1import{as as f,t as E,U as S,at as p,a5 as u,a8 as d,aa as b,au as r,a7 as A,G as R,av as y,X as T,aw as F,w as a,f as O}from"./browser-agent-BoSClcZG.js";import{A as L}from"./aggregate-base-Bh_nSTi7.js";import{a as l}from"./traverse-eGeoT8Mx.js";import"./main-DyjxXpTK.js";import"./event-buffer-iHMgVxEW.js";class N{timestamp;message;attributes;level;constructor(s,i,e={},t=f.INFO){this.timestamp=s,this.message=i,this.attributes={...e,pageUrl:E(""+S)},this.level=t.toUpperCase()}}const g="Logging/Event/";class V extends L{static featureName=p;constructor(s){super(s,p);const i=(e,t)=>{this.loggingMode={auto:e,api:t},t===void 0&&(this.loggingMode.api=e)};this.harvestOpts.raw=!0,super.customAttributesAreSeparate=!0,this.ee.on(u.RESET,()=>{this.abort(d.RESET)}),this.ee.on(u.UPDATE,(e,t)=>{this.blocked||e!==b.CROSS_TAB||(t.loggingMode===r.OFF&&(!t.logApiMode||t.logApiMode===r.OFF)?this.abort(d.CROSS_TAB):i(t.loggingMode,t.logApiMode))}),this.waitForFlags(["log","logapi"]).then(([e,t])=>{if(this.blocked)return;this.loggingMode??={auto:e,api:t};const o=this.agentRef.runtime.session;if(A(s.init)&&o&&(o.isNew?this.#t():i(o.state.loggingMode,o.state.logApiMode)),this.loggingMode.auto===r.OFF&&this.loggingMode.api===r.OFF){this.blocked=!0,this.deregisterDrain();return}R(y,this.handleLog.bind(this),this.featureName,this.ee),this.drain(),s.runtime.harvester.triggerHarvestFor(this)})}handleLog(s,i,e={},t=f.INFO,o,m){if(this.blocked)return;const h=o?this.loggingMode.auto:this.loggingMode.api;if(!h)return;if((!e||typeof e!="object")&&(e={}),e={...e,...T(m,this)},typeof t=="string"&&(t=t.toUpperCase()),!F(t))return a(30,t);if(h<(r[t]||1/0)){this.reportSupportabilityMetric(g+"Dropped/Sampling");return}try{if(typeof i!="string"){const n=O(i);n&&n!=="{}"?i=n:i=String(i)}}catch{a(16,i),this.reportSupportabilityMetric(g+"Dropped/Casting");return}if(typeof i!="string"||!i)return a(32);const M=new N(Math.floor(this.agentRef.runtime.timeKeeper.correctRelativeTimestamp(s)),i,e,t);this.events.add(M)&&this.reportSupportabilityMetric(g+(o?"Auto":"API")+"/Added")}serializer(s){const i=this.agentRef.runtime.session;return[{common:{attributes:{...l(this.agentRef.info.jsAttributes,this.obfuscator.obfuscateString.bind(this.obfuscator),"string"),...this.harvestEndpointVersion===1&&{"entity.guid":this.agentRef.runtime.appMetadata.agents[0].entityGuid,appId:this.agentRef.info.applicationID},...i&&{session:i.state.value||"0",hasReplay:i.state.sessionReplayMode===1,hasTrace:i.state.sessionTraceMode===1},ptid:this.agentRef.runtime.ptid,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}},logs:l(s,this.obfuscator.obfuscateString.bind(this.obfuscator),"string")}]}queryStringsBuilder(){return{browser_monitoring_key:this.agentRef.info.licenseKey}}abort(s={}){this.reportSupportabilityMetric("Logging/Abort/".concat(s.sm)),this.blocked=!0,this.events&&(this.events.clear(),this.events.clearSave()),this.loggingMode={auto:r.OFF,api:r.OFF},this.#t(),this.deregisterDrain()}#t(){this.agentRef.runtime.session?.write({loggingMode:this.loggingMode.auto,logApiMode:this.loggingMode.api})}}export{V 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.