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