@cimulate/copilot-widget 1.50.2 → 1.50.4
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 +9 -0
- package/dist/cimulate-copilot-widget.d.ts +6 -0
- package/dist/cimulate-copilot-widget.es.js +1280 -1277
- package/dist/cimulate-copilot-widget.umd.js +16 -16
- package/dist/copilot.es.js +1280 -1277
- package/dist/copilot.umd.js +16 -16
- package/dist/messaging.d.ts +6 -0
- package/dist/messaging.es.js +5815 -5834
- package/dist/messaging.umd.js +45 -48
- package/dist/o11y-sdk.umd.js +4 -0
- package/package.json +1 -1
- package/dist/client-BjHA3vv5.js +0 -1964
- package/dist/collectors-DLVG7H_C.js +0 -2053
- package/dist/sf_embeddedMessaging-B3h7hoYD.js +0 -18
- package/dist/shared-B0BNUnWB.js +0 -661
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
(function(M,q){typeof exports=="object"&&typeof module!="undefined"?q(exports):typeof define=="function"&&define.amd?define(["exports"],q):(M=typeof globalThis!="undefined"?globalThis:M||self,q(M.CimulateO11ySdk={}))})(this,(function(M){"use strict";var wr=Object.defineProperty;var rt=Object.getOwnPropertySymbols;var Er=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable;var it=(M,q,B)=>q in M?wr(M,q,{enumerable:!0,configurable:!0,writable:!0,value:B}):M[q]=B,st=(M,q)=>{for(var B in q||(q={}))Er.call(q,B)&&it(M,B,q[B]);if(rt)for(var B of rt(q))Ar.call(q,B)&&it(M,B,q[B]);return M};var G=(M,q,B)=>new Promise((de,ie)=>{var ce=$=>{try{K(B.next($))}catch(z){ie(z)}},he=$=>{try{K(B.throw($))}catch(z){ie(z)}},K=$=>$.done?de($.value):Promise.resolve($.value).then(ce,he);K((B=B.apply(M,q)).next())});const q={namespace:"sf.instrumentation",name:"PayloadDiags",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{PayloadDiags:{fields:{extras:{rule:"repeated",id:1,type:"string"}}}}}}}}}},B={namespace:"sf.instrumentation",name:"IdleDetectorReport",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{IdleDetectorReport:{fields:{listenerCount:{id:3,type:"uint32"},busyTasks:{rule:"repeated",id:5,type:"string"},busyDurations:{rule:"repeated",id:6,type:"double"},pollableCount:{id:4,type:"uint32"},pollCounts:{rule:"repeated",id:8,type:"double"},logThreshold:{id:2,type:"double"},maxDuration:{id:1,type:"double"},pollables:{rule:"repeated",id:7,type:"string"}}}}}}}}}},de={namespace:"sf.instrumentation",name:"InstrumentedEvent",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MouseEvent:{reserved:[[6,6],[7,7],[15,15],[16,16],[17,17],[18,18],[19,19],[20,20],[21,21],[22,22]],fields:{cancelable:{id:5,type:"bool"},ctrlKey:{id:9,type:"bool"},type:{id:25,type:"string"},button:{id:3,type:"uint32"},offsetX:{id:30,type:"double"},eventPhase:{id:12,type:"uint32"},shiftKey:{id:23,type:"bool"},offsetY:{id:31,type:"double"},composed:{id:8,type:"bool"},altKey:{id:1,type:"bool"},isTrusted:{id:13,type:"bool"},buttons:{id:4,type:"uint32"},movementY:{id:29,type:"double"},clientY:{id:27,type:"double"},clientX:{id:26,type:"double"},movementX:{id:28,type:"double"},defaultPrevented:{id:10,type:"bool"},metaKey:{id:14,type:"bool"},timeStamp:{id:24,type:"double"},bubbles:{id:2,type:"bool"},detail:{id:11,type:"int64"},pageY:{id:33,type:"double"},pageX:{id:32,type:"double"},screenX:{id:34,type:"double"},screenY:{id:35,type:"double"}}},Event:{fields:{type:{id:1,type:"string"}}},InstrumentedEvent:{oneofs:{event:{oneof:["mouseEvent","baseEvent"]}},reserved:[[4,4],"xpath",[6,6],[8,8]],fields:{mouseEvent:{id:7,type:"MouseEvent"},auto:{id:3,type:"bool"},parentComponent:{id:2,type:"string"},baseEvent:{id:10,type:"Event"},ownerComponent:{id:1,type:"string"},userPayload:{id:5,type:"Payload"},simplePath:{id:9,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},ie={namespace:"sf.instrumentation",name:"Network",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Network:{fields:{mtd:{id:1,type:"string"},url:{id:2,type:"string"}}}}}}}}}},ce={namespace:"sf.instrumentation",name:"Activity",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Activity:{reserved:[[5,5],[7,7]],fields:{stopReason:{id:6,type:"string"},externalParentId:{id:17,type:"string"},isRoot:{id:8,type:"bool"},isExternal:{id:16,type:"bool"},isSampled:{id:11,type:"bool"},preRootId:{id:9,type:"string"},parentId:{id:13,type:"string"},duration:{id:3,type:"double"},timerOverridden:{id:12,type:"uint32"},isRerooted:{id:15,type:"bool"},name:{options:{"(meta.max_length)":25},id:2,type:"string"},traceIdSource:{id:14,type:"string"},id:{id:1,type:"string"},userPayload:{id:4,type:"Payload"},errorCount:{id:10,type:"uint32"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}},he={pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{MessageBundle:{fields:{messages:{rule:"repeated",id:2,type:"LogMessage"},schemaName:{id:1,type:"string"}}},Metrics:{fields:{globalMetricTags:{rule:"repeated",id:4,type:"MetricTag"},bucketHistograms:{rule:"repeated",id:3,type:"BucketHistogram"},valueRecorders:{rule:"repeated",id:2,type:"ValueRecorder"},upCounters:{rule:"repeated",id:1,type:"UpCounter"}}},CoreEnvelopeDiagnostics:{fields:{schemaVersion:{id:6,type:"string"},generatedTimestamp:{id:2,type:"double"},bundleCount:{id:3,type:"uint32"},upCounterCount:{id:4,type:"uint32"},valueRecorderCount:{id:5,type:"uint32"},key:{id:1,type:"string"},bucketHistogramCount:{id:7,type:"uint32"}}},LogMessage:{fields:{data:{id:2,type:"bytes"},rootId:{id:4,type:"string"},csId:{id:12,type:"string"},recCsId:{id:13,type:"string"},pagePayload:{id:7,type:"Payload"},connectionType:{id:9,type:"string"},appPayload:{id:10,type:"Payload"},tenantClass:{id:15,type:"string"},loggerAppName:{id:8,type:"string"},sseq:{id:11,type:"uint32"},recRootId:{id:14,type:"string"},loggerName:{id:6,type:"string"},age:{id:3,type:"double"},seq:{id:5,type:"uint32"},timestamp:{id:1,type:"double"}}},CoreEnvelope:{fields:{diagnostics:{id:1,type:"CoreEnvelopeDiagnostics"},bundles:{rule:"repeated",id:2,type:"MessageBundle"},metrics:{id:3,type:"Metrics"},staticAttributes:{id:4,type:"StaticAttributes"}}},MetricTag:{fields:{name:{id:1,type:"string"},value:{id:2,type:"string"}}},BucketHistogram:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:7,type:"string"},ownerAppName:{id:8,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},buckets:{rule:"repeated",id:5,type:"uint32"},name:{id:1,type:"string"},tags:{rule:"repeated",id:6,type:"MetricTag"}}},ValueRecorder:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},values:{rule:"repeated",id:4,type:"double"},name:{id:1,type:"string"},tags:{rule:"repeated",id:5,type:"MetricTag"}}},StaticAttributes:{fields:{appVersion:{id:2,type:"string"},appName:{id:1,type:"string"},deviceModel:{id:5,type:"string"},sdkVersion:{id:6,type:"string"},deviceId:{id:4,type:"string"},appExperience:{id:3,type:"string"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}},UpCounter:{fields:{lastUpdatedTimestamp:{id:3,type:"double"},ownerName:{id:6,type:"string"},ownerAppName:{id:7,type:"string"},createdTimestamp:{id:2,type:"double"},name:{id:1,type:"string"},value:{id:4,type:"uint32"},tags:{rule:"repeated",id:5,type:"MetricTag"}}}}}}}}}},K={namespace:"sf.instrumentation",name:"Simple",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Simple:{fields:{text:{options:{"(meta.max_length)":25},id:1,type:"string"}}}}}}}}}},$={namespace:"sf.instrumentation",name:"Error",pbjsSchema:{nested:{sf:{nested:{instrumentation:{nested:{Error:{reserved:[[5,5],[7,7]],fields:{activityId:{id:6,type:"string"},stack:{id:3,type:"string"},name:{id:1,type:"string"},message:{options:{"(meta.max_length)":200},id:2,type:"string"},userPayload:{id:4,type:"Payload"}}},Payload:{fields:{payload:{id:2,type:"bytes"},schemaName:{id:1,type:"string"}}}}}}}}}};class z{constructor(){this.notImplemented="Method not implemented.";const e=typeof performance!="undefined";e?performance.timeOrigin?this._timeOrigin=performance.timeOrigin:this._timeOrigin=Date.now():this._timeOrigin=Date.now();const r=this._timeOrigin;e&&typeof performance.now=="function"?(this.perfNow=performance.now.bind(performance),this.time=()=>{const t=this.perfNow();return{tsNow:r+t,perfNow:t,timeOrigin:r}}):(this.perfNow=()=>Date.now()-r,this.time=()=>{const t=this.perfNow();return{tsNow:Date.now(),perfNow:t,timeOrigin:r}})}get isProduction(){return z._isProduction}markProduction(e){z._isProduction=e!=null?e:!0}_checkArgument(e,r){if(typeof r=="string")return typeof e===r;if(typeof r=="function")return e instanceof r;if(Array.isArray(r))return r.some(t=>this._checkArgument(e,t));throw new Error(`Invalid argKind ${r}`)}requireArgument(e,r,t){let a=e==null||e==="";const l=t!==void 0;if(!a&&l&&(a=!this._checkArgument(e,t)),a)throw new Error(`${r} argument is required${l?" and must be of a supported type.":"."}`)}requireArgumentIfDefined(e,r,t){if(e===void 0)return!1;if(e===null||e===""||!this._checkArgument(e,t))throw new Error(`${r} argument, if defined, must be of a supported type.`);return!0}checkForDenyListedValues(e,r,t){if(t.some(a=>e===a))throw new Error(`The value ${e} isn't allowed for ${r} argument.`)}checkForReservedCharacters(e,r,t){if(e&&t.some(a=>e.indexOf(a)>=0))throw new Error(`The argument ${r} isn't allowed to contain characters from ['${t.join(", ")}']. Received: ${e}.`)}generateUniqueId(e=16){const r=[],t="0123456789abcdef";if(!(e===void 0||e>0))throw new Error('If specified, the argument "length" must be a positive integer');for(let a=0;a<e;a++){const l=Math.floor(Math.random()*16);r.push(t[l])}return r.join("")}getXpath(e){function r(l){const i=l.localName;for(;l.nextElementSibling;)if(l=l.nextElementSibling,l.localName===i)return!0;return!1}function t(l,i){return l?t(l.previousElementSibling,i||l.localName)+(l.localName===i?1:0):1}function a(l){if(!l||l.nodeType!==1)return[""];const i=t(l)>1||r(l)?`${l.localName.toLowerCase()}[${t(l)}]`:l.localName.toLowerCase();return[...a(l.parentNode),i]}return a(e).join("/")}getAge(e){return e-this._timeOrigin}_getNavigatorSafe(){try{return typeof navigator!="undefined"?navigator:void 0}catch(e){return}}_hasEffectiveConnectionType(e){if(typeof e!="object"||e===null||!("connection"in e))return!1;const r=e.connection;return typeof r=="object"&&r!==null&&"effectiveType"in r&&typeof r.effectiveType=="string"}getConnectionType(){const e=this._getNavigatorSafe();return this._hasEffectiveConnectionType(e)?e.connection.effectiveType:void 0}clone(e){return JSON.parse(JSON.stringify(e))}definedValueOrDefault(e,r){return e!==void 0?e:r}getGlobal(){if(typeof globalThis=="object")return globalThis;if(typeof self=="object")return self;throw new Error("Unable to locate globalThis or self")}getIsBeaconSupported(){const e=this.getGlobal(),r=this._getNavigatorSafe();return typeof(r==null?void 0:r.sendBeacon)=="function"&&typeof e.Blob=="function"}estimateObjectSize(e){const r=new Set,t=[e];let a=0;for(;t.length;){const l=t.pop();if(typeof l=="boolean")a+=4;else if(typeof l=="string")a+=l.length*2;else if(typeof l=="number")a+=8;else if(l instanceof Uint8Array||l instanceof Uint8ClampedArray||l instanceof Uint16Array||l instanceof Uint32Array||l instanceof Int8Array||l instanceof Int16Array||l instanceof Int32Array||l instanceof Float32Array||l instanceof Float64Array)a+=l.byteLength;else if(typeof l=="object"){const i=l;if(!r.has(i)){r.add(i);for(const d in i)t.push(i[d])}}}return a}noProdThrow(e){if(!E.isProduction)throw e}isAllowedOrigin(e,r){return Array.isArray(r)&&r.some(t=>t==="*"||e===t||t instanceof RegExp&&t.test(e))}roundNumber(e,r){const t=Math.pow(10,r);return Math.round(e*t)/t}roundNumbersInObject(e,r){e&&Object.entries(e).forEach(([t,a])=>{typeof a=="number"&&(e[t]=this.roundNumber(a,r))})}tryGetAbsoluteUrl(e){var r,t;return e!=null&&e.startsWith("//")&&typeof window=="object"?((r=window.location.protocol)!==null&&r!==void 0?r:"")+e:e!=null&&e.startsWith("/")&&typeof window=="object"?((t=window.location.origin)!==null&&t!==void 0?t:"")+e:e}validateParentActivityType(e,r){const t=e!=null?e:!1;if(!r)return;const a=r.isExternal();if(t===a)return r;{const l=t?"external":"internal",i=a?"external":"internal";throw new Error(`Parent activity type mismatch: ${l} activity cannot have ${i} parent.`)}}}z._isProduction=!0;const pe=new z,fe=pe.getGlobal();pe.markProduction(fe==null?void 0:fe.__O11Y_IS_PROD__);const E=Object.freeze(pe);class me{constructor(e,r,t,a,l,i,d){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=a,this._value=0,this._createdOn=l===void 0?E.time().tsNow:l,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 nt="co11y";class ot{constructor(){this._upCounters=new Map,this._ownerAppName=nt}_addOrUpdateCounter(e,r,t){if(!e)return;const a={status:t},l=`${this._ownerAppName}:${r}:${e}${JSON.stringify(a)}`;let i=this._upCounters.get(l);i||(i=new me(e,r,this._ownerAppName,a),this._upCounters.set(l,i)),i.increment()}success(e,r){this._addOrUpdateCounter(e,r,"success")}exception(e,r){this._addOrUpdateCounter(e,r,"error")}getBucketHistograms(){return[]}getUpCounters(){return Array.from(this._upCounters.values()).filter(e=>e.getLastUpdatedOn())}getValueRecorders(){return[]}setOwnerAppName(e){this._ownerAppName=e}}const Y=new ot;class at{constructor(e){if(this._lazyMap=new Map,e!==void 0){if(typeof e=="number"&&e>0){this._maxSize=Math.ceil(e);return}throw new Error("maxSize must be a positive number")}}get maxSize(){return this._maxSize}get size(){return this._lazyMap.size}push(e,r){let t=this._lazyMap.get(e);if(!t){if(this.maxSize!==void 0&&this.size===this.maxSize)return!1;t=new Array,this._lazyMap.set(e,t)}return t.push(r),!0}getMessages(e,r){const t=this._lazyMap.get(e);return r&&this._lazyMap.has(e)&&this._lazyMap.set(e,[]),t||[]}getAllMessages(e){const r=new Map;for(const[t,a]of this._lazyMap.entries())a.length&&r.set(t,this.getMessages(t,e));return r}extractMessages(e){return this.getMessages(e,!0)}extractAllMessages(){return this.getAllMessages(!0)}get totalItemCount(){let e=0;for(const r of this._lazyMap.values())e+=r.length;return e}}class ut{getSchemaId(e){return`${e.namespace}.${e.name}`}isInternal(e){return(e==null?void 0:e.namespace)==="sf.instrumentation"}makePayload(e,r,t=!0){if(!t||e!==void 0&&r!==void 0)return{schema:e,payload:r}}checkSchema(e){return E.requireArgument(e,"schema","object"),E.requireArgument(e.namespace,"schema.namespace","string"),E.requireArgument(e.name,"schema.name","string"),E.requireArgument(e.pbjsSchema,"schema.pbjsSchema","object"),this._getTokens(e)}_getTokens(e){const r=e.namespace.split(".");if(r.length!==2)throw new Error(`Schema "${this.getSchemaId(e)}" must have a namespace of the form "domain.feature".`);return{domain:r[0],feature:r[1],message:e.name}}_getAnyNestedObject(e,r){return r.reduce((t,a)=>{const l=t.nested;if(l){const i=l[a];if(i)return i}throw new Error(`Cannot locate ${r.join(".")} in schema with ID ${this.getSchemaId(e)}`)},e.pbjsSchema)}getTypes(e){const r=this.checkSchema(e),a=this._getAnyNestedObject(e,[r.domain,r.feature]).nested;if(!a)throw new Error(`Cannot parse schema with ID ${this.getSchemaId(e)}`);return a}getType(e,r){E.requireArgument(r,"messageName","string");const a=this.getTypes(e)[r];if(!a)throw new Error(`Cannot locate message ${r} in schema with ID ${this.getSchemaId(e)}`);return a}getOptions(e,r,t){t&&E.requireArgument(r,"messageName","string");const a=this.checkSchema(e);if(!r)return this._getAnyNestedObject(e,[a.domain,a.feature]).options;const l=this.getType(e,r);if(!t)return l.options;const i=l.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),l=this.getTypes(e)[t].fields,i=new Set(Object.keys(l));return r!=null?Object.keys(r).filter(p=>!i.has(p)):[]}}const D=new ut,ye=1e4,ke=1e4,Oe=0,lt=2147483647,dt=-2147483648,ct=4294967295,ht=9223372036854776e3,pt=-9223372036854776e3,ft=18446744073709552e3;class Se{constructor(e,r,t,a){this.errorCode=e,this.fields=r,this.expected=t,this.received=a}asMessage(e){const r=this.fields[0]+this.fields.slice(1).reduce((a,l)=>Number(l)>=0?`${a}[${l}]`:`${a}.${l}`,"");let t;switch(this.errorCode){case 1:t="Repeated field must be an array";break;case 2:t=`Expected type ${this.expected} but received type ${this.received}`;break;case 3:t="Value must be finite";break;case 4:t="Value is out of range for its type";break;case 5:t="Bytes array is malformed";break;case 6:t="Exceeded app limit for maximum string length";break;case 7:t="Exceeded app limit for item count";break;case 12:t="Value must be an integer";break;case 13:t="Values like null or undefined are not allowed for items in repeated fields";break;default:t=`Unknown error code: ${this.errorCode}`;break}return`Schema ${e} on field "${r}": ${t}`}}class mt{validate(e,r,t=!1){const a=D.checkSchema(e);E.requireArgument(r,"data","object");const l=D.getSchemaId(e),i=new Array,d=D.getTypes(e);if(this._validateFields(i,[],r,d[a.message],d,l),i.length&&!t)throw new Error(i[0].asMessage(l));return i}_validateFields(e,r,t,a,l,i){const d=a.oneofs||{},p=a.fields||{};for(const h in t){const s=t[h];if(s!=null){const o=(u,n,c)=>this._matchFieldTypes(e,[...r,h],s,u,l,i,h,n,c);d[h]?o(p[d[h].oneof[0]].type):p[h]&&o(p[h].type,p[h].rule==="repeated")}}}_matchFieldTypes(e,r,t,a,l,i,d,p,h){let s;if(p)Array.isArray(t)?(t.length>ke&&(s=7),t.forEach((o,u)=>{this._matchFieldTypes(e,[...r,u.toString()],o,a,l,i,d,void 0,!0)})):s=1;else if(t==null||t===void 0)h&&(s=13);else{let o,u;switch(a){case"string":u="string",t.length>ye&&(s=6);break;case"bytes":u="object",t instanceof Uint8Array||(s=5);break;case"bool":u="boolean";break;case"uint32":u="number",o={min:Oe,max:ct,isInt:!0,isItem:h};break;case"int32":case"sint32":case"fixed32":case"sfixed32":u="number",o={min:dt,max:lt,isInt:!0,isItem:h};break;case"uint64":u="number",o={min:Oe,max:ft,isInt:!0,isItem:h};break;case"fixed64":case"sfixed64":case"int64":case"sint64":u="number",o={min:pt,max:ht,isInt:!0,isItem:h};break;case"double":case"float":u="number",o={min:Number.NEGATIVE_INFINITY,max:Number.POSITIVE_INFINITY,isInt:!1,isItem:h};break;default:new Set(Object.keys(l)).has(a)&&(this._validateFields(e,r,t,l[a],l,i),u="object");break}typeof t!==u?e.push(new Se(2,r,a,typeof t)):o&&(o.isInt&&!Number.isFinite(t)?s=3:o.isInt&&!Number.isInteger(t)?s=12:!(!o.isInt&&Number.isNaN(t))&&!(t>=o.min&&t<=o.max)&&(s=4))}s&&e.push(new Se(s,r))}}const Ce=new mt;class yt{_getMetricTags(e){const r=e.getTags();if(r)return Object.entries(r).map(t=>({name:t[0],value:t[1].toString()}))}getUpCounters(e,r=!0){return e.map(t=>{const a={name:t.getName(),createdTimestamp:t.getCreatedOn(),lastUpdatedTimestamp:t.getLastUpdatedOn(),value:t.getData(),ownerName:t.getOwnerName(),ownerAppName:t.getOwnerAppName(),tags:this._getMetricTags(t)};return r&&t.reset(),a})}getValueRecorders(e,r=!0){return e.map(t=>{const a={name:t.getName(),createdTimestamp:t.getCreatedOn(),lastUpdatedTimestamp:t.getLastUpdatedOn(),values:t.getData(),ownerName:t.getOwnerName(),ownerAppName:t.getOwnerAppName(),tags:this._getMetricTags(t)};return r&&t.reset(),a})}getBucketHistograms(e,r=!0){return e.map(t=>{const a={name:t.getName(),createdTimestamp:t.getCreatedOn(),lastUpdatedTimestamp:t.getLastUpdatedOn(),values:t.getData(),buckets:t.getBuckets(),ownerName:t.getOwnerName(),ownerAppName:t.getOwnerAppName(),tags:this._getMetricTags(t)};return r&&t.reset(),a})}getMetricsTags(e){const r={};return e.forEach(t=>{r[t.name]=t.value}),r}}const V=Object.freeze(new yt);class gt{checkInputs(e,r){D.checkSchema(e),E.requireArgument(r,"data","object");let t,a;r.userPayload!==void 0&&D.isInternal(e)&&(a=r.userPayload,t=Ce.validate(a.schema,a.payload,!0),this._processValidationResults(D.getSchemaId(a.schema),a.payload,t),r.userPayload=void 0),t=Ce.validate(e,r,!0),this._processValidationResults(D.getSchemaId(e),r,t),a!==void 0&&(r.userPayload=a)}getExtraFields(e,r){E.requireArgument(r,"data","object");const t=[],a=r.userPayload;return a!==void 0&&D.isInternal(e)&&t.push(...D.getExtraFields(a.schema,a.payload)),t.push(...D.getExtraFields(e,r)),t}getPayloadFromProvider(e,r){const t=(e==null?void 0:e.getPayload(r))||void 0;return t&&this.checkInputs(t.schema,t.payload),t}_processValidationResults(e,r,t){for(let a=0;a<t.length;a+=1){const l=t[a];if(l.errorCode==6||l.errorCode==7){const i=l.fields.length-1,d=this._traverseFields(r,l.fields.slice(0,i)),p=l.fields[i];l.errorCode==6?d[p]=d[p].substring(0,ye):d[p].splice(ke)}else throw new Error(l.asMessage(e))}}_traverseFields(e,r){return r.length?this._traverseFields(e[r[0]],r.slice(1)):e}}const se=Object.freeze(new gt),Ie="o11y";class Te{constructor(e){this._errorCounter=e,this._safeCatchMode=!1}_callCo11y(e,r){r?Y.exception(e==null?void 0:e.op,Ie):Y.success(e==null?void 0:e.op,Ie)}tryCatch(e,r){let t;try{e()}catch(a){t=!0,this._prodSafeCatch(a)}finally{this._callCo11y(r,t)}}tryCatchReturn(e,r,t){let a;try{return E.requireArgument(r,"noopValue"),e()}catch(l){return a=!0,this._prodSafeCatch(l),r}finally{this._callCo11y(t,a)}}_prodSafeCatch(e){let r;try{if(r=!E.isProduction,r)throw e;if(this._safeCatchMode)throw this._safeCatchMode=!1,new Error("Internal error in prodSafeCatch.");if(this._safeCatchMode=!0,this._errorCounter&&this._errorCounter.increment(),!(e instanceof Error)){const t=e&&e.message||(typeof e.toString=="function"?e.toString():"");e=new Error(t)}this._safeCatchMode=!1}catch(t){if(r)throw t;if(t&&console&&typeof console.error=="function")try{console.error(t)}catch(a){}this._safeCatchMode=!1}}}const vt=Symbol("o11y.stampTenantClass");class _t{get isBusy(){return this._isOk?this._busyCount>0:void 0}constructor(e,r,t,a){this.name=e,this._doneCallback=t,this._overDoneCallback=a,this._busyCount=0,this._isOk=!0,this._busyCount=r}add(){this._isOk&&(this._busyCount+=1)}done(){this._isOk&&(this._busyCount>0?(this._busyCount-=1,this._busyCount||this._doneCallback()):(this._isOk=!1,this._overDoneCallback()))}}const bt=300;class wt{constructor(e){this._taskers=new Map,this._listeners=new Set,this._busyCheckers=new Map,this._logThreshold=bt,this._endedTasks=new Array,this._pollableReport=new Array,E.requireArgumentIfDefined(e==null?void 0:e.logThreshold,"options.logThreshold","number")&&(this._logThreshold=e.logThreshold),E.requireArgumentIfDefined(e==null?void 0:e.reportListener,"options.reportListener","function")&&(this._reportListener=e.reportListener),E.requireArgumentIfDefined(e==null?void 0:e.errorListener,"options.errorListener","function")&&(this._errorListener=e.errorListener)}requestIdleDetectedCallback(e){E.requireArgument(e,"callback","function"),this._listeners.size===0&&(this._firstCallbackTime=E.time().perfNow),this._listeners.add(e),this._checkIfLoaded()}_reportTaskEnded(e){if(this._listeners.size){const r=Object.assign({},this._taskers.get(e));this._endedTasks.push(r)}}declareNotifierTaskSingle(e){E.requireArgument(e,"name","string");const r=this._addTasker(e,1);return{get isBusy(){return r.isBusy},done:()=>{r.done(),this._taskers.delete(r)}}}declareNotifierTaskMulti(e,r=0){if(E.requireArgument(e,"name","string"),r!==void 0&&(E.requireArgument(r,"existingBusyCount","number"),!Number.isInteger(r)||r<0))throw new Error("existingBusyCount accepts only non-negative integers");const t=this._addTasker(e,r);return{get isBusy(){return t.isBusy},add:()=>{if(!t.isBusy){const l=this._taskers.get(t);l.start=E.time().perfNow,l.end=void 0}t.add()},done:t.done.bind(t)}}declarePollableTaskMulti(e,r){E.requireArgument(e,"name","string"),E.requireArgument(r,"isBusyChecker","function"),this._busyCheckers.set(r,e)}_addTasker(e,r){const t=new _t(e,r,()=>{this._taskers.get(t).end=E.time().perfNow,this._reportTaskEnded(t),this._checkIfLoaded()},()=>{var a;(a=this._errorListener)===null||a===void 0||a.call(this,`Overdone: ${t.name}`),E.noProdThrow(`Tasker '${t.name}' is done too many times.`)});return this._taskers.set(t,{name:e,start:r>0?E.time().perfNow:void 0,end:void 0}),t}_areAllNotifiersIdle(){return!Array.from(this._taskers.keys()).some(e=>e.isBusy)}_getFirstBusyPollable(){const e=Array.from(this._busyCheckers).find(r=>{var t;const a=r[0],l=r[1];try{return a()}catch(i){return(t=this._errorListener)===null||t===void 0||t.call(this,i,`BusyChecker ${l}`),E.noProdThrow(i),!1}});return e?e[1]:void 0}_checkIfLoaded(){this._listeners.size&&(this._timerCheckQueued&&clearTimeout(this._timerCheckQueued),this._areAllNotifiersIdle()&&(this._timerCheckQueued=setTimeout(()=>{this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},40)},0)))}_doubleCheck(){if(this._timerCheckQueued=void 0,this._areAllNotifiersIdle()){const e=this._getFirstBusyPollable();if(e!==void 0)this._addToPollableReport(e),this._timerCheckQueued=setTimeout(()=>{this._doubleCheck()},15);else{const r=E.time().perfNow-this._firstCallbackTime,t=Array.from(this._listeners.values());this._listeners.clear(),this._firstCallbackTime=void 0;const a=this._endedTasks.splice(0),l=this._pollableReport.splice(0);this._notify(t,r,a,l)}}}_addToPollableReport(e){const r=this._pollableReport.length?this._pollableReport[this._pollableReport.length-1]:void 0;(r==null?void 0:r.name)===e?r.count+=1:this._pollableReport.push({name:e,count:1})}_notify(e,r,t,a){var l;if(r>=this._logThreshold&&this._reportListener){const d=this._getReport(r,e.length,t,a);this._reportListener(d)}e.reverse();const i=E.time().tsNow;for(const[d,p]of e.entries())try{p(i)}catch(h){(l=this._errorListener)===null||l===void 0||l.call(this,h,`Listener #${e.length-1-d}`),E.noProdThrow(h)}}getReport(){const e=E.time().perfNow,r=this._firstCallbackTime>0?e-this._firstCallbackTime:void 0,t=Array.from(this._taskers.entries()).filter(a=>a[0].isBusy).map(a=>({name:a[1].name,start:a[1].start,end:e}));return this._getReport(r,this._listeners.size,this._endedTasks.concat(t),this._pollableReport)}_getReport(e,r,t,a){const l=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:l.map(i=>i.name),busyDurations:l.map(i=>i.duration),pollables:a.map(i=>i.name),pollCounts:a.map(i=>i.count)}}}const Et={namespace:"sfcore.performance",name:"ResourceTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{ResourceTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"}}}}}}}}}},At={namespace:"sfcore.performance",name:"NavigationTiming",pbjsSchema:{nested:{sfcore:{nested:{performance:{nested:{NavigationTiming:{oneofs:{_xhrDelay:{oneof:["xhrDelay"]},_renderBlockingStatus:{oneof:["renderBlockingStatus"]},_firstInterimResponseStart:{oneof:["firstInterimResponseStart"]},_srvDuration:{oneof:["srvDuration"]},_isCdnCached:{oneof:["isCdnCached"]},_responseStatus:{oneof:["responseStatus"]},_dbDuration:{oneof:["dbDuration"]},_reqBatchCount:{oneof:["reqBatchCount"]}},fields:{redirectCount:{id:37,type:"uint32"},encodedBodySize:{id:21,type:"uint32"},reqActionNames:{rule:"repeated",id:28,type:"string"},unloadEventEnd:{id:40,type:"double"},responseEnd:{id:19,type:"double"},domainLookupEnd:{id:12,type:"double"},unloadEventStart:{id:39,type:"double"},domContentLoadedEventStart:{id:32,type:"double"},type:{id:38,type:"string"},firstInterimResponseStart:{options:{proto3_optional:!0},id:18,type:"double"},duration:{id:3,type:"double"},decodedBodySize:{id:22,type:"uint32"},redirectStart:{id:8,type:"double"},connectEnd:{id:15,type:"double"},isCdnCached:{options:{proto3_optional:!0},id:24,type:"bool"},requestStart:{id:16,type:"double"},startTime:{id:2,type:"double"},fetchStart:{id:10,type:"double"},domContentLoadedEventEnd:{id:33,type:"double"},srvReqId:{id:29,type:"string"},reqBatchCount:{options:{proto3_optional:!0},id:27,type:"uint32"},renderBlockingStatus:{options:{proto3_optional:!0},id:6,type:"string"},workerStart:{id:7,type:"double"},responseStart:{id:17,type:"double"},xhrDelay:{options:{proto3_optional:!0},id:30,type:"double"},domInteractive:{id:34,type:"double"},domComplete:{id:31,type:"double"},domainLookupStart:{id:11,type:"double"},responseStatus:{options:{proto3_optional:!0},id:23,type:"uint32"},redirectEnd:{id:9,type:"double"},logEvent:{id:41,type:"string"},transferSize:{id:20,type:"uint32"},srvDuration:{options:{proto3_optional:!0},id:26,type:"double"},dbDuration:{options:{proto3_optional:!0},id:25,type:"double"},connectStart:{id:13,type:"double"},loadEventStart:{id:35,type:"double"},secureConnectionStart:{id:14,type:"double"},name:{id:1,type:"string"},nextHopProtocol:{id:5,type:"string"},initiatorType:{id:4,type:"string"},loadEventEnd:{id:36,type:"double"}}}}}}}}}};class kt{constructor(e){this._fuzzyKeyRange=e,this._map=new Map,E.requireArgument(e,"_fuzzyKeyRange","number")}add(e,r,t){const a=this._map.get(e);a?a.push({fuzzyKey:r,value:t}):this._map.set(e,[{fuzzyKey:r,value:t}])}pop(e,r){const t=this._map.get(e);if((t==null?void 0:t.length)>=1){let a=Number.POSITIVE_INFINITY,l=-1;for(let i=0;i<t.length;i++){const{fuzzyKey:d}=t[i],p=Math.abs(d-r);p<=this._fuzzyKeyRange&&p<a&&(a=p,l=i)}if(l>=0){const{value:i}=t.splice(l,1)[0];return t.length===0&&this._map.delete(e),i}}}clear(){this._map.clear()}}const Ot=["fetch","xmlhttprequest"];class St{constructor(e,r,t,a,l){if(this._instr=e,this._skipUrls=t,this._logPerformanceActivityName=a,this._boundObserverCallback=this._logPerformanceEntries.bind(this),this._boundNavigationTimingEventCallback=i=>{this._logNavigationEntries(i)},this._setTimeoutNavigationCallback=i=>{setTimeout(()=>{this._boundNavigationTimingEventCallback(i)},0)},this._visibilityChangeNavigationCallback=i=>{document.visibilityState==="hidden"&&this._boundNavigationTimingEventCallback(i)},this._isStarted=!1,this._processedNavigationTiming=!1,E.requireArgument(e,"_instr","object"),E.requireArgument(r,"fuzzyMapRange","number"),E.requireArgumentIfDefined(t,"_skipUrls",Array),E.requireArgumentIfDefined(a,"_logPerformanceActivityName","string"),E.requireArgumentIfDefined(l,"logLevel","string"),this._hasPerf=typeof performance!="undefined"&&typeof PerformanceObserver=="function",this._hasWindow=typeof window!="undefined",!l||l.toLowerCase()==="full")this._logLevel=1;else if((l==null?void 0:l.toLowerCase())==="basic")this._logLevel=0;else throw new Error(`Invalid log level: ${l}`);this._fuzzyMapper=new kt(r)}get isStarted(){return this._isStarted}get logLevel(){return this._logLevel}start(){this._hasPerf&&(this._isStarted||(this._isStarted=!0,this._resourceObserver=new PerformanceObserver(this._boundObserverCallback),this._resourceObserver.observe({type:"resource",buffered:!0}),this._addNavigationListeners()))}stop(){this._resourceObserver&&(this._resourceObserver.disconnect(),this._resourceObserver=void 0),this._removeNavigationListeners(),this._fuzzyMapper.clear(),this._isStarted=!1}_addNavigationListeners(){this._hasWindow&&(window.addEventListener("load",this._setTimeoutNavigationCallback),window.addEventListener("pagehide",this._boundNavigationTimingEventCallback),document.addEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}_removeNavigationListeners(){this._hasWindow&&(window.removeEventListener("load",this._setTimeoutNavigationCallback),window.removeEventListener("pagehide",this._boundNavigationTimingEventCallback),document.removeEventListener("visibilitychange",this._visibilityChangeNavigationCallback))}addEntry(e,r,t){this._fuzzyMapper.add(e,r,t)}_resourceEntryToResourceTiming(e){var r,t;const a={name:e.name,startTime:e.startTime,duration:e.duration,initiatorType:e.initiatorType,nextHopProtocol:e.nextHopProtocol,renderBlockingStatus:e.renderBlockingStatus,workerStart:e.workerStart,redirectStart:e.redirectStart,redirectEnd:e.redirectEnd,fetchStart:e.fetchStart,domainLookupStart:e.domainLookupStart,domainLookupEnd:e.domainLookupEnd,connectStart:e.connectStart,secureConnectionStart:e.secureConnectionStart,connectEnd:e.connectEnd,requestStart:e.requestStart,responseStart:e.responseStart,firstInterimResponseStart:e.firstInterimResponseStart,responseEnd:e.responseEnd,transferSize:e.transferSize,encodedBodySize:e.encodedBodySize,decodedBodySize:e.decodedBodySize,responseStatus:e.responseStatus},l=e.serverTiming;return Array.isArray(l)&&(a.dbDuration=(r=l.find(i=>i.name==="db"))===null||r===void 0?void 0:r.duration,a.srvDuration=(t=l.find(i=>i.name==="Total"))===null||t===void 0?void 0:t.duration),a}_shouldInclude(e){var r;return((r=this._skipUrls)===null||r===void 0?void 0:r.some(a=>a instanceof RegExp?a.test(e.name):e.name===a))?!1:this._logLevel===1?!0:Ot.indexOf(e.initiatorType)>=0||e.entryType==="navigation"}_calculateXhrDelay(e,r){if(r){if(e.initiatorType==="fetch"){if(e.responseStart===0)return-1;if(r.activityDuration!==void 0){const t=e.responseStart-e.startTime;return r.activityDuration-t}return}if(r.activityDuration!==void 0)return r.activityDuration-e.duration}}_logActivity(e,r,t,a){const l={id:t},i={perfStartOverride:r.startTime,perfStopOverride:r.startTime+r.duration,errorCount:a};this._instr.startActivity(this._logPerformanceActivityName,l).stop(e,r,i)}_logNavigationEntries(e){if(!this._processedNavigationTiming)for(const r of performance.getEntriesByType("navigation")){const t=r;if(this._shouldInclude(t)){this._processedNavigationTiming=!0;const a=this._resourceEntryToResourceTiming(t),l={domComplete:t.domComplete,domContentLoadedEventStart:t.domContentLoadedEventStart,domContentLoadedEventEnd:t.domContentLoadedEventEnd,domInteractive:t.domInteractive,loadEventStart:t.loadEventStart,loadEventEnd:t.loadEventEnd,redirectCount:t.redirectCount,type:t.type,unloadEventStart:t.unloadEventStart,unloadEventEnd:t.unloadEventEnd,logEvent:e.type};this._logActivity(At,Object.assign(a,l))}break}}_logPerformanceEntries(e){for(const r of e.getEntriesByType("resource")){const t=r,a=this._fuzzyMapper.pop(t.name,t.startTime);if(this._shouldInclude(t)){const l=this._resourceEntryToResourceTiming(t);Object.assign(l,{srvReqId:a==null?void 0:a.requestId,xhrDelay:this._calculateXhrDelay(t,a)}),l.responseStatus===void 0&&(l.responseStatus=a==null?void 0:a.responseStatus),this._logActivity(Et,l,a==null?void 0:a.activityId,a==null?void 0:a.errorCount)}}}}const Ct=32,It=16,Ne=16,Tt="traceparent",Nt="b3",xe="X-B3-TraceId",je="X-B3-SpanId",Pe="X-B3-Sampled",Re="X-B3-ParentSpanId",Le="X-SFDC-Request-Id",xt="baggage",jt="fetch",Pt="xhr_send",Rt="perf-timing",Lt=50,Dt=[xt,xe,je,Re,Pe],J=new WeakMap;class C{constructor(e,r){this._instr=e,this._idleDetector=r,E.requireArgument(e,"_instr","object"),E.requireArgument(r,"_idleDetector","object")}static _getB3CompactFormat(e,r,t,a){let l=`${e}-${r}`;return(t!==void 0||a!==void 0)&&(l+=t?"-1":"-0",a!==void 0&&(l+=`-${a}`)),l}static _getW3CompactFormat(e,r,t){return`00-${e}-${r}-${t?"01":"00"}`}static _conformTextAsId(e,r){e=e.toLowerCase();const t=e.length;for(let a=0;a<t;a+=1){const l=e[a];if(!(l>="a"&&l<="f")&&!(l>="0"&&l<="9"))throw new Error(`The text '${e}' has an invalid character at index #${a}`)}return t>r?e.substr(t-r):t<r?e.padStart(r,"0"):e}static setHeaders(e){if(e===void 0){C._userHeaders={};return}Object.entries(e).forEach(([r])=>{Dt.includes(r)||delete e[r]}),C._userHeaders=e}static getHeaders(e,r,t,a){E.requireArgument(r,"spanId","string");const l=a==null?void 0:a.useB3Headers,i={};if(e===void 0)return i;e=this._conformTextAsId(e,(a==null?void 0:a.traceIdEffectiveLength)!==void 0?a.traceIdEffectiveLength:l?It:Ct),r=this._conformTextAsId(r,Ne);const d=a&&a.parentSpanId!==void 0&&this._conformTextAsId(a.parentSpanId,Ne)||void 0;return l?(a==null?void 0:a.useCompactHeader)?i[Nt]=this._getB3CompactFormat(e,r,t,d):(i[xe]=e,i[je]=r,d!==void 0&&(i[Re]=d),t!==void 0&&(i[Pe]=t?"1":"0")):i[Tt]=this._getW3CompactFormat(e,r,t),i}_disableNetworkInstrumentation(){C._isNetworkInstrumentationEnabled&&(C._originalFetch&&(C._global.fetch=C._originalFetch,C._originalFetch=void 0),C._originalXhr&&(C._global.XMLHttpRequest=C._originalXhr,C._originalXhr=void 0),C._originalXhrOpen&&(C._global.XMLHttpRequest.prototype.open=C._originalXhrOpen,C._originalXhrOpen=void 0),C._originalXhrSetRequestHeader&&(C._global.XMLHttpRequest.prototype.setRequestHeader=C._originalXhrSetRequestHeader,C._originalXhrSetRequestHeader=void 0),C._originalXhrSend&&(C._global.XMLHttpRequest.prototype.send=C._originalXhrSend,C._originalXhrSend=void 0),C._performanceObservability&&(C._performanceObservability.stop(),C._performanceObservability=void 0),C._isNetworkInstrumentationEnabled=!1)}_enableNetworkInstrumentation(e,r,t,a,l,i,d,p,h,s){typeof C._global.fetch=="function"&&(this._overrideFetch(e,r,t,a,l,i,h),C._isNetworkInstrumentationEnabled=!0),typeof C._global.XMLHttpRequest=="function"&&(this._overrideXhr(e,r,t,a,l,i,h),C._isNetworkInstrumentationEnabled=!0),d&&(C._performanceObservability=new St(e,s,h,p,d===!0?"full":d),C._performanceObservability.start(),C._isNetworkInstrumentationEnabled=!0)}static _getTraceHeaders(e,r,t,a,l){let i;if(e)i=e.getTraceHeaders(t)||{};else{const d=r.internalInstrumentationContext;d!=null&&d.rootId?i=C.getHeaders(d.rootId,E.generateUniqueId(),d.isRootActivitySampled,t):i={}}if(typeof(t==null?void 0:t.headerProcessor)=="function")i=t.headerProcessor({method:a,url:l,defaultHeaders:i});else if(typeof window=="object"){let d;try{d=new URL(l)}catch(p){}d&&d.host!==window.location.host&&(i=void 0)}return C._userHeaders&&Object.keys(C._userHeaders).length>0&&(i=st({},i),Object.entries(C._userHeaders).forEach(([d,p])=>{i[d]=p}),C._userHeaders=void 0),i||{}}static _extractHeader(e,r,t){if((t==null?void 0:t.headers)instanceof Headers)return t.headers.get(e);if(Array.isArray(t==null?void 0:t.headers)){const a=t.headers.find(l=>l[0]===e);return a==null?void 0:a[1]}if(typeof(t==null?void 0:t.headers)=="object")return t.headers[e];if(r instanceof Request)return r.headers.get(e)}_overrideFetch(e,r,t,a,l,i,d){C._originalFetch=C._global.fetch;const p=(h,s,...o)=>G(this,null,function*(){var u;let n,c,y,f,v,m=!1,_;try{i==null||i.add(),f=s==null?void 0:s.method;const A=s==null?void 0:s.o11y,g=A==null?void 0:A.skipInstr;if(m=g||C._shouldSkipUrl(d,h),!m)n=e.startActivity(t||jt);else if(g){C._reqIndex+=1;try{if(h instanceof URL)h.searchParams.append("o11y",C._reqIndex.toString());else if(typeof h=="string"){const S=new URL(h),b=`o11y=${C._reqIndex}`;S.search+=S.search.startsWith("?")?`&${b}`:b,h=S.toString()}}catch(S){}}if(s==null||delete s.o11y,c=h==null?void 0:h.toString(),y=E.tryGetAbsoluteUrl(c),a){h instanceof Request&&(f||(f=h.method),c=h.url,y=E.tryGetAbsoluteUrl(c));const S=C._getTraceHeaders(n,e,l,f,y);!this._applyTraceHeaders(h,s,S)&&s===void 0&&(s={headers:S})}return v=E.perfNow(),_=yield C._originalFetch.call(C._global,h,s,...o),_}catch(A){throw r&&!m&&(n?n.error(A):e.error(A)),A}finally{try{const A=C._endActivity(n,c,f);if(!((u=C._performanceObservability)===null||u===void 0)&&u.isStarted){const S={requestId:C._extractHeader(Le,h,s),activityDuration:A,activityId:n==null?void 0:n.getId(),errorCount:n==null?void 0:n.getErrorCount(),responseStatus:_==null?void 0:_.status};C._performanceObservability.addEntry(y,v,S)}}finally{i==null||i.done()}}});C._global.fetch=p}static _endActivity(e,r,t){var a;if(e)return!((a=C._performanceObservability)===null||a===void 0)&&a.isStarted?e.discard():e.stop(ie,{mtd:t,url:r}),e.getStopPerfTime()-e.getStartPerfTime()}_overrideXhr(e,r,t,a,l,i,d){C._originalXhr=C._global.XMLHttpRequest,C._originalXhrOpen=C._originalXhr.prototype.open,C._originalXhrSetRequestHeader=C._originalXhr.prototype.setRequestHeader,C._originalXhrSend=C._originalXhr.prototype.send;function p(s,o){var u;const n=J.get(s);if(n){const c=n.activity,y=C._endActivity(c,n.url,n.method);!o&&(!((u=C._performanceObservability)===null||u===void 0)&&u.isStarted)&&C._performanceObservability.addEntry(n.absoluteUrl,n.sendTime,{requestId:n.requestId,activityDuration:y,activityId:c==null?void 0:c.getId(),errorCount:c==null?void 0:c.getErrorCount(),responseStatus:s.status})}}C._originalXhr.prototype.open=function(s,o,u,n,c){const y={method:s,url:o==null?void 0:o.toString()};J.set(this,y),y.absoluteUrl=E.tryGetAbsoluteUrl(y.url),y.suspendInstrumentation=C._shouldSkipUrl(d,y.absoluteUrl),C._originalXhrOpen.apply(this,arguments)},C._originalXhr.prototype.setRequestHeader=function(s,o){var u;if(((u=s==null?void 0:s.toLowerCase)===null||u===void 0?void 0:u.call(s))===Le.toLowerCase()){const n=J.get(this);n&&(n.requestId=o)}C._originalXhrSetRequestHeader.apply(this,arguments)},C._originalXhr.prototype.send=function(...s){let o;const u=this;let n=J.get(u);n||(n={},J.set(u,n));try{if(i==null||i.add(),n.suspendInstrumentation||(n.activity=o=e.startActivity(t||Pt)),a){const c=C._getTraceHeaders(o,e,l,n.method,n.absoluteUrl);Object.entries(c).forEach(y=>{u.setRequestHeader(y[0],y[1])})}n.sendTime=E.perfNow(),C._originalXhrSend.call(this,...s)}catch(c){throw r&&!(n!=null&&n.suspendInstrumentation)&&(o?o.error(c):e.error(c)),p(u,!0),i==null||i.done(),c}};const h=new Proxy(C._originalXhr,{construct(s){const o=new s;return o.addEventListener("load",()=>{p(o),i==null||i.done()}),o.addEventListener("error",u=>{const n=J.get(o)||{};try{if(r&&!(n!=null&&n.suspendInstrumentation)){const c=new Error("XHR Network-Level Error"),y=n==null?void 0:n.activity;y?y.error(c):e.error(c)}p(o)}finally{i==null||i.done()}}),o.addEventListener("abort",()=>{var u;const n=J.get(o)||{};(u=n==null?void 0:n.activity)===null||u===void 0||u.discard(),i==null||i.done()}),o}});C._global.XMLHttpRequest=h}networkInstrumentation(e){var r;if(E.requireArgument(e,"options",["boolean","object"]),this._disableNetworkInstrumentation(),e){const t=typeof e=="object"?e:{};let a;E.definedValueOrDefault(t.useTasker,!0)&&(a=(r=this._idleDetector)===null||r===void 0?void 0:r.declareNotifierTaskMulti("o11y network")),this._enableNetworkInstrumentation(E.definedValueOrDefault(t.instrumentation,this._instr),E.definedValueOrDefault(t.logErrors,!0),t.activityName,E.definedValueOrDefault(t.useTracing,!0),t.tracingHeadersOptions,a,E.definedValueOrDefault(t.logPerformance,!0),E.definedValueOrDefault(t.logPerformanceActivityName,Rt),E.definedValueOrDefault(t.skipUrls,[]),E.definedValueOrDefault(t.fuzzyMapRange,Lt))}}resetRequestCounter(){C._reqIndex=0}_applyTraceHeaders(e,r,t){if((r==null?void 0:r.headers)!==void 0){if(r.headers instanceof Headers&&typeof r.headers.set=="function")return Object.entries(t).forEach(([a,l])=>{r.headers.set(a,l)}),!0;if(Array.isArray(r.headers))return Object.entries(t).forEach(a=>{r.headers.push(a)}),!0;if(typeof r.headers=="object")return r.headers=Object.assign(r.headers,t),!0}else{if(e instanceof Request&&e.headers instanceof Headers)return Object.entries(t).forEach(([a,l])=>{e.headers.set(a,l)}),!0;if(r)return r.headers=Object.assign({},t),!0}return!1}static _shouldSkipUrl(e,r){var t;let a=r;return r instanceof URL?a=(t=r.toString)===null||t===void 0?void 0:t.call(r):r instanceof Request&&(a=r.url),e==null?void 0:e.some(l=>l instanceof RegExp?l.test(a):a===l)}}C._global=E.getGlobal(),C._isNetworkInstrumentationEnabled=!1,C._reqIndex=0;var U;(function(w){w[w.none=0]="none",w[w.start=1]="start",w[w.stop=2]="stop",w[w.both=3]="both"})(U||(U={}));const Mt="timedout",qt="terminated",ge="discarded",ne={timedout:Mt,terminated:qt,discarded:ge};class W{constructor(e,r,t,a,l,i,d,p,h,s,o){var u,n;this._name=e,this._rootId=r,this._onStopped=t,this._onError=a,this._isSampled=d,this._noRerooting=h,this._isExternal=s,this._parentActivity=o,this._isRoot=!1,this._errorCount=0,this._timerOverridden=U.none;const{tsNow:c,perfNow:y}=E.time();if(W._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}__${W._count}`,this._perfId=`${this._name}__${this.id}`;try{performance.mark(this._perfId)}catch(f){this._usePerf=!1}}this._startTimestamp=c,this._startPerfTime=y,this._overrideTimer(p),l>0&&(this._timer=setTimeout(()=>{this._stopReason=this._stopReason||ne.timedout,this.stop()},l)),this._safety=new Te,this._externalParentActivity=!((u=this._parentActivity)===null||u===void 0)&&u.isExternal()?this._parentActivity:(n=this._parentActivity)===null||n===void 0?void 0:n.getExternalParentActivity()}get id(){return this._id}getId(){return this.id}getRootId(){return this._rootId}get stopReason(){return this._stopReason}getParentActivity(){return this._parentActivity}isExternal(){var e;return(e=this._isExternal)!==null&&e!==void 0?e:!1}getExternalParentActivity(){return this._externalParentActivity}error(e,r,t){this._safety.tryCatch(()=>{this._errorCount+=1,typeof e=="string"&&(e=new Error(e)),this._onError(e,this._getDetail(r,t))},{op:"activity.error"})}stop(e,r,t){this._safety.tryCatch(()=>{if(E.requireArgumentIfDefined(e,"userSchemaOrText",["object","string"]),E.requireArgumentIfDefined(r,"userData","object"),t){const a=t.perfStartOverride,l=E.requireArgumentIfDefined(a,"options.perfStartOverride","number"),i=t.perfStopOverride,d=E.requireArgumentIfDefined(i,"options.perfStopOverride","number"),p=t.errorCount;if(E.requireArgumentIfDefined(p,"options.errorCount","number")&&(this._errorCount=p),l&&a<0)throw new Error("perfStartOverride, if defined, must be >= 0");if(d&&(i<0||i<(l?a:this._startPerfTime)||i>E.time().perfNow+100))throw new Error("perfStopOverride, if defined, must be >= 0 and >= startTime and <= now")}this._stopInternal(e,r,t)},{op:"activity.stop"})}_overrideTimer(e,r){e!==void 0&&(this._startTimestamp=Math.round(this._startTimestamp-(this._startPerfTime-e)),this._startPerfTime=e,this._setTimerOverride(U.start)),r!==void 0&&(this._stopPerfTime=r,this._setTimerOverride(U.stop))}_setTimerOverride(e){this._timerOverridden===U.both||this._timerOverridden===e||e===U.none||(this._timerOverridden=this._timerOverridden===U.none?e:U.both)}_stopInternal(e,r,t){const a=E.perfNow();if(this._usePerf)try{this._stopReason!==ne.discarded&&performance.measure(this._perfName,this._perfId),performance.clearMarks(this._perfId),performance.clearMeasures(this._perfName)}catch(i){}if(this._timer&&(clearTimeout(this._timer),this._timer=void 0),this.isStopped)return;t&&this._overrideTimer(t.perfStartOverride,t.perfStopOverride),this._stopPerfTime=this._timerOverridden===U.none||this._timerOverridden===U.start?a:this._stopPerfTime;const l=this._getDetail(e,r);this._onStopped(l)}get isStopped(){return this._stopPerfTime!==void 0}discard(){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||ne.discarded,this.stop()},{op:"activity.discard"})}terminate(e,r,t){this._safety.tryCatch(()=>{this._stopReason=this._stopReason||ne.terminated,this.stop(e,r,t)},{op:"activity.terminate"})}getIsSampled(){return this._isSampled||!1}_getDetail(e,r){return{id:this._id,rootId:this._rootId,name:this._name,userSchemaOrText:e,userData:r,stopReason:this._stopReason,startTimestamp:this._startTimestamp,startPerfTime:this._startPerfTime,stopPerfTime:this._stopPerfTime,errorCount:this._errorCount,isSampled:this.getIsSampled(),timerOverridden:this._timerOverridden,noRerooting:this._noRerooting,isExternal:this._isExternal,parentActivity:this._parentActivity,externalParentActivity:this._externalParentActivity}}getTraceHeaders(e){const r=this.id,t=this._isRoot?this.id:this._rootId;return C.getHeaders(t,r,this.getIsSampled(),e)}getStartTimestamp(){return this._startTimestamp}getStartPerfTime(){return this._startPerfTime}getStopPerfTime(){return this._stopPerfTime}getErrorCount(){return this._errorCount}}W._count=0;const Bt=new Array(16).fill(0).join("");class Ht{getId(){return Bt}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const Ft=Object.freeze(new Ht);class Ut{getInstrumentedEventData(e,r,t,a){var l;const i={ownerComponent:t.tagName,parentComponent:((l=t.parentElement)===null||l===void 0?void 0:l.tagName)||void 0,simplePath:E.getXpath(t)};switch(e){case 0:i.baseEvent=r;break;case 1:i.mouseEvent=r;break}return a&&(i.userPayload=D.makePayload(a.schema,a.payload,!0)),i}getEventData(e){return{type:e.type}}getMouseEventData(e){return{altKey:e.altKey,bubbles:e.bubbles,button:e.button,buttons:e.buttons,cancelable:e.cancelable,clientX:e.clientX,clientY:e.clientY,composed:e.composed,defaultPrevented:e.defaultPrevented,detail:e.detail,eventPhase:e.eventPhase,isTrusted:e.isTrusted,timeStamp:e.timeStamp,type:e.type,ctrlKey:e.ctrlKey,metaKey:e.metaKey,movementX:e.movementX,movementY:e.movementY,offsetX:e.offsetX,offsetY:e.offsetY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY,shiftKey:e.shiftKey}}}const ve=new Ut;class De{constructor(e,r,t,a,l,i,d,p){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=a,this._buckets=l,this._values=new Array,this._createdOn=i===void 0?E.time().tsNow:i,d!==void 0&&(this._lastUpdatedOn=d),p!==void 0&&(this._values=p)}getName(){return this._name}getCreatedOn(){return this._createdOn}getLastUpdatedOn(){return this._lastUpdatedOn}getData(){return this.values}getBuckets(){return this.buckets}get buckets(){return this._buckets.slice(0,this._buckets.length)}get values(){return this._values.slice(0,this._values.length)}record(e){if(typeof e=="number"){this._values.push(e),this._lastUpdatedOn=E.time().tsNow;return}throw new Error("BucketHistogram can only record numbers.")}reset(){this._lastUpdatedOn=void 0,this._values=[]}getOwnerName(){return this._ownerName}getOwnerAppName(){return this._ownerAppName}getTags(){return this._tags}}class Me{constructor(e,r,t,a,l,i,d){this._name=e,this._ownerName=r,this._ownerAppName=t,this._tags=a,this._values=new Array,this._createdOn=l===void 0?E.time().tsNow:l,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 _e{constructor(e){if(this._map=new Map,typeof e=="number"&&e>0){this._maxSize=Math.ceil(e);return}throw new Error("maxSize must be a positive number")}get maxSize(){return this._maxSize}get(e){return this._map.get(e)}has(e){return this._map.has(e)}set(e,r){return this.has(e)||this._map.size<this.maxSize?(this._map.set(e,r),!0):!1}getElements(){return Array.from(this._map.values())}clear(){this._map.clear()}}const qe=1e3,Be=500,He=500;var Q;(function(w){w[w.Counter=0]="Counter",w[w.Percentile=1]="Percentile",w[w.BucketHistogram=2]="BucketHistogram"})(Q||(Q={}));class Fe{constructor(e,r){this._ownerName=e,this._getOwnerAppName=r,this._upCounters=new _e(qe),this._valueRecorders=new _e(Be),this._bucketHistograms=new _e(He)}incrementCounter(e,r,t=!1,a={}){this._tagError(a,t),this._upCounter(e,a).increment(r)}trackValue(e,r,t=!1,a={}){this._tagError(a,t),this._valueRecorder(e,a).record(r)}bucketValue(e,r,t,a=!1,l={}){this._tagError(l,a),this._bucketHistogram(e,l,t).record(r)}_bucketHistogram(e,r,t){const{key:a,sortedTags:l}=this._getKeyAndSortedTags(e,r,Q.BucketHistogram);let i=this._bucketHistograms.get(a);if(!i&&(i=new De(e,this._ownerName,this._getOwnerAppName(),l,t),!this._bucketHistograms.set(a,i)))throw new Error(`Max size of ${He} exceeded for BucketHistograms`);return i}_upCounter(e,r){const{key:t,sortedTags:a}=this._getKeyAndSortedTags(e,r,Q.Counter);let l=this._upCounters.get(t);if(!l&&(l=new me(e,this._ownerName,this._getOwnerAppName(),a),!this._upCounters.set(t,l)))throw new Error(`Max size of ${qe} exceeded for UpCounters`);return l}_valueRecorder(e,r){const{key:t,sortedTags:a}=this._getKeyAndSortedTags(e,r,Q.Percentile);let l=this._valueRecorders.get(t);if(!l&&(l=new Me(e,this._ownerName,this._getOwnerAppName(),a),!this._valueRecorders.set(t,l)))throw new Error(`Max size of ${Be} exceeded for ValueRecorders`);return l}getUpCounters(){return this._upCounters.getElements()}getValueRecorders(){return this._valueRecorders.getElements()}getBucketHistograms(){return this._bucketHistograms.getElements()}_tagError(e,r){e.status=r===!0?"error":"success"}_getKeyAndSortedTags(e,r,t){const a=Object.keys(r).sort().reduce((i,d)=>(i[d]=r[d],i),{});return{key:`${Q[t]}:${e}${JSON.stringify(a)}`,sortedTags:a}}}class $t{constructor(){this.isMock=!0}}const zt=void 0,oe=["`"],Ue={internalError:"o11y-error"},be=Object.freeze(Array.from(Object.values(Ue))),we=new WeakMap;class re{constructor(e,r){this._nextGen=e,this._name=r,this._onActivityStoppedCallback=this._handleActivityStop.bind(this),this._onActivityErrorCallback=this._handleActivityError.bind(this);for(const a of oe)if(this._name.indexOf(a)>=0)throw new Error(`Name cannot include the reserved character "${a}"`);this._safety=new Te({increment:a=>this._incrementError(a)}),this._metrics=this._initMetrics();const t=D.getOptions(K,"Simple","text");this._simpleTextMaxLength=t?t["(meta.max_length)"]:ye}_initMetrics(){return new Fe(this.name,()=>this._nextGen.appName||re.defaultAppName)}_incrementError(e=1){this._metrics.incrementCounter(Ue.internalError,e,!0)}get name(){return this._name}[vt](e,r,t){const a=this[e];if(typeof a=="function"){we.set(this,t);try{a.apply(this,r)}finally{we.delete(this)}}}_wrapUserPayload(e,r,t=!1){let a;return typeof e=="string"?(a=K,e?r={text:e.substring(0,this._simpleTextMaxLength)}:r=void 0):a=e,D.makePayload(a,r,t)}_getEffectiveRootId(e){var r,t;return(t=(r=e==null?void 0:e.instrumentationContext)===null||r===void 0?void 0:r.rootId)!==null&&t!==void 0?t:this._nextGen.getDefaultInstrumentationContext().rootId}get internalInstrumentationContext(){return this._nextGen.getDefaultInstrumentationContext()}log(e,r,t){this._safety.tryCatch(()=>{const a=E.time().tsNow;E.requireArgument(e,"userSchemaOrText",["object","string"]),E.requireArgumentIfDefined(r,"userData","object"),E.requireArgumentIfDefined(t,"options","object");const l=this._wrapUserPayload(e,r);l!=null&&l.payload&&this._logInternal(this.name,l.schema,l.payload,a,this._getEffectiveRootId(t))},{op:"log"})}_logInternal(e,r,t,a,l){const i=we.get(this),d=this._nextGen.addLog(e,r,t,a,l,i);if(!E.isProduction){const p=se.getExtraFields(r,t);!E.isProduction&&p.length>0&&this.error("Extra fields",q,{extras:p})}return d}error(e,r,t,a){return this._safety.tryCatch(()=>{E.requireArgumentIfDefined(r,"userSchemaOrText",["object","string"]),E.requireArgumentIfDefined(t,"userData","object"),E.requireArgumentIfDefined(a,"options","object");const l=this._getEffectiveRootId(a);this._errorInternal(e,r,t,void 0,l)},{op:"error"})}_errorInternal(e,r,t,a,l){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 p=this._wrapUserPayload(r,t,!0),h={name:d.name,message:d.message,stack:d.stack,userPayload:p,activityId:a};return this._logInternal(this.name,$,h,i,l)}startActivity(e,r){return this._safety.tryCatchReturn(()=>{var t;E.requireArgument(e,"name"),E.requireArgumentIfDefined(r,"options","object");const a=E.validateParentActivityType(r==null?void 0:r.isExternal,r==null?void 0:r.parentActivity);let l,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,l={rootId:d,isRootActivitySampled:r.instrumentationContext.isRootActivitySampled,isRootActivityExternalSampled:r.instrumentationContext.isRootActivityExternalSampled}):l=this._nextGen.getDefaultInstrumentationContext();const p=r!=null&&r.isExternal?l.isRootActivityExternalSampled:l.isRootActivitySampled;return new W(e,l.rootId,this._onActivityStoppedCallback,this._onActivityErrorCallback,zt,r==null?void 0:r.id,p,r==null?void 0:r.perfStartOverride,i,r==null?void 0:r.isExternal,a)},Ft,{op:"startActivity"})}getRootActivityHistoryEntryByTime(e){let r;return this._safety.tryCatch(()=>{r=this._nextGen.getRootActivityHistoryEntryByTime(e)},{op:"getRootActivityHistoryEntryByTime"}),r}_getActivityData(e){var r,t;const a=this._wrapUserPayload(e.userSchemaOrText,e.userData,!0);return{id:e.id,name:e.name,duration:e.stopPerfTime-e.startPerfTime,stopReason:e.stopReason,userPayload:a,errorCount:e.errorCount,isSampled:e.isSampled,timerOverridden:e.timerOverridden,isRerooted:e.isRerooted,isExternal:e.isExternal,parentId:(r=e.parentActivity)===null||r===void 0?void 0:r.getId(),externalParentId:(t=e.externalParentActivity)===null||t===void 0?void 0:t.getId()}}_handleActivityStop(e){if(e.stopReason===ge)return;if(!e.isRoot&&!e.noRerooting){const t=this._nextGen.getRootActivityHistoryEntryByTime(e.startPerfTime);(!t&&e.rootId!==void 0||t&&e.rootId!==t.id)&&(e.rootId=t==null?void 0:t.id,e.isSampled=(t==null?void 0:t.isSampled)||!1,e.isRerooted=!0)}const r=this._getActivityData(e);this._logActivity(r,e.startTimestamp,e.rootId)}_logActivity(e,r,t){this._logInternal(this.name,ce,e,r,t)}_handleActivityError(e,r){this._errorInternal(e,r.userSchemaOrText,r.userData,r.id,r.rootId)}domEvent(e,r,t,a,l){this._safety.tryCatch(()=>{var i;const d=E.time().tsNow;E.requireArgument(e,"event",[Event,$t]),E.requireArgument(r,"handledBy",[HTMLElement,"object"]);let p;r instanceof HTMLElement?p=r:(r=r,((i=r.template)===null||i===void 0?void 0:i.host)instanceof HTMLElement?p=r.template.host:E.requireArgument(void 0,"handledBy"));const h=this._wrapUserPayload(t,a,!0),s=this._getEffectiveRootId(l);if(e.type==="click"){const o=e,u=this._nextGen.getClickTracker();u&&u.markEventHandled(o);const n=l==null?void 0:l.captureMouseData,c=ve.getInstrumentedEventData(n?1:0,n?ve.getMouseEventData(o):ve.getEventData(o),p,h);c.auto=l==null?void 0:l._auto,this._logInternal(this.name,de,c,d,s)}else throw new Error(E.notImplemented)},{op:"domEvent"})}_siftTags(e){const r=Object.assign({},e);return Object.entries(r).forEach(([t,a])=>{if(a===null)r[t]="null";else if(a==="")r[t]="empty";else if(Number.isNaN(a))r[t]="NaN";else{const l=typeof a;["number","string","boolean"].indexOf(l)===-1&&(r[t]=l)}}),r}incrementCounter(e,r=1,t=!1,a={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",be),E.checkForReservedCharacters(e,"operation",oe),E.requireArgument(r,"increment","number"),E.requireArgument(t,"hasError","boolean"),E.requireArgument(a,"tags","object"),this._metrics.incrementCounter(e,r,t,this._siftTags(a))},{op:"incrementCounter"})}trackValue(e,r,t=!1,a={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",be),E.checkForReservedCharacters(e,"operation",oe),E.requireArgument(r,"value","number"),E.requireArgument(t,"hasError","boolean"),E.requireArgument(a,"tags","object"),this._metrics.trackValue(e,r,t,this._siftTags(a))},{op:"trackValue"})}bucketValue(e,r,t=[],a=!1,l={}){this._safety.tryCatch(()=>{E.requireArgument(e,"operation","string"),E.checkForDenyListedValues(e,"operation",be),E.checkForReservedCharacters(e,"operation",oe),E.requireArgument(r,"value","number"),E.requireArgument(t,"buckets",Array),Object.entries(t).forEach(([i,d])=>{E.requireArgument(d,`Bucket value for '${i}'`,"number")}),E.requireArgument(a,"hasError","boolean"),E.requireArgument(l,"tags","object"),this._metrics.bucketValue(e,r,t,a,this._siftTags(l))},{op:"bucketValue"})}getUpCounters(){return this._metrics.getUpCounters().filter(e=>e.getLastUpdatedOn())}getValueRecorders(){return this._metrics.getValueRecorders().filter(e=>e.getLastUpdatedOn())}getBucketHistograms(){return this._metrics.getBucketHistograms().filter(e=>e.getLastUpdatedOn())}registerForLogPrompt(e){E.requireArgument(e,"listener","function"),this._nextGen.registerForLogPrompt(e)}_getAsaOptions(e){return e?Object.assign({instrumentationContext:e==null?void 0:e.instrumentationContext},e.startOptions):void 0}activity(e,r,t){var a,l,i,d;const p=this._getAsaOptions(t),h=this.startActivity(e,p);try{return r(h)}catch(s){throw h.error(s,(a=t==null?void 0:t.errorPayload)===null||a===void 0?void 0:a.schema,(l=t==null?void 0:t.errorPayload)===null||l===void 0?void 0:l.payload),s}finally{h.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(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 G(this,null,function*(){var a,l,i,d;const p=this._getAsaOptions(t),h=this.startActivity(e,p);try{return yield r(h)}catch(s){throw h.error(s,(a=t==null?void 0:t.errorPayload)===null||a===void 0?void 0:a.schema,(l=t==null?void 0:t.errorPayload)===null||l===void 0?void 0:l.payload),s}finally{h.stop((i=t==null?void 0:t.stopPayload)===null||i===void 0?void 0:i.schema,(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 C.setHeaders(t),e(...r)}}re.defaultAppName="APP_NOT_REGISTERED";const Vt=.1,Xt=20;class Jt{constructor(e){if(this._historyMap=new Map,this._historyList=new Array,E.requireArgumentIfDefined(e,"limit","number")){if(e=Math.ceil(e),e<=0)throw new Error("Limit must be a positive number")}else e=Xt;this._graceCount=Math.max(1,Math.floor(e*Vt)),this._realLimit=1+e+this._graceCount}add(e){if(this._historyMap.has(e.id))throw new Error(`RootActivityHistoryImpl.add: entry already exists for rootId: ${e.id}`);this._historyMap.set(e.id,e),this._historyList.push(e),this._historyList.length===this._realLimit&&this._historyList.splice(1,this._graceCount).forEach(t=>this._historyMap.delete(t.id))}get count(){return this._historyList.length}findById(e){return this._historyMap.get(e)}findByTime(e){let r,t=Number.MAX_VALUE;for(const a of this._historyList){const l=e-a.startPerfTime;l>=0&&(a.stopPerfTime===void 0||e<a.stopPerfTime)&&l<t&&(r=a,t=l)}return r}}class Gt extends W{constructor(e,r,t,a,l,i,d,p){super(e,void 0,r,t,void 0,a||E.generateUniqueId(d!=null?d:32),l,i),this._isRoot=!0,this._isExternalSampled=p}get isExternalSampled(){var e;return(e=this._isExternalSampled)!==null&&e!==void 0?e:!1}set isExternalSampled(e){this._isExternalSampled=e}get preRootId(){return this._preRootId}set preRootId(e){this._preRootId=e}_getDetail(e,r){const t=super._getDetail(e,r);return t.isRoot=!0,t.preRootId=this.preRootId,t}}const Kt=new Array(32).fill(0).join("");class Yt{getId(){return Kt}getRootId(){}error(){}stop(){}discard(){}terminate(){}getIsSampled(){return!1}getTraceHeaders(e){return{}}getStartTimestamp(){}getStartPerfTime(){}getStopPerfTime(){}getErrorCount(){return 0}getParentActivity(){}isExternal(){return!1}getExternalParentActivity(){}}const Wt=Object.freeze(new Yt);class Qt extends re{constructor(e,r,t){super(e,r),this._allowMulti=t,this._rootActivityHistory=new Jt,this._onRootActivityStoppedCallback=this._handleRootActivityStop.bind(this)}startRootActivity(e,r,t,a,l){return this._safety.tryCatchReturn(()=>{if(E.requireArgument(e,"name"),(a==null?void 0:a.id)!==void 0)throw new Error("Cannot specify id for root activity, use rootId argument instead");const i=new Gt(e,this._onRootActivityStoppedCallback,this._onActivityErrorCallback,r,t,a==null?void 0:a.perfStartOverride,this._nextGen.preferredRootIdLength,l);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 p=this._singleRootActivity.getId();this._singleRootActivity.terminate(),i.preRootId=p}this._singleRootActivity=i}return i},Wt,{op:"startRootActivity"})}_handleRootActivityStop(e){const r=this._rootActivityHistory.findById(e.id);if(r&&(r.stopPerfTime=e.stopPerfTime,r.startPerfTime=e.startPerfTime),e.stopReason===ge)return;const t=this._getActivityData(e);this._logActivity(t,e.startTimestamp),this._singleRootActivity=void 0}_getActivityData(e){const r=super._getActivityData(e);return r.isRoot=e.isRoot,r.preRootId=e.preRootId,r}getSingleRootActivityId(){var e;return(e=this._singleRootActivity)===null||e===void 0?void 0:e.getId()}isSingleRootActivitySampled(){var e;return(e=this._singleRootActivity)===null||e===void 0?void 0:e.getIsSampled()}isSingleRootActivityExternalSampled(){var e,r;return(r=(e=this._singleRootActivity)===null||e===void 0?void 0:e.isExternalSampled)!==null&&r!==void 0?r:!1}_initMetrics(){return new Fe(this.name,()=>this.name)}getRootActivityHistoryEntry(e){return this._rootActivityHistory.findByTime(e)}}const Zt=5;class er{constructor(e,r){this._instr=e,this._doc=r,this._isActive=!1,this._boundClickListener=this._clickListener.bind(this),E.requireArgument(e,"_instr"),E.requireArgument(r,"_doc")}activate(){this._isActive||(this._doc.addEventListener("click",this._boundClickListener,!0),this._isActive=!0)}deactivate(){this._isActive&&(this._doc.removeEventListener("click",this._boundClickListener,!0),this._isActive=!1)}markEventHandled(e){this._ignoredEvent=e}_clickListener(e){var r;let t=(r=e.composedPath)===null||r===void 0?void 0:r.call(e);(!t||!t.length)&&(t=e.path);const a=this._getClickableElement(t);a&&setTimeout(()=>{e!==this._ignoredEvent&&this._instr.domEvent(e,a,void 0,void 0,{_auto:!0})})}_getClickableElement(e){var r,t;const a=e?Math.min(e.length,Zt):0;for(let l=0;l<a;l+=1){const i=e[l],d=(r=i.tagName)===null||r===void 0?void 0:r.toLowerCase();if(d==="a"||d==="button")return i;if(d==="input"){const p=i;if(((t=p.type)===null||t===void 0?void 0:t.toLowerCase())==="button")return p}}}}const $e="o11y:receiver";var Ee;(function(w){w[w.Unknown=0]="Unknown",w[w.Opening=1]="Opening"})(Ee||(Ee={}));class tr{constructor(e,r,t){this._logCallback=e,this._metricsCallback=r,this._commErrorCallback=t,this._senders=new Map,E.requireArgument(this._logCallback,"_logCallback","function"),E.requireArgument(this._metricsCallback,"_metricsCallback","function"),E.requireArgument(this._commErrorCallback,"_commErrorCallback","function")}openComms(e){if(E.requireArgument(e,"sender","object"),!this._senders.has(e)){const r=new MessageChannel,t={state:Ee.Opening,port:r.port1};this._senders.set(e,t),t.port.onmessage=this._messagePortEventHandler.bind(this),t.port.onmessageerror=this._messagePortErrorHandler.bind(this),e.postMessage({from:$e,type:ze},"*",[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===Ve?this._logCallback(e.data.data):e.data.type===Xe&&this._metricsCallback(e.data.data)}_messagePortErrorHandler(){this._commErrorCallback()}}const ze="handshake",Ve="log",Xe="metrics";class rr{constructor(e,r){this._self=e,this._allowedOrigins=r,this._messageEventHandlerFunc=this._messageEventHandler.bind(this),this._handshakeComplete=!1,this._logBuffer=[],this._metricsBuffer=[],E.requireArgument(this._self,"_self","object"),E.requireArgumentIfDefined(r,"allowedOrigins",Array),this._self.addEventListener("message",this._messageEventHandlerFunc)}_messageEventHandler(e){e.data.from===$e&&e.data.type===ze&&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:Ve,data:e}):this._logBuffer.push(e)}sendMetrics(e){this._handshakeComplete?this._otherPort.postMessage({type:Xe,data:e}):this._metricsBuffer.push(e)}_emptyBuffers(){this._logBuffer.forEach(e=>this.sendLog(e)),this._metricsBuffer.forEach(e=>this.sendMetrics(e)),this._logBuffer=void 0,this._metricsBuffer=void 0}}class ir{constructor(){this._upCounters=[],this._valueRecorders=[],this._bucketHistograms=[]}add(e){var r,t,a;!((r=e.upCounters)===null||r===void 0)&&r.length&&this._upCounters.push(...e.upCounters.map(l=>new me(l.name,l.ownerName,l.ownerAppName,V.getMetricsTags(l.tags),l.createdTimestamp,l.lastUpdatedTimestamp,l.value))),!((t=e.valueRecorders)===null||t===void 0)&&t.length&&this._valueRecorders.push(...e.valueRecorders.map(l=>new Me(l.name,l.ownerName,l.ownerAppName,V.getMetricsTags(l.tags),l.createdTimestamp,l.lastUpdatedTimestamp,l.values))),!((a=e.bucketHistograms)===null||a===void 0)&&a.length&&this._bucketHistograms.push(...e.bucketHistograms.map(l=>new De(l.name,l.ownerName,l.ownerAppName,V.getMetricsTags(l.tags),l.buckets,l.createdTimestamp,l.lastUpdatedTimestamp,l.values)))}getUpCounters(){return this._upCounters=this._upCounters.filter(e=>e.getLastUpdatedOn()!==void 0),this._upCounters}getValueRecorders(){return this._valueRecorders=this._valueRecorders.filter(e=>e.getLastUpdatedOn()!==void 0),this._valueRecorders}getBucketHistograms(){return this._bucketHistograms=this._bucketHistograms.filter(e=>e.getLastUpdatedOn()!==void 0),this._bucketHistograms}}const sr=1e3;class nr{constructor(e,r){this._connector=e,this._pollInterval=sr,E.requireArgument(e,"_connector","object"),E.requireArgumentIfDefined(r,"_pollInterval","number")&&r>0&&(this._pollInterval=r)}collect(e,r,t){const a={schema:e,data:r,logMeta:t};this._connector.sendLog(a)}receiveMetricsExtractors(e){this._metricsExtractors=e,this._collectAndSendMetrics(),setInterval(this._collectAndSendMetrics.bind(this),this._pollInterval)}_collectAndSendMetrics(){const e={upCounters:V.getUpCounters(this._metricsExtractors.getAllUpCounters()),valueRecorders:V.getValueRecorders(this._metricsExtractors.getAllValueRecorders()),bucketHistograms:V.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms())};(e.upCounters.length||e.valueRecorders.length||e.bucketHistograms.length)&&this._connector.sendMetrics(e)}}const Je=80,or=32,Ge="_CUT",ar=Je-Ge.length;function ae(){}class ue{get preferredRootIdLength(){return this._preferredRootIdLength}get pagePayloadProvider(){return this._pagePayloadProvider}set pagePayloadProvider(e){this._pagePayloadProvider=e}get appPayloadProvider(){return this._appPayloadProvider}set appPayloadProvider(e){this._appPayloadProvider=e}constructor(e){this._idleDetector=e,this._logCollectors=new Set,this._instruments=new Map,this._seqBySchema=new Map,this._sequence=0,this._forceDisabledLogCollectors=new Set,this._logCollectorFailures=new Map,this._isBufferingEnabled=!1,this._buffer=[],this._logCollectionListeners=new Set,this._opMode="default",this._isSender=!1,this._isReceiver=!1,this._decimalPoints=2}registerApp(e,r){var t,a;if(E.requireArgument(e,"name","string"),this._appInstr)throw new Error("An app has already been registered with instrumentation.");if(this._instruments.get(e))throw new Error(`The instrumentation name ${e} is already taken`);if(Y.setOwnerAppName(e),this._initOpMode(r==null?void 0:r.operationMode),this._isSender=this._opMode==="sender",this._isReceiver=this._opMode==="receiver",(r==null?void 0:r.decimalPoints)!==void 0&&(this._decimalPoints=r.decimalPoints),this._preferredRootIdLength=(t=r==null?void 0:r.preferredRootIdLength)!==null&&t!==void 0?t:or,this._clientSessionId=((a=r==null?void 0:r.clientSessionId)===null||a===void 0?void 0:a.toString())||E.generateUniqueId(),this._appInstr=new Qt(this,e,r==null?void 0:r.allowMultipleRootActivities),this._instruments.set(e,this._appInstr),this._isSender){const d=new nr(new rr(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 ir,this._receiverConnector=new tr(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 C(this.getInstrumentation("Network"),this._idleDetector);return{log:this._appInstr.log.bind(this._appInstr),error:this._appInstr.error.bind(this._appInstr),startActivity:this._appInstr.startActivity.bind(this._appInstr),domEvent:this._appInstr.domEvent.bind(this._appInstr),incrementCounter:this._appInstr.incrementCounter.bind(this._appInstr),trackValue:this._appInstr.trackValue.bind(this._appInstr),bucketValue:this._appInstr.bucketValue.bind(this._appInstr),networkInstrumentation:i.networkInstrumentation.bind(i),registerForLogPrompt:this._appInstr.registerForLogPrompt.bind(this._appInstr),activity:this._appInstr.activity.bind(this._appInstr),activityAsync:this._appInstr.activityAsync.bind(this._appInstr),invokeNetworkCallWithHeaders:this._appInstr.invokeNetworkCallWithHeaders.bind(this._appInstr),startRootActivity:this._appInstr.startRootActivity.bind(this._appInstr),registerLogCollector:this._isSender?ae:this.registerLogCollector.bind(this),registerMetricsCollector:this._isSender?ae:this.registerMetricsCollector.bind(this),activateClickTracker:this.activateClickTracker.bind(this),deactivateClickTracker:this.deactivateClickTracker.bind(this),disableBuffering:this.disableBuffering.bind(this),promptLogCollection:this.promptLogCollection.bind(this),getClientSessionId:this.getClientSessionId.bind(this),getOperationMode:this.getOperationMode.bind(this),startReceiving:this._isReceiver?this._receiverConnector.openComms.bind(this._receiverConnector):ae,stopReceiving:this._isReceiver?this._receiverConnector.closeComms.bind(this._receiverConnector):ae}}getInstrumentation(e){E.requireArgument(e,"name","string"),e.length>Je&&(e=e.substring(0,ar)+Ge);let r=this._instruments.get(e);if(!r)r=new re(this,e),this._instruments.set(e,r);else if(r===this._appInstr)throw new Error(`The instrumentation name ${e} is being used by the app.`);return r}get appName(){var e;return(e=this._appInstr)===null||e===void 0?void 0:e.name}getRootActivityHistoryEntryByTime(e){var r;return(r=this._appInstr)===null||r===void 0?void 0:r.getRootActivityHistoryEntry(e)}addLog(e,r,t,a,l,i){var d,p,h;se.checkInputs(r,t),this._sequence+=1;const s=D.isInternal(r),o=s&&(t!=null&&t.userPayload)?t.userPayload.schema:r,u=D.getSchemaId(o);let n=this._seqBySchema.get(u)||0;n+=1,this._seqBySchema.set(u,n);const c={timestamp:a,rootId:l,sequence:this._sequence,schemaSequence:n,loggerName:e,pagePayload:void 0,appPayload:void 0,loggerAppName:this.appName,connectionType:E.getConnectionType(),clientSessionId:this._clientSessionId,age:E.getAge(a),tenantClass:i||void 0},y={schema:r,data:t,logMeta:c};if(c.pagePayload=se.getPayloadFromProvider(this.pagePayloadProvider,y),c.appPayload=se.getPayloadFromProvider(this.appPayloadProvider,y),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((p=c.pagePayload)===null||p===void 0?void 0:p.payload,this._decimalPoints),E.roundNumbersInObject((h=c.appPayload)===null||h===void 0?void 0:h.payload,this._decimalPoints)),this._isBufferingEnabled){const f={schema:r,data:t,logMeta:c};this._buffer.push(f)}return this._multiplex(r,t,c),this._sequence}_multiplex(e,r,t){const a=Array.from(this._logCollectors).filter(l=>{var i;return!this._forceDisabledLogCollectors.has(l)&&!(!((i=l.getIsCollectDisabled)===null||i===void 0)&&i.call(l))});if(a.length>0)for(const l of a){let i=this._logCollectorFailures.get(l)||0;try{l.collect(e,r,t),i>0&&this._logCollectorFailures.set(l,i-1)}catch(d){i+=1,i>=ue._collectorFailureLimit?(this._forceDisabledLogCollectors.add(l),this._appInstr&&(typeof d=="string"||d instanceof Error)&&this._appInstr.error(d)):this._logCollectorFailures.set(l,i)}}}getBuffer(){return this._buffer}disableBuffering(){this._isBufferingEnabled=!1,this._buffer=[]}getClickTracker(){return this._autoClickTracker}getDefaultInstrumentationContext(){var e,r,t;return{rootId:(e=this._appInstr)===null||e===void 0?void 0:e.getSingleRootActivityId(),isRootActivitySampled:(r=this._appInstr)===null||r===void 0?void 0:r.isSingleRootActivitySampled(),isRootActivityExternalSampled:(t=this._appInstr)===null||t===void 0?void 0:t.isSingleRootActivityExternalSampled()}}activateClickTracker(){typeof document!="undefined"&&(this._autoClickTracker||(this._autoClickTracker=new er(this._appInstr,document)),this._autoClickTracker.activate())}deactivateClickTracker(){this._autoClickTracker&&(this._autoClickTracker.deactivate(),this._autoClickTracker=void 0)}registerLogCollector(e,r){if(E.requireArgument(e,"collector"),!this._logCollectors.has(e)&&(this._logCollectors.add(e),this._logCollectorFailures.set(e,0),(!e.getIsCollectDisabled||!e.getIsCollectDisabled())&&(r!=null&&r.retroactive)))for(const t of this._buffer)e.collect(t.schema,t.data,t.logMeta)}registerMetricsCollector(e){if(E.requireArgument(e,"collector"),this._metricsCollector)throw new Error("A metrics Collector is already registered.");this._metricsCollector=e,this._metricsCollector.receiveMetricsExtractors({getAllUpCounters:this._getAllUpCounters.bind(this),getAllValueRecorders:this._getAllValueRecorders.bind(this),getAllBucketHistograms:this._getAllBucketHistograms.bind(this)})}_getAllUpCounters(){var e;return(((e=this._metricsStore)===null||e===void 0?void 0:e.getUpCounters())||[]).concat(Array.from(this._instruments.values()).map(r=>r.getUpCounters()).flat()).concat(Y.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(Y.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(Y.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}}ue._collectorFailureLimit=5;class ur{get _lazyNextGen(){return this._nextgen||(this._nextgen=new ue(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 lr=new wt({logThreshold:300,reportListener:w=>{Z==null||Z.log(B,w)},errorListener:(w,e)=>{Z==null||Z.error(w,e)}}),le=new ur(lr),dr=le.registerInstrumentedApp.bind(le),Z=le.getInstrumentation.bind(le)("IdleDetector"),cr="264.105.0",hr="o11y";class ee{constructor(){this._envelope={diagnostics:{key:hr,generatedTimestamp:void 0,bundleCount:0,bucketHistogramCount:0,upCounterCount:0,valueRecorderCount:0,schemaVersion:cr},bundles:[],metrics:{bucketHistograms:[],upCounters:[],valueRecorders:[]},staticAttributes:{}}}withStaticAttributes(e){return this._envelope.staticAttributes=e,this}withLogs(e,r){let t=this._envelope.bundles.find(a=>a.schemaName===e);if(t)for(const a of r)t.messages.push(a);else t={schemaName:e,messages:r},this._envelope.bundles.push(t);return this._envelope.diagnostics.bundleCount=this._envelope.bundles.length,this}static getUpCounters(e,r=!0){return V.getUpCounters(e,r)}static getValueRecorders(e,r=!0){return V.getValueRecorders(e,r)}static getBucketHistograms(e,r=!0){return V.getBucketHistograms(e,r)}withUpCounters(e){for(const r of e)this._envelope.metrics.upCounters.push(r);return this._envelope.diagnostics.upCounterCount=this._envelope.metrics.upCounters.length,this}withValueRecorders(e){for(const r of e)this._envelope.metrics.valueRecorders.push(r);return this._envelope.diagnostics.valueRecorderCount=this._envelope.metrics.valueRecorders.length,this}withBucketHistograms(e){for(const r of e)this._envelope.metrics.bucketHistograms.push(r);return this._envelope.diagnostics.bucketHistogramCount=this._envelope.metrics.bucketHistograms.length,this}build(){return this._envelope.diagnostics.generatedTimestamp=E.time().tsNow,this._envelope}static buildFrom(e){const r=new ee;return e.staticAttributes&&r.withStaticAttributes(e.staticAttributes),e.messages&&e.messages.forEach((t,a)=>{r.withLogs(D.getSchemaId(a),t)}),e.upCounters&&r.withUpCounters(e.upCounters),e.valueRecorders&&r.withValueRecorders(e.valueRecorders),e.bucketHistograms&&r.withBucketHistograms(e.bucketHistograms),r.build()}}var Ae;(function(w){var e,r;e={1:[function(t,a,l){a.exports=function(i,d){for(var p=Array(arguments.length-1),h=0,s=2,o=!0;s<arguments.length;)p[h++]=arguments[s++];return new Promise(function(u,n){p[h]=function(c){if(o)if(o=!1,c)n(c);else{for(var y=Array(arguments.length-1),f=0;f<y.length;)y[f++]=arguments[f];u.apply(null,y)}};try{i.apply(d||null,p)}catch(c){o&&(o=!1,n(c))}})}},{}],2:[function(t,a,l){l.length=function(s){var o=s.length;if(!o)return 0;for(var u=0;1<--o%4&&(s[0|o]||"")=="=";)++u;return Math.ceil(3*s.length)/4-u};for(var i=Array(64),d=Array(123),p=0;p<64;)d[i[p]=p<26?p+65:p<52?p+71:p<62?p-4:p-59|43]=p++;l.encode=function(s,o,u){for(var n,c=null,y=[],f=0,v=0;o<u;){var m=s[o++];switch(v){case 0:y[f++]=i[m>>2],n=(3&m)<<4,v=1;break;case 1:y[f++]=i[n|m>>4],n=(15&m)<<2,v=2;break;case 2:y[f++]=i[n|m>>6],y[f++]=i[63&m],v=0}8191<f&&((c=c||[]).push(String.fromCharCode.apply(String,y)),f=0)}return v&&(y[f++]=i[n],y[f++]=61,v===1&&(y[f++]=61)),c?(f&&c.push(String.fromCharCode.apply(String,y.slice(0,f))),c.join("")):String.fromCharCode.apply(String,y.slice(0,f))};var h="invalid encoding";l.decode=function(s,o,u){for(var n,c=u,y=0,f=0;f<s.length;){var v=s.charCodeAt(f++);if(v==61&&1<y)break;if((v=d[v])===w)throw Error(h);switch(y){case 0:n=v,y=1;break;case 1:o[u++]=n<<2|(48&v)>>4,n=v,y=2;break;case 2:o[u++]=(15&n)<<4|(60&v)>>2,n=v,y=3;break;case 3:o[u++]=(3&n)<<6|v,y=0}}if(y===1)throw Error(h);return u-c},l.test=function(s){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(s)}},{}],3:[function(t,a,l){a.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(p,h){typeof p=="string"&&(h=p,p=w);var s=[];function o(n){if(typeof n!="string"){var c=u();if(d.verbose&&console.log("codegen: "+c),c="return "+c,n){for(var y=Object.keys(n),f=Array(y.length+1),v=Array(y.length),m=0;m<y.length;)f[m]=y[m],v[m]=n[y[m++]];return f[m]=c,Function.apply(null,f).apply(null,v)}return Function(c)()}for(var _=Array(arguments.length-1),A=0;A<_.length;)_[A]=arguments[++A];if(A=0,n=n.replace(/%([%dfijs])/g,function(g,S){var b=_[A++];switch(S){case"d":case"f":return""+ +(""+b);case"i":return""+Math.floor(b);case"j":return JSON.stringify(b);case"s":return""+b}return"%"}),A!==_.length)throw Error("parameter count mismatch");return s.push(n),o}function u(n){return"function "+(function(c){return!c||!(c=(""+c).replace(/[^\w$]/g,""))?"":(/^\d/.test(c)&&(c="_"+c),i.test(c)?c+"_":c)})(n||h)+"("+(p&&p.join(",")||"")+`){
|
|
2
|
+
`+s.join(`
|
|
3
|
+
`)+`
|
|
4
|
+
}`}return o.toString=u,o}d.verbose=!1},{}],4:[function(t,a,l){function i(){this.t={}}(a.exports=i).prototype.on=function(d,p,h){return(this.t[d]||(this.t[d]=[])).push({fn:p,ctx:h||this}),this},i.prototype.off=function(d,p){if(d===w)this.t={};else if(p===w)this.t[d]=[];else for(var h=this.t[d],s=0;s<h.length;)h[s].fn===p?h.splice(s,1):++s;return this},i.prototype.emit=function(d){var p=this.t[d];if(p){for(var h=[],s=1;s<arguments.length;)h.push(arguments[s++]);for(s=0;s<p.length;)p[s].fn.apply(p[s++].ctx,h)}return this}},{}],5:[function(t,a,l){a.exports=p;var i=t(1),d=t(7)("fs");function p(h,s,o){return s=typeof s=="function"?(o=s,{}):s||{},o?!s.xhr&&d&&d.readFile?d.readFile(h,function(u,n){return u&&typeof XMLHttpRequest!="undefined"?p.xhr(h,s,o):u?o(u):o(null,s.binary?n:n.toString("utf8"))}):p.xhr(h,s,o):i(p,this,h,s)}p.xhr=function(h,s,o){var u=new XMLHttpRequest;u.onreadystatechange=function(){if(u.readyState!==4)return w;if(u.status!==0&&u.status!==200)return o(Error("status "+u.status));if(s.binary){if(!(n=u.response))for(var n=[],c=0;c<u.responseText.length;++c)n.push(255&u.responseText.charCodeAt(c));return o(null,typeof Uint8Array!="undefined"?new Uint8Array(n):n)}return o(null,u.responseText)},s.binary&&("overrideMimeType"in u&&u.overrideMimeType("text/plain; charset=x-user-defined"),u.responseType="arraybuffer"),u.open("GET",h),u.send()}},{1:1,7:7}],6:[function(t,a,l){function i(o){function u(T,O,I,x){var P=O<0?1:0;T((O=P?-O:O)===0?0<1/O?0:2147483648:isNaN(O)?2143289344:34028234663852886e22<O?(P<<31|2139095040)>>>0:O<11754943508222875e-54?(P<<31|Math.round(O/1401298464324817e-60))>>>0:(P<<31|127+(T=Math.floor(Math.log(O)/Math.LN2))<<23|8388607&Math.round(O*Math.pow(2,-T)*8388608))>>>0,I,x)}function n(T,O,I){return T=T(O,I),O=2*(T>>31)+1,I=T>>>23&255,T&=8388607,I==255?T?NaN:1/0*O:I==0?1401298464324817e-60*O*T:O*Math.pow(2,I-150)*(8388608+T)}function c(T,O,I){m[0]=T,O[I]=_[0],O[I+1]=_[1],O[I+2]=_[2],O[I+3]=_[3]}function y(T,O,I){m[0]=T,O[I]=_[3],O[I+1]=_[2],O[I+2]=_[1],O[I+3]=_[0]}function f(T,O){return _[0]=T[O],_[1]=T[O+1],_[2]=T[O+2],_[3]=T[O+3],m[0]}function v(T,O){return _[3]=T[O],_[2]=T[O+1],_[1]=T[O+2],_[0]=T[O+3],m[0]}var m,_,A,g,S;function b(T,O,I,x,P,R){var F,te=x<0?1:0;(x=te?-x:x)===0?(T(0,P,R+O),T(0<1/x?0:2147483648,P,R+I)):isNaN(x)?(T(0,P,R+O),T(2146959360,P,R+I)):17976931348623157e292<x?(T(0,P,R+O),T((te<<31|2146435072)>>>0,P,R+I)):x<22250738585072014e-324?(T((F=x/5e-324)>>>0,P,R+O),T((te<<31|F/4294967296)>>>0,P,R+I)):(T(4503599627370496*(F=x*Math.pow(2,-(x=(x=Math.floor(Math.log(x)/Math.LN2))===1024?1023:x)))>>>0,P,R+O),T((te<<31|x+1023<<20|1048576*F&1048575)>>>0,P,R+I))}function k(T,O,I,x,P){return O=T(x,P+O),T=T(x,P+I),x=2*(T>>31)+1,P=T>>>20&2047,I=4294967296*(1048575&T)+O,P==2047?I?NaN:1/0*x:P==0?5e-324*x*I:x*Math.pow(2,P-1075)*(I+4503599627370496)}function N(T,O,I){A[0]=T,O[I]=g[0],O[I+1]=g[1],O[I+2]=g[2],O[I+3]=g[3],O[I+4]=g[4],O[I+5]=g[5],O[I+6]=g[6],O[I+7]=g[7]}function j(T,O,I){A[0]=T,O[I]=g[7],O[I+1]=g[6],O[I+2]=g[5],O[I+3]=g[4],O[I+4]=g[3],O[I+5]=g[2],O[I+6]=g[1],O[I+7]=g[0]}function L(T,O){return g[0]=T[O],g[1]=T[O+1],g[2]=T[O+2],g[3]=T[O+3],g[4]=T[O+4],g[5]=T[O+5],g[6]=T[O+6],g[7]=T[O+7],A[0]}function H(T,O){return g[7]=T[O],g[6]=T[O+1],g[5]=T[O+2],g[4]=T[O+3],g[3]=T[O+4],g[2]=T[O+5],g[1]=T[O+6],g[0]=T[O+7],A[0]}return typeof Float32Array!="undefined"?(m=new Float32Array([-0]),_=new Uint8Array(m.buffer),S=_[3]===128,o.writeFloatLE=S?c:y,o.writeFloatBE=S?y:c,o.readFloatLE=S?f:v,o.readFloatBE=S?v:f):(o.writeFloatLE=u.bind(null,d),o.writeFloatBE=u.bind(null,p),o.readFloatLE=n.bind(null,h),o.readFloatBE=n.bind(null,s)),typeof Float64Array!="undefined"?(A=new Float64Array([-0]),g=new Uint8Array(A.buffer),S=g[7]===128,o.writeDoubleLE=S?N:j,o.writeDoubleBE=S?j:N,o.readDoubleLE=S?L:H,o.readDoubleBE=S?H:L):(o.writeDoubleLE=b.bind(null,d,0,4),o.writeDoubleBE=b.bind(null,p,4,0),o.readDoubleLE=k.bind(null,h,0,4),o.readDoubleBE=k.bind(null,s,4,0)),o}function d(o,u,n){u[n]=255&o,u[n+1]=o>>>8&255,u[n+2]=o>>>16&255,u[n+3]=o>>>24}function p(o,u,n){u[n]=o>>>24,u[n+1]=o>>>16&255,u[n+2]=o>>>8&255,u[n+3]=255&o}function h(o,u){return(o[u]|o[u+1]<<8|o[u+2]<<16|o[u+3]<<24)>>>0}function s(o,u){return(o[u]<<24|o[u+1]<<16|o[u+2]<<8|o[u+3])>>>0}a.exports=i(i)},{}],7:[function(t,a,l){a.exports=function(i){try{var d;return typeof t!="function"?null:(d=t(i))&&(d.length||Object.keys(d).length)?d:null}catch(p){return null}}},{}],8:[function(t,a,l){var i=l.isAbsolute=function(p){return/^(?:\/|\w+:)/.test(p)},d=l.normalize=function(o){var h=(o=o.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),s=i(o),o="";s&&(o=h.shift()+"/");for(var u=0;u<h.length;)h[u]===".."?0<u&&h[u-1]!==".."?h.splice(--u,2):s?h.splice(u,1):++u:h[u]==="."?h.splice(u,1):++u;return o+h.join("/")};l.resolve=function(p,h,s){return s||(h=d(h)),!i(h)&&(p=(p=s?p:d(p)).replace(/(?:\/|^)[^/]+$/,"")).length?d(p+"/"+h):h}},{}],9:[function(t,a,l){a.exports=function(i,d,p){var h=p||8192,s=h>>>1,o=null,u=h;return function(n){return n<1||s<n?i(n):(h<u+n&&(o=i(h),u=0),n=d.call(o,u,u+=n),7&u&&(u=1+(7|u)),n)}}},{}],10:[function(t,a,l){l.length=function(i){for(var d,p=0,h=0;h<i.length;++h)(d=i.charCodeAt(h))<128?p+=1:d<2048?p+=2:(64512&d)==55296&&(64512&i.charCodeAt(h+1))==56320?(++h,p+=4):p+=3;return p},l.read=function(i,d,p){if(p-d<1)return"";for(var h="",s=d;s<p;){var o,u=i[s++];u<=127?h+=String.fromCharCode(u):192<=u&&u<224?h+=128<=(o=(31&u)<<6|63&i[s++])?String.fromCharCode(o):"�":224<=u&&u<240?h+=2048<=(o=(15&u)<<12|(63&i[s++])<<6|63&i[s++])?String.fromCharCode(o):"�":240<=u&&((u=(7&u)<<18|(63&i[s++])<<12|(63&i[s++])<<6|63&i[s++])<65536||1114111<u?h+="�":h=h+String.fromCharCode(55296+((u-=65536)>>10))+String.fromCharCode(56320+(1023&u)))}return h},l.write=function(i,d,p){for(var h,s,o=p,u=0;u<i.length;++u)(h=i.charCodeAt(u))<128?d[p++]=h:(h<2048?d[p++]=h>>6|192:((64512&h)==55296&&(64512&(s=i.charCodeAt(u+1)))==56320?(++u,d[p++]=(h=65536+((1023&h)<<10)+(1023&s))>>18|240,d[p++]=h>>12&63|128):d[p++]=h>>12|224,d[p++]=h>>6&63|128),d[p++]=63&h|128);return p-o}},{}],11:[function(t,a,l){var i=t(14),d=t(33);function p(s,o,u,n){var c=!1;if(o.resolvedType)if(o.resolvedType instanceof i){s("switch(d%s){",n);for(var y=o.resolvedType.values,f=Object.keys(y),v=0;v<f.length;++v)y[f[v]]!==o.typeDefault||c||(s("default:")('if(typeof(d%s)==="number"){m%s=d%s;break}',n,n,n),o.repeated||s("break"),c=!0),s("case%j:",f[v])("case %i:",y[f[v]])("m%s=%j",n,y[f[v]])("break");s("}")}else s('if(typeof d%s!=="object")',n)("throw TypeError(%j)",o.fullName+": object expected")("m%s=types[%i].fromObject(d%s,n+1)",n,u,n);else{var m=!1;switch(o.type){case"double":case"float":s("m%s=Number(d%s)",n,n);break;case"uint32":case"fixed32":s("m%s=d%s>>>0",n,n);break;case"int32":case"sint32":case"sfixed32":s("m%s=d%s|0",n,n);break;case"uint64":m=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":s("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",n,n,m)('else if(typeof d%s==="string")',n)("m%s=parseInt(d%s,10)",n,n)('else if(typeof d%s==="number")',n)("m%s=d%s",n,n)('else if(typeof d%s==="object")',n)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",n,n,n,m?"true":"");break;case"bytes":s('if(typeof d%s==="string")',n)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",n,n,n)("else if(d%s.length >= 0)",n)("m%s=d%s",n,n);break;case"string":s("m%s=String(d%s)",n,n);break;case"bool":s("m%s=Boolean(d%s)",n,n)}}return s}function h(s,o,u,n){if(o.resolvedType)o.resolvedType instanceof i?s("d%s=o.enums===String?(types[%i].values[m%s]===undefined?m%s:types[%i].values[m%s]):m%s",n,u,n,n,u,n,n):s("d%s=types[%i].toObject(m%s,o)",n,u,n);else{var c=!1;switch(o.type){case"double":case"float":s("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",n,n,n,n);break;case"uint64":c=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":s('if(typeof m%s==="number")',n)("d%s=o.longs===String?String(m%s):m%s",n,n,n)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",n,n,n,n,c?"true":"",n);break;case"bytes":s("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",n,n,n,n,n);break;default:s("d%s=m%s",n,n)}}return s}l.fromObject=function(s){var o=s.fieldsArray,u=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(!o.length)return u("return new this.ctor");u("var m=new this.ctor");for(var n=0;n<o.length;++n){var c=o[n].resolve(),y=d.safeProp(c.name);c.map?(u("if(d%s){",y)('if(typeof d%s!=="object")',y)("throw TypeError(%j)",c.fullName+": object expected")("m%s={}",y)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",y),u('if(ks[i]==="__proto__")')("util.makeProp(m%s,ks[i])",y),p(u,c,n,y+"[ks[i]]")("}")("}")):c.repeated?(u("if(d%s){",y)("if(!Array.isArray(d%s))",y)("throw TypeError(%j)",c.fullName+": array expected")("m%s=[]",y)("for(var i=0;i<d%s.length;++i){",y),p(u,c,n,y+"[i]")("}")("}")):(c.resolvedType instanceof i||u("if(d%s!=null){",y),p(u,c,n,y),c.resolvedType instanceof i||u("}"))}return u("return m")},l.toObject=function(s){var o=s.fieldsArray.slice().sort(d.compareFieldsById);if(!o.length)return d.codegen()("return {}");for(var u=d.codegen(["m","o"],s.name+"$toObject")("if(!o)")("o={}")("var d={}"),n=[],c=[],y=[],f=0;f<o.length;++f)o[f].partOf||(o[f].resolve().repeated?n:o[f].map?c:y).push(o[f]);if(n.length){for(u("if(o.arrays||o.defaults){"),f=0;f<n.length;++f)u("d%s=[]",d.safeProp(n[f].name));u("}")}if(c.length){for(u("if(o.objects||o.defaults){"),f=0;f<c.length;++f)u("d%s={}",d.safeProp(c[f].name));u("}")}if(y.length){for(u("if(o.defaults){"),f=0;f<y.length;++f){var v,m=y[f],_=d.safeProp(m.name);m.resolvedType instanceof i?u("d%s=o.enums===String?%j:%j",_,m.resolvedType.valuesById[m.typeDefault],m.typeDefault):m.long?u("if(util.Long){")("var n=new util.Long(%i,%i,%j)",m.typeDefault.low,m.typeDefault.high,m.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",_)("}else")("d%s=o.longs===String?%j:%i",_,m.typeDefault.toString(),m.typeDefault.toNumber()):m.bytes?(v=Array.prototype.slice.call(m.typeDefault),u("if(o.bytes===String)d%s=%j",_,String.fromCharCode.apply(String,m.typeDefault))("else{")("d%s=%j",_,v)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",_,_)("}")):u("d%s=%j",_,m.typeDefault)}u("}")}for(var A=!1,f=0;f<o.length;++f){var m=o[f],g=s.i.indexOf(m),_=d.safeProp(m.name);m.map?(A||(A=!0,u("var ks2")),u("if(m%s&&(ks2=Object.keys(m%s)).length){",_,_)("d%s={}",_)("for(var j=0;j<ks2.length;++j){"),u('if(ks2[j]==="__proto__")')("util.makeProp(d%s,ks2[j])",_),h(u,m,g,_+"[ks2[j]]")("}")):m.repeated?(u("if(m%s&&m%s.length){",_,_)("d%s=[]",_)("for(var j=0;j<m%s.length;++j){",_),h(u,m,g,_+"[j]")("}")):(u("if(m%s!=null&&m.hasOwnProperty(%j)){",_,m.name),h(u,m,g,_),m.partOf&&u("if(o.oneofs)")("d%s=%j",d.safeProp(m.partOf.name),m.name)),u("}")}return u("return d")}},{14:14,33:33}],12:[function(t,a,l){a.exports=function(h){for(var s=p.codegen(["r","l","e","n"],h.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("if(n===undefined)n=0")("if(n>Reader.recursionLimit)")('throw Error("maximum nesting depth exceeded")')("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(h.fieldsArray.filter(function(f){return f.map}).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()")("if(t===e)")("break")("switch(t>>>3){"),o=0;o<h.fieldsArray.length;++o){var u=h.i[o].resolve(),n=u.resolvedType instanceof i?"int32":u.type,c="m"+p.safeProp(u.name);s("case %i: {",u.id),u.map?(s("if(%s===util.emptyObject)",c)("%s={}",c)("var c2 = r.uint32()+r.pos"),d.defaults[u.keyType]!==w?s("k=%j",d.defaults[u.keyType]):s("k=null"),d.defaults[n]!==w?s("value=%j",d.defaults[n]):s("value=null"),s("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",u.keyType)("case 2:"),d.basic[n]===w?s("value=types[%i].decode(r,r.uint32(),undefined,n+1)",o):s("value=r.%s()",n),s("break")("default:")("r.skipType(tag2&7,n)")("break")("}")("}"),d.long[u.keyType]!==w?s('%s[typeof k==="object"?util.longToHash(k):k]=value',c):(u.keyType==="string"&&s('if(k==="__proto__")')("util.makeProp(%s,k)",c),s("%s[k]=value",c))):u.repeated?(s("if(!(%s&&%s.length))",c,c)("%s=[]",c),d.packed[n]!==w&&s("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",c,n)("}else"),d.basic[n]===w?s(u.delimited?"%s.push(types[%i].decode(r,undefined,((t&~7)|4),n+1))":"%s.push(types[%i].decode(r,r.uint32(),undefined,n+1))",c,o):s("%s.push(r.%s())",c,n)):d.basic[n]===w?s(u.delimited?"%s=types[%i].decode(r,undefined,((t&~7)|4),n+1)":"%s=types[%i].decode(r,r.uint32(),undefined,n+1)",c,o):s("%s=r.%s()",c,n),s("break")("}")}for(s("default:")("r.skipType(t&7,n)")("break")("}")("}"),o=0;o<h.i.length;++o){var y=h.i[o];y.required&&s("if(!m.hasOwnProperty(%j))",y.name)("throw util.ProtocolError(%j,{instance:m})","missing required '"+y.name+"'")}return s("return m")};var i=t(14),d=t(32),p=t(33)},{14:14,32:32,33:33}],13:[function(t,a,l){a.exports=function(s){for(var o,u=p.codegen(["m","w"],s.name+"$encode")("if(!w)")("w=Writer.create()"),n=s.fieldsArray.slice().sort(p.compareFieldsById),c=0;c<n.length;++c){var y=n[c].resolve(),f=s.i.indexOf(y),v=y.resolvedType instanceof i?"int32":y.type,m=d.basic[v];o="m"+p.safeProp(y.name),y.map?(u("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",o,y.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",o)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(y.id<<3|2)>>>0,8|d.mapKey[y.keyType],y.keyType),m===w?u("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",f,o):u(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|m,v,o),u("}")("}")):y.repeated?(u("if(%s!=null&&%s.length){",o,o),y.packed&&d.packed[v]!==w?u("w.uint32(%i).fork()",(y.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",o)("w.%s(%s[i])",v,o)("w.ldelim()"):(u("for(var i=0;i<%s.length;++i)",o),m===w?h(u,y,f,o+"[i]"):u("w.uint32(%i).%s(%s[i])",(y.id<<3|m)>>>0,v,o)),u("}")):(y.optional&&u("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",o,y.name),m===w?h(u,y,f,o):u("w.uint32(%i).%s(%s)",(y.id<<3|m)>>>0,v,o))}return u("return w")};var i=t(14),d=t(32),p=t(33);function h(s,o,u,n){o.delimited?s("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",u,n,(o.id<<3|3)>>>0,(o.id<<3|4)>>>0):s("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",u,n,(o.id<<3|2)>>>0)}},{14:14,32:32,33:33}],14:[function(t,a,l){a.exports=h;var i=t(22),d=(((h.prototype=Object.create(i.prototype)).constructor=h).className="Enum",t(21)),p=t(33);function h(s,o,u,n,c,y){if(i.call(this,s,u),o&&typeof o!="object")throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=c||{},this.valuesOptions=y,this.n={},this.reserved=w,o)for(var f=Object.keys(o),v=0;v<f.length;++v)f[v]!=="__proto__"&&typeof o[f[v]]=="number"&&(this.valuesById[this.values[f[v]]=o[f[v]]]=f[v])}h.prototype.r=function(s){return s=this.e||s,i.prototype.r.call(this,s),Object.keys(this.values).forEach(o=>{var u=Object.assign({},this.o);this.n[o]=Object.assign(u,this.valuesOptions&&this.valuesOptions[o]&&this.valuesOptions[o].features)}),this},h.fromJSON=function(s,o){return s=new h(s,o.values,o.options,o.comment,o.comments),s.reserved=o.reserved,o.edition&&(s.e=o.edition),s.u="proto3",s},h.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,p.toObject(["edition",this.h(),"options",this.options,"valuesOptions",this.valuesOptions,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:w,"comment",s?this.comment:w,"comments",s?this.comments:w])},h.prototype.add=function(s,o,u,n){if(!p.isString(s))throw TypeError("name must be a string");if(!p.isInteger(o))throw TypeError("id must be an integer");if(s!=="__proto__"){if(this.values[s]!==w)throw Error("duplicate name '"+s+"' in "+this);if(this.isReservedId(o))throw Error("id "+o+" is reserved in "+this);if(this.isReservedName(s))throw Error("name '"+s+"' is reserved in "+this);if(this.valuesById[o]!==w){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+o+" in "+this);this.values[s]=o}else this.valuesById[this.values[s]=o]=s;n&&(this.valuesOptions===w&&(this.valuesOptions={}),this.valuesOptions[s]=n||null),this.comments[s]=u||null}return this},h.prototype.remove=function(s){if(!p.isString(s))throw TypeError("name must be a string");var o=this.values[s];if(o==null)throw Error("name '"+s+"' does not exist in "+this);return delete this.valuesById[o],delete this.values[s],delete this.comments[s],this.valuesOptions&&delete this.valuesOptions[s],this},h.prototype.isReservedId=function(s){return d.isReservedId(this.reserved,s)},h.prototype.isReservedName=function(s){return d.isReservedName(this.reserved,s)}},{21:21,22:22,33:33}],15:[function(t,a,l){a.exports=u;var i,d=t(22),p=(((u.prototype=Object.create(d.prototype)).constructor=u).className="Field",t(14)),h=t(32),s=t(33),o=/^required|optional|repeated$/;function u(n,c,y,f,v,m,_){if(s.isObject(f)?(_=v,m=f,f=v=w):s.isObject(v)&&(_=m,m=v,v=w),d.call(this,n,m),!s.isInteger(c)||c<0)throw TypeError("id must be a non-negative integer");if(!s.isString(y))throw TypeError("type must be a string");if(f!==w&&!o.test(f=f.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(v!==w&&!s.isString(v))throw TypeError("extend must be a string");this.rule=(f=f==="proto3_optional"?"optional":f)&&f!=="optional"?f:w,this.type=y,this.id=c,this.extend=v||w,this.repeated=f==="repeated",this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!s.Long&&h.long[y]!==w,this.bytes=y==="bytes",this.resolvedType=null,this.extensionField=null,this.declaringField=null,this.comment=_}u.fromJSON=function(n,c){return n=new u(n,c.id,c.type,c.rule,c.extend,c.options,c.comment),c.edition&&(n.e=c.edition),n.u="proto3",n},Object.defineProperty(u.prototype,"required",{get:function(){return this.o.field_presence==="LEGACY_REQUIRED"}}),Object.defineProperty(u.prototype,"optional",{get:function(){return!this.required}}),Object.defineProperty(u.prototype,"delimited",{get:function(){return this.resolvedType instanceof i&&this.o.message_encoding==="DELIMITED"}}),Object.defineProperty(u.prototype,"packed",{get:function(){return this.o.repeated_field_encoding==="PACKED"}}),Object.defineProperty(u.prototype,"hasPresence",{get:function(){return!this.repeated&&!this.map&&(this.partOf||this.declaringField||this.extensionField||this.o.field_presence!=="IMPLICIT")}}),u.prototype.setOption=function(n,c,y){return d.prototype.setOption.call(this,n,c,y)},u.prototype.toJSON=function(n){return n=!!n&&!!n.keepComments,s.toObject(["edition",this.h(),"rule",this.rule!=="optional"&&this.rule||w,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",n?this.comment:w])},u.prototype.resolve=function(){var n;return this.resolved?this:((this.typeDefault=h.defaults[this.type])===w?(this.resolvedType=(this.declaringField||this).parent.lookupTypeOrEnum(this.type),this.resolvedType instanceof i?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]):this.options&&this.options.proto3_optional&&(this.typeDefault=null),this.options&&this.options.default!=null&&(this.typeDefault=this.options.default,this.resolvedType instanceof p&&typeof this.typeDefault=="string"&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(this.options.packed===w||!this.resolvedType||this.resolvedType instanceof p||delete this.options.packed,Object.keys(this.options).length||(this.options=w)),this.long?(this.typeDefault=s.Long.fromNumber(this.typeDefault,(this.type[0]||"")=="u"),Object.freeze&&Object.freeze(this.typeDefault)):this.bytes&&typeof this.typeDefault=="string"&&(s.base64.test(this.typeDefault)?s.base64.decode(this.typeDefault,n=s.newBuffer(s.base64.length(this.typeDefault)),0):s.utf8.write(this.typeDefault,n=s.newBuffer(s.utf8.length(this.typeDefault)),0),this.typeDefault=n),this.map?this.defaultValue=s.emptyObject:this.repeated?this.defaultValue=s.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof i&&(this.parent.ctor.prototype[this.name]=this.defaultValue),d.prototype.resolve.call(this))},u.prototype.f=function(n){var c;return n!=="proto2"&&n!=="proto3"?{}:(n={},this.rule==="required"&&(n.field_presence="LEGACY_REQUIRED"),this.parent&&h.defaults[this.type]===w&&(c=this.parent.get(this.type.split(".").pop()))&&c instanceof i&&c.group&&(n.message_encoding="DELIMITED"),this.getOption("packed")===!0?n.repeated_field_encoding="PACKED":this.getOption("packed")===!1&&(n.repeated_field_encoding="EXPANDED"),n)},u.prototype.r=function(n){return d.prototype.r.call(this,this.e||n)},u.d=function(n,c,y,f){return typeof c=="function"?c=s.decorateType(c).name:c&&typeof c=="object"&&(c=s.decorateEnum(c).name),function(v,m){s.decorateType(v.constructor).add(new u(m,n,c,y,{default:f}))}},u.c=function(n){i=n}},{14:14,22:22,32:32,33:33}],16:[function(t,a,l){var i=a.exports=t(17);i.build="light",i.load=function(d,p,h){return(p=typeof p=="function"?(h=p,new i.Root):p||new i.Root).load(d,h)},i.loadSync=function(d,p){return(p=p||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,a,l){var i=l;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,a,l){a.exports=h;var i=t(15),d=(((h.prototype=Object.create(i.prototype)).constructor=h).className="MapField",t(32)),p=t(33);function h(s,o,u,n,c,y){if(i.call(this,s,o,n,w,w,c,y),!p.isString(u))throw TypeError("keyType must be a string");this.keyType=u,this.resolvedKeyType=null,this.map=!0}h.fromJSON=function(s,o){return new h(s,o.id,o.keyType,o.type,o.options,o.comment)},h.prototype.toJSON=function(s){return s=!!s&&!!s.keepComments,p.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",s?this.comment:w])},h.prototype.resolve=function(){if(this.resolved)return this;if(d.mapKey[this.keyType]===w)throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},h.d=function(s,o,u){return typeof u=="function"?u=p.decorateType(u).name:u&&typeof u=="object"&&(u=p.decorateEnum(u).name),function(n,c){p.decorateType(n.constructor).add(new h(c,s,o,u))}}},{15:15,32:32,33:33}],19:[function(t,a,l){a.exports=d;var i=t(35);function d(p){if(p)for(var h=Object.keys(p),s=0;s<h.length;++s){var o=h[s];o!=="__proto__"&&(this[o]=p[o])}}d.create=function(p){return this.$type.create(p)},d.encode=function(p,h){return this.$type.encode(p,h)},d.encodeDelimited=function(p,h){return this.$type.encodeDelimited(p,h)},d.decode=function(p){return this.$type.decode(p)},d.decodeDelimited=function(p){return this.$type.decodeDelimited(p)},d.verify=function(p){return this.$type.verify(p)},d.fromObject=function(p){return this.$type.fromObject(p)},d.toObject=function(p,h){return this.$type.toObject(p,h)},d.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},{35:35}],20:[function(t,a,l){a.exports=p;var i=t(22),d=(((p.prototype=Object.create(i.prototype)).constructor=p).className="Method",t(33));function p(h,s,o,u,n,c,y,f,v){if(d.isObject(n)?(y=n,n=c=w):d.isObject(c)&&(y=c,c=w),s!==w&&!d.isString(s))throw TypeError("type must be a string");if(!d.isString(o))throw TypeError("requestType must be a string");if(!d.isString(u))throw TypeError("responseType must be a string");i.call(this,h,y),this.type=s||"rpc",this.requestType=o,this.requestStream=!!n||w,this.responseType=u,this.responseStream=!!c||w,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=f,this.parsedOptions=v}p.fromJSON=function(h,s){return new p(h,s.type,s.requestType,s.responseType,s.requestStream,s.responseStream,s.options,s.comment,s.parsedOptions)},p.prototype.toJSON=function(h){return h=!!h&&!!h.keepComments,d.toObject(["type",this.type!=="rpc"&&this.type||w,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",h?this.comment:w,"parsedOptions",this.parsedOptions])},p.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),i.prototype.resolve.call(this))}},{22:22,33:33}],21:[function(t,a,l){a.exports=c;var i,d,p,h=t(22),s=(((c.prototype=Object.create(h.prototype)).constructor=c).className="Namespace",t(15)),o=t(33),u=t(23);function n(f,v){if(!f||!f.length)return w;for(var m={},_=0;_<f.length;++_)m[f[_].name]=f[_].toJSON(v);return m}function c(f,v){h.call(this,f,v),this.nested=w,this.a=null,this.l=Object.create(null),this.p=!0,this.b=!0}function y(f){f.a=null,f.l=Object.create(null);for(var v=f;v=v.parent;)v.l=Object.create(null);return f}c.fromJSON=function(f,v){return new c(f,v.options).addJSON(v.nested)},c.arrayToJSON=n,c.isReservedId=function(f,v){if(f){for(var m=0;m<f.length;++m)if(typeof f[m]!="string"&&f[m][0]<=v&&f[m][1]>v)return!0}return!1},c.isReservedName=function(f,v){if(f){for(var m=0;m<f.length;++m)if(f[m]===v)return!0}return!1},Object.defineProperty(c.prototype,"nestedArray",{get:function(){return this.a||(this.a=o.toArray(this.nested))}}),c.prototype.toJSON=function(f){return o.toObject(["options",this.options,"nested",n(this.nestedArray,f)])},c.prototype.addJSON=function(f){if(f)for(var v,m=Object.keys(f),_=0;_<m.length;++_)v=f[m[_]],this.add((v.fields!==w?i:v.values!==w?p:v.methods!==w?d:v.id!==w?s:c).fromJSON(m[_],v));return this},c.prototype.get=function(f){return this.nested&&Object.prototype.hasOwnProperty.call(this.nested,f)?this.nested[f]:null},c.prototype.getEnum=function(f){if(this.nested&&Object.prototype.hasOwnProperty.call(this.nested,f)&&this.nested[f]instanceof p)return this.nested[f].values;throw Error("no such enum: "+f)},c.prototype.add=function(f){if(!(f instanceof s&&f.extend!==w||f instanceof i||f instanceof u||f instanceof p||f instanceof d||f instanceof c))throw TypeError("object must be a valid nested object");if(f.name==="__proto__")return this;if(this.nested){var v=this.get(f.name);if(v){if(!(v instanceof c&&f instanceof c)||v instanceof i||v instanceof d)throw Error("duplicate name '"+f.name+"' in "+this);for(var m=v.nestedArray,_=0;_<m.length;++_)f.add(m[_]);this.remove(v),this.nested||(this.nested={}),f.setOptions(v.options,!0)}}else this.nested={};this.nested[f.name]=f,this instanceof i||this instanceof d||this instanceof p||this instanceof s||f.e||(f.e=f.u),this.p=!0,this.b=!0;for(var A=this;A=A.parent;)A.p=!0,A.b=!0;return f.onAdd(this),y(this)},c.prototype.remove=function(f){if(!(f instanceof h))throw TypeError("object must be a ReflectionObject");if(f.parent!==this)throw Error(f+" is not a member of "+this);return delete this.nested[f.name],Object.keys(this.nested).length||(this.nested=w),f.onRemove(this),y(this)},c.prototype.define=function(f,v){if(o.isString(f))f=f.split(".");else if(!Array.isArray(f))throw TypeError("illegal path");if(f&&f.length&&f[0]==="")throw Error("path must be relative");for(var m=this;0<f.length;){var _=f.shift();if(m.nested&&m.nested[_]){if(!((m=m.nested[_])instanceof c))throw Error("path conflicts with non-namespace objects")}else m.add(m=new c(_))}return v&&m.addJSON(v),m},c.prototype.resolveAll=function(){if(this.b){this.v(this.e);var f=this.nestedArray,v=0;for(this.resolve();v<f.length;)f[v]instanceof c?f[v++].resolveAll():f[v++].resolve();this.b=!1}return this},c.prototype.v=function(f){return this.p&&(this.p=!1,f=this.e||f,h.prototype.v.call(this,f),this.nestedArray.forEach(v=>{v.v(f)})),this},c.prototype.lookup=function(f,v,m){if(typeof v=="boolean"?(m=v,v=w):v&&!Array.isArray(v)&&(v=[v]),o.isString(f)&&f.length){if(f===".")return this.root;f=f.split(".")}else if(!f.length)return this;var _=f.join(".");if(f[0]==="")return this.root.lookup(f.slice(1),v);var A=this.root.y&&this.root.y["."+_];if(A&&(!v||~v.indexOf(A.constructor))||(A=this.w(f,_))&&(!v||~v.indexOf(A.constructor)))return A;if(!m)for(var g=this;g.parent;){if((A=g.parent.w(f,_))&&(!v||~v.indexOf(A.constructor)))return A;g=g.parent}return null},c.prototype.w=function(f,v){if(Object.prototype.hasOwnProperty.call(this.l,v))return this.l[v];var m=this.get(f[0]),_=null;if(m)f.length===1?_=m:m instanceof c&&(f=f.slice(1),_=m.w(f,f.join(".")));else for(var A=0;A<this.nestedArray.length;++A)this.a[A]instanceof c&&(m=this.a[A].w(f,v))&&(_=m);return this.l[v]=_},c.prototype.lookupType=function(f){var v=this.lookup(f,[i]);if(v)return v;throw Error("no such type: "+f)},c.prototype.lookupEnum=function(f){var v=this.lookup(f,[p]);if(v)return v;throw Error("no such Enum '"+f+"' in "+this)},c.prototype.lookupTypeOrEnum=function(f){var v=this.lookup(f,[i,p]);if(v)return v;throw Error("no such Type or Enum '"+f+"' in "+this)},c.prototype.lookupService=function(f){var v=this.lookup(f,[d]);if(v)return v;throw Error("no such Service '"+f+"' in "+this)},c.c=function(f,v,m){i=f,d=v,p=m}},{15:15,22:22,23:23,33:33}],22:[function(t,a,l){(a.exports=u).className="ReflectionObject";const i=t(23);var d,p=t(33),h={enum_type:"OPEN",field_presence:"EXPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"},s={enum_type:"CLOSED",field_presence:"EXPLICIT",json_format:"LEGACY_BEST_EFFORT",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"EXPANDED",utf8_validation:"NONE"},o={enum_type:"OPEN",field_presence:"IMPLICIT",json_format:"ALLOW",message_encoding:"LENGTH_PREFIXED",repeated_field_encoding:"PACKED",utf8_validation:"VERIFY"};function u(n,c){if(!p.isString(n))throw TypeError("name must be a string");if(c&&!p.isObject(c))throw TypeError("options must be an object");this.options=c,this.parsedOptions=null,this.name=n,this.e=null,this.u="proto2",this.o={},this.g=!1,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(u.prototype,{root:{get:function(){for(var n=this;n.parent!==null;)n=n.parent;return n}},fullName:{get:function(){for(var n=[this.name],c=this.parent;c;)n.unshift(c.name),c=c.parent;return n.join(".")}}}),u.prototype.toJSON=function(){throw Error()},u.prototype.onAdd=function(n){this.parent&&this.parent!==n&&this.parent.remove(this),this.parent=n,this.resolved=!1,n=n.root,n instanceof d&&n.j(this)},u.prototype.onRemove=function(n){n=n.root,n instanceof d&&n.O(this),this.parent=null,this.resolved=!1},u.prototype.resolve=function(){return this.resolved||this.root instanceof d&&(this.resolved=!0),this},u.prototype.v=function(n){return this.r(this.e||n)},u.prototype.r=function(n){if(!this.g){var c={};if(!n)throw Error("Unknown edition for "+this.fullName);var y=Object.assign(this.options?Object.assign({},this.options.features):{},this.f(n));if(this.e){if(n==="proto2")c=Object.assign({},s);else if(n==="proto3")c=Object.assign({},o);else{if(n!=="2023")throw Error("Unknown edition: "+n);c=Object.assign({},h)}this.o=Object.assign(c,y||{})}else{if(this.partOf instanceof i)n=Object.assign({},this.partOf.o),this.o=Object.assign(n,y||{});else if(!this.declaringField){if(!this.parent)throw Error("Unable to find a parent for "+this.fullName);c=Object.assign({},this.parent.o),this.o=Object.assign(c,y||{})}this.extensionField&&(this.extensionField.o=this.o)}this.g=!0}},u.prototype.f=function(){return{}},u.prototype.getOption=function(n){return this.options?this.options[n]:w},u.prototype.setOption=function(n,c,y){return n!=="__proto__"&&(this.options||(this.options={}),/^features\./.test(n)?p.setProperty(this.options,n,c,y):y&&this.options[n]!==w||(this.getOption(n)!==c&&(this.resolved=!1),this.options[n]=c)),this},u.prototype.setParsedOption=function(n,c,y){var f,v,m;return n!=="__proto__"&&(this.parsedOptions||(this.parsedOptions=[]),f=this.parsedOptions,y?(v=f.find(function(_){return Object.prototype.hasOwnProperty.call(_,n)}))?(m=v[n],p.setProperty(m,y,c)):((v={})[n]=p.setProperty({},y,c),f.push(v)):((m={})[n]=c,f.push(m))),this},u.prototype.setOptions=function(n,c){if(n)for(var y=Object.keys(n),f=0;f<y.length;++f)this.setOption(y[f],n[y[f]],c);return this},u.prototype.toString=function(){var n=this.constructor.className,c=this.fullName;return c.length?n+" "+c:n},u.prototype.h=function(){return this.e&&this.e!=="proto3"?this.e:w},u.c=function(n){d=n}},{23:23,33:33}],23:[function(t,a,l){a.exports=h;var i=t(22),d=(((h.prototype=Object.create(i.prototype)).constructor=h).className="OneOf",t(15)),p=t(33);function h(o,u,n,c){if(Array.isArray(u)||(n=u,u=w),i.call(this,o,n),u!==w&&!Array.isArray(u))throw TypeError("fieldNames must be an Array");this.oneof=u||[],this.fieldsArray=[],this.comment=c}function s(o){if(o.parent)for(var u=0;u<o.fieldsArray.length;++u)o.fieldsArray[u].parent||o.parent.add(o.fieldsArray[u])}h.fromJSON=function(o,u){return new h(o,u.oneof,u.options,u.comment)},h.prototype.toJSON=function(o){return o=!!o&&!!o.keepComments,p.toObject(["options",this.options,"oneof",this.oneof,"comment",o?this.comment:w])},h.prototype.add=function(o){if(o instanceof d)return o.parent&&o.parent!==this.parent&&o.parent.remove(o),this.oneof.push(o.name),this.fieldsArray.push(o),s(o.partOf=this),this;throw TypeError("field must be a Field")},h.prototype.remove=function(o){if(!(o instanceof d))throw TypeError("field must be a Field");var u=this.fieldsArray.indexOf(o);if(u<0)throw Error(o+" is not a member of "+this);return this.fieldsArray.splice(u,1),-1<(u=this.oneof.indexOf(o.name))&&this.oneof.splice(u,1),o.partOf=null,this},h.prototype.onAdd=function(o){i.prototype.onAdd.call(this,o);for(var u=0;u<this.oneof.length;++u){var n=o.get(this.oneof[u]);n&&!n.partOf&&(n.partOf=this).fieldsArray.push(n)}s(this)},h.prototype.onRemove=function(o){for(var u,n=0;n<this.fieldsArray.length;++n)(u=this.fieldsArray[n]).parent&&u.parent.remove(u);i.prototype.onRemove.call(this,o)},Object.defineProperty(h.prototype,"isProto3Optional",{get:function(){var o;return this.fieldsArray!=null&&this.fieldsArray.length===1&&(o=this.fieldsArray[0]).options!=null&&o.options.proto3_optional===!0}}),h.d=function(){for(var o=Array(arguments.length),u=0;u<arguments.length;)o[u]=arguments[u++];return function(n,c){p.decorateType(n.constructor).add(new h(c,o)),Object.defineProperty(n,c,{get:p.oneOfGetter(o),set:p.oneOfSetter(o)})}}},{15:15,22:22,33:33}],24:[function(t,a,l){a.exports=o;var i,d=t(35),p=d.LongBits,h=d.utf8;function s(m,_){return RangeError("index out of range: "+m.pos+" + "+(_||1)+" > "+m.len)}function o(m){this.buf=m,this.pos=0,this.len=m.length}function u(){return d.Buffer?function(m){return(o.create=function(_){return d.Buffer.isBuffer(_)?new i(_):c(_)})(m)}:c}var n,c=typeof Uint8Array!="undefined"?function(m){if(m instanceof Uint8Array||Array.isArray(m))return new o(m);throw Error("illegal buffer")}:function(m){if(Array.isArray(m))return new o(m);throw Error("illegal buffer")};function y(){var m=new p(0,0),_=0;if(!(4<this.len-this.pos)){for(;_<3;++_){if(this.pos>=this.len)throw s(this);if(m.lo=(m.lo|(127&this.buf[this.pos])<<7*_)>>>0,this.buf[this.pos++]<128)return m}return m.lo=(m.lo|(127&this.buf[this.pos++])<<7*_)>>>0,m}for(;_<4;++_)if(m.lo=(m.lo|(127&this.buf[this.pos])<<7*_)>>>0,this.buf[this.pos++]<128)return m;if(m.lo=(m.lo|(127&this.buf[this.pos])<<28)>>>0,m.hi=(m.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return m;if(_=0,4<this.len-this.pos){for(;_<5;++_)if(m.hi=(m.hi|(127&this.buf[this.pos])<<7*_+3)>>>0,this.buf[this.pos++]<128)return m}else for(;_<5;++_){if(this.pos>=this.len)throw s(this);if(m.hi=(m.hi|(127&this.buf[this.pos])<<7*_+3)>>>0,this.buf[this.pos++]<128)return m}throw Error("invalid varint encoding")}function f(m,_){return(m[_-4]|m[_-3]<<8|m[_-2]<<16|m[_-1]<<24)>>>0}function v(){if(this.pos+8>this.len)throw s(this,8);return new p(f(this.buf,this.pos+=4),f(this.buf,this.pos+=4))}o.create=u(),o.prototype.k=d.Array.prototype.subarray||d.Array.prototype.slice,o.prototype.uint32=(n=4294967295,function(){if(n=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128||(n=(n|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128||(n=(n|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128||(n=(n|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128||(n=(n|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128||!((this.pos+=5)>this.len))))))return n;throw this.pos=this.len,s(this,10)}),o.prototype.int32=function(){return 0|this.uint32()},o.prototype.sint32=function(){var m=this.uint32();return m>>>1^-(1&m)|0},o.prototype.bool=function(){return this.uint32()!==0},o.prototype.fixed32=function(){if(this.pos+4>this.len)throw s(this,4);return f(this.buf,this.pos+=4)},o.prototype.sfixed32=function(){if(this.pos+4>this.len)throw s(this,4);return 0|f(this.buf,this.pos+=4)},o.prototype.float=function(){if(this.pos+4>this.len)throw s(this,4);var m=d.float.readFloatLE(this.buf,this.pos);return this.pos+=4,m},o.prototype.double=function(){if(this.pos+8>this.len)throw s(this,4);var m=d.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,m},o.prototype.bytes=function(){var m=this.uint32(),_=this.pos,A=this.pos+m;if(A>this.len)throw s(this,m);return this.pos+=m,Array.isArray(this.buf)?this.buf.slice(_,A):_===A?(m=d.Buffer)?m.alloc(0):new this.buf.constructor(0):this.k.call(this.buf,_,A)},o.prototype.string=function(){var m=this.bytes();return h.read(m,0,m.length)},o.prototype.skip=function(m){if(typeof m=="number"){if(this.pos+m>this.len)throw s(this,m);this.pos+=m}else do if(this.pos>=this.len)throw s(this);while(128&this.buf[this.pos++]);return this},o.recursionLimit=d.recursionLimit,o.prototype.skipType=function(m,_){if(o.recursionLimit<(_=_===w?0:_))throw Error("maximum nesting depth exceeded");switch(m){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(m=7&this.uint32())!=4;)this.skipType(m,_+1);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+m+" at offset "+this.pos)}return this},o.c=function(m){i=m,o.create=u(),i.c();var _=d.Long?"toLong":"toNumber";d.merge(o.prototype,{int64:function(){return y.call(this)[_](!1)},uint64:function(){return y.call(this)[_](!0)},sint64:function(){return y.call(this).zzDecode()[_](!1)},fixed64:function(){return v.call(this)[_](!0)},sfixed64:function(){return v.call(this)[_](!1)}})}},{35:35}],25:[function(t,a,l){a.exports=p;var i=t(24),d=((p.prototype=Object.create(i.prototype)).constructor=p,t(35));function p(h){i.call(this,h)}p.c=function(){d.Buffer&&(p.prototype.k=d.Buffer.prototype.slice)},p.prototype.string=function(){var h=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+h,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+h,this.len))},p.c()},{24:24,35:35}],26:[function(t,a,l){a.exports=c;var i,d,p,h=t(21),s=(((c.prototype=Object.create(h.prototype)).constructor=c).className="Root",t(15)),o=t(14),u=t(23),n=t(33);function c(m){h.call(this,"",m),this.deferred=[],this.files=[],this.e="proto2",this.y={}}function y(){}c.fromJSON=function(m,_){return _=_||new c,m.options&&_.setOptions(m.options),_.addJSON(m.nested).resolveAll()},c.prototype.resolvePath=n.path.resolve,c.prototype.fetch=n.fetch,c.prototype.load=function m(_,A,g){typeof A=="function"&&(g=A,A=w);var S=this;if(!g)return n.asPromise(m,S,_,A);var b=g===y;function k(I,x){if(g){if(b)throw I;x&&x.resolveAll();var P=g;g=null,P(I,x)}}function N(I){var x=I.lastIndexOf("google/protobuf/");return-1<x&&(I=I.substring(x),I in p)?I:null}function j(I,x){try{if(n.isString(x)&&(x[0]||"")=="{"&&(x=JSON.parse(x)),n.isString(x)){d.filename=I;var P,R=d(x,S,A),F=0;if(R.imports)for(;F<R.imports.length;++F)(P=N(R.imports[F])||S.resolvePath(I,R.imports[F]))&&L(P);if(R.weakImports)for(F=0;F<R.weakImports.length;++F)(P=N(R.weakImports[F])||S.resolvePath(I,R.weakImports[F]))&&L(P,!0)}else S.setOptions(x.options).addJSON(x.nested)}catch(te){k(te)}b||H||k(null,S)}function L(I,x){if(I=N(I)||I,!~S.files.indexOf(I))if(S.files.push(I),I in p)b?j(I,p[I]):(++H,setTimeout(function(){--H,j(I,p[I])}));else if(b){var P;try{P=n.fs.readFileSync(I).toString("utf8")}catch(R){return void(x||k(R))}j(I,P)}else++H,S.fetch(I,function(R,F){--H,g&&(R?x?H||k(null,S):k(R):j(I,F))})}var H=0;n.isString(_)&&(_=[_]);for(var T,O=0;O<_.length;++O)(T=S.resolvePath("",_[O]))&&L(T);return b?S.resolveAll():H||k(null,S),S},c.prototype.loadSync=function(m,_){if(n.isNode)return this.load(m,_,y);throw Error("not supported")},c.prototype.resolveAll=function(){if(!this.b)return this;if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map(function(m){return"'extend "+m.extend+"' in "+m.parent.fullName}).join(", "));return h.prototype.resolveAll.call(this)};var f=/^[A-Z]/;function v(m,_){var A,g=_.parent.lookup(_.extend);if(g)return A=new s(_.fullName,_.id,_.type,_.rule,w,_.options),g.get(A.name)||((A.declaringField=_).extensionField=A,g.add(A)),1}c.prototype.j=function(m){if(m instanceof s)m.extend===w||m.extensionField||v(0,m)||this.deferred.push(m);else if(m instanceof o)f.test(m.name)&&(m.parent[m.name]=m.values);else if(!(m instanceof u)){if(m instanceof i)for(var _=0;_<this.deferred.length;)v(0,this.deferred[_])?this.deferred.splice(_,1):++_;for(var A=0;A<m.nestedArray.length;++A)this.j(m.a[A]);f.test(m.name)&&(m.parent[m.name]=m)}(m instanceof i||m instanceof o||m instanceof s)&&(this.y[m.fullName]=m)},c.prototype.O=function(m){var _;if(m instanceof s)m.extend!==w&&(m.extensionField?(m.extensionField.parent.remove(m.extensionField),m.extensionField=null):-1<(_=this.deferred.indexOf(m))&&this.deferred.splice(_,1));else if(m instanceof o)f.test(m.name)&&delete m.parent[m.name];else if(m instanceof h){for(var A=0;A<m.nestedArray.length;++A)this.O(m.a[A]);f.test(m.name)&&delete m.parent[m.name]}delete this.y[m.fullName]},c.c=function(m,_,A){i=m,d=_,p=A}},{14:14,15:15,21:21,23:23,33:33}],27:[function(t,a,l){a.exports={}},{}],28:[function(t,a,l){l.Service=t(29)},{29:29}],29:[function(t,a,l){a.exports=d;var i=t(35);function d(p,h,s){if(typeof p!="function")throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=p,this.requestDelimited=!!h,this.responseDelimited=!!s}((d.prototype=Object.create(i.EventEmitter.prototype)).constructor=d).prototype.rpcCall=function p(h,s,o,u,n){if(!u)throw TypeError("request must be specified");var c=this;if(!n)return i.asPromise(p,c,h,s,o,u);if(!c.rpcImpl)return setTimeout(function(){n(Error("already ended"))},0),w;try{return c.rpcImpl(h,s[c.requestDelimited?"encodeDelimited":"encode"](u).finish(),function(y,f){if(y)return c.emit("error",y,h),n(y);if(f===null)return c.end(!0),w;if(!(f instanceof o))try{f=o[c.responseDelimited?"decodeDelimited":"decode"](f)}catch(v){return c.emit("error",v,h),n(v)}return c.emit("data",f,h),n(null,f)})}catch(y){return c.emit("error",y,h),setTimeout(function(){n(y)},0),w}},d.prototype.end=function(p){return this.rpcImpl&&(p||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},{35:35}],30:[function(t,a,l){a.exports=o;var i=t(21),d=(((o.prototype=Object.create(i.prototype)).constructor=o).className="Service",t(20)),p=t(33),h=t(28),s=p.patterns.reservedRe;function o(n,c){i.call(this,n,c),this.methods={},this._=null}function u(n){return n._=null,n}o.fromJSON=function(n,c){var y=new o(n,c.options);if(c.methods)for(var f=Object.keys(c.methods),v=0;v<f.length;++v)y.add(d.fromJSON(f[v],c.methods[f[v]]));return c.nested&&y.addJSON(c.nested),c.edition&&(y.e=c.edition),y.comment=c.comment,y.u="proto3",y},o.prototype.toJSON=function(n){var c=i.prototype.toJSON.call(this,n),y=!!n&&!!n.keepComments;return p.toObject(["edition",this.h(),"options",c&&c.options||w,"methods",i.arrayToJSON(this.methodsArray,n)||{},"nested",c&&c.nested||w,"comment",y?this.comment:w])},Object.defineProperty(o.prototype,"methodsArray",{get:function(){return this._||(this._=p.toArray(this.methods))}}),o.prototype.get=function(n){return Object.prototype.hasOwnProperty.call(this.methods,n)?this.methods[n]:i.prototype.get.call(this,n)},o.prototype.resolveAll=function(){if(this.b){i.prototype.resolve.call(this);for(var n=this.methodsArray,c=0;c<n.length;++c)n[c].resolve()}return this},o.prototype.v=function(n){return this.p&&(n=this.e||n,i.prototype.v.call(this,n),this.methodsArray.forEach(c=>{c.v(n)})),this},o.prototype.add=function(n){if(this.get(n.name))throw Error("duplicate name '"+n.name+"' in "+this);return n instanceof d?n.name==="__proto__"?this:u((this.methods[n.name]=n).parent=this):i.prototype.add.call(this,n)},o.prototype.remove=function(n){if(n instanceof d){if(this.methods[n.name]!==n)throw Error(n+" is not a member of "+this);return delete this.methods[n.name],n.parent=null,u(this)}return i.prototype.remove.call(this,n)},o.prototype.create=function(n,c,y){for(var f,v=new h.Service(n,c,y),m=0;m<this.methodsArray.length;++m){var _=p.lcFirst((f=this._[m]).resolve().name).replace(/[^$\w_]/g,"");v[_]=p.codegen(["r","c"],s.test(_)?_+"_":_)("return this.rpcCall(m,q,s,r,c)")({m:f,q:f.resolvedRequestType.ctor,s:f.resolvedResponseType.ctor})}return v}},{20:20,21:21,28:28,33:33}],31:[function(t,a,l){a.exports=g;var i=t(21),d=(((g.prototype=Object.create(i.prototype)).constructor=g).className="Type",t(14)),p=t(23),h=t(15),s=t(18),o=t(30),u=t(19),n=t(24),c=t(39),y=t(33),f=t(13),v=t(12),m=t(37),_=t(11),A=t(38);function g(b,k){b=b.replace(/\W/g,""),i.call(this,b,k),this.fields={},this.oneofs=w,this.extensions=w,this.reserved=w,this.group=w,this.A=null,this.i=null,this.T=null,this.x=null}function S(b){return b.A=b.i=b.T=null,delete b.encode,delete b.decode,delete b.verify,b}Object.defineProperties(g.prototype,{fieldsById:{get:function(){if(!this.A){this.A={};for(var b=Object.keys(this.fields),k=0;k<b.length;++k){var N=this.fields[b[k]],j=N.id;if(this.A[j])throw Error("duplicate id "+j+" in "+this);this.A[j]=N}}return this.A}},fieldsArray:{get:function(){return this.i||(this.i=y.toArray(this.fields))}},oneofsArray:{get:function(){return this.T||(this.T=y.toArray(this.oneofs))}},ctor:{get:function(){return this.x||(this.ctor=g.generateConstructor(this)())},set:function(b){for(var k=b.prototype,N=(k instanceof u||((b.prototype=new u).constructor=b,y.merge(b.prototype,k)),b.$type=b.prototype.$type=this,y.merge(b,u,!0),this.x=b,0);N<this.fieldsArray.length;++N)this.i[N].resolve();for(var j={},N=0;N<this.oneofsArray.length;++N)j[this.T[N].resolve().name]={get:y.oneOfGetter(this.T[N].oneof),set:y.oneOfSetter(this.T[N].oneof)};N&&Object.defineProperties(b.prototype,j)}}}),g.generateConstructor=function(b){for(var k,N=y.codegen(["p"],b.name),j=0;j<b.fieldsArray.length;++j)(k=b.i[j]).map?N("this%s={}",y.safeProp(k.name)):k.repeated&&N("this%s=[]",y.safeProp(k.name));return N('if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null&&ks[i]!=="__proto__")')("this[ks[i]]=p[ks[i]]")},g.fromJSON=function(b,k){for(var N=new g(b,k.options),j=(N.extensions=k.extensions,N.reserved=k.reserved,Object.keys(k.fields)),L=0;L<j.length;++L)N.add((k.fields[j[L]].keyType!==void 0?s:h).fromJSON(j[L],k.fields[j[L]]));if(k.oneofs)for(j=Object.keys(k.oneofs),L=0;L<j.length;++L)N.add(p.fromJSON(j[L],k.oneofs[j[L]]));if(k.nested)for(j=Object.keys(k.nested),L=0;L<j.length;++L){var H=k.nested[j[L]];N.add((H.id!==w?h:H.fields!==w?g:H.values!==w?d:H.methods!==w?o:i).fromJSON(j[L],H))}return k.extensions&&k.extensions.length&&(N.extensions=k.extensions),k.reserved&&k.reserved.length&&(N.reserved=k.reserved),k.group&&(N.group=!0),k.comment&&(N.comment=k.comment),k.edition&&(N.e=k.edition),N.u="proto3",N},g.prototype.toJSON=function(b){var k=i.prototype.toJSON.call(this,b),N=!!b&&!!b.keepComments;return y.toObject(["edition",this.h(),"options",k&&k.options||w,"oneofs",i.arrayToJSON(this.oneofsArray,b),"fields",i.arrayToJSON(this.fieldsArray.filter(function(j){return!j.declaringField}),b)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:w,"reserved",this.reserved&&this.reserved.length?this.reserved:w,"group",this.group||w,"nested",k&&k.nested||w,"comment",N?this.comment:w])},g.prototype.resolveAll=function(){if(this.b){i.prototype.resolveAll.call(this);for(var b=this.oneofsArray,k=0;k<b.length;)b[k++].resolve();for(var N=this.fieldsArray,k=0;k<N.length;)N[k++].resolve()}return this},g.prototype.v=function(b){return this.p&&(b=this.e||b,i.prototype.v.call(this,b),this.oneofsArray.forEach(k=>{k.r(b)}),this.fieldsArray.forEach(k=>{k.r(b)})),this},g.prototype.get=function(b){return Object.prototype.hasOwnProperty.call(this.fields,b)?this.fields[b]:this.oneofs&&Object.prototype.hasOwnProperty.call(this.oneofs,b)?this.oneofs[b]:this.nested&&Object.prototype.hasOwnProperty.call(this.nested,b)?this.nested[b]:null},g.prototype.add=function(b){if(this.get(b.name))throw Error("duplicate name '"+b.name+"' in "+this);if(b instanceof h&&b.extend===w){if((this.A||this.fieldsById)[b.id])throw Error("duplicate id "+b.id+" in "+this);if(this.isReservedId(b.id))throw Error("id "+b.id+" is reserved in "+this);if(this.isReservedName(b.name))throw Error("name '"+b.name+"' is reserved in "+this);return b.name==="__proto__"?this:(b.parent&&b.parent.remove(b),(this.fields[b.name]=b).message=this,b.onAdd(this),S(this))}return b instanceof p?b.name==="__proto__"?this:(this.oneofs||(this.oneofs={}),(this.oneofs[b.name]=b).onAdd(this),S(this)):i.prototype.add.call(this,b)},g.prototype.remove=function(b){if(b instanceof h&&b.extend===w){if(this.fields&&this.fields[b.name]===b)return delete this.fields[b.name],b.parent=null,b.onRemove(this),S(this);throw Error(b+" is not a member of "+this)}if(b instanceof p){if(this.oneofs&&this.oneofs[b.name]===b)return delete this.oneofs[b.name],b.parent=null,b.onRemove(this),S(this);throw Error(b+" is not a member of "+this)}return i.prototype.remove.call(this,b)},g.prototype.isReservedId=function(b){return i.isReservedId(this.reserved,b)},g.prototype.isReservedName=function(b){return i.isReservedName(this.reserved,b)},g.prototype.create=function(b){return new this.ctor(b)},g.prototype.setup=function(){for(var j=this.fullName,b=[],k=0;k<this.fieldsArray.length;++k)b.push(this.i[k].resolve().resolvedType);this.encode=f(this)({Writer:c,types:b,util:y}),this.decode=v(this)({Reader:n,types:b,util:y}),this.verify=m(this)({types:b,util:y}),this.fromObject=_.fromObject(this)({types:b,util:y}),this.toObject=_.toObject(this)({types:b,util:y});var N,j=A[j];return j&&((N=Object.create(this)).fromObject=this.fromObject,this.fromObject=j.fromObject.bind(N),N.toObject=this.toObject,this.toObject=j.toObject.bind(N)),this},g.prototype.encode=function(b,k){return this.setup().encode(b,k)},g.prototype.encodeDelimited=function(b,k){return this.encode(b,k&&k.len?k.fork():k).ldelim()},g.prototype.decode=function(b,k,N,j){return this.setup().decode(b,k,N,j)},g.prototype.decodeDelimited=function(b){return b instanceof n||(b=n.create(b)),this.decode(b,b.uint32())},g.prototype.verify=function(b,k){return this.setup().verify(b,k)},g.prototype.fromObject=function(b,k){return this.setup().fromObject(b,k)},g.prototype.toObject=function(b,k){return this.setup().toObject(b,k)},g.d=function(b){return function(k){y.decorateType(k,b)}}},{11:11,12:12,13:13,14:14,15:15,18:18,19:19,21:21,23:23,24:24,30:30,33:33,37:37,38:38,39:39}],32:[function(i,a,l){var i=i(33),d=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function p(h,s){var o=0,u=Object.create(null);for(s|=0;o<h.length;)u[d[o+s]]=h[o++];return u}l.basic=p([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),l.defaults=p([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",i.emptyArray,null]),l.long=p([0,0,0,1,1],7),l.mapKey=p([0,0,0,5,5,0,0,0,1,1,0,2],2),l.packed=p([1,5,0,0,0,5,5,0,0,0,1,1,0])},{33:33}],33:[function(t,a,l){var i,d,p=a.exports=t(35),h=t(27),s=(p.codegen=t(3),p.fetch=t(5),p.path=t(8),p.patterns=t(36),p.patterns.reservedRe),o=p.patterns.unsafePropertyRe,u=(p.fs=p.inquire("fs"),p.toArray=function(c){if(c){for(var y=Object.keys(c),f=Array(y.length),v=0;v<y.length;)f[v]=c[y[v++]];return f}return[]},p.toObject=function(c){for(var y={},f=0;f<c.length;){var v=c[f++],m=c[f++];m!==w&&(y[v]=m)}return y},p.isReserved=function(c){return s.test(c)},p.safeProp=function(c){return!/^[$\w_]+$/.test(c)||s.test(c)?"["+JSON.stringify(c)+"]":"."+c},p.ucFirst=function(c){return(c[0]||"").toUpperCase()+c.substring(1)},/_([a-z])/g),n=(p.camelCase=function(c){return c.substring(0,1)+c.substring(1).replace(u,function(y,f){return f.toUpperCase()})},p.compareFieldsById=function(c,y){return c.id-y.id},p.decorateType=function(c,y){return c.$type?(y&&c.$type.name!==y&&(p.decorateRoot.remove(c.$type),c.$type.name=y,p.decorateRoot.add(c.$type)),c.$type):(y=new(i=i||t(31))(y||c.name),p.decorateRoot.add(y),y.ctor=c,Object.defineProperty(c,"$type",{value:y,enumerable:!1}),Object.defineProperty(c.prototype,"$type",{value:y,enumerable:!1}),y)},0);p.decorateEnum=function(c){var y;return c.$type||(y=new(d=d||t(14))("Enum"+n++,c),p.decorateRoot.add(y),Object.defineProperty(c,"$type",{value:y,enumerable:!1}),y)},p.setProperty=function(c,y,f,v){if(typeof c!="object")throw TypeError("dst must be an object");if(y)return(function m(_,A,g){var S=A.shift();if(!o.test(S))if(0<A.length)_[S]=m(_[S]||{},A,g);else{if((A=_[S])&&v)return _;A&&(g=[].concat(A).concat(g)),_[S]=g}return _})(c,y=y.split("."),f);throw TypeError("path must be specified")},Object.defineProperty(p,"decorateRoot",{get:function(){return h.decorated||(h.decorated=new(t(26)))}})},{14:14,26:26,27:27,3:3,31:31,35:35,36:36,5:5,8:8}],34:[function(t,a,l){a.exports=d;var i=t(35);function d(s,o){this.lo=s>>>0,this.hi=o>>>0}var p=d.zero=new d(0,0),h=(p.toNumber=function(){return 0},p.zzEncode=p.zzDecode=function(){return this},p.length=function(){return 1},d.zeroHash="\0\0\0\0\0\0\0\0",d.fromNumber=function(s){var o,u;return s===0?p:(u=(s=(o=s<0)?-s:s)>>>0,s=(s-u)/4294967296>>>0,o&&(s=~s>>>0,u=~u>>>0,4294967295<++u&&(u=0,4294967295<++s&&(s=0))),new d(u,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):p},d.prototype.toNumber=function(s){var o;return!s&&this.hi>>>31?(s=1+~this.lo>>>0,o=~this.hi>>>0,-(s+4294967296*(o=s?o:o+1>>>0))):this.lo+4294967296*this.hi},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"?p:new d((h.call(s,0)|h.call(s,1)<<8|h.call(s,2)<<16|h.call(s,3)<<24)>>>0,(h.call(s,4)|h.call(s,5)<<8|h.call(s,6)<<16|h.call(s,7)<<24)>>>0)},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,o=(this.lo>>>28|this.hi<<4)>>>0,u=this.hi>>>24;return u==0?o==0?s<16384?s<128?1:2:s<2097152?3:4:o<16384?o<128?5:6:o<2097152?7:8:u<128?9:10}},{35:35}],35:[function(t,a,l){var i=l;function d(h,s,o){for(var u=Object.keys(s),n=0;n<u.length;++n)h[u[n]]!==w&&o||u[n]!=="__proto__"&&(h[u[n]]=s[u[n]]);return h}function p(h){function s(o,u){if(!(this instanceof s))return new s(o,u);Object.defineProperty(this,"message",{get:function(){return o}}),Error.captureStackTrace?Error.captureStackTrace(this,s):Object.defineProperty(this,"stack",{value:Error().stack||""}),u&&d(this,u)}return s.prototype=Object.create(Error.prototype,{constructor:{value:s,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return h},set:w,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),s}i.asPromise=t(1),i.base64=t(2),i.EventEmitter=t(4),i.float=t(6),i.inquire=t(7),i.utf8=t(10),i.pool=t(9),i.LongBits=t(34),i.isNode=!!(typeof global!="undefined"&&global&&global.process&&global.process.versions&&global.process.versions.node),i.global=i.isNode&&global||typeof window!="undefined"&&window||typeof self!="undefined"&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(h){return typeof h=="number"&&isFinite(h)&&Math.floor(h)===h},i.isString=function(h){return typeof h=="string"||h instanceof String},i.isObject=function(h){return h&&typeof h=="object"},i.isset=i.isSet=function(h,s){var o=h[s];return o!=null&&h.hasOwnProperty(s)&&(typeof o!="object"||0<(Array.isArray(o)?o:Object.keys(o)).length)},i.Buffer=null,i.S=null,i.L=null,i.newBuffer=function(h){return typeof h=="number"?i.Buffer?i.L(h):new i.Array(h):i.Buffer?i.S(h):typeof Uint8Array=="undefined"?h:new Uint8Array(h)},i.Array=typeof Uint8Array!="undefined"?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(h){return h?i.LongBits.from(h).toHash():i.LongBits.zeroHash},i.longFromHash=function(h,s){return h=i.LongBits.fromHash(h),i.Long?i.Long.fromBits(h.lo,h.hi,s):h.toNumber(!!s)},i.merge=d,i.recursionLimit=100,i.makeProp=function(h,s){Object.defineProperty(h,s,{enumerable:!0,configurable:!0,writable:!0})},i.lcFirst=function(h){return(h[0]||"").toLowerCase()+h.substring(1)},i.newError=p,i.ProtocolError=p("ProtocolError"),i.oneOfGetter=function(h){for(var s={},o=0;o<h.length;++o)s[h[o]]=1;return function(){for(var u=Object.keys(this),n=u.length-1;-1<n;--n)if(s[u[n]]===1&&this[u[n]]!==w&&this[u[n]]!==null)return u[n]}},i.oneOfSetter=function(h){return function(s){for(var o=0;o<h.length;++o)h[o]!==s&&delete this[h[o]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i.c=function(){var h=i.Buffer;h?(i.S=h.from!==Uint8Array.from&&h.from||function(s,o){return new h(s,o)},i.L=h.allocUnsafe||function(s){return new h(s)}):i.S=i.L=null}},{1:1,10:10,2:2,34:34,4:4,6:6,7:7,9:9}],36:[function(t,a,l){l.numberRe=/^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/,l.typeRefRe=/^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/,l.reservedRe=/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/,l.unsafePropertyRe=/^(?:__proto__|prototype|constructor)$/},{}],37:[function(t,a,l){a.exports=function(s){var o=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"),u=s.oneofsArray,n={};u.length&&o("var p={}");for(var c=0;c<s.fieldsArray.length;++c){var y,f=s.i[c].resolve(),v="m"+d.safeProp(f.name);f.optional&&o("if(%s!=null&&m.hasOwnProperty(%j)){",v,f.name),f.map?(o("if(!util.isObject(%s))",v)("return%j",p(f,"object"))("var k=Object.keys(%s)",v)("for(var i=0;i<k.length;++i){"),(function(m,_,A){switch(_.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":m("if(!util.key32Re.test(%s))",A)("return%j",p(_,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":m("if(!util.key64Re.test(%s))",A)("return%j",p(_,"integer|Long key"));break;case"bool":m("if(!util.key2Re.test(%s))",A)("return%j",p(_,"boolean key"))}})(o,f,"k[i]"),h(o,f,c,v+"[k[i]]")("}")):f.repeated?(o("if(!Array.isArray(%s))",v)("return%j",p(f,"array"))("for(var i=0;i<%s.length;++i){",v),h(o,f,c,v+"[i]")("}")):(f.partOf&&(y=d.safeProp(f.partOf.name),n[f.partOf.name]===1&&o("if(p%s===1)",y)("return%j",f.partOf.name+": multiple values"),n[f.partOf.name]=1,o("p%s=1",y)),h(o,f,c,v)),f.optional&&o("}")}return o("return null")};var i=t(14),d=t(33);function p(s,o){return s.name+": "+o+(s.repeated&&o!=="array"?"[]":s.map&&o!=="object"?"{k:"+s.keyType+"}":"")+" expected"}function h(s,o,u,n){if(o.resolvedType)if(o.resolvedType instanceof i){s("switch(%s){",n)("default:")("return%j",p(o,"enum value"));for(var c=Object.keys(o.resolvedType.values),y=0;y<c.length;++y)s("case %i:",o.resolvedType.values[c[y]]);s("break")("}")}else s("{")("var e=types[%i].verify(%s,n+1);",u,n)("if(e)")("return%j+e",o.name+".")("}");else switch(o.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":s("if(!util.isInteger(%s))",n)("return%j",p(o,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":s("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",p(o,"integer|Long"));break;case"float":case"double":s('if(typeof %s!=="number")',n)("return%j",p(o,"number"));break;case"bool":s('if(typeof %s!=="boolean")',n)("return%j",p(o,"boolean"));break;case"string":s("if(!util.isString(%s))",n)("return%j",p(o,"string"));break;case"bytes":s('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",p(o,"buffer"))}return s}},{14:14,33:33}],38:[function(t,a,l){var i=t(19);l[".google.protobuf.Any"]={fromObject:function(d,p){if(d&&d["@type"]){var h,s=d["@type"].substring(1+d["@type"].lastIndexOf("/")),s=this.lookup(s);if(s)return~(h=(d["@type"][0]||"")=="."?d["@type"].slice(1):d["@type"]).indexOf("/")||(h="/"+h),this.create({type_url:h,value:s.encode(s.fromObject(d,p===w?1:p+1)).finish()})}return this.fromObject(d,p)},toObject:function(d,p){var h,s,o="",u="";return p&&p.json&&d.type_url&&d.value&&(u=d.type_url.substring(1+d.type_url.lastIndexOf("/")),o=d.type_url.substring(0,1+d.type_url.lastIndexOf("/")),(h=this.lookup(u))&&(d=h.decode(d.value))),!(d instanceof this.ctor)&&d instanceof i?(h=d.$type.toObject(d,p),s=d.$type.fullName[0]==="."?d.$type.fullName.slice(1):d.$type.fullName,h["@type"]=u=(o=o===""?"type.googleapis.com/":o)+s,h):this.toObject(d,p)}}},{19:19}],39:[function(t,a,l){a.exports=c;var i,d=t(35),p=d.LongBits,h=d.base64,s=d.utf8;function o(g,S,b){this.fn=g,this.len=S,this.next=w,this.val=b}function u(){}function n(g){this.head=g.head,this.tail=g.tail,this.len=g.len,this.next=g.states}function c(){this.len=0,this.head=new o(u,0,0),this.tail=this.head,this.states=null}function y(){return d.Buffer?function(){return(c.create=function(){return new i})()}:function(){return new c}}function f(g,S,b){S[b]=255&g}function v(g,S){this.len=g,this.next=w,this.val=S}function m(g,S,b){for(;g.hi;)S[b++]=127&g.lo|128,g.lo=(g.lo>>>7|g.hi<<25)>>>0,g.hi>>>=7;for(;127<g.lo;)S[b++]=127&g.lo|128,g.lo=g.lo>>>7;S[b++]=g.lo}function _(g,S,b){S[b]=255&g,S[b+1]=g>>>8&255,S[b+2]=g>>>16&255,S[b+3]=g>>>24}c.create=y(),c.alloc=function(g){return new d.Array(g)},d.Array!==Array&&(c.alloc=d.pool(c.alloc,d.Array.prototype.subarray)),c.prototype.N=function(g,S,b){return this.tail=this.tail.next=new o(g,S,b),this.len+=S,this},(v.prototype=Object.create(o.prototype)).fn=function(g,S,b){for(;127<g;)S[b++]=127&g|128,g>>>=7;S[b]=g},c.prototype.uint32=function(g){return this.len+=(this.tail=this.tail.next=new v((g>>>=0)<128?1:g<16384?2:g<2097152?3:g<268435456?4:5,g)).len,this},c.prototype.int32=function(g){return g<0?this.N(m,10,p.fromNumber(g)):this.uint32(g)},c.prototype.sint32=function(g){return this.uint32((g<<1^g>>31)>>>0)},c.prototype.int64=c.prototype.uint64=function(g){return g=p.from(g),this.N(m,g.length(),g)},c.prototype.sint64=function(g){return g=p.from(g).zzEncode(),this.N(m,g.length(),g)},c.prototype.bool=function(g){return this.N(f,1,g?1:0)},c.prototype.sfixed32=c.prototype.fixed32=function(g){return this.N(_,4,g>>>0)},c.prototype.sfixed64=c.prototype.fixed64=function(g){return g=p.from(g),this.N(_,4,g.lo).N(_,4,g.hi)},c.prototype.float=function(g){return this.N(d.float.writeFloatLE,4,g)},c.prototype.double=function(g){return this.N(d.float.writeDoubleLE,8,g)};var A=d.Array.prototype.set?function(g,S,b){S.set(g,b)}:function(g,S,b){for(var k=0;k<g.length;++k)S[b+k]=g[k]};c.prototype.bytes=function(g){var S,b=g.length>>>0;return b?(d.isString(g)&&(S=c.alloc(b=h.length(g)),h.decode(g,S,0),g=S),this.uint32(b).N(A,b,g)):this.N(f,1,0)},c.prototype.string=function(g){var S=s.length(g);return S?this.uint32(S).N(s.write,S,g):this.N(f,1,0)},c.prototype.fork=function(){return this.states=new n(this),this.head=this.tail=new o(u,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new o(u,0,0),this.len=0),this},c.prototype.ldelim=function(){var g=this.head,S=this.tail,b=this.len;return this.reset().uint32(b),b&&(this.tail.next=g.next,this.tail=S,this.len+=b),this},c.prototype.finish=function(){for(var g=this.head.next,S=this.constructor.alloc(this.len),b=0;g;)g.fn(g.val,S,b),b+=g.len,g=g.next;return S},c.c=function(g){i=g,c.create=y(),i.c()}},{35:35}],40:[function(t,a,l){a.exports=p;var i=t(39),d=((p.prototype=Object.create(i.prototype)).constructor=p,t(35));function p(){i.call(this)}function h(s,o,u){s.length<40?d.utf8.write(s,o,u):o.utf8Write?o.utf8Write(s,u):o.write(s,u)}p.c=function(){p.alloc=d.L,p.writeBytesBuffer=d.Buffer&&d.Buffer.prototype instanceof Uint8Array&&d.Buffer.prototype.set.name==="set"?function(s,o,u){o.set(s,u)}:function(s,o,u){if(s.copy)s.copy(o,u,0,s.length);else for(var n=0;n<s.length;)o[u++]=s[n++]}},p.prototype.bytes=function(s){var o=(s=d.isString(s)?d.S(s,"base64"):s).length>>>0;return this.uint32(o),o&&this.N(p.writeBytesBuffer,o,s),this},p.prototype.string=function(s){var o=d.Buffer.byteLength(s);return this.uint32(o),o&&this.N(h,o,s),this},p.c()},{35:35,39:39}]},r={},Ae=(function t(a){var l=r[a];return l||e[a][0].call(l=r[a]={exports:{}},t,l,l.exports),l.exports})([16][0])})();class pr{constructor(){this._typeStore=new Map}getSchemaType(e){E.requireArgument(e,"schema");const r=D.getSchemaId(e);let t=this._typeStore.get(r);return t||(t=Ae.Root.fromJSON(e.pbjsSchema).lookupType(r),this._typeStore.set(r,t)),t}validate(e,r){E.requireArgument(e,"schema"),E.requireArgument(r,"data");const t=this.getSchemaType(e),a=t.verify(r);if(a)throw new Error(`Data is invalid for ${t.fullName}: ${a}`);return t}encode(e,r){const t=this.validate(e,r),a=t.fromObject(r);return t.encode(a).finish()}encodePayload(e){if(e!=null&&e.schema&&e.payload)return{schemaName:D.getSchemaId(e.schema),payload:this.encode(e.schema,e.payload)}}getLogMessage(e,r,t){return{timestamp:t.timestamp,data:this.encode(e,r),age:t.age,rootId:t.rootId,seq:t.sequence,sseq:t.schemaSequence,loggerName:t.loggerName,pagePayload:this.encodePayload(t.pagePayload),loggerAppName:t.loggerAppName,connectionType:t.connectionType,appPayload:this.encodePayload(t.appPayload),csId:t.clientSessionId,recCsId:t.receiverClientSessionId,recRootId:t.receiverRootId,tenantClass:t.tenantClass}}processRawLogMessage(e,r){const t=r.data?Object.assign({},r.data):{};return D.isInternal(e)&&t.userPayload&&(t.userPayload=this.encodePayload(t.userPayload)),Object.assign({},r,{data:this.encode(e,t),pagePayload:this.encodePayload(r.pagePayload),appPayload:this.encodePayload(r.appPayload)})}}const Ke=new pr,Ye=Ae.Root.fromJSON(he.pbjsSchema).lookupType("CoreEnvelope");function We(w){return ee.buildFrom(w)}function Qe(w){const e=Ye.verify(w);if(e)throw new Error(`Invalid CoreEnvelope: ${e}`);return Ye.encode(w).finish()}var X;(function(w){w[w.fetchBinary=0]="fetchBinary",w[w.fetchFile=1]="fetchFile",w[w.noUpload=2]="noUpload"})(X||(X={}));const Ze="telemetry",fr=1e4,et=1e4,mr=10,yr=10,tt=X.fetchBinary;class gr{constructor(e,r,t,a){this._messagesLimit=mr,this._metricsLimit=yr,this._formDataKey=Ze,this._uploadInterval=et,this._messageSize=0,this.uploadEndpoint=e,this.uploadMode=r==null?tt:r,t&&(this._staticAttributes={appName:t.appName,appVersion:t.appVersion,appExperience:t.appExperience,deviceId:t.deviceId,deviceModel:t.deviceModel,sdkVersion:t.sdkVersion});let l=fr;if(a){const i=a.maxUniqueSchemas;if(i!==void 0){if(typeof i!="number"||!(i>0))throw new Error("options.maxUniqueSchemas, if defined, must be > 0");l=i}const d=a.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 p=a.metricsLimit;if(p!==void 0){if(typeof p!="number"||!(p>0))throw new Error("options.metricsLimit, if defined, must be > 0");this._metricsLimit=p}E.requireArgumentIfDefined(a.formDataKeyName,"options.formDataKeyName","string")&&(this._formDataKey=a.formDataKeyName),E.requireArgumentIfDefined(a.uploadFailedListener,"options.uploadFailedListener","function")&&(this._uploadFailedListener=a.uploadFailedListener),E.requireArgumentIfDefined(a.apiKey,"options.apiKey","string")&&(this._apiKey=a.apiKey)}this._messageBuffers=new at(l),this._emptySize=this.getByteSize(1),this._restartTimer()}get uploadInterval(){return this._uploadInterval}set uploadInterval(e){if(e===void 0&&(e=et),typeof e!="number"||!(e>0))throw new Error("uploadInterval, if defined, must be > 0");e!==this._uploadInterval&&(this._uploadInterval=e,this._restartTimer())}get uploadEndpoint(){return this._uploadEndpoint}set uploadEndpoint(e){E.requireArgumentIfDefined(e,"uploadEndpoint","string"),this._uploadEndpoint=e}get uploadOptionsCallback(){return this._uploadOptionsCallback}set uploadOptionsCallback(e){E.requireArgumentIfDefined(e,"uploadOptionsCallback","function"),this._uploadOptionsCallback=e}get uploadMode(){return this._uploadMode}set uploadMode(e){if(E.requireArgumentIfDefined(e,"uploadMode","number"),e===void 0&&(e=tt),!(e in X))throw new Error(`Unsupported upload mode: ${e}`);this._uploadMode=e}getByteSize(e){return e>=1?this._buildProtoEncodedCoreEnvelope(!1).byteLength:e>=.5?this._emptySize+this._messageSize+this.metricsCount*8:this._emptySize+this._messageSize}_stopTimer(){this._intervalHandle!==void 0&&(clearInterval(this._intervalHandle),this._intervalHandle=void 0)}_restartTimer(){this._stopTimer(),this._intervalHandle=setInterval(()=>{this.hasData&&this._upload()},this._uploadInterval)}collect(e,r,t){return G(this,null,function*(){D.isInternal(e)&&r.userPayload&&(r.userPayload=Ke.encodePayload(r.userPayload));const a=Ke.getLogMessage(e,r,t);if(!this._messageBuffers.push(e,a))throw new Error(`Buffer is full. Refusing schemaId ${D.getSchemaId(e)}`);if(this._messageSize+=E.estimateObjectSize(a),this._shouldUpload())return this._upload()})}_shouldUpload(){return this._immediateUpload&&this.hasData||this.messagesCount>=this._messagesLimit||this.metricsCount>=this._metricsLimit}_upload(e){return G(this,null,function*(){if(this._restartTimer(),!this._uploadEndpoint||this._uploadMode===X.noUpload)return;const r=this._getContentsOfCoreEnvelope(!0);return this._uploadContents(r,e)})}_uploadContents(e,r){return G(this,null,function*(){let t=this._getRequestInit(e);const a={envelopeContents:e};try{if(this._apiKey&&(t.headers["x-o11y-api-key"]=this._apiKey),this._uploadOptionsCallback){const l=this._uploadOptionsCallback()||{};if(l){if(l.headers&&t.headers)if(l.headers instanceof Headers)for(const i in t.headers)Object.prototype.hasOwnProperty.call(t.headers,i)&&l.headers.set(i,t.headers[i]);else{if(Array.isArray(l.headers))throw new Error("Headers as array is not supported.");Object.assign(l.headers,t.headers)}l.method=t.method,l.body=t.body,t=l}}if(a.response=yield fetch(this._uploadEndpoint,t),!a.response.ok)throw new Error("HTTP Not OK");return a}catch(l){if(a.error=l,!r&&this._uploadFailedListener)try{this._uploadFailedListener(a)}catch(i){}throw a}})}_getRequestInit(e){const r=We(e),t=Qe(r);let a;switch(this._uploadMode){case X.fetchBinary:a={method:"POST",headers:{"Content-Type":"application/octet-stream"},body:t};break;case void 0:case X.fetchFile:if(typeof FormData!="function")throw new Error("FormData is not a function in the global namespace.");const l=new FormData;l.append(this._formDataKey||Ze,new Blob([t])),a={method:"POST",body:l};break;case X.noUpload:default:throw new Error("Invalid uploadMode")}return a}_checkUploadState(){if(this._uploadEndpoint===void 0)throw new Error("Upload endpoint is unset");if(this._uploadMode===X.noUpload)throw new Error("Upload mode is unset")}upload(e){return G(this,null,function*(){return this._checkUploadState(),E.requireArgumentIfDefined(e,"contents","object")?this._uploadContents(e,!0):this.hasData?this._upload(!0):void 0})}get hasData(){return this.messagesCount>0||this.metricsCount>0}get messagesCount(){return this._messageBuffers.totalItemCount}get metricsCount(){let e=0;return this._metricsExtractors&&(e+=this._metricsExtractors.getAllUpCounters().length||0,e+=this._metricsExtractors.getAllValueRecorders().length||0,e+=this._metricsExtractors.getAllBucketHistograms().length||0),e}getProtoEncodedCoreEnvelope(){return this._buildProtoEncodedCoreEnvelope(!0)}getContentsOfCoreEnvelope(){return this._getContentsOfCoreEnvelope(!0)}_getContentsOfCoreEnvelope(e){const r={staticAttributes:this._staticAttributes,messages:this._messageBuffers.getAllMessages(e)};return this._metricsExtractors&&(r.upCounters=ee.getUpCounters(this._metricsExtractors.getAllUpCounters(),e),r.valueRecorders=ee.getValueRecorders(this._metricsExtractors.getAllValueRecorders(),e),r.bucketHistograms=ee.getBucketHistograms(this._metricsExtractors.getAllBucketHistograms(),e)),e&&(this._messageSize=0),r}_buildProtoEncodedCoreEnvelope(e){const r=this._getContentsOfCoreEnvelope(e),t=We(r);return Qe(t)}receiveMetricsExtractors(e){this._metricsExtractors=e}}const vr={namespace:"sf.embeddedMessaging",name:"FailureEvent",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{FailureEvent:{oneofs:{_participantType:{oneof:["participantType"]},_convEntryId:{oneof:["convEntryId"]}},fields:{convId:{id:4,type:"string"},method:{id:2,type:"string"},clientName:{id:10,type:"string"},errCode:{id:5,type:"uint32"},jwtClaims:{id:8,type:"string"},participantType:{options:{proto3_optional:!0},id:11,type:"string"},hostUrl:{id:9,type:"string"},convType:{id:7,type:"string"},errMessage:{id:3,type:"string"},configDev:{id:1,type:"string"},convEntryId:{options:{proto3_optional:!0},id:6,type:"string"}}}}}}}}}},_r={namespace:"sf.embeddedMessaging",name:"InteractionEvent",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{InteractionEvent:{oneofs:{_participantType:{oneof:["participantType"]}},fields:{convId:{id:5,type:"string"},op:{id:4,type:"string"},method:{id:2,type:"string"},feature:{id:3,type:"string"},fileSize:{id:6,type:"uint32"},clientName:{id:11,type:"string"},jwtClaims:{id:9,type:"string"},participantType:{options:{proto3_optional:!0},id:12,type:"string"},fileMimeType:{id:7,type:"string"},hostUrl:{id:10,type:"string"},convType:{id:8,type:"string"},configDev:{id:1,type:"string"}}}}}}}}}},br={namespace:"sf.embeddedMessaging",name:"CurrentState",pbjsSchema:{nested:{sf:{nested:{embeddedMessaging:{nested:{CurrentState:{oneofs:{_participantType:{oneof:["participantType"]},_convEntryId:{oneof:["convEntryId"]}},fields:{convId:{id:4,type:"string"},method:{id:2,type:"string"},clientName:{id:9,type:"string"},jwtClaims:{id:7,type:"string"},stateMessage:{id:3,type:"string"},participantType:{options:{proto3_optional:!0},id:10,type:"string"},hostUrl:{id:8,type:"string"},convType:{id:6,type:"string"},configDev:{id:1,type:"string"},convEntryId:{options:{proto3_optional:!0},id:5,type:"string"}}}}}}}}}};M.CoreCollector=gr,M.currentStateSchema=br,M.failureEventSchema=vr,M.interactionEventSchema=_r,M.registerInstrumentedApp=dr,Object.defineProperty(M,Symbol.toStringTag,{value:"Module"})}));
|