@cimulate/copilot-widget 1.58.2 → 1.60.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.
- package/CHANGELOG.md +12 -0
- package/README.md +87 -3
- package/dist/cimulate-copilot-widget.d.ts +289 -1
- package/dist/cimulate-copilot-widget.es.js +7461 -7378
- package/dist/cimulate-copilot-widget.umd.js +29 -29
- package/dist/{client-DaAK0txn.js → client-C4_HVnQ6.js} +156 -146
- package/dist/copilot.es.js +7459 -7376
- package/dist/copilot.umd.js +29 -29
- package/dist/locales/da-DK.json +238 -0
- package/dist/locales/de-DE.json +238 -0
- package/dist/locales/en-US.json +237 -0
- package/dist/locales/es-ES.json +238 -0
- package/dist/locales/es-MX.json +238 -0
- package/dist/locales/fi-FI.json +238 -0
- package/dist/locales/fr-FR.json +238 -0
- package/dist/locales/it-IT.json +238 -0
- package/dist/locales/ja-JP.json +238 -0
- package/dist/locales/ko-KR.json +234 -0
- package/dist/locales/nb-NO.json +238 -0
- package/dist/locales/nl-NL.json +238 -0
- package/dist/locales/pl.json +238 -0
- package/dist/locales/pt-BR.json +238 -0
- package/dist/locales/sv-SE.json +238 -0
- package/dist/locales/zh-CN.json +230 -0
- package/dist/locales/zh-TW.json +230 -0
- package/dist/messaging.d.ts +307 -1
- package/dist/messaging.es.js +10853 -10673
- package/dist/messaging.umd.js +38 -38
- package/dist/o11y-sdk.umd.js +2 -2
- package/package.json +3 -2
package/dist/o11y-sdk.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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 Vi=Object.defineProperty,Xi=Object.defineProperties;var Ji=Object.getOwnPropertyDescriptors;var kr=Object.getOwnPropertySymbols;var Gi=Object.prototype.hasOwnProperty,Ki=Object.prototype.propertyIsEnumerable;var Ar=(B,F,H)=>F in B?Vi(B,F,{enumerable:!0,configurable:!0,writable:!0,value:H}):B[F]=H,Q=(B,F)=>{for(var H in F||(F={}))Gi.call(F,H)&&Ar(B,H,F[H]);if(kr)for(var H of kr(F))Ki.call(F,H)&&Ar(B,H,F[H]);return B},be=(B,F)=>Xi(B,Ji(F));var te=(B,F,H)=>new Promise((De,we)=>{var Be=Y=>{try{ie(H.next(Y))}catch(W){we(W)}},Ee=Y=>{try{ie(H.throw(Y))}catch(W){we(W)}},ie=Y=>Y.done?De(Y.value):Promise.resolve(Y.value).then(Be,Ee);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"}}}}}}}}}},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"}}}}}}}}}},we={namespace:"sf.instrumentation",name:"Network",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Network:{fields:{mtd:{id:1,type:"string"},url:{id:2,type:"string"}}}}}}}}}},Be={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"}}}}}}}}}},Ee={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"}}}}}}}}}},Y={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 W{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 W._isProduction}markProduction(e){W._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 u=t!==void 0;if(!n&&u&&(n=!this._checkArgument(e,t)),n)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(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 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 n(u){if(!u||u.nodeType!==1)return[""];const i=t(u)>1||r(u)?`${u.localName.toLowerCase()}[${t(u)}]`:u.localName.toLowerCase();return[...n(u.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 u=t.pop();if(typeof u=="boolean")n+=4;else if(typeof u=="string")n+=u.length*2;else if(typeof u=="number")n+=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)n+=u.byteLength;else if(typeof u=="object"){const i=u;if(!r.has(i)){r.add(i);for(const d in i)t.push(i[d])}}}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 u=t?"external":"internal",i=n?"external":"internal";throw new Error(`Parent activity type mismatch: ${u} activity cannot have ${i} parent.`)}}}W._isProduction=!0;const qe=new W,Fe=qe.getGlobal();qe.markProduction(Fe==null?void 0:Fe.__O11Y_IS_PROD__);const E=Object.freeze(qe);class He{constructor(e,r,t,n,u,i,d){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=n,this._value=0,this._createdOn=u===void 0?E.time().tsNow:u,i!==void 0&&(this._lastUpdatedOn=i),d!==void 0&&(this._value=d)}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 Sr="co11y";class Cr{constructor(){this._upCounters=new Map,this._ownerAppName=Sr}_addOrUpdateCounter(e,r,t){if(!e)return;const n={status:t},u=`${this._ownerAppName}:${r}:${e}${JSON.stringify(n)}`;let i=this._upCounters.get(u);i||(i=new He(e,r,this._ownerAppName,n),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 se=new Cr;class Or{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 Ir{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 u=t.nested;if(u){const i=u[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 u=this.getType(e,r);if(!t)return u.options;const i=u.fields[t];if(!i){const d=this.getSchemaId(e);throw new Error(`Cannot locate field ${t} in message ${r} in schema with ID ${d}`)}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(h=>!i.has(h)):[]}}const D=new Ir,Ue=1e4,ft=1e4,pt=0,mt=2147483647,yt=-2147483648,Tr=4294967295,xr=9223372036854776e3,Nr=-9223372036854776e3,Rr=18446744073709552e3;class gt{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,u)=>Number(u)>=0?`${n}[${u}]`:`${n}.${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 jr{validate(e,r,t=!1){const n=D.checkSchema(e);E.requireArgument(r,"data","object");const u=D.getSchemaId(e),i=new Array,d=D.getTypes(e);if(this._validateFields(i,[],r,d[n.message],e.pbjsSchema.nested,u,[n.domain,n.feature,n.message]),i.length&&!t)throw new Error(i[0].asMessage(u));return i}_validateFields(e,r,t,n,u,i,d){const h=n.oneofs||{},p=n.fields||{};for(const s in t){const a=t[s];if(a!=null){const c=(l,f,g)=>this._matchFieldTypes(e,[...r,s],a,l,u,i,d,f,g);h[s]?c(p[h[s].oneof[0]].type):p[s]&&c(p[s].type,p[s].rule==="repeated")}}}_matchFieldTypes(e,r,t,n,u,i,d,h,p){let s;if(h)Array.isArray(t)?(t.length>ft&&(s=7),t.forEach((a,c)=>{this._matchFieldTypes(e,[...r,c.toString()],a,n,u,i,d,void 0,!0)})):s=1;else if(t==null||t===void 0)p&&(s=13);else{let a,c,l;switch(n){case"string":c="string",t.length>Ue&&(s=6);break;case"bytes":c="object",t instanceof Uint8Array||(s=5);break;case"bool":c="boolean";break;case"uint32":c="number",a={min:pt,max:Tr,isInt:!0,isItem:p};break;case"int32":case"sint32":case"fixed32":case"sfixed32":c="number",a={min:yt,max:mt,isInt:!0,isItem:p};break;case"uint64":c="number",a={min:pt,max:Rr,isInt:!0,isItem:p};break;case"fixed64":case"sfixed64":case"int64":case"sint64":c="number",a={min:Nr,max:xr,isInt:!0,isItem:p};break;case"double":case"float":c="number",a={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,isInt:!1,isItem:p};break;default:{const f=n.startsWith("."),g=(f?n.slice(1):n).split(".");let m,_;for(let y=f?0:d.length;y>=0;y--){_=[...d.slice(0,y),...g];let b=u;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?(c="number",l=Object.values(m.values),a={min:yt,max:mt,isInt:!0,isItem:p}):m&&"fields"in m&&(this._validateFields(e,r,t,m,u,i,_),c="object");break}}typeof t!==c?e.push(new gt(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)||l&&!l.includes(t))&&(s=4))}s&&e.push(new gt(s,r))}}const vt=new jr;class Pr{_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 Z=Object.freeze(new Pr);class Lr{checkInputs(e,r){D.checkSchema(e),E.requireArgument(r,"data","object");let t,n;r.userPayload!==void 0&&D.isInternal(e)&&(n=r.userPayload,t=vt.validate(n.schema,n.payload,!0),this._processValidationResults(D.getSchemaId(n.schema),n.payload,t),r.userPayload=void 0),t=vt.validate(e,r,!0),this._processValidationResults(D.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&&D.isInternal(e)&&t.push(...D.getExtraFields(n.schema,n.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 n=0;n<t.length;n+=1){const u=t[n];if(u.errorCode==6||u.errorCode==7){const i=u.fields.length-1,d=this._traverseFields(r,u.fields.slice(0,i)),h=u.fields[i];u.errorCode==6?d[h]=d[h].substring(0,Ue):d[h].splice(ft)}else throw new Error(u.asMessage(e))}}_traverseFields(e,r){return r.length?this._traverseFields(e[r[0]],r.slice(1)):e}}const ke=Object.freeze(new Lr),_t="o11y";class bt{constructor(e){this._errorCounter=e,this._safeCatchMode=!1}_callCo11y(e,r){r?se.exception(e==null?void 0:e.op,_t):se.success(e==null?void 0:e.op,_t)}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(u){return n=!0,this._prodSafeCatch(u),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 Mr=Symbol("o11y.stampTenantClass");class Dr{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 Br=300;class qr{constructor(e){this._taskers=new Map,this._listeners=new Set,this._busyCheckers=new Map,this._logThreshold=Br,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 Dr(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],u=r[1];try{return n()}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 n=this._endedTasks.splice(0),u=this._pollableReport.splice(0);this._notify(t,r,n,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,n){var u;if(r>=this._logThreshold&&this._reportListener){const d=this._getReport(r,e.length,t,n);this._reportListener(d)}e.reverse();const i=E.time().tsNow;for(const[d,h]of e.entries())try{h(i)}catch(p){(u=this._errorListener)===null||u===void 0||u.call(this,p,`Listener #${e.length-1-d}`),E.noProdThrow(p)}}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 u=t.map(i=>({name:i.name,duration:i.end-i.start})).sort((i,d)=>d.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:n.map(i=>i.name),pollCounts:n.map(i=>i.count)}}}const Fr={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"}}}}}}}}}},Hr={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 Ur{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,u=-1;for(let i=0;i<t.length;i++){const{fuzzyKey:d}=t[i],h=Math.abs(d-r);h<=this._fuzzyKeyRange&&h<n&&(n=h,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 $r=["fetch","xmlhttprequest"];class zr{constructor(e,r,t,n,u){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(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 Ur(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},u=e.serverTiming;return Array.isArray(u)&&(n.dbDuration=(r=u.find(i=>i.name==="db"))===null||r===void 0?void 0:r.duration,n.srvDuration=(t=u.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:$r.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 u={id:t},i={perfStartOverride:r.startTime,perfStopOverride:r.startTime+r.duration,errorCount:n};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 n=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(Hr,Object.assign(n,u))}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 u=this._resourceEntryToResourceTiming(t);Object.assign(u,{srvReqId:n==null?void 0:n.requestId,xhrDelay:this._calculateXhrDelay(t,n)}),u.responseStatus===void 0&&(u.responseStatus=n==null?void 0:n.responseStatus),this._logActivity(Fr,u,n==null?void 0:n.activityId,n==null?void 0:n.errorCount)}}}}const Vr=32,Xr=16,wt=16,Jr="traceparent",Gr="b3",Et="X-B3-TraceId",kt="X-B3-SpanId",At="X-B3-Sampled",St="X-B3-ParentSpanId",Ct="X-SFDC-Request-Id",Kr="baggage",Yr="fetch",Wr="xhr_send",Zr="perf-timing",Qr=50,en=[Kr,Et,kt,St,At],re=new WeakMap;class O{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 u=`${e}-${r}`;return(t!==void 0||n!==void 0)&&(u+=t?"-1":"-0",n!==void 0&&(u+=`-${n}`)),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 n=0;n<t;n+=1){const u=e[n];if(!(u>="a"&&u<="f")&&!(u>="0"&&u<="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){O._userHeaders={};return}Object.entries(e).forEach(([r])=>{en.includes(r)||delete e[r]}),O._userHeaders=e}static getHeaders(e,r,t,n){E.requireArgument(r,"spanId","string");const u=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:u?Xr:Vr),r=this._conformTextAsId(r,wt);const d=n&&n.parentSpanId!==void 0&&this._conformTextAsId(n.parentSpanId,wt)||void 0;return u?(n==null?void 0:n.useCompactHeader)?i[Gr]=this._getB3CompactFormat(e,r,t,d):(i[Et]=e,i[kt]=r,d!==void 0&&(i[St]=d),t!==void 0&&(i[At]=t?"1":"0")):i[Jr]=this._getW3CompactFormat(e,r,t),i}_disableNetworkInstrumentation(){O._isNetworkInstrumentationEnabled&&(O._originalFetch&&(O._global.fetch=O._originalFetch,O._originalFetch=void 0),O._originalXhr&&(O._global.XMLHttpRequest=O._originalXhr,O._originalXhr=void 0),O._originalXhrOpen&&(O._global.XMLHttpRequest.prototype.open=O._originalXhrOpen,O._originalXhrOpen=void 0),O._originalXhrSetRequestHeader&&(O._global.XMLHttpRequest.prototype.setRequestHeader=O._originalXhrSetRequestHeader,O._originalXhrSetRequestHeader=void 0),O._originalXhrSend&&(O._global.XMLHttpRequest.prototype.send=O._originalXhrSend,O._originalXhrSend=void 0),O._performanceObservability&&(O._performanceObservability.stop(),O._performanceObservability=void 0),O._isNetworkInstrumentationEnabled=!1)}_enableNetworkInstrumentation(e,r,t,n,u,i,d,h,p,s){typeof O._global.fetch=="function"&&(this._overrideFetch(e,r,t,n,u,i,p),O._isNetworkInstrumentationEnabled=!0),typeof O._global.XMLHttpRequest=="function"&&(this._overrideXhr(e,r,t,n,u,i,p),O._isNetworkInstrumentationEnabled=!0),d&&(O._performanceObservability=new zr(e,s,p,h,d===!0?"full":d),O._performanceObservability.start(),O._isNetworkInstrumentationEnabled=!0)}static _getTraceHeaders(e,r,t,n,u){let i;if(e)i=e.getTraceHeaders(t)||{};else{const d=r.internalInstrumentationContext;d!=null&&d.rootId?i=O.getHeaders(d.rootId,E.generateUniqueId(),d.isRootActivitySampled,t):i={}}if(typeof(t==null?void 0:t.headerProcessor)=="function")i=t.headerProcessor({method:n,url:u,defaultHeaders:i});else if(typeof window=="object"){let d;try{d=new URL(u)}catch(h){}d&&d.host!==window.location.host&&(i=void 0)}return O._userHeaders&&Object.keys(O._userHeaders).length>0&&(i=Q({},i),Object.entries(O._userHeaders).forEach(([d,h])=>{i[d]=h}),O._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(u=>u[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,u,i,d){O._originalFetch=O._global.fetch;const h=(p,s,...a)=>te(this,null,function*(){var c;let l,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||O._shouldSkipUrl(d,p),!y)l=e.startActivity(t||Yr);else if(v){O._reqIndex+=1;try{if(p instanceof URL)p.searchParams.append("o11y",O._reqIndex.toString());else if(typeof p=="string"){const C=new URL(p),w=`o11y=${O._reqIndex}`;C.search+=C.search.startsWith("?")?`&${w}`:w,p=C.toString()}}catch(C){}}if(s==null||delete s.o11y,f=p==null?void 0:p.toString(),g=E.tryGetAbsoluteUrl(f),n){p instanceof Request&&(m||(m=p.method),f=p.url,g=E.tryGetAbsoluteUrl(f));const C=O._getTraceHeaders(l,e,u,m,g);!this._applyTraceHeaders(p,s,C)&&s===void 0&&(s={headers:C})}return _=E.perfNow(),b=yield O._originalFetch.call(O._global,p,s,...a),b}catch(k){throw r&&!y&&(l?l.error(k):e.error(k)),k}finally{try{const k=O._endActivity(l,f,m);if(!((c=O._performanceObservability)===null||c===void 0)&&c.isStarted){const C={requestId:O._extractHeader(Ct,p,s),activityDuration:k,activityId:l==null?void 0:l.getId(),errorCount:l==null?void 0:l.getErrorCount(),responseStatus:b==null?void 0:b.status};O._performanceObservability.addEntry(g,_,C)}}finally{i==null||i.done()}}});O._global.fetch=h}static _endActivity(e,r,t){var n;if(e)return!((n=O._performanceObservability)===null||n===void 0)&&n.isStarted?e.discard():e.stop(we,{mtd:t,url:r}),e.getStopPerfTime()-e.getStartPerfTime()}_overrideXhr(e,r,t,n,u,i,d){O._originalXhr=O._global.XMLHttpRequest,O._originalXhrOpen=O._originalXhr.prototype.open,O._originalXhrSetRequestHeader=O._originalXhr.prototype.setRequestHeader,O._originalXhrSend=O._originalXhr.prototype.send;function h(s,a){var c;const l=re.get(s);if(l){const f=l.activity,g=O._endActivity(f,l.url,l.method);!a&&(!((c=O._performanceObservability)===null||c===void 0)&&c.isStarted)&&O._performanceObservability.addEntry(l.absoluteUrl,l.sendTime,{requestId:l.requestId,activityDuration:g,activityId:f==null?void 0:f.getId(),errorCount:f==null?void 0:f.getErrorCount(),responseStatus:s.status})}}O._originalXhr.prototype.open=function(s,a,c,l,f){const g={method:s,url:a==null?void 0:a.toString()};re.set(this,g),g.absoluteUrl=E.tryGetAbsoluteUrl(g.url),g.suspendInstrumentation=O._shouldSkipUrl(d,g.absoluteUrl),O._originalXhrOpen.apply(this,arguments)},O._originalXhr.prototype.setRequestHeader=function(s,a){var c;if(((c=s==null?void 0:s.toLowerCase)===null||c===void 0?void 0:c.call(s))===Ct.toLowerCase()){const l=re.get(this);l&&(l.requestId=a)}O._originalXhrSetRequestHeader.apply(this,arguments)},O._originalXhr.prototype.send=function(...s){let a;const c=this;let l=re.get(c);l||(l={},re.set(c,l));try{if(i==null||i.add(),l.suspendInstrumentation||(l.activity=a=e.startActivity(t||Wr)),n){const f=O._getTraceHeaders(a,e,u,l.method,l.absoluteUrl);Object.entries(f).forEach(g=>{c.setRequestHeader(g[0],g[1])})}l.sendTime=E.perfNow(),O._originalXhrSend.call(this,...s)}catch(f){throw r&&!(l!=null&&l.suspendInstrumentation)&&(a?a.error(f):e.error(f)),h(c,!0),i==null||i.done(),f}};const p=new Proxy(O._originalXhr,{construct(s){const a=new s;return a.addEventListener("load",()=>{h(a),i==null||i.done()}),a.addEventListener("error",c=>{const l=re.get(a)||{};try{if(r&&!(l!=null&&l.suspendInstrumentation)){const f=new Error("XHR Network-Level Error"),g=l==null?void 0:l.activity;g?g.error(f):e.error(f)}h(a)}finally{i==null||i.done()}}),a.addEventListener("abort",()=>{var c;const l=re.get(a)||{};(c=l==null?void 0:l.activity)===null||c===void 0||c.discard(),i==null||i.done()}),a}});O._global.XMLHttpRequest=p}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,Zr),E.definedValueOrDefault(t.skipUrls,[]),E.definedValueOrDefault(t.fuzzyMapRange,Qr))}}resetRequestCounter(){O._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,u])=>{r.headers.set(n,u)}),!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,u])=>{e.headers.set(n,u)}),!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(u=>u instanceof RegExp?u.test(n):n===u)}}O._global=E.getGlobal(),O._isNetworkInstrumentationEnabled=!1,O._reqIndex=0;var G;(function(o){o[o.none=0]="none",o[o.start=1]="start",o[o.stop=2]="stop",o[o.both=3]="both"})(G||(G={}));const tn="timedout",rn="terminated",$e="discarded",Ae={timedout:tn,terminated:rn,discarded:$e};class oe{constructor(e,r,t,n,u,i,d,h,p,s,a){var c,l;this._name=e,this._rootId=r,this._onStopped=t,this._onError=n,this._isSampled=d,this._noRerooting=p,this._isExternal=s,this._parentActivity=a,this._isRoot=!1,this._errorCount=0,this._timerOverridden=G.none;const{tsNow:f,perfNow:g}=E.time();if(oe._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}__${oe._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(h),u>0&&(this._timer=setTimeout(()=>{this._stopReason=this._stopReason||Ae.timedout,this.stop()},u)),this._safety=new bt,this._externalParentActivity=!((c=this._parentActivity)===null||c===void 0)&&c.isExternal()?this._parentActivity:(l=this._parentActivity)===null||l===void 0?void 0:l.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,u=E.requireArgumentIfDefined(n,"options.perfStartOverride","number"),i=t.perfStopOverride,d=E.requireArgumentIfDefined(i,"options.perfStopOverride","number"),h=t.errorCount;if(E.requireArgumentIfDefined(h,"options.errorCount","number")&&(this._errorCount=h),u&&n<0)throw new Error("perfStartOverride, if defined, must be >= 0");if(d&&(i<0||i<(u?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!==Ae.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 u=this._getDetail(e,r);this._onStopped(u)}get isStopped(){return this._stopPerfTime!==void 0}discard(){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||Ae.discarded,this.stop()},{op:"activity.discard"})}terminate(e,r,t){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||Ae.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 O.getHeaders(t,r,this.getIsSampled(),e)}getStartTimestamp(){return this._startTimestamp}getStartPerfTime(){return this._startPerfTime}getStopPerfTime(){return this._stopPerfTime}getErrorCount(){return this._errorCount}}oe._count=0;const nn=new Array(16).fill(0).join("");class sn{getId(){return nn}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const on=Object.freeze(new sn);class an{getInstrumentedEventData(e,r,t,n){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 n&&(i.userPayload=D.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 ze=new an;class Ot{constructor(e,r,t,n,u,i,d,h){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=n,this._buckets=u,this._values=new Array,this._createdOn=i===void 0?E.time().tsNow:i,d!==void 0&&(this._lastUpdatedOn=d),h!==void 0&&(this._values=h)}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 It{constructor(e,r,t,n,u,i,d){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=n,this._values=new Array,this._createdOn=u===void 0?E.time().tsNow:u,i!==void 0&&(this._lastUpdatedOn=i),d!==void 0&&(this._values=d)}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 Ve{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 Tt=1e3,xt=500,Nt=500;var ae;(function(o){o[o.Counter=0]="Counter",o[o.Percentile=1]="Percentile",o[o.BucketHistogram=2]="BucketHistogram"})(ae||(ae={}));class Rt{constructor(e,r){this._ownerName=e,this._getOwnerAppName=r,this._upCounters=new Ve(Tt),this._valueRecorders=new Ve(xt),this._bucketHistograms=new Ve(Nt)}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,u={}){this._tagError(u,n),this._bucketHistogram(e,u,t).record(r)}_bucketHistogram(e,r,t){const{key:n,sortedTags:u}=this._getKeyAndSortedTags(e,r,ae.BucketHistogram);let i=this._bucketHistograms.get(n);if(!i&&(i=new Ot(e,this._ownerName,this._getOwnerAppName(),u,t),!this._bucketHistograms.set(n,i)))throw new Error(`Max size of ${Nt} exceeded for BucketHistograms`);return i}_upCounter(e,r){const{key:t,sortedTags:n}=this._getKeyAndSortedTags(e,r,ae.Counter);let u=this._upCounters.get(t);if(!u&&(u=new He(e,this._ownerName,this._getOwnerAppName(),n),!this._upCounters.set(t,u)))throw new Error(`Max size of ${Tt} exceeded for UpCounters`);return u}_valueRecorder(e,r){const{key:t,sortedTags:n}=this._getKeyAndSortedTags(e,r,ae.Percentile);let u=this._valueRecorders.get(t);if(!u&&(u=new It(e,this._ownerName,this._getOwnerAppName(),n),!this._valueRecorders.set(t,u)))throw new Error(`Max size of ${xt} 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 n=Object.keys(r).sort().reduce((i,d)=>(i[d]=r[d],i),{});return{key:`${ae[t]}:${e}${JSON.stringify(n)}`,sortedTags:n}}}class ln{constructor(){this.isMock=!0}}const un=void 0,Se=["`"],jt={internalError:"o11y-error"},Xe=Object.freeze(Array.from(Object.values(jt))),Je=new WeakMap;class pe{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 Se)if(this._name.indexOf(n)>=0)throw new Error(`Name cannot include the reserved character "${n}"`);this._safety=new bt({increment:n=>this._incrementError(n)}),this._metrics=this._initMetrics();const t=D.getOptions(ie,"Simple","text");this._simpleTextMaxLength=t?t["(meta.max_length)"]:Ue}_initMetrics(){return new Rt(this.name,()=>this._nextGen.appName||pe.defaultAppName)}_incrementError(e=1){this._metrics.incrementCounter(jt.internalError,e,!0)}get name(){return this._name}[Mr](e,r,t){const n=this[e];if(typeof n=="function"){Je.set(this,t);try{n.apply(this,r)}finally{Je.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,D.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 u=this._wrapUserPayload(e,r);u!=null&&u.payload&&this._logInternal(this.name,u.schema,u.payload,n,this._getEffectiveRootId(t))},{op:"log"})}_logInternal(e,r,t,n,u){const i=Je.get(this),d=this._nextGen.addLog(e,r,t,n,u,i);if(!E.isProduction){const h=ke.getExtraFields(r,t);!E.isProduction&&h.length>0&&this.error("Extra fields",F,{extras:h})}return d}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 u=this._getEffectiveRootId(n);this._errorInternal(e,r,t,void 0,u)},{op:"error"})}_errorInternal(e,r,t,n,u){const i=E.time().tsNow;let d;if(e instanceof Error)d=e;else{let s;e==null||typeof e.toString!="function"?s="UNKNOWN":s=e.toString(),d=new Error(s)}const h=this._wrapUserPayload(r,t,!0),p={name:d.name,message:d.message,stack:d.stack,userPayload:h,activityId:n};return this._logInternal(this.name,Y,p,i,u)}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 u,i=(r==null?void 0:r.perfStartOverride)!==void 0;const d=(t=r==null?void 0:r.instrumentationContext)===null||t===void 0?void 0:t.rootId;d?(i=!0,u={rootId:d,isRootActivitySampled:r.instrumentationContext.isRootActivitySampled,isRootActivityExternalSampled:r.instrumentationContext.isRootActivityExternalSampled}):u=this._nextGen.getDefaultInstrumentationContext();const h=r!=null&&r.isExternal?u.isRootActivityExternalSampled:u.isRootActivitySampled;return new oe(e,u.rootId,this._onActivityStoppedCallback,this._onActivityErrorCallback,un,r==null?void 0:r.id,h,r==null?void 0:r.perfStartOverride,i,r==null?void 0:r.isExternal,n)},on,{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===$e)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,Be,e,r,t)}_handleActivityError(e,r){this._errorInternal(e,r.userSchemaOrText,r.userData,r.id,r.rootId)}domEvent(e,r,t,n,u){this._safety.tryCatch(()=>{var i;const d=E.time().tsNow;E.requireArgument(e,"event",[Event,ln]),E.requireArgument(r,"handledBy",[HTMLElement,"object"]);let h;r instanceof HTMLElement?h=r:(r=r,((i=r.template)===null||i===void 0?void 0:i.host)instanceof HTMLElement?h=r.template.host:E.requireArgument(void 0,"handledBy"));const p=this._wrapUserPayload(t,n,!0),s=this._getEffectiveRootId(u);if(e.type==="click"){const a=e,c=this._nextGen.getClickTracker();c&&c.markEventHandled(a);const l=u==null?void 0:u.captureMouseData,f=ze.getInstrumentedEventData(l?1:0,l?ze.getMouseEventData(a):ze.getEventData(a),h,p);f.auto=u==null?void 0:u._auto,this._logInternal(this.name,De,f,d,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 u=typeof n;["number","string","boolean"].indexOf(u)===-1&&(r[t]=u)}}),r}incrementCounter(e,r=1,t=!1,n={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",Xe),E.checkForReservedCharacters(e,"operation",Se),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",Xe),E.checkForReservedCharacters(e,"operation",Se),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,u={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",Xe),E.checkForReservedCharacters(e,"operation",Se),E.requireArgument(r,"value","number"),E.requireArgument(t,"buckets",Array),Object.entries(t).forEach(([i,d])=>{E.requireArgument(d,`Bucket value for '${i}'`,"number")}),E.requireArgument(n,"hasError","boolean"),E.requireArgument(u,"tags","object"),this._metrics.bucketValue(e,r,t,n,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 n,u,i,d;const h=this._getAsaOptions(t),p=this.startActivity(e,h);try{return r(p)}catch(s){throw p.error(s,(n=t==null?void 0:t.errorPayload)===null||n===void 0?void 0:n.schema,(u=t==null?void 0:t.errorPayload)===null||u===void 0?void 0:u.payload),s}finally{p.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(d=t==null?void 0:t.stopPayload)===null||d===void 0?void 0:d.payload,t==null?void 0:t.stopOptions)}}activityAsync(e,r,t){return te(this,null,function*(){var n,u,i,d;const h=this._getAsaOptions(t),p=this.startActivity(e,h);try{return yield r(p)}catch(s){throw p.error(s,(n=t==null?void 0:t.errorPayload)===null||n===void 0?void 0:n.schema,(u=t==null?void 0:t.errorPayload)===null||u===void 0?void 0:u.payload),s}finally{p.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(d=t==null?void 0:t.stopPayload)===null||d===void 0?void 0:d.payload,t==null?void 0:t.stopOptions)}})}invokeNetworkCallWithHeaders(e,r,t){return O.setHeaders(t),e(...r)}}pe.defaultAppName="APP_NOT_REGISTERED";const dn=.1,cn=20;class hn{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=cn;this._graceCount=Math.max(1,Math.floor(e*dn)),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 u=e-n.startPerfTime;u>=0&&(n.stopPerfTime===void 0||e<n.stopPerfTime)&&u<t&&(r=n,t=u)}return r}}class fn extends oe{constructor(e,r,t,n,u,i,d,h){super(e,void 0,r,t,void 0,n||E.generateUniqueId(d!=null?d:32),u,i),this._isRoot=!0,this._isExternalSampled=h}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 pn=new Array(32).fill(0).join("");class mn{getId(){return pn}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const yn=Object.freeze(new mn);class gn extends pe{constructor(e,r,t){super(e,r),this._allowMulti=t,this._rootActivityHistory=new hn,this._onRootActivityStoppedCallback=this._handleRootActivityStop.bind(this)}startRootActivity(e,r,t,n,u){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 fn(e,this._onRootActivityStoppedCallback,this._onActivityErrorCallback,r,t,n==null?void 0:n.perfStartOverride,this._nextGen.preferredRootIdLength,u);if(!this._allowMulti){const d={id:i.getId(),name:e,startPerfTime:i.getStartPerfTime(),isSampled:i.getIsSampled()};if(this._rootActivityHistory.add(d),this._singleRootActivity&&!this._singleRootActivity.isStopped){const h=this._singleRootActivity.getId();this._singleRootActivity.terminate(),i.preRootId=h}this._singleRootActivity=i}return i},yn,{op:"startRootActivity"})}_handleRootActivityStop(e){const r=this._rootActivityHistory.findById(e.id);if(r&&(r.stopPerfTime=e.stopPerfTime,r.startPerfTime=e.startPerfTime),e.stopReason===$e)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 Rt(this.name,()=>this.name)}getRootActivityHistoryEntry(e){return this._rootActivityHistory.findByTime(e)}}const vn=5;class _n{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,vn):0;for(let u=0;u<n;u+=1){const i=e[u],d=(r=i.tagName)===null||r===void 0?void 0:r.toLowerCase();if(d==="a"||d==="button")return i;if(d==="input"){const h=i;if(((t=h.type)===null||t===void 0?void 0:t.toLowerCase())==="button")return h}}}}const Pt="o11y:receiver";var Ge;(function(o){o[o.Unknown=0]="Unknown",o[o.Opening=1]="Opening"})(Ge||(Ge={}));class bn{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:Ge.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:Pt,type:Lt},"*",[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===Mt?this._logCallback(e.data.data):e.data.type===Dt&&this._metricsCallback(e.data.data)}_messagePortErrorHandler(){this._commErrorCallback()}}const Lt="handshake",Mt="log",Dt="metrics";class wn{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===Pt&&e.data.type===Lt&&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:Mt,data:e}):this._logBuffer.push(e)}sendMetrics(e){this._handshakeComplete?this._otherPort.postMessage({type:Dt,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 En{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(u=>new He(u.name,u.ownerName,u.ownerAppName,Z.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 It(u.name,u.ownerName,u.ownerAppName,Z.getMetricsTags(u.tags),u.createdTimestamp,u.lastUpdatedTimestamp,u.values))),!((n=e.bucketHistograms)===null||n===void 0)&&n.length&&this._bucketHistograms.push(...e.bucketHistograms.map(u=>new Ot(u.name,u.ownerName,u.ownerAppName,Z.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}}function kn(o){return!!o&&typeof o=="object"&&"envelopeContents"in o&&"error"in o}const An=1e3;class Sn{constructor(e,r){this._connector=e,this._pollInterval=An,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:Z.getUpCounters(this._metricsExtractors.getAllUpCounters()),valueRecorders:Z.getValueRecorders(this._metricsExtractors.getAllValueRecorders()),bucketHistograms:Z.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms())};(e.upCounters.length||e.valueRecorders.length||e.bucketHistograms.length)&&this._connector.sendMetrics(e)}}const Bt=80,Cn=32,qt="_CUT",On=Bt-qt.length;function Ce(){}class Oe{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(se.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:Cn,this._clientSessionId=((n=r==null?void 0:r.clientSessionId)===null||n===void 0?void 0:n.toString())||E.generateUniqueId(),this._appInstr=new gn(this,e,r==null?void 0:r.allowMultipleRootActivities),this._instruments.set(e,this._appInstr),this._isSender){const d=new Sn(new wn(window,r==null?void 0:r.allowedReceiverOrigins),r==null?void 0:r.senderMetricsPollingInterval);this.registerLogCollector(d),this.registerMetricsCollector(d)}else this._isReceiver&&(this._metricsStore=new En,this._receiverConnector=new bn(d=>{d.logMeta.receiverClientSessionId=this._clientSessionId,d.logMeta.receiverRootId=this._appInstr.getSingleRootActivityId(),this._multiplex(d.schema,d.data,d.logMeta)},d=>{this._metricsStore.add(d)},()=>{this._appInstr.incrementCounter("o11y-error-receiver",1,!0)}));this._isBufferingEnabled=!this._isSender&&(r==null?void 0:r.enableBuffering);const i=new O(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?Ce:this.registerLogCollector.bind(this),registerMetricsCollector:this._isSender?Ce: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):Ce,stopReceiving:this._isReceiver?this._receiverConnector.closeComms.bind(this._receiverConnector):Ce}}getInstrumentation(e){E.requireArgument(e,"name","string"),e.length>Bt&&(e=e.substring(0,On)+qt);let r=this._instruments.get(e);if(!r)r=new pe(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,u,i){var d,h,p;ke.checkInputs(r,t),this._sequence+=1;const s=D.isInternal(r),a=s&&(t!=null&&t.userPayload)?t.userPayload.schema:r,c=D.getSchemaId(a);let l=this._seqBySchema.get(c)||0;l+=1,this._seqBySchema.set(c,l);const f={timestamp:n,rootId:u,sequence:this._sequence,schemaSequence:l,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=ke.getPayloadFromProvider(this.pagePayloadProvider,g),f.appPayload=ke.getPayloadFromProvider(this.appPayloadProvider,g),this._isSender||(t=E.clone(t)),typeof this._decimalPoints=="number"&&(E.roundNumbersInObject(t,this._decimalPoints),s&&E.roundNumbersInObject((d=t.userPayload)===null||d===void 0?void 0:d.payload,this._decimalPoints),E.roundNumbersInObject((h=f.pagePayload)===null||h===void 0?void 0:h.payload,this._decimalPoints),E.roundNumbersInObject((p=f.appPayload)===null||p===void 0?void 0:p.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(u=>{var i;return!this._forceDisabledLogCollectors.has(u)&&!(!((i=u.getIsCollectDisabled)===null||i===void 0)&&i.call(u))});if(n.length>0)for(const u of n)try{this._collect(u,e,r,t)==="sync"&&this._recordCollectorSuccess(u)}catch(i){this._recordCollectorFailure(u,i)}}_collect(e,r,t,n){const u=e.collect(r,t,n);return!u||typeof u.then!="function"?"sync":(Promise.resolve(u).then(()=>this._recordCollectorSuccess(e),i=>{kn(i)?this._recordCollectorSuccess(e):this._recordCollectorFailure(e,i)}),"async")}_recordCollectorSuccess(e){const r=this._logCollectorFailures.get(e)||0;r>0&&this._logCollectorFailures.set(e,r-1)}_recordCollectorFailure(e,r){const t=(this._logCollectorFailures.get(e)||0)+1;t>=Oe._collectorFailureLimit?(this._forceDisabledLogCollectors.add(e),this._appInstr&&(typeof r=="string"||r instanceof Error)&&this._appInstr.error(r)):this._logCollectorFailures.set(e,t)}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 _n(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)this._collect(e,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(se.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(se.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(se.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}}Oe._collectorFailureLimit=5;class In{get _lazyNextGen(){return this._nextgen||(this._nextgen=new Oe(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 Tn=new qr({logThreshold:300,reportListener:o=>{le==null||le.log(H,o)},errorListener:(o,e)=>{le==null||le.error(o,e)}}),Ie=new In(Tn),xn=Ie.registerInstrumentedApp.bind(Ie),le=Ie.getInstrumentation.bind(Ie)("IdleDetector"),Nn="264.105.0",Rn="o11y";class ue{constructor(){this._envelope={diagnostics:{key:Rn,generatedTimestamp:void 0,bundleCount:0,bucketHistogramCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:Nn},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 Z.getUpCounters(e,r)}static getValueRecorders(e,r=!0){return Z.getValueRecorders(e,r)}static getBucketHistograms(e,r=!0){return Z.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 ue;return e.staticAttributes&&r.withStaticAttributes(e.staticAttributes),e.messages&&e.messages.forEach((t,n)=>{r.withLogs(D.getSchemaId(n),t)}),e.upCounters&&r.withUpCounters(e.upCounters),e.valueRecorders&&r.withValueRecorders(e.valueRecorders),e.bucketHistograms&&r.withBucketHistograms(e.bucketHistograms),r.build()}}var Te;(function(o){var e,r;e={1:[function(t,n,u){n.exports=function(i,d){for(var h=Array(arguments.length-1),p=0,s=2,a=!0;s<arguments.length;)h[p++]=arguments[s++];return new Promise(function(c,l){h[p]=function(f){if(a)if(a=!1,f)l(f);else{for(var g=Array(arguments.length-1),m=0;m<g.length;)g[m++]=arguments[m];c.apply(null,g)}};try{i.apply(d||null,h)}catch(f){a&&(a=!1,l(f))}})}},{}],2:[function(t,n,u){u.length=function(s){var a=s.length;if(!a)return 0;for(var c=0;1<--a%4&&(s[0|a]||"")=="=";)++c;return Math.ceil(3*s.length)/4-c};for(var i=Array(64),d=Array(123),h=0;h<64;)d[i[h]=h<26?h+65:h<52?h+71:h<62?h-4:h-59|43]=h++;u.encode=function(s,a,c){for(var l,f=null,g=[],m=0,_=0;a<c;){var y=s[a++];switch(_){case 0:g[m++]=i[y>>2],l=(3&y)<<4,_=1;break;case 1:g[m++]=i[l|y>>4],l=(15&y)<<2,_=2;break;case 2:g[m++]=i[l|y>>6],g[m++]=i[63&y],_=0}8191<m&&((f=f||[]).push(String.fromCharCode.apply(String,g)),m=0)}return _&&(g[m++]=i[l],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 p="invalid encoding";u.decode=function(s,a,c){for(var l,f=c,g=0,m=0;m<s.length;){var _=s.charCodeAt(m++);if(_==61&&1<g)break;if((_=d[_])===o)throw Error(p);switch(g){case 0:l=_,g=1;break;case 1:a[c++]=l<<2|(48&_)>>4,l=_,g=2;break;case 2:a[c++]=(15&l)<<4|(60&_)>>2,l=_,g=3;break;case 3:a[c++]=(3&l)<<6|_,g=0}}if(g===1)throw Error(p);return c-f},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,n,u){n.exports=d;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 d(h,p){typeof h=="string"&&(p=h,h=o);var s=[];function a(l){if(typeof l!="string"){var f=c();if(d.verbose&&console.log("codegen: "+f),f="return "+f,l){for(var g=Object.keys(l),m=Array(g.length+1),_=Array(g.length),y=0;y<g.length;)m[y]=g[y],_[y]=l[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,l=l.replace(/%([%dfijs])/g,function(v,C){var w=b[k++];switch(C){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(l),a}function c(l){return"function "+(function(f){return!f||!(f=(""+f).replace(/[^\w$]/g,""))?"":(/^\d/.test(f)&&(f="_"+f),i.test(f)?f+"_":f)})(l||p)+"("+(h&&h.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 Xi=Object.defineProperty,Ji=Object.defineProperties;var Gi=Object.getOwnPropertyDescriptors;var kr=Object.getOwnPropertySymbols;var Ki=Object.prototype.hasOwnProperty,Yi=Object.prototype.propertyIsEnumerable;var Ar=(B,F,H)=>F in B?Xi(B,F,{enumerable:!0,configurable:!0,writable:!0,value:H}):B[F]=H,Q=(B,F)=>{for(var H in F||(F={}))Ki.call(F,H)&&Ar(B,H,F[H]);if(kr)for(var H of kr(F))Yi.call(F,H)&&Ar(B,H,F[H]);return B},be=(B,F)=>Ji(B,Gi(F));var te=(B,F,H)=>new Promise((De,we)=>{var Be=Y=>{try{ie(H.next(Y))}catch(W){we(W)}},Ee=Y=>{try{ie(H.throw(Y))}catch(W){we(W)}},ie=Y=>Y.done?De(Y.value):Promise.resolve(Y.value).then(Be,Ee);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"}}}}}}}}}},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"}}}}}}}}}},we={namespace:"sf.instrumentation",name:"Network",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Network:{fields:{mtd:{id:1,type:"string"},url:{id:2,type:"string"}}}}}}}}}},Be={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"}}}}}}}}}},Ee={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"}}}}}}}}}},Y={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 W{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 W._isProduction}markProduction(e){W._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 u=t!==void 0;if(!n&&u&&(n=!this._checkArgument(e,t)),n)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(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 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 n(u){if(!u||u.nodeType!==1)return[""];const i=t(u)>1||r(u)?`${u.localName.toLowerCase()}[${t(u)}]`:u.localName.toLowerCase();return[...n(u.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 u=t.pop();if(typeof u=="boolean")n+=4;else if(typeof u=="string")n+=u.length*2;else if(typeof u=="number")n+=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)n+=u.byteLength;else if(typeof u=="object"){const i=u;if(!r.has(i)){r.add(i);for(const d in i)t.push(i[d])}}}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 u=t?"external":"internal",i=n?"external":"internal";throw new Error(`Parent activity type mismatch: ${u} activity cannot have ${i} parent.`)}}}W._isProduction=!0;const qe=new W,Fe=qe.getGlobal();qe.markProduction(Fe==null?void 0:Fe.__O11Y_IS_PROD__);const E=Object.freeze(qe);class He{constructor(e,r,t,n,u,i,d){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=n,this._value=0,this._createdOn=u===void 0?E.time().tsNow:u,i!==void 0&&(this._lastUpdatedOn=i),d!==void 0&&(this._value=d)}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 Sr="co11y";class Cr{constructor(){this._upCounters=new Map,this._ownerAppName=Sr}_addOrUpdateCounter(e,r,t){if(!e)return;const n={status:t},u=`${this._ownerAppName}:${r}:${e}${JSON.stringify(n)}`;let i=this._upCounters.get(u);i||(i=new He(e,r,this._ownerAppName,n),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 se=new Cr;class Or{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 Ir{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 u=t.nested;if(u){const i=u[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 u=this.getType(e,r);if(!t)return u.options;const i=u.fields[t];if(!i){const d=this.getSchemaId(e);throw new Error(`Cannot locate field ${t} in message ${r} in schema with ID ${d}`)}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(h=>!i.has(h)):[]}}const D=new Ir,Ue=1e4,ft=1e4,pt=0,mt=2147483647,yt=-2147483648,Tr=4294967295,xr=9223372036854776e3,Nr=-9223372036854776e3,Rr=18446744073709552e3;class gt{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,u)=>Number(u)>=0?`${n}[${u}]`:`${n}.${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 jr{validate(e,r,t=!1){const n=D.checkSchema(e);E.requireArgument(r,"data","object");const u=D.getSchemaId(e),i=new Array,d=D.getTypes(e);if(this._validateFields(i,[],r,d[n.message],e.pbjsSchema.nested,u,[n.domain,n.feature,n.message]),i.length&&!t)throw new Error(i[0].asMessage(u));return i}_validateFields(e,r,t,n,u,i,d){const h=n.oneofs||{},p=n.fields||{};for(const s in t){const a=t[s];if(a!=null){const c=(l,f,g)=>this._matchFieldTypes(e,[...r,s],a,l,u,i,d,f,g);h[s]?c(p[h[s].oneof[0]].type):p[s]&&c(p[s].type,p[s].rule==="repeated")}}}_matchFieldTypes(e,r,t,n,u,i,d,h,p){let s;if(h)Array.isArray(t)?(t.length>ft&&(s=7),t.forEach((a,c)=>{this._matchFieldTypes(e,[...r,c.toString()],a,n,u,i,d,void 0,!0)})):s=1;else if(t==null||t===void 0)p&&(s=13);else{let a,c,l;switch(n){case"string":c="string",t.length>Ue&&(s=6);break;case"bytes":c="object",t instanceof Uint8Array||(s=5);break;case"bool":c="boolean";break;case"uint32":c="number",a={min:pt,max:Tr,isInt:!0,isItem:p};break;case"int32":case"sint32":case"fixed32":case"sfixed32":c="number",a={min:yt,max:mt,isInt:!0,isItem:p};break;case"uint64":c="number",a={min:pt,max:Rr,isInt:!0,isItem:p};break;case"fixed64":case"sfixed64":case"int64":case"sint64":c="number",a={min:Nr,max:xr,isInt:!0,isItem:p};break;case"double":case"float":c="number",a={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,isInt:!1,isItem:p};break;default:{const f=n.startsWith("."),g=(f?n.slice(1):n).split(".");let m,_;for(let y=f?0:d.length;y>=0;y--){_=[...d.slice(0,y),...g];let b=u;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?(c="number",l=Object.values(m.values),a={min:yt,max:mt,isInt:!0,isItem:p}):m&&"fields"in m&&(this._validateFields(e,r,t,m,u,i,_),c="object");break}}typeof t!==c?e.push(new gt(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)||l&&!l.includes(t))&&(s=4))}s&&e.push(new gt(s,r))}}const vt=new jr;class Pr{_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 Z=Object.freeze(new Pr);class Lr{checkInputs(e,r){D.checkSchema(e),E.requireArgument(r,"data","object");let t,n;r.userPayload!==void 0&&D.isInternal(e)&&(n=r.userPayload,t=vt.validate(n.schema,n.payload,!0),this._processValidationResults(D.getSchemaId(n.schema),n.payload,t),r.userPayload=void 0),t=vt.validate(e,r,!0),this._processValidationResults(D.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&&D.isInternal(e)&&t.push(...D.getExtraFields(n.schema,n.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 n=0;n<t.length;n+=1){const u=t[n];if(u.errorCode==6||u.errorCode==7){const i=u.fields.length-1,d=this._traverseFields(r,u.fields.slice(0,i)),h=u.fields[i];u.errorCode==6?d[h]=d[h].substring(0,Ue):d[h].splice(ft)}else throw new Error(u.asMessage(e))}}_traverseFields(e,r){return r.length?this._traverseFields(e[r[0]],r.slice(1)):e}}const ke=Object.freeze(new Lr),_t="o11y";class bt{constructor(e){this._errorCounter=e,this._safeCatchMode=!1}_callCo11y(e,r){r?se.exception(e==null?void 0:e.op,_t):se.success(e==null?void 0:e.op,_t)}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(u){return n=!0,this._prodSafeCatch(u),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 Mr={namespace:"sf.pdp",name:"PdpEvent",pbjsSchema:{nested:{sf:{nested:{pdp:{nested:{PdpEvent:{oneofs:{_eventVolume:{oneof:["eventVolume"]}},fields:{contextName:{id:5,type:"string"},componentId:{id:2,type:"string"},productFeatureId:{id:3,type:"string"},channel:{id:7,type:"string"},eventName:{id:1,type:"string"},contextValue:{id:6,type:"string"},subType:{id:8,type:"string"},eventVolume:{options:{proto3_optional:!0},id:4,type:"int32"}}}}}}}}}},Dr=Symbol("o11y.stampTenantClass");class Br{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 qr=300;class Fr{constructor(e){this._taskers=new Map,this._listeners=new Set,this._busyCheckers=new Map,this._logThreshold=qr,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 Br(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],u=r[1];try{return n()}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 n=this._endedTasks.splice(0),u=this._pollableReport.splice(0);this._notify(t,r,n,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,n){var u;if(r>=this._logThreshold&&this._reportListener){const d=this._getReport(r,e.length,t,n);this._reportListener(d)}e.reverse();const i=E.time().tsNow;for(const[d,h]of e.entries())try{h(i)}catch(p){(u=this._errorListener)===null||u===void 0||u.call(this,p,`Listener #${e.length-1-d}`),E.noProdThrow(p)}}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 u=t.map(i=>({name:i.name,duration:i.end-i.start})).sort((i,d)=>d.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:n.map(i=>i.name),pollCounts:n.map(i=>i.count)}}}const Hr={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"}}}}}}}}}},Ur={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 $r{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,u=-1;for(let i=0;i<t.length;i++){const{fuzzyKey:d}=t[i],h=Math.abs(d-r);h<=this._fuzzyKeyRange&&h<n&&(n=h,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 zr=["fetch","xmlhttprequest"];class Vr{constructor(e,r,t,n,u){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(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 $r(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},u=e.serverTiming;return Array.isArray(u)&&(n.dbDuration=(r=u.find(i=>i.name==="db"))===null||r===void 0?void 0:r.duration,n.srvDuration=(t=u.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:zr.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 u={id:t},i={perfStartOverride:r.startTime,perfStopOverride:r.startTime+r.duration,errorCount:n};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 n=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(Ur,Object.assign(n,u))}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 u=this._resourceEntryToResourceTiming(t);Object.assign(u,{srvReqId:n==null?void 0:n.requestId,xhrDelay:this._calculateXhrDelay(t,n)}),u.responseStatus===void 0&&(u.responseStatus=n==null?void 0:n.responseStatus),this._logActivity(Hr,u,n==null?void 0:n.activityId,n==null?void 0:n.errorCount)}}}}const Xr=32,Jr=16,wt=16,Gr="traceparent",Kr="b3",Et="X-B3-TraceId",kt="X-B3-SpanId",At="X-B3-Sampled",St="X-B3-ParentSpanId",Ct="X-SFDC-Request-Id",Yr="baggage",Wr="fetch",Zr="xhr_send",Qr="perf-timing",en=50,tn=[Yr,Et,kt,St,At],re=new WeakMap;class O{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 u=`${e}-${r}`;return(t!==void 0||n!==void 0)&&(u+=t?"-1":"-0",n!==void 0&&(u+=`-${n}`)),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 n=0;n<t;n+=1){const u=e[n];if(!(u>="a"&&u<="f")&&!(u>="0"&&u<="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){O._userHeaders={};return}Object.entries(e).forEach(([r])=>{tn.includes(r)||delete e[r]}),O._userHeaders=e}static getHeaders(e,r,t,n){E.requireArgument(r,"spanId","string");const u=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:u?Jr:Xr),r=this._conformTextAsId(r,wt);const d=n&&n.parentSpanId!==void 0&&this._conformTextAsId(n.parentSpanId,wt)||void 0;return u?(n==null?void 0:n.useCompactHeader)?i[Kr]=this._getB3CompactFormat(e,r,t,d):(i[Et]=e,i[kt]=r,d!==void 0&&(i[St]=d),t!==void 0&&(i[At]=t?"1":"0")):i[Gr]=this._getW3CompactFormat(e,r,t),i}_disableNetworkInstrumentation(){O._isNetworkInstrumentationEnabled&&(O._originalFetch&&(O._global.fetch=O._originalFetch,O._originalFetch=void 0),O._originalXhr&&(O._global.XMLHttpRequest=O._originalXhr,O._originalXhr=void 0),O._originalXhrOpen&&(O._global.XMLHttpRequest.prototype.open=O._originalXhrOpen,O._originalXhrOpen=void 0),O._originalXhrSetRequestHeader&&(O._global.XMLHttpRequest.prototype.setRequestHeader=O._originalXhrSetRequestHeader,O._originalXhrSetRequestHeader=void 0),O._originalXhrSend&&(O._global.XMLHttpRequest.prototype.send=O._originalXhrSend,O._originalXhrSend=void 0),O._performanceObservability&&(O._performanceObservability.stop(),O._performanceObservability=void 0),O._isNetworkInstrumentationEnabled=!1)}_enableNetworkInstrumentation(e,r,t,n,u,i,d,h,p,s){typeof O._global.fetch=="function"&&(this._overrideFetch(e,r,t,n,u,i,p),O._isNetworkInstrumentationEnabled=!0),typeof O._global.XMLHttpRequest=="function"&&(this._overrideXhr(e,r,t,n,u,i,p),O._isNetworkInstrumentationEnabled=!0),d&&(O._performanceObservability=new Vr(e,s,p,h,d===!0?"full":d),O._performanceObservability.start(),O._isNetworkInstrumentationEnabled=!0)}static _getTraceHeaders(e,r,t,n,u){let i;if(e)i=e.getTraceHeaders(t)||{};else{const d=r.internalInstrumentationContext;d!=null&&d.rootId?i=O.getHeaders(d.rootId,E.generateUniqueId(),d.isRootActivitySampled,t):i={}}if(typeof(t==null?void 0:t.headerProcessor)=="function")i=t.headerProcessor({method:n,url:u,defaultHeaders:i});else if(typeof window=="object"){let d;try{d=new URL(u)}catch(h){}d&&d.host!==window.location.host&&(i=void 0)}return O._userHeaders&&Object.keys(O._userHeaders).length>0&&(i=Q({},i),Object.entries(O._userHeaders).forEach(([d,h])=>{i[d]=h}),O._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(u=>u[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,u,i,d){O._originalFetch=O._global.fetch;const h=(p,s,...a)=>te(this,null,function*(){var c;let l,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||O._shouldSkipUrl(d,p),!y)l=e.startActivity(t||Wr);else if(v){O._reqIndex+=1;try{if(p instanceof URL)p.searchParams.append("o11y",O._reqIndex.toString());else if(typeof p=="string"){const C=new URL(p),w=`o11y=${O._reqIndex}`;C.search+=C.search.startsWith("?")?`&${w}`:w,p=C.toString()}}catch(C){}}if(s==null||delete s.o11y,f=p==null?void 0:p.toString(),g=E.tryGetAbsoluteUrl(f),n){p instanceof Request&&(m||(m=p.method),f=p.url,g=E.tryGetAbsoluteUrl(f));const C=O._getTraceHeaders(l,e,u,m,g);!this._applyTraceHeaders(p,s,C)&&s===void 0&&(s={headers:C})}return _=E.perfNow(),b=yield O._originalFetch.call(O._global,p,s,...a),b}catch(k){throw r&&!y&&(l?l.error(k):e.error(k)),k}finally{try{const k=O._endActivity(l,f,m);if(!((c=O._performanceObservability)===null||c===void 0)&&c.isStarted){const C={requestId:O._extractHeader(Ct,p,s),activityDuration:k,activityId:l==null?void 0:l.getId(),errorCount:l==null?void 0:l.getErrorCount(),responseStatus:b==null?void 0:b.status};O._performanceObservability.addEntry(g,_,C)}}finally{i==null||i.done()}}});O._global.fetch=h}static _endActivity(e,r,t){var n;if(e)return!((n=O._performanceObservability)===null||n===void 0)&&n.isStarted?e.discard():e.stop(we,{mtd:t,url:r}),e.getStopPerfTime()-e.getStartPerfTime()}_overrideXhr(e,r,t,n,u,i,d){O._originalXhr=O._global.XMLHttpRequest,O._originalXhrOpen=O._originalXhr.prototype.open,O._originalXhrSetRequestHeader=O._originalXhr.prototype.setRequestHeader,O._originalXhrSend=O._originalXhr.prototype.send;function h(s,a){var c;const l=re.get(s);if(l){const f=l.activity,g=O._endActivity(f,l.url,l.method);!a&&(!((c=O._performanceObservability)===null||c===void 0)&&c.isStarted)&&O._performanceObservability.addEntry(l.absoluteUrl,l.sendTime,{requestId:l.requestId,activityDuration:g,activityId:f==null?void 0:f.getId(),errorCount:f==null?void 0:f.getErrorCount(),responseStatus:s.status})}}O._originalXhr.prototype.open=function(s,a,c,l,f){const g={method:s,url:a==null?void 0:a.toString()};re.set(this,g),g.absoluteUrl=E.tryGetAbsoluteUrl(g.url),g.suspendInstrumentation=O._shouldSkipUrl(d,g.absoluteUrl),O._originalXhrOpen.apply(this,arguments)},O._originalXhr.prototype.setRequestHeader=function(s,a){var c;if(((c=s==null?void 0:s.toLowerCase)===null||c===void 0?void 0:c.call(s))===Ct.toLowerCase()){const l=re.get(this);l&&(l.requestId=a)}O._originalXhrSetRequestHeader.apply(this,arguments)},O._originalXhr.prototype.send=function(...s){let a;const c=this;let l=re.get(c);l||(l={},re.set(c,l));try{if(i==null||i.add(),l.suspendInstrumentation||(l.activity=a=e.startActivity(t||Zr)),n){const f=O._getTraceHeaders(a,e,u,l.method,l.absoluteUrl);Object.entries(f).forEach(g=>{c.setRequestHeader(g[0],g[1])})}l.sendTime=E.perfNow(),O._originalXhrSend.call(this,...s)}catch(f){throw r&&!(l!=null&&l.suspendInstrumentation)&&(a?a.error(f):e.error(f)),h(c,!0),i==null||i.done(),f}};const p=new Proxy(O._originalXhr,{construct(s){const a=new s;return a.addEventListener("load",()=>{h(a),i==null||i.done()}),a.addEventListener("error",c=>{const l=re.get(a)||{};try{if(r&&!(l!=null&&l.suspendInstrumentation)){const f=new Error("XHR Network-Level Error"),g=l==null?void 0:l.activity;g?g.error(f):e.error(f)}h(a)}finally{i==null||i.done()}}),a.addEventListener("abort",()=>{var c;const l=re.get(a)||{};(c=l==null?void 0:l.activity)===null||c===void 0||c.discard(),i==null||i.done()}),a}});O._global.XMLHttpRequest=p}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,Qr),E.definedValueOrDefault(t.skipUrls,[]),E.definedValueOrDefault(t.fuzzyMapRange,en))}}resetRequestCounter(){O._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,u])=>{r.headers.set(n,u)}),!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,u])=>{e.headers.set(n,u)}),!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(u=>u instanceof RegExp?u.test(n):n===u)}}O._global=E.getGlobal(),O._isNetworkInstrumentationEnabled=!1,O._reqIndex=0;var G;(function(o){o[o.none=0]="none",o[o.start=1]="start",o[o.stop=2]="stop",o[o.both=3]="both"})(G||(G={}));const rn="timedout",nn="terminated",$e="discarded",Ae={timedout:rn,terminated:nn,discarded:$e};class oe{constructor(e,r,t,n,u,i,d,h,p,s,a){var c,l;this._name=e,this._rootId=r,this._onStopped=t,this._onError=n,this._isSampled=d,this._noRerooting=p,this._isExternal=s,this._parentActivity=a,this._isRoot=!1,this._errorCount=0,this._timerOverridden=G.none;const{tsNow:f,perfNow:g}=E.time();if(oe._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}__${oe._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(h),u>0&&(this._timer=setTimeout(()=>{this._stopReason=this._stopReason||Ae.timedout,this.stop()},u)),this._safety=new bt,this._externalParentActivity=!((c=this._parentActivity)===null||c===void 0)&&c.isExternal()?this._parentActivity:(l=this._parentActivity)===null||l===void 0?void 0:l.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,u=E.requireArgumentIfDefined(n,"options.perfStartOverride","number"),i=t.perfStopOverride,d=E.requireArgumentIfDefined(i,"options.perfStopOverride","number"),h=t.errorCount;if(E.requireArgumentIfDefined(h,"options.errorCount","number")&&(this._errorCount=h),u&&n<0)throw new Error("perfStartOverride, if defined, must be >= 0");if(d&&(i<0||i<(u?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!==Ae.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 u=this._getDetail(e,r);this._onStopped(u)}get isStopped(){return this._stopPerfTime!==void 0}discard(){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||Ae.discarded,this.stop()},{op:"activity.discard"})}terminate(e,r,t){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||Ae.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 O.getHeaders(t,r,this.getIsSampled(),e)}getStartTimestamp(){return this._startTimestamp}getStartPerfTime(){return this._startPerfTime}getStopPerfTime(){return this._stopPerfTime}getErrorCount(){return this._errorCount}}oe._count=0;const sn=new Array(16).fill(0).join("");class on{getId(){return sn}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const an=Object.freeze(new on);class ln{getInstrumentedEventData(e,r,t,n){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 n&&(i.userPayload=D.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 ze=new ln;class Ot{constructor(e,r,t,n,u,i,d,h){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=n,this._buckets=u,this._values=new Array,this._createdOn=i===void 0?E.time().tsNow:i,d!==void 0&&(this._lastUpdatedOn=d),h!==void 0&&(this._values=h)}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 It{constructor(e,r,t,n,u,i,d){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=n,this._values=new Array,this._createdOn=u===void 0?E.time().tsNow:u,i!==void 0&&(this._lastUpdatedOn=i),d!==void 0&&(this._values=d)}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 Ve{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 Tt=1e3,xt=500,Nt=500;var ae;(function(o){o[o.Counter=0]="Counter",o[o.Percentile=1]="Percentile",o[o.BucketHistogram=2]="BucketHistogram"})(ae||(ae={}));class Rt{constructor(e,r){this._ownerName=e,this._getOwnerAppName=r,this._upCounters=new Ve(Tt),this._valueRecorders=new Ve(xt),this._bucketHistograms=new Ve(Nt)}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,u={}){this._tagError(u,n),this._bucketHistogram(e,u,t).record(r)}_bucketHistogram(e,r,t){const{key:n,sortedTags:u}=this._getKeyAndSortedTags(e,r,ae.BucketHistogram);let i=this._bucketHistograms.get(n);if(!i&&(i=new Ot(e,this._ownerName,this._getOwnerAppName(),u,t),!this._bucketHistograms.set(n,i)))throw new Error(`Max size of ${Nt} exceeded for BucketHistograms`);return i}_upCounter(e,r){const{key:t,sortedTags:n}=this._getKeyAndSortedTags(e,r,ae.Counter);let u=this._upCounters.get(t);if(!u&&(u=new He(e,this._ownerName,this._getOwnerAppName(),n),!this._upCounters.set(t,u)))throw new Error(`Max size of ${Tt} exceeded for UpCounters`);return u}_valueRecorder(e,r){const{key:t,sortedTags:n}=this._getKeyAndSortedTags(e,r,ae.Percentile);let u=this._valueRecorders.get(t);if(!u&&(u=new It(e,this._ownerName,this._getOwnerAppName(),n),!this._valueRecorders.set(t,u)))throw new Error(`Max size of ${xt} 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 n=Object.keys(r).sort().reduce((i,d)=>(i[d]=r[d],i),{});return{key:`${ae[t]}:${e}${JSON.stringify(n)}`,sortedTags:n}}}class un{constructor(){this.isMock=!0}}const dn=void 0,Se=["`"],jt={internalError:"o11y-error"},Xe=Object.freeze(Array.from(Object.values(jt))),Je=new WeakMap;class pe{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 Se)if(this._name.indexOf(n)>=0)throw new Error(`Name cannot include the reserved character "${n}"`);this._safety=new bt({increment:n=>this._incrementError(n)}),this._metrics=this._initMetrics();const t=D.getOptions(ie,"Simple","text");this._simpleTextMaxLength=t?t["(meta.max_length)"]:Ue}_initMetrics(){return new Rt(this.name,()=>this._nextGen.appName||pe.defaultAppName)}_incrementError(e=1){this._metrics.incrementCounter(jt.internalError,e,!0)}get name(){return this._name}[Dr](e,r,t){const n=this[e];if(typeof n=="function"){Je.set(this,t);try{n.apply(this,r)}finally{Je.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,D.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 u=this._wrapUserPayload(e,r);u!=null&&u.payload&&this._logInternal(this.name,u.schema,u.payload,n,this._getEffectiveRootId(t))},{op:"log"})}logPdpEvent(e,r){this._safety.tryCatch(()=>{E.requireArgument(e,"pdpEventData","object"),this.log(Mr,e,r)},{op:"logPdpEvent"})}_logInternal(e,r,t,n,u){const i=Je.get(this),d=this._nextGen.addLog(e,r,t,n,u,i);if(!E.isProduction){const h=ke.getExtraFields(r,t);!E.isProduction&&h.length>0&&this.error("Extra fields",F,{extras:h})}return d}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 u=this._getEffectiveRootId(n);this._errorInternal(e,r,t,void 0,u)},{op:"error"})}_errorInternal(e,r,t,n,u){const i=E.time().tsNow;let d;if(e instanceof Error)d=e;else{let s;e==null||typeof e.toString!="function"?s="UNKNOWN":s=e.toString(),d=new Error(s)}const h=this._wrapUserPayload(r,t,!0),p={name:d.name,message:d.message,stack:d.stack,userPayload:h,activityId:n};return this._logInternal(this.name,Y,p,i,u)}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 u,i=(r==null?void 0:r.perfStartOverride)!==void 0;const d=(t=r==null?void 0:r.instrumentationContext)===null||t===void 0?void 0:t.rootId;d?(i=!0,u={rootId:d,isRootActivitySampled:r.instrumentationContext.isRootActivitySampled,isRootActivityExternalSampled:r.instrumentationContext.isRootActivityExternalSampled}):u=this._nextGen.getDefaultInstrumentationContext();const h=r!=null&&r.isExternal?u.isRootActivityExternalSampled:u.isRootActivitySampled;return new oe(e,u.rootId,this._onActivityStoppedCallback,this._onActivityErrorCallback,dn,r==null?void 0:r.id,h,r==null?void 0:r.perfStartOverride,i,r==null?void 0:r.isExternal,n)},an,{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===$e)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,Be,e,r,t)}_handleActivityError(e,r){this._errorInternal(e,r.userSchemaOrText,r.userData,r.id,r.rootId)}domEvent(e,r,t,n,u){this._safety.tryCatch(()=>{var i;const d=E.time().tsNow;E.requireArgument(e,"event",[Event,un]),E.requireArgument(r,"handledBy",[HTMLElement,"object"]);let h;r instanceof HTMLElement?h=r:(r=r,((i=r.template)===null||i===void 0?void 0:i.host)instanceof HTMLElement?h=r.template.host:E.requireArgument(void 0,"handledBy"));const p=this._wrapUserPayload(t,n,!0),s=this._getEffectiveRootId(u);if(e.type==="click"){const a=e,c=this._nextGen.getClickTracker();c&&c.markEventHandled(a);const l=u==null?void 0:u.captureMouseData,f=ze.getInstrumentedEventData(l?1:0,l?ze.getMouseEventData(a):ze.getEventData(a),h,p);f.auto=u==null?void 0:u._auto,this._logInternal(this.name,De,f,d,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 u=typeof n;["number","string","boolean"].indexOf(u)===-1&&(r[t]=u)}}),r}incrementCounter(e,r=1,t=!1,n={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",Xe),E.checkForReservedCharacters(e,"operation",Se),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",Xe),E.checkForReservedCharacters(e,"operation",Se),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,u={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",Xe),E.checkForReservedCharacters(e,"operation",Se),E.requireArgument(r,"value","number"),E.requireArgument(t,"buckets",Array),Object.entries(t).forEach(([i,d])=>{E.requireArgument(d,`Bucket value for '${i}'`,"number")}),E.requireArgument(n,"hasError","boolean"),E.requireArgument(u,"tags","object"),this._metrics.bucketValue(e,r,t,n,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 n,u,i,d;const h=this._getAsaOptions(t),p=this.startActivity(e,h);try{return r(p)}catch(s){throw p.error(s,(n=t==null?void 0:t.errorPayload)===null||n===void 0?void 0:n.schema,(u=t==null?void 0:t.errorPayload)===null||u===void 0?void 0:u.payload),s}finally{p.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(d=t==null?void 0:t.stopPayload)===null||d===void 0?void 0:d.payload,t==null?void 0:t.stopOptions)}}activityAsync(e,r,t){return te(this,null,function*(){var n,u,i,d;const h=this._getAsaOptions(t),p=this.startActivity(e,h);try{return yield r(p)}catch(s){throw p.error(s,(n=t==null?void 0:t.errorPayload)===null||n===void 0?void 0:n.schema,(u=t==null?void 0:t.errorPayload)===null||u===void 0?void 0:u.payload),s}finally{p.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(d=t==null?void 0:t.stopPayload)===null||d===void 0?void 0:d.payload,t==null?void 0:t.stopOptions)}})}invokeNetworkCallWithHeaders(e,r,t){return O.setHeaders(t),e(...r)}}pe.defaultAppName="APP_NOT_REGISTERED";const cn=.1,hn=20;class fn{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=hn;this._graceCount=Math.max(1,Math.floor(e*cn)),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 u=e-n.startPerfTime;u>=0&&(n.stopPerfTime===void 0||e<n.stopPerfTime)&&u<t&&(r=n,t=u)}return r}}class pn extends oe{constructor(e,r,t,n,u,i,d,h){super(e,void 0,r,t,void 0,n||E.generateUniqueId(d!=null?d:32),u,i),this._isRoot=!0,this._isExternalSampled=h}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 mn=new Array(32).fill(0).join("");class yn{getId(){return mn}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const gn=Object.freeze(new yn);class vn extends pe{constructor(e,r,t){super(e,r),this._allowMulti=t,this._rootActivityHistory=new fn,this._onRootActivityStoppedCallback=this._handleRootActivityStop.bind(this)}startRootActivity(e,r,t,n,u){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 pn(e,this._onRootActivityStoppedCallback,this._onActivityErrorCallback,r,t,n==null?void 0:n.perfStartOverride,this._nextGen.preferredRootIdLength,u);if(!this._allowMulti){const d={id:i.getId(),name:e,startPerfTime:i.getStartPerfTime(),isSampled:i.getIsSampled()};if(this._rootActivityHistory.add(d),this._singleRootActivity&&!this._singleRootActivity.isStopped){const h=this._singleRootActivity.getId();this._singleRootActivity.terminate(),i.preRootId=h}this._singleRootActivity=i}return i},gn,{op:"startRootActivity"})}_handleRootActivityStop(e){const r=this._rootActivityHistory.findById(e.id);if(r&&(r.stopPerfTime=e.stopPerfTime,r.startPerfTime=e.startPerfTime),e.stopReason===$e)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 Rt(this.name,()=>this.name)}getRootActivityHistoryEntry(e){return this._rootActivityHistory.findByTime(e)}}const _n=5;class bn{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,_n):0;for(let u=0;u<n;u+=1){const i=e[u],d=(r=i.tagName)===null||r===void 0?void 0:r.toLowerCase();if(d==="a"||d==="button")return i;if(d==="input"){const h=i;if(((t=h.type)===null||t===void 0?void 0:t.toLowerCase())==="button")return h}}}}const Pt="o11y:receiver";var Ge;(function(o){o[o.Unknown=0]="Unknown",o[o.Opening=1]="Opening"})(Ge||(Ge={}));class wn{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:Ge.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:Pt,type:Lt},"*",[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===Mt?this._logCallback(e.data.data):e.data.type===Dt&&this._metricsCallback(e.data.data)}_messagePortErrorHandler(){this._commErrorCallback()}}const Lt="handshake",Mt="log",Dt="metrics";class En{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===Pt&&e.data.type===Lt&&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:Mt,data:e}):this._logBuffer.push(e)}sendMetrics(e){this._handshakeComplete?this._otherPort.postMessage({type:Dt,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 kn{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(u=>new He(u.name,u.ownerName,u.ownerAppName,Z.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 It(u.name,u.ownerName,u.ownerAppName,Z.getMetricsTags(u.tags),u.createdTimestamp,u.lastUpdatedTimestamp,u.values))),!((n=e.bucketHistograms)===null||n===void 0)&&n.length&&this._bucketHistograms.push(...e.bucketHistograms.map(u=>new Ot(u.name,u.ownerName,u.ownerAppName,Z.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}}function An(o){return!!o&&typeof o=="object"&&"envelopeContents"in o&&"error"in o}const Sn=1e3;class Cn{constructor(e,r){this._connector=e,this._pollInterval=Sn,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:Z.getUpCounters(this._metricsExtractors.getAllUpCounters()),valueRecorders:Z.getValueRecorders(this._metricsExtractors.getAllValueRecorders()),bucketHistograms:Z.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms())};(e.upCounters.length||e.valueRecorders.length||e.bucketHistograms.length)&&this._connector.sendMetrics(e)}}const Bt=80,On=32,qt="_CUT",In=Bt-qt.length;function Ce(){}class Oe{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(se.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:On,this._clientSessionId=((n=r==null?void 0:r.clientSessionId)===null||n===void 0?void 0:n.toString())||E.generateUniqueId(),this._appInstr=new vn(this,e,r==null?void 0:r.allowMultipleRootActivities),this._instruments.set(e,this._appInstr),this._isSender){const d=new Cn(new En(window,r==null?void 0:r.allowedReceiverOrigins),r==null?void 0:r.senderMetricsPollingInterval);this.registerLogCollector(d),this.registerMetricsCollector(d)}else this._isReceiver&&(this._metricsStore=new kn,this._receiverConnector=new wn(d=>{d.logMeta.receiverClientSessionId=this._clientSessionId,d.logMeta.receiverRootId=this._appInstr.getSingleRootActivityId(),this._multiplex(d.schema,d.data,d.logMeta)},d=>{this._metricsStore.add(d)},()=>{this._appInstr.incrementCounter("o11y-error-receiver",1,!0)}));this._isBufferingEnabled=!this._isSender&&(r==null?void 0:r.enableBuffering);const i=new O(this.getInstrumentation("Network"),this._idleDetector);return{log:this._appInstr.log.bind(this._appInstr),logPdpEvent:this._appInstr.logPdpEvent.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?Ce:this.registerLogCollector.bind(this),registerMetricsCollector:this._isSender?Ce: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):Ce,stopReceiving:this._isReceiver?this._receiverConnector.closeComms.bind(this._receiverConnector):Ce}}getInstrumentation(e){E.requireArgument(e,"name","string"),e.length>Bt&&(e=e.substring(0,In)+qt);let r=this._instruments.get(e);if(!r)r=new pe(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,u,i){var d,h,p;ke.checkInputs(r,t),this._sequence+=1;const s=D.isInternal(r),a=s&&(t!=null&&t.userPayload)?t.userPayload.schema:r,c=D.getSchemaId(a);let l=this._seqBySchema.get(c)||0;l+=1,this._seqBySchema.set(c,l);const f={timestamp:n,rootId:u,sequence:this._sequence,schemaSequence:l,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=ke.getPayloadFromProvider(this.pagePayloadProvider,g),f.appPayload=ke.getPayloadFromProvider(this.appPayloadProvider,g),this._isSender||(t=E.clone(t)),typeof this._decimalPoints=="number"&&(E.roundNumbersInObject(t,this._decimalPoints),s&&E.roundNumbersInObject((d=t.userPayload)===null||d===void 0?void 0:d.payload,this._decimalPoints),E.roundNumbersInObject((h=f.pagePayload)===null||h===void 0?void 0:h.payload,this._decimalPoints),E.roundNumbersInObject((p=f.appPayload)===null||p===void 0?void 0:p.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(u=>{var i;return!this._forceDisabledLogCollectors.has(u)&&!(!((i=u.getIsCollectDisabled)===null||i===void 0)&&i.call(u))});if(n.length>0)for(const u of n)try{this._collect(u,e,r,t)==="sync"&&this._recordCollectorSuccess(u)}catch(i){this._recordCollectorFailure(u,i)}}_collect(e,r,t,n){const u=e.collect(r,t,n);return!u||typeof u.then!="function"?"sync":(Promise.resolve(u).then(()=>this._recordCollectorSuccess(e),i=>{An(i)?this._recordCollectorSuccess(e):this._recordCollectorFailure(e,i)}),"async")}_recordCollectorSuccess(e){const r=this._logCollectorFailures.get(e)||0;r>0&&this._logCollectorFailures.set(e,r-1)}_recordCollectorFailure(e,r){const t=(this._logCollectorFailures.get(e)||0)+1;t>=Oe._collectorFailureLimit?(this._forceDisabledLogCollectors.add(e),this._appInstr&&(typeof r=="string"||r instanceof Error)&&this._appInstr.error(r)):this._logCollectorFailures.set(e,t)}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 bn(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)this._collect(e,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(se.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(se.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(se.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}}Oe._collectorFailureLimit=5;class Tn{get _lazyNextGen(){return this._nextgen||(this._nextgen=new Oe(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 xn=new Fr({logThreshold:300,reportListener:o=>{le==null||le.log(H,o)},errorListener:(o,e)=>{le==null||le.error(o,e)}}),Ie=new Tn(xn),Nn=Ie.registerInstrumentedApp.bind(Ie),le=Ie.getInstrumentation.bind(Ie)("IdleDetector"),Rn="264.105.0",jn="o11y";class ue{constructor(){this._envelope={diagnostics:{key:jn,generatedTimestamp:void 0,bundleCount:0,bucketHistogramCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:Rn},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 Z.getUpCounters(e,r)}static getValueRecorders(e,r=!0){return Z.getValueRecorders(e,r)}static getBucketHistograms(e,r=!0){return Z.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 ue;return e.staticAttributes&&r.withStaticAttributes(e.staticAttributes),e.messages&&e.messages.forEach((t,n)=>{r.withLogs(D.getSchemaId(n),t)}),e.upCounters&&r.withUpCounters(e.upCounters),e.valueRecorders&&r.withValueRecorders(e.valueRecorders),e.bucketHistograms&&r.withBucketHistograms(e.bucketHistograms),r.build()}}var Te;(function(o){var e,r;e={1:[function(t,n,u){n.exports=function(i,d){for(var h=Array(arguments.length-1),p=0,s=2,a=!0;s<arguments.length;)h[p++]=arguments[s++];return new Promise(function(c,l){h[p]=function(f){if(a)if(a=!1,f)l(f);else{for(var g=Array(arguments.length-1),m=0;m<g.length;)g[m++]=arguments[m];c.apply(null,g)}};try{i.apply(d||null,h)}catch(f){a&&(a=!1,l(f))}})}},{}],2:[function(t,n,u){u.length=function(s){var a=s.length;if(!a)return 0;for(var c=0;1<--a%4&&(s[0|a]||"")=="=";)++c;return Math.ceil(3*s.length)/4-c};for(var i=Array(64),d=Array(123),h=0;h<64;)d[i[h]=h<26?h+65:h<52?h+71:h<62?h-4:h-59|43]=h++;u.encode=function(s,a,c){for(var l,f=null,g=[],m=0,_=0;a<c;){var y=s[a++];switch(_){case 0:g[m++]=i[y>>2],l=(3&y)<<4,_=1;break;case 1:g[m++]=i[l|y>>4],l=(15&y)<<2,_=2;break;case 2:g[m++]=i[l|y>>6],g[m++]=i[63&y],_=0}8191<m&&((f=f||[]).push(String.fromCharCode.apply(String,g)),m=0)}return _&&(g[m++]=i[l],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 p="invalid encoding";u.decode=function(s,a,c){for(var l,f=c,g=0,m=0;m<s.length;){var _=s.charCodeAt(m++);if(_==61&&1<g)break;if((_=d[_])===o)throw Error(p);switch(g){case 0:l=_,g=1;break;case 1:a[c++]=l<<2|(48&_)>>4,l=_,g=2;break;case 2:a[c++]=(15&l)<<4|(60&_)>>2,l=_,g=3;break;case 3:a[c++]=(3&l)<<6|_,g=0}}if(g===1)throw Error(p);return c-f},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,n,u){n.exports=d;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 d(h,p){typeof h=="string"&&(p=h,h=o);var s=[];function a(l){if(typeof l!="string"){var f=c();if(d.verbose&&console.log("codegen: "+f),f="return "+f,l){for(var g=Object.keys(l),m=Array(g.length+1),_=Array(g.length),y=0;y<g.length;)m[y]=g[y],_[y]=l[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,l=l.replace(/%([%dfijs])/g,function(v,C){var w=b[k++];switch(C){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(l),a}function c(l){return"function "+(function(f){return!f||!(f=(""+f).replace(/[^\w$]/g,""))?"":(/^\d/.test(f)&&(f="_"+f),i.test(f)?f+"_":f)})(l||p)+"("+(h&&h.join(",")||"")+`){
|
|
2
2
|
`+s.join(`
|
|
3
3
|
`)+`
|
|
4
|
-
}`}return a.toString=c,a}d.verbose=!1},{}],4:[function(t,n,u){function i(){this.t={}}(n.exports=i).prototype.on=function(d,h,p){return(this.t[d]||(this.t[d]=[])).push({fn:h,ctx:p||this}),this},i.prototype.off=function(d,h){if(d===o)this.t={};else if(h===o)this.t[d]=[];else for(var p=this.t[d],s=0;s<p.length;)p[s].fn===h?p.splice(s,1):++s;return this},i.prototype.emit=function(d){var h=this.t[d];if(h){for(var p=[],s=1;s<arguments.length;)p.push(arguments[s++]);for(s=0;s<h.length;)h[s].fn.apply(h[s++].ctx,p)}return this}},{}],5:[function(t,n,u){n.exports=h;var i=t(1),d=t(7)("fs");function h(p,s,a){return s=typeof s=="function"?(a=s,{}):s||{},a?!s.xhr&&d&&d.readFile?d.readFile(p,function(c,l){return c&&typeof XMLHttpRequest!="undefined"?h.xhr(p,s,a):c?a(c):a(null,s.binary?l:l.toString("utf8"))}):h.xhr(p,s,a):i(h,this,p,s)}h.xhr=function(p,s,a){var c=new XMLHttpRequest;c.onreadystatechange=function(){if(c.readyState!==4)return o;if(c.status!==0&&c.status!==200)return a(Error("status "+c.status));if(s.binary){if(!(l=c.response))for(var l=[],f=0;f<c.responseText.length;++f)l.push(255&c.responseText.charCodeAt(f));return a(null,typeof Uint8Array!="undefined"?new Uint8Array(l):l)}return a(null,c.responseText)},s.binary&&("overrideMimeType"in c&&c.overrideMimeType("text/plain; charset=x-user-defined"),c.responseType="arraybuffer"),c.open("GET",p),c.send()}},{1:1,7:7}],6:[function(t,n,u){function i(a){function c(T,S,I,N){var j=S<0?1:0;T((S=j?-S:S)===0?0<1/S?0:2147483648:isNaN(S)?2143289344:34028234663852886e22<S?(j<<31|2139095040)>>>0:S<11754943508222875e-54?(j<<31|Math.round(S/1401298464324817e-60))>>>0:(j<<31|127+(T=Math.floor(Math.log(S)/Math.LN2))<<23|8388607&Math.round(S*Math.pow(2,-T)*8388608))>>>0,I,N)}function l(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,C;function w(T,S,I,N,j,M){var V,fe=N<0?1:0;(N=fe?-N:N)===0?(T(0,j,M+S),T(0<1/N?0:2147483648,j,M+I)):isNaN(N)?(T(0,j,M+S),T(2146959360,j,M+I)):17976931348623157e292<N?(T(0,j,M+S),T((fe<<31|2146435072)>>>0,j,M+I)):N<22250738585072014e-324?(T((V=N/5e-324)>>>0,j,M+S),T((fe<<31|V/4294967296)>>>0,j,M+I)):(T(4503599627370496*(V=N*Math.pow(2,-(N=(N=Math.floor(Math.log(N)/Math.LN2))===1024?1023:N)))>>>0,j,M+S),T((fe<<31|N+1023<<20|1048576*V&1048575)>>>0,j,M+I))}function A(T,S,I,N,j){return S=T(N,j+S),T=T(N,j+I),N=2*(T>>31)+1,j=T>>>20&2047,I=4294967296*(1048575&T)+S,j==2047?I?NaN:1/0*N:j==0?5e-324*N*I:N*Math.pow(2,j-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 R(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),C=b[3]===128,a.writeFloatLE=C?f:g,a.writeFloatBE=C?g:f,a.readFloatLE=C?m:_,a.readFloatBE=C?_:m):(a.writeFloatLE=c.bind(null,d),a.writeFloatBE=c.bind(null,h),a.readFloatLE=l.bind(null,p),a.readFloatBE=l.bind(null,s)),typeof Float64Array!="undefined"?(k=new Float64Array([-0]),v=new Uint8Array(k.buffer),C=v[7]===128,a.writeDoubleLE=C?x:R,a.writeDoubleBE=C?R:x,a.readDoubleLE=C?q:z,a.readDoubleBE=C?z:q):(a.writeDoubleLE=w.bind(null,d,0,4),a.writeDoubleBE=w.bind(null,h,4,0),a.readDoubleLE=A.bind(null,p,0,4),a.readDoubleBE=A.bind(null,s,4,0)),a}function d(a,c,l){c[l]=255&a,c[l+1]=a>>>8&255,c[l+2]=a>>>16&255,c[l+3]=a>>>24}function h(a,c,l){c[l]=a>>>24,c[l+1]=a>>>16&255,c[l+2]=a>>>8&255,c[l+3]=255&a}function p(a,c){return(a[c]|a[c+1]<<8|a[c+2]<<16|a[c+3]<<24)>>>0}function s(a,c){return(a[c]<<24|a[c+1]<<16|a[c+2]<<8|a[c+3])>>>0}n.exports=i(i)},{}],7:[function(t,n,u){n.exports=function(i){try{var d;return typeof t!="function"?null:(d=t(i))&&(d.length||Object.keys(d).length)?d:null}catch(h){return null}}},{}],8:[function(t,n,u){var i=u.isAbsolute=function(h){return/^(?:\/|\w+:)/.test(h)},d=u.normalize=function(a){var p=(a=a.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),s=i(a),a="";s&&(a=p.shift()+"/");for(var c=0;c<p.length;)p[c]===".."?0<c&&p[c-1]!==".."?p.splice(--c,2):s?p.splice(c,1):++c:p[c]==="."?p.splice(c,1):++c;return a+p.join("/")};u.resolve=function(h,p,s){return s||(p=d(p)),!i(p)&&(h=(h=s?h:d(h)).replace(/(?:\/|^)[^/]+$/,"")).length?d(h+"/"+p):p}},{}],9:[function(t,n,u){n.exports=function(i,d,h){var p=h||8192,s=p>>>1,a=null,c=p;return function(l){return l<1||s<l?i(l):(p<c+l&&(a=i(p),c=0),l=d.call(a,c,c+=l),7&c&&(c=1+(7|c)),l)}}},{}],10:[function(t,n,u){u.length=function(i){for(var d,h=0,p=0;p<i.length;++p)(d=i.charCodeAt(p))<128?h+=1:d<2048?h+=2:(64512&d)==55296&&(64512&i.charCodeAt(p+1))==56320?(++p,h+=4):h+=3;return h},u.read=function(i,d,h){if(h-d<1)return"";for(var p="",s=d;s<h;){var a,c=i[s++];c<=127?p+=String.fromCharCode(c):192<=c&&c<224?p+=128<=(a=(31&c)<<6|63&i[s++])?String.fromCharCode(a):"�":224<=c&&c<240?p+=2048<=(a=(15&c)<<12|(63&i[s++])<<6|63&i[s++])?String.fromCharCode(a):"�":240<=c&&((c=(7&c)<<18|(63&i[s++])<<12|(63&i[s++])<<6|63&i[s++])<65536||1114111<c?p+="�":p=p+String.fromCharCode(55296+((c-=65536)>>10))+String.fromCharCode(56320+(1023&c)))}return p},u.write=function(i,d,h){for(var p,s,a=h,c=0;c<i.length;++c)(p=i.charCodeAt(c))<128?d[h++]=p:(p<2048?d[h++]=p>>6|192:((64512&p)==55296&&(64512&(s=i.charCodeAt(c+1)))==56320?(++c,d[h++]=(p=65536+((1023&p)<<10)+(1023&s))>>18|240,d[h++]=p>>12&63|128):d[h++]=p>>12|224,d[h++]=p>>6&63|128),d[h++]=63&p|128);return h-a}},{}],11:[function(t,n,u){var i=t(14),d=t(33);function h(s,a,c,l){var f=!1;if(a.resolvedType)if(a.resolvedType instanceof i){s("switch(d%s){",l);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}',l,l,l),a.repeated||s("break"),f=!0),s("case%j:",m[_])("case %i:",g[m[_]])("m%s=%j",l,g[m[_]])("break");s("}")}else s('if(typeof d%s!=="object")',l)("throw TypeError(%j)",a.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",l,c,l);else{var y=!1;switch(a.type){case"double":case"float":s("m%s=Number(d%s)",l,l);break;case"uint32":case"fixed32":s("m%s=d%s>>>0",l,l);break;case"int32":case"sint32":case"sfixed32":s("m%s=d%s|0",l,l);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",l,l,y)('else if(typeof d%s==="string")',l)("m%s=parseInt(d%s,10)",l,l)('else if(typeof d%s==="number")',l)("m%s=d%s",l,l)('else if(typeof d%s==="object")',l)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",l,l,l,y?"true":"");break;case"bytes":s('if(typeof d%s==="string")',l)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",l,l,l)("else if(d%s.length >= 0)",l)("m%s=d%s",l,l);break;case"string":s("m%s=String(d%s)",l,l);break;case"bool":s("m%s=Boolean(d%s)",l,l)}}return s}function p(s,a,c,l){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",l,c,l,l,c,l,l):s("d%s=types[%i].toObject(m%s,o)",l,c,l);else{var f=!1;switch(a.type){case"double":case"float":s("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",l,l,l,l);break;case"uint64":f=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":s('if(typeof m%s==="number")',l)("d%s=o.longs===String?String(m%s):m%s",l,l,l)("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",l,l,l,l,f?"true":"",l);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",l,l,l,l,l);break;default:s("d%s=m%s",l,l)}}return s}u.fromObject=function(s){var a=s.fieldsArray,c=d.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 c("return new this.ctor");c("var m=new this.ctor");for(var l=0;l<a.length;++l){var f=a[l].resolve(),g=d.safeProp(f.name);f.map?(c("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),c('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",g),h(c,f,l,g+"[ks[i]]")("}")("}")):f.repeated?(c("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),h(c,f,l,g+"[i]")("}")("}")):(f.resolvedType instanceof i||c("if(d%s!=null){",g),h(c,f,l,g),f.resolvedType instanceof i||c("}"))}return c("return m")},u.toObject=function(s){var a=s.fieldsArray.slice().sort(d.compareFieldsById);if(!a.length)return d.codegen()("return {}");for(var c=d.codegen(["m","o"],s.name+"$toObject")("if(!o)")("o={}")("var d={}"),l=[],f=[],g=[],m=0;m<a.length;++m)a[m].partOf||(a[m].resolve().repeated?l:a[m].map?f:g).push(a[m]);if(l.length){for(c("if(o.arrays||o.defaults){"),m=0;m<l.length;++m)c("d%s=[]",d.safeProp(l[m].name));c("}")}if(f.length){for(c("if(o.objects||o.defaults){"),m=0;m<f.length;++m)c("d%s={}",d.safeProp(f[m].name));c("}")}if(g.length){for(c("if(o.defaults){"),m=0;m<g.length;++m){var _,y=g[m],b=d.safeProp(y.name);y.resolvedType instanceof i?c("d%s=o.enums===String?%j:%j",b,y.resolvedType.valuesById[y.typeDefault],y.typeDefault):y.long?c("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),c("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)("}")):c("d%s=%j",b,y.typeDefault)}c("}")}for(var k=!1,m=0;m<a.length;++m){var y=a[m],v=s.i.indexOf(y),b=d.safeProp(y.name);y.map?(k||(k=!0,c("var ks2")),c("if(m%s&&(ks2=Object.keys(m%s)).length){",b,b)("d%s={}",b)("for(var j=0;j<ks2.length;++j){"),c('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",b),p(c,y,v,b+"[ks2[j]]")("}")):y.repeated?(c("if(m%s&&m%s.length){",b,b)("d%s=[]",b)("for(var j=0;j<m%s.length;++j){",b),p(c,y,v,b+"[j]")("}")):(c("if(m%s!=null&&m.hasOwnProperty(%j)){",b,y.name),p(c,y,v,b),y.partOf&&c("if(o.oneofs)")("d%s=%j",d.safeProp(y.partOf.name),y.name)),c("}")}return c("return d")}},{14:14,33:33}],12:[function(t,n,u){n.exports=function(p){for(var s=h.codegen(["r","l","e","n"],p.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"+(p.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<p.fieldsArray.length;++a){var c=p.i[a].resolve(),l=c.resolvedType instanceof i?"int32":c.type,f="m"+h.safeProp(c.name);s("case %i: {",c.id),c.map?(s("if(%s===util.emptyObject)",f)("%s={}",f)("var c2 = r.uint32()+r.pos"),d.defaults[c.keyType]!==o?s("k=%j",d.defaults[c.keyType]):s("k=null"),d.defaults[l]!==o?s("value=%j",d.defaults[l]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",c.keyType)("case 2:"),d.basic[l]===o?s("value=types[%i].decode(r,r.uint32(),undefined,n+1)",a):s("value=r.%s()",l),s("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}"),d.long[c.keyType]!==o?s('%s[typeof k==="object"?util.longToHash(k):k]=value',f):(c.keyType==="string"&&s('if(k==="__proto__")')("util.makeProp(%s,k)",f),s("%s[k]=value",f))):c.repeated?(s("if(!(%s&&%s.length))",f,f)("%s=[]",f),d.packed[l]!==o&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",f,l)("}else"),d.basic[l]===o?s(c.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,l)):d.basic[l]===o?s(c.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,l),s("break")("}")}for(s("default:")("r.skipType(t&7,n)")("break")("}")("}"),a=0;a<p.i.length;++a){var g=p.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),d=t(32),h=t(33)},{14:14,32:32,33:33}],13:[function(t,n,u){n.exports=function(s){for(var a,c=h.codegen(["m","w"],s.name+"$encode")("if(!w)")("w=Writer.create()"),l=s.fieldsArray.slice().sort(h.compareFieldsById),f=0;f<l.length;++f){var g=l[f].resolve(),m=s.i.indexOf(g),_=g.resolvedType instanceof i?"int32":g.type,y=d.basic[_];a="m"+h.safeProp(g.name),g.map?(c("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|d.mapKey[g.keyType],g.keyType),y===o?c("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",m,a):c(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|y,_,a),c("}")("}")):g.repeated?(c("if(%s!=null&&%s.length){",a,a),g.packed&&d.packed[_]!==o?c("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()"):(c("for(var i=0;i<%s.length;++i)",a),y===o?p(c,g,m,a+"[i]"):c("w.uint32(%i).%s(%s[i])",(g.id<<3|y)>>>0,_,a)),c("}")):(g.optional&&c("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",a,g.name),y===o?p(c,g,m,a):c("w.uint32(%i).%s(%s)",(g.id<<3|y)>>>0,_,a))}return c("return w")};var i=t(14),d=t(32),h=t(33);function p(s,a,c,l){a.delimited?s("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",c,l,(a.id<<3|3)>>>0,(a.id<<3|4)>>>0):s("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",c,l,(a.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(t,n,u){n.exports=p;var i=t(22),d=(((p.prototype=Object.create(i.prototype)).constructor=p).className="Enum",t(21)),h=t(33);function p(s,a,c,l,f,g){if(i.call(this,s,c),a&&typeof a!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=l,this.comments=f||{},this.valuesOptions=g,this.n={},this.reserved=o,a)for(var m=Object.keys(a),_=0;_<m.length;++_)m[_]!=="__proto__"&&typeof a[m[_]]=="number"&&(this.valuesById[this.values[m[_]]=a[m[_]]]=m[_])}p.prototype.r=function(s){return s=this.e||s,i.prototype.r.call(this,s),Object.keys(this.values).forEach(a=>{var c=Object.assign({},this.o);this.n[a]=Object.assign(c,this.valuesOptions&&this.valuesOptions[a]&&this.valuesOptions[a].features)}),this},p.fromJSON=function(s,a){return s=new p(s,a.values,a.options,a.comment,a.comments),s.reserved=a.reserved,a.edition&&(s.e=a.edition),s.u="proto3",s},p.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,h.toObject(["edition",this.h(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:o,"comment",s?this.comment:o,"comments",s?this.comments:o])},p.prototype.add=function(s,a,c,l){if(!h.isString(s))throw TypeError("name must be a string");if(!h.isInteger(a))throw TypeError("id must be an integer");if(s!=="__proto__"){if(this.values[s]!==o)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]!==o){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;l&&(this.valuesOptions===o&&(this.valuesOptions={}),this.valuesOptions[s]=l||null),this.comments[s]=c||null}return this},p.prototype.remove=function(s){if(!h.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},p.prototype.isReservedId=function(s){return d.isReservedId(this.reserved,s)},p.prototype.isReservedName=function(s){return d.isReservedName(this.reserved,s)}},{21:21,22:22,33:33}],15:[function(t,n,u){n.exports=c;var i,d=t(22),h=(((c.prototype=Object.create(d.prototype)).constructor=c).className="Field",t(14)),p=t(32),s=t(33),a=/^required|optional|repeated$/;function c(l,f,g,m,_,y,b){if(s.isObject(m)?(b=_,y=m,m=_=o):s.isObject(_)&&(b=y,y=_,_=o),d.call(this,l,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!==o&&!a.test(m=m.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(_!==o&&!s.isString(_))throw TypeError("extend must be a string");this.rule=(m=m==="proto3_optional"?"optional":m)&&m!=="optional"?m:o,this.type=g,this.id=f,this.extend=_||o,this.repeated=m==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!s.Long&&p.long[g]!==o,this.bytes=g==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=b}c.fromJSON=function(l,f){return l=new c(l,f.id,f.type,f.rule,f.extend,f.options,f.comment),f.edition&&(l.e=f.edition),l.u="proto3",l},Object.defineProperty(c.prototype,"required",{get:function(){return this.o.field_presence==="LEGACY_REQUIRED"}}),Object.defineProperty(c.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(c.prototype,"delimited",{get:function(){return this.resolvedType instanceof i&&this.o.message_encoding==="DELIMITED"}}),Object.defineProperty(c.prototype,"packed",{get:function(){return this.o.repeated_field_encoding==="PACKED"}}),Object.defineProperty(c.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||this.o.field_presence!=="IMPLICIT")}}),c.prototype.setOption=function(l,f,g){return d.prototype.setOption.call(this,l,f,g)},c.prototype.toJSON=function(l){return l=!!l&&!!l.keepComments,s.toObject(["edition",this.h(),"rule",this.rule!=="optional"&&this.rule||o,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",l?this.comment:o])},c.prototype.resolve=function(){var l;return this.resolved?this:((this.typeDefault=p.defaults[this.type])===o?(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 h&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed===o||!this.resolvedType||this.resolvedType instanceof h||delete this.options.packed,Object.keys(this.options).length||(this.options=o)),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,l=s.newBuffer(s.base64.length(this.typeDefault)),0):s.utf8.write(this.typeDefault,l=s.newBuffer(s.utf8.length(this.typeDefault)),0),this.typeDefault=l),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),d.prototype.resolve.call(this))},c.prototype.f=function(l){var f;return l!=="proto2"&&l!=="proto3"?{}:(l={},this.rule==="required"&&(l.field_presence="LEGACY_REQUIRED"),this.parent&&p.defaults[this.type]===o&&(f=this.parent.get(this.type.split(".").pop()))&&f instanceof i&&f.group&&(l.message_encoding="DELIMITED"),this.getOption("packed")===!0?l.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(l.repeated_field_encoding="EXPANDED"),l)},c.prototype.r=function(l){return d.prototype.r.call(this,this.e||l)},c.d=function(l,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 c(y,l,f,g,{default:m}))}},c.c=function(l){i=l}},{14:14,22:22,32:32,33:33}],16:[function(t,n,u){var i=n.exports=t(17);i.build="light",i.load=function(d,h,p){return(h=typeof h=="function"?(p=h,new i.Root):h||new i.Root).load(d,p)},i.loadSync=function(d,h){return(h=h||new i.Root).loadSync(d)},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,u){var i=u;function d(){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=d,d()},{24:24,25:25,27:27,28:28,35:35,39:39,40:40}],18:[function(t,n,u){n.exports=p;var i=t(15),d=(((p.prototype=Object.create(i.prototype)).constructor=p).className="MapField",t(32)),h=t(33);function p(s,a,c,l,f,g){if(i.call(this,s,a,l,o,o,f,g),!h.isString(c))throw TypeError("keyType must be a string");this.keyType=c,this.resolvedKeyType=null,this.map=!0}p.fromJSON=function(s,a){return new p(s,a.id,a.keyType,a.type,a.options,a.comment)},p.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,h.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:o])},p.prototype.resolve=function(){if(this.resolved)return this;if(d.mapKey[this.keyType]===o)throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},p.d=function(s,a,c){return typeof c=="function"?c=h.decorateType(c).name:c&&typeof c=="object"&&(c=h.decorateEnum(c).name),function(l,f){h.decorateType(l.constructor).add(new p(f,s,a,c))}}},{15:15,32:32,33:33}],19:[function(t,n,u){n.exports=d;var i=t(35);function d(h){if(h)for(var p=Object.keys(h),s=0;s<p.length;++s){var a=p[s];a!=="__proto__"&&(this[a]=h[a])}}d.create=function(h){return this.$type.create(h)},d.encode=function(h,p){return this.$type.encode(h,p)},d.encodeDelimited=function(h,p){return this.$type.encodeDelimited(h,p)},d.decode=function(h){return this.$type.decode(h)},d.decodeDelimited=function(h){return this.$type.decodeDelimited(h)},d.verify=function(h){return this.$type.verify(h)},d.fromObject=function(h){return this.$type.fromObject(h)},d.toObject=function(h,p){return this.$type.toObject(h,p)},d.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},{35:35}],20:[function(t,n,u){n.exports=h;var i=t(22),d=(((h.prototype=Object.create(i.prototype)).constructor=h).className="Method",t(33));function h(p,s,a,c,l,f,g,m,_){if(d.isObject(l)?(g=l,l=f=o):d.isObject(f)&&(g=f,f=o),s!==o&&!d.isString(s))throw TypeError("type must be a string");if(!d.isString(a))throw TypeError("requestType must be a string");if(!d.isString(c))throw TypeError("responseType must be a string");i.call(this,p,g),this.type=s||"rpc",this.requestType=a,this.requestStream=!!l||o,this.responseType=c,this.responseStream=!!f||o,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=m,this.parsedOptions=_}h.fromJSON=function(p,s){return new h(p,s.type,s.requestType,s.responseType,s.requestStream,s.responseStream,s.options,s.comment,s.parsedOptions)},h.prototype.toJSON=function(p){return p=!!p&&!!p.keepComments,d.toObject(["type",this.type!=="rpc"&&this.type||o,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",p?this.comment:o,"parsedOptions",this.parsedOptions])},h.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,u){n.exports=f;var i,d,h,p=t(22),s=(((f.prototype=Object.create(p.prototype)).constructor=f).className="Namespace",t(15)),a=t(33),c=t(23);function l(m,_){if(!m||!m.length)return o;for(var y={},b=0;b<m.length;++b)y[m[b].name]=m[b].toJSON(_);return y}function f(m,_){p.call(this,m,_),this.nested=o,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=l,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",l(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!==o?i:_.values!==o?h:_.methods!==o?d:_.id!==o?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 h)return this.nested[m].values;throw Error("no such enum: "+m)},f.prototype.add=function(m){if(!(m instanceof s&&m.extend!==o||m instanceof i||m instanceof c||m instanceof h||m instanceof d||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 d)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 d||this instanceof h||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 p))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=o),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,p.prototype.v.call(this,m),this.nestedArray.forEach(_=>{_.v(m)})),this},f.prototype.lookup=function(m,_,y){if(typeof _=="boolean"?(y=_,_=o):_&&!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,[h]);if(_)return _;throw Error("no such Enum '"+m+"' in "+this)},f.prototype.lookupTypeOrEnum=function(m){var _=this.lookup(m,[i,h]);if(_)return _;throw Error("no such Type or Enum '"+m+"' in "+this)},f.prototype.lookupService=function(m){var _=this.lookup(m,[d]);if(_)return _;throw Error("no such Service '"+m+"' in "+this)},f.c=function(m,_,y){i=m,d=_,h=y}},{15:15,22:22,23:23,33:33}],22:[function(t,n,u){(n.exports=c).className="ReflectionObject";const i=t(23);var d,h=t(33),p={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 c(l,f){if(!h.isString(l))throw TypeError("name must be a string");if(f&&!h.isObject(f))throw TypeError("options must be an object");this.options=f,this.parsedOptions=null,this.name=l,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(c.prototype,{root:{get:function(){for(var l=this;l.parent!==null;)l=l.parent;return l}},fullName:{get:function(){for(var l=[this.name],f=this.parent;f;)l.unshift(f.name),f=f.parent;return l.join(".")}}}),c.prototype.toJSON=function(){throw Error()},c.prototype.onAdd=function(l){this.parent&&this.parent!==l&&this.parent.remove(this),this.parent=l,this.resolved=!1,l=l.root,l instanceof d&&l.j(this)},c.prototype.onRemove=function(l){l=l.root,l instanceof d&&l.O(this),this.parent=null,this.resolved=!1},c.prototype.resolve=function(){return this.resolved||this.root instanceof d&&(this.resolved=!0),this},c.prototype.v=function(l){return this.r(this.e||l)},c.prototype.r=function(l){if(!this.g){var f={};if(!l)throw Error("Unknown edition for "+this.fullName);var g=Object.assign(this.options?Object.assign({},this.options.features):{},this.f(l));if(this.e){if(l==="proto2")f=Object.assign({},s);else if(l==="proto3")f=Object.assign({},a);else{if(l!=="2023")throw Error("Unknown edition: "+l);f=Object.assign({},p)}this.o=Object.assign(f,g||{})}else{if(this.partOf instanceof i)l=Object.assign({},this.partOf.o),this.o=Object.assign(l,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}},c.prototype.f=function(){return{}},c.prototype.getOption=function(l){return this.options?this.options[l]:o},c.prototype.setOption=function(l,f,g){return l!=="__proto__"&&(this.options||(this.options={}),/^features\./.test(l)?h.setProperty(this.options,l,f,g):g&&this.options[l]!==o||(this.getOption(l)!==f&&(this.resolved=!1),this.options[l]=f)),this},c.prototype.setParsedOption=function(l,f,g){var m,_,y;return l!=="__proto__"&&(this.parsedOptions||(this.parsedOptions=[]),m=this.parsedOptions,g?(_=m.find(function(b){return Object.prototype.hasOwnProperty.call(b,l)}))?(y=_[l],h.setProperty(y,g,f)):((_={})[l]=h.setProperty({},g,f),m.push(_)):((y={})[l]=f,m.push(y))),this},c.prototype.setOptions=function(l,f){if(l)for(var g=Object.keys(l),m=0;m<g.length;++m)this.setOption(g[m],l[g[m]],f);return this},c.prototype.toString=function(){var l=this.constructor.className,f=this.fullName;return f.length?l+" "+f:l},c.prototype.h=function(){return this.e&&this.e!=="proto3"?this.e:o},c.c=function(l){d=l}},{23:23,33:33}],23:[function(t,n,u){n.exports=p;var i=t(22),d=(((p.prototype=Object.create(i.prototype)).constructor=p).className="OneOf",t(15)),h=t(33);function p(a,c,l,f){if(Array.isArray(c)||(l=c,c=o),i.call(this,a,l),c!==o&&!Array.isArray(c))throw TypeError("fieldNames must be an Array");this.oneof=c||[],this.fieldsArray=[],this.comment=f}function s(a){if(a.parent)for(var c=0;c<a.fieldsArray.length;++c)a.fieldsArray[c].parent||a.parent.add(a.fieldsArray[c])}p.fromJSON=function(a,c){return new p(a,c.oneof,c.options,c.comment)},p.prototype.toJSON=function(a){return a=!!a&&!!a.keepComments,h.toObject(["options",this.options,"oneof",this.oneof,"comment",a?this.comment:o])},p.prototype.add=function(a){if(a instanceof d)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")},p.prototype.remove=function(a){if(!(a instanceof d))throw TypeError("field must be a Field");var c=this.fieldsArray.indexOf(a);if(c<0)throw Error(a+" is not a member of "+this);return this.fieldsArray.splice(c,1),-1<(c=this.oneof.indexOf(a.name))&&this.oneof.splice(c,1),a.partOf=null,this},p.prototype.onAdd=function(a){i.prototype.onAdd.call(this,a);for(var c=0;c<this.oneof.length;++c){var l=a.get(this.oneof[c]);l&&!l.partOf&&(l.partOf=this).fieldsArray.push(l)}s(this)},p.prototype.onRemove=function(a){for(var c,l=0;l<this.fieldsArray.length;++l)(c=this.fieldsArray[l]).parent&&c.parent.remove(c);i.prototype.onRemove.call(this,a)},Object.defineProperty(p.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}}),p.d=function(){for(var a=Array(arguments.length),c=0;c<arguments.length;)a[c]=arguments[c++];return function(l,f){h.decorateType(l.constructor).add(new p(f,a)),Object.defineProperty(l,f,{get:h.oneOfGetter(a),set:h.oneOfSetter(a)})}}},{15:15,22:22,33:33}],24:[function(t,n,u){n.exports=a;var i,d=t(35),h=d.LongBits,p=d.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 c(){return d.Buffer?function(y){return(a.create=function(b){return d.Buffer.isBuffer(b)?new i(b):f(b)})(y)}:f}var l,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 h(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 h(m(this.buf,this.pos+=4),m(this.buf,this.pos+=4))}a.create=c(),a.prototype.k=d.Array.prototype.subarray||d.Array.prototype.slice,a.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128||(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128||!((this.pos+=5)>this.len))))))return l;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=d.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=d.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=d.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 p.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=d.recursionLimit,a.prototype.skipType=function(y,b){if(a.recursionLimit<(b=b===o?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=c(),i.c();var b=d.Long?"toLong":"toNumber";d.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,u){n.exports=h;var i=t(24),d=((h.prototype=Object.create(i.prototype)).constructor=h,t(35));function h(p){i.call(this,p)}h.c=function(){d.Buffer&&(h.prototype.k=d.Buffer.prototype.slice)},h.prototype.string=function(){var p=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+p,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+p,this.len))},h.c()},{24:24,35:35}],26:[function(t,n,u){n.exports=f;var i,d,h,p=t(21),s=(((f.prototype=Object.create(p.prototype)).constructor=f).className="Root",t(15)),a=t(14),c=t(23),l=t(33);function f(y){p.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=l.path.resolve,f.prototype.fetch=l.fetch,f.prototype.load=function y(b,k,v){typeof k=="function"&&(v=k,k=o);var C=this;if(!v)return l.asPromise(y,C,b,k);var w=v===g;function A(I,N){if(v){if(w)throw I;N&&N.resolveAll();var j=v;v=null,j(I,N)}}function x(I){var N=I.lastIndexOf("google/protobuf/");return-1<N&&(I=I.substring(N),I in h)?I:null}function R(I,N){try{if(l.isString(N)&&(N[0]||"")=="{"&&(N=JSON.parse(N)),l.isString(N)){d.filename=I;var j,M=d(N,C,k),V=0;if(M.imports)for(;V<M.imports.length;++V)(j=x(M.imports[V])||C.resolvePath(I,M.imports[V]))&&q(j);if(M.weakImports)for(V=0;V<M.weakImports.length;++V)(j=x(M.weakImports[V])||C.resolvePath(I,M.weakImports[V]))&&q(j,!0)}else C.setOptions(N.options).addJSON(N.nested)}catch(fe){A(fe)}w||z||A(null,C)}function q(I,N){if(I=x(I)||I,!~C.files.indexOf(I))if(C.files.push(I),I in h)w?R(I,h[I]):(++z,setTimeout(function(){--z,R(I,h[I])}));else if(w){var j;try{j=l.fs.readFileSync(I).toString("utf8")}catch(M){return void(N||A(M))}R(I,j)}else++z,C.fetch(I,function(M,V){--z,v&&(M?N?z||A(null,C):A(M):R(I,V))})}var z=0;l.isString(b)&&(b=[b]);for(var T,S=0;S<b.length;++S)(T=C.resolvePath("",b[S]))&&q(T);return w?C.resolveAll():z||A(null,C),C},f.prototype.loadSync=function(y,b){if(l.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 p.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,o,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===o||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 c)){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!==o&&(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 p){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,d=b,h=k}},{14:14,15:15,21:21,23:23,33:33}],27:[function(t,n,u){n.exports={}},{}],28:[function(t,n,u){u.Service=t(29)},{29:29}],29:[function(t,n,u){n.exports=d;var i=t(35);function d(h,p,s){if(typeof h!="function")throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=h,this.requestDelimited=!!p,this.responseDelimited=!!s}((d.prototype=Object.create(i.EventEmitter.prototype)).constructor=d).prototype.rpcCall=function h(p,s,a,c,l){if(!c)throw TypeError("request must be specified");var f=this;if(!l)return i.asPromise(h,f,p,s,a,c);if(!f.rpcImpl)return setTimeout(function(){l(Error("already ended"))},0),o;try{return f.rpcImpl(p,s[f.requestDelimited?"encodeDelimited":"encode"](c).finish(),function(g,m){if(g)return f.emit("error",g,p),l(g);if(m===null)return f.end(!0),o;if(!(m instanceof a))try{m=a[f.responseDelimited?"decodeDelimited":"decode"](m)}catch(_){return f.emit("error",_,p),l(_)}return f.emit("data",m,p),l(null,m)})}catch(g){return f.emit("error",g,p),setTimeout(function(){l(g)},0),o}},d.prototype.end=function(h){return this.rpcImpl&&(h||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(t,n,u){n.exports=a;var i=t(21),d=(((a.prototype=Object.create(i.prototype)).constructor=a).className="Service",t(20)),h=t(33),p=t(28),s=h.patterns.reservedRe;function a(l,f){i.call(this,l,f),this.methods={},this._=null}function c(l){return l._=null,l}a.fromJSON=function(l,f){var g=new a(l,f.options);if(f.methods)for(var m=Object.keys(f.methods),_=0;_<m.length;++_)g.add(d.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(l){var f=i.prototype.toJSON.call(this,l),g=!!l&&!!l.keepComments;return h.toObject(["edition",this.h(),"options",f&&f.options||o,"methods",i.arrayToJSON(this.methodsArray,l)||{},"nested",f&&f.nested||o,"comment",g?this.comment:o])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._||(this._=h.toArray(this.methods))}}),a.prototype.get=function(l){return Object.prototype.hasOwnProperty.call(this.methods,l)?this.methods[l]:i.prototype.get.call(this,l)},a.prototype.resolveAll=function(){if(this.b){i.prototype.resolve.call(this);for(var l=this.methodsArray,f=0;f<l.length;++f)l[f].resolve()}return this},a.prototype.v=function(l){return this.p&&(l=this.e||l,i.prototype.v.call(this,l),this.methodsArray.forEach(f=>{f.v(l)})),this},a.prototype.add=function(l){if(this.get(l.name))throw Error("duplicate name '"+l.name+"' in "+this);return l instanceof d?l.name==="__proto__"?this:c((this.methods[l.name]=l).parent=this):i.prototype.add.call(this,l)},a.prototype.remove=function(l){if(l instanceof d){if(this.methods[l.name]!==l)throw Error(l+" is not a member of "+this);return delete this.methods[l.name],l.parent=null,c(this)}return i.prototype.remove.call(this,l)},a.prototype.create=function(l,f,g){for(var m,_=new p.Service(l,f,g),y=0;y<this.methodsArray.length;++y){var b=h.lcFirst((m=this._[y]).resolve().name).replace(/[^$\w_]/g,"");_[b]=h.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,u){n.exports=v;var i=t(21),d=(((v.prototype=Object.create(i.prototype)).constructor=v).className="Type",t(14)),h=t(23),p=t(15),s=t(18),a=t(30),c=t(19),l=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=o,this.extensions=o,this.reserved=o,this.group=o,this.A=null,this.i=null,this.T=null,this.x=null}function C(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]],R=x.id;if(this.A[R])throw Error("duplicate id "+R+" in "+this);this.A[R]=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 c||((w.prototype=new c).constructor=w,g.merge(w.prototype,A)),w.$type=w.prototype.$type=this,g.merge(w,c,!0),this.x=w,0);x<this.fieldsArray.length;++x)this.i[x].resolve();for(var R={},x=0;x<this.oneofsArray.length;++x)R[this.T[x].resolve().name]={get:g.oneOfGetter(this.T[x].oneof),set:g.oneOfSetter(this.T[x].oneof)};x&&Object.defineProperties(w.prototype,R)}}}),v.generateConstructor=function(w){for(var A,x=g.codegen(["p"],w.name),R=0;R<w.fieldsArray.length;++R)(A=w.i[R]).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),R=(x.extensions=A.extensions,x.reserved=A.reserved,Object.keys(A.fields)),q=0;q<R.length;++q)x.add((A.fields[R[q]].keyType!==void 0?s:p).fromJSON(R[q],A.fields[R[q]]));if(A.oneofs)for(R=Object.keys(A.oneofs),q=0;q<R.length;++q)x.add(h.fromJSON(R[q],A.oneofs[R[q]]));if(A.nested)for(R=Object.keys(A.nested),q=0;q<R.length;++q){var z=A.nested[R[q]];x.add((z.id!==o?p:z.fields!==o?v:z.values!==o?d:z.methods!==o?a:i).fromJSON(R[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||o,"oneofs",i.arrayToJSON(this.oneofsArray,w),"fields",i.arrayToJSON(this.fieldsArray.filter(function(R){return!R.declaringField}),w)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:o,"reserved",this.reserved&&this.reserved.length?this.reserved:o,"group",this.group||o,"nested",A&&A.nested||o,"comment",x?this.comment:o])},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 p&&w.extend===o){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),C(this))}return w instanceof h?w.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),(this.oneofs[w.name]=w).onAdd(this),C(this)):i.prototype.add.call(this,w)},v.prototype.remove=function(w){if(w instanceof p&&w.extend===o){if(this.fields&&this.fields[w.name]===w)return delete this.fields[w.name],w.parent=null,w.onRemove(this),C(this);throw Error(w+" is not a member of "+this)}if(w instanceof h){if(this.oneofs&&this.oneofs[w.name]===w)return delete this.oneofs[w.name],w.parent=null,w.onRemove(this),C(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 R=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:l,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,R=k[R];return R&&((x=Object.create(this)).fromObject=this.fromObject,this.fromObject=R.fromObject.bind(x),x.toObject=this.toObject,this.toObject=R.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,R){return this.setup().decode(w,A,x,R)},v.prototype.decodeDelimited=function(w){return w instanceof l||(w=l.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,u){var i=i(33),d=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function h(p,s){var a=0,c=Object.create(null);for(s|=0;a<p.length;)c[d[a+s]]=p[a++];return c}u.basic=h([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),u.defaults=h([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),u.long=h([0,0,0,1,1],7),u.mapKey=h([0,0,0,5,5,0,0,0,1,1,0,2],2),u.packed=h([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(t,n,u){var i,d,h=n.exports=t(35),p=t(27),s=(h.codegen=t(3),h.fetch=t(5),h.path=t(8),h.patterns=t(36),h.patterns.reservedRe),a=h.patterns.unsafePropertyRe,c=(h.fs=h.inquire("fs"),h.toArray=function(f){if(f){for(var g=Object.keys(f),m=Array(g.length),_=0;_<g.length;)m[_]=f[g[_++]];return m}return[]},h.toObject=function(f){for(var g={},m=0;m<f.length;){var _=f[m++],y=f[m++];y!==o&&(g[_]=y)}return g},h.isReserved=function(f){return s.test(f)},h.safeProp=function(f){return!/^[$\w_]+$/.test(f)||s.test(f)?"["+JSON.stringify(f)+"]":"."+f},h.ucFirst=function(f){return(f[0]||"").toUpperCase()+f.substring(1)},/_([a-z])/g),l=(h.camelCase=function(f){return f.substring(0,1)+f.substring(1).replace(c,function(g,m){return m.toUpperCase()})},h.compareFieldsById=function(f,g){return f.id-g.id},h.decorateType=function(f,g){return f.$type?(g&&f.$type.name!==g&&(h.decorateRoot.remove(f.$type),f.$type.name=g,h.decorateRoot.add(f.$type)),f.$type):(g=new(i=i||t(31))(g||f.name),h.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);h.decorateEnum=function(f){var g;return f.$type||(g=new(d=d||t(14))("Enum"+l++,f),h.decorateRoot.add(g),Object.defineProperty(f,"$type",{value:g,enumerable:!1}),g)},h.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 C=k.shift();if(!a.test(C))if(0<k.length)b[C]=y(b[C]||{},k,v);else{if((k=b[C])&&_)return b;k&&(v=[].concat(k).concat(v)),b[C]=v}return b})(f,g=g.split("."),m);throw TypeError("path must be specified")},Object.defineProperty(h,"decorateRoot",{get:function(){return p.decorated||(p.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,u){n.exports=d;var i=t(35);function d(s,a){this.lo=s>>>0,this.hi=a>>>0}var h=d.zero=new d(0,0),p=(h.toNumber=function(){return 0},h.zzEncode=h.zzDecode=function(){return this},h.length=function(){return 1},d.zeroHash="\0\0\0\0\0\0\0\0",d.fromNumber=function(s){var a,c;return s===0?h:(c=(s=(a=s<0)?-s:s)>>>0,s=(s-c)/4294967296>>>0,a&&(s=~s>>>0,c=~c>>>0,4294967295<++c&&(c=0,4294967295<++s&&(s=0))),new d(c,s))},d.from=function(s){if(typeof s=="number")return d.fromNumber(s);if(i.isString(s)){if(!i.Long)return d.fromNumber(parseInt(s,10));s=i.Long.fromString(s)}return s.low||s.high?new d(s.low>>>0,s.high>>>0):h},d.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},d.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);d.fromHash=function(s){return s==="\0\0\0\0\0\0\0\0"?h:new d((p.call(s,0)|p.call(s,1)<<8|p.call(s,2)<<16|p.call(s,3)<<24)>>>0,(p.call(s,4)|p.call(s,5)<<8|p.call(s,6)<<16|p.call(s,7)<<24)>>>0)},d.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)},d.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},d.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},d.prototype.length=function(){var s=this.lo,a=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c==0?a==0?s<16384?s<128?1:2:s<2097152?3:4:a<16384?a<128?5:6:a<2097152?7:8:c<128?9:10}},{35:35}],35:[function(t,n,u){var i=u;function d(p,s,a){for(var c=Object.keys(s),l=0;l<c.length;++l)p[c[l]]!==o&&a||c[l]!=="__proto__"&&(p[c[l]]=s[c[l]]);return p}function h(p){function s(a,c){if(!(this instanceof s))return new s(a,c);Object.defineProperty(this,"message",{get:function(){return a}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:Error().stack||""}),c&&d(this,c)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return p},set:o,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(p){return typeof p=="number"&&isFinite(p)&&Math.floor(p)===p},i.isString=function(p){return typeof p=="string"||p instanceof String},i.isObject=function(p){return p&&typeof p=="object"},i.isset=i.isSet=function(p,s){var a=p[s];return a!=null&&p.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(p){return typeof p=="number"?i.Buffer?i.L(p):new i.Array(p):i.Buffer?i.S(p):typeof Uint8Array=="undefined"?p:new Uint8Array(p)},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(p){return p?i.LongBits.from(p).toHash():i.LongBits.zeroHash},i.longFromHash=function(p,s){return p=i.LongBits.fromHash(p),i.Long?i.Long.fromBits(p.lo,p.hi,s):p.toNumber(!!s)},i.merge=d,i.recursionLimit=100,i.makeProp=function(p,s){Object.defineProperty(p,s,{enumerable:!0,configurable:!0,writable:!0})},i.lcFirst=function(p){return(p[0]||"").toLowerCase()+p.substring(1)},i.newError=h,i.ProtocolError=h("ProtocolError"),i.oneOfGetter=function(p){for(var s={},a=0;a<p.length;++a)s[p[a]]=1;return function(){for(var c=Object.keys(this),l=c.length-1;-1<l;--l)if(s[c[l]]===1&&this[c[l]]!==o&&this[c[l]]!==null)return c[l]}},i.oneOfSetter=function(p){return function(s){for(var a=0;a<p.length;++a)p[a]!==s&&delete this[p[a]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i.c=function(){var p=i.Buffer;p?(i.S=p.from!==Uint8Array.from&&p.from||function(s,a){return new p(s,a)},i.L=p.allocUnsafe||function(s){return new p(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,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,n,u){n.exports=function(s){var a=d.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"),c=s.oneofsArray,l={};c.length&&a("var p={}");for(var f=0;f<s.fieldsArray.length;++f){var g,m=s.i[f].resolve(),_="m"+d.safeProp(m.name);m.optional&&a("if(%s!=null&&m.hasOwnProperty(%j)){",_,m.name),m.map?(a("if(!util.isObject(%s))",_)("return%j",h(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",h(b,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":y("if(!util.key64Re.test(%s))",k)("return%j",h(b,"integer|Long key"));break;case"bool":y("if(!util.key2Re.test(%s))",k)("return%j",h(b,"boolean key"))}})(a,m,"k[i]"),p(a,m,f,_+"[k[i]]")("}")):m.repeated?(a("if(!Array.isArray(%s))",_)("return%j",h(m,"array"))("for(var i=0;i<%s.length;++i){",_),p(a,m,f,_+"[i]")("}")):(m.partOf&&(g=d.safeProp(m.partOf.name),l[m.partOf.name]===1&&a("if(p%s===1)",g)("return%j",m.partOf.name+": multiple values"),l[m.partOf.name]=1,a("p%s=1",g)),p(a,m,f,_)),m.optional&&a("}")}return a("return null")};var i=t(14),d=t(33);function h(s,a){return s.name+": "+a+(s.repeated&&a!=="array"?"[]":s.map&&a!=="object"?"{k:"+s.keyType+"}":"")+" expected"}function p(s,a,c,l){if(a.resolvedType)if(a.resolvedType instanceof i){s("switch(%s){",l)("default:")("return%j",h(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);",c,l)("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))",l)("return%j",h(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)))",l,l,l,l)("return%j",h(a,"integer|Long"));break;case"float":case"double":s('if(typeof %s!=="number")',l)("return%j",h(a,"number"));break;case"bool":s('if(typeof %s!=="boolean")',l)("return%j",h(a,"boolean"));break;case"string":s("if(!util.isString(%s))",l)("return%j",h(a,"string"));break;case"bytes":s('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',l,l,l)("return%j",h(a,"buffer"))}return s}},{14:14,33:33}],38:[function(t,n,u){var i=t(19);u[".google.protobuf.Any"]={fromObject:function(d,h){if(d&&d["@type"]){var p,s=d["@type"].substring(1+d["@type"].lastIndexOf("/")),s=this.lookup(s);if(s)return~(p=(d["@type"][0]||"")=="."?d["@type"].slice(1):d["@type"]).indexOf("/")||(p="/"+p),this.create({type_url:p,value:s.encode(s.fromObject(d,h===o?1:h+1)).finish()})}return this.fromObject(d,h)},toObject:function(d,h){var p,s,a="",c="";return h&&h.json&&d.type_url&&d.value&&(c=d.type_url.substring(1+d.type_url.lastIndexOf("/")),a=d.type_url.substring(0,1+d.type_url.lastIndexOf("/")),(p=this.lookup(c))&&(d=p.decode(d.value))),!(d instanceof this.ctor)&&d instanceof i?(p=d.$type.toObject(d,h),s=d.$type.fullName[0]==="."?d.$type.fullName.slice(1):d.$type.fullName,p["@type"]=c=(a=a===""?"type.googleapis.com/":a)+s,p):this.toObject(d,h)}}},{19:19}],39:[function(t,n,u){n.exports=f;var i,d=t(35),h=d.LongBits,p=d.base64,s=d.utf8;function a(v,C,w){this.fn=v,this.len=C,this.next=o,this.val=w}function c(){}function l(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(c,0,0),this.tail=this.head,this.states=null}function g(){return d.Buffer?function(){return(f.create=function(){return new i})()}:function(){return new f}}function m(v,C,w){C[w]=255&v}function _(v,C){this.len=v,this.next=o,this.val=C}function y(v,C,w){for(;v.hi;)C[w++]=127&v.lo|128,v.lo=(v.lo>>>7|v.hi<<25)>>>0,v.hi>>>=7;for(;127<v.lo;)C[w++]=127&v.lo|128,v.lo=v.lo>>>7;C[w++]=v.lo}function b(v,C,w){C[w]=255&v,C[w+1]=v>>>8&255,C[w+2]=v>>>16&255,C[w+3]=v>>>24}f.create=g(),f.alloc=function(v){return new d.Array(v)},d.Array!==Array&&(f.alloc=d.pool(f.alloc,d.Array.prototype.subarray)),f.prototype.N=function(v,C,w){return this.tail=this.tail.next=new a(v,C,w),this.len+=C,this},(_.prototype=Object.create(a.prototype)).fn=function(v,C,w){for(;127<v;)C[w++]=127&v|128,v>>>=7;C[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,h.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=h.from(v),this.N(y,v.length(),v)},f.prototype.sint64=function(v){return v=h.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=h.from(v),this.N(b,4,v.lo).N(b,4,v.hi)},f.prototype.float=function(v){return this.N(d.float.writeFloatLE,4,v)},f.prototype.double=function(v){return this.N(d.float.writeDoubleLE,8,v)};var k=d.Array.prototype.set?function(v,C,w){C.set(v,w)}:function(v,C,w){for(var A=0;A<v.length;++A)C[w+A]=v[A]};f.prototype.bytes=function(v){var C,w=v.length>>>0;return w?(d.isString(v)&&(C=f.alloc(w=p.length(v)),p.decode(v,C,0),v=C),this.uint32(w).N(k,w,v)):this.N(m,1,0)},f.prototype.string=function(v){var C=s.length(v);return C?this.uint32(C).N(s.write,C,v):this.N(m,1,0)},f.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new a(c,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(c,0,0),this.len=0),this},f.prototype.ldelim=function(){var v=this.head,C=this.tail,w=this.len;return this.reset().uint32(w),w&&(this.tail.next=v.next,this.tail=C,this.len+=w),this},f.prototype.finish=function(){for(var v=this.head.next,C=this.constructor.alloc(this.len),w=0;v;)v.fn(v.val,C,w),w+=v.len,v=v.next;return C},f.c=function(v){i=v,f.create=g(),i.c()}},{35:35}],40:[function(t,n,u){n.exports=h;var i=t(39),d=((h.prototype=Object.create(i.prototype)).constructor=h,t(35));function h(){i.call(this)}function p(s,a,c){s.length<40?d.utf8.write(s,a,c):a.utf8Write?a.utf8Write(s,c):a.write(s,c)}h.c=function(){h.alloc=d.L,h.writeBytesBuffer=d.Buffer&&d.Buffer.prototype instanceof Uint8Array&&d.Buffer.prototype.set.name==="set"?function(s,a,c){a.set(s,c)}:function(s,a,c){if(s.copy)s.copy(a,c,0,s.length);else for(var l=0;l<s.length;)a[c++]=s[l++]}},h.prototype.bytes=function(s){var a=(s=d.isString(s)?d.S(s,"base64"):s).length>>>0;return this.uint32(a),a&&this.N(h.writeBytesBuffer,a,s),this},h.prototype.string=function(s){var a=d.Buffer.byteLength(s);return this.uint32(a),a&&this.N(p,a,s),this},h.c()},{35:35,39:39}]},r={},Te=(function t(n){var u=r[n];return u||e[n][0].call(u=r[n]={exports:{}},t,u,u.exports),u.exports})([16][0])})();const Ft=4096,jn=1<<20;let L=new Uint8Array(Ft),xe=new DataView(L.buffer),P=0,$=0,X=0;function Pn(){return P}function Ln(o){return L.slice(o,P)}function Mn(o){P=o,o===0&&L.length>jn&&(L=new Uint8Array(Ft),xe=new DataView(L.buffer))}function J(o){if(P+o>L.length){const e=new Uint8Array(Math.max(L.length*2,P+o));e.set(L.subarray(0,P)),L=e,xe=new DataView(e.buffer)}}function me(o){for(;o>127;)L[P++]=o&127|128,o>>>=7;L[P++]=o}function Ke(){for(;X;)L[P++]=$&127|128,$=($>>>7|X<<25)>>>0,X>>>=7;me($)}function Ye(o){L[P++]=o&255,L[P++]=o>>>8&255,L[P++]=o>>>16&255,L[P++]=o>>>24}function We(o){if(o===0){$=X=0;return}const e=o<0;e&&(o=-o),$=o>>>0,X=(o-$)/4294967296>>>0,e&&(X=~X>>>0,$=~$>>>0,++$>4294967295&&($=0,++X>4294967295&&(X=0)))}function ee(o){J(5),o<128?L[P++]=o:me(o)}function Dn(o){J(1),L[P++]=o}function Ht(o){J(5),me(o>>>0)}function Ut(o){o|=0,J(10),o<0?($=o>>>0,X=4294967295,Ke()):me(o)}function Bn(o){o|=0,Ht((o<<1^o>>31)>>>0)}function $t(o){J(4),Ye(o>>>0)}function zt(o){We(o),J(10),Ke()}function qn(o){We(o);const e=X>>31;X=((X<<1|$>>>31)^e)>>>0,$=($<<1^e)>>>0,J(10),Ke()}function Vt(o){We(o),J(8),Ye($),Ye(X)}function Fn(o){J(8),xe.setFloat64(P,o,!0),P+=8}function Hn(o){J(4),xe.setFloat32(P,o,!0),P+=4}function Un(o){const e=o.length>>>0;J(e+5),me(e),e&&(L.set(o,P),P+=e)}function Ze(){return J(1),P++}function Ne(o){const e=P-o-1;if(e<128){L[o]=e;return}const r=e<16384?2:e<2097152?3:e<268435456?4:5;J(r-1),L.copyWithin(o+r,o+1,P),P=o+r+e;let t=e;for(let n=0;n<r-1;n++)L[o+n]=t&127|128,t>>>=7;L[o+r-1]=t}function $n(o){const e=o.length;J(e*3+5);const r=L,t=P++;let n=P,u=0,i=0;for(;u<e&&(i=o.charCodeAt(u))<128;)r[n++]=i,u++;for(;u<e;u++)i=o.charCodeAt(u),i<128?r[n++]=i:i<2048?(r[n++]=i>>6|192,r[n++]=i&63|128):(i&64512)===55296&&(o.charCodeAt(u+1)&64512)===56320?(i=65536+((i&1023)<<10)+(o.charCodeAt(++u)&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,Ne(t)}const Re=0,de=1,Xt=2,Jt=3,Gt=4,zn=5,ce=Object.prototype.hasOwnProperty;function Qe(o,e){return o&&typeof o=="object"&&ce.call(o,e)?o[e]:void 0}function Vn(o){return o.fields!==void 0?de:o.values!==void 0?Xt:o.methods!==void 0?Jt:o.id!==void 0?Gt:Re}function et(o){return o===Re||o===de||o===Jt}function je(o,e,r){const t=Qe(o.nested,e);return t&&typeof t=="object"?{node:t,kind:Vn(t),path:r.concat(e)}:null}function Xn(o,e){if(o.kind===de){const r=Qe(o.node.fields,e);if(r)return{node:r,kind:Gt,path:o.path.concat(e)};const t=Qe(o.node.oneofs,e);if(t)return{node:t,kind:zn,path:o.path.concat(e)}}return je(o.node,e,o.path)}function tt(o,e,r){const t=Xn(o,e[r]);let n=null;if(t)r===e.length-1?n=t:et(t.kind)&&(n=tt(t,e,r+1));else if(o.node.nested&&typeof o.node.nested=="object")for(const u of Object.keys(o.node.nested)){const i=je(o.node,u,o.path);i&&et(i.kind)&&(n=tt(i,e,r)||n)}return n}function Jn(o,e){let r={node:o,kind:Re,path:[]};for(let t=0;r&&t<e.length;t++)r=et(r.kind)?je(r.node,e[t],r.path):null;return r}function Kt(o,e,r,t){r[0]===""&&(e=[],r=r.slice(1));const n=Jn(o,r);if(n&&t(n.kind))return n;const u=[{node:o,kind:Re,path:[]}];for(const i of e)u.push(je(u[u.length-1].node,i,u[u.length-1].path));for(let i=u.length-1;i>=0;i--){const d=tt(u[i],r,0);if(d&&t(d.kind))return d}return null}const Yt=100,Gn=0,ne=1,Pe=2,Wt=3,Zt=4,Qt=new WeakMap,er=()=>{},Kn=new Uint8Array(0),Yn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ye=o=>Number.isInteger(o),ge=o=>Number.isInteger(o)||!!(o&&Number.isInteger(o.low)&&Number.isInteger(o.high)),tr=o=>typeof o=="number",Wn=o=>typeof o=="boolean",rr=o=>typeof o=="string"||o instanceof String,Zn=o=>!!(o&&typeof o.length=="number")||rr(o);function ve(o,e){if(typeof o=="string")return parseInt(o,10);if(o&&typeof o=="object"){const r=o.low>>>0,t=o.high>>>0;if(!e&&t>>>31){const n=~r+1>>>0,u=n?~t>>>0:(~t>>>0)+1>>>0;return-(n+u*4294967296)}return r+t*4294967296}return o}function Qn(o){const e=new Uint8Array(Math.ceil(o.length*3/4));let r=0,t=0,n=0;for(let u=0;u<o.length;){const i=o.charAt(u++);if(i==="="&&t>1)break;const d=Yn.indexOf(i);if(d<0)throw new Error("invalid encoding");t===0?(n=d,t=1):t===1?(e[r++]=n<<2|(d&48)>>4,n=d,t=2):t===2?(e[r++]=(n&15)<<4|(d&60)>>2,n=d,t=3):(e[r++]=(n&3)<<6|d,t=0)}if(t===1)throw new Error("invalid encoding");return e.subarray(0,r)}const U=(o,e,r,t,n,u=Gn)=>({wt:o,put:e,ok:r,exp:t,def:n,vk:u}),Le={double:U(1,o=>Fn(Number(o)),tr,"number",0,Pe),float:U(5,o=>Hn(Number(o)),tr,"number",0,Pe),int32:U(0,Ut,ye,"integer",0,ne),uint32:U(0,Ht,ye,"integer",0,ne),sint32:U(0,Bn,ye,"integer",0,ne),fixed32:U(5,$t,ye,"integer",0,ne),sfixed32:U(5,$t,ye,"integer",0,ne),int64:U(0,o=>zt(ve(o)),ge,"integer|Long",0),uint64:U(0,o=>zt(ve(o,!0)),ge,"integer|Long",0),sint64:U(0,o=>qn(ve(o)),ge,"integer|Long",0),fixed64:U(1,o=>Vt(ve(o)),ge,"integer|Long",0),sfixed64:U(1,o=>Vt(ve(o)),ge,"integer|Long",0),bool:U(0,o=>Dn(o?1:0),Wn,"boolean",!1,Zt),string:U(2,o=>$n(typeof o=="string"?o:String(o)),rr,"string","",Wt),bytes:U(2,o=>Un(typeof o=="string"?Qn(o):o),Zn,"buffer",Kn)};function nr(o){return`${o.owner.full}.${o.name}`}function ei(o){return new TypeError(`${nr(o)}: array expected`)}function rt(o){return new TypeError(`${nr(o)}: object expected`)}function nt(o,e){if(!e)return null;if(!Array.isArray(e))throw ei(o);return e.length?e:null}function it(o,e,r){if(typeof e!="object"||e===null)throw rt(o);const t=Ze();ir(o.child,e,r+1),Ne(t)}function ti(o,e){ee(o.tag),o.put(e)}function ri(o,e){const r=nt(o,e);if(r){ee(o.tag);const t=Ze();for(let n=0;n<r.length;n++)o.put(r[n]);Ne(t)}}function ni(o,e){const r=nt(o,e);if(r)for(let t=0;t<r.length;t++)ee(o.tag),o.put(r[t])}function ii(o,e,r){if(typeof e!="object")throw rt(o);ee(o.tag),it(o,e,r)}function si(o,e,r){const t=nt(o,e);if(t)for(let n=0;n<t.length;n++)ee(o.tag),it(o,t[n],r)}function oi(o,e,r){if(!e)return;if(typeof e!="object")throw rt(o);const t=Object.keys(e);for(let n=0;n<t.length;n++){ee(o.tag);const u=Ze();ee(o.ktag),o.kput(t[n]),ee(o.vtag),o.child?it(o,e[t[n]],r):o.put(e[t[n]]),Ne(u)}}function ir(o,e,r){if(r>Yt)throw new Error("maximum nesting depth exceeded");const t=o.fields;for(let n=0;n<t.length;n++){const u=t[n];let i=e[u.name];if(i==null){if(!u.required)continue;i=u.def}u.write(u,i,r)}}function he(o,e){return`${o.name}: ${e}${o.repeated&&e!=="array"?"[]":o.keyType&&e!=="object"?`{k:${o.keyType}}`:""} expected`}const ai=/^-?(?:0|[1-9][0-9]*)$/,li=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,ui=/(?:^true)|false|0|(?:1$)/;function sr(o,e){switch(o.vk){case ne:return Number.isInteger(e);case Pe:return typeof e=="number";case Wt:return typeof e=="string"||e instanceof String;case Zt:return typeof e=="boolean";default:return o.ok(e)}}function st(o,e,r){if(o.child){const t=or(o.child,e,r+1);return t&&`${o.name}.${t}`}return sr(o,e)?null:he(o,o.exp)}function di(o,e,r){let t=0;if(o.vk===ne)for(;t<e.length&&Number.isInteger(e[t]);)t++;else if(o.vk===Pe)for(;t<e.length&&typeof e[t]=="number";)t++;else{for(let n;t<e.length;t++)if(n=st(o,e[t],r))return n;return null}return t<e.length?he(o,o.exp):null}function ci(o,e,r,t){let n=null;if(o.keyType){if(!r||typeof r!="object")return he(o,"object");const u=Object.keys(r);for(let i=0;!n&&i<u.length;i++)n=o.kre&&!o.kre.test(u[i])?he(o,o.kexp):st(o,r[u[i]],t)}else if(o.repeated){if(!Array.isArray(r))return he(o,"array");n=di(o,r,t)}else{for(let u=0;u<o.prior.length;u++)if(e[o.prior[u].name]!=null&&ce.call(e,o.prior[u].name))return`${o.oneof}: multiple values`;n=st(o,r,t)}return n}function or(o,e,r){if(typeof e!="object"||e===null)return"object expected";if(r>Yt)return"maximum nesting depth exceeded";const t=o.vfields;for(let n=0;n<t.length;n++){const u=t[n],i=e[u.name];if(u.required||i!=null&&ce.call(e,u.name)){const d=u.plain?sr(u,i)?null:he(u,u.exp):ci(u,e,i,r);if(d)return d}}return null}const ar=U(2,er,()=>!0,"",void 0);function hi(o,e,r,t,n,u){const i=t.keyType!==void 0,d=!i&&t.rule==="repeated";let h=ce.call(Le,t.type)?Le[t.type]:ar,p=null;if(h===ar){const f=Kt(o.root,e.path,t.type.split("."),g=>g===de||g===Xt);if(!f)throw new Error(`no such Type or Enum '${t.type}' in Type ${e.full}`);if(f.kind===de){if(f.node.group)throw new Error(`${t.type}: groups are not supported`);p=lr(o,f)}else{const g=f.node.values,_=Object.keys(g).map(y=>g[y]);h=U(0,y=>Ut(typeof y=="string"?ce.call(g,y)?g[y]:_[0]:y),y=>_.indexOf(y)>=0,"enum value",_[0])}}const s=t.options&&t.options.packed,a=d&&!p&&h.wt!==2&&(s===void 0?e.packed:s===!0),c=i?t.keyType:"";return{name:r,id:t.id,tag:(t.id<<3|(i||p||a?2:h.wt))>>>0,write:i?oi:p?d?si:ii:d?a?ri:ni:ti,put:h.put,ok:h.ok,vk:h.vk,exp:h.exp,required:t.rule==="required",repeated:d,def:d||i?void 0:h.def,child:p,owner:e,keyType:c,kre:c==="bool"?ui:/64$/.test(c)?li:c&&c!=="string"?ai:null,kexp:c==="bool"?"boolean key":/64$/.test(c)?"integer|Long key":"integer key",ktag:i?8|Le[c].wt:0,kput:i?Le[c].put:er,vtag:16|(p?2:h.wt),oneof:n,prior:u.slice(),plain:!i&&!d&&!p&&!u.length}}function lr(o,e){const r=e.path.join(".");let t=o.plans.get(r);if(t)return t;t={path:e.path,full:`.${r}`,fields:[],vfields:[],packed:e.node.edition!=="proto2"},o.plans.set(r,t);const n=e.node,u=new Map,i=n.oneofs||{};for(const h of Object.keys(i))for(const p of i[h].oneof||[])ce.call(n.fields,p)&&!u.has(p)&&u.set(p,h);const d=new Map;for(const h of Object.keys(n.fields)){const p=u.get(h)||"",s=d.get(p)||[],a=hi(o,t,h,n.fields[h],p,p?s:[]);p&&(s.push(a),d.set(p,s)),t.vfields.push(a)}return t.fields=t.vfields.slice().sort((h,p)=>h.id-p.id),t}let ur,dr="",cr;function ot(o,e){if(o===ur&&e===dr)return cr;let r=Qt.get(o);r||(r={root:o,plans:new Map,names:new Map},Qt.set(o,r));let t=r.names.get(e);if(!t){const n=Kt(r.root,[],e.split("."),u=>u===de);if(!n)throw new Error(`no such type: ${e}`);try{t=lr(r,n)}catch(u){throw r.plans.clear(),u}r.names.set(e,t)}return ur=o,dr=e,cr=t,t}function hr(o,e,r){const t=ot(o,e),n=Pn();try{return ir(t,r,0),Ln(n)}finally{Mn(n)}}function fr(o,e,r,t){return or(ot(o,e),r,0)}function fi(o,e){return ot(o,e).full}let Me;function pi(){if(Me===void 0)try{Me=Te.util.codegen(["a"],"o11yEvalProbe")("return a === true")()(!0)}catch(o){Me=!1}return Me}function at(o){return!!o&&!pi()}class mi{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=Te.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"),at(t)){const i=D.getSchemaId(e),d=fr(e.pbjsSchema,i,r);if(d)throw new Error(`Data is invalid for ${fi(e.pbjsSchema,i)}: ${d}`);return}const n=this.getSchemaType(e),u=n.verify(r);if(u)throw new Error(`Data is invalid for ${n.fullName}: ${u}`);return n}encode(e,r,t){const n=this.validate(e,r,t);if(at(t))return hr(e.pbjsSchema,D.getSchemaId(e),r);const u=n.fromObject(r);return n.encode(u).finish()}encodePayload(e,r){if(e!=null&&e.schema&&e.payload)return{schemaName:D.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 D.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 pr=new mi;let lt;function yi(){return lt||(lt=Te.Root.fromJSON(Ee.pbjsSchema).lookupType("CoreEnvelope")),lt}function mr(o){return ue.buildFrom(o)}function yr(o,e){if(at(e)){const u=Ee.pbjsSchema,i=fr(u,"CoreEnvelope",o);if(i)throw new Error(`Invalid CoreEnvelope: ${i}`);return hr(u,"CoreEnvelope",o)}const r=yi(),t=r.verify(o);if(t)throw new Error(`Invalid CoreEnvelope: ${t}`);return r.encode(o).finish()}function gi(o){return!!o&&typeof o=="object"&&"envelopeContents"in o&&"error"in o}var K;(function(o){o[o.fetchBinary=0]="fetchBinary",o[o.fetchFile=1]="fetchFile",o[o.noUpload=2]="noUpload"})(K||(K={}));const vi=3e4,_i=1e3,bi=500,ut=2147483647,wi=/^[A-Za-z]{3}, \d{2} [A-Za-z]{3} \d{4} \d{2}:\d{2}:\d{2} GMT$/,Ei=/^[A-Za-z]{6,9}, \d{2}-[A-Za-z]{3}-\d{2} \d{2}:\d{2}:\d{2} GMT$/,ki=/^[A-Za-z]{3} [A-Za-z]{3} [ \d]\d \d{2}:\d{2}:\d{2} \d{4}$/,gr=.5;function vr(){try{const o=typeof globalThis=="object"?globalThis:{},e=o.crypto||o.msCrypto;if(e&&typeof e.getRandomValues=="function")return e.getRandomValues(new Uint32Array(1))[0]/4294967296}catch(o){}return gr}function _r(o){const e=o();return Number.isFinite(e)&&e>=0&&e<1?e:gr}function Ai(o,e=Date.now()){if(!o)return;const r=o.trim();if(/^\d+$/.test(r))return Math.min(parseInt(r,10)*1e3,ut);const t=ki.test(r);if(!t&&!wi.test(r)&&!Ei.test(r))return;const n=Date.parse(t?`${r} GMT`:r);if(!isNaN(n))return Math.min(Math.max(0,n-e),ut)}function Si(o,e,r=vi,t=vr){const n=Math.min(r,ut),u=Math.min(n,1e3*Math.pow(2,o));if(e!==void 0){if(e>n)return;const h=Math.max(e,u),p=Math.max(_i,h/2),s=Math.min(n,h+p),a=Math.max(e,Math.min(h,s-p));return a+Math.floor(_r(t)*(s-a))}const i=u/2,d=Math.floor(i+_r(t)*i);return Math.min(n,Math.max(bi,d))}const Ci=3,Oi=3e4,br=10,_e=12e4,Ii=100,Ti=1e3,xi=1024*1024;function dt(o){o&&typeof o.unref=="function"&&o.unref()}class Ni{constructor(e,r){if(this._owner=r,this.maxRetries=Ci,this._maxRetryDelayMs=Oi,this._throttledUntil=0,this.random=vr,this.retryingUploads=0,this._retrying=new WeakSet,this.drainingHeldBacklog=!1,this.drainChunkInFlight=!1,this._droppedMessagesCount=0,e){const t=e.maxRetries;if(t!==void 0){if(typeof t!="number"||!Number.isInteger(t)||t<0||t>br)throw new Error(`options.maxRetries, if defined, must be an integer between 0 and ${br}`);this.maxRetries=t}const n=e.maxRetryDelayMs;if(n!==void 0){if(typeof n!="number"||!Number.isFinite(n)||n<1||n>_e)throw new Error(`options.maxRetryDelayMs, if defined, must be a number >= 1 and <= ${_e}`);this._maxRetryDelayMs=n}}}get droppedMessagesCount(){return this._droppedMessagesCount}isThrottled(){if(this.retryingUploads>0)return!0;const e=this._throttledUntil-Date.now();return e>_e?(this._throttledUntil=0,!1):e>0}shouldDrop(e,r,t){return(this.isThrottled()||this.drainingHeldBacklog&&this.drainChunkInFlight)&&this.isHeldBacklogFull(e(),r,t)?(this._droppedMessagesCount++,!0):!1}isHeldBacklogFull(e,r,t){return e>=Math.max(Ti,Ii*t)||r>=xi}backoffBeforeRetry(e,r,t,n){const u=t?0:this.maxRetries,i=e.response.status;if(i!==429&&i!==503)return;const d=Ai(e.response.headers?e.response.headers.get("Retry-After"):void 0);if(i===503&&d===void 0)return;const h=Si(r,d,this._maxRetryDelayMs,this.random),p=Math.min(h===void 0?d:h,_e),s=Date.now()+p;if(this.drainingHeldBacklog=!0,s>this._throttledUntil&&(this._throttledUntil=s,this._scheduleHoldFlush(p)),h===void 0||r>=u)return;this._retrying.has(e)||(this._retrying.add(e),this.retryingUploads++);const a=Math.max(h,this._throttledUntil-Date.now()),c=e.response;return n?this._sleepUntilHoldEnds(a,n).then(()=>this._discardBody(c)):(this._discardBody(c),this._sleepUntilHoldEnds(a,n))}endRetryChain(e){this._retrying.delete(e)&&(this.retryingUploads--,this.retryingUploads===0&&(this._scheduleHoldFlush(0),this._owner.messagesCount()===0&&!this.isThrottled()&&(this.drainingHeldBacklog=!1)))}_scheduleHoldFlush(e){this._holdTimerHandle!==void 0&&clearTimeout(this._holdTimerHandle),this._holdTimerHandle=setTimeout(()=>{if(this._holdTimerHandle=void 0,this.isThrottled()){const r=this._throttledUntil-Date.now();this.retryingUploads===0&&r>0&&this._scheduleHoldFlush(r);return}this._owner.messagesCount()===0&&(this.drainingHeldBacklog=!1),this._owner.hasData()&&this._owner.flush()},e),dt(this._holdTimerHandle)}_sleepUntilHoldEnds(e,r){const t=Date.now()+e;return this._sleep(e,r).then(()=>{const n=this._throttledUntil-t;return n>0&&n<=_e?this._sleepUntilHoldEnds(this._throttledUntil-Date.now(),r):void 0})}_sleep(e,r){return new Promise((t,n)=>{if(r&&r.aborted){n(this._abortError(r));return}const u=()=>{clearTimeout(i),n(this._abortError(r))},i=setTimeout(()=>{r&&r.removeEventListener("abort",u),t()},e);dt(i),r&&r.addEventListener("abort",u,{once:!0})})}_discardBody(e){Promise.resolve().then(()=>{const r=e.body;return r&&typeof r.cancel=="function"?r.cancel():void 0}).catch(()=>{})}_abortError(e){return e.reason||Object.assign(new Error("The operation was aborted."),{name:"AbortError"})}}const ct="telemetry",Ri=1e4,wr=1e4,ji=10,Pi=10,Er=K.fetchBinary,Li=100,Mi=256*1024,Di=64*1024,Bi=6e4,qi=112+2*70;function Fi(o){const e=o.replace(/\r\n|\r|\n/g,"%0D%0A").replace(/"/g,"%22");let r=0;for(const t of e){const n=t.codePointAt(0);r+=n<128?1:n<2048?2:n<65536?3:4}return r}function ht(o){if(!gi(o))throw o}class Hi{constructor(e,r,t,n){this._messagesLimit=ji,this._metricsLimit=Pi,this._formDataKey=ct,this._uploadInterval=wr,this._messageSize=0,this._evalFreeFallback=!1,this.uploadEndpoint=e,this.uploadMode=r==null?Er:r,t&&(this._staticAttributes={appName:t.appName,appVersion:t.appVersion,appExperience:t.appExperience,deviceId:t.deviceId,deviceModel:t.deviceModel,sdkVersion:t.sdkVersion});let u=Ri;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");u=i}const d=n.messagesLimit;if(d!==void 0){if(typeof d!="number"||!(d>0))throw new Error("options.messagesLimit, if defined, must be > 0");this._messagesLimit=d}const h=n.metricsLimit;if(h!==void 0){if(typeof h!="number"||!(h>0))throw new Error("options.metricsLimit, if defined, must be > 0");this._metricsLimit=h}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._throttle=new Ni(n,{hasData:()=>this.hasData,messagesCount:()=>this.messagesCount,flush:()=>this._upload().catch(ht)}),this._messageBuffers=new Or(u),this._emptySize=this.getByteSize(1),this._restartTimer()}get uploadInterval(){return this._uploadInterval}set uploadInterval(e){if(e===void 0&&(e=wr),typeof e!="number"||!(e>0))throw new Error("uploadInterval, if defined, must be > 0");e!==this._uploadInterval&&(this._uploadInterval=e,this._restartTimer())}get droppedMessagesCount(){return this._throttle.droppedMessagesCount}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=Er),!(e in K))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().catch(ht)},this._uploadInterval)}collect(e,r,t){return te(this,null,function*(){if(this._throttle.shouldDrop(()=>this.messagesCount,this._messageSize,this._messagesLimit))return;D.isInternal(e)&&r.userPayload&&(r.userPayload=pr.encodePayload(r.userPayload,this._evalFreeFallback));const n=pr.getLogMessage(e,r,t,this._evalFreeFallback);if(!this._messageBuffers.push(e,n))throw new Error(`Buffer is full. Refusing schemaId ${D.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 te(this,null,function*(){if(!e&&this._throttle.isThrottled()||(this._restartTimer(),!this._uploadEndpoint||this._uploadMode===K.noUpload))return;const r=!e&&this._throttle.drainingHeldBacklog;if(r&&this._throttle.drainChunkInFlight)return;const t=r?this._getContentsOfCoreEnvelope(!0,!0):this._getContentsOfCoreEnvelope(!0),n=this.messagesCount>0;!n&&!this._throttle.isThrottled()&&(this._throttle.drainingHeldBacklog=!1);let u;r&&(this._throttle.drainChunkInFlight=!0);try{u=yield this._uploadContents(t,e,r)}finally{r&&(this._throttle.drainChunkInFlight=!1)}return r&&n&&this._drainRemaining(),u})}_drainRemaining(){this.messagesCount>0&&!this._throttle.isThrottled()&&this._upload().catch(ht)}_uploadContents(e,r,t=!1){return te(this,null,function*(){const{requestInit:n,bodyByteLength:u}=this._getRequestInit(e),i={envelopeContents:e};try{let d;for(let h=0;;h++){d=this._buildAttemptRequestInit(n,u),i.response=void 0,h>0&&(i.attempts=h+1),i.response=h>0||t?yield this._fetchWithTimeout(d):yield fetch(this._uploadEndpoint,d);const p=this._throttle.backoffBeforeRetry(i,h,r,d.signal);if(!p)break;yield p}if(!i.response.ok)throw new Error("HTTP Not OK");return i}catch(d){if(i.error=d,!r&&this._uploadFailedListener)try{this._uploadFailedListener(i)}catch(h){}throw i}finally{this._throttle.endRetryChain(i)}})}_buildAttemptRequestInit(e,r){let t=e;if(this._apiKey&&(t=be(Q({},t),{headers:be(Q({},t.headers),{"x-o11y-api-key":this._apiKey})})),this._uploadOptionsCallback){const n=this._uploadOptionsCallback()||{},u=Q({},n);if(n.headers&&t.headers)if(n.headers instanceof Headers){const i=new Headers(n.headers);for(const d in t.headers)Object.prototype.hasOwnProperty.call(t.headers,d)&&i.set(d,t.headers[d]);u.headers=i}else{if(Array.isArray(n.headers))throw new Error("Headers as array is not supported.");u.headers=Q(Q({},n.headers),t.headers)}else t.headers&&(u.headers=t.headers);u.method=t.method,u.body=t.body,t=u}return t.keepalive&&r>Di&&(t=be(Q({},t),{keepalive:!1})),t}_fetchWithTimeout(e){return te(this,null,function*(){if(typeof AbortController!="function")return fetch(this._uploadEndpoint,e);const r=new AbortController,t=e.signal,n=()=>r.abort(t.reason);t&&(t.aborted?n():t.addEventListener("abort",n,{once:!0}));const u=setTimeout(()=>r.abort(Object.assign(new Error("Upload request timed out."),{name:"TimeoutError"})),Bi);dt(u);try{return yield fetch(this._uploadEndpoint,be(Q({},e),{signal:r.signal}))}finally{clearTimeout(u),t&&t.removeEventListener("abort",n)}})}_getRequestInit(e){const r=mr(e),t=yr(r,this._evalFreeFallback);let n;switch(this._uploadMode){case K.fetchBinary:n={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t};break;case void 0:case K.fetchFile:if(typeof FormData!="function")throw new Error("FormData is not a function in the global namespace.");const i=new FormData;i.append(this._formDataKey||ct,new Blob([t])),n={method:"POST",body:i};break;case K.noUpload:default:throw new Error("Invalid uploadMode")}const u=t.byteLength+(this._uploadMode===K.fetchBinary?0:qi+Fi(this._formDataKey||ct));return{requestInit:n,bodyByteLength:u}}_checkUploadState(){if(this._uploadEndpoint===void 0)throw new Error("Upload endpoint is unset");if(this._uploadMode===K.noUpload)throw new Error("Upload mode is unset")}upload(e){return te(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,r=!1){const t={staticAttributes:this._staticAttributes,messages:e&&r?this._extractMessageChunk():this._messageBuffers.getAllMessages(e)};return this._metricsExtractors&&(t.upCounters=ue.getUpCounters(this._metricsExtractors.getAllUpCounters(),e),t.valueRecorders=ue.getValueRecorders(this._metricsExtractors.getAllValueRecorders(),e),t.bucketHistograms=ue.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms(),e)),e&&!r&&(this._messageSize=0),t}_extractMessageChunk(){const e=Math.max(this._messagesLimit,Li),r=new Map;let t=0,n=0,u=!1;for(const[i,d]of this._messageBuffers.getAllMessages(!1)){let h=0;for(;h<d.length;){const p=E.estimateObjectSize(d[h]);if(t>0&&(t>=e||n+p>Mi)){u=!0;break}t++,n+=p,h++}if(h>0&&r.set(i,d.splice(0,h)),u)break}return this._messageSize=this.messagesCount===0?0:Math.max(0,this._messageSize-n),r}_buildProtoEncodedCoreEnvelope(e){const r=this._getContentsOfCoreEnvelope(e),t=mr(r);return yr(t,this._evalFreeFallback)}receiveMetricsExtractors(e){this._metricsExtractors=e}}const Ui={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"}}}}}}}}}},$i={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"}}}}}}}}}},zi={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=Hi,B.currentStateSchema=zi,B.failureEventSchema=Ui,B.interactionEventSchema=$i,B.registerInstrumentedApp=xn,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
|
|
4
|
+
}`}return a.toString=c,a}d.verbose=!1},{}],4:[function(t,n,u){function i(){this.t={}}(n.exports=i).prototype.on=function(d,h,p){return(this.t[d]||(this.t[d]=[])).push({fn:h,ctx:p||this}),this},i.prototype.off=function(d,h){if(d===o)this.t={};else if(h===o)this.t[d]=[];else for(var p=this.t[d],s=0;s<p.length;)p[s].fn===h?p.splice(s,1):++s;return this},i.prototype.emit=function(d){var h=this.t[d];if(h){for(var p=[],s=1;s<arguments.length;)p.push(arguments[s++]);for(s=0;s<h.length;)h[s].fn.apply(h[s++].ctx,p)}return this}},{}],5:[function(t,n,u){n.exports=h;var i=t(1),d=t(7)("fs");function h(p,s,a){return s=typeof s=="function"?(a=s,{}):s||{},a?!s.xhr&&d&&d.readFile?d.readFile(p,function(c,l){return c&&typeof XMLHttpRequest!="undefined"?h.xhr(p,s,a):c?a(c):a(null,s.binary?l:l.toString("utf8"))}):h.xhr(p,s,a):i(h,this,p,s)}h.xhr=function(p,s,a){var c=new XMLHttpRequest;c.onreadystatechange=function(){if(c.readyState!==4)return o;if(c.status!==0&&c.status!==200)return a(Error("status "+c.status));if(s.binary){if(!(l=c.response))for(var l=[],f=0;f<c.responseText.length;++f)l.push(255&c.responseText.charCodeAt(f));return a(null,typeof Uint8Array!="undefined"?new Uint8Array(l):l)}return a(null,c.responseText)},s.binary&&("overrideMimeType"in c&&c.overrideMimeType("text/plain; charset=x-user-defined"),c.responseType="arraybuffer"),c.open("GET",p),c.send()}},{1:1,7:7}],6:[function(t,n,u){function i(a){function c(T,S,I,N){var j=S<0?1:0;T((S=j?-S:S)===0?0<1/S?0:2147483648:isNaN(S)?2143289344:34028234663852886e22<S?(j<<31|2139095040)>>>0:S<11754943508222875e-54?(j<<31|Math.round(S/1401298464324817e-60))>>>0:(j<<31|127+(T=Math.floor(Math.log(S)/Math.LN2))<<23|8388607&Math.round(S*Math.pow(2,-T)*8388608))>>>0,I,N)}function l(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,C;function w(T,S,I,N,j,M){var V,fe=N<0?1:0;(N=fe?-N:N)===0?(T(0,j,M+S),T(0<1/N?0:2147483648,j,M+I)):isNaN(N)?(T(0,j,M+S),T(2146959360,j,M+I)):17976931348623157e292<N?(T(0,j,M+S),T((fe<<31|2146435072)>>>0,j,M+I)):N<22250738585072014e-324?(T((V=N/5e-324)>>>0,j,M+S),T((fe<<31|V/4294967296)>>>0,j,M+I)):(T(4503599627370496*(V=N*Math.pow(2,-(N=(N=Math.floor(Math.log(N)/Math.LN2))===1024?1023:N)))>>>0,j,M+S),T((fe<<31|N+1023<<20|1048576*V&1048575)>>>0,j,M+I))}function A(T,S,I,N,j){return S=T(N,j+S),T=T(N,j+I),N=2*(T>>31)+1,j=T>>>20&2047,I=4294967296*(1048575&T)+S,j==2047?I?NaN:1/0*N:j==0?5e-324*N*I:N*Math.pow(2,j-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 R(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),C=b[3]===128,a.writeFloatLE=C?f:g,a.writeFloatBE=C?g:f,a.readFloatLE=C?m:_,a.readFloatBE=C?_:m):(a.writeFloatLE=c.bind(null,d),a.writeFloatBE=c.bind(null,h),a.readFloatLE=l.bind(null,p),a.readFloatBE=l.bind(null,s)),typeof Float64Array!="undefined"?(k=new Float64Array([-0]),v=new Uint8Array(k.buffer),C=v[7]===128,a.writeDoubleLE=C?x:R,a.writeDoubleBE=C?R:x,a.readDoubleLE=C?q:z,a.readDoubleBE=C?z:q):(a.writeDoubleLE=w.bind(null,d,0,4),a.writeDoubleBE=w.bind(null,h,4,0),a.readDoubleLE=A.bind(null,p,0,4),a.readDoubleBE=A.bind(null,s,4,0)),a}function d(a,c,l){c[l]=255&a,c[l+1]=a>>>8&255,c[l+2]=a>>>16&255,c[l+3]=a>>>24}function h(a,c,l){c[l]=a>>>24,c[l+1]=a>>>16&255,c[l+2]=a>>>8&255,c[l+3]=255&a}function p(a,c){return(a[c]|a[c+1]<<8|a[c+2]<<16|a[c+3]<<24)>>>0}function s(a,c){return(a[c]<<24|a[c+1]<<16|a[c+2]<<8|a[c+3])>>>0}n.exports=i(i)},{}],7:[function(t,n,u){n.exports=function(i){try{var d;return typeof t!="function"?null:(d=t(i))&&(d.length||Object.keys(d).length)?d:null}catch(h){return null}}},{}],8:[function(t,n,u){var i=u.isAbsolute=function(h){return/^(?:\/|\w+:)/.test(h)},d=u.normalize=function(a){var p=(a=a.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),s=i(a),a="";s&&(a=p.shift()+"/");for(var c=0;c<p.length;)p[c]===".."?0<c&&p[c-1]!==".."?p.splice(--c,2):s?p.splice(c,1):++c:p[c]==="."?p.splice(c,1):++c;return a+p.join("/")};u.resolve=function(h,p,s){return s||(p=d(p)),!i(p)&&(h=(h=s?h:d(h)).replace(/(?:\/|^)[^/]+$/,"")).length?d(h+"/"+p):p}},{}],9:[function(t,n,u){n.exports=function(i,d,h){var p=h||8192,s=p>>>1,a=null,c=p;return function(l){return l<1||s<l?i(l):(p<c+l&&(a=i(p),c=0),l=d.call(a,c,c+=l),7&c&&(c=1+(7|c)),l)}}},{}],10:[function(t,n,u){u.length=function(i){for(var d,h=0,p=0;p<i.length;++p)(d=i.charCodeAt(p))<128?h+=1:d<2048?h+=2:(64512&d)==55296&&(64512&i.charCodeAt(p+1))==56320?(++p,h+=4):h+=3;return h},u.read=function(i,d,h){if(h-d<1)return"";for(var p="",s=d;s<h;){var a,c=i[s++];c<=127?p+=String.fromCharCode(c):192<=c&&c<224?p+=128<=(a=(31&c)<<6|63&i[s++])?String.fromCharCode(a):"�":224<=c&&c<240?p+=2048<=(a=(15&c)<<12|(63&i[s++])<<6|63&i[s++])?String.fromCharCode(a):"�":240<=c&&((c=(7&c)<<18|(63&i[s++])<<12|(63&i[s++])<<6|63&i[s++])<65536||1114111<c?p+="�":p=p+String.fromCharCode(55296+((c-=65536)>>10))+String.fromCharCode(56320+(1023&c)))}return p},u.write=function(i,d,h){for(var p,s,a=h,c=0;c<i.length;++c)(p=i.charCodeAt(c))<128?d[h++]=p:(p<2048?d[h++]=p>>6|192:((64512&p)==55296&&(64512&(s=i.charCodeAt(c+1)))==56320?(++c,d[h++]=(p=65536+((1023&p)<<10)+(1023&s))>>18|240,d[h++]=p>>12&63|128):d[h++]=p>>12|224,d[h++]=p>>6&63|128),d[h++]=63&p|128);return h-a}},{}],11:[function(t,n,u){var i=t(14),d=t(33);function h(s,a,c,l){var f=!1;if(a.resolvedType)if(a.resolvedType instanceof i){s("switch(d%s){",l);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}',l,l,l),a.repeated||s("break"),f=!0),s("case%j:",m[_])("case %i:",g[m[_]])("m%s=%j",l,g[m[_]])("break");s("}")}else s('if(typeof d%s!=="object")',l)("throw TypeError(%j)",a.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",l,c,l);else{var y=!1;switch(a.type){case"double":case"float":s("m%s=Number(d%s)",l,l);break;case"uint32":case"fixed32":s("m%s=d%s>>>0",l,l);break;case"int32":case"sint32":case"sfixed32":s("m%s=d%s|0",l,l);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",l,l,y)('else if(typeof d%s==="string")',l)("m%s=parseInt(d%s,10)",l,l)('else if(typeof d%s==="number")',l)("m%s=d%s",l,l)('else if(typeof d%s==="object")',l)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",l,l,l,y?"true":"");break;case"bytes":s('if(typeof d%s==="string")',l)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",l,l,l)("else if(d%s.length >= 0)",l)("m%s=d%s",l,l);break;case"string":s("m%s=String(d%s)",l,l);break;case"bool":s("m%s=Boolean(d%s)",l,l)}}return s}function p(s,a,c,l){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",l,c,l,l,c,l,l):s("d%s=types[%i].toObject(m%s,o)",l,c,l);else{var f=!1;switch(a.type){case"double":case"float":s("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",l,l,l,l);break;case"uint64":f=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":s('if(typeof m%s==="number")',l)("d%s=o.longs===String?String(m%s):m%s",l,l,l)("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",l,l,l,l,f?"true":"",l);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",l,l,l,l,l);break;default:s("d%s=m%s",l,l)}}return s}u.fromObject=function(s){var a=s.fieldsArray,c=d.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 c("return new this.ctor");c("var m=new this.ctor");for(var l=0;l<a.length;++l){var f=a[l].resolve(),g=d.safeProp(f.name);f.map?(c("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),c('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",g),h(c,f,l,g+"[ks[i]]")("}")("}")):f.repeated?(c("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),h(c,f,l,g+"[i]")("}")("}")):(f.resolvedType instanceof i||c("if(d%s!=null){",g),h(c,f,l,g),f.resolvedType instanceof i||c("}"))}return c("return m")},u.toObject=function(s){var a=s.fieldsArray.slice().sort(d.compareFieldsById);if(!a.length)return d.codegen()("return {}");for(var c=d.codegen(["m","o"],s.name+"$toObject")("if(!o)")("o={}")("var d={}"),l=[],f=[],g=[],m=0;m<a.length;++m)a[m].partOf||(a[m].resolve().repeated?l:a[m].map?f:g).push(a[m]);if(l.length){for(c("if(o.arrays||o.defaults){"),m=0;m<l.length;++m)c("d%s=[]",d.safeProp(l[m].name));c("}")}if(f.length){for(c("if(o.objects||o.defaults){"),m=0;m<f.length;++m)c("d%s={}",d.safeProp(f[m].name));c("}")}if(g.length){for(c("if(o.defaults){"),m=0;m<g.length;++m){var _,y=g[m],b=d.safeProp(y.name);y.resolvedType instanceof i?c("d%s=o.enums===String?%j:%j",b,y.resolvedType.valuesById[y.typeDefault],y.typeDefault):y.long?c("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),c("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)("}")):c("d%s=%j",b,y.typeDefault)}c("}")}for(var k=!1,m=0;m<a.length;++m){var y=a[m],v=s.i.indexOf(y),b=d.safeProp(y.name);y.map?(k||(k=!0,c("var ks2")),c("if(m%s&&(ks2=Object.keys(m%s)).length){",b,b)("d%s={}",b)("for(var j=0;j<ks2.length;++j){"),c('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",b),p(c,y,v,b+"[ks2[j]]")("}")):y.repeated?(c("if(m%s&&m%s.length){",b,b)("d%s=[]",b)("for(var j=0;j<m%s.length;++j){",b),p(c,y,v,b+"[j]")("}")):(c("if(m%s!=null&&m.hasOwnProperty(%j)){",b,y.name),p(c,y,v,b),y.partOf&&c("if(o.oneofs)")("d%s=%j",d.safeProp(y.partOf.name),y.name)),c("}")}return c("return d")}},{14:14,33:33}],12:[function(t,n,u){n.exports=function(p){for(var s=h.codegen(["r","l","e","n"],p.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"+(p.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<p.fieldsArray.length;++a){var c=p.i[a].resolve(),l=c.resolvedType instanceof i?"int32":c.type,f="m"+h.safeProp(c.name);s("case %i: {",c.id),c.map?(s("if(%s===util.emptyObject)",f)("%s={}",f)("var c2 = r.uint32()+r.pos"),d.defaults[c.keyType]!==o?s("k=%j",d.defaults[c.keyType]):s("k=null"),d.defaults[l]!==o?s("value=%j",d.defaults[l]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",c.keyType)("case 2:"),d.basic[l]===o?s("value=types[%i].decode(r,r.uint32(),undefined,n+1)",a):s("value=r.%s()",l),s("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}"),d.long[c.keyType]!==o?s('%s[typeof k==="object"?util.longToHash(k):k]=value',f):(c.keyType==="string"&&s('if(k==="__proto__")')("util.makeProp(%s,k)",f),s("%s[k]=value",f))):c.repeated?(s("if(!(%s&&%s.length))",f,f)("%s=[]",f),d.packed[l]!==o&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",f,l)("}else"),d.basic[l]===o?s(c.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,l)):d.basic[l]===o?s(c.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,l),s("break")("}")}for(s("default:")("r.skipType(t&7,n)")("break")("}")("}"),a=0;a<p.i.length;++a){var g=p.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),d=t(32),h=t(33)},{14:14,32:32,33:33}],13:[function(t,n,u){n.exports=function(s){for(var a,c=h.codegen(["m","w"],s.name+"$encode")("if(!w)")("w=Writer.create()"),l=s.fieldsArray.slice().sort(h.compareFieldsById),f=0;f<l.length;++f){var g=l[f].resolve(),m=s.i.indexOf(g),_=g.resolvedType instanceof i?"int32":g.type,y=d.basic[_];a="m"+h.safeProp(g.name),g.map?(c("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|d.mapKey[g.keyType],g.keyType),y===o?c("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",m,a):c(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|y,_,a),c("}")("}")):g.repeated?(c("if(%s!=null&&%s.length){",a,a),g.packed&&d.packed[_]!==o?c("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()"):(c("for(var i=0;i<%s.length;++i)",a),y===o?p(c,g,m,a+"[i]"):c("w.uint32(%i).%s(%s[i])",(g.id<<3|y)>>>0,_,a)),c("}")):(g.optional&&c("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",a,g.name),y===o?p(c,g,m,a):c("w.uint32(%i).%s(%s)",(g.id<<3|y)>>>0,_,a))}return c("return w")};var i=t(14),d=t(32),h=t(33);function p(s,a,c,l){a.delimited?s("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",c,l,(a.id<<3|3)>>>0,(a.id<<3|4)>>>0):s("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",c,l,(a.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(t,n,u){n.exports=p;var i=t(22),d=(((p.prototype=Object.create(i.prototype)).constructor=p).className="Enum",t(21)),h=t(33);function p(s,a,c,l,f,g){if(i.call(this,s,c),a&&typeof a!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=l,this.comments=f||{},this.valuesOptions=g,this.n={},this.reserved=o,a)for(var m=Object.keys(a),_=0;_<m.length;++_)m[_]!=="__proto__"&&typeof a[m[_]]=="number"&&(this.valuesById[this.values[m[_]]=a[m[_]]]=m[_])}p.prototype.r=function(s){return s=this.e||s,i.prototype.r.call(this,s),Object.keys(this.values).forEach(a=>{var c=Object.assign({},this.o);this.n[a]=Object.assign(c,this.valuesOptions&&this.valuesOptions[a]&&this.valuesOptions[a].features)}),this},p.fromJSON=function(s,a){return s=new p(s,a.values,a.options,a.comment,a.comments),s.reserved=a.reserved,a.edition&&(s.e=a.edition),s.u="proto3",s},p.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,h.toObject(["edition",this.h(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:o,"comment",s?this.comment:o,"comments",s?this.comments:o])},p.prototype.add=function(s,a,c,l){if(!h.isString(s))throw TypeError("name must be a string");if(!h.isInteger(a))throw TypeError("id must be an integer");if(s!=="__proto__"){if(this.values[s]!==o)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]!==o){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;l&&(this.valuesOptions===o&&(this.valuesOptions={}),this.valuesOptions[s]=l||null),this.comments[s]=c||null}return this},p.prototype.remove=function(s){if(!h.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},p.prototype.isReservedId=function(s){return d.isReservedId(this.reserved,s)},p.prototype.isReservedName=function(s){return d.isReservedName(this.reserved,s)}},{21:21,22:22,33:33}],15:[function(t,n,u){n.exports=c;var i,d=t(22),h=(((c.prototype=Object.create(d.prototype)).constructor=c).className="Field",t(14)),p=t(32),s=t(33),a=/^required|optional|repeated$/;function c(l,f,g,m,_,y,b){if(s.isObject(m)?(b=_,y=m,m=_=o):s.isObject(_)&&(b=y,y=_,_=o),d.call(this,l,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!==o&&!a.test(m=m.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(_!==o&&!s.isString(_))throw TypeError("extend must be a string");this.rule=(m=m==="proto3_optional"?"optional":m)&&m!=="optional"?m:o,this.type=g,this.id=f,this.extend=_||o,this.repeated=m==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!s.Long&&p.long[g]!==o,this.bytes=g==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=b}c.fromJSON=function(l,f){return l=new c(l,f.id,f.type,f.rule,f.extend,f.options,f.comment),f.edition&&(l.e=f.edition),l.u="proto3",l},Object.defineProperty(c.prototype,"required",{get:function(){return this.o.field_presence==="LEGACY_REQUIRED"}}),Object.defineProperty(c.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(c.prototype,"delimited",{get:function(){return this.resolvedType instanceof i&&this.o.message_encoding==="DELIMITED"}}),Object.defineProperty(c.prototype,"packed",{get:function(){return this.o.repeated_field_encoding==="PACKED"}}),Object.defineProperty(c.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||this.o.field_presence!=="IMPLICIT")}}),c.prototype.setOption=function(l,f,g){return d.prototype.setOption.call(this,l,f,g)},c.prototype.toJSON=function(l){return l=!!l&&!!l.keepComments,s.toObject(["edition",this.h(),"rule",this.rule!=="optional"&&this.rule||o,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",l?this.comment:o])},c.prototype.resolve=function(){var l;return this.resolved?this:((this.typeDefault=p.defaults[this.type])===o?(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 h&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed===o||!this.resolvedType||this.resolvedType instanceof h||delete this.options.packed,Object.keys(this.options).length||(this.options=o)),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,l=s.newBuffer(s.base64.length(this.typeDefault)),0):s.utf8.write(this.typeDefault,l=s.newBuffer(s.utf8.length(this.typeDefault)),0),this.typeDefault=l),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),d.prototype.resolve.call(this))},c.prototype.f=function(l){var f;return l!=="proto2"&&l!=="proto3"?{}:(l={},this.rule==="required"&&(l.field_presence="LEGACY_REQUIRED"),this.parent&&p.defaults[this.type]===o&&(f=this.parent.get(this.type.split(".").pop()))&&f instanceof i&&f.group&&(l.message_encoding="DELIMITED"),this.getOption("packed")===!0?l.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(l.repeated_field_encoding="EXPANDED"),l)},c.prototype.r=function(l){return d.prototype.r.call(this,this.e||l)},c.d=function(l,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 c(y,l,f,g,{default:m}))}},c.c=function(l){i=l}},{14:14,22:22,32:32,33:33}],16:[function(t,n,u){var i=n.exports=t(17);i.build="light",i.load=function(d,h,p){return(h=typeof h=="function"?(p=h,new i.Root):h||new i.Root).load(d,p)},i.loadSync=function(d,h){return(h=h||new i.Root).loadSync(d)},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,u){var i=u;function d(){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=d,d()},{24:24,25:25,27:27,28:28,35:35,39:39,40:40}],18:[function(t,n,u){n.exports=p;var i=t(15),d=(((p.prototype=Object.create(i.prototype)).constructor=p).className="MapField",t(32)),h=t(33);function p(s,a,c,l,f,g){if(i.call(this,s,a,l,o,o,f,g),!h.isString(c))throw TypeError("keyType must be a string");this.keyType=c,this.resolvedKeyType=null,this.map=!0}p.fromJSON=function(s,a){return new p(s,a.id,a.keyType,a.type,a.options,a.comment)},p.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,h.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:o])},p.prototype.resolve=function(){if(this.resolved)return this;if(d.mapKey[this.keyType]===o)throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},p.d=function(s,a,c){return typeof c=="function"?c=h.decorateType(c).name:c&&typeof c=="object"&&(c=h.decorateEnum(c).name),function(l,f){h.decorateType(l.constructor).add(new p(f,s,a,c))}}},{15:15,32:32,33:33}],19:[function(t,n,u){n.exports=d;var i=t(35);function d(h){if(h)for(var p=Object.keys(h),s=0;s<p.length;++s){var a=p[s];a!=="__proto__"&&(this[a]=h[a])}}d.create=function(h){return this.$type.create(h)},d.encode=function(h,p){return this.$type.encode(h,p)},d.encodeDelimited=function(h,p){return this.$type.encodeDelimited(h,p)},d.decode=function(h){return this.$type.decode(h)},d.decodeDelimited=function(h){return this.$type.decodeDelimited(h)},d.verify=function(h){return this.$type.verify(h)},d.fromObject=function(h){return this.$type.fromObject(h)},d.toObject=function(h,p){return this.$type.toObject(h,p)},d.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},{35:35}],20:[function(t,n,u){n.exports=h;var i=t(22),d=(((h.prototype=Object.create(i.prototype)).constructor=h).className="Method",t(33));function h(p,s,a,c,l,f,g,m,_){if(d.isObject(l)?(g=l,l=f=o):d.isObject(f)&&(g=f,f=o),s!==o&&!d.isString(s))throw TypeError("type must be a string");if(!d.isString(a))throw TypeError("requestType must be a string");if(!d.isString(c))throw TypeError("responseType must be a string");i.call(this,p,g),this.type=s||"rpc",this.requestType=a,this.requestStream=!!l||o,this.responseType=c,this.responseStream=!!f||o,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=m,this.parsedOptions=_}h.fromJSON=function(p,s){return new h(p,s.type,s.requestType,s.responseType,s.requestStream,s.responseStream,s.options,s.comment,s.parsedOptions)},h.prototype.toJSON=function(p){return p=!!p&&!!p.keepComments,d.toObject(["type",this.type!=="rpc"&&this.type||o,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",p?this.comment:o,"parsedOptions",this.parsedOptions])},h.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,u){n.exports=f;var i,d,h,p=t(22),s=(((f.prototype=Object.create(p.prototype)).constructor=f).className="Namespace",t(15)),a=t(33),c=t(23);function l(m,_){if(!m||!m.length)return o;for(var y={},b=0;b<m.length;++b)y[m[b].name]=m[b].toJSON(_);return y}function f(m,_){p.call(this,m,_),this.nested=o,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=l,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",l(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!==o?i:_.values!==o?h:_.methods!==o?d:_.id!==o?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 h)return this.nested[m].values;throw Error("no such enum: "+m)},f.prototype.add=function(m){if(!(m instanceof s&&m.extend!==o||m instanceof i||m instanceof c||m instanceof h||m instanceof d||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 d)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 d||this instanceof h||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 p))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=o),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,p.prototype.v.call(this,m),this.nestedArray.forEach(_=>{_.v(m)})),this},f.prototype.lookup=function(m,_,y){if(typeof _=="boolean"?(y=_,_=o):_&&!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,[h]);if(_)return _;throw Error("no such Enum '"+m+"' in "+this)},f.prototype.lookupTypeOrEnum=function(m){var _=this.lookup(m,[i,h]);if(_)return _;throw Error("no such Type or Enum '"+m+"' in "+this)},f.prototype.lookupService=function(m){var _=this.lookup(m,[d]);if(_)return _;throw Error("no such Service '"+m+"' in "+this)},f.c=function(m,_,y){i=m,d=_,h=y}},{15:15,22:22,23:23,33:33}],22:[function(t,n,u){(n.exports=c).className="ReflectionObject";const i=t(23);var d,h=t(33),p={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 c(l,f){if(!h.isString(l))throw TypeError("name must be a string");if(f&&!h.isObject(f))throw TypeError("options must be an object");this.options=f,this.parsedOptions=null,this.name=l,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(c.prototype,{root:{get:function(){for(var l=this;l.parent!==null;)l=l.parent;return l}},fullName:{get:function(){for(var l=[this.name],f=this.parent;f;)l.unshift(f.name),f=f.parent;return l.join(".")}}}),c.prototype.toJSON=function(){throw Error()},c.prototype.onAdd=function(l){this.parent&&this.parent!==l&&this.parent.remove(this),this.parent=l,this.resolved=!1,l=l.root,l instanceof d&&l.j(this)},c.prototype.onRemove=function(l){l=l.root,l instanceof d&&l.O(this),this.parent=null,this.resolved=!1},c.prototype.resolve=function(){return this.resolved||this.root instanceof d&&(this.resolved=!0),this},c.prototype.v=function(l){return this.r(this.e||l)},c.prototype.r=function(l){if(!this.g){var f={};if(!l)throw Error("Unknown edition for "+this.fullName);var g=Object.assign(this.options?Object.assign({},this.options.features):{},this.f(l));if(this.e){if(l==="proto2")f=Object.assign({},s);else if(l==="proto3")f=Object.assign({},a);else{if(l!=="2023")throw Error("Unknown edition: "+l);f=Object.assign({},p)}this.o=Object.assign(f,g||{})}else{if(this.partOf instanceof i)l=Object.assign({},this.partOf.o),this.o=Object.assign(l,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}},c.prototype.f=function(){return{}},c.prototype.getOption=function(l){return this.options?this.options[l]:o},c.prototype.setOption=function(l,f,g){return l!=="__proto__"&&(this.options||(this.options={}),/^features\./.test(l)?h.setProperty(this.options,l,f,g):g&&this.options[l]!==o||(this.getOption(l)!==f&&(this.resolved=!1),this.options[l]=f)),this},c.prototype.setParsedOption=function(l,f,g){var m,_,y;return l!=="__proto__"&&(this.parsedOptions||(this.parsedOptions=[]),m=this.parsedOptions,g?(_=m.find(function(b){return Object.prototype.hasOwnProperty.call(b,l)}))?(y=_[l],h.setProperty(y,g,f)):((_={})[l]=h.setProperty({},g,f),m.push(_)):((y={})[l]=f,m.push(y))),this},c.prototype.setOptions=function(l,f){if(l)for(var g=Object.keys(l),m=0;m<g.length;++m)this.setOption(g[m],l[g[m]],f);return this},c.prototype.toString=function(){var l=this.constructor.className,f=this.fullName;return f.length?l+" "+f:l},c.prototype.h=function(){return this.e&&this.e!=="proto3"?this.e:o},c.c=function(l){d=l}},{23:23,33:33}],23:[function(t,n,u){n.exports=p;var i=t(22),d=(((p.prototype=Object.create(i.prototype)).constructor=p).className="OneOf",t(15)),h=t(33);function p(a,c,l,f){if(Array.isArray(c)||(l=c,c=o),i.call(this,a,l),c!==o&&!Array.isArray(c))throw TypeError("fieldNames must be an Array");this.oneof=c||[],this.fieldsArray=[],this.comment=f}function s(a){if(a.parent)for(var c=0;c<a.fieldsArray.length;++c)a.fieldsArray[c].parent||a.parent.add(a.fieldsArray[c])}p.fromJSON=function(a,c){return new p(a,c.oneof,c.options,c.comment)},p.prototype.toJSON=function(a){return a=!!a&&!!a.keepComments,h.toObject(["options",this.options,"oneof",this.oneof,"comment",a?this.comment:o])},p.prototype.add=function(a){if(a instanceof d)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")},p.prototype.remove=function(a){if(!(a instanceof d))throw TypeError("field must be a Field");var c=this.fieldsArray.indexOf(a);if(c<0)throw Error(a+" is not a member of "+this);return this.fieldsArray.splice(c,1),-1<(c=this.oneof.indexOf(a.name))&&this.oneof.splice(c,1),a.partOf=null,this},p.prototype.onAdd=function(a){i.prototype.onAdd.call(this,a);for(var c=0;c<this.oneof.length;++c){var l=a.get(this.oneof[c]);l&&!l.partOf&&(l.partOf=this).fieldsArray.push(l)}s(this)},p.prototype.onRemove=function(a){for(var c,l=0;l<this.fieldsArray.length;++l)(c=this.fieldsArray[l]).parent&&c.parent.remove(c);i.prototype.onRemove.call(this,a)},Object.defineProperty(p.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}}),p.d=function(){for(var a=Array(arguments.length),c=0;c<arguments.length;)a[c]=arguments[c++];return function(l,f){h.decorateType(l.constructor).add(new p(f,a)),Object.defineProperty(l,f,{get:h.oneOfGetter(a),set:h.oneOfSetter(a)})}}},{15:15,22:22,33:33}],24:[function(t,n,u){n.exports=a;var i,d=t(35),h=d.LongBits,p=d.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 c(){return d.Buffer?function(y){return(a.create=function(b){return d.Buffer.isBuffer(b)?new i(b):f(b)})(y)}:f}var l,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 h(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 h(m(this.buf,this.pos+=4),m(this.buf,this.pos+=4))}a.create=c(),a.prototype.k=d.Array.prototype.subarray||d.Array.prototype.slice,a.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128||(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128||(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128||!((this.pos+=5)>this.len))))))return l;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=d.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=d.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=d.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 p.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=d.recursionLimit,a.prototype.skipType=function(y,b){if(a.recursionLimit<(b=b===o?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=c(),i.c();var b=d.Long?"toLong":"toNumber";d.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,u){n.exports=h;var i=t(24),d=((h.prototype=Object.create(i.prototype)).constructor=h,t(35));function h(p){i.call(this,p)}h.c=function(){d.Buffer&&(h.prototype.k=d.Buffer.prototype.slice)},h.prototype.string=function(){var p=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+p,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+p,this.len))},h.c()},{24:24,35:35}],26:[function(t,n,u){n.exports=f;var i,d,h,p=t(21),s=(((f.prototype=Object.create(p.prototype)).constructor=f).className="Root",t(15)),a=t(14),c=t(23),l=t(33);function f(y){p.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=l.path.resolve,f.prototype.fetch=l.fetch,f.prototype.load=function y(b,k,v){typeof k=="function"&&(v=k,k=o);var C=this;if(!v)return l.asPromise(y,C,b,k);var w=v===g;function A(I,N){if(v){if(w)throw I;N&&N.resolveAll();var j=v;v=null,j(I,N)}}function x(I){var N=I.lastIndexOf("google/protobuf/");return-1<N&&(I=I.substring(N),I in h)?I:null}function R(I,N){try{if(l.isString(N)&&(N[0]||"")=="{"&&(N=JSON.parse(N)),l.isString(N)){d.filename=I;var j,M=d(N,C,k),V=0;if(M.imports)for(;V<M.imports.length;++V)(j=x(M.imports[V])||C.resolvePath(I,M.imports[V]))&&q(j);if(M.weakImports)for(V=0;V<M.weakImports.length;++V)(j=x(M.weakImports[V])||C.resolvePath(I,M.weakImports[V]))&&q(j,!0)}else C.setOptions(N.options).addJSON(N.nested)}catch(fe){A(fe)}w||z||A(null,C)}function q(I,N){if(I=x(I)||I,!~C.files.indexOf(I))if(C.files.push(I),I in h)w?R(I,h[I]):(++z,setTimeout(function(){--z,R(I,h[I])}));else if(w){var j;try{j=l.fs.readFileSync(I).toString("utf8")}catch(M){return void(N||A(M))}R(I,j)}else++z,C.fetch(I,function(M,V){--z,v&&(M?N?z||A(null,C):A(M):R(I,V))})}var z=0;l.isString(b)&&(b=[b]);for(var T,S=0;S<b.length;++S)(T=C.resolvePath("",b[S]))&&q(T);return w?C.resolveAll():z||A(null,C),C},f.prototype.loadSync=function(y,b){if(l.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 p.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,o,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===o||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 c)){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!==o&&(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 p){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,d=b,h=k}},{14:14,15:15,21:21,23:23,33:33}],27:[function(t,n,u){n.exports={}},{}],28:[function(t,n,u){u.Service=t(29)},{29:29}],29:[function(t,n,u){n.exports=d;var i=t(35);function d(h,p,s){if(typeof h!="function")throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=h,this.requestDelimited=!!p,this.responseDelimited=!!s}((d.prototype=Object.create(i.EventEmitter.prototype)).constructor=d).prototype.rpcCall=function h(p,s,a,c,l){if(!c)throw TypeError("request must be specified");var f=this;if(!l)return i.asPromise(h,f,p,s,a,c);if(!f.rpcImpl)return setTimeout(function(){l(Error("already ended"))},0),o;try{return f.rpcImpl(p,s[f.requestDelimited?"encodeDelimited":"encode"](c).finish(),function(g,m){if(g)return f.emit("error",g,p),l(g);if(m===null)return f.end(!0),o;if(!(m instanceof a))try{m=a[f.responseDelimited?"decodeDelimited":"decode"](m)}catch(_){return f.emit("error",_,p),l(_)}return f.emit("data",m,p),l(null,m)})}catch(g){return f.emit("error",g,p),setTimeout(function(){l(g)},0),o}},d.prototype.end=function(h){return this.rpcImpl&&(h||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(t,n,u){n.exports=a;var i=t(21),d=(((a.prototype=Object.create(i.prototype)).constructor=a).className="Service",t(20)),h=t(33),p=t(28),s=h.patterns.reservedRe;function a(l,f){i.call(this,l,f),this.methods={},this._=null}function c(l){return l._=null,l}a.fromJSON=function(l,f){var g=new a(l,f.options);if(f.methods)for(var m=Object.keys(f.methods),_=0;_<m.length;++_)g.add(d.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(l){var f=i.prototype.toJSON.call(this,l),g=!!l&&!!l.keepComments;return h.toObject(["edition",this.h(),"options",f&&f.options||o,"methods",i.arrayToJSON(this.methodsArray,l)||{},"nested",f&&f.nested||o,"comment",g?this.comment:o])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._||(this._=h.toArray(this.methods))}}),a.prototype.get=function(l){return Object.prototype.hasOwnProperty.call(this.methods,l)?this.methods[l]:i.prototype.get.call(this,l)},a.prototype.resolveAll=function(){if(this.b){i.prototype.resolve.call(this);for(var l=this.methodsArray,f=0;f<l.length;++f)l[f].resolve()}return this},a.prototype.v=function(l){return this.p&&(l=this.e||l,i.prototype.v.call(this,l),this.methodsArray.forEach(f=>{f.v(l)})),this},a.prototype.add=function(l){if(this.get(l.name))throw Error("duplicate name '"+l.name+"' in "+this);return l instanceof d?l.name==="__proto__"?this:c((this.methods[l.name]=l).parent=this):i.prototype.add.call(this,l)},a.prototype.remove=function(l){if(l instanceof d){if(this.methods[l.name]!==l)throw Error(l+" is not a member of "+this);return delete this.methods[l.name],l.parent=null,c(this)}return i.prototype.remove.call(this,l)},a.prototype.create=function(l,f,g){for(var m,_=new p.Service(l,f,g),y=0;y<this.methodsArray.length;++y){var b=h.lcFirst((m=this._[y]).resolve().name).replace(/[^$\w_]/g,"");_[b]=h.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,u){n.exports=v;var i=t(21),d=(((v.prototype=Object.create(i.prototype)).constructor=v).className="Type",t(14)),h=t(23),p=t(15),s=t(18),a=t(30),c=t(19),l=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=o,this.extensions=o,this.reserved=o,this.group=o,this.A=null,this.i=null,this.T=null,this.x=null}function C(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]],R=x.id;if(this.A[R])throw Error("duplicate id "+R+" in "+this);this.A[R]=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 c||((w.prototype=new c).constructor=w,g.merge(w.prototype,A)),w.$type=w.prototype.$type=this,g.merge(w,c,!0),this.x=w,0);x<this.fieldsArray.length;++x)this.i[x].resolve();for(var R={},x=0;x<this.oneofsArray.length;++x)R[this.T[x].resolve().name]={get:g.oneOfGetter(this.T[x].oneof),set:g.oneOfSetter(this.T[x].oneof)};x&&Object.defineProperties(w.prototype,R)}}}),v.generateConstructor=function(w){for(var A,x=g.codegen(["p"],w.name),R=0;R<w.fieldsArray.length;++R)(A=w.i[R]).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),R=(x.extensions=A.extensions,x.reserved=A.reserved,Object.keys(A.fields)),q=0;q<R.length;++q)x.add((A.fields[R[q]].keyType!==void 0?s:p).fromJSON(R[q],A.fields[R[q]]));if(A.oneofs)for(R=Object.keys(A.oneofs),q=0;q<R.length;++q)x.add(h.fromJSON(R[q],A.oneofs[R[q]]));if(A.nested)for(R=Object.keys(A.nested),q=0;q<R.length;++q){var z=A.nested[R[q]];x.add((z.id!==o?p:z.fields!==o?v:z.values!==o?d:z.methods!==o?a:i).fromJSON(R[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||o,"oneofs",i.arrayToJSON(this.oneofsArray,w),"fields",i.arrayToJSON(this.fieldsArray.filter(function(R){return!R.declaringField}),w)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:o,"reserved",this.reserved&&this.reserved.length?this.reserved:o,"group",this.group||o,"nested",A&&A.nested||o,"comment",x?this.comment:o])},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 p&&w.extend===o){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),C(this))}return w instanceof h?w.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),(this.oneofs[w.name]=w).onAdd(this),C(this)):i.prototype.add.call(this,w)},v.prototype.remove=function(w){if(w instanceof p&&w.extend===o){if(this.fields&&this.fields[w.name]===w)return delete this.fields[w.name],w.parent=null,w.onRemove(this),C(this);throw Error(w+" is not a member of "+this)}if(w instanceof h){if(this.oneofs&&this.oneofs[w.name]===w)return delete this.oneofs[w.name],w.parent=null,w.onRemove(this),C(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 R=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:l,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,R=k[R];return R&&((x=Object.create(this)).fromObject=this.fromObject,this.fromObject=R.fromObject.bind(x),x.toObject=this.toObject,this.toObject=R.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,R){return this.setup().decode(w,A,x,R)},v.prototype.decodeDelimited=function(w){return w instanceof l||(w=l.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,u){var i=i(33),d=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function h(p,s){var a=0,c=Object.create(null);for(s|=0;a<p.length;)c[d[a+s]]=p[a++];return c}u.basic=h([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),u.defaults=h([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),u.long=h([0,0,0,1,1],7),u.mapKey=h([0,0,0,5,5,0,0,0,1,1,0,2],2),u.packed=h([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(t,n,u){var i,d,h=n.exports=t(35),p=t(27),s=(h.codegen=t(3),h.fetch=t(5),h.path=t(8),h.patterns=t(36),h.patterns.reservedRe),a=h.patterns.unsafePropertyRe,c=(h.fs=h.inquire("fs"),h.toArray=function(f){if(f){for(var g=Object.keys(f),m=Array(g.length),_=0;_<g.length;)m[_]=f[g[_++]];return m}return[]},h.toObject=function(f){for(var g={},m=0;m<f.length;){var _=f[m++],y=f[m++];y!==o&&(g[_]=y)}return g},h.isReserved=function(f){return s.test(f)},h.safeProp=function(f){return!/^[$\w_]+$/.test(f)||s.test(f)?"["+JSON.stringify(f)+"]":"."+f},h.ucFirst=function(f){return(f[0]||"").toUpperCase()+f.substring(1)},/_([a-z])/g),l=(h.camelCase=function(f){return f.substring(0,1)+f.substring(1).replace(c,function(g,m){return m.toUpperCase()})},h.compareFieldsById=function(f,g){return f.id-g.id},h.decorateType=function(f,g){return f.$type?(g&&f.$type.name!==g&&(h.decorateRoot.remove(f.$type),f.$type.name=g,h.decorateRoot.add(f.$type)),f.$type):(g=new(i=i||t(31))(g||f.name),h.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);h.decorateEnum=function(f){var g;return f.$type||(g=new(d=d||t(14))("Enum"+l++,f),h.decorateRoot.add(g),Object.defineProperty(f,"$type",{value:g,enumerable:!1}),g)},h.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 C=k.shift();if(!a.test(C))if(0<k.length)b[C]=y(b[C]||{},k,v);else{if((k=b[C])&&_)return b;k&&(v=[].concat(k).concat(v)),b[C]=v}return b})(f,g=g.split("."),m);throw TypeError("path must be specified")},Object.defineProperty(h,"decorateRoot",{get:function(){return p.decorated||(p.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,u){n.exports=d;var i=t(35);function d(s,a){this.lo=s>>>0,this.hi=a>>>0}var h=d.zero=new d(0,0),p=(h.toNumber=function(){return 0},h.zzEncode=h.zzDecode=function(){return this},h.length=function(){return 1},d.zeroHash="\0\0\0\0\0\0\0\0",d.fromNumber=function(s){var a,c;return s===0?h:(c=(s=(a=s<0)?-s:s)>>>0,s=(s-c)/4294967296>>>0,a&&(s=~s>>>0,c=~c>>>0,4294967295<++c&&(c=0,4294967295<++s&&(s=0))),new d(c,s))},d.from=function(s){if(typeof s=="number")return d.fromNumber(s);if(i.isString(s)){if(!i.Long)return d.fromNumber(parseInt(s,10));s=i.Long.fromString(s)}return s.low||s.high?new d(s.low>>>0,s.high>>>0):h},d.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},d.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);d.fromHash=function(s){return s==="\0\0\0\0\0\0\0\0"?h:new d((p.call(s,0)|p.call(s,1)<<8|p.call(s,2)<<16|p.call(s,3)<<24)>>>0,(p.call(s,4)|p.call(s,5)<<8|p.call(s,6)<<16|p.call(s,7)<<24)>>>0)},d.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)},d.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},d.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},d.prototype.length=function(){var s=this.lo,a=(this.lo>>>28|this.hi<<4)>>>0,c=this.hi>>>24;return c==0?a==0?s<16384?s<128?1:2:s<2097152?3:4:a<16384?a<128?5:6:a<2097152?7:8:c<128?9:10}},{35:35}],35:[function(t,n,u){var i=u;function d(p,s,a){for(var c=Object.keys(s),l=0;l<c.length;++l)p[c[l]]!==o&&a||c[l]!=="__proto__"&&(p[c[l]]=s[c[l]]);return p}function h(p){function s(a,c){if(!(this instanceof s))return new s(a,c);Object.defineProperty(this,"message",{get:function(){return a}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:Error().stack||""}),c&&d(this,c)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return p},set:o,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(p){return typeof p=="number"&&isFinite(p)&&Math.floor(p)===p},i.isString=function(p){return typeof p=="string"||p instanceof String},i.isObject=function(p){return p&&typeof p=="object"},i.isset=i.isSet=function(p,s){var a=p[s];return a!=null&&p.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(p){return typeof p=="number"?i.Buffer?i.L(p):new i.Array(p):i.Buffer?i.S(p):typeof Uint8Array=="undefined"?p:new Uint8Array(p)},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(p){return p?i.LongBits.from(p).toHash():i.LongBits.zeroHash},i.longFromHash=function(p,s){return p=i.LongBits.fromHash(p),i.Long?i.Long.fromBits(p.lo,p.hi,s):p.toNumber(!!s)},i.merge=d,i.recursionLimit=100,i.makeProp=function(p,s){Object.defineProperty(p,s,{enumerable:!0,configurable:!0,writable:!0})},i.lcFirst=function(p){return(p[0]||"").toLowerCase()+p.substring(1)},i.newError=h,i.ProtocolError=h("ProtocolError"),i.oneOfGetter=function(p){for(var s={},a=0;a<p.length;++a)s[p[a]]=1;return function(){for(var c=Object.keys(this),l=c.length-1;-1<l;--l)if(s[c[l]]===1&&this[c[l]]!==o&&this[c[l]]!==null)return c[l]}},i.oneOfSetter=function(p){return function(s){for(var a=0;a<p.length;++a)p[a]!==s&&delete this[p[a]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i.c=function(){var p=i.Buffer;p?(i.S=p.from!==Uint8Array.from&&p.from||function(s,a){return new p(s,a)},i.L=p.allocUnsafe||function(s){return new p(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,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,n,u){n.exports=function(s){var a=d.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"),c=s.oneofsArray,l={};c.length&&a("var p={}");for(var f=0;f<s.fieldsArray.length;++f){var g,m=s.i[f].resolve(),_="m"+d.safeProp(m.name);m.optional&&a("if(%s!=null&&m.hasOwnProperty(%j)){",_,m.name),m.map?(a("if(!util.isObject(%s))",_)("return%j",h(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",h(b,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":y("if(!util.key64Re.test(%s))",k)("return%j",h(b,"integer|Long key"));break;case"bool":y("if(!util.key2Re.test(%s))",k)("return%j",h(b,"boolean key"))}})(a,m,"k[i]"),p(a,m,f,_+"[k[i]]")("}")):m.repeated?(a("if(!Array.isArray(%s))",_)("return%j",h(m,"array"))("for(var i=0;i<%s.length;++i){",_),p(a,m,f,_+"[i]")("}")):(m.partOf&&(g=d.safeProp(m.partOf.name),l[m.partOf.name]===1&&a("if(p%s===1)",g)("return%j",m.partOf.name+": multiple values"),l[m.partOf.name]=1,a("p%s=1",g)),p(a,m,f,_)),m.optional&&a("}")}return a("return null")};var i=t(14),d=t(33);function h(s,a){return s.name+": "+a+(s.repeated&&a!=="array"?"[]":s.map&&a!=="object"?"{k:"+s.keyType+"}":"")+" expected"}function p(s,a,c,l){if(a.resolvedType)if(a.resolvedType instanceof i){s("switch(%s){",l)("default:")("return%j",h(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);",c,l)("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))",l)("return%j",h(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)))",l,l,l,l)("return%j",h(a,"integer|Long"));break;case"float":case"double":s('if(typeof %s!=="number")',l)("return%j",h(a,"number"));break;case"bool":s('if(typeof %s!=="boolean")',l)("return%j",h(a,"boolean"));break;case"string":s("if(!util.isString(%s))",l)("return%j",h(a,"string"));break;case"bytes":s('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',l,l,l)("return%j",h(a,"buffer"))}return s}},{14:14,33:33}],38:[function(t,n,u){var i=t(19);u[".google.protobuf.Any"]={fromObject:function(d,h){if(d&&d["@type"]){var p,s=d["@type"].substring(1+d["@type"].lastIndexOf("/")),s=this.lookup(s);if(s)return~(p=(d["@type"][0]||"")=="."?d["@type"].slice(1):d["@type"]).indexOf("/")||(p="/"+p),this.create({type_url:p,value:s.encode(s.fromObject(d,h===o?1:h+1)).finish()})}return this.fromObject(d,h)},toObject:function(d,h){var p,s,a="",c="";return h&&h.json&&d.type_url&&d.value&&(c=d.type_url.substring(1+d.type_url.lastIndexOf("/")),a=d.type_url.substring(0,1+d.type_url.lastIndexOf("/")),(p=this.lookup(c))&&(d=p.decode(d.value))),!(d instanceof this.ctor)&&d instanceof i?(p=d.$type.toObject(d,h),s=d.$type.fullName[0]==="."?d.$type.fullName.slice(1):d.$type.fullName,p["@type"]=c=(a=a===""?"type.googleapis.com/":a)+s,p):this.toObject(d,h)}}},{19:19}],39:[function(t,n,u){n.exports=f;var i,d=t(35),h=d.LongBits,p=d.base64,s=d.utf8;function a(v,C,w){this.fn=v,this.len=C,this.next=o,this.val=w}function c(){}function l(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(c,0,0),this.tail=this.head,this.states=null}function g(){return d.Buffer?function(){return(f.create=function(){return new i})()}:function(){return new f}}function m(v,C,w){C[w]=255&v}function _(v,C){this.len=v,this.next=o,this.val=C}function y(v,C,w){for(;v.hi;)C[w++]=127&v.lo|128,v.lo=(v.lo>>>7|v.hi<<25)>>>0,v.hi>>>=7;for(;127<v.lo;)C[w++]=127&v.lo|128,v.lo=v.lo>>>7;C[w++]=v.lo}function b(v,C,w){C[w]=255&v,C[w+1]=v>>>8&255,C[w+2]=v>>>16&255,C[w+3]=v>>>24}f.create=g(),f.alloc=function(v){return new d.Array(v)},d.Array!==Array&&(f.alloc=d.pool(f.alloc,d.Array.prototype.subarray)),f.prototype.N=function(v,C,w){return this.tail=this.tail.next=new a(v,C,w),this.len+=C,this},(_.prototype=Object.create(a.prototype)).fn=function(v,C,w){for(;127<v;)C[w++]=127&v|128,v>>>=7;C[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,h.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=h.from(v),this.N(y,v.length(),v)},f.prototype.sint64=function(v){return v=h.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=h.from(v),this.N(b,4,v.lo).N(b,4,v.hi)},f.prototype.float=function(v){return this.N(d.float.writeFloatLE,4,v)},f.prototype.double=function(v){return this.N(d.float.writeDoubleLE,8,v)};var k=d.Array.prototype.set?function(v,C,w){C.set(v,w)}:function(v,C,w){for(var A=0;A<v.length;++A)C[w+A]=v[A]};f.prototype.bytes=function(v){var C,w=v.length>>>0;return w?(d.isString(v)&&(C=f.alloc(w=p.length(v)),p.decode(v,C,0),v=C),this.uint32(w).N(k,w,v)):this.N(m,1,0)},f.prototype.string=function(v){var C=s.length(v);return C?this.uint32(C).N(s.write,C,v):this.N(m,1,0)},f.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new a(c,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(c,0,0),this.len=0),this},f.prototype.ldelim=function(){var v=this.head,C=this.tail,w=this.len;return this.reset().uint32(w),w&&(this.tail.next=v.next,this.tail=C,this.len+=w),this},f.prototype.finish=function(){for(var v=this.head.next,C=this.constructor.alloc(this.len),w=0;v;)v.fn(v.val,C,w),w+=v.len,v=v.next;return C},f.c=function(v){i=v,f.create=g(),i.c()}},{35:35}],40:[function(t,n,u){n.exports=h;var i=t(39),d=((h.prototype=Object.create(i.prototype)).constructor=h,t(35));function h(){i.call(this)}function p(s,a,c){s.length<40?d.utf8.write(s,a,c):a.utf8Write?a.utf8Write(s,c):a.write(s,c)}h.c=function(){h.alloc=d.L,h.writeBytesBuffer=d.Buffer&&d.Buffer.prototype instanceof Uint8Array&&d.Buffer.prototype.set.name==="set"?function(s,a,c){a.set(s,c)}:function(s,a,c){if(s.copy)s.copy(a,c,0,s.length);else for(var l=0;l<s.length;)a[c++]=s[l++]}},h.prototype.bytes=function(s){var a=(s=d.isString(s)?d.S(s,"base64"):s).length>>>0;return this.uint32(a),a&&this.N(h.writeBytesBuffer,a,s),this},h.prototype.string=function(s){var a=d.Buffer.byteLength(s);return this.uint32(a),a&&this.N(p,a,s),this},h.c()},{35:35,39:39}]},r={},Te=(function t(n){var u=r[n];return u||e[n][0].call(u=r[n]={exports:{}},t,u,u.exports),u.exports})([16][0])})();const Ft=4096,Pn=1<<20;let L=new Uint8Array(Ft),xe=new DataView(L.buffer),P=0,$=0,X=0;function Ln(){return P}function Mn(o){return L.slice(o,P)}function Dn(o){P=o,o===0&&L.length>Pn&&(L=new Uint8Array(Ft),xe=new DataView(L.buffer))}function J(o){if(P+o>L.length){const e=new Uint8Array(Math.max(L.length*2,P+o));e.set(L.subarray(0,P)),L=e,xe=new DataView(e.buffer)}}function me(o){for(;o>127;)L[P++]=o&127|128,o>>>=7;L[P++]=o}function Ke(){for(;X;)L[P++]=$&127|128,$=($>>>7|X<<25)>>>0,X>>>=7;me($)}function Ye(o){L[P++]=o&255,L[P++]=o>>>8&255,L[P++]=o>>>16&255,L[P++]=o>>>24}function We(o){if(o===0){$=X=0;return}const e=o<0;e&&(o=-o),$=o>>>0,X=(o-$)/4294967296>>>0,e&&(X=~X>>>0,$=~$>>>0,++$>4294967295&&($=0,++X>4294967295&&(X=0)))}function ee(o){J(5),o<128?L[P++]=o:me(o)}function Bn(o){J(1),L[P++]=o}function Ht(o){J(5),me(o>>>0)}function Ut(o){o|=0,J(10),o<0?($=o>>>0,X=4294967295,Ke()):me(o)}function qn(o){o|=0,Ht((o<<1^o>>31)>>>0)}function $t(o){J(4),Ye(o>>>0)}function zt(o){We(o),J(10),Ke()}function Fn(o){We(o);const e=X>>31;X=((X<<1|$>>>31)^e)>>>0,$=($<<1^e)>>>0,J(10),Ke()}function Vt(o){We(o),J(8),Ye($),Ye(X)}function Hn(o){J(8),xe.setFloat64(P,o,!0),P+=8}function Un(o){J(4),xe.setFloat32(P,o,!0),P+=4}function $n(o){const e=o.length>>>0;J(e+5),me(e),e&&(L.set(o,P),P+=e)}function Ze(){return J(1),P++}function Ne(o){const e=P-o-1;if(e<128){L[o]=e;return}const r=e<16384?2:e<2097152?3:e<268435456?4:5;J(r-1),L.copyWithin(o+r,o+1,P),P=o+r+e;let t=e;for(let n=0;n<r-1;n++)L[o+n]=t&127|128,t>>>=7;L[o+r-1]=t}function zn(o){const e=o.length;J(e*3+5);const r=L,t=P++;let n=P,u=0,i=0;for(;u<e&&(i=o.charCodeAt(u))<128;)r[n++]=i,u++;for(;u<e;u++)i=o.charCodeAt(u),i<128?r[n++]=i:i<2048?(r[n++]=i>>6|192,r[n++]=i&63|128):(i&64512)===55296&&(o.charCodeAt(u+1)&64512)===56320?(i=65536+((i&1023)<<10)+(o.charCodeAt(++u)&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,Ne(t)}const Re=0,de=1,Xt=2,Jt=3,Gt=4,Vn=5,ce=Object.prototype.hasOwnProperty;function Qe(o,e){return o&&typeof o=="object"&&ce.call(o,e)?o[e]:void 0}function Xn(o){return o.fields!==void 0?de:o.values!==void 0?Xt:o.methods!==void 0?Jt:o.id!==void 0?Gt:Re}function et(o){return o===Re||o===de||o===Jt}function je(o,e,r){const t=Qe(o.nested,e);return t&&typeof t=="object"?{node:t,kind:Xn(t),path:r.concat(e)}:null}function Jn(o,e){if(o.kind===de){const r=Qe(o.node.fields,e);if(r)return{node:r,kind:Gt,path:o.path.concat(e)};const t=Qe(o.node.oneofs,e);if(t)return{node:t,kind:Vn,path:o.path.concat(e)}}return je(o.node,e,o.path)}function tt(o,e,r){const t=Jn(o,e[r]);let n=null;if(t)r===e.length-1?n=t:et(t.kind)&&(n=tt(t,e,r+1));else if(o.node.nested&&typeof o.node.nested=="object")for(const u of Object.keys(o.node.nested)){const i=je(o.node,u,o.path);i&&et(i.kind)&&(n=tt(i,e,r)||n)}return n}function Gn(o,e){let r={node:o,kind:Re,path:[]};for(let t=0;r&&t<e.length;t++)r=et(r.kind)?je(r.node,e[t],r.path):null;return r}function Kt(o,e,r,t){r[0]===""&&(e=[],r=r.slice(1));const n=Gn(o,r);if(n&&t(n.kind))return n;const u=[{node:o,kind:Re,path:[]}];for(const i of e)u.push(je(u[u.length-1].node,i,u[u.length-1].path));for(let i=u.length-1;i>=0;i--){const d=tt(u[i],r,0);if(d&&t(d.kind))return d}return null}const Yt=100,Kn=0,ne=1,Pe=2,Wt=3,Zt=4,Qt=new WeakMap,er=()=>{},Yn=new Uint8Array(0),Wn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ye=o=>Number.isInteger(o),ge=o=>Number.isInteger(o)||!!(o&&Number.isInteger(o.low)&&Number.isInteger(o.high)),tr=o=>typeof o=="number",Zn=o=>typeof o=="boolean",rr=o=>typeof o=="string"||o instanceof String,Qn=o=>!!(o&&typeof o.length=="number")||rr(o);function ve(o,e){if(typeof o=="string")return parseInt(o,10);if(o&&typeof o=="object"){const r=o.low>>>0,t=o.high>>>0;if(!e&&t>>>31){const n=~r+1>>>0,u=n?~t>>>0:(~t>>>0)+1>>>0;return-(n+u*4294967296)}return r+t*4294967296}return o}function ei(o){const e=new Uint8Array(Math.ceil(o.length*3/4));let r=0,t=0,n=0;for(let u=0;u<o.length;){const i=o.charAt(u++);if(i==="="&&t>1)break;const d=Wn.indexOf(i);if(d<0)throw new Error("invalid encoding");t===0?(n=d,t=1):t===1?(e[r++]=n<<2|(d&48)>>4,n=d,t=2):t===2?(e[r++]=(n&15)<<4|(d&60)>>2,n=d,t=3):(e[r++]=(n&3)<<6|d,t=0)}if(t===1)throw new Error("invalid encoding");return e.subarray(0,r)}const U=(o,e,r,t,n,u=Kn)=>({wt:o,put:e,ok:r,exp:t,def:n,vk:u}),Le={double:U(1,o=>Hn(Number(o)),tr,"number",0,Pe),float:U(5,o=>Un(Number(o)),tr,"number",0,Pe),int32:U(0,Ut,ye,"integer",0,ne),uint32:U(0,Ht,ye,"integer",0,ne),sint32:U(0,qn,ye,"integer",0,ne),fixed32:U(5,$t,ye,"integer",0,ne),sfixed32:U(5,$t,ye,"integer",0,ne),int64:U(0,o=>zt(ve(o)),ge,"integer|Long",0),uint64:U(0,o=>zt(ve(o,!0)),ge,"integer|Long",0),sint64:U(0,o=>Fn(ve(o)),ge,"integer|Long",0),fixed64:U(1,o=>Vt(ve(o)),ge,"integer|Long",0),sfixed64:U(1,o=>Vt(ve(o)),ge,"integer|Long",0),bool:U(0,o=>Bn(o?1:0),Zn,"boolean",!1,Zt),string:U(2,o=>zn(typeof o=="string"?o:String(o)),rr,"string","",Wt),bytes:U(2,o=>$n(typeof o=="string"?ei(o):o),Qn,"buffer",Yn)};function nr(o){return`${o.owner.full}.${o.name}`}function ti(o){return new TypeError(`${nr(o)}: array expected`)}function rt(o){return new TypeError(`${nr(o)}: object expected`)}function nt(o,e){if(!e)return null;if(!Array.isArray(e))throw ti(o);return e.length?e:null}function it(o,e,r){if(typeof e!="object"||e===null)throw rt(o);const t=Ze();ir(o.child,e,r+1),Ne(t)}function ri(o,e){ee(o.tag),o.put(e)}function ni(o,e){const r=nt(o,e);if(r){ee(o.tag);const t=Ze();for(let n=0;n<r.length;n++)o.put(r[n]);Ne(t)}}function ii(o,e){const r=nt(o,e);if(r)for(let t=0;t<r.length;t++)ee(o.tag),o.put(r[t])}function si(o,e,r){if(typeof e!="object")throw rt(o);ee(o.tag),it(o,e,r)}function oi(o,e,r){const t=nt(o,e);if(t)for(let n=0;n<t.length;n++)ee(o.tag),it(o,t[n],r)}function ai(o,e,r){if(!e)return;if(typeof e!="object")throw rt(o);const t=Object.keys(e);for(let n=0;n<t.length;n++){ee(o.tag);const u=Ze();ee(o.ktag),o.kput(t[n]),ee(o.vtag),o.child?it(o,e[t[n]],r):o.put(e[t[n]]),Ne(u)}}function ir(o,e,r){if(r>Yt)throw new Error("maximum nesting depth exceeded");const t=o.fields;for(let n=0;n<t.length;n++){const u=t[n];let i=e[u.name];if(i==null){if(!u.required)continue;i=u.def}u.write(u,i,r)}}function he(o,e){return`${o.name}: ${e}${o.repeated&&e!=="array"?"[]":o.keyType&&e!=="object"?`{k:${o.keyType}}`:""} expected`}const li=/^-?(?:0|[1-9][0-9]*)$/,ui=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,di=/(?:^true)|false|0|(?:1$)/;function sr(o,e){switch(o.vk){case ne:return Number.isInteger(e);case Pe:return typeof e=="number";case Wt:return typeof e=="string"||e instanceof String;case Zt:return typeof e=="boolean";default:return o.ok(e)}}function st(o,e,r){if(o.child){const t=or(o.child,e,r+1);return t&&`${o.name}.${t}`}return sr(o,e)?null:he(o,o.exp)}function ci(o,e,r){let t=0;if(o.vk===ne)for(;t<e.length&&Number.isInteger(e[t]);)t++;else if(o.vk===Pe)for(;t<e.length&&typeof e[t]=="number";)t++;else{for(let n;t<e.length;t++)if(n=st(o,e[t],r))return n;return null}return t<e.length?he(o,o.exp):null}function hi(o,e,r,t){let n=null;if(o.keyType){if(!r||typeof r!="object")return he(o,"object");const u=Object.keys(r);for(let i=0;!n&&i<u.length;i++)n=o.kre&&!o.kre.test(u[i])?he(o,o.kexp):st(o,r[u[i]],t)}else if(o.repeated){if(!Array.isArray(r))return he(o,"array");n=ci(o,r,t)}else{for(let u=0;u<o.prior.length;u++)if(e[o.prior[u].name]!=null&&ce.call(e,o.prior[u].name))return`${o.oneof}: multiple values`;n=st(o,r,t)}return n}function or(o,e,r){if(typeof e!="object"||e===null)return"object expected";if(r>Yt)return"maximum nesting depth exceeded";const t=o.vfields;for(let n=0;n<t.length;n++){const u=t[n],i=e[u.name];if(u.required||i!=null&&ce.call(e,u.name)){const d=u.plain?sr(u,i)?null:he(u,u.exp):hi(u,e,i,r);if(d)return d}}return null}const ar=U(2,er,()=>!0,"",void 0);function fi(o,e,r,t,n,u){const i=t.keyType!==void 0,d=!i&&t.rule==="repeated";let h=ce.call(Le,t.type)?Le[t.type]:ar,p=null;if(h===ar){const f=Kt(o.root,e.path,t.type.split("."),g=>g===de||g===Xt);if(!f)throw new Error(`no such Type or Enum '${t.type}' in Type ${e.full}`);if(f.kind===de){if(f.node.group)throw new Error(`${t.type}: groups are not supported`);p=lr(o,f)}else{const g=f.node.values,_=Object.keys(g).map(y=>g[y]);h=U(0,y=>Ut(typeof y=="string"?ce.call(g,y)?g[y]:_[0]:y),y=>_.indexOf(y)>=0,"enum value",_[0])}}const s=t.options&&t.options.packed,a=d&&!p&&h.wt!==2&&(s===void 0?e.packed:s===!0),c=i?t.keyType:"";return{name:r,id:t.id,tag:(t.id<<3|(i||p||a?2:h.wt))>>>0,write:i?ai:p?d?oi:si:d?a?ni:ii:ri,put:h.put,ok:h.ok,vk:h.vk,exp:h.exp,required:t.rule==="required",repeated:d,def:d||i?void 0:h.def,child:p,owner:e,keyType:c,kre:c==="bool"?di:/64$/.test(c)?ui:c&&c!=="string"?li:null,kexp:c==="bool"?"boolean key":/64$/.test(c)?"integer|Long key":"integer key",ktag:i?8|Le[c].wt:0,kput:i?Le[c].put:er,vtag:16|(p?2:h.wt),oneof:n,prior:u.slice(),plain:!i&&!d&&!p&&!u.length}}function lr(o,e){const r=e.path.join(".");let t=o.plans.get(r);if(t)return t;t={path:e.path,full:`.${r}`,fields:[],vfields:[],packed:e.node.edition!=="proto2"},o.plans.set(r,t);const n=e.node,u=new Map,i=n.oneofs||{};for(const h of Object.keys(i))for(const p of i[h].oneof||[])ce.call(n.fields,p)&&!u.has(p)&&u.set(p,h);const d=new Map;for(const h of Object.keys(n.fields)){const p=u.get(h)||"",s=d.get(p)||[],a=fi(o,t,h,n.fields[h],p,p?s:[]);p&&(s.push(a),d.set(p,s)),t.vfields.push(a)}return t.fields=t.vfields.slice().sort((h,p)=>h.id-p.id),t}let ur,dr="",cr;function ot(o,e){if(o===ur&&e===dr)return cr;let r=Qt.get(o);r||(r={root:o,plans:new Map,names:new Map},Qt.set(o,r));let t=r.names.get(e);if(!t){const n=Kt(r.root,[],e.split("."),u=>u===de);if(!n)throw new Error(`no such type: ${e}`);try{t=lr(r,n)}catch(u){throw r.plans.clear(),u}r.names.set(e,t)}return ur=o,dr=e,cr=t,t}function hr(o,e,r){const t=ot(o,e),n=Ln();try{return ir(t,r,0),Mn(n)}finally{Dn(n)}}function fr(o,e,r,t){return or(ot(o,e),r,0)}function pi(o,e){return ot(o,e).full}let Me;function mi(){if(Me===void 0)try{Me=Te.util.codegen(["a"],"o11yEvalProbe")("return a === true")()(!0)}catch(o){Me=!1}return Me}function at(o){return!!o&&!mi()}class yi{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=Te.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"),at(t)){const i=D.getSchemaId(e),d=fr(e.pbjsSchema,i,r);if(d)throw new Error(`Data is invalid for ${pi(e.pbjsSchema,i)}: ${d}`);return}const n=this.getSchemaType(e),u=n.verify(r);if(u)throw new Error(`Data is invalid for ${n.fullName}: ${u}`);return n}encode(e,r,t){const n=this.validate(e,r,t);if(at(t))return hr(e.pbjsSchema,D.getSchemaId(e),r);const u=n.fromObject(r);return n.encode(u).finish()}encodePayload(e,r){if(e!=null&&e.schema&&e.payload)return{schemaName:D.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 D.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 pr=new yi;let lt;function gi(){return lt||(lt=Te.Root.fromJSON(Ee.pbjsSchema).lookupType("CoreEnvelope")),lt}function mr(o){return ue.buildFrom(o)}function yr(o,e){if(at(e)){const u=Ee.pbjsSchema,i=fr(u,"CoreEnvelope",o);if(i)throw new Error(`Invalid CoreEnvelope: ${i}`);return hr(u,"CoreEnvelope",o)}const r=gi(),t=r.verify(o);if(t)throw new Error(`Invalid CoreEnvelope: ${t}`);return r.encode(o).finish()}function vi(o){return!!o&&typeof o=="object"&&"envelopeContents"in o&&"error"in o}var K;(function(o){o[o.fetchBinary=0]="fetchBinary",o[o.fetchFile=1]="fetchFile",o[o.noUpload=2]="noUpload"})(K||(K={}));const _i=3e4,bi=1e3,wi=500,ut=2147483647,Ei=/^[A-Za-z]{3}, \d{2} [A-Za-z]{3} \d{4} \d{2}:\d{2}:\d{2} GMT$/,ki=/^[A-Za-z]{6,9}, \d{2}-[A-Za-z]{3}-\d{2} \d{2}:\d{2}:\d{2} GMT$/,Ai=/^[A-Za-z]{3} [A-Za-z]{3} [ \d]\d \d{2}:\d{2}:\d{2} \d{4}$/,gr=.5;function vr(){try{const o=typeof globalThis=="object"?globalThis:{},e=o.crypto||o.msCrypto;if(e&&typeof e.getRandomValues=="function")return e.getRandomValues(new Uint32Array(1))[0]/4294967296}catch(o){}return gr}function _r(o){const e=o();return Number.isFinite(e)&&e>=0&&e<1?e:gr}function Si(o,e=Date.now()){if(!o)return;const r=o.trim();if(/^\d+$/.test(r))return Math.min(parseInt(r,10)*1e3,ut);const t=Ai.test(r);if(!t&&!Ei.test(r)&&!ki.test(r))return;const n=Date.parse(t?`${r} GMT`:r);if(!isNaN(n))return Math.min(Math.max(0,n-e),ut)}function Ci(o,e,r=_i,t=vr){const n=Math.min(r,ut),u=Math.min(n,1e3*Math.pow(2,o));if(e!==void 0){if(e>n)return;const h=Math.max(e,u),p=Math.max(bi,h/2),s=Math.min(n,h+p),a=Math.max(e,Math.min(h,s-p));return a+Math.floor(_r(t)*(s-a))}const i=u/2,d=Math.floor(i+_r(t)*i);return Math.min(n,Math.max(wi,d))}const Oi=3,Ii=3e4,br=10,_e=12e4,Ti=100,xi=1e3,Ni=1024*1024;function dt(o){o&&typeof o.unref=="function"&&o.unref()}class Ri{constructor(e,r){if(this._owner=r,this.maxRetries=Oi,this._maxRetryDelayMs=Ii,this._throttledUntil=0,this.random=vr,this.retryingUploads=0,this._retrying=new WeakSet,this.drainingHeldBacklog=!1,this.drainChunkInFlight=!1,this._droppedMessagesCount=0,e){const t=e.maxRetries;if(t!==void 0){if(typeof t!="number"||!Number.isInteger(t)||t<0||t>br)throw new Error(`options.maxRetries, if defined, must be an integer between 0 and ${br}`);this.maxRetries=t}const n=e.maxRetryDelayMs;if(n!==void 0){if(typeof n!="number"||!Number.isFinite(n)||n<1||n>_e)throw new Error(`options.maxRetryDelayMs, if defined, must be a number >= 1 and <= ${_e}`);this._maxRetryDelayMs=n}}}get droppedMessagesCount(){return this._droppedMessagesCount}isThrottled(){if(this.retryingUploads>0)return!0;const e=this._throttledUntil-Date.now();return e>_e?(this._throttledUntil=0,!1):e>0}shouldDrop(e,r,t){return(this.isThrottled()||this.drainingHeldBacklog&&this.drainChunkInFlight)&&this.isHeldBacklogFull(e(),r,t)?(this._droppedMessagesCount++,!0):!1}isHeldBacklogFull(e,r,t){return e>=Math.max(xi,Ti*t)||r>=Ni}backoffBeforeRetry(e,r,t,n){const u=t?0:this.maxRetries,i=e.response.status;if(i!==429&&i!==503)return;const d=Si(e.response.headers?e.response.headers.get("Retry-After"):void 0);if(i===503&&d===void 0)return;const h=Ci(r,d,this._maxRetryDelayMs,this.random),p=Math.min(h===void 0?d:h,_e),s=Date.now()+p;if(this.drainingHeldBacklog=!0,s>this._throttledUntil&&(this._throttledUntil=s,this._scheduleHoldFlush(p)),h===void 0||r>=u)return;this._retrying.has(e)||(this._retrying.add(e),this.retryingUploads++);const a=Math.max(h,this._throttledUntil-Date.now()),c=e.response;return n?this._sleepUntilHoldEnds(a,n).then(()=>this._discardBody(c)):(this._discardBody(c),this._sleepUntilHoldEnds(a,n))}endRetryChain(e){this._retrying.delete(e)&&(this.retryingUploads--,this.retryingUploads===0&&(this._scheduleHoldFlush(0),this._owner.messagesCount()===0&&!this.isThrottled()&&(this.drainingHeldBacklog=!1)))}_scheduleHoldFlush(e){this._holdTimerHandle!==void 0&&clearTimeout(this._holdTimerHandle),this._holdTimerHandle=setTimeout(()=>{if(this._holdTimerHandle=void 0,this.isThrottled()){const r=this._throttledUntil-Date.now();this.retryingUploads===0&&r>0&&this._scheduleHoldFlush(r);return}this._owner.messagesCount()===0&&(this.drainingHeldBacklog=!1),this._owner.hasData()&&this._owner.flush()},e),dt(this._holdTimerHandle)}_sleepUntilHoldEnds(e,r){const t=Date.now()+e;return this._sleep(e,r).then(()=>{const n=this._throttledUntil-t;return n>0&&n<=_e?this._sleepUntilHoldEnds(this._throttledUntil-Date.now(),r):void 0})}_sleep(e,r){return new Promise((t,n)=>{if(r&&r.aborted){n(this._abortError(r));return}const u=()=>{clearTimeout(i),n(this._abortError(r))},i=setTimeout(()=>{r&&r.removeEventListener("abort",u),t()},e);dt(i),r&&r.addEventListener("abort",u,{once:!0})})}_discardBody(e){Promise.resolve().then(()=>{const r=e.body;return r&&typeof r.cancel=="function"?r.cancel():void 0}).catch(()=>{})}_abortError(e){return e.reason||Object.assign(new Error("The operation was aborted."),{name:"AbortError"})}}const ct="telemetry",ji=1e4,wr=1e4,Pi=10,Li=10,Er=K.fetchBinary,Mi=100,Di=256*1024,Bi=64*1024,qi=6e4,Fi=112+2*70;function Hi(o){const e=o.replace(/\r\n|\r|\n/g,"%0D%0A").replace(/"/g,"%22");let r=0;for(const t of e){const n=t.codePointAt(0);r+=n<128?1:n<2048?2:n<65536?3:4}return r}function ht(o){if(!vi(o))throw o}class Ui{constructor(e,r,t,n){this._messagesLimit=Pi,this._metricsLimit=Li,this._formDataKey=ct,this._uploadInterval=wr,this._messageSize=0,this._evalFreeFallback=!1,this.uploadEndpoint=e,this.uploadMode=r==null?Er:r,t&&(this._staticAttributes={appName:t.appName,appVersion:t.appVersion,appExperience:t.appExperience,deviceId:t.deviceId,deviceModel:t.deviceModel,sdkVersion:t.sdkVersion});let u=ji;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");u=i}const d=n.messagesLimit;if(d!==void 0){if(typeof d!="number"||!(d>0))throw new Error("options.messagesLimit, if defined, must be > 0");this._messagesLimit=d}const h=n.metricsLimit;if(h!==void 0){if(typeof h!="number"||!(h>0))throw new Error("options.metricsLimit, if defined, must be > 0");this._metricsLimit=h}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._throttle=new Ri(n,{hasData:()=>this.hasData,messagesCount:()=>this.messagesCount,flush:()=>this._upload().catch(ht)}),this._messageBuffers=new Or(u),this._emptySize=this.getByteSize(1),this._restartTimer()}get uploadInterval(){return this._uploadInterval}set uploadInterval(e){if(e===void 0&&(e=wr),typeof e!="number"||!(e>0))throw new Error("uploadInterval, if defined, must be > 0");e!==this._uploadInterval&&(this._uploadInterval=e,this._restartTimer())}get droppedMessagesCount(){return this._throttle.droppedMessagesCount}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=Er),!(e in K))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().catch(ht)},this._uploadInterval)}collect(e,r,t){return te(this,null,function*(){if(this._throttle.shouldDrop(()=>this.messagesCount,this._messageSize,this._messagesLimit))return;D.isInternal(e)&&r.userPayload&&(r.userPayload=pr.encodePayload(r.userPayload,this._evalFreeFallback));const n=pr.getLogMessage(e,r,t,this._evalFreeFallback);if(!this._messageBuffers.push(e,n))throw new Error(`Buffer is full. Refusing schemaId ${D.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 te(this,null,function*(){if(!e&&this._throttle.isThrottled()||(this._restartTimer(),!this._uploadEndpoint||this._uploadMode===K.noUpload))return;const r=!e&&this._throttle.drainingHeldBacklog;if(r&&this._throttle.drainChunkInFlight)return;const t=r?this._getContentsOfCoreEnvelope(!0,!0):this._getContentsOfCoreEnvelope(!0),n=this.messagesCount>0;!n&&!this._throttle.isThrottled()&&(this._throttle.drainingHeldBacklog=!1);let u;r&&(this._throttle.drainChunkInFlight=!0);try{u=yield this._uploadContents(t,e,r)}finally{r&&(this._throttle.drainChunkInFlight=!1)}return r&&n&&this._drainRemaining(),u})}_drainRemaining(){this.messagesCount>0&&!this._throttle.isThrottled()&&this._upload().catch(ht)}_uploadContents(e,r,t=!1){return te(this,null,function*(){const{requestInit:n,bodyByteLength:u}=this._getRequestInit(e),i={envelopeContents:e};try{let d;for(let h=0;;h++){d=this._buildAttemptRequestInit(n,u),i.response=void 0,h>0&&(i.attempts=h+1),i.response=h>0||t?yield this._fetchWithTimeout(d):yield fetch(this._uploadEndpoint,d);const p=this._throttle.backoffBeforeRetry(i,h,r,d.signal);if(!p)break;yield p}if(!i.response.ok)throw new Error("HTTP Not OK");return i}catch(d){if(i.error=d,!r&&this._uploadFailedListener)try{this._uploadFailedListener(i)}catch(h){}throw i}finally{this._throttle.endRetryChain(i)}})}_buildAttemptRequestInit(e,r){let t=e;if(this._apiKey&&(t=be(Q({},t),{headers:be(Q({},t.headers),{"x-o11y-api-key":this._apiKey})})),this._uploadOptionsCallback){const n=this._uploadOptionsCallback()||{},u=Q({},n);if(n.headers&&t.headers)if(n.headers instanceof Headers){const i=new Headers(n.headers);for(const d in t.headers)Object.prototype.hasOwnProperty.call(t.headers,d)&&i.set(d,t.headers[d]);u.headers=i}else{if(Array.isArray(n.headers))throw new Error("Headers as array is not supported.");u.headers=Q(Q({},n.headers),t.headers)}else t.headers&&(u.headers=t.headers);u.method=t.method,u.body=t.body,t=u}return t.keepalive&&r>Bi&&(t=be(Q({},t),{keepalive:!1})),t}_fetchWithTimeout(e){return te(this,null,function*(){if(typeof AbortController!="function")return fetch(this._uploadEndpoint,e);const r=new AbortController,t=e.signal,n=()=>r.abort(t.reason);t&&(t.aborted?n():t.addEventListener("abort",n,{once:!0}));const u=setTimeout(()=>r.abort(Object.assign(new Error("Upload request timed out."),{name:"TimeoutError"})),qi);dt(u);try{return yield fetch(this._uploadEndpoint,be(Q({},e),{signal:r.signal}))}finally{clearTimeout(u),t&&t.removeEventListener("abort",n)}})}_getRequestInit(e){const r=mr(e),t=yr(r,this._evalFreeFallback);let n;switch(this._uploadMode){case K.fetchBinary:n={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t};break;case void 0:case K.fetchFile:if(typeof FormData!="function")throw new Error("FormData is not a function in the global namespace.");const i=new FormData;i.append(this._formDataKey||ct,new Blob([t])),n={method:"POST",body:i};break;case K.noUpload:default:throw new Error("Invalid uploadMode")}const u=t.byteLength+(this._uploadMode===K.fetchBinary?0:Fi+Hi(this._formDataKey||ct));return{requestInit:n,bodyByteLength:u}}_checkUploadState(){if(this._uploadEndpoint===void 0)throw new Error("Upload endpoint is unset");if(this._uploadMode===K.noUpload)throw new Error("Upload mode is unset")}upload(e){return te(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,r=!1){const t={staticAttributes:this._staticAttributes,messages:e&&r?this._extractMessageChunk():this._messageBuffers.getAllMessages(e)};return this._metricsExtractors&&(t.upCounters=ue.getUpCounters(this._metricsExtractors.getAllUpCounters(),e),t.valueRecorders=ue.getValueRecorders(this._metricsExtractors.getAllValueRecorders(),e),t.bucketHistograms=ue.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms(),e)),e&&!r&&(this._messageSize=0),t}_extractMessageChunk(){const e=Math.max(this._messagesLimit,Mi),r=new Map;let t=0,n=0,u=!1;for(const[i,d]of this._messageBuffers.getAllMessages(!1)){let h=0;for(;h<d.length;){const p=E.estimateObjectSize(d[h]);if(t>0&&(t>=e||n+p>Di)){u=!0;break}t++,n+=p,h++}if(h>0&&r.set(i,d.splice(0,h)),u)break}return this._messageSize=this.messagesCount===0?0:Math.max(0,this._messageSize-n),r}_buildProtoEncodedCoreEnvelope(e){const r=this._getContentsOfCoreEnvelope(e),t=mr(r);return yr(t,this._evalFreeFallback)}receiveMetricsExtractors(e){this._metricsExtractors=e}}const $i={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"}}}}}}}}}},zi={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"}}}}}}}}}},Vi={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=Ui,B.currentStateSchema=Vi,B.failureEventSchema=$i,B.interactionEventSchema=zi,B.registerInstrumentedApp=Nn,Object.defineProperty(B,Symbol.toStringTag,{value:"Module"})}));
|