1var e=Object.defineProperty,t=Object.defineProperties,i=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,n=(t,i,s)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[i]=s,a=(e,t)=>{for(var i in t||(t={}))r.call(t,i)&&n(e,i,t[i]);if(s)for(var i of s(t))o.call(t,i)&&n(e,i,t[i]);return e},l=(e,s)=>t(e,i(s)),h=(e,t,i)=>n(e,"symbol"!=typeof t?t+"":t,i),d=(e,t,i)=>new Promise((s,r)=>{var o=e=>{try{a(i.next(e))}catch(t){r(t)}},n=e=>{try{a(i.throw(e))}catch(t){r(t)}},a=e=>e.done?s(e.value):Promise.resolve(e.value).then(o,n);a((i=i.apply(e,t)).next())});import{_ as p}from"./main-BnzPSaAB.js";import{ae as c,a9 as u,af as m,ad as y,ag as g,ah as f,ai as v,C as R,aj as S,ak as b,b as M,s as E,M as F,w as _,al as C,n as T,p as O,am as L,an as j,ao as k}from"./browser-Dx-y7Jmd.js";import{A as z,o as w}from"./aggregate-base-Di7cs1Bw.js";import{s as A}from"./stylesheet-evaluator-Bda-b0Dk.js";import"./redux-vendor-C5HMt75f.js";import"./react-vendor-d2XN-_nt.js";import"./router-vendor-CDEUxg0V.js";import"./ui-vendor-B78xTfmQ.js";import"./qrCode-CrlAA5fd.js";import"./event-buffer-D3jju-Z7.js";let I;const U=new Promise(e=>{I=e}),P=Object.freeze({onReplayReady:I,sessionReplayInitialized:U});class N extends z{constructor(e,t){var i;super(e,c),h(this,"mode",u.OFF),this.initialized=!1,this.blocked=!1,this.gzipper=void 0,this.u8=void 0,this.shouldCompress=!0,this.entitled=!1,this.timeKeeper=void 0,this.instrumentClass=t,this.recorder=null==(i=this.instrumentClass)?void 0:i.recorder,this.harvestOpts.raw=!0,this.isSessionTrackingEnabled=m(e.init)&&!!e.runtime.session,this.reportSupportabilityMetric("Config/SessionReplay/Enabled"),this.ee.on(y.RESET,()=>{this.abort(g.RESET)}),this.ee.on(y.PAUSE,()=>{var e;null==(e=this.recorder)||e.stopRecording()}),this.ee.on(y.RESUME,()=>{var t;this.recorder&&(this.mode=e.runtime.session.state.sessionReplayMode,this.initialized&&this.mode!==u.OFF&&(null==(t=this.recorder)||t.startRecording(f.RESUME,this.mode)))}),this.ee.on(y.UPDATE,(e,t)=>{this.recorder&&this.initialized&&!this.blocked&&e===v.CROSS_TAB&&(this.mode!==u.OFF&&t.sessionReplayMode===u.OFF&&this.abort(g.CROSS_TAB),this.mode=t.sessionReplayMode)}),R(S,()=>{this.forceStop(this.mode===u.FULL)},this.featureName,this.ee),R(b,e=>{this.handleError(e)},this.featureName,this.ee);const{error_sampling_rate:s,sampling_rate:r,autoStart:o,block_selector:n,mask_text_selector:a,mask_all_inputs:l,inline_images:d,collect_fonts:p}=e.init.session_replay;this.waitForFlags(["srs","sr"]).then(([e,t])=>{if(this.entitled=!!t,!this.entitled)return this.deregisterDrain(),void(this.agentRef.runtime.isRecording&&(this.abort(g.ENTITLEMENTS),this.reportSupportabilityMetric("SessionReplay/EnabledNotEntitled/Detected")));this.initializeRecording(e).then(()=>{this.drain()})}).then(()=>{var e,t,i,s;if(this.mode===u.OFF)for(null==(e=this.recorder)||e.stopRecording();null==(t=this.recorder)?void 0:t.getEvents().events.length;)null==(s=null==(i=this.recorder)?void 0:i.clearBuffer)||s.call(i);P.onReplayReady(this.mode)}),o||this.reportSupportabilityMetric("Config/SessionReplay/AutoStart/Modified"),!0===p&&this.reportSupportabilityMetric("Config/SessionReplay/CollectFonts/Modified"),!0===d&&this.reportSupportabilityMetric("Config/SessionReplay/InlineImages/Modifed"),!0!==l&&this.reportSupportabilityMetric("Config/SessionReplay/MaskAllInputs/Modified"),"[data-nr-block]"!==n&&this.reportSupportabilityMetric("Config/SessionReplay/BlockSelector/Modified"),"*"!==a&&this.reportSupportabilityMetric("Config/SessionReplay/MaskTextSelector/Modified"),this.reportSupportabilityMetric("Config/SessionReplay/SamplingRate/Value",r),this.reportSupportabilityMetric("Config/SessionReplay/ErrorSamplingRate/Value",s)}replayIsActive(){return Boolean(this.recorder&&this.mode===u.FULL&&!this.blocked&&this.entitled)}handleError(e){var t;this.recorder&&(this.recorder.events.hasError=!0),this.mode===u.ERROR&&"visible"===(null==(t=M)?void 0:t.document.visibilityState)&&this.switchToFull()}switchToFull(){this.entitled&&!this.blocked&&(this.mode=u.FULL,this.recorder&&this.initialized?(this.agentRef.runtime.isRecording||this.recorder.startRecording(f.SWITCH_TO_FULL,this.mode),this.syncWithSessionManager({sessionReplayMode:this.mode})):this.initializeRecording(u.FULL,!0,f.SWITCH_TO_FULL))}initializeRecording(e,t){return d(this,arguments,function*(e,t,i=f.INITIALIZE){var s;if(this.initialized=!0,!this.entitled)return;const{session:r,timeKeeper:o}=this.agentRef.runtime;if(this.timeKeeper=o,(null==(s=this.recorder)?void 0:s.trigger)===f.API&&this.agentRef.runtime.isRecording?this.mode=u.FULL:r.isNew||t?this.mode=e:this.mode=r.state.sessionReplayMode,this.mode!==u.OFF){try{null!=this.recorder||(this.recorder=yield this.instrumentClass.importRecorder())}catch(n){return this.abort(g.IMPORT,n)}this.mode===u.ERROR&&this.instrumentClass.errorNoticed&&(this.mode=u.FULL),yield this.prepUtils(),this.agentRef.runtime.isRecording||this.recorder.startRecording(i,this.mode),this.syncWithSessionManager({sessionReplayMode:this.mode})}})}prepUtils(){return d(this,null,function*(){try{const{gzipSync:e,strToU8:t}=yield p(()=>d(null,null,function*(){const{gzipSync:e,strToU8:t}=yield import("./browser-BNWEmiE2.js");return{gzipSync:e,strToU8:t}}),[]);this.gzipper=e,this.u8=t}catch(e){this.shouldCompress=!1}})}makeHarvestPayload(){var e;if(this.isRetrying)return this.recorder.retryPayload;if(this.mode!==u.FULL||this.blocked)return;if(this.shouldCompress&&!this.gzipper)return;if(!(this.recorder&&(null==(e=this.timeKeeper)?void 0:e.ready)&&this.recorder.hasSeenSnapshot&&this.recorder.hasSeenMeta))return;const t=this.recorder.getEvents();if(!t.events.length)return;const i=this.getHarvestContents(t);if(!i.body.length)return void this.recorder.clearBuffer();this.reportSupportabilityMetric("SessionReplay/Harvest/Attempts");let s=0;if(this.gzipper&&this.u8)i.body=this.gzipper(this.u8("[".concat(i.body.map(({__serialized:e})=>e).join(","),"]"))),s=i.body.length;else{for(let e in i.body)delete i.body[e].__serialized;s=E(i.body).length}if(!(s>F))return this.agentRef.runtime.session.state.sessionReplaySentFirstChunk||this.syncWithSessionManager({sessionReplaySentFirstChunk:!0}),this.recorder.clearBuffer(),this.agentRef.runtime.session.state.traceHarvestStarted||_(59,JSON.stringify(this.agentRef.runtime.session.state)),this.recorder.retryPayload=i,i;this.abort(g.TOO_BIG,s)}getFirstAndLastNodes(e=[]){const t={firstEvent:e[0],lastEvent:e[e.length-1]};
1return e.forEach(e=>{var i,s;const r=null==e?void 0:e.timestamp;(!(null==(i=t.firstEvent)?void 0:i.timestamp)||(r||1/0)<t.firstEvent.timestamp)&&(t.firstEvent=e),(!(null==(s=t.lastEvent)?void 0:s.timestamp)||(r||-1/0)>t.lastEvent.timestamp)&&(t.lastEvent=e)}),t}getHarvestContents(e){var t,i,s,r,o,n;null!=e||(e=this.recorder.getEvents());let h=e.events;const d=this.agentRef.runtime,p=null==(t=this.agentRef.info.jsAttributes)?void 0:t["enduser.id"];(null==(i=null==h?void 0:h[0])?void 0:i.type)===C.FullSnapshot&&this.recorder.lastMeta&&(e.hasMeta=!0,h.unshift(this.recorder.lastMeta),this.recorder.lastMeta=void 0),(null==(s=h[h.length-1])?void 0:s.type)===C.Meta&&(this.recorder.lastMeta=h[h.length-1],h=h.slice(0,h.length-1),e.hasMeta=!!h.find(e=>e.type===C.Meta));const c=T(),{firstEvent:u,lastEvent:m}=this.getFirstAndLastNodes(h),y=(null==u?void 0:u.timestamp)||Math.floor(this.timeKeeper.correctAbsoluteTimestamp(e.cycleTimestamp)),g=(null==m?void 0:m.timestamp)||Math.floor(this.timeKeeper.correctRelativeTimestamp(c)),f=(null==(o=null==(r=d.appMetadata)?void 0:r.agents)?void 0:o[0])||{};return{qs:{browser_monitoring_key:this.agentRef.info.licenseKey,type:"SessionReplay",app_id:this.agentRef.info.applicationID,protocol_version:"0",timestamp:y,attributes:w(l(a(l(a(a({},!!this.gzipper&&!!this.u8&&{content_encoding:"gzip"}),f.entityGuid&&{entityGuid:f.entityGuid}),{harvestId:[null==(n=d.session)?void 0:n.state.value,d.ptid,d.harvestCount].filter(e=>e).join("_"),"replay.firstTimestamp":y,"replay.lastTimestamp":g,"replay.nodes":h.length,"session.durationMs":d.session.getDuration(),agentVersion:d.version,session:d.session.state.value,rst:c,hasMeta:e.hasMeta||!1,hasSnapshot:e.hasSnapshot||!1,hasError:e.hasError||!1,isFirstChunk:!1===d.session.state.sessionReplaySentFirstChunk,decompressedBytes:e.payloadBytesEstimation,invalidStylesheetsDetected:A.invalidStylesheetsDetected,inlinedAllStylesheets:e.inlinedAllStylesheets,"rrweb.version":j+"@"+k,"payload.type":e.type}),p&&{"enduser.id":this.obfuscator.obfuscateString(p)}),{currentUrl:this.obfuscator.obfuscateString(O(""+location))}),L).substring(1)},body:h}}postHarvestCleanup(e){e.sent&&(e.retry?(_(70),this.isRetrying=!0,this.forceStop()):(this.recorder.retryPayload=void 0,this.isRetrying&&(this.isRetrying=!1,this.switchToFull())))}forceStop(e){var t,i;e&&this.agentRef.runtime.harvester.triggerHarvestFor(this),this.mode=u.OFF,null==(i=null==(t=this.recorder)?void 0:t.stopRecording)||i.call(t),this.syncWithSessionManager({sessionReplayMode:this.mode})}abort(e={},t){var i,s,r,o,n,a,l;for(_(33,e.message),this.reportSupportabilityMetric("SessionReplay/Abort/".concat(e.sm),t),this.blocked=!0,this.mode=u.OFF,null==(s=null==(i=this.recorder)?void 0:i.stopRecording)||s.call(i),this.syncWithSessionManager({sessionReplayMode:this.mode}),null==(o=null==(r=this.recorder)?void 0:r.clearTimestamps)||o.call(r);null==(n=this.recorder)?void 0:n.getEvents().events.length;)null==(l=null==(a=this.recorder)?void 0:a.clearBuffer)||l.call(a)}syncWithSessionManager(e={}){this.isSessionTrackingEnabled&&this.agentRef.runtime.session.write(e)}}h(N,"featureName",c);export{N 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.