@react-native/debugger-frontend
Version:
Debugger frontend for React Native based on Chrome DevTools
1 lines • 294 kB
JavaScript
import*as e from"../../core/i18n/i18n.js";import*as t from"../../ui/legacy/theme_support/theme_support.js";import*as i from"../../models/trace/trace.js";import*as n from"../../core/sdk/sdk.js";import*as r from"../../core/common/common.js";import*as a from"../../core/root/root.js";import*as s from"./components/components.js";import{Utils as o}from"./components/components.js";import*as l from"../../core/host/host.js";import*as c from"../../core/platform/platform.js";import*as d from"../../models/workspace/workspace.js";import*as h from"../../services/trace_bounds/trace_bounds.js";import*as m from"../../ui/components/adorners/adorners.js";import*as p from"../../ui/legacy/components/perf_ui/perf_ui.js";import*as u from"../../ui/legacy/legacy.js";import*as g from"../../ui/visual_logging/visual_logging.js";import*as v from"../mobile_throttling/mobile_throttling.js";import*as T from"./components/insights/insights.js";import*as f from"../../ui/components/menus/menus.js";import*as y from"../../models/source_map_scopes/source_map_scopes.js";import*as w from"../../models/extensions/extensions.js";import*as b from"../../models/bindings/bindings.js";import*as S from"./overlays/overlays.js";import*as C from"../../models/timeline_model/timeline_model.js";import*as E from"../../ui/legacy/components/utils/utils.js";import*as k from"../../ui/legacy/components/data_grid/data_grid.js";import*as x from"../../ui/components/code_highlighter/code_highlighter.js";import*as P from"./extensions/extensions.js";import*as I from"../layer_viewer/layer_viewer.js";import*as M from"../../ui/components/data_grid/data_grid.js";import*as F from"../../ui/components/linkifier/linkifier.js";import*as L from"../../ui/lit-html/lit-html.js";import*as R from"./utils/utils.js";import*as D from"../../ui/components/panel_feedback/panel_feedback.js";import*as A from"../../ui/components/icon_button/icon_button.js";const B={sSelfS:"{PH1} (self {PH2})"},N=e.i18n.registerUIStrings("panels/timeline/AppenderUtils.ts",B),H=e.i18n.getLocalizedString.bind(void 0,N);function U(e){const i={padding:4,height:17,collapsible:!0,color:t.ThemeSupport.instance().getComputedValue("--sys-color-on-surface"),backgroundColor:t.ThemeSupport.instance().getComputedValue("--sys-color-cdt-base-container"),nestingLevel:0,shareHeaderLine:!0};return Object.assign(i,e)}function W(e,t,i,n,r,a,s,o){const l={startLevel:t,name:i,style:n,selectable:r,expanded:a,showStackContextMenu:s,legends:o};return null!==e&&(l.jslogContext=e),l}function O(t,n){const r=i.Helpers.Timing.microSecondsToMilliseconds(t||0);if(r===i.Types.Timing.MilliSeconds(0))return"";const a=i.Helpers.Timing.microSecondsToMilliseconds(n||0),s=1e-6;return Math.abs(r-a)>s&&a>s?H(B.sSelfS,{PH1:e.TimeUtilities.millisToString(r,!0),PH2:e.TimeUtilities.millisToString(a,!0)}):e.TimeUtilities.millisToString(r,!0)}function V(e,t){let i=0;const n=e.ts,r=e.ts+(e.dur||0);for(;i<t.length&&n<t[i];)++i;return t[i]=r,i}function _(e,t,i){const n=e.entryDecorations[t]||[];n.push(i),e.entryDecorations[t]=n}var z=Object.freeze({__proto__:null,buildGroupStyle:U,buildTrackHeader:W,getFormattedTime:O,getEventLevel:V,addDecorationToEvent:_});const G={animations:"Animations"},j=e.i18n.registerUIStrings("panels/timeline/AnimationsTrackAppender.ts",G),q=e.i18n.getLocalizedString.bind(void 0,j);class ${appenderName="Animations";#e;#t;constructor(e,t){this.#e=e,this.#t=t}appendTrackAtLevel(e,t){const i=this.#t.Animations.animations;return 0===i.length?e:(this.#i(e,t),this.#e.appendEventsAtLevel(i,e,this))}#i(e,t){const i=U({useFirstLineForOverview:!1}),n=W("animations",e,q(G.animations),i,!0,t);this.#e.registerTrackForGroup(n,this)}colorForEvent(){return t.ThemeSupport.instance().getComputedValue("--app-color-rendering")}titleForEvent(e){return e.name}highlightedEntryInfo(e){return{title:this.titleForEvent(e),formattedTime:O(e.dur)}}}var J=Object.freeze({__proto__:null,AnimationsTrackAppender:$});class K extends Event{duration;static eventName="traceload";constructor(e){super(K.eventName,{bubbles:!0,composed:!0}),this.duration=e}}var Y=Object.freeze({__proto__:null,TraceLoadEvent:K});class X{x;y;width;height;color;outlineColor;constructor([e,t,i,n]){this.x=e,this.y=t,this.width=i,this.height=n,this.color={r:238,g:111,b:99,a:.4},this.outlineColor={r:238,g:111,b:99,a:.7}}}let Z;class Q{static instance(e={forceNew:null}){const{forceNew:t}=e;return Z&&!t||(Z=new Q),Z}linkify(e,t){const i=document.createElement("span"),r=e,{x:a,y:s,width:o,height:l}=r;return i.textContent=`Location: [${a},${s}], Size: [${o}x${l}]`,i.addEventListener("mouseover",(()=>n.OverlayModel.OverlayModel.highlightRect(r))),i.addEventListener("mouseleave",(()=>n.OverlayModel.OverlayModel.clearHighlight())),i}}var ee=Object.freeze({__proto__:null,CLSRect:X,Linkifier:Q});const te={loading:"Loading",experience:"Experience",scripting:"Scripting",rendering:"Rendering",painting:"Painting",gpu:"GPU",async:"Async",system:"System",idle:"Idle",task:"Task",other:"Other",animation:"Animation",event:"Event",requestMainThreadFrame:"Request Main Thread Frame",frameStart:"Frame Start",onMessage:"On Message",schedulePostMessage:"Schedule postMessage",messaging:"Messaging",frameStartMainThread:"Frame Start (main thread)",drawFrame:"Draw Frame",profilingOverhead:"Profiling Overhead",hitTest:"Hit Test",scheduleStyleRecalculation:"Schedule Style Recalculation",recalculateStyle:"Recalculate Style",invalidateLayout:"Invalidate Layout",layerize:"Layerize",layout:"Layout",paintSetup:"Paint Setup",paintImage:"Paint Image",prePaint:"Pre-Paint",updateLayer:"Update Layer",updateLayerTree:"Update Layer Tree",paint:"Paint",rasterizePaint:"Rasterize Paint",scroll:"Scroll",commit:"Commit",compositeLayers:"Composite Layers",computeIntersections:"Compute Intersections",parseHtml:"Parse HTML",parseStylesheet:"Parse Stylesheet",installTimer:"Install Timer",removeTimer:"Remove Timer",timerFired:"Timer Fired",xhrReadyStateChange:"`XHR` Ready State Change",xhrLoad:"`XHR` Load",compileScript:"Compile Script",cacheScript:"Cache Script Code",compileCode:"Compile Code",optimizeCode:"Optimize Code",evaluateScript:"Evaluate Script",compileModule:"Compile Module",cacheModule:"Cache Module Code",evaluateModule:"Evaluate Module",streamingCompileTask:"Streaming Compile Task",waitingForNetwork:"Waiting for Network",parseAndCompile:"Parse and Compile",deserializeCodeCache:"Deserialize Code Cache",streamingWasmResponse:"Streaming Wasm Response",compiledWasmModule:"Compiled Wasm Module",cachedWasmModule:"Cached Wasm Module",wasmModuleCacheHit:"Wasm Module Cache Hit",wasmModuleCacheInvalid:"Wasm Module Cache Invalid",frameStartedLoading:"Frame Started Loading",onloadEvent:"Onload Event",domcontentloadedEvent:"DOMContentLoaded Event",firstPaint:"First Paint",firstContentfulPaint:"First Contentful Paint",largestContentfulPaint:"Largest Contentful Paint",timestamp:"Timestamp",consoleTime:"Console Time",userTiming:"User Timing",willSendRequest:"Will Send Request",sendRequest:"Send Request",receiveResponse:"Receive Response",finishLoading:"Finish Loading",receiveData:"Receive Data",runMicrotasks:"Run Microtasks",functionCall:"Function Call",gcEvent:"GC Event",majorGc:"Major GC",minorGc:"Minor GC",requestAnimationFrame:"Request Animation Frame",cancelAnimationFrame:"Cancel Animation Frame",animationFrameFired:"Animation Frame Fired",requestIdleCallback:"Request Idle Callback",cancelIdleCallback:"Cancel Idle Callback",fireIdleCallback:"Fire Idle Callback",createWebsocket:"Create WebSocket",sendWebsocketHandshake:"Send WebSocket Handshake",receiveWebsocketHandshake:"Receive WebSocket Handshake",wsMessageReceived:"Receive WebSocket Message",wsMessageSent:"Send WebSocket Message",destroyWebsocket:"Destroy WebSocket",embedderCallback:"Embedder Callback",imageDecode:"Image Decode",domGc:"DOM GC",cppGc:"CPP GC",encrypt:"Encrypt",encryptReply:"Encrypt Reply",decrypt:"Decrypt",decryptReply:"Decrypt Reply",digest:"Digest",digestReply:"Digest Reply",sign:"Sign",signReply:"Sign Reply",verify:"Verify",verifyReply:"Verify Reply",asyncTask:"Async Task",layoutShift:"Layout Shift",eventTiming:"Event Timing",jsFrame:"JS Frame",rasterizing:"Rasterizing",drawing:"Drawing"};var ie;let ne;!function(e){e.DRAWING="drawing",e.RASTERIZING="rasterizing",e.LAYOUT="layout",e.LOADING="loading",e.EXPERIENCE="experience",e.SCRIPTING="scripting",e.MESSAGING="messaging",e.RENDERING="rendering",e.PAINTING="painting",e.GPU="gpu",e.ASYNC="async",e.OTHER="other",e.IDLE="idle"}(ie||(ie={}));const re=e.i18n.registerUIStrings("panels/timeline/EventUICategory.ts",te),ae=e.i18n.getLocalizedString.bind(void 0,re);class se{title;category;hidden;constructor(e,t,i=!1){this.title=e,this.category=t,this.hidden=i}}class oe{name;title;visible;childColor;colorInternal;hiddenInternal;constructor(e,t,i,n,r){this.name=e,this.title=t,this.visible=i,this.childColor=n,this.colorInternal=r,this.hidden=!1}get hidden(){return Boolean(this.hiddenInternal)}get color(){return this.getComputedColorValue()}getCSSValue(){return`var(${this.colorInternal})`}getComputedColorValue(){return t.ThemeSupport.instance().getComputedValue(this.colorInternal)}set hidden(e){this.hiddenInternal=e}}let le,ce;function de(e){return pe()[e]}function he(e){return Object.values(ie).includes(e)}function me(){return le||(le={loading:new oe(ie.LOADING,ae(te.loading),!0,"--app-color-loading-children","--app-color-loading"),experience:new oe(ie.EXPERIENCE,ae(te.experience),!1,"--app-color-rendering-children","--app-color-rendering"),messaging:new oe(ie.MESSAGING,ae(te.messaging),!0,"--app-color-messaging-children","--app-color-messaging"),scripting:new oe(ie.SCRIPTING,ae(te.scripting),!0,"--app-color-scripting-children","--app-color-scripting"),rendering:new oe(ie.RENDERING,ae(te.rendering),!0,"--app-color-rendering-children","--app-color-rendering"),painting:new oe(ie.PAINTING,ae(te.painting),!0,"--app-color-painting-children","--app-color-painting"),gpu:new oe(ie.GPU,ae(te.gpu),!1,"--app-color-painting-children","--app-color-painting"),async:new oe(ie.ASYNC,ae(te.async),!1,"--app-color-async-children","--app-color-async"),other:new oe(ie.OTHER,ae(te.system),!1,"--app-color-system-children","--app-color-system"),idle:new oe(ie.IDLE,ae(te.idle),!1,"--app-color-idle-children","--app-color-idle"),layout:new oe(ie.LAYOUT,ae(te.layout),!1,"--app-color-loading-children","--app-color-loading"),rasterizing:new oe(ie.RASTERIZING,ae(te.rasterizing),!1,"--app-color-children","--app-color-scripting"),drawing:new oe(ie.DRAWING,ae(te.drawing),!1,"--app-color-rendering-children","--app-color-rendering")},le)}function pe(){if(ce)return ce;const e=me();return ce={RunTask:new se(ae(te.task),e.other),ProfileCall:new se(ae(te.jsFrame),e.scripting),JSSample:new se("JSSample",e.scripting),Program:new se(ae(te.other),e.other),"CpuProfiler::StartProfiling":new se(ae(te.profilingOverhead),e.other),Animation:new se(ae(te.animation),e.rendering),EventDispatch:new se(ae(te.event),e.scripting),RequestMainThreadFrame:new se(ae(te.requestMainThreadFrame),e.rendering,!0),BeginFrame:new se(ae(te.frameStart),e.rendering,!0),BeginMainThreadFrame:new se(ae(te.frameStartMainThread),e.rendering,!0),DrawFrame:new se(ae(te.drawFrame),e.rendering,!0),HitTest:new se(ae(te.hitTest),e.rendering),ScheduleStyleRecalculation:new se(ae(te.scheduleStyleRecalculation),e.rendering),UpdateLayoutTree:new se(ae(te.recalculateStyle),e.rendering),InvalidateLayout:new se(ae(te.invalidateLayout),e.rendering,!0),Layerize:new se(ae(te.layerize),e.rendering),Layout:new se(ae(te.layout),e.rendering),PaintSetup:new se(ae(te.paintSetup),e.painting),PaintImage:new se(ae(te.paintImage),e.painting,!0),UpdateLayer:new se(ae(te.updateLayer),e.painting,!0),UpdateLayerTree:new se(ae(te.updateLayerTree),e.rendering),Paint:new se(ae(te.paint),e.painting),PrePaint:new se(ae(te.prePaint),e.rendering),RasterTask:new se(ae(te.rasterizePaint),e.painting),ScrollLayer:new se(ae(te.scroll),e.rendering),Commit:new se(ae(te.commit),e.painting),CompositeLayers:new se(ae(te.compositeLayers),e.painting),ComputeIntersections:new se(ae(te.computeIntersections),e.rendering),ParseHTML:new se(ae(te.parseHtml),e.loading),ParseAuthorStyleSheet:new se(ae(te.parseStylesheet),e.loading),TimerInstall:new se(ae(te.installTimer),e.scripting),TimerRemove:new se(ae(te.removeTimer),e.scripting),TimerFire:new se(ae(te.timerFired),e.scripting),XHRReadyStateChange:new se(ae(te.xhrReadyStateChange),e.scripting),XHRLoad:new se(ae(te.xhrLoad),e.scripting),"v8.compile":new se(ae(te.compileScript),e.scripting),"v8.produceCache":new se(ae(te.cacheScript),e.scripting),"V8.CompileCode":new se(ae(te.compileCode),e.scripting),"V8.OptimizeCode":new se(ae(te.optimizeCode),e.scripting),EvaluateScript:new se(ae(te.evaluateScript),e.scripting),"V8.CompileModule":new se(ae(te.compileModule),e.scripting),"v8.produceModuleCache":new se(ae(te.cacheModule),e.scripting),"v8.evaluateModule":new se(ae(te.evaluateModule),e.scripting),"v8.parseOnBackground":new se(ae(te.streamingCompileTask),e.other),"v8.parseOnBackgroundWaiting":new se(ae(te.waitingForNetwork),e.idle),"v8.parseOnBackgroundParsing":new se(ae(te.parseAndCompile),e.scripting),"v8.deserializeOnBackground":new se(ae(te.deserializeCodeCache),e.scripting),"V8.FinalizeDeserialization":new se(ae(te.profilingOverhead),e.other),"v8.wasm.streamFromResponseCallback":new se(ae(te.streamingWasmResponse),e.scripting),"v8.wasm.compiledModule":new se(ae(te.compiledWasmModule),e.scripting),"v8.wasm.cachedModule":new se(ae(te.cachedWasmModule),e.scripting),"v8.wasm.moduleCacheHit":new se(ae(te.wasmModuleCacheHit),e.scripting),"v8.wasm.moduleCacheInvalid":new se(ae(te.wasmModuleCacheInvalid),e.scripting),FrameStartedLoading:new se(ae(te.frameStartedLoading),e.loading,!0),MarkLoad:new se(ae(te.onloadEvent),e.scripting,!0),MarkDOMContent:new se(ae(te.domcontentloadedEvent),e.scripting,!0),firstPaint:new se(ae(te.firstPaint),e.painting,!0),firstContentfulPaint:new se(ae(te.firstContentfulPaint),e.rendering,!0),"largestContentfulPaint::Candidate":new se(ae(te.largestContentfulPaint),e.rendering,!0),TimeStamp:new se(ae(te.timestamp),e.scripting),ConsoleTime:new se(ae(te.consoleTime),e.scripting),UserTiming:new se(ae(te.userTiming),e.scripting),ResourceWillSendRequest:new se(ae(te.willSendRequest),e.loading),ResourceSendRequest:new se(ae(te.sendRequest),e.loading),ResourceReceiveResponse:new se(ae(te.receiveResponse),e.loading),ResourceFinish:new se(ae(te.finishLoading),e.loading),ResourceReceivedData:new se(ae(te.receiveData),e.loading),RunMicrotasks:new se(ae(te.runMicrotasks),e.scripting),FunctionCall:new se(ae(te.functionCall),e.scripting),GCEvent:new se(ae(te.gcEvent),e.scripting),MajorGC:new se(ae(te.majorGc),e.scripting),MinorGC:new se(ae(te.minorGc),e.scripting),"CppGC.IncrementalSweep":new se(ae(te.cppGc),e.scripting),RequestAnimationFrame:new se(ae(te.requestAnimationFrame),e.scripting),CancelAnimationFrame:new se(ae(te.cancelAnimationFrame),e.scripting),FireAnimationFrame:new se(ae(te.animationFrameFired),e.scripting),RequestIdleCallback:new se(ae(te.requestIdleCallback),e.scripting),CancelIdleCallback:new se(ae(te.cancelIdleCallback),e.scripting),FireIdleCallback:new se(ae(te.fireIdleCallback),e.scripting),WebSocketCreate:new se(ae(te.createWebsocket),e.scripting),WebSocketSendHandshakeRequest:new se(ae(te.sendWebsocketHandshake),e.scripting),WebSocketReceiveHandshakeResponse:new se(ae(te.receiveWebsocketHandshake),e.scripting),WebSocketDestroy:new se(ae(te.destroyWebsocket),e.scripting),WebSocketSend:new se(ae(te.wsMessageSent),e.scripting),WebSocketReceive:new se(ae(te.wsMessageReceived),e.scripting),EmbedderCallback:new se(ae(te.embedderCallback),e.scripting),"Decode Image":new se(ae(te.imageDecode),e.painting),GPUTask:new se(ae(te.gpu),e.gpu),"BlinkGC.AtomicPhase":new se(ae(te.domGc),e.scripting),DoEncrypt:new se(ae(te.encrypt),e.scripting),DoEncryptReply:new se(ae(te.encryptReply),e.scripting),DoDecrypt:new se(ae(te.decrypt),e.scripting),DoDecryptReply:new se(ae(te.decryptReply),e.scripting),DoDigest:new se(ae(te.digest),e.scripting),DoDigestReply:new se(ae(te.digestReply),e.scripting),DoSign:new se(ae(te.sign),e.scripting),DoSignReply:new se(ae(te.signReply),e.scripting),DoVerify:new se(ae(te.verify),e.scripting),DoVerifyReply:new se(ae(te.verifyReply),e.scripting),AsyncTask:new se(ae(te.asyncTask),e.async),LayoutShift:new se(ae(te.layoutShift),e.experience),EventTiming:new se(ae(te.eventTiming),e.experience),HandlePostMessage:new se(ae(te.onMessage),e.messaging),SchedulePostMessage:new se(ae(te.schedulePostMessage),e.messaging)},ce}function ue(e){ce=e}function ge(e){le=e}function ve(){const e=pe(),t=[];for(const i in e){const n=i;e[n]?.hidden||t.push(i)}return t}function Te(){return ne||(ne=[ie.IDLE,ie.LOADING,ie.PAINTING,ie.RENDERING,ie.SCRIPTING,ie.OTHER],ne)}function fe(e){ne=e}var ye=Object.freeze({__proto__:null,get EventCategory(){return ie},TimelineRecordStyle:se,TimelineCategory:oe,getEventStyle:de,stringIsEventCategory:he,getCategoryStyles:me,maybeInitSylesMap:pe,setEventStylesMap:ue,setCategories:ge,visibleTypes:ve,getTimelineMainEventCategories:Te,setTimelineMainEventCategories:fe});let we=null;class be{static instance(e={forceNew:null}){const t=Boolean(e.forceNew);return we&&!t||(we=new be),we}static removeInstance(){we=null}#n=[];activeFilters(){return this.#n}setFilters(e){this.#n=e}isVisible(e){return this.#n.every((t=>t.accept(e)))}}let Se=null;class Ce{#r=new WeakSet;static instance(e={forceNew:!1}){return Se&&!e.forceNew||(Se=new Ce),Se}registerFreshRecording(e){this.#r.add(e)}recordingIsFresh(e){return this.#r.has(e)}}var Ee=Object.freeze({__proto__:null,Tracker:Ce});const ke=new CSSStyleSheet;ke.replaceSync('.content{margin-left:5px}.history-dropdown-button{width:160px;height:26px;text-align:left;display:flex;border:1px solid transparent}.history-dropdown-button[disabled]{opacity:50%;border:1px solid transparent}.history-dropdown-button > .content{padding-right:5px;overflow:hidden;text-overflow:ellipsis;flex:1 1;min-width:35px;&::after{float:right;user-select:none;mask-image:var(--image-file-triangle-down);width:14px;height:14px;content:"";position:absolute;background-color:var(--icon-default);right:-3px}}.history-dropdown-button:focus-visible::before{content:"";position:absolute;top:2px;left:0;right:0;bottom:2px;border-radius:2px;background:var(--divider-line)}@media (forced-colors: active){.history-dropdown-button[disabled]{opacity:100%}.history-dropdown-button > .content::after{background-color:ButtonText}.history-dropdown-button[disabled] > .content::after{background-color:GrayText}}\n/*# sourceURL=historyToolbarButton.css */\n');const xe={empty:"(empty)",selectJavascriptVmInstance:"Select JavaScript VM instance"},Pe=e.i18n.registerUIStrings("panels/timeline/IsolateSelector.ts",xe),Ie=e.i18n.getLocalizedString.bind(void 0,Pe);class Me extends u.Toolbar.ToolbarItem{menu;options;items;itemByIsolate=new Map;constructor(){const e=new f.SelectMenu.SelectMenu;super(e),this.menu=e,e.buttonTitle=Ie(xe.selectJavascriptVmInstance),e.showArrow=!0,e.style.whiteSpace="normal",e.addEventListener("selectmenuselected",this.#a.bind(this)),n.IsolateManager.IsolateManager.instance().observeIsolates(this),n.TargetManager.TargetManager.instance().addEventListener("NameChanged",this.targetChanged,this),n.TargetManager.TargetManager.instance().addEventListener("InspectedURLChanged",this.targetChanged,this)}#s(e,t){const i=new Map;for(const t of e.models()){const e=t.target(),a=n.TargetManager.TargetManager.instance().rootTarget()!==e?e.name():"",s=new r.ParsedURL.ParsedURL(e.inspectedURL()),o=s.isValid?s.domain():"",l=e.decorateLabel(o&&a?`${o}: ${a}`:a||o||Ie(xe.empty));i.set(l,(i.get(l)||0)+1)}t.removeChildren();for(const[e,n]of i){const i=n>1?`${e} (${n})`:e;t.createChild("div").textContent=i}}#a(e){this.itemByIsolate.forEach(((t,i)=>{if(t.selected=t.value===e.itemValue,t.selected){const e=t.textContent?.slice(0,29);this.menu.buttonTitle=e||Ie(xe.empty);const r=i.runtimeModel();u.Context.Context.instance().setFlavor(n.CPUProfilerModel.CPUProfilerModel,r&&r.target().model(n.CPUProfilerModel.CPUProfilerModel))}}))}isolateAdded(e){const t=new f.Menu.MenuItem;this.menu.appendChild(t),t.value=e.id(),this.itemByIsolate.set(e,t),this.#s(e,t)}isolateRemoved(e){const t=this.itemByIsolate.get(e);t&&(t.selected&&(this.menu.buttonTitle=Ie(xe.selectJavascriptVmInstance),u.Context.Context.instance().setFlavor(n.CPUProfilerModel.CPUProfilerModel,null)),this.menu.removeChild(t))}isolateChanged(e){const t=this.itemByIsolate.get(e);t&&this.#s(e,t)}targetChanged(e){const t=e.data.model(n.RuntimeModel.RuntimeModel);if(!t)return;const i=n.IsolateManager.IsolateManager.instance().isolateByModel(t);i&&this.isolateChanged(i)}}class Fe{#o=new Map;keyForEvent(e){if(i.Types.TraceEvents.isProfileCall(e))return`p-${e.pid}-${e.tid}-${i.Types.TraceEvents.SampleIndex(e.sampleIndex)}-${e.nodeId}`;const t=i.Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getRawTraceEvents(),n=i.Types.TraceEvents.isSyntheticBasedEvent(e)?`s-${t.indexOf(e.rawSourceEvent)}`:`r-${t.indexOf(e)}`;return n.length<3?null:n}eventForKey(e,t){const n=i.Types.File.traceEventKeyToValues(e);if(Fe.isProfileCallKey(n))return this.#l(n,t);if(Fe.isSyntheticEventKey(n)){const e=i.Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getSyntheticTraceEvents().at(n.rawIndex);if(!e)throw new Error(`Attempted to get a synthetic event from an unknown raw event index: ${n.rawIndex}`);return e}if(Fe.isRawEventKey(n)){return i.Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getRawTraceEvents()[n.rawIndex]}throw new Error(`Unknown trace event serializable key values: ${n.join("-")}`)}static isProfileCallKey(e){return"p"===e.type}static isRawEventKey(e){return"r"===e.type}static isSyntheticEventKey(e){return"s"===e.type}#l(e,t){const i=this.#o.get(e);if(i)return i;const n=t.Renderer.processes.get(e.processID)?.threads.get(e.threadID)?.profileCalls;if(!n)throw new Error(`Unknown profile call serializable key: ${e}`);const r=c.ArrayUtilities.nearestIndexFromBeginning(n,(t=>t.sampleIndex>=e.sampleIndex&&t.nodeId>=e.protocol)),a=null!==r&&n.at(r);if(!a)throw new Error(`Unknown profile call serializable key: ${e}`);return this.#o.set(e,a),a}}var Le=Object.freeze({__proto__:null,EventsSerializer:Fe});const Re=[];let De;class Ae extends Event{overlay;action;static eventName="annotationmodifiedevent";constructor(e,t){super(Ae.eventName),this.overlay=e,this.action=t}}class Be extends EventTarget{#c;#d;#h=null;#t;#m;#p;static activeManager(){return De}static initAndActivateModificationsManager(e,t){Re[t]&&(De=Re[t],Be.activeManager()?.applyModificationsIfPresent());const i=e.traceParsedData(t);if(!i)throw new Error("ModificationsManager was initialized without a corresponding trace data");const n=i.Meta.traceBounds,r=e.rawTraceEvents(t);if(!r)throw new Error("ModificationsManager was initialized without a corresponding raw trace events array");const a=e.syntheticTraceEventsManager(t);if(!a)throw new Error("ModificationsManager was initialized without a corresponding SyntheticEventsManager");const s=e.metadata(t),o=new Be({traceParsedData:i,traceBounds:n,rawTraceEvents:r,modifications:s?.modifications,syntheticEvents:a.getSyntheticTraceEvents()});return Re[t]=o,De=o,Be.activeManager()?.applyModificationsIfPresent(),this.activeManager()}constructor({traceParsedData:e,traceBounds:t,modifications:n}){super();const r=new Map([...e.Samples.entryToNode,...e.Renderer.entryToNode]);this.#c=new i.EntriesFilter.EntriesFilter(r),this.#d=new s.Breadcrumbs.Breadcrumbs(t),this.#h=n||null,this.#t=e,this.#m=new Fe,this.#p=new Map}getEntriesFilter(){return this.#c}getTimelineBreadcrumbs(){return this.#d}createAnnotation(e){const t={type:"ENTRY_LABEL",entry:e.entry,label:e.label};this.#p.set(e,t),this.dispatchEvent(new Ae(t,"Add"))}removeAnnotation(e){const t=this.#p.get(e);t?(this.#p.delete(e),this.dispatchEvent(new Ae(t,"Remove"))):console.warn("Overlay for deleted Annotation does not exist")}removeAnnotationOverlay(e){const t=this.#u(e);t?(this.#p.delete(t),this.dispatchEvent(new Ae(e,"Remove"))):console.warn("Annotation for deleted Overlay does not exist")}updateAnnotationOverlay(e){const t=this.#u(e);t?("ENTRY_LABEL"===e.type&&(t.label=e.label),this.dispatchEvent(new Ae(e,"UpdateLabel"))):console.warn("Annotation for updated Overlay does not exist")}#u(e){for(const[t,i]of this.#p.entries())if(i===e)return t;return null}getAnnotations(){return[...this.#p.keys()]}getOverlays(){return[...this.#p.values()]}toJSON(){const e=this.#c.invisibleEntries().map((e=>this.#m.keyForEvent(e))).filter((e=>null!==e)),t=this.#c.expandableEntries().map((e=>this.#m.keyForEvent(e))).filter((e=>null!==e));return this.#h={entriesModifications:{hiddenEntries:e,expandableEntries:t},initialBreadcrumb:this.#d.initialBreadcrumb,annotations:this.#g()},this.#h}#g(){const e=this.getAnnotations(),t=[];for(let i=0;i<e.length;i++)if("ENTRY_LABEL"===e[i].type){const n=this.#m.keyForEvent(e[i].entry);n&&t.push({entry:n,label:e[i].label})}return{entryLabels:t}}applyModificationsIfPresent(){const e=this.#h;if(!e||!e.annotations)return;const t=e.entriesModifications.hiddenEntries,i=e.entriesModifications.expandableEntries;this.#v(t,i),this.#d.setInitialBreadcrumbFromLoadedModifications(e.initialBreadcrumb);e.annotations.entryLabels.forEach((e=>{this.createAnnotation({type:"ENTRY_LABEL",entry:this.#m.eventForKey(e.entry,this.#t),label:e.label})}))}#v(e,t){const i=e.map((e=>this.#m.eventForKey(e,this.#t))),n=t.map((e=>this.#m.eventForKey(e,this.#t)));this.#c.setHiddenAndExpandableEntries(i,n)}}var Ne=Object.freeze({__proto__:null,AnnotationModifiedEvent:Ae,ModificationsManager:Be});function*He(e){if(yield"[\n",e.length>0){const t=e[Symbol.iterator](),i=t.next().value;yield` ${JSON.stringify(i)}`;let n=1e4,r="";for(const e of t)r+=`,\n ${JSON.stringify(e)}`,n--,0===n&&(yield r,n=1e4,r="");yield r}yield"\n]"}function*Ue(e,t){yield`{"metadata": ${JSON.stringify(t||{},null,2)}`,yield',\n"traceEvents": ',yield*He(e),yield"}\n"}function We(e){return JSON.stringify(e)}var Oe=Object.freeze({__proto__:null,arrayOfObjectsJsonGenerator:He,traceJsonGenerator:Ue,cpuprofileJsonGenerator:We});class Ve extends Event{static eventName="nodenamesupdated";constructor(){super(Ve.eventName,{composed:!0,bubbles:!0})}}const _e=new Map;class ze extends EventTarget{#T;#f=!1;#y=new Set;constructor(e){super(),this.#T=e}static clearResolvedNodeNames(){_e.clear()}static resolvedNodeNameForEntry(e){return _e.get(e.pid)?.get(e.tid)?.get(e.nodeId)??null}static storeResolvedNodeNameForEntry(e,t,i,n){const r=_e.get(e)||new Map,a=r.get(t)||new Map;a.set(i,n),r.set(t,a),_e.set(e,r)}async install(){if(this.#T.Samples){for(const e of this.#T.Samples.profilesInProcess.values())for(const[t,i]of e){const e=i.parsedProfile.nodes();if(!e||0===e.length)continue;const r=this.#w(t),a=r?.model(n.DebuggerModel.DebuggerModel);if(a)for(const t of e){const e=a.scriptForId(String(t.callFrame.scriptId));(!e||e.sourceMapURL)&&this.#y.add(a)}}for(const e of this.#y)e.sourceMapManager().addEventListener(n.SourceMapManager.Events.SourceMapAttached,this.#b,this);await this.#S()}}uninstall(){for(const e of this.#y)e.sourceMapManager().removeEventListener(n.SourceMapManager.Events.SourceMapAttached,this.#b,this);this.#y.clear()}async#S(){if(this.#T.Samples){for(const[e,t]of this.#T.Samples.profilesInProcess)for(const[i,n]of t){const t=n.parsedProfile.nodes()??[],r=this.#w(i);if(r)for(const n of t){const t=await y.NamesResolver.resolveProfileFrameFunctionName(n.callFrame,r);n.setFunctionName(t),ze.storeResolvedNodeNameForEntry(e,i,n.id,t)}}this.dispatchEvent(new Ve)}}#b(){this.#f||(this.#f=!0,setTimeout((async()=>{this.#f=!1,await this.#S()}),500))}#w(e){const t=this.#T.Workers.workerIdByThread.get(e);return t?n.TargetManager.TargetManager.instance().targetById(t):n.TargetManager.TargetManager.instance().primaryPageTarget()}}var Ge=Object.freeze({__proto__:null,NodeNamesUpdated:Ve,SourceMapsResolver:ze});const je={tracingNotSupported:"Performance trace recording not supported for this type of target"},qe=e.i18n.registerUIStrings("panels/timeline/TimelineController.ts",je),$e=e.i18n.getLocalizedString.bind(void 0,qe);class Je{primaryPageTarget;rootTarget;tracingManager;#C=[];#E=null;client;tracingCompleteCallback;constructor(e,t,n){this.primaryPageTarget=t,this.rootTarget=e,this.tracingManager=e.model(i.TracingManager.TracingManager),this.client=n}async dispose(){this.tracingManager&&await this.tracingManager.reset()}async startRecording(e){function t(e){return"disabled-by-default-"+e}const r=[a.Runtime.experiments.isEnabled("timeline-show-all-events")?"*":"-*",i.Types.TraceEvents.Categories.Console,i.Types.TraceEvents.Categories.Loading,i.Types.TraceEvents.Categories.UserTiming,"devtools.timeline",t("devtools.timeline"),t("devtools.timeline.frame"),t("devtools.timeline.stack"),t("v8.compile"),t("v8.cpu_profiler.hires"),t("lighthouse"),"v8.execute","v8","cppgc","navigation,rail"];a.Runtime.experiments.isEnabled("timeline-v8-runtime-call-stats")&&e.enableJSSampling&&r.push(t("v8.runtime_stats_sampling")),e.enableJSSampling&&r.push(t("v8.cpu_profiler")),a.Runtime.experiments.isEnabled("timeline-invalidation-tracking")&&r.push(t("devtools.timeline.invalidationTracking")),e.capturePictures&&r.push(t("devtools.timeline.layers"),t("devtools.timeline.picture"),t("blink.graphics_context_annotations")),e.captureFilmStrip&&r.push(t("devtools.screenshot")),e.captureSelectorStats&&r.push(t("blink.debug")),a.Runtime.experiments.isEnabled("timeline-enhanced-traces")&&(r.push(t("devtools.target-rundown")),r.push(t("devtools.v8-source-rundown"))),a.Runtime.experiments.isEnabled("timeline-compiled-sources")&&r.push(t("devtools.v8-source-rundown-sources")),this.#E=Date.now();const s=await this.startRecordingWithCategories(r.join(","));return s.getError()&&(await this.waitForTracingToStop(!1),await n.TargetManager.TargetManager.instance().resumeAllTargets()),s}async stopRecording(){this.tracingManager&&this.tracingManager.stop(),this.client.loadingStarted(),await this.waitForTracingToStop(!0),await this.allSourcesFinished()}async waitForTracingToStop(e){const t=[];this.tracingManager&&e&&t.push(new Promise((e=>{this.tracingCompleteCallback=e}))),await Promise.all(t)}async startRecordingWithCategories(e){if(!this.tracingManager)throw new Error($e(je.tracingNotSupported));await n.TargetManager.TargetManager.instance().suspendAllTargets("performance-timeline");const t=await this.tracingManager.start(this,e,"");return await this.warmupJsProfiler(),w.ExtensionServer.ExtensionServer.instance().profilingStarted(),t}async warmupJsProfiler(){const e=this.primaryPageTarget.model(n.RuntimeModel.RuntimeModel);e&&await e.agent.invoke_evaluate({expression:"(async function(){ await 1; })()",throwOnSideEffect:!0})}traceEventsCollected(e){this.#C.push(...e)}tracingComplete(){this.tracingCompleteCallback&&(this.tracingCompleteCallback(void 0),this.tracingCompleteCallback=null)}async allSourcesFinished(){this.client.processingStarted(),await this.finalizeTrace()}async finalizeTrace(){await n.TargetManager.TargetManager.instance().resumeAllTargets(),w.ExtensionServer.ExtensionServer.instance().profilingStopped(),await this.client.loadingComplete(this.#C,null,!1,this.#E,null),this.client.loadingCompleteForTest()}tracingBufferUsage(e){this.client.recordingProgress(e)}eventsRetrievalProgress(e){this.client.loadingProgress(e)}}var Ke=Object.freeze({__proto__:null,TimelineController:Je});const Ye={jsHeap:"JS Heap",documents:"Documents",nodes:"Nodes",listeners:"Listeners",gpuMemory:"GPU Memory",ss:"[{PH1} – {PH2}]"},Xe=e.i18n.registerUIStrings("panels/timeline/CountersGraph.ts",Ye),Ze=e.i18n.getLocalizedString.bind(void 0,Xe);class Qe extends u.Widget.VBox{delegate;calculator;header;toolbar;graphsContainer;canvasContainer;canvas;timelineGrid;counters;counterUI;countersByName;gpuMemoryCounter;#k=null;currentValuesBar;markerXPosition;#x=this.#P.bind(this);constructor(e){super(),this.element.id="memory-graphs-container",this.delegate=e,this.calculator=new it,this.header=new u.Widget.HBox,this.header.element.classList.add("timeline-memory-header"),this.header.show(this.element),this.toolbar=new u.Toolbar.Toolbar("timeline-memory-toolbar"),this.header.element.appendChild(this.toolbar.element),this.graphsContainer=new u.Widget.VBox,this.graphsContainer.show(this.element);const t=new u.Widget.VBoxWithResizeCallback(this.resize.bind(this));t.show(this.graphsContainer.element),this.createCurrentValuesBar(),this.canvasContainer=t.element,this.canvasContainer.id="memory-graphs-canvas-container",this.canvas=document.createElement("canvas"),this.canvasContainer.appendChild(this.canvas),this.canvas.id="memory-counters-graph",this.canvasContainer.addEventListener("mouseover",this.onMouseMove.bind(this),!0),this.canvasContainer.addEventListener("mousemove",this.onMouseMove.bind(this),!0),this.canvasContainer.addEventListener("mouseleave",this.onMouseLeave.bind(this),!0),this.canvasContainer.addEventListener("click",this.onClick.bind(this),!0),this.timelineGrid=new p.TimelineGrid.TimelineGrid,this.canvasContainer.appendChild(this.timelineGrid.dividersElement),this.counters=[],this.counterUI=[],this.countersByName=new Map,this.countersByName.set("jsHeapSizeUsed",this.createCounter(Ze(Ye.jsHeap),"js-heap-size-used","hsl(220, 90%, 43%)",c.NumberUtilities.bytesToString)),this.countersByName.set("documents",this.createCounter(Ze(Ye.documents),"documents","hsl(0, 90%, 43%)")),this.countersByName.set("nodes",this.createCounter(Ze(Ye.nodes),"nodes","hsl(120, 90%, 43%)")),this.countersByName.set("jsEventListeners",this.createCounter(Ze(Ye.listeners),"js-event-listeners","hsl(38, 90%, 43%)")),this.gpuMemoryCounter=this.createCounter(Ze(Ye.gpuMemory),"gpu-memory-used-kb","hsl(300, 90%, 43%)",c.NumberUtilities.bytesToString),this.countersByName.set("gpuMemoryUsedKB",this.gpuMemoryCounter),h.TraceBounds.onChange(this.#x)}#P(e){if("RESET"===e.updateType||"VISIBLE_WINDOW"===e.updateType){const t=e.state.milli.timelineTraceWindow;this.calculator.setWindow(t.min,t.max),this.#I()}}setModel(e,t){if(this.#k=t,!t)return;const n=e?i.Helpers.Timing.traceWindowMilliSeconds(e.Meta.traceBounds).min:0;this.calculator.setZeroTime(n);for(let e=0;e<this.counters.length;++e)this.counters[e].reset(),this.counterUI[e].reset();this.#I();for(let e=0;e<t.length;++e){const n=t[e];if(!i.Types.TraceEvents.isTraceEventUpdateCounters(n))continue;const r=n.args.data;if(!r)return;for(const e in r){const t=this.countersByName.get(e);if(t){const{startTime:a}=i.Helpers.Timing.eventTimingsMilliSeconds(n);t.appendSample(a,r[e])}}void 0!==r.gpuMemoryLimitKB&&this.gpuMemoryCounter.setLimit(r.gpuMemoryLimitKB)}}createCurrentValuesBar(){this.currentValuesBar=this.graphsContainer.element.createChild("div"),this.currentValuesBar.id="counter-values-bar"}createCounter(e,t,i,n){const r=new et;return this.counters.push(r),this.counterUI.push(new tt(this,e,t,i,r,n)),r}resizerElement(){return this.header.element}resize(){const e=this.canvas.parentElement;this.canvas.width=e.clientWidth*window.devicePixelRatio,this.canvas.height=e.clientHeight*window.devicePixelRatio,this.calculator.setDisplayWidth(this.canvas.width),this.refresh()}#I(){u.UIUtils.invokeOnceAfterBatchUpdate(this,this.refresh)}draw(){this.clear();for(const e of this.counters)e.calculateVisibleIndexes(this.calculator),e.calculateXValues(this.canvas.width);for(const e of this.counterUI)e.drawGraph(this.canvas)}onClick(e){const t=e.x-this.canvasContainer.getBoundingClientRect().left;let i,n=1/0;for(const e of this.counterUI){if(!e.counter.times.length)continue;const r=e.recordIndexAt(t),a=Math.abs(t*window.devicePixelRatio-e.counter.x[r]);a<n&&(n=a,i=e.counter.times[r])}void 0!==i&&this.#k&&this.delegate.selectEntryAtTime(this.#k,i)}onMouseLeave(e){delete this.markerXPosition,this.clearCurrentValueAndMarker()}clearCurrentValueAndMarker(){for(let e=0;e<this.counterUI.length;e++)this.counterUI[e].clearCurrentValueAndMarker()}onMouseMove(e){const t=e.x-this.canvasContainer.getBoundingClientRect().left;this.markerXPosition=t,this.refreshCurrentValues()}refreshCurrentValues(){if(void 0!==this.markerXPosition)for(let e=0;e<this.counterUI.length;++e)this.counterUI[e].updateCurrentValue(this.markerXPosition)}refresh(){this.timelineGrid.updateDividers(this.calculator),this.draw(),this.refreshCurrentValues()}clear(){const e=this.canvas.getContext("2d");if(!e)throw new Error("Unable to get canvas context");e.clearRect(0,0,e.canvas.width,e.canvas.height)}}class et{times;values;x;minimumIndex;maximumIndex;maxTime;minTime;limitValue;constructor(){this.times=[],this.values=[],this.x=[],this.minimumIndex=0,this.maximumIndex=0,this.maxTime=0,this.minTime=0}appendSample(e,t){this.values.length&&this.values[this.values.length-1]===t||(this.times.push(e),this.values.push(t))}reset(){this.times=[],this.values=[]}setLimit(e){this.limitValue=e}calculateBounds(){let e,t;for(let i=this.minimumIndex;i<=this.maximumIndex;i++){const n=this.values[i];(void 0===t||n<t)&&(t=n),(void 0===e||n>e)&&(e=n)}return t=t||0,e=e||1,this.limitValue&&(e>.5*this.limitValue&&(e=Math.max(e,this.limitValue)),t=Math.min(t,this.limitValue)),{min:t,max:e}}calculateVisibleIndexes(e){const t=e.minimumBoundary(),i=e.maximumBoundary();this.minimumIndex=c.NumberUtilities.clamp(c.ArrayUtilities.upperBound(this.times,t,c.ArrayUtilities.DEFAULT_COMPARATOR)-1,0,this.times.length-1),this.maximumIndex=c.NumberUtilities.clamp(c.ArrayUtilities.lowerBound(this.times,i,c.ArrayUtilities.DEFAULT_COMPARATOR),0,this.times.length-1),this.minTime=t,this.maxTime=i}calculateXValues(e){if(!this.values.length)return;const t=e/(this.maxTime-this.minTime);this.x=new Array(this.values.length);for(let e=this.minimumIndex+1;e<=this.maximumIndex;e++)this.x[e]=t*(this.times[e]-this.minTime)}}class tt{countersPane;counter;formatter;setting;filter;range;value;graphColor;limitColor;graphYValues;verticalPadding;currentValueLabel;marker;constructor(e,t,i,n,a,s){this.countersPane=e,this.counter=a,this.formatter=s||c.NumberUtilities.withThousandsSeparator,this.setting=r.Settings.Settings.instance().createSetting("timeline-counters-graph-"+i,!0),this.setting.setTitle(t),this.filter=new u.Toolbar.ToolbarSettingCheckbox(this.setting,t),this.filter.inputElement.classList.add("-theme-preserve-input");const o=r.Color.parse(n);if(o){const e=o.setAlpha(.5).asString("rgba"),t=this.filter.element;e&&(t.style.backgroundColor=e),t.style.borderColor="transparent"}this.filter.inputElement.addEventListener("click",this.toggleCounterGraph.bind(this)),e.toolbar.appendToolbarItem(this.filter),this.range=this.filter.element.createChild("span","range"),this.value=e.currentValuesBar.createChild("span","memory-counter-value"),this.value.style.color=n,this.graphColor=n,o&&(this.limitColor=o.setAlpha(.3).asString("rgba")),this.graphYValues=[],this.verticalPadding=10,this.currentValueLabel=t,this.marker=e.canvasContainer.createChild("div","memory-counter-marker"),this.marker.style.backgroundColor=n,this.clearCurrentValueAndMarker()}reset(){this.range.textContent=""}setRange(e,t){const i=this.formatter(e),n=this.formatter(t);this.range.textContent=Ze(Ye.ss,{PH1:i,PH2:n})}toggleCounterGraph(){this.value.classList.toggle("hidden",!this.filter.checked()),this.countersPane.refresh()}recordIndexAt(e){return c.ArrayUtilities.upperBound(this.counter.x,e*window.devicePixelRatio,c.ArrayUtilities.DEFAULT_COMPARATOR,this.counter.minimumIndex+1,this.counter.maximumIndex+1)-1}updateCurrentValue(e){if(!this.visible()||!this.counter.values.length||!this.counter.x)return;const t=this.recordIndexAt(e),i=c.NumberUtilities.withThousandsSeparator(this.counter.values[t]);this.value.textContent=`${this.currentValueLabel}: ${i}`;const n=this.graphYValues[t]/window.devicePixelRatio;this.marker.style.left=e+"px",this.marker.style.top=n+"px",this.marker.classList.remove("hidden")}clearCurrentValueAndMarker(){this.value.textContent="",this.marker.classList.add("hidden")}drawGraph(e){const t=e.getContext("2d");if(!t)throw new Error("Unable to get canvas context");const i=e.width,n=e.height-2*this.verticalPadding;if(n<=0)return void(this.graphYValues=[]);const r=this.verticalPadding,a=this.counter,s=a.values;if(!s.length)return;const o=a.calculateBounds(),l=o.min,c=o.max;if(this.setRange(l,c),!this.visible())return;const d=this.graphYValues,h=c-l,m=h?n/h:1;t.save(),t.lineWidth=window.devicePixelRatio,t.lineWidth%2&&t.translate(.5,.5),t.beginPath();let p=s[a.minimumIndex],u=Math.round(r+n-(p-l)*m);t.moveTo(0,u);let g=a.minimumIndex;for(;g<=a.maximumIndex;g++){const e=Math.round(a.x[g]);t.lineTo(e,u);const i=s[g];void 0!==i&&(p=i),u=Math.round(r+n-(p-l)*m),t.lineTo(e,u),d[g]=u}if(d.length=g,t.lineTo(i,u),t.strokeStyle=this.graphColor,t.stroke(),a.limitValue){const e=Math.round(r+n-(a.limitValue-l)*m);t.moveTo(0,e),t.lineTo(i,e),this.limitColor&&(t.strokeStyle=this.limitColor),t.stroke()}t.closePath(),t.restore()}visible(){return this.filter.checked()}}class it{minimumBoundaryInternal;maximumBoundaryInternal;workingArea;zeroTimeInternal;constructor(){this.minimumBoundaryInternal=0,this.maximumBoundaryInternal=0,this.workingArea=0,this.zeroTimeInternal=0}setZeroTime(e){this.zeroTimeInternal=e}computePosition(e){return(e-this.minimumBoundaryInternal)/this.boundarySpan()*this.workingArea}setWindow(e,t){this.minimumBoundaryInternal=e,this.maximumBoundaryInternal=t}setDisplayWidth(e){this.workingArea=e}formatValue(t,i){return e.TimeUtilities.preciseMillisToString(t-this.zeroTime(),i)}maximumBoundary(){return this.maximumBoundaryInternal}minimumBoundary(){return this.minimumBoundaryInternal}zeroTime(){return this.zeroTimeInternal}boundarySpan(){return this.maximumBoundaryInternal-this.minimumBoundaryInternal}}var nt=Object.freeze({__proto__:null,CountersGraph:Qe,Counter:et,CounterUI:tt,Calculator:it});function rt(e,t){const i=n.TargetManager.TargetManager.instance(),r=e.Workers.workerIdByThread.get(t.tid);return r?i.targetById(r):i.primaryPageTarget()}var at=Object.freeze({__proto__:null,targetForEvent:rt});const st=new CSSStyleSheet;st.replaceSync(".token-variable{color:var(--sys-color-token-variable)}.token-property{color:var(--sys-color-token-property)}.token-type{color:var(--sys-color-token-type)}.token-variable-special{color:var(--sys-color-token-variable-special)}.token-definition{color:var(--sys-color-token-definition)}.token-builtin{color:var(--sys-color-token-builtin)}.token-number{color:var(--sys-color-token-number)}.token-string{color:var(--sys-color-token-string)}.token-string-special{color:var(--sys-color-token-string-special)}.token-atom{color:var(--sys-color-token-atom)}.token-keyword{color:var(--sys-color-token-keyword)}.token-comment{color:var(--sys-color-token-comment)}.token-meta{color:var(--sys-color-token-meta)}.token-invalid{color:var(--sys-color-error)}.token-tag{color:var(--sys-color-token-tag)}.token-attribute{color:var(--sys-color-token-attribute)}.token-attribute-value{color:var(--sys-color-token-attribute-value)}.token-inserted{color:var(--sys-color-token-inserted)}.token-deleted{color:var(--sys-color-token-deleted)}.token-heading{color:var(--sys-color-token-variable-special);font-weight:bold}.token-link{color:var(--sys-color-token-variable-special);text-decoration:underline}.token-strikethrough{text-decoration:strike-through}.token-strong{font-weight:bold}.token-emphasis{font-style:italic}\n/*# sourceURL=codeHighlighter.css */\n");const ot=new CSSStyleSheet;ot.replaceSync(".image-preview-container{background:transparent;text-align:center;border-spacing:0}.image-preview-container img{margin:6px 0;max-width:100px;max-height:100px;background-image:var(--image-file-checker);user-select:text;vertical-align:top;-webkit-user-drag:auto}.image-container{padding:0}.image-container > div{min-height:50px;display:flex;align-items:center;justify-content:center;cursor:pointer}.image-preview-container .row{line-height:1.2;vertical-align:baseline}.image-preview-container .title{padding-right:0.5em;text-align:right;color:var(--sys-color-token-subtle);white-space:nowrap}.image-preview-container .description{white-space:nowrap;text-align:left;color:var(--sys-color-on-surface)}.image-preview-container .description-link{max-width:20em}.image-preview-container .source-link{white-space:normal;word-break:break-all;color:var(--sys-color-primary);cursor:pointer}\n/*# sourceURL=imagePreview.css */\n");const lt=new CSSStyleSheet;lt.replaceSync('*{box-sizing:border-box;min-width:0;min-height:0}:root{height:100%;overflow:hidden;--legacy-accent-color:#1a73e8;--legacy-accent-fg-color:#1a73e8;--legacy-accent-color-hover:#3b86e8;--legacy-accent-fg-color-hover:#1567d3;--legacy-active-control-bg-color:#5a5a5a;--legacy-focus-bg-color:hsl(214deg 40% 92%);--legacy-focus-ring-inactive-shadow-color:#e0e0e0;--legacy-input-validation-error:#db1600;--legacy-toolbar-hover-bg-color:#eaeaea;--legacy-selection-fg-color:#fff;--legacy-selection-bg-color:var(--legacy-accent-color);--legacy-selection-inactive-fg-color:#5a5a5a;--legacy-selection-inactive-bg-color:#dadada;--legacy-divider-border:1px solid var(--sys-color-divider);--legacy-focus-ring-inactive-shadow:0 0 0 1px var(--legacy-focus-ring-inactive-shadow-color);--legacy-focus-ring-active-shadow:0 0 0 1px var(--legacy-accent-color);--legacy-item-selection-bg-color:#cfe8fc;--legacy-item-selection-inactive-bg-color:#e0e0e0;--monospace-font-size:10px;--monospace-font-family:monospace;--source-code-font-size:11px;--source-code-font-family:monospace;--sys-motion-duration-short4:200ms;--sys-motion-duration-medium2:300ms;--sys-motion-duration-long2:500ms;--sys-motion-easing-emphasized:cubic-bezier(0.2,0,0,1);--sys-motion-easing-emphasized-decelerate:cubic-bezier(0.05,0.7,0.1,1);--sys-motion-easing-emphasized-accelerate:cubic-bezier(0.2,0,0,1)}.theme-with-dark-background{color-scheme:dark;--legacy-accent-color:#0e639c;--legacy-accent-fg-color:#ccc;--legacy-accent-fg-color-hover:#fff;--legacy-accent-color-hover:rgb(17 119 187);--legacy-active-control-bg-color:#cdcdcd;--legacy-focus-bg-color:hsl(214deg 19% 27%);--legacy-focus-ring-inactive-shadow-color:#5a5a5a;--legacy-toolbar-hover-bg-color:#202020;--legacy-selection-fg-color:#cdcdcd;--legacy-selection-inactive-fg-color:#cdcdcd;--legacy-selection-inactive-bg-color:hsl(0deg 0% 28%);--legacy-focus-ring-inactive-shadow:0 0 0 1px var(--legacy-focus-ring-inactive-shadow-color);--legacy-item-selection-bg-color:hsl(207deg 88% 22%);--legacy-item-selection-inactive-bg-color:#454545}body{--default-font-family:".SFNSDisplay-Regular","Helvetica Neue","Lucida Grande",sans-serif;height:100%;width:100%;position:relative;overflow:hidden;margin:0;cursor:default;font-family:var(--default-font-family);font-size:12px;tab-size:4;user-select:none;color:var(--sys-color-on-surface);background:var(--sys-color-cdt-base-container)}.platform-linux{--default-font-family:"Google Sans Text","Google Sans",system-ui,sans-serif}.platform-mac{--default-font-family:system-ui,sans-serif}.platform-windows{--default-font-family:system-ui,sans-serif}:focus{outline-width:0}.platform-mac,\n:host-context(.platform-mac){--monospace-font-size:11px;--monospace-font-family:monospace;--source-code-font-size:11px;--source-code-font-family:monospace}.platform-windows,\n:host-context(.platform-windows){--monospace-font-size:12px;--monospace-font-family:monospace;--source-code-font-size:12px;--source-code-font-family:monospace}.platform-linux,\n:host-context(.platform-linux){--monospace-font-size:11px;--monospace-font-family:"Noto Sans Mono","DejaVu Sans Mono",monospace;--source-code-font-size:11px;--source-code-font-family:"Noto Sans Mono","DejaVu Sans Mono",monospace}.monospace{font-family:var(--monospace-font-family);font-size:var(--monospace-font-size)!important}.source-code{font-family:var(--source-code-font-family);font-size:var(--source-code-font-size)!important;white-space:pre-wrap}.source-code .devtools-link.text-button{max-width:100%;overflow:hidden;text-overflow:ellipsis}img{-webkit-user-drag:none}iframe,\na img{border:none}.fill{position:absolute;top:0;left:0;right:0;bottom:0}iframe.fill{width:100%;height:100%}.widget{position:relative;flex:auto;contain:style}.hbox{display:flex;flex-direction:row!important;position:relative}.vbox{display:flex;flex-direction:column!important;position:relative}.view-container > .toolbar{border-bottom:1px solid var(--sys-color-divider)}.flex-auto{flex:auto}.flex-none{flex:none}.flex-centered{display:flex;align-items:center;justify-content:center}.overflow-auto{overflow:auto;background-color:var(--sys-color-cdt-base-container)}iframe.widget{position:absolute;width:100%;height:100%;left:0;right:0;top:0;bottom:0}.hidden{display:none!important}.highlighted-search-result{border-radius:1px;background-color:var(--sys-color-yellow-container);outline:1px solid var(--sys-color-yellow-container)}.link{cursor:pointer;text-decoration:underline;color:var(--sys-color-primary);outline-offset:2px}button,\ninput,\nselect{font-family:inherit;font-size:inherit}select option,\nselect optgroup,\ninput{background-color:var(--sys-color-cdt-base-container)}input{color:inherit;&[type="checkbox"]{position:relative;&:hover::after,\n &:active::before{content:"";height:24px;width:24px;border-radius:var(--sys-shape-corner-full);position:absolute;top:-6px;left:-6px}&:not(.-theme-preserve){accent-color:var(--sys-color-primary-bright);color:var(--sys-color-on-primary)}&:not(:disabled):hover::after{background-color:var(--sys-color-state-hover-on-subtle)}&:not(:disabled):active::before{background-color:var(--sys-color-state-ripple-neutral-on-subtle)}&:not(:disabled):focus-visible{outline:none;&::before{content:"";height:15px;width:15px;border-radius:5px;position:absolute;top:-3.5px;left:-3.5px;border:2px solid var(--sys-color-state-focus-ring)}}&.small:hover::after,\n &.small:active::before{height:12px;width:12px;top:0;left:0;border-radius:2px}}}input::placeholder{--override-input-placeholder-color:rgb(0 0 0/54%);color:var(--override-input-plac