@react-native/debugger-frontend 0.73.0-nightly-20230922-52104c6ee

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (656) hide show
  1. package/BUILD_INFO +10 -0
  2. package/README.md +22 -0
  3. package/dist/third-party/LICENSE +28 -0
  4. package/dist/third-party/front_end/Images/3d-center.svg +1 -0
  5. package/dist/third-party/front_end/Images/3d-pan.svg +1 -0
  6. package/dist/third-party/front_end/Images/3d-rotate.svg +1 -0
  7. package/dist/third-party/front_end/Images/Images.js +223 -0
  8. package/dist/third-party/front_end/Images/accelerometer-back.svg +1 -0
  9. package/dist/third-party/front_end/Images/accelerometer-bottom.png +0 -0
  10. package/dist/third-party/front_end/Images/accelerometer-front.svg +1 -0
  11. package/dist/third-party/front_end/Images/accelerometer-left.png +0 -0
  12. package/dist/third-party/front_end/Images/accelerometer-right.png +0 -0
  13. package/dist/third-party/front_end/Images/accelerometer-top.png +0 -0
  14. package/dist/third-party/front_end/Images/align-content-center.svg +1 -0
  15. package/dist/third-party/front_end/Images/align-content-end.svg +1 -0
  16. package/dist/third-party/front_end/Images/align-content-space-around.svg +1 -0
  17. package/dist/third-party/front_end/Images/align-content-space-between.svg +1 -0
  18. package/dist/third-party/front_end/Images/align-content-space-evenly.svg +1 -0
  19. package/dist/third-party/front_end/Images/align-content-start.svg +1 -0
  20. package/dist/third-party/front_end/Images/align-content-stretch.svg +1 -0
  21. package/dist/third-party/front_end/Images/align-items-baseline.svg +1 -0
  22. package/dist/third-party/front_end/Images/align-items-center.svg +1 -0
  23. package/dist/third-party/front_end/Images/align-items-end.svg +1 -0
  24. package/dist/third-party/front_end/Images/align-items-start.svg +1 -0
  25. package/dist/third-party/front_end/Images/align-items-stretch.svg +1 -0
  26. package/dist/third-party/front_end/Images/align-self-center.svg +1 -0
  27. package/dist/third-party/front_end/Images/align-self-end.svg +1 -0
  28. package/dist/third-party/front_end/Images/align-self-start.svg +1 -0
  29. package/dist/third-party/front_end/Images/align-self-stretch.svg +1 -0
  30. package/dist/third-party/front_end/Images/arrow-down.svg +1 -0
  31. package/dist/third-party/front_end/Images/arrow-drop-down-dark.svg +1 -0
  32. package/dist/third-party/front_end/Images/arrow-drop-down-light.svg +1 -0
  33. package/dist/third-party/front_end/Images/arrow-up-down-circle.svg +1 -0
  34. package/dist/third-party/front_end/Images/arrow-up-down.svg +1 -0
  35. package/dist/third-party/front_end/Images/arrow-up.svg +1 -0
  36. package/dist/third-party/front_end/Images/bell.svg +1 -0
  37. package/dist/third-party/front_end/Images/bezier-curve-filled.svg +1 -0
  38. package/dist/third-party/front_end/Images/bin.svg +1 -0
  39. package/dist/third-party/front_end/Images/bottom-panel-close.svg +1 -0
  40. package/dist/third-party/front_end/Images/bottom-panel-open.svg +1 -0
  41. package/dist/third-party/front_end/Images/brackets.svg +1 -0
  42. package/dist/third-party/front_end/Images/breakpoint-circle.svg +1 -0
  43. package/dist/third-party/front_end/Images/breakpoint-crossed-filled.svg +1 -0
  44. package/dist/third-party/front_end/Images/breakpoint-crossed.svg +1 -0
  45. package/dist/third-party/front_end/Images/brush-filled.svg +1 -0
  46. package/dist/third-party/front_end/Images/brush.svg +1 -0
  47. package/dist/third-party/front_end/Images/bug.svg +1 -0
  48. package/dist/third-party/front_end/Images/bundle.svg +1 -0
  49. package/dist/third-party/front_end/Images/check-circle.svg +1 -0
  50. package/dist/third-party/front_end/Images/check-double.svg +1 -0
  51. package/dist/third-party/front_end/Images/checker.svg +1 -0
  52. package/dist/third-party/front_end/Images/checkmark.svg +1 -0
  53. package/dist/third-party/front_end/Images/chevron-double-right.svg +1 -0
  54. package/dist/third-party/front_end/Images/chevron-down.svg +1 -0
  55. package/dist/third-party/front_end/Images/chevron-left-dot.svg +1 -0
  56. package/dist/third-party/front_end/Images/chevron-left.svg +1 -0
  57. package/dist/third-party/front_end/Images/chevron-right.svg +1 -0
  58. package/dist/third-party/front_end/Images/chevron-up.svg +1 -0
  59. package/dist/third-party/front_end/Images/chromeLeft.avif +0 -0
  60. package/dist/third-party/front_end/Images/chromeMiddle.avif +0 -0
  61. package/dist/third-party/front_end/Images/chromeRight.avif +0 -0
  62. package/dist/third-party/front_end/Images/clear-list.svg +1 -0
  63. package/dist/third-party/front_end/Images/clear.svg +1 -0
  64. package/dist/third-party/front_end/Images/cloud.svg +1 -0
  65. package/dist/third-party/front_end/Images/code-circle.svg +1 -0
  66. package/dist/third-party/front_end/Images/code.svg +1 -0
  67. package/dist/third-party/front_end/Images/colon.svg +1 -0
  68. package/dist/third-party/front_end/Images/color-picker-filled.svg +1 -0
  69. package/dist/third-party/front_end/Images/color-picker.svg +1 -0
  70. package/dist/third-party/front_end/Images/console-conditional-breakpoint.svg +1 -0
  71. package/dist/third-party/front_end/Images/console-logpoint.svg +1 -0
  72. package/dist/third-party/front_end/Images/cookie.svg +1 -0
  73. package/dist/third-party/front_end/Images/copy.svg +1 -0
  74. package/dist/third-party/front_end/Images/credit-card.svg +1 -0
  75. package/dist/third-party/front_end/Images/cross-circle-filled.svg +1 -0
  76. package/dist/third-party/front_end/Images/cross-circle.svg +1 -0
  77. package/dist/third-party/front_end/Images/cross.svg +1 -0
  78. package/dist/third-party/front_end/Images/cssoverview_icons_2x.avif +0 -0
  79. package/dist/third-party/front_end/Images/custom-typography.svg +1 -0
  80. package/dist/third-party/front_end/Images/database.svg +1 -0
  81. package/dist/third-party/front_end/Images/deployed.svg +1 -0
  82. package/dist/third-party/front_end/Images/device-fold.svg +1 -0
  83. package/dist/third-party/front_end/Images/devices.svg +1 -0
  84. package/dist/third-party/front_end/Images/dock-bottom.svg +1 -0
  85. package/dist/third-party/front_end/Images/dock-left.svg +1 -0
  86. package/dist/third-party/front_end/Images/dock-right.svg +1 -0
  87. package/dist/third-party/front_end/Images/dock-window.svg +1 -0
  88. package/dist/third-party/front_end/Images/document.svg +1 -0
  89. package/dist/third-party/front_end/Images/dots-horizontal.svg +1 -0
  90. package/dist/third-party/front_end/Images/dots-vertical.svg +1 -0
  91. package/dist/third-party/front_end/Images/download.svg +1 -0
  92. package/dist/third-party/front_end/Images/edit.svg +1 -0
  93. package/dist/third-party/front_end/Images/empty.svg +1 -0
  94. package/dist/third-party/front_end/Images/errorWave.svg +1 -0
  95. package/dist/third-party/front_end/Images/exclamation.svg +1 -0
  96. package/dist/third-party/front_end/Images/experiment-check.svg +1 -0
  97. package/dist/third-party/front_end/Images/experiment.svg +1 -0
  98. package/dist/third-party/front_end/Images/eye.svg +1 -0
  99. package/dist/third-party/front_end/Images/file-document.svg +1 -0
  100. package/dist/third-party/front_end/Images/file-font.svg +1 -0
  101. package/dist/third-party/front_end/Images/file-generic.svg +1 -0
  102. package/dist/third-party/front_end/Images/file-image.svg +1 -0
  103. package/dist/third-party/front_end/Images/file-script.svg +1 -0
  104. package/dist/third-party/front_end/Images/file-snippet.svg +1 -0
  105. package/dist/third-party/front_end/Images/file-stylesheet.svg +1 -0
  106. package/dist/third-party/front_end/Images/filter-clear.svg +1 -0
  107. package/dist/third-party/front_end/Images/filter-filled.svg +1 -0
  108. package/dist/third-party/front_end/Images/filter.svg +1 -0
  109. package/dist/third-party/front_end/Images/flex-direction.svg +1 -0
  110. package/dist/third-party/front_end/Images/flex-no-wrap.svg +1 -0
  111. package/dist/third-party/front_end/Images/flex-wrap.svg +1 -0
  112. package/dist/third-party/front_end/Images/flow.svg +1 -0
  113. package/dist/third-party/front_end/Images/fold-more.svg +1 -0
  114. package/dist/third-party/front_end/Images/folder.svg +1 -0
  115. package/dist/third-party/front_end/Images/frame-crossed.svg +1 -0
  116. package/dist/third-party/front_end/Images/frame-icon.svg +1 -0
  117. package/dist/third-party/front_end/Images/frame.svg +1 -0
  118. package/dist/third-party/front_end/Images/gear-filled.svg +1 -0
  119. package/dist/third-party/front_end/Images/gear.svg +1 -0
  120. package/dist/third-party/front_end/Images/gears.svg +1 -0
  121. package/dist/third-party/front_end/Images/heap-snapshot.svg +1 -0
  122. package/dist/third-party/front_end/Images/heap-snapshots.svg +1 -0
  123. package/dist/third-party/front_end/Images/help.svg +1 -0
  124. package/dist/third-party/front_end/Images/iframe-crossed.svg +1 -0
  125. package/dist/third-party/front_end/Images/iframe.svg +1 -0
  126. package/dist/third-party/front_end/Images/import.svg +1 -0
  127. package/dist/third-party/front_end/Images/info-filled.svg +1 -0
  128. package/dist/third-party/front_end/Images/info.svg +1 -0
  129. package/dist/third-party/front_end/Images/issue-cross-filled.svg +1 -0
  130. package/dist/third-party/front_end/Images/issue-exclamation-filled.svg +1 -0
  131. package/dist/third-party/front_end/Images/issue-questionmark-filled.svg +1 -0
  132. package/dist/third-party/front_end/Images/issue-text-filled.svg +1 -0
  133. package/dist/third-party/front_end/Images/justify-content-center.svg +1 -0
  134. package/dist/third-party/front_end/Images/justify-content-end.svg +1 -0
  135. package/dist/third-party/front_end/Images/justify-content-space-around.svg +1 -0
  136. package/dist/third-party/front_end/Images/justify-content-space-between.svg +1 -0
  137. package/dist/third-party/front_end/Images/justify-content-space-evenly.svg +1 -0
  138. package/dist/third-party/front_end/Images/justify-content-start.svg +1 -0
  139. package/dist/third-party/front_end/Images/justify-items-center.svg +1 -0
  140. package/dist/third-party/front_end/Images/justify-items-end.svg +1 -0
  141. package/dist/third-party/front_end/Images/justify-items-start.svg +1 -0
  142. package/dist/third-party/front_end/Images/justify-items-stretch.svg +1 -0
  143. package/dist/third-party/front_end/Images/keyboard-pen.svg +1 -0
  144. package/dist/third-party/front_end/Images/large-arrow-right-filled.svg +1 -0
  145. package/dist/third-party/front_end/Images/largeIcons.svg +2 -0
  146. package/dist/third-party/front_end/Images/layers-filled.svg +1 -0
  147. package/dist/third-party/front_end/Images/layers.svg +1 -0
  148. package/dist/third-party/front_end/Images/left-panel-close.svg +1 -0
  149. package/dist/third-party/front_end/Images/left-panel-open.svg +1 -0
  150. package/dist/third-party/front_end/Images/lighthouse_logo.svg +1 -0
  151. package/dist/third-party/front_end/Images/list.svg +1 -0
  152. package/dist/third-party/front_end/Images/mediumIcons.svg +1 -0
  153. package/dist/third-party/front_end/Images/memory.svg +1 -0
  154. package/dist/third-party/front_end/Images/minus.svg +1 -0
  155. package/dist/third-party/front_end/Images/minus_icon.svg +1 -0
  156. package/dist/third-party/front_end/Images/navigationControls.png +0 -0
  157. package/dist/third-party/front_end/Images/navigationControls_2x.png +0 -0
  158. package/dist/third-party/front_end/Images/network-settings.svg +1 -0
  159. package/dist/third-party/front_end/Images/nodeIcon.avif +0 -0
  160. package/dist/third-party/front_end/Images/node_search_icon.svg +1 -0
  161. package/dist/third-party/front_end/Images/open-externally.svg +1 -0
  162. package/dist/third-party/front_end/Images/pause.svg +1 -0
  163. package/dist/third-party/front_end/Images/performance.svg +1 -0
  164. package/dist/third-party/front_end/Images/person.svg +1 -0
  165. package/dist/third-party/front_end/Images/play.svg +1 -0
  166. package/dist/third-party/front_end/Images/plus.svg +1 -0
  167. package/dist/third-party/front_end/Images/popoverArrows.png +0 -0
  168. package/dist/third-party/front_end/Images/popup.svg +1 -0
  169. package/dist/third-party/front_end/Images/preview_feature_video_thumbnail.svg +1 -0
  170. package/dist/third-party/front_end/Images/profile.svg +1 -0
  171. package/dist/third-party/front_end/Images/react_native/welcomeIcon.png +0 -0
  172. package/dist/third-party/front_end/Images/record-start.svg +1 -0
  173. package/dist/third-party/front_end/Images/record-stop.svg +1 -0
  174. package/dist/third-party/front_end/Images/redo.svg +1 -0
  175. package/dist/third-party/front_end/Images/refresh.svg +1 -0
  176. package/dist/third-party/front_end/Images/replace.svg +1 -0
  177. package/dist/third-party/front_end/Images/replay.svg +1 -0
  178. package/dist/third-party/front_end/Images/resizeDiagonal.svg +1 -0
  179. package/dist/third-party/front_end/Images/resizeHorizontal.svg +1 -0
  180. package/dist/third-party/front_end/Images/resizeVertical.svg +1 -0
  181. package/dist/third-party/front_end/Images/resume.svg +1 -0
  182. package/dist/third-party/front_end/Images/review.svg +1 -0
  183. package/dist/third-party/front_end/Images/right-panel-close.svg +1 -0
  184. package/dist/third-party/front_end/Images/right-panel-open.svg +1 -0
  185. package/dist/third-party/front_end/Images/screen-rotation.svg +1 -0
  186. package/dist/third-party/front_end/Images/search.svg +1 -0
  187. package/dist/third-party/front_end/Images/securityIcons.svg +1 -0
  188. package/dist/third-party/front_end/Images/select-element.svg +1 -0
  189. package/dist/third-party/front_end/Images/settings_14x14_icon.svg +1 -0
  190. package/dist/third-party/front_end/Images/shadow.svg +1 -0
  191. package/dist/third-party/front_end/Images/smallIcons.svg +1 -0
  192. package/dist/third-party/front_end/Images/snippet.svg +1 -0
  193. package/dist/third-party/front_end/Images/star.svg +1 -0
  194. package/dist/third-party/front_end/Images/step-into.svg +1 -0
  195. package/dist/third-party/front_end/Images/step-out.svg +1 -0
  196. package/dist/third-party/front_end/Images/step-over.svg +1 -0
  197. package/dist/third-party/front_end/Images/step.svg +1 -0
  198. package/dist/third-party/front_end/Images/stop.svg +1 -0
  199. package/dist/third-party/front_end/Images/symbol.svg +1 -0
  200. package/dist/third-party/front_end/Images/sync.svg +1 -0
  201. package/dist/third-party/front_end/Images/table.svg +1 -0
  202. package/dist/third-party/front_end/Images/toolbarResizerVertical.png +0 -0
  203. package/dist/third-party/front_end/Images/top-panel-close.svg +1 -0
  204. package/dist/third-party/front_end/Images/top-panel-open.svg +1 -0
  205. package/dist/third-party/front_end/Images/touchCursor.png +0 -0
  206. package/dist/third-party/front_end/Images/touchCursor_2x.png +0 -0
  207. package/dist/third-party/front_end/Images/triangle-bottom-right.svg +1 -0
  208. package/dist/third-party/front_end/Images/triangle-down.svg +1 -0
  209. package/dist/third-party/front_end/Images/triangle-left.svg +1 -0
  210. package/dist/third-party/front_end/Images/triangle-right.svg +1 -0
  211. package/dist/third-party/front_end/Images/triangle-up.svg +1 -0
  212. package/dist/third-party/front_end/Images/undo.svg +1 -0
  213. package/dist/third-party/front_end/Images/warning-filled.svg +1 -0
  214. package/dist/third-party/front_end/Images/warning.svg +1 -0
  215. package/dist/third-party/front_end/Images/warning_icon.svg +1 -0
  216. package/dist/third-party/front_end/Images/watch.svg +1 -0
  217. package/dist/third-party/front_end/Images/whatsnew.avif +0 -0
  218. package/dist/third-party/front_end/Images/width.svg +1 -0
  219. package/dist/third-party/front_end/Tests.js +1662 -0
  220. package/dist/third-party/front_end/core/common/common-legacy.js +1 -0
  221. package/dist/third-party/front_end/core/common/common.js +1 -0
  222. package/dist/third-party/front_end/core/dom_extension/dom_extension.js +1 -0
  223. package/dist/third-party/front_end/core/host/host-legacy.js +1 -0
  224. package/dist/third-party/front_end/core/host/host.js +1 -0
  225. package/dist/third-party/front_end/core/i18n/i18n.js +1 -0
  226. package/dist/third-party/front_end/core/i18n/locales/en-US.json +1 -0
  227. package/dist/third-party/front_end/core/i18n/locales/zh.json +1 -0
  228. package/dist/third-party/front_end/core/platform/platform.js +1 -0
  229. package/dist/third-party/front_end/core/protocol_client/protocol_client-legacy.js +1 -0
  230. package/dist/third-party/front_end/core/protocol_client/protocol_client.js +1 -0
  231. package/dist/third-party/front_end/core/root/root-legacy.js +1 -0
  232. package/dist/third-party/front_end/core/root/root.js +1 -0
  233. package/dist/third-party/front_end/core/sdk/sdk-legacy.js +1 -0
  234. package/dist/third-party/front_end/core/sdk/sdk-meta.js +1 -0
  235. package/dist/third-party/front_end/core/sdk/sdk.js +1 -0
  236. package/dist/third-party/front_end/device_mode_emulation_frame.html +20 -0
  237. package/dist/third-party/front_end/devtools_app.html +20 -0
  238. package/dist/third-party/front_end/devtools_compatibility.js +1595 -0
  239. package/dist/third-party/front_end/emulated_devices/optimized/MotoG4-landscape.avif +0 -0
  240. package/dist/third-party/front_end/emulated_devices/optimized/MotoG4-portrait.avif +0 -0
  241. package/dist/third-party/front_end/emulated_devices/optimized/Nexus5X-landscape.avif +0 -0
  242. package/dist/third-party/front_end/emulated_devices/optimized/Nexus5X-portrait.avif +0 -0
  243. package/dist/third-party/front_end/emulated_devices/optimized/Nexus6P-landscape.avif +0 -0
  244. package/dist/third-party/front_end/emulated_devices/optimized/Nexus6P-portrait.avif +0 -0
  245. package/dist/third-party/front_end/emulated_devices/optimized/google-nest-hub-horizontal.avif +0 -0
  246. package/dist/third-party/front_end/emulated_devices/optimized/google-nest-hub-max-horizontal.avif +0 -0
  247. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-1x.avif +0 -0
  248. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-2x.avif +0 -0
  249. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-1x.avif +0 -0
  250. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-2x.avif +0 -0
  251. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-1x.avif +0 -0
  252. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-2x.avif +0 -0
  253. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-1x.avif +0 -0
  254. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-2x.avif +0 -0
  255. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-1x.avif +0 -0
  256. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-2x.avif +0 -0
  257. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-1x.avif +0 -0
  258. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-2x.avif +0 -0
  259. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-1x.avif +0 -0
  260. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-2x.avif +0 -0
  261. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-1x.avif +0 -0
  262. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-2x.avif +0 -0
  263. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-1x.avif +0 -0
  264. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-2x.avif +0 -0
  265. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-1x.avif +0 -0
  266. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-2x.avif +0 -0
  267. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-1x.avif +0 -0
  268. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-2x.avif +0 -0
  269. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-1x.avif +0 -0
  270. package/dist/third-party/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-2x.avif +0 -0
  271. package/dist/third-party/front_end/emulated_devices/optimized/iPad-landscape.avif +0 -0
  272. package/dist/third-party/front_end/emulated_devices/optimized/iPad-portrait.avif +0 -0
  273. package/dist/third-party/front_end/emulated_devices/optimized/iPhone5-landscape.avif +0 -0
  274. package/dist/third-party/front_end/emulated_devices/optimized/iPhone5-portrait.avif +0 -0
  275. package/dist/third-party/front_end/emulated_devices/optimized/iPhone6-landscape.avif +0 -0
  276. package/dist/third-party/front_end/emulated_devices/optimized/iPhone6-portrait.avif +0 -0
  277. package/dist/third-party/front_end/emulated_devices/optimized/iPhone6Plus-landscape.avif +0 -0
  278. package/dist/third-party/front_end/emulated_devices/optimized/iPhone6Plus-portrait.avif +0 -0
  279. package/dist/third-party/front_end/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.js +1 -0
  280. package/dist/third-party/front_end/entrypoints/devtools_app/devtools_app.js +1 -0
  281. package/dist/third-party/front_end/entrypoints/formatter_worker/FormatterActions.js +1 -0
  282. package/dist/third-party/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.js +1 -0
  283. package/dist/third-party/front_end/entrypoints/formatter_worker/formatter_worker.js +1 -0
  284. package/dist/third-party/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.js +1 -0
  285. package/dist/third-party/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker-legacy.js +1 -0
  286. package/dist/third-party/front_end/entrypoints/heap_snapshot_worker/heap_snapshot_worker.js +1 -0
  287. package/dist/third-party/front_end/entrypoints/inspector/inspector.js +1 -0
  288. package/dist/third-party/front_end/entrypoints/inspector_main/inspector_main-meta.js +1 -0
  289. package/dist/third-party/front_end/entrypoints/inspector_main/inspector_main.js +1 -0
  290. package/dist/third-party/front_end/entrypoints/js_app/js_app.js +1 -0
  291. package/dist/third-party/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js +1 -0
  292. package/dist/third-party/front_end/entrypoints/main/main-legacy.js +1 -0
  293. package/dist/third-party/front_end/entrypoints/main/main-meta.js +1 -0
  294. package/dist/third-party/front_end/entrypoints/main/main.js +1 -0
  295. package/dist/third-party/front_end/entrypoints/ndb_app/ndb_app.js +1 -0
  296. package/dist/third-party/front_end/entrypoints/node_app/node_app.js +1 -0
  297. package/dist/third-party/front_end/entrypoints/rn_inspector/rn_inspector.js +1 -0
  298. package/dist/third-party/front_end/entrypoints/shell/shell.js +1 -0
  299. package/dist/third-party/front_end/entrypoints/wasmparser_worker/wasmparser_worker-entrypoint.js +1 -0
  300. package/dist/third-party/front_end/entrypoints/wasmparser_worker/wasmparser_worker.js +1 -0
  301. package/dist/third-party/front_end/entrypoints/worker_app/worker_app.js +1 -0
  302. package/dist/third-party/front_end/inspector.html +20 -0
  303. package/dist/third-party/front_end/integration_test_runner.html +40 -0
  304. package/dist/third-party/front_end/js_app.html +20 -0
  305. package/dist/third-party/front_end/legacy_test_runner/legacy_test_runner.js +36 -0
  306. package/dist/third-party/front_end/legacy_test_runner/test_runner/test_runner.js +1 -0
  307. package/dist/third-party/front_end/models/bindings/bindings-legacy.js +1 -0
  308. package/dist/third-party/front_end/models/bindings/bindings.js +1 -0
  309. package/dist/third-party/front_end/models/breakpoints/breakpoints-legacy.js +1 -0
  310. package/dist/third-party/front_end/models/breakpoints/breakpoints.js +1 -0
  311. package/dist/third-party/front_end/models/emulation/emulation.js +1 -0
  312. package/dist/third-party/front_end/models/extensions/extensions-legacy.js +1 -0
  313. package/dist/third-party/front_end/models/extensions/extensions.js +1 -0
  314. package/dist/third-party/front_end/models/formatter/formatter-legacy.js +1 -0
  315. package/dist/third-party/front_end/models/formatter/formatter.js +1 -0
  316. package/dist/third-party/front_end/models/har/har.js +1 -0
  317. package/dist/third-party/front_end/models/heap_snapshot_model/heap_snapshot_model-legacy.js +1 -0
  318. package/dist/third-party/front_end/models/heap_snapshot_model/heap_snapshot_model.js +1 -0
  319. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepCoopSandboxedIframeCannotNavigateToCoopPage.md +4 -0
  320. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepCorpNotSameOrigin.md +8 -0
  321. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepCorpNotSameOriginAfterDefaultedToSameOriginByCoep.md +18 -0
  322. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepCorpNotSameSite.md +7 -0
  323. package/dist/third-party/front_end/models/issues_manager/descriptions/CoepFrameResourceNeedsCoepHeader.md +10 -0
  324. package/dist/third-party/front_end/models/issues_manager/descriptions/CompatibilityModeQuirks.md +5 -0
  325. package/dist/third-party/front_end/models/issues_manager/descriptions/CookieAttributeValueExceedsMaxSize.md +5 -0
  326. package/dist/third-party/front_end/models/issues_manager/descriptions/LowTextContrast.md +5 -0
  327. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteExcludeContextDowngradeRead.md +8 -0
  328. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteExcludeContextDowngradeSet.md +8 -0
  329. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteExcludeNavigationContextDowngrade.md +8 -0
  330. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteInvalidSameParty.md +8 -0
  331. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureErrorRead.md +8 -0
  332. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureErrorSet.md +8 -0
  333. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureWarnRead.md +8 -0
  334. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteNoneInsecureWarnSet.md +8 -0
  335. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedLaxAllowUnsafeRead.md +9 -0
  336. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedLaxAllowUnsafeSet.md +9 -0
  337. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedTreatedAsLaxRead.md +9 -0
  338. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteUnspecifiedTreatedAsLaxSet.md +9 -0
  339. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteWarnCrossDowngradeRead.md +8 -0
  340. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteWarnCrossDowngradeSet.md +8 -0
  341. package/dist/third-party/front_end/models/issues_manager/descriptions/SameSiteWarnStrictLaxDowngradeStrict.md +8 -0
  342. package/dist/third-party/front_end/models/issues_manager/descriptions/arInsecureContext.md +7 -0
  343. package/dist/third-party/front_end/models/issues_manager/descriptions/arInvalidRegisterOsSourceHeader.md +5 -0
  344. package/dist/third-party/front_end/models/issues_manager/descriptions/arInvalidRegisterOsTriggerHeader.md +5 -0
  345. package/dist/third-party/front_end/models/issues_manager/descriptions/arInvalidRegisterSourceHeader.md +5 -0
  346. package/dist/third-party/front_end/models/issues_manager/descriptions/arInvalidRegisterTriggerHeader.md +5 -0
  347. package/dist/third-party/front_end/models/issues_manager/descriptions/arOsSourceIgnored.md +18 -0
  348. package/dist/third-party/front_end/models/issues_manager/descriptions/arOsTriggerIgnored.md +19 -0
  349. package/dist/third-party/front_end/models/issues_manager/descriptions/arPermissionPolicyDisabled.md +8 -0
  350. package/dist/third-party/front_end/models/issues_manager/descriptions/arSourceAndTriggerHeaders.md +9 -0
  351. package/dist/third-party/front_end/models/issues_manager/descriptions/arSourceIgnored.md +13 -0
  352. package/dist/third-party/front_end/models/issues_manager/descriptions/arTriggerIgnored.md +12 -0
  353. package/dist/third-party/front_end/models/issues_manager/descriptions/arUntrustworthyReportingOrigin.md +10 -0
  354. package/dist/third-party/front_end/models/issues_manager/descriptions/arWebAndOsHeaders.md +11 -0
  355. package/dist/third-party/front_end/models/issues_manager/descriptions/bounceTrackingMitigations.md +3 -0
  356. package/dist/third-party/front_end/models/issues_manager/descriptions/clientHintMetaTagAllowListInvalidOrigin.md +4 -0
  357. package/dist/third-party/front_end/models/issues_manager/descriptions/clientHintMetaTagModifiedHTML.md +4 -0
  358. package/dist/third-party/front_end/models/issues_manager/descriptions/cookieExcludeBlockedWithinFirstPartySet.md +4 -0
  359. package/dist/third-party/front_end/models/issues_manager/descriptions/cookieExcludeDomainNonAscii.md +11 -0
  360. package/dist/third-party/front_end/models/issues_manager/descriptions/cookieWarnDomainNonAscii.md +11 -0
  361. package/dist/third-party/front_end/models/issues_manager/descriptions/corsAllowCredentialsRequired.md +6 -0
  362. package/dist/third-party/front_end/models/issues_manager/descriptions/corsDisabledScheme.md +7 -0
  363. package/dist/third-party/front_end/models/issues_manager/descriptions/corsDisallowedByMode.md +7 -0
  364. package/dist/third-party/front_end/models/issues_manager/descriptions/corsHeaderDisallowedByPreflightResponse.md +5 -0
  365. package/dist/third-party/front_end/models/issues_manager/descriptions/corsInsecurePrivateNetwork.md +10 -0
  366. package/dist/third-party/front_end/models/issues_manager/descriptions/corsInvalidHeaderValues.md +7 -0
  367. package/dist/third-party/front_end/models/issues_manager/descriptions/corsMethodDisallowedByPreflightResponse.md +5 -0
  368. package/dist/third-party/front_end/models/issues_manager/descriptions/corsNoCorsRedirectModeNotFollow.md +5 -0
  369. package/dist/third-party/front_end/models/issues_manager/descriptions/corsOriginMismatch.md +6 -0
  370. package/dist/third-party/front_end/models/issues_manager/descriptions/corsPreflightAllowPrivateNetworkError.md +10 -0
  371. package/dist/third-party/front_end/models/issues_manager/descriptions/corsPreflightResponseInvalid.md +5 -0
  372. package/dist/third-party/front_end/models/issues_manager/descriptions/corsRedirectContainsCredentials.md +5 -0
  373. package/dist/third-party/front_end/models/issues_manager/descriptions/corsWildcardOriginNotAllowed.md +8 -0
  374. package/dist/third-party/front_end/models/issues_manager/descriptions/cspEvalViolation.md +9 -0
  375. package/dist/third-party/front_end/models/issues_manager/descriptions/cspInlineViolation.md +10 -0
  376. package/dist/third-party/front_end/models/issues_manager/descriptions/cspTrustedTypesPolicyViolation.md +5 -0
  377. package/dist/third-party/front_end/models/issues_manager/descriptions/cspTrustedTypesSinkViolation.md +8 -0
  378. package/dist/third-party/front_end/models/issues_manager/descriptions/cspURLViolation.md +10 -0
  379. package/dist/third-party/front_end/models/issues_manager/descriptions/deprecation.md +3 -0
  380. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsHttpNotFound.md +1 -0
  381. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsInvalidResponse.md +1 -0
  382. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestAccountsNoResponse.md +1 -0
  383. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestApprovalDeclined.md +1 -0
  384. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestCanceled.md +1 -0
  385. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestClientMetadataHttpNotFound.md +1 -0
  386. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestClientMetadataInvalidResponse.md +1 -0
  387. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestClientMetadataNoResponse.md +1 -0
  388. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestErrorFetchingSignin.md +1 -0
  389. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestErrorIdToken.md +1 -0
  390. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenHttpNotFound.md +1 -0
  391. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidRequest.md +1 -0
  392. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenInvalidResponse.md +1 -0
  393. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestIdTokenNoResponse.md +1 -0
  394. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestInvalidSigninResponse.md +1 -0
  395. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestHttpNotFound.md +1 -0
  396. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestInvalidResponse.md +1 -0
  397. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestManifestNoResponse.md +1 -0
  398. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthRequestTooManyRequests.md +1 -0
  399. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestInvalidAccountsResponse.md +1 -0
  400. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestInvalidConfigOrWellKnown.md +1 -0
  401. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNoAccountSharingPermission.md +1 -0
  402. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNoApiPermission.md +1 -0
  403. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNoReturningUserFromFetchedAccounts.md +1 -0
  404. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotIframe.md +1 -0
  405. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotPotentiallyTrustworthy.md +1 -0
  406. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotSameOrigin.md +1 -0
  407. package/dist/third-party/front_end/models/issues_manager/descriptions/federatedAuthUserInfoRequestNotSignedInWithIdp.md +1 -0
  408. package/dist/third-party/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
  409. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormAriaLabelledByToNonExistingId.md +8 -0
  410. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormAutocompleteAttributeEmptyError.md +5 -0
  411. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormDuplicateIdForInputError.md +5 -0
  412. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormEmptyIdAndNameAttributesForInputError.md +5 -0
  413. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormInputAssignedAutocompleteValueToIdOrNameAttributeError.md +5 -0
  414. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormInputHasWrongButWellIntendedAutocompleteValueError.md +5 -0
  415. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormInputWithNoLabelError.md +5 -0
  416. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormLabelForMatchesNonExistingIdError.md +5 -0
  417. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormLabelForNameError.md +5 -0
  418. package/dist/third-party/front_end/models/issues_manager/descriptions/genericFormLabelHasNeitherForNorNestedInput.md +5 -0
  419. package/dist/third-party/front_end/models/issues_manager/descriptions/heavyAd.md +10 -0
  420. package/dist/third-party/front_end/models/issues_manager/descriptions/mixedContent.md +5 -0
  421. package/dist/third-party/front_end/models/issues_manager/descriptions/sharedArrayBuffer.md +7 -0
  422. package/dist/third-party/front_end/models/issues_manager/descriptions/stylesheetLateImport.md +4 -0
  423. package/dist/third-party/front_end/models/issues_manager/descriptions/stylesheetRequestFailed.md +3 -0
  424. package/dist/third-party/front_end/models/issues_manager/issues_manager.js +1 -0
  425. package/dist/third-party/front_end/models/javascript_metadata/javascript_metadata.js +1 -0
  426. package/dist/third-party/front_end/models/logs/logs-meta.js +1 -0
  427. package/dist/third-party/front_end/models/logs/logs.js +1 -0
  428. package/dist/third-party/front_end/models/persistence/persistence-legacy.js +1 -0
  429. package/dist/third-party/front_end/models/persistence/persistence-meta.js +1 -0
  430. package/dist/third-party/front_end/models/persistence/persistence.js +1 -0
  431. package/dist/third-party/front_end/models/source_map_scopes/source_map_scopes.js +1 -0
  432. package/dist/third-party/front_end/models/text_utils/text_utils-legacy.js +1 -0
  433. package/dist/third-party/front_end/models/text_utils/text_utils.js +1 -0
  434. package/dist/third-party/front_end/models/timeline_model/timeline_model-legacy.js +1 -0
  435. package/dist/third-party/front_end/models/timeline_model/timeline_model.js +1 -0
  436. package/dist/third-party/front_end/models/trace/extras/extras.js +1 -0
  437. package/dist/third-party/front_end/models/trace/handlers/handlers.js +1 -0
  438. package/dist/third-party/front_end/models/trace/helpers/helpers.js +1 -0
  439. package/dist/third-party/front_end/models/trace/trace.js +1 -0
  440. package/dist/third-party/front_end/models/trace/types/types.js +1 -0
  441. package/dist/third-party/front_end/models/workspace/workspace-legacy.js +1 -0
  442. package/dist/third-party/front_end/models/workspace/workspace.js +1 -0
  443. package/dist/third-party/front_end/models/workspace_diff/workspace_diff-legacy.js +1 -0
  444. package/dist/third-party/front_end/models/workspace_diff/workspace_diff.js +1 -0
  445. package/dist/third-party/front_end/ndb_app.html +20 -0
  446. package/dist/third-party/front_end/node_app.html +20 -0
  447. package/dist/third-party/front_end/panels/accessibility/accessibility-legacy.js +1 -0
  448. package/dist/third-party/front_end/panels/accessibility/accessibility-meta.js +1 -0
  449. package/dist/third-party/front_end/panels/accessibility/accessibility.js +1 -0
  450. package/dist/third-party/front_end/panels/animation/animation-legacy.js +1 -0
  451. package/dist/third-party/front_end/panels/animation/animation-meta.js +1 -0
  452. package/dist/third-party/front_end/panels/animation/animation.js +1 -0
  453. package/dist/third-party/front_end/panels/application/application-legacy.js +1 -0
  454. package/dist/third-party/front_end/panels/application/application-meta.js +1 -0
  455. package/dist/third-party/front_end/panels/application/application.js +1 -0
  456. package/dist/third-party/front_end/panels/application/components/components.js +1 -0
  457. package/dist/third-party/front_end/panels/application/preloading/components/components.js +1 -0
  458. package/dist/third-party/front_end/panels/browser_debugger/browser_debugger-legacy.js +1 -0
  459. package/dist/third-party/front_end/panels/browser_debugger/browser_debugger-meta.js +1 -0
  460. package/dist/third-party/front_end/panels/browser_debugger/browser_debugger.js +1 -0
  461. package/dist/third-party/front_end/panels/changes/changes-legacy.js +1 -0
  462. package/dist/third-party/front_end/panels/changes/changes-meta.js +1 -0
  463. package/dist/third-party/front_end/panels/changes/changes.js +1 -0
  464. package/dist/third-party/front_end/panels/console/console-legacy.js +1 -0
  465. package/dist/third-party/front_end/panels/console/console-meta.js +1 -0
  466. package/dist/third-party/front_end/panels/console/console.js +6 -0
  467. package/dist/third-party/front_end/panels/console_counters/console_counters-meta.js +1 -0
  468. package/dist/third-party/front_end/panels/console_counters/console_counters.js +1 -0
  469. package/dist/third-party/front_end/panels/coverage/coverage-legacy.js +1 -0
  470. package/dist/third-party/front_end/panels/coverage/coverage-meta.js +1 -0
  471. package/dist/third-party/front_end/panels/coverage/coverage.js +1 -0
  472. package/dist/third-party/front_end/panels/css_overview/components/components.js +1 -0
  473. package/dist/third-party/front_end/panels/css_overview/css_overview-meta.js +1 -0
  474. package/dist/third-party/front_end/panels/css_overview/css_overview.js +144 -0
  475. package/dist/third-party/front_end/panels/developer_resources/developer_resources-meta.js +1 -0
  476. package/dist/third-party/front_end/panels/developer_resources/developer_resources.js +1 -0
  477. package/dist/third-party/front_end/panels/elements/components/components.js +1 -0
  478. package/dist/third-party/front_end/panels/elements/elements-legacy.js +1 -0
  479. package/dist/third-party/front_end/panels/elements/elements-meta.js +1 -0
  480. package/dist/third-party/front_end/panels/elements/elements.js +1 -0
  481. package/dist/third-party/front_end/panels/emulation/components/components.js +22 -0
  482. package/dist/third-party/front_end/panels/emulation/emulation-legacy.js +1 -0
  483. package/dist/third-party/front_end/panels/emulation/emulation-meta.js +1 -0
  484. package/dist/third-party/front_end/panels/emulation/emulation.js +1 -0
  485. package/dist/third-party/front_end/panels/event_listeners/event_listeners.js +1 -0
  486. package/dist/third-party/front_end/panels/issues/components/components.js +1 -0
  487. package/dist/third-party/front_end/panels/issues/issues-meta.js +1 -0
  488. package/dist/third-party/front_end/panels/issues/issues.js +1 -0
  489. package/dist/third-party/front_end/panels/js_profiler/js_profiler-meta.js +1 -0
  490. package/dist/third-party/front_end/panels/js_profiler/js_profiler.js +1 -0
  491. package/dist/third-party/front_end/panels/layer_viewer/layer_viewer-legacy.js +1 -0
  492. package/dist/third-party/front_end/panels/layer_viewer/layer_viewer-meta.js +1 -0
  493. package/dist/third-party/front_end/panels/layer_viewer/layer_viewer.js +1 -0
  494. package/dist/third-party/front_end/panels/layers/layers-meta.js +1 -0
  495. package/dist/third-party/front_end/panels/layers/layers.js +1 -0
  496. package/dist/third-party/front_end/panels/lighthouse/lighthouse-legacy.js +1 -0
  497. package/dist/third-party/front_end/panels/lighthouse/lighthouse-meta.js +1 -0
  498. package/dist/third-party/front_end/panels/lighthouse/lighthouse.js +66 -0
  499. package/dist/third-party/front_end/panels/media/media-meta.js +1 -0
  500. package/dist/third-party/front_end/panels/media/media.js +25 -0
  501. package/dist/third-party/front_end/panels/mobile_throttling/mobile_throttling-legacy.js +1 -0
  502. package/dist/third-party/front_end/panels/mobile_throttling/mobile_throttling-meta.js +1 -0
  503. package/dist/third-party/front_end/panels/mobile_throttling/mobile_throttling.js +1 -0
  504. package/dist/third-party/front_end/panels/network/components/components.js +1 -0
  505. package/dist/third-party/front_end/panels/network/forward/forward.js +1 -0
  506. package/dist/third-party/front_end/panels/network/network-legacy.js +1 -0
  507. package/dist/third-party/front_end/panels/network/network-meta.js +1 -0
  508. package/dist/third-party/front_end/panels/network/network.js +1 -0
  509. package/dist/third-party/front_end/panels/performance_monitor/performance_monitor-meta.js +1 -0
  510. package/dist/third-party/front_end/panels/performance_monitor/performance_monitor.js +1 -0
  511. package/dist/third-party/front_end/panels/profiler/profiler-legacy.js +1 -0
  512. package/dist/third-party/front_end/panels/profiler/profiler-meta.js +1 -0
  513. package/dist/third-party/front_end/panels/profiler/profiler.js +7 -0
  514. package/dist/third-party/front_end/panels/protocol_monitor/components/components.js +1 -0
  515. package/dist/third-party/front_end/panels/protocol_monitor/protocol_monitor-meta.js +1 -0
  516. package/dist/third-party/front_end/panels/protocol_monitor/protocol_monitor.js +1 -0
  517. package/dist/third-party/front_end/panels/recorder/components/components.js +1 -0
  518. package/dist/third-party/front_end/panels/recorder/controllers/controllers.js +1 -0
  519. package/dist/third-party/front_end/panels/recorder/converters/converters.js +1 -0
  520. package/dist/third-party/front_end/panels/recorder/extensions/extensions.js +1 -0
  521. package/dist/third-party/front_end/panels/recorder/injected/injected.generated.js +1 -0
  522. package/dist/third-party/front_end/panels/recorder/injected/injected.js +1 -0
  523. package/dist/third-party/front_end/panels/recorder/models/models.js +1 -0
  524. package/dist/third-party/front_end/panels/recorder/recorder-actions.js +1 -0
  525. package/dist/third-party/front_end/panels/recorder/recorder-meta.js +1 -0
  526. package/dist/third-party/front_end/panels/recorder/recorder.js +1 -0
  527. package/dist/third-party/front_end/panels/recorder/util/util.js +1 -0
  528. package/dist/third-party/front_end/panels/rn_welcome/rn_welcome-meta.js +1 -0
  529. package/dist/third-party/front_end/panels/rn_welcome/rn_welcome.js +1 -0
  530. package/dist/third-party/front_end/panels/screencast/screencast-meta.js +1 -0
  531. package/dist/third-party/front_end/panels/screencast/screencast.js +1 -0
  532. package/dist/third-party/front_end/panels/search/search-legacy.js +1 -0
  533. package/dist/third-party/front_end/panels/search/search.js +1 -0
  534. package/dist/third-party/front_end/panels/security/security-legacy.js +1 -0
  535. package/dist/third-party/front_end/panels/security/security-meta.js +1 -0
  536. package/dist/third-party/front_end/panels/security/security.js +1 -0
  537. package/dist/third-party/front_end/panels/sensors/sensors-meta.js +1 -0
  538. package/dist/third-party/front_end/panels/sensors/sensors.js +1 -0
  539. package/dist/third-party/front_end/panels/settings/components/components.js +1 -0
  540. package/dist/third-party/front_end/panels/settings/emulation/components/components.js +1 -0
  541. package/dist/third-party/front_end/panels/settings/emulation/emulation-meta.js +1 -0
  542. package/dist/third-party/front_end/panels/settings/emulation/emulation.js +1 -0
  543. package/dist/third-party/front_end/panels/settings/emulation/utils/utils.js +1 -0
  544. package/dist/third-party/front_end/panels/settings/settings-legacy.js +1 -0
  545. package/dist/third-party/front_end/panels/settings/settings-meta.js +1 -0
  546. package/dist/third-party/front_end/panels/settings/settings.js +1 -0
  547. package/dist/third-party/front_end/panels/snippets/snippets-legacy.js +1 -0
  548. package/dist/third-party/front_end/panels/snippets/snippets.js +1 -0
  549. package/dist/third-party/front_end/panels/sources/components/components.js +1 -0
  550. package/dist/third-party/front_end/panels/sources/sources-legacy.js +1 -0
  551. package/dist/third-party/front_end/panels/sources/sources-meta.js +1 -0
  552. package/dist/third-party/front_end/panels/sources/sources.js +1 -0
  553. package/dist/third-party/front_end/panels/timeline/timeline-legacy.js +1 -0
  554. package/dist/third-party/front_end/panels/timeline/timeline-meta.js +1 -0
  555. package/dist/third-party/front_end/panels/timeline/timeline.js +1 -0
  556. package/dist/third-party/front_end/panels/utils/utils.js +1 -0
  557. package/dist/third-party/front_end/panels/web_audio/graph_visualizer/graph_visualizer.js +1 -0
  558. package/dist/third-party/front_end/panels/web_audio/web_audio-legacy.js +1 -0
  559. package/dist/third-party/front_end/panels/web_audio/web_audio-meta.js +1 -0
  560. package/dist/third-party/front_end/panels/web_audio/web_audio.js +1 -0
  561. package/dist/third-party/front_end/panels/webauthn/webauthn-meta.js +1 -0
  562. package/dist/third-party/front_end/panels/webauthn/webauthn.js +1 -0
  563. package/dist/third-party/front_end/rn_inspector.html +20 -0
  564. package/dist/third-party/front_end/services/puppeteer/puppeteer.js +1 -0
  565. package/dist/third-party/front_end/services/tracing/tracing.js +1 -0
  566. package/dist/third-party/front_end/services/window_bounds/window_bounds.js +1 -0
  567. package/dist/third-party/front_end/third_party/acorn/acorn.js +1 -0
  568. package/dist/third-party/front_end/third_party/chromium/client-variations/client-variations.js +1 -0
  569. package/dist/third-party/front_end/third_party/codemirror.next/chunk/angular.js +2 -0
  570. package/dist/third-party/front_end/third_party/codemirror.next/chunk/codemirror.js +2 -0
  571. package/dist/third-party/front_end/third_party/codemirror.next/chunk/cpp.js +2 -0
  572. package/dist/third-party/front_end/third_party/codemirror.next/chunk/java.js +2 -0
  573. package/dist/third-party/front_end/third_party/codemirror.next/chunk/json.js +2 -0
  574. package/dist/third-party/front_end/third_party/codemirror.next/chunk/legacy.js +2 -0
  575. package/dist/third-party/front_end/third_party/codemirror.next/chunk/less.js +2 -0
  576. package/dist/third-party/front_end/third_party/codemirror.next/chunk/markdown.js +2 -0
  577. package/dist/third-party/front_end/third_party/codemirror.next/chunk/php.js +2 -0
  578. package/dist/third-party/front_end/third_party/codemirror.next/chunk/python.js +2 -0
  579. package/dist/third-party/front_end/third_party/codemirror.next/chunk/sass.js +2 -0
  580. package/dist/third-party/front_end/third_party/codemirror.next/chunk/svelte.js +2 -0
  581. package/dist/third-party/front_end/third_party/codemirror.next/chunk/vue.js +2 -0
  582. package/dist/third-party/front_end/third_party/codemirror.next/chunk/wast.js +2 -0
  583. package/dist/third-party/front_end/third_party/codemirror.next/chunk/xml.js +2 -0
  584. package/dist/third-party/front_end/third_party/codemirror.next/codemirror.next.js +2 -0
  585. package/dist/third-party/front_end/third_party/diff/diff-legacy.js +1 -0
  586. package/dist/third-party/front_end/third_party/diff/diff.js +1 -0
  587. package/dist/third-party/front_end/third_party/i18n/i18n.js +1 -0
  588. package/dist/third-party/front_end/third_party/intl-messageformat/intl-messageformat.js +15 -0
  589. package/dist/third-party/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1297 -0
  590. package/dist/third-party/front_end/third_party/lighthouse/report/report.js +222 -0
  591. package/dist/third-party/front_end/third_party/lit/lit.js +98 -0
  592. package/dist/third-party/front_end/third_party/marked/marked.js +1 -0
  593. package/dist/third-party/front_end/third_party/puppeteer/puppeteer.js +1 -0
  594. package/dist/third-party/front_end/third_party/puppeteer-replay/puppeteer-replay.js +1 -0
  595. package/dist/third-party/front_end/third_party/wasmparser/wasmparser.js +1 -0
  596. package/dist/third-party/front_end/ui/components/adorners/adorners.js +1 -0
  597. package/dist/third-party/front_end/ui/components/buttons/buttons.js +1 -0
  598. package/dist/third-party/front_end/ui/components/chrome_link/chrome_link.js +1 -0
  599. package/dist/third-party/front_end/ui/components/code_highlighter/code_highlighter.js +1 -0
  600. package/dist/third-party/front_end/ui/components/data_grid/data_grid.js +1 -0
  601. package/dist/third-party/front_end/ui/components/dialogs/dialogs.js +1 -0
  602. package/dist/third-party/front_end/ui/components/diff_view/diff_view.js +1 -0
  603. package/dist/third-party/front_end/ui/components/expandable_list/expandable_list.js +1 -0
  604. package/dist/third-party/front_end/ui/components/helpers/helpers.js +1 -0
  605. package/dist/third-party/front_end/ui/components/icon_button/icon_button.js +1 -0
  606. package/dist/third-party/front_end/ui/components/input/input.js +1 -0
  607. package/dist/third-party/front_end/ui/components/issue_counter/issue_counter.js +1 -0
  608. package/dist/third-party/front_end/ui/components/legacy_wrapper/legacy_wrapper.js +1 -0
  609. package/dist/third-party/front_end/ui/components/linear_memory_inspector/linear_memory_inspector-meta.js +1 -0
  610. package/dist/third-party/front_end/ui/components/linear_memory_inspector/linear_memory_inspector.js +1 -0
  611. package/dist/third-party/front_end/ui/components/linkifier/linkifier.js +1 -0
  612. package/dist/third-party/front_end/ui/components/markdown_view/markdown_view.js +1 -0
  613. package/dist/third-party/front_end/ui/components/menus/menus.js +1 -0
  614. package/dist/third-party/front_end/ui/components/node_text/node_text.js +1 -0
  615. package/dist/third-party/front_end/ui/components/panel_feedback/panel_feedback.js +1 -0
  616. package/dist/third-party/front_end/ui/components/panel_introduction_steps/panel_introduction_steps.js +1 -0
  617. package/dist/third-party/front_end/ui/components/render_coordinator/render_coordinator.js +1 -0
  618. package/dist/third-party/front_end/ui/components/report_view/report_view.js +1 -0
  619. package/dist/third-party/front_end/ui/components/request_link_icon/request_link_icon.js +1 -0
  620. package/dist/third-party/front_end/ui/components/settings/settings.js +1 -0
  621. package/dist/third-party/front_end/ui/components/srgb_overlay/srgb_overlay.js +1 -0
  622. package/dist/third-party/front_end/ui/components/survey_link/survey_link.js +1 -0
  623. package/dist/third-party/front_end/ui/components/text_editor/text_editor.js +1 -0
  624. package/dist/third-party/front_end/ui/components/text_prompt/text_prompt.js +1 -0
  625. package/dist/third-party/front_end/ui/components/tree_outline/tree_outline.js +1 -0
  626. package/dist/third-party/front_end/ui/components/two_states_counter/two_states_counter.js +1 -0
  627. package/dist/third-party/front_end/ui/legacy/components/color_picker/color_picker-legacy.js +1 -0
  628. package/dist/third-party/front_end/ui/legacy/components/color_picker/color_picker.js +1 -0
  629. package/dist/third-party/front_end/ui/legacy/components/cookie_table/cookie_table-legacy.js +1 -0
  630. package/dist/third-party/front_end/ui/legacy/components/cookie_table/cookie_table.js +1 -0
  631. package/dist/third-party/front_end/ui/legacy/components/data_grid/data_grid-legacy.js +1 -0
  632. package/dist/third-party/front_end/ui/legacy/components/data_grid/data_grid.js +1 -0
  633. package/dist/third-party/front_end/ui/legacy/components/inline_editor/inline_editor-legacy.js +1 -0
  634. package/dist/third-party/front_end/ui/legacy/components/inline_editor/inline_editor.js +1 -0
  635. package/dist/third-party/front_end/ui/legacy/components/object_ui/object_ui-legacy.js +1 -0
  636. package/dist/third-party/front_end/ui/legacy/components/object_ui/object_ui-meta.js +1 -0
  637. package/dist/third-party/front_end/ui/legacy/components/object_ui/object_ui.js +1 -0
  638. package/dist/third-party/front_end/ui/legacy/components/perf_ui/perf_ui-legacy.js +1 -0
  639. package/dist/third-party/front_end/ui/legacy/components/perf_ui/perf_ui-meta.js +1 -0
  640. package/dist/third-party/front_end/ui/legacy/components/perf_ui/perf_ui.js +12 -0
  641. package/dist/third-party/front_end/ui/legacy/components/quick_open/quick_open-legacy.js +1 -0
  642. package/dist/third-party/front_end/ui/legacy/components/quick_open/quick_open-meta.js +1 -0
  643. package/dist/third-party/front_end/ui/legacy/components/quick_open/quick_open.js +1 -0
  644. package/dist/third-party/front_end/ui/legacy/components/source_frame/source_frame-legacy.js +1 -0
  645. package/dist/third-party/front_end/ui/legacy/components/source_frame/source_frame-meta.js +1 -0
  646. package/dist/third-party/front_end/ui/legacy/components/source_frame/source_frame.js +1 -0
  647. package/dist/third-party/front_end/ui/legacy/components/utils/utils-legacy.js +1 -0
  648. package/dist/third-party/front_end/ui/legacy/components/utils/utils.js +1 -0
  649. package/dist/third-party/front_end/ui/legacy/legacy-legacy.js +1 -0
  650. package/dist/third-party/front_end/ui/legacy/legacy.js +1 -0
  651. package/dist/third-party/front_end/ui/legacy/theme_support/theme_support.js +1 -0
  652. package/dist/third-party/front_end/ui/legacy/utils/utils.js +1 -0
  653. package/dist/third-party/front_end/ui/lit-html/lit-html.js +1 -0
  654. package/dist/third-party/front_end/worker_app.html +20 -0
  655. package/index.js +15 -0
  656. package/package.json +25 -0
@@ -0,0 +1 @@
1
+ import*as o from"../../core/i18n/i18n.js";import*as r from"../../ui/legacy/legacy.js";const e={performanceMonitor:"Performance monitor",performance:"performance",systemMonitor:"system monitor",monitor:"monitor",activity:"activity",metrics:"metrics",showPerformanceMonitor:"Show Performance monitor"},i=o.i18n.registerUIStrings("panels/performance_monitor/performance_monitor-meta.ts",e),n=o.i18n.getLazilyComputedLocalizedString.bind(void 0,i);let t;r.ViewManager.registerViewExtension({location:"drawer-view",id:"performance.monitor",title:n(e.performanceMonitor),commandPrompt:n(e.showPerformanceMonitor),persistence:"closeable",order:100,loadView:async()=>(await async function(){return t||(t=await import("./performance_monitor.js")),t}()).PerformanceMonitor.PerformanceMonitorImpl.instance(),tags:[n(e.performance),n(e.systemMonitor),n(e.monitor),n(e.activity),n(e.metrics)]});
@@ -0,0 +1 @@
1
+ import*as e from"../../core/common/common.js";import*as t from"../../core/host/host.js";import*as o from"../../core/i18n/i18n.js";import*as r from"../../core/platform/platform.js";import*as i from"../../core/sdk/sdk.js";import*as s from"../../ui/components/icon_button/icon_button.js";import*as n from"../../ui/legacy/legacy.js";import*as a from"../../ui/legacy/theme_support/theme_support.js";const l=new CSSStyleSheet;l.replaceSync(".perfmon-pane{overflow:hidden;--override-color-perf-monitor-cpu:rgb(227 33 33);--override-color-perf-monitor-cpu-task-duration:rgb(154 154 154);--override-color-perf-monitor-cpu-script-duration:rgb(255 165 0);--override-color-perf-monitor-cpu-layout-duration:rgb(138 43 226);--override-color-perf-monitor-cpu-recalc-style-duration:rgb(238 130 238);--override-color-perf-monitor-jsheap:rgb(0 0 255);--override-color-perf-monitor-jsheap-total-size:rgb(153 153 255);--override-color-perf-monitor-jsheap-used-size:rgb(0 0 255);--override-color-perf-monitor-dom-nodes:rgb(11 154 11);--override-color-perf-monitor-js-event-listeners:rgb(154 205 50);--override-color-perf-monitor-documents:rgb(0 0 139);--override-color-perf-monitor-document-frames:rgb(0 139 139);--override-color-perf-monitor-layout-count:rgb(255 105 180);--override-color-perf-monitor-recalc-style-count:rgb(255 20 147)}:host-context(.-theme-with-dark-background) .perfmon-pane{--override-color-perf-monitor-cpu:rgb(242 113 113);--override-color-perf-monitor-cpu-task-duration:rgb(201 201 201);--override-color-perf-monitor-cpu-script-duration:rgb(255 165 0);--override-color-perf-monitor-cpu-layout-duration:rgb(124 29 212);--override-color-perf-monitor-cpu-recalc-style-duration:rgb(179 49 179);--override-color-perf-monitor-jsheap:rgb(153 153 255);--override-color-perf-monitor-jsheap-total-size:rgb(153 153 255);--override-color-perf-monitor-jsheap-used-size:rgb(0 0 255);--override-color-perf-monitor-dom-nodes:rgb(127 255 127);--override-color-perf-monitor-js-event-listeners:rgb(154 205 50);--override-color-perf-monitor-documents:rgb(116 116 255);--override-color-perf-monitor-document-frames:rgb(116 255 255);--override-color-perf-monitor-layout-count:rgb(255 105 180);--override-color-perf-monitor-recalc-style-count:rgb(235 0 127)}.perfmon-pane.suspended{opacity:40%;pointer-events:none}.perfmon-pane .perfmon-chart-suspend-overlay{display:none;font-size:26px;align-items:center;justify-content:center}.perfmon-pane.suspended .perfmon-chart-suspend-overlay{display:flex}.perfmon-control-pane{display:flex;flex-direction:column;padding:6px 0;overflow-x:hidden;overflow-y:auto}.perfmon-chart-container{display:flex;flex:1 1;border-left:1px solid var(--color-details-hairline);overflow-y:auto}.perfmon-chart-container canvas{width:100%}.perfmon-indicator{padding:6px 12px;margin:-1px 0;display:flex;flex-shrink:0;width:210px}.perfmon-indicator:hover,\n.perfmon-indicator:focus-visible{background-color:var(--color-background-elevation-1)}.perfmon-indicator-swatch{margin-right:4px}.perfmon-indicator-title{flex:0 0 115px}.perfmon-indicator:not(.active) .perfmon-indicator-title{color:var(--color-text-secondary)}.perfmon-indicator-value{flex:0 0 55px;text-align:right;overflow:visible}.perfmon-indicator:not(.active) .perfmon-indicator-value{opacity:0%}\n/*# sourceURL=performanceMonitor.css */\n");const c={graphsDisplayingARealtimeViewOf:"Graphs displaying a real-time view of performance metrics",paused:"Paused",cpuUsage:"CPU usage",jsHeapSize:"JS heap size",domNodes:"DOM Nodes",jsEventListeners:"JS event listeners",documents:"Documents",documentFrames:"Document Frames",layoutsSec:"Layouts / sec",styleRecalcsSec:"Style recalcs / sec"},h=o.i18n.registerUIStrings("panels/performance_monitor/PerformanceMonitor.ts",c),m=o.i18n.getLocalizedString.bind(void 0,h);let d,p,u;class f extends n.Widget.HBox{metricsBuffer;pixelsPerMs;pollIntervalMs;scaleHeight;graphHeight;gridColor;controlPane;canvas;animationId;width;height;model;startTimestamp;pollTimer;constructor(e){super(!0),this.contentElement.classList.add("perfmon-pane"),this.metricsBuffer=[],this.pixelsPerMs=.01,this.pollIntervalMs=e,this.scaleHeight=16,this.graphHeight=90,this.gridColor=a.ThemeSupport.instance().getComputedValue("--divider-line"),this.controlPane=new g(this.contentElement);const t=this.contentElement.createChild("div","perfmon-chart-container");this.canvas=t.createChild("canvas"),this.canvas.tabIndex=-1,n.ARIAUtils.setLabel(this.canvas,m(c.graphsDisplayingARealtimeViewOf)),this.contentElement.createChild("div","perfmon-chart-suspend-overlay fill").createChild("div").textContent=m(c.paused),this.controlPane.addEventListener("MetricChanged",this.recalcChartHeight,this),i.TargetManager.TargetManager.instance().observeModels(i.PerformanceMetricsModel.PerformanceMetricsModel,this)}static instance(e={forceNew:null}){const{forceNew:t}=e;return d&&!t||(d=new f(500)),d}wasShown(){if(!this.model)return;this.registerCSSFiles([l]),this.controlPane.instantiateMetricData();a.ThemeSupport.instance().addEventListener(a.ThemeChangeEvent.eventName,(()=>{this.controlPane.instantiateMetricData(),this.draw()})),i.TargetManager.TargetManager.instance().addEventListener(i.TargetManager.Events.SuspendStateChanged,this.suspendStateChanged,this),this.model.enable(),this.suspendStateChanged()}willHide(){this.model&&(i.TargetManager.TargetManager.instance().removeEventListener(i.TargetManager.Events.SuspendStateChanged,this.suspendStateChanged,this),this.stopPolling(),this.model.disable())}modelAdded(e){e.target()===i.TargetManager.TargetManager.instance().primaryPageTarget()&&(this.model=e,this.isShowing()&&this.wasShown())}modelRemoved(e){this.model===e&&(this.isShowing()&&this.willHide(),this.model=null)}suspendStateChanged(){const e=i.TargetManager.TargetManager.instance().allTargetsSuspended();e?this.stopPolling():this.startPolling(),this.contentElement.classList.toggle("suspended",e)}startPolling(){this.startTimestamp=0,this.pollTimer=window.setInterval((()=>this.poll()),this.pollIntervalMs),this.onResize();const e=()=>{this.draw(),this.animationId=this.contentElement.window().requestAnimationFrame((()=>{e()}))};e()}stopPolling(){window.clearInterval(this.pollTimer),this.contentElement.window().cancelAnimationFrame(this.animationId),this.metricsBuffer=[]}async poll(){if(!this.model)return;const e=await this.model.requestMetrics(),t=e.timestamp,o=e.metrics;this.metricsBuffer.push({timestamp:t,metrics:o});const r=this.width/this.pixelsPerMs,i=Math.ceil(r/this.pollIntervalMs*2);this.metricsBuffer.length>2*i&&this.metricsBuffer.splice(0,this.metricsBuffer.length-i),this.controlPane.updateMetrics(o)}draw(){const e=this.canvas.getContext("2d");e.save(),e.scale(window.devicePixelRatio,window.devicePixelRatio),e.clearRect(0,0,this.width,this.height),e.save(),e.translate(0,this.scaleHeight);for(const t of this.controlPane.charts())this.controlPane.isActive(t.metrics[0].name)&&(this.drawChart(e,t,this.graphHeight),e.translate(0,this.graphHeight));e.restore(),this.drawHorizontalGrid(e),e.restore()}drawHorizontalGrid(e){const o=a.ThemeSupport.instance().getComputedValue("--color-background-inverted-opacity-2");e.font="10px "+t.Platform.fontFamily(),e.fillStyle=a.ThemeSupport.instance().getComputedValue("--color-background-inverted-opacity-50");const r=Date.now()/1e3;for(let t=Math.ceil(r);;--t){const i=this.width-(1e3*(r-t)-this.pollIntervalMs)*this.pixelsPerMs;if(i<-50)break;e.beginPath(),e.moveTo(i,0),e.lineTo(i,this.height),t>=0&&t%10==0&&e.fillText(new Date(1e3*t).toLocaleTimeString(),i+4,12),e.strokeStyle=t%10?o:this.gridColor,e.stroke()}}drawChart(o,r,i){o.save(),o.rect(0,0,this.width,i),o.clip();const s=1.05*this.calcMax(r),n=r.stacked?new Map:null,l=[];for(let e=r.metrics.length-1;e>=0;--e){const t=r.metrics[e];l.push({path:this.buildMetricPath(r,t,i-8,s,e?n:null),color:t.color})}const c=e.Color.parse(a.ThemeSupport.instance().getComputedValue("--color-background"))?.asLegacyColor();if(c)for(const t of l.reverse()){const r=t.color;o.save();const i=e.Color.parse(r);i&&(o.fillStyle=c.blendWith(i.setAlpha(.2).asLegacyColor()).asString()||"",o.fill(t.path),o.strokeStyle=r,o.lineWidth=.5,o.stroke(t.path),o.restore())}o.fillStyle=a.ThemeSupport.instance().getComputedValue("--color-background-inverted-opacity-50"),o.font=`10px ${t.Platform.fontFamily()}`,o.fillText(r.title,8,10),this.drawVerticalGrid(o,i-8,s,r),o.restore()}calcMax(e){if(e.max)return e.max;const t=this.width,o=performance.now()-this.pollIntervalMs-t/this.pixelsPerMs;let r=-1/0;for(const t of e.metrics)for(let e=this.metricsBuffer.length-1;e>=0;--e){const i=this.metricsBuffer[e],s=i.metrics.get(t.name);if(void 0!==s&&(r=Math.max(r,s)),i.timestamp<o)break}if(!this.metricsBuffer.length)return 10;const i=Math.pow(10,Math.floor(Math.log10(r)));r=Math.ceil(r/i/2)*i*2;return e.currentMax=.2*r+.8*(e.currentMax||r),e.currentMax}drawVerticalGrid(e,t,o,r){let i=Math.pow(10,Math.floor(Math.log10(o)));const s=Math.floor(o/i);1!==s&&s%2==1&&(i*=2);let n=Math.floor(o/i)*i;const l=o,c=t-18;e.fillStyle=a.ThemeSupport.instance().getComputedValue("--color-background-inverted-opacity-50"),e.strokeStyle=this.gridColor,e.beginPath();for(let t=0;t<2;++t){const t=h(n),o=v.formatNumber(n,r);e.moveTo(0,t),e.lineTo(4,t),e.moveTo(e.measureText(o).width+12,t),e.lineTo(this.width,t),e.fillText(o,8,h(n)+3),n/=2}function h(e){return Math.round(t-c*e/l)+.5}e.stroke(),e.beginPath(),e.moveTo(0,t+.5),e.lineTo(this.width,t+.5),e.strokeStyle=a.ThemeSupport.instance().getComputedValue("--color-background-inverted-opacity-2"),e.stroke()}buildMetricPath(e,t,o,i,s){const n=new Path2D,a=o-18;if(a<1)return n;const l=i,c=t.name,h=this.pixelsPerMs,m=performance.now()-this.pollIntervalMs-this.width/h,d=e.smooth;let p=0,u=0,f=0;this.metricsBuffer.length&&(p=(this.metricsBuffer[0].timestamp-m)*h,n.moveTo(p,g(0)),n.lineTo(this.width+5,g(0)),u=g(this.metricsBuffer[this.metricsBuffer.length-1].metrics.get(c)||0),f=this.width+5,n.lineTo(f,u));for(let e=this.metricsBuffer.length-1;e>=0;--e){const t=this.metricsBuffer[e],o=t.timestamp;let i=t.metrics.get(c)||0;s&&(i+=s.get(o)||0,i=r.NumberUtilities.clamp(i,0,1),s.set(o,i));const a=g(i);if(p=(o-m)*h,d){const e=(f+p)/2;n.bezierCurveTo(e,u,e,a,p,a)}else n.lineTo(p,u),n.lineTo(p,a);if(f=p,u=a,o<m)break}return n;function g(e){return Math.round(o-a*e/l)+.5}}onResize(){super.onResize(),this.width=this.canvas.offsetWidth,this.canvas.width=Math.round(this.width*window.devicePixelRatio),this.recalcChartHeight()}recalcChartHeight(){let e=this.scaleHeight;for(const t of this.controlPane.charts())this.controlPane.isActive(t.metrics[0].name)&&(e+=this.graphHeight);this.height=Math.ceil(e*window.devicePixelRatio),this.canvas.height=this.height,this.canvas.style.height=this.height/window.devicePixelRatio+"px"}}class g extends e.ObjectWrapper.ObjectWrapper{element;enabledChartsSetting;enabledCharts;chartsInfo=[];indicators=new Map;constructor(t){super(),this.element=t.createChild("div","perfmon-control-pane"),this.enabledChartsSetting=e.Settings.Settings.instance().createSetting("perfmonActiveIndicators2",["TaskDuration","JSHeapTotalSize","Nodes"]),this.enabledCharts=new Set(this.enabledChartsSetting.get())}instantiateMetricData(){const e={color:void 0,format:void 0,currentMax:void 0,max:void 0,smooth:void 0,stacked:void 0},t=a.ThemeSupport.instance();this.chartsInfo=[{...e,title:m(c.cpuUsage),metrics:[{name:"TaskDuration",color:t.getComputedValue("--override-color-perf-monitor-cpu-task-duration",this.element)},{name:"ScriptDuration",color:t.getComputedValue("--override-color-perf-monitor-cpu-script-duration",this.element)},{name:"LayoutDuration",color:t.getComputedValue("--override-color-perf-monitor-cpu-layout-duration",this.element)},{name:"RecalcStyleDuration",color:t.getComputedValue("--override-color-perf-monitor-cpu-recalc-style-duration",this.element)}],format:"Percent",smooth:!0,stacked:!0,color:t.getComputedValue("--override-color-perf-monitor-cpu",this.element),max:1,currentMax:void 0},{...e,title:m(c.jsHeapSize),metrics:[{name:"JSHeapTotalSize",color:t.getComputedValue("--override-color-perf-monitor-jsheap-total-size",this.element)},{name:"JSHeapUsedSize",color:t.getComputedValue("--override-color-perf-monitor-jsheap-used-size",this.element)}],format:"Bytes",color:t.getComputedValue("--override-color-perf-monitor-jsheap")},{...e,title:m(c.domNodes),metrics:[{name:"Nodes",color:t.getComputedValue("--override-color-perf-monitor-dom-nodes",this.element)}]},{...e,title:m(c.jsEventListeners),metrics:[{name:"JSEventListeners",color:t.getComputedValue("--override-color-perf-monitor-js-event-listeners",this.element)}]},{...e,title:m(c.documents),metrics:[{name:"Documents",color:t.getComputedValue("--override-color-perf-monitor-documents",this.element)}]},{...e,title:m(c.documentFrames),metrics:[{name:"Frames",color:t.getComputedValue("--override-color-perf-monitor-document-frames",this.element)}]},{...e,title:m(c.layoutsSec),metrics:[{name:"LayoutCount",color:t.getComputedValue("--override-color-perf-monitor-layout-count",this.element)}]},{...e,title:m(c.styleRecalcsSec),metrics:[{name:"RecalcStyleCount",color:t.getComputedValue("--override-color-perf-monitor-recalc-style-count",this.element)}]}],this.element.removeChildren(),this.indicators=new Map;for(const e of this.chartsInfo){const t=e.metrics[0].name,o=this.enabledCharts.has(t),r=new v(this.element,e,o,this.onToggle.bind(this,t));this.indicators.set(t,r)}}onToggle(e,t){t?this.enabledCharts.add(e):this.enabledCharts.delete(e),this.enabledChartsSetting.set(Array.from(this.enabledCharts)),this.dispatchEventToListeners("MetricChanged")}charts(){return this.chartsInfo}isActive(e){return this.enabledCharts.has(e)}updateMetrics(e){for(const t of this.indicators.keys()){const o=e.get(t);if(void 0!==o){const e=this.indicators.get(t);e&&e.setValue(o)}}}}class v{info;active;onToggle;element;swatchElement;valueElement;color;constructor(e,t,o,r){this.color=t.color||t.metrics[0].color,this.info=t,this.active=o,this.onToggle=r,this.element=e.createChild("div","perfmon-indicator"),this.swatchElement=new s.Icon.Icon,this.swatchElement.classList.add("perfmon-indicator-swatch"),this.updateSwatchElement(),this.element.appendChild(this.swatchElement),this.element.createChild("div","perfmon-indicator-title").textContent=t.title,this.valueElement=this.element.createChild("div","perfmon-indicator-value"),this.valueElement.style.color=this.color,this.element.addEventListener("click",(()=>this.toggleIndicator())),this.element.addEventListener("keypress",(e=>this.handleKeypress(e))),this.element.classList.toggle("active",o),n.ARIAUtils.markAsCheckbox(this.element),n.ARIAUtils.setChecked(this.element,this.active),this.element.tabIndex=0}static formatNumber(e,t){switch(p||(p=new Intl.NumberFormat("en-US",{maximumFractionDigits:1}),u=new Intl.NumberFormat("en-US",{maximumFractionDigits:1,style:"percent"})),t.format){case"Percent":return u.format(e);case"Bytes":return r.NumberUtilities.bytesToString(e);default:return p.format(e)}}setValue(e){this.valueElement.textContent=v.formatNumber(e,this.info)}updateSwatchElement(){const e=this.active?this.color:"var(--icon-disabled)";this.swatchElement.data={iconName:"checkmark",color:e,width:"16px",height:"14px"}}toggleIndicator(){this.active=!this.active,this.updateSwatchElement(),this.element.classList.toggle("active",this.active),n.ARIAUtils.setChecked(this.element,this.active),this.onToggle(this.active)}handleKeypress(e){const t=e;" "!==t.key&&"Enter"!==t.key||this.toggleIndicator()}}const w=new Intl.NumberFormat("en-US",{maximumFractionDigits:1});var b=Object.freeze({__proto__:null,PerformanceMonitorImpl:f,ControlPane:g,MetricIndicator:v,format:w});export{b as PerformanceMonitor};
@@ -0,0 +1 @@
1
+ import*as e from"./profiler.js";self.Profiler=self.Profiler||{},Profiler=Profiler||{},Profiler.CPUProfileFlameChart=e.CPUProfileFlameChart.CPUProfileFlameChart,Profiler.CPUProfileView=e.CPUProfileView.CPUProfileView,Profiler.CPUProfileHeader=e.CPUProfileView.CPUProfileHeader,Profiler.HeapProfileView=e.HeapProfileView.HeapProfileView,Profiler.SamplingHeapProfileType=e.HeapProfileView.SamplingHeapProfileType,Profiler.SamplingHeapProfileNode=e.HeapProfileView.SamplingHeapProfileNode,Profiler.HeapProfilerPanel=e.HeapProfilerPanel.HeapProfilerPanel,Profiler.HeapSnapshotSortableDataGrid=e.HeapSnapshotDataGrids.HeapSnapshotSortableDataGrid,Profiler.HeapSnapshotSortableDataGridEvents=e.HeapSnapshotDataGrids.HeapSnapshotSortableDataGridEvents,Profiler.HeapSnapshotContainmentDataGrid=e.HeapSnapshotDataGrids.HeapSnapshotContainmentDataGrid,Profiler.HeapSnapshotRetainmentDataGrid=e.HeapSnapshotDataGrids.HeapSnapshotRetainmentDataGrid,Profiler.HeapSnapshotRetainmentDataGridEvents=e.HeapSnapshotDataGrids.HeapSnapshotRetainmentDataGridEvents,Profiler.HeapSnapshotConstructorsDataGrid=e.HeapSnapshotDataGrids.HeapSnapshotConstructorsDataGrid,Profiler.HeapSnapshotDiffDataGrid=e.HeapSnapshotDataGrids.HeapSnapshotDiffDataGrid,Profiler.HeapSnapshotGridNode=e.HeapSnapshotGridNodes.HeapSnapshotGridNode,Profiler.HeapSnapshotDiffNode=e.HeapSnapshotGridNodes.HeapSnapshotDiffNode,Profiler.HeapSnapshotProxy=e.HeapSnapshotProxy.HeapSnapshotProxy,Profiler.HeapSnapshotWorkerProxy=e.HeapSnapshotProxy.HeapSnapshotWorkerProxy,Profiler.HeapSnapshotProviderProxy=e.HeapSnapshotProxy.HeapSnapshotProviderProxy,Profiler.HeapSnapshotView=e.HeapSnapshotView.HeapSnapshotView,Profiler.HeapSnapshotProfileType=e.HeapSnapshotView.HeapSnapshotProfileType,Profiler.HeapProfileHeader=e.HeapSnapshotView.HeapProfileHeader,Profiler.HeapTimelineOverview=e.HeapTimelineOverview.HeapTimelineOverview,Profiler.IsolateSelector=e.IsolateSelector.IsolateSelector,Profiler.LiveHeapProfileView=e.LiveHeapProfileView.LiveHeapProfileView,Profiler.LiveHeapProfileView.ActionDelegate=e.LiveHeapProfileView.ActionDelegate,Profiler.ProfileDataGridNode=e.ProfileDataGrid.ProfileDataGridNode,Profiler.ProfileHeader=e.ProfileHeader.ProfileHeader,Profiler.ProfileHeader.Events=e.ProfileHeader.Events,Profiler.ProfileLauncherView=e.ProfileLauncherView.ProfileLauncherView,Profiler.ProfileType=e.ProfileHeader.ProfileType,Profiler.ProfileTypeRegistry=e.ProfileTypeRegistry.ProfileTypeRegistry,Profiler.ProfileTypeRegistry.instance=e.ProfileTypeRegistry.instance,Profiler.ProfileView=e.ProfileView.ProfileView,Profiler.ProfilesPanel=e.ProfilesPanel.ProfilesPanel,Profiler.ProfileTypeSidebarSection=e.ProfilesPanel.ProfileTypeSidebarSection,Profiler.JSProfilerPanel=e.ProfilesPanel.JSProfilerPanel;
@@ -0,0 +1 @@
1
+ import*as e from"../../core/common/common.js";import*as t from"../../core/i18n/i18n.js";import*as o from"../../core/root/root.js";import*as i from"../../core/sdk/sdk.js";import*as r from"../../ui/legacy/legacy.js";let a;const n={memory:"Memory",liveHeapProfile:"Live Heap Profile",startRecordingHeapAllocations:"Start recording heap allocations",stopRecordingHeapAllocations:"Stop recording heap allocations",startRecordingHeapAllocationsAndReload:"Start recording heap allocations and reload the page",startStopRecording:"Start/stop recording",showNativeFunctions:"Show native functions in JS Profile",showMemory:"Show Memory",showLiveHeapProfile:"Show Live Heap Profile"},l=t.i18n.registerUIStrings("panels/profiler/profiler-meta.ts",n),s=t.i18n.getLazilyComputedLocalizedString.bind(void 0,l);async function c(){return a||(a=await import("./profiler.js")),a}r.ViewManager.registerViewExtension({location:"panel",id:"heap_profiler",commandPrompt:s(n.showMemory),title:s(n.memory),order:60,loadView:async()=>(await c()).HeapProfilerPanel.HeapProfilerPanel.instance()}),r.ViewManager.registerViewExtension({location:"drawer-view",id:"live_heap_profile",commandPrompt:s(n.showLiveHeapProfile),title:s(n.liveHeapProfile),persistence:"closeable",order:100,loadView:async()=>(await c()).LiveHeapProfileView.LiveHeapProfileView.instance(),experiment:o.Runtime.ExperimentName.LIVE_HEAP_PROFILE}),r.ActionRegistration.registerActionExtension({actionId:"live-heap-profile.toggle-recording",iconClass:"record-start",toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,loadActionDelegate:async()=>(await c()).LiveHeapProfileView.ActionDelegate.instance(),category:r.ActionRegistration.ActionCategory.MEMORY,experiment:o.Runtime.ExperimentName.LIVE_HEAP_PROFILE,options:[{value:!0,title:s(n.startRecordingHeapAllocations)},{value:!1,title:s(n.stopRecordingHeapAllocations)}]}),r.ActionRegistration.registerActionExtension({actionId:"live-heap-profile.start-with-reload",iconClass:"refresh",loadActionDelegate:async()=>(await c()).LiveHeapProfileView.ActionDelegate.instance(),category:r.ActionRegistration.ActionCategory.MEMORY,experiment:o.Runtime.ExperimentName.LIVE_HEAP_PROFILE,title:s(n.startRecordingHeapAllocationsAndReload)}),r.ActionRegistration.registerActionExtension({actionId:"profiler.heap-toggle-recording",category:r.ActionRegistration.ActionCategory.MEMORY,iconClass:"record-start",title:s(n.startStopRecording),toggleable:!0,toggledIconClass:"record-stop",toggleWithRedColor:!0,contextTypes(){return e=e=>[e.HeapProfilerPanel.HeapProfilerPanel],void 0===a?[]:e(a);var e},loadActionDelegate:async()=>(await c()).HeapProfilerPanel.HeapProfilerPanel.instance(),bindings:[{platform:"windows,linux",shortcut:"Ctrl+E"},{platform:"mac",shortcut:"Meta+E"}]}),e.Settings.registerSettingExtension({category:e.Settings.SettingCategory.PERFORMANCE,storageType:e.Settings.SettingStorageType.Synced,title:s(n.showNativeFunctions),settingName:"showNativeFunctionsInJSProfile",settingType:e.Settings.SettingType.BOOLEAN,defaultValue:!0}),r.ContextMenu.registerProvider({contextTypes:()=>[i.RemoteObject.RemoteObject],loadProvider:async()=>(await c()).HeapProfilerPanel.HeapProfilerPanel.instance(),experiment:void 0});
@@ -0,0 +1,7 @@
1
+ import*as e from"../../core/platform/platform.js";import*as t from"../../core/i18n/i18n.js";import*as i from"../../ui/components/icon_button/icon_button.js";import*as r from"../../ui/legacy/components/data_grid/data_grid.js";import*as s from"../../ui/legacy/legacy.js";import*as o from"../../core/common/common.js";import*as n from"../../ui/legacy/components/perf_ui/perf_ui.js";import*as a from"../../core/host/host.js";import*as l from"../../core/sdk/sdk.js";import*as d from"../../ui/legacy/components/utils/utils.js";import*as h from"../../models/bindings/bindings.js";import*as c from"../../core/root/root.js";import*as p from"../../models/heap_snapshot_model/heap_snapshot_model.js";import*as u from"../../ui/legacy/components/object_ui/object_ui.js";import*as m from"../../models/workspace/workspace.js";const f={notOptimizedS:"Not optimized: {PH1}",genericTextTwoPlaceholders:"{PH1}, {PH2}"},g=t.i18n.registerUIStrings("panels/profiler/ProfileDataGrid.ts",f),v=t.i18n.getLocalizedString.bind(void 0,g);class w extends r.DataGrid.DataGridNode{searchMatchedSelfColumn;searchMatchedTotalColumn;searchMatchedFunctionColumn;profileNode;tree;childrenByCallUID;lastComparator;callUID;self;total;functionName;deoptReason;url;linkElement;populated;savedSelf;savedTotal;savedChildren;constructor(e,t,i){super(null,i),this.searchMatchedSelfColumn=!1,this.searchMatchedTotalColumn=!1,this.searchMatchedFunctionColumn=!1,this.profileNode=e,this.tree=t,this.childrenByCallUID=new Map,this.lastComparator=null,this.callUID=e.callUID,this.self=e.self,this.total=e.total,this.functionName=s.UIUtils.beautifyFunctionName(e.functionName),this.deoptReason=e.deoptReason||"",this.url=e.url,this.linkElement=null,this.populated=!1}static sort(e,t,i){for(let r=0;r<e.length;++r){const s=e[r],o=s.length;for(let r=0;r<o;++r){const o=s[r];if(!(i||o.expanded&&o.lastComparator!==t)){o.children.length&&(o.shouldRefreshChildren=!0);continue}o.lastComparator=t;const n=o.children,a=n.length;if(a){n.sort(t);for(let e=0;e<a;++e)n[e].recalculateSiblings(e);e.push(n)}}}}static merge(e,t,i){e.self+=t.self,i||(e.total+=t.total);let r=e.children.slice();e.removeChildren();let s=r.length;for(let o=0;o<s;++o)i&&r[o]===t||e.appendChild(r[o]);r=t.children.slice(),s=r.length;for(let t=0;t<s;++t){const i=r[t],s=e.childrenByCallUID.get(i.callUID);s?s.merge(i,!1):e.appendChild(i)}}static populate(e){if(e.populated)return;e.populated=!0,e.populateChildren();const t=e.tree.lastComparator;t&&e.sort(t,!0)}createCell(e){switch(e){case"self":{const t=this.createValueCell(this.self,this.selfPercent,e);return t.classList.toggle("highlight",this.searchMatchedSelfColumn),t}case"total":{const t=this.createValueCell(this.total,this.totalPercent,e);return t.classList.toggle("highlight",this.searchMatchedTotalColumn),t}case"function":{const t=this.createTD(e);if(t.classList.toggle("highlight",this.searchMatchedFunctionColumn),this.deoptReason){t.classList.add("not-optimized");const e=new i.Icon.Icon;e.data={iconName:"warning-filled",color:"var(--icon-warning)",width:"14px",height:"14px"},e.classList.add("profile-warn-marker"),s.Tooltip.Tooltip.install(e,v(f.notOptimizedS,{PH1:this.deoptReason})),t.appendChild(e)}if(s.UIUtils.createTextChild(t,this.functionName),"0"===this.profileNode.scriptId)return t;const r=this.tree.formatter.linkifyNode(this);return r?(r.style.maxWidth="75%",t.appendChild(r),this.linkElement=r,t):t}}return super.createCell(e)}createValueCell(e,t,i){const r=document.createElement("td");r.classList.add("numeric-column");const s=r.createChild("div","profile-multiple-values"),o=s.createChild("span"),n=this.tree.formatter.formatValue(e,this);o.textContent=n;const a=s.createChild("span","percent-column"),l=this.tree.formatter.formatPercent(t,this);a.textContent=l;const d=this.tree.formatter.formatValueAccessibleText(e,this);return this.setCellAccessibleName(v(f.genericTextTwoPlaceholders,{PH1:d,PH2:l}),r,i),r}sort(e,t){const i=e;return w.sort([[this]],i,t)}insertChild(e,t){const i=e;super.insertChild(i,t),this.childrenByCallUID.set(i.callUID,i)}removeChild(e){super.removeChild(e),this.childrenByCallUID.delete(e.callUID)}removeChildren(){super.removeChildren(),this.childrenByCallUID.clear()}findChild(e){return e&&this.childrenByCallUID.get(e.callUID)||null}get selfPercent(){return this.self/this.tree.total*100}get totalPercent(){return this.total/this.tree.total*100}populate(){w.populate(this)}populateChildren(){}save(){this.savedChildren||(this.savedSelf=this.self,this.savedTotal=this.total,this.savedChildren=this.children.slice())}restore(){if(!this.savedChildren)return;this.savedSelf&&this.savedTotal&&(this.self=this.savedSelf,this.total=this.savedTotal),this.removeChildren();const e=this.savedChildren,t=e.length;for(let i=0;i<t;++i)e[i].restore(),this.appendChild(e[i])}merge(e,t){w.merge(this,e,t)}}class S{tree;self;children;formatter;searchableView;total;lastComparator;childrenByCallUID;deepSearch;populated;searchResults;savedTotal;savedChildren;searchResultIndex=-1;constructor(e,t,i){this.tree=this,this.self=0,this.children=[],this.formatter=e,this.searchableView=t,this.total=i,this.lastComparator=null,this.childrenByCallUID=new Map,this.deepSearch=!0,this.populated=!1}static propertyComparator(e,t){let i=S.propertyComparators[t?1:0][e];return i||(i=t?function(t,i){return t[e]<i[e]?-1:t[e]>i[e]?1:0}:function(t,i){return t[e]>i[e]?-1:t[e]<i[e]?1:0},S.propertyComparators[t?1:0][e]=i),i}get expanded(){return!0}appendChild(e){this.insertChild(e,this.children.length)}focus(e){}exclude(e){}insertChild(e,t){const i=e;this.children.splice(t,0,i),this.childrenByCallUID.set(i.callUID,e)}removeChildren(){this.children=[],this.childrenByCallUID.clear()}populateChildren(){}findChild(e){return e&&this.childrenByCallUID.get(e.callUID)||null}sort(e,t){return w.sort([[this]],e,t)}save(){this.savedChildren||(this.savedTotal=this.total,this.savedChildren=this.children.slice())}restore(){if(!this.savedChildren)return;this.children=this.savedChildren,this.savedTotal&&(this.total=this.savedTotal);const e=this.children,t=e.length;for(let i=0;i<t;++i)e[i].restore();this.savedChildren=null}matchFunction(t){const i=t.query.trim();if(!i.length)return null;const r=i.startsWith(">"),s=i.startsWith("<");let o=i.startsWith("=")||(r||s)&&1===i.indexOf("=");const n=i.endsWith("%"),a=i.length>2&&i.endsWith("ms"),l=!a&&i.endsWith("s");let d=parseFloat(i);(r||s||o)&&(d=o&&(r||s)?parseFloat(i.substring(2)):parseFloat(i.substring(1)));const h=l?1e3*d:d;isNaN(d)||r||s||(o=!0);const c=e.StringUtilities.createPlainTextSearchRegex(i,"i");return function(e){return e.searchMatchedSelfColumn=!1,e.searchMatchedTotalColumn=!1,e.searchMatchedFunctionColumn=!1,n?(s?(e.selfPercent<d&&(e.searchMatchedSelfColumn=!0),e.totalPercent<d&&(e.searchMatchedTotalColumn=!0)):r&&(e.selfPercent>d&&(e.searchMatchedSelfColumn=!0),e.totalPercent>d&&(e.searchMatchedTotalColumn=!0)),o&&(e.selfPercent===d&&(e.searchMatchedSelfColumn=!0),e.totalPercent===d&&(e.searchMatchedTotalColumn=!0))):(a||l)&&(s?(e.self<h&&(e.searchMatchedSelfColumn=!0),e.total<h&&(e.searchMatchedTotalColumn=!0)):r&&(e.self>h&&(e.searchMatchedSelfColumn=!0),e.total>h&&(e.searchMatchedTotalColumn=!0)),o&&(e.self===h&&(e.searchMatchedSelfColumn=!0),e.total===h&&(e.searchMatchedTotalColumn=!0))),(e.functionName.match(c)||e.url&&e.url.match(c))&&(e.searchMatchedFunctionColumn=!0),!!(e.searchMatchedSelfColumn||e.searchMatchedTotalColumn||e.searchMatchedFunctionColumn)&&(e.refresh(),!0)}}performSearch(e,t,i){this.onSearchCanceled();const r=this.matchFunction(e);if(!r)return;this.searchResults=[];const s=this.deepSearch;let o;for(o=this.children[0];o;o=o.traverseNextNode(!s,null,!s)){const e=o;if(!e)break;r(e)&&this.searchResults.push({profileNode:e})}this.searchResultIndex=i?0:this.searchResults.length-1,this.searchableView.updateSearchMatchesCount(this.searchResults.length),this.searchableView.updateCurrentMatchIndex(this.searchResultIndex)}onSearchCanceled(){if(this.searchResults)for(let e=0;e<this.searchResults.length;++e){const t=this.searchResults[e].profileNode;t.searchMatchedSelfColumn=!1,t.searchMatchedTotalColumn=!1,t.searchMatchedFunctionColumn=!1,t.refresh()}this.searchResults=[],this.searchResultIndex=-1}jumpToNextSearchResult(){this.searchResults&&this.searchResults.length&&(this.searchResultIndex=(this.searchResultIndex+1)%this.searchResults.length,this.jumpToSearchResult(this.searchResultIndex))}jumpToPreviousSearchResult(){this.searchResults&&this.searchResults.length&&(this.searchResultIndex=(this.searchResultIndex-1+this.searchResults.length)%this.searchResults.length,this.jumpToSearchResult(this.searchResultIndex))}supportsCaseSensitiveSearch(){return!0}supportsRegexSearch(){return!1}jumpToSearchResult(e){const t=this.searchResults[e];if(!t)return;t.profileNode.revealAndSelect(),this.searchableView.updateCurrentMatchIndex(e)}static propertyComparators=[{},{}]}var b=Object.freeze({__proto__:null,ProfileDataGridNode:w,ProfileDataGridTree:S});class C extends w{remainingNodeInfos;constructor(e,t){super(e,t,null!==e.parent&&Boolean(e.parent.parent)),this.remainingNodeInfos=[]}static sharedPopulate(e){if(void 0===e.remainingNodeInfos)return;const t=e.remainingNodeInfos,i=t.length;for(let r=0;r<i;++r){const i=t[r],s=i.ancestor,o=i.focusNode;let n=e.findChild(s);if(n){const e=i.totalAccountedFor;n.self+=o.self,e||(n.total+=o.total)}else n=new C(s,e.tree),s!==o&&(n.self=o.self,n.total=o.total),e.appendChild(n);const a=s.parent;a&&a.parent&&(i.ancestor=a,n.remainingNodeInfos||(n.remainingNodeInfos=[]),n.remainingNodeInfos.push(i))}delete e.remainingNodeInfos}takePropertiesFromProfileDataGridNode(e){this.save(),this.self=e.self,this.total=e.total}keepOnlyChild(e){this.save(),this.removeChildren(),this.appendChild(e)}exclude(e){this.remainingNodeInfos&&this.populate(),this.save();const t=this.children;let i=this.children.length;for(;i--;)t[i].exclude(e);const r=this.childrenByCallUID.get(e);r&&this.merge(r,!0)}restore(){super.restore(),this.children.length||this.setHasChildren(this.willHaveChildren(this.profileNode))}merge(e,t){this.self-=e.self,super.merge(e,t)}populateChildren(){C.sharedPopulate(this)}willHaveChildren(e){return Boolean(e.parent&&e.parent.parent)}}class P extends S{deepSearch;remainingNodeInfos;constructor(e,t,i,r){super(e,t,r),this.deepSearch=!1;let s=0;const o=[[],[i]],n=new Map;this.remainingNodeInfos=[];for(let e=0;e<o.length;++e){const t=o[e],i=o[++e],r=i.length,a=new WeakMap;for(let e=0;e<r;++e){const r=i[e];if(a.get(r)||a.set(r,++s),r.parent){let e=n.get(r.callUID),i=!1;if(e){const r=t.length;for(let s=0;s<r;++s){const r=a.get(t[s]);if(r&&e.has(r)){i=!0;break}}}else e=new Set,n.set(r.callUID,e);const s=a.get(r);s&&e.add(s),this.remainingNodeInfos.push({ancestor:r,focusNode:r,totalAccountedFor:i})}const l=r.children;l.length&&(o.push(t.concat([r])),o.push(l))}}return w.populate(this),this}focus(e){if(!e)return;this.save();let t=e,i=e;for(;t.parent&&t instanceof C;)t.takePropertiesFromProfileDataGridNode(e),i=t,t=t.parent,t instanceof C&&t.keepOnlyChild(i);this.children=[i],this.total=e.total}exclude(t){if(!t)return;this.save();const i=t.callUID,r=this.childrenByCallUID.get(i);r&&e.ArrayUtilities.removeElement(this.children,r);const s=this.children,o=s.length;for(let e=0;e<o;++e)s[e].exclude(i);this.lastComparator&&this.sort(this.lastComparator,!0)}populateChildren(){C.sharedPopulate(this)}}var T=Object.freeze({__proto__:null,BottomUpProfileDataGridNode:C,BottomUpProfileDataGridTree:P}),x=Object.freeze({__proto__:null});let y=null;class I{colorGeneratorInternal;maxStackDepthInternal;timelineData_;entryNodes;#e;boldFont;constructor(){this.colorGeneratorInternal=I.colorGenerator(),this.maxStackDepthInternal=0,this.timelineData_=null,this.entryNodes=[],this.#e=`${n.Font.DEFAULT_FONT_SIZE} ${n.Font.getFontFamilyForCanvas()}`}static colorGenerator(){return y||(y=new o.Color.Generator({min:30,max:330,count:void 0},{min:50,max:80,count:5},{min:80,max:90,count:3}),y.setColorForID("(idle)","hsl(0, 0%, 94%)"),y.setColorForID("(program)","hsl(0, 0%, 80%)"),y.setColorForID("(garbage collector)","hsl(0, 0%, 80%)")),y}minimumBoundary(){throw"Not implemented."}totalTime(){throw"Not implemented."}formatValue(e,i){return t.TimeUtilities.preciseMillisToString(e,i)}maxStackDepth(){return this.maxStackDepthInternal}timelineData(){return this.timelineData_||this.calculateTimelineData()}calculateTimelineData(){throw"Not implemented."}prepareHighlightedEntryInfo(e){throw"Not implemented."}canJumpToEntry(e){return"0"!==this.entryNodes[e].scriptId}entryTitle(e){const t=this.entryNodes[e];return s.UIUtils.beautifyFunctionName(t.functionName)}entryFont(e){const t="bold "+this.#e;return this.entryHasDeoptReason(e)?t:this.#e}entryHasDeoptReason(e){throw"Not implemented."}entryColor(e){const t=this.entryNodes[e];return this.colorGeneratorInternal.colorForID(t.url||("0"!==t.scriptId?t.scriptId:t.functionName))}decorateEntry(e,t,i,r,s,o,n){return!1}forceDecoration(e){return!1}textColor(e){return"#333"}navStartTimes(){return new Map}entryNodesLength(){return this.entryNodes.length}}class R extends(o.ObjectWrapper.eventMixin(s.Widget.VBox)){searchableView;overviewPane;mainPane;entrySelected;dataProvider;searchResults;searchResultIndex=-1;constructor(e,t){super(),this.element.id="cpu-flame-chart",this.searchableView=e,this.overviewPane=new N(t),this.overviewPane.show(this.element),this.mainPane=new n.FlameChart.FlameChart(t,this.overviewPane),this.mainPane.setBarHeight(15),this.mainPane.setTextBaseline(4),this.mainPane.setTextPadding(2),this.mainPane.show(this.element),this.mainPane.addEventListener(n.FlameChart.Events.EntrySelected,this.onEntrySelected,this),this.mainPane.addEventListener(n.FlameChart.Events.EntryInvoked,this.onEntryInvoked,this),this.entrySelected=!1,this.mainPane.addEventListener(n.FlameChart.Events.CanvasFocused,this.onEntrySelected,this),this.overviewPane.addEventListener("WindowChanged",this.onWindowChanged,this),this.dataProvider=t,this.searchResults=[]}focus(){this.mainPane.focus()}onWindowChanged(e){const{windowTimeLeft:t,windowTimeRight:i}=e.data;this.mainPane.setWindowTimes(t,i,!0)}selectRange(e,t){this.overviewPane.selectRange(e,t)}onEntrySelected(e){if(e.data){const t=e.data;this.mainPane.setSelectedEntry(t),this.entrySelected=-1!==t}else this.entrySelected||(this.mainPane.setSelectedEntry(0),this.entrySelected=!0)}onEntryInvoked(e){this.onEntrySelected(e),this.dispatchEventToListeners(n.FlameChart.Events.EntryInvoked,e.data)}update(){this.overviewPane.update(),this.mainPane.update()}performSearch(t,i,r){const s=e.StringUtilities.createPlainTextSearchRegex(t.query,t.caseSensitive?"":"i"),o=-1!==this.searchResultIndex?this.searchResults[this.searchResultIndex]:-1;this.searchResults=[];const n=this.dataProvider.entryNodesLength();for(let e=0;e<n;++e)this.dataProvider.entryTitle(e).match(s)&&this.searchResults.push(e);this.searchResults.length?(this.searchResultIndex=this.searchResults.indexOf(o),-1===this.searchResultIndex&&(this.searchResultIndex=r?this.searchResults.length-1:0),this.mainPane.setSelectedEntry(this.searchResults[this.searchResultIndex])):this.onSearchCanceled(),this.searchableView.updateSearchMatchesCount(this.searchResults.length),this.searchableView.updateCurrentMatchIndex(this.searchResultIndex)}onSearchCanceled(){this.mainPane.setSelectedEntry(-1),this.searchResults=[],this.searchResultIndex=-1}jumpToNextSearchResult(){this.searchResultIndex=(this.searchResultIndex+1)%this.searchResults.length,this.mainPane.setSelectedEntry(this.searchResults[this.searchResultIndex]),this.searchableView.updateCurrentMatchIndex(this.searchResultIndex)}jumpToPreviousSearchResult(){this.searchResultIndex=(this.searchResultIndex-1+this.searchResults.length)%this.searchResults.length,this.mainPane.setSelectedEntry(this.searchResults[this.searchResultIndex]),this.searchableView.updateCurrentMatchIndex(this.searchResultIndex)}supportsCaseSensitiveSearch(){return!0}supportsRegexSearch(){return!1}}class E{formatter;minimumBoundaries;maximumBoundaries;xScaleFactor;constructor(e){this.formatter=e}updateBoundaries(e){this.minimumBoundaries=e.dataProvider.minimumBoundary();const t=e.dataProvider.totalTime();this.maximumBoundaries=this.minimumBoundaries+t,this.xScaleFactor=e.overviewContainer.clientWidth/t}computePosition(e){return(e-this.minimumBoundaries)*this.xScaleFactor}formatValue(e,t){return this.formatter(e-this.minimumBoundaries,t)}maximumBoundary(){return this.maximumBoundaries}minimumBoundary(){return this.minimumBoundaries}zeroTime(){return this.minimumBoundaries}boundarySpan(){return this.maximumBoundaries-this.minimumBoundaries}}class N extends(o.ObjectWrapper.eventMixin(s.Widget.VBox)){overviewContainer;overviewCalculator;overviewGrid;overviewCanvas;dataProvider;windowTimeLeft;windowTimeRight;updateTimerId;constructor(e){super(),this.element.classList.add("cpu-profile-flame-chart-overview-pane"),this.overviewContainer=this.element.createChild("div","cpu-profile-flame-chart-overview-container"),this.overviewCalculator=new E(e.formatValue),this.overviewGrid=new n.OverviewGrid.OverviewGrid("cpu-profile-flame-chart",this.overviewCalculator),this.overviewGrid.element.classList.add("fill"),this.overviewCanvas=this.overviewContainer.createChild("canvas","cpu-profile-flame-chart-overview-canvas"),this.overviewContainer.appendChild(this.overviewGrid.element),this.dataProvider=e,this.overviewGrid.addEventListener(n.OverviewGrid.Events.WindowChangedWithPosition,this.onWindowChanged,this)}windowChanged(e,t){this.selectRange(e,t)}updateRangeSelection(e,t){}updateSelectedGroup(e,t){}selectRange(e,t){const i=this.dataProvider.minimumBoundary(),r=this.dataProvider.totalTime();this.overviewGrid.setWindow((e-i)/r,(t-i)/r)}onWindowChanged(e){const t={windowTimeLeft:e.data.rawStartValue,windowTimeRight:e.data.rawEndValue};this.windowTimeLeft=t.windowTimeLeft,this.windowTimeRight=t.windowTimeRight,this.dispatchEventToListeners("WindowChanged",t)}timelineData(){return this.dataProvider.timelineData()}onResize(){this.scheduleUpdate()}scheduleUpdate(){this.updateTimerId||(this.updateTimerId=this.element.window().requestAnimationFrame(this.update.bind(this)))}update(){this.updateTimerId=0;this.timelineData()&&(this.resetCanvas(this.overviewContainer.clientWidth,this.overviewContainer.clientHeight-n.FlameChart.HeaderHeight),this.overviewCalculator.updateBoundaries(this),this.overviewGrid.updateDividers(this.overviewCalculator),this.drawOverviewCanvas())}drawOverviewCanvas(){const e=this.overviewCanvas.width,t=this.overviewCanvas.height,i=this.calculateDrawData(e),r=this.overviewCanvas.getContext("2d");if(!r)throw new Error("Failed to get canvas context");const s=window.devicePixelRatio,o=t/(1.1*this.dataProvider.maxStackDepth());r.lineWidth=1,r.translate(.5,.5),r.strokeStyle="rgba(20,0,0,0.4)",r.fillStyle="rgba(214,225,254,0.8)",r.moveTo(-1,t+1),r.lineTo(-1,Math.round(t-i[0]*o-s));let n=0;for(let a=0;a<e;++a)n=Math.round(t-i[a]*o-s),r.lineTo(a,n);r.lineTo(e+1,n),r.lineTo(e+1,t+1),r.fill(),r.stroke(),r.closePath()}calculateDrawData(e){const t=this.dataProvider,i=this.timelineData(),r=i.entryStartTimes,s=i.entryTotalTimes,o=i.entryLevels,n=r.length,a=this.dataProvider.minimumBoundary(),l=new Uint8Array(e),d=e/t.totalTime();for(let e=0;e<n;++e){const t=Math.floor((r[e]-a)*d),i=Math.floor((r[e]-a+s[e])*d);for(let r=t;r<=i;++r)l[r]=Math.max(l[r],o[e]+1)}return l}resetCanvas(e,t){const i=window.devicePixelRatio;this.overviewCanvas.width=e*i,this.overviewCanvas.height=t*i,this.overviewCanvas.style.width=e+"px",this.overviewCanvas.style.height=t+"px"}}var k,D,M=Object.freeze({__proto__:null,ProfileFlameChartDataProvider:I,CPUProfileFlameChart:R,OverviewCalculator:E,OverviewPane:N});class F extends o.ObjectWrapper.ObjectWrapper{profileTypeInternal;title;uid;fromFileInternal;tempFile;constructor(e,t){super(),this.profileTypeInternal=e,this.title=t,this.uid=e.incrementProfileUid(),this.fromFileInternal=!1,this.tempFile=null}setTitle(e){this.title=e,this.dispatchEventToListeners(k.ProfileTitleChanged,this)}profileType(){return this.profileTypeInternal}updateStatus(e,t){this.dispatchEventToListeners(k.UpdateStatus,new H(e,t))}createSidebarTreeElement(e){throw new Error("Not implemented.")}createView(e){throw new Error("Not implemented.")}removeTempFile(){this.tempFile&&this.tempFile.remove()}dispose(){}canSaveToFile(){return!1}saveToFile(){throw new Error("Not implemented.")}loadFromFile(e){throw new Error("Not implemented.")}fromFile(){return this.fromFileInternal}setFromFile(){this.fromFileInternal=!0}setProfile(e){}}class H{subtitle;wait;constructor(e,t){this.subtitle=e,this.wait=t}}!function(e){e.UpdateStatus="UpdateStatus",e.ProfileReceived="ProfileReceived",e.ProfileTitleChanged="ProfileTitleChanged"}(k||(k={}));class L extends o.ObjectWrapper.ObjectWrapper{idInternal;nameInternal;profiles;profileBeingRecordedInternal;nextProfileUidInternal;constructor(e,t){super(),this.idInternal=e,this.nameInternal=t,this.profiles=[],this.profileBeingRecordedInternal=null,this.nextProfileUidInternal=1,window.opener||window.addEventListener("unload",this.clearTempStorage.bind(this),!1)}typeName(){return""}nextProfileUid(){return this.nextProfileUidInternal}incrementProfileUid(){return this.nextProfileUidInternal++}hasTemporaryView(){return!1}fileExtension(){return null}get buttonTooltip(){return""}get id(){return this.idInternal}get treeItemTitle(){return this.nameInternal}get name(){return this.nameInternal}buttonClicked(){return!1}get description(){return""}isInstantProfile(){return!1}isEnabled(){return!0}getProfiles(){return this.profiles.filter(function(e){return this.profileBeingRecordedInternal!==e}.bind(this))}customContent(){return null}setCustomContentEnabled(e){}getProfile(e){for(let t=0;t<this.profiles.length;++t)if(this.profiles[t].uid===e)return this.profiles[t];return null}loadFromFile(e){let t=e.name;const i=this.fileExtension();i&&t.endsWith(i)&&(t=t.substr(0,t.length-i.length));const r=this.createProfileLoadedFromFile(t);return r.setFromFile(),this.setProfileBeingRecorded(r),this.addProfile(r),r.loadFromFile(e)}createProfileLoadedFromFile(e){throw new Error("Not implemented")}addProfile(e){this.profiles.push(e),this.dispatchEventToListeners(D.AddProfileHeader,e)}removeProfile(e){const t=this.profiles.indexOf(e);-1!==t&&(this.profiles.splice(t,1),this.disposeProfile(e))}clearTempStorage(){for(let e=0;e<this.profiles.length;++e)this.profiles[e].removeTempFile()}profileBeingRecorded(){return this.profileBeingRecordedInternal}setProfileBeingRecorded(e){this.profileBeingRecordedInternal=e}profileBeingRecordedRemoved(){}reset(){for(const e of this.profiles.slice())this.disposeProfile(e);this.profiles=[],this.nextProfileUidInternal=1}disposeProfile(e){this.dispatchEventToListeners(D.RemoveProfileHeader,e),e.dispose(),this.profileBeingRecordedInternal===e&&(this.profileBeingRecordedRemoved(),this.setProfileBeingRecorded(null))}}!function(e){e.AddProfileHeader="add-profile-header",e.ProfileComplete="profile-complete",e.RemoveProfileHeader="remove-profile-header",e.ViewUpdated="view-updated"}(D||(D={}));var j=Object.freeze({__proto__:null,ProfileHeader:F,StatusUpdate:H,get Events(){return k},ProfileType:L,get ProfileEvents(){return D}});const O={save:"Save",saveWithEllipsis:"Save…",load:"Load…",delete:"Delete"},z=t.i18n.registerUIStrings("panels/profiler/ProfileSidebarTreeElement.ts",O),B=t.i18n.getLocalizedString.bind(void 0,z);let G=null;function V(){return G}function U(e){G=e}class A extends s.TreeOutline.TreeElement{iconElement;titlesElement;titleContainer;titleElement;subtitleElement;className;small;dataDisplayDelegate;profile;saveLinkElement;editing;constructor(e,t,i){super("",!1),this.iconElement=document.createElement("div"),this.iconElement.classList.add("icon"),this.titlesElement=document.createElement("div"),this.titlesElement.classList.add("titles"),this.titlesElement.classList.add("no-subtitle"),this.titleContainer=this.titlesElement.createChild("span","title-container"),this.titleElement=this.titleContainer.createChild("span","title"),this.subtitleElement=this.titlesElement.createChild("span","subtitle"),this.titleElement.textContent=t.title,this.className=i,this.small=!1,this.dataDisplayDelegate=e,this.profile=t,t.addEventListener(k.UpdateStatus,this.updateStatus,this),t.canSaveToFile()?this.createSaveLink():t.addEventListener(k.ProfileReceived,this.onProfileReceived,this)}createSaveLink(){this.saveLinkElement=this.titleContainer.createChild("span","save-link"),this.saveLinkElement.textContent=B(O.save),this.saveLinkElement.addEventListener("click",this.saveProfile.bind(this),!1)}onProfileReceived(){this.createSaveLink()}updateStatus(e){const t=e.data;null!==t.subtitle&&(this.subtitleElement.textContent=t.subtitle||"",this.titlesElement.classList.toggle("no-subtitle",!t.subtitle)),"boolean"==typeof t.wait&&this.listItemElement&&(this.iconElement.classList.toggle("spinner",t.wait),this.listItemElement.classList.toggle("wait",t.wait))}ondblclick(e){return this.editing||this.startEditing(e.target),!1}startEditing(e){const t=e.enclosingNodeOrSelfWithClass("title");if(!t)return;const i=new s.InplaceEditor.Config(this.editingCommitted.bind(this),this.editingCancelled.bind(this));this.editing=s.InplaceEditor.InplaceEditor.startEditing(t,i)}editingCommitted(e,t){delete this.editing,this.profile.setTitle(t)}editingCancelled(){delete this.editing}dispose(){this.profile.removeEventListener(k.UpdateStatus,this.updateStatus,this),this.profile.removeEventListener(k.ProfileReceived,this.onProfileReceived,this)}onselect(){return this.dataDisplayDelegate.showProfile(this.profile),!0}ondelete(){return this.profile.profileType().removeProfile(this.profile),!0}onattach(){this.className&&this.listItemElement.classList.add(this.className),this.small&&this.listItemElement.classList.add("small"),this.listItemElement.append(this.iconElement,this.titlesElement),this.listItemElement.addEventListener("contextmenu",this.handleContextMenuEvent.bind(this),!0),s.ARIAUtils.setDescription(this.listItemElement,this.profile.profileType().name)}handleContextMenuEvent(e){const t=this.profile,i=new s.ContextMenu.ContextMenu(e),r=V();if(!r)throw new Error("File selector element shared by ProfilePanel instances is missing");i.headerSection().appendItem(B(O.load),r.click.bind(r)),t.canSaveToFile()&&i.saveSection().appendItem(B(O.saveWithEllipsis),t.saveToFile.bind(t)),i.footerSection().appendItem(B(O.delete),this.ondelete.bind(this)),i.show()}saveProfile(e){this.profile.saveToFile()}setSmall(e){this.small=e,this.listItemElement&&this.listItemElement.classList.toggle("small",this.small)}setMainTitle(e){this.titleElement.textContent=e}}var W=Object.freeze({__proto__:null,setSharedFileSelectorElement:U,ProfileSidebarTreeElement:A});class _ extends w{remainingChildren;constructor(e,t){super(e,t,Boolean(e.children&&e.children.length)),this.remainingChildren=e.children}static sharedPopulate(e){const t=e.remainingChildren,i=t.length;for(let r=0;r<i;++r)e.appendChild(new _(t[r],e.tree));e.remainingChildren=[]}static excludeRecursively(e,t){e.remainingChildren.length>0&&e.populate(),e.save();const i=e.children;let r=e.children.length;for(;r--;)_.excludeRecursively(i[r],t);const s=e.childrenByCallUID.get(t);s&&w.merge(e,s,!0)}populateChildren(){_.sharedPopulate(this)}}class J extends S{remainingChildren;constructor(e,t,i,r){super(e,t,r),this.remainingChildren=i.children,w.populate(this)}focus(e){e&&(this.save(),e.savePosition(),this.children=[e],this.total=e.total)}exclude(e){e&&(this.save(),_.excludeRecursively(this,e.callUID),this.lastComparator&&this.sort(this.lastComparator,!0))}restore(){this.savedChildren&&(this.children[0].restorePosition(),super.restore())}populateChildren(){_.sharedPopulate(this)}}var $=Object.freeze({__proto__:null,TopDownProfileDataGridNode:_,TopDownProfileDataGridTree:J});const q={profile:"Profile",findByCostMsNameOrFile:"Find by cost (>50ms), name or file",function:"Function",profiler:"Profiler",profileViewMode:"Profile view mode",focusSelectedFunction:"Focus selected function",excludeSelectedFunction:"Exclude selected function",restoreAllFunctions:"Restore all functions",chart:"Chart",heavyBottomUp:"Heavy (Bottom Up)",treeTopDown:"Tree (Top Down)",profileD:"Profile {PH1}",loadingD:"Loading… {PH1}%",fileSReadErrorS:"File ''{PH1}'' read error: {PH2}",loading:"Loading…",failedToReadFile:"Failed to read file",parsing:"Parsing…",loaded:"Loaded"},Q=t.i18n.registerUIStrings("panels/profiler/ProfileView.ts",q),K=t.i18n.getLocalizedString.bind(void 0,Q);class Y extends s.View.SimpleView{profileInternal;searchableViewInternal;dataGrid;viewSelectComboBox;focusButton;excludeButton;resetButton;linkifierInternal;nodeFormatter;viewType;adjustedTotal;profileHeader;bottomUpProfileDataGridTree;topDownProfileDataGridTree;currentSearchResultIndex;dataProvider;flameChart;visibleView;searchableElement;profileDataGridTree;constructor(){super(K(q.profile)),this.profileInternal=null,this.searchableViewInternal=new s.SearchableView.SearchableView(this,null),this.searchableViewInternal.setPlaceholder(K(q.findByCostMsNameOrFile)),this.searchableViewInternal.show(this.element);const e=[];e.push({id:"self",title:this.columnHeader("self"),width:"120px",fixedWidth:!0,sortable:!0,sort:r.DataGrid.Order.Descending,titleDOMFragment:void 0,align:void 0,editable:void 0,nonSelectable:void 0,longText:void 0,disclosure:void 0,weight:void 0,allowInSortByEvenWhenHidden:void 0,dataType:void 0,defaultWeight:void 0}),e.push({id:"total",title:this.columnHeader("total"),width:"120px",fixedWidth:!0,sortable:!0,sort:void 0,titleDOMFragment:void 0,align:void 0,editable:void 0,nonSelectable:void 0,longText:void 0,disclosure:void 0,weight:void 0,allowInSortByEvenWhenHidden:void 0,dataType:void 0,defaultWeight:void 0}),e.push({id:"function",title:K(q.function),disclosure:!0,sortable:!0,sort:void 0,titleDOMFragment:void 0,align:void 0,editable:void 0,nonSelectable:void 0,longText:void 0,weight:void 0,allowInSortByEvenWhenHidden:void 0,dataType:void 0,defaultWeight:void 0,width:void 0,fixedWidth:void 0}),this.dataGrid=new r.DataGrid.DataGridImpl({displayName:K(q.profiler),columns:e,editCallback:void 0,deleteCallback:void 0,refreshCallback:void 0}),this.dataGrid.addEventListener(r.DataGrid.Events.SortingChanged,this.sortProfile,this),this.dataGrid.addEventListener(r.DataGrid.Events.SelectedNode,this.nodeSelected.bind(this,!0)),this.dataGrid.addEventListener(r.DataGrid.Events.DeselectedNode,this.nodeSelected.bind(this,!1)),this.dataGrid.setRowContextMenuCallback(this.populateContextMenu.bind(this)),this.viewSelectComboBox=new s.Toolbar.ToolbarComboBox(this.changeView.bind(this),K(q.profileViewMode)),this.focusButton=new s.Toolbar.ToolbarButton(K(q.focusSelectedFunction),"eye"),this.focusButton.setEnabled(!1),this.focusButton.addEventListener(s.Toolbar.ToolbarButton.Events.Click,this.focusClicked,this),this.excludeButton=new s.Toolbar.ToolbarButton(K(q.excludeSelectedFunction),"cross"),this.excludeButton.setEnabled(!1),this.excludeButton.addEventListener(s.Toolbar.ToolbarButton.Events.Click,this.excludeClicked,this),this.resetButton=new s.Toolbar.ToolbarButton(K(q.restoreAllFunctions),"refresh"),this.resetButton.setEnabled(!1),this.resetButton.addEventListener(s.Toolbar.ToolbarButton.Events.Click,this.resetClicked,this),this.linkifierInternal=new d.Linkifier.Linkifier(Z)}static buildPopoverTable(e){const t=document.createElement("table");for(const i of e){const e=t.createChild("tr");e.createChild("td").textContent=i.title,e.createChild("td").textContent=i.value}return t}setProfile(e){this.profileInternal=e,this.bottomUpProfileDataGridTree=null,this.topDownProfileDataGridTree=null,this.changeView(),this.refresh()}profile(){return this.profileInternal}initialize(e){this.nodeFormatter=e,this.viewType=o.Settings.Settings.instance().createSetting("profileView","Heavy");const t=["Flame","Heavy","Tree"],i=new Map([["Flame",K(q.chart)],["Heavy",K(q.heavyBottomUp)],["Tree",K(q.treeTopDown)]]),r=new Map(t.map((e=>[e,this.viewSelectComboBox.createOption(i.get(e),e)]))),s=this.viewType.get()||t[0],n=r.get(s)||r.get(t[0]);this.viewSelectComboBox.select(n),this.changeView(),this.flameChart&&this.flameChart.update()}focus(){this.flameChart?this.flameChart.focus():super.focus()}columnHeader(e){throw"Not implemented"}selectRange(e,t){this.flameChart&&this.flameChart.selectRange(e,t)}async toolbarItems(){return[this.viewSelectComboBox,this.focusButton,this.excludeButton,this.resetButton]}getBottomUpProfileDataGridTree(){return this.bottomUpProfileDataGridTree||(this.bottomUpProfileDataGridTree=new P(this.nodeFormatter,this.searchableViewInternal,this.profileInternal.root,this.adjustedTotal)),this.bottomUpProfileDataGridTree}getTopDownProfileDataGridTree(){return this.topDownProfileDataGridTree||(this.topDownProfileDataGridTree=new J(this.nodeFormatter,this.searchableViewInternal,this.profileInternal.root,this.adjustedTotal)),this.topDownProfileDataGridTree}populateContextMenu(e,t){const i=t;i.linkElement&&!e.containsTarget(i.linkElement)&&e.appendApplicableItems(i.linkElement)}willHide(){this.currentSearchResultIndex=-1}refresh(){if(!this.profileDataGridTree)return;const e=this.dataGrid.selectedNode?this.dataGrid.selectedNode.profileNode:null;this.dataGrid.rootNode().removeChildren();const t=this.profileDataGridTree.children,i=t.length;for(let e=0;e<i;++e)this.dataGrid.rootNode().appendChild(t[e]);e&&(e.selected=!0)}refreshVisibleData(){let e=this.dataGrid.rootNode().children[0];for(;e;)e.refresh(),e=e.traverseNextNode(!1,null,!0)}searchableView(){return this.searchableViewInternal}supportsCaseSensitiveSearch(){return!0}supportsRegexSearch(){return!1}onSearchCanceled(){this.searchableElement&&this.searchableElement.onSearchCanceled()}performSearch(e,t,i){this.searchableElement&&this.searchableElement.performSearch(e,t,i)}jumpToNextSearchResult(){this.searchableElement&&this.searchableElement.jumpToNextSearchResult()}jumpToPreviousSearchResult(){this.searchableElement&&this.searchableElement.jumpToPreviousSearchResult()}linkifier(){return this.linkifierInternal}createFlameChartDataProvider(){throw"Not implemented"}ensureFlameChartCreated(){this.flameChart||(this.dataProvider=this.createFlameChartDataProvider(),this.flameChart=new R(this.searchableViewInternal,this.dataProvider),this.flameChart.addEventListener(n.FlameChart.Events.EntryInvoked,(e=>{this.onEntryInvoked(e)})))}async onEntryInvoked(e){if(!this.dataProvider)return;const t=e.data,i=this.dataProvider.entryNodes[t],r=this.profileHeader.debuggerModel;if(!i||!i.scriptId||!r)return;const s=r.scriptForId(i.scriptId);if(!s)return;const n=r.createRawLocation(s,i.lineNumber,i.columnNumber),a=await h.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance().rawLocationToUILocation(n);o.Revealer.reveal(a)}changeView(){if(!this.profileInternal)return;switch(this.searchableViewInternal.closeSearch(),this.visibleView&&this.visibleView.detach(),this.viewType.set(this.viewSelectComboBox.selectedOption().value),this.viewType.get()){case"Flame":this.ensureFlameChartCreated(),this.visibleView=this.flameChart,this.searchableElement=this.flameChart;break;case"Tree":this.profileDataGridTree=this.getTopDownProfileDataGridTree(),this.sortProfile(),this.visibleView=this.dataGrid.asWidget(),this.searchableElement=this.profileDataGridTree;break;case"Heavy":this.profileDataGridTree=this.getBottomUpProfileDataGridTree(),this.sortProfile(),this.visibleView=this.dataGrid.asWidget(),this.searchableElement=this.profileDataGridTree}const e="Flame"===this.viewType.get();this.focusButton.setVisible(!e),this.excludeButton.setVisible(!e),this.resetButton.setVisible(!e),this.visibleView&&this.visibleView.show(this.searchableViewInternal.element)}nodeSelected(e){this.focusButton.setEnabled(e),this.excludeButton.setEnabled(e)}focusClicked(){this.dataGrid.selectedNode&&(this.resetButton.setEnabled(!0),this.resetButton.element.focus(),this.profileDataGridTree&&this.profileDataGridTree.focus(this.dataGrid.selectedNode),this.refresh(),this.refreshVisibleData(),a.userMetrics.actionTaken(a.UserMetrics.Action.CpuProfileNodeFocused))}excludeClicked(){const e=this.dataGrid.selectedNode;e&&(this.resetButton.setEnabled(!0),this.resetButton.element.focus(),e.deselect(),this.profileDataGridTree&&this.profileDataGridTree.exclude(e),this.refresh(),this.refreshVisibleData(),a.userMetrics.actionTaken(a.UserMetrics.Action.CpuProfileNodeExcluded))}resetClicked(){this.viewSelectComboBox.selectElement().focus(),this.resetButton.setEnabled(!1),this.profileDataGridTree&&this.profileDataGridTree.restore(),this.linkifierInternal.reset(),this.refresh(),this.refreshVisibleData()}sortProfile(){if(!this.profileDataGridTree)return;const e=this.dataGrid.isSortOrderAscending(),t=this.dataGrid.sortColumnId(),i="function"===t?"functionName":t||"";this.profileDataGridTree.sort(S.propertyComparator(i,e),!1),this.refresh()}}const Z=30;class X extends F{debuggerModel;fileName;jsonifiedProfile;profile;protocolProfileInternal;constructor(e,t,i){super(t,i||K(q.profileD,{PH1:t.nextProfileUid()})),this.debuggerModel=e}onChunkTransferred(t){this.jsonifiedProfile&&this.updateStatus(K(q.loadingD,{PH1:e.NumberUtilities.bytesToString(this.jsonifiedProfile.length)}))}onError(e){const t=e.error();t&&this.updateStatus(K(q.fileSReadErrorS,{PH1:e.fileName(),PH2:t.message}))}async write(e){this.jsonifiedProfile+=e}async close(){}dispose(){this.removeTempFile()}createSidebarTreeElement(e){return new A(e,this,"profile-sidebar-tree-item")}canSaveToFile(){return!this.fromFile()&&Boolean(this.protocolProfileInternal)}async saveToFile(){const t=new h.FileUtils.FileOutputStream;if(!this.fileName){const t=e.DateUtilities.toISO8601Compact(new Date),i=this.profileType().fileExtension();this.fileName=`${this.profileType().typeName()}-${t}${i}`}if(!await t.open(this.fileName)||!this.tempFile)return;const i=await this.tempFile.read();i&&await t.write(i),t.close()}async loadFromFile(e){this.updateStatus(K(q.loading),!0);const t=new h.FileUtils.ChunkedFileReader(e,1e7,this.onChunkTransferred.bind(this));this.jsonifiedProfile="";if(!await t.read(this))return this.onError(t),new Error(K(q.failedToReadFile));this.updateStatus(K(q.parsing),!0);let i=null;try{this.profile=JSON.parse(this.jsonifiedProfile),this.setProfile(this.profile),this.updateStatus(K(q.loaded),!1)}catch(e){i=e,this.profileType().removeProfile(this)}return this.jsonifiedProfile=null,this.profileType().profileBeingRecorded()===this&&this.profileType().setProfileBeingRecorded(null),i}setProtocolProfile(e){this.setProfile(e),this.protocolProfileInternal=e,this.tempFile=new h.TempFile.TempFile,this.tempFile.write([JSON.stringify(e)]),this.canSaveToFile()&&this.dispatchEventToListeners(k.ProfileReceived)}}var ee=Object.freeze({__proto__:null,ProfileView:Y,maxLinkLength:Z,WritableProfileHeader:X});const te={selfTime:"Self Time",totalTime:"Total Time",recordJavascriptCpuProfile:"Record JavaScript CPU Profile",stopCpuProfiling:"Stop CPU profiling",startCpuProfiling:"Start CPU profiling",cpuProfiles:"CPU PROFILES",cpuProfilesShow:"CPU profiles show where the execution time is spent in your page's JavaScript functions.",recording:"Recording…",fms:"{PH1} ms",formatPercent:"{PH1} %",name:"Name",url:"URL",aggregatedSelfTime:"Aggregated self time",aggregatedTotalTime:"Aggregated total time",notOptimized:"Not optimized"},ie=t.i18n.registerUIStrings("panels/profiler/CPUProfileView.ts",te),re=t.i18n.getLocalizedString.bind(void 0,ie);class se extends Y{profileHeader;adjustedTotal;constructor(e){super(),this.profileHeader=e,this.initialize(new ae(this));const t=e.profileModel();this.adjustedTotal=t.profileHead.total,this.adjustedTotal-=t.idleNode?t.idleNode.total:0,this.setProfile(t)}wasShown(){super.wasShown(),n.LineLevelProfile.Performance.instance().reset(),n.LineLevelProfile.Performance.instance().appendCPUProfile(this.profileHeader.profileModel())}columnHeader(e){switch(e){case"self":return re(te.selfTime);case"total":return re(te.totalTime)}return o.UIString.LocalizedEmptyString}createFlameChartDataProvider(){return new le(this.profileHeader.profileModel(),this.profileHeader.cpuProfilerModel)}}class oe extends L{recording;constructor(){super(oe.TypeId,re(te.recordJavascriptCpuProfile)),this.recording=!1;const e=l.TargetManager.TargetManager.instance().models(l.CPUProfilerModel.CPUProfilerModel);for(const t of e)for(const e of t.registeredConsoleProfileMessages)this.consoleProfileFinished(e);l.TargetManager.TargetManager.instance().addModelListener(l.CPUProfilerModel.CPUProfilerModel,l.CPUProfilerModel.Events.ConsoleProfileFinished,(e=>this.consoleProfileFinished(e.data)),this)}profileBeingRecorded(){return super.profileBeingRecorded()}typeName(){return"CPU"}fileExtension(){return".cpuprofile"}get buttonTooltip(){return this.recording?re(te.stopCpuProfiling):re(te.startCpuProfiling)}buttonClicked(){return this.recording?(this.stopRecordingProfile(),!1):(this.startRecordingProfile(),!0)}get treeItemTitle(){return re(te.cpuProfiles)}get description(){return re(te.cpuProfilesShow)}consoleProfileFinished(e){const t=new ne(e.cpuProfilerModel,this,e.title);t.setProtocolProfile(e.cpuProfile),this.addProfile(t)}startRecordingProfile(){const e=s.Context.Context.instance().flavor(l.CPUProfilerModel.CPUProfilerModel);if(this.profileBeingRecorded()||!e)return;const t=new ne(e,this);this.setProfileBeingRecorded(t),l.TargetManager.TargetManager.instance().suspendAllTargets(),this.addProfile(t),t.updateStatus(re(te.recording)),this.recording=!0,e.startRecording(),a.userMetrics.actionTaken(a.UserMetrics.Action.ProfilesCPUProfileTaken)}async stopRecordingProfile(){this.recording=!1;const e=this.profileBeingRecorded();if(!e||!e.cpuProfilerModel)return;const t=await e.cpuProfilerModel.stopRecording(),i=this.profileBeingRecorded();if(i){if(!t)throw new Error("Expected profile to be non-null");i.setProtocolProfile(t),i.updateStatus(""),this.setProfileBeingRecorded(null)}await l.TargetManager.TargetManager.instance().resumeAllTargets(),this.dispatchEventToListeners(D.ProfileComplete,i)}createProfileLoadedFromFile(e){return new ne(null,this,e)}profileBeingRecordedRemoved(){this.stopRecordingProfile()}static TypeId="CPU"}class ne extends X{cpuProfilerModel;profileModelInternal;constructor(e,t,i){super(e&&e.debuggerModel(),t,i),this.cpuProfilerModel=e}createView(){return new se(this)}protocolProfile(){if(!this.protocolProfile())throw new Error("Expected _protocolProfile to be available");return this.protocolProfile()}profileModel(){if(!this.profileModelInternal)throw new Error("Expected _profileModel to be available");return this.profileModelInternal}setProfile(e){const t=this.cpuProfilerModel&&this.cpuProfilerModel.target()||null;this.profileModelInternal=new l.CPUProfileDataModel.CPUProfileDataModel(e,t)}}class ae{profileView;constructor(e){this.profileView=e}formatValue(e){return re(te.fms,{PH1:e.toFixed(1)})}formatValueAccessibleText(e){return this.formatValue(e)}formatPercent(e,t){if(this.profileView){const i=this.profileView.profile();if(i&&t.profileNode!==i.idleNode)return re(te.formatPercent,{PH1:e.toFixed(2)})}return""}linkifyNode(e){const t=this.profileView.profileHeader.cpuProfilerModel,i=t?t.target():null;return this.profileView.linkifier().maybeLinkifyConsoleCallFrame(i,e.profileNode.callFrame,{className:"profile-node-file",inlineFrameIndex:0})}}class le extends I{cpuProfile;cpuProfilerModel;entrySelfTimes;constructor(e,t){super(),this.cpuProfile=e,this.cpuProfilerModel=t}minimumBoundary(){return this.cpuProfile.profileStartTime}totalTime(){return this.cpuProfile.profileHead.total}entryHasDeoptReason(e){const t=this.entryNodes[e];return Boolean(t.deoptReason)}calculateTimelineData(){const e=[],t=[];let i=5;this.cpuProfile.forEachFrame((function(){t.push(e.length),e.push(null)}),(function(r,s,o,n,a){const l=t.pop();e[l]=new le.ChartEntry(r,n,o,a,s),i=Math.max(i,r)}));const r=new Array(e.length),s=new Uint16Array(e.length),o=new Float32Array(e.length),a=new Float32Array(e.length),l=new Float64Array(e.length);for(let t=0;t<e.length;++t){const i=e[t];i&&(r[t]=i.node,s[t]=i.depth,o[t]=i.duration,l[t]=i.startTime,a[t]=i.selfTime)}return this.maxStackDepthInternal=i+1,this.entryNodes=r,this.timelineData_=n.FlameChart.FlameChartTimelineData.create({entryLevels:s,entryTotalTimes:o,entryStartTimes:l,groups:null}),this.entrySelfTimes=a,this.timelineData_}prepareHighlightedEntryInfo(e){const i=this.timelineData_,r=this.entryNodes[e];if(!r)return null;const o=[];function n(e,t){o.push({title:e,value:t})}function a(e){return 0===e?"0":e<1e3?re(te.fms,{PH1:e.toFixed(1)}):t.TimeUtilities.secondsToString(e/1e3,!0)}const l=s.UIUtils.beautifyFunctionName(r.functionName);n(re(te.name),l);const h=a(this.entrySelfTimes[e]),c=a(i.entryTotalTimes[e]);n(re(te.selfTime),h),n(re(te.totalTime),c);const p=new d.Linkifier.Linkifier,u=p.maybeLinkifyConsoleCallFrame(this.cpuProfilerModel&&this.cpuProfilerModel.target(),r.callFrame);u&&n(re(te.url),u.textContent||""),p.dispose(),n(re(te.aggregatedSelfTime),t.TimeUtilities.secondsToString(r.self/1e3,!0)),n(re(te.aggregatedTotalTime),t.TimeUtilities.secondsToString(r.total/1e3,!0));const m=r.deoptReason;return m&&n(re(te.notOptimized),m),Y.buildPopoverTable(o)}}!function(e){e.ChartEntry=class{depth;duration;startTime;selfTime;node;constructor(e,t,i,r,s){this.depth=e,this.duration=t,this.startTime=i,this.selfTime=r,this.node=s}}}(le||(le={}));var de=Object.freeze({__proto__:null,CPUProfileView:se,CPUProfileType:oe,CPUProfileHeader:ne,NodeFormatter:ae,get CPUFlameChartDataProvider(){return le}});const he=new CSSStyleSheet;he.replaceSync(".value.object-value-node:hover{background-color:var(--item-hover-color)}.object-value-function-prefix,\n.object-value-boolean{color:var(--color-syntax-3)}.object-value-function{font-style:italic}.object-value-function.linkified:hover{--override-linkified-hover-background:rgb(0 0 0/10%);background-color:var(--override-linkified-hover-background);cursor:pointer}.-theme-with-dark-background .object-value-function.linkified:hover,\n:host-context(.-theme-with-dark-background) .object-value-function.linkified:hover{--override-linkified-hover-background:rgb(230 230 230/10%)}.object-value-number{color:var(--color-syntax-3)}.object-value-bigint{color:var(--color-syntax-6)}.object-value-string,\n.object-value-regexp,\n.object-value-symbol{white-space:pre;unicode-bidi:-webkit-isolate;color:var(--color-syntax-1)}.object-value-node{position:relative;vertical-align:baseline;color:var(--color-syntax-7);white-space:nowrap}.object-value-null,\n.object-value-undefined{color:var(--color-text-disabled)}.object-value-unavailable{color:var(--color-syntax-2)}.object-value-calculate-value-button:hover{text-decoration:underline}.object-properties-section-custom-section{display:inline-flex;flex-direction:column}.-theme-with-dark-background .object-value-number,\n:host-context(.-theme-with-dark-background) .object-value-number,\n.-theme-with-dark-background .object-value-boolean,\n:host-context(.-theme-with-dark-background) .object-value-boolean{--override-primitive-dark-mode-color:hsl(252deg 100% 75%);color:var(--override-primitive-dark-mode-color)}.object-properties-section .object-description{color:var(--color-text-secondary)}.value .object-properties-preview{white-space:nowrap}.name{color:var(--color-syntax-2);flex-shrink:0}.object-properties-preview .name{color:var(--color-text-secondary)}@media (forced-colors: active){.object-value-calculate-value-button:hover{forced-color-adjust:none;color:Highlight}}\n/*# sourceURL=objectValue.css */\n");const ce=new CSSStyleSheet;ce.replaceSync('.heap-snapshot-view{overflow:hidden}.heap-snapshot-view .data-grid{border:none;flex:auto}.heap-snapshot-view .data-grid tr:empty{height:16px;visibility:hidden}.heap-snapshot-view .data-grid span.percent-column{width:35px!important}.heap-snapshot-view .object-value-object,\n.object-value-node{display:inline;position:static}.heap-snapshot-view .object-value-string{white-space:nowrap}.heap-snapshot-view td.object-column .objects-count{margin-left:10px;font-size:11px;color:var(--color-text-secondary)}.heap-snapshot-view tr:not(.selected) .object-value-id{color:var(--color-text-secondary)}.profile-view .heap-tracking-overview{flex:0 0 80px;height:80px}.heap-snapshot-view .retaining-paths-view{overflow:hidden}.heap-snapshot-view .heap-snapshot-view-resizer{background-color:var(--color-background-elevation-1);border-bottom:1px solid var(--color-details-hairline);display:flex;flex:0 0 21px}.heap-snapshot-view td.object-column > div > span{margin-right:6px}.heap-snapshot-view .heap-snapshot-view-resizer .title{flex:0 1 auto;overflow:hidden;white-space:nowrap}.heap-snapshot-view .heap-snapshot-view-resizer .verticalResizerIcon{background-image:var(--image-file-toolbarResizerVertical);background-repeat:no-repeat;background-position:center;flex:0 0 28px;margin-left:auto}.heap-snapshot-view .heap-snapshot-view-resizer .title > span{display:inline-block;padding-top:3px;vertical-align:middle;margin-left:4px;margin-right:8px}.heap-snapshot-view .heap-snapshot-view-resizer *{pointer-events:none}.heap-snapshot-view tr:not(.selected) td.object-column span.highlight{background-color:inherit}.heap-snapshot-view td.object-column span.heap-object-source-link{float:right}.heap-snapshot-view td.object-column span.heap-object-source-link:empty{animation:fadeInOut 2s infinite}.heap-snapshot-view td.object-column span.heap-object-source-link:empty::before{content:"\\b7\\b7";font-weight:bold}@keyframes fadeInOut{0%{transform:rotate(0)}50%{transform:rotate(0.5turn)}100%{transform:rotate(1turn)}}.heap-snapshot-view tr:not(.selected) td.object-column span.heap-object-tag,\n.heap-snapshot-view tr:not(.selected) td.object-column span.grayed{color:var(--color-text-secondary)}.heap-snapshot-view tr:not(.selected) .cycled-ancessor-node{opacity:60%}#heap-recording-view .profile-view{top:80px}.heap-overview-container{overflow:hidden;position:absolute;top:0;width:100%;height:80px}#heap-recording-overview-grid .resources-dividers-label-bar{pointer-events:auto}.heap-recording-overview-canvas{position:absolute;top:20px;left:0;right:0;bottom:0}.heap-snapshot-statistics-view{overflow:auto}.heap-snapshot-stats-pie-chart{margin:12px 30px;flex-shrink:0}.heap-allocation-stack .stack-frame{display:flex;justify-content:space-between;border-bottom:1px solid var(--color-details-hairline);padding:2px}.heap-allocation-stack .stack-frame:focus{background-color:var(--legacy-selection-bg-color);color:var(--legacy-selection-fg-color)}.heap-allocation-stack .stack-frame:focus:hover{background-color:var(--legacy-accent-color-hover)}.heap-allocation-stack .stack-frame:hover:not(:focus){background-color:var(--color-background-hover-overlay)}.heap-allocation-stack .stack-frame .devtools-link{color:var(--color-text-secondary)}.heap-allocation-stack .stack-frame:focus .devtools-link{color:var(--legacy-selection-fg-color)}.no-heap-allocation-stack{padding:5px}@media (forced-colors: active){.cycled-ancessor-node{opacity:100%}.heap-snapshot-view td.object-column .objects-count,\n .heap-snapshot-view tr:not(.selected) td.object-column span.heap-object-tag,\n .heap-snapshot-view tr:not(.selected) .object-value-id{color:ButtonText}}\n/*# sourceURL=heapProfiler.css */\n');const pe=new CSSStyleSheet;pe.replaceSync("#profile-views{flex:auto;position:relative}.profile-view .data-grid table.data{background:var(--color-background)}.profile-view .data-grid tr:not(.selected) .highlight{background-color:var(--color-selection-highlight)}.profile-view .data-grid tr:hover td:not(.bottom-filler-td){background-color:var(--color-background-hover-overlay)}.profile-view .data-grid td.numeric-column{text-align:right}.profile-view .data-grid div.profile-multiple-values{float:right}.profile-view .data-grid span.percent-column{color:var(--color-text-secondary);width:9ex;display:inline-block}.profile-view .data-grid tr.selected span{color:inherit}.profiles-toolbar{background-color:var(--color-background-elevation-1);border-bottom:1px solid var(--color-details-hairline);flex-shrink:0}.profiles-tree-sidebar{flex:auto;overflow:hidden}.profiles-sidebar-tree-box{overflow-y:auto}.profile-view{display:flex;overflow:hidden}.profile-view .data-grid{border:none;flex:auto}.profile-view .data-grid th.self-column,\n.profile-view .data-grid th.total-column{text-align:center}.profile-node-file{float:right;color:var(--color-text-secondary)}.profile-warn-marker{vertical-align:-1px;margin-right:2px}.cpu-profile-flame-chart-overview-container{overflow:hidden;position:absolute;top:0;width:100%;height:80px}#cpu-profile-flame-chart-overview-container{border-bottom:1px solid var(--color-details-hairline);overflow:hidden}.cpu-profile-flame-chart-overview-canvas{position:absolute;top:20px;left:0;right:0;bottom:0}#cpu-profile-flame-chart-overview-grid .resources-dividers-label-bar{pointer-events:auto}.cpu-profile-flame-chart-overview-pane{flex:0 0 80px!important}.profile-text-view{padding:10px;overflow:auto;margin:0;user-select:text;cursor:text}.empty-landing-page{position:absolute;background-color:var(--color-background);justify-content:center;align-items:center;overflow:auto;font-size:16px;color:var(--color-text-secondary);padding:50px}button{cursor:pointer}@media (forced-colors: active){.profile-view .data-grid tr:hover td:not(.bottom-filler-td){background:Highlight}.profile-view .data-grid table.data{background:transparent}}\n/*# sourceURL=profilesPanel.css */\n");const ue=new CSSStyleSheet;ue.replaceSync(':host{padding:0}ol.tree-outline{overflow:auto;flex:auto;padding:0;margin:0}.tree-outline li{height:36px;padding-right:5px;margin-top:1px;line-height:34px;border-top:1px solid transparent}.tree-outline li:not(.parent)::before{display:none}:host-context(.some-expandable) .tree-outline li:not(.parent){margin-left:10px}.tree-outline li.profiles-tree-section{height:18px;padding:0 10px;white-space:nowrap;margin-top:1px;color:var(--color-text-secondary);text-shadow:var(--color-background-opacity-80) 0 1px 0;line-height:18px}.tree-outline li.profiles-tree-section::before{display:none}.tree-outline ol{overflow:hidden}.title-container > .save-link{text-decoration:underline;margin-left:auto;display:none}li.selected .title-container > .save-link{display:block;cursor:pointer}li .icon{width:20px;height:20px;margin-top:1px;margin-right:3px;flex:none}.tree-outline > .icon{margin-left:16px}li.wait .spinner::before{--dimension:20px;margin:0}li.wait.small .spinner::before{--dimension:14px;--clip-size:9px;--override-spinner-size:2px;margin:1px}li.wait.selected .spinner::before{--override-spinner-color:#fff}@keyframes spinner-animation{from{transform:rotate(0)}to{transform:rotate(360deg)}}li.small{height:20px}li .titles{display:flex;flex-direction:column;top:5px;line-height:12px;padding-bottom:1px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;flex:auto}li .titles > .title-container{display:flex}li.small .titles{top:2px;line-height:normal}li:not(.small) .title::after{content:"\\A";white-space:pre}li .subtitle{font-size:80%}li.small .subtitle{display:none}.profile-launcher-view-tree-item{margin-left:0!important}.profile-launcher-view-tree-item > .icon{width:8px!important;visibility:hidden}.heap-snapshot-sidebar-tree-item .icon,\n.profile-sidebar-tree-item .icon{-webkit-mask-image:var(--image-file-heap-snapshot);background:var(--icon-default)}.profile-group-sidebar-tree-item .icon{-webkit-mask-image:var(--image-file-heap-snapshots);background:var(--icon-default)}li.small .icon{width:16px;height:16px}li.wait .icon{content:none}.heap-snapshot-sidebar-tree-item.wait .icon{-webkit-mask-image:unset;background-color:inherit}.force-white-icons .heap-snapshot-sidebar-tree-item:not(.wait) .icon,\n.force-white-icons .profile-sidebar-tree-item:not(.wait) .icon,\n:host-context(.force-white-icons) .heap-snapshot-sidebar-tree-item:not(.wait) .icon,\n:host-context(.force-white-icons) .profile-sidebar-tree-item:not(.wait) .icon,\n.force-white-icons.profile-sidebar-tree-item:not(.wait) .icon,\n.force-white-icons.heap-snapshot-sidebar-tree-item:not(.wait) .icon,\n.-theme-preserve{-webkit-mask-image:var(--image-file-heap-snapshot);-webkit-mask-position:var(--spritesheet-position);background:var(--icon-force-white)!important}.force-white-icons .profile-group-sidebar-tree-item:not(.wait) .icon,\n:host-context(.force-white-icons) .profile-group-sidebar-tree-item:not(.wait) .icon,\n.force-white-icons.profile-group-sidebar-tree-item:not(.wait) .icon,\n.-theme-preserve{-webkit-mask-image:var(--image-file-heap-snapshots);-webkit-mask-position:var(--spritesheet-position);background:var(--icon-force-white)!important}.heap-snapshot-sidebar-tree-item.small .icon{-webkit-mask-image:var(--image-file-heap-snapshots);background:var(--icon-default)}.profile-sidebar-tree-item.small .icon{-webkit-mask-image:var(--image-file-heap-snapshots);background:var(--icon-default)}@media (forced-colors: active){.tree-outline li,\n .tree-outline li.profiles-tree-section,\n .tree-outline li:hover .tree-element-title{forced-color-adjust:none;color:ButtonText;text-shadow:unset}.tree-outline:not(.hide-selection-when-blurred) li.selected{color:HighlightText}}\n/*# sourceURL=profilesSidebarTree.css */\n');const me={javascriptVmInstances:"JavaScript VM instances",totalJsHeapSize:"Total JS heap size",totalPageJsHeapSizeChangeTrend:"Total page JS heap size change trend over the last {PH1} minutes.",totalPageJsHeapSizeAcrossAllVm:"Total page JS heap size across all VM instances.",changeRate:"{PH1}/s",increasingBySPerSecond:"increasing by {PH1} per second",decreasingBySPerSecond:"decreasing by {PH1} per second",heapSizeInUseByLiveJsObjects:"Heap size in use by live JS objects.",heapSizeChangeTrendOverTheLastS:"Heap size change trend over the last {PH1} minutes.",empty:"(empty)"},fe=t.i18n.registerUIStrings("panels/profiler/IsolateSelector.ts",me),ge=t.i18n.getLocalizedString.bind(void 0,fe);class ve extends s.Widget.VBox{items;list;itemByIsolate;totalElement;totalValueDiv;totalTrendDiv;constructor(){super(!1),this.items=new s.ListModel.ListModel,this.list=new s.ListControl.ListControl(this.items,this,s.ListControl.ListMode.NonViewport),this.list.element.classList.add("javascript-vm-instances-list"),s.ARIAUtils.setLabel(this.list.element,ge(me.javascriptVmInstances)),this.contentElement.appendChild(this.list.element),this.itemByIsolate=new Map,this.totalElement=document.createElement("div"),this.totalElement.classList.add("profile-memory-usage-item"),this.totalElement.classList.add("hbox"),this.totalValueDiv=this.totalElement.createChild("div","profile-memory-usage-item-size"),this.totalTrendDiv=this.totalElement.createChild("div","profile-memory-usage-item-trend"),this.totalElement.createChild("div").textContent=ge(me.totalJsHeapSize);const e=Math.round(l.IsolateManager.MemoryTrendWindowMs/6e4);s.Tooltip.Tooltip.install(this.totalTrendDiv,ge(me.totalPageJsHeapSizeChangeTrend,{PH1:e})),s.Tooltip.Tooltip.install(this.totalValueDiv,ge(me.totalPageJsHeapSizeAcrossAllVm)),l.IsolateManager.IsolateManager.instance().observeIsolates(this),l.TargetManager.TargetManager.instance().addEventListener(l.TargetManager.Events.NameChanged,this.targetChanged,this),l.TargetManager.TargetManager.instance().addEventListener(l.TargetManager.Events.InspectedURLChanged,this.targetChanged,this)}wasShown(){super.wasShown(),l.IsolateManager.IsolateManager.instance().addEventListener(l.IsolateManager.Events.MemoryChanged,this.heapStatsChanged,this)}willHide(){l.IsolateManager.IsolateManager.instance().removeEventListener(l.IsolateManager.Events.MemoryChanged,this.heapStatsChanged,this)}isolateAdded(e){this.list.element.tabIndex=0;const t=new we(e),i=t.model().target()===l.TargetManager.TargetManager.instance().rootTarget()?0:this.items.length;this.items.insert(i,t),this.itemByIsolate.set(e,t),(1===this.items.length||e.isMainThread())&&this.list.selectItem(t),this.update()}isolateChanged(e){const t=this.itemByIsolate.get(e);t&&t.updateTitle(),this.update()}isolateRemoved(e){const t=this.itemByIsolate.get(e);t&&this.items.remove(this.items.indexOf(t)),this.itemByIsolate.delete(e),0===this.items.length&&(this.list.element.tabIndex=-1),this.update()}targetChanged(e){const t=e.data.model(l.RuntimeModel.RuntimeModel);if(!t)return;const i=l.IsolateManager.IsolateManager.instance().isolateByModel(t),r=i&&this.itemByIsolate.get(i);r&&r.updateTitle()}heapStatsChanged(e){const t=e.data,i=this.itemByIsolate.get(t);i&&i.updateStats(),this.updateTotal()}updateTotal(){let t=0,i=0;for(const e of l.IsolateManager.IsolateManager.instance().isolates())t+=e.usedHeapSize(),i+=e.usedHeapSizeGrowRate();this.totalValueDiv.textContent=e.NumberUtilities.bytesToString(t),ve.formatTrendElement(i,this.totalTrendDiv)}static formatTrendElement(t,i){const r=1e3*t;if(Math.abs(r)<1e3)return;const o=e.NumberUtilities.bytesToString(Math.abs(r));let n,a;r>0?(n="⬆"+ge(me.changeRate,{PH1:o}),i.classList.toggle("increasing",!0),a=ge(me.increasingBySPerSecond,{PH1:o})):(n="⬇"+ge(me.changeRate,{PH1:o}),i.classList.toggle("increasing",!1),a=ge(me.decreasingBySPerSecond,{PH1:o})),i.textContent=n,s.ARIAUtils.setLabel(i,a)}totalMemoryElement(){return this.totalElement}createElementForItem(e){return e.element}heightForItem(e){return console.assert(!1,"should not be called"),0}updateSelectedItemARIA(e,t){return!1}isItemSelectable(e){return!0}selectedItemChanged(e,t,i,r){i&&i.classList.remove("selected"),r&&r.classList.add("selected");const o=t&&t.model();s.Context.Context.instance().setFlavor(l.HeapProfilerModel.HeapProfilerModel,o&&o.heapProfilerModel()),s.Context.Context.instance().setFlavor(l.CPUProfilerModel.CPUProfilerModel,o&&o.target().model(l.CPUProfilerModel.CPUProfilerModel))}update(){this.updateTotal(),this.list.invalidateRange(0,this.items.length)}}class we{isolate;element;heapDiv;trendDiv;nameDiv;constructor(e){this.isolate=e;const t=Math.round(l.IsolateManager.MemoryTrendWindowMs/6e4);this.element=document.createElement("div"),this.element.classList.add("profile-memory-usage-item"),this.element.classList.add("hbox"),s.ARIAUtils.markAsOption(this.element),this.heapDiv=this.element.createChild("div","profile-memory-usage-item-size"),s.Tooltip.Tooltip.install(this.heapDiv,ge(me.heapSizeInUseByLiveJsObjects)),this.trendDiv=this.element.createChild("div","profile-memory-usage-item-trend"),s.Tooltip.Tooltip.install(this.trendDiv,ge(me.heapSizeChangeTrendOverTheLastS,{PH1:t})),this.nameDiv=this.element.createChild("div","profile-memory-usage-item-name"),this.updateTitle()}model(){return this.isolate.runtimeModel()}updateStats(){this.heapDiv.textContent=e.NumberUtilities.bytesToString(this.isolate.usedHeapSize()),ve.formatTrendElement(this.isolate.usedHeapSizeGrowRate(),this.trendDiv)}updateTitle(){const e=new Map;for(const t of this.isolate.models()){const i=t.target(),r=l.TargetManager.TargetManager.instance().rootTarget()!==i?i.name():"",s=new o.ParsedURL.ParsedURL(i.inspectedURL()),n=s.isValid?s.domain():"",a=i.decorateLabel(n&&r?`${n}: ${r}`:r||n||ge(me.empty));e.set(a,(e.get(a)||0)+1)}this.nameDiv.removeChildren();const t=[];for(const[i,r]of e){const e=r>1?`${i} (${r})`:i;t.push(e);const o=this.nameDiv.createChild("div");o.textContent=e,s.Tooltip.Tooltip.install(o,String(e))}}}var Se=Object.freeze({__proto__:null,IsolateSelector:ve,ListItem:we});const be=new CSSStyleSheet;be.replaceSync('.profile-launcher-view{overflow:auto}.profile-launcher-view-content{margin:10px 16px;flex:auto 1 0}.profile-launcher-view-content h1{font-size:15px;font-weight:normal;margin:6px 0 10px}.profile-launcher-view-content [is="dt-radio"]{font-size:13px}.profile-launcher-view-content p{color:var(--color-text-secondary);margin-top:1px;margin-left:22px}.profile-launcher-view-content p [is="dt-checkbox"]{display:flex}.profile-launcher-view-content button.running{color:var(--color-accent-red)}.profile-launcher-view-content > div{flex:auto 0 0}.profile-launcher-view-content > .profile-isolate-selector-block{flex:auto 1 0;overflow:hidden}.profile-isolate-selector-block button{min-width:110px}.profile-launcher-target-list{margin-bottom:6px;border:1px solid var(--color-details-hairline);flex:150px 1 0}.profile-launcher-target-list-container{overflow:auto}.profile-memory-usage-item{min-width:100%;width:max-content;padding:4px;line-height:16px;border-left:3px solid transparent}.profile-isolate-selector-block > .profile-memory-usage-item{margin-left:1px;margin-bottom:4px;font-weight:bolder}.profile-launcher-target-list .profile-memory-usage-item:hover:not(.selected){background-color:var(--item-hover-color)}.profile-memory-usage-item.selected{background-color:var(--legacy-item-selection-inactive-bg-color)}.javascript-vm-instances-list{width:max-content;min-width:100%}.javascript-vm-instances-list:focus .profile-memory-usage-item.selected{border-color:var(--legacy-selection-bg-color);background-color:var(--legacy-item-selection-bg-color)}.profile-memory-usage-item > div{flex-shrink:0;margin-right:12px}.profile-memory-usage-item-size{width:60px;text-align:right}.profile-memory-usage-item-trend{min-width:5em;color:var(--color-accent-green)}.profile-memory-usage-item-trend.increasing{color:var(--color-accent-red)}.profile-launcher-buttons{flex-wrap:wrap}.profile-launcher-buttons button{min-width:120px;height:28px;margin:4px 16px 4px 0}@media (forced-colors: active){.profile-memory-usage-item{forced-color-adjust:none;border-left-color:transparent}.profile-memory-usage-item-trend,\n .profile-memory-usage-item-trend.increasing,\n .profile-launcher-view-content button.running,\n body.inactive .profile-launcher-view-content button.running:not(.toolbar-item){color:ButtonText}.javascript-vm-instances-list .profile-memory-usage-item:hover:not(.selected){background-color:Highlight;color:HighlightText}.javascript-vm-instances-list .profile-memory-usage-item.selected .profile-memory-usage-item-trend,\n .javascript-vm-instances-list .profile-memory-usage-item.selected .profile-memory-usage-item-trend.increasing{color:ButtonFace}.javascript-vm-instances-list .profile-memory-usage-item:hover:not(.selected) .profile-memory-usage-item-trend,\n .javascript-vm-instances-list .profile-memory-usage-item:hover:not(.selected) .profile-memory-usage-item-trend.increasing{background-color:Highlight;color:HighlightText}.javascript-vm-instances-list .profile-memory-usage-item.selected{background-color:ButtonText;border-color:Highlight;color:ButtonFace}.javascript-vm-instances-list:focus .profile-memory-usage-item.selected,\n .javascript-vm-instances-list:focus-visible .profile-memory-usage-item.selected{background-color:Highlight;border-color:ButtonText;color:HighlightText}}\n/*# sourceURL=profileLauncherView.css */\n');const Ce={selectJavascriptVmInstance:"Select JavaScript VM instance",load:"Load",takeSnapshot:"Take snapshot",stop:"Stop",start:"Start",selectProfilingType:"Select profiling type"},Pe=t.i18n.registerUIStrings("panels/profiler/ProfileLauncherView.ts",Ce),Te=t.i18n.getLocalizedString.bind(void 0,Pe);class xe extends(o.ObjectWrapper.eventMixin(s.Widget.VBox)){panel;contentElementInternal;selectedProfileTypeSetting;profileTypeHeaderElement;profileTypeSelectorForm;controlButton;loadButton;recordButtonEnabled;typeIdToOptionElementAndProfileType;isProfiling;isInstantProfile;isEnabled;constructor(e){super(),this.panel=e,this.element.classList.add("profile-launcher-view"),this.contentElementInternal=this.element.createChild("div","profile-launcher-view-content vbox");const t=this.contentElementInternal.createChild("div","vbox");this.selectedProfileTypeSetting=o.Settings.Settings.instance().createSetting("selectedProfileType","CPU"),this.profileTypeHeaderElement=t.createChild("h1"),this.profileTypeSelectorForm=t.createChild("form"),s.ARIAUtils.markAsRadioGroup(this.profileTypeSelectorForm);const i=this.contentElementInternal.createChild("div","vbox profile-isolate-selector-block");i.createChild("h1").textContent=Te(Ce.selectJavascriptVmInstance);const r=new ve,n=i.createChild("div","vbox profile-launcher-target-list");n.classList.add("profile-launcher-target-list-container"),r.show(n),i.appendChild(r.totalMemoryElement());const a=this.contentElementInternal.createChild("div","hbox profile-launcher-buttons");this.controlButton=s.UIUtils.createTextButton("",this.controlButtonClicked.bind(this),"",!0),this.loadButton=s.UIUtils.createTextButton(Te(Ce.load),this.loadButtonClicked.bind(this),""),a.appendChild(this.controlButton),a.appendChild(this.loadButton),this.recordButtonEnabled=!0,this.typeIdToOptionElementAndProfileType=new Map}loadButtonClicked(){this.panel.showLoadFromFileDialog()}updateControls(){this.isEnabled&&this.recordButtonEnabled?this.controlButton.removeAttribute("disabled"):this.controlButton.setAttribute("disabled",""),s.Tooltip.Tooltip.install(this.controlButton,this.recordButtonEnabled?"":s.UIUtils.anotherProfilerActiveLabel()),this.isInstantProfile?(this.controlButton.classList.remove("running"),this.controlButton.classList.add("primary-button"),this.controlButton.textContent=Te(Ce.takeSnapshot)):this.isProfiling?(this.controlButton.classList.add("running"),this.controlButton.classList.remove("primary-button"),this.controlButton.textContent=Te(Ce.stop)):(this.controlButton.classList.remove("running"),this.controlButton.classList.add("primary-button"),this.controlButton.textContent=Te(Ce.start));for(const{optionElement:e}of this.typeIdToOptionElementAndProfileType.values())e.disabled=Boolean(this.isProfiling)}profileStarted(){this.isProfiling=!0,this.updateControls()}profileFinished(){this.isProfiling=!1,this.updateControls()}updateProfileType(e,t){this.isInstantProfile=e.isInstantProfile(),this.recordButtonEnabled=t,this.isEnabled=e.isEnabled(),this.updateControls()}addProfileType(e){const t=s.UIUtils.createRadioLabel("profile-type",e.name);this.profileTypeSelectorForm.appendChild(t);const i=t.radioElement;this.typeIdToOptionElementAndProfileType.set(e.id,{optionElement:i,profileType:e}),i.addEventListener("change",this.profileTypeChanged.bind(this,e),!1);this.profileTypeSelectorForm.createChild("p").textContent=e.description,s.ARIAUtils.setDescription(i,e.description);const r=e.customContent();r&&(r.setAttribute("role","group"),r.setAttribute("aria-labelledby",`${i.id}`),this.profileTypeSelectorForm.createChild("p").appendChild(r),e.setCustomContentEnabled(!1));const o=this.typeIdToOptionElementAndProfileType.size>1?Te(Ce.selectProfilingType):e.name;this.profileTypeHeaderElement.textContent=o,s.ARIAUtils.setLabel(this.profileTypeSelectorForm,o)}restoreSelectedProfileType(){let e=this.selectedProfileTypeSetting.get();this.typeIdToOptionElementAndProfileType.has(e)||(e=this.typeIdToOptionElementAndProfileType.keys().next().value,this.selectedProfileTypeSetting.set(e));const t=this.typeIdToOptionElementAndProfileType.get(e);t.optionElement.checked=!0;const i=t.profileType;for(const[t,{profileType:i}]of this.typeIdToOptionElementAndProfileType){const r=t===e;i.setCustomContentEnabled(r)}this.dispatchEventToListeners(ye.ProfileTypeSelected,i)}controlButtonClicked(){this.panel.toggleRecord()}profileTypeChanged(e){const t=this.selectedProfileTypeSetting.get();this.typeIdToOptionElementAndProfileType.get(t).profileType.setCustomContentEnabled(!1),e.setCustomContentEnabled(!0),this.dispatchEventToListeners(ye.ProfileTypeSelected,e),this.isInstantProfile=e.isInstantProfile(),this.isEnabled=e.isEnabled(),this.updateControls(),this.selectedProfileTypeSetting.set(e.id)}wasShown(){super.wasShown(),this.registerCSSFiles([be])}}var ye;!function(e){e.ProfileTypeSelected="ProfileTypeSelected"}(ye||(ye={}));var Ie=Object.freeze({__proto__:null,ProfileLauncherView:xe,get Events(){return ye}});class Re extends(o.ObjectWrapper.eventMixin(s.Widget.VBox)){overviewCalculator;overviewContainer;overviewGrid;overviewCanvas;windowLeft;windowRight;yScale;xScale;profileSamples;running;updateOverviewCanvas;updateGridTimerId;updateTimerId;windowWidth;constructor(){super(),this.element.id="heap-recording-view",this.element.classList.add("heap-tracking-overview"),this.overviewCalculator=new ke,this.overviewContainer=this.element.createChild("div","heap-overview-container"),this.overviewGrid=new n.OverviewGrid.OverviewGrid("heap-recording",this.overviewCalculator),this.overviewGrid.element.classList.add("fill"),this.overviewCanvas=this.overviewContainer.createChild("canvas","heap-recording-overview-canvas"),this.overviewContainer.appendChild(this.overviewGrid.element),this.overviewGrid.addEventListener(n.OverviewGrid.Events.WindowChanged,this.onWindowChanged,this),this.windowLeft=0,this.windowRight=1,this.overviewGrid.setWindow(this.windowLeft,this.windowRight),this.yScale=new Ee,this.xScale=new Ee,this.profileSamples=new Ne}start(){this.running=!0;const e=()=>{this.update(),this.running&&this.element.window().requestAnimationFrame(e)};e()}stop(){this.running=!1}setSamples(e){this.profileSamples=e,this.running||this.update()}drawOverviewCanvas(t,i){if(!this.profileSamples)return;const r=this.profileSamples,s=r.sizes,o=r.max,n=r.timestamps,a=n[0],l=this.xScale.nextScale(t/r.totalTime);let d=0;function h(e,t){let i=0,r=0;for(let s=1;s<n.length;++s){const o=Math.floor((n[s]-a)*l);o!==r&&(i&&t(r,i),i=0,r=o),i+=e[s]}t(r,i)}h(s,(function(e,t){d=Math.max(d,t)}));const c=this.yScale.nextScale(d?i/(1.1*d):0);this.overviewCanvas.width=t*window.devicePixelRatio,this.overviewCanvas.height=i*window.devicePixelRatio,this.overviewCanvas.style.width=t+"px",this.overviewCanvas.style.height=i+"px";const p=this.overviewCanvas.getContext("2d");if(!p)throw new Error("Failed to get canvas context");const u=p;if(u.scale(window.devicePixelRatio,window.devicePixelRatio),this.running){u.beginPath(),u.lineWidth=2,u.strokeStyle="rgba(192, 192, 192, 0.6)";const e=(Date.now()-a)*l;u.moveTo(e,i-1),u.lineTo(e,0),u.stroke(),u.closePath()}let m,f=0;if(c){const e=(i-14)/c;m=Math.pow(1024,Math.floor(Math.log(e)/Math.log(1024))),m*=Math.pow(10,Math.floor(Math.log(e/m)/Math.LN10)),5*m<=e&&(m*=5),f=Math.round(i-m*c-.5)+.5,u.beginPath(),u.lineWidth=1,u.strokeStyle="rgba(0, 0, 0, 0.2)",u.moveTo(0,f),u.lineTo(t,f),u.stroke(),u.closePath()}function g(e,t){u.moveTo(e,i-1),u.lineTo(e,Math.round(i-t*c-1))}if(u.beginPath(),u.lineWidth=2,u.strokeStyle="rgba(192, 192, 192, 0.6)",h(o,g),u.stroke(),u.closePath(),u.beginPath(),u.lineWidth=2,u.strokeStyle="rgba(0, 0, 192, 0.8)",h(s,g),u.stroke(),u.closePath(),m){const t=e.NumberUtilities.bytesToString(m),i=4,r=0,s=f-.5,o=2*i+u.measureText(t).width;u.beginPath(),u.textBaseline="bottom",u.font="10px "+window.getComputedStyle(this.element,null).getPropertyValue("font-family"),u.fillStyle="rgba(255, 255, 255, 0.75)",u.fillRect(r,s-14,o,14),u.fillStyle="rgb(64, 64, 64)",u.fillText(t,r+i,s),u.fill(),u.closePath()}}onResize(){this.updateOverviewCanvas=!0,this.scheduleUpdate()}onWindowChanged(){this.updateGridTimerId||(this.updateGridTimerId=window.setTimeout(this.updateGrid.bind(this),10))}scheduleUpdate(){this.updateTimerId||(this.updateTimerId=window.setTimeout(this.update.bind(this),10))}updateBoundaries(){this.windowLeft=this.overviewGrid.windowLeft(),this.windowRight=this.overviewGrid.windowRight(),this.windowWidth=this.windowRight-this.windowLeft}update(){this.updateTimerId=null,this.isShowing()&&(this.updateBoundaries(),this.overviewCalculator.updateBoundaries(this),this.overviewGrid.updateDividers(this.overviewCalculator),this.drawOverviewCanvas(this.overviewContainer.clientWidth,this.overviewContainer.clientHeight-20))}updateGrid(){this.updateGridTimerId=0,this.updateBoundaries();const t=this.profileSamples.ids;if(!t.length)return;const i=this.profileSamples.timestamps,r=this.profileSamples.sizes,s=i[0],o=this.profileSamples.totalTime,n=s+o*this.windowLeft,a=s+o*this.windowRight,l=e.ArrayUtilities.lowerBound(i,n,e.ArrayUtilities.DEFAULT_COMPARATOR),d=e.ArrayUtilities.upperBound(i,a,e.ArrayUtilities.DEFAULT_COMPARATOR);let h=0;for(let e=l;e<d;++e)h+=r[e];const c=l>0?t[l-1]:0,p=d<t.length?t[d]:1/0;this.dispatchEventToListeners("IdsRangeChanged",{minId:c,maxId:p,size:h})}}class Ee{lastUpdate;currentScale;constructor(){this.lastUpdate=0,this.currentScale=0}nextScale(t){if(t=t||this.currentScale,this.currentScale){const i=Date.now(),r=i-this.lastUpdate;this.lastUpdate=i;const s=20,o=Math.pow(s,r/1e3),n=t/this.currentScale;this.currentScale*=e.NumberUtilities.clamp(n,1/o,o)}else this.currentScale=t;return this.currentScale}}class Ne{sizes;ids;timestamps;max;totalTime;constructor(){this.sizes=[],this.ids=[],this.timestamps=[],this.max=[],this.totalTime=3e4}}class ke{maximumBoundaries;minimumBoundaries;xScaleFactor;constructor(){this.maximumBoundaries=0,this.minimumBoundaries=0,this.xScaleFactor=0}updateBoundaries(e){this.minimumBoundaries=0,this.maximumBoundaries=e.profileSamples.totalTime,this.xScaleFactor=e.overviewContainer.clientWidth/this.maximumBoundaries}computePosition(e){return(e-this.minimumBoundaries)*this.xScaleFactor}formatValue(e,i){return t.TimeUtilities.secondsToString(e/1e3,Boolean(i))}maximumBoundary(){return this.maximumBoundaries}minimumBoundary(){return this.minimumBoundaries}zeroTime(){return this.minimumBoundaries}boundarySpan(){return this.maximumBoundaries-this.minimumBoundaries}}var De=Object.freeze({__proto__:null,HeapTimelineOverview:Re,SmoothScale:Ee,Samples:Ne,OverviewCalculator:ke});const Me={selectedSizeS:"Selected size: {PH1}",selfSizeBytes:"Self Size (bytes)",totalSizeBytes:"Total Size (bytes)",stopHeapProfiling:"Stop heap profiling",startHeapProfiling:"Start heap profiling",recording:"Recording…",heapProfilerIsRecording:"Heap profiler is recording",stopping:"Stopping…",allocationSampling:"Allocation sampling",samplingProfiles:"SAMPLING PROFILES",recordMemoryAllocations:"Record memory allocations using sampling method.",thisProfileTypeHasMinimal:"This profile type has minimal performance overhead and can be used for long running operations.",itProvidesGoodApproximation:"It provides good approximation of allocations broken down by `JavaScript` execution stack.",profileD:"Profile {PH1}",sBytes:"{PH1} bytes",formatPercent:"{PH1} %",skb:"{PH1} kB",name:"Name",selfSize:"Self size",totalSize:"Total size",url:"URL"},Fe=t.i18n.registerUIStrings("panels/profiler/HeapProfileView.ts",Me),He=t.i18n.getLocalizedString.bind(void 0,Fe);function Le(e){return e.profile||e.protocolProfile()}class je extends Y{profileHeader;profileType;adjustedTotal;selectedSizeText;timestamps;sizes;max;ordinals;totalTime;lastOrdinal;timelineOverview;constructor(e){super(),this.profileHeader=e,this.profileType=e.profileType(),this.initialize(new Ae(this));const t=new Ue(Le(e));this.adjustedTotal=t.total,this.setProfile(t),this.selectedSizeText=new s.Toolbar.ToolbarText,this.timestamps=[],this.sizes=[],this.max=[],this.ordinals=[],this.totalTime=0,this.lastOrdinal=0,this.timelineOverview=new Re,c.Runtime.experiments.isEnabled("samplingHeapProfilerTimeline")&&(this.timelineOverview.addEventListener("IdsRangeChanged",this.onIdsRangeChanged.bind(this)),this.timelineOverview.show(this.element,this.element.firstChild),this.timelineOverview.start(),this.profileType.addEventListener("StatsUpdate",this.onStatsUpdate,this),this.profileType.once(D.ProfileComplete).then((()=>{this.profileType.removeEventListener("StatsUpdate",this.onStatsUpdate,this),this.timelineOverview.stop(),this.timelineOverview.updateGrid()})))}async toolbarItems(){return[...await super.toolbarItems(),this.selectedSizeText]}onIdsRangeChanged(t){const{minId:i,maxId:r}=t.data;this.selectedSizeText.setText(He(Me.selectedSizeS,{PH1:e.NumberUtilities.bytesToString(t.data.size)})),this.setSelectionRange(i,r)}setSelectionRange(e,t){const i=Le(this.profileHeader),r=new Ue(i,e,t);this.adjustedTotal=r.total,this.setProfile(r)}onStatsUpdate(t){const i=t.data;this.totalTime||(this.timestamps=[],this.sizes=[],this.max=[],this.ordinals=[],this.totalTime=3e4,this.lastOrdinal=0),this.sizes.fill(0),this.sizes.push(0),this.timestamps.push(Date.now()),this.ordinals.push(this.lastOrdinal+1);for(const t of i?.samples??[]){this.lastOrdinal=Math.max(this.lastOrdinal,t.ordinal);const i=e.ArrayUtilities.upperBound(this.ordinals,t.ordinal,e.ArrayUtilities.DEFAULT_COMPARATOR)-1;this.sizes[i]+=t.size}this.max.push(this.sizes[this.sizes.length-1]);this.timestamps[this.timestamps.length-1]-this.timestamps[0]>this.totalTime&&(this.totalTime*=2);const r={sizes:this.sizes,max:this.max,ids:this.ordinals,timestamps:this.timestamps,totalTime:this.totalTime};this.timelineOverview.setSamples(r)}columnHeader(e){switch(e){case"self":return He(Me.selfSizeBytes);case"total":return He(Me.totalSizeBytes)}return o.UIString.LocalizedEmptyString}createFlameChartDataProvider(){return new We(this.profile(),this.profileHeader.heapProfilerModel())}}class Oe extends(o.ObjectWrapper.eventMixin(L)){recording;clearedDuringRecording;constructor(e,t){super(e,t),this.recording=!1,this.clearedDuringRecording=!1}profileBeingRecorded(){return super.profileBeingRecorded()}typeName(){return"Heap"}fileExtension(){return".heapprofile"}get buttonTooltip(){return this.recording?He(Me.stopHeapProfiling):He(Me.startHeapProfiling)}buttonClicked(){return this.recording?this.stopRecordingProfile():this.startRecordingProfile(),this.recording}startRecordingProfile(){const e=s.Context.Context.instance().flavor(l.HeapProfilerModel.HeapProfilerModel);if(this.profileBeingRecorded()||!e)return;const t=new Ge(e,this);this.setProfileBeingRecorded(t),this.addProfile(t),t.updateStatus(He(Me.recording));const r=new i.Icon.Icon;r.data={iconName:"warning-filled",color:"var(--icon-warning)",width:"14px",height:"14px"},s.Tooltip.Tooltip.install(r,He(Me.heapProfilerIsRecording)),s.InspectorView.InspectorView.instance().setPanelIcon("heap_profiler",r),this.recording=!0,this.startSampling()}async stopRecordingProfile(){this.recording=!1;const e=this.profileBeingRecorded();if(!e||!e.heapProfilerModel())return;e.updateStatus(He(Me.stopping));const t=await this.stopSampling();e&&(console.assert(void 0!==t),e.setProtocolProfile(t),e.updateStatus(""),this.setProfileBeingRecorded(null)),s.InspectorView.InspectorView.instance().setPanelIcon("heap_profiler",null);const i=this.clearedDuringRecording;this.clearedDuringRecording=!1,i||this.dispatchEventToListeners(D.ProfileComplete,e)}createProfileLoadedFromFile(e){return new Ge(null,this,e)}profileBeingRecordedRemoved(){this.clearedDuringRecording=!0,this.stopRecordingProfile()}startSampling(){throw"Not implemented"}stopSampling(){throw"Not implemented"}}let ze;class Be extends Oe{updateTimer;updateIntervalMs;constructor(){super(Be.TypeId,He(Me.allocationSampling)),ze||(ze=this),this.updateTimer=0,this.updateIntervalMs=200}static get instance(){return ze}get treeItemTitle(){return He(Me.samplingProfiles)}get description(){return[He(Me.recordMemoryAllocations),He(Me.thisProfileTypeHasMinimal),He(Me.itProvidesGoodApproximation)].join("\n")}hasTemporaryView(){return c.Runtime.experiments.isEnabled("samplingHeapProfilerTimeline")}startSampling(){const e=this.obtainRecordingProfile();e&&(e.startSampling(),c.Runtime.experiments.isEnabled("samplingHeapProfilerTimeline")&&(this.updateTimer=window.setTimeout((()=>{this.updateStats()}),this.updateIntervalMs)))}obtainRecordingProfile(){const e=this.profileBeingRecorded();if(e){return e.heapProfilerModel()}return null}async stopSampling(){window.clearTimeout(this.updateTimer),this.updateTimer=0,this.dispatchEventToListeners("RecordingStopped");const e=this.obtainRecordingProfile();if(!e)throw new Error("No heap profiler model");const t=await e.stopSampling();if(!t)throw new Error("No sampling profile found");return t}async updateStats(){const e=this.obtainRecordingProfile();if(!e)return;const t=await e.getSamplingProfile();this.updateTimer&&(this.dispatchEventToListeners("StatsUpdate",t),this.updateTimer=window.setTimeout((()=>{this.updateStats()}),this.updateIntervalMs))}static TypeId="SamplingHeap"}class Ge extends X{heapProfilerModelInternal;protocolProfileInternal;constructor(e,t,i){super(e&&e.debuggerModel(),t,i||He(Me.profileD,{PH1:t.nextProfileUid()})),this.heapProfilerModelInternal=e,this.protocolProfileInternal={head:{callFrame:{functionName:"",scriptId:"",url:"",lineNumber:0,columnNumber:0},children:[],selfSize:0,id:0},samples:[],startTime:0,endTime:0,nodes:[]}}createView(){return new je(this)}protocolProfile(){return this.protocolProfileInternal}heapProfilerModel(){return this.heapProfilerModelInternal}profileType(){return super.profileType()}}class Ve extends l.ProfileTreeModel.ProfileNode{self;constructor(e,t){super(e.callFrame||{functionName:e.functionName,scriptId:e.scriptId,url:e.url,lineNumber:e.lineNumber-1,columnNumber:e.columnNumber-1},t),this.self=e.selfSize}}class Ue extends l.ProfileTreeModel.ProfileTreeModel{modules;constructor(e,t,i){super(),this.modules=e.modules||[];let r=null;if(t||i){r=new Map,t=t||0,i=i||1/0;for(const s of e.samples){if(s.ordinal<t||s.ordinal>i)continue;const e=r.get(s.nodeId)||0;r.set(s.nodeId,e+s.size)}}function s(e){return e.children=e.children.filter(s),Boolean(e.children.length||e.self)}this.initialize(function(e,t){const i=new Ve(e,t),o=[e],n=[i];for(;o.length;){const e=o.pop(),i=n.pop();i.children=e.children.map((e=>{const i=new Ve(e,t);return r&&(i.self=r.get(e.id)||0),i})),o.push(...e.children),n.push(...i.children)}return s(i),i}(e.head,this.target()))}}class Ae{profileView;constructor(e){this.profileView=e}formatValue(t){return e.NumberUtilities.withThousandsSeparator(t)}formatValueAccessibleText(e){return He(Me.sBytes,{PH1:e})}formatPercent(e,t){return He(Me.formatPercent,{PH1:e.toFixed(2)})}linkifyNode(e){const t=this.profileView.profileHeader.heapProfilerModel(),i=t?t.target():null;return this.profileView.linkifier().maybeLinkifyConsoleCallFrame(i,e.profileNode.callFrame,{className:"profile-node-file",inlineFrameIndex:0})}}class We extends I{profile;heapProfilerModel;timelineDataInternal;constructor(e,t){super(),this.profile=e,this.heapProfilerModel=t}minimumBoundary(){return 0}totalTime(){return this.profile.root.total}entryHasDeoptReason(e){return!1}formatValue(t,i){return He(Me.skb,{PH1:e.NumberUtilities.withThousandsSeparator(t/1e3)})}calculateTimelineData(){const e=function e(t){return t.children.reduce(((t,i)=>t+e(i)),1)}(this.profile.root),t=new Array(e),i=new Uint16Array(e),r=new Float32Array(e),s=new Float64Array(e);let o=0,a=0,l=0,d=0;return function e(n){const h=l;t[d]=n,i[d]=o,r[d]=n.total,s[d]=l,++d,++o,n.children.forEach(e),--o,a=Math.max(a,o),l=h+n.total}(this.profile.root),this.maxStackDepthInternal=a+1,this.entryNodes=t,this.timelineDataInternal=n.FlameChart.FlameChartTimelineData.create({entryLevels:i,entryTotalTimes:r,entryStartTimes:s,groups:null}),this.timelineDataInternal}prepareHighlightedEntryInfo(t){const i=this.entryNodes[t];if(!i)return null;const r=[];function o(e,t){r.push({title:e,value:t})}o(He(Me.name),s.UIUtils.beautifyFunctionName(i.functionName)),o(He(Me.selfSize),e.NumberUtilities.bytesToString(i.self)),o(He(Me.totalSize),e.NumberUtilities.bytesToString(i.total));const n=new d.Linkifier.Linkifier,a=n.maybeLinkifyConsoleCallFrame(this.heapProfilerModel?this.heapProfilerModel.target():null,i.callFrame);return a&&o(He(Me.url),a.textContent),n.dispose(),Y.buildPopoverTable(r)}}var _e=Object.freeze({__proto__:null,HeapProfileView:je,SamplingHeapProfileTypeBase:Oe,SamplingHeapProfileType:Be,SamplingHeapProfileHeader:Ge,SamplingHeapProfileNode:Ve,SamplingHeapProfileModel:Ue,NodeFormatter:Ae,HeapFlameChartDataProvider:We});const Je={genericStringsTwoPlaceholders:"{PH1}, {PH2}",internalArray:"(internal array)[]",userObjectReachableFromWindow:"User object reachable from window",detachedFromDomTree:"Detached from DOM tree",previewIsNotAvailable:"Preview is not available",revealInSummaryView:"Reveal in Summary view",summary:"Summary",revealObjectSWithIdSInSummary:"Reveal object ''{PH1}'' with id @{PH2} in Summary view",storeAsGlobalVariable:"Store as global variable",inElement:"in"},$e=t.i18n.registerUIStrings("panels/profiler/HeapSnapshotGridNodes.ts",Je),qe=t.i18n.getLocalizedString.bind(void 0,$e);class Qe extends r.DataGrid.DataGridNode{}class Ke extends(o.ObjectWrapper.eventMixin(Qe)){dataGridInternal;instanceCount;savedChildren;retrievedChildrenRanges;providerObject;reachableFromWindow;populated;constructor(e,t){super(null,t),this.dataGridInternal=e,this.instanceCount=0,this.savedChildren=new Map,this.retrievedChildrenRanges=[],this.providerObject=null,this.reachableFromWindow=!1}get name(){}heapSnapshotDataGrid(){return this.dataGridInternal}createProvider(){throw new Error("Not implemented.")}comparator(){throw new Error("Not implemented.")}getHash(){throw new Error("Not implemented.")}createChildNode(e){throw new Error("Not implemented.")}retainersDataSource(){return null}provider(){return this.providerObject||(this.providerObject=this.createProvider()),this.providerObject}createCell(e){return super.createCell(e)}collapse(){super.collapse(),this.dataGridInternal.updateVisibleNodes(!0)}expand(){super.expand(),this.dataGridInternal.updateVisibleNodes(!0)}dispose(){this.providerObject&&this.providerObject.dispose();for(let e=this.children[0];e;e=e.traverseNextNode(!0,this,!0))e.dispose()}queryObjectContent(e,t){throw new Error("Not implemented.")}tryQueryObjectContent(e,t){throw new Error("Not implemented.")}populateContextMenu(e,t,i){}toPercentString(e){return e.toFixed(0)+" %"}toUIDistance(e){const t=p.HeapSnapshotModel.baseSystemDistance;return e>=0&&e<t?e.toString():"−"}allChildren(){return this.dataGridInternal.allChildren(this)}removeChildByIndex(e){this.dataGridInternal.removeChildByIndex(this,e)}childForPosition(e){let t=0;for(let i=0;i<this.retrievedChildrenRanges.length;i++){const r=this.retrievedChildrenRanges[i];if(r.from<=e&&e<r.to){const i=t+e-r.from;return this.allChildren()[i]}t+=r.to-r.from+1}return null}createValueCell(e){const t=s.Fragment.html`<td class="numeric-column">`,i=this.dataGrid;if(i.snapshot&&0!==i.snapshot.totalSize){const i=document.createElement("div"),r=s.Fragment.html`<span>${this.data[e]}</span>`;i.appendChild(r);const o=e+"-percent";if(o in this.data){const n=s.Fragment.html`<span class="percent-column">${this.data[o]}</span>`;i.appendChild(n),i.classList.add("profile-multiple-values"),s.ARIAUtils.markAsHidden(r),s.ARIAUtils.markAsHidden(n),this.setCellAccessibleName(qe(Je.genericStringsTwoPlaceholders,{PH1:this.data[e],PH2:this.data[o]}),t,e)}t.appendChild(i)}return t}populate(){this.populated||(this.populated=!0,this.provider().sortAndRewind(this.comparator()).then((()=>this.populateChildren())))}expandWithoutPopulate(){return this.populated=!0,this.expand(),this.provider().sortAndRewind(this.comparator())}childHashForEntity(e){return"edgeIndex"in e?e.edgeIndex:e.id}populateChildren(e,t){return new Promise((i=>{e=e||0,t=t||e+this.dataGridInternal.defaultPopulateCount();let s=e;function o(e){if(s>=e)return;const t=Math.min(s+this.dataGridInternal.defaultPopulateCount(),e);this.provider().serializeItemsRange(s,t).then((t=>l.call(this,t,e))),s=t}function n(e,t){if(this.savedChildren){const i=this.childHashForEntity(e),r=this.savedChildren.get(i);if(r)return void this.dataGridInternal.insertChild(this,r,t)}this.dataGridInternal.insertChild(this,this.createChildNode(e),t)}function a(e,t,i){const s=new r.ShowMoreDataGridNode.ShowMoreDataGridNode(this.populateChildren.bind(this),e,t,this.dataGridInternal.defaultPopulateCount());this.dataGridInternal.insertChild(this,s,i)}function l(e,t){let r=0,l=e.startPosition;const d=e.items;let h=0;if(this.retrievedChildrenRanges.length){let t=0,i=!1,s={from:0,to:0};for(;t<this.retrievedChildrenRanges.length;){if(s=this.retrievedChildrenRanges[t],s.to>=l){i=!0;break}h+=s.to-s.from,s.to<e.totalLength&&(h+=1),++t}if(!i||e.startPosition<s.from){this.allChildren()[h-1].setEndPosition(e.startPosition),a.call(this,e.startPosition,i?s.from:e.totalLength,h),s={from:e.startPosition,to:e.startPosition},i||(t=this.retrievedChildrenRanges.length),this.retrievedChildrenRanges.splice(t,0,s)}else h+=l-s.from;for(;s.to<e.endPosition;){const i=s.to-l;h+=i,r+=i,l=s.to;const o=this.retrievedChildrenRanges[t+1];let a=o?o.from:e.totalLength;for(a>e.endPosition&&(a=e.endPosition);l<a;)n.call(this,d[r++],h++),++l;o&&a===o.from?(s.to=o.to,this.removeChildByIndex(h),this.retrievedChildrenRanges.splice(t+1,1)):(s.to=a,a===e.totalLength?this.removeChildByIndex(h):this.allChildren()[h].setStartPosition(e.endPosition))}}else{e.startPosition>0&&(this.retrievedChildrenRanges.push({from:0,to:0}),a.call(this,0,e.startPosition,h++)),this.retrievedChildrenRanges.push({from:e.startPosition,to:e.endPosition});for(let e=0,t=d.length;e<t;++e)n.call(this,d[e],h++);e.endPosition<e.totalLength&&a.call(this,e.endPosition,e.totalLength,h++)}this.instanceCount+=d.length,s<t?o.call(this,t):(this.expanded&&this.dataGridInternal.updateVisibleNodes(!0),i(),this.dispatchEventToListeners(Ke.Events.PopulateComplete))}o.call(this,t)}))}saveChildren(){this.savedChildren.clear();const e=this.allChildren();for(let t=0,i=e.length;t<i;++t){const i=e[t];i.expanded&&this.savedChildren.set(i.getHash(),i)}}async sort(){this.dataGridInternal.recursiveSortingEnter(),await this.provider().sortAndRewind(this.comparator()),this.saveChildren(),this.dataGridInternal.removeAllChildren(this),this.retrievedChildrenRanges=[];const e=this.instanceCount;this.instanceCount=0,await this.populateChildren(0,e);for(const e of this.allChildren())e.expanded&&e.sort();this.dataGridInternal.recursiveSortingLeave()}}!function(e){let t;!function(e){e.PopulateComplete="PopulateComplete"}(t=e.Events||(e.Events={}))}(Ke||(Ke={}));class Ye extends Ke{referenceName;nameInternal;type;distance;shallowSize;retainedSize;snapshotNodeId;snapshotNodeIndex;detachedDOMTreeNode;linkElement;constructor(t,i){if(super(t,!1),!i)return;this.referenceName=null,this.nameInternal=i.name,this.type=i.type,this.distance=i.distance,this.shallowSize=i.selfSize,this.retainedSize=i.retainedSize,this.snapshotNodeId=i.id,this.snapshotNodeIndex=i.nodeIndex,"string"===this.type?this.reachableFromWindow=!0:"object"===this.type&&this.nameInternal.startsWith("Window")?(this.nameInternal=this.shortenWindowURL(this.nameInternal,!1),this.reachableFromWindow=!0):i.canBeQueried&&(this.reachableFromWindow=!0),i.detachedDOMTreeNode&&(this.detachedDOMTreeNode=!0);const r=t.snapshot,s=this.shallowSize/r.totalSize*100,o=this.retainedSize/r.totalSize*100;this.data={distance:this.toUIDistance(this.distance),shallowSize:e.NumberUtilities.withThousandsSeparator(this.shallowSize),retainedSize:e.NumberUtilities.withThousandsSeparator(this.retainedSize),"shallowSize-percent":this.toPercentString(s),"retainedSize-percent":this.toPercentString(o)}}get name(){return this.nameInternal}retainersDataSource(){return void 0===this.snapshotNodeIndex?null:{snapshot:this.dataGridInternal.snapshot,snapshotNodeIndex:this.snapshotNodeIndex}}createCell(e){return"object"!==e?this.createValueCell(e):this.createObjectCell()}createObjectCell(){let e=this.nameInternal,t="object";switch(this.type){case"concatenated string":case"string":e=`"${e}"`,t="string";break;case"regexp":e=`/${e}/`,t="string";break;case"closure":e=`${e}()`,t="function";break;case"bigint":t="bigint";break;case"number":t="number";break;case"hidden":case"object shape":t="null";break;case"array":e=e?`${e}[]`:qe(Je.internalArray)}return this.createObjectCellWithValue(t,e||"")}createObjectCellWithValue(e,t){const i=s.Fragment.Fragment.build`
2
+ <td class="object-column disclosure">
3
+ <div class="source-code event-properties" style="overflow: visible;" $="container">
4
+ <span class="value object-value-${e}">${t}</span>
5
+ <span class="object-value-id">@${this.snapshotNodeId}</span>
6
+ </div>
7
+ </td>`,r=i.$("container");this.prefixObjectCell(r),this.reachableFromWindow&&r.appendChild(s.Fragment.html`<span class="heap-object-tag" title="${qe(Je.userObjectReachableFromWindow)}">🗖</span>`),this.detachedDOMTreeNode&&r.appendChild(s.Fragment.html`<span class="heap-object-tag" title="${qe(Je.detachedFromDomTree)}">✀</span>`),this.appendSourceLocation(r);const o=i.element();return this.depth&&o.style.setProperty("padding-left",this.depth*this.dataGrid.indentWidth+"px"),o}prefixObjectCell(e){}async appendSourceLocation(e){const t=s.Fragment.html`<span class="heap-object-source-link">`;e.appendChild(t);const i=await this.dataGridInternal.dataDisplayDelegate().linkifyObject(this.snapshotNodeIndex);i?(t.appendChild(i),this.linkElement=i):t.remove()}async queryObjectContent(e,t){return await this.tryQueryObjectContent(e,t)||e.runtimeModel().createRemoteObjectFromPrimitiveValue(qe(Je.previewIsNotAvailable))}async tryQueryObjectContent(e,t){return"string"===this.type?e.runtimeModel().createRemoteObjectFromPrimitiveValue(this.nameInternal):await e.objectForSnapshotObjectId(String(this.snapshotNodeId),t)}async updateHasChildren(){const e=await this.provider().isEmpty();this.setHasChildren(!e)}shortenWindowURL(t,i){const r=t.indexOf("/"),s=i?t.indexOf("@"):t.length;if(-1===r||-1===s)return t;const o=t.substring(r+1,s).trimLeft();let n=e.StringUtilities.trimURL(o);return n.length>40&&(n=e.StringUtilities.trimMiddle(n,40)),t.substr(0,r+2)+n+t.substr(s)}populateContextMenu(e,t,i){if(e.revealSection().appendItem(qe(Je.revealInSummaryView),(()=>{t.showObject(String(this.snapshotNodeId),qe(Je.summary))})),this.referenceName)for(const i of this.referenceName.matchAll(/\((?<objectName>[^@)]*) @(?<snapshotNodeId>\d+)\)/g)){const{objectName:r,snapshotNodeId:s}=i.groups;e.revealSection().appendItem(qe(Je.revealObjectSWithIdSInSummary,{PH1:r,PH2:s}),(()=>{t.showObject(s,qe(Je.summary))}))}i&&e.revealSection().appendItem(qe(Je.storeAsGlobalVariable),(async()=>{const e=await this.tryQueryObjectContent(i,"");if(e){const t=i.target().model(l.ConsoleModel.ConsoleModel);await(t?.saveToTempVariable(s.Context.Context.instance().flavor(l.RuntimeModel.ExecutionContext),e))}else o.Console.Console.instance().error(qe(Je.previewIsNotAvailable))}))}}class Ze extends Ye{referenceName;referenceType;edgeIndex;snapshot;parentObjectNode;cycledWithAncestorGridNode;constructor(e,t,i,r){super(e,i.node),this.referenceName=i.name,this.referenceType=i.type,this.edgeIndex=i.edgeIndex,this.snapshot=t,this.parentObjectNode=r,this.cycledWithAncestorGridNode=this.findAncestorWithSameSnapshotNodeId(),this.cycledWithAncestorGridNode||this.updateHasChildren();const s=this.data;s.count="",s.addedCount="",s.removedCount="",s.countDelta="",s.addedSize="",s.removedSize="",s.sizeDelta=""}retainersDataSource(){return void 0===this.snapshotNodeIndex?null:{snapshot:this.snapshot,snapshotNodeIndex:this.snapshotNodeIndex}}createProvider(){if(void 0===this.snapshotNodeIndex)throw new Error("Cannot create a provider on a root node");return this.snapshot.createEdgesProvider(this.snapshotNodeIndex)}findAncestorWithSameSnapshotNodeId(){let e=this.parentObjectNode;for(;e;){if(e.snapshotNodeId===this.snapshotNodeId)return e;e=e.parentObjectNode}return null}createChildNode(e){return new Ze(this.dataGridInternal,this.snapshot,e,this)}getHash(){return this.edgeIndex}comparator(){const e=this.dataGridInternal.isSortOrderAscending();switch(this.dataGridInternal.sortColumnId()){case"object":return new p.HeapSnapshotModel.ComparatorConfig("!edgeName",e,"retainedSize",!1);case"count":default:return new p.HeapSnapshotModel.ComparatorConfig("!edgeName",!0,"retainedSize",!1);case"shallowSize":return new p.HeapSnapshotModel.ComparatorConfig("selfSize",e,"!edgeName",!0);case"retainedSize":return new p.HeapSnapshotModel.ComparatorConfig("retainedSize",e,"!edgeName",!0);case"distance":return new p.HeapSnapshotModel.ComparatorConfig("distance",e,"name",!0)}}prefixObjectCell(e){let t=this.referenceName||"(empty)",i="name";switch(this.referenceType){case"context":i="object-value-number";break;case"internal":case"hidden":case"weak":i="object-value-null";break;case"element":t=`[${t}]`}this.cycledWithAncestorGridNode&&e.classList.add("cycled-ancessor-node"),e.prepend(s.Fragment.html`<span class="property-name ${i}">${t}</span> <span class="grayed">${this.edgeNodeSeparator()}</span>`)}edgeNodeSeparator(){return"::"}}class Xe extends Ze{constructor(e,t,i,r){super(e,t,i,r)}createProvider(){if(void 0===this.snapshotNodeIndex)throw new Error("Cannot create providers on root nodes");return this.snapshot.createRetainingEdgesProvider(this.snapshotNodeIndex)}createChildNode(e){return new Xe(this.dataGridInternal,this.snapshot,e,this)}edgeNodeSeparator(){return qe(Je.inElement)}expand(){this.expandRetainersChain(20)}expandRetainersChain(e){if(!this.populated)return this.once(Ke.Events.PopulateComplete).then((()=>this.expandRetainersChain(e))),void this.populate();if(super.expand(),--e>0&&this.children.length>0){const t=this.children[0];if((t.distance||0)>1)return void t.expandRetainersChain(e)}this.dataGridInternal.dispatchEventToListeners(pt.ExpandRetainersComplete)}}class et extends Ye{baseSnapshotOrSnapshot;isDeletedNode;constructor(t,i,r,s){super(t,r),this.baseSnapshotOrSnapshot=i,this.isDeletedNode=s,this.updateHasChildren();const o=this.data;o.count="",o.countDelta="",o.sizeDelta="",this.isDeletedNode?(o.addedCount="",o.addedSize="",o.removedCount="•",o.removedSize=e.NumberUtilities.withThousandsSeparator(this.shallowSize||0)):(o.addedCount="•",o.addedSize=e.NumberUtilities.withThousandsSeparator(this.shallowSize||0),o.removedCount="",o.removedSize="")}retainersDataSource(){return void 0===this.snapshotNodeIndex?null:{snapshot:this.baseSnapshotOrSnapshot,snapshotNodeIndex:this.snapshotNodeIndex}}createProvider(){if(void 0===this.snapshotNodeIndex)throw new Error("Cannot create providers on root nodes");return this.baseSnapshotOrSnapshot.createEdgesProvider(this.snapshotNodeIndex)}createChildNode(e){return new Ze(this.dataGridInternal,this.baseSnapshotOrSnapshot,e,null)}getHash(){if(void 0===this.snapshotNodeId)throw new Error("Cannot hash root nodes");return this.snapshotNodeId}comparator(){const e=this.dataGridInternal.isSortOrderAscending();switch(this.dataGridInternal.sortColumnId()){case"object":return new p.HeapSnapshotModel.ComparatorConfig("!edgeName",e,"retainedSize",!1);case"distance":return new p.HeapSnapshotModel.ComparatorConfig("distance",e,"retainedSize",!1);case"count":default:return new p.HeapSnapshotModel.ComparatorConfig("!edgeName",!0,"retainedSize",!1);case"addedSize":case"removedSize":case"shallowSize":return new p.HeapSnapshotModel.ComparatorConfig("selfSize",e,"!edgeName",!0);case"retainedSize":return new p.HeapSnapshotModel.ComparatorConfig("retainedSize",e,"!edgeName",!0)}}}class tt extends Ke{nameInternal;nodeFilter;distance;count;shallowSize;retainedSize;constructor(t,i,r,s){super(t,r.count>0),this.nameInternal=i,this.nodeFilter=s,this.distance=r.distance,this.count=r.count,this.shallowSize=r.self,this.retainedSize=r.maxRet;const o=t.snapshot,n=this.retainedSize/o.totalSize*100,a=this.shallowSize/o.totalSize*100;this.data={object:i,count:e.NumberUtilities.withThousandsSeparator(this.count),distance:this.toUIDistance(this.distance),shallowSize:e.NumberUtilities.withThousandsSeparator(this.shallowSize),retainedSize:e.NumberUtilities.withThousandsSeparator(this.retainedSize),"shallowSize-percent":this.toPercentString(a),"retainedSize-percent":this.toPercentString(n)}}get name(){return this.nameInternal}createProvider(){return this.dataGridInternal.snapshot.createNodesProviderForClass(this.nameInternal,this.nodeFilter)}async populateNodeBySnapshotObjectId(e){this.dataGridInternal.resetNameFilter(),await this.expandWithoutPopulate();const t=await this.provider().nodePosition(e);if(-1===t)return this.collapse(),[];await this.populateChildren(t,null);const i=this.childForPosition(t);return i?[this,i]:[]}filteredOut(e){return-1===this.nameInternal.toLowerCase().indexOf(e)}createCell(e){const t="object"===e?super.createCell(e):this.createValueCell(e);return"object"===e&&this.count>1&&t.appendChild(s.Fragment.html`<span class="objects-count">×${this.count}</span>`),t}createChildNode(e){return new et(this.dataGridInternal,this.dataGridInternal.snapshot,e,!1)}comparator(){const e=this.dataGridInternal.isSortOrderAscending(),t=this.dataGridInternal.sortColumnId();switch(t){case"object":return new p.HeapSnapshotModel.ComparatorConfig("name",e,"id",!0);case"distance":return new p.HeapSnapshotModel.ComparatorConfig("distance",e,"retainedSize",!1);case"shallowSize":return new p.HeapSnapshotModel.ComparatorConfig("selfSize",e,"id",!0);case"retainedSize":return new p.HeapSnapshotModel.ComparatorConfig("retainedSize",e,"id",!0);default:throw new Error(`Invalid sort column id ${t}`)}}}class it{addedNodesProvider;deletedNodesProvider;addedCount;removedCount;constructor(e,t,i,r){this.addedNodesProvider=e,this.deletedNodesProvider=t,this.addedCount=i,this.removedCount=r}dispose(){this.addedNodesProvider.dispose(),this.deletedNodesProvider.dispose()}nodePosition(e){throw new Error("Unreachable")}isEmpty(){return Promise.resolve(!1)}async serializeItemsRange(e,t){let i,r;if(e<this.addedCount){i=await this.addedNodesProvider.serializeItemsRange(e,t);for(const e of i.items)e.isAddedNotRemoved=!0;if(i.endPosition>=t)return i.totalLength=this.addedCount+this.removedCount,i;r=i,i=await this.deletedNodesProvider.serializeItemsRange(0,t-i.endPosition)}else r=new p.HeapSnapshotModel.ItemsRange(0,0,0,[]),i=await this.deletedNodesProvider.serializeItemsRange(e-this.addedCount,t-this.addedCount);r.items.length||(r.startPosition=this.addedCount+i.startPosition);for(const e of i.items)e.isAddedNotRemoved=!1;return r.items.push(...i.items),r.endPosition=this.addedCount+i.endPosition,r.totalLength=this.addedCount+this.removedCount,r}async sortAndRewind(e){await this.addedNodesProvider.sortAndRewind(e),await this.deletedNodesProvider.sortAndRewind(e)}}class rt extends Ke{nameInternal;addedCount;removedCount;countDelta;addedSize;removedSize;sizeDelta;deletedIndexes;constructor(t,i,r){super(t,!0),this.nameInternal=i,this.addedCount=r.addedCount,this.removedCount=r.removedCount,this.countDelta=r.countDelta,this.addedSize=r.addedSize,this.removedSize=r.removedSize,this.sizeDelta=r.sizeDelta,this.deletedIndexes=r.deletedIndexes,this.data={object:i,addedCount:e.NumberUtilities.withThousandsSeparator(this.addedCount),removedCount:e.NumberUtilities.withThousandsSeparator(this.removedCount),countDelta:this.signForDelta(this.countDelta)+e.NumberUtilities.withThousandsSeparator(Math.abs(this.countDelta)),addedSize:e.NumberUtilities.withThousandsSeparator(this.addedSize),removedSize:e.NumberUtilities.withThousandsSeparator(this.removedSize),sizeDelta:this.signForDelta(this.sizeDelta)+e.NumberUtilities.withThousandsSeparator(Math.abs(this.sizeDelta))}}get name(){return this.nameInternal}createProvider(){const e=this.dataGridInternal;if(null===e.snapshot||void 0===e.baseSnapshot||void 0===e.baseSnapshot.uid)throw new Error("Data sources have not been set correctly");const t=e.snapshot.createAddedNodesProvider(e.baseSnapshot.uid,this.nameInternal),i=e.baseSnapshot.createDeletedNodesProvider(this.deletedIndexes);if(!t||!i)throw new Error("Failed to create node providers");return new it(t,i,this.addedCount,this.removedCount)}createCell(e){const t=super.createCell(e);return"object"!==e&&t.classList.add("numeric-column"),t}createChildNode(e){const t=this.dataGridInternal;if(e.isAddedNotRemoved){if(null===t.snapshot)throw new Error("Data sources have not been set correctly");return new et(this.dataGridInternal,t.snapshot,e,!1)}if(void 0===t.baseSnapshot)throw new Error("Data sources have not been set correctly");return new et(this.dataGridInternal,t.baseSnapshot,e,!0)}comparator(){const e=this.dataGridInternal.isSortOrderAscending(),t=this.dataGridInternal.sortColumnId();switch(t){case"object":return new p.HeapSnapshotModel.ComparatorConfig("name",e,"id",!0);case"addedCount":case"removedCount":case"countDelta":return new p.HeapSnapshotModel.ComparatorConfig("name",!0,"id",!0);case"addedSize":case"removedSize":case"sizeDelta":return new p.HeapSnapshotModel.ComparatorConfig("selfSize",e,"id",!0);default:throw new Error(`Invalid sort column ${t}`)}}filteredOut(e){return-1===this.nameInternal.toLowerCase().indexOf(e)}signForDelta(e){return 0===e?"":e>0?"+":"−"}}class st extends Ke{populated;allocationNode;constructor(t,i){super(t,i.hasChildren),this.populated=!1,this.allocationNode=i,this.data={liveCount:e.NumberUtilities.withThousandsSeparator(i.liveCount),count:e.NumberUtilities.withThousandsSeparator(i.count),liveSize:e.NumberUtilities.withThousandsSeparator(i.liveSize),size:e.NumberUtilities.withThousandsSeparator(i.size),name:i.name}}populate(){this.populated||this.doPopulate()}async doPopulate(){this.populated=!0;const e=await this.dataGridInternal.snapshot.allocationNodeCallers(this.allocationNode.id),t=e.nodesWithSingleCaller;let i=this;const r=this.dataGridInternal;for(const e of t){const t=new st(r,e);r.appendNode(i,t),i=t,i.populated=!0,this.expanded&&i.expand()}const s=e.branchingCallers;s.sort(this.dataGridInternal.createComparator());for(const e of s)r.appendNode(i,new st(r,e));r.updateVisibleNodes(!0)}expand(){super.expand(),1===this.children.length&&this.children[0].expand()}createCell(e){if("name"!==e)return this.createValueCell(e);const t=super.createCell(e),i=this.allocationNode,r=this.dataGridInternal.heapProfilerModel();if(i.scriptId){const e=this.dataGridInternal.linkifier.linkifyScriptLocation(r?r.target():null,String(i.scriptId),i.scriptName,i.line-1,{columnNumber:i.column-1,inlineFrameIndex:0,className:"profile-node-file"});e.style.maxWidth="75%",t.insertBefore(e,t.firstChild)}return t}allocationNodeId(){return this.allocationNode.id}}var ot=Object.freeze({__proto__:null,get HeapSnapshotGridNode(){return Ke},HeapSnapshotGenericObjectNode:Ye,HeapSnapshotObjectNode:Ze,HeapSnapshotRetainingObjectNode:Xe,HeapSnapshotInstanceNode:et,HeapSnapshotConstructorNode:tt,HeapSnapshotDiffNodesProvider:it,HeapSnapshotDiffNode:rt,AllocationGridNode:st});const nt={distanceFromWindowObject:"Distance from window object",sizeOfTheObjectItselfInBytes:"Size of the object itself in bytes",sizeOfTheObjectPlusTheGraphIt:"Size of the object plus the graph it retains in bytes",object:"Object",distance:"Distance",shallowSize:"Shallow Size",retainedSize:"Retained Size",heapSnapshotRetainment:"Heap Snapshot Retainment",constructorString:"Constructor",heapSnapshotConstructors:"Heap Snapshot Constructors",New:"# New",Deleted:"# Deleted",Delta:"# Delta",allocSize:"Alloc. Size",freedSize:"Freed Size",sizeDelta:"Size Delta",heapSnapshotDiff:"Heap Snapshot Diff",liveCount:"Live Count",count:"Count",liveSize:"Live Size",size:"Size",function:"Function",allocation:"Allocation"},at=t.i18n.registerUIStrings("panels/profiler/HeapSnapshotDataGrids.ts",nt),lt=t.i18n.getLocalizedString.bind(void 0,at),dt=new WeakMap;class ht extends r.DataGrid.DataGridImpl{}class ct extends(o.ObjectWrapper.eventMixin(ht)){snapshot;selectedNode;heapProfilerModelInternal;dataDisplayDelegateInternal;recursiveSortingDepth;populatedAndSorted;nameFilter;nodeFilterInternal;lastSortColumnId;lastSortAscending;constructor(e,t,i){super(i),this.snapshot=null,this.selectedNode=null,this.heapProfilerModelInternal=e,this.dataDisplayDelegateInternal=t;const s=[["distance",lt(nt.distanceFromWindowObject)],["shallowSize",lt(nt.sizeOfTheObjectItselfInBytes)],["retainedSize",lt(nt.sizeOfTheObjectPlusTheGraphIt)]];for(const e of s){const t=this.headerTableHeader(e[0]);t&&t.setAttribute("title",e[1])}this.recursiveSortingDepth=0,this.populatedAndSorted=!1,this.nameFilter=null,this.nodeFilterInternal=new p.HeapSnapshotModel.NodeFilter,this.addEventListener(pt.SortingComplete,this.sortingComplete,this),this.addEventListener(r.DataGrid.Events.SortingChanged,this.sortingChanged,this),this.setRowContextMenuCallback(this.populateContextMenu.bind(this))}async setDataSource(e,t){}isFilteredOut(e){const t=this.nameFilter?this.nameFilter.value().toLowerCase():"";return!!(t&&(e instanceof rt||e instanceof tt)&&e.filteredOut(t))}heapProfilerModel(){return this.heapProfilerModelInternal}dataDisplayDelegate(){return this.dataDisplayDelegateInternal}nodeFilter(){return this.nodeFilterInternal}setNameFilter(e){this.nameFilter=e}defaultPopulateCount(){return 100}disposeAllNodes(){const e=this.topLevelNodes();for(let t=0,i=e.length;t<i;++t)e[t].dispose()}wasShown(){this.nameFilter&&(this.nameFilter.addEventListener(s.Toolbar.ToolbarInput.Event.TextChanged,this.onNameFilterChanged,this),this.updateVisibleNodes(!0)),this.populatedAndSorted&&this.dispatchEventToListeners(pt.ContentShown,this)}sortingComplete(){this.removeEventListener(pt.SortingComplete,this.sortingComplete,this),this.populatedAndSorted=!0,this.dispatchEventToListeners(pt.ContentShown,this)}willHide(){this.nameFilter&&this.nameFilter.removeEventListener(s.Toolbar.ToolbarInput.Event.TextChanged,this.onNameFilterChanged,this)}populateContextMenu(e,t){const i=t;i.populateContextMenu(e,this.dataDisplayDelegateInternal,this.heapProfilerModel()),i instanceof Ye&&i.linkElement&&!e.containsTarget(i.linkElement)&&e.appendApplicableItems(i.linkElement)}resetSortingCache(){delete this.lastSortColumnId,delete this.lastSortAscending}topLevelNodes(){return this.rootNode().children}revealObjectByHeapSnapshotId(e){return Promise.resolve(null)}resetNameFilter(){this.nameFilter&&this.nameFilter.setValue("")}onNameFilterChanged(){this.updateVisibleNodes(!0),this.deselectFilteredNodes()}deselectFilteredNodes(){let e=this.selectedNode;for(;e;){if(this.selectedNode&&this.isFilteredOut(e))return this.selectedNode.deselect(),void(this.selectedNode=null);e=e.parent}}sortFields(e,t){throw new Error("Not implemented")}sortingChanged(){const e=this.isSortOrderAscending(),t=this.sortColumnId();if(this.lastSortColumnId===t&&this.lastSortAscending===e)return;this.lastSortColumnId=t,this.lastSortAscending=e;const i=this.sortFields(t||"",e);this.performSorting((function(e,t){let r=e[i.fieldName1],s=t[i.fieldName1],o=r<s?-1:r>s?1:0;return i.ascending1||(o=-o),0!==o||(r=e[i.fieldName2],s=t[i.fieldName2],o=r<s?-1:r>s?1:0,i.ascending2||(o=-o)),o}))}performSorting(e){this.recursiveSortingEnter();const t=this.allChildren(this.rootNode());this.rootNode().removeChildren(),t.sort(e);for(let e=0,i=t.length;e<i;++e){const i=t[e];this.appendChildAfterSorting(i),i.expanded&&i.sort()}this.recursiveSortingLeave()}appendChildAfterSorting(e){const t=e.revealed;this.rootNode().appendChild(e),e.revealed=t}recursiveSortingEnter(){++this.recursiveSortingDepth}recursiveSortingLeave(){this.recursiveSortingDepth&&(--this.recursiveSortingDepth||(this.updateVisibleNodes(!0),this.dispatchEventToListeners(pt.SortingComplete)))}updateVisibleNodes(e){}allChildren(e){return e.children}insertChild(e,t,i){e.insertChild(t,i)}removeChildByIndex(e,t){e.removeChild(e.children[t])}removeAllChildren(e){e.removeChildren()}}var pt,ut;!function(e){e.ContentShown="ContentShown",e.SortingComplete="SortingComplete",e.ExpandRetainersComplete="ExpandRetainersComplete"}(pt||(pt={}));class mt extends ct{topPaddingHeight;bottomPaddingHeight;selectedNode;scrollToResolveCallback;constructor(e,t,i){super(e,t,i),this.scrollContainer.addEventListener("scroll",this.onScroll.bind(this),!0),this.topPaddingHeight=0,this.bottomPaddingHeight=0,this.selectedNode=null}topLevelNodes(){return this.allChildren(this.rootNode())}appendChildAfterSorting(e){}updateVisibleNodes(e){const t=this.scrollContainer.scrollHeight;let i=this.scrollContainer.scrollTop,r=t-i-this.scrollContainer.offsetHeight;i=Math.max(0,i-40),r=Math.max(0,r-40);let s=t-i-r;if(!e&&i>=this.topPaddingHeight&&r>=this.bottomPaddingHeight)return;i-=500,s+=1e3;const o=this.selectedNode;this.rootNode().removeChildren(),this.topPaddingHeight=0,this.bottomPaddingHeight=0,this.addVisibleNodes(this.rootNode(),i,i+s),this.setVerticalPadding(this.topPaddingHeight,this.bottomPaddingHeight),o&&(o.parent?o.select(!0):this.selectedNode=o)}addVisibleNodes(e,t,i){if(!e.expanded)return 0;const r=this.allChildren(e);let s=0,o=0;for(;o<r.length;++o){const e=r[o];if(this.isFilteredOut(e))continue;const i=s+this.nodeHeight(e);if(i>t)break;s=i}let n=s;for(;o<r.length&&n<i;++o){const s=r[o];if(this.isFilteredOut(s))continue;const a=s.hasChildren();s.removeChildren(),s.setHasChildren(a),e.appendChild(s),n+=s.nodeSelfHeight(),n+=this.addVisibleNodes(s,t-n,i-n)}let a=0;for(;o<r.length;++o){const e=r[o];this.isFilteredOut(e)||(a+=this.nodeHeight(e))}return this.topPaddingHeight+=s,this.bottomPaddingHeight+=a,n+a}nodeHeight(e){let t=e.nodeSelfHeight();if(!e.expanded)return t;const i=this.allChildren(e);for(let e=0;e<i.length;e++)t+=this.nodeHeight(i[e]);return t}revealTreeNode(e){const t=this.calculateOffset(e),i=e[e.length-1],r=this.scrollContainer.scrollTop,s=r+this.scrollContainer.offsetHeight;if(t>=r&&t<s)return Promise.resolve(i);return this.scrollContainer.scrollTop=Math.max(0,t-40),new Promise((e=>{console.assert(!this.scrollToResolveCallback),this.scrollToResolveCallback=e.bind(null,i),this.scrollContainer.window().requestAnimationFrame((()=>{this.scrollToResolveCallback&&(this.scrollToResolveCallback(),this.scrollToResolveCallback=null)}))}))}calculateOffset(e){let t=this.rootNode(),i=0;if(0===e.length)return 0;for(let r=0;r<e.length;++r){const s=e[r],o=this.allChildren(t);for(let e=0;e<o.length;++e){const t=o[e];if(s===t){i+=s.nodeSelfHeight();break}i+=this.nodeHeight(t)}t=s}return i-e[e.length-1].nodeSelfHeight()}allChildren(e){const t=dt.get(e)||[];return dt.has(e)||dt.set(e,t),t}appendNode(e,t){this.allChildren(e).push(t)}insertChild(e,t,i){this.allChildren(e).splice(i,0,t)}removeChildByIndex(e,t){this.allChildren(e).splice(t,1)}removeAllChildren(e){dt.delete(e)}removeTopLevelNodes(){this.disposeAllNodes(),this.rootNode().removeChildren(),this.removeAllChildren(this.rootNode())}isScrolledIntoView(e){const t=this.scrollContainer.scrollTop,i=t+this.scrollContainer.clientHeight,r=e.offsetTop;return r+e.offsetHeight<=i&&r>=t}onResize(){super.onResize(),this.updateVisibleNodes(!1)}onScroll(e){this.updateVisibleNodes(!1),this.scrollToResolveCallback&&(this.scrollToResolveCallback(),this.scrollToResolveCallback=null)}}class ft extends ct{constructor(e,t,i,s){super(e,t,{displayName:i,columns:s=s||[{id:"object",title:lt(nt.object),disclosure:!0,sortable:!0},{id:"distance",title:lt(nt.distance),width:"70px",sortable:!0,fixedWidth:!0},{id:"shallowSize",title:lt(nt.shallowSize),width:"110px",sortable:!0,fixedWidth:!0},{id:"retainedSize",title:lt(nt.retainedSize),width:"110px",sortable:!0,fixedWidth:!0,sort:r.DataGrid.Order.Descending}]})}async setDataSource(e,t){this.snapshot=e;const i=new p.HeapSnapshotModel.Node(-1,"root",0,t||e.rootNodeIndex,0,0,"");this.setRootNode(this.createRootNode(e,i)),this.rootNode().sort()}createRootNode(e,t){const i=new p.HeapSnapshotModel.Edge("",t,"",-1);return new Ze(this,e,i,null)}sortingChanged(){const e=this.rootNode();e.hasChildren()&&e.sort()}}class gt extends ft{constructor(e,t){const i=[{id:"object",title:lt(nt.object),disclosure:!0,sortable:!0},{id:"distance",title:lt(nt.distance),width:"70px",sortable:!0,fixedWidth:!0,sort:r.DataGrid.Order.Ascending},{id:"shallowSize",title:lt(nt.shallowSize),width:"110px",sortable:!0,fixedWidth:!0},{id:"retainedSize",title:lt(nt.retainedSize),width:"110px",sortable:!0,fixedWidth:!0}];super(e,t,lt(nt.heapSnapshotRetainment),i)}createRootNode(e,t){const i=new p.HeapSnapshotModel.Edge("",t,"",-1);return new Xe(this,e,i,null)}sortFields(e,t){switch(e){case"object":return new p.HeapSnapshotModel.ComparatorConfig("name",t,"count",!1);case"count":return new p.HeapSnapshotModel.ComparatorConfig("count",t,"name",!0);case"shallowSize":return new p.HeapSnapshotModel.ComparatorConfig("shallowSize",t,"name",!0);case"retainedSize":return new p.HeapSnapshotModel.ComparatorConfig("retainedSize",t,"name",!0);case"distance":return new p.HeapSnapshotModel.ComparatorConfig("distance",t,"name",!0);default:throw new Error(`Unknown column ${e}`)}}reset(){this.rootNode().removeChildren(),this.resetSortingCache()}async setDataSource(e,t){await super.setDataSource(e,t),this.rootNode().expand()}}!function(e){e.ExpandRetainersComplete="ExpandRetainersComplete"}(ut||(ut={}));class vt extends mt{profileIndex;objectIdToSelect;nextRequestedFilter;lastFilter;filterInProgress;constructor(e,t){const i=[{id:"object",title:lt(nt.constructorString),disclosure:!0,sortable:!0},{id:"distance",title:lt(nt.distance),width:"70px",sortable:!0,fixedWidth:!0},{id:"shallowSize",title:lt(nt.shallowSize),width:"110px",sortable:!0,fixedWidth:!0},{id:"retainedSize",title:lt(nt.retainedSize),width:"110px",sort:r.DataGrid.Order.Descending,sortable:!0,fixedWidth:!0}];super(e,t,{displayName:lt(nt.heapSnapshotConstructors).toString(),columns:i}),this.profileIndex=-1,this.objectIdToSelect=null,this.nextRequestedFilter=null}sortFields(e,t){switch(e){case"object":return new p.HeapSnapshotModel.ComparatorConfig("name",t,"retainedSize",!1);case"distance":return new p.HeapSnapshotModel.ComparatorConfig("distance",t,"retainedSize",!1);case"shallowSize":return new p.HeapSnapshotModel.ComparatorConfig("shallowSize",t,"name",!0);case"retainedSize":return new p.HeapSnapshotModel.ComparatorConfig("retainedSize",t,"name",!0);default:throw new Error(`Unknown column ${e}`)}}async revealObjectByHeapSnapshotId(e){if(!this.snapshot)return this.objectIdToSelect=e,null;const t=await this.snapshot.nodeClassName(parseInt(e,10));if(!t)return null;const i=this.topLevelNodes().find((e=>e.name===t));if(!i)return null;const r=await i.populateNodeBySnapshotObjectId(parseInt(e,10));return r.length?this.revealTreeNode(r):null}clear(){this.nextRequestedFilter=null,this.lastFilter=null,this.removeTopLevelNodes()}async setDataSource(e,t){this.snapshot=e,-1===this.profileIndex&&this.populateChildren(),this.objectIdToSelect&&(this.revealObjectByHeapSnapshotId(this.objectIdToSelect),this.objectIdToSelect=null)}setSelectionRange(e,t){this.nodeFilterInternal=new p.HeapSnapshotModel.NodeFilter(e,t),this.populateChildren(this.nodeFilterInternal)}setAllocationNodeId(e){this.nodeFilterInternal=new p.HeapSnapshotModel.NodeFilter,this.nodeFilterInternal.allocationNodeId=e,this.populateChildren(this.nodeFilterInternal)}aggregatesReceived(e,t){this.filterInProgress=null,this.nextRequestedFilter&&this.snapshot&&(this.snapshot.aggregatesWithFilter(this.nextRequestedFilter).then(this.aggregatesReceived.bind(this,this.nextRequestedFilter)),this.filterInProgress=this.nextRequestedFilter,this.nextRequestedFilter=null),this.removeTopLevelNodes(),this.resetSortingCache();for(const i in t)this.appendNode(this.rootNode(),new tt(this,i,t[i],e));this.sortingChanged(),this.lastFilter=e}async populateChildren(e){const t=e||new p.HeapSnapshotModel.NodeFilter;if(this.filterInProgress)this.nextRequestedFilter=this.filterInProgress.equals(t)?null:t;else if((!this.lastFilter||!this.lastFilter.equals(t))&&(this.filterInProgress=t,this.snapshot)){const e=await this.snapshot.aggregatesWithFilter(t);this.aggregatesReceived(t,e)}}filterSelectIndexChanged(e,t){if(this.profileIndex=t,this.nodeFilterInternal=void 0,-1!==t){const i=t>0?e[t-1].maxJSObjectId:0,r=e[t].maxJSObjectId;this.nodeFilterInternal=new p.HeapSnapshotModel.NodeFilter(i,r)}this.populateChildren(this.nodeFilterInternal)}}class wt extends mt{baseSnapshot;constructor(e,t){const i=[{id:"object",title:lt(nt.constructorString),disclosure:!0,sortable:!0},{id:"addedCount",title:lt(nt.New),width:"75px",sortable:!0,fixedWidth:!0},{id:"removedCount",title:lt(nt.Deleted),width:"75px",sortable:!0,fixedWidth:!0},{id:"countDelta",title:lt(nt.Delta),width:"65px",sortable:!0,fixedWidth:!0},{id:"addedSize",title:lt(nt.allocSize),width:"75px",sortable:!0,fixedWidth:!0,sort:r.DataGrid.Order.Descending},{id:"removedSize",title:lt(nt.freedSize),width:"75px",sortable:!0,fixedWidth:!0},{id:"sizeDelta",title:lt(nt.sizeDelta),width:"75px",sortable:!0,fixedWidth:!0}];super(e,t,{displayName:lt(nt.heapSnapshotDiff).toString(),columns:i})}defaultPopulateCount(){return 50}sortFields(e,t){switch(e){case"object":return new p.HeapSnapshotModel.ComparatorConfig("name",t,"count",!1);case"addedCount":return new p.HeapSnapshotModel.ComparatorConfig("addedCount",t,"name",!0);case"removedCount":return new p.HeapSnapshotModel.ComparatorConfig("removedCount",t,"name",!0);case"countDelta":return new p.HeapSnapshotModel.ComparatorConfig("countDelta",t,"name",!0);case"addedSize":return new p.HeapSnapshotModel.ComparatorConfig("addedSize",t,"name",!0);case"removedSize":return new p.HeapSnapshotModel.ComparatorConfig("removedSize",t,"name",!0);case"sizeDelta":return new p.HeapSnapshotModel.ComparatorConfig("sizeDelta",t,"name",!0);default:throw new Error(`Unknown column ${e}`)}}async setDataSource(e,t){this.snapshot=e}setBaseDataSource(e){this.baseSnapshot=e,this.removeTopLevelNodes(),this.resetSortingCache(),this.baseSnapshot!==this.snapshot?this.populateChildren():this.dispatchEventToListeners(pt.SortingComplete)}async populateChildren(){if(null===this.snapshot||void 0===this.baseSnapshot||void 0===this.baseSnapshot.uid)throw new Error("Data sources have not been set correctly");const e=await this.baseSnapshot.aggregatesForDiff(),t=await this.snapshot.calculateSnapshotDiff(this.baseSnapshot.uid,e);for(const e in t){const i=t[e];this.appendNode(this.rootNode(),new rt(this,e,i))}this.sortingChanged()}}class St extends mt{linkifierInternal;topNodes;constructor(e,t){const i=[{id:"liveCount",title:lt(nt.liveCount),width:"75px",sortable:!0,fixedWidth:!0},{id:"count",title:lt(nt.count),width:"65px",sortable:!0,fixedWidth:!0},{id:"liveSize",title:lt(nt.liveSize),width:"75px",sortable:!0,fixedWidth:!0},{id:"size",title:lt(nt.size),width:"75px",sortable:!0,fixedWidth:!0,sort:r.DataGrid.Order.Descending},{id:"name",title:lt(nt.function),disclosure:!0,sortable:!0}];super(e,t,{displayName:lt(nt.allocation).toString(),columns:i}),this.linkifierInternal=new d.Linkifier.Linkifier}get linkifier(){return this.linkifierInternal}dispose(){this.linkifierInternal.reset()}async setDataSource(e,t){this.snapshot=e,this.topNodes=await this.snapshot.allocationTracesTops(),this.populateChildren()}populateChildren(){this.removeTopLevelNodes();const e=this.rootNode(),t=this.topNodes||[];for(const i of t)this.appendNode(e,new st(this,i));this.updateVisibleNodes(!0)}sortingChanged(){void 0!==this.topNodes&&(this.topNodes.sort(this.createComparator()),this.rootNode().removeChildren(),this.populateChildren())}createComparator(){const e=this.sortColumnId(),t=this.sortOrder()===r.DataGrid.Order.Ascending?1:-1;return function(i,r){return i[e]>r[e]?t:i[e]<r[e]?-t:0}}}var bt=Object.freeze({__proto__:null,HeapSnapshotSortableDataGrid:ct,get HeapSnapshotSortableDataGridEvents(){return pt},HeapSnapshotViewportDataGrid:mt,HeapSnapshotContainmentDataGrid:ft,HeapSnapshotRetainmentDataGrid:gt,get HeapSnapshotRetainmentDataGridEvents(){return ut},HeapSnapshotConstructorsDataGrid:vt,HeapSnapshotDiffDataGrid:wt,AllocationDataGrid:St});const Ct={anErrorOccurredWhenACallToMethod:"An error occurred when a call to method ''{PH1}'' was requested"},Pt=t.i18n.registerUIStrings("panels/profiler/HeapSnapshotProxy.ts",Ct),Tt=t.i18n.getLocalizedString.bind(void 0,Pt);class xt extends o.ObjectWrapper.ObjectWrapper{eventHandler;nextObjectId;nextCallId;callbacks;previousCallbacks;worker;interval;constructor(e){super(),this.eventHandler=e,this.nextObjectId=1,this.nextCallId=1,this.callbacks=new Map,this.previousCallbacks=new Set,this.worker=o.Worker.WorkerWrapper.fromURL(new URL("../../entrypoints/heap_snapshot_worker/heap_snapshot_worker-legacy.js",import.meta.url)),this.worker.onmessage=this.messageReceived.bind(this)}createLoader(e,t){const i=this.nextObjectId++,r=new It(this,i,e,t);return this.postMessage({callId:this.nextCallId++,disposition:"create",objectId:i,methodName:"HeapSnapshotWorker.HeapSnapshotLoader"}),r}dispose(){this.worker.terminate(),this.interval&&clearInterval(this.interval)}disposeObject(e){this.postMessage({callId:this.nextCallId++,disposition:"dispose",objectId:e})}evaluateForTest(e,t){const i=this.nextCallId++;this.callbacks.set(i,t),this.postMessage({callId:i,disposition:"evaluateForTest",source:e})}callFactoryMethod(e,t,i,r){const s=this.nextCallId++,o=Array.prototype.slice.call(arguments,4),n=this.nextObjectId++;return e?(this.callbacks.set(s,(t=>{e(t?new r(this,n):null)})),this.postMessage({callId:s,disposition:"factory",objectId:t,methodName:i,methodArguments:o,newObjectId:n}),null):(this.postMessage({callId:s,disposition:"factory",objectId:t,methodName:i,methodArguments:o,newObjectId:n}),new r(this,n))}callMethod(e,t,i){const r=this.nextCallId++,s=Array.prototype.slice.call(arguments,3);e&&this.callbacks.set(r,e),this.postMessage({callId:r,disposition:"method",objectId:t,methodName:i,methodArguments:s})}startCheckingForLongRunningCalls(){this.interval||(this.checkLongRunningCalls(),this.interval=window.setInterval(this.checkLongRunningCalls.bind(this),300))}checkLongRunningCalls(){for(const e of this.previousCallbacks)this.callbacks.has(e)||this.previousCallbacks.delete(e);const e=Boolean(this.previousCallbacks.size);this.dispatchEventToListeners("Wait",e);for(const e of this.callbacks.keys())this.previousCallbacks.add(e)}messageReceived(e){const t=e.data;if(t.eventName)return void(this.eventHandler&&this.eventHandler(t.eventName,t.data));if(t.error)return t.errorMethodName&&o.Console.Console.instance().error(Tt(Ct.anErrorOccurredWhenACallToMethod,{PH1:t.errorMethodName})),o.Console.Console.instance().error(t.errorCallStack),void this.callbacks.delete(t.callId);const i=this.callbacks.get(t.callId);i&&(this.callbacks.delete(t.callId),i(t.result))}postMessage(e){this.worker.postMessage(e)}}class yt{worker;objectId;constructor(e,t){this.worker=e,this.objectId=t}callWorker(e,t){t.splice(1,0,this.objectId);const i=this.worker[e];if(!i)throw new Error(`Could not find worker with name ${e}.`);return i.apply(this.worker,t)}dispose(){this.worker.disposeObject(this.objectId)}disposeWorker(){this.worker.dispose()}callFactoryMethod(e,t,i,...r){return this.callWorker("callFactoryMethod",Array.prototype.slice.call(arguments,0))}callMethodPromise(e,...t){const i=Array.prototype.slice.call(arguments);return new Promise((e=>this.callWorker("callMethod",[e,...i])))}}class It extends yt{profileUid;snapshotReceivedCallback;constructor(e,t,i,r){super(e,t),this.profileUid=i,this.snapshotReceivedCallback=r}async write(e){await this.callMethodPromise("write",e)}async close(){await this.callMethodPromise("close");const e=await new Promise((e=>this.callFactoryMethod(e,"buildSnapshot",Rt)));this.dispose(),e.setProfileUid(this.profileUid),await e.updateStaticData(),this.snapshotReceivedCallback(e)}}class Rt extends yt{staticData;profileUid;constructor(e,t){super(e,t),this.staticData=null}search(e,t){return this.callMethodPromise("search",e,t)}aggregatesWithFilter(e){return this.callMethodPromise("aggregatesWithFilter",e)}aggregatesForDiff(){return this.callMethodPromise("aggregatesForDiff")}calculateSnapshotDiff(e,t){return this.callMethodPromise("calculateSnapshotDiff",e,t)}nodeClassName(e){return this.callMethodPromise("nodeClassName",e)}createEdgesProvider(e){return this.callFactoryMethod(null,"createEdgesProvider",Et,e)}createRetainingEdgesProvider(e){return this.callFactoryMethod(null,"createRetainingEdgesProvider",Et,e)}createAddedNodesProvider(e,t){return this.callFactoryMethod(null,"createAddedNodesProvider",Et,e,t)}createDeletedNodesProvider(e){return this.callFactoryMethod(null,"createDeletedNodesProvider",Et,e)}createNodesProvider(e){return this.callFactoryMethod(null,"createNodesProvider",Et,e)}createNodesProviderForClass(e,t){return this.callFactoryMethod(null,"createNodesProviderForClass",Et,e,t)}allocationTracesTops(){return this.callMethodPromise("allocationTracesTops")}allocationNodeCallers(e){return this.callMethodPromise("allocationNodeCallers",e)}allocationStack(e){return this.callMethodPromise("allocationStack",e)}dispose(){throw new Error("Should never be called")}get nodeCount(){return this.staticData?this.staticData.nodeCount:0}get rootNodeIndex(){return this.staticData?this.staticData.rootNodeIndex:0}async updateStaticData(){this.staticData=await this.callMethodPromise("updateStaticData")}getStatistics(){return this.callMethodPromise("getStatistics")}getLocation(e){return this.callMethodPromise("getLocation",e)}getSamples(){return this.callMethodPromise("getSamples")}get totalSize(){return this.staticData?this.staticData.totalSize:0}get uid(){return this.profileUid}setProfileUid(e){this.profileUid=e}maxJSObjectId(){return this.staticData?this.staticData.maxJSObjectId:0}}class Et extends yt{constructor(e,t){super(e,t)}nodePosition(e){return this.callMethodPromise("nodePosition",e)}isEmpty(){return this.callMethodPromise("isEmpty")}serializeItemsRange(e,t){return this.callMethodPromise("serializeItemsRange",e,t)}async sortAndRewind(e){await this.callMethodPromise("sortAndRewind",e)}}var Nt=Object.freeze({__proto__:null,HeapSnapshotWorkerProxy:xt,HeapSnapshotProxyObject:yt,HeapSnapshotLoaderProxy:It,HeapSnapshotProxy:Rt,HeapSnapshotProviderProxy:Et});const kt={find:"Find",containment:"Containment",retainers:"Retainers",allocationStack:"Allocation stack",perspective:"Perspective",baseSnapshot:"Base snapshot",filter:"Filter",classFilter:"Class filter",code:"Code",strings:"Strings",jsArrays:"JS arrays",typedArrays:"Typed arrays",systemObjects:"System objects",selectedSizeS:"Selected size: {PH1}",allObjects:"All objects",objectsAllocatedBeforeS:"Objects allocated before {PH1}",objectsAllocatedBetweenSAndS:"Objects allocated between {PH1} and {PH2}",summary:"Summary",comparison:"Comparison",allocation:"Allocation",liveObjects:"Live objects",statistics:"Statistics",heapSnapshot:"Heap snapshot",takeHeapSnapshot:"Take heap snapshot",heapSnapshots:"HEAP SNAPSHOTS",heapSnapshotProfilesShowMemory:"Heap snapshot profiles show memory distribution among your page's JavaScript objects and related DOM nodes.",exposeInternals:"Expose internals (includes additional implementation-specific details)",captureNumericValue:"Include numerical values in capture",snapshotting:"Snapshotting…",snapshotD:"Snapshot {PH1}",percentagePlaceholder:"{PH1}%",allocationInstrumentationOn:"Allocation instrumentation on timeline",stopRecordingHeapProfile:"Stop recording heap profile",startRecordingHeapProfile:"Start recording heap profile",recordAllocationStacksExtra:"Record stack traces of allocations (extra performance overhead)",recording:"Recording…",allocationTimelines:"ALLOCATION TIMELINES",AllocationTimelinesShowInstrumented:"Allocation timelines show instrumented JavaScript memory allocations over time. Once profile is recorded you can select a time interval to see objects that were allocated within it and still alive by the end of recording. Use this profile type to isolate memory leaks.",loading:"Loading…",savingD:"Saving… {PH1}%",sKb:"{PH1} kB",heapMemoryUsage:"Heap memory usage",stackWasNotRecordedForThisObject:"Stack was not recorded for this object because it had been allocated before this profile recording started."},Dt=t.i18n.registerUIStrings("panels/profiler/HeapSnapshotView.ts",kt),Mt=t.i18n.getLocalizedString.bind(void 0,Dt),Ft=t.i18n.registerUIStrings("panels/profiler/ModuleUIStrings.ts",{buildingEdgeIndexes:"Building edge indexes…",buildingRetainers:"Building retainers…",propagatingDomState:"Propagating DOM state…",calculatingNodeFlags:"Calculating node flags…",calculatingDistances:"Calculating distances…",buildingPostorderIndex:"Building postorder index…",buildingDominatorTree:"Building dominator tree…",calculatingRetainedSizes:"Calculating retained sizes…",buildingDominatedNodes:"Building dominated nodes…",calculatingStatistics:"Calculating statistics…",calculatingSamples:"Calculating samples…",buildingLocations:"Building locations…",finishedProcessing:"Finished processing.",buildingAllocationStatistics:"Building allocation statistics…",done:"Done",processingSnapshot:"Processing snapshot…",parsingStrings:"Parsing strings…",loadingSnapshotInfo:"Loading snapshot info…",loadingNodesD:"Loading nodes… {PH1}%",loadingEdgesD:"Loading edges… {PH1}%",loadingAllocationTracesD:"Loading allocation traces… {PH1}%",loadingSamples:"Loading samples…",loadingLocations:"Loading locations…",loadingStrings:"Loading strings…"}),Ht=t.i18n.getLocalizedString.bind(void 0,Ft);class Lt extends s.View.SimpleView{searchResults;profile;linkifier;parentDataDisplayDelegate;searchableViewInternal;splitWidget;containmentDataGrid;containmentWidget;statisticsView;constructorsDataGrid;constructorsWidget;diffDataGrid;diffWidget;allocationDataGrid;allocationWidget;allocationStackView;tabbedPane;retainmentDataGrid;retainmentWidget;objectDetailsView;perspectives;comparisonPerspective;perspectiveSelect;baseSelect;filterSelect;classNameFilter;selectedSizeText;popoverHelper;currentPerspectiveIndex;currentPerspective;dataGrid;searchThrottler;baseProfile;trackingOverviewGrid;currentSearchResultIndex=-1;currentQuery;constructor(e,t){super(Mt(kt.heapSnapshot)),this.searchResults=[],this.element.classList.add("heap-snapshot-view"),this.profile=t,this.linkifier=new d.Linkifier.Linkifier;const i=t.profileType();i.addEventListener("SnapshotReceived",this.onReceiveSnapshot,this),i.addEventListener(D.RemoveProfileHeader,this.onProfileHeaderRemoved,this);const n=i.id===At.TypeId;n&&this.createOverview();const a=Kt.trackingHeapSnapshotProfileType.recordAllocationStacksSetting().get();this.parentDataDisplayDelegate=e,this.searchableViewInternal=new s.SearchableView.SearchableView(this,null),this.searchableViewInternal.setPlaceholder(Mt(kt.find),Mt(kt.find)),this.searchableViewInternal.show(this.element),this.splitWidget=new s.SplitWidget.SplitWidget(!1,!0,"heapSnapshotSplitViewState",200,200),this.splitWidget.show(this.searchableViewInternal.element);const l=t.heapProfilerModel();let h;if(this.containmentDataGrid=new ft(l,this,Mt(kt.containment)),this.containmentDataGrid.addEventListener(r.DataGrid.Events.SelectedNode,this.selectionChanged,this),this.containmentWidget=this.containmentDataGrid.asWidget(),this.containmentWidget.setMinimumSize(50,25),this.statisticsView=new _t,this.constructorsDataGrid=new vt(l,this),this.constructorsDataGrid.addEventListener(r.DataGrid.Events.SelectedNode,this.selectionChanged,this),this.constructorsWidget=this.constructorsDataGrid.asWidget(),this.constructorsWidget.setMinimumSize(50,25),this.diffDataGrid=new wt(l,this),this.diffDataGrid.addEventListener(r.DataGrid.Events.SelectedNode,this.selectionChanged,this),this.diffWidget=this.diffDataGrid.asWidget(),this.diffWidget.setMinimumSize(50,25),this.allocationDataGrid=null,n&&a&&(this.allocationDataGrid=new St(l,this),this.allocationDataGrid.addEventListener(r.DataGrid.Events.SelectedNode,this.onSelectAllocationNode,this),this.allocationWidget=this.allocationDataGrid.asWidget(),this.allocationWidget.setMinimumSize(50,25),this.allocationStackView=new Jt(l),this.allocationStackView.setMinimumSize(50,25),this.tabbedPane=new s.TabbedPane.TabbedPane),this.retainmentDataGrid=new gt(l,this),this.retainmentWidget=this.retainmentDataGrid.asWidget(),this.retainmentWidget.setMinimumSize(50,21),this.retainmentWidget.element.classList.add("retaining-paths-view"),this.allocationStackView)this.tabbedPane=new s.TabbedPane.TabbedPane,this.tabbedPane.appendTab("retainers",Mt(kt.retainers),this.retainmentWidget),this.tabbedPane.appendTab("allocation-stack",Mt(kt.allocationStack),this.allocationStackView),h=this.tabbedPane.headerElement(),this.objectDetailsView=this.tabbedPane;else{const e=document.createElement("div");e.classList.add("heap-snapshot-view-resizer");const t=e.createChild("div","title");e.createChild("div","verticalResizerIcon");t.createChild("span").textContent=Mt(kt.retainers),h=e,this.objectDetailsView=new s.Widget.VBox,this.objectDetailsView.element.appendChild(e),this.retainmentWidget.show(this.objectDetailsView.element)}this.splitWidget.hideDefaultResizer(),this.splitWidget.installResizer(h),this.retainmentDataGrid.addEventListener(r.DataGrid.Events.SelectedNode,this.inspectedObjectChanged,this),this.retainmentDataGrid.reset(),this.perspectives=[],this.comparisonPerspective=new zt,this.perspectives.push(new Ot),t.profileType()!==Kt.trackingHeapSnapshotProfileType&&this.perspectives.push(this.comparisonPerspective),this.perspectives.push(new Bt),this.allocationWidget&&this.perspectives.push(new Gt),this.perspectives.push(new Vt),this.perspectiveSelect=new s.Toolbar.ToolbarComboBox(this.onSelectedPerspectiveChanged.bind(this),Mt(kt.perspective)),this.updatePerspectiveOptions(),this.baseSelect=new s.Toolbar.ToolbarComboBox(this.changeBase.bind(this),Mt(kt.baseSnapshot)),this.baseSelect.setVisible(!1),this.updateBaseOptions(),this.filterSelect=new s.Toolbar.ToolbarComboBox(this.changeFilter.bind(this),Mt(kt.filter)),this.filterSelect.setVisible(!1),this.updateFilterOptions(),this.classNameFilter=new s.Toolbar.ToolbarInput(Mt(kt.classFilter)),this.classNameFilter.setVisible(!1),this.constructorsDataGrid.setNameFilter(this.classNameFilter),this.diffDataGrid.setNameFilter(this.classNameFilter),this.selectedSizeText=new s.Toolbar.ToolbarText,this.popoverHelper=new s.PopoverHelper.PopoverHelper(this.element,this.getPopoverRequest.bind(this)),this.popoverHelper.setDisableOnClick(!0),this.popoverHelper.setHasPadding(!0),this.element.addEventListener("scroll",this.popoverHelper.hidePopover.bind(this.popoverHelper),!0),this.currentPerspectiveIndex=0,this.currentPerspective=this.perspectives[0],this.currentPerspective.activate(this),this.dataGrid=this.currentPerspective.masterGrid(this),this.populate(),this.searchThrottler=new o.Throttler.Throttler(0);for(const e of this.profiles())e.addEventListener(k.ProfileTitleChanged,this.updateControls,this)}createOverview(){const e=this.profile.profileType();this.trackingOverviewGrid=new Re,this.trackingOverviewGrid.addEventListener("IdsRangeChanged",this.onIdsRangeChanged.bind(this)),this.profile.fromFile()||e.profileBeingRecorded()!==this.profile||(e.addEventListener("HeapStatsUpdate",this.onHeapStatsUpdate,this),e.addEventListener("TrackingStopped",this.onStopTracking,this),this.trackingOverviewGrid.start())}onStopTracking(){const e=this.profile.profileType();e.removeEventListener("HeapStatsUpdate",this.onHeapStatsUpdate,this),e.removeEventListener("TrackingStopped",this.onStopTracking,this),this.trackingOverviewGrid&&this.trackingOverviewGrid.stop()}onHeapStatsUpdate({data:e}){this.trackingOverviewGrid&&this.trackingOverviewGrid.setSamples(e)}searchableView(){return this.searchableViewInternal}showProfile(e){return this.parentDataDisplayDelegate.showProfile(e)}showObject(e,t){Number(e)<=this.profile.maxJSObjectId?this.selectLiveObject(t,e):this.parentDataDisplayDelegate.showObject(e,t)}async linkifyObject(e){const t=this.profile.heapProfilerModel();if(!t)return null;const i=await this.profile.getLocation(e);if(!i)return null;const r=t.runtimeModel().debuggerModel().createRawLocationByScriptId(String(i.scriptId),i.lineNumber,i.columnNumber);if(!r)return null;const s=r.script(),o=s&&s.sourceURL;return o&&this.linkifier?this.linkifier.linkifyRawLocation(r,o):null}async populate(){const e=await this.profile.loadPromise;if(this.retrieveStatistics(e),this.dataGrid&&this.dataGrid.setDataSource(e,0),this.profile.profileType().id===At.TypeId&&this.profile.fromFile()){const t=await e.getSamples();if(t){console.assert(Boolean(t.timestamps.length));const e=new Ne;e.sizes=t.sizes,e.ids=t.lastAssignedIds,e.timestamps=t.timestamps,e.max=t.sizes,e.totalTime=Math.max(t.timestamps[t.timestamps.length-1]||0,1e4),this.trackingOverviewGrid&&this.trackingOverviewGrid.setSamples(e)}}const t=this.profiles().indexOf(this.profile);this.baseSelect.setSelectedIndex(Math.max(0,t-1)),this.trackingOverviewGrid&&this.trackingOverviewGrid.updateGrid()}async retrieveStatistics(e){const t=await e.getStatistics(),i=[{value:t.code,color:"#f77",title:Mt(kt.code)},{value:t.strings,color:"#5e5",title:Mt(kt.strings)},{value:t.jsArrays,color:"#7af",title:Mt(kt.jsArrays)},{value:t.native,color:"#fc5",title:Mt(kt.typedArrays)},{value:t.system,color:"#98f",title:Mt(kt.systemObjects)}];return this.statisticsView.setTotalAndRecords(t.total,i),t}onIdsRangeChanged(t){const{minId:i,maxId:r}=t.data;this.selectedSizeText.setText(Mt(kt.selectedSizeS,{PH1:e.NumberUtilities.bytesToString(t.data.size)})),this.constructorsDataGrid.snapshot&&this.constructorsDataGrid.setSelectionRange(i,r)}async toolbarItems(){const e=[this.perspectiveSelect,this.classNameFilter];return this.profile.profileType()!==Kt.trackingHeapSnapshotProfileType&&e.push(this.baseSelect,this.filterSelect),e.push(this.selectedSizeText),e}willHide(){this.currentSearchResultIndex=-1,this.popoverHelper.hidePopover()}supportsCaseSensitiveSearch(){return!0}supportsRegexSearch(){return!1}onSearchCanceled(){this.currentSearchResultIndex=-1,this.searchResults=[]}selectRevealedNode(e){e&&e.select()}performSearch(e,t,i){const r=new p.HeapSnapshotModel.SearchConfig(e.query.trim(),e.caseSensitive,e.isRegex,t,i||!1);this.searchThrottler.schedule(this.performSearchInternal.bind(this,r))}async performSearchInternal(e){if(this.onSearchCanceled(),!this.currentPerspective.supportsSearch())return;this.currentQuery=e;const t=e.query.trim();if(!t)return;if("@"===t.charAt(0)){const e=parseInt(t.substring(1),10);if(isNaN(e))return;if(!this.dataGrid)return;const i=await this.dataGrid.revealObjectByHeapSnapshotId(String(e));return void this.selectRevealedNode(i)}if(!this.profile.snapshotProxy||!this.dataGrid)return;const i=this.dataGrid.nodeFilter();this.searchResults=i?await this.profile.snapshotProxy.search(this.currentQuery,i):[],this.searchableViewInternal.updateSearchMatchesCount(this.searchResults.length),this.searchResults.length&&(this.currentSearchResultIndex=e.jumpBackward?this.searchResults.length-1:0),await this.jumpToSearchResult(this.currentSearchResultIndex)}jumpToNextSearchResult(){this.searchResults.length&&(this.currentSearchResultIndex=(this.currentSearchResultIndex+1)%this.searchResults.length,this.searchThrottler.schedule(this.jumpToSearchResult.bind(this,this.currentSearchResultIndex)))}jumpToPreviousSearchResult(){this.searchResults.length&&(this.currentSearchResultIndex=(this.currentSearchResultIndex+this.searchResults.length-1)%this.searchResults.length,this.searchThrottler.schedule(this.jumpToSearchResult.bind(this,this.currentSearchResultIndex)))}async jumpToSearchResult(e){if(this.searchableViewInternal.updateCurrentMatchIndex(e),-1===e)return;if(!this.dataGrid)return;const t=await this.dataGrid.revealObjectByHeapSnapshotId(String(this.searchResults[e]));this.selectRevealedNode(t)}refreshVisibleData(){if(!this.dataGrid)return;let e=this.dataGrid.rootNode().children[0];for(;e;)e.refresh(),e=e.traverseNextNode(!1,null,!0)}changeBase(){if(this.baseProfile===this.profiles()[this.baseSelect.selectedIndex()])return;this.baseProfile=this.profiles()[this.baseSelect.selectedIndex()];const e=this.dataGrid;e.snapshot&&this.baseProfile.loadPromise.then(e.setBaseDataSource.bind(e)),this.currentQuery&&this.searchResults&&this.performSearch(this.currentQuery,!1)}changeFilter(){const e=this.filterSelect.selectedIndex()-1;this.dataGrid&&(this.dataGrid.filterSelectIndexChanged(this.profiles(),e),this.currentQuery&&this.searchResults&&this.performSearch(this.currentQuery,!1))}profiles(){return this.profile.profileType().getProfiles()}selectionChanged(e){const t=e.data;this.setSelectedNodeForDetailsView(t),this.inspectedObjectChanged(e)}onSelectAllocationNode(e){const t=e.data;this.constructorsDataGrid.setAllocationNodeId(t.allocationNodeId()),this.setSelectedNodeForDetailsView(null)}inspectedObjectChanged(e){const t=e.data,i=this.profile.heapProfilerModel();i&&t instanceof Ye&&i.addInspectedHeapObject(String(t.snapshotNodeId))}setSelectedNodeForDetailsView(e){const t=e&&e.retainersDataSource();t?(this.retainmentDataGrid.setDataSource(t.snapshot,t.snapshotNodeIndex),this.allocationStackView&&this.allocationStackView.setAllocatedObject(t.snapshot,t.snapshotNodeIndex)):(this.allocationStackView&&this.allocationStackView.clear(),this.retainmentDataGrid.reset())}async changePerspectiveAndWait(e){const t=this.perspectives.findIndex((t=>t.title()===e));if(-1===t||this.currentPerspectiveIndex===t)return;const i=this.perspectives[t].masterGrid(this);if(!i)return;const r=i.once(pt.ContentShown),s=this.perspectiveSelect.options().find((e=>e.value===String(t)));this.perspectiveSelect.select(s),this.changePerspective(t),await r}async updateDataSourceAndView(){const e=this.dataGrid;if(!e||e.snapshot)return;const t=await this.profile.loadPromise;if(this.dataGrid!==e)return;if(e.snapshot!==t&&e.setDataSource(t,0),e!==this.diffDataGrid)return;this.baseProfile||(this.baseProfile=this.profiles()[this.baseSelect.selectedIndex()]);const i=await this.baseProfile.loadPromise;this.diffDataGrid.baseSnapshot!==i&&this.diffDataGrid.setBaseDataSource(i)}onSelectedPerspectiveChanged(e){this.changePerspective(Number(e.target.selectedOptions[0].value))}changePerspective(e){if(e===this.currentPerspectiveIndex)return;this.currentPerspectiveIndex=e,this.currentPerspective.deactivate(this);const t=this.perspectives[e];this.currentPerspective=t,this.dataGrid=t.masterGrid(this),t.activate(this),this.refreshVisibleData(),this.dataGrid&&this.dataGrid.updateWidths(),this.updateDataSourceAndView(),this.currentQuery&&this.searchResults&&this.performSearch(this.currentQuery,!1)}async selectLiveObject(e,t){if(await this.changePerspectiveAndWait(e),!this.dataGrid)return;const i=await this.dataGrid.revealObjectByHeapSnapshotId(t);i?i.select():o.Console.Console.instance().error("Cannot find corresponding heap snapshot node")}getPopoverRequest(e){const t=s.UIUtils.enclosingNodeOrSelfWithNodeName(e.target,"span"),i=s.UIUtils.enclosingNodeOrSelfWithNodeName(e.target,"tr");if(!i)return null;if(!this.dataGrid)return null;const r=this.dataGrid.dataGridNodeFromNode(i)||this.containmentDataGrid.dataGridNodeFromNode(i)||this.constructorsDataGrid.dataGridNodeFromNode(i)||this.diffDataGrid.dataGridNodeFromNode(i)||this.allocationDataGrid&&this.allocationDataGrid.dataGridNodeFromNode(i)||this.retainmentDataGrid.dataGridNodeFromNode(i),o=this.profile.heapProfilerModel();if(!r||!t||!o)return null;let n;return{box:t.boxInWindow(),show:async e=>{if(!o)return!1;const t=await r.queryObjectContent(o,"popover");return!!t&&(n=await u.ObjectPopoverHelper.ObjectPopoverHelper.buildObjectPopover(t,e),!!n||(o.runtimeModel().releaseObjectGroup("popover"),!1))},hide:()=>{o.runtimeModel().releaseObjectGroup("popover"),n&&n.dispose()}}}updatePerspectiveOptions(){const e=this.profiles().length>1;this.perspectiveSelect.removeOptions(),this.perspectives.forEach(((t,i)=>{(e||t!==this.comparisonPerspective)&&this.perspectiveSelect.createOption(t.title(),String(i))}))}updateBaseOptions(){const e=this.profiles(),t=this.baseSelect.selectedIndex();this.baseSelect.removeOptions();for(const t of e)this.baseSelect.createOption(t.title);t>-1&&this.baseSelect.setSelectedIndex(t)}updateFilterOptions(){const e=this.profiles(),t=this.filterSelect.selectedIndex();this.filterSelect.removeOptions(),this.filterSelect.createOption(Mt(kt.allObjects));for(let t=0;t<e.length;++t){let i;i=t?Mt(kt.objectsAllocatedBetweenSAndS,{PH1:e[t-1].title,PH2:e[t].title}):Mt(kt.objectsAllocatedBeforeS,{PH1:e[t].title}),this.filterSelect.createOption(i)}t>-1&&this.filterSelect.setSelectedIndex(t)}updateControls(){this.updatePerspectiveOptions(),this.updateBaseOptions(),this.updateFilterOptions()}onReceiveSnapshot(e){this.updateControls();e.data.addEventListener(k.ProfileTitleChanged,this.updateControls,this)}onProfileHeaderRemoved(e){const t=e.data;t.removeEventListener(k.ProfileTitleChanged,this.updateControls,this),this.profile===t?(this.detach(),this.profile.profileType().removeEventListener("SnapshotReceived",this.onReceiveSnapshot,this),this.profile.profileType().removeEventListener(D.RemoveProfileHeader,this.onProfileHeaderRemoved,this),this.dispose()):this.updateControls()}dispose(){this.linkifier.dispose(),this.popoverHelper.dispose(),this.allocationStackView&&(this.allocationStackView.clear(),this.allocationDataGrid&&this.allocationDataGrid.dispose()),this.onStopTracking(),this.trackingOverviewGrid&&this.trackingOverviewGrid.removeEventListener("IdsRangeChanged",this.onIdsRangeChanged.bind(this))}}class jt{titleInternal;constructor(e){this.titleInternal=e}activate(e){}deactivate(e){e.baseSelect.setVisible(!1),e.filterSelect.setVisible(!1),e.classNameFilter.setVisible(!1),e.trackingOverviewGrid&&e.trackingOverviewGrid.detach(),e.allocationWidget&&e.allocationWidget.detach(),e.statisticsView&&e.statisticsView.detach(),e.splitWidget.detach(),e.splitWidget.detachChildWidgets()}masterGrid(e){return null}title(){return this.titleInternal}supportsSearch(){return!1}}class Ot extends jt{constructor(){super(Mt(kt.summary))}activate(e){e.splitWidget.setMainWidget(e.constructorsWidget),e.splitWidget.setSidebarWidget(e.objectDetailsView),e.splitWidget.show(e.searchableViewInternal.element),e.filterSelect.setVisible(!0),e.classNameFilter.setVisible(!0),e.trackingOverviewGrid&&(e.trackingOverviewGrid.show(e.searchableViewInternal.element,e.splitWidget.element),e.trackingOverviewGrid.update(),e.trackingOverviewGrid.updateGrid())}masterGrid(e){return e.constructorsDataGrid}supportsSearch(){return!0}}class zt extends jt{constructor(){super(Mt(kt.comparison))}activate(e){e.splitWidget.setMainWidget(e.diffWidget),e.splitWidget.setSidebarWidget(e.objectDetailsView),e.splitWidget.show(e.searchableViewInternal.element),e.baseSelect.setVisible(!0),e.classNameFilter.setVisible(!0)}masterGrid(e){return e.diffDataGrid}supportsSearch(){return!0}}class Bt extends jt{constructor(){super(Mt(kt.containment))}activate(e){e.splitWidget.setMainWidget(e.containmentWidget),e.splitWidget.setSidebarWidget(e.objectDetailsView),e.splitWidget.show(e.searchableViewInternal.element)}masterGrid(e){return e.containmentDataGrid}}class Gt extends jt{allocationSplitWidget;constructor(){super(Mt(kt.allocation)),this.allocationSplitWidget=new s.SplitWidget.SplitWidget(!1,!0,"heapSnapshotAllocationSplitViewState",200,200),this.allocationSplitWidget.setSidebarWidget(new s.Widget.VBox)}activate(e){e.allocationWidget&&this.allocationSplitWidget.setMainWidget(e.allocationWidget),e.splitWidget.setMainWidget(e.constructorsWidget),e.splitWidget.setSidebarWidget(e.objectDetailsView);const t=new s.Widget.VBox,i=document.createElement("div");i.classList.add("heap-snapshot-view-resizer");const r=i.createChild("div","title").createChild("span");if(i.createChild("div","verticalResizerIcon"),r.textContent=Mt(kt.liveObjects),this.allocationSplitWidget.hideDefaultResizer(),this.allocationSplitWidget.installResizer(i),t.element.appendChild(i),e.splitWidget.show(t.element),this.allocationSplitWidget.setSidebarWidget(t),this.allocationSplitWidget.show(e.searchableViewInternal.element),e.constructorsDataGrid.clear(),e.allocationDataGrid){const t=e.allocationDataGrid.selectedNode;t&&e.constructorsDataGrid.setAllocationNodeId(t.allocationNodeId())}}deactivate(e){this.allocationSplitWidget.detach(),super.deactivate(e)}masterGrid(e){return e.allocationDataGrid}}class Vt extends jt{constructor(){super(Mt(kt.statistics))}activate(e){e.statisticsView.show(e.searchableViewInternal.element)}masterGrid(e){return null}}class Ut extends(o.ObjectWrapper.eventMixin(L)){exposeInternals;captureNumericValue;customContentInternal;constructor(e,t){super(e||Ut.TypeId,t||Mt(kt.heapSnapshot)),l.TargetManager.TargetManager.instance().observeModels(l.HeapProfilerModel.HeapProfilerModel,this),l.TargetManager.TargetManager.instance().addModelListener(l.HeapProfilerModel.HeapProfilerModel,l.HeapProfilerModel.Events.ResetProfiles,this.resetProfiles,this),l.TargetManager.TargetManager.instance().addModelListener(l.HeapProfilerModel.HeapProfilerModel,l.HeapProfilerModel.Events.AddHeapSnapshotChunk,this.addHeapSnapshotChunk,this),l.TargetManager.TargetManager.instance().addModelListener(l.HeapProfilerModel.HeapProfilerModel,l.HeapProfilerModel.Events.ReportHeapSnapshotProgress,this.reportHeapSnapshotProgress,this),this.exposeInternals=o.Settings.Settings.instance().createSetting("exposeInternals",!1),this.captureNumericValue=o.Settings.Settings.instance().createSetting("captureNumericValue",!1),this.customContentInternal=null}modelAdded(e){e.enable()}modelRemoved(e){}getProfiles(){return super.getProfiles()}fileExtension(){return".heapsnapshot"}get buttonTooltip(){return Mt(kt.takeHeapSnapshot)}isInstantProfile(){return!0}buttonClicked(){return this.takeHeapSnapshot(),a.userMetrics.actionTaken(a.UserMetrics.Action.ProfilesHeapProfileTaken),!1}get treeItemTitle(){return Mt(kt.heapSnapshots)}get description(){return Mt(kt.heapSnapshotProfilesShowMemory)}customContent(){const e=document.createElement("div"),t=c.Runtime.experiments.isEnabled("showOptionToExposeInternalsInHeapSnapshot"),i=!t;if(t){const t=s.SettingsUI.createSettingCheckbox(Mt(kt.exposeInternals),this.exposeInternals,i);e.appendChild(t)}const r=s.SettingsUI.createSettingCheckbox(Mt(kt.captureNumericValue),this.captureNumericValue,i);return e.appendChild(r),this.customContentInternal=e,e}setCustomContentEnabled(e){this.customContentInternal&&this.customContentInternal.querySelectorAll("[is=dt-checkbox]").forEach((t=>{t.checkboxElement.disabled=!e}))}createProfileLoadedFromFile(e){return new Wt(null,this,e)}async takeHeapSnapshot(){if(this.profileBeingRecorded())return;const e=s.Context.Context.instance().flavor(l.HeapProfilerModel.HeapProfilerModel);if(!e)return;let t=new Wt(e,this);this.setProfileBeingRecorded(t),this.addProfile(t),t.updateStatus(Mt(kt.snapshotting)),await e.takeHeapSnapshot({reportProgress:!0,captureNumericValue:this.captureNumericValue.get(),exposeInternals:this.exposeInternals.get()}),t=this.profileBeingRecorded(),t&&(t.title=Mt(kt.snapshotD,{PH1:t.uid}),t.finishLoad(),this.setProfileBeingRecorded(null),this.dispatchEventToListeners(D.ProfileComplete,t))}addHeapSnapshotChunk(e){const t=this.profileBeingRecorded();t&&t.transferChunk(e.data)}reportHeapSnapshotProgress(e){const t=this.profileBeingRecorded();if(!t)return;const{done:i,total:r,finished:s}=e.data;t.updateStatus(Mt(kt.percentagePlaceholder,{PH1:(i/r*100).toFixed(0)}),!0),s&&t.prepareToLoad()}resetProfiles(e){const t=e.data;for(const e of this.getProfiles())e.heapProfilerModel()===t&&this.removeProfile(e)}snapshotReceived(e){this.profileBeingRecorded()===e&&this.setProfileBeingRecorded(null),this.dispatchEventToListeners("SnapshotReceived",e)}static TypeId="HEAP";static SnapshotReceived="SnapshotReceived"}class At extends(o.ObjectWrapper.eventMixin(Ut)){recordAllocationStacksSettingInternal;customContentInternal;recording;profileSamples;constructor(){super(At.TypeId,Mt(kt.allocationInstrumentationOn)),this.recordAllocationStacksSettingInternal=o.Settings.Settings.instance().createSetting("recordAllocationStacks",!1),this.customContentInternal=null,this.recording=!1}modelAdded(e){super.modelAdded(e),e.addEventListener(l.HeapProfilerModel.Events.HeapStatsUpdate,this.heapStatsUpdate,this),e.addEventListener(l.HeapProfilerModel.Events.LastSeenObjectId,this.lastSeenObjectId,this)}modelRemoved(e){super.modelRemoved(e),e.removeEventListener(l.HeapProfilerModel.Events.HeapStatsUpdate,this.heapStatsUpdate,this),e.removeEventListener(l.HeapProfilerModel.Events.LastSeenObjectId,this.lastSeenObjectId,this)}heapStatsUpdate(e){if(!this.profileSamples)return;const t=e.data;let i;for(let e=0;e<t.length;e+=3){i=t[e];const r=t[e+2];this.profileSamples.sizes[i]=r,this.profileSamples.max[i]||(this.profileSamples.max[i]=r)}}lastSeenObjectId(e){const t=this.profileSamples;if(!t)return;const{lastSeenObjectId:i,timestamp:r}=e.data,s=Math.max(t.ids.length,t.max.length-1);t.ids[s]=i,t.max[s]||(t.max[s]=0,t.sizes[s]=0),t.timestamps[s]=r,t.totalTime<r-t.timestamps[0]&&(t.totalTime*=2),this.profileSamples&&this.dispatchEventToListeners("HeapStatsUpdate",this.profileSamples);const o=this.profileBeingRecorded();o&&o.updateStatus(null,!0)}hasTemporaryView(){return!0}get buttonTooltip(){return this.recording?Mt(kt.stopRecordingHeapProfile):Mt(kt.startRecordingHeapProfile)}isInstantProfile(){return!1}buttonClicked(){return this.toggleRecording()}startRecordingProfile(){if(this.profileBeingRecorded())return;const e=this.addNewProfile();e&&e.startTrackingHeapObjects(this.recordAllocationStacksSettingInternal.get())}customContent(){const e=s.SettingsUI.createSettingCheckbox(Mt(kt.recordAllocationStacksExtra),this.recordAllocationStacksSettingInternal,!0);return this.customContentInternal=e,e}setCustomContentEnabled(e){this.customContentInternal&&(this.customContentInternal.checkboxElement.disabled=!e)}recordAllocationStacksSetting(){return this.recordAllocationStacksSettingInternal}addNewProfile(){const e=s.Context.Context.instance().flavor(l.HeapProfilerModel.HeapProfilerModel);return e?(this.setProfileBeingRecorded(new Wt(e,this,void 0)),this.profileSamples=new Ne,this.profileBeingRecorded()._profileSamples=this.profileSamples,this.recording=!0,this.addProfile(this.profileBeingRecorded()),this.profileBeingRecorded().updateStatus(Mt(kt.recording)),this.dispatchEventToListeners("TrackingStarted"),e):null}async stopRecordingProfile(){let e=this.profileBeingRecorded();e.updateStatus(Mt(kt.snapshotting));const t=e.heapProfilerModel().stopTrackingHeapObjects(!0);this.recording=!1,this.dispatchEventToListeners("TrackingStopped"),await t,e=this.profileBeingRecorded(),e&&(e.finishLoad(),this.profileSamples=null,this.setProfileBeingRecorded(null),this.dispatchEventToListeners(D.ProfileComplete,e))}toggleRecording(){return this.recording?this.stopRecordingProfile():this.startRecordingProfile(),this.recording}fileExtension(){return".heaptimeline"}get treeItemTitle(){return Mt(kt.allocationTimelines)}get description(){return Mt(kt.AllocationTimelinesShowInstrumented)}resetProfiles(e){const t=this.recording;this.setProfileBeingRecorded(null),super.resetProfiles(e),this.profileSamples=null,t&&this.addNewProfile()}profileBeingRecordedRemoved(){this.stopRecordingProfile(),this.profileSamples=null}static TypeId="HEAP-RECORD";static HeapStatsUpdate="HeapStatsUpdate";static TrackingStarted="TrackingStarted";static TrackingStopped="TrackingStopped"}class Wt extends F{heapProfilerModelInternal;maxJSObjectId;workerProxy;receiver;snapshotProxy;loadPromise;fulfillLoad;totalNumberOfChunks;bufferedWriter;onTempFileReady;failedToCreateTempFile;wasDisposed;fileName;constructor(e,t,i){super(t,i||Mt(kt.snapshotD,{PH1:t.nextProfileUid()})),this.heapProfilerModelInternal=e,this.maxJSObjectId=-1,this.workerProxy=null,this.receiver=null,this.snapshotProxy=null,this.loadPromise=new Promise((e=>{this.fulfillLoad=e})),this.totalNumberOfChunks=0,this.bufferedWriter=null,this.onTempFileReady=null}heapProfilerModel(){return this.heapProfilerModelInternal}async getLocation(e){return this.snapshotProxy?this.snapshotProxy.getLocation(e):null}createSidebarTreeElement(e){return new A(e,this,"heap-snapshot-sidebar-tree-item")}createView(e){return new Lt(e,this)}prepareToLoad(){console.assert(!this.receiver,"Already loading"),this.setupWorker(),this.updateStatus(Mt(kt.loading),!0)}finishLoad(){!this.wasDisposed&&this.receiver&&this.receiver.close(),this.bufferedWriter&&this.didWriteToTempFile(this.bufferedWriter)}didWriteToTempFile(e){this.wasDisposed?e&&e.remove():(this.tempFile=e,e||(this.failedToCreateTempFile=!0),this.onTempFileReady&&(this.onTempFileReady(),this.onTempFileReady=null))}setupWorker(){console.assert(!this.workerProxy,"HeapSnapshotWorkerProxy already exists"),this.workerProxy=new xt(this.handleWorkerEvent.bind(this)),this.workerProxy.addEventListener("Wait",(e=>{this.updateStatus(null,e.data)}),this),this.receiver=this.workerProxy.createLoader(this.uid,this.snapshotReceived.bind(this))}handleWorkerEvent(e,i){if(p.HeapSnapshotModel.HeapSnapshotProgressEvent.BrokenSnapshot===e){const e=i;return void o.Console.Console.instance().error(e)}if(p.HeapSnapshotModel.HeapSnapshotProgressEvent.Update!==e)return;const r=i,s=t.i18n.deserializeUIString(r);this.updateStatus(Ht(s.string,s.values))}dispose(){this.workerProxy&&this.workerProxy.dispose(),this.removeTempFile(),this.wasDisposed=!0}didCompleteSnapshotTransfer(){this.snapshotProxy&&this.updateStatus(e.NumberUtilities.bytesToString(this.snapshotProxy.totalSize),!1)}transferChunk(e){this.bufferedWriter||(this.bufferedWriter=new h.TempFile.TempFile),this.bufferedWriter.write([e]),++this.totalNumberOfChunks,this.receiver&&this.receiver.write(e)}snapshotReceived(e){this.wasDisposed||(this.receiver=null,this.snapshotProxy=e,this.maxJSObjectId=e.maxJSObjectId(),this.didCompleteSnapshotTransfer(),this.workerProxy&&this.workerProxy.startCheckingForLongRunningCalls(),this.notifySnapshotReceived())}notifySnapshotReceived(){this.snapshotProxy&&this.fulfillLoad&&this.fulfillLoad(this.snapshotProxy),this.profileType().snapshotReceived(this),this.canSaveToFile()&&this.dispatchEventToListeners(k.ProfileReceived)}canSaveToFile(){return!this.fromFile()&&Boolean(this.snapshotProxy)}saveToFile(){const t=new h.FileUtils.FileOutputStream;this.fileName=this.fileName||"Heap-"+e.DateUtilities.toISO8601Compact(new Date)+this.profileType().fileExtension();const i=async e=>{if(e){if(this.failedToCreateTempFile)return o.Console.Console.instance().error("Failed to open temp file with heap snapshot"),void t.close();if(this.tempFile){const e=await this.tempFile.copyToOutputStream(t,this.onChunkTransferred.bind(this));return e&&o.Console.Console.instance().error("Failed to read heap snapshot from temp file: "+e.message),void this.didCompleteSnapshotTransfer()}this.onTempFileReady=()=>{i(e)},this.updateSaveProgress(0,1)}};t.open(this.fileName).then(i.bind(this))}onChunkTransferred(e){this.updateSaveProgress(e.loadedSize(),e.fileSize())}updateSaveProgress(e,t){const i=(100*(t&&e/t)).toFixed(0);this.updateStatus(Mt(kt.savingD,{PH1:i}))}async loadFromFile(e){this.updateStatus(Mt(kt.loading),!0),this.setupWorker();const t=new h.FileUtils.ChunkedFileReader(e,1e7),i=await t.read(this.receiver);if(!i){const e=t.error();e&&this.updateStatus(e.message)}return i?null:t.error()}profileType(){return super.profileType()}}class _t extends s.Widget.VBox{pieChart;constructor(){super(),this.element.classList.add("heap-snapshot-statistics-view"),this.pieChart=new n.PieChart.PieChart,this.setTotalAndRecords(0,[]),this.pieChart.classList.add("heap-snapshot-stats-pie-chart"),this.element.appendChild(this.pieChart)}static valueFormatter(t){return Mt(kt.sKb,{PH1:e.NumberUtilities.withThousandsSeparator(Math.round(t/1e3))})}setTotalAndRecords(e,t){this.pieChart.data={chartName:Mt(kt.heapMemoryUsage),size:150,formatter:_t.valueFormatter,showLegend:!0,total:e,slices:t}}}class Jt extends s.Widget.Widget{heapProfilerModel;linkifier;frameElements;constructor(e){super(),this.heapProfilerModel=e,this.linkifier=new d.Linkifier.Linkifier,this.frameElements=[]}onContextMenu(e,t){const i=new s.ContextMenu.ContextMenu(t);i.containsTarget(e)||i.appendApplicableItems(e),i.show(),t.consume(!0)}onStackViewKeydown(e){const t=e.target;if(!t)return;if("Enter"===e.key){const i=$t.get(t);if(!i)return;const r=d.Linkifier.Linkifier.linkInfo(i);if(!r)return;return void(d.Linkifier.Linkifier.invokeFirstAction(r)&&e.consume(!0))}let i;const r=e;if("ArrowUp"===r.key)i=!1;else{if("ArrowDown"!==r.key)return;i=!0}const s=this.frameElements.indexOf(t);if(-1===s)return;const o=i?s+1:s-1;if(o<0||o>=this.frameElements.length)return;const n=this.frameElements[o];n.tabIndex=0,t.tabIndex=-1,n.focus(),e.consume(!0)}async setAllocatedObject(e,t){this.clear();const i=await e.allocationStack(t);if(!i){const e=this.element.createChild("div","no-heap-allocation-stack");return void s.UIUtils.createTextChild(e,Mt(kt.stackWasNotRecordedForThisObject))}const r=this.element.createChild("div","heap-allocation-stack");r.addEventListener("keydown",this.onStackViewKeydown.bind(this),!1);for(const e of i){const t=r.createChild("div","stack-frame");this.frameElements.push(t),t.tabIndex=-1;if(t.createChild("div").textContent=s.UIUtils.beautifyFunctionName(e.functionName),!e.scriptId)continue;const i=this.heapProfilerModel?this.heapProfilerModel.target():null,o={columnNumber:e.column-1,inlineFrameIndex:0},n=this.linkifier.linkifyScriptLocation(i,String(e.scriptId),e.scriptName,e.line-1,o);t.appendChild(n),$t.set(t,n),t.addEventListener("contextmenu",this.onContextMenu.bind(this,n))}this.frameElements[0].tabIndex=0}clear(){this.element.removeChildren(),this.frameElements=[],this.linkifier.reset()}}const $t=new WeakMap;var qt=Object.freeze({__proto__:null,HeapSnapshotView:Lt,Perspective:jt,SummaryPerspective:Ot,ComparisonPerspective:zt,ContainmentPerspective:Bt,AllocationPerspective:Gt,StatisticsPerspective:Vt,HeapSnapshotProfileType:Ut,TrackingHeapSnapshotProfileType:At,HeapProfileHeader:Wt,HeapSnapshotStatisticsView:_t,HeapAllocationStackView:Jt});class Qt{cpuProfileType;heapSnapshotProfileType;samplingHeapProfileType;trackingHeapSnapshotProfileType;constructor(){this.cpuProfileType=new oe,this.heapSnapshotProfileType=new Ut,this.samplingHeapProfileType=new Be,this.trackingHeapSnapshotProfileType=new At}}const Kt=new Qt;var Yt=Object.freeze({__proto__:null,ProfileTypeRegistry:Qt,instance:Kt});const Zt={clearAllProfiles:"Clear all profiles",cantLoadFileSupportedFile:"Can’t load file. Supported file extensions: ''{PH1}''.",cantLoadProfileWhileAnother:"Can’t load profile while another profile is being recorded.",profileLoadingFailedS:"Profile loading failed: {PH1}.",load:"Load…",runD:"Run {PH1}",profiles:"Profiles",deprecationWarnMsg:"This panel will be deprecated in the upcoming version. Use the Performance panel to record JavaScript CPU profiles.",learnMore:"Learn more",feedback:"Feedback",goToPerformancePanel:"Go to Performance Panel",enableThisPanelTemporarily:"Enable this panel temporarily"},Xt=t.i18n.registerUIStrings("panels/profiler/ProfilesPanel.ts",Zt),ei=t.i18n.getLocalizedString.bind(void 0,Xt);class ti extends s.Panel.PanelWithSidebar{profileTypes;profilesItemTreeElement;sidebarTree;profileViews;toolbarElement;toggleRecordAction;toggleRecordButton;clearResultsButton;profileViewToolbar;profileGroups;launcherView;visibleView;profileToView;typeIdToSidebarSection;fileSelectorElement;selectedProfileType;constructor(e,t,i){super(e),this.profileTypes=t;const r=new s.Widget.VBox;this.splitWidget().setMainWidget(r),this.profilesItemTreeElement=new oi(this),this.sidebarTree=new s.TreeOutline.TreeOutlineInShadow,this.sidebarTree.element.classList.add("profiles-sidebar-tree-box"),this.panelSidebarElement().appendChild(this.sidebarTree.element),this.sidebarTree.appendChild(this.profilesItemTreeElement),this.sidebarTree.element.addEventListener("keydown",this.onKeyDown.bind(this),!1),this.profileViews=document.createElement("div"),this.profileViews.id="profile-views",this.profileViews.classList.add("vbox"),r.element.appendChild(this.profileViews),this.toolbarElement=document.createElement("div"),this.toolbarElement.classList.add("profiles-toolbar"),r.element.insertBefore(this.toolbarElement,r.element.firstChild),this.panelSidebarElement().classList.add("profiles-tree-sidebar");const o=document.createElement("div");o.classList.add("profiles-toolbar"),this.panelSidebarElement().insertBefore(o,this.panelSidebarElement().firstChild);const n=new s.Toolbar.Toolbar("",o);this.toggleRecordAction=s.ActionRegistry.ActionRegistry.instance().action(i),this.toggleRecordButton=s.Toolbar.Toolbar.createActionButton(this.toggleRecordAction),n.appendToolbarItem(this.toggleRecordButton),this.clearResultsButton=new s.Toolbar.ToolbarButton(ei(Zt.clearAllProfiles),"clear"),this.clearResultsButton.addEventListener(s.Toolbar.ToolbarButton.Events.Click,this.reset,this),n.appendToolbarItem(this.clearResultsButton),n.appendSeparator(),n.appendToolbarItem(s.Toolbar.Toolbar.createActionButtonForId("components.collect-garbage")),this.profileViewToolbar=new s.Toolbar.Toolbar("",this.toolbarElement),this.profileViewToolbar.makeWrappable(!0),this.profileGroups={},this.launcherView=new xe(this),this.launcherView.addEventListener(ye.ProfileTypeSelected,this.onProfileTypeSelected,this),this.profileToView=[],this.typeIdToSidebarSection={};const a=this.profileTypes;for(let e=0;e<a.length;e++)this.registerProfileType(a[e]);this.launcherView.restoreSelectedProfileType(),this.profilesItemTreeElement.select(),this.showLauncherView(),this.createFileSelectorElement(),this.element.addEventListener("contextmenu",this.handleContextMenuEvent.bind(this),!1),l.TargetManager.TargetManager.instance().addEventListener(l.TargetManager.Events.SuspendStateChanged,this.onSuspendStateChanged,this),s.Context.Context.instance().addFlavorChangeListener(l.CPUProfilerModel.CPUProfilerModel,this.updateProfileTypeSpecificUI,this),s.Context.Context.instance().addFlavorChangeListener(l.HeapProfilerModel.HeapProfilerModel,this.updateProfileTypeSpecificUI,this)}onKeyDown(e){const t=e;let i=!1;"ArrowDown"!==t.key||t.altKey?"ArrowUp"!==t.key||t.altKey||(i=this.sidebarTree.selectPrevious()):i=this.sidebarTree.selectNext(),i&&t.consume(!0)}searchableView(){const e=this.visibleView;return e&&e.searchableView?e.searchableView():null}createFileSelectorElement(){this.fileSelectorElement&&this.element.removeChild(this.fileSelectorElement),this.fileSelectorElement=s.UIUtils.createFileSelectorElement(this.loadFromFile.bind(this)),U(this.fileSelectorElement),this.element.appendChild(this.fileSelectorElement)}findProfileTypeByExtension(e){return this.profileTypes.find((t=>Boolean(t.fileExtension())&&e.endsWith(t.fileExtension()||"")))||null}async loadFromFile(e){this.createFileSelectorElement();const t=this.findProfileTypeByExtension(e.name);if(!t){const e=new Set(this.profileTypes.map((e=>e.fileExtension())).filter((e=>e)));return void o.Console.Console.instance().error(ei(Zt.cantLoadFileSupportedFile,{PH1:Array.from(e).join("', '")}))}if(Boolean(t.profileBeingRecorded()))return void o.Console.Console.instance().error(ei(Zt.cantLoadProfileWhileAnother));const i=await t.loadFromFile(e);i&&"message"in i&&s.UIUtils.MessageDialog.show(ei(Zt.profileLoadingFailedS,{PH1:i.message}))}toggleRecord(){if(!this.toggleRecordAction.enabled())return!0;const t=e.DOMUtilities.deepActiveElement(this.element.ownerDocument),i=this.selectedProfileType;if(!i)return!0;const r=i.buttonClicked();return this.updateToggleRecordAction(r),r?(this.launcherView.profileStarted(),i.hasTemporaryView()&&this.showProfile(i.profileBeingRecorded())):this.launcherView.profileFinished(),t&&t.focus(),!0}onSuspendStateChanged(){this.updateToggleRecordAction(this.toggleRecordAction.toggled())}updateToggleRecordAction(e){const t=Boolean(s.Context.Context.instance().flavor(l.CPUProfilerModel.CPUProfilerModel)||s.Context.Context.instance().flavor(l.HeapProfilerModel.HeapProfilerModel)),i=e||!l.TargetManager.TargetManager.instance().allTargetsSuspended()&&t;this.toggleRecordAction.setEnabled(i),this.toggleRecordAction.setToggled(e),i?this.toggleRecordButton.setTitle(this.selectedProfileType?this.selectedProfileType.buttonTooltip:""):this.toggleRecordButton.setTitle(s.UIUtils.anotherProfilerActiveLabel()),this.selectedProfileType&&this.launcherView.updateProfileType(this.selectedProfileType,i)}profileBeingRecordedRemoved(){this.updateToggleRecordAction(!1),this.launcherView.profileFinished()}onProfileTypeSelected(e){this.selectedProfileType=e.data,this.updateProfileTypeSpecificUI()}updateProfileTypeSpecificUI(){this.updateToggleRecordAction(this.toggleRecordAction.toggled())}reset(){this.profileTypes.forEach((e=>e.reset())),delete this.visibleView,this.profileGroups={},this.updateToggleRecordAction(!1),this.launcherView.profileFinished(),this.sidebarTree.element.classList.remove("some-expandable"),this.launcherView.detach(),this.profileViews.removeChildren(),this.profileViewToolbar.removeToolbarItems(),this.clearResultsButton.element.classList.remove("hidden"),this.profilesItemTreeElement.select(),this.showLauncherView()}showLauncherView(){this.closeVisibleView(),this.profileViewToolbar.removeToolbarItems(),this.launcherView.show(this.profileViews),this.visibleView=this.launcherView,this.toolbarElement.classList.add("hidden")}registerProfileType(e){this.launcherView.addProfileType(e);const t=new ii(this,e);this.typeIdToSidebarSection[e.id]=t,this.sidebarTree.appendChild(t),t.childrenListElement.addEventListener("contextmenu",this.handleContextMenuEvent.bind(this),!1),e.addEventListener(D.ViewUpdated,this.updateProfileTypeSpecificUI,this),e.addEventListener(D.AddProfileHeader,(function(e){this.addProfileHeader(e.data)}),this),e.addEventListener(D.RemoveProfileHeader,(function(e){this.removeProfileHeader(e.data)}),this),e.addEventListener(D.ProfileComplete,(function(e){this.showProfile(e.data)}),this);const i=e.getProfiles();for(let e=0;e<i.length;e++)this.addProfileHeader(i[e])}handleContextMenuEvent(e){const t=new s.ContextMenu.ContextMenu(e);this.panelSidebarElement().isSelfOrAncestor(e.target)&&t.defaultSection().appendItem(ei(Zt.load),this.fileSelectorElement.click.bind(this.fileSelectorElement)),t.show()}showLoadFromFileDialog(){this.fileSelectorElement.click()}addProfileHeader(e){const t=e.profileType().id;this.typeIdToSidebarSection[t].addProfileHeader(e),this.visibleView&&this.visibleView!==this.launcherView||this.showProfile(e)}removeProfileHeader(e){e.profileType().profileBeingRecorded()===e&&this.profileBeingRecordedRemoved();const t=this.indexOfViewForProfile(e);-1!==t&&this.profileToView.splice(t,1);const i=e.profileType().id;this.typeIdToSidebarSection[i].removeProfileHeader(e)&&(this.profilesItemTreeElement.select(),this.showLauncherView())}showProfile(e){if(!e||e.profileType().profileBeingRecorded()===e&&!e.profileType().hasTemporaryView())return null;const t=this.viewForProfile(e);if(t===this.visibleView)return t;this.closeVisibleView(),t.show(this.profileViews),this.toolbarElement.classList.remove("hidden"),this.visibleView=t;const i=this.typeIdToSidebarSection[e.profileType().id].sidebarElementForProfile(e);return i&&i.revealAndSelect(),this.profileViewToolbar.removeToolbarItems(),t.toolbarItems().then((e=>{e.map((e=>this.profileViewToolbar.appendToolbarItem(e)))})),t}showObject(e,t){}async linkifyObject(e){return null}viewForProfile(e){const t=this.indexOfViewForProfile(e);if(-1!==t)return this.profileToView[t].view;const i=e.createView(this);return i.element.classList.add("profile-view"),this.profileToView.push({profile:e,view:i}),i}indexOfViewForProfile(e){return this.profileToView.findIndex((t=>t.profile===e))}closeVisibleView(){this.visibleView&&this.visibleView.detach(),delete this.visibleView}focus(){this.sidebarTree.focus()}wasShown(){super.wasShown(),this.registerCSSFiles([he,pe,ce]),this.sidebarTree.registerCSSFiles([ue])}}class ii extends s.TreeOutline.TreeElement{dataDisplayDelegate;profileTreeElements;profileGroups;constructor(e,t){super(t.treeItemTitle,!0),this.selectable=!1,this.dataDisplayDelegate=e,this.profileTreeElements=[],this.profileGroups={},this.expand(),this.hidden=!0,this.setCollapsible(!1)}addProfileHeader(e){this.hidden=!1;const t=e.profileType();let i=this;const r=e.createSidebarTreeElement(this.dataDisplayDelegate);if(this.profileTreeElements.push(r),!e.fromFile()&&t.profileBeingRecorded()!==e){const t=e.title;let s=this.profileGroups[t];s||(s=new ri,this.profileGroups[t]=s),s.profileSidebarTreeElements.push(r);const o=s.profileSidebarTreeElements.length;if(2===o){s.sidebarTreeElement=new si(this.dataDisplayDelegate,e.title);const t=s.profileSidebarTreeElements[0],i=this.children().indexOf(t);this.insertChild(s.sidebarTreeElement,i);const r=t.selected;this.removeChild(t),s.sidebarTreeElement.appendChild(t),r&&t.revealAndSelect(),t.setSmall(!0),t.setMainTitle(ei(Zt.runD,{PH1:1})),this.treeOutline&&this.treeOutline.element.classList.add("some-expandable")}o>=2&&(i=s.sidebarTreeElement,r.setSmall(!0),r.setMainTitle(ei(Zt.runD,{PH1:o})))}i&&i.appendChild(r)}removeProfileHeader(e){const t=this.sidebarElementIndex(e);if(-1===t)return!1;const i=this.profileTreeElements[t];this.profileTreeElements.splice(t,1);let r=this;const s=this.profileGroups[e.title];if(s){const t=s.profileSidebarTreeElements;if(t.splice(t.indexOf(i),1),1===t.length){const i=r.children().indexOf(s.sidebarTreeElement);s.sidebarTreeElement&&s.sidebarTreeElement.removeChild(t[0]),this.insertChild(t[0],i),t[0].setSmall(!1),t[0].setMainTitle(e.title),s.sidebarTreeElement&&this.removeChild(s.sidebarTreeElement)}0!==t.length&&(r=s.sidebarTreeElement)}return r&&r.removeChild(i),i.dispose(),!this.childCount()&&(this.hidden=!0,!0)}sidebarElementForProfile(e){const t=this.sidebarElementIndex(e);return-1===t?null:this.profileTreeElements[t]}sidebarElementIndex(e){const t=this.profileTreeElements;for(let i=0;i<t.length;i++)if(t[i].profile===e)return i;return-1}onattach(){this.listItemElement.classList.add("profiles-tree-section")}}class ri{profileSidebarTreeElements;sidebarTreeElement;constructor(){this.profileSidebarTreeElements=[],this.sidebarTreeElement=null}}class si extends s.TreeOutline.TreeElement{dataDisplayDelegate;profileTitle;toggleOnClick;constructor(e,t){super("",!0),this.selectable=!1,this.dataDisplayDelegate=e,this.profileTitle=t,this.expand(),this.toggleOnClick=!0}onselect(){const e=this.childCount()>0;if(e){const e=this.lastChild();e instanceof A&&this.dataDisplayDelegate.showProfile(e.profile)}return e}onattach(){this.listItemElement.classList.add("profile-group-sidebar-tree-item"),this.listItemElement.createChild("div","icon"),this.listItemElement.createChild("div","titles no-subtitle").createChild("span","title-container").createChild("span","title").textContent=this.profileTitle}}class oi extends s.TreeOutline.TreeElement{panel;constructor(e){super("",!1),this.selectable=!0,this.panel=e}onselect(){return this.panel.showLauncherView(),!0}onattach(){this.listItemElement.classList.add("profile-launcher-view-tree-item"),this.listItemElement.createChild("div","icon"),this.listItemElement.createChild("div","titles no-subtitle").createChild("span","title-container").createChild("span","title").textContent=ei(Zt.profiles)}}let ni;class ai extends ti{constructor(){super("js_profiler",[Kt.cpuProfileType],"profiler.js-toggle-recording"),this.splitWidget().mainWidget()?.setMinimumSize(350,0),c.Runtime.experiments.isEnabled("jsProfilerTemporarilyEnable")?this.#t():this.#i()}static instance(e={forceNew:null}){const{forceNew:t}=e;return ni&&!t||(ni=new ai),ni}#t(){function e(){a.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab("https://github.com/ChromeDevTools/rfcs/discussions/2")}const t=new s.Infobar.Infobar(s.Infobar.Type.Warning,ei(Zt.deprecationWarnMsg),[{text:ei(Zt.learnMore),highlight:!1,delegate:e,dismiss:!1},{text:ei(Zt.feedback),highlight:!1,delegate:e,dismiss:!1},{text:ei(Zt.goToPerformancePanel),highlight:!0,delegate:async function(){await s.InspectorView.InspectorView.instance().showPanel("timeline")},dismiss:!1}],void 0);t.setParentView(this),this.splitWidget().mainWidget()?.element.prepend(t.element)}#i(){const e=this.splitWidget().mainWidget();if(e?.detachChildWidgets(),e){const t=new s.Widget.VBox;t.contentElement.classList.add("empty-landing-page","fill");const i=t.contentElement.createChild("div");i.createChild("p").textContent="This panel is deprecated and will be removed in the next version. Use the Performance panel to record JavaScript CPU profiles.",i.createChild("p").textContent="You can temporarily enable this panel with Settings > Experiments > Enable JavaScript Profiler.",i.appendChild(s.UIUtils.createTextButton(ei(Zt.goToPerformancePanel),(async function(){await s.InspectorView.InspectorView.instance().showPanel("timeline")}),"infobar-button primary-button")),i.appendChild(s.UIUtils.createTextButton(ei(Zt.learnMore),(function(){a.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab("https://developer.chrome.com/blog/js-profiler-deprecation/")}))),i.appendChild(s.UIUtils.createTextButton(ei(Zt.feedback),(function(){a.InspectorFrontendHost.InspectorFrontendHostInstance.openInNewTab("https://bugs.chromium.org/p/chromium/issues/detail?id=1354548")}))),i.appendChild(s.UIUtils.createTextButton(ei(Zt.enableThisPanelTemporarily),(async function(){await s.ViewManager.ViewManager.instance().showView("experiments");(await s.ViewManager.ViewManager.instance().view("experiments").widget()).setFilter("Enable JavaScript Profiler temporarily")}))),t.show(e.element)}}wasShown(){super.wasShown(),s.Context.Context.instance().setFlavor(ai,this)}willHide(){s.Context.Context.instance().setFlavor(ai,null)}handleAction(e,t){const i=s.Context.Context.instance().flavor(ai);if(!(i instanceof ai))throw new Error("non-null JSProfilerPanel expected!");return i.toggleRecord(),!0}}var li=Object.freeze({__proto__:null,ProfilesPanel:ti,ProfileTypeSidebarSection:ii,ProfileGroup:ri,ProfileGroupSidebarTreeElement:si,ProfilesSidebarTreeElement:oi,JSProfilerPanel:ai});const di={revealInSummaryView:"Reveal in Summary view"},hi=t.i18n.registerUIStrings("panels/profiler/HeapProfilerPanel.ts",di),ci=t.i18n.getLocalizedString.bind(void 0,hi);let pi;class ui extends ti{constructor(){const e=Kt;super("heap_profiler",[e.heapSnapshotProfileType,e.trackingHeapSnapshotProfileType,e.samplingHeapProfileType],"profiler.heap-toggle-recording")}static instance(){return pi||(pi=new ui),pi}appendApplicableItems(e,t,i){if(!(i instanceof l.RemoteObject.RemoteObject))return;if(!this.isShowing())return;const r=i;if(!r.objectId)return;const s=r.objectId;if(!Kt.heapSnapshotProfileType.getProfiles().length)return;const o=r.runtimeModel().heapProfilerModel();o&&t.revealSection().appendItem(ci(di.revealInSummaryView),function(e){o.snapshotObjectIdForObjectId(s).then((t=>{this.isShowing()&&t&&this.showObject(t,e)}))}.bind(this,"Summary"))}handleAction(e,t){const i=s.Context.Context.instance().flavor(ui);return console.assert(Boolean(i)&&i instanceof ui),i&&i.toggleRecord(),!0}wasShown(){super.wasShown(),s.Context.Context.instance().setFlavor(ui,this),a.userMetrics.panelLoaded("heap_profiler","DevTools.Launch.HeapProfiler")}willHide(){s.Context.Context.instance().setFlavor(ui,null)}showObject(e,t){const i=Kt.heapSnapshotProfileType.getProfiles();for(let r=0;r<i.length;r++){const s=i[r];if(s.maxJSObjectId>=parseInt(e,10)){this.showProfile(s);this.viewForProfile(s).selectLiveObject(t,e);break}}}}var mi=Object.freeze({__proto__:null,HeapProfilerPanel:ui});const fi=new CSSStyleSheet;fi.replaceSync(".data-grid{border:none}.data-grid td .size-units{margin-left:4px;font-size:75%}.data-grid tr:not(.selected) td .size-units{color:var(--color-text-secondary)}.toolbar{border-bottom:1px solid var(--color-details-hairline)}\n/*# sourceURL=liveHeapProfile.css */\n");const gi={jsHeap:"JS Heap",allocatedJsHeapSizeCurrentlyIn:"Allocated JS heap size currently in use",vms:"VMs",numberOfVmsSharingTheSameScript:"Number of VMs sharing the same script source",scriptUrl:"Script URL",urlOfTheScriptSource:"URL of the script source",heapProfile:"Heap Profile",anonymousScriptS:"(Anonymous Script {PH1})",kb:"kB"},vi=t.i18n.registerUIStrings("panels/profiler/LiveHeapProfileView.ts",gi),wi=t.i18n.getLocalizedString.bind(void 0,vi);let Si,bi;class Ci extends s.Widget.VBox{gridNodeByUrl;setting;toggleRecordAction;toggleRecordButton;startWithReloadButton;dataGrid;currentPollId;constructor(){super(!0),this.gridNodeByUrl=new Map,this.setting=o.Settings.Settings.instance().moduleSetting("memoryLiveHeapProfile");const e=new s.Toolbar.Toolbar("live-heap-profile-toolbar",this.contentElement);this.toggleRecordAction=s.ActionRegistry.ActionRegistry.instance().action("live-heap-profile.toggle-recording"),this.toggleRecordButton=s.Toolbar.Toolbar.createActionButton(this.toggleRecordAction),this.toggleRecordButton.setToggled(this.setting.get()),e.appendToolbarItem(this.toggleRecordButton);const t=l.TargetManager.TargetManager.instance().primaryPageTarget();if(t&&t.model(l.ResourceTreeModel.ResourceTreeModel)){const t=s.ActionRegistry.ActionRegistry.instance().action("live-heap-profile.start-with-reload");this.startWithReloadButton=s.Toolbar.Toolbar.createActionButton(t),e.appendToolbarItem(this.startWithReloadButton)}this.dataGrid=this.createDataGrid(),this.dataGrid.asWidget().show(this.contentElement),this.currentPollId=0}static instance(){return Si||(Si=new Ci),Si}createDataGrid(){const e={id:"",title:o.UIString.LocalizedEmptyString,width:void 0,fixedWidth:!0,sortable:!0,align:r.DataGrid.Align.Right,sort:r.DataGrid.Order.Descending,titleDOMFragment:void 0,editable:void 0,nonSelectable:void 0,longText:void 0,disclosure:void 0,weight:void 0,allowInSortByEvenWhenHidden:void 0,dataType:void 0,defaultWeight:void 0},t=[{...e,id:"size",title:wi(gi.jsHeap),width:"72px",fixedWidth:!0,sortable:!0,align:r.DataGrid.Align.Right,sort:r.DataGrid.Order.Descending,tooltip:wi(gi.allocatedJsHeapSizeCurrentlyIn)},{...e,id:"isolates",title:wi(gi.vms),width:"40px",fixedWidth:!0,align:r.DataGrid.Align.Right,tooltip:wi(gi.numberOfVmsSharingTheSameScript)},{...e,id:"url",title:wi(gi.scriptUrl),fixedWidth:!1,sortable:!0,tooltip:wi(gi.urlOfTheScriptSource)}],i=new r.SortableDataGrid.SortableDataGrid({displayName:wi(gi.heapProfile),columns:t,editCallback:void 0,deleteCallback:void 0,refreshCallback:void 0});i.setResizeMethod(r.DataGrid.ResizeMethod.Last),i.element.classList.add("flex-auto"),i.element.addEventListener("keydown",this.onKeyDown.bind(this),!1),i.addEventListener(r.DataGrid.Events.OpenedNode,this.revealSourceForSelectedNode,this),i.addEventListener(r.DataGrid.Events.SortingChanged,this.sortingChanged,this);for(const e of t){const t=i.headerTableHeader(e.id);t&&t.setAttribute("title",e.tooltip)}return i}wasShown(){super.wasShown(),this.poll(),this.registerCSSFiles([fi]),this.setting.addChangeListener(this.settingChanged,this)}willHide(){++this.currentPollId,this.setting.removeChangeListener(this.settingChanged,this)}settingChanged(e){this.toggleRecordButton.setToggled(e.data)}async poll(){const e=this.currentPollId;do{const t=Array.from(l.IsolateManager.IsolateManager.instance().isolates()),i=await Promise.all(t.map((e=>{const t=e.heapProfilerModel();return t?t.getSamplingProfile():null})));if(this.currentPollId!==e)return;this.update(t,i),await new Promise((e=>window.setTimeout(e,3e3)))}while(this.currentPollId===e)}update(e,t){const i=new Map;t.forEach(((t,i)=>{t&&o(e[i],"",t.head)}));const r=this.dataGrid.rootNode(),s=new Set;for(const e of i){const t=e[0],i=e[1].size,o=e[1].isolates.size;if(!t){console.info(`Node with empty URL: ${i} bytes`);continue}let n=this.gridNodeByUrl.get(t);n?n.updateNode(i,o):(n=new Pi(t,i,o),this.gridNodeByUrl.set(t,n),r.appendChild(n)),s.add(n)}for(const e of r.children.slice()){s.has(e)||e.remove();const t=e;this.gridNodeByUrl.delete(t.url)}function o(e,t,r){const s=r.callFrame.url||t||function(e){const t=e.callFrame.functionName;return t.startsWith("(")&&"(root)"!==t?t:""}(r)||function(e){return Number(e.callFrame.scriptId)?wi(gi.anonymousScriptS,{PH1:e.callFrame.scriptId}):""}(r);if(r.children.forEach(o.bind(null,e,s)),!r.selfSize)return;let n=i.get(s);n||(n={size:0,isolates:new Set},i.set(s,n)),n.size+=r.selfSize,n.isolates.add(e)}this.sortingChanged()}onKeyDown(e){"Enter"===e.key&&(e.consume(!0),this.revealSourceForSelectedNode())}revealSourceForSelectedNode(){const e=this.dataGrid.selectedNode;if(!e||!e.url)return;const t=m.Workspace.WorkspaceImpl.instance().uiSourceCodeForURL(e.url);t&&o.Revealer.reveal(t)}sortingChanged(){const e=this.dataGrid.sortColumnId();if(!e)return;const t="url"===e?function(e,t){return t.url.localeCompare(e.url)}:function(e,t){return t.size-e.size};this.dataGrid.sortNodes(t,this.dataGrid.isSortOrderAscending())}toggleRecording(){!this.setting.get()?this.startRecording(!1):this.stopRecording()}startRecording(e){if(this.setting.set(!0),!e)return;const t=l.TargetManager.TargetManager.instance().primaryPageTarget();if(!t)return;const i=t.model(l.ResourceTreeModel.ResourceTreeModel);i&&i.reloadPage()}async stopRecording(){this.setting.set(!1)}}class Pi extends r.SortableDataGrid.SortableDataGridNode{url;size;isolateCount;constructor(e,t,i){super(),this.url=e,this.size=t,this.isolateCount=i}updateNode(e,t){this.size===e&&this.isolateCount===t||(this.size=e,this.isolateCount=t,this.refresh())}createCell(t){const i=this.createTD(t);switch(t){case"url":i.textContent=this.url;break;case"size":i.textContent=e.NumberUtilities.withThousandsSeparator(Math.round(this.size/1e3)),i.createChild("span","size-units").textContent=wi(gi.kb);break;case"isolates":i.textContent=`${this.isolateCount}`}return i}}class Ti{static instance(e={forceNew:null}){const{forceNew:t}=e;return bi&&!t||(bi=new Ti),bi}handleAction(e,t){return(async()=>{const e="live_heap_profile";await s.ViewManager.ViewManager.instance().showView(e);const i=s.ViewManager.ViewManager.instance().view(e);if(i){const e=await i.widget();this.innerHandleAction(e,t)}})(),!0}innerHandleAction(e,t){switch(t){case"live-heap-profile.toggle-recording":e.toggleRecording();break;case"live-heap-profile.start-with-reload":e.startRecording(!0);break;default:console.assert(!1,`Unknown action: ${t}`)}}}var xi=Object.freeze({__proto__:null,LiveHeapProfileView:Ci,GridNode:Pi,ActionDelegate:Ti});export{T as BottomUpProfileDataGrid,M as CPUProfileFlameChart,de as CPUProfileView,x as ChildrenProvider,_e as HeapProfileView,mi as HeapProfilerPanel,bt as HeapSnapshotDataGrids,ot as HeapSnapshotGridNodes,Nt as HeapSnapshotProxy,qt as HeapSnapshotView,De as HeapTimelineOverview,Se as IsolateSelector,xi as LiveHeapProfileView,b as ProfileDataGrid,j as ProfileHeader,Ie as ProfileLauncherView,W as ProfileSidebarTreeElement,Yt as ProfileTypeRegistry,ee as ProfileView,li as ProfilesPanel,$ as TopDownProfileDataGrid};
@@ -0,0 +1 @@
1
+ import*as e from"../../recorder/components/components.js";import*as t from"../../../ui/lit-html/lit-html.js";const r=new CSSStyleSheet;r.replaceSync("*{box-sizing:border-box;padding:0;margin:0;font-size:inherit}:host{display:block}.row{display:flex;flex-direction:row;color:var(--color-syntax-1);font-family:var(--monospace-font-family);font-size:var(--monospace-font-size);align-items:center;line-height:18px;margin-top:3px}.separator{margin-right:0.5em;color:var(--color-text-primary)}.padded{margin-left:2em}.padded.double{margin-left:4em}\n/*# sourceURL=JSONEditor.css */\n");var o=self&&self.__decorate||function(e,t,r,o){var a,s=arguments.length,n=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,r,o);else for(var d=e.length-1;d>=0;d--)(a=e[d])&&(n=(s<3?a(n):s>3?a(t,r,n):a(t,r))||n);return s>3&&n&&Object.defineProperty(t,r,n),n};const{html:a,Decorators:s,LitElement:n,nothing:d}=t,{customElement:i,property:p,state:l}=s;let c=class extends n{static styles=[r];command="";getCommand(){return this.command}getParameters(){return this.parameters}#e=async t=>{t.target instanceof e.RecorderInput.RecorderInput&&(this.command=t.target.value)};#t(){return a`<div class="row attribute padded" data-attribute="type"> <div>command<span class="separator">:</span></div> <devtools-recorder-input .disabled="${!1}" .options="${this.protocolMethods}" .value="${this.command}" .placeholder="${"Enter your command..."}" @blur="${this.#e}"></devtools-recorder-input> </div>`}#r(){return a`<div class="row attribute padded" data-attribute="type"> <div>parameters<span class="separator">:</span></div> </div>`}#o(e){return a` <ul> ${Object.keys(e).map((t=>{const r=JSON.stringify(e[t]);return a` <div class="row attribute padded double" data-attribute="type"> <div>${t}<span class="separator">:</span></div> <devtools-recorder-input .disabled="${!1}" .value="${r}" .placeholder="${"Enter your parameter..."}"></devtools-recorder-input> </div> `}))} </ul>`}render(){return a` <div class="wrapper"> ${this.#t()} ${this.parameters&&0!==Object.keys(this.parameters).length?a` ${this.#r()} ${this.#o(this.parameters)} `:d} </div>`}};o([p()],c.prototype,"jsonPromptEditors",void 0),o([p()],c.prototype,"parameters",void 0),o([p()],c.prototype,"protocolMethods",void 0),o([l()],c.prototype,"command",void 0),c=o([i("devtools-json-editor")],c);var m=Object.freeze({__proto__:null,get JSONEditor(){return c}});export{m as JSONEditor};
@@ -0,0 +1 @@
1
+ import*as o from"../../core/i18n/i18n.js";import*as t from"../../core/root/root.js";import*as r from"../../ui/legacy/legacy.js";const i={protocolMonitor:"Protocol monitor",showProtocolMonitor:"Show Protocol monitor"},e=o.i18n.registerUIStrings("panels/protocol_monitor/protocol_monitor-meta.ts",i),n=o.i18n.getLazilyComputedLocalizedString.bind(void 0,e);let c;r.ViewManager.registerViewExtension({location:"drawer-view",id:"protocol-monitor",title:n(i.protocolMonitor),commandPrompt:n(i.showProtocolMonitor),order:100,persistence:"closeable",loadView:async()=>(await async function(){return c||(c=await import("./protocol_monitor.js")),c}()).ProtocolMonitor.ProtocolMonitorImpl.instance(),experiment:t.Runtime.ExperimentName.PROTOCOL_MONITOR});