1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./recorder.3VIlSA6cAFPk0KQR.js","./entry.B12u5oqYnpPrO_rT.js","./entry.T6kG17msHrRD_36j.css","./event-buffer.BmVEMbAIYGd211XO.js","./stylesheet-evaluator.CyVfa7jYlS_cTPrO.js"])))=>i.map(i=>d[i]); 2import{bL as R,bz as r,bM as T,bD as c,bN as l,bO as v,b5 as S,bP as b,be as F,bQ as A,D as E,b6 as O,bc as M,bR as y,bd as N,bS as I,bT as L}from"./entry.B12u5oqYnpPrO_rT.js";import{A as k,o as C,c as U}from"./aggregate-base.yYh2P8zne7K6M42v.js";import{s as w}from"./stylesheet-evaluator.CyVfa7jYlS_cTPrO.js";import{M as z}from"./event-buffer.BmVEMbAIYGd211XO.js";let _;const P=new Promise(g=>{_=g}),D=Object.freeze({onReplayReady:_,sessionReplayInitialized:P});class H extends k{static featureName=R;mode=r.OFF;constructor(e,t){super(e,R),this.initialized=!1,this.blocked=!1,this.gzipper=void 0,this.u8=void 0,this.entitled=!1,this.timeKeeper=void 0,this.recorder=t?.recorder,this.errorNoticed=t?.errorNoticed||!1,this.harvestOpts.raw=!0,this.isSessionTrackingEnabled=T(e.init)&&!!e.runtime.session,this.reportSupportabilityMetric("Config/SessionReplay/Enabled"),this.ee.on(c.RESET,()=>{this.abort(l.RESET)}),this.ee.on(c.PAUSE,()=>{this.recorder?.stopRecording()}),this.ee.on(c.RESUME,()=>{this.recorder&&(this.mode=e.runtime.session.state.sessionReplayMode,!(!this.initialized||this.mode===r.OFF)&&this.recorder?.startRecording())}),this.ee.on(c.UPDATE,(n,h)=>{!this.recorder||!this.initialized||this.blocked||n!==v.CROSS_TAB||(this.mode!==r.OFF&&h.sessionReplayMode===r.OFF&&this.abort(l.CROSS_TAB),this.mode=h.sessionReplayMode)}),S(b.PAUSE,()=>{this.forceStop(this.mode===r.FULL)},this.featureName,this.ee),S(b.ERROR_DURING_REPLAY,n=>{this.handleError(n)},this.featureName,this.ee);const{error_sampling_rate:i,sampling_rate:s,autoStart:a,block_selector:o,mask_text_selector:d,mask_all_inputs:f,inline_images:u,collect_fonts:p}=e.init.session_replay;this.waitForFlags(["srs","sr"]).then(([n,h])=>{if(this.entitled=!!h,!this.entitled){this.deregisterDrain(),this.agentRef.runtime.isRecording&&(this.abort(l.ENTITLEMENTS),this.reportSupportabilityMetric("SessionReplay/EnabledNotEntitled/Detected"));return}this.initializeRecording(n).then(()=>{this.drain()})}).then(()=>{if(this.mode===r.OFF)for(this.recorder?.stopRecording();this.recorder?.getEvents().events.length;)this.recorder?.clearBuffer?.();D.onReplayReady(this.mode)}),a||this.reportSupportabilityMetric("Config/SessionReplay/AutoStart/Modified"),p===!0&&this.reportSupportabilityMetric("Config/SessionReplay/CollectFonts/Modified"),u===!0&&this.reportSupportabilityMetric("Config/SessionReplay/InlineImages/Modifed"),f!==!0&&this.reportSupportabilityMetric("Config/SessionReplay/MaskAllInputs/Modified"),o!=="[data-nr-block]"&&this.reportSupportabilityMetric("Config/SessionReplay/BlockSelector/Modified"),d!=="*"&&this.reportSupportabilityMetric("Config/SessionReplay/MaskTextSelector/Modified"),this.reportSupportabilityMetric("Config/SessionReplay/SamplingRate/Value",s),this.reportSupportabilityMetric("Config/SessionReplay/ErrorSamplingRate/Value",i)}replayIsActive(){return!!(this.recorder&&this.mode===r.FULL&&!this.blocked&&this.entitled)}handleError(e){this.recorder&&(this.recorder.events.hasError=!0),this.mode===r.ERROR&&F?.document.visibilityState==="visible"&&this.switchToFull()}switchToFull(){!this.entitled||this.blocked||(this.mode=r.FULL,this.recorder&&this.initialized?(this.agentRef.runtime.isRecording||this.recorder.startRecording(),this.syncWithSessionManager({sessionReplayMode:this.mode})):this.initializeRecording(r.FULL,!0))}async initializeRecording(e,t){if(this.initialized=!0,!this.entitled)return;const{session:i,timeKeeper:s}=this.agentRef.runtime;if(this.timeKeeper=s,this.recorder?.parent.trigger===A.API&&this.agentRef.runtime.isRecording?this.mode=r.FULL:!i.isNew&&!t?this.mode=i.state.sessionReplayMode:this.mode=e,this.mode!==r.OFF){if(this.recorder)this.recorder.parent=this;else try{const{Recorder:a}=await E(async()=>{const{Recorder:o}=await import("./recorder.3VIlSA6cAFPk0KQR.js");return{Recorder:o}},__vite__mapDeps([0,1,2,3,4]),import.meta.url);this.recorder=new a(this),this.recorder.events.hasError=this.errorNoticed}catch{return this.abort(l.IMPORT)}this.mode===r.ERROR&&this.errorNoticed&&(this.mode=r.FULL),await this.prepUtils(),this.agentRef.runtime.isRecording||this.recorder.startRecording(),this.syncWithSessionManager({sessionReplayMode:this.mode})}}async prepUtils(){try{const{gzipSync:e,strToU8:t}=await E(async()=>{const{gzipSync:i,strToU8:s}=await import("./browser.CdfDu96zLn2O5AIv.js");return{gzipSync:i,strToU8:s}},[],import.meta.url);this.gzipper=e,this.u8=t}catch{}}makeHarvestPayload(e){const t={targetApp:void 0,payload:void 0};if(this.mode!==r.FULL||this.blocked||!this.recorder||!this.timeKeeper?.ready||!this.recorder.hasSeenSnapshot)return;const i=this.recorder.getEvents();if(!i.events.length)return;const s=this.getHarvestContents(i);if(!s.body.length)return this.recorder.clearBuffer(),[t];this.reportSupportabilityMetric("SessionReplay/Harvest/Attempts");let a=0;if(this.gzipper&&this.u8)s.body=this.gzipper(this.u8("[".concat(s.body.map(({__serialized:o})=>o).join(","),"]"))),a=s.body.length;else{for(let o in s.body)delete s.body[o].__serialized;a=O(s.body).length}return a>z?(this.abort(l.TOO_BIG,a),[t]):(this.agentRef.runtime.session.state.sessionReplaySentFirstChunk||this.syncWithSessionManager({sessionReplaySentFirstChunk:!0}),this.recorder.clearBuffer(),i.type==="preloaded"&&this.agentRef.runtime.harvester.triggerHarvestFor(this),t.payload=s,this.agentRef.runtime.session.state.traceHarvestStarted||M(59,JSON.stringify(this.agentRef.runtime.session.state)),[t])}getFirstAndLastNodes(e=[]){const t={firstEvent:e[0],lastEvent:e[e.length-1]};return e.forEach(i=>
2{const s=i?.timestamp;(!t.firstEvent?.timestamp||(s||1/0)<t.firstEvent.timestamp)&&(t.firstEvent=i),(!t.lastEvent?.timestamp||(s||-1/0)>t.lastEvent.timestamp)&&(t.lastEvent=i)}),t}getHarvestContents(e){e??=this.recorder.getEvents();let t=e.events;const i=this.agentRef.runtime,s=this.agentRef.info.jsAttributes?.["enduser.id"];t?.[0]?.type===y.FullSnapshot&&this.recorder.lastMeta&&(e.hasMeta=!0,t.unshift(this.recorder.lastMeta),this.recorder.lastMeta=void 0),t[t.length-1]?.type===y.Meta&&(this.recorder.lastMeta=t[t.length-1],t=t.slice(0,t.length-1),e.hasMeta=!!t.find(m=>m.type===y.Meta));const d=N(),{firstEvent:f,lastEvent:u}=this.getFirstAndLastNodes(t),p=f?.timestamp||Math.floor(this.timeKeeper.correctAbsoluteTimestamp(e.cycleTimestamp)),n=u?.timestamp||Math.floor(this.timeKeeper.correctRelativeTimestamp(d)),h=i.appMetadata?.agents?.[0]||{};return{qs:{browser_monitoring_key:this.agentRef.info.licenseKey,type:"SessionReplay",app_id:this.agentRef.info.applicationID,protocol_version:"0",timestamp:p,attributes:C({...!!this.gzipper&&!!this.u8&&{content_encoding:"gzip"},...h.entityGuid&&{entityGuid:h.entityGuid},harvestId:[i.session?.state.value,i.ptid,i.harvestCount].filter(m=>m).join("_"),"replay.firstTimestamp":p,"replay.lastTimestamp":n,"replay.nodes":t.length,"session.durationMs":i.session.getDuration(),agentVersion:i.version,session:i.session.state.value,rst:d,hasMeta:e.hasMeta||!1,hasSnapshot:e.hasSnapshot||!1,hasError:e.hasError||!1,isFirstChunk:i.session.state.sessionReplaySentFirstChunk===!1,decompressedBytes:e.payloadBytesEstimation,invalidStylesheetsDetected:w.invalidStylesheetsDetected,inlinedAllStylesheets:e.inlinedAllStylesheets,"rrweb.version":L,"payload.type":e.type,...s&&{"enduser.id":this.obfuscator.obfuscateString(s)},currentUrl:this.obfuscator.obfuscateString(U(""+location))},I).substring(1)},body:t}}postHarvestCleanup(e){e.status===429&&this.abort(l.TOO_MANY)}forceStop(e){e&&this.agentRef.runtime.harvester.triggerHarvestFor(this),this.mode=r.OFF,this.recorder?.stopRecording?.(),this.syncWithSessionManager({sessionReplayMode:this.mode})}abort(e={},t){for(M(33,e.message),this.reportSupportabilityMetric("SessionReplay/Abort/".concat(e.sm),t),this.blocked=!0,this.mode=r.OFF,this.recorder?.stopRecording?.(),this.syncWithSessionManager({sessionReplayMode:this.mode}),this.recorder?.clearTimestamps?.();this.recorder?.getEvents().events.length;)this.recorder?.clearBuffer?.()}syncWithSessionManager(e={}){this.isSessionTrackingEnabled&&this.agentRef.runtime.session.write(e)}}export{H as Aggregate}; 3//# sourceMappingURL=index.CjbgqxOlvALu0hg5.js.map
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.