1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[2440],{20586:(function(Rt,U,c){c.r(U),c.d(U,{DEFAULT_RUM_PROFILER_CONFIGURATION:function(){return V},createRumProfiler:function(){return vt}});var L=c(6288);function _(){const s=(0,L.Y9)();return e=>{s.send("profile",e)}}var f=c(30647),j=c(39362);function K(s,e,t){const n=(0,f.wP)(s,e,t,j.j.PROFILING);return({profile:d,trace:r})=>{const l={event:d,"wall-time.json":r};n.send(l)}}const Y=/\/(?![vV]\d{1,2}\/)([^/\d?]*\d+[^/?]*)/g;function J(s){return s?s.replace(Y,"/?"):"/"}const B=(s,e)=>s||J(e);var Q=c(74145),m=c(48678);function W(s,e,t){const n=(0,Q.m5)(e),d=X(s,e.applicationId,t),r=$(n);return{...d,attachments:["wall-time.json"],start:new Date(s.startClocks.timeStamp).toISOString(),end:new Date(s.endClocks.timeStamp).toISOString(),family:"chrome",runtime:"chrome",format:"json",version:4,tags_profiler:r.join(","),_dd:{clock_drift:(0,m._O)()}}}function X(s,e,t){const{ids:n,names:d}=z(s.views),r=s.longTasks.map(I=>I.id).filter(I=>I!==void 0),l=s.actions?.map(I=>I.id).filter(I=>I!==void 0)??[],{ids:v,labels:h}=q(s.vitals),p={application:{id:e}};return t&&(p.session={id:t}),n.length&&(p.view={id:n,name:d}),r.length&&(p.long_task={id:r}),l.length&&(p.action={id:l,label:[]}),v.length&&(p.vital={id:v,label:h}),p}function z(s){const e={ids:[],names:[]};for(const t of s)e.ids.push(t.viewId),t.viewName&&e.names.push(t.viewName);return e.names=Array.from(new Set(e.names)),e}function q(s){const e={ids:[],labels:[]};if(!s)return e;for(const t of s)e.ids.push(t.id),e.labels.push(t.label);return e.labels=Array.from(new Set(e.labels)),e}function $(s){return s.concat(["language:javascript","runtime:chrome","family:chrome","host:browser"])}var N=c(96030),P=c(9134);const Z=N.AQ;function tt(s){const e=(0,P.q)({expireDelay:Z});return s.subscribe(f.Rg.RAW_RUM_EVENT_COLLECTED,({rawRumEvent:t,startClocks:n,duration:d})=>{t.type==="long_task"&&e.add({id:t.long_task.id,startClocks:n,duration:d,entryType:t.long_task.entry_type===f.K.LONG_TASK?f.do.LONG_TASK:f.do.LONG_ANIMATION_FRAME},n.relative).close((0,m.Gw)(n.relative,d))}),e}const et=N.AQ;function st(s){const e=(0,P.q)({expireDelay:et});return s.subscribe(f.Rg.ACTION_STARTED,t=>{e.add({id:t.id,label:"",startClocks:t.startClocks,duration:void 0},t.startClocks.relative)}),s.subscribe(f.Rg.RAW_RUM_EVENT_COLLECTED,({rawRumEvent:t,startClocks:n,duration:d})=>{if(t.type==="action"){const r=e.getEntries(n.relative).find(v=>v.value.id===t.action.id),l=d??0;r?(r.value.duration=l,r.close((0,m.Gw)(n.relative,l))):e.add({id:t.action.id,label:"",startClocks:n,duration:d},n.relative).close((0,m.Gw)(n.relative,l))}}),e}const nt=N.AQ;function it(s){const e=(0,P.q)({expireDelay:nt});return s.subscribe(f.Rg.DURATION_VITAL_STARTED,t=>{e.add({id:t.id,type:f.DL.DURATION,startClocks:t.startClocks,duration:void 0,label:t.name},t.startClocks.relative)}),s.subscribe(f.Rg.RAW_RUM_EVENT_COLLECTED,({rawRumEvent:t,startClocks:n,duration:d})=>{if(t.type!=="vital")return;if(t.vital.type===f.DL.OPERATION_STEP){if(t.vital.step_type==="start")e.add({id:t.vital.id,type:t.vital.type,operationKey:t.vital.operation_key,startClocks:n,label:t.vital.name},n.relative);else if(t.vital.step_type==="end"){const l=e.findAllEntries().find(v=>v.value.type===f.DL.OPERATION_STEP&&v.value.label===t.vital.name&&v.value.operationKey===t.vital.operation_key);if(!l)return;l.value.duration=(0,m.vk)(l.value.startClocks.relative,n.relative),l.close(n.relative)}return}const r=e.getEntries(n.relative).find(l=>l.value.id===t.vital.id);if(r){r.value.duration=d,r.close((0,m.Gw)(n.relative,d));return}e.add({id:t.vital.id,type:t.vital.type,operationKey:t.vital.operation_key,startClocks:n,duration:d,label:t.vital.name},n.relative).close((0,m.Gw)(n.relative,d))}),e}var ot=c(18616),g=c(6478),at=c(99703);function rt(s,e){const t=s?.data?.attributes;if(!t||typeof t.admitted!="boolean"||typeof t.reason!="string")return e;const n=t.reason==="backend_client_not_initialized"?"backend_unavailable":t.reason;return{decision:t.admitted?"quota_ok":"quota_ko",reason:n}}function lt(s,e){return(0,at.Hg)({proxy:s.proxy,site:s.site,path:"/api/v2/profiling/quota",parameters:`session_id=${e}`,subdomain:"quota"})}function dt(s,e,t=5e3){const n=lt(s,e),d=new AbortController;let r;const l=(0,ot.h)(n,{credentials:"omit",signal:d.signal,headers:new Headers({"DD-CLIENT-TOKEN":s.clientToken})}).then(h=>{const p=h.status===429?{decision:"quota_ko",reason:"quota_exceeded"}:{decision:"quota_ok",reason:"api-error"};return h.json().then(I=>((0,g.DJ)(r),rt(I,p)),()=>((0,g.DJ)(r),p))}).catch(()=>((0,g.DJ)(r),{decision:"quota_ok",reason:"api-error"})),v=new Promise(h=>{r=(0,g.wg)(()=>{d.abort(),h({decision:"quota_ok",reason:"timeout"})},t)});return Promise.race([l,v])}var ct=c(93047);function ut(s){const e=new Map((0,ct.J)(s)?.map(n=>[n.url,n.id])),t=[];
1return s.forEach((n,d)=>{const r=e.get(n);r!==void 0&&t.push({resourceId:d,debugId:r})}),t.length?t:void 0}var E=c(86209),H=c(29794),D=c(42123),S=c(38197),ft=c(93327),pt=c(95041);const V={sampleIntervalMs:10,collectIntervalMs:6e4,minProfileDurationMs:5e3};function vt(s,e,t,n,d,r,l=V){const v=(0,L.d0)()?(0,E.B)(_)():(0,E.B)(K)(s,e,d);let h;const p=[],I=(0,E.B)(tt)(e),mt=(0,E.B)(st)(e),It=(0,E.B)(it)(e);let o={state:"stopped",stateReason:"initializing"},w=0;e.subscribe(f.Rg.SESSION_EXPIRED,()=>{k("session-expired")}),e.subscribe(f.Rg.SESSION_RENEWED,()=>{if(o.state==="stopped"&&(o.stateReason==="session-expired"||o.stateReason==="quota_ko")){const i=t.findTrackedSession();if(!i||!(0,H.$5)(i.id,(0,H.it)(s.sessionSampleRate,s.profilingSampleRate)))return;G()}});function G(){if(o.state==="running")return;const i=r.findView();h=i?{startClocks:i.startClocks,viewId:i.id,viewName:B(i.name,document.location.pathname)}:void 0,p.push((0,D.q2)(window,D.gX.VISIBILITY_CHANGE,Dt).stop,(0,D.q2)(window,D.gX.BEFORE_UNLOAD,At).stop),y(),ht()}function ht(){if((0,L.d0)())return;const i=++w,a=t.findTrackedSession()?.id;a&&(0,E.B)(dt)(s,a).then(u=>{i===w&&(o.state!=="running"&&o.state!=="paused"||u.decision==="quota_ko"&&k("quota_ko",u.reason))}).catch(S.Dx)}function bt(){k("stopped-by-user")}function k(i,a){Et(i),p.forEach(u=>u()),p.length=0,n.set({status:"stopped",error_reason:void 0,quota_reason:a})}function gt(i){if(i.state==="running")return{cleanupTasks:i.cleanupTasks};const a=[],u=e.subscribe(f.Rg.VIEW_CREATED,b=>{const T={viewId:b.id,viewName:B(b.name,document.location.pathname),startClocks:b.startClocks};C(T),h=T});return a.push(u.unsubscribe),{cleanupTasks:a}}function y(){const i=pt.J.Profiler;if(!i)throw n.set({status:"error",error_reason:"not-supported-by-browser"}),new Error("RUM Profiler is not supported in this browser.");o.state==="running"&&R(o);const{cleanupTasks:a}=gt(o);let u;try{u=new i({sampleInterval:l.sampleIntervalMs,maxBufferSize:Math.round(l.collectIntervalMs*1.5/l.sampleIntervalMs)})}catch(b){b instanceof Error&&b.message.includes("disabled by Document Policy")?(ft.V.warn("[DD_RUM] Profiler startup failed. Ensure your server includes the `Document-Policy: js-profiling` response header when serving HTML pages.",b),n.set({status:"error",error_reason:"missing-document-policy-header"})):n.set({status:"error",error_reason:"unexpected-exception"});return}n.set({status:"running",error_reason:void 0}),o={state:"running",startClocks:(0,m.M8)(),profiler:u,timeoutId:(0,g.wg)(y,l.collectIntervalMs),views:[],cleanupTasks:a,longTasks:[],sessionId:t.findTrackedSession()?.id},C(h),u.addEventListener("samplebufferfull",M)}function R(i){(0,g.DJ)(i.timeoutId),i.profiler.removeEventListener("samplebufferfull",M);const{startClocks:a,views:u,sessionId:b}=i;i.profiler.stop().then(T=>{const F=(0,m.M8)(),A=(0,m.vk)(a.relative,F.relative),x=I.findAll(a.relative,A),Pt=mt.findAll(a.relative,A),St=It.findAll(a.relative,A).map(O=>({id:O.id,label:O.label,startClocks:O.startClocks,duration:O.duration})),kt=A<l.minProfileDurationMs;x.length===0&&kt||Tt(Object.assign({},T,{startClocks:a,endClocks:F,clocksOrigin:(0,m.Oc)(),longTasks:x,actions:Pt,vitals:St,views:u,sampleInterval:l.sampleIntervalMs,debugIds:ut(T.resources)}),b)}).catch(S.Dx)}function Et(i){if(o.state!=="running"){(o.state==="paused"||o.state==="stopped"&&i==="stopped-by-user")&&(o={state:"stopped",stateReason:i});return}const a=o;o={state:"stopped",stateReason:i},a.cleanupTasks.forEach(u=>u()),i==="quota_ko"?((0,g.DJ)(a.timeoutId),a.profiler.removeEventListener("samplebufferfull",M),a.profiler.stop().catch(S.Dx)):R(a)}function yt(){if(o.state!=="running")return;const i=o;o={state:"paused"},i.cleanupTasks.forEach(a=>a()),R(i)}function C(i){o.state!=="running"||!i||o.views.push(i)}function Tt(i,a){const u={profile:W(i,s,a),trace:i};v(u)}function M(){y()}function Dt(){document.visibilityState==="hidden"&&o.state==="running"?yt():document.visibilityState==="visible"&&o.state==="paused"&&y()}function At(){y()}function Ot(){return o.state==="stopped"}function Lt(){return o.state==="running"}function Nt(){return o.state==="paused"}return{start:G,stop:bt,isStopped:Ot,isRunning:Lt,isPaused:Nt}}})}]); 2 3//# sourceMappingURL=datadogProfiler_ef686039b530797dc3ff.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.