1var M=Object.defineProperty;var b=(r,t,e)=>t in r?M(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var o=(r,t,e)=>b(r,typeof t!="symbol"?t+"":t,e);import{a5 as E,K as y,a4 as R,w as a}from"./instrument-base-DXJzuvQL.js";import{S as c,b as L,a as u}from"./stringify-Ld9O3j-q.js";import{c as T,A as v,M as F}from"./aggregate-base-BFvJAToj.js";import{L as S,F as d,b as g,a as O}from"./constants-CzW6GYBR.js";import{i as A}from"./index-Br73PI4v.js";import{a as N}from"./traverse-eGeoT8Mx.js";import{a as _}from"./constants-DRmf5Urr.js";import{A as m}from"./browser-agent-0xeT1dBs.js";import"./vendor-i18n-B6HYivoC.js";import"./vendor-framework-CobW1Mgl.js";import"./configure-CX0xSG8t.js";import"./index-CQR1pb2S.js";import"./wrap-events-CtM99SMr.js";import"./deny-list-CI4EWlrg.js";class I{constructor(t,e,i={},s=S.INFO){o(this,"timestamp");o(this,"message");o(this,"attributes");o(this,"level");this.timestamp=t,this.message=e,this.attributes={...i,pageUrl:T(""+E)},this.level=s.toUpperCase()}}class w extends v{constructor(t){super(t,d),this.isSessionTrackingEnabled=y(t.init)&&t.runtime.session,this.ee.on(c.RESET,()=>{this.abort(m.RESET)}),this.ee.on(c.UPDATE,(e,i)=>{this.blocked||e!==L.CROSS_TAB||(this.loggingMode!==g.OFF&&i.loggingMode===g.OFF?this.abort(m.CROSS_TAB):this.loggingMode=i.loggingMode)}),this.harvestOpts.raw=!0,this.waitForFlags(["log"]).then(([e])=>{const i=this.agentRef.runtime.session??{};if(this.loggingMode===g.OFF||i.isNew&&e===g.OFF){this.blocked=!0,this.deregisterDrain();return}i.isNew||!this.isSessionTrackingEnabled?this.updateLoggingMode(e):this.loggingMode=i.state.loggingMode,R(O,this.handleLog.bind(this),this.featureName,this.ee),this.drain(),t.runtime.harvester.triggerHarvestFor(this)})}updateLoggingMode(t){this.loggingMode=t,this.syncWithSessionManager({loggingMode:this.loggingMode})}handleLog(t,e,i={},s=S.INFO,p){if(!this.agentRef.runtime.entityManager.get(p))return a(56,this.featureName);if(this.blocked||!this.loggingMode)return;if((!i||typeof i!="object")&&(i={}),typeof s=="string"&&(s=s.toUpperCase()),!A(s))return a(30,s);if(this.loggingMode<(g[s]||1/0)){this.reportSupportabilityMetric("Logging/Event/Dropped/Sampling");return}try{if(typeof e!="string"){const l=u(e);l&&l!=="{}"?e=l:e=String(e)}}catch{a(16,e),this.reportSupportabilityMetric("Logging/Event/Dropped/Casting");return}if(typeof e!="string"||!e)return a(32);const n=new I(Math.floor(this.agentRef.runtime.timeKeeper.correctRelativeTimestamp(t)),e,i,s),h=n.message.length+u(n.attributes).length+n.level.length+10,f="Logging/Harvest/Failed/Seen";if(h>F){this.reportSupportabilityMetric(f,h),a(31,n.message.slice(0,25)+"...");return}this.events.wouldExceedMaxSize(h,p)&&(this.reportSupportabilityMetric("Logging/Harvest/Early/Seen",this.events.byteSize()+h),this.agentRef.runtime.harvester.triggerHarvestFor(this,{targetEntityGuid:p})),this.events.add(n,p)?this.reportSupportabilityMetric("Logging/Event/Added/Seen"):(this.reportSupportabilityMetric(f,h),a(31,n.message.slice(0,25)+"..."))}serializer(t,e){const i=this.agentRef.runtime.entityManager.get(e),s=this.agentRef.runtime.session;return[{common:{attributes:{"entity.guid":i.entityGuid,...s&&{session:s.state.value||"0",hasReplay:s.state.sessionReplayMode===1&&_(i,this.agentRef),hasTrace:s.state.sessionTraceMode===1},ptid:this.agentRef.runtime.ptid,appId:i.applicationID||this.agentRef.info.applicationID,standalone:!!this.agentRef.info.sa,agentVersion:this.agentRef.runtime.version,"instrumentation.provider":"browser","instrumentation.version":this.agentRef.runtime.version,"instrumentation.name":this.agentRef.runtime.loaderType,...this.agentRef.info.jsAttributes}},logs:N(t,this.obfuscator.obfuscateString.bind(this.obfuscator),"string")}]}queryStringsBuilder(t,e){return{browser_monitoring_key:this.agentRef.runtime.entityManager.get(e).licenseKey}}abort(t={}){this.reportSupportabilityMetric("Logging/Abort/".concat(t.sm)),this.blocked=!0,this.events&&(this.events.clear(),this.events.clearSave()),this.updateLoggingMode(g.OFF),this.deregisterDrain()}syncWithSessionManager(t={}){this.isSessionTrackingEnabled&&this.agentRef.runtime.session.write(t)}}o(w,"featureName",d);export{w as Aggregate};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.