@cimulate/copilot-widget 1.53.2 → 1.54.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- (function(M,q){typeof exports=="object"&&typeof module!="undefined"?q(exports):typeof define=="function"&&define.amd?define(["exports"],q):(M=typeof globalThis!="undefined"?globalThis:M||self,q(M.CimulateO11ySdk={}))})(this,(function(M){"use strict";var wr=Object.defineProperty;var st=Object.getOwnPropertySymbols;var Er=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable;var nt=(M,q,B)=>q in M?wr(M,q,{enumerable:!0,configurable:!0,writable:!0,value:B}):M[q]=B,ot=(M,q)=>{for(var B in q||(q={}))Er.call(q,B)&&nt(M,B,q[B]);if(st)for(var B of st(q))Ar.call(q,B)&&nt(M,B,q[B]);return M};var G=(M,q,B)=>new Promise((de,ie)=>{var ce=$=>{try{K(B.next($))}catch(z){ie(z)}},he=$=>{try{K(B.throw($))}catch(z){ie(z)}},K=$=>$.done?de($.value):Promise.resolve($.value).then(ce,he);K((B=B.apply(M,q)).next())});const q={namespace:"sf.instrumentation",name:"PayloadDiags",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{PayloadDiags:{fields:{extras:{rule:"repeated",id:1,type:"string"}}}}}}}}}},B={namespace:"sf.instrumentation",name:"IdleDetectorReport",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{IdleDetectorReport:{fields:{listenerCount:{id:3,type:"uint32"},busyTasks:{rule:"repeated",id:5,type:"string"},busyDurations:{rule:"repeated",id:6,type:"double"},pollableCount:{id:4,type:"uint32"},pollCounts:{rule:"repeated",id:8,type:"double"},logThreshold:{id:2,type:"double"},maxDuration:{id:1,type:"double"},pollables:{rule:"repeated",id:7,type:"string"}}}}}}}}}},de={namespace:"sf.instrumentation",name:"InstrumentedEvent",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MouseEvent:{reserved:[[6,6],[7,7],[15,15],[16,16],[17,17],[18,18],[19,19],[20,20],[21,21],[22,22]],fields:{cancelable:{id:5,type:"bool"},ctrlKey:{id:9,type:"bool"},type:{id:25,type:"string"},button:{id:3,type:"uint32"},offsetX:{id:30,type:"double"},eventPhase:{id:12,type:"uint32"},shiftKey:{id:23,type:"bool"},offsetY:{id:31,type:"double"},composed:{id:8,type:"bool"},altKey:{id:1,type:"bool"},isTrusted:{id:13,type:"bool"},buttons:{id:4,type:"uint32"},movementY:{id:29,type:"double"},clientY:{id:27,type:"double"},clientX:{id:26,type:"double"},movementX:{id:28,type:"double"},defaultPrevented:{id:10,type:"bool"},metaKey:{id:14,type:"bool"},timeStamp:{id:24,type:"double"},bubbles:{id:2,type:"bool"},detail:{id:11,type:"int64"},pageY:{id:33,type:"double"},pageX:{id:32,type:"double"},screenX:{id:34,type:"double"},screenY:{id:35,type:"double"}}},Event:{fields:{type:{id:1,type:"string"}}},InstrumentedEvent:{oneofs:{event:{oneof:["mouseEvent","baseEvent"]}},reserved:[[4,4],"xpath",[6,6],[8,8]],fields:{mouseEvent:{id:7,type:"MouseEvent"},auto:{id:3,type:"bool"},parentComponent:{id:2,type:"string"},baseEvent:{id:10,type:"Event"},ownerComponent:{id:1,type:"string"},userPayload:{id:5,type:"Payload"},simplePath:{id:9,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},ie={namespace:"sf.instrumentation",name:"Network",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Network:{fields:{mtd:{id:1,type:"string"},url:{id:2,type:"string"}}}}}}}}}},ce={namespace:"sf.instrumentation",name:"Activity",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Activity:{reserved:[[5,5],[7,7]],fields:{stopReason:{id:6,type:"string"},externalParentId:{id:17,type:"string"},isRoot:{id:8,type:"bool"},isExternal:{id:16,type:"bool"},isSampled:{id:11,type:"bool"},preRootId:{id:9,type:"string"},parentId:{id:13,type:"string"},duration:{id:3,type:"double"},timerOverridden:{id:12,type:"uint32"},isRerooted:{id:15,type:"bool"},name:{options:{"(meta.max_length)":25},id:2,type:"string"},traceIdSource:{id:14,type:"string"},id:{id:1,type:"string"},userPayload:{id:4,type:"Payload"},errorCount:{id:10,type:"uint32"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},he={pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MessageBundle:{fields:{messages:{rule:"repeated",id:2,type:"LogMessage"},schemaName:{id:1,type:"string"}}},Metrics:{fields:{globalMetricTags:{rule:"repeated",id:4,type:"MetricTag"},bucketHistograms:{rule:"repeated",id:3,type:"BucketHistogram"},valueRecorders:{rule:"repeated",id:2,type:"ValueRecorder"},upCounters:{rule:"repeated",id:1,type:"UpCounter"}}},CoreEnvelopeDiagnostics:{fields:{schemaVersion:{id:6,type:"string"},generatedTimestamp:{id:2,type:"double"},bundleCount:{id:3,type:"uint32"},upCounterCount:{id:4,type:"uint32"},valueRecorderCount:{id:5,type:"uint32"},key:{id:1,type:"string"},bucketHistogramCount:{id:7,type:"uint32"}}},LogMessage:{fields:{data:{id:2,type:"bytes"},rootId:{id:4,type:"string"},csId:{id:12,type:"string"},recCsId:{id:13,type:"string"},pagePayload:{id:7,type:"Payload"},connectionType:{id:9,type:"string"},appPayload:{id:10,type:"Payload"},tenantClass:{id:15,type:"string"},loggerAppName:{id:8,type:"string"},sseq:{id:11,type:"uint32"},recRootId:{id:14,type:"string"},loggerName:{id:6,type:"string"},age:{id:3,type:"double"},seq:{id:5,type:"uint32"},timestamp:{id:1,type:"double"}}},CoreEnvelope:{fields:{diagnostics:{id:1,type:"CoreEnvelopeDiagnostics"},bundles:{rule:"repeated",id:2,type:"MessageBundle"},metrics:{id:3,type:"Metrics"},staticAttributes:{id:4,type:"StaticAttributes"}}},MetricTag:{fields:{name:{id:1,type:"string"},value:{id:2,type:"string"}}},BucketHistogram:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:7,type:"string"},ownerAppName:{id:8,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},buckets:{rule:"repeated",id:5,type:"uint32"},name:{id:1,type:"string"},tags:{rule:"repeated",id:6,type:"MetricTag"}}},ValueRecorder:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},name:{id:1,type:"string"},tags:{rule:"repeated",id:5,type:"MetricTag"}}},StaticAttributes:{fields:{appVersion:{id:2,type:"string"},appName:{id:1,type:"string"},deviceModel:{id:5,type:"string"},sdkVersion:{id:6,type:"string"},deviceId:{id:4,type:"string"},appExperience:{id:3,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}},UpCounter:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},name:{id:1,type:"string"},value:{id:4,type:"uint32"},tags:{rule:"repeated",id:5,type:"MetricTag"}}}}}}}}}},K={namespace:"sf.instrumentation",name:"Simple",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Simple:{fields:{text:{options:{"(meta.max_length)":25},id:1,type:"string"}}}}}}}}}},$={namespace:"sf.instrumentation",name:"Error",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Error:{reserved:[[5,5],[7,7]],fields:{activityId:{id:6,type:"string"},stack:{id:3,type:"string"},name:{id:1,type:"string"},message:{options:{"(meta.max_length)":200},id:2,type:"string"},userPayload:{id:4,type:"Payload"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}};class z{constructor(){this.notImplemented="Method not implemented.";const e=typeof performance!="undefined";e?performance.timeOrigin?this._timeOrigin=performance.timeOrigin:this._timeOrigin=Date.now():this._timeOrigin=Date.now();const r=this._timeOrigin;e&&typeof performance.now=="function"?(this.perfNow=performance.now.bind(performance),this.time=()=>{const t=this.perfNow();return{tsNow:r+t,perfNow:t,timeOrigin:r}}):(this.perfNow=()=>Date.now()-r,this.time=()=>{const t=this.perfNow();return{tsNow:Date.now(),perfNow:t,timeOrigin:r}})}get isProduction(){return z._isProduction}markProduction(e){z._isProduction=e!=null?e:!0}_checkArgument(e,r){if(typeof r=="string")return typeof e===r;if(typeof r=="function")return e instanceof r;if(Array.isArray(r))return r.some(t=>this._checkArgument(e,t));throw new Error(`Invalid argKind ${r}`)}requireArgument(e,r,t){let a=e==null||e==="";const u=t!==void 0;if(!a&&u&&(a=!this._checkArgument(e,t)),a)throw new Error(`${r} argument is required${u?" and must be of a supported type.":"."}`)}requireArgumentIfDefined(e,r,t){if(e===void 0)return!1;if(e===null||e===""||!this._checkArgument(e,t))throw new Error(`${r} argument, if defined, must be of a supported type.`);return!0}checkForDenyListedValues(e,r,t){if(t.some(a=>e===a))throw new Error(`The value ${e} isn't allowed for ${r} argument.`)}checkForReservedCharacters(e,r,t){if(e&&t.some(a=>e.indexOf(a)>=0))throw new Error(`The argument ${r} isn't allowed to contain characters from ['${t.join(", ")}']. Received: ${e}.`)}generateUniqueId(e=16){const r=[],t="0123456789abcdef";if(!(e===void 0||e>0))throw new Error('If specified, the argument "length" must be a positive integer');for(let a=0;a<e;a++){const u=Math.floor(Math.random()*16);r.push(t[u])}return r.join("")}getXpath(e){function r(u){const i=u.localName;for(;u.nextElementSibling;)if(u=u.nextElementSibling,u.localName===i)return!0;return!1}function t(u,i){return u?t(u.previousElementSibling,i||u.localName)+(u.localName===i?1:0):1}function a(u){if(!u||u.nodeType!==1)return[""];const i=t(u)>1||r(u)?`${u.localName.toLowerCase()}[${t(u)}]`:u.localName.toLowerCase();return[...a(u.parentNode),i]}return a(e).join("/")}getAge(e){return e-this._timeOrigin}_getNavigatorSafe(){try{return typeof navigator!="undefined"?navigator:void 0}catch(e){return}}_hasEffectiveConnectionType(e){if(typeof e!="object"||e===null||!("connection"in e))return!1;const r=e.connection;return typeof r=="object"&&r!==null&&"effectiveType"in r&&typeof r.effectiveType=="string"}getConnectionType(){const e=this._getNavigatorSafe();return this._hasEffectiveConnectionType(e)?e.connection.effectiveType:void 0}clone(e){return JSON.parse(JSON.stringify(e))}definedValueOrDefault(e,r){return e!==void 0?e:r}getGlobal(){if(typeof globalThis=="object")return globalThis;if(typeof self=="object")return self;throw new Error("Unable to locate globalThis or self")}getIsBeaconSupported(){const e=this.getGlobal(),r=this._getNavigatorSafe();return typeof(r==null?void 0:r.sendBeacon)=="function"&&typeof e.Blob=="function"}estimateObjectSize(e){const r=new Set,t=[e];let a=0;for(;t.length;){const u=t.pop();if(typeof u=="boolean")a+=4;else if(typeof u=="string")a+=u.length*2;else if(typeof u=="number")a+=8;else if(u instanceof Uint8Array||u instanceof Uint8ClampedArray||u instanceof Uint16Array||u instanceof Uint32Array||u instanceof Int8Array||u instanceof Int16Array||u instanceof Int32Array||u instanceof Float32Array||u instanceof Float64Array)a+=u.byteLength;else if(typeof u=="object"){const i=u;if(!r.has(i)){r.add(i);for(const c in i)t.push(i[c])}}}return a}noProdThrow(e){if(!E.isProduction)throw e}isAllowedOrigin(e,r){return Array.isArray(r)&&r.some(t=>t==="*"||e===t||t instanceof RegExp&&t.test(e))}roundNumber(e,r){const t=Math.pow(10,r);return Math.round(e*t)/t}roundNumbersInObject(e,r){e&&Object.entries(e).forEach(([t,a])=>{typeof a=="number"&&(e[t]=this.roundNumber(a,r))})}tryGetAbsoluteUrl(e){var r,t;return e!=null&&e.startsWith("//")&&typeof window=="object"?((r=window.location.protocol)!==null&&r!==void 0?r:"")+e:e!=null&&e.startsWith("/")&&typeof window=="object"?((t=window.location.origin)!==null&&t!==void 0?t:"")+e:e}validateParentActivityType(e,r){const t=e!=null?e:!1;if(!r)return;const a=r.isExternal();if(t===a)return r;{const u=t?"external":"internal",i=a?"external":"internal";throw new Error(`Parent activity type mismatch: ${u} activity cannot have ${i} parent.`)}}}z._isProduction=!0;const pe=new z,fe=pe.getGlobal();pe.markProduction(fe==null?void 0:fe.__O11Y_IS_PROD__);const E=Object.freeze(pe);class me{constructor(e,r,t,a,u,i,c){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=a,this._value=0,this._createdOn=u===void 0?E.time().tsNow:u,i!==void 0&&(this._lastUpdatedOn=i),c!==void 0&&(this._value=c)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this._value}increment(e=1){if(typeof e=="number"&&e>0){this._value+=Math.round(e),this._lastUpdatedOn=E.time().tsNow;return}throw new Error("UpCounter can only increment positive numbers.")}reset(){this._lastUpdatedOn=void 0,this._value=0}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}const at="co11y";class lt{constructor(){this._upCounters=new Map,this._ownerAppName=at}_addOrUpdateCounter(e,r,t){if(!e)return;const a={status:t},u=`${this._ownerAppName}:${r}:${e}${JSON.stringify(a)}`;let i=this._upCounters.get(u);i||(i=new me(e,r,this._ownerAppName,a),this._upCounters.set(u,i)),i.increment()}success(e,r){this._addOrUpdateCounter(e,r,"success")}exception(e,r){this._addOrUpdateCounter(e,r,"error")}getBucketHistograms(){return[]}getUpCounters(){return Array.from(this._upCounters.values()).filter(e=>e.getLastUpdatedOn())}getValueRecorders(){return[]}setOwnerAppName(e){this._ownerAppName=e}}const W=new lt;class ut{constructor(e){if(this._lazyMap=new Map,e!==void 0){if(typeof e=="number"&&e>0){this._maxSize=Math.ceil(e);return}throw new Error("maxSize must be a positive number")}}get maxSize(){return this._maxSize}get size(){return this._lazyMap.size}push(e,r){let t=this._lazyMap.get(e);if(!t){if(this.maxSize!==void 0&&this.size===this.maxSize)return!1;t=new Array,this._lazyMap.set(e,t)}return t.push(r),!0}getMessages(e,r){const t=this._lazyMap.get(e);return r&&this._lazyMap.has(e)&&this._lazyMap.set(e,[]),t||[]}getAllMessages(e){const r=new Map;for(const[t,a]of this._lazyMap.entries())a.length&&r.set(t,this.getMessages(t,e));return r}extractMessages(e){return this.getMessages(e,!0)}extractAllMessages(){return this.getAllMessages(!0)}get totalItemCount(){let e=0;for(const r of this._lazyMap.values())e+=r.length;return e}}class dt{getSchemaId(e){return`${e.namespace}.${e.name}`}isInternal(e){return(e==null?void 0:e.namespace)==="sf.instrumentation"}makePayload(e,r,t=!0){if(!t||e!==void 0&&r!==void 0)return{schema:e,payload:r}}checkSchema(e){return E.requireArgument(e,"schema","object"),E.requireArgument(e.namespace,"schema.namespace","string"),E.requireArgument(e.name,"schema.name","string"),E.requireArgument(e.pbjsSchema,"schema.pbjsSchema","object"),this._getTokens(e)}_getTokens(e){const r=e.namespace.split(".");if(r.length!==2)throw new Error(`Schema "${this.getSchemaId(e)}" must have a namespace of the form "domain.feature".`);return{domain:r[0],feature:r[1],message:e.name}}_getAnyNestedObject(e,r){return r.reduce((t,a)=>{const u=t.nested;if(u){const i=u[a];if(i)return i}throw new Error(`Cannot locate ${r.join(".")} in schema with ID ${this.getSchemaId(e)}`)},e.pbjsSchema)}getTypes(e){const r=this.checkSchema(e),a=this._getAnyNestedObject(e,[r.domain,r.feature]).nested;if(!a)throw new Error(`Cannot parse schema with ID ${this.getSchemaId(e)}`);return a}getType(e,r){E.requireArgument(r,"messageName","string");const a=this.getTypes(e)[r];if(!a)throw new Error(`Cannot locate message ${r} in schema with ID ${this.getSchemaId(e)}`);return a}getOptions(e,r,t){t&&E.requireArgument(r,"messageName","string");const a=this.checkSchema(e);if(!r)return this._getAnyNestedObject(e,[a.domain,a.feature]).options;const u=this.getType(e,r);if(!t)return u.options;const i=u.fields[t];if(!i){const c=this.getSchemaId(e);throw new Error(`Cannot locate field ${t} in message ${r} in schema with ID ${c}`)}return i.options}getExtraFields(e,r){const{message:t}=this._getTokens(e),u=this.getTypes(e)[t].fields,i=new Set(Object.keys(u));return r!=null?Object.keys(r).filter(p=>!i.has(p)):[]}}const D=new dt,ye=1e4,ke=1e4,Se=0,Oe=2147483647,Ce=-2147483648,ct=4294967295,ht=9223372036854776e3,pt=-9223372036854776e3,ft=18446744073709552e3;class Ie{constructor(e,r,t,a){this.errorCode=e,this.fields=r,this.expected=t,this.received=a}asMessage(e){const r=this.fields[0]+this.fields.slice(1).reduce((a,u)=>Number(u)>=0?`${a}[${u}]`:`${a}.${u}`,"");let t;switch(this.errorCode){case 1:t="Repeated field must be an array";break;case 2:t=`Expected type ${this.expected} but received type ${this.received}`;break;case 3:t="Value must be finite";break;case 4:t="Value is out of range for its type";break;case 5:t="Bytes array is malformed";break;case 6:t="Exceeded app limit for maximum string length";break;case 7:t="Exceeded app limit for item count";break;case 12:t="Value must be an integer";break;case 13:t="Values like null or undefined are not allowed for items in repeated fields";break;default:t=`Unknown error code: ${this.errorCode}`;break}return`Schema ${e} on field "${r}": ${t}`}}class mt{validate(e,r,t=!1){const a=D.checkSchema(e);E.requireArgument(r,"data","object");const u=D.getSchemaId(e),i=new Array,c=D.getTypes(e);if(this._validateFields(i,[],r,c[a.message],e.pbjsSchema.nested,u,[a.domain,a.feature,a.message]),i.length&&!t)throw new Error(i[0].asMessage(u));return i}_validateFields(e,r,t,a,u,i,c){const p=a.oneofs||{},h=a.fields||{};for(const s in t){const o=t[s];if(o!=null){const l=(n,d,y)=>this._matchFieldTypes(e,[...r,s],o,n,u,i,c,d,y);p[s]?l(h[p[s].oneof[0]].type):h[s]&&l(h[s].type,h[s].rule==="repeated")}}}_matchFieldTypes(e,r,t,a,u,i,c,p,h){let s;if(p)Array.isArray(t)?(t.length>ke&&(s=7),t.forEach((o,l)=>{this._matchFieldTypes(e,[...r,l.toString()],o,a,u,i,c,void 0,!0)})):s=1;else if(t==null||t===void 0)h&&(s=13);else{let o,l,n;switch(a){case"string":l="string",t.length>ye&&(s=6);break;case"bytes":l="object",t instanceof Uint8Array||(s=5);break;case"bool":l="boolean";break;case"uint32":l="number",o={min:Se,max:ct,isInt:!0,isItem:h};break;case"int32":case"sint32":case"fixed32":case"sfixed32":l="number",o={min:Ce,max:Oe,isInt:!0,isItem:h};break;case"uint64":l="number",o={min:Se,max:ft,isInt:!0,isItem:h};break;case"fixed64":case"sfixed64":case"int64":case"sint64":l="number",o={min:pt,max:ht,isInt:!0,isItem:h};break;case"double":case"float":l="number",o={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,isInt:!1,isItem:h};break;default:{const d=a.startsWith("."),y=(d?a.slice(1):a).split(".");let f,_;for(let m=d?0:c.length;m>=0;m--){_=[...c.slice(0,m),...y];let v=u;f=void 0;for(const A of _)f=v==null?void 0:v[A],v=f&&"nested"in f?f.nested:void 0;if(f)break}f&&"values"in f?(l="number",n=Object.values(f.values),o={min:Ce,max:Oe,isInt:!0,isItem:h}):f&&"fields"in f&&(this._validateFields(e,r,t,f,u,i,_),l="object");break}}typeof t!==l?e.push(new Ie(2,r,a,typeof t)):o&&(o.isInt&&!Number.isFinite(t)?s=3:o.isInt&&!Number.isInteger(t)?s=12:(!(!o.isInt&&Number.isNaN(t))&&!(t>=o.min&&t<=o.max)||n&&!n.includes(t))&&(s=4))}s&&e.push(new Ie(s,r))}}const Te=new mt;class yt{_getMetricTags(e){const r=e.getTags();if(r)return Object.entries(r).map(t=>({name:t[0],value:t[1].toString()}))}getUpCounters(e,r=!0){return e.map(t=>{const a={name:t.getName(),createdTimestamp:t.getCreatedOn(),lastUpdatedTimestamp:t.getLastUpdatedOn(),value:t.getData(),ownerName:t.getOwnerName(),ownerAppName:t.getOwnerAppName(),tags:this._getMetricTags(t)};return r&&t.reset(),a})}getValueRecorders(e,r=!0){return e.map(t=>{const a={name:t.getName(),createdTimestamp:t.getCreatedOn(),lastUpdatedTimestamp:t.getLastUpdatedOn(),values:t.getData(),ownerName:t.getOwnerName(),ownerAppName:t.getOwnerAppName(),tags:this._getMetricTags(t)};return r&&t.reset(),a})}getBucketHistograms(e,r=!0){return e.map(t=>{const a={name:t.getName(),createdTimestamp:t.getCreatedOn(),lastUpdatedTimestamp:t.getLastUpdatedOn(),values:t.getData(),buckets:t.getBuckets(),ownerName:t.getOwnerName(),ownerAppName:t.getOwnerAppName(),tags:this._getMetricTags(t)};return r&&t.reset(),a})}getMetricsTags(e){const r={};return e.forEach(t=>{r[t.name]=t.value}),r}}const V=Object.freeze(new yt);class gt{checkInputs(e,r){D.checkSchema(e),E.requireArgument(r,"data","object");let t,a;r.userPayload!==void 0&&D.isInternal(e)&&(a=r.userPayload,t=Te.validate(a.schema,a.payload,!0),this._processValidationResults(D.getSchemaId(a.schema),a.payload,t),r.userPayload=void 0),t=Te.validate(e,r,!0),this._processValidationResults(D.getSchemaId(e),r,t),a!==void 0&&(r.userPayload=a)}getExtraFields(e,r){E.requireArgument(r,"data","object");const t=[],a=r.userPayload;return a!==void 0&&D.isInternal(e)&&t.push(...D.getExtraFields(a.schema,a.payload)),t.push(...D.getExtraFields(e,r)),t}getPayloadFromProvider(e,r){const t=(e==null?void 0:e.getPayload(r))||void 0;return t&&this.checkInputs(t.schema,t.payload),t}_processValidationResults(e,r,t){for(let a=0;a<t.length;a+=1){const u=t[a];if(u.errorCode==6||u.errorCode==7){const i=u.fields.length-1,c=this._traverseFields(r,u.fields.slice(0,i)),p=u.fields[i];u.errorCode==6?c[p]=c[p].substring(0,ye):c[p].splice(ke)}else throw new Error(u.asMessage(e))}}_traverseFields(e,r){return r.length?this._traverseFields(e[r[0]],r.slice(1)):e}}const se=Object.freeze(new gt),Ne="o11y";class xe{constructor(e){this._errorCounter=e,this._safeCatchMode=!1}_callCo11y(e,r){r?W.exception(e==null?void 0:e.op,Ne):W.success(e==null?void 0:e.op,Ne)}tryCatch(e,r){let t;try{e()}catch(a){t=!0,this._prodSafeCatch(a)}finally{this._callCo11y(r,t)}}tryCatchReturn(e,r,t){let a;try{return E.requireArgument(r,"noopValue"),e()}catch(u){return a=!0,this._prodSafeCatch(u),r}finally{this._callCo11y(t,a)}}_prodSafeCatch(e){let r;try{if(r=!E.isProduction,r)throw e;if(this._safeCatchMode)throw this._safeCatchMode=!1,new Error("Internal error in prodSafeCatch.");if(this._safeCatchMode=!0,this._errorCounter&&this._errorCounter.increment(),!(e instanceof Error)){const t=e&&e.message||(typeof e.toString=="function"?e.toString():"");e=new Error(t)}this._safeCatchMode=!1}catch(t){if(r)throw t;if(t&&console&&typeof console.error=="function")try{console.error(t)}catch(a){}this._safeCatchMode=!1}}}const vt=Symbol("o11y.stampTenantClass");class _t{get isBusy(){return this._isOk?this._busyCount>0:void 0}constructor(e,r,t,a){this.name=e,this._doneCallback=t,this._overDoneCallback=a,this._busyCount=0,this._isOk=!0,this._busyCount=r}add(){this._isOk&&(this._busyCount+=1)}done(){this._isOk&&(this._busyCount>0?(this._busyCount-=1,this._busyCount||this._doneCallback()):(this._isOk=!1,this._overDoneCallback()))}}const bt=300;class wt{constructor(e){this._taskers=new Map,this._listeners=new Set,this._busyCheckers=new Map,this._logThreshold=bt,this._endedTasks=new Array,this._pollableReport=new Array,E.requireArgumentIfDefined(e==null?void 0:e.logThreshold,"options.logThreshold","number")&&(this._logThreshold=e.logThreshold),E.requireArgumentIfDefined(e==null?void 0:e.reportListener,"options.reportListener","function")&&(this._reportListener=e.reportListener),E.requireArgumentIfDefined(e==null?void 0:e.errorListener,"options.errorListener","function")&&(this._errorListener=e.errorListener)}requestIdleDetectedCallback(e){E.requireArgument(e,"callback","function"),this._listeners.size===0&&(this._firstCallbackTime=E.time().perfNow),this._listeners.add(e),this._checkIfLoaded()}_reportTaskEnded(e){if(this._listeners.size){const r=Object.assign({},this._taskers.get(e));this._endedTasks.push(r)}}declareNotifierTaskSingle(e){E.requireArgument(e,"name","string");const r=this._addTasker(e,1);return{get isBusy(){return r.isBusy},done:()=>{r.done(),this._taskers.delete(r)}}}declareNotifierTaskMulti(e,r=0){if(E.requireArgument(e,"name","string"),r!==void 0&&(E.requireArgument(r,"existingBusyCount","number"),!Number.isInteger(r)||r<0))throw new Error("existingBusyCount accepts only non-negative integers");const t=this._addTasker(e,r);return{get isBusy(){return t.isBusy},add:()=>{if(!t.isBusy){const u=this._taskers.get(t);u.start=E.time().perfNow,u.end=void 0}t.add()},done:t.done.bind(t)}}declarePollableTaskMulti(e,r){E.requireArgument(e,"name","string"),E.requireArgument(r,"isBusyChecker","function"),this._busyCheckers.set(r,e)}_addTasker(e,r){const t=new _t(e,r,()=>{this._taskers.get(t).end=E.time().perfNow,this._reportTaskEnded(t),this._checkIfLoaded()},()=>{var a;(a=this._errorListener)===null||a===void 0||a.call(this,`Overdone: ${t.name}`),E.noProdThrow(`Tasker '${t.name}' is done too many times.`)});return this._taskers.set(t,{name:e,start:r>0?E.time().perfNow:void 0,end:void 0}),t}_areAllNotifiersIdle(){return!Array.from(this._taskers.keys()).some(e=>e.isBusy)}_getFirstBusyPollable(){const e=Array.from(this._busyCheckers).find(r=>{var t;const a=r[0],u=r[1];try{return a()}catch(i){return(t=this._errorListener)===null||t===void 0||t.call(this,i,`BusyChecker ${u}`),E.noProdThrow(i),!1}});return e?e[1]:void 0}_checkIfLoaded(){this._listeners.size&&(this._timerCheckQueued&&clearTimeout(this._timerCheckQueued),this._areAllNotifiersIdle()&&(this._timerCheckQueued=setTimeout(()=>{this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},40)},0)))}_doubleCheck(){if(this._timerCheckQueued=void 0,this._areAllNotifiersIdle()){const e=this._getFirstBusyPollable();if(e!==void 0)this._addToPollableReport(e),this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},15);else{const r=E.time().perfNow-this._firstCallbackTime,t=Array.from(this._listeners.values());this._listeners.clear(),this._firstCallbackTime=void 0;const a=this._endedTasks.splice(0),u=this._pollableReport.splice(0);this._notify(t,r,a,u)}}}_addToPollableReport(e){const r=this._pollableReport.length?this._pollableReport[this._pollableReport.length-1]:void 0;(r==null?void 0:r.name)===e?r.count+=1:this._pollableReport.push({name:e,count:1})}_notify(e,r,t,a){var u;if(r>=this._logThreshold&&this._reportListener){const c=this._getReport(r,e.length,t,a);this._reportListener(c)}e.reverse();const i=E.time().tsNow;for(const[c,p]of e.entries())try{p(i)}catch(h){(u=this._errorListener)===null||u===void 0||u.call(this,h,`Listener #${e.length-1-c}`),E.noProdThrow(h)}}getReport(){const e=E.time().perfNow,r=this._firstCallbackTime>0?e-this._firstCallbackTime:void 0,t=Array.from(this._taskers.entries()).filter(a=>a[0].isBusy).map(a=>({name:a[1].name,start:a[1].start,end:e}));return this._getReport(r,this._listeners.size,this._endedTasks.concat(t),this._pollableReport)}_getReport(e,r,t,a){const u=t.map(i=>({name:i.name,duration:i.end-i.start})).sort((i,c)=>c.duration-i.duration);return{logThreshold:this._logThreshold,maxDuration:e,listenerCount:r,pollableCount:this._busyCheckers.size,busyTasks:u.map(i=>i.name),busyDurations:u.map(i=>i.duration),pollables:a.map(i=>i.name),pollCounts:a.map(i=>i.count)}}}const Et={namespace:"sfcore.performance",name:"ResourceTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{ResourceTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"}}}}}}}}}},At={namespace:"sfcore.performance",name:"NavigationTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{NavigationTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{redirectCount:{id:37,type:"uint32"},encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},unloadEventEnd:{id:40,type:"double"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},unloadEventStart:{id:39,type:"double"},domContentLoadedEventStart:{id:32,type:"double"},type:{id:38,type:"string"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},domContentLoadedEventEnd:{id:33,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domInteractive:{id:34,type:"double"},domComplete:{id:31,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},logEvent:{id:41,type:"string"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},loadEventStart:{id:35,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"},loadEventEnd:{id:36,type:"double"}}}}}}}}}};class kt{constructor(e){this._fuzzyKeyRange=e,this._map=new Map,E.requireArgument(e,"_fuzzyKeyRange","number")}add(e,r,t){const a=this._map.get(e);a?a.push({fuzzyKey:r,value:t}):this._map.set(e,[{fuzzyKey:r,value:t}])}pop(e,r){const t=this._map.get(e);if((t==null?void 0:t.length)>=1){let a=Number.POSITIVE_INFINITY,u=-1;for(let i=0;i<t.length;i++){const{fuzzyKey:c}=t[i],p=Math.abs(c-r);p<=this._fuzzyKeyRange&&p<a&&(a=p,u=i)}if(u>=0){const{value:i}=t.splice(u,1)[0];return t.length===0&&this._map.delete(e),i}}}clear(){this._map.clear()}}const St=["fetch","xmlhttprequest"];class Ot{constructor(e,r,t,a,u){if(this._instr=e,this._skipUrls=t,this._logPerformanceActivityName=a,this._boundObserverCallback=this._logPerformanceEntries.bind(this),this._boundNavigationTimingEventCallback=i=>{this._logNavigationEntries(i)},this._setTimeoutNavigationCallback=i=>{setTimeout(()=>{this._boundNavigationTimingEventCallback(i)},0)},this._visibilityChangeNavigationCallback=i=>{document.visibilityState==="hidden"&&this._boundNavigationTimingEventCallback(i)},this._isStarted=!1,this._processedNavigationTiming=!1,E.requireArgument(e,"_instr","object"),E.requireArgument(r,"fuzzyMapRange","number"),E.requireArgumentIfDefined(t,"_skipUrls",Array),E.requireArgumentIfDefined(a,"_logPerformanceActivityName","string"),E.requireArgumentIfDefined(u,"logLevel","string"),this._hasPerf=typeof performance!="undefined"&&typeof PerformanceObserver=="function",this._hasWindow=typeof window!="undefined",!u||u.toLowerCase()==="full")this._logLevel=1;else if((u==null?void 0:u.toLowerCase())==="basic")this._logLevel=0;else throw new Error(`Invalid log level: ${u}`);this._fuzzyMapper=new kt(r)}get isStarted(){return this._isStarted}get logLevel(){return this._logLevel}start(){this._hasPerf&&(this._isStarted||(this._isStarted=!0,this._resourceObserver=new PerformanceObserver(this._boundObserverCallback),this._resourceObserver.observe({type:"resource",buffered:!0}),this._addNavigationListeners()))}stop(){this._resourceObserver&&(this._resourceObserver.disconnect(),this._resourceObserver=void 0),this._removeNavigationListeners(),this._fuzzyMapper.clear(),this._isStarted=!1}_addNavigationListeners(){this._hasWindow&&(window.addEventListener("load",this._setTimeoutNavigationCallback),window.addEventListener("pagehide",this._boundNavigationTimingEventCallback),document.addEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}_removeNavigationListeners(){this._hasWindow&&(window.removeEventListener("load",this._setTimeoutNavigationCallback),window.removeEventListener("pagehide",this._boundNavigationTimingEventCallback),document.removeEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}addEntry(e,r,t){this._fuzzyMapper.add(e,r,t)}_resourceEntryToResourceTiming(e){var r,t;const a={name:e.name,startTime:e.startTime,duration:e.duration,initiatorType:e.initiatorType,nextHopProtocol:e.nextHopProtocol,renderBlockingStatus:e.renderBlockingStatus,workerStart:e.workerStart,redirectStart:e.redirectStart,redirectEnd:e.redirectEnd,fetchStart:e.fetchStart,domainLookupStart:e.domainLookupStart,domainLookupEnd:e.domainLookupEnd,connectStart:e.connectStart,secureConnectionStart:e.secureConnectionStart,connectEnd:e.connectEnd,requestStart:e.requestStart,responseStart:e.responseStart,firstInterimResponseStart:e.firstInterimResponseStart,responseEnd:e.responseEnd,transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,responseStatus:e.responseStatus},u=e.serverTiming;return Array.isArray(u)&&(a.dbDuration=(r=u.find(i=>i.name==="db"))===null||r===void 0?void 0:r.duration,a.srvDuration=(t=u.find(i=>i.name==="Total"))===null||t===void 0?void 0:t.duration),a}_shouldInclude(e){var r;return((r=this._skipUrls)===null||r===void 0?void 0:r.some(a=>a instanceof RegExp?a.test(e.name):e.name===a))?!1:this._logLevel===1?!0:St.indexOf(e.initiatorType)>=0||e.entryType==="navigation"}_calculateXhrDelay(e,r){if(r){if(e.initiatorType==="fetch"){if(e.responseStart===0)return-1;if(r.activityDuration!==void 0){const t=e.responseStart-e.startTime;return r.activityDuration-t}return}if(r.activityDuration!==void 0)return r.activityDuration-e.duration}}_logActivity(e,r,t,a){const u={id:t},i={perfStartOverride:r.startTime,perfStopOverride:r.startTime+r.duration,errorCount:a};this._instr.startActivity(this._logPerformanceActivityName,u).stop(e,r,i)}_logNavigationEntries(e){if(!this._processedNavigationTiming)for(const r of performance.getEntriesByType("navigation")){const t=r;if(this._shouldInclude(t)){this._processedNavigationTiming=!0;const a=this._resourceEntryToResourceTiming(t),u={domComplete:t.domComplete,domContentLoadedEventStart:t.domContentLoadedEventStart,domContentLoadedEventEnd:t.domContentLoadedEventEnd,domInteractive:t.domInteractive,loadEventStart:t.loadEventStart,loadEventEnd:t.loadEventEnd,redirectCount:t.redirectCount,type:t.type,unloadEventStart:t.unloadEventStart,unloadEventEnd:t.unloadEventEnd,logEvent:e.type};this._logActivity(At,Object.assign(a,u))}break}}_logPerformanceEntries(e){for(const r of e.getEntriesByType("resource")){const t=r,a=this._fuzzyMapper.pop(t.name,t.startTime);if(this._shouldInclude(t)){const u=this._resourceEntryToResourceTiming(t);Object.assign(u,{srvReqId:a==null?void 0:a.requestId,xhrDelay:this._calculateXhrDelay(t,a)}),u.responseStatus===void 0&&(u.responseStatus=a==null?void 0:a.responseStatus),this._logActivity(Et,u,a==null?void 0:a.activityId,a==null?void 0:a.errorCount)}}}}const Ct=32,It=16,je=16,Tt="traceparent",Nt="b3",Pe="X-B3-TraceId",Re="X-B3-SpanId",Le="X-B3-Sampled",De="X-B3-ParentSpanId",Me="X-SFDC-Request-Id",xt="baggage",jt="fetch",Pt="xhr_send",Rt="perf-timing",Lt=50,Dt=[xt,Pe,Re,De,Le],J=new WeakMap;class C{constructor(e,r){this._instr=e,this._idleDetector=r,E.requireArgument(e,"_instr","object"),E.requireArgument(r,"_idleDetector","object")}static _getB3CompactFormat(e,r,t,a){let u=`${e}-${r}`;return(t!==void 0||a!==void 0)&&(u+=t?"-1":"-0",a!==void 0&&(u+=`-${a}`)),u}static _getW3CompactFormat(e,r,t){return`00-${e}-${r}-${t?"01":"00"}`}static _conformTextAsId(e,r){e=e.toLowerCase();const t=e.length;for(let a=0;a<t;a+=1){const u=e[a];if(!(u>="a"&&u<="f")&&!(u>="0"&&u<="9"))throw new Error(`The text '${e}' has an invalid character at index #${a}`)}return t>r?e.substr(t-r):t<r?e.padStart(r,"0"):e}static setHeaders(e){if(e===void 0){C._userHeaders={};return}Object.entries(e).forEach(([r])=>{Dt.includes(r)||delete e[r]}),C._userHeaders=e}static getHeaders(e,r,t,a){E.requireArgument(r,"spanId","string");const u=a==null?void 0:a.useB3Headers,i={};if(e===void 0)return i;e=this._conformTextAsId(e,(a==null?void 0:a.traceIdEffectiveLength)!==void 0?a.traceIdEffectiveLength:u?It:Ct),r=this._conformTextAsId(r,je);const c=a&&a.parentSpanId!==void 0&&this._conformTextAsId(a.parentSpanId,je)||void 0;return u?(a==null?void 0:a.useCompactHeader)?i[Nt]=this._getB3CompactFormat(e,r,t,c):(i[Pe]=e,i[Re]=r,c!==void 0&&(i[De]=c),t!==void 0&&(i[Le]=t?"1":"0")):i[Tt]=this._getW3CompactFormat(e,r,t),i}_disableNetworkInstrumentation(){C._isNetworkInstrumentationEnabled&&(C._originalFetch&&(C._global.fetch=C._originalFetch,C._originalFetch=void 0),C._originalXhr&&(C._global.XMLHttpRequest=C._originalXhr,C._originalXhr=void 0),C._originalXhrOpen&&(C._global.XMLHttpRequest.prototype.open=C._originalXhrOpen,C._originalXhrOpen=void 0),C._originalXhrSetRequestHeader&&(C._global.XMLHttpRequest.prototype.setRequestHeader=C._originalXhrSetRequestHeader,C._originalXhrSetRequestHeader=void 0),C._originalXhrSend&&(C._global.XMLHttpRequest.prototype.send=C._originalXhrSend,C._originalXhrSend=void 0),C._performanceObservability&&(C._performanceObservability.stop(),C._performanceObservability=void 0),C._isNetworkInstrumentationEnabled=!1)}_enableNetworkInstrumentation(e,r,t,a,u,i,c,p,h,s){typeof C._global.fetch=="function"&&(this._overrideFetch(e,r,t,a,u,i,h),C._isNetworkInstrumentationEnabled=!0),typeof C._global.XMLHttpRequest=="function"&&(this._overrideXhr(e,r,t,a,u,i,h),C._isNetworkInstrumentationEnabled=!0),c&&(C._performanceObservability=new Ot(e,s,h,p,c===!0?"full":c),C._performanceObservability.start(),C._isNetworkInstrumentationEnabled=!0)}static _getTraceHeaders(e,r,t,a,u){let i;if(e)i=e.getTraceHeaders(t)||{};else{const c=r.internalInstrumentationContext;c!=null&&c.rootId?i=C.getHeaders(c.rootId,E.generateUniqueId(),c.isRootActivitySampled,t):i={}}if(typeof(t==null?void 0:t.headerProcessor)=="function")i=t.headerProcessor({method:a,url:u,defaultHeaders:i});else if(typeof window=="object"){let c;try{c=new URL(u)}catch(p){}c&&c.host!==window.location.host&&(i=void 0)}return C._userHeaders&&Object.keys(C._userHeaders).length>0&&(i=ot({},i),Object.entries(C._userHeaders).forEach(([c,p])=>{i[c]=p}),C._userHeaders=void 0),i||{}}static _extractHeader(e,r,t){if((t==null?void 0:t.headers)instanceof Headers)return t.headers.get(e);if(Array.isArray(t==null?void 0:t.headers)){const a=t.headers.find(u=>u[0]===e);return a==null?void 0:a[1]}if(typeof(t==null?void 0:t.headers)=="object")return t.headers[e];if(r instanceof Request)return r.headers.get(e)}_overrideFetch(e,r,t,a,u,i,c){C._originalFetch=C._global.fetch;const p=(h,s,...o)=>G(this,null,function*(){var l;let n,d,y,f,_,m=!1,v;try{i==null||i.add(),f=s==null?void 0:s.method;const A=s==null?void 0:s.o11y,g=A==null?void 0:A.skipInstr;if(m=g||C._shouldSkipUrl(c,h),!m)n=e.startActivity(t||jt);else if(g){C._reqIndex+=1;try{if(h instanceof URL)h.searchParams.append("o11y",C._reqIndex.toString());else if(typeof h=="string"){const O=new URL(h),b=`o11y=${C._reqIndex}`;O.search+=O.search.startsWith("?")?`&${b}`:b,h=O.toString()}}catch(O){}}if(s==null||delete s.o11y,d=h==null?void 0:h.toString(),y=E.tryGetAbsoluteUrl(d),a){h instanceof Request&&(f||(f=h.method),d=h.url,y=E.tryGetAbsoluteUrl(d));const O=C._getTraceHeaders(n,e,u,f,y);!this._applyTraceHeaders(h,s,O)&&s===void 0&&(s={headers:O})}return _=E.perfNow(),v=yield C._originalFetch.call(C._global,h,s,...o),v}catch(A){throw r&&!m&&(n?n.error(A):e.error(A)),A}finally{try{const A=C._endActivity(n,d,f);if(!((l=C._performanceObservability)===null||l===void 0)&&l.isStarted){const O={requestId:C._extractHeader(Me,h,s),activityDuration:A,activityId:n==null?void 0:n.getId(),errorCount:n==null?void 0:n.getErrorCount(),responseStatus:v==null?void 0:v.status};C._performanceObservability.addEntry(y,_,O)}}finally{i==null||i.done()}}});C._global.fetch=p}static _endActivity(e,r,t){var a;if(e)return!((a=C._performanceObservability)===null||a===void 0)&&a.isStarted?e.discard():e.stop(ie,{mtd:t,url:r}),e.getStopPerfTime()-e.getStartPerfTime()}_overrideXhr(e,r,t,a,u,i,c){C._originalXhr=C._global.XMLHttpRequest,C._originalXhrOpen=C._originalXhr.prototype.open,C._originalXhrSetRequestHeader=C._originalXhr.prototype.setRequestHeader,C._originalXhrSend=C._originalXhr.prototype.send;function p(s,o){var l;const n=J.get(s);if(n){const d=n.activity,y=C._endActivity(d,n.url,n.method);!o&&(!((l=C._performanceObservability)===null||l===void 0)&&l.isStarted)&&C._performanceObservability.addEntry(n.absoluteUrl,n.sendTime,{requestId:n.requestId,activityDuration:y,activityId:d==null?void 0:d.getId(),errorCount:d==null?void 0:d.getErrorCount(),responseStatus:s.status})}}C._originalXhr.prototype.open=function(s,o,l,n,d){const y={method:s,url:o==null?void 0:o.toString()};J.set(this,y),y.absoluteUrl=E.tryGetAbsoluteUrl(y.url),y.suspendInstrumentation=C._shouldSkipUrl(c,y.absoluteUrl),C._originalXhrOpen.apply(this,arguments)},C._originalXhr.prototype.setRequestHeader=function(s,o){var l;if(((l=s==null?void 0:s.toLowerCase)===null||l===void 0?void 0:l.call(s))===Me.toLowerCase()){const n=J.get(this);n&&(n.requestId=o)}C._originalXhrSetRequestHeader.apply(this,arguments)},C._originalXhr.prototype.send=function(...s){let o;const l=this;let n=J.get(l);n||(n={},J.set(l,n));try{if(i==null||i.add(),n.suspendInstrumentation||(n.activity=o=e.startActivity(t||Pt)),a){const d=C._getTraceHeaders(o,e,u,n.method,n.absoluteUrl);Object.entries(d).forEach(y=>{l.setRequestHeader(y[0],y[1])})}n.sendTime=E.perfNow(),C._originalXhrSend.call(this,...s)}catch(d){throw r&&!(n!=null&&n.suspendInstrumentation)&&(o?o.error(d):e.error(d)),p(l,!0),i==null||i.done(),d}};const h=new Proxy(C._originalXhr,{construct(s){const o=new s;return o.addEventListener("load",()=>{p(o),i==null||i.done()}),o.addEventListener("error",l=>{const n=J.get(o)||{};try{if(r&&!(n!=null&&n.suspendInstrumentation)){const d=new Error("XHR Network-Level Error"),y=n==null?void 0:n.activity;y?y.error(d):e.error(d)}p(o)}finally{i==null||i.done()}}),o.addEventListener("abort",()=>{var l;const n=J.get(o)||{};(l=n==null?void 0:n.activity)===null||l===void 0||l.discard(),i==null||i.done()}),o}});C._global.XMLHttpRequest=h}networkInstrumentation(e){var r;if(E.requireArgument(e,"options",["boolean","object"]),this._disableNetworkInstrumentation(),e){const t=typeof e=="object"?e:{};let a;E.definedValueOrDefault(t.useTasker,!0)&&(a=(r=this._idleDetector)===null||r===void 0?void 0:r.declareNotifierTaskMulti("o11y network")),this._enableNetworkInstrumentation(E.definedValueOrDefault(t.instrumentation,this._instr),E.definedValueOrDefault(t.logErrors,!0),t.activityName,E.definedValueOrDefault(t.useTracing,!0),t.tracingHeadersOptions,a,E.definedValueOrDefault(t.logPerformance,!0),E.definedValueOrDefault(t.logPerformanceActivityName,Rt),E.definedValueOrDefault(t.skipUrls,[]),E.definedValueOrDefault(t.fuzzyMapRange,Lt))}}resetRequestCounter(){C._reqIndex=0}_applyTraceHeaders(e,r,t){if((r==null?void 0:r.headers)!==void 0){if(r.headers instanceof Headers&&typeof r.headers.set=="function")return Object.entries(t).forEach(([a,u])=>{r.headers.set(a,u)}),!0;if(Array.isArray(r.headers))return Object.entries(t).forEach(a=>{r.headers.push(a)}),!0;if(typeof r.headers=="object")return r.headers=Object.assign(r.headers,t),!0}else{if(e instanceof Request&&e.headers instanceof Headers)return Object.entries(t).forEach(([a,u])=>{e.headers.set(a,u)}),!0;if(r)return r.headers=Object.assign({},t),!0}return!1}static _shouldSkipUrl(e,r){var t;let a=r;return r instanceof URL?a=(t=r.toString)===null||t===void 0?void 0:t.call(r):r instanceof Request&&(a=r.url),e==null?void 0:e.some(u=>u instanceof RegExp?u.test(a):a===u)}}C._global=E.getGlobal(),C._isNetworkInstrumentationEnabled=!1,C._reqIndex=0;var U;(function(w){w[w.none=0]="none",w[w.start=1]="start",w[w.stop=2]="stop",w[w.both=3]="both"})(U||(U={}));const Mt="timedout",qt="terminated",ge="discarded",ne={timedout:Mt,terminated:qt,discarded:ge};class Y{constructor(e,r,t,a,u,i,c,p,h,s,o){var l,n;this._name=e,this._rootId=r,this._onStopped=t,this._onError=a,this._isSampled=c,this._noRerooting=h,this._isExternal=s,this._parentActivity=o,this._isRoot=!1,this._errorCount=0,this._timerOverridden=U.none;const{tsNow:d,perfNow:y}=E.time();if(Y._count+=1,this._id=i||E.generateUniqueId(),this._usePerf=typeof performance!="undefined"&&typeof performance.mark=="function"&&typeof performance.measure=="function",this._usePerf){this._perfName=`${this._name}__${Y._count}`,this._perfId=`${this._name}__${this.id}`;try{performance.mark(this._perfId)}catch(f){this._usePerf=!1}}this._startTimestamp=d,this._startPerfTime=y,this._overrideTimer(p),u>0&&(this._timer=setTimeout(()=>{this._stopReason=this._stopReason||ne.timedout,this.stop()},u)),this._safety=new xe,this._externalParentActivity=!((l=this._parentActivity)===null||l===void 0)&&l.isExternal()?this._parentActivity:(n=this._parentActivity)===null||n===void 0?void 0:n.getExternalParentActivity()}get id(){return this._id}getId(){return this.id}getRootId(){return this._rootId}get stopReason(){return this._stopReason}getParentActivity(){return this._parentActivity}isExternal(){var e;return(e=this._isExternal)!==null&&e!==void 0?e:!1}getExternalParentActivity(){return this._externalParentActivity}error(e,r,t){this._safety.tryCatch(()=>{this._errorCount+=1,typeof e=="string"&&(e=new Error(e)),this._onError(e,this._getDetail(r,t))},{op:"activity.error"})}stop(e,r,t){this._safety.tryCatch(()=>{if(E.requireArgumentIfDefined(e,"userSchemaOrText",["object","string"]),E.requireArgumentIfDefined(r,"userData","object"),t){const a=t.perfStartOverride,u=E.requireArgumentIfDefined(a,"options.perfStartOverride","number"),i=t.perfStopOverride,c=E.requireArgumentIfDefined(i,"options.perfStopOverride","number"),p=t.errorCount;if(E.requireArgumentIfDefined(p,"options.errorCount","number")&&(this._errorCount=p),u&&a<0)throw new Error("perfStartOverride, if defined, must be >= 0");if(c&&(i<0||i<(u?a:this._startPerfTime)||i>E.time().perfNow+100))throw new Error("perfStopOverride, if defined, must be >= 0 and >= startTime and <= now")}this._stopInternal(e,r,t)},{op:"activity.stop"})}_overrideTimer(e,r){e!==void 0&&(this._startTimestamp=Math.round(this._startTimestamp-(this._startPerfTime-e)),this._startPerfTime=e,this._setTimerOverride(U.start)),r!==void 0&&(this._stopPerfTime=r,this._setTimerOverride(U.stop))}_setTimerOverride(e){this._timerOverridden===U.both||this._timerOverridden===e||e===U.none||(this._timerOverridden=this._timerOverridden===U.none?e:U.both)}_stopInternal(e,r,t){const a=E.perfNow();if(this._usePerf)try{this._stopReason!==ne.discarded&&performance.measure(this._perfName,this._perfId),performance.clearMarks(this._perfId),performance.clearMeasures(this._perfName)}catch(i){}if(this._timer&&(clearTimeout(this._timer),this._timer=void 0),this.isStopped)return;t&&this._overrideTimer(t.perfStartOverride,t.perfStopOverride),this._stopPerfTime=this._timerOverridden===U.none||this._timerOverridden===U.start?a:this._stopPerfTime;const u=this._getDetail(e,r);this._onStopped(u)}get isStopped(){return this._stopPerfTime!==void 0}discard(){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||ne.discarded,this.stop()},{op:"activity.discard"})}terminate(e,r,t){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||ne.terminated,this.stop(e,r,t)},{op:"activity.terminate"})}getIsSampled(){return this._isSampled||!1}_getDetail(e,r){return{id:this._id,rootId:this._rootId,name:this._name,userSchemaOrText:e,userData:r,stopReason:this._stopReason,startTimestamp:this._startTimestamp,startPerfTime:this._startPerfTime,stopPerfTime:this._stopPerfTime,errorCount:this._errorCount,isSampled:this.getIsSampled(),timerOverridden:this._timerOverridden,noRerooting:this._noRerooting,isExternal:this._isExternal,parentActivity:this._parentActivity,externalParentActivity:this._externalParentActivity}}getTraceHeaders(e){const r=this.id,t=this._isRoot?this.id:this._rootId;return C.getHeaders(t,r,this.getIsSampled(),e)}getStartTimestamp(){return this._startTimestamp}getStartPerfTime(){return this._startPerfTime}getStopPerfTime(){return this._stopPerfTime}getErrorCount(){return this._errorCount}}Y._count=0;const Bt=new Array(16).fill(0).join("");class Ht{getId(){return Bt}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const Ft=Object.freeze(new Ht);class Ut{getInstrumentedEventData(e,r,t,a){var u;const i={ownerComponent:t.tagName,parentComponent:((u=t.parentElement)===null||u===void 0?void 0:u.tagName)||void 0,simplePath:E.getXpath(t)};switch(e){case 0:i.baseEvent=r;break;case 1:i.mouseEvent=r;break}return a&&(i.userPayload=D.makePayload(a.schema,a.payload,!0)),i}getEventData(e){return{type:e.type}}getMouseEventData(e){return{altKey:e.altKey,bubbles:e.bubbles,button:e.button,buttons:e.buttons,cancelable:e.cancelable,clientX:e.clientX,clientY:e.clientY,composed:e.composed,defaultPrevented:e.defaultPrevented,detail:e.detail,eventPhase:e.eventPhase,isTrusted:e.isTrusted,timeStamp:e.timeStamp,type:e.type,ctrlKey:e.ctrlKey,metaKey:e.metaKey,movementX:e.movementX,movementY:e.movementY,offsetX:e.offsetX,offsetY:e.offsetY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,shiftKey:e.shiftKey}}}const ve=new Ut;class qe{constructor(e,r,t,a,u,i,c,p){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=a,this._buckets=u,this._values=new Array,this._createdOn=i===void 0?E.time().tsNow:i,c!==void 0&&(this._lastUpdatedOn=c),p!==void 0&&(this._values=p)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}getBuckets(){return this.buckets}get buckets(){return this._buckets.slice(0,this._buckets.length)}get values(){return this._values.slice(0,this._values.length)}record(e){if(typeof e=="number"){this._values.push(e),this._lastUpdatedOn=E.time().tsNow;return}throw new Error("BucketHistogram can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class Be{constructor(e,r,t,a,u,i,c){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=a,this._values=new Array,this._createdOn=u===void 0?E.time().tsNow:u,i!==void 0&&(this._lastUpdatedOn=i),c!==void 0&&(this._values=c)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}get values(){return this._values.slice(0,this._values.length)}record(e){if(typeof e=="number"){this._values.push(e),this._lastUpdatedOn=E.time().tsNow;return}throw new Error("ValueRecorder can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class _e{constructor(e){if(this._map=new Map,typeof e=="number"&&e>0){this._maxSize=Math.ceil(e);return}throw new Error("maxSize must be a positive number")}get maxSize(){return this._maxSize}get(e){return this._map.get(e)}has(e){return this._map.has(e)}set(e,r){return this.has(e)||this._map.size<this.maxSize?(this._map.set(e,r),!0):!1}getElements(){return Array.from(this._map.values())}clear(){this._map.clear()}}const He=1e3,Fe=500,Ue=500;var Q;(function(w){w[w.Counter=0]="Counter",w[w.Percentile=1]="Percentile",w[w.BucketHistogram=2]="BucketHistogram"})(Q||(Q={}));class $e{constructor(e,r){this._ownerName=e,this._getOwnerAppName=r,this._upCounters=new _e(He),this._valueRecorders=new _e(Fe),this._bucketHistograms=new _e(Ue)}incrementCounter(e,r,t=!1,a={}){this._tagError(a,t),this._upCounter(e,a).increment(r)}trackValue(e,r,t=!1,a={}){this._tagError(a,t),this._valueRecorder(e,a).record(r)}bucketValue(e,r,t,a=!1,u={}){this._tagError(u,a),this._bucketHistogram(e,u,t).record(r)}_bucketHistogram(e,r,t){const{key:a,sortedTags:u}=this._getKeyAndSortedTags(e,r,Q.BucketHistogram);let i=this._bucketHistograms.get(a);if(!i&&(i=new qe(e,this._ownerName,this._getOwnerAppName(),u,t),!this._bucketHistograms.set(a,i)))throw new Error(`Max size of ${Ue} exceeded for BucketHistograms`);return i}_upCounter(e,r){const{key:t,sortedTags:a}=this._getKeyAndSortedTags(e,r,Q.Counter);let u=this._upCounters.get(t);if(!u&&(u=new me(e,this._ownerName,this._getOwnerAppName(),a),!this._upCounters.set(t,u)))throw new Error(`Max size of ${He} exceeded for UpCounters`);return u}_valueRecorder(e,r){const{key:t,sortedTags:a}=this._getKeyAndSortedTags(e,r,Q.Percentile);let u=this._valueRecorders.get(t);if(!u&&(u=new Be(e,this._ownerName,this._getOwnerAppName(),a),!this._valueRecorders.set(t,u)))throw new Error(`Max size of ${Fe} exceeded for ValueRecorders`);return u}getUpCounters(){return this._upCounters.getElements()}getValueRecorders(){return this._valueRecorders.getElements()}getBucketHistograms(){return this._bucketHistograms.getElements()}_tagError(e,r){e.status=r===!0?"error":"success"}_getKeyAndSortedTags(e,r,t){const a=Object.keys(r).sort().reduce((i,c)=>(i[c]=r[c],i),{});return{key:`${Q[t]}:${e}${JSON.stringify(a)}`,sortedTags:a}}}class $t{constructor(){this.isMock=!0}}const zt=void 0,oe=["`"],ze={internalError:"o11y-error"},be=Object.freeze(Array.from(Object.values(ze))),we=new WeakMap;class re{constructor(e,r){this._nextGen=e,this._name=r,this._onActivityStoppedCallback=this._handleActivityStop.bind(this),this._onActivityErrorCallback=this._handleActivityError.bind(this);for(const a of oe)if(this._name.indexOf(a)>=0)throw new Error(`Name cannot include the reserved character "${a}"`);this._safety=new xe({increment:a=>this._incrementError(a)}),this._metrics=this._initMetrics();const t=D.getOptions(K,"Simple","text");this._simpleTextMaxLength=t?t["(meta.max_length)"]:ye}_initMetrics(){return new $e(this.name,()=>this._nextGen.appName||re.defaultAppName)}_incrementError(e=1){this._metrics.incrementCounter(ze.internalError,e,!0)}get name(){return this._name}[vt](e,r,t){const a=this[e];if(typeof a=="function"){we.set(this,t);try{a.apply(this,r)}finally{we.delete(this)}}}_wrapUserPayload(e,r,t=!1){let a;return typeof e=="string"?(a=K,e?r={text:e.substring(0,this._simpleTextMaxLength)}:r=void 0):a=e,D.makePayload(a,r,t)}_getEffectiveRootId(e){var r,t;return(t=(r=e==null?void 0:e.instrumentationContext)===null||r===void 0?void 0:r.rootId)!==null&&t!==void 0?t:this._nextGen.getDefaultInstrumentationContext().rootId}get internalInstrumentationContext(){return this._nextGen.getDefaultInstrumentationContext()}log(e,r,t){this._safety.tryCatch(()=>{const a=E.time().tsNow;E.requireArgument(e,"userSchemaOrText",["object","string"]),E.requireArgumentIfDefined(r,"userData","object"),E.requireArgumentIfDefined(t,"options","object");const u=this._wrapUserPayload(e,r);u!=null&&u.payload&&this._logInternal(this.name,u.schema,u.payload,a,this._getEffectiveRootId(t))},{op:"log"})}_logInternal(e,r,t,a,u){const i=we.get(this),c=this._nextGen.addLog(e,r,t,a,u,i);if(!E.isProduction){const p=se.getExtraFields(r,t);!E.isProduction&&p.length>0&&this.error("Extra fields",q,{extras:p})}return c}error(e,r,t,a){return this._safety.tryCatch(()=>{E.requireArgumentIfDefined(r,"userSchemaOrText",["object","string"]),E.requireArgumentIfDefined(t,"userData","object"),E.requireArgumentIfDefined(a,"options","object");const u=this._getEffectiveRootId(a);this._errorInternal(e,r,t,void 0,u)},{op:"error"})}_errorInternal(e,r,t,a,u){const i=E.time().tsNow;let c;if(e instanceof Error)c=e;else{let s;e==null||typeof e.toString!="function"?s="UNKNOWN":s=e.toString(),c=new Error(s)}const p=this._wrapUserPayload(r,t,!0),h={name:c.name,message:c.message,stack:c.stack,userPayload:p,activityId:a};return this._logInternal(this.name,$,h,i,u)}startActivity(e,r){return this._safety.tryCatchReturn(()=>{var t;E.requireArgument(e,"name"),E.requireArgumentIfDefined(r,"options","object");const a=E.validateParentActivityType(r==null?void 0:r.isExternal,r==null?void 0:r.parentActivity);let u,i=(r==null?void 0:r.perfStartOverride)!==void 0;const c=(t=r==null?void 0:r.instrumentationContext)===null||t===void 0?void 0:t.rootId;c?(i=!0,u={rootId:c,isRootActivitySampled:r.instrumentationContext.isRootActivitySampled,isRootActivityExternalSampled:r.instrumentationContext.isRootActivityExternalSampled}):u=this._nextGen.getDefaultInstrumentationContext();const p=r!=null&&r.isExternal?u.isRootActivityExternalSampled:u.isRootActivitySampled;return new Y(e,u.rootId,this._onActivityStoppedCallback,this._onActivityErrorCallback,zt,r==null?void 0:r.id,p,r==null?void 0:r.perfStartOverride,i,r==null?void 0:r.isExternal,a)},Ft,{op:"startActivity"})}getRootActivityHistoryEntryByTime(e){let r;return this._safety.tryCatch(()=>{r=this._nextGen.getRootActivityHistoryEntryByTime(e)},{op:"getRootActivityHistoryEntryByTime"}),r}_getActivityData(e){var r,t;const a=this._wrapUserPayload(e.userSchemaOrText,e.userData,!0);return{id:e.id,name:e.name,duration:e.stopPerfTime-e.startPerfTime,stopReason:e.stopReason,userPayload:a,errorCount:e.errorCount,isSampled:e.isSampled,timerOverridden:e.timerOverridden,isRerooted:e.isRerooted,isExternal:e.isExternal,parentId:(r=e.parentActivity)===null||r===void 0?void 0:r.getId(),externalParentId:(t=e.externalParentActivity)===null||t===void 0?void 0:t.getId()}}_handleActivityStop(e){if(e.stopReason===ge)return;if(!e.isRoot&&!e.noRerooting){const t=this._nextGen.getRootActivityHistoryEntryByTime(e.startPerfTime);(!t&&e.rootId!==void 0||t&&e.rootId!==t.id)&&(e.rootId=t==null?void 0:t.id,e.isSampled=(t==null?void 0:t.isSampled)||!1,e.isRerooted=!0)}const r=this._getActivityData(e);this._logActivity(r,e.startTimestamp,e.rootId)}_logActivity(e,r,t){this._logInternal(this.name,ce,e,r,t)}_handleActivityError(e,r){this._errorInternal(e,r.userSchemaOrText,r.userData,r.id,r.rootId)}domEvent(e,r,t,a,u){this._safety.tryCatch(()=>{var i;const c=E.time().tsNow;E.requireArgument(e,"event",[Event,$t]),E.requireArgument(r,"handledBy",[HTMLElement,"object"]);let p;r instanceof HTMLElement?p=r:(r=r,((i=r.template)===null||i===void 0?void 0:i.host)instanceof HTMLElement?p=r.template.host:E.requireArgument(void 0,"handledBy"));const h=this._wrapUserPayload(t,a,!0),s=this._getEffectiveRootId(u);if(e.type==="click"){const o=e,l=this._nextGen.getClickTracker();l&&l.markEventHandled(o);const n=u==null?void 0:u.captureMouseData,d=ve.getInstrumentedEventData(n?1:0,n?ve.getMouseEventData(o):ve.getEventData(o),p,h);d.auto=u==null?void 0:u._auto,this._logInternal(this.name,de,d,c,s)}else throw new Error(E.notImplemented)},{op:"domEvent"})}_siftTags(e){const r=Object.assign({},e);return Object.entries(r).forEach(([t,a])=>{if(a===null)r[t]="null";else if(a==="")r[t]="empty";else if(Number.isNaN(a))r[t]="NaN";else{const u=typeof a;["number","string","boolean"].indexOf(u)===-1&&(r[t]=u)}}),r}incrementCounter(e,r=1,t=!1,a={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",be),E.checkForReservedCharacters(e,"operation",oe),E.requireArgument(r,"increment","number"),E.requireArgument(t,"hasError","boolean"),E.requireArgument(a,"tags","object"),this._metrics.incrementCounter(e,r,t,this._siftTags(a))},{op:"incrementCounter"})}trackValue(e,r,t=!1,a={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",be),E.checkForReservedCharacters(e,"operation",oe),E.requireArgument(r,"value","number"),E.requireArgument(t,"hasError","boolean"),E.requireArgument(a,"tags","object"),this._metrics.trackValue(e,r,t,this._siftTags(a))},{op:"trackValue"})}bucketValue(e,r,t=[],a=!1,u={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",be),E.checkForReservedCharacters(e,"operation",oe),E.requireArgument(r,"value","number"),E.requireArgument(t,"buckets",Array),Object.entries(t).forEach(([i,c])=>{E.requireArgument(c,`Bucket value for '${i}'`,"number")}),E.requireArgument(a,"hasError","boolean"),E.requireArgument(u,"tags","object"),this._metrics.bucketValue(e,r,t,a,this._siftTags(u))},{op:"bucketValue"})}getUpCounters(){return this._metrics.getUpCounters().filter(e=>e.getLastUpdatedOn())}getValueRecorders(){return this._metrics.getValueRecorders().filter(e=>e.getLastUpdatedOn())}getBucketHistograms(){return this._metrics.getBucketHistograms().filter(e=>e.getLastUpdatedOn())}registerForLogPrompt(e){E.requireArgument(e,"listener","function"),this._nextGen.registerForLogPrompt(e)}_getAsaOptions(e){return e?Object.assign({instrumentationContext:e==null?void 0:e.instrumentationContext},e.startOptions):void 0}activity(e,r,t){var a,u,i,c;const p=this._getAsaOptions(t),h=this.startActivity(e,p);try{return r(h)}catch(s){throw h.error(s,(a=t==null?void 0:t.errorPayload)===null||a===void 0?void 0:a.schema,(u=t==null?void 0:t.errorPayload)===null||u===void 0?void 0:u.payload),s}finally{h.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(c=t==null?void 0:t.stopPayload)===null||c===void 0?void 0:c.payload,t==null?void 0:t.stopOptions)}}activityAsync(e,r,t){return G(this,null,function*(){var a,u,i,c;const p=this._getAsaOptions(t),h=this.startActivity(e,p);try{return yield r(h)}catch(s){throw h.error(s,(a=t==null?void 0:t.errorPayload)===null||a===void 0?void 0:a.schema,(u=t==null?void 0:t.errorPayload)===null||u===void 0?void 0:u.payload),s}finally{h.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(c=t==null?void 0:t.stopPayload)===null||c===void 0?void 0:c.payload,t==null?void 0:t.stopOptions)}})}invokeNetworkCallWithHeaders(e,r,t){return C.setHeaders(t),e(...r)}}re.defaultAppName="APP_NOT_REGISTERED";const Vt=.1,Xt=20;class Jt{constructor(e){if(this._historyMap=new Map,this._historyList=new Array,E.requireArgumentIfDefined(e,"limit","number")){if(e=Math.ceil(e),e<=0)throw new Error("Limit must be a positive number")}else e=Xt;this._graceCount=Math.max(1,Math.floor(e*Vt)),this._realLimit=1+e+this._graceCount}add(e){if(this._historyMap.has(e.id))throw new Error(`RootActivityHistoryImpl.add: entry already exists for rootId: ${e.id}`);this._historyMap.set(e.id,e),this._historyList.push(e),this._historyList.length===this._realLimit&&this._historyList.splice(1,this._graceCount).forEach(t=>this._historyMap.delete(t.id))}get count(){return this._historyList.length}findById(e){return this._historyMap.get(e)}findByTime(e){let r,t=Number.MAX_VALUE;for(const a of this._historyList){const u=e-a.startPerfTime;u>=0&&(a.stopPerfTime===void 0||e<a.stopPerfTime)&&u<t&&(r=a,t=u)}return r}}class Gt extends Y{constructor(e,r,t,a,u,i,c,p){super(e,void 0,r,t,void 0,a||E.generateUniqueId(c!=null?c:32),u,i),this._isRoot=!0,this._isExternalSampled=p}get isExternalSampled(){var e;return(e=this._isExternalSampled)!==null&&e!==void 0?e:!1}set isExternalSampled(e){this._isExternalSampled=e}get preRootId(){return this._preRootId}set preRootId(e){this._preRootId=e}_getDetail(e,r){const t=super._getDetail(e,r);return t.isRoot=!0,t.preRootId=this.preRootId,t}}const Kt=new Array(32).fill(0).join("");class Wt{getId(){return Kt}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const Yt=Object.freeze(new Wt);class Qt extends re{constructor(e,r,t){super(e,r),this._allowMulti=t,this._rootActivityHistory=new Jt,this._onRootActivityStoppedCallback=this._handleRootActivityStop.bind(this)}startRootActivity(e,r,t,a,u){return this._safety.tryCatchReturn(()=>{if(E.requireArgument(e,"name"),(a==null?void 0:a.id)!==void 0)throw new Error("Cannot specify id for root activity, use rootId argument instead");const i=new Gt(e,this._onRootActivityStoppedCallback,this._onActivityErrorCallback,r,t,a==null?void 0:a.perfStartOverride,this._nextGen.preferredRootIdLength,u);if(!this._allowMulti){const c={id:i.getId(),name:e,startPerfTime:i.getStartPerfTime(),isSampled:i.getIsSampled()};if(this._rootActivityHistory.add(c),this._singleRootActivity&&!this._singleRootActivity.isStopped){const p=this._singleRootActivity.getId();this._singleRootActivity.terminate(),i.preRootId=p}this._singleRootActivity=i}return i},Yt,{op:"startRootActivity"})}_handleRootActivityStop(e){const r=this._rootActivityHistory.findById(e.id);if(r&&(r.stopPerfTime=e.stopPerfTime,r.startPerfTime=e.startPerfTime),e.stopReason===ge)return;const t=this._getActivityData(e);this._logActivity(t,e.startTimestamp),this._singleRootActivity=void 0}_getActivityData(e){const r=super._getActivityData(e);return r.isRoot=e.isRoot,r.preRootId=e.preRootId,r}getSingleRootActivityId(){var e;return(e=this._singleRootActivity)===null||e===void 0?void 0:e.getId()}isSingleRootActivitySampled(){var e;return(e=this._singleRootActivity)===null||e===void 0?void 0:e.getIsSampled()}isSingleRootActivityExternalSampled(){var e,r;return(r=(e=this._singleRootActivity)===null||e===void 0?void 0:e.isExternalSampled)!==null&&r!==void 0?r:!1}_initMetrics(){return new $e(this.name,()=>this.name)}getRootActivityHistoryEntry(e){return this._rootActivityHistory.findByTime(e)}}const Zt=5;class er{constructor(e,r){this._instr=e,this._doc=r,this._isActive=!1,this._boundClickListener=this._clickListener.bind(this),E.requireArgument(e,"_instr"),E.requireArgument(r,"_doc")}activate(){this._isActive||(this._doc.addEventListener("click",this._boundClickListener,!0),this._isActive=!0)}deactivate(){this._isActive&&(this._doc.removeEventListener("click",this._boundClickListener,!0),this._isActive=!1)}markEventHandled(e){this._ignoredEvent=e}_clickListener(e){var r;let t=(r=e.composedPath)===null||r===void 0?void 0:r.call(e);(!t||!t.length)&&(t=e.path);const a=this._getClickableElement(t);a&&setTimeout(()=>{e!==this._ignoredEvent&&this._instr.domEvent(e,a,void 0,void 0,{_auto:!0})})}_getClickableElement(e){var r,t;const a=e?Math.min(e.length,Zt):0;for(let u=0;u<a;u+=1){const i=e[u],c=(r=i.tagName)===null||r===void 0?void 0:r.toLowerCase();if(c==="a"||c==="button")return i;if(c==="input"){const p=i;if(((t=p.type)===null||t===void 0?void 0:t.toLowerCase())==="button")return p}}}}const Ve="o11y:receiver";var Ee;(function(w){w[w.Unknown=0]="Unknown",w[w.Opening=1]="Opening"})(Ee||(Ee={}));class tr{constructor(e,r,t){this._logCallback=e,this._metricsCallback=r,this._commErrorCallback=t,this._senders=new Map,E.requireArgument(this._logCallback,"_logCallback","function"),E.requireArgument(this._metricsCallback,"_metricsCallback","function"),E.requireArgument(this._commErrorCallback,"_commErrorCallback","function")}openComms(e){if(E.requireArgument(e,"sender","object"),!this._senders.has(e)){const r=new MessageChannel,t={state:Ee.Opening,port:r.port1};this._senders.set(e,t),t.port.onmessage=this._messagePortEventHandler.bind(this),t.port.onmessageerror=this._messagePortErrorHandler.bind(this),e.postMessage({from:Ve,type:Xe},"*",[r.port2])}}closeComms(e){const r=this._senders.get(e);r&&(r.port.onmessage=void 0,r.port.onmessageerror=void 0,this._senders.delete(e))}_messagePortEventHandler(e){e.data.type===Je?this._logCallback(e.data.data):e.data.type===Ge&&this._metricsCallback(e.data.data)}_messagePortErrorHandler(){this._commErrorCallback()}}const Xe="handshake",Je="log",Ge="metrics";class rr{constructor(e,r){this._self=e,this._allowedOrigins=r,this._messageEventHandlerFunc=this._messageEventHandler.bind(this),this._handshakeComplete=!1,this._logBuffer=[],this._metricsBuffer=[],E.requireArgument(this._self,"_self","object"),E.requireArgumentIfDefined(r,"allowedOrigins",Array),this._self.addEventListener("message",this._messageEventHandlerFunc)}_messageEventHandler(e){e.data.from===Ve&&e.data.type===Xe&&e.ports[0]instanceof MessagePort&&E.isAllowedOrigin(e.origin,this._allowedOrigins)&&(this._handshakeComplete=!0,this._self.removeEventListener("message",this._messageEventHandlerFunc),this._otherPort=e.ports[0],this._emptyBuffers())}sendLog(e){this._handshakeComplete?this._otherPort.postMessage({type:Je,data:e}):this._logBuffer.push(e)}sendMetrics(e){this._handshakeComplete?this._otherPort.postMessage({type:Ge,data:e}):this._metricsBuffer.push(e)}_emptyBuffers(){this._logBuffer.forEach(e=>this.sendLog(e)),this._metricsBuffer.forEach(e=>this.sendMetrics(e)),this._logBuffer=void 0,this._metricsBuffer=void 0}}class ir{constructor(){this._upCounters=[],this._valueRecorders=[],this._bucketHistograms=[]}add(e){var r,t,a;!((r=e.upCounters)===null||r===void 0)&&r.length&&this._upCounters.push(...e.upCounters.map(u=>new me(u.name,u.ownerName,u.ownerAppName,V.getMetricsTags(u.tags),u.createdTimestamp,u.lastUpdatedTimestamp,u.value))),!((t=e.valueRecorders)===null||t===void 0)&&t.length&&this._valueRecorders.push(...e.valueRecorders.map(u=>new Be(u.name,u.ownerName,u.ownerAppName,V.getMetricsTags(u.tags),u.createdTimestamp,u.lastUpdatedTimestamp,u.values))),!((a=e.bucketHistograms)===null||a===void 0)&&a.length&&this._bucketHistograms.push(...e.bucketHistograms.map(u=>new qe(u.name,u.ownerName,u.ownerAppName,V.getMetricsTags(u.tags),u.buckets,u.createdTimestamp,u.lastUpdatedTimestamp,u.values)))}getUpCounters(){return this._upCounters=this._upCounters.filter(e=>e.getLastUpdatedOn()!==void 0),this._upCounters}getValueRecorders(){return this._valueRecorders=this._valueRecorders.filter(e=>e.getLastUpdatedOn()!==void 0),this._valueRecorders}getBucketHistograms(){return this._bucketHistograms=this._bucketHistograms.filter(e=>e.getLastUpdatedOn()!==void 0),this._bucketHistograms}}const sr=1e3;class nr{constructor(e,r){this._connector=e,this._pollInterval=sr,E.requireArgument(e,"_connector","object"),E.requireArgumentIfDefined(r,"_pollInterval","number")&&r>0&&(this._pollInterval=r)}collect(e,r,t){const a={schema:e,data:r,logMeta:t};this._connector.sendLog(a)}receiveMetricsExtractors(e){this._metricsExtractors=e,this._collectAndSendMetrics(),setInterval(this._collectAndSendMetrics.bind(this),this._pollInterval)}_collectAndSendMetrics(){const e={upCounters:V.getUpCounters(this._metricsExtractors.getAllUpCounters()),valueRecorders:V.getValueRecorders(this._metricsExtractors.getAllValueRecorders()),bucketHistograms:V.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms())};(e.upCounters.length||e.valueRecorders.length||e.bucketHistograms.length)&&this._connector.sendMetrics(e)}}const Ke=80,or=32,We="_CUT",ar=Ke-We.length;function ae(){}class le{get preferredRootIdLength(){return this._preferredRootIdLength}get pagePayloadProvider(){return this._pagePayloadProvider}set pagePayloadProvider(e){this._pagePayloadProvider=e}get appPayloadProvider(){return this._appPayloadProvider}set appPayloadProvider(e){this._appPayloadProvider=e}constructor(e){this._idleDetector=e,this._logCollectors=new Set,this._instruments=new Map,this._seqBySchema=new Map,this._sequence=0,this._forceDisabledLogCollectors=new Set,this._logCollectorFailures=new Map,this._isBufferingEnabled=!1,this._buffer=[],this._logCollectionListeners=new Set,this._opMode="default",this._isSender=!1,this._isReceiver=!1,this._decimalPoints=2}registerApp(e,r){var t,a;if(E.requireArgument(e,"name","string"),this._appInstr)throw new Error("An app has already been registered with instrumentation.");if(this._instruments.get(e))throw new Error(`The instrumentation name ${e} is already taken`);if(W.setOwnerAppName(e),this._initOpMode(r==null?void 0:r.operationMode),this._isSender=this._opMode==="sender",this._isReceiver=this._opMode==="receiver",(r==null?void 0:r.decimalPoints)!==void 0&&(this._decimalPoints=r.decimalPoints),this._preferredRootIdLength=(t=r==null?void 0:r.preferredRootIdLength)!==null&&t!==void 0?t:or,this._clientSessionId=((a=r==null?void 0:r.clientSessionId)===null||a===void 0?void 0:a.toString())||E.generateUniqueId(),this._appInstr=new Qt(this,e,r==null?void 0:r.allowMultipleRootActivities),this._instruments.set(e,this._appInstr),this._isSender){const c=new nr(new rr(window,r==null?void 0:r.allowedReceiverOrigins),r==null?void 0:r.senderMetricsPollingInterval);this.registerLogCollector(c),this.registerMetricsCollector(c)}else this._isReceiver&&(this._metricsStore=new ir,this._receiverConnector=new tr(c=>{c.logMeta.receiverClientSessionId=this._clientSessionId,c.logMeta.receiverRootId=this._appInstr.getSingleRootActivityId(),this._multiplex(c.schema,c.data,c.logMeta)},c=>{this._metricsStore.add(c)},()=>{this._appInstr.incrementCounter("o11y-error-receiver",1,!0)}));this._isBufferingEnabled=!this._isSender&&(r==null?void 0:r.enableBuffering);const i=new C(this.getInstrumentation("Network"),this._idleDetector);return{log:this._appInstr.log.bind(this._appInstr),error:this._appInstr.error.bind(this._appInstr),startActivity:this._appInstr.startActivity.bind(this._appInstr),domEvent:this._appInstr.domEvent.bind(this._appInstr),incrementCounter:this._appInstr.incrementCounter.bind(this._appInstr),trackValue:this._appInstr.trackValue.bind(this._appInstr),bucketValue:this._appInstr.bucketValue.bind(this._appInstr),networkInstrumentation:i.networkInstrumentation.bind(i),registerForLogPrompt:this._appInstr.registerForLogPrompt.bind(this._appInstr),activity:this._appInstr.activity.bind(this._appInstr),activityAsync:this._appInstr.activityAsync.bind(this._appInstr),invokeNetworkCallWithHeaders:this._appInstr.invokeNetworkCallWithHeaders.bind(this._appInstr),startRootActivity:this._appInstr.startRootActivity.bind(this._appInstr),registerLogCollector:this._isSender?ae:this.registerLogCollector.bind(this),registerMetricsCollector:this._isSender?ae:this.registerMetricsCollector.bind(this),activateClickTracker:this.activateClickTracker.bind(this),deactivateClickTracker:this.deactivateClickTracker.bind(this),disableBuffering:this.disableBuffering.bind(this),promptLogCollection:this.promptLogCollection.bind(this),getClientSessionId:this.getClientSessionId.bind(this),getOperationMode:this.getOperationMode.bind(this),startReceiving:this._isReceiver?this._receiverConnector.openComms.bind(this._receiverConnector):ae,stopReceiving:this._isReceiver?this._receiverConnector.closeComms.bind(this._receiverConnector):ae}}getInstrumentation(e){E.requireArgument(e,"name","string"),e.length>Ke&&(e=e.substring(0,ar)+We);let r=this._instruments.get(e);if(!r)r=new re(this,e),this._instruments.set(e,r);else if(r===this._appInstr)throw new Error(`The instrumentation name ${e} is being used by the app.`);return r}get appName(){var e;return(e=this._appInstr)===null||e===void 0?void 0:e.name}getRootActivityHistoryEntryByTime(e){var r;return(r=this._appInstr)===null||r===void 0?void 0:r.getRootActivityHistoryEntry(e)}addLog(e,r,t,a,u,i){var c,p,h;se.checkInputs(r,t),this._sequence+=1;const s=D.isInternal(r),o=s&&(t!=null&&t.userPayload)?t.userPayload.schema:r,l=D.getSchemaId(o);let n=this._seqBySchema.get(l)||0;n+=1,this._seqBySchema.set(l,n);const d={timestamp:a,rootId:u,sequence:this._sequence,schemaSequence:n,loggerName:e,pagePayload:void 0,appPayload:void 0,loggerAppName:this.appName,connectionType:E.getConnectionType(),clientSessionId:this._clientSessionId,age:E.getAge(a),tenantClass:i||void 0},y={schema:r,data:t,logMeta:d};if(d.pagePayload=se.getPayloadFromProvider(this.pagePayloadProvider,y),d.appPayload=se.getPayloadFromProvider(this.appPayloadProvider,y),this._isSender||(t=E.clone(t)),typeof this._decimalPoints=="number"&&(E.roundNumbersInObject(t,this._decimalPoints),s&&E.roundNumbersInObject((c=t.userPayload)===null||c===void 0?void 0:c.payload,this._decimalPoints),E.roundNumbersInObject((p=d.pagePayload)===null||p===void 0?void 0:p.payload,this._decimalPoints),E.roundNumbersInObject((h=d.appPayload)===null||h===void 0?void 0:h.payload,this._decimalPoints)),this._isBufferingEnabled){const f={schema:r,data:t,logMeta:d};this._buffer.push(f)}return this._multiplex(r,t,d),this._sequence}_multiplex(e,r,t){const a=Array.from(this._logCollectors).filter(u=>{var i;return!this._forceDisabledLogCollectors.has(u)&&!(!((i=u.getIsCollectDisabled)===null||i===void 0)&&i.call(u))});if(a.length>0)for(const u of a){let i=this._logCollectorFailures.get(u)||0;try{u.collect(e,r,t),i>0&&this._logCollectorFailures.set(u,i-1)}catch(c){i+=1,i>=le._collectorFailureLimit?(this._forceDisabledLogCollectors.add(u),this._appInstr&&(typeof c=="string"||c instanceof Error)&&this._appInstr.error(c)):this._logCollectorFailures.set(u,i)}}}getBuffer(){return this._buffer}disableBuffering(){this._isBufferingEnabled=!1,this._buffer=[]}getClickTracker(){return this._autoClickTracker}getDefaultInstrumentationContext(){var e,r,t;return{rootId:(e=this._appInstr)===null||e===void 0?void 0:e.getSingleRootActivityId(),isRootActivitySampled:(r=this._appInstr)===null||r===void 0?void 0:r.isSingleRootActivitySampled(),isRootActivityExternalSampled:(t=this._appInstr)===null||t===void 0?void 0:t.isSingleRootActivityExternalSampled()}}activateClickTracker(){typeof document!="undefined"&&(this._autoClickTracker||(this._autoClickTracker=new er(this._appInstr,document)),this._autoClickTracker.activate())}deactivateClickTracker(){this._autoClickTracker&&(this._autoClickTracker.deactivate(),this._autoClickTracker=void 0)}registerLogCollector(e,r){if(E.requireArgument(e,"collector"),!this._logCollectors.has(e)&&(this._logCollectors.add(e),this._logCollectorFailures.set(e,0),(!e.getIsCollectDisabled||!e.getIsCollectDisabled())&&(r!=null&&r.retroactive)))for(const t of this._buffer)e.collect(t.schema,t.data,t.logMeta)}registerMetricsCollector(e){if(E.requireArgument(e,"collector"),this._metricsCollector)throw new Error("A metrics Collector is already registered.");this._metricsCollector=e,this._metricsCollector.receiveMetricsExtractors({getAllUpCounters:this._getAllUpCounters.bind(this),getAllValueRecorders:this._getAllValueRecorders.bind(this),getAllBucketHistograms:this._getAllBucketHistograms.bind(this)})}_getAllUpCounters(){var e;return(((e=this._metricsStore)===null||e===void 0?void 0:e.getUpCounters())||[]).concat(Array.from(this._instruments.values()).map(r=>r.getUpCounters()).flat()).concat(W.getUpCounters())}_getAllValueRecorders(){var e;return(((e=this._metricsStore)===null||e===void 0?void 0:e.getValueRecorders())||[]).concat(Array.from(this._instruments.values()).map(r=>r.getValueRecorders()).flat()).concat(W.getValueRecorders())}_getAllBucketHistograms(){var e;return(((e=this._metricsStore)===null||e===void 0?void 0:e.getBucketHistograms())||[]).concat(Array.from(this._instruments.values()).map(r=>r.getBucketHistograms()).flat()).concat(W.getBucketHistograms())}registerForLogPrompt(e){this._logCollectionListeners.add(e)}promptLogCollection(e){for(const r of this._logCollectionListeners.keys())try{r(e)}catch(t){if(!E.isProduction)throw t}}getClientSessionId(){return this._clientSessionId}_initOpMode(e){if(typeof e=="function"&&(e=e()),(e===void 0||typeof window!="object")&&(e="default"),["default","receiver","sender"].indexOf(e)>=0)this._opMode=e;else throw new Error(`Invalid operation mode: ${e}`)}getOperationMode(){return this._opMode}}le._collectorFailureLimit=5;class lr{get _lazyNextGen(){return this._nextgen||(this._nextgen=new le(this._idleDetector)),this._nextgen}constructor(e){this._idleDetector=e,E.requireArgument(e,"_idleDetector")}registerInstrumentedApp(e,r){const t=this._lazyNextGen.registerApp(e,r);return r&&(E.markProduction(r.isProduction),this._nextgen.appPayloadProvider=r.appPayloadProvider,this._nextgen.pagePayloadProvider=r.pagePayloadProvider),t}getInstrumentation(e){return this._lazyNextGen.getInstrumentation(e)}}E.time.bind(E);const ur=new wt({logThreshold:300,reportListener:w=>{Z==null||Z.log(B,w)},errorListener:(w,e)=>{Z==null||Z.error(w,e)}}),ue=new lr(ur),dr=ue.registerInstrumentedApp.bind(ue),Z=ue.getInstrumentation.bind(ue)("IdleDetector"),cr="264.105.0",hr="o11y";class ee{constructor(){this._envelope={diagnostics:{key:hr,generatedTimestamp:void 0,bundleCount:0,bucketHistogramCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:cr},bundles:[],metrics:{bucketHistograms:[],upCounters:[],valueRecorders:[]},staticAttributes:{}}}withStaticAttributes(e){return this._envelope.staticAttributes=e,this}withLogs(e,r){let t=this._envelope.bundles.find(a=>a.schemaName===e);if(t)for(const a of r)t.messages.push(a);else t={schemaName:e,messages:r},this._envelope.bundles.push(t);return this._envelope.diagnostics.bundleCount=this._envelope.bundles.length,this}static getUpCounters(e,r=!0){return V.getUpCounters(e,r)}static getValueRecorders(e,r=!0){return V.getValueRecorders(e,r)}static getBucketHistograms(e,r=!0){return V.getBucketHistograms(e,r)}withUpCounters(e){for(const r of e)this._envelope.metrics.upCounters.push(r);return this._envelope.diagnostics.upCounterCount=this._envelope.metrics.upCounters.length,this}withValueRecorders(e){for(const r of e)this._envelope.metrics.valueRecorders.push(r);return this._envelope.diagnostics.valueRecorderCount=this._envelope.metrics.valueRecorders.length,this}withBucketHistograms(e){for(const r of e)this._envelope.metrics.bucketHistograms.push(r);return this._envelope.diagnostics.bucketHistogramCount=this._envelope.metrics.bucketHistograms.length,this}build(){return this._envelope.diagnostics.generatedTimestamp=E.time().tsNow,this._envelope}static buildFrom(e){const r=new ee;return e.staticAttributes&&r.withStaticAttributes(e.staticAttributes),e.messages&&e.messages.forEach((t,a)=>{r.withLogs(D.getSchemaId(a),t)}),e.upCounters&&r.withUpCounters(e.upCounters),e.valueRecorders&&r.withValueRecorders(e.valueRecorders),e.bucketHistograms&&r.withBucketHistograms(e.bucketHistograms),r.build()}}var Ae;(function(w){var e,r;e={1:[function(t,a,u){a.exports=function(i,c){for(var p=Array(arguments.length-1),h=0,s=2,o=!0;s<arguments.length;)p[h++]=arguments[s++];return new Promise(function(l,n){p[h]=function(d){if(o)if(o=!1,d)n(d);else{for(var y=Array(arguments.length-1),f=0;f<y.length;)y[f++]=arguments[f];l.apply(null,y)}};try{i.apply(c||null,p)}catch(d){o&&(o=!1,n(d))}})}},{}],2:[function(t,a,u){u.length=function(s){var o=s.length;if(!o)return 0;for(var l=0;1<--o%4&&(s[0|o]||"")=="=";)++l;return Math.ceil(3*s.length)/4-l};for(var i=Array(64),c=Array(123),p=0;p<64;)c[i[p]=p<26?p+65:p<52?p+71:p<62?p-4:p-59|43]=p++;u.encode=function(s,o,l){for(var n,d=null,y=[],f=0,_=0;o<l;){var m=s[o++];switch(_){case 0:y[f++]=i[m>>2],n=(3&m)<<4,_=1;break;case 1:y[f++]=i[n|m>>4],n=(15&m)<<2,_=2;break;case 2:y[f++]=i[n|m>>6],y[f++]=i[63&m],_=0}8191<f&&((d=d||[]).push(String.fromCharCode.apply(String,y)),f=0)}return _&&(y[f++]=i[n],y[f++]=61,_===1&&(y[f++]=61)),d?(f&&d.push(String.fromCharCode.apply(String,y.slice(0,f))),d.join("")):String.fromCharCode.apply(String,y.slice(0,f))};var h="invalid encoding";u.decode=function(s,o,l){for(var n,d=l,y=0,f=0;f<s.length;){var _=s.charCodeAt(f++);if(_==61&&1<y)break;if((_=c[_])===w)throw Error(h);switch(y){case 0:n=_,y=1;break;case 1:o[l++]=n<<2|(48&_)>>4,n=_,y=2;break;case 2:o[l++]=(15&n)<<4|(60&_)>>2,n=_,y=3;break;case 3:o[l++]=(3&n)<<6|_,y=0}}if(y===1)throw Error(h);return l-d},u.test=function(s){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s)}},{}],3:[function(t,a,u){a.exports=c;var i=/^(?: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)$/;function c(p,h){typeof p=="string"&&(h=p,p=w);var s=[];function o(n){if(typeof n!="string"){var d=l();if(c.verbose&&console.log("codegen: "+d),d="return "+d,n){for(var y=Object.keys(n),f=Array(y.length+1),_=Array(y.length),m=0;m<y.length;)f[m]=y[m],_[m]=n[y[m++]];return f[m]=d,Function.apply(null,f).apply(null,_)}return Function(d)()}for(var v=Array(arguments.length-1),A=0;A<v.length;)v[A]=arguments[++A];if(A=0,n=n.replace(/%([%dfijs])/g,function(g,O){var b=v[A++];switch(O){case"d":case"f":return""+ +(""+b);case"i":return""+Math.floor(b);case"j":return JSON.stringify(b);case"s":return""+b}return"%"}),A!==v.length)throw Error("parameter count mismatch");return s.push(n),o}function l(n){return"function "+(function(d){return!d||!(d=(""+d).replace(/[^\w$]/g,""))?"":(/^\d/.test(d)&&(d="_"+d),i.test(d)?d+"_":d)})(n||h)+"("+(p&&p.join(",")||"")+`){
1
+ (function(B,F){typeof exports=="object"&&typeof module!="undefined"?F(exports):typeof define=="function"&&define.amd?define(["exports"],F):(B=typeof globalThis!="undefined"?globalThis:B||self,F(B.CimulateO11ySdk={}))})(this,(function(B){"use strict";var pn=Object.defineProperty;var hr=Object.getOwnPropertySymbols;var mn=Object.prototype.hasOwnProperty,yn=Object.prototype.propertyIsEnumerable;var pr=(B,F,H)=>F in B?pn(B,F,{enumerable:!0,configurable:!0,writable:!0,value:H}):B[F]=H,mr=(B,F)=>{for(var H in F||(F={}))mn.call(F,H)&&pr(B,H,F[H]);if(hr)for(var H of hr(F))yn.call(F,H)&&pr(B,H,F[H]);return B};var re=(B,F,H)=>new Promise((Pe,ve)=>{var Le=K=>{try{ie(H.next(K))}catch(Y){ve(Y)}},_e=K=>{try{ie(H.throw(K))}catch(Y){ve(Y)}},ie=K=>K.done?Pe(K.value):Promise.resolve(K.value).then(Le,_e);ie((H=H.apply(B,F)).next())});const F={namespace:"sf.instrumentation",name:"PayloadDiags",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{PayloadDiags:{fields:{extras:{rule:"repeated",id:1,type:"string"}}}}}}}}}},H={namespace:"sf.instrumentation",name:"IdleDetectorReport",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{IdleDetectorReport:{fields:{listenerCount:{id:3,type:"uint32"},busyTasks:{rule:"repeated",id:5,type:"string"},busyDurations:{rule:"repeated",id:6,type:"double"},pollableCount:{id:4,type:"uint32"},pollCounts:{rule:"repeated",id:8,type:"double"},logThreshold:{id:2,type:"double"},maxDuration:{id:1,type:"double"},pollables:{rule:"repeated",id:7,type:"string"}}}}}}}}}},Pe={namespace:"sf.instrumentation",name:"InstrumentedEvent",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MouseEvent:{reserved:[[6,6],[7,7],[15,15],[16,16],[17,17],[18,18],[19,19],[20,20],[21,21],[22,22]],fields:{cancelable:{id:5,type:"bool"},ctrlKey:{id:9,type:"bool"},type:{id:25,type:"string"},button:{id:3,type:"uint32"},offsetX:{id:30,type:"double"},eventPhase:{id:12,type:"uint32"},shiftKey:{id:23,type:"bool"},offsetY:{id:31,type:"double"},composed:{id:8,type:"bool"},altKey:{id:1,type:"bool"},isTrusted:{id:13,type:"bool"},buttons:{id:4,type:"uint32"},movementY:{id:29,type:"double"},clientY:{id:27,type:"double"},clientX:{id:26,type:"double"},movementX:{id:28,type:"double"},defaultPrevented:{id:10,type:"bool"},metaKey:{id:14,type:"bool"},timeStamp:{id:24,type:"double"},bubbles:{id:2,type:"bool"},detail:{id:11,type:"int64"},pageY:{id:33,type:"double"},pageX:{id:32,type:"double"},screenX:{id:34,type:"double"},screenY:{id:35,type:"double"}}},Event:{fields:{type:{id:1,type:"string"}}},InstrumentedEvent:{oneofs:{event:{oneof:["mouseEvent","baseEvent"]}},reserved:[[4,4],"xpath",[6,6],[8,8]],fields:{mouseEvent:{id:7,type:"MouseEvent"},auto:{id:3,type:"bool"},parentComponent:{id:2,type:"string"},baseEvent:{id:10,type:"Event"},ownerComponent:{id:1,type:"string"},userPayload:{id:5,type:"Payload"},simplePath:{id:9,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},ve={namespace:"sf.instrumentation",name:"Network",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Network:{fields:{mtd:{id:1,type:"string"},url:{id:2,type:"string"}}}}}}}}}},Le={namespace:"sf.instrumentation",name:"Activity",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Activity:{reserved:[[5,5],[7,7]],fields:{stopReason:{id:6,type:"string"},externalParentId:{id:17,type:"string"},isRoot:{id:8,type:"bool"},isExternal:{id:16,type:"bool"},isSampled:{id:11,type:"bool"},preRootId:{id:9,type:"string"},parentId:{id:13,type:"string"},duration:{id:3,type:"double"},timerOverridden:{id:12,type:"uint32"},isRerooted:{id:15,type:"bool"},name:{options:{"(meta.max_length)":25},id:2,type:"string"},traceIdSource:{id:14,type:"string"},id:{id:1,type:"string"},userPayload:{id:4,type:"Payload"},errorCount:{id:10,type:"uint32"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},_e={pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MessageBundle:{fields:{messages:{rule:"repeated",id:2,type:"LogMessage"},schemaName:{id:1,type:"string"}}},Metrics:{fields:{globalMetricTags:{rule:"repeated",id:4,type:"MetricTag"},bucketHistograms:{rule:"repeated",id:3,type:"BucketHistogram"},valueRecorders:{rule:"repeated",id:2,type:"ValueRecorder"},upCounters:{rule:"repeated",id:1,type:"UpCounter"}}},CoreEnvelopeDiagnostics:{fields:{schemaVersion:{id:6,type:"string"},generatedTimestamp:{id:2,type:"double"},bundleCount:{id:3,type:"uint32"},upCounterCount:{id:4,type:"uint32"},valueRecorderCount:{id:5,type:"uint32"},key:{id:1,type:"string"},bucketHistogramCount:{id:7,type:"uint32"}}},LogMessage:{fields:{data:{id:2,type:"bytes"},rootId:{id:4,type:"string"},csId:{id:12,type:"string"},recCsId:{id:13,type:"string"},pagePayload:{id:7,type:"Payload"},connectionType:{id:9,type:"string"},appPayload:{id:10,type:"Payload"},tenantClass:{id:15,type:"string"},loggerAppName:{id:8,type:"string"},sseq:{id:11,type:"uint32"},recRootId:{id:14,type:"string"},loggerName:{id:6,type:"string"},age:{id:3,type:"double"},seq:{id:5,type:"uint32"},timestamp:{id:1,type:"double"}}},CoreEnvelope:{fields:{diagnostics:{id:1,type:"CoreEnvelopeDiagnostics"},bundles:{rule:"repeated",id:2,type:"MessageBundle"},metrics:{id:3,type:"Metrics"},staticAttributes:{id:4,type:"StaticAttributes"}}},MetricTag:{fields:{name:{id:1,type:"string"},value:{id:2,type:"string"}}},BucketHistogram:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:7,type:"string"},ownerAppName:{id:8,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},buckets:{rule:"repeated",id:5,type:"uint32"},name:{id:1,type:"string"},tags:{rule:"repeated",id:6,type:"MetricTag"}}},ValueRecorder:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},name:{id:1,type:"string"},tags:{rule:"repeated",id:5,type:"MetricTag"}}},StaticAttributes:{fields:{appVersion:{id:2,type:"string"},appName:{id:1,type:"string"},deviceModel:{id:5,type:"string"},sdkVersion:{id:6,type:"string"},deviceId:{id:4,type:"string"},appExperience:{id:3,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}},UpCounter:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},name:{id:1,type:"string"},value:{id:4,type:"uint32"},tags:{rule:"repeated",id:5,type:"MetricTag"}}}}}}}}}},ie={namespace:"sf.instrumentation",name:"Simple",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Simple:{fields:{text:{options:{"(meta.max_length)":25},id:1,type:"string"}}}}}}}}}},K={namespace:"sf.instrumentation",name:"Error",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Error:{reserved:[[5,5],[7,7]],fields:{activityId:{id:6,type:"string"},stack:{id:3,type:"string"},name:{id:1,type:"string"},message:{options:{"(meta.max_length)":200},id:2,type:"string"},userPayload:{id:4,type:"Payload"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}};class Y{constructor(){this.notImplemented="Method not implemented.";const e=typeof performance!="undefined";e?performance.timeOrigin?this._timeOrigin=performance.timeOrigin:this._timeOrigin=Date.now():this._timeOrigin=Date.now();const r=this._timeOrigin;e&&typeof performance.now=="function"?(this.perfNow=performance.now.bind(performance),this.time=()=>{const t=this.perfNow();return{tsNow:r+t,perfNow:t,timeOrigin:r}}):(this.perfNow=()=>Date.now()-r,this.time=()=>{const t=this.perfNow();return{tsNow:Date.now(),perfNow:t,timeOrigin:r}})}get isProduction(){return Y._isProduction}markProduction(e){Y._isProduction=e!=null?e:!0}_checkArgument(e,r){if(typeof r=="string")return typeof e===r;if(typeof r=="function")return e instanceof r;if(Array.isArray(r))return r.some(t=>this._checkArgument(e,t));throw new Error(`Invalid argKind ${r}`)}requireArgument(e,r,t){let n=e==null||e==="";const l=t!==void 0;if(!n&&l&&(n=!this._checkArgument(e,t)),n)throw new Error(`${r} argument is required${l?" and must be of a supported type.":"."}`)}requireArgumentIfDefined(e,r,t){if(e===void 0)return!1;if(e===null||e===""||!this._checkArgument(e,t))throw new Error(`${r} argument, if defined, must be of a supported type.`);return!0}checkForDenyListedValues(e,r,t){if(t.some(n=>e===n))throw new Error(`The value ${e} isn't allowed for ${r} argument.`)}checkForReservedCharacters(e,r,t){if(e&&t.some(n=>e.indexOf(n)>=0))throw new Error(`The argument ${r} isn't allowed to contain characters from ['${t.join(", ")}']. Received: ${e}.`)}generateUniqueId(e=16){const r=[],t="0123456789abcdef";if(!(e===void 0||e>0))throw new Error('If specified, the argument "length" must be a positive integer');for(let n=0;n<e;n++){const l=Math.floor(Math.random()*16);r.push(t[l])}return r.join("")}getXpath(e){function r(l){const i=l.localName;for(;l.nextElementSibling;)if(l=l.nextElementSibling,l.localName===i)return!0;return!1}function t(l,i){return l?t(l.previousElementSibling,i||l.localName)+(l.localName===i?1:0):1}function n(l){if(!l||l.nodeType!==1)return[""];const i=t(l)>1||r(l)?`${l.localName.toLowerCase()}[${t(l)}]`:l.localName.toLowerCase();return[...n(l.parentNode),i]}return n(e).join("/")}getAge(e){return e-this._timeOrigin}_getNavigatorSafe(){try{return typeof navigator!="undefined"?navigator:void 0}catch(e){return}}_hasEffectiveConnectionType(e){if(typeof e!="object"||e===null||!("connection"in e))return!1;const r=e.connection;return typeof r=="object"&&r!==null&&"effectiveType"in r&&typeof r.effectiveType=="string"}getConnectionType(){const e=this._getNavigatorSafe();return this._hasEffectiveConnectionType(e)?e.connection.effectiveType:void 0}clone(e){return JSON.parse(JSON.stringify(e))}definedValueOrDefault(e,r){return e!==void 0?e:r}getGlobal(){if(typeof globalThis=="object")return globalThis;if(typeof self=="object")return self;throw new Error("Unable to locate globalThis or self")}getIsBeaconSupported(){const e=this.getGlobal(),r=this._getNavigatorSafe();return typeof(r==null?void 0:r.sendBeacon)=="function"&&typeof e.Blob=="function"}estimateObjectSize(e){const r=new Set,t=[e];let n=0;for(;t.length;){const l=t.pop();if(typeof l=="boolean")n+=4;else if(typeof l=="string")n+=l.length*2;else if(typeof l=="number")n+=8;else if(l instanceof Uint8Array||l instanceof Uint8ClampedArray||l instanceof Uint16Array||l instanceof Uint32Array||l instanceof Int8Array||l instanceof Int16Array||l instanceof Int32Array||l instanceof Float32Array||l instanceof Float64Array)n+=l.byteLength;else if(typeof l=="object"){const i=l;if(!r.has(i)){r.add(i);for(const c in i)t.push(i[c])}}}return n}noProdThrow(e){if(!E.isProduction)throw e}isAllowedOrigin(e,r){return Array.isArray(r)&&r.some(t=>t==="*"||e===t||t instanceof RegExp&&t.test(e))}roundNumber(e,r){const t=Math.pow(10,r);return Math.round(e*t)/t}roundNumbersInObject(e,r){e&&Object.entries(e).forEach(([t,n])=>{typeof n=="number"&&(e[t]=this.roundNumber(n,r))})}tryGetAbsoluteUrl(e){var r,t;return e!=null&&e.startsWith("//")&&typeof window=="object"?((r=window.location.protocol)!==null&&r!==void 0?r:"")+e:e!=null&&e.startsWith("/")&&typeof window=="object"?((t=window.location.origin)!==null&&t!==void 0?t:"")+e:e}validateParentActivityType(e,r){const t=e!=null?e:!1;if(!r)return;const n=r.isExternal();if(t===n)return r;{const l=t?"external":"internal",i=n?"external":"internal";throw new Error(`Parent activity type mismatch: ${l} activity cannot have ${i} parent.`)}}}Y._isProduction=!0;const De=new Y,Me=De.getGlobal();De.markProduction(Me==null?void 0:Me.__O11Y_IS_PROD__);const E=Object.freeze(De);class qe{constructor(e,r,t,n,l,i,c){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=n,this._value=0,this._createdOn=l===void 0?E.time().tsNow:l,i!==void 0&&(this._lastUpdatedOn=i),c!==void 0&&(this._value=c)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this._value}increment(e=1){if(typeof e=="number"&&e>0){this._value+=Math.round(e),this._lastUpdatedOn=E.time().tsNow;return}throw new Error("UpCounter can only increment positive numbers.")}reset(){this._lastUpdatedOn=void 0,this._value=0}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}const yr="co11y";class gr{constructor(){this._upCounters=new Map,this._ownerAppName=yr}_addOrUpdateCounter(e,r,t){if(!e)return;const n={status:t},l=`${this._ownerAppName}:${r}:${e}${JSON.stringify(n)}`;let i=this._upCounters.get(l);i||(i=new qe(e,r,this._ownerAppName,n),this._upCounters.set(l,i)),i.increment()}success(e,r){this._addOrUpdateCounter(e,r,"success")}exception(e,r){this._addOrUpdateCounter(e,r,"error")}getBucketHistograms(){return[]}getUpCounters(){return Array.from(this._upCounters.values()).filter(e=>e.getLastUpdatedOn())}getValueRecorders(){return[]}setOwnerAppName(e){this._ownerAppName=e}}const ne=new gr;class vr{constructor(e){if(this._lazyMap=new Map,e!==void 0){if(typeof e=="number"&&e>0){this._maxSize=Math.ceil(e);return}throw new Error("maxSize must be a positive number")}}get maxSize(){return this._maxSize}get size(){return this._lazyMap.size}push(e,r){let t=this._lazyMap.get(e);if(!t){if(this.maxSize!==void 0&&this.size===this.maxSize)return!1;t=new Array,this._lazyMap.set(e,t)}return t.push(r),!0}getMessages(e,r){const t=this._lazyMap.get(e);return r&&this._lazyMap.has(e)&&this._lazyMap.set(e,[]),t||[]}getAllMessages(e){const r=new Map;for(const[t,n]of this._lazyMap.entries())n.length&&r.set(t,this.getMessages(t,e));return r}extractMessages(e){return this.getMessages(e,!0)}extractAllMessages(){return this.getAllMessages(!0)}get totalItemCount(){let e=0;for(const r of this._lazyMap.values())e+=r.length;return e}}class _r{getSchemaId(e){return`${e.namespace}.${e.name}`}isInternal(e){return(e==null?void 0:e.namespace)==="sf.instrumentation"}makePayload(e,r,t=!0){if(!t||e!==void 0&&r!==void 0)return{schema:e,payload:r}}checkSchema(e){return E.requireArgument(e,"schema","object"),E.requireArgument(e.namespace,"schema.namespace","string"),E.requireArgument(e.name,"schema.name","string"),E.requireArgument(e.pbjsSchema,"schema.pbjsSchema","object"),this._getTokens(e)}_getTokens(e){const r=e.namespace.split(".");if(r.length!==2)throw new Error(`Schema "${this.getSchemaId(e)}" must have a namespace of the form "domain.feature".`);return{domain:r[0],feature:r[1],message:e.name}}_getAnyNestedObject(e,r){return r.reduce((t,n)=>{const l=t.nested;if(l){const i=l[n];if(i)return i}throw new Error(`Cannot locate ${r.join(".")} in schema with ID ${this.getSchemaId(e)}`)},e.pbjsSchema)}getTypes(e){const r=this.checkSchema(e),n=this._getAnyNestedObject(e,[r.domain,r.feature]).nested;if(!n)throw new Error(`Cannot parse schema with ID ${this.getSchemaId(e)}`);return n}getType(e,r){E.requireArgument(r,"messageName","string");const n=this.getTypes(e)[r];if(!n)throw new Error(`Cannot locate message ${r} in schema with ID ${this.getSchemaId(e)}`);return n}getOptions(e,r,t){t&&E.requireArgument(r,"messageName","string");const n=this.checkSchema(e);if(!r)return this._getAnyNestedObject(e,[n.domain,n.feature]).options;const l=this.getType(e,r);if(!t)return l.options;const i=l.fields[t];if(!i){const c=this.getSchemaId(e);throw new Error(`Cannot locate field ${t} in message ${r} in schema with ID ${c}`)}return i.options}getExtraFields(e,r){const{message:t}=this._getTokens(e),l=this.getTypes(e)[t].fields,i=new Set(Object.keys(l));return r!=null?Object.keys(r).filter(p=>!i.has(p)):[]}}const M=new _r,Be=1e4,ot=1e4,at=0,lt=2147483647,ut=-2147483648,br=4294967295,wr=9223372036854776e3,Er=-9223372036854776e3,kr=18446744073709552e3;class dt{constructor(e,r,t,n){this.errorCode=e,this.fields=r,this.expected=t,this.received=n}asMessage(e){const r=this.fields[0]+this.fields.slice(1).reduce((n,l)=>Number(l)>=0?`${n}[${l}]`:`${n}.${l}`,"");let t;switch(this.errorCode){case 1:t="Repeated field must be an array";break;case 2:t=`Expected type ${this.expected} but received type ${this.received}`;break;case 3:t="Value must be finite";break;case 4:t="Value is out of range for its type";break;case 5:t="Bytes array is malformed";break;case 6:t="Exceeded app limit for maximum string length";break;case 7:t="Exceeded app limit for item count";break;case 12:t="Value must be an integer";break;case 13:t="Values like null or undefined are not allowed for items in repeated fields";break;default:t=`Unknown error code: ${this.errorCode}`;break}return`Schema ${e} on field "${r}": ${t}`}}class Ar{validate(e,r,t=!1){const n=M.checkSchema(e);E.requireArgument(r,"data","object");const l=M.getSchemaId(e),i=new Array,c=M.getTypes(e);if(this._validateFields(i,[],r,c[n.message],e.pbjsSchema.nested,l,[n.domain,n.feature,n.message]),i.length&&!t)throw new Error(i[0].asMessage(l));return i}_validateFields(e,r,t,n,l,i,c){const p=n.oneofs||{},h=n.fields||{};for(const s in t){const a=t[s];if(a!=null){const d=(o,f,g)=>this._matchFieldTypes(e,[...r,s],a,o,l,i,c,f,g);p[s]?d(h[p[s].oneof[0]].type):h[s]&&d(h[s].type,h[s].rule==="repeated")}}}_matchFieldTypes(e,r,t,n,l,i,c,p,h){let s;if(p)Array.isArray(t)?(t.length>ot&&(s=7),t.forEach((a,d)=>{this._matchFieldTypes(e,[...r,d.toString()],a,n,l,i,c,void 0,!0)})):s=1;else if(t==null||t===void 0)h&&(s=13);else{let a,d,o;switch(n){case"string":d="string",t.length>Be&&(s=6);break;case"bytes":d="object",t instanceof Uint8Array||(s=5);break;case"bool":d="boolean";break;case"uint32":d="number",a={min:at,max:br,isInt:!0,isItem:h};break;case"int32":case"sint32":case"fixed32":case"sfixed32":d="number",a={min:ut,max:lt,isInt:!0,isItem:h};break;case"uint64":d="number",a={min:at,max:kr,isInt:!0,isItem:h};break;case"fixed64":case"sfixed64":case"int64":case"sint64":d="number",a={min:Er,max:wr,isInt:!0,isItem:h};break;case"double":case"float":d="number",a={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,isInt:!1,isItem:h};break;default:{const f=n.startsWith("."),g=(f?n.slice(1):n).split(".");let m,_;for(let y=f?0:c.length;y>=0;y--){_=[...c.slice(0,y),...g];let b=l;m=void 0;for(const k of _)m=b==null?void 0:b[k],b=m&&"nested"in m?m.nested:void 0;if(m)break}m&&"values"in m?(d="number",o=Object.values(m.values),a={min:ut,max:lt,isInt:!0,isItem:h}):m&&"fields"in m&&(this._validateFields(e,r,t,m,l,i,_),d="object");break}}typeof t!==d?e.push(new dt(2,r,n,typeof t)):a&&(a.isInt&&!Number.isFinite(t)?s=3:a.isInt&&!Number.isInteger(t)?s=12:(!(!a.isInt&&Number.isNaN(t))&&!(t>=a.min&&t<=a.max)||o&&!o.includes(t))&&(s=4))}s&&e.push(new dt(s,r))}}const ct=new Ar;class Sr{_getMetricTags(e){const r=e.getTags();if(r)return Object.entries(r).map(t=>({name:t[0],value:t[1].toString()}))}getUpCounters(e,r=!0){return e.map(t=>{const n={name:t.getName(),createdTimestamp:t.getCreatedOn(),lastUpdatedTimestamp:t.getLastUpdatedOn(),value:t.getData(),ownerName:t.getOwnerName(),ownerAppName:t.getOwnerAppName(),tags:this._getMetricTags(t)};return r&&t.reset(),n})}getValueRecorders(e,r=!0){return e.map(t=>{const n={name:t.getName(),createdTimestamp:t.getCreatedOn(),lastUpdatedTimestamp:t.getLastUpdatedOn(),values:t.getData(),ownerName:t.getOwnerName(),ownerAppName:t.getOwnerAppName(),tags:this._getMetricTags(t)};return r&&t.reset(),n})}getBucketHistograms(e,r=!0){return e.map(t=>{const n={name:t.getName(),createdTimestamp:t.getCreatedOn(),lastUpdatedTimestamp:t.getLastUpdatedOn(),values:t.getData(),buckets:t.getBuckets(),ownerName:t.getOwnerName(),ownerAppName:t.getOwnerAppName(),tags:this._getMetricTags(t)};return r&&t.reset(),n})}getMetricsTags(e){const r={};return e.forEach(t=>{r[t.name]=t.value}),r}}const W=Object.freeze(new Sr);class Or{checkInputs(e,r){M.checkSchema(e),E.requireArgument(r,"data","object");let t,n;r.userPayload!==void 0&&M.isInternal(e)&&(n=r.userPayload,t=ct.validate(n.schema,n.payload,!0),this._processValidationResults(M.getSchemaId(n.schema),n.payload,t),r.userPayload=void 0),t=ct.validate(e,r,!0),this._processValidationResults(M.getSchemaId(e),r,t),n!==void 0&&(r.userPayload=n)}getExtraFields(e,r){E.requireArgument(r,"data","object");const t=[],n=r.userPayload;return n!==void 0&&M.isInternal(e)&&t.push(...M.getExtraFields(n.schema,n.payload)),t.push(...M.getExtraFields(e,r)),t}getPayloadFromProvider(e,r){const t=(e==null?void 0:e.getPayload(r))||void 0;return t&&this.checkInputs(t.schema,t.payload),t}_processValidationResults(e,r,t){for(let n=0;n<t.length;n+=1){const l=t[n];if(l.errorCode==6||l.errorCode==7){const i=l.fields.length-1,c=this._traverseFields(r,l.fields.slice(0,i)),p=l.fields[i];l.errorCode==6?c[p]=c[p].substring(0,Be):c[p].splice(ot)}else throw new Error(l.asMessage(e))}}_traverseFields(e,r){return r.length?this._traverseFields(e[r[0]],r.slice(1)):e}}const be=Object.freeze(new Or),ft="o11y";class ht{constructor(e){this._errorCounter=e,this._safeCatchMode=!1}_callCo11y(e,r){r?ne.exception(e==null?void 0:e.op,ft):ne.success(e==null?void 0:e.op,ft)}tryCatch(e,r){let t;try{e()}catch(n){t=!0,this._prodSafeCatch(n)}finally{this._callCo11y(r,t)}}tryCatchReturn(e,r,t){let n;try{return E.requireArgument(r,"noopValue"),e()}catch(l){return n=!0,this._prodSafeCatch(l),r}finally{this._callCo11y(t,n)}}_prodSafeCatch(e){let r;try{if(r=!E.isProduction,r)throw e;if(this._safeCatchMode)throw this._safeCatchMode=!1,new Error("Internal error in prodSafeCatch.");if(this._safeCatchMode=!0,this._errorCounter&&this._errorCounter.increment(),!(e instanceof Error)){const t=e&&e.message||(typeof e.toString=="function"?e.toString():"");e=new Error(t)}this._safeCatchMode=!1}catch(t){if(r)throw t;if(t&&console&&typeof console.error=="function")try{console.error(t)}catch(n){}this._safeCatchMode=!1}}}const Cr=Symbol("o11y.stampTenantClass");class Ir{get isBusy(){return this._isOk?this._busyCount>0:void 0}constructor(e,r,t,n){this.name=e,this._doneCallback=t,this._overDoneCallback=n,this._busyCount=0,this._isOk=!0,this._busyCount=r}add(){this._isOk&&(this._busyCount+=1)}done(){this._isOk&&(this._busyCount>0?(this._busyCount-=1,this._busyCount||this._doneCallback()):(this._isOk=!1,this._overDoneCallback()))}}const Tr=300;class xr{constructor(e){this._taskers=new Map,this._listeners=new Set,this._busyCheckers=new Map,this._logThreshold=Tr,this._endedTasks=new Array,this._pollableReport=new Array,E.requireArgumentIfDefined(e==null?void 0:e.logThreshold,"options.logThreshold","number")&&(this._logThreshold=e.logThreshold),E.requireArgumentIfDefined(e==null?void 0:e.reportListener,"options.reportListener","function")&&(this._reportListener=e.reportListener),E.requireArgumentIfDefined(e==null?void 0:e.errorListener,"options.errorListener","function")&&(this._errorListener=e.errorListener)}requestIdleDetectedCallback(e){E.requireArgument(e,"callback","function"),this._listeners.size===0&&(this._firstCallbackTime=E.time().perfNow),this._listeners.add(e),this._checkIfLoaded()}_reportTaskEnded(e){if(this._listeners.size){const r=Object.assign({},this._taskers.get(e));this._endedTasks.push(r)}}declareNotifierTaskSingle(e){E.requireArgument(e,"name","string");const r=this._addTasker(e,1);return{get isBusy(){return r.isBusy},done:()=>{r.done(),this._taskers.delete(r)}}}declareNotifierTaskMulti(e,r=0){if(E.requireArgument(e,"name","string"),r!==void 0&&(E.requireArgument(r,"existingBusyCount","number"),!Number.isInteger(r)||r<0))throw new Error("existingBusyCount accepts only non-negative integers");const t=this._addTasker(e,r);return{get isBusy(){return t.isBusy},add:()=>{if(!t.isBusy){const l=this._taskers.get(t);l.start=E.time().perfNow,l.end=void 0}t.add()},done:t.done.bind(t)}}declarePollableTaskMulti(e,r){E.requireArgument(e,"name","string"),E.requireArgument(r,"isBusyChecker","function"),this._busyCheckers.set(r,e)}_addTasker(e,r){const t=new Ir(e,r,()=>{this._taskers.get(t).end=E.time().perfNow,this._reportTaskEnded(t),this._checkIfLoaded()},()=>{var n;(n=this._errorListener)===null||n===void 0||n.call(this,`Overdone: ${t.name}`),E.noProdThrow(`Tasker '${t.name}' is done too many times.`)});return this._taskers.set(t,{name:e,start:r>0?E.time().perfNow:void 0,end:void 0}),t}_areAllNotifiersIdle(){return!Array.from(this._taskers.keys()).some(e=>e.isBusy)}_getFirstBusyPollable(){const e=Array.from(this._busyCheckers).find(r=>{var t;const n=r[0],l=r[1];try{return n()}catch(i){return(t=this._errorListener)===null||t===void 0||t.call(this,i,`BusyChecker ${l}`),E.noProdThrow(i),!1}});return e?e[1]:void 0}_checkIfLoaded(){this._listeners.size&&(this._timerCheckQueued&&clearTimeout(this._timerCheckQueued),this._areAllNotifiersIdle()&&(this._timerCheckQueued=setTimeout(()=>{this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},40)},0)))}_doubleCheck(){if(this._timerCheckQueued=void 0,this._areAllNotifiersIdle()){const e=this._getFirstBusyPollable();if(e!==void 0)this._addToPollableReport(e),this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},15);else{const r=E.time().perfNow-this._firstCallbackTime,t=Array.from(this._listeners.values());this._listeners.clear(),this._firstCallbackTime=void 0;const n=this._endedTasks.splice(0),l=this._pollableReport.splice(0);this._notify(t,r,n,l)}}}_addToPollableReport(e){const r=this._pollableReport.length?this._pollableReport[this._pollableReport.length-1]:void 0;(r==null?void 0:r.name)===e?r.count+=1:this._pollableReport.push({name:e,count:1})}_notify(e,r,t,n){var l;if(r>=this._logThreshold&&this._reportListener){const c=this._getReport(r,e.length,t,n);this._reportListener(c)}e.reverse();const i=E.time().tsNow;for(const[c,p]of e.entries())try{p(i)}catch(h){(l=this._errorListener)===null||l===void 0||l.call(this,h,`Listener #${e.length-1-c}`),E.noProdThrow(h)}}getReport(){const e=E.time().perfNow,r=this._firstCallbackTime>0?e-this._firstCallbackTime:void 0,t=Array.from(this._taskers.entries()).filter(n=>n[0].isBusy).map(n=>({name:n[1].name,start:n[1].start,end:e}));return this._getReport(r,this._listeners.size,this._endedTasks.concat(t),this._pollableReport)}_getReport(e,r,t,n){const l=t.map(i=>({name:i.name,duration:i.end-i.start})).sort((i,c)=>c.duration-i.duration);return{logThreshold:this._logThreshold,maxDuration:e,listenerCount:r,pollableCount:this._busyCheckers.size,busyTasks:l.map(i=>i.name),busyDurations:l.map(i=>i.duration),pollables:n.map(i=>i.name),pollCounts:n.map(i=>i.count)}}}const Nr={namespace:"sfcore.performance",name:"ResourceTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{ResourceTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"}}}}}}}}}},jr={namespace:"sfcore.performance",name:"NavigationTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{NavigationTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{redirectCount:{id:37,type:"uint32"},encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},unloadEventEnd:{id:40,type:"double"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},unloadEventStart:{id:39,type:"double"},domContentLoadedEventStart:{id:32,type:"double"},type:{id:38,type:"string"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},domContentLoadedEventEnd:{id:33,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domInteractive:{id:34,type:"double"},domComplete:{id:31,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},logEvent:{id:41,type:"string"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},loadEventStart:{id:35,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"},loadEventEnd:{id:36,type:"double"}}}}}}}}}};class Rr{constructor(e){this._fuzzyKeyRange=e,this._map=new Map,E.requireArgument(e,"_fuzzyKeyRange","number")}add(e,r,t){const n=this._map.get(e);n?n.push({fuzzyKey:r,value:t}):this._map.set(e,[{fuzzyKey:r,value:t}])}pop(e,r){const t=this._map.get(e);if((t==null?void 0:t.length)>=1){let n=Number.POSITIVE_INFINITY,l=-1;for(let i=0;i<t.length;i++){const{fuzzyKey:c}=t[i],p=Math.abs(c-r);p<=this._fuzzyKeyRange&&p<n&&(n=p,l=i)}if(l>=0){const{value:i}=t.splice(l,1)[0];return t.length===0&&this._map.delete(e),i}}}clear(){this._map.clear()}}const Pr=["fetch","xmlhttprequest"];class Lr{constructor(e,r,t,n,l){if(this._instr=e,this._skipUrls=t,this._logPerformanceActivityName=n,this._boundObserverCallback=this._logPerformanceEntries.bind(this),this._boundNavigationTimingEventCallback=i=>{this._logNavigationEntries(i)},this._setTimeoutNavigationCallback=i=>{setTimeout(()=>{this._boundNavigationTimingEventCallback(i)},0)},this._visibilityChangeNavigationCallback=i=>{document.visibilityState==="hidden"&&this._boundNavigationTimingEventCallback(i)},this._isStarted=!1,this._processedNavigationTiming=!1,E.requireArgument(e,"_instr","object"),E.requireArgument(r,"fuzzyMapRange","number"),E.requireArgumentIfDefined(t,"_skipUrls",Array),E.requireArgumentIfDefined(n,"_logPerformanceActivityName","string"),E.requireArgumentIfDefined(l,"logLevel","string"),this._hasPerf=typeof performance!="undefined"&&typeof PerformanceObserver=="function",this._hasWindow=typeof window!="undefined",!l||l.toLowerCase()==="full")this._logLevel=1;else if((l==null?void 0:l.toLowerCase())==="basic")this._logLevel=0;else throw new Error(`Invalid log level: ${l}`);this._fuzzyMapper=new Rr(r)}get isStarted(){return this._isStarted}get logLevel(){return this._logLevel}start(){this._hasPerf&&(this._isStarted||(this._isStarted=!0,this._resourceObserver=new PerformanceObserver(this._boundObserverCallback),this._resourceObserver.observe({type:"resource",buffered:!0}),this._addNavigationListeners()))}stop(){this._resourceObserver&&(this._resourceObserver.disconnect(),this._resourceObserver=void 0),this._removeNavigationListeners(),this._fuzzyMapper.clear(),this._isStarted=!1}_addNavigationListeners(){this._hasWindow&&(window.addEventListener("load",this._setTimeoutNavigationCallback),window.addEventListener("pagehide",this._boundNavigationTimingEventCallback),document.addEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}_removeNavigationListeners(){this._hasWindow&&(window.removeEventListener("load",this._setTimeoutNavigationCallback),window.removeEventListener("pagehide",this._boundNavigationTimingEventCallback),document.removeEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}addEntry(e,r,t){this._fuzzyMapper.add(e,r,t)}_resourceEntryToResourceTiming(e){var r,t;const n={name:e.name,startTime:e.startTime,duration:e.duration,initiatorType:e.initiatorType,nextHopProtocol:e.nextHopProtocol,renderBlockingStatus:e.renderBlockingStatus,workerStart:e.workerStart,redirectStart:e.redirectStart,redirectEnd:e.redirectEnd,fetchStart:e.fetchStart,domainLookupStart:e.domainLookupStart,domainLookupEnd:e.domainLookupEnd,connectStart:e.connectStart,secureConnectionStart:e.secureConnectionStart,connectEnd:e.connectEnd,requestStart:e.requestStart,responseStart:e.responseStart,firstInterimResponseStart:e.firstInterimResponseStart,responseEnd:e.responseEnd,transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,responseStatus:e.responseStatus},l=e.serverTiming;return Array.isArray(l)&&(n.dbDuration=(r=l.find(i=>i.name==="db"))===null||r===void 0?void 0:r.duration,n.srvDuration=(t=l.find(i=>i.name==="Total"))===null||t===void 0?void 0:t.duration),n}_shouldInclude(e){var r;return((r=this._skipUrls)===null||r===void 0?void 0:r.some(n=>n instanceof RegExp?n.test(e.name):e.name===n))?!1:this._logLevel===1?!0:Pr.indexOf(e.initiatorType)>=0||e.entryType==="navigation"}_calculateXhrDelay(e,r){if(r){if(e.initiatorType==="fetch"){if(e.responseStart===0)return-1;if(r.activityDuration!==void 0){const t=e.responseStart-e.startTime;return r.activityDuration-t}return}if(r.activityDuration!==void 0)return r.activityDuration-e.duration}}_logActivity(e,r,t,n){const l={id:t},i={perfStartOverride:r.startTime,perfStopOverride:r.startTime+r.duration,errorCount:n};this._instr.startActivity(this._logPerformanceActivityName,l).stop(e,r,i)}_logNavigationEntries(e){if(!this._processedNavigationTiming)for(const r of performance.getEntriesByType("navigation")){const t=r;if(this._shouldInclude(t)){this._processedNavigationTiming=!0;const n=this._resourceEntryToResourceTiming(t),l={domComplete:t.domComplete,domContentLoadedEventStart:t.domContentLoadedEventStart,domContentLoadedEventEnd:t.domContentLoadedEventEnd,domInteractive:t.domInteractive,loadEventStart:t.loadEventStart,loadEventEnd:t.loadEventEnd,redirectCount:t.redirectCount,type:t.type,unloadEventStart:t.unloadEventStart,unloadEventEnd:t.unloadEventEnd,logEvent:e.type};this._logActivity(jr,Object.assign(n,l))}break}}_logPerformanceEntries(e){for(const r of e.getEntriesByType("resource")){const t=r,n=this._fuzzyMapper.pop(t.name,t.startTime);if(this._shouldInclude(t)){const l=this._resourceEntryToResourceTiming(t);Object.assign(l,{srvReqId:n==null?void 0:n.requestId,xhrDelay:this._calculateXhrDelay(t,n)}),l.responseStatus===void 0&&(l.responseStatus=n==null?void 0:n.responseStatus),this._logActivity(Nr,l,n==null?void 0:n.activityId,n==null?void 0:n.errorCount)}}}}const Dr=32,Mr=16,pt=16,qr="traceparent",Br="b3",mt="X-B3-TraceId",yt="X-B3-SpanId",gt="X-B3-Sampled",vt="X-B3-ParentSpanId",_t="X-SFDC-Request-Id",Fr="baggage",Hr="fetch",Ur="xhr_send",$r="perf-timing",zr=50,Vr=[Fr,mt,yt,vt,gt],ee=new WeakMap;class C{constructor(e,r){this._instr=e,this._idleDetector=r,E.requireArgument(e,"_instr","object"),E.requireArgument(r,"_idleDetector","object")}static _getB3CompactFormat(e,r,t,n){let l=`${e}-${r}`;return(t!==void 0||n!==void 0)&&(l+=t?"-1":"-0",n!==void 0&&(l+=`-${n}`)),l}static _getW3CompactFormat(e,r,t){return`00-${e}-${r}-${t?"01":"00"}`}static _conformTextAsId(e,r){e=e.toLowerCase();const t=e.length;for(let n=0;n<t;n+=1){const l=e[n];if(!(l>="a"&&l<="f")&&!(l>="0"&&l<="9"))throw new Error(`The text '${e}' has an invalid character at index #${n}`)}return t>r?e.substr(t-r):t<r?e.padStart(r,"0"):e}static setHeaders(e){if(e===void 0){C._userHeaders={};return}Object.entries(e).forEach(([r])=>{Vr.includes(r)||delete e[r]}),C._userHeaders=e}static getHeaders(e,r,t,n){E.requireArgument(r,"spanId","string");const l=n==null?void 0:n.useB3Headers,i={};if(e===void 0)return i;e=this._conformTextAsId(e,(n==null?void 0:n.traceIdEffectiveLength)!==void 0?n.traceIdEffectiveLength:l?Mr:Dr),r=this._conformTextAsId(r,pt);const c=n&&n.parentSpanId!==void 0&&this._conformTextAsId(n.parentSpanId,pt)||void 0;return l?(n==null?void 0:n.useCompactHeader)?i[Br]=this._getB3CompactFormat(e,r,t,c):(i[mt]=e,i[yt]=r,c!==void 0&&(i[vt]=c),t!==void 0&&(i[gt]=t?"1":"0")):i[qr]=this._getW3CompactFormat(e,r,t),i}_disableNetworkInstrumentation(){C._isNetworkInstrumentationEnabled&&(C._originalFetch&&(C._global.fetch=C._originalFetch,C._originalFetch=void 0),C._originalXhr&&(C._global.XMLHttpRequest=C._originalXhr,C._originalXhr=void 0),C._originalXhrOpen&&(C._global.XMLHttpRequest.prototype.open=C._originalXhrOpen,C._originalXhrOpen=void 0),C._originalXhrSetRequestHeader&&(C._global.XMLHttpRequest.prototype.setRequestHeader=C._originalXhrSetRequestHeader,C._originalXhrSetRequestHeader=void 0),C._originalXhrSend&&(C._global.XMLHttpRequest.prototype.send=C._originalXhrSend,C._originalXhrSend=void 0),C._performanceObservability&&(C._performanceObservability.stop(),C._performanceObservability=void 0),C._isNetworkInstrumentationEnabled=!1)}_enableNetworkInstrumentation(e,r,t,n,l,i,c,p,h,s){typeof C._global.fetch=="function"&&(this._overrideFetch(e,r,t,n,l,i,h),C._isNetworkInstrumentationEnabled=!0),typeof C._global.XMLHttpRequest=="function"&&(this._overrideXhr(e,r,t,n,l,i,h),C._isNetworkInstrumentationEnabled=!0),c&&(C._performanceObservability=new Lr(e,s,h,p,c===!0?"full":c),C._performanceObservability.start(),C._isNetworkInstrumentationEnabled=!0)}static _getTraceHeaders(e,r,t,n,l){let i;if(e)i=e.getTraceHeaders(t)||{};else{const c=r.internalInstrumentationContext;c!=null&&c.rootId?i=C.getHeaders(c.rootId,E.generateUniqueId(),c.isRootActivitySampled,t):i={}}if(typeof(t==null?void 0:t.headerProcessor)=="function")i=t.headerProcessor({method:n,url:l,defaultHeaders:i});else if(typeof window=="object"){let c;try{c=new URL(l)}catch(p){}c&&c.host!==window.location.host&&(i=void 0)}return C._userHeaders&&Object.keys(C._userHeaders).length>0&&(i=mr({},i),Object.entries(C._userHeaders).forEach(([c,p])=>{i[c]=p}),C._userHeaders=void 0),i||{}}static _extractHeader(e,r,t){if((t==null?void 0:t.headers)instanceof Headers)return t.headers.get(e);if(Array.isArray(t==null?void 0:t.headers)){const n=t.headers.find(l=>l[0]===e);return n==null?void 0:n[1]}if(typeof(t==null?void 0:t.headers)=="object")return t.headers[e];if(r instanceof Request)return r.headers.get(e)}_overrideFetch(e,r,t,n,l,i,c){C._originalFetch=C._global.fetch;const p=(h,s,...a)=>re(this,null,function*(){var d;let o,f,g,m,_,y=!1,b;try{i==null||i.add(),m=s==null?void 0:s.method;const k=s==null?void 0:s.o11y,v=k==null?void 0:k.skipInstr;if(y=v||C._shouldSkipUrl(c,h),!y)o=e.startActivity(t||Hr);else if(v){C._reqIndex+=1;try{if(h instanceof URL)h.searchParams.append("o11y",C._reqIndex.toString());else if(typeof h=="string"){const O=new URL(h),w=`o11y=${C._reqIndex}`;O.search+=O.search.startsWith("?")?`&${w}`:w,h=O.toString()}}catch(O){}}if(s==null||delete s.o11y,f=h==null?void 0:h.toString(),g=E.tryGetAbsoluteUrl(f),n){h instanceof Request&&(m||(m=h.method),f=h.url,g=E.tryGetAbsoluteUrl(f));const O=C._getTraceHeaders(o,e,l,m,g);!this._applyTraceHeaders(h,s,O)&&s===void 0&&(s={headers:O})}return _=E.perfNow(),b=yield C._originalFetch.call(C._global,h,s,...a),b}catch(k){throw r&&!y&&(o?o.error(k):e.error(k)),k}finally{try{const k=C._endActivity(o,f,m);if(!((d=C._performanceObservability)===null||d===void 0)&&d.isStarted){const O={requestId:C._extractHeader(_t,h,s),activityDuration:k,activityId:o==null?void 0:o.getId(),errorCount:o==null?void 0:o.getErrorCount(),responseStatus:b==null?void 0:b.status};C._performanceObservability.addEntry(g,_,O)}}finally{i==null||i.done()}}});C._global.fetch=p}static _endActivity(e,r,t){var n;if(e)return!((n=C._performanceObservability)===null||n===void 0)&&n.isStarted?e.discard():e.stop(ve,{mtd:t,url:r}),e.getStopPerfTime()-e.getStartPerfTime()}_overrideXhr(e,r,t,n,l,i,c){C._originalXhr=C._global.XMLHttpRequest,C._originalXhrOpen=C._originalXhr.prototype.open,C._originalXhrSetRequestHeader=C._originalXhr.prototype.setRequestHeader,C._originalXhrSend=C._originalXhr.prototype.send;function p(s,a){var d;const o=ee.get(s);if(o){const f=o.activity,g=C._endActivity(f,o.url,o.method);!a&&(!((d=C._performanceObservability)===null||d===void 0)&&d.isStarted)&&C._performanceObservability.addEntry(o.absoluteUrl,o.sendTime,{requestId:o.requestId,activityDuration:g,activityId:f==null?void 0:f.getId(),errorCount:f==null?void 0:f.getErrorCount(),responseStatus:s.status})}}C._originalXhr.prototype.open=function(s,a,d,o,f){const g={method:s,url:a==null?void 0:a.toString()};ee.set(this,g),g.absoluteUrl=E.tryGetAbsoluteUrl(g.url),g.suspendInstrumentation=C._shouldSkipUrl(c,g.absoluteUrl),C._originalXhrOpen.apply(this,arguments)},C._originalXhr.prototype.setRequestHeader=function(s,a){var d;if(((d=s==null?void 0:s.toLowerCase)===null||d===void 0?void 0:d.call(s))===_t.toLowerCase()){const o=ee.get(this);o&&(o.requestId=a)}C._originalXhrSetRequestHeader.apply(this,arguments)},C._originalXhr.prototype.send=function(...s){let a;const d=this;let o=ee.get(d);o||(o={},ee.set(d,o));try{if(i==null||i.add(),o.suspendInstrumentation||(o.activity=a=e.startActivity(t||Ur)),n){const f=C._getTraceHeaders(a,e,l,o.method,o.absoluteUrl);Object.entries(f).forEach(g=>{d.setRequestHeader(g[0],g[1])})}o.sendTime=E.perfNow(),C._originalXhrSend.call(this,...s)}catch(f){throw r&&!(o!=null&&o.suspendInstrumentation)&&(a?a.error(f):e.error(f)),p(d,!0),i==null||i.done(),f}};const h=new Proxy(C._originalXhr,{construct(s){const a=new s;return a.addEventListener("load",()=>{p(a),i==null||i.done()}),a.addEventListener("error",d=>{const o=ee.get(a)||{};try{if(r&&!(o!=null&&o.suspendInstrumentation)){const f=new Error("XHR Network-Level Error"),g=o==null?void 0:o.activity;g?g.error(f):e.error(f)}p(a)}finally{i==null||i.done()}}),a.addEventListener("abort",()=>{var d;const o=ee.get(a)||{};(d=o==null?void 0:o.activity)===null||d===void 0||d.discard(),i==null||i.done()}),a}});C._global.XMLHttpRequest=h}networkInstrumentation(e){var r;if(E.requireArgument(e,"options",["boolean","object"]),this._disableNetworkInstrumentation(),e){const t=typeof e=="object"?e:{};let n;E.definedValueOrDefault(t.useTasker,!0)&&(n=(r=this._idleDetector)===null||r===void 0?void 0:r.declareNotifierTaskMulti("o11y network")),this._enableNetworkInstrumentation(E.definedValueOrDefault(t.instrumentation,this._instr),E.definedValueOrDefault(t.logErrors,!0),t.activityName,E.definedValueOrDefault(t.useTracing,!0),t.tracingHeadersOptions,n,E.definedValueOrDefault(t.logPerformance,!0),E.definedValueOrDefault(t.logPerformanceActivityName,$r),E.definedValueOrDefault(t.skipUrls,[]),E.definedValueOrDefault(t.fuzzyMapRange,zr))}}resetRequestCounter(){C._reqIndex=0}_applyTraceHeaders(e,r,t){if((r==null?void 0:r.headers)!==void 0){if(r.headers instanceof Headers&&typeof r.headers.set=="function")return Object.entries(t).forEach(([n,l])=>{r.headers.set(n,l)}),!0;if(Array.isArray(r.headers))return Object.entries(t).forEach(n=>{r.headers.push(n)}),!0;if(typeof r.headers=="object")return r.headers=Object.assign(r.headers,t),!0}else{if(e instanceof Request&&e.headers instanceof Headers)return Object.entries(t).forEach(([n,l])=>{e.headers.set(n,l)}),!0;if(r)return r.headers=Object.assign({},t),!0}return!1}static _shouldSkipUrl(e,r){var t;let n=r;return r instanceof URL?n=(t=r.toString)===null||t===void 0?void 0:t.call(r):r instanceof Request&&(n=r.url),e==null?void 0:e.some(l=>l instanceof RegExp?l.test(n):n===l)}}C._global=E.getGlobal(),C._isNetworkInstrumentationEnabled=!1,C._reqIndex=0;var G;(function(u){u[u.none=0]="none",u[u.start=1]="start",u[u.stop=2]="stop",u[u.both=3]="both"})(G||(G={}));const Xr="timedout",Jr="terminated",Fe="discarded",we={timedout:Xr,terminated:Jr,discarded:Fe};class se{constructor(e,r,t,n,l,i,c,p,h,s,a){var d,o;this._name=e,this._rootId=r,this._onStopped=t,this._onError=n,this._isSampled=c,this._noRerooting=h,this._isExternal=s,this._parentActivity=a,this._isRoot=!1,this._errorCount=0,this._timerOverridden=G.none;const{tsNow:f,perfNow:g}=E.time();if(se._count+=1,this._id=i||E.generateUniqueId(),this._usePerf=typeof performance!="undefined"&&typeof performance.mark=="function"&&typeof performance.measure=="function",this._usePerf){this._perfName=`${this._name}__${se._count}`,this._perfId=`${this._name}__${this.id}`;try{performance.mark(this._perfId)}catch(m){this._usePerf=!1}}this._startTimestamp=f,this._startPerfTime=g,this._overrideTimer(p),l>0&&(this._timer=setTimeout(()=>{this._stopReason=this._stopReason||we.timedout,this.stop()},l)),this._safety=new ht,this._externalParentActivity=!((d=this._parentActivity)===null||d===void 0)&&d.isExternal()?this._parentActivity:(o=this._parentActivity)===null||o===void 0?void 0:o.getExternalParentActivity()}get id(){return this._id}getId(){return this.id}getRootId(){return this._rootId}get stopReason(){return this._stopReason}getParentActivity(){return this._parentActivity}isExternal(){var e;return(e=this._isExternal)!==null&&e!==void 0?e:!1}getExternalParentActivity(){return this._externalParentActivity}error(e,r,t){this._safety.tryCatch(()=>{this._errorCount+=1,typeof e=="string"&&(e=new Error(e)),this._onError(e,this._getDetail(r,t))},{op:"activity.error"})}stop(e,r,t){this._safety.tryCatch(()=>{if(E.requireArgumentIfDefined(e,"userSchemaOrText",["object","string"]),E.requireArgumentIfDefined(r,"userData","object"),t){const n=t.perfStartOverride,l=E.requireArgumentIfDefined(n,"options.perfStartOverride","number"),i=t.perfStopOverride,c=E.requireArgumentIfDefined(i,"options.perfStopOverride","number"),p=t.errorCount;if(E.requireArgumentIfDefined(p,"options.errorCount","number")&&(this._errorCount=p),l&&n<0)throw new Error("perfStartOverride, if defined, must be >= 0");if(c&&(i<0||i<(l?n:this._startPerfTime)||i>E.time().perfNow+100))throw new Error("perfStopOverride, if defined, must be >= 0 and >= startTime and <= now")}this._stopInternal(e,r,t)},{op:"activity.stop"})}_overrideTimer(e,r){e!==void 0&&(this._startTimestamp=Math.round(this._startTimestamp-(this._startPerfTime-e)),this._startPerfTime=e,this._setTimerOverride(G.start)),r!==void 0&&(this._stopPerfTime=r,this._setTimerOverride(G.stop))}_setTimerOverride(e){this._timerOverridden===G.both||this._timerOverridden===e||e===G.none||(this._timerOverridden=this._timerOverridden===G.none?e:G.both)}_stopInternal(e,r,t){const n=E.perfNow();if(this._usePerf)try{this._stopReason!==we.discarded&&performance.measure(this._perfName,this._perfId),performance.clearMarks(this._perfId),performance.clearMeasures(this._perfName)}catch(i){}if(this._timer&&(clearTimeout(this._timer),this._timer=void 0),this.isStopped)return;t&&this._overrideTimer(t.perfStartOverride,t.perfStopOverride),this._stopPerfTime=this._timerOverridden===G.none||this._timerOverridden===G.start?n:this._stopPerfTime;const l=this._getDetail(e,r);this._onStopped(l)}get isStopped(){return this._stopPerfTime!==void 0}discard(){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||we.discarded,this.stop()},{op:"activity.discard"})}terminate(e,r,t){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||we.terminated,this.stop(e,r,t)},{op:"activity.terminate"})}getIsSampled(){return this._isSampled||!1}_getDetail(e,r){return{id:this._id,rootId:this._rootId,name:this._name,userSchemaOrText:e,userData:r,stopReason:this._stopReason,startTimestamp:this._startTimestamp,startPerfTime:this._startPerfTime,stopPerfTime:this._stopPerfTime,errorCount:this._errorCount,isSampled:this.getIsSampled(),timerOverridden:this._timerOverridden,noRerooting:this._noRerooting,isExternal:this._isExternal,parentActivity:this._parentActivity,externalParentActivity:this._externalParentActivity}}getTraceHeaders(e){const r=this.id,t=this._isRoot?this.id:this._rootId;return C.getHeaders(t,r,this.getIsSampled(),e)}getStartTimestamp(){return this._startTimestamp}getStartPerfTime(){return this._startPerfTime}getStopPerfTime(){return this._stopPerfTime}getErrorCount(){return this._errorCount}}se._count=0;const Gr=new Array(16).fill(0).join("");class Kr{getId(){return Gr}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const Yr=Object.freeze(new Kr);class Wr{getInstrumentedEventData(e,r,t,n){var l;const i={ownerComponent:t.tagName,parentComponent:((l=t.parentElement)===null||l===void 0?void 0:l.tagName)||void 0,simplePath:E.getXpath(t)};switch(e){case 0:i.baseEvent=r;break;case 1:i.mouseEvent=r;break}return n&&(i.userPayload=M.makePayload(n.schema,n.payload,!0)),i}getEventData(e){return{type:e.type}}getMouseEventData(e){return{altKey:e.altKey,bubbles:e.bubbles,button:e.button,buttons:e.buttons,cancelable:e.cancelable,clientX:e.clientX,clientY:e.clientY,composed:e.composed,defaultPrevented:e.defaultPrevented,detail:e.detail,eventPhase:e.eventPhase,isTrusted:e.isTrusted,timeStamp:e.timeStamp,type:e.type,ctrlKey:e.ctrlKey,metaKey:e.metaKey,movementX:e.movementX,movementY:e.movementY,offsetX:e.offsetX,offsetY:e.offsetY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,shiftKey:e.shiftKey}}}const He=new Wr;class bt{constructor(e,r,t,n,l,i,c,p){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=n,this._buckets=l,this._values=new Array,this._createdOn=i===void 0?E.time().tsNow:i,c!==void 0&&(this._lastUpdatedOn=c),p!==void 0&&(this._values=p)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}getBuckets(){return this.buckets}get buckets(){return this._buckets.slice(0,this._buckets.length)}get values(){return this._values.slice(0,this._values.length)}record(e){if(typeof e=="number"){this._values.push(e),this._lastUpdatedOn=E.time().tsNow;return}throw new Error("BucketHistogram can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class wt{constructor(e,r,t,n,l,i,c){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=n,this._values=new Array,this._createdOn=l===void 0?E.time().tsNow:l,i!==void 0&&(this._lastUpdatedOn=i),c!==void 0&&(this._values=c)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}get values(){return this._values.slice(0,this._values.length)}record(e){if(typeof e=="number"){this._values.push(e),this._lastUpdatedOn=E.time().tsNow;return}throw new Error("ValueRecorder can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class Ue{constructor(e){if(this._map=new Map,typeof e=="number"&&e>0){this._maxSize=Math.ceil(e);return}throw new Error("maxSize must be a positive number")}get maxSize(){return this._maxSize}get(e){return this._map.get(e)}has(e){return this._map.has(e)}set(e,r){return this.has(e)||this._map.size<this.maxSize?(this._map.set(e,r),!0):!1}getElements(){return Array.from(this._map.values())}clear(){this._map.clear()}}const Et=1e3,kt=500,At=500;var oe;(function(u){u[u.Counter=0]="Counter",u[u.Percentile=1]="Percentile",u[u.BucketHistogram=2]="BucketHistogram"})(oe||(oe={}));class St{constructor(e,r){this._ownerName=e,this._getOwnerAppName=r,this._upCounters=new Ue(Et),this._valueRecorders=new Ue(kt),this._bucketHistograms=new Ue(At)}incrementCounter(e,r,t=!1,n={}){this._tagError(n,t),this._upCounter(e,n).increment(r)}trackValue(e,r,t=!1,n={}){this._tagError(n,t),this._valueRecorder(e,n).record(r)}bucketValue(e,r,t,n=!1,l={}){this._tagError(l,n),this._bucketHistogram(e,l,t).record(r)}_bucketHistogram(e,r,t){const{key:n,sortedTags:l}=this._getKeyAndSortedTags(e,r,oe.BucketHistogram);let i=this._bucketHistograms.get(n);if(!i&&(i=new bt(e,this._ownerName,this._getOwnerAppName(),l,t),!this._bucketHistograms.set(n,i)))throw new Error(`Max size of ${At} exceeded for BucketHistograms`);return i}_upCounter(e,r){const{key:t,sortedTags:n}=this._getKeyAndSortedTags(e,r,oe.Counter);let l=this._upCounters.get(t);if(!l&&(l=new qe(e,this._ownerName,this._getOwnerAppName(),n),!this._upCounters.set(t,l)))throw new Error(`Max size of ${Et} exceeded for UpCounters`);return l}_valueRecorder(e,r){const{key:t,sortedTags:n}=this._getKeyAndSortedTags(e,r,oe.Percentile);let l=this._valueRecorders.get(t);if(!l&&(l=new wt(e,this._ownerName,this._getOwnerAppName(),n),!this._valueRecorders.set(t,l)))throw new Error(`Max size of ${kt} exceeded for ValueRecorders`);return l}getUpCounters(){return this._upCounters.getElements()}getValueRecorders(){return this._valueRecorders.getElements()}getBucketHistograms(){return this._bucketHistograms.getElements()}_tagError(e,r){e.status=r===!0?"error":"success"}_getKeyAndSortedTags(e,r,t){const n=Object.keys(r).sort().reduce((i,c)=>(i[c]=r[c],i),{});return{key:`${oe[t]}:${e}${JSON.stringify(n)}`,sortedTags:n}}}class Zr{constructor(){this.isMock=!0}}const Qr=void 0,Ee=["`"],Ot={internalError:"o11y-error"},$e=Object.freeze(Array.from(Object.values(Ot))),ze=new WeakMap;class he{constructor(e,r){this._nextGen=e,this._name=r,this._onActivityStoppedCallback=this._handleActivityStop.bind(this),this._onActivityErrorCallback=this._handleActivityError.bind(this);for(const n of Ee)if(this._name.indexOf(n)>=0)throw new Error(`Name cannot include the reserved character "${n}"`);this._safety=new ht({increment:n=>this._incrementError(n)}),this._metrics=this._initMetrics();const t=M.getOptions(ie,"Simple","text");this._simpleTextMaxLength=t?t["(meta.max_length)"]:Be}_initMetrics(){return new St(this.name,()=>this._nextGen.appName||he.defaultAppName)}_incrementError(e=1){this._metrics.incrementCounter(Ot.internalError,e,!0)}get name(){return this._name}[Cr](e,r,t){const n=this[e];if(typeof n=="function"){ze.set(this,t);try{n.apply(this,r)}finally{ze.delete(this)}}}_wrapUserPayload(e,r,t=!1){let n;return typeof e=="string"?(n=ie,e?r={text:e.substring(0,this._simpleTextMaxLength)}:r=void 0):n=e,M.makePayload(n,r,t)}_getEffectiveRootId(e){var r,t;return(t=(r=e==null?void 0:e.instrumentationContext)===null||r===void 0?void 0:r.rootId)!==null&&t!==void 0?t:this._nextGen.getDefaultInstrumentationContext().rootId}get internalInstrumentationContext(){return this._nextGen.getDefaultInstrumentationContext()}log(e,r,t){this._safety.tryCatch(()=>{const n=E.time().tsNow;E.requireArgument(e,"userSchemaOrText",["object","string"]),E.requireArgumentIfDefined(r,"userData","object"),E.requireArgumentIfDefined(t,"options","object");const l=this._wrapUserPayload(e,r);l!=null&&l.payload&&this._logInternal(this.name,l.schema,l.payload,n,this._getEffectiveRootId(t))},{op:"log"})}_logInternal(e,r,t,n,l){const i=ze.get(this),c=this._nextGen.addLog(e,r,t,n,l,i);if(!E.isProduction){const p=be.getExtraFields(r,t);!E.isProduction&&p.length>0&&this.error("Extra fields",F,{extras:p})}return c}error(e,r,t,n){return this._safety.tryCatch(()=>{E.requireArgumentIfDefined(r,"userSchemaOrText",["object","string"]),E.requireArgumentIfDefined(t,"userData","object"),E.requireArgumentIfDefined(n,"options","object");const l=this._getEffectiveRootId(n);this._errorInternal(e,r,t,void 0,l)},{op:"error"})}_errorInternal(e,r,t,n,l){const i=E.time().tsNow;let c;if(e instanceof Error)c=e;else{let s;e==null||typeof e.toString!="function"?s="UNKNOWN":s=e.toString(),c=new Error(s)}const p=this._wrapUserPayload(r,t,!0),h={name:c.name,message:c.message,stack:c.stack,userPayload:p,activityId:n};return this._logInternal(this.name,K,h,i,l)}startActivity(e,r){return this._safety.tryCatchReturn(()=>{var t;E.requireArgument(e,"name"),E.requireArgumentIfDefined(r,"options","object");const n=E.validateParentActivityType(r==null?void 0:r.isExternal,r==null?void 0:r.parentActivity);let l,i=(r==null?void 0:r.perfStartOverride)!==void 0;const c=(t=r==null?void 0:r.instrumentationContext)===null||t===void 0?void 0:t.rootId;c?(i=!0,l={rootId:c,isRootActivitySampled:r.instrumentationContext.isRootActivitySampled,isRootActivityExternalSampled:r.instrumentationContext.isRootActivityExternalSampled}):l=this._nextGen.getDefaultInstrumentationContext();const p=r!=null&&r.isExternal?l.isRootActivityExternalSampled:l.isRootActivitySampled;return new se(e,l.rootId,this._onActivityStoppedCallback,this._onActivityErrorCallback,Qr,r==null?void 0:r.id,p,r==null?void 0:r.perfStartOverride,i,r==null?void 0:r.isExternal,n)},Yr,{op:"startActivity"})}getRootActivityHistoryEntryByTime(e){let r;return this._safety.tryCatch(()=>{r=this._nextGen.getRootActivityHistoryEntryByTime(e)},{op:"getRootActivityHistoryEntryByTime"}),r}_getActivityData(e){var r,t;const n=this._wrapUserPayload(e.userSchemaOrText,e.userData,!0);return{id:e.id,name:e.name,duration:e.stopPerfTime-e.startPerfTime,stopReason:e.stopReason,userPayload:n,errorCount:e.errorCount,isSampled:e.isSampled,timerOverridden:e.timerOverridden,isRerooted:e.isRerooted,isExternal:e.isExternal,parentId:(r=e.parentActivity)===null||r===void 0?void 0:r.getId(),externalParentId:(t=e.externalParentActivity)===null||t===void 0?void 0:t.getId()}}_handleActivityStop(e){if(e.stopReason===Fe)return;if(!e.isRoot&&!e.noRerooting){const t=this._nextGen.getRootActivityHistoryEntryByTime(e.startPerfTime);(!t&&e.rootId!==void 0||t&&e.rootId!==t.id)&&(e.rootId=t==null?void 0:t.id,e.isSampled=(t==null?void 0:t.isSampled)||!1,e.isRerooted=!0)}const r=this._getActivityData(e);this._logActivity(r,e.startTimestamp,e.rootId)}_logActivity(e,r,t){this._logInternal(this.name,Le,e,r,t)}_handleActivityError(e,r){this._errorInternal(e,r.userSchemaOrText,r.userData,r.id,r.rootId)}domEvent(e,r,t,n,l){this._safety.tryCatch(()=>{var i;const c=E.time().tsNow;E.requireArgument(e,"event",[Event,Zr]),E.requireArgument(r,"handledBy",[HTMLElement,"object"]);let p;r instanceof HTMLElement?p=r:(r=r,((i=r.template)===null||i===void 0?void 0:i.host)instanceof HTMLElement?p=r.template.host:E.requireArgument(void 0,"handledBy"));const h=this._wrapUserPayload(t,n,!0),s=this._getEffectiveRootId(l);if(e.type==="click"){const a=e,d=this._nextGen.getClickTracker();d&&d.markEventHandled(a);const o=l==null?void 0:l.captureMouseData,f=He.getInstrumentedEventData(o?1:0,o?He.getMouseEventData(a):He.getEventData(a),p,h);f.auto=l==null?void 0:l._auto,this._logInternal(this.name,Pe,f,c,s)}else throw new Error(E.notImplemented)},{op:"domEvent"})}_siftTags(e){const r=Object.assign({},e);return Object.entries(r).forEach(([t,n])=>{if(n===null)r[t]="null";else if(n==="")r[t]="empty";else if(Number.isNaN(n))r[t]="NaN";else{const l=typeof n;["number","string","boolean"].indexOf(l)===-1&&(r[t]=l)}}),r}incrementCounter(e,r=1,t=!1,n={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",$e),E.checkForReservedCharacters(e,"operation",Ee),E.requireArgument(r,"increment","number"),E.requireArgument(t,"hasError","boolean"),E.requireArgument(n,"tags","object"),this._metrics.incrementCounter(e,r,t,this._siftTags(n))},{op:"incrementCounter"})}trackValue(e,r,t=!1,n={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",$e),E.checkForReservedCharacters(e,"operation",Ee),E.requireArgument(r,"value","number"),E.requireArgument(t,"hasError","boolean"),E.requireArgument(n,"tags","object"),this._metrics.trackValue(e,r,t,this._siftTags(n))},{op:"trackValue"})}bucketValue(e,r,t=[],n=!1,l={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",$e),E.checkForReservedCharacters(e,"operation",Ee),E.requireArgument(r,"value","number"),E.requireArgument(t,"buckets",Array),Object.entries(t).forEach(([i,c])=>{E.requireArgument(c,`Bucket value for '${i}'`,"number")}),E.requireArgument(n,"hasError","boolean"),E.requireArgument(l,"tags","object"),this._metrics.bucketValue(e,r,t,n,this._siftTags(l))},{op:"bucketValue"})}getUpCounters(){return this._metrics.getUpCounters().filter(e=>e.getLastUpdatedOn())}getValueRecorders(){return this._metrics.getValueRecorders().filter(e=>e.getLastUpdatedOn())}getBucketHistograms(){return this._metrics.getBucketHistograms().filter(e=>e.getLastUpdatedOn())}registerForLogPrompt(e){E.requireArgument(e,"listener","function"),this._nextGen.registerForLogPrompt(e)}_getAsaOptions(e){return e?Object.assign({instrumentationContext:e==null?void 0:e.instrumentationContext},e.startOptions):void 0}activity(e,r,t){var n,l,i,c;const p=this._getAsaOptions(t),h=this.startActivity(e,p);try{return r(h)}catch(s){throw h.error(s,(n=t==null?void 0:t.errorPayload)===null||n===void 0?void 0:n.schema,(l=t==null?void 0:t.errorPayload)===null||l===void 0?void 0:l.payload),s}finally{h.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(c=t==null?void 0:t.stopPayload)===null||c===void 0?void 0:c.payload,t==null?void 0:t.stopOptions)}}activityAsync(e,r,t){return re(this,null,function*(){var n,l,i,c;const p=this._getAsaOptions(t),h=this.startActivity(e,p);try{return yield r(h)}catch(s){throw h.error(s,(n=t==null?void 0:t.errorPayload)===null||n===void 0?void 0:n.schema,(l=t==null?void 0:t.errorPayload)===null||l===void 0?void 0:l.payload),s}finally{h.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(c=t==null?void 0:t.stopPayload)===null||c===void 0?void 0:c.payload,t==null?void 0:t.stopOptions)}})}invokeNetworkCallWithHeaders(e,r,t){return C.setHeaders(t),e(...r)}}he.defaultAppName="APP_NOT_REGISTERED";const ei=.1,ti=20;class ri{constructor(e){if(this._historyMap=new Map,this._historyList=new Array,E.requireArgumentIfDefined(e,"limit","number")){if(e=Math.ceil(e),e<=0)throw new Error("Limit must be a positive number")}else e=ti;this._graceCount=Math.max(1,Math.floor(e*ei)),this._realLimit=1+e+this._graceCount}add(e){if(this._historyMap.has(e.id))throw new Error(`RootActivityHistoryImpl.add: entry already exists for rootId: ${e.id}`);this._historyMap.set(e.id,e),this._historyList.push(e),this._historyList.length===this._realLimit&&this._historyList.splice(1,this._graceCount).forEach(t=>this._historyMap.delete(t.id))}get count(){return this._historyList.length}findById(e){return this._historyMap.get(e)}findByTime(e){let r,t=Number.MAX_VALUE;for(const n of this._historyList){const l=e-n.startPerfTime;l>=0&&(n.stopPerfTime===void 0||e<n.stopPerfTime)&&l<t&&(r=n,t=l)}return r}}class ii extends se{constructor(e,r,t,n,l,i,c,p){super(e,void 0,r,t,void 0,n||E.generateUniqueId(c!=null?c:32),l,i),this._isRoot=!0,this._isExternalSampled=p}get isExternalSampled(){var e;return(e=this._isExternalSampled)!==null&&e!==void 0?e:!1}set isExternalSampled(e){this._isExternalSampled=e}get preRootId(){return this._preRootId}set preRootId(e){this._preRootId=e}_getDetail(e,r){const t=super._getDetail(e,r);return t.isRoot=!0,t.preRootId=this.preRootId,t}}const ni=new Array(32).fill(0).join("");class si{getId(){return ni}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const oi=Object.freeze(new si);class ai extends he{constructor(e,r,t){super(e,r),this._allowMulti=t,this._rootActivityHistory=new ri,this._onRootActivityStoppedCallback=this._handleRootActivityStop.bind(this)}startRootActivity(e,r,t,n,l){return this._safety.tryCatchReturn(()=>{if(E.requireArgument(e,"name"),(n==null?void 0:n.id)!==void 0)throw new Error("Cannot specify id for root activity, use rootId argument instead");const i=new ii(e,this._onRootActivityStoppedCallback,this._onActivityErrorCallback,r,t,n==null?void 0:n.perfStartOverride,this._nextGen.preferredRootIdLength,l);if(!this._allowMulti){const c={id:i.getId(),name:e,startPerfTime:i.getStartPerfTime(),isSampled:i.getIsSampled()};if(this._rootActivityHistory.add(c),this._singleRootActivity&&!this._singleRootActivity.isStopped){const p=this._singleRootActivity.getId();this._singleRootActivity.terminate(),i.preRootId=p}this._singleRootActivity=i}return i},oi,{op:"startRootActivity"})}_handleRootActivityStop(e){const r=this._rootActivityHistory.findById(e.id);if(r&&(r.stopPerfTime=e.stopPerfTime,r.startPerfTime=e.startPerfTime),e.stopReason===Fe)return;const t=this._getActivityData(e);this._logActivity(t,e.startTimestamp),this._singleRootActivity=void 0}_getActivityData(e){const r=super._getActivityData(e);return r.isRoot=e.isRoot,r.preRootId=e.preRootId,r}getSingleRootActivityId(){var e;return(e=this._singleRootActivity)===null||e===void 0?void 0:e.getId()}isSingleRootActivitySampled(){var e;return(e=this._singleRootActivity)===null||e===void 0?void 0:e.getIsSampled()}isSingleRootActivityExternalSampled(){var e,r;return(r=(e=this._singleRootActivity)===null||e===void 0?void 0:e.isExternalSampled)!==null&&r!==void 0?r:!1}_initMetrics(){return new St(this.name,()=>this.name)}getRootActivityHistoryEntry(e){return this._rootActivityHistory.findByTime(e)}}const li=5;class ui{constructor(e,r){this._instr=e,this._doc=r,this._isActive=!1,this._boundClickListener=this._clickListener.bind(this),E.requireArgument(e,"_instr"),E.requireArgument(r,"_doc")}activate(){this._isActive||(this._doc.addEventListener("click",this._boundClickListener,!0),this._isActive=!0)}deactivate(){this._isActive&&(this._doc.removeEventListener("click",this._boundClickListener,!0),this._isActive=!1)}markEventHandled(e){this._ignoredEvent=e}_clickListener(e){var r;let t=(r=e.composedPath)===null||r===void 0?void 0:r.call(e);(!t||!t.length)&&(t=e.path);const n=this._getClickableElement(t);n&&setTimeout(()=>{e!==this._ignoredEvent&&this._instr.domEvent(e,n,void 0,void 0,{_auto:!0})})}_getClickableElement(e){var r,t;const n=e?Math.min(e.length,li):0;for(let l=0;l<n;l+=1){const i=e[l],c=(r=i.tagName)===null||r===void 0?void 0:r.toLowerCase();if(c==="a"||c==="button")return i;if(c==="input"){const p=i;if(((t=p.type)===null||t===void 0?void 0:t.toLowerCase())==="button")return p}}}}const Ct="o11y:receiver";var Ve;(function(u){u[u.Unknown=0]="Unknown",u[u.Opening=1]="Opening"})(Ve||(Ve={}));class di{constructor(e,r,t){this._logCallback=e,this._metricsCallback=r,this._commErrorCallback=t,this._senders=new Map,E.requireArgument(this._logCallback,"_logCallback","function"),E.requireArgument(this._metricsCallback,"_metricsCallback","function"),E.requireArgument(this._commErrorCallback,"_commErrorCallback","function")}openComms(e){if(E.requireArgument(e,"sender","object"),!this._senders.has(e)){const r=new MessageChannel,t={state:Ve.Opening,port:r.port1};this._senders.set(e,t),t.port.onmessage=this._messagePortEventHandler.bind(this),t.port.onmessageerror=this._messagePortErrorHandler.bind(this),e.postMessage({from:Ct,type:It},"*",[r.port2])}}closeComms(e){const r=this._senders.get(e);r&&(r.port.onmessage=void 0,r.port.onmessageerror=void 0,this._senders.delete(e))}_messagePortEventHandler(e){e.data.type===Tt?this._logCallback(e.data.data):e.data.type===xt&&this._metricsCallback(e.data.data)}_messagePortErrorHandler(){this._commErrorCallback()}}const It="handshake",Tt="log",xt="metrics";class ci{constructor(e,r){this._self=e,this._allowedOrigins=r,this._messageEventHandlerFunc=this._messageEventHandler.bind(this),this._handshakeComplete=!1,this._logBuffer=[],this._metricsBuffer=[],E.requireArgument(this._self,"_self","object"),E.requireArgumentIfDefined(r,"allowedOrigins",Array),this._self.addEventListener("message",this._messageEventHandlerFunc)}_messageEventHandler(e){e.data.from===Ct&&e.data.type===It&&e.ports[0]instanceof MessagePort&&E.isAllowedOrigin(e.origin,this._allowedOrigins)&&(this._handshakeComplete=!0,this._self.removeEventListener("message",this._messageEventHandlerFunc),this._otherPort=e.ports[0],this._emptyBuffers())}sendLog(e){this._handshakeComplete?this._otherPort.postMessage({type:Tt,data:e}):this._logBuffer.push(e)}sendMetrics(e){this._handshakeComplete?this._otherPort.postMessage({type:xt,data:e}):this._metricsBuffer.push(e)}_emptyBuffers(){this._logBuffer.forEach(e=>this.sendLog(e)),this._metricsBuffer.forEach(e=>this.sendMetrics(e)),this._logBuffer=void 0,this._metricsBuffer=void 0}}class fi{constructor(){this._upCounters=[],this._valueRecorders=[],this._bucketHistograms=[]}add(e){var r,t,n;!((r=e.upCounters)===null||r===void 0)&&r.length&&this._upCounters.push(...e.upCounters.map(l=>new qe(l.name,l.ownerName,l.ownerAppName,W.getMetricsTags(l.tags),l.createdTimestamp,l.lastUpdatedTimestamp,l.value))),!((t=e.valueRecorders)===null||t===void 0)&&t.length&&this._valueRecorders.push(...e.valueRecorders.map(l=>new wt(l.name,l.ownerName,l.ownerAppName,W.getMetricsTags(l.tags),l.createdTimestamp,l.lastUpdatedTimestamp,l.values))),!((n=e.bucketHistograms)===null||n===void 0)&&n.length&&this._bucketHistograms.push(...e.bucketHistograms.map(l=>new bt(l.name,l.ownerName,l.ownerAppName,W.getMetricsTags(l.tags),l.buckets,l.createdTimestamp,l.lastUpdatedTimestamp,l.values)))}getUpCounters(){return this._upCounters=this._upCounters.filter(e=>e.getLastUpdatedOn()!==void 0),this._upCounters}getValueRecorders(){return this._valueRecorders=this._valueRecorders.filter(e=>e.getLastUpdatedOn()!==void 0),this._valueRecorders}getBucketHistograms(){return this._bucketHistograms=this._bucketHistograms.filter(e=>e.getLastUpdatedOn()!==void 0),this._bucketHistograms}}const hi=1e3;class pi{constructor(e,r){this._connector=e,this._pollInterval=hi,E.requireArgument(e,"_connector","object"),E.requireArgumentIfDefined(r,"_pollInterval","number")&&r>0&&(this._pollInterval=r)}collect(e,r,t){const n={schema:e,data:r,logMeta:t};this._connector.sendLog(n)}receiveMetricsExtractors(e){this._metricsExtractors=e,this._collectAndSendMetrics(),setInterval(this._collectAndSendMetrics.bind(this),this._pollInterval)}_collectAndSendMetrics(){const e={upCounters:W.getUpCounters(this._metricsExtractors.getAllUpCounters()),valueRecorders:W.getValueRecorders(this._metricsExtractors.getAllValueRecorders()),bucketHistograms:W.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms())};(e.upCounters.length||e.valueRecorders.length||e.bucketHistograms.length)&&this._connector.sendMetrics(e)}}const Nt=80,mi=32,jt="_CUT",yi=Nt-jt.length;function ke(){}class Ae{get preferredRootIdLength(){return this._preferredRootIdLength}get pagePayloadProvider(){return this._pagePayloadProvider}set pagePayloadProvider(e){this._pagePayloadProvider=e}get appPayloadProvider(){return this._appPayloadProvider}set appPayloadProvider(e){this._appPayloadProvider=e}constructor(e){this._idleDetector=e,this._logCollectors=new Set,this._instruments=new Map,this._seqBySchema=new Map,this._sequence=0,this._forceDisabledLogCollectors=new Set,this._logCollectorFailures=new Map,this._isBufferingEnabled=!1,this._buffer=[],this._logCollectionListeners=new Set,this._opMode="default",this._isSender=!1,this._isReceiver=!1,this._decimalPoints=2}registerApp(e,r){var t,n;if(E.requireArgument(e,"name","string"),this._appInstr)throw new Error("An app has already been registered with instrumentation.");if(this._instruments.get(e))throw new Error(`The instrumentation name ${e} is already taken`);if(ne.setOwnerAppName(e),this._initOpMode(r==null?void 0:r.operationMode),this._isSender=this._opMode==="sender",this._isReceiver=this._opMode==="receiver",(r==null?void 0:r.decimalPoints)!==void 0&&(this._decimalPoints=r.decimalPoints),this._preferredRootIdLength=(t=r==null?void 0:r.preferredRootIdLength)!==null&&t!==void 0?t:mi,this._clientSessionId=((n=r==null?void 0:r.clientSessionId)===null||n===void 0?void 0:n.toString())||E.generateUniqueId(),this._appInstr=new ai(this,e,r==null?void 0:r.allowMultipleRootActivities),this._instruments.set(e,this._appInstr),this._isSender){const c=new pi(new ci(window,r==null?void 0:r.allowedReceiverOrigins),r==null?void 0:r.senderMetricsPollingInterval);this.registerLogCollector(c),this.registerMetricsCollector(c)}else this._isReceiver&&(this._metricsStore=new fi,this._receiverConnector=new di(c=>{c.logMeta.receiverClientSessionId=this._clientSessionId,c.logMeta.receiverRootId=this._appInstr.getSingleRootActivityId(),this._multiplex(c.schema,c.data,c.logMeta)},c=>{this._metricsStore.add(c)},()=>{this._appInstr.incrementCounter("o11y-error-receiver",1,!0)}));this._isBufferingEnabled=!this._isSender&&(r==null?void 0:r.enableBuffering);const i=new C(this.getInstrumentation("Network"),this._idleDetector);return{log:this._appInstr.log.bind(this._appInstr),error:this._appInstr.error.bind(this._appInstr),startActivity:this._appInstr.startActivity.bind(this._appInstr),domEvent:this._appInstr.domEvent.bind(this._appInstr),incrementCounter:this._appInstr.incrementCounter.bind(this._appInstr),trackValue:this._appInstr.trackValue.bind(this._appInstr),bucketValue:this._appInstr.bucketValue.bind(this._appInstr),networkInstrumentation:i.networkInstrumentation.bind(i),registerForLogPrompt:this._appInstr.registerForLogPrompt.bind(this._appInstr),activity:this._appInstr.activity.bind(this._appInstr),activityAsync:this._appInstr.activityAsync.bind(this._appInstr),invokeNetworkCallWithHeaders:this._appInstr.invokeNetworkCallWithHeaders.bind(this._appInstr),startRootActivity:this._appInstr.startRootActivity.bind(this._appInstr),registerLogCollector:this._isSender?ke:this.registerLogCollector.bind(this),registerMetricsCollector:this._isSender?ke:this.registerMetricsCollector.bind(this),activateClickTracker:this.activateClickTracker.bind(this),deactivateClickTracker:this.deactivateClickTracker.bind(this),disableBuffering:this.disableBuffering.bind(this),promptLogCollection:this.promptLogCollection.bind(this),getClientSessionId:this.getClientSessionId.bind(this),getOperationMode:this.getOperationMode.bind(this),startReceiving:this._isReceiver?this._receiverConnector.openComms.bind(this._receiverConnector):ke,stopReceiving:this._isReceiver?this._receiverConnector.closeComms.bind(this._receiverConnector):ke}}getInstrumentation(e){E.requireArgument(e,"name","string"),e.length>Nt&&(e=e.substring(0,yi)+jt);let r=this._instruments.get(e);if(!r)r=new he(this,e),this._instruments.set(e,r);else if(r===this._appInstr)throw new Error(`The instrumentation name ${e} is being used by the app.`);return r}get appName(){var e;return(e=this._appInstr)===null||e===void 0?void 0:e.name}getRootActivityHistoryEntryByTime(e){var r;return(r=this._appInstr)===null||r===void 0?void 0:r.getRootActivityHistoryEntry(e)}addLog(e,r,t,n,l,i){var c,p,h;be.checkInputs(r,t),this._sequence+=1;const s=M.isInternal(r),a=s&&(t!=null&&t.userPayload)?t.userPayload.schema:r,d=M.getSchemaId(a);let o=this._seqBySchema.get(d)||0;o+=1,this._seqBySchema.set(d,o);const f={timestamp:n,rootId:l,sequence:this._sequence,schemaSequence:o,loggerName:e,pagePayload:void 0,appPayload:void 0,loggerAppName:this.appName,connectionType:E.getConnectionType(),clientSessionId:this._clientSessionId,age:E.getAge(n),tenantClass:i||void 0},g={schema:r,data:t,logMeta:f};if(f.pagePayload=be.getPayloadFromProvider(this.pagePayloadProvider,g),f.appPayload=be.getPayloadFromProvider(this.appPayloadProvider,g),this._isSender||(t=E.clone(t)),typeof this._decimalPoints=="number"&&(E.roundNumbersInObject(t,this._decimalPoints),s&&E.roundNumbersInObject((c=t.userPayload)===null||c===void 0?void 0:c.payload,this._decimalPoints),E.roundNumbersInObject((p=f.pagePayload)===null||p===void 0?void 0:p.payload,this._decimalPoints),E.roundNumbersInObject((h=f.appPayload)===null||h===void 0?void 0:h.payload,this._decimalPoints)),this._isBufferingEnabled){const m={schema:r,data:t,logMeta:f};this._buffer.push(m)}return this._multiplex(r,t,f),this._sequence}_multiplex(e,r,t){const n=Array.from(this._logCollectors).filter(l=>{var i;return!this._forceDisabledLogCollectors.has(l)&&!(!((i=l.getIsCollectDisabled)===null||i===void 0)&&i.call(l))});if(n.length>0)for(const l of n){let i=this._logCollectorFailures.get(l)||0;try{l.collect(e,r,t),i>0&&this._logCollectorFailures.set(l,i-1)}catch(c){i+=1,i>=Ae._collectorFailureLimit?(this._forceDisabledLogCollectors.add(l),this._appInstr&&(typeof c=="string"||c instanceof Error)&&this._appInstr.error(c)):this._logCollectorFailures.set(l,i)}}}getBuffer(){return this._buffer}disableBuffering(){this._isBufferingEnabled=!1,this._buffer=[]}getClickTracker(){return this._autoClickTracker}getDefaultInstrumentationContext(){var e,r,t;return{rootId:(e=this._appInstr)===null||e===void 0?void 0:e.getSingleRootActivityId(),isRootActivitySampled:(r=this._appInstr)===null||r===void 0?void 0:r.isSingleRootActivitySampled(),isRootActivityExternalSampled:(t=this._appInstr)===null||t===void 0?void 0:t.isSingleRootActivityExternalSampled()}}activateClickTracker(){typeof document!="undefined"&&(this._autoClickTracker||(this._autoClickTracker=new ui(this._appInstr,document)),this._autoClickTracker.activate())}deactivateClickTracker(){this._autoClickTracker&&(this._autoClickTracker.deactivate(),this._autoClickTracker=void 0)}registerLogCollector(e,r){if(E.requireArgument(e,"collector"),!this._logCollectors.has(e)&&(this._logCollectors.add(e),this._logCollectorFailures.set(e,0),(!e.getIsCollectDisabled||!e.getIsCollectDisabled())&&(r!=null&&r.retroactive)))for(const t of this._buffer)e.collect(t.schema,t.data,t.logMeta)}registerMetricsCollector(e){if(E.requireArgument(e,"collector"),this._metricsCollector)throw new Error("A metrics Collector is already registered.");this._metricsCollector=e,this._metricsCollector.receiveMetricsExtractors({getAllUpCounters:this._getAllUpCounters.bind(this),getAllValueRecorders:this._getAllValueRecorders.bind(this),getAllBucketHistograms:this._getAllBucketHistograms.bind(this)})}_getAllUpCounters(){var e;return(((e=this._metricsStore)===null||e===void 0?void 0:e.getUpCounters())||[]).concat(Array.from(this._instruments.values()).map(r=>r.getUpCounters()).flat()).concat(ne.getUpCounters())}_getAllValueRecorders(){var e;return(((e=this._metricsStore)===null||e===void 0?void 0:e.getValueRecorders())||[]).concat(Array.from(this._instruments.values()).map(r=>r.getValueRecorders()).flat()).concat(ne.getValueRecorders())}_getAllBucketHistograms(){var e;return(((e=this._metricsStore)===null||e===void 0?void 0:e.getBucketHistograms())||[]).concat(Array.from(this._instruments.values()).map(r=>r.getBucketHistograms()).flat()).concat(ne.getBucketHistograms())}registerForLogPrompt(e){this._logCollectionListeners.add(e)}promptLogCollection(e){for(const r of this._logCollectionListeners.keys())try{r(e)}catch(t){if(!E.isProduction)throw t}}getClientSessionId(){return this._clientSessionId}_initOpMode(e){if(typeof e=="function"&&(e=e()),(e===void 0||typeof window!="object")&&(e="default"),["default","receiver","sender"].indexOf(e)>=0)this._opMode=e;else throw new Error(`Invalid operation mode: ${e}`)}getOperationMode(){return this._opMode}}Ae._collectorFailureLimit=5;class gi{get _lazyNextGen(){return this._nextgen||(this._nextgen=new Ae(this._idleDetector)),this._nextgen}constructor(e){this._idleDetector=e,E.requireArgument(e,"_idleDetector")}registerInstrumentedApp(e,r){const t=this._lazyNextGen.registerApp(e,r);return r&&(E.markProduction(r.isProduction),this._nextgen.appPayloadProvider=r.appPayloadProvider,this._nextgen.pagePayloadProvider=r.pagePayloadProvider),t}getInstrumentation(e){return this._lazyNextGen.getInstrumentation(e)}}E.time.bind(E);const vi=new xr({logThreshold:300,reportListener:u=>{ae==null||ae.log(H,u)},errorListener:(u,e)=>{ae==null||ae.error(u,e)}}),Se=new gi(vi),_i=Se.registerInstrumentedApp.bind(Se),ae=Se.getInstrumentation.bind(Se)("IdleDetector"),bi="264.105.0",wi="o11y";class le{constructor(){this._envelope={diagnostics:{key:wi,generatedTimestamp:void 0,bundleCount:0,bucketHistogramCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:bi},bundles:[],metrics:{bucketHistograms:[],upCounters:[],valueRecorders:[]},staticAttributes:{}}}withStaticAttributes(e){return this._envelope.staticAttributes=e,this}withLogs(e,r){let t=this._envelope.bundles.find(n=>n.schemaName===e);if(t)for(const n of r)t.messages.push(n);else t={schemaName:e,messages:r},this._envelope.bundles.push(t);return this._envelope.diagnostics.bundleCount=this._envelope.bundles.length,this}static getUpCounters(e,r=!0){return W.getUpCounters(e,r)}static getValueRecorders(e,r=!0){return W.getValueRecorders(e,r)}static getBucketHistograms(e,r=!0){return W.getBucketHistograms(e,r)}withUpCounters(e){for(const r of e)this._envelope.metrics.upCounters.push(r);return this._envelope.diagnostics.upCounterCount=this._envelope.metrics.upCounters.length,this}withValueRecorders(e){for(const r of e)this._envelope.metrics.valueRecorders.push(r);return this._envelope.diagnostics.valueRecorderCount=this._envelope.metrics.valueRecorders.length,this}withBucketHistograms(e){for(const r of e)this._envelope.metrics.bucketHistograms.push(r);return this._envelope.diagnostics.bucketHistogramCount=this._envelope.metrics.bucketHistograms.length,this}build(){return this._envelope.diagnostics.generatedTimestamp=E.time().tsNow,this._envelope}static buildFrom(e){const r=new le;return e.staticAttributes&&r.withStaticAttributes(e.staticAttributes),e.messages&&e.messages.forEach((t,n)=>{r.withLogs(M.getSchemaId(n),t)}),e.upCounters&&r.withUpCounters(e.upCounters),e.valueRecorders&&r.withValueRecorders(e.valueRecorders),e.bucketHistograms&&r.withBucketHistograms(e.bucketHistograms),r.build()}}var Oe;(function(u){var e,r;e={1:[function(t,n,l){n.exports=function(i,c){for(var p=Array(arguments.length-1),h=0,s=2,a=!0;s<arguments.length;)p[h++]=arguments[s++];return new Promise(function(d,o){p[h]=function(f){if(a)if(a=!1,f)o(f);else{for(var g=Array(arguments.length-1),m=0;m<g.length;)g[m++]=arguments[m];d.apply(null,g)}};try{i.apply(c||null,p)}catch(f){a&&(a=!1,o(f))}})}},{}],2:[function(t,n,l){l.length=function(s){var a=s.length;if(!a)return 0;for(var d=0;1<--a%4&&(s[0|a]||"")=="=";)++d;return Math.ceil(3*s.length)/4-d};for(var i=Array(64),c=Array(123),p=0;p<64;)c[i[p]=p<26?p+65:p<52?p+71:p<62?p-4:p-59|43]=p++;l.encode=function(s,a,d){for(var o,f=null,g=[],m=0,_=0;a<d;){var y=s[a++];switch(_){case 0:g[m++]=i[y>>2],o=(3&y)<<4,_=1;break;case 1:g[m++]=i[o|y>>4],o=(15&y)<<2,_=2;break;case 2:g[m++]=i[o|y>>6],g[m++]=i[63&y],_=0}8191<m&&((f=f||[]).push(String.fromCharCode.apply(String,g)),m=0)}return _&&(g[m++]=i[o],g[m++]=61,_===1&&(g[m++]=61)),f?(m&&f.push(String.fromCharCode.apply(String,g.slice(0,m))),f.join("")):String.fromCharCode.apply(String,g.slice(0,m))};var h="invalid encoding";l.decode=function(s,a,d){for(var o,f=d,g=0,m=0;m<s.length;){var _=s.charCodeAt(m++);if(_==61&&1<g)break;if((_=c[_])===u)throw Error(h);switch(g){case 0:o=_,g=1;break;case 1:a[d++]=o<<2|(48&_)>>4,o=_,g=2;break;case 2:a[d++]=(15&o)<<4|(60&_)>>2,o=_,g=3;break;case 3:a[d++]=(3&o)<<6|_,g=0}}if(g===1)throw Error(h);return d-f},l.test=function(s){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s)}},{}],3:[function(t,n,l){n.exports=c;var i=/^(?: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)$/;function c(p,h){typeof p=="string"&&(h=p,p=u);var s=[];function a(o){if(typeof o!="string"){var f=d();if(c.verbose&&console.log("codegen: "+f),f="return "+f,o){for(var g=Object.keys(o),m=Array(g.length+1),_=Array(g.length),y=0;y<g.length;)m[y]=g[y],_[y]=o[g[y++]];return m[y]=f,Function.apply(null,m).apply(null,_)}return Function(f)()}for(var b=Array(arguments.length-1),k=0;k<b.length;)b[k]=arguments[++k];if(k=0,o=o.replace(/%([%dfijs])/g,function(v,O){var w=b[k++];switch(O){case"d":case"f":return""+ +(""+w);case"i":return""+Math.floor(w);case"j":return JSON.stringify(w);case"s":return""+w}return"%"}),k!==b.length)throw Error("parameter count mismatch");return s.push(o),a}function d(o){return"function "+(function(f){return!f||!(f=(""+f).replace(/[^\w$]/g,""))?"":(/^\d/.test(f)&&(f="_"+f),i.test(f)?f+"_":f)})(o||h)+"("+(p&&p.join(",")||"")+`){
2
2
  `+s.join(`
3
3
  `)+`
4
- }`}return o.toString=l,o}c.verbose=!1},{}],4:[function(t,a,u){function i(){this.t={}}(a.exports=i).prototype.on=function(c,p,h){return(this.t[c]||(this.t[c]=[])).push({fn:p,ctx:h||this}),this},i.prototype.off=function(c,p){if(c===w)this.t={};else if(p===w)this.t[c]=[];else for(var h=this.t[c],s=0;s<h.length;)h[s].fn===p?h.splice(s,1):++s;return this},i.prototype.emit=function(c){var p=this.t[c];if(p){for(var h=[],s=1;s<arguments.length;)h.push(arguments[s++]);for(s=0;s<p.length;)p[s].fn.apply(p[s++].ctx,h)}return this}},{}],5:[function(t,a,u){a.exports=p;var i=t(1),c=t(7)("fs");function p(h,s,o){return s=typeof s=="function"?(o=s,{}):s||{},o?!s.xhr&&c&&c.readFile?c.readFile(h,function(l,n){return l&&typeof XMLHttpRequest!="undefined"?p.xhr(h,s,o):l?o(l):o(null,s.binary?n:n.toString("utf8"))}):p.xhr(h,s,o):i(p,this,h,s)}p.xhr=function(h,s,o){var l=new XMLHttpRequest;l.onreadystatechange=function(){if(l.readyState!==4)return w;if(l.status!==0&&l.status!==200)return o(Error("status "+l.status));if(s.binary){if(!(n=l.response))for(var n=[],d=0;d<l.responseText.length;++d)n.push(255&l.responseText.charCodeAt(d));return o(null,typeof Uint8Array!="undefined"?new Uint8Array(n):n)}return o(null,l.responseText)},s.binary&&("overrideMimeType"in l&&l.overrideMimeType("text/plain; charset=x-user-defined"),l.responseType="arraybuffer"),l.open("GET",h),l.send()}},{1:1,7:7}],6:[function(t,a,u){function i(o){function l(T,S,I,x){var P=S<0?1:0;T((S=P?-S:S)===0?0<1/S?0:2147483648:isNaN(S)?2143289344:34028234663852886e22<S?(P<<31|2139095040)>>>0:S<11754943508222875e-54?(P<<31|Math.round(S/1401298464324817e-60))>>>0:(P<<31|127+(T=Math.floor(Math.log(S)/Math.LN2))<<23|8388607&Math.round(S*Math.pow(2,-T)*8388608))>>>0,I,x)}function n(T,S,I){return T=T(S,I),S=2*(T>>31)+1,I=T>>>23&255,T&=8388607,I==255?T?NaN:1/0*S:I==0?1401298464324817e-60*S*T:S*Math.pow(2,I-150)*(8388608+T)}function d(T,S,I){m[0]=T,S[I]=v[0],S[I+1]=v[1],S[I+2]=v[2],S[I+3]=v[3]}function y(T,S,I){m[0]=T,S[I]=v[3],S[I+1]=v[2],S[I+2]=v[1],S[I+3]=v[0]}function f(T,S){return v[0]=T[S],v[1]=T[S+1],v[2]=T[S+2],v[3]=T[S+3],m[0]}function _(T,S){return v[3]=T[S],v[2]=T[S+1],v[1]=T[S+2],v[0]=T[S+3],m[0]}var m,v,A,g,O;function b(T,S,I,x,P,R){var F,te=x<0?1:0;(x=te?-x:x)===0?(T(0,P,R+S),T(0<1/x?0:2147483648,P,R+I)):isNaN(x)?(T(0,P,R+S),T(2146959360,P,R+I)):17976931348623157e292<x?(T(0,P,R+S),T((te<<31|2146435072)>>>0,P,R+I)):x<22250738585072014e-324?(T((F=x/5e-324)>>>0,P,R+S),T((te<<31|F/4294967296)>>>0,P,R+I)):(T(4503599627370496*(F=x*Math.pow(2,-(x=(x=Math.floor(Math.log(x)/Math.LN2))===1024?1023:x)))>>>0,P,R+S),T((te<<31|x+1023<<20|1048576*F&1048575)>>>0,P,R+I))}function k(T,S,I,x,P){return S=T(x,P+S),T=T(x,P+I),x=2*(T>>31)+1,P=T>>>20&2047,I=4294967296*(1048575&T)+S,P==2047?I?NaN:1/0*x:P==0?5e-324*x*I:x*Math.pow(2,P-1075)*(I+4503599627370496)}function N(T,S,I){A[0]=T,S[I]=g[0],S[I+1]=g[1],S[I+2]=g[2],S[I+3]=g[3],S[I+4]=g[4],S[I+5]=g[5],S[I+6]=g[6],S[I+7]=g[7]}function j(T,S,I){A[0]=T,S[I]=g[7],S[I+1]=g[6],S[I+2]=g[5],S[I+3]=g[4],S[I+4]=g[3],S[I+5]=g[2],S[I+6]=g[1],S[I+7]=g[0]}function L(T,S){return g[0]=T[S],g[1]=T[S+1],g[2]=T[S+2],g[3]=T[S+3],g[4]=T[S+4],g[5]=T[S+5],g[6]=T[S+6],g[7]=T[S+7],A[0]}function H(T,S){return g[7]=T[S],g[6]=T[S+1],g[5]=T[S+2],g[4]=T[S+3],g[3]=T[S+4],g[2]=T[S+5],g[1]=T[S+6],g[0]=T[S+7],A[0]}return typeof Float32Array!="undefined"?(m=new Float32Array([-0]),v=new Uint8Array(m.buffer),O=v[3]===128,o.writeFloatLE=O?d:y,o.writeFloatBE=O?y:d,o.readFloatLE=O?f:_,o.readFloatBE=O?_:f):(o.writeFloatLE=l.bind(null,c),o.writeFloatBE=l.bind(null,p),o.readFloatLE=n.bind(null,h),o.readFloatBE=n.bind(null,s)),typeof Float64Array!="undefined"?(A=new Float64Array([-0]),g=new Uint8Array(A.buffer),O=g[7]===128,o.writeDoubleLE=O?N:j,o.writeDoubleBE=O?j:N,o.readDoubleLE=O?L:H,o.readDoubleBE=O?H:L):(o.writeDoubleLE=b.bind(null,c,0,4),o.writeDoubleBE=b.bind(null,p,4,0),o.readDoubleLE=k.bind(null,h,0,4),o.readDoubleBE=k.bind(null,s,4,0)),o}function c(o,l,n){l[n]=255&o,l[n+1]=o>>>8&255,l[n+2]=o>>>16&255,l[n+3]=o>>>24}function p(o,l,n){l[n]=o>>>24,l[n+1]=o>>>16&255,l[n+2]=o>>>8&255,l[n+3]=255&o}function h(o,l){return(o[l]|o[l+1]<<8|o[l+2]<<16|o[l+3]<<24)>>>0}function s(o,l){return(o[l]<<24|o[l+1]<<16|o[l+2]<<8|o[l+3])>>>0}a.exports=i(i)},{}],7:[function(t,a,u){a.exports=function(i){try{var c;return typeof t!="function"?null:(c=t(i))&&(c.length||Object.keys(c).length)?c:null}catch(p){return null}}},{}],8:[function(t,a,u){var i=u.isAbsolute=function(p){return/^(?:\/|\w+:)/.test(p)},c=u.normalize=function(o){var h=(o=o.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),s=i(o),o="";s&&(o=h.shift()+"/");for(var l=0;l<h.length;)h[l]===".."?0<l&&h[l-1]!==".."?h.splice(--l,2):s?h.splice(l,1):++l:h[l]==="."?h.splice(l,1):++l;return o+h.join("/")};u.resolve=function(p,h,s){return s||(h=c(h)),!i(h)&&(p=(p=s?p:c(p)).replace(/(?:\/|^)[^/]+$/,"")).length?c(p+"/"+h):h}},{}],9:[function(t,a,u){a.exports=function(i,c,p){var h=p||8192,s=h>>>1,o=null,l=h;return function(n){return n<1||s<n?i(n):(h<l+n&&(o=i(h),l=0),n=c.call(o,l,l+=n),7&l&&(l=1+(7|l)),n)}}},{}],10:[function(t,a,u){u.length=function(i){for(var c,p=0,h=0;h<i.length;++h)(c=i.charCodeAt(h))<128?p+=1:c<2048?p+=2:(64512&c)==55296&&(64512&i.charCodeAt(h+1))==56320?(++h,p+=4):p+=3;return p},u.read=function(i,c,p){if(p-c<1)return"";for(var h="",s=c;s<p;){var o,l=i[s++];l<=127?h+=String.fromCharCode(l):192<=l&&l<224?h+=128<=(o=(31&l)<<6|63&i[s++])?String.fromCharCode(o):"�":224<=l&&l<240?h+=2048<=(o=(15&l)<<12|(63&i[s++])<<6|63&i[s++])?String.fromCharCode(o):"�":240<=l&&((l=(7&l)<<18|(63&i[s++])<<12|(63&i[s++])<<6|63&i[s++])<65536||1114111<l?h+="�":h=h+String.fromCharCode(55296+((l-=65536)>>10))+String.fromCharCode(56320+(1023&l)))}return h},u.write=function(i,c,p){for(var h,s,o=p,l=0;l<i.length;++l)(h=i.charCodeAt(l))<128?c[p++]=h:(h<2048?c[p++]=h>>6|192:((64512&h)==55296&&(64512&(s=i.charCodeAt(l+1)))==56320?(++l,c[p++]=(h=65536+((1023&h)<<10)+(1023&s))>>18|240,c[p++]=h>>12&63|128):c[p++]=h>>12|224,c[p++]=h>>6&63|128),c[p++]=63&h|128);return p-o}},{}],11:[function(t,a,u){var i=t(14),c=t(33);function p(s,o,l,n){var d=!1;if(o.resolvedType)if(o.resolvedType instanceof i){s("switch(d%s){",n);for(var y=o.resolvedType.values,f=Object.keys(y),_=0;_<f.length;++_)y[f[_]]!==o.typeDefault||d||(s("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),o.repeated||s("break"),d=!0),s("case%j:",f[_])("case %i:",y[f[_]])("m%s=%j",n,y[f[_]])("break");s("}")}else s('if(typeof d%s!=="object")',n)("throw TypeError(%j)",o.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",n,l,n);else{var m=!1;switch(o.type){case"double":case"float":s("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":s("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":s("m%s=d%s|0",n,n);break;case"uint64":m=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":s("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,m)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,m?"true":"");break;case"bytes":s('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":s("m%s=String(d%s)",n,n);break;case"bool":s("m%s=Boolean(d%s)",n,n)}}return s}function h(s,o,l,n){if(o.resolvedType)o.resolvedType instanceof i?s("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,l,n,n,l,n,n):s("d%s=types[%i].toObject(m%s,o)",n,l,n);else{var d=!1;switch(o.type){case"double":case"float":s("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":d=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":s('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("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",n,n,n,n,d?"true":"",n);break;case"bytes":s("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",n,n,n,n,n);break;default:s("d%s=m%s",n,n)}}return s}u.fromObject=function(s){var o=s.fieldsArray,l=c.codegen(["d","n"],s.name+"$fromObject")("if(d instanceof this.ctor)")("return d")("if(n===undefined)n=0")("if(n>util.recursionLimit)")('throw Error("maximum nesting depth exceeded")');if(!o.length)return l("return new this.ctor");l("var m=new this.ctor");for(var n=0;n<o.length;++n){var d=o[n].resolve(),y=c.safeProp(d.name);d.map?(l("if(d%s){",y)('if(typeof d%s!=="object")',y)("throw TypeError(%j)",d.fullName+": object expected")("m%s={}",y)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",y),l('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",y),p(l,d,n,y+"[ks[i]]")("}")("}")):d.repeated?(l("if(d%s){",y)("if(!Array.isArray(d%s))",y)("throw TypeError(%j)",d.fullName+": array expected")("m%s=[]",y)("for(var i=0;i<d%s.length;++i){",y),p(l,d,n,y+"[i]")("}")("}")):(d.resolvedType instanceof i||l("if(d%s!=null){",y),p(l,d,n,y),d.resolvedType instanceof i||l("}"))}return l("return m")},u.toObject=function(s){var o=s.fieldsArray.slice().sort(c.compareFieldsById);if(!o.length)return c.codegen()("return {}");for(var l=c.codegen(["m","o"],s.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],d=[],y=[],f=0;f<o.length;++f)o[f].partOf||(o[f].resolve().repeated?n:o[f].map?d:y).push(o[f]);if(n.length){for(l("if(o.arrays||o.defaults){"),f=0;f<n.length;++f)l("d%s=[]",c.safeProp(n[f].name));l("}")}if(d.length){for(l("if(o.objects||o.defaults){"),f=0;f<d.length;++f)l("d%s={}",c.safeProp(d[f].name));l("}")}if(y.length){for(l("if(o.defaults){"),f=0;f<y.length;++f){var _,m=y[f],v=c.safeProp(m.name);m.resolvedType instanceof i?l("d%s=o.enums===String?%j:%j",v,m.resolvedType.valuesById[m.typeDefault],m.typeDefault):m.long?l("if(util.Long){")("var n=new util.Long(%i,%i,%j)",m.typeDefault.low,m.typeDefault.high,m.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",v)("}else")("d%s=o.longs===String?%j:%i",v,m.typeDefault.toString(),m.typeDefault.toNumber()):m.bytes?(_=Array.prototype.slice.call(m.typeDefault),l("if(o.bytes===String)d%s=%j",v,String.fromCharCode.apply(String,m.typeDefault))("else{")("d%s=%j",v,_)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",v,v)("}")):l("d%s=%j",v,m.typeDefault)}l("}")}for(var A=!1,f=0;f<o.length;++f){var m=o[f],g=s.i.indexOf(m),v=c.safeProp(m.name);m.map?(A||(A=!0,l("var ks2")),l("if(m%s&&(ks2=Object.keys(m%s)).length){",v,v)("d%s={}",v)("for(var j=0;j<ks2.length;++j){"),l('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",v),h(l,m,g,v+"[ks2[j]]")("}")):m.repeated?(l("if(m%s&&m%s.length){",v,v)("d%s=[]",v)("for(var j=0;j<m%s.length;++j){",v),h(l,m,g,v+"[j]")("}")):(l("if(m%s!=null&&m.hasOwnProperty(%j)){",v,m.name),h(l,m,g,v),m.partOf&&l("if(o.oneofs)")("d%s=%j",c.safeProp(m.partOf.name),m.name)),l("}")}return l("return d")}},{14:14,33:33}],12:[function(t,a,u){a.exports=function(h){for(var s=p.codegen(["r","l","e","n"],h.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("if(n===undefined)n=0")("if(n>Reader.recursionLimit)")('throw Error("maximum nesting depth exceeded")')("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(h.fieldsArray.filter(function(f){return f.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),o=0;o<h.fieldsArray.length;++o){var l=h.i[o].resolve(),n=l.resolvedType instanceof i?"int32":l.type,d="m"+p.safeProp(l.name);s("case %i: {",l.id),l.map?(s("if(%s===util.emptyObject)",d)("%s={}",d)("var c2 = r.uint32()+r.pos"),c.defaults[l.keyType]!==w?s("k=%j",c.defaults[l.keyType]):s("k=null"),c.defaults[n]!==w?s("value=%j",c.defaults[n]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",l.keyType)("case 2:"),c.basic[n]===w?s("value=types[%i].decode(r,r.uint32(),undefined,n+1)",o):s("value=r.%s()",n),s("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}"),c.long[l.keyType]!==w?s('%s[typeof k==="object"?util.longToHash(k):k]=value',d):(l.keyType==="string"&&s('if(k==="__proto__")')("util.makeProp(%s,k)",d),s("%s[k]=value",d))):l.repeated?(s("if(!(%s&&%s.length))",d,d)("%s=[]",d),c.packed[n]!==w&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",d,n)("}else"),c.basic[n]===w?s(l.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4),n+1))":"%s.push(types[%i].decode(r,r.uint32(),undefined,n+1))",d,o):s("%s.push(r.%s())",d,n)):c.basic[n]===w?s(l.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4),n+1)":"%s=types[%i].decode(r,r.uint32(),undefined,n+1)",d,o):s("%s=r.%s()",d,n),s("break")("}")}for(s("default:")("r.skipType(t&7,n)")("break")("}")("}"),o=0;o<h.i.length;++o){var y=h.i[o];y.required&&s("if(!m.hasOwnProperty(%j))",y.name)("throw util.ProtocolError(%j,{instance:m})","missing required '"+y.name+"'")}return s("return m")};var i=t(14),c=t(32),p=t(33)},{14:14,32:32,33:33}],13:[function(t,a,u){a.exports=function(s){for(var o,l=p.codegen(["m","w"],s.name+"$encode")("if(!w)")("w=Writer.create()"),n=s.fieldsArray.slice().sort(p.compareFieldsById),d=0;d<n.length;++d){var y=n[d].resolve(),f=s.i.indexOf(y),_=y.resolvedType instanceof i?"int32":y.type,m=c.basic[_];o="m"+p.safeProp(y.name),y.map?(l("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",o,y.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",o)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(y.id<<3|2)>>>0,8|c.mapKey[y.keyType],y.keyType),m===w?l("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",f,o):l(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|m,_,o),l("}")("}")):y.repeated?(l("if(%s!=null&&%s.length){",o,o),y.packed&&c.packed[_]!==w?l("w.uint32(%i).fork()",(y.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",o)("w.%s(%s[i])",_,o)("w.ldelim()"):(l("for(var i=0;i<%s.length;++i)",o),m===w?h(l,y,f,o+"[i]"):l("w.uint32(%i).%s(%s[i])",(y.id<<3|m)>>>0,_,o)),l("}")):(y.optional&&l("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",o,y.name),m===w?h(l,y,f,o):l("w.uint32(%i).%s(%s)",(y.id<<3|m)>>>0,_,o))}return l("return w")};var i=t(14),c=t(32),p=t(33);function h(s,o,l,n){o.delimited?s("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",l,n,(o.id<<3|3)>>>0,(o.id<<3|4)>>>0):s("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",l,n,(o.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(t,a,u){a.exports=h;var i=t(22),c=(((h.prototype=Object.create(i.prototype)).constructor=h).className="Enum",t(21)),p=t(33);function h(s,o,l,n,d,y){if(i.call(this,s,l),o&&typeof o!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=d||{},this.valuesOptions=y,this.n={},this.reserved=w,o)for(var f=Object.keys(o),_=0;_<f.length;++_)f[_]!=="__proto__"&&typeof o[f[_]]=="number"&&(this.valuesById[this.values[f[_]]=o[f[_]]]=f[_])}h.prototype.r=function(s){return s=this.e||s,i.prototype.r.call(this,s),Object.keys(this.values).forEach(o=>{var l=Object.assign({},this.o);this.n[o]=Object.assign(l,this.valuesOptions&&this.valuesOptions[o]&&this.valuesOptions[o].features)}),this},h.fromJSON=function(s,o){return s=new h(s,o.values,o.options,o.comment,o.comments),s.reserved=o.reserved,o.edition&&(s.e=o.edition),s.u="proto3",s},h.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,p.toObject(["edition",this.h(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:w,"comment",s?this.comment:w,"comments",s?this.comments:w])},h.prototype.add=function(s,o,l,n){if(!p.isString(s))throw TypeError("name must be a string");if(!p.isInteger(o))throw TypeError("id must be an integer");if(s!=="__proto__"){if(this.values[s]!==w)throw Error("duplicate name '"+s+"' in "+this);if(this.isReservedId(o))throw Error("id "+o+" is reserved in "+this);if(this.isReservedName(s))throw Error("name '"+s+"' is reserved in "+this);if(this.valuesById[o]!==w){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+o+" in "+this);this.values[s]=o}else this.valuesById[this.values[s]=o]=s;n&&(this.valuesOptions===w&&(this.valuesOptions={}),this.valuesOptions[s]=n||null),this.comments[s]=l||null}return this},h.prototype.remove=function(s){if(!p.isString(s))throw TypeError("name must be a string");var o=this.values[s];if(o==null)throw Error("name '"+s+"' does not exist in "+this);return delete this.valuesById[o],delete this.values[s],delete this.comments[s],this.valuesOptions&&delete this.valuesOptions[s],this},h.prototype.isReservedId=function(s){return c.isReservedId(this.reserved,s)},h.prototype.isReservedName=function(s){return c.isReservedName(this.reserved,s)}},{21:21,22:22,33:33}],15:[function(t,a,u){a.exports=l;var i,c=t(22),p=(((l.prototype=Object.create(c.prototype)).constructor=l).className="Field",t(14)),h=t(32),s=t(33),o=/^required|optional|repeated$/;function l(n,d,y,f,_,m,v){if(s.isObject(f)?(v=_,m=f,f=_=w):s.isObject(_)&&(v=m,m=_,_=w),c.call(this,n,m),!s.isInteger(d)||d<0)throw TypeError("id must be a non-negative integer");if(!s.isString(y))throw TypeError("type must be a string");if(f!==w&&!o.test(f=f.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(_!==w&&!s.isString(_))throw TypeError("extend must be a string");this.rule=(f=f==="proto3_optional"?"optional":f)&&f!=="optional"?f:w,this.type=y,this.id=d,this.extend=_||w,this.repeated=f==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!s.Long&&h.long[y]!==w,this.bytes=y==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=v}l.fromJSON=function(n,d){return n=new l(n,d.id,d.type,d.rule,d.extend,d.options,d.comment),d.edition&&(n.e=d.edition),n.u="proto3",n},Object.defineProperty(l.prototype,"required",{get:function(){return this.o.field_presence==="LEGACY_REQUIRED"}}),Object.defineProperty(l.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(l.prototype,"delimited",{get:function(){return this.resolvedType instanceof i&&this.o.message_encoding==="DELIMITED"}}),Object.defineProperty(l.prototype,"packed",{get:function(){return this.o.repeated_field_encoding==="PACKED"}}),Object.defineProperty(l.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||this.o.field_presence!=="IMPLICIT")}}),l.prototype.setOption=function(n,d,y){return c.prototype.setOption.call(this,n,d,y)},l.prototype.toJSON=function(n){return n=!!n&&!!n.keepComments,s.toObject(["edition",this.h(),"rule",this.rule!=="optional"&&this.rule||w,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",n?this.comment:w])},l.prototype.resolve=function(){var n;return this.resolved?this:((this.typeDefault=h.defaults[this.type])===w?(this.resolvedType=(this.declaringField||this).parent.lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof p&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed===w||!this.resolvedType||this.resolvedType instanceof p||delete this.options.packed,Object.keys(this.options).length||(this.options=w)),this.long?(this.typeDefault=s.Long.fromNumber(this.typeDefault,(this.type[0]||"")=="u"),Object.freeze&&Object.freeze(this.typeDefault)):this.bytes&&typeof this.typeDefault=="string"&&(s.base64.test(this.typeDefault)?s.base64.decode(this.typeDefault,n=s.newBuffer(s.base64.length(this.typeDefault)),0):s.utf8.write(this.typeDefault,n=s.newBuffer(s.utf8.length(this.typeDefault)),0),this.typeDefault=n),this.map?this.defaultValue=s.emptyObject:this.repeated?this.defaultValue=s.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),c.prototype.resolve.call(this))},l.prototype.f=function(n){var d;return n!=="proto2"&&n!=="proto3"?{}:(n={},this.rule==="required"&&(n.field_presence="LEGACY_REQUIRED"),this.parent&&h.defaults[this.type]===w&&(d=this.parent.get(this.type.split(".").pop()))&&d instanceof i&&d.group&&(n.message_encoding="DELIMITED"),this.getOption("packed")===!0?n.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(n.repeated_field_encoding="EXPANDED"),n)},l.prototype.r=function(n){return c.prototype.r.call(this,this.e||n)},l.d=function(n,d,y,f){return typeof d=="function"?d=s.decorateType(d).name:d&&typeof d=="object"&&(d=s.decorateEnum(d).name),function(_,m){s.decorateType(_.constructor).add(new l(m,n,d,y,{default:f}))}},l.c=function(n){i=n}},{14:14,22:22,32:32,33:33}],16:[function(t,a,u){var i=a.exports=t(17);i.build="light",i.load=function(c,p,h){return(p=typeof p=="function"?(h=p,new i.Root):p||new i.Root).load(c,h)},i.loadSync=function(c,p){return(p=p||new i.Root).loadSync(c)},i.encoder=t(13),i.decoder=t(12),i.verifier=t(37),i.converter=t(11),i.ReflectionObject=t(22),i.Namespace=t(21),i.Root=t(26),i.Enum=t(14),i.Type=t(31),i.Field=t(15),i.OneOf=t(23),i.MapField=t(18),i.Service=t(30),i.Method=t(20),i.Message=t(19),i.wrappers=t(38),i.types=t(32),i.util=t(33),i.ReflectionObject.c(i.Root),i.Namespace.c(i.Type,i.Service,i.Enum),i.Root.c(i.Type),i.Field.c(i.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,37:37,38:38}],17:[function(t,a,u){var i=u;function c(){i.util.c(),i.Writer.c(i.BufferWriter),i.Reader.c(i.BufferReader)}i.build="minimal",i.Writer=t(39),i.BufferWriter=t(40),i.Reader=t(24),i.BufferReader=t(25),i.util=t(35),i.rpc=t(28),i.roots=t(27),i.configure=c,c()},{24:24,25:25,27:27,28:28,35:35,39:39,40:40}],18:[function(t,a,u){a.exports=h;var i=t(15),c=(((h.prototype=Object.create(i.prototype)).constructor=h).className="MapField",t(32)),p=t(33);function h(s,o,l,n,d,y){if(i.call(this,s,o,n,w,w,d,y),!p.isString(l))throw TypeError("keyType must be a string");this.keyType=l,this.resolvedKeyType=null,this.map=!0}h.fromJSON=function(s,o){return new h(s,o.id,o.keyType,o.type,o.options,o.comment)},h.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,p.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:w])},h.prototype.resolve=function(){if(this.resolved)return this;if(c.mapKey[this.keyType]===w)throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},h.d=function(s,o,l){return typeof l=="function"?l=p.decorateType(l).name:l&&typeof l=="object"&&(l=p.decorateEnum(l).name),function(n,d){p.decorateType(n.constructor).add(new h(d,s,o,l))}}},{15:15,32:32,33:33}],19:[function(t,a,u){a.exports=c;var i=t(35);function c(p){if(p)for(var h=Object.keys(p),s=0;s<h.length;++s){var o=h[s];o!=="__proto__"&&(this[o]=p[o])}}c.create=function(p){return this.$type.create(p)},c.encode=function(p,h){return this.$type.encode(p,h)},c.encodeDelimited=function(p,h){return this.$type.encodeDelimited(p,h)},c.decode=function(p){return this.$type.decode(p)},c.decodeDelimited=function(p){return this.$type.decodeDelimited(p)},c.verify=function(p){return this.$type.verify(p)},c.fromObject=function(p){return this.$type.fromObject(p)},c.toObject=function(p,h){return this.$type.toObject(p,h)},c.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},{35:35}],20:[function(t,a,u){a.exports=p;var i=t(22),c=(((p.prototype=Object.create(i.prototype)).constructor=p).className="Method",t(33));function p(h,s,o,l,n,d,y,f,_){if(c.isObject(n)?(y=n,n=d=w):c.isObject(d)&&(y=d,d=w),s!==w&&!c.isString(s))throw TypeError("type must be a string");if(!c.isString(o))throw TypeError("requestType must be a string");if(!c.isString(l))throw TypeError("responseType must be a string");i.call(this,h,y),this.type=s||"rpc",this.requestType=o,this.requestStream=!!n||w,this.responseType=l,this.responseStream=!!d||w,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=f,this.parsedOptions=_}p.fromJSON=function(h,s){return new p(h,s.type,s.requestType,s.responseType,s.requestStream,s.responseStream,s.options,s.comment,s.parsedOptions)},p.prototype.toJSON=function(h){return h=!!h&&!!h.keepComments,c.toObject(["type",this.type!=="rpc"&&this.type||w,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",h?this.comment:w,"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),i.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(t,a,u){a.exports=d;var i,c,p,h=t(22),s=(((d.prototype=Object.create(h.prototype)).constructor=d).className="Namespace",t(15)),o=t(33),l=t(23);function n(f,_){if(!f||!f.length)return w;for(var m={},v=0;v<f.length;++v)m[f[v].name]=f[v].toJSON(_);return m}function d(f,_){h.call(this,f,_),this.nested=w,this.a=null,this.l=Object.create(null),this.p=!0,this.b=!0}function y(f){f.a=null,f.l=Object.create(null);for(var _=f;_=_.parent;)_.l=Object.create(null);return f}d.fromJSON=function(f,_){return new d(f,_.options).addJSON(_.nested)},d.arrayToJSON=n,d.isReservedId=function(f,_){if(f){for(var m=0;m<f.length;++m)if(typeof f[m]!="string"&&f[m][0]<=_&&f[m][1]>_)return!0}return!1},d.isReservedName=function(f,_){if(f){for(var m=0;m<f.length;++m)if(f[m]===_)return!0}return!1},Object.defineProperty(d.prototype,"nestedArray",{get:function(){return this.a||(this.a=o.toArray(this.nested))}}),d.prototype.toJSON=function(f){return o.toObject(["options",this.options,"nested",n(this.nestedArray,f)])},d.prototype.addJSON=function(f){if(f)for(var _,m=Object.keys(f),v=0;v<m.length;++v)_=f[m[v]],this.add((_.fields!==w?i:_.values!==w?p:_.methods!==w?c:_.id!==w?s:d).fromJSON(m[v],_));return this},d.prototype.get=function(f){return this.nested&&Object.prototype.hasOwnProperty.call(this.nested,f)?this.nested[f]:null},d.prototype.getEnum=function(f){if(this.nested&&Object.prototype.hasOwnProperty.call(this.nested,f)&&this.nested[f]instanceof p)return this.nested[f].values;throw Error("no such enum: "+f)},d.prototype.add=function(f){if(!(f instanceof s&&f.extend!==w||f instanceof i||f instanceof l||f instanceof p||f instanceof c||f instanceof d))throw TypeError("object must be a valid nested object");if(f.name==="__proto__")return this;if(this.nested){var _=this.get(f.name);if(_){if(!(_ instanceof d&&f instanceof d)||_ instanceof i||_ instanceof c)throw Error("duplicate name '"+f.name+"' in "+this);for(var m=_.nestedArray,v=0;v<m.length;++v)f.add(m[v]);this.remove(_),this.nested||(this.nested={}),f.setOptions(_.options,!0)}}else this.nested={};this.nested[f.name]=f,this instanceof i||this instanceof c||this instanceof p||this instanceof s||f.e||(f.e=f.u),this.p=!0,this.b=!0;for(var A=this;A=A.parent;)A.p=!0,A.b=!0;return f.onAdd(this),y(this)},d.prototype.remove=function(f){if(!(f instanceof h))throw TypeError("object must be a ReflectionObject");if(f.parent!==this)throw Error(f+" is not a member of "+this);return delete this.nested[f.name],Object.keys(this.nested).length||(this.nested=w),f.onRemove(this),y(this)},d.prototype.define=function(f,_){if(o.isString(f))f=f.split(".");else if(!Array.isArray(f))throw TypeError("illegal path");if(f&&f.length&&f[0]==="")throw Error("path must be relative");for(var m=this;0<f.length;){var v=f.shift();if(m.nested&&m.nested[v]){if(!((m=m.nested[v])instanceof d))throw Error("path conflicts with non-namespace objects")}else m.add(m=new d(v))}return _&&m.addJSON(_),m},d.prototype.resolveAll=function(){if(this.b){this.v(this.e);var f=this.nestedArray,_=0;for(this.resolve();_<f.length;)f[_]instanceof d?f[_++].resolveAll():f[_++].resolve();this.b=!1}return this},d.prototype.v=function(f){return this.p&&(this.p=!1,f=this.e||f,h.prototype.v.call(this,f),this.nestedArray.forEach(_=>{_.v(f)})),this},d.prototype.lookup=function(f,_,m){if(typeof _=="boolean"?(m=_,_=w):_&&!Array.isArray(_)&&(_=[_]),o.isString(f)&&f.length){if(f===".")return this.root;f=f.split(".")}else if(!f.length)return this;var v=f.join(".");if(f[0]==="")return this.root.lookup(f.slice(1),_);var A=this.root.y&&this.root.y["."+v];if(A&&(!_||~_.indexOf(A.constructor))||(A=this.w(f,v))&&(!_||~_.indexOf(A.constructor)))return A;if(!m)for(var g=this;g.parent;){if((A=g.parent.w(f,v))&&(!_||~_.indexOf(A.constructor)))return A;g=g.parent}return null},d.prototype.w=function(f,_){if(Object.prototype.hasOwnProperty.call(this.l,_))return this.l[_];var m=this.get(f[0]),v=null;if(m)f.length===1?v=m:m instanceof d&&(f=f.slice(1),v=m.w(f,f.join(".")));else for(var A=0;A<this.nestedArray.length;++A)this.a[A]instanceof d&&(m=this.a[A].w(f,_))&&(v=m);return this.l[_]=v},d.prototype.lookupType=function(f){var _=this.lookup(f,[i]);if(_)return _;throw Error("no such type: "+f)},d.prototype.lookupEnum=function(f){var _=this.lookup(f,[p]);if(_)return _;throw Error("no such Enum '"+f+"' in "+this)},d.prototype.lookupTypeOrEnum=function(f){var _=this.lookup(f,[i,p]);if(_)return _;throw Error("no such Type or Enum '"+f+"' in "+this)},d.prototype.lookupService=function(f){var _=this.lookup(f,[c]);if(_)return _;throw Error("no such Service '"+f+"' in "+this)},d.c=function(f,_,m){i=f,c=_,p=m}},{15:15,22:22,23:23,33:33}],22:[function(t,a,u){(a.exports=l).className="ReflectionObject";const i=t(23);var c,p=t(33),h={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},s={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},o={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function l(n,d){if(!p.isString(n))throw TypeError("name must be a string");if(d&&!p.isObject(d))throw TypeError("options must be an object");this.options=d,this.parsedOptions=null,this.name=n,this.e=null,this.u="proto2",this.o={},this.g=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(l.prototype,{root:{get:function(){for(var n=this;n.parent!==null;)n=n.parent;return n}},fullName:{get:function(){for(var n=[this.name],d=this.parent;d;)n.unshift(d.name),d=d.parent;return n.join(".")}}}),l.prototype.toJSON=function(){throw Error()},l.prototype.onAdd=function(n){this.parent&&this.parent!==n&&this.parent.remove(this),this.parent=n,this.resolved=!1,n=n.root,n instanceof c&&n.j(this)},l.prototype.onRemove=function(n){n=n.root,n instanceof c&&n.O(this),this.parent=null,this.resolved=!1},l.prototype.resolve=function(){return this.resolved||this.root instanceof c&&(this.resolved=!0),this},l.prototype.v=function(n){return this.r(this.e||n)},l.prototype.r=function(n){if(!this.g){var d={};if(!n)throw Error("Unknown edition for "+this.fullName);var y=Object.assign(this.options?Object.assign({},this.options.features):{},this.f(n));if(this.e){if(n==="proto2")d=Object.assign({},s);else if(n==="proto3")d=Object.assign({},o);else{if(n!=="2023")throw Error("Unknown edition: "+n);d=Object.assign({},h)}this.o=Object.assign(d,y||{})}else{if(this.partOf instanceof i)n=Object.assign({},this.partOf.o),this.o=Object.assign(n,y||{});else if(!this.declaringField){if(!this.parent)throw Error("Unable to find a parent for "+this.fullName);d=Object.assign({},this.parent.o),this.o=Object.assign(d,y||{})}this.extensionField&&(this.extensionField.o=this.o)}this.g=!0}},l.prototype.f=function(){return{}},l.prototype.getOption=function(n){return this.options?this.options[n]:w},l.prototype.setOption=function(n,d,y){return n!=="__proto__"&&(this.options||(this.options={}),/^features\./.test(n)?p.setProperty(this.options,n,d,y):y&&this.options[n]!==w||(this.getOption(n)!==d&&(this.resolved=!1),this.options[n]=d)),this},l.prototype.setParsedOption=function(n,d,y){var f,_,m;return n!=="__proto__"&&(this.parsedOptions||(this.parsedOptions=[]),f=this.parsedOptions,y?(_=f.find(function(v){return Object.prototype.hasOwnProperty.call(v,n)}))?(m=_[n],p.setProperty(m,y,d)):((_={})[n]=p.setProperty({},y,d),f.push(_)):((m={})[n]=d,f.push(m))),this},l.prototype.setOptions=function(n,d){if(n)for(var y=Object.keys(n),f=0;f<y.length;++f)this.setOption(y[f],n[y[f]],d);return this},l.prototype.toString=function(){var n=this.constructor.className,d=this.fullName;return d.length?n+" "+d:n},l.prototype.h=function(){return this.e&&this.e!=="proto3"?this.e:w},l.c=function(n){c=n}},{23:23,33:33}],23:[function(t,a,u){a.exports=h;var i=t(22),c=(((h.prototype=Object.create(i.prototype)).constructor=h).className="OneOf",t(15)),p=t(33);function h(o,l,n,d){if(Array.isArray(l)||(n=l,l=w),i.call(this,o,n),l!==w&&!Array.isArray(l))throw TypeError("fieldNames must be an Array");this.oneof=l||[],this.fieldsArray=[],this.comment=d}function s(o){if(o.parent)for(var l=0;l<o.fieldsArray.length;++l)o.fieldsArray[l].parent||o.parent.add(o.fieldsArray[l])}h.fromJSON=function(o,l){return new h(o,l.oneof,l.options,l.comment)},h.prototype.toJSON=function(o){return o=!!o&&!!o.keepComments,p.toObject(["options",this.options,"oneof",this.oneof,"comment",o?this.comment:w])},h.prototype.add=function(o){if(o instanceof c)return o.parent&&o.parent!==this.parent&&o.parent.remove(o),this.oneof.push(o.name),this.fieldsArray.push(o),s(o.partOf=this),this;throw TypeError("field must be a Field")},h.prototype.remove=function(o){if(!(o instanceof c))throw TypeError("field must be a Field");var l=this.fieldsArray.indexOf(o);if(l<0)throw Error(o+" is not a member of "+this);return this.fieldsArray.splice(l,1),-1<(l=this.oneof.indexOf(o.name))&&this.oneof.splice(l,1),o.partOf=null,this},h.prototype.onAdd=function(o){i.prototype.onAdd.call(this,o);for(var l=0;l<this.oneof.length;++l){var n=o.get(this.oneof[l]);n&&!n.partOf&&(n.partOf=this).fieldsArray.push(n)}s(this)},h.prototype.onRemove=function(o){for(var l,n=0;n<this.fieldsArray.length;++n)(l=this.fieldsArray[n]).parent&&l.parent.remove(l);i.prototype.onRemove.call(this,o)},Object.defineProperty(h.prototype,"isProto3Optional",{get:function(){var o;return this.fieldsArray!=null&&this.fieldsArray.length===1&&(o=this.fieldsArray[0]).options!=null&&o.options.proto3_optional===!0}}),h.d=function(){for(var o=Array(arguments.length),l=0;l<arguments.length;)o[l]=arguments[l++];return function(n,d){p.decorateType(n.constructor).add(new h(d,o)),Object.defineProperty(n,d,{get:p.oneOfGetter(o),set:p.oneOfSetter(o)})}}},{15:15,22:22,33:33}],24:[function(t,a,u){a.exports=o;var i,c=t(35),p=c.LongBits,h=c.utf8;function s(m,v){return RangeError("index out of range: "+m.pos+" + "+(v||1)+" > "+m.len)}function o(m){this.buf=m,this.pos=0,this.len=m.length}function l(){return c.Buffer?function(m){return(o.create=function(v){return c.Buffer.isBuffer(v)?new i(v):d(v)})(m)}:d}var n,d=typeof Uint8Array!="undefined"?function(m){if(m instanceof Uint8Array||Array.isArray(m))return new o(m);throw Error("illegal buffer")}:function(m){if(Array.isArray(m))return new o(m);throw Error("illegal buffer")};function y(){var m=new p(0,0),v=0;if(!(4<this.len-this.pos)){for(;v<3;++v){if(this.pos>=this.len)throw s(this);if(m.lo=(m.lo|(127&this.buf[this.pos])<<7*v)>>>0,this.buf[this.pos++]<128)return m}return m.lo=(m.lo|(127&this.buf[this.pos++])<<7*v)>>>0,m}for(;v<4;++v)if(m.lo=(m.lo|(127&this.buf[this.pos])<<7*v)>>>0,this.buf[this.pos++]<128)return m;if(m.lo=(m.lo|(127&this.buf[this.pos])<<28)>>>0,m.hi=(m.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return m;if(v=0,4<this.len-this.pos){for(;v<5;++v)if(m.hi=(m.hi|(127&this.buf[this.pos])<<7*v+3)>>>0,this.buf[this.pos++]<128)return m}else for(;v<5;++v){if(this.pos>=this.len)throw s(this);if(m.hi=(m.hi|(127&this.buf[this.pos])<<7*v+3)>>>0,this.buf[this.pos++]<128)return m}throw Error("invalid varint encoding")}function f(m,v){return(m[v-4]|m[v-3]<<8|m[v-2]<<16|m[v-1]<<24)>>>0}function _(){if(this.pos+8>this.len)throw s(this,8);return new p(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}o.create=l(),o.prototype.k=c.Array.prototype.subarray||c.Array.prototype.slice,o.prototype.uint32=(n=4294967295,function(){if(n=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(n=(n|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128||(n=(n|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128||(n=(n|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128||(n=(n|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128||!((this.pos+=5)>this.len))))))return n;throw this.pos=this.len,s(this,10)}),o.prototype.int32=function(){return 0|this.uint32()},o.prototype.sint32=function(){var m=this.uint32();return m>>>1^-(1&m)|0},o.prototype.bool=function(){return this.uint32()!==0},o.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return f(this.buf,this.pos+=4)},o.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|f(this.buf,this.pos+=4)},o.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var m=c.float.readFloatLE(this.buf,this.pos);return this.pos+=4,m},o.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var m=c.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,m},o.prototype.bytes=function(){var m=this.uint32(),v=this.pos,A=this.pos+m;if(A>this.len)throw s(this,m);return this.pos+=m,Array.isArray(this.buf)?this.buf.slice(v,A):v===A?(m=c.Buffer)?m.alloc(0):new this.buf.constructor(0):this.k.call(this.buf,v,A)},o.prototype.string=function(){var m=this.bytes();return h.read(m,0,m.length)},o.prototype.skip=function(m){if(typeof m=="number"){if(this.pos+m>this.len)throw s(this,m);this.pos+=m}else do if(this.pos>=this.len)throw s(this);while(128&this.buf[this.pos++]);return this},o.recursionLimit=c.recursionLimit,o.prototype.skipType=function(m,v){if(o.recursionLimit<(v=v===w?0:v))throw Error("maximum nesting depth exceeded");switch(m){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(m=7&this.uint32())!=4;)this.skipType(m,v+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+m+" at offset "+this.pos)}return this},o.c=function(m){i=m,o.create=l(),i.c();var v=c.Long?"toLong":"toNumber";c.merge(o.prototype,{int64:function(){return y.call(this)[v](!1)},uint64:function(){return y.call(this)[v](!0)},sint64:function(){return y.call(this).zzDecode()[v](!1)},fixed64:function(){return _.call(this)[v](!0)},sfixed64:function(){return _.call(this)[v](!1)}})}},{35:35}],25:[function(t,a,u){a.exports=p;var i=t(24),c=((p.prototype=Object.create(i.prototype)).constructor=p,t(35));function p(h){i.call(this,h)}p.c=function(){c.Buffer&&(p.prototype.k=c.Buffer.prototype.slice)},p.prototype.string=function(){var h=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+h,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+h,this.len))},p.c()},{24:24,35:35}],26:[function(t,a,u){a.exports=d;var i,c,p,h=t(21),s=(((d.prototype=Object.create(h.prototype)).constructor=d).className="Root",t(15)),o=t(14),l=t(23),n=t(33);function d(m){h.call(this,"",m),this.deferred=[],this.files=[],this.e="proto2",this.y={}}function y(){}d.fromJSON=function(m,v){return v=v||new d,m.options&&v.setOptions(m.options),v.addJSON(m.nested).resolveAll()},d.prototype.resolvePath=n.path.resolve,d.prototype.fetch=n.fetch,d.prototype.load=function m(v,A,g){typeof A=="function"&&(g=A,A=w);var O=this;if(!g)return n.asPromise(m,O,v,A);var b=g===y;function k(I,x){if(g){if(b)throw I;x&&x.resolveAll();var P=g;g=null,P(I,x)}}function N(I){var x=I.lastIndexOf("google/protobuf/");return-1<x&&(I=I.substring(x),I in p)?I:null}function j(I,x){try{if(n.isString(x)&&(x[0]||"")=="{"&&(x=JSON.parse(x)),n.isString(x)){c.filename=I;var P,R=c(x,O,A),F=0;if(R.imports)for(;F<R.imports.length;++F)(P=N(R.imports[F])||O.resolvePath(I,R.imports[F]))&&L(P);if(R.weakImports)for(F=0;F<R.weakImports.length;++F)(P=N(R.weakImports[F])||O.resolvePath(I,R.weakImports[F]))&&L(P,!0)}else O.setOptions(x.options).addJSON(x.nested)}catch(te){k(te)}b||H||k(null,O)}function L(I,x){if(I=N(I)||I,!~O.files.indexOf(I))if(O.files.push(I),I in p)b?j(I,p[I]):(++H,setTimeout(function(){--H,j(I,p[I])}));else if(b){var P;try{P=n.fs.readFileSync(I).toString("utf8")}catch(R){return void(x||k(R))}j(I,P)}else++H,O.fetch(I,function(R,F){--H,g&&(R?x?H||k(null,O):k(R):j(I,F))})}var H=0;n.isString(v)&&(v=[v]);for(var T,S=0;S<v.length;++S)(T=O.resolvePath("",v[S]))&&L(T);return b?O.resolveAll():H||k(null,O),O},d.prototype.loadSync=function(m,v){if(n.isNode)return this.load(m,v,y);throw Error("not supported")},d.prototype.resolveAll=function(){if(!this.b)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(m){return"'extend "+m.extend+"' in "+m.parent.fullName}).join(", "));return h.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function _(m,v){var A,g=v.parent.lookup(v.extend);if(g)return A=new s(v.fullName,v.id,v.type,v.rule,w,v.options),g.get(A.name)||((A.declaringField=v).extensionField=A,g.add(A)),1}d.prototype.j=function(m){if(m instanceof s)m.extend===w||m.extensionField||_(0,m)||this.deferred.push(m);else if(m instanceof o)f.test(m.name)&&(m.parent[m.name]=m.values);else if(!(m instanceof l)){if(m instanceof i)for(var v=0;v<this.deferred.length;)_(0,this.deferred[v])?this.deferred.splice(v,1):++v;for(var A=0;A<m.nestedArray.length;++A)this.j(m.a[A]);f.test(m.name)&&(m.parent[m.name]=m)}(m instanceof i||m instanceof o||m instanceof s)&&(this.y[m.fullName]=m)},d.prototype.O=function(m){var v;if(m instanceof s)m.extend!==w&&(m.extensionField?(m.extensionField.parent.remove(m.extensionField),m.extensionField=null):-1<(v=this.deferred.indexOf(m))&&this.deferred.splice(v,1));else if(m instanceof o)f.test(m.name)&&delete m.parent[m.name];else if(m instanceof h){for(var A=0;A<m.nestedArray.length;++A)this.O(m.a[A]);f.test(m.name)&&delete m.parent[m.name]}delete this.y[m.fullName]},d.c=function(m,v,A){i=m,c=v,p=A}},{14:14,15:15,21:21,23:23,33:33}],27:[function(t,a,u){a.exports={}},{}],28:[function(t,a,u){u.Service=t(29)},{29:29}],29:[function(t,a,u){a.exports=c;var i=t(35);function c(p,h,s){if(typeof p!="function")throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=p,this.requestDelimited=!!h,this.responseDelimited=!!s}((c.prototype=Object.create(i.EventEmitter.prototype)).constructor=c).prototype.rpcCall=function p(h,s,o,l,n){if(!l)throw TypeError("request must be specified");var d=this;if(!n)return i.asPromise(p,d,h,s,o,l);if(!d.rpcImpl)return setTimeout(function(){n(Error("already ended"))},0),w;try{return d.rpcImpl(h,s[d.requestDelimited?"encodeDelimited":"encode"](l).finish(),function(y,f){if(y)return d.emit("error",y,h),n(y);if(f===null)return d.end(!0),w;if(!(f instanceof o))try{f=o[d.responseDelimited?"decodeDelimited":"decode"](f)}catch(_){return d.emit("error",_,h),n(_)}return d.emit("data",f,h),n(null,f)})}catch(y){return d.emit("error",y,h),setTimeout(function(){n(y)},0),w}},c.prototype.end=function(p){return this.rpcImpl&&(p||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(t,a,u){a.exports=o;var i=t(21),c=(((o.prototype=Object.create(i.prototype)).constructor=o).className="Service",t(20)),p=t(33),h=t(28),s=p.patterns.reservedRe;function o(n,d){i.call(this,n,d),this.methods={},this._=null}function l(n){return n._=null,n}o.fromJSON=function(n,d){var y=new o(n,d.options);if(d.methods)for(var f=Object.keys(d.methods),_=0;_<f.length;++_)y.add(c.fromJSON(f[_],d.methods[f[_]]));return d.nested&&y.addJSON(d.nested),d.edition&&(y.e=d.edition),y.comment=d.comment,y.u="proto3",y},o.prototype.toJSON=function(n){var d=i.prototype.toJSON.call(this,n),y=!!n&&!!n.keepComments;return p.toObject(["edition",this.h(),"options",d&&d.options||w,"methods",i.arrayToJSON(this.methodsArray,n)||{},"nested",d&&d.nested||w,"comment",y?this.comment:w])},Object.defineProperty(o.prototype,"methodsArray",{get:function(){return this._||(this._=p.toArray(this.methods))}}),o.prototype.get=function(n){return Object.prototype.hasOwnProperty.call(this.methods,n)?this.methods[n]:i.prototype.get.call(this,n)},o.prototype.resolveAll=function(){if(this.b){i.prototype.resolve.call(this);for(var n=this.methodsArray,d=0;d<n.length;++d)n[d].resolve()}return this},o.prototype.v=function(n){return this.p&&(n=this.e||n,i.prototype.v.call(this,n),this.methodsArray.forEach(d=>{d.v(n)})),this},o.prototype.add=function(n){if(this.get(n.name))throw Error("duplicate name '"+n.name+"' in "+this);return n instanceof c?n.name==="__proto__"?this:l((this.methods[n.name]=n).parent=this):i.prototype.add.call(this,n)},o.prototype.remove=function(n){if(n instanceof c){if(this.methods[n.name]!==n)throw Error(n+" is not a member of "+this);return delete this.methods[n.name],n.parent=null,l(this)}return i.prototype.remove.call(this,n)},o.prototype.create=function(n,d,y){for(var f,_=new h.Service(n,d,y),m=0;m<this.methodsArray.length;++m){var v=p.lcFirst((f=this._[m]).resolve().name).replace(/[^$\w_]/g,"");_[v]=p.codegen(["r","c"],s.test(v)?v+"_":v)("return this.rpcCall(m,q,s,r,c)")({m:f,q:f.resolvedRequestType.ctor,s:f.resolvedResponseType.ctor})}return _}},{20:20,21:21,28:28,33:33}],31:[function(t,a,u){a.exports=g;var i=t(21),c=(((g.prototype=Object.create(i.prototype)).constructor=g).className="Type",t(14)),p=t(23),h=t(15),s=t(18),o=t(30),l=t(19),n=t(24),d=t(39),y=t(33),f=t(13),_=t(12),m=t(37),v=t(11),A=t(38);function g(b,k){b=b.replace(/\W/g,""),i.call(this,b,k),this.fields={},this.oneofs=w,this.extensions=w,this.reserved=w,this.group=w,this.A=null,this.i=null,this.T=null,this.x=null}function O(b){return b.A=b.i=b.T=null,delete b.encode,delete b.decode,delete b.verify,b}Object.defineProperties(g.prototype,{fieldsById:{get:function(){if(!this.A){this.A={};for(var b=Object.keys(this.fields),k=0;k<b.length;++k){var N=this.fields[b[k]],j=N.id;if(this.A[j])throw Error("duplicate id "+j+" in "+this);this.A[j]=N}}return this.A}},fieldsArray:{get:function(){return this.i||(this.i=y.toArray(this.fields))}},oneofsArray:{get:function(){return this.T||(this.T=y.toArray(this.oneofs))}},ctor:{get:function(){return this.x||(this.ctor=g.generateConstructor(this)())},set:function(b){for(var k=b.prototype,N=(k instanceof l||((b.prototype=new l).constructor=b,y.merge(b.prototype,k)),b.$type=b.prototype.$type=this,y.merge(b,l,!0),this.x=b,0);N<this.fieldsArray.length;++N)this.i[N].resolve();for(var j={},N=0;N<this.oneofsArray.length;++N)j[this.T[N].resolve().name]={get:y.oneOfGetter(this.T[N].oneof),set:y.oneOfSetter(this.T[N].oneof)};N&&Object.defineProperties(b.prototype,j)}}}),g.generateConstructor=function(b){for(var k,N=y.codegen(["p"],b.name),j=0;j<b.fieldsArray.length;++j)(k=b.i[j]).map?N("this%s={}",y.safeProp(k.name)):k.repeated&&N("this%s=[]",y.safeProp(k.name));return N('if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null&&ks[i]!=="__proto__")')("this[ks[i]]=p[ks[i]]")},g.fromJSON=function(b,k){for(var N=new g(b,k.options),j=(N.extensions=k.extensions,N.reserved=k.reserved,Object.keys(k.fields)),L=0;L<j.length;++L)N.add((k.fields[j[L]].keyType!==void 0?s:h).fromJSON(j[L],k.fields[j[L]]));if(k.oneofs)for(j=Object.keys(k.oneofs),L=0;L<j.length;++L)N.add(p.fromJSON(j[L],k.oneofs[j[L]]));if(k.nested)for(j=Object.keys(k.nested),L=0;L<j.length;++L){var H=k.nested[j[L]];N.add((H.id!==w?h:H.fields!==w?g:H.values!==w?c:H.methods!==w?o:i).fromJSON(j[L],H))}return k.extensions&&k.extensions.length&&(N.extensions=k.extensions),k.reserved&&k.reserved.length&&(N.reserved=k.reserved),k.group&&(N.group=!0),k.comment&&(N.comment=k.comment),k.edition&&(N.e=k.edition),N.u="proto3",N},g.prototype.toJSON=function(b){var k=i.prototype.toJSON.call(this,b),N=!!b&&!!b.keepComments;return y.toObject(["edition",this.h(),"options",k&&k.options||w,"oneofs",i.arrayToJSON(this.oneofsArray,b),"fields",i.arrayToJSON(this.fieldsArray.filter(function(j){return!j.declaringField}),b)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:w,"reserved",this.reserved&&this.reserved.length?this.reserved:w,"group",this.group||w,"nested",k&&k.nested||w,"comment",N?this.comment:w])},g.prototype.resolveAll=function(){if(this.b){i.prototype.resolveAll.call(this);for(var b=this.oneofsArray,k=0;k<b.length;)b[k++].resolve();for(var N=this.fieldsArray,k=0;k<N.length;)N[k++].resolve()}return this},g.prototype.v=function(b){return this.p&&(b=this.e||b,i.prototype.v.call(this,b),this.oneofsArray.forEach(k=>{k.r(b)}),this.fieldsArray.forEach(k=>{k.r(b)})),this},g.prototype.get=function(b){return Object.prototype.hasOwnProperty.call(this.fields,b)?this.fields[b]:this.oneofs&&Object.prototype.hasOwnProperty.call(this.oneofs,b)?this.oneofs[b]:this.nested&&Object.prototype.hasOwnProperty.call(this.nested,b)?this.nested[b]:null},g.prototype.add=function(b){if(this.get(b.name))throw Error("duplicate name '"+b.name+"' in "+this);if(b instanceof h&&b.extend===w){if((this.A||this.fieldsById)[b.id])throw Error("duplicate id "+b.id+" in "+this);if(this.isReservedId(b.id))throw Error("id "+b.id+" is reserved in "+this);if(this.isReservedName(b.name))throw Error("name '"+b.name+"' is reserved in "+this);return b.name==="__proto__"?this:(b.parent&&b.parent.remove(b),(this.fields[b.name]=b).message=this,b.onAdd(this),O(this))}return b instanceof p?b.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),(this.oneofs[b.name]=b).onAdd(this),O(this)):i.prototype.add.call(this,b)},g.prototype.remove=function(b){if(b instanceof h&&b.extend===w){if(this.fields&&this.fields[b.name]===b)return delete this.fields[b.name],b.parent=null,b.onRemove(this),O(this);throw Error(b+" is not a member of "+this)}if(b instanceof p){if(this.oneofs&&this.oneofs[b.name]===b)return delete this.oneofs[b.name],b.parent=null,b.onRemove(this),O(this);throw Error(b+" is not a member of "+this)}return i.prototype.remove.call(this,b)},g.prototype.isReservedId=function(b){return i.isReservedId(this.reserved,b)},g.prototype.isReservedName=function(b){return i.isReservedName(this.reserved,b)},g.prototype.create=function(b){return new this.ctor(b)},g.prototype.setup=function(){for(var j=this.fullName,b=[],k=0;k<this.fieldsArray.length;++k)b.push(this.i[k].resolve().resolvedType);this.encode=f(this)({Writer:d,types:b,util:y}),this.decode=_(this)({Reader:n,types:b,util:y}),this.verify=m(this)({types:b,util:y}),this.fromObject=v.fromObject(this)({types:b,util:y}),this.toObject=v.toObject(this)({types:b,util:y});var N,j=A[j];return j&&((N=Object.create(this)).fromObject=this.fromObject,this.fromObject=j.fromObject.bind(N),N.toObject=this.toObject,this.toObject=j.toObject.bind(N)),this},g.prototype.encode=function(b,k){return this.setup().encode(b,k)},g.prototype.encodeDelimited=function(b,k){return this.encode(b,k&&k.len?k.fork():k).ldelim()},g.prototype.decode=function(b,k,N,j){return this.setup().decode(b,k,N,j)},g.prototype.decodeDelimited=function(b){return b instanceof n||(b=n.create(b)),this.decode(b,b.uint32())},g.prototype.verify=function(b,k){return this.setup().verify(b,k)},g.prototype.fromObject=function(b,k){return this.setup().fromObject(b,k)},g.prototype.toObject=function(b,k){return this.setup().toObject(b,k)},g.d=function(b){return function(k){y.decorateType(k,b)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,37:37,38:38,39:39}],32:[function(i,a,u){var i=i(33),c=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function p(h,s){var o=0,l=Object.create(null);for(s|=0;o<h.length;)l[c[o+s]]=h[o++];return l}u.basic=p([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),u.defaults=p([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),u.long=p([0,0,0,1,1],7),u.mapKey=p([0,0,0,5,5,0,0,0,1,1,0,2],2),u.packed=p([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(t,a,u){var i,c,p=a.exports=t(35),h=t(27),s=(p.codegen=t(3),p.fetch=t(5),p.path=t(8),p.patterns=t(36),p.patterns.reservedRe),o=p.patterns.unsafePropertyRe,l=(p.fs=p.inquire("fs"),p.toArray=function(d){if(d){for(var y=Object.keys(d),f=Array(y.length),_=0;_<y.length;)f[_]=d[y[_++]];return f}return[]},p.toObject=function(d){for(var y={},f=0;f<d.length;){var _=d[f++],m=d[f++];m!==w&&(y[_]=m)}return y},p.isReserved=function(d){return s.test(d)},p.safeProp=function(d){return!/^[$\w_]+$/.test(d)||s.test(d)?"["+JSON.stringify(d)+"]":"."+d},p.ucFirst=function(d){return(d[0]||"").toUpperCase()+d.substring(1)},/_([a-z])/g),n=(p.camelCase=function(d){return d.substring(0,1)+d.substring(1).replace(l,function(y,f){return f.toUpperCase()})},p.compareFieldsById=function(d,y){return d.id-y.id},p.decorateType=function(d,y){return d.$type?(y&&d.$type.name!==y&&(p.decorateRoot.remove(d.$type),d.$type.name=y,p.decorateRoot.add(d.$type)),d.$type):(y=new(i=i||t(31))(y||d.name),p.decorateRoot.add(y),y.ctor=d,Object.defineProperty(d,"$type",{value:y,enumerable:!1}),Object.defineProperty(d.prototype,"$type",{value:y,enumerable:!1}),y)},0);p.decorateEnum=function(d){var y;return d.$type||(y=new(c=c||t(14))("Enum"+n++,d),p.decorateRoot.add(y),Object.defineProperty(d,"$type",{value:y,enumerable:!1}),y)},p.setProperty=function(d,y,f,_){if(typeof d!="object")throw TypeError("dst must be an object");if(y)return(function m(v,A,g){var O=A.shift();if(!o.test(O))if(0<A.length)v[O]=m(v[O]||{},A,g);else{if((A=v[O])&&_)return v;A&&(g=[].concat(A).concat(g)),v[O]=g}return v})(d,y=y.split("."),f);throw TypeError("path must be specified")},Object.defineProperty(p,"decorateRoot",{get:function(){return h.decorated||(h.decorated=new(t(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,36:36,5:5,8:8}],34:[function(t,a,u){a.exports=c;var i=t(35);function c(s,o){this.lo=s>>>0,this.hi=o>>>0}var p=c.zero=new c(0,0),h=(p.toNumber=function(){return 0},p.zzEncode=p.zzDecode=function(){return this},p.length=function(){return 1},c.zeroHash="\0\0\0\0\0\0\0\0",c.fromNumber=function(s){var o,l;return s===0?p:(l=(s=(o=s<0)?-s:s)>>>0,s=(s-l)/4294967296>>>0,o&&(s=~s>>>0,l=~l>>>0,4294967295<++l&&(l=0,4294967295<++s&&(s=0))),new c(l,s))},c.from=function(s){if(typeof s=="number")return c.fromNumber(s);if(i.isString(s)){if(!i.Long)return c.fromNumber(parseInt(s,10));s=i.Long.fromString(s)}return s.low||s.high?new c(s.low>>>0,s.high>>>0):p},c.prototype.toNumber=function(s){var o;return!s&&this.hi>>>31?(s=1+~this.lo>>>0,o=~this.hi>>>0,-(s+4294967296*(o=s?o:o+1>>>0))):this.lo+4294967296*this.hi},c.prototype.toLong=function(s){return i.Long?new i.Long(0|this.lo,0|this.hi,!!s):{low:0|this.lo,high:0|this.hi,unsigned:!!s}},String.prototype.charCodeAt);c.fromHash=function(s){return s==="\0\0\0\0\0\0\0\0"?p:new c((h.call(s,0)|h.call(s,1)<<8|h.call(s,2)<<16|h.call(s,3)<<24)>>>0,(h.call(s,4)|h.call(s,5)<<8|h.call(s,6)<<16|h.call(s,7)<<24)>>>0)},c.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)},c.prototype.zzEncode=function(){var s=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^s)>>>0,this.lo=(this.lo<<1^s)>>>0,this},c.prototype.zzDecode=function(){var s=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^s)>>>0,this.hi=(this.hi>>>1^s)>>>0,this},c.prototype.length=function(){var s=this.lo,o=(this.lo>>>28|this.hi<<4)>>>0,l=this.hi>>>24;return l==0?o==0?s<16384?s<128?1:2:s<2097152?3:4:o<16384?o<128?5:6:o<2097152?7:8:l<128?9:10}},{35:35}],35:[function(t,a,u){var i=u;function c(h,s,o){for(var l=Object.keys(s),n=0;n<l.length;++n)h[l[n]]!==w&&o||l[n]!=="__proto__"&&(h[l[n]]=s[l[n]]);return h}function p(h){function s(o,l){if(!(this instanceof s))return new s(o,l);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:Error().stack||""}),l&&c(this,l)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return h},set:w,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),s}i.asPromise=t(1),i.base64=t(2),i.EventEmitter=t(4),i.float=t(6),i.inquire=t(7),i.utf8=t(10),i.pool=t(9),i.LongBits=t(34),i.isNode=!!(typeof global!="undefined"&&global&&global.process&&global.process.versions&&global.process.versions.node),i.global=i.isNode&&global||typeof window!="undefined"&&window||typeof self!="undefined"&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(h){return typeof h=="number"&&isFinite(h)&&Math.floor(h)===h},i.isString=function(h){return typeof h=="string"||h instanceof String},i.isObject=function(h){return h&&typeof h=="object"},i.isset=i.isSet=function(h,s){var o=h[s];return o!=null&&h.hasOwnProperty(s)&&(typeof o!="object"||0<(Array.isArray(o)?o:Object.keys(o)).length)},i.Buffer=null,i.S=null,i.L=null,i.newBuffer=function(h){return typeof h=="number"?i.Buffer?i.L(h):new i.Array(h):i.Buffer?i.S(h):typeof Uint8Array=="undefined"?h:new Uint8Array(h)},i.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(h){return h?i.LongBits.from(h).toHash():i.LongBits.zeroHash},i.longFromHash=function(h,s){return h=i.LongBits.fromHash(h),i.Long?i.Long.fromBits(h.lo,h.hi,s):h.toNumber(!!s)},i.merge=c,i.recursionLimit=100,i.makeProp=function(h,s){Object.defineProperty(h,s,{enumerable:!0,configurable:!0,writable:!0})},i.lcFirst=function(h){return(h[0]||"").toLowerCase()+h.substring(1)},i.newError=p,i.ProtocolError=p("ProtocolError"),i.oneOfGetter=function(h){for(var s={},o=0;o<h.length;++o)s[h[o]]=1;return function(){for(var l=Object.keys(this),n=l.length-1;-1<n;--n)if(s[l[n]]===1&&this[l[n]]!==w&&this[l[n]]!==null)return l[n]}},i.oneOfSetter=function(h){return function(s){for(var o=0;o<h.length;++o)h[o]!==s&&delete this[h[o]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i.c=function(){var h=i.Buffer;h?(i.S=h.from!==Uint8Array.from&&h.from||function(s,o){return new h(s,o)},i.L=h.allocUnsafe||function(s){return new h(s)}):i.S=i.L=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(t,a,u){u.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,u.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,u.reservedRe=/^(?: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)$/,u.unsafePropertyRe=/^(?:__proto__|prototype|constructor)$/},{}],37:[function(t,a,u){a.exports=function(s){var o=c.codegen(["m","n"],s.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected")("if(n===undefined)n=0")("if(n>util.recursionLimit)")("return%j","maximum nesting depth exceeded"),l=s.oneofsArray,n={};l.length&&o("var p={}");for(var d=0;d<s.fieldsArray.length;++d){var y,f=s.i[d].resolve(),_="m"+c.safeProp(f.name);f.optional&&o("if(%s!=null&&m.hasOwnProperty(%j)){",_,f.name),f.map?(o("if(!util.isObject(%s))",_)("return%j",p(f,"object"))("var k=Object.keys(%s)",_)("for(var i=0;i<k.length;++i){"),(function(m,v,A){switch(v.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":m("if(!util.key32Re.test(%s))",A)("return%j",p(v,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":m("if(!util.key64Re.test(%s))",A)("return%j",p(v,"integer|Long key"));break;case"bool":m("if(!util.key2Re.test(%s))",A)("return%j",p(v,"boolean key"))}})(o,f,"k[i]"),h(o,f,d,_+"[k[i]]")("}")):f.repeated?(o("if(!Array.isArray(%s))",_)("return%j",p(f,"array"))("for(var i=0;i<%s.length;++i){",_),h(o,f,d,_+"[i]")("}")):(f.partOf&&(y=c.safeProp(f.partOf.name),n[f.partOf.name]===1&&o("if(p%s===1)",y)("return%j",f.partOf.name+": multiple values"),n[f.partOf.name]=1,o("p%s=1",y)),h(o,f,d,_)),f.optional&&o("}")}return o("return null")};var i=t(14),c=t(33);function p(s,o){return s.name+": "+o+(s.repeated&&o!=="array"?"[]":s.map&&o!=="object"?"{k:"+s.keyType+"}":"")+" expected"}function h(s,o,l,n){if(o.resolvedType)if(o.resolvedType instanceof i){s("switch(%s){",n)("default:")("return%j",p(o,"enum value"));for(var d=Object.keys(o.resolvedType.values),y=0;y<d.length;++y)s("case %i:",o.resolvedType.values[d[y]]);s("break")("}")}else s("{")("var e=types[%i].verify(%s,n+1);",l,n)("if(e)")("return%j+e",o.name+".")("}");else switch(o.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":s("if(!util.isInteger(%s))",n)("return%j",p(o,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":s("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",p(o,"integer|Long"));break;case"float":case"double":s('if(typeof %s!=="number")',n)("return%j",p(o,"number"));break;case"bool":s('if(typeof %s!=="boolean")',n)("return%j",p(o,"boolean"));break;case"string":s("if(!util.isString(%s))",n)("return%j",p(o,"string"));break;case"bytes":s('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",p(o,"buffer"))}return s}},{14:14,33:33}],38:[function(t,a,u){var i=t(19);u[".google.protobuf.Any"]={fromObject:function(c,p){if(c&&c["@type"]){var h,s=c["@type"].substring(1+c["@type"].lastIndexOf("/")),s=this.lookup(s);if(s)return~(h=(c["@type"][0]||"")=="."?c["@type"].slice(1):c["@type"]).indexOf("/")||(h="/"+h),this.create({type_url:h,value:s.encode(s.fromObject(c,p===w?1:p+1)).finish()})}return this.fromObject(c,p)},toObject:function(c,p){var h,s,o="",l="";return p&&p.json&&c.type_url&&c.value&&(l=c.type_url.substring(1+c.type_url.lastIndexOf("/")),o=c.type_url.substring(0,1+c.type_url.lastIndexOf("/")),(h=this.lookup(l))&&(c=h.decode(c.value))),!(c instanceof this.ctor)&&c instanceof i?(h=c.$type.toObject(c,p),s=c.$type.fullName[0]==="."?c.$type.fullName.slice(1):c.$type.fullName,h["@type"]=l=(o=o===""?"type.googleapis.com/":o)+s,h):this.toObject(c,p)}}},{19:19}],39:[function(t,a,u){a.exports=d;var i,c=t(35),p=c.LongBits,h=c.base64,s=c.utf8;function o(g,O,b){this.fn=g,this.len=O,this.next=w,this.val=b}function l(){}function n(g){this.head=g.head,this.tail=g.tail,this.len=g.len,this.next=g.states}function d(){this.len=0,this.head=new o(l,0,0),this.tail=this.head,this.states=null}function y(){return c.Buffer?function(){return(d.create=function(){return new i})()}:function(){return new d}}function f(g,O,b){O[b]=255&g}function _(g,O){this.len=g,this.next=w,this.val=O}function m(g,O,b){for(;g.hi;)O[b++]=127&g.lo|128,g.lo=(g.lo>>>7|g.hi<<25)>>>0,g.hi>>>=7;for(;127<g.lo;)O[b++]=127&g.lo|128,g.lo=g.lo>>>7;O[b++]=g.lo}function v(g,O,b){O[b]=255&g,O[b+1]=g>>>8&255,O[b+2]=g>>>16&255,O[b+3]=g>>>24}d.create=y(),d.alloc=function(g){return new c.Array(g)},c.Array!==Array&&(d.alloc=c.pool(d.alloc,c.Array.prototype.subarray)),d.prototype.N=function(g,O,b){return this.tail=this.tail.next=new o(g,O,b),this.len+=O,this},(_.prototype=Object.create(o.prototype)).fn=function(g,O,b){for(;127<g;)O[b++]=127&g|128,g>>>=7;O[b]=g},d.prototype.uint32=function(g){return this.len+=(this.tail=this.tail.next=new _((g>>>=0)<128?1:g<16384?2:g<2097152?3:g<268435456?4:5,g)).len,this},d.prototype.int32=function(g){return g<0?this.N(m,10,p.fromNumber(g)):this.uint32(g)},d.prototype.sint32=function(g){return this.uint32((g<<1^g>>31)>>>0)},d.prototype.int64=d.prototype.uint64=function(g){return g=p.from(g),this.N(m,g.length(),g)},d.prototype.sint64=function(g){return g=p.from(g).zzEncode(),this.N(m,g.length(),g)},d.prototype.bool=function(g){return this.N(f,1,g?1:0)},d.prototype.sfixed32=d.prototype.fixed32=function(g){return this.N(v,4,g>>>0)},d.prototype.sfixed64=d.prototype.fixed64=function(g){return g=p.from(g),this.N(v,4,g.lo).N(v,4,g.hi)},d.prototype.float=function(g){return this.N(c.float.writeFloatLE,4,g)},d.prototype.double=function(g){return this.N(c.float.writeDoubleLE,8,g)};var A=c.Array.prototype.set?function(g,O,b){O.set(g,b)}:function(g,O,b){for(var k=0;k<g.length;++k)O[b+k]=g[k]};d.prototype.bytes=function(g){var O,b=g.length>>>0;return b?(c.isString(g)&&(O=d.alloc(b=h.length(g)),h.decode(g,O,0),g=O),this.uint32(b).N(A,b,g)):this.N(f,1,0)},d.prototype.string=function(g){var O=s.length(g);return O?this.uint32(O).N(s.write,O,g):this.N(f,1,0)},d.prototype.fork=function(){return this.states=new n(this),this.head=this.tail=new o(l,0,0),this.len=0,this},d.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new o(l,0,0),this.len=0),this},d.prototype.ldelim=function(){var g=this.head,O=this.tail,b=this.len;return this.reset().uint32(b),b&&(this.tail.next=g.next,this.tail=O,this.len+=b),this},d.prototype.finish=function(){for(var g=this.head.next,O=this.constructor.alloc(this.len),b=0;g;)g.fn(g.val,O,b),b+=g.len,g=g.next;return O},d.c=function(g){i=g,d.create=y(),i.c()}},{35:35}],40:[function(t,a,u){a.exports=p;var i=t(39),c=((p.prototype=Object.create(i.prototype)).constructor=p,t(35));function p(){i.call(this)}function h(s,o,l){s.length<40?c.utf8.write(s,o,l):o.utf8Write?o.utf8Write(s,l):o.write(s,l)}p.c=function(){p.alloc=c.L,p.writeBytesBuffer=c.Buffer&&c.Buffer.prototype instanceof Uint8Array&&c.Buffer.prototype.set.name==="set"?function(s,o,l){o.set(s,l)}:function(s,o,l){if(s.copy)s.copy(o,l,0,s.length);else for(var n=0;n<s.length;)o[l++]=s[n++]}},p.prototype.bytes=function(s){var o=(s=c.isString(s)?c.S(s,"base64"):s).length>>>0;return this.uint32(o),o&&this.N(p.writeBytesBuffer,o,s),this},p.prototype.string=function(s){var o=c.Buffer.byteLength(s);return this.uint32(o),o&&this.N(h,o,s),this},p.c()},{35:35,39:39}]},r={},Ae=(function t(a){var u=r[a];return u||e[a][0].call(u=r[a]={exports:{}},t,u,u.exports),u.exports})([16][0])})();class pr{constructor(){this._typeStore=new Map}getSchemaType(e){E.requireArgument(e,"schema");const r=D.getSchemaId(e);let t=this._typeStore.get(r);return t||(t=Ae.Root.fromJSON(e.pbjsSchema).lookupType(r),this._typeStore.set(r,t)),t}validate(e,r){E.requireArgument(e,"schema"),E.requireArgument(r,"data");const t=this.getSchemaType(e),a=t.verify(r);if(a)throw new Error(`Data is invalid for ${t.fullName}: ${a}`);return t}encode(e,r){const t=this.validate(e,r),a=t.fromObject(r);return t.encode(a).finish()}encodePayload(e){if(e!=null&&e.schema&&e.payload)return{schemaName:D.getSchemaId(e.schema),payload:this.encode(e.schema,e.payload)}}getLogMessage(e,r,t){return{timestamp:t.timestamp,data:this.encode(e,r),age:t.age,rootId:t.rootId,seq:t.sequence,sseq:t.schemaSequence,loggerName:t.loggerName,pagePayload:this.encodePayload(t.pagePayload),loggerAppName:t.loggerAppName,connectionType:t.connectionType,appPayload:this.encodePayload(t.appPayload),csId:t.clientSessionId,recCsId:t.receiverClientSessionId,recRootId:t.receiverRootId,tenantClass:t.tenantClass}}processRawLogMessage(e,r){const t=r.data?Object.assign({},r.data):{};return D.isInternal(e)&&t.userPayload&&(t.userPayload=this.encodePayload(t.userPayload)),Object.assign({},r,{data:this.encode(e,t),pagePayload:this.encodePayload(r.pagePayload),appPayload:this.encodePayload(r.appPayload)})}}const Ye=new pr,Qe=Ae.Root.fromJSON(he.pbjsSchema).lookupType("CoreEnvelope");function Ze(w){return ee.buildFrom(w)}function et(w){const e=Qe.verify(w);if(e)throw new Error(`Invalid CoreEnvelope: ${e}`);return Qe.encode(w).finish()}var X;(function(w){w[w.fetchBinary=0]="fetchBinary",w[w.fetchFile=1]="fetchFile",w[w.noUpload=2]="noUpload"})(X||(X={}));const tt="telemetry",fr=1e4,rt=1e4,mr=10,yr=10,it=X.fetchBinary;class gr{constructor(e,r,t,a){this._messagesLimit=mr,this._metricsLimit=yr,this._formDataKey=tt,this._uploadInterval=rt,this._messageSize=0,this.uploadEndpoint=e,this.uploadMode=r==null?it:r,t&&(this._staticAttributes={appName:t.appName,appVersion:t.appVersion,appExperience:t.appExperience,deviceId:t.deviceId,deviceModel:t.deviceModel,sdkVersion:t.sdkVersion});let u=fr;if(a){const i=a.maxUniqueSchemas;if(i!==void 0){if(typeof i!="number"||!(i>0))throw new Error("options.maxUniqueSchemas, if defined, must be > 0");u=i}const c=a.messagesLimit;if(c!==void 0){if(typeof c!="number"||!(c>0))throw new Error("options.messagesLimit, if defined, must be > 0");this._messagesLimit=c}const p=a.metricsLimit;if(p!==void 0){if(typeof p!="number"||!(p>0))throw new Error("options.metricsLimit, if defined, must be > 0");this._metricsLimit=p}E.requireArgumentIfDefined(a.formDataKeyName,"options.formDataKeyName","string")&&(this._formDataKey=a.formDataKeyName),E.requireArgumentIfDefined(a.uploadFailedListener,"options.uploadFailedListener","function")&&(this._uploadFailedListener=a.uploadFailedListener),E.requireArgumentIfDefined(a.apiKey,"options.apiKey","string")&&(this._apiKey=a.apiKey)}this._messageBuffers=new ut(u),this._emptySize=this.getByteSize(1),this._restartTimer()}get uploadInterval(){return this._uploadInterval}set uploadInterval(e){if(e===void 0&&(e=rt),typeof e!="number"||!(e>0))throw new Error("uploadInterval, if defined, must be > 0");e!==this._uploadInterval&&(this._uploadInterval=e,this._restartTimer())}get uploadEndpoint(){return this._uploadEndpoint}set uploadEndpoint(e){E.requireArgumentIfDefined(e,"uploadEndpoint","string"),this._uploadEndpoint=e}get uploadOptionsCallback(){return this._uploadOptionsCallback}set uploadOptionsCallback(e){E.requireArgumentIfDefined(e,"uploadOptionsCallback","function"),this._uploadOptionsCallback=e}get uploadMode(){return this._uploadMode}set uploadMode(e){if(E.requireArgumentIfDefined(e,"uploadMode","number"),e===void 0&&(e=it),!(e in X))throw new Error(`Unsupported upload mode: ${e}`);this._uploadMode=e}getByteSize(e){return e>=1?this._buildProtoEncodedCoreEnvelope(!1).byteLength:e>=.5?this._emptySize+this._messageSize+this.metricsCount*8:this._emptySize+this._messageSize}_stopTimer(){this._intervalHandle!==void 0&&(clearInterval(this._intervalHandle),this._intervalHandle=void 0)}_restartTimer(){this._stopTimer(),this._intervalHandle=setInterval(()=>{this.hasData&&this._upload()},this._uploadInterval)}collect(e,r,t){return G(this,null,function*(){D.isInternal(e)&&r.userPayload&&(r.userPayload=Ye.encodePayload(r.userPayload));const a=Ye.getLogMessage(e,r,t);if(!this._messageBuffers.push(e,a))throw new Error(`Buffer is full. Refusing schemaId ${D.getSchemaId(e)}`);if(this._messageSize+=E.estimateObjectSize(a),this._shouldUpload())return this._upload()})}_shouldUpload(){return this._immediateUpload&&this.hasData||this.messagesCount>=this._messagesLimit||this.metricsCount>=this._metricsLimit}_upload(e){return G(this,null,function*(){if(this._restartTimer(),!this._uploadEndpoint||this._uploadMode===X.noUpload)return;const r=this._getContentsOfCoreEnvelope(!0);return this._uploadContents(r,e)})}_uploadContents(e,r){return G(this,null,function*(){let t=this._getRequestInit(e);const a={envelopeContents:e};try{if(this._apiKey&&(t.headers["x-o11y-api-key"]=this._apiKey),this._uploadOptionsCallback){const u=this._uploadOptionsCallback()||{};if(u){if(u.headers&&t.headers)if(u.headers instanceof Headers)for(const i in t.headers)Object.prototype.hasOwnProperty.call(t.headers,i)&&u.headers.set(i,t.headers[i]);else{if(Array.isArray(u.headers))throw new Error("Headers as array is not supported.");Object.assign(u.headers,t.headers)}u.method=t.method,u.body=t.body,t=u}}if(a.response=yield fetch(this._uploadEndpoint,t),!a.response.ok)throw new Error("HTTP Not OK");return a}catch(u){if(a.error=u,!r&&this._uploadFailedListener)try{this._uploadFailedListener(a)}catch(i){}throw a}})}_getRequestInit(e){const r=Ze(e),t=et(r);let a;switch(this._uploadMode){case X.fetchBinary:a={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t};break;case void 0:case X.fetchFile:if(typeof FormData!="function")throw new Error("FormData is not a function in the global namespace.");const u=new FormData;u.append(this._formDataKey||tt,new Blob([t])),a={method:"POST",body:u};break;case X.noUpload:default:throw new Error("Invalid uploadMode")}return a}_checkUploadState(){if(this._uploadEndpoint===void 0)throw new Error("Upload endpoint is unset");if(this._uploadMode===X.noUpload)throw new Error("Upload mode is unset")}upload(e){return G(this,null,function*(){return this._checkUploadState(),E.requireArgumentIfDefined(e,"contents","object")?this._uploadContents(e,!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 e=0;return this._metricsExtractors&&(e+=this._metricsExtractors.getAllUpCounters().length||0,e+=this._metricsExtractors.getAllValueRecorders().length||0,e+=this._metricsExtractors.getAllBucketHistograms().length||0),e}getProtoEncodedCoreEnvelope(){return this._buildProtoEncodedCoreEnvelope(!0)}getContentsOfCoreEnvelope(){return this._getContentsOfCoreEnvelope(!0)}_getContentsOfCoreEnvelope(e){const r={staticAttributes:this._staticAttributes,messages:this._messageBuffers.getAllMessages(e)};return this._metricsExtractors&&(r.upCounters=ee.getUpCounters(this._metricsExtractors.getAllUpCounters(),e),r.valueRecorders=ee.getValueRecorders(this._metricsExtractors.getAllValueRecorders(),e),r.bucketHistograms=ee.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms(),e)),e&&(this._messageSize=0),r}_buildProtoEncodedCoreEnvelope(e){const r=this._getContentsOfCoreEnvelope(e),t=Ze(r);return et(t)}receiveMetricsExtractors(e){this._metricsExtractors=e}}const vr={namespace:"sf.embeddedMessaging",name:"FailureEvent",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{FailureEvent:{oneofs:{_participantType:{oneof:["participantType"]},_convEntryId:{oneof:["convEntryId"]}},fields:{convId:{id:4,type:"string"},method:{id:2,type:"string"},clientName:{id:10,type:"string"},errCode:{id:5,type:"uint32"},jwtClaims:{id:8,type:"string"},participantType:{options:{proto3_optional:!0},id:11,type:"string"},hostUrl:{id:9,type:"string"},convType:{id:7,type:"string"},errMessage:{id:3,type:"string"},configDev:{id:1,type:"string"},convEntryId:{options:{proto3_optional:!0},id:6,type:"string"}}}}}}}}}},_r={namespace:"sf.embeddedMessaging",name:"InteractionEvent",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{InteractionEvent:{oneofs:{_participantType:{oneof:["participantType"]}},fields:{convId:{id:5,type:"string"},op:{id:4,type:"string"},method:{id:2,type:"string"},feature:{id:3,type:"string"},fileSize:{id:6,type:"uint32"},clientName:{id:11,type:"string"},jwtClaims:{id:9,type:"string"},participantType:{options:{proto3_optional:!0},id:12,type:"string"},fileMimeType:{id:7,type:"string"},hostUrl:{id:10,type:"string"},convType:{id:8,type:"string"},configDev:{id:1,type:"string"}}}}}}}}}},br={namespace:"sf.embeddedMessaging",name:"CurrentState",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{CurrentState:{oneofs:{_participantType:{oneof:["participantType"]},_convEntryId:{oneof:["convEntryId"]}},fields:{convId:{id:4,type:"string"},method:{id:2,type:"string"},clientName:{id:9,type:"string"},jwtClaims:{id:7,type:"string"},stateMessage:{id:3,type:"string"},participantType:{options:{proto3_optional:!0},id:10,type:"string"},hostUrl:{id:8,type:"string"},convType:{id:6,type:"string"},configDev:{id:1,type:"string"},convEntryId:{options:{proto3_optional:!0},id:5,type:"string"}}}}}}}}}};M.CoreCollector=gr,M.currentStateSchema=br,M.failureEventSchema=vr,M.interactionEventSchema=_r,M.registerInstrumentedApp=dr,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
4
+ }`}return a.toString=d,a}c.verbose=!1},{}],4:[function(t,n,l){function i(){this.t={}}(n.exports=i).prototype.on=function(c,p,h){return(this.t[c]||(this.t[c]=[])).push({fn:p,ctx:h||this}),this},i.prototype.off=function(c,p){if(c===u)this.t={};else if(p===u)this.t[c]=[];else for(var h=this.t[c],s=0;s<h.length;)h[s].fn===p?h.splice(s,1):++s;return this},i.prototype.emit=function(c){var p=this.t[c];if(p){for(var h=[],s=1;s<arguments.length;)h.push(arguments[s++]);for(s=0;s<p.length;)p[s].fn.apply(p[s++].ctx,h)}return this}},{}],5:[function(t,n,l){n.exports=p;var i=t(1),c=t(7)("fs");function p(h,s,a){return s=typeof s=="function"?(a=s,{}):s||{},a?!s.xhr&&c&&c.readFile?c.readFile(h,function(d,o){return d&&typeof XMLHttpRequest!="undefined"?p.xhr(h,s,a):d?a(d):a(null,s.binary?o:o.toString("utf8"))}):p.xhr(h,s,a):i(p,this,h,s)}p.xhr=function(h,s,a){var d=new XMLHttpRequest;d.onreadystatechange=function(){if(d.readyState!==4)return u;if(d.status!==0&&d.status!==200)return a(Error("status "+d.status));if(s.binary){if(!(o=d.response))for(var o=[],f=0;f<d.responseText.length;++f)o.push(255&d.responseText.charCodeAt(f));return a(null,typeof Uint8Array!="undefined"?new Uint8Array(o):o)}return a(null,d.responseText)},s.binary&&("overrideMimeType"in d&&d.overrideMimeType("text/plain; charset=x-user-defined"),d.responseType="arraybuffer"),d.open("GET",h),d.send()}},{1:1,7:7}],6:[function(t,n,l){function i(a){function d(T,S,I,N){var R=S<0?1:0;T((S=R?-S:S)===0?0<1/S?0:2147483648:isNaN(S)?2143289344:34028234663852886e22<S?(R<<31|2139095040)>>>0:S<11754943508222875e-54?(R<<31|Math.round(S/1401298464324817e-60))>>>0:(R<<31|127+(T=Math.floor(Math.log(S)/Math.LN2))<<23|8388607&Math.round(S*Math.pow(2,-T)*8388608))>>>0,I,N)}function o(T,S,I){return T=T(S,I),S=2*(T>>31)+1,I=T>>>23&255,T&=8388607,I==255?T?NaN:1/0*S:I==0?1401298464324817e-60*S*T:S*Math.pow(2,I-150)*(8388608+T)}function f(T,S,I){y[0]=T,S[I]=b[0],S[I+1]=b[1],S[I+2]=b[2],S[I+3]=b[3]}function g(T,S,I){y[0]=T,S[I]=b[3],S[I+1]=b[2],S[I+2]=b[1],S[I+3]=b[0]}function m(T,S){return b[0]=T[S],b[1]=T[S+1],b[2]=T[S+2],b[3]=T[S+3],y[0]}function _(T,S){return b[3]=T[S],b[2]=T[S+1],b[1]=T[S+2],b[0]=T[S+3],y[0]}var y,b,k,v,O;function w(T,S,I,N,R,D){var V,fe=N<0?1:0;(N=fe?-N:N)===0?(T(0,R,D+S),T(0<1/N?0:2147483648,R,D+I)):isNaN(N)?(T(0,R,D+S),T(2146959360,R,D+I)):17976931348623157e292<N?(T(0,R,D+S),T((fe<<31|2146435072)>>>0,R,D+I)):N<22250738585072014e-324?(T((V=N/5e-324)>>>0,R,D+S),T((fe<<31|V/4294967296)>>>0,R,D+I)):(T(4503599627370496*(V=N*Math.pow(2,-(N=(N=Math.floor(Math.log(N)/Math.LN2))===1024?1023:N)))>>>0,R,D+S),T((fe<<31|N+1023<<20|1048576*V&1048575)>>>0,R,D+I))}function A(T,S,I,N,R){return S=T(N,R+S),T=T(N,R+I),N=2*(T>>31)+1,R=T>>>20&2047,I=4294967296*(1048575&T)+S,R==2047?I?NaN:1/0*N:R==0?5e-324*N*I:N*Math.pow(2,R-1075)*(I+4503599627370496)}function x(T,S,I){k[0]=T,S[I]=v[0],S[I+1]=v[1],S[I+2]=v[2],S[I+3]=v[3],S[I+4]=v[4],S[I+5]=v[5],S[I+6]=v[6],S[I+7]=v[7]}function j(T,S,I){k[0]=T,S[I]=v[7],S[I+1]=v[6],S[I+2]=v[5],S[I+3]=v[4],S[I+4]=v[3],S[I+5]=v[2],S[I+6]=v[1],S[I+7]=v[0]}function q(T,S){return v[0]=T[S],v[1]=T[S+1],v[2]=T[S+2],v[3]=T[S+3],v[4]=T[S+4],v[5]=T[S+5],v[6]=T[S+6],v[7]=T[S+7],k[0]}function z(T,S){return v[7]=T[S],v[6]=T[S+1],v[5]=T[S+2],v[4]=T[S+3],v[3]=T[S+4],v[2]=T[S+5],v[1]=T[S+6],v[0]=T[S+7],k[0]}return typeof Float32Array!="undefined"?(y=new Float32Array([-0]),b=new Uint8Array(y.buffer),O=b[3]===128,a.writeFloatLE=O?f:g,a.writeFloatBE=O?g:f,a.readFloatLE=O?m:_,a.readFloatBE=O?_:m):(a.writeFloatLE=d.bind(null,c),a.writeFloatBE=d.bind(null,p),a.readFloatLE=o.bind(null,h),a.readFloatBE=o.bind(null,s)),typeof Float64Array!="undefined"?(k=new Float64Array([-0]),v=new Uint8Array(k.buffer),O=v[7]===128,a.writeDoubleLE=O?x:j,a.writeDoubleBE=O?j:x,a.readDoubleLE=O?q:z,a.readDoubleBE=O?z:q):(a.writeDoubleLE=w.bind(null,c,0,4),a.writeDoubleBE=w.bind(null,p,4,0),a.readDoubleLE=A.bind(null,h,0,4),a.readDoubleBE=A.bind(null,s,4,0)),a}function c(a,d,o){d[o]=255&a,d[o+1]=a>>>8&255,d[o+2]=a>>>16&255,d[o+3]=a>>>24}function p(a,d,o){d[o]=a>>>24,d[o+1]=a>>>16&255,d[o+2]=a>>>8&255,d[o+3]=255&a}function h(a,d){return(a[d]|a[d+1]<<8|a[d+2]<<16|a[d+3]<<24)>>>0}function s(a,d){return(a[d]<<24|a[d+1]<<16|a[d+2]<<8|a[d+3])>>>0}n.exports=i(i)},{}],7:[function(t,n,l){n.exports=function(i){try{var c;return typeof t!="function"?null:(c=t(i))&&(c.length||Object.keys(c).length)?c:null}catch(p){return null}}},{}],8:[function(t,n,l){var i=l.isAbsolute=function(p){return/^(?:\/|\w+:)/.test(p)},c=l.normalize=function(a){var h=(a=a.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),s=i(a),a="";s&&(a=h.shift()+"/");for(var d=0;d<h.length;)h[d]===".."?0<d&&h[d-1]!==".."?h.splice(--d,2):s?h.splice(d,1):++d:h[d]==="."?h.splice(d,1):++d;return a+h.join("/")};l.resolve=function(p,h,s){return s||(h=c(h)),!i(h)&&(p=(p=s?p:c(p)).replace(/(?:\/|^)[^/]+$/,"")).length?c(p+"/"+h):h}},{}],9:[function(t,n,l){n.exports=function(i,c,p){var h=p||8192,s=h>>>1,a=null,d=h;return function(o){return o<1||s<o?i(o):(h<d+o&&(a=i(h),d=0),o=c.call(a,d,d+=o),7&d&&(d=1+(7|d)),o)}}},{}],10:[function(t,n,l){l.length=function(i){for(var c,p=0,h=0;h<i.length;++h)(c=i.charCodeAt(h))<128?p+=1:c<2048?p+=2:(64512&c)==55296&&(64512&i.charCodeAt(h+1))==56320?(++h,p+=4):p+=3;return p},l.read=function(i,c,p){if(p-c<1)return"";for(var h="",s=c;s<p;){var a,d=i[s++];d<=127?h+=String.fromCharCode(d):192<=d&&d<224?h+=128<=(a=(31&d)<<6|63&i[s++])?String.fromCharCode(a):"�":224<=d&&d<240?h+=2048<=(a=(15&d)<<12|(63&i[s++])<<6|63&i[s++])?String.fromCharCode(a):"�":240<=d&&((d=(7&d)<<18|(63&i[s++])<<12|(63&i[s++])<<6|63&i[s++])<65536||1114111<d?h+="�":h=h+String.fromCharCode(55296+((d-=65536)>>10))+String.fromCharCode(56320+(1023&d)))}return h},l.write=function(i,c,p){for(var h,s,a=p,d=0;d<i.length;++d)(h=i.charCodeAt(d))<128?c[p++]=h:(h<2048?c[p++]=h>>6|192:((64512&h)==55296&&(64512&(s=i.charCodeAt(d+1)))==56320?(++d,c[p++]=(h=65536+((1023&h)<<10)+(1023&s))>>18|240,c[p++]=h>>12&63|128):c[p++]=h>>12|224,c[p++]=h>>6&63|128),c[p++]=63&h|128);return p-a}},{}],11:[function(t,n,l){var i=t(14),c=t(33);function p(s,a,d,o){var f=!1;if(a.resolvedType)if(a.resolvedType instanceof i){s("switch(d%s){",o);for(var g=a.resolvedType.values,m=Object.keys(g),_=0;_<m.length;++_)g[m[_]]!==a.typeDefault||f||(s("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',o,o,o),a.repeated||s("break"),f=!0),s("case%j:",m[_])("case %i:",g[m[_]])("m%s=%j",o,g[m[_]])("break");s("}")}else s('if(typeof d%s!=="object")',o)("throw TypeError(%j)",a.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",o,d,o);else{var y=!1;switch(a.type){case"double":case"float":s("m%s=Number(d%s)",o,o);break;case"uint32":case"fixed32":s("m%s=d%s>>>0",o,o);break;case"int32":case"sint32":case"sfixed32":s("m%s=d%s|0",o,o);break;case"uint64":y=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":s("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",o,o,y)('else if(typeof d%s==="string")',o)("m%s=parseInt(d%s,10)",o,o)('else if(typeof d%s==="number")',o)("m%s=d%s",o,o)('else if(typeof d%s==="object")',o)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",o,o,o,y?"true":"");break;case"bytes":s('if(typeof d%s==="string")',o)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",o,o,o)("else if(d%s.length >= 0)",o)("m%s=d%s",o,o);break;case"string":s("m%s=String(d%s)",o,o);break;case"bool":s("m%s=Boolean(d%s)",o,o)}}return s}function h(s,a,d,o){if(a.resolvedType)a.resolvedType instanceof i?s("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",o,d,o,o,d,o,o):s("d%s=types[%i].toObject(m%s,o)",o,d,o);else{var f=!1;switch(a.type){case"double":case"float":s("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",o,o,o,o);break;case"uint64":f=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":s('if(typeof m%s==="number")',o)("d%s=o.longs===String?String(m%s):m%s",o,o,o)("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",o,o,o,o,f?"true":"",o);break;case"bytes":s("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",o,o,o,o,o);break;default:s("d%s=m%s",o,o)}}return s}l.fromObject=function(s){var a=s.fieldsArray,d=c.codegen(["d","n"],s.name+"$fromObject")("if(d instanceof this.ctor)")("return d")("if(n===undefined)n=0")("if(n>util.recursionLimit)")('throw Error("maximum nesting depth exceeded")');if(!a.length)return d("return new this.ctor");d("var m=new this.ctor");for(var o=0;o<a.length;++o){var f=a[o].resolve(),g=c.safeProp(f.name);f.map?(d("if(d%s){",g)('if(typeof d%s!=="object")',g)("throw TypeError(%j)",f.fullName+": object expected")("m%s={}",g)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",g),d('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",g),p(d,f,o,g+"[ks[i]]")("}")("}")):f.repeated?(d("if(d%s){",g)("if(!Array.isArray(d%s))",g)("throw TypeError(%j)",f.fullName+": array expected")("m%s=[]",g)("for(var i=0;i<d%s.length;++i){",g),p(d,f,o,g+"[i]")("}")("}")):(f.resolvedType instanceof i||d("if(d%s!=null){",g),p(d,f,o,g),f.resolvedType instanceof i||d("}"))}return d("return m")},l.toObject=function(s){var a=s.fieldsArray.slice().sort(c.compareFieldsById);if(!a.length)return c.codegen()("return {}");for(var d=c.codegen(["m","o"],s.name+"$toObject")("if(!o)")("o={}")("var d={}"),o=[],f=[],g=[],m=0;m<a.length;++m)a[m].partOf||(a[m].resolve().repeated?o:a[m].map?f:g).push(a[m]);if(o.length){for(d("if(o.arrays||o.defaults){"),m=0;m<o.length;++m)d("d%s=[]",c.safeProp(o[m].name));d("}")}if(f.length){for(d("if(o.objects||o.defaults){"),m=0;m<f.length;++m)d("d%s={}",c.safeProp(f[m].name));d("}")}if(g.length){for(d("if(o.defaults){"),m=0;m<g.length;++m){var _,y=g[m],b=c.safeProp(y.name);y.resolvedType instanceof i?d("d%s=o.enums===String?%j:%j",b,y.resolvedType.valuesById[y.typeDefault],y.typeDefault):y.long?d("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",b)("}else")("d%s=o.longs===String?%j:%i",b,y.typeDefault.toString(),y.typeDefault.toNumber()):y.bytes?(_=Array.prototype.slice.call(y.typeDefault),d("if(o.bytes===String)d%s=%j",b,String.fromCharCode.apply(String,y.typeDefault))("else{")("d%s=%j",b,_)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",b,b)("}")):d("d%s=%j",b,y.typeDefault)}d("}")}for(var k=!1,m=0;m<a.length;++m){var y=a[m],v=s.i.indexOf(y),b=c.safeProp(y.name);y.map?(k||(k=!0,d("var ks2")),d("if(m%s&&(ks2=Object.keys(m%s)).length){",b,b)("d%s={}",b)("for(var j=0;j<ks2.length;++j){"),d('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",b),h(d,y,v,b+"[ks2[j]]")("}")):y.repeated?(d("if(m%s&&m%s.length){",b,b)("d%s=[]",b)("for(var j=0;j<m%s.length;++j){",b),h(d,y,v,b+"[j]")("}")):(d("if(m%s!=null&&m.hasOwnProperty(%j)){",b,y.name),h(d,y,v,b),y.partOf&&d("if(o.oneofs)")("d%s=%j",c.safeProp(y.partOf.name),y.name)),d("}")}return d("return d")}},{14:14,33:33}],12:[function(t,n,l){n.exports=function(h){for(var s=p.codegen(["r","l","e","n"],h.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("if(n===undefined)n=0")("if(n>Reader.recursionLimit)")('throw Error("maximum nesting depth exceeded")')("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(h.fieldsArray.filter(function(m){return m.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),a=0;a<h.fieldsArray.length;++a){var d=h.i[a].resolve(),o=d.resolvedType instanceof i?"int32":d.type,f="m"+p.safeProp(d.name);s("case %i: {",d.id),d.map?(s("if(%s===util.emptyObject)",f)("%s={}",f)("var c2 = r.uint32()+r.pos"),c.defaults[d.keyType]!==u?s("k=%j",c.defaults[d.keyType]):s("k=null"),c.defaults[o]!==u?s("value=%j",c.defaults[o]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",d.keyType)("case 2:"),c.basic[o]===u?s("value=types[%i].decode(r,r.uint32(),undefined,n+1)",a):s("value=r.%s()",o),s("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}"),c.long[d.keyType]!==u?s('%s[typeof k==="object"?util.longToHash(k):k]=value',f):(d.keyType==="string"&&s('if(k==="__proto__")')("util.makeProp(%s,k)",f),s("%s[k]=value",f))):d.repeated?(s("if(!(%s&&%s.length))",f,f)("%s=[]",f),c.packed[o]!==u&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",f,o)("}else"),c.basic[o]===u?s(d.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4),n+1))":"%s.push(types[%i].decode(r,r.uint32(),undefined,n+1))",f,a):s("%s.push(r.%s())",f,o)):c.basic[o]===u?s(d.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4),n+1)":"%s=types[%i].decode(r,r.uint32(),undefined,n+1)",f,a):s("%s=r.%s()",f,o),s("break")("}")}for(s("default:")("r.skipType(t&7,n)")("break")("}")("}"),a=0;a<h.i.length;++a){var g=h.i[a];g.required&&s("if(!m.hasOwnProperty(%j))",g.name)("throw util.ProtocolError(%j,{instance:m})","missing required '"+g.name+"'")}return s("return m")};var i=t(14),c=t(32),p=t(33)},{14:14,32:32,33:33}],13:[function(t,n,l){n.exports=function(s){for(var a,d=p.codegen(["m","w"],s.name+"$encode")("if(!w)")("w=Writer.create()"),o=s.fieldsArray.slice().sort(p.compareFieldsById),f=0;f<o.length;++f){var g=o[f].resolve(),m=s.i.indexOf(g),_=g.resolvedType instanceof i?"int32":g.type,y=c.basic[_];a="m"+p.safeProp(g.name),g.map?(d("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",a,g.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",a)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(g.id<<3|2)>>>0,8|c.mapKey[g.keyType],g.keyType),y===u?d("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",m,a):d(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|y,_,a),d("}")("}")):g.repeated?(d("if(%s!=null&&%s.length){",a,a),g.packed&&c.packed[_]!==u?d("w.uint32(%i).fork()",(g.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",a)("w.%s(%s[i])",_,a)("w.ldelim()"):(d("for(var i=0;i<%s.length;++i)",a),y===u?h(d,g,m,a+"[i]"):d("w.uint32(%i).%s(%s[i])",(g.id<<3|y)>>>0,_,a)),d("}")):(g.optional&&d("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",a,g.name),y===u?h(d,g,m,a):d("w.uint32(%i).%s(%s)",(g.id<<3|y)>>>0,_,a))}return d("return w")};var i=t(14),c=t(32),p=t(33);function h(s,a,d,o){a.delimited?s("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",d,o,(a.id<<3|3)>>>0,(a.id<<3|4)>>>0):s("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",d,o,(a.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(t,n,l){n.exports=h;var i=t(22),c=(((h.prototype=Object.create(i.prototype)).constructor=h).className="Enum",t(21)),p=t(33);function h(s,a,d,o,f,g){if(i.call(this,s,d),a&&typeof a!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=o,this.comments=f||{},this.valuesOptions=g,this.n={},this.reserved=u,a)for(var m=Object.keys(a),_=0;_<m.length;++_)m[_]!=="__proto__"&&typeof a[m[_]]=="number"&&(this.valuesById[this.values[m[_]]=a[m[_]]]=m[_])}h.prototype.r=function(s){return s=this.e||s,i.prototype.r.call(this,s),Object.keys(this.values).forEach(a=>{var d=Object.assign({},this.o);this.n[a]=Object.assign(d,this.valuesOptions&&this.valuesOptions[a]&&this.valuesOptions[a].features)}),this},h.fromJSON=function(s,a){return s=new h(s,a.values,a.options,a.comment,a.comments),s.reserved=a.reserved,a.edition&&(s.e=a.edition),s.u="proto3",s},h.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,p.toObject(["edition",this.h(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:u,"comment",s?this.comment:u,"comments",s?this.comments:u])},h.prototype.add=function(s,a,d,o){if(!p.isString(s))throw TypeError("name must be a string");if(!p.isInteger(a))throw TypeError("id must be an integer");if(s!=="__proto__"){if(this.values[s]!==u)throw Error("duplicate name '"+s+"' in "+this);if(this.isReservedId(a))throw Error("id "+a+" is reserved in "+this);if(this.isReservedName(s))throw Error("name '"+s+"' is reserved in "+this);if(this.valuesById[a]!==u){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+a+" in "+this);this.values[s]=a}else this.valuesById[this.values[s]=a]=s;o&&(this.valuesOptions===u&&(this.valuesOptions={}),this.valuesOptions[s]=o||null),this.comments[s]=d||null}return this},h.prototype.remove=function(s){if(!p.isString(s))throw TypeError("name must be a string");var a=this.values[s];if(a==null)throw Error("name '"+s+"' does not exist in "+this);return delete this.valuesById[a],delete this.values[s],delete this.comments[s],this.valuesOptions&&delete this.valuesOptions[s],this},h.prototype.isReservedId=function(s){return c.isReservedId(this.reserved,s)},h.prototype.isReservedName=function(s){return c.isReservedName(this.reserved,s)}},{21:21,22:22,33:33}],15:[function(t,n,l){n.exports=d;var i,c=t(22),p=(((d.prototype=Object.create(c.prototype)).constructor=d).className="Field",t(14)),h=t(32),s=t(33),a=/^required|optional|repeated$/;function d(o,f,g,m,_,y,b){if(s.isObject(m)?(b=_,y=m,m=_=u):s.isObject(_)&&(b=y,y=_,_=u),c.call(this,o,y),!s.isInteger(f)||f<0)throw TypeError("id must be a non-negative integer");if(!s.isString(g))throw TypeError("type must be a string");if(m!==u&&!a.test(m=m.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(_!==u&&!s.isString(_))throw TypeError("extend must be a string");this.rule=(m=m==="proto3_optional"?"optional":m)&&m!=="optional"?m:u,this.type=g,this.id=f,this.extend=_||u,this.repeated=m==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!s.Long&&h.long[g]!==u,this.bytes=g==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=b}d.fromJSON=function(o,f){return o=new d(o,f.id,f.type,f.rule,f.extend,f.options,f.comment),f.edition&&(o.e=f.edition),o.u="proto3",o},Object.defineProperty(d.prototype,"required",{get:function(){return this.o.field_presence==="LEGACY_REQUIRED"}}),Object.defineProperty(d.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(d.prototype,"delimited",{get:function(){return this.resolvedType instanceof i&&this.o.message_encoding==="DELIMITED"}}),Object.defineProperty(d.prototype,"packed",{get:function(){return this.o.repeated_field_encoding==="PACKED"}}),Object.defineProperty(d.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||this.o.field_presence!=="IMPLICIT")}}),d.prototype.setOption=function(o,f,g){return c.prototype.setOption.call(this,o,f,g)},d.prototype.toJSON=function(o){return o=!!o&&!!o.keepComments,s.toObject(["edition",this.h(),"rule",this.rule!=="optional"&&this.rule||u,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",o?this.comment:u])},d.prototype.resolve=function(){var o;return this.resolved?this:((this.typeDefault=h.defaults[this.type])===u?(this.resolvedType=(this.declaringField||this).parent.lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof p&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed===u||!this.resolvedType||this.resolvedType instanceof p||delete this.options.packed,Object.keys(this.options).length||(this.options=u)),this.long?(this.typeDefault=s.Long.fromNumber(this.typeDefault,(this.type[0]||"")=="u"),Object.freeze&&Object.freeze(this.typeDefault)):this.bytes&&typeof this.typeDefault=="string"&&(s.base64.test(this.typeDefault)?s.base64.decode(this.typeDefault,o=s.newBuffer(s.base64.length(this.typeDefault)),0):s.utf8.write(this.typeDefault,o=s.newBuffer(s.utf8.length(this.typeDefault)),0),this.typeDefault=o),this.map?this.defaultValue=s.emptyObject:this.repeated?this.defaultValue=s.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),c.prototype.resolve.call(this))},d.prototype.f=function(o){var f;return o!=="proto2"&&o!=="proto3"?{}:(o={},this.rule==="required"&&(o.field_presence="LEGACY_REQUIRED"),this.parent&&h.defaults[this.type]===u&&(f=this.parent.get(this.type.split(".").pop()))&&f instanceof i&&f.group&&(o.message_encoding="DELIMITED"),this.getOption("packed")===!0?o.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(o.repeated_field_encoding="EXPANDED"),o)},d.prototype.r=function(o){return c.prototype.r.call(this,this.e||o)},d.d=function(o,f,g,m){return typeof f=="function"?f=s.decorateType(f).name:f&&typeof f=="object"&&(f=s.decorateEnum(f).name),function(_,y){s.decorateType(_.constructor).add(new d(y,o,f,g,{default:m}))}},d.c=function(o){i=o}},{14:14,22:22,32:32,33:33}],16:[function(t,n,l){var i=n.exports=t(17);i.build="light",i.load=function(c,p,h){return(p=typeof p=="function"?(h=p,new i.Root):p||new i.Root).load(c,h)},i.loadSync=function(c,p){return(p=p||new i.Root).loadSync(c)},i.encoder=t(13),i.decoder=t(12),i.verifier=t(37),i.converter=t(11),i.ReflectionObject=t(22),i.Namespace=t(21),i.Root=t(26),i.Enum=t(14),i.Type=t(31),i.Field=t(15),i.OneOf=t(23),i.MapField=t(18),i.Service=t(30),i.Method=t(20),i.Message=t(19),i.wrappers=t(38),i.types=t(32),i.util=t(33),i.ReflectionObject.c(i.Root),i.Namespace.c(i.Type,i.Service,i.Enum),i.Root.c(i.Type),i.Field.c(i.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,37:37,38:38}],17:[function(t,n,l){var i=l;function c(){i.util.c(),i.Writer.c(i.BufferWriter),i.Reader.c(i.BufferReader)}i.build="minimal",i.Writer=t(39),i.BufferWriter=t(40),i.Reader=t(24),i.BufferReader=t(25),i.util=t(35),i.rpc=t(28),i.roots=t(27),i.configure=c,c()},{24:24,25:25,27:27,28:28,35:35,39:39,40:40}],18:[function(t,n,l){n.exports=h;var i=t(15),c=(((h.prototype=Object.create(i.prototype)).constructor=h).className="MapField",t(32)),p=t(33);function h(s,a,d,o,f,g){if(i.call(this,s,a,o,u,u,f,g),!p.isString(d))throw TypeError("keyType must be a string");this.keyType=d,this.resolvedKeyType=null,this.map=!0}h.fromJSON=function(s,a){return new h(s,a.id,a.keyType,a.type,a.options,a.comment)},h.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,p.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:u])},h.prototype.resolve=function(){if(this.resolved)return this;if(c.mapKey[this.keyType]===u)throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},h.d=function(s,a,d){return typeof d=="function"?d=p.decorateType(d).name:d&&typeof d=="object"&&(d=p.decorateEnum(d).name),function(o,f){p.decorateType(o.constructor).add(new h(f,s,a,d))}}},{15:15,32:32,33:33}],19:[function(t,n,l){n.exports=c;var i=t(35);function c(p){if(p)for(var h=Object.keys(p),s=0;s<h.length;++s){var a=h[s];a!=="__proto__"&&(this[a]=p[a])}}c.create=function(p){return this.$type.create(p)},c.encode=function(p,h){return this.$type.encode(p,h)},c.encodeDelimited=function(p,h){return this.$type.encodeDelimited(p,h)},c.decode=function(p){return this.$type.decode(p)},c.decodeDelimited=function(p){return this.$type.decodeDelimited(p)},c.verify=function(p){return this.$type.verify(p)},c.fromObject=function(p){return this.$type.fromObject(p)},c.toObject=function(p,h){return this.$type.toObject(p,h)},c.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},{35:35}],20:[function(t,n,l){n.exports=p;var i=t(22),c=(((p.prototype=Object.create(i.prototype)).constructor=p).className="Method",t(33));function p(h,s,a,d,o,f,g,m,_){if(c.isObject(o)?(g=o,o=f=u):c.isObject(f)&&(g=f,f=u),s!==u&&!c.isString(s))throw TypeError("type must be a string");if(!c.isString(a))throw TypeError("requestType must be a string");if(!c.isString(d))throw TypeError("responseType must be a string");i.call(this,h,g),this.type=s||"rpc",this.requestType=a,this.requestStream=!!o||u,this.responseType=d,this.responseStream=!!f||u,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=m,this.parsedOptions=_}p.fromJSON=function(h,s){return new p(h,s.type,s.requestType,s.responseType,s.requestStream,s.responseStream,s.options,s.comment,s.parsedOptions)},p.prototype.toJSON=function(h){return h=!!h&&!!h.keepComments,c.toObject(["type",this.type!=="rpc"&&this.type||u,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",h?this.comment:u,"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),i.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(t,n,l){n.exports=f;var i,c,p,h=t(22),s=(((f.prototype=Object.create(h.prototype)).constructor=f).className="Namespace",t(15)),a=t(33),d=t(23);function o(m,_){if(!m||!m.length)return u;for(var y={},b=0;b<m.length;++b)y[m[b].name]=m[b].toJSON(_);return y}function f(m,_){h.call(this,m,_),this.nested=u,this.a=null,this.l=Object.create(null),this.p=!0,this.b=!0}function g(m){m.a=null,m.l=Object.create(null);for(var _=m;_=_.parent;)_.l=Object.create(null);return m}f.fromJSON=function(m,_){return new f(m,_.options).addJSON(_.nested)},f.arrayToJSON=o,f.isReservedId=function(m,_){if(m){for(var y=0;y<m.length;++y)if(typeof m[y]!="string"&&m[y][0]<=_&&m[y][1]>_)return!0}return!1},f.isReservedName=function(m,_){if(m){for(var y=0;y<m.length;++y)if(m[y]===_)return!0}return!1},Object.defineProperty(f.prototype,"nestedArray",{get:function(){return this.a||(this.a=a.toArray(this.nested))}}),f.prototype.toJSON=function(m){return a.toObject(["options",this.options,"nested",o(this.nestedArray,m)])},f.prototype.addJSON=function(m){if(m)for(var _,y=Object.keys(m),b=0;b<y.length;++b)_=m[y[b]],this.add((_.fields!==u?i:_.values!==u?p:_.methods!==u?c:_.id!==u?s:f).fromJSON(y[b],_));return this},f.prototype.get=function(m){return this.nested&&Object.prototype.hasOwnProperty.call(this.nested,m)?this.nested[m]:null},f.prototype.getEnum=function(m){if(this.nested&&Object.prototype.hasOwnProperty.call(this.nested,m)&&this.nested[m]instanceof p)return this.nested[m].values;throw Error("no such enum: "+m)},f.prototype.add=function(m){if(!(m instanceof s&&m.extend!==u||m instanceof i||m instanceof d||m instanceof p||m instanceof c||m instanceof f))throw TypeError("object must be a valid nested object");if(m.name==="__proto__")return this;if(this.nested){var _=this.get(m.name);if(_){if(!(_ instanceof f&&m instanceof f)||_ instanceof i||_ instanceof c)throw Error("duplicate name '"+m.name+"' in "+this);for(var y=_.nestedArray,b=0;b<y.length;++b)m.add(y[b]);this.remove(_),this.nested||(this.nested={}),m.setOptions(_.options,!0)}}else this.nested={};this.nested[m.name]=m,this instanceof i||this instanceof c||this instanceof p||this instanceof s||m.e||(m.e=m.u),this.p=!0,this.b=!0;for(var k=this;k=k.parent;)k.p=!0,k.b=!0;return m.onAdd(this),g(this)},f.prototype.remove=function(m){if(!(m instanceof h))throw TypeError("object must be a ReflectionObject");if(m.parent!==this)throw Error(m+" is not a member of "+this);return delete this.nested[m.name],Object.keys(this.nested).length||(this.nested=u),m.onRemove(this),g(this)},f.prototype.define=function(m,_){if(a.isString(m))m=m.split(".");else if(!Array.isArray(m))throw TypeError("illegal path");if(m&&m.length&&m[0]==="")throw Error("path must be relative");for(var y=this;0<m.length;){var b=m.shift();if(y.nested&&y.nested[b]){if(!((y=y.nested[b])instanceof f))throw Error("path conflicts with non-namespace objects")}else y.add(y=new f(b))}return _&&y.addJSON(_),y},f.prototype.resolveAll=function(){if(this.b){this.v(this.e);var m=this.nestedArray,_=0;for(this.resolve();_<m.length;)m[_]instanceof f?m[_++].resolveAll():m[_++].resolve();this.b=!1}return this},f.prototype.v=function(m){return this.p&&(this.p=!1,m=this.e||m,h.prototype.v.call(this,m),this.nestedArray.forEach(_=>{_.v(m)})),this},f.prototype.lookup=function(m,_,y){if(typeof _=="boolean"?(y=_,_=u):_&&!Array.isArray(_)&&(_=[_]),a.isString(m)&&m.length){if(m===".")return this.root;m=m.split(".")}else if(!m.length)return this;var b=m.join(".");if(m[0]==="")return this.root.lookup(m.slice(1),_);var k=this.root.y&&this.root.y["."+b];if(k&&(!_||~_.indexOf(k.constructor))||(k=this.w(m,b))&&(!_||~_.indexOf(k.constructor)))return k;if(!y)for(var v=this;v.parent;){if((k=v.parent.w(m,b))&&(!_||~_.indexOf(k.constructor)))return k;v=v.parent}return null},f.prototype.w=function(m,_){if(Object.prototype.hasOwnProperty.call(this.l,_))return this.l[_];var y=this.get(m[0]),b=null;if(y)m.length===1?b=y:y instanceof f&&(m=m.slice(1),b=y.w(m,m.join(".")));else for(var k=0;k<this.nestedArray.length;++k)this.a[k]instanceof f&&(y=this.a[k].w(m,_))&&(b=y);return this.l[_]=b},f.prototype.lookupType=function(m){var _=this.lookup(m,[i]);if(_)return _;throw Error("no such type: "+m)},f.prototype.lookupEnum=function(m){var _=this.lookup(m,[p]);if(_)return _;throw Error("no such Enum '"+m+"' in "+this)},f.prototype.lookupTypeOrEnum=function(m){var _=this.lookup(m,[i,p]);if(_)return _;throw Error("no such Type or Enum '"+m+"' in "+this)},f.prototype.lookupService=function(m){var _=this.lookup(m,[c]);if(_)return _;throw Error("no such Service '"+m+"' in "+this)},f.c=function(m,_,y){i=m,c=_,p=y}},{15:15,22:22,23:23,33:33}],22:[function(t,n,l){(n.exports=d).className="ReflectionObject";const i=t(23);var c,p=t(33),h={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},s={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},a={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function d(o,f){if(!p.isString(o))throw TypeError("name must be a string");if(f&&!p.isObject(f))throw TypeError("options must be an object");this.options=f,this.parsedOptions=null,this.name=o,this.e=null,this.u="proto2",this.o={},this.g=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(d.prototype,{root:{get:function(){for(var o=this;o.parent!==null;)o=o.parent;return o}},fullName:{get:function(){for(var o=[this.name],f=this.parent;f;)o.unshift(f.name),f=f.parent;return o.join(".")}}}),d.prototype.toJSON=function(){throw Error()},d.prototype.onAdd=function(o){this.parent&&this.parent!==o&&this.parent.remove(this),this.parent=o,this.resolved=!1,o=o.root,o instanceof c&&o.j(this)},d.prototype.onRemove=function(o){o=o.root,o instanceof c&&o.O(this),this.parent=null,this.resolved=!1},d.prototype.resolve=function(){return this.resolved||this.root instanceof c&&(this.resolved=!0),this},d.prototype.v=function(o){return this.r(this.e||o)},d.prototype.r=function(o){if(!this.g){var f={};if(!o)throw Error("Unknown edition for "+this.fullName);var g=Object.assign(this.options?Object.assign({},this.options.features):{},this.f(o));if(this.e){if(o==="proto2")f=Object.assign({},s);else if(o==="proto3")f=Object.assign({},a);else{if(o!=="2023")throw Error("Unknown edition: "+o);f=Object.assign({},h)}this.o=Object.assign(f,g||{})}else{if(this.partOf instanceof i)o=Object.assign({},this.partOf.o),this.o=Object.assign(o,g||{});else if(!this.declaringField){if(!this.parent)throw Error("Unable to find a parent for "+this.fullName);f=Object.assign({},this.parent.o),this.o=Object.assign(f,g||{})}this.extensionField&&(this.extensionField.o=this.o)}this.g=!0}},d.prototype.f=function(){return{}},d.prototype.getOption=function(o){return this.options?this.options[o]:u},d.prototype.setOption=function(o,f,g){return o!=="__proto__"&&(this.options||(this.options={}),/^features\./.test(o)?p.setProperty(this.options,o,f,g):g&&this.options[o]!==u||(this.getOption(o)!==f&&(this.resolved=!1),this.options[o]=f)),this},d.prototype.setParsedOption=function(o,f,g){var m,_,y;return o!=="__proto__"&&(this.parsedOptions||(this.parsedOptions=[]),m=this.parsedOptions,g?(_=m.find(function(b){return Object.prototype.hasOwnProperty.call(b,o)}))?(y=_[o],p.setProperty(y,g,f)):((_={})[o]=p.setProperty({},g,f),m.push(_)):((y={})[o]=f,m.push(y))),this},d.prototype.setOptions=function(o,f){if(o)for(var g=Object.keys(o),m=0;m<g.length;++m)this.setOption(g[m],o[g[m]],f);return this},d.prototype.toString=function(){var o=this.constructor.className,f=this.fullName;return f.length?o+" "+f:o},d.prototype.h=function(){return this.e&&this.e!=="proto3"?this.e:u},d.c=function(o){c=o}},{23:23,33:33}],23:[function(t,n,l){n.exports=h;var i=t(22),c=(((h.prototype=Object.create(i.prototype)).constructor=h).className="OneOf",t(15)),p=t(33);function h(a,d,o,f){if(Array.isArray(d)||(o=d,d=u),i.call(this,a,o),d!==u&&!Array.isArray(d))throw TypeError("fieldNames must be an Array");this.oneof=d||[],this.fieldsArray=[],this.comment=f}function s(a){if(a.parent)for(var d=0;d<a.fieldsArray.length;++d)a.fieldsArray[d].parent||a.parent.add(a.fieldsArray[d])}h.fromJSON=function(a,d){return new h(a,d.oneof,d.options,d.comment)},h.prototype.toJSON=function(a){return a=!!a&&!!a.keepComments,p.toObject(["options",this.options,"oneof",this.oneof,"comment",a?this.comment:u])},h.prototype.add=function(a){if(a instanceof c)return a.parent&&a.parent!==this.parent&&a.parent.remove(a),this.oneof.push(a.name),this.fieldsArray.push(a),s(a.partOf=this),this;throw TypeError("field must be a Field")},h.prototype.remove=function(a){if(!(a instanceof c))throw TypeError("field must be a Field");var d=this.fieldsArray.indexOf(a);if(d<0)throw Error(a+" is not a member of "+this);return this.fieldsArray.splice(d,1),-1<(d=this.oneof.indexOf(a.name))&&this.oneof.splice(d,1),a.partOf=null,this},h.prototype.onAdd=function(a){i.prototype.onAdd.call(this,a);for(var d=0;d<this.oneof.length;++d){var o=a.get(this.oneof[d]);o&&!o.partOf&&(o.partOf=this).fieldsArray.push(o)}s(this)},h.prototype.onRemove=function(a){for(var d,o=0;o<this.fieldsArray.length;++o)(d=this.fieldsArray[o]).parent&&d.parent.remove(d);i.prototype.onRemove.call(this,a)},Object.defineProperty(h.prototype,"isProto3Optional",{get:function(){var a;return this.fieldsArray!=null&&this.fieldsArray.length===1&&(a=this.fieldsArray[0]).options!=null&&a.options.proto3_optional===!0}}),h.d=function(){for(var a=Array(arguments.length),d=0;d<arguments.length;)a[d]=arguments[d++];return function(o,f){p.decorateType(o.constructor).add(new h(f,a)),Object.defineProperty(o,f,{get:p.oneOfGetter(a),set:p.oneOfSetter(a)})}}},{15:15,22:22,33:33}],24:[function(t,n,l){n.exports=a;var i,c=t(35),p=c.LongBits,h=c.utf8;function s(y,b){return RangeError("index out of range: "+y.pos+" + "+(b||1)+" > "+y.len)}function a(y){this.buf=y,this.pos=0,this.len=y.length}function d(){return c.Buffer?function(y){return(a.create=function(b){return c.Buffer.isBuffer(b)?new i(b):f(b)})(y)}:f}var o,f=typeof Uint8Array!="undefined"?function(y){if(y instanceof Uint8Array||Array.isArray(y))return new a(y);throw Error("illegal buffer")}:function(y){if(Array.isArray(y))return new a(y);throw Error("illegal buffer")};function g(){var y=new p(0,0),b=0;if(!(4<this.len-this.pos)){for(;b<3;++b){if(this.pos>=this.len)throw s(this);if(y.lo=(y.lo|(127&this.buf[this.pos])<<7*b)>>>0,this.buf[this.pos++]<128)return y}return y.lo=(y.lo|(127&this.buf[this.pos++])<<7*b)>>>0,y}for(;b<4;++b)if(y.lo=(y.lo|(127&this.buf[this.pos])<<7*b)>>>0,this.buf[this.pos++]<128)return y;if(y.lo=(y.lo|(127&this.buf[this.pos])<<28)>>>0,y.hi=(y.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return y;if(b=0,4<this.len-this.pos){for(;b<5;++b)if(y.hi=(y.hi|(127&this.buf[this.pos])<<7*b+3)>>>0,this.buf[this.pos++]<128)return y}else for(;b<5;++b){if(this.pos>=this.len)throw s(this);if(y.hi=(y.hi|(127&this.buf[this.pos])<<7*b+3)>>>0,this.buf[this.pos++]<128)return y}throw Error("invalid varint encoding")}function m(y,b){return(y[b-4]|y[b-3]<<8|y[b-2]<<16|y[b-1]<<24)>>>0}function _(){if(this.pos+8>this.len)throw s(this,8);return new p(m(this.buf,this.pos+=4),m(this.buf,this.pos+=4))}a.create=d(),a.prototype.k=c.Array.prototype.subarray||c.Array.prototype.slice,a.prototype.uint32=(o=4294967295,function(){if(o=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(o=(o|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128||(o=(o|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128||(o=(o|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128||(o=(o|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128||!((this.pos+=5)>this.len))))))return o;throw this.pos=this.len,s(this,10)}),a.prototype.int32=function(){return 0|this.uint32()},a.prototype.sint32=function(){var y=this.uint32();return y>>>1^-(1&y)|0},a.prototype.bool=function(){return this.uint32()!==0},a.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return m(this.buf,this.pos+=4)},a.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|m(this.buf,this.pos+=4)},a.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var y=c.float.readFloatLE(this.buf,this.pos);return this.pos+=4,y},a.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var y=c.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,y},a.prototype.bytes=function(){var y=this.uint32(),b=this.pos,k=this.pos+y;if(k>this.len)throw s(this,y);return this.pos+=y,Array.isArray(this.buf)?this.buf.slice(b,k):b===k?(y=c.Buffer)?y.alloc(0):new this.buf.constructor(0):this.k.call(this.buf,b,k)},a.prototype.string=function(){var y=this.bytes();return h.read(y,0,y.length)},a.prototype.skip=function(y){if(typeof y=="number"){if(this.pos+y>this.len)throw s(this,y);this.pos+=y}else do if(this.pos>=this.len)throw s(this);while(128&this.buf[this.pos++]);return this},a.recursionLimit=c.recursionLimit,a.prototype.skipType=function(y,b){if(a.recursionLimit<(b=b===u?0:b))throw Error("maximum nesting depth exceeded");switch(y){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(y=7&this.uint32())!=4;)this.skipType(y,b+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+y+" at offset "+this.pos)}return this},a.c=function(y){i=y,a.create=d(),i.c();var b=c.Long?"toLong":"toNumber";c.merge(a.prototype,{int64:function(){return g.call(this)[b](!1)},uint64:function(){return g.call(this)[b](!0)},sint64:function(){return g.call(this).zzDecode()[b](!1)},fixed64:function(){return _.call(this)[b](!0)},sfixed64:function(){return _.call(this)[b](!1)}})}},{35:35}],25:[function(t,n,l){n.exports=p;var i=t(24),c=((p.prototype=Object.create(i.prototype)).constructor=p,t(35));function p(h){i.call(this,h)}p.c=function(){c.Buffer&&(p.prototype.k=c.Buffer.prototype.slice)},p.prototype.string=function(){var h=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+h,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+h,this.len))},p.c()},{24:24,35:35}],26:[function(t,n,l){n.exports=f;var i,c,p,h=t(21),s=(((f.prototype=Object.create(h.prototype)).constructor=f).className="Root",t(15)),a=t(14),d=t(23),o=t(33);function f(y){h.call(this,"",y),this.deferred=[],this.files=[],this.e="proto2",this.y={}}function g(){}f.fromJSON=function(y,b){return b=b||new f,y.options&&b.setOptions(y.options),b.addJSON(y.nested).resolveAll()},f.prototype.resolvePath=o.path.resolve,f.prototype.fetch=o.fetch,f.prototype.load=function y(b,k,v){typeof k=="function"&&(v=k,k=u);var O=this;if(!v)return o.asPromise(y,O,b,k);var w=v===g;function A(I,N){if(v){if(w)throw I;N&&N.resolveAll();var R=v;v=null,R(I,N)}}function x(I){var N=I.lastIndexOf("google/protobuf/");return-1<N&&(I=I.substring(N),I in p)?I:null}function j(I,N){try{if(o.isString(N)&&(N[0]||"")=="{"&&(N=JSON.parse(N)),o.isString(N)){c.filename=I;var R,D=c(N,O,k),V=0;if(D.imports)for(;V<D.imports.length;++V)(R=x(D.imports[V])||O.resolvePath(I,D.imports[V]))&&q(R);if(D.weakImports)for(V=0;V<D.weakImports.length;++V)(R=x(D.weakImports[V])||O.resolvePath(I,D.weakImports[V]))&&q(R,!0)}else O.setOptions(N.options).addJSON(N.nested)}catch(fe){A(fe)}w||z||A(null,O)}function q(I,N){if(I=x(I)||I,!~O.files.indexOf(I))if(O.files.push(I),I in p)w?j(I,p[I]):(++z,setTimeout(function(){--z,j(I,p[I])}));else if(w){var R;try{R=o.fs.readFileSync(I).toString("utf8")}catch(D){return void(N||A(D))}j(I,R)}else++z,O.fetch(I,function(D,V){--z,v&&(D?N?z||A(null,O):A(D):j(I,V))})}var z=0;o.isString(b)&&(b=[b]);for(var T,S=0;S<b.length;++S)(T=O.resolvePath("",b[S]))&&q(T);return w?O.resolveAll():z||A(null,O),O},f.prototype.loadSync=function(y,b){if(o.isNode)return this.load(y,b,g);throw Error("not supported")},f.prototype.resolveAll=function(){if(!this.b)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(y){return"'extend "+y.extend+"' in "+y.parent.fullName}).join(", "));return h.prototype.resolveAll.call(this)};var m=/^[A-Z]/;function _(y,b){var k,v=b.parent.lookup(b.extend);if(v)return k=new s(b.fullName,b.id,b.type,b.rule,u,b.options),v.get(k.name)||((k.declaringField=b).extensionField=k,v.add(k)),1}f.prototype.j=function(y){if(y instanceof s)y.extend===u||y.extensionField||_(0,y)||this.deferred.push(y);else if(y instanceof a)m.test(y.name)&&(y.parent[y.name]=y.values);else if(!(y instanceof d)){if(y instanceof i)for(var b=0;b<this.deferred.length;)_(0,this.deferred[b])?this.deferred.splice(b,1):++b;for(var k=0;k<y.nestedArray.length;++k)this.j(y.a[k]);m.test(y.name)&&(y.parent[y.name]=y)}(y instanceof i||y instanceof a||y instanceof s)&&(this.y[y.fullName]=y)},f.prototype.O=function(y){var b;if(y instanceof s)y.extend!==u&&(y.extensionField?(y.extensionField.parent.remove(y.extensionField),y.extensionField=null):-1<(b=this.deferred.indexOf(y))&&this.deferred.splice(b,1));else if(y instanceof a)m.test(y.name)&&delete y.parent[y.name];else if(y instanceof h){for(var k=0;k<y.nestedArray.length;++k)this.O(y.a[k]);m.test(y.name)&&delete y.parent[y.name]}delete this.y[y.fullName]},f.c=function(y,b,k){i=y,c=b,p=k}},{14:14,15:15,21:21,23:23,33:33}],27:[function(t,n,l){n.exports={}},{}],28:[function(t,n,l){l.Service=t(29)},{29:29}],29:[function(t,n,l){n.exports=c;var i=t(35);function c(p,h,s){if(typeof p!="function")throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=p,this.requestDelimited=!!h,this.responseDelimited=!!s}((c.prototype=Object.create(i.EventEmitter.prototype)).constructor=c).prototype.rpcCall=function p(h,s,a,d,o){if(!d)throw TypeError("request must be specified");var f=this;if(!o)return i.asPromise(p,f,h,s,a,d);if(!f.rpcImpl)return setTimeout(function(){o(Error("already ended"))},0),u;try{return f.rpcImpl(h,s[f.requestDelimited?"encodeDelimited":"encode"](d).finish(),function(g,m){if(g)return f.emit("error",g,h),o(g);if(m===null)return f.end(!0),u;if(!(m instanceof a))try{m=a[f.responseDelimited?"decodeDelimited":"decode"](m)}catch(_){return f.emit("error",_,h),o(_)}return f.emit("data",m,h),o(null,m)})}catch(g){return f.emit("error",g,h),setTimeout(function(){o(g)},0),u}},c.prototype.end=function(p){return this.rpcImpl&&(p||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(t,n,l){n.exports=a;var i=t(21),c=(((a.prototype=Object.create(i.prototype)).constructor=a).className="Service",t(20)),p=t(33),h=t(28),s=p.patterns.reservedRe;function a(o,f){i.call(this,o,f),this.methods={},this._=null}function d(o){return o._=null,o}a.fromJSON=function(o,f){var g=new a(o,f.options);if(f.methods)for(var m=Object.keys(f.methods),_=0;_<m.length;++_)g.add(c.fromJSON(m[_],f.methods[m[_]]));return f.nested&&g.addJSON(f.nested),f.edition&&(g.e=f.edition),g.comment=f.comment,g.u="proto3",g},a.prototype.toJSON=function(o){var f=i.prototype.toJSON.call(this,o),g=!!o&&!!o.keepComments;return p.toObject(["edition",this.h(),"options",f&&f.options||u,"methods",i.arrayToJSON(this.methodsArray,o)||{},"nested",f&&f.nested||u,"comment",g?this.comment:u])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._||(this._=p.toArray(this.methods))}}),a.prototype.get=function(o){return Object.prototype.hasOwnProperty.call(this.methods,o)?this.methods[o]:i.prototype.get.call(this,o)},a.prototype.resolveAll=function(){if(this.b){i.prototype.resolve.call(this);for(var o=this.methodsArray,f=0;f<o.length;++f)o[f].resolve()}return this},a.prototype.v=function(o){return this.p&&(o=this.e||o,i.prototype.v.call(this,o),this.methodsArray.forEach(f=>{f.v(o)})),this},a.prototype.add=function(o){if(this.get(o.name))throw Error("duplicate name '"+o.name+"' in "+this);return o instanceof c?o.name==="__proto__"?this:d((this.methods[o.name]=o).parent=this):i.prototype.add.call(this,o)},a.prototype.remove=function(o){if(o instanceof c){if(this.methods[o.name]!==o)throw Error(o+" is not a member of "+this);return delete this.methods[o.name],o.parent=null,d(this)}return i.prototype.remove.call(this,o)},a.prototype.create=function(o,f,g){for(var m,_=new h.Service(o,f,g),y=0;y<this.methodsArray.length;++y){var b=p.lcFirst((m=this._[y]).resolve().name).replace(/[^$\w_]/g,"");_[b]=p.codegen(["r","c"],s.test(b)?b+"_":b)("return this.rpcCall(m,q,s,r,c)")({m,q:m.resolvedRequestType.ctor,s:m.resolvedResponseType.ctor})}return _}},{20:20,21:21,28:28,33:33}],31:[function(t,n,l){n.exports=v;var i=t(21),c=(((v.prototype=Object.create(i.prototype)).constructor=v).className="Type",t(14)),p=t(23),h=t(15),s=t(18),a=t(30),d=t(19),o=t(24),f=t(39),g=t(33),m=t(13),_=t(12),y=t(37),b=t(11),k=t(38);function v(w,A){w=w.replace(/\W/g,""),i.call(this,w,A),this.fields={},this.oneofs=u,this.extensions=u,this.reserved=u,this.group=u,this.A=null,this.i=null,this.T=null,this.x=null}function O(w){return w.A=w.i=w.T=null,delete w.encode,delete w.decode,delete w.verify,w}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(!this.A){this.A={};for(var w=Object.keys(this.fields),A=0;A<w.length;++A){var x=this.fields[w[A]],j=x.id;if(this.A[j])throw Error("duplicate id "+j+" in "+this);this.A[j]=x}}return this.A}},fieldsArray:{get:function(){return this.i||(this.i=g.toArray(this.fields))}},oneofsArray:{get:function(){return this.T||(this.T=g.toArray(this.oneofs))}},ctor:{get:function(){return this.x||(this.ctor=v.generateConstructor(this)())},set:function(w){for(var A=w.prototype,x=(A instanceof d||((w.prototype=new d).constructor=w,g.merge(w.prototype,A)),w.$type=w.prototype.$type=this,g.merge(w,d,!0),this.x=w,0);x<this.fieldsArray.length;++x)this.i[x].resolve();for(var j={},x=0;x<this.oneofsArray.length;++x)j[this.T[x].resolve().name]={get:g.oneOfGetter(this.T[x].oneof),set:g.oneOfSetter(this.T[x].oneof)};x&&Object.defineProperties(w.prototype,j)}}}),v.generateConstructor=function(w){for(var A,x=g.codegen(["p"],w.name),j=0;j<w.fieldsArray.length;++j)(A=w.i[j]).map?x("this%s={}",g.safeProp(A.name)):A.repeated&&x("this%s=[]",g.safeProp(A.name));return x('if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null&&ks[i]!=="__proto__")')("this[ks[i]]=p[ks[i]]")},v.fromJSON=function(w,A){for(var x=new v(w,A.options),j=(x.extensions=A.extensions,x.reserved=A.reserved,Object.keys(A.fields)),q=0;q<j.length;++q)x.add((A.fields[j[q]].keyType!==void 0?s:h).fromJSON(j[q],A.fields[j[q]]));if(A.oneofs)for(j=Object.keys(A.oneofs),q=0;q<j.length;++q)x.add(p.fromJSON(j[q],A.oneofs[j[q]]));if(A.nested)for(j=Object.keys(A.nested),q=0;q<j.length;++q){var z=A.nested[j[q]];x.add((z.id!==u?h:z.fields!==u?v:z.values!==u?c:z.methods!==u?a:i).fromJSON(j[q],z))}return A.extensions&&A.extensions.length&&(x.extensions=A.extensions),A.reserved&&A.reserved.length&&(x.reserved=A.reserved),A.group&&(x.group=!0),A.comment&&(x.comment=A.comment),A.edition&&(x.e=A.edition),x.u="proto3",x},v.prototype.toJSON=function(w){var A=i.prototype.toJSON.call(this,w),x=!!w&&!!w.keepComments;return g.toObject(["edition",this.h(),"options",A&&A.options||u,"oneofs",i.arrayToJSON(this.oneofsArray,w),"fields",i.arrayToJSON(this.fieldsArray.filter(function(j){return!j.declaringField}),w)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:u,"reserved",this.reserved&&this.reserved.length?this.reserved:u,"group",this.group||u,"nested",A&&A.nested||u,"comment",x?this.comment:u])},v.prototype.resolveAll=function(){if(this.b){i.prototype.resolveAll.call(this);for(var w=this.oneofsArray,A=0;A<w.length;)w[A++].resolve();for(var x=this.fieldsArray,A=0;A<x.length;)x[A++].resolve()}return this},v.prototype.v=function(w){return this.p&&(w=this.e||w,i.prototype.v.call(this,w),this.oneofsArray.forEach(A=>{A.r(w)}),this.fieldsArray.forEach(A=>{A.r(w)})),this},v.prototype.get=function(w){return Object.prototype.hasOwnProperty.call(this.fields,w)?this.fields[w]:this.oneofs&&Object.prototype.hasOwnProperty.call(this.oneofs,w)?this.oneofs[w]:this.nested&&Object.prototype.hasOwnProperty.call(this.nested,w)?this.nested[w]:null},v.prototype.add=function(w){if(this.get(w.name))throw Error("duplicate name '"+w.name+"' in "+this);if(w instanceof h&&w.extend===u){if((this.A||this.fieldsById)[w.id])throw Error("duplicate id "+w.id+" in "+this);if(this.isReservedId(w.id))throw Error("id "+w.id+" is reserved in "+this);if(this.isReservedName(w.name))throw Error("name '"+w.name+"' is reserved in "+this);return w.name==="__proto__"?this:(w.parent&&w.parent.remove(w),(this.fields[w.name]=w).message=this,w.onAdd(this),O(this))}return w instanceof p?w.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),(this.oneofs[w.name]=w).onAdd(this),O(this)):i.prototype.add.call(this,w)},v.prototype.remove=function(w){if(w instanceof h&&w.extend===u){if(this.fields&&this.fields[w.name]===w)return delete this.fields[w.name],w.parent=null,w.onRemove(this),O(this);throw Error(w+" is not a member of "+this)}if(w instanceof p){if(this.oneofs&&this.oneofs[w.name]===w)return delete this.oneofs[w.name],w.parent=null,w.onRemove(this),O(this);throw Error(w+" is not a member of "+this)}return i.prototype.remove.call(this,w)},v.prototype.isReservedId=function(w){return i.isReservedId(this.reserved,w)},v.prototype.isReservedName=function(w){return i.isReservedName(this.reserved,w)},v.prototype.create=function(w){return new this.ctor(w)},v.prototype.setup=function(){for(var j=this.fullName,w=[],A=0;A<this.fieldsArray.length;++A)w.push(this.i[A].resolve().resolvedType);this.encode=m(this)({Writer:f,types:w,util:g}),this.decode=_(this)({Reader:o,types:w,util:g}),this.verify=y(this)({types:w,util:g}),this.fromObject=b.fromObject(this)({types:w,util:g}),this.toObject=b.toObject(this)({types:w,util:g});var x,j=k[j];return j&&((x=Object.create(this)).fromObject=this.fromObject,this.fromObject=j.fromObject.bind(x),x.toObject=this.toObject,this.toObject=j.toObject.bind(x)),this},v.prototype.encode=function(w,A){return this.setup().encode(w,A)},v.prototype.encodeDelimited=function(w,A){return this.encode(w,A&&A.len?A.fork():A).ldelim()},v.prototype.decode=function(w,A,x,j){return this.setup().decode(w,A,x,j)},v.prototype.decodeDelimited=function(w){return w instanceof o||(w=o.create(w)),this.decode(w,w.uint32())},v.prototype.verify=function(w,A){return this.setup().verify(w,A)},v.prototype.fromObject=function(w,A){return this.setup().fromObject(w,A)},v.prototype.toObject=function(w,A){return this.setup().toObject(w,A)},v.d=function(w){return function(A){g.decorateType(A,w)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,37:37,38:38,39:39}],32:[function(i,n,l){var i=i(33),c=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function p(h,s){var a=0,d=Object.create(null);for(s|=0;a<h.length;)d[c[a+s]]=h[a++];return d}l.basic=p([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),l.defaults=p([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),l.long=p([0,0,0,1,1],7),l.mapKey=p([0,0,0,5,5,0,0,0,1,1,0,2],2),l.packed=p([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(t,n,l){var i,c,p=n.exports=t(35),h=t(27),s=(p.codegen=t(3),p.fetch=t(5),p.path=t(8),p.patterns=t(36),p.patterns.reservedRe),a=p.patterns.unsafePropertyRe,d=(p.fs=p.inquire("fs"),p.toArray=function(f){if(f){for(var g=Object.keys(f),m=Array(g.length),_=0;_<g.length;)m[_]=f[g[_++]];return m}return[]},p.toObject=function(f){for(var g={},m=0;m<f.length;){var _=f[m++],y=f[m++];y!==u&&(g[_]=y)}return g},p.isReserved=function(f){return s.test(f)},p.safeProp=function(f){return!/^[$\w_]+$/.test(f)||s.test(f)?"["+JSON.stringify(f)+"]":"."+f},p.ucFirst=function(f){return(f[0]||"").toUpperCase()+f.substring(1)},/_([a-z])/g),o=(p.camelCase=function(f){return f.substring(0,1)+f.substring(1).replace(d,function(g,m){return m.toUpperCase()})},p.compareFieldsById=function(f,g){return f.id-g.id},p.decorateType=function(f,g){return f.$type?(g&&f.$type.name!==g&&(p.decorateRoot.remove(f.$type),f.$type.name=g,p.decorateRoot.add(f.$type)),f.$type):(g=new(i=i||t(31))(g||f.name),p.decorateRoot.add(g),g.ctor=f,Object.defineProperty(f,"$type",{value:g,enumerable:!1}),Object.defineProperty(f.prototype,"$type",{value:g,enumerable:!1}),g)},0);p.decorateEnum=function(f){var g;return f.$type||(g=new(c=c||t(14))("Enum"+o++,f),p.decorateRoot.add(g),Object.defineProperty(f,"$type",{value:g,enumerable:!1}),g)},p.setProperty=function(f,g,m,_){if(typeof f!="object")throw TypeError("dst must be an object");if(g)return(function y(b,k,v){var O=k.shift();if(!a.test(O))if(0<k.length)b[O]=y(b[O]||{},k,v);else{if((k=b[O])&&_)return b;k&&(v=[].concat(k).concat(v)),b[O]=v}return b})(f,g=g.split("."),m);throw TypeError("path must be specified")},Object.defineProperty(p,"decorateRoot",{get:function(){return h.decorated||(h.decorated=new(t(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,36:36,5:5,8:8}],34:[function(t,n,l){n.exports=c;var i=t(35);function c(s,a){this.lo=s>>>0,this.hi=a>>>0}var p=c.zero=new c(0,0),h=(p.toNumber=function(){return 0},p.zzEncode=p.zzDecode=function(){return this},p.length=function(){return 1},c.zeroHash="\0\0\0\0\0\0\0\0",c.fromNumber=function(s){var a,d;return s===0?p:(d=(s=(a=s<0)?-s:s)>>>0,s=(s-d)/4294967296>>>0,a&&(s=~s>>>0,d=~d>>>0,4294967295<++d&&(d=0,4294967295<++s&&(s=0))),new c(d,s))},c.from=function(s){if(typeof s=="number")return c.fromNumber(s);if(i.isString(s)){if(!i.Long)return c.fromNumber(parseInt(s,10));s=i.Long.fromString(s)}return s.low||s.high?new c(s.low>>>0,s.high>>>0):p},c.prototype.toNumber=function(s){var a;return!s&&this.hi>>>31?(s=1+~this.lo>>>0,a=~this.hi>>>0,-(s+4294967296*(a=s?a:a+1>>>0))):this.lo+4294967296*this.hi},c.prototype.toLong=function(s){return i.Long?new i.Long(0|this.lo,0|this.hi,!!s):{low:0|this.lo,high:0|this.hi,unsigned:!!s}},String.prototype.charCodeAt);c.fromHash=function(s){return s==="\0\0\0\0\0\0\0\0"?p:new c((h.call(s,0)|h.call(s,1)<<8|h.call(s,2)<<16|h.call(s,3)<<24)>>>0,(h.call(s,4)|h.call(s,5)<<8|h.call(s,6)<<16|h.call(s,7)<<24)>>>0)},c.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)},c.prototype.zzEncode=function(){var s=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^s)>>>0,this.lo=(this.lo<<1^s)>>>0,this},c.prototype.zzDecode=function(){var s=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^s)>>>0,this.hi=(this.hi>>>1^s)>>>0,this},c.prototype.length=function(){var s=this.lo,a=(this.lo>>>28|this.hi<<4)>>>0,d=this.hi>>>24;return d==0?a==0?s<16384?s<128?1:2:s<2097152?3:4:a<16384?a<128?5:6:a<2097152?7:8:d<128?9:10}},{35:35}],35:[function(t,n,l){var i=l;function c(h,s,a){for(var d=Object.keys(s),o=0;o<d.length;++o)h[d[o]]!==u&&a||d[o]!=="__proto__"&&(h[d[o]]=s[d[o]]);return h}function p(h){function s(a,d){if(!(this instanceof s))return new s(a,d);Object.defineProperty(this,"message",{get:function(){return a}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:Error().stack||""}),d&&c(this,d)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return h},set:u,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),s}i.asPromise=t(1),i.base64=t(2),i.EventEmitter=t(4),i.float=t(6),i.inquire=t(7),i.utf8=t(10),i.pool=t(9),i.LongBits=t(34),i.isNode=!!(typeof global!="undefined"&&global&&global.process&&global.process.versions&&global.process.versions.node),i.global=i.isNode&&global||typeof window!="undefined"&&window||typeof self!="undefined"&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(h){return typeof h=="number"&&isFinite(h)&&Math.floor(h)===h},i.isString=function(h){return typeof h=="string"||h instanceof String},i.isObject=function(h){return h&&typeof h=="object"},i.isset=i.isSet=function(h,s){var a=h[s];return a!=null&&h.hasOwnProperty(s)&&(typeof a!="object"||0<(Array.isArray(a)?a:Object.keys(a)).length)},i.Buffer=null,i.S=null,i.L=null,i.newBuffer=function(h){return typeof h=="number"?i.Buffer?i.L(h):new i.Array(h):i.Buffer?i.S(h):typeof Uint8Array=="undefined"?h:new Uint8Array(h)},i.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(h){return h?i.LongBits.from(h).toHash():i.LongBits.zeroHash},i.longFromHash=function(h,s){return h=i.LongBits.fromHash(h),i.Long?i.Long.fromBits(h.lo,h.hi,s):h.toNumber(!!s)},i.merge=c,i.recursionLimit=100,i.makeProp=function(h,s){Object.defineProperty(h,s,{enumerable:!0,configurable:!0,writable:!0})},i.lcFirst=function(h){return(h[0]||"").toLowerCase()+h.substring(1)},i.newError=p,i.ProtocolError=p("ProtocolError"),i.oneOfGetter=function(h){for(var s={},a=0;a<h.length;++a)s[h[a]]=1;return function(){for(var d=Object.keys(this),o=d.length-1;-1<o;--o)if(s[d[o]]===1&&this[d[o]]!==u&&this[d[o]]!==null)return d[o]}},i.oneOfSetter=function(h){return function(s){for(var a=0;a<h.length;++a)h[a]!==s&&delete this[h[a]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i.c=function(){var h=i.Buffer;h?(i.S=h.from!==Uint8Array.from&&h.from||function(s,a){return new h(s,a)},i.L=h.allocUnsafe||function(s){return new h(s)}):i.S=i.L=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(t,n,l){l.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,l.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,l.reservedRe=/^(?: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)$/,l.unsafePropertyRe=/^(?:__proto__|prototype|constructor)$/},{}],37:[function(t,n,l){n.exports=function(s){var a=c.codegen(["m","n"],s.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected")("if(n===undefined)n=0")("if(n>util.recursionLimit)")("return%j","maximum nesting depth exceeded"),d=s.oneofsArray,o={};d.length&&a("var p={}");for(var f=0;f<s.fieldsArray.length;++f){var g,m=s.i[f].resolve(),_="m"+c.safeProp(m.name);m.optional&&a("if(%s!=null&&m.hasOwnProperty(%j)){",_,m.name),m.map?(a("if(!util.isObject(%s))",_)("return%j",p(m,"object"))("var k=Object.keys(%s)",_)("for(var i=0;i<k.length;++i){"),(function(y,b,k){switch(b.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":y("if(!util.key32Re.test(%s))",k)("return%j",p(b,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":y("if(!util.key64Re.test(%s))",k)("return%j",p(b,"integer|Long key"));break;case"bool":y("if(!util.key2Re.test(%s))",k)("return%j",p(b,"boolean key"))}})(a,m,"k[i]"),h(a,m,f,_+"[k[i]]")("}")):m.repeated?(a("if(!Array.isArray(%s))",_)("return%j",p(m,"array"))("for(var i=0;i<%s.length;++i){",_),h(a,m,f,_+"[i]")("}")):(m.partOf&&(g=c.safeProp(m.partOf.name),o[m.partOf.name]===1&&a("if(p%s===1)",g)("return%j",m.partOf.name+": multiple values"),o[m.partOf.name]=1,a("p%s=1",g)),h(a,m,f,_)),m.optional&&a("}")}return a("return null")};var i=t(14),c=t(33);function p(s,a){return s.name+": "+a+(s.repeated&&a!=="array"?"[]":s.map&&a!=="object"?"{k:"+s.keyType+"}":"")+" expected"}function h(s,a,d,o){if(a.resolvedType)if(a.resolvedType instanceof i){s("switch(%s){",o)("default:")("return%j",p(a,"enum value"));for(var f=Object.keys(a.resolvedType.values),g=0;g<f.length;++g)s("case %i:",a.resolvedType.values[f[g]]);s("break")("}")}else s("{")("var e=types[%i].verify(%s,n+1);",d,o)("if(e)")("return%j+e",a.name+".")("}");else switch(a.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":s("if(!util.isInteger(%s))",o)("return%j",p(a,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":s("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",o,o,o,o)("return%j",p(a,"integer|Long"));break;case"float":case"double":s('if(typeof %s!=="number")',o)("return%j",p(a,"number"));break;case"bool":s('if(typeof %s!=="boolean")',o)("return%j",p(a,"boolean"));break;case"string":s("if(!util.isString(%s))",o)("return%j",p(a,"string"));break;case"bytes":s('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',o,o,o)("return%j",p(a,"buffer"))}return s}},{14:14,33:33}],38:[function(t,n,l){var i=t(19);l[".google.protobuf.Any"]={fromObject:function(c,p){if(c&&c["@type"]){var h,s=c["@type"].substring(1+c["@type"].lastIndexOf("/")),s=this.lookup(s);if(s)return~(h=(c["@type"][0]||"")=="."?c["@type"].slice(1):c["@type"]).indexOf("/")||(h="/"+h),this.create({type_url:h,value:s.encode(s.fromObject(c,p===u?1:p+1)).finish()})}return this.fromObject(c,p)},toObject:function(c,p){var h,s,a="",d="";return p&&p.json&&c.type_url&&c.value&&(d=c.type_url.substring(1+c.type_url.lastIndexOf("/")),a=c.type_url.substring(0,1+c.type_url.lastIndexOf("/")),(h=this.lookup(d))&&(c=h.decode(c.value))),!(c instanceof this.ctor)&&c instanceof i?(h=c.$type.toObject(c,p),s=c.$type.fullName[0]==="."?c.$type.fullName.slice(1):c.$type.fullName,h["@type"]=d=(a=a===""?"type.googleapis.com/":a)+s,h):this.toObject(c,p)}}},{19:19}],39:[function(t,n,l){n.exports=f;var i,c=t(35),p=c.LongBits,h=c.base64,s=c.utf8;function a(v,O,w){this.fn=v,this.len=O,this.next=u,this.val=w}function d(){}function o(v){this.head=v.head,this.tail=v.tail,this.len=v.len,this.next=v.states}function f(){this.len=0,this.head=new a(d,0,0),this.tail=this.head,this.states=null}function g(){return c.Buffer?function(){return(f.create=function(){return new i})()}:function(){return new f}}function m(v,O,w){O[w]=255&v}function _(v,O){this.len=v,this.next=u,this.val=O}function y(v,O,w){for(;v.hi;)O[w++]=127&v.lo|128,v.lo=(v.lo>>>7|v.hi<<25)>>>0,v.hi>>>=7;for(;127<v.lo;)O[w++]=127&v.lo|128,v.lo=v.lo>>>7;O[w++]=v.lo}function b(v,O,w){O[w]=255&v,O[w+1]=v>>>8&255,O[w+2]=v>>>16&255,O[w+3]=v>>>24}f.create=g(),f.alloc=function(v){return new c.Array(v)},c.Array!==Array&&(f.alloc=c.pool(f.alloc,c.Array.prototype.subarray)),f.prototype.N=function(v,O,w){return this.tail=this.tail.next=new a(v,O,w),this.len+=O,this},(_.prototype=Object.create(a.prototype)).fn=function(v,O,w){for(;127<v;)O[w++]=127&v|128,v>>>=7;O[w]=v},f.prototype.uint32=function(v){return this.len+=(this.tail=this.tail.next=new _((v>>>=0)<128?1:v<16384?2:v<2097152?3:v<268435456?4:5,v)).len,this},f.prototype.int32=function(v){return v<0?this.N(y,10,p.fromNumber(v)):this.uint32(v)},f.prototype.sint32=function(v){return this.uint32((v<<1^v>>31)>>>0)},f.prototype.int64=f.prototype.uint64=function(v){return v=p.from(v),this.N(y,v.length(),v)},f.prototype.sint64=function(v){return v=p.from(v).zzEncode(),this.N(y,v.length(),v)},f.prototype.bool=function(v){return this.N(m,1,v?1:0)},f.prototype.sfixed32=f.prototype.fixed32=function(v){return this.N(b,4,v>>>0)},f.prototype.sfixed64=f.prototype.fixed64=function(v){return v=p.from(v),this.N(b,4,v.lo).N(b,4,v.hi)},f.prototype.float=function(v){return this.N(c.float.writeFloatLE,4,v)},f.prototype.double=function(v){return this.N(c.float.writeDoubleLE,8,v)};var k=c.Array.prototype.set?function(v,O,w){O.set(v,w)}:function(v,O,w){for(var A=0;A<v.length;++A)O[w+A]=v[A]};f.prototype.bytes=function(v){var O,w=v.length>>>0;return w?(c.isString(v)&&(O=f.alloc(w=h.length(v)),h.decode(v,O,0),v=O),this.uint32(w).N(k,w,v)):this.N(m,1,0)},f.prototype.string=function(v){var O=s.length(v);return O?this.uint32(O).N(s.write,O,v):this.N(m,1,0)},f.prototype.fork=function(){return this.states=new o(this),this.head=this.tail=new a(d,0,0),this.len=0,this},f.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 a(d,0,0),this.len=0),this},f.prototype.ldelim=function(){var v=this.head,O=this.tail,w=this.len;return this.reset().uint32(w),w&&(this.tail.next=v.next,this.tail=O,this.len+=w),this},f.prototype.finish=function(){for(var v=this.head.next,O=this.constructor.alloc(this.len),w=0;v;)v.fn(v.val,O,w),w+=v.len,v=v.next;return O},f.c=function(v){i=v,f.create=g(),i.c()}},{35:35}],40:[function(t,n,l){n.exports=p;var i=t(39),c=((p.prototype=Object.create(i.prototype)).constructor=p,t(35));function p(){i.call(this)}function h(s,a,d){s.length<40?c.utf8.write(s,a,d):a.utf8Write?a.utf8Write(s,d):a.write(s,d)}p.c=function(){p.alloc=c.L,p.writeBytesBuffer=c.Buffer&&c.Buffer.prototype instanceof Uint8Array&&c.Buffer.prototype.set.name==="set"?function(s,a,d){a.set(s,d)}:function(s,a,d){if(s.copy)s.copy(a,d,0,s.length);else for(var o=0;o<s.length;)a[d++]=s[o++]}},p.prototype.bytes=function(s){var a=(s=c.isString(s)?c.S(s,"base64"):s).length>>>0;return this.uint32(a),a&&this.N(p.writeBytesBuffer,a,s),this},p.prototype.string=function(s){var a=c.Buffer.byteLength(s);return this.uint32(a),a&&this.N(h,a,s),this},p.c()},{35:35,39:39}]},r={},Oe=(function t(n){var l=r[n];return l||e[n][0].call(l=r[n]={exports:{}},t,l,l.exports),l.exports})([16][0])})();const Rt=4096,Ei=1<<20;let L=new Uint8Array(Rt),Ce=new DataView(L.buffer),P=0,$=0,X=0;function ki(){return P}function Ai(u){return L.slice(u,P)}function Si(u){P=u,u===0&&L.length>Ei&&(L=new Uint8Array(Rt),Ce=new DataView(L.buffer))}function J(u){if(P+u>L.length){const e=new Uint8Array(Math.max(L.length*2,P+u));e.set(L.subarray(0,P)),L=e,Ce=new DataView(e.buffer)}}function pe(u){for(;u>127;)L[P++]=u&127|128,u>>>=7;L[P++]=u}function Xe(){for(;X;)L[P++]=$&127|128,$=($>>>7|X<<25)>>>0,X>>>=7;pe($)}function Je(u){L[P++]=u&255,L[P++]=u>>>8&255,L[P++]=u>>>16&255,L[P++]=u>>>24}function Ge(u){if(u===0){$=X=0;return}const e=u<0;e&&(u=-u),$=u>>>0,X=(u-$)/4294967296>>>0,e&&(X=~X>>>0,$=~$>>>0,++$>4294967295&&($=0,++X>4294967295&&(X=0)))}function Q(u){J(5),u<128?L[P++]=u:pe(u)}function Oi(u){J(1),L[P++]=u}function Pt(u){J(5),pe(u>>>0)}function Lt(u){u|=0,J(10),u<0?($=u>>>0,X=4294967295,Xe()):pe(u)}function Ci(u){u|=0,Pt((u<<1^u>>31)>>>0)}function Dt(u){J(4),Je(u>>>0)}function Mt(u){Ge(u),J(10),Xe()}function Ii(u){Ge(u);const e=X>>31;X=((X<<1|$>>>31)^e)>>>0,$=($<<1^e)>>>0,J(10),Xe()}function qt(u){Ge(u),J(8),Je($),Je(X)}function Ti(u){J(8),Ce.setFloat64(P,u,!0),P+=8}function xi(u){J(4),Ce.setFloat32(P,u,!0),P+=4}function Ni(u){const e=u.length>>>0;J(e+5),pe(e),e&&(L.set(u,P),P+=e)}function Ke(){return J(1),P++}function Ie(u){const e=P-u-1;if(e<128){L[u]=e;return}const r=e<16384?2:e<2097152?3:e<268435456?4:5;J(r-1),L.copyWithin(u+r,u+1,P),P=u+r+e;let t=e;for(let n=0;n<r-1;n++)L[u+n]=t&127|128,t>>>=7;L[u+r-1]=t}function ji(u){const e=u.length;J(e*3+5);const r=L,t=P++;let n=P,l=0,i=0;for(;l<e&&(i=u.charCodeAt(l))<128;)r[n++]=i,l++;for(;l<e;l++)i=u.charCodeAt(l),i<128?r[n++]=i:i<2048?(r[n++]=i>>6|192,r[n++]=i&63|128):(i&64512)===55296&&(u.charCodeAt(l+1)&64512)===56320?(i=65536+((i&1023)<<10)+(u.charCodeAt(++l)&1023),r[n++]=i>>18|240,r[n++]=i>>12&63|128,r[n++]=i>>6&63|128,r[n++]=i&63|128):(r[n++]=i>>12|224,r[n++]=i>>6&63|128,r[n++]=i&63|128);P=n,Ie(t)}const Te=0,ue=1,Bt=2,Ft=3,Ht=4,Ri=5,de=Object.prototype.hasOwnProperty;function Ye(u,e){return u&&typeof u=="object"&&de.call(u,e)?u[e]:void 0}function Pi(u){return u.fields!==void 0?ue:u.values!==void 0?Bt:u.methods!==void 0?Ft:u.id!==void 0?Ht:Te}function We(u){return u===Te||u===ue||u===Ft}function xe(u,e,r){const t=Ye(u.nested,e);return t&&typeof t=="object"?{node:t,kind:Pi(t),path:r.concat(e)}:null}function Li(u,e){if(u.kind===ue){const r=Ye(u.node.fields,e);if(r)return{node:r,kind:Ht,path:u.path.concat(e)};const t=Ye(u.node.oneofs,e);if(t)return{node:t,kind:Ri,path:u.path.concat(e)}}return xe(u.node,e,u.path)}function Ze(u,e,r){const t=Li(u,e[r]);let n=null;if(t)r===e.length-1?n=t:We(t.kind)&&(n=Ze(t,e,r+1));else if(u.node.nested&&typeof u.node.nested=="object")for(const l of Object.keys(u.node.nested)){const i=xe(u.node,l,u.path);i&&We(i.kind)&&(n=Ze(i,e,r)||n)}return n}function Di(u,e){let r={node:u,kind:Te,path:[]};for(let t=0;r&&t<e.length;t++)r=We(r.kind)?xe(r.node,e[t],r.path):null;return r}function Ut(u,e,r,t){r[0]===""&&(e=[],r=r.slice(1));const n=Di(u,r);if(n&&t(n.kind))return n;const l=[{node:u,kind:Te,path:[]}];for(const i of e)l.push(xe(l[l.length-1].node,i,l[l.length-1].path));for(let i=l.length-1;i>=0;i--){const c=Ze(l[i],r,0);if(c&&t(c.kind))return c}return null}const $t=100,Mi=0,te=1,Ne=2,zt=3,Vt=4,Xt=new WeakMap,Jt=()=>{},qi=new Uint8Array(0),Bi="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",me=u=>Number.isInteger(u),ye=u=>Number.isInteger(u)||!!(u&&Number.isInteger(u.low)&&Number.isInteger(u.high)),Gt=u=>typeof u=="number",Fi=u=>typeof u=="boolean",Kt=u=>typeof u=="string"||u instanceof String,Hi=u=>!!(u&&typeof u.length=="number")||Kt(u);function ge(u,e){if(typeof u=="string")return parseInt(u,10);if(u&&typeof u=="object"){const r=u.low>>>0,t=u.high>>>0;if(!e&&t>>>31){const n=~r+1>>>0,l=n?~t>>>0:(~t>>>0)+1>>>0;return-(n+l*4294967296)}return r+t*4294967296}return u}function Ui(u){const e=new Uint8Array(Math.ceil(u.length*3/4));let r=0,t=0,n=0;for(let l=0;l<u.length;){const i=u.charAt(l++);if(i==="="&&t>1)break;const c=Bi.indexOf(i);if(c<0)throw new Error("invalid encoding");t===0?(n=c,t=1):t===1?(e[r++]=n<<2|(c&48)>>4,n=c,t=2):t===2?(e[r++]=(n&15)<<4|(c&60)>>2,n=c,t=3):(e[r++]=(n&3)<<6|c,t=0)}if(t===1)throw new Error("invalid encoding");return e.subarray(0,r)}const U=(u,e,r,t,n,l=Mi)=>({wt:u,put:e,ok:r,exp:t,def:n,vk:l}),je={double:U(1,u=>Ti(Number(u)),Gt,"number",0,Ne),float:U(5,u=>xi(Number(u)),Gt,"number",0,Ne),int32:U(0,Lt,me,"integer",0,te),uint32:U(0,Pt,me,"integer",0,te),sint32:U(0,Ci,me,"integer",0,te),fixed32:U(5,Dt,me,"integer",0,te),sfixed32:U(5,Dt,me,"integer",0,te),int64:U(0,u=>Mt(ge(u)),ye,"integer|Long",0),uint64:U(0,u=>Mt(ge(u,!0)),ye,"integer|Long",0),sint64:U(0,u=>Ii(ge(u)),ye,"integer|Long",0),fixed64:U(1,u=>qt(ge(u)),ye,"integer|Long",0),sfixed64:U(1,u=>qt(ge(u)),ye,"integer|Long",0),bool:U(0,u=>Oi(u?1:0),Fi,"boolean",!1,Vt),string:U(2,u=>ji(typeof u=="string"?u:String(u)),Kt,"string","",zt),bytes:U(2,u=>Ni(typeof u=="string"?Ui(u):u),Hi,"buffer",qi)};function Yt(u){return`${u.owner.full}.${u.name}`}function $i(u){return new TypeError(`${Yt(u)}: array expected`)}function Qe(u){return new TypeError(`${Yt(u)}: object expected`)}function et(u,e){if(!e)return null;if(!Array.isArray(e))throw $i(u);return e.length?e:null}function tt(u,e,r){if(typeof e!="object"||e===null)throw Qe(u);const t=Ke();Wt(u.child,e,r+1),Ie(t)}function zi(u,e){Q(u.tag),u.put(e)}function Vi(u,e){const r=et(u,e);if(r){Q(u.tag);const t=Ke();for(let n=0;n<r.length;n++)u.put(r[n]);Ie(t)}}function Xi(u,e){const r=et(u,e);if(r)for(let t=0;t<r.length;t++)Q(u.tag),u.put(r[t])}function Ji(u,e,r){if(typeof e!="object")throw Qe(u);Q(u.tag),tt(u,e,r)}function Gi(u,e,r){const t=et(u,e);if(t)for(let n=0;n<t.length;n++)Q(u.tag),tt(u,t[n],r)}function Ki(u,e,r){if(!e)return;if(typeof e!="object")throw Qe(u);const t=Object.keys(e);for(let n=0;n<t.length;n++){Q(u.tag);const l=Ke();Q(u.ktag),u.kput(t[n]),Q(u.vtag),u.child?tt(u,e[t[n]],r):u.put(e[t[n]]),Ie(l)}}function Wt(u,e,r){if(r>$t)throw new Error("maximum nesting depth exceeded");const t=u.fields;for(let n=0;n<t.length;n++){const l=t[n];let i=e[l.name];if(i==null){if(!l.required)continue;i=l.def}l.write(l,i,r)}}function ce(u,e){return`${u.name}: ${e}${u.repeated&&e!=="array"?"[]":u.keyType&&e!=="object"?`{k:${u.keyType}}`:""} expected`}const Yi=/^-?(?:0|[1-9][0-9]*)$/,Wi=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,Zi=/(?:^true)|false|0|(?:1$)/;function Zt(u,e){switch(u.vk){case te:return Number.isInteger(e);case Ne:return typeof e=="number";case zt:return typeof e=="string"||e instanceof String;case Vt:return typeof e=="boolean";default:return u.ok(e)}}function rt(u,e,r){if(u.child){const t=Qt(u.child,e,r+1);return t&&`${u.name}.${t}`}return Zt(u,e)?null:ce(u,u.exp)}function Qi(u,e,r){let t=0;if(u.vk===te)for(;t<e.length&&Number.isInteger(e[t]);)t++;else if(u.vk===Ne)for(;t<e.length&&typeof e[t]=="number";)t++;else{for(let n;t<e.length;t++)if(n=rt(u,e[t],r))return n;return null}return t<e.length?ce(u,u.exp):null}function en(u,e,r,t){let n=null;if(u.keyType){if(!r||typeof r!="object")return ce(u,"object");const l=Object.keys(r);for(let i=0;!n&&i<l.length;i++)n=u.kre&&!u.kre.test(l[i])?ce(u,u.kexp):rt(u,r[l[i]],t)}else if(u.repeated){if(!Array.isArray(r))return ce(u,"array");n=Qi(u,r,t)}else{for(let l=0;l<u.prior.length;l++)if(e[u.prior[l].name]!=null&&de.call(e,u.prior[l].name))return`${u.oneof}: multiple values`;n=rt(u,r,t)}return n}function Qt(u,e,r){if(typeof e!="object"||e===null)return"object expected";if(r>$t)return"maximum nesting depth exceeded";const t=u.vfields;for(let n=0;n<t.length;n++){const l=t[n],i=e[l.name];if(l.required||i!=null&&de.call(e,l.name)){const c=l.plain?Zt(l,i)?null:ce(l,l.exp):en(l,e,i,r);if(c)return c}}return null}const er=U(2,Jt,()=>!0,"",void 0);function tn(u,e,r,t,n,l){const i=t.keyType!==void 0,c=!i&&t.rule==="repeated";let p=de.call(je,t.type)?je[t.type]:er,h=null;if(p===er){const f=Ut(u.root,e.path,t.type.split("."),g=>g===ue||g===Bt);if(!f)throw new Error(`no such Type or Enum '${t.type}' in Type ${e.full}`);if(f.kind===ue){if(f.node.group)throw new Error(`${t.type}: groups are not supported`);h=tr(u,f)}else{const g=f.node.values,_=Object.keys(g).map(y=>g[y]);p=U(0,y=>Lt(typeof y=="string"?de.call(g,y)?g[y]:_[0]:y),y=>_.indexOf(y)>=0,"enum value",_[0])}}const s=t.options&&t.options.packed,a=c&&!h&&p.wt!==2&&(s===void 0?e.packed:s===!0),d=i?t.keyType:"";return{name:r,id:t.id,tag:(t.id<<3|(i||h||a?2:p.wt))>>>0,write:i?Ki:h?c?Gi:Ji:c?a?Vi:Xi:zi,put:p.put,ok:p.ok,vk:p.vk,exp:p.exp,required:t.rule==="required",repeated:c,def:c||i?void 0:p.def,child:h,owner:e,keyType:d,kre:d==="bool"?Zi:/64$/.test(d)?Wi:d&&d!=="string"?Yi:null,kexp:d==="bool"?"boolean key":/64$/.test(d)?"integer|Long key":"integer key",ktag:i?8|je[d].wt:0,kput:i?je[d].put:Jt,vtag:16|(h?2:p.wt),oneof:n,prior:l.slice(),plain:!i&&!c&&!h&&!l.length}}function tr(u,e){const r=e.path.join(".");let t=u.plans.get(r);if(t)return t;t={path:e.path,full:`.${r}`,fields:[],vfields:[],packed:e.node.edition!=="proto2"},u.plans.set(r,t);const n=e.node,l=new Map,i=n.oneofs||{};for(const p of Object.keys(i))for(const h of i[p].oneof||[])de.call(n.fields,h)&&!l.has(h)&&l.set(h,p);const c=new Map;for(const p of Object.keys(n.fields)){const h=l.get(p)||"",s=c.get(h)||[],a=tn(u,t,p,n.fields[p],h,h?s:[]);h&&(s.push(a),c.set(h,s)),t.vfields.push(a)}return t.fields=t.vfields.slice().sort((p,h)=>p.id-h.id),t}let rr,ir="",nr;function it(u,e){if(u===rr&&e===ir)return nr;let r=Xt.get(u);r||(r={root:u,plans:new Map,names:new Map},Xt.set(u,r));let t=r.names.get(e);if(!t){const n=Ut(r.root,[],e.split("."),l=>l===ue);if(!n)throw new Error(`no such type: ${e}`);try{t=tr(r,n)}catch(l){throw r.plans.clear(),l}r.names.set(e,t)}return rr=u,ir=e,nr=t,t}function sr(u,e,r){const t=it(u,e),n=ki();try{return Wt(t,r,0),Ai(n)}finally{Si(n)}}function or(u,e,r,t){return Qt(it(u,e),r,0)}function rn(u,e){return it(u,e).full}let Re;function nn(){if(Re===void 0)try{Re=Oe.util.codegen(["a"],"o11yEvalProbe")("return a === true")()(!0)}catch(u){Re=!1}return Re}function nt(u){return!!u&&!nn()}class sn{constructor(){this._typeStore=new Map}getSchemaType(e){E.requireArgument(e,"schema");const r=M.getSchemaId(e);let t=this._typeStore.get(r);return t||(t=Oe.Root.fromJSON(e.pbjsSchema).lookupType(r),this._typeStore.set(r,t)),t}validate(e,r,t){if(E.requireArgument(e,"schema"),E.requireArgument(r,"data"),nt(t)){const i=M.getSchemaId(e),c=or(e.pbjsSchema,i,r);if(c)throw new Error(`Data is invalid for ${rn(e.pbjsSchema,i)}: ${c}`);return}const n=this.getSchemaType(e),l=n.verify(r);if(l)throw new Error(`Data is invalid for ${n.fullName}: ${l}`);return n}encode(e,r,t){const n=this.validate(e,r,t);if(nt(t))return sr(e.pbjsSchema,M.getSchemaId(e),r);const l=n.fromObject(r);return n.encode(l).finish()}encodePayload(e,r){if(e!=null&&e.schema&&e.payload)return{schemaName:M.getSchemaId(e.schema),payload:this.encode(e.schema,e.payload,r)}}getLogMessage(e,r,t,n){return{timestamp:t.timestamp,data:this.encode(e,r,n),age:t.age,rootId:t.rootId,seq:t.sequence,sseq:t.schemaSequence,loggerName:t.loggerName,pagePayload:this.encodePayload(t.pagePayload,n),loggerAppName:t.loggerAppName,connectionType:t.connectionType,appPayload:this.encodePayload(t.appPayload,n),csId:t.clientSessionId,recCsId:t.receiverClientSessionId,recRootId:t.receiverRootId,tenantClass:t.tenantClass}}processRawLogMessage(e,r,t){const n=r.data?Object.assign({},r.data):{};return M.isInternal(e)&&n.userPayload&&(n.userPayload=this.encodePayload(n.userPayload,t)),Object.assign({},r,{data:this.encode(e,n,t),pagePayload:this.encodePayload(r.pagePayload,t),appPayload:this.encodePayload(r.appPayload,t)})}}const ar=new sn;let st;function on(){return st||(st=Oe.Root.fromJSON(_e.pbjsSchema).lookupType("CoreEnvelope")),st}function lr(u){return le.buildFrom(u)}function ur(u,e){if(nt(e)){const l=_e.pbjsSchema,i=or(l,"CoreEnvelope",u);if(i)throw new Error(`Invalid CoreEnvelope: ${i}`);return sr(l,"CoreEnvelope",u)}const r=on(),t=r.verify(u);if(t)throw new Error(`Invalid CoreEnvelope: ${t}`);return r.encode(u).finish()}var Z;(function(u){u[u.fetchBinary=0]="fetchBinary",u[u.fetchFile=1]="fetchFile",u[u.noUpload=2]="noUpload"})(Z||(Z={}));const dr="telemetry",an=1e4,cr=1e4,ln=10,un=10,fr=Z.fetchBinary;class dn{constructor(e,r,t,n){this._messagesLimit=ln,this._metricsLimit=un,this._formDataKey=dr,this._uploadInterval=cr,this._messageSize=0,this._evalFreeFallback=!1,this.uploadEndpoint=e,this.uploadMode=r==null?fr:r,t&&(this._staticAttributes={appName:t.appName,appVersion:t.appVersion,appExperience:t.appExperience,deviceId:t.deviceId,deviceModel:t.deviceModel,sdkVersion:t.sdkVersion});let l=an;if(n){const i=n.maxUniqueSchemas;if(i!==void 0){if(typeof i!="number"||!(i>0))throw new Error("options.maxUniqueSchemas, if defined, must be > 0");l=i}const c=n.messagesLimit;if(c!==void 0){if(typeof c!="number"||!(c>0))throw new Error("options.messagesLimit, if defined, must be > 0");this._messagesLimit=c}const p=n.metricsLimit;if(p!==void 0){if(typeof p!="number"||!(p>0))throw new Error("options.metricsLimit, if defined, must be > 0");this._metricsLimit=p}E.requireArgumentIfDefined(n.formDataKeyName,"options.formDataKeyName","string")&&(this._formDataKey=n.formDataKeyName),E.requireArgumentIfDefined(n.uploadFailedListener,"options.uploadFailedListener","function")&&(this._uploadFailedListener=n.uploadFailedListener),E.requireArgumentIfDefined(n.apiKey,"options.apiKey","string")&&(this._apiKey=n.apiKey),E.requireArgumentIfDefined(n.useEvalFreeEncoder,"options.useEvalFreeEncoder","boolean")&&(this._evalFreeFallback=n.useEvalFreeEncoder)}this._messageBuffers=new vr(l),this._emptySize=this.getByteSize(1),this._restartTimer()}get uploadInterval(){return this._uploadInterval}set uploadInterval(e){if(e===void 0&&(e=cr),typeof e!="number"||!(e>0))throw new Error("uploadInterval, if defined, must be > 0");e!==this._uploadInterval&&(this._uploadInterval=e,this._restartTimer())}get uploadEndpoint(){return this._uploadEndpoint}set uploadEndpoint(e){E.requireArgumentIfDefined(e,"uploadEndpoint","string"),this._uploadEndpoint=e}get uploadOptionsCallback(){return this._uploadOptionsCallback}set uploadOptionsCallback(e){E.requireArgumentIfDefined(e,"uploadOptionsCallback","function"),this._uploadOptionsCallback=e}get uploadMode(){return this._uploadMode}set uploadMode(e){if(E.requireArgumentIfDefined(e,"uploadMode","number"),e===void 0&&(e=fr),!(e in Z))throw new Error(`Unsupported upload mode: ${e}`);this._uploadMode=e}getByteSize(e){return e>=1?this._buildProtoEncodedCoreEnvelope(!1).byteLength:e>=.5?this._emptySize+this._messageSize+this.metricsCount*8:this._emptySize+this._messageSize}_stopTimer(){this._intervalHandle!==void 0&&(clearInterval(this._intervalHandle),this._intervalHandle=void 0)}_restartTimer(){this._stopTimer(),this._intervalHandle=setInterval(()=>{this.hasData&&this._upload()},this._uploadInterval)}collect(e,r,t){return re(this,null,function*(){M.isInternal(e)&&r.userPayload&&(r.userPayload=ar.encodePayload(r.userPayload,this._evalFreeFallback));const n=ar.getLogMessage(e,r,t,this._evalFreeFallback);if(!this._messageBuffers.push(e,n))throw new Error(`Buffer is full. Refusing schemaId ${M.getSchemaId(e)}`);if(this._messageSize+=E.estimateObjectSize(n),this._shouldUpload())return this._upload()})}_shouldUpload(){return this._immediateUpload&&this.hasData||this.messagesCount>=this._messagesLimit||this.metricsCount>=this._metricsLimit}_upload(e){return re(this,null,function*(){if(this._restartTimer(),!this._uploadEndpoint||this._uploadMode===Z.noUpload)return;const r=this._getContentsOfCoreEnvelope(!0);return this._uploadContents(r,e)})}_uploadContents(e,r){return re(this,null,function*(){let t=this._getRequestInit(e);const n={envelopeContents:e};try{if(this._apiKey&&(t.headers["x-o11y-api-key"]=this._apiKey),this._uploadOptionsCallback){const l=this._uploadOptionsCallback()||{};if(l){if(l.headers&&t.headers)if(l.headers instanceof Headers)for(const i in t.headers)Object.prototype.hasOwnProperty.call(t.headers,i)&&l.headers.set(i,t.headers[i]);else{if(Array.isArray(l.headers))throw new Error("Headers as array is not supported.");Object.assign(l.headers,t.headers)}l.method=t.method,l.body=t.body,t=l}}if(n.response=yield fetch(this._uploadEndpoint,t),!n.response.ok)throw new Error("HTTP Not OK");return n}catch(l){if(n.error=l,!r&&this._uploadFailedListener)try{this._uploadFailedListener(n)}catch(i){}throw n}})}_getRequestInit(e){const r=lr(e),t=ur(r,this._evalFreeFallback);let n;switch(this._uploadMode){case Z.fetchBinary:n={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t};break;case void 0:case Z.fetchFile:if(typeof FormData!="function")throw new Error("FormData is not a function in the global namespace.");const l=new FormData;l.append(this._formDataKey||dr,new Blob([t])),n={method:"POST",body:l};break;case Z.noUpload:default:throw new Error("Invalid uploadMode")}return n}_checkUploadState(){if(this._uploadEndpoint===void 0)throw new Error("Upload endpoint is unset");if(this._uploadMode===Z.noUpload)throw new Error("Upload mode is unset")}upload(e){return re(this,null,function*(){return this._checkUploadState(),E.requireArgumentIfDefined(e,"contents","object")?this._uploadContents(e,!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 e=0;return this._metricsExtractors&&(e+=this._metricsExtractors.getAllUpCounters().length||0,e+=this._metricsExtractors.getAllValueRecorders().length||0,e+=this._metricsExtractors.getAllBucketHistograms().length||0),e}getProtoEncodedCoreEnvelope(){return this._buildProtoEncodedCoreEnvelope(!0)}getContentsOfCoreEnvelope(){return this._getContentsOfCoreEnvelope(!0)}_getContentsOfCoreEnvelope(e){const r={staticAttributes:this._staticAttributes,messages:this._messageBuffers.getAllMessages(e)};return this._metricsExtractors&&(r.upCounters=le.getUpCounters(this._metricsExtractors.getAllUpCounters(),e),r.valueRecorders=le.getValueRecorders(this._metricsExtractors.getAllValueRecorders(),e),r.bucketHistograms=le.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms(),e)),e&&(this._messageSize=0),r}_buildProtoEncodedCoreEnvelope(e){const r=this._getContentsOfCoreEnvelope(e),t=lr(r);return ur(t,this._evalFreeFallback)}receiveMetricsExtractors(e){this._metricsExtractors=e}}const cn={namespace:"sf.embeddedMessaging",name:"FailureEvent",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{FailureEvent:{oneofs:{_participantType:{oneof:["participantType"]},_convEntryId:{oneof:["convEntryId"]}},fields:{convId:{id:4,type:"string"},method:{id:2,type:"string"},clientName:{id:10,type:"string"},errCode:{id:5,type:"uint32"},jwtClaims:{id:8,type:"string"},participantType:{options:{proto3_optional:!0},id:11,type:"string"},hostUrl:{id:9,type:"string"},convType:{id:7,type:"string"},errMessage:{id:3,type:"string"},configDev:{id:1,type:"string"},convEntryId:{options:{proto3_optional:!0},id:6,type:"string"}}}}}}}}}},fn={namespace:"sf.embeddedMessaging",name:"InteractionEvent",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{InteractionEvent:{oneofs:{_participantType:{oneof:["participantType"]}},fields:{convId:{id:5,type:"string"},op:{id:4,type:"string"},method:{id:2,type:"string"},feature:{id:3,type:"string"},fileSize:{id:6,type:"uint32"},clientName:{id:11,type:"string"},jwtClaims:{id:9,type:"string"},participantType:{options:{proto3_optional:!0},id:12,type:"string"},fileMimeType:{id:7,type:"string"},hostUrl:{id:10,type:"string"},convType:{id:8,type:"string"},configDev:{id:1,type:"string"}}}}}}}}}},hn={namespace:"sf.embeddedMessaging",name:"CurrentState",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{CurrentState:{oneofs:{_participantType:{oneof:["participantType"]},_convEntryId:{oneof:["convEntryId"]}},fields:{convId:{id:4,type:"string"},method:{id:2,type:"string"},clientName:{id:9,type:"string"},jwtClaims:{id:7,type:"string"},stateMessage:{id:3,type:"string"},participantType:{options:{proto3_optional:!0},id:10,type:"string"},hostUrl:{id:8,type:"string"},convType:{id:6,type:"string"},configDev:{id:1,type:"string"},convEntryId:{options:{proto3_optional:!0},id:5,type:"string"}}}}}}}}}};B.CoreCollector=dn,B.currentStateSchema=hn,B.failureEventSchema=cn,B.interactionEventSchema=fn,B.registerInstrumentedApp=_i,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));