@buoy-gg/js-top 7.0.41 → 7.0.42

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 (118) hide show
  1. package/README.md +12 -71
  2. package/lib/commonjs/index.js +1 -99
  3. package/lib/commonjs/js-top/components/BusySparkline.js +1 -56
  4. package/lib/commonjs/js-top/components/JsTopHudOverlay.js +1 -79
  5. package/lib/commonjs/js-top/components/JsTopModal.js +1 -349
  6. package/lib/commonjs/js-top/components/TaskDetailView.js +1 -330
  7. package/lib/commonjs/js-top/components/TaskTable.js +1 -360
  8. package/lib/commonjs/js-top/engine/JsTopController.js +1 -350
  9. package/lib/commonjs/js-top/engine/aggregator.js +1 -148
  10. package/lib/commonjs/js-top/engine/busyProbe.js +1 -101
  11. package/lib/commonjs/js-top/engine/frameStack.js +1 -133
  12. package/lib/commonjs/js-top/engine/longtasks.js +1 -141
  13. package/lib/commonjs/js-top/engine/now.js +1 -38
  14. package/lib/commonjs/js-top/engine/originRegistry.js +1 -402
  15. package/lib/commonjs/js-top/engine/patches/bridge.js +1 -60
  16. package/lib/commonjs/js-top/engine/patches/microtasks.js +1 -27
  17. package/lib/commonjs/js-top/engine/patches/promises.js +1 -65
  18. package/lib/commonjs/js-top/engine/patches/timers.js +1 -66
  19. package/lib/commonjs/js-top/engine/state.js +1 -63
  20. package/lib/commonjs/js-top/engine/symbolicate.js +1 -95
  21. package/lib/commonjs/js-top/sync/jsTopSyncAdapter.js +1 -74
  22. package/lib/commonjs/js-top/types/index.js +1 -46
  23. package/lib/commonjs/js-top/utils/preferences.js +1 -31
  24. package/lib/commonjs/preset.js +1 -75
  25. package/lib/module/index.js +1 -49
  26. package/lib/module/js-top/components/BusySparkline.js +1 -52
  27. package/lib/module/js-top/components/JsTopHudOverlay.js +1 -75
  28. package/lib/module/js-top/components/JsTopModal.js +1 -345
  29. package/lib/module/js-top/components/TaskDetailView.js +1 -326
  30. package/lib/module/js-top/components/TaskTable.js +1 -353
  31. package/lib/module/js-top/engine/JsTopController.js +1 -347
  32. package/lib/module/js-top/engine/aggregator.js +1 -136
  33. package/lib/module/js-top/engine/busyProbe.js +1 -94
  34. package/lib/module/js-top/engine/frameStack.js +1 -126
  35. package/lib/module/js-top/engine/longtasks.js +1 -133
  36. package/lib/module/js-top/engine/now.js +1 -33
  37. package/lib/module/js-top/engine/originRegistry.js +1 -388
  38. package/lib/module/js-top/engine/patches/bridge.js +1 -56
  39. package/lib/module/js-top/engine/patches/microtasks.js +1 -23
  40. package/lib/module/js-top/engine/patches/promises.js +1 -62
  41. package/lib/module/js-top/engine/patches/timers.js +1 -62
  42. package/lib/module/js-top/engine/state.js +1 -54
  43. package/lib/module/js-top/engine/symbolicate.js +1 -91
  44. package/lib/module/js-top/sync/jsTopSyncAdapter.js +1 -70
  45. package/lib/module/js-top/types/index.js +1 -42
  46. package/lib/module/js-top/utils/preferences.js +1 -26
  47. package/lib/module/preset.js +1 -71
  48. package/lib/web/index.mjs +2 -3
  49. package/package.json +2 -2
  50. package/lib/commonjs/index.js.map +0 -1
  51. package/lib/commonjs/js-top/components/BusySparkline.js.map +0 -1
  52. package/lib/commonjs/js-top/components/JsTopHudOverlay.js.map +0 -1
  53. package/lib/commonjs/js-top/components/JsTopModal.js.map +0 -1
  54. package/lib/commonjs/js-top/components/TaskDetailView.js.map +0 -1
  55. package/lib/commonjs/js-top/components/TaskTable.js.map +0 -1
  56. package/lib/commonjs/js-top/engine/JsTopController.js.map +0 -1
  57. package/lib/commonjs/js-top/engine/aggregator.js.map +0 -1
  58. package/lib/commonjs/js-top/engine/busyProbe.js.map +0 -1
  59. package/lib/commonjs/js-top/engine/frameStack.js.map +0 -1
  60. package/lib/commonjs/js-top/engine/longtasks.js.map +0 -1
  61. package/lib/commonjs/js-top/engine/now.js.map +0 -1
  62. package/lib/commonjs/js-top/engine/originRegistry.js.map +0 -1
  63. package/lib/commonjs/js-top/engine/patches/bridge.js.map +0 -1
  64. package/lib/commonjs/js-top/engine/patches/microtasks.js.map +0 -1
  65. package/lib/commonjs/js-top/engine/patches/promises.js.map +0 -1
  66. package/lib/commonjs/js-top/engine/patches/timers.js.map +0 -1
  67. package/lib/commonjs/js-top/engine/state.js.map +0 -1
  68. package/lib/commonjs/js-top/engine/symbolicate.js.map +0 -1
  69. package/lib/commonjs/js-top/sync/jsTopSyncAdapter.js.map +0 -1
  70. package/lib/commonjs/js-top/types/index.js.map +0 -1
  71. package/lib/commonjs/js-top/utils/preferences.js.map +0 -1
  72. package/lib/commonjs/preset.js.map +0 -1
  73. package/lib/module/index.js.map +0 -1
  74. package/lib/module/js-top/components/BusySparkline.js.map +0 -1
  75. package/lib/module/js-top/components/JsTopHudOverlay.js.map +0 -1
  76. package/lib/module/js-top/components/JsTopModal.js.map +0 -1
  77. package/lib/module/js-top/components/TaskDetailView.js.map +0 -1
  78. package/lib/module/js-top/components/TaskTable.js.map +0 -1
  79. package/lib/module/js-top/engine/JsTopController.js.map +0 -1
  80. package/lib/module/js-top/engine/aggregator.js.map +0 -1
  81. package/lib/module/js-top/engine/busyProbe.js.map +0 -1
  82. package/lib/module/js-top/engine/frameStack.js.map +0 -1
  83. package/lib/module/js-top/engine/longtasks.js.map +0 -1
  84. package/lib/module/js-top/engine/now.js.map +0 -1
  85. package/lib/module/js-top/engine/originRegistry.js.map +0 -1
  86. package/lib/module/js-top/engine/patches/bridge.js.map +0 -1
  87. package/lib/module/js-top/engine/patches/microtasks.js.map +0 -1
  88. package/lib/module/js-top/engine/patches/promises.js.map +0 -1
  89. package/lib/module/js-top/engine/patches/timers.js.map +0 -1
  90. package/lib/module/js-top/engine/state.js.map +0 -1
  91. package/lib/module/js-top/engine/symbolicate.js.map +0 -1
  92. package/lib/module/js-top/sync/jsTopSyncAdapter.js.map +0 -1
  93. package/lib/module/js-top/types/index.js.map +0 -1
  94. package/lib/module/js-top/utils/preferences.js.map +0 -1
  95. package/lib/module/preset.js.map +0 -1
  96. package/lib/typescript/index.d.ts.map +0 -1
  97. package/lib/typescript/js-top/components/BusySparkline.d.ts.map +0 -1
  98. package/lib/typescript/js-top/components/JsTopHudOverlay.d.ts.map +0 -1
  99. package/lib/typescript/js-top/components/JsTopModal.d.ts.map +0 -1
  100. package/lib/typescript/js-top/components/TaskDetailView.d.ts.map +0 -1
  101. package/lib/typescript/js-top/components/TaskTable.d.ts.map +0 -1
  102. package/lib/typescript/js-top/engine/JsTopController.d.ts.map +0 -1
  103. package/lib/typescript/js-top/engine/aggregator.d.ts.map +0 -1
  104. package/lib/typescript/js-top/engine/busyProbe.d.ts.map +0 -1
  105. package/lib/typescript/js-top/engine/frameStack.d.ts.map +0 -1
  106. package/lib/typescript/js-top/engine/longtasks.d.ts.map +0 -1
  107. package/lib/typescript/js-top/engine/now.d.ts.map +0 -1
  108. package/lib/typescript/js-top/engine/originRegistry.d.ts.map +0 -1
  109. package/lib/typescript/js-top/engine/patches/bridge.d.ts.map +0 -1
  110. package/lib/typescript/js-top/engine/patches/microtasks.d.ts.map +0 -1
  111. package/lib/typescript/js-top/engine/patches/promises.d.ts.map +0 -1
  112. package/lib/typescript/js-top/engine/patches/timers.d.ts.map +0 -1
  113. package/lib/typescript/js-top/engine/state.d.ts.map +0 -1
  114. package/lib/typescript/js-top/engine/symbolicate.d.ts.map +0 -1
  115. package/lib/typescript/js-top/sync/jsTopSyncAdapter.d.ts.map +0 -1
  116. package/lib/typescript/js-top/types/index.d.ts.map +0 -1
  117. package/lib/typescript/js-top/utils/preferences.d.ts.map +0 -1
  118. package/lib/typescript/preset.d.ts.map +0 -1
@@ -1,360 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.API_BADGE = void 0;
7
- exports.TaskTable = TaskTable;
8
- exports.badgeFor = badgeFor;
9
- exports.displayName = displayName;
10
- var _react = require("react");
11
- var _reactNative = require("react-native");
12
- var _sharedUi = require("@buoy-gg/shared-ui");
13
- var _jsxRuntime = require("react/jsx-runtime");
14
- /**
15
- * The ranked task table — the "process list".
16
- *
17
- * Row layout (phone-first): the API is a small colored badge and the FULL
18
- * width goes to the task name (the part that varies); numbers live on a
19
- * second stats line instead of fixed-width columns, so nothing truncates:
20
- *
21
- * 1 [INTERVAL] hotIntervalWork 1240 ms 41%
22
- * ▓▓▓▓▓░░░░░ 50 calls · avg 24.8 · max 31.0 · total 1.2k
23
- *
24
- * Sorting is a chip row above the list (column headers don't survive on a
25
- * narrow screen). Rows keyed by origin key (never index: rows re-rank every
26
- * tick) and memoized with a precise comparator so a tick only re-renders
27
- * rows whose numbers moved.
28
- */
29
-
30
- const SORT_OPTIONS = [{
31
- key: "windowMs",
32
- title: "RECENT"
33
- }, {
34
- key: "calls",
35
- title: "CALLS"
36
- }, {
37
- key: "avgMs",
38
- title: "AVG"
39
- }, {
40
- key: "maxMs",
41
- title: "MAX"
42
- }, {
43
- key: "totalMs",
44
- title: "TOTAL"
45
- }];
46
- const API_BADGE = exports.API_BADGE = {
47
- timeout: {
48
- text: "TIMEOUT",
49
- color: "#38BDF8",
50
- prefix: "setTimeout"
51
- },
52
- interval: {
53
- text: "INTERVAL",
54
- color: "#22D3EE",
55
- prefix: "setInterval"
56
- },
57
- immediate: {
58
- text: "IMMED",
59
- color: "#60A5FA",
60
- prefix: "setImmediate"
61
- },
62
- raf: {
63
- text: "RAF",
64
- color: "#34D399",
65
- prefix: "requestAnimationFrame"
66
- },
67
- microtask: {
68
- text: "MICRO",
69
- color: "#A78BFA",
70
- prefix: "queueMicrotask"
71
- },
72
- then: {
73
- text: "PROMISE",
74
- color: "#BF5AF2",
75
- prefix: "Promise.then"
76
- },
77
- bridge: {
78
- text: "BRIDGE",
79
- color: "#FBBF24",
80
- prefix: "bridge"
81
- },
82
- unattributed: {
83
- text: "SYSTEM",
84
- color: "#8E8E93"
85
- },
86
- other: {
87
- text: "OTHER",
88
- color: "#8E8E93",
89
- prefix: "other"
90
- }
91
- };
92
- function badgeFor(api) {
93
- return API_BADGE[api] ?? API_BADGE.other;
94
- }
95
-
96
- /** The row label minus its API prefix — the badge already says the API. */
97
- function displayName(row) {
98
- if (row.api === "unattributed") return "events · React · native call-ins";
99
- if (row.api === "other") return "evicted cold origins";
100
- const prefix = badgeFor(row.api).prefix;
101
- let name = row.label;
102
- if (prefix && name.startsWith(prefix)) name = name.slice(prefix.length);
103
- name = name.replace(/^[\s←@]+/, "").trim();
104
- return name.length > 0 ? name : "anonymous";
105
- }
106
- function fmt(n) {
107
- if (n >= 10_000) return `${Math.round(n / 1000)}k`;
108
- if (n >= 1000) return `${(n / 1000).toFixed(1)}k`;
109
- if (n >= 100) return `${Math.round(n)}`;
110
- return `${Math.round(n * 10) / 10}`;
111
- }
112
- function statsLine(row) {
113
- if (row.calls <= 0) return "measured by probe · not reachable from JS";
114
- return `${fmt(row.calls)} calls · avg ${fmt(row.avgMs)} · max ${fmt(row.maxMs)} · total ${fmt(row.totalMs)} ms`;
115
- }
116
- const TaskRow = /*#__PURE__*/(0, _react.memo)(function TaskRow({
117
- row,
118
- rank,
119
- onPress
120
- }) {
121
- const badge = badgeFor(row.api);
122
- const Wrapper = onPress ? _reactNative.TouchableOpacity : _reactNative.View;
123
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Wrapper, {
124
- style: rowStyles.row,
125
- ...(onPress ? {
126
- onPress: () => onPress(row),
127
- activeOpacity: 0.6
128
- } : {}),
129
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
130
- style: rowStyles.topLine,
131
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
132
- style: rowStyles.rank,
133
- children: rank
134
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
135
- style: [rowStyles.badge, {
136
- borderColor: badge.color,
137
- backgroundColor: `${badge.color}1A`
138
- }],
139
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
140
- style: [rowStyles.badgeText, {
141
- color: badge.color
142
- }],
143
- children: badge.text
144
- })
145
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
146
- style: rowStyles.name,
147
- numberOfLines: 1,
148
- children: displayName(row)
149
- }), row.freezes > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
150
- style: [rowStyles.freezeBadge, row.worstFreezeMs >= 100 && rowStyles.freezeBadgeSevere],
151
- children: ["\u26A0 \xD7", row.freezes]
152
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
153
- style: [rowStyles.windowMs, row.api !== "unattributed" && row.pctOfBusy >= 25 && {
154
- color: row.pctOfBusy >= 50 ? _sharedUi.macOSColors.semantic.error : _sharedUi.macOSColors.semantic.warning
155
- }],
156
- children: [fmt(row.windowMs), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
157
- style: rowStyles.unit,
158
- children: " ms"
159
- })]
160
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
161
- style: [rowStyles.pct, row.api === "unattributed" && rowStyles.pctMuted],
162
- children: [Math.round(row.pctOfBusy), "%"]
163
- })]
164
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
165
- style: rowStyles.subLine,
166
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
167
- style: rowStyles.barTrack,
168
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
169
- style: [rowStyles.barFill, {
170
- width: `${Math.min(100, row.pctOfBusy)}%`,
171
- backgroundColor: badge.color
172
- }]
173
- })
174
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
175
- style: rowStyles.stats,
176
- numberOfLines: 1,
177
- children: statsLine(row)
178
- })]
179
- })]
180
- });
181
- }, (prev, next) => prev.rank === next.rank && prev.onPress === next.onPress && prev.row.key === next.row.key && prev.row.windowMs === next.row.windowMs && prev.row.calls === next.row.calls && prev.row.maxMs === next.row.maxMs && prev.row.totalMs === next.row.totalMs && prev.row.pctOfBusy === next.row.pctOfBusy && prev.row.freezes === next.row.freezes && prev.row.worstFreezeMs === next.row.worstFreezeMs);
182
- function TaskTable({
183
- rows,
184
- onSelectRow
185
- }) {
186
- const [sortKey, setSortKey] = (0, _react.useState)("windowMs");
187
- const sorted = sortKey === "windowMs" ? rows : [...rows].sort((a, b) => b[sortKey] - a[sortKey]);
188
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
189
- style: styles.root,
190
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
191
- style: styles.sortRow,
192
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
193
- style: styles.sortLabel,
194
- children: "SORT"
195
- }), SORT_OPTIONS.map(o => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
196
- onPress: () => setSortKey(o.key),
197
- style: [styles.sortChip, sortKey === o.key && styles.sortChipOn],
198
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
199
- style: [styles.sortChipText, sortKey === o.key && styles.sortChipTextOn],
200
- children: o.title
201
- })
202
- }, o.key))]
203
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
204
- style: styles.body,
205
- children: [sorted.map((row, i) => /*#__PURE__*/(0, _jsxRuntime.jsx)(TaskRow, {
206
- row: row,
207
- rank: i + 1,
208
- onPress: onSelectRow
209
- }, row.key)), sorted.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
210
- style: styles.empty,
211
- children: "No tasks observed yet \u2014 interact with the app."
212
- })]
213
- })]
214
- });
215
- }
216
- const styles = _reactNative.StyleSheet.create({
217
- root: {
218
- flex: 1,
219
- minHeight: 0
220
- },
221
- sortRow: {
222
- flexDirection: "row",
223
- alignItems: "center",
224
- gap: 6,
225
- paddingHorizontal: 10,
226
- paddingVertical: 6,
227
- borderBottomWidth: 1,
228
- borderBottomColor: _sharedUi.night.color.border,
229
- backgroundColor: _sharedUi.night.color.surface
230
- },
231
- sortLabel: {
232
- color: _sharedUi.night.color.textTertiary,
233
- fontSize: 9,
234
- fontWeight: "700",
235
- letterSpacing: 0.5,
236
- marginRight: 2
237
- },
238
- sortChip: {
239
- borderWidth: 1,
240
- borderColor: _sharedUi.night.color.border,
241
- borderRadius: 4,
242
- paddingHorizontal: 7,
243
- paddingVertical: 3
244
- },
245
- sortChipOn: {
246
- borderColor: _sharedUi.night.color.accentBorderStrong,
247
- backgroundColor: _sharedUi.night.color.accentSoft
248
- },
249
- sortChipText: {
250
- color: _sharedUi.night.color.textTertiary,
251
- fontSize: 9,
252
- fontWeight: "600",
253
- fontVariant: ["tabular-nums"]
254
- },
255
- sortChipTextOn: {
256
- color: _sharedUi.night.color.accent
257
- },
258
- body: {
259
- flex: 1
260
- },
261
- empty: {
262
- color: _sharedUi.night.color.textTertiary,
263
- fontSize: 12,
264
- textAlign: "center",
265
- paddingVertical: 24
266
- }
267
- });
268
- const rowStyles = _reactNative.StyleSheet.create({
269
- row: {
270
- paddingHorizontal: 10,
271
- paddingVertical: 8,
272
- borderBottomWidth: _reactNative.StyleSheet.hairlineWidth,
273
- borderBottomColor: _sharedUi.night.color.border,
274
- gap: 5
275
- },
276
- topLine: {
277
- flexDirection: "row",
278
- alignItems: "center",
279
- gap: 6
280
- },
281
- rank: {
282
- width: 16,
283
- color: _sharedUi.night.color.textTertiary,
284
- fontSize: 10,
285
- fontVariant: ["tabular-nums"]
286
- },
287
- badge: {
288
- borderWidth: 1,
289
- borderRadius: 3,
290
- paddingHorizontal: 4,
291
- paddingVertical: 1
292
- },
293
- badgeText: {
294
- fontSize: 8,
295
- fontWeight: "700",
296
- letterSpacing: 0.4
297
- },
298
- name: {
299
- flex: 1,
300
- color: _sharedUi.night.color.text,
301
- fontSize: 13,
302
- fontWeight: "500"
303
- },
304
- freezeBadge: {
305
- color: _sharedUi.macOSColors.semantic.warning,
306
- fontSize: 10,
307
- fontWeight: "700",
308
- fontVariant: ["tabular-nums"]
309
- },
310
- freezeBadgeSevere: {
311
- color: _sharedUi.macOSColors.semantic.error
312
- },
313
- windowMs: {
314
- color: _sharedUi.night.color.text,
315
- fontSize: 13,
316
- fontWeight: "700",
317
- fontVariant: ["tabular-nums"]
318
- },
319
- unit: {
320
- color: _sharedUi.night.color.textTertiary,
321
- fontSize: 10,
322
- fontWeight: "400"
323
- },
324
- pct: {
325
- width: 38,
326
- textAlign: "right",
327
- color: _sharedUi.night.color.textSecondary,
328
- fontSize: 12,
329
- fontWeight: "600",
330
- fontVariant: ["tabular-nums"]
331
- },
332
- pctMuted: {
333
- color: _sharedUi.night.color.textTertiary
334
- },
335
- subLine: {
336
- flexDirection: "row",
337
- alignItems: "center",
338
- gap: 8,
339
- paddingLeft: 22
340
- },
341
- barTrack: {
342
- width: 72,
343
- height: 4,
344
- borderRadius: 2,
345
- backgroundColor: _sharedUi.night.color.fillSecondary,
346
- overflow: "hidden"
347
- },
348
- barFill: {
349
- height: 4,
350
- borderRadius: 2,
351
- opacity: 0.85
352
- },
353
- stats: {
354
- flex: 1,
355
- color: _sharedUi.night.color.textTertiary,
356
- fontSize: 10,
357
- fontVariant: ["tabular-nums"]
358
- }
359
- });
360
- //# sourceMappingURL=TaskTable.js.map
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.API_BADGE=void 0;exports.TaskTable=TaskTable;exports.badgeFor=badgeFor;exports.displayName=displayName;var _react=require("react");var _reactNative=require("react-native");var _sharedUi=require("@buoy-gg/shared-ui");var _jsxRuntime=require("react/jsx-runtime");const SORT_OPTIONS=[{key:"windowMs",title:"RECENT"},{key:"calls",title:"CALLS"},{key:"avgMs",title:"AVG"},{key:"maxMs",title:"MAX"},{key:"totalMs",title:"TOTAL"}];const API_BADGE=exports.API_BADGE={timeout:{text:"TIMEOUT",color:"#38BDF8",prefix:"setTimeout"},interval:{text:"INTERVAL",color:"#22D3EE",prefix:"setInterval"},immediate:{text:"IMMED",color:"#60A5FA",prefix:"setImmediate"},raf:{text:"RAF",color:"#34D399",prefix:"requestAnimationFrame"},microtask:{text:"MICRO",color:"#A78BFA",prefix:"queueMicrotask"},then:{text:"PROMISE",color:"#BF5AF2",prefix:"Promise.then"},bridge:{text:"BRIDGE",color:"#FBBF24",prefix:"bridge"},unattributed:{text:"SYSTEM",color:"#8E8E93"},other:{text:"OTHER",color:"#8E8E93",prefix:"other"}};function badgeFor(e){return API_BADGE[e]??API_BADGE.other}function displayName(e){if(e.api==="unattributed")return"events \xB7 React \xB7 native call-ins";if(e.api==="other")return"evicted cold origins";const t=badgeFor(e.api).prefix;let r=e.label;if(t&&r.startsWith(t))r=r.slice(t.length);r=r.replace(/^[\s←@]+/,"").trim();return r.length>0?r:"anonymous"}function fmt(e){if(e>=1e4)return`${Math.round(e/1e3)}k`;if(e>=1e3)return`${(e/1e3).toFixed(1)}k`;if(e>=100)return`${Math.round(e)}`;return`${Math.round(e*10)/10}`}function statsLine(e){if(e.calls<=0)return"measured by probe \xB7 not reachable from JS";return`${fmt(e.calls)} calls \xB7 avg ${fmt(e.avgMs)} \xB7 max ${fmt(e.maxMs)} \xB7 total ${fmt(e.totalMs)} ms`}const TaskRow=(0,_react.memo)(function e({row:t,rank:r,onPress:a}){const i=badgeFor(t.api);const o=a?_reactNative.TouchableOpacity:_reactNative.View;return(0,_jsxRuntime.jsxs)(o,{style:rowStyles.row,...a?{onPress:()=>a(t),activeOpacity:.6}:{},children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:rowStyles.topLine,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.rank,children:r}),(0,_jsxRuntime.jsx)(_reactNative.View,{style:[rowStyles.badge,{borderColor:i.color,backgroundColor:`${i.color}1A`}],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[rowStyles.badgeText,{color:i.color}],children:i.text})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.name,numberOfLines:1,children:displayName(t)}),t.freezes>0&&(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[rowStyles.freezeBadge,t.worstFreezeMs>=100&&rowStyles.freezeBadgeSevere],children:["\u26A0 \xD7",t.freezes]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[rowStyles.windowMs,t.api!=="unattributed"&&t.pctOfBusy>=25&&{color:t.pctOfBusy>=50?_sharedUi.macOSColors.semantic.error:_sharedUi.macOSColors.semantic.warning}],children:[fmt(t.windowMs),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.unit,children:" ms"})]}),(0,_jsxRuntime.jsxs)(_reactNative.Text,{style:[rowStyles.pct,t.api==="unattributed"&&rowStyles.pctMuted],children:[Math.round(t.pctOfBusy),"%"]})]}),(0,_jsxRuntime.jsxs)(_reactNative.View,{style:rowStyles.subLine,children:[(0,_jsxRuntime.jsx)(_reactNative.View,{style:rowStyles.barTrack,children:(0,_jsxRuntime.jsx)(_reactNative.View,{style:[rowStyles.barFill,{width:`${Math.min(100,t.pctOfBusy)}%`,backgroundColor:i.color}]})}),(0,_jsxRuntime.jsx)(_reactNative.Text,{style:rowStyles.stats,numberOfLines:1,children:statsLine(t)})]})]})},(e,t)=>e.rank===t.rank&&e.onPress===t.onPress&&e.row.key===t.row.key&&e.row.windowMs===t.row.windowMs&&e.row.calls===t.row.calls&&e.row.maxMs===t.row.maxMs&&e.row.totalMs===t.row.totalMs&&e.row.pctOfBusy===t.row.pctOfBusy&&e.row.freezes===t.row.freezes&&e.row.worstFreezeMs===t.row.worstFreezeMs);function TaskTable({rows:e,onSelectRow:t}){const[r,a]=(0,_react.useState)("windowMs");const i=r==="windowMs"?e:[...e].sort((o,n)=>n[r]-o[r]);return(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.root,children:[(0,_jsxRuntime.jsxs)(_reactNative.View,{style:styles.sortRow,children:[(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.sortLabel,children:"SORT"}),SORT_OPTIONS.map(o=>(0,_jsxRuntime.jsx)(_reactNative.TouchableOpacity,{onPress:()=>a(o.key),style:[styles.sortChip,r===o.key&&styles.sortChipOn],children:(0,_jsxRuntime.jsx)(_reactNative.Text,{style:[styles.sortChipText,r===o.key&&styles.sortChipTextOn],children:o.title})},o.key))]}),(0,_jsxRuntime.jsxs)(_reactNative.ScrollView,{style:styles.body,children:[i.map((o,n)=>(0,_jsxRuntime.jsx)(TaskRow,{row:o,rank:n+1,onPress:t},o.key)),i.length===0&&(0,_jsxRuntime.jsx)(_reactNative.Text,{style:styles.empty,children:"No tasks observed yet \u2014 interact with the app."})]})]})}const styles=_reactNative.StyleSheet.create({root:{flex:1,minHeight:0},sortRow:{flexDirection:"row",alignItems:"center",gap:6,paddingHorizontal:10,paddingVertical:6,borderBottomWidth:1,borderBottomColor:_sharedUi.night.color.border,backgroundColor:_sharedUi.night.color.surface},sortLabel:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"700",letterSpacing:.5,marginRight:2},sortChip:{borderWidth:1,borderColor:_sharedUi.night.color.border,borderRadius:4,paddingHorizontal:7,paddingVertical:3},sortChipOn:{borderColor:_sharedUi.night.color.accentBorderStrong,backgroundColor:_sharedUi.night.color.accentSoft},sortChipText:{color:_sharedUi.night.color.textTertiary,fontSize:9,fontWeight:"600",fontVariant:["tabular-nums"]},sortChipTextOn:{color:_sharedUi.night.color.accent},body:{flex:1},empty:{color:_sharedUi.night.color.textTertiary,fontSize:12,textAlign:"center",paddingVertical:24}});const rowStyles=_reactNative.StyleSheet.create({row:{paddingHorizontal:10,paddingVertical:8,borderBottomWidth:_reactNative.StyleSheet.hairlineWidth,borderBottomColor:_sharedUi.night.color.border,gap:5},topLine:{flexDirection:"row",alignItems:"center",gap:6},rank:{width:16,color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]},badge:{borderWidth:1,borderRadius:3,paddingHorizontal:4,paddingVertical:1},badgeText:{fontSize:8,fontWeight:"700",letterSpacing:.4},name:{flex:1,color:_sharedUi.night.color.text,fontSize:13,fontWeight:"500"},freezeBadge:{color:_sharedUi.macOSColors.semantic.warning,fontSize:10,fontWeight:"700",fontVariant:["tabular-nums"]},freezeBadgeSevere:{color:_sharedUi.macOSColors.semantic.error},windowMs:{color:_sharedUi.night.color.text,fontSize:13,fontWeight:"700",fontVariant:["tabular-nums"]},unit:{color:_sharedUi.night.color.textTertiary,fontSize:10,fontWeight:"400"},pct:{width:38,textAlign:"right",color:_sharedUi.night.color.textSecondary,fontSize:12,fontWeight:"600",fontVariant:["tabular-nums"]},pctMuted:{color:_sharedUi.night.color.textTertiary},subLine:{flexDirection:"row",alignItems:"center",gap:8,paddingLeft:22},barTrack:{width:72,height:4,borderRadius:2,backgroundColor:_sharedUi.night.color.fillSecondary,overflow:"hidden"},barFill:{height:4,borderRadius:2,opacity:.85},stats:{flex:1,color:_sharedUi.night.color.textTertiary,fontSize:10,fontVariant:["tabular-nums"]}});