@locusgraph/loop 0.3.0 → 0.4.0

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 (130) hide show
  1. package/dist/agent/index.d.ts +1 -1
  2. package/dist/agent/pulse/gradient-label.js +70 -17
  3. package/dist/agent/pulse/marks/bars-mark.js +39 -15
  4. package/dist/agent/pulse/marks/glyph-mark.js +57 -16
  5. package/dist/agent/pulse/marks/locus-mark.js +39 -13
  6. package/dist/agent/pulse/marks/orb-mark.js +21 -9
  7. package/dist/agent/pulse/pulse.js +1 -1
  8. package/dist/agent/pulse/use-loop-animation.d.ts +0 -1
  9. package/dist/agent/pulse/use-loop-animation.js +36 -15
  10. package/dist/agent/steps/step-icon.js +20 -13
  11. package/dist/agent/steps/steps.js +39 -37
  12. package/dist/agent/thinking/thinking.js +65 -62
  13. package/dist/agent/tool/json-block.js +10 -7
  14. package/dist/agent/tool/tool-status.d.ts +2 -0
  15. package/dist/agent/tool/tool-status.js +16 -13
  16. package/dist/agent/tool/tool.d.ts +8 -1
  17. package/dist/agent/tool/tool.js +238 -119
  18. package/dist/approval/inbox/inbox-row.d.ts +3 -3
  19. package/dist/approval/inbox/inbox-row.js +248 -86
  20. package/dist/approval/inbox/inbox.d.ts +3 -3
  21. package/dist/approval/inbox/inbox.js +251 -57
  22. package/dist/approval/inbox/virtual-inbox-list.d.ts +3 -3
  23. package/dist/approval/inbox/virtual-inbox-list.js +107 -30
  24. package/dist/approval/memory/memory-review.js +228 -91
  25. package/dist/approval/memory/memory-row.js +192 -56
  26. package/dist/approval/plan/plan-review.js +241 -108
  27. package/dist/approval/plan/plan-step-row.js +184 -77
  28. package/dist/approval/plan/plan-steps.d.ts +1 -1
  29. package/dist/approval/plan/plan-steps.js +2 -2
  30. package/dist/approval/plan/question-choices.js +139 -48
  31. package/dist/approval/plan/question.js +189 -67
  32. package/dist/approval/run/run-bar.js +138 -49
  33. package/dist/approval/shared/approval-line.d.ts +27 -0
  34. package/dist/approval/shared/approval-line.js +85 -0
  35. package/dist/approval/shared/risk-badge.d.ts +3 -5
  36. package/dist/approval/shared/risk-badge.js +11 -19
  37. package/dist/approval/shared/time.d.ts +0 -1
  38. package/dist/approval/shared/time.js +0 -1
  39. package/dist/approval/shared/use-focus-on-mount.js +23 -5
  40. package/dist/approval/shared/use-focus-when-settled.d.ts +2 -0
  41. package/dist/approval/shared/use-focus-when-settled.js +18 -0
  42. package/dist/approval/spend/raise-cap-form.d.ts +2 -2
  43. package/dist/approval/spend/raise-cap-form.js +235 -52
  44. package/dist/approval/spend/spend-gate.js +200 -106
  45. package/dist/approval/spend/spend-math.d.ts +1 -0
  46. package/dist/approval/spend/spend-math.js +5 -2
  47. package/dist/approval/spend/spend-meter.js +5 -5
  48. package/dist/approval/tool/approval.js +157 -96
  49. package/dist/approval/tool/args/args-editor.js +232 -81
  50. package/dist/approval/tool/args/args-field.js +333 -60
  51. package/dist/approval/tool/deny-form.js +114 -32
  52. package/dist/approval/tool/tool-inputs.js +93 -33
  53. package/dist/chat/chat/chat.js +5 -4
  54. package/dist/chat/chat/use-stick-to-bottom.js +116 -63
  55. package/dist/chat/chat/virtual-chat-items.js +129 -34
  56. package/dist/chat/composer/composer-actions.d.ts +1 -2
  57. package/dist/chat/composer/composer-actions.js +136 -50
  58. package/dist/chat/composer/composer-status.d.ts +2 -0
  59. package/dist/chat/composer/composer-status.js +3 -0
  60. package/dist/chat/composer/composer.d.ts +1 -1
  61. package/dist/chat/composer/composer.js +6 -4
  62. package/dist/chat/composer/use-auto-grow.js +29 -8
  63. package/dist/chat/files/files.js +296 -67
  64. package/dist/chat/index.d.ts +1 -1
  65. package/dist/chat/index.js +1 -1
  66. package/dist/chat/reply/fenced-code.js +1 -1
  67. package/dist/chat/reply/markdown-components.js +9 -116
  68. package/dist/chat/reply/reply.js +2 -2
  69. package/dist/chat/turn/group-parts.d.ts +1 -0
  70. package/dist/chat/turn/group-parts.js +6 -3
  71. package/dist/chat/turn/turn.js +13 -4
  72. package/dist/cost/context.js +3 -3
  73. package/dist/cost/cost-steps.js +31 -30
  74. package/dist/cost/cost.js +39 -39
  75. package/dist/cost/model-picker.js +176 -43
  76. package/dist/cost/shared/context-breakdown.js +10 -11
  77. package/dist/cost/shared/model-option-row.js +4 -3
  78. package/dist/cost/shared/step-cost-row.js +11 -12
  79. package/dist/cost/shared/usage-totals.d.ts +1 -0
  80. package/dist/cost/shared/usage-totals.js +19 -1
  81. package/dist/memory/cite.js +190 -59
  82. package/dist/memory/memorized.js +231 -62
  83. package/dist/memory/recall.js +272 -85
  84. package/dist/memory/shared/host-label.d.ts +1 -1
  85. package/dist/memory/shared/host-label.js +2 -2
  86. package/dist/memory/shared/source-mark.js +1 -1
  87. package/dist/memory/sources.d.ts +2 -1
  88. package/dist/memory/sources.js +277 -62
  89. package/dist/shared/decision-summary.js +2 -1
  90. package/dist/shared/line.d.ts +10 -0
  91. package/dist/shared/line.js +11 -0
  92. package/dist/shared/live-status.d.ts +3 -0
  93. package/dist/shared/live-status.js +11 -0
  94. package/dist/shared/reduced-motion.d.ts +1 -0
  95. package/dist/shared/reduced-motion.js +3 -0
  96. package/dist/shared/virtual/use-list-virtualizer.js +2 -0
  97. package/dist/thread/actions/action-button.js +1 -1
  98. package/dist/thread/actions/actions.d.ts +3 -1
  99. package/dist/thread/actions/actions.js +100 -81
  100. package/dist/thread/actions/branch-switcher.js +129 -23
  101. package/dist/thread/canvas/canvas-meta.d.ts +9 -0
  102. package/dist/thread/canvas/canvas-meta.js +35 -0
  103. package/dist/thread/canvas/canvas.d.ts +1 -1
  104. package/dist/thread/canvas/canvas.js +64 -74
  105. package/dist/thread/canvas/version-switcher.d.ts +1 -0
  106. package/dist/thread/canvas/version-switcher.js +161 -45
  107. package/dist/thread/code/code.js +4 -6
  108. package/dist/thread/code/copy-code-button.d.ts +2 -1
  109. package/dist/thread/code/copy-code-button.js +91 -26
  110. package/dist/thread/history/history.d.ts +1 -1
  111. package/dist/thread/history/history.js +104 -104
  112. package/dist/thread/history/row/history-row.js +106 -22
  113. package/dist/thread/history/row/thread-item-menu.js +84 -20
  114. package/dist/thread/history/row/thread-title-editor.js +74 -29
  115. package/dist/thread/history/virtual-history-list.js +83 -46
  116. package/dist/thread/index.d.ts +1 -0
  117. package/dist/thread/index.js +1 -0
  118. package/dist/thread/starters/starters.js +91 -28
  119. package/dist/thread/use-copied.js +40 -10
  120. package/package.json +6 -6
  121. package/dist/agent/shared/status-dot.d.ts +0 -1
  122. package/dist/agent/shared/status-dot.js +0 -1
  123. package/dist/approval/shared/decision-line.d.ts +0 -1
  124. package/dist/approval/shared/decision-line.js +0 -1
  125. package/dist/memory/shared/disclosure.d.ts +0 -6
  126. package/dist/memory/shared/disclosure.js +0 -6
  127. package/dist/shared/panel.d.ts +0 -19
  128. package/dist/shared/panel.js +0 -77
  129. package/dist/shared/status-dot.d.ts +0 -6
  130. package/dist/shared/status-dot.js +0 -20
@@ -1,53 +1,172 @@
1
- import { MailAll as InboxIcon } from "@carbon/icons-react";
2
- import { Button, Checkbox, Label } from "@locusgraph/components";
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
4
+ import { Button, Checkbox, cn, Label } from "@locusgraph/components";
3
5
  import { pluralize } from "@locusgraph/utils";
6
+ import { Tray as InboxIcon } from "@phosphor-icons/react/ssr";
4
7
  import { useId, useState } from "react";
5
- import { ApprovalPanel, LiveStatus, PanelFooter, PanelHeader, PanelTitle } from "../../shared/panel.js";
8
+ import { lineIconClass } from "../../shared/line.js";
9
+ import { LiveStatus } from "../../shared/live-status.js";
6
10
  import { PanelEmpty } from "../../shared/panel-empty.js";
7
11
  import { shouldVirtualize } from "../../shared/virtual/use-list-virtualizer.js";
8
12
  import { InboxRow } from "./inbox-row.js";
9
13
  import { bulkApprovable, selectAllState, selectedIn, toggled } from "./inbox-selection.js";
10
14
  import { VirtualInboxList } from "./virtual-inbox-list.js";
11
15
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
12
- export function Inbox({
13
- items,
14
- now = Date.now(),
15
- title = "Waiting for approval",
16
- onApprove,
17
- onDeny,
18
- onApproveAll,
19
- virtualize = true,
20
- className
21
- }) {
16
+ const oneAtATimeNote = "Destructive requests are approved one at a time.";
17
+ export function Inbox(t0) {
18
+ const $ = _c(58);
19
+ const {
20
+ items,
21
+ now: t1,
22
+ title: t2,
23
+ openId: t3,
24
+ onOpen,
25
+ onApproveAll,
26
+ virtualize: t4,
27
+ className
28
+ } = t0;
29
+ let t5;
30
+ if ($[0] !== t1) {
31
+ t5 = t1 === undefined ? Date.now() : t1;
32
+ $[0] = t1;
33
+ $[1] = t5;
34
+ } else {
35
+ t5 = $[1];
36
+ }
37
+ const now = t5;
38
+ const title = t2 === undefined ? "Waiting for approval" : t2;
39
+ const openId = t3 === undefined ? null : t3;
40
+ const virtualize = t4 === undefined ? true : t4;
22
41
  const selectAllId = useId();
23
- const [selected, setSelected] = useState(() => new Set());
24
- const selectable = bulkApprovable(items);
25
- const selectedIds = selectedIn(items, selected);
26
- const allState = selectAllState(selectable.length, selectedIds.length);
42
+ const [selected, setSelected] = useState(_temp);
43
+ let selectable;
44
+ let selectedIds;
45
+ let t6;
46
+ if ($[2] !== items || $[3] !== selected) {
47
+ selectable = bulkApprovable(items);
48
+ selectedIds = selectedIn(items, selected);
49
+ t6 = selectAllState(selectable.length, selectedIds.length);
50
+ $[2] = items;
51
+ $[3] = selected;
52
+ $[4] = selectable;
53
+ $[5] = selectedIds;
54
+ $[6] = t6;
55
+ } else {
56
+ selectable = $[4];
57
+ selectedIds = $[5];
58
+ t6 = $[6];
59
+ }
60
+ const allState = t6;
27
61
  const hasDestructive = selectable.length < items.length;
28
62
  const empty = items.length === 0;
29
- const rowHandlers = {
30
- isSelected: id => selected.has(id),
31
- onSelect: (id, on) => setSelected(current => toggled(current, id, on)),
32
- onApprove,
33
- onDeny
34
- };
35
- return /*#__PURE__*/_jsxs(ApprovalPanel, {
36
- "data-slot": "inbox",
37
- "aria-label": title,
38
- className: className,
39
- children: [/*#__PURE__*/_jsx(PanelHeader, {
40
- icon: /*#__PURE__*/_jsx(InboxIcon, {
41
- "aria-hidden": true
42
- }),
43
- eyebrow: "Approvals",
44
- status: empty ? "All clear" : `${items.length} waiting`,
45
- tone: empty ? "done" : "waiting"
46
- }), /*#__PURE__*/_jsx(PanelTitle, {
47
- children: title
48
- }), empty ? /*#__PURE__*/_jsx(PanelEmpty, {
63
+ let t7;
64
+ if ($[7] !== selected) {
65
+ t7 = id => selected.has(id);
66
+ $[7] = selected;
67
+ $[8] = t7;
68
+ } else {
69
+ t7 = $[8];
70
+ }
71
+ let t8;
72
+ if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
73
+ t8 = (id_0, on) => setSelected(current => toggled(current, id_0, on));
74
+ $[9] = t8;
75
+ } else {
76
+ t8 = $[9];
77
+ }
78
+ let t9;
79
+ if ($[10] !== openId) {
80
+ t9 = id_1 => id_1 === openId;
81
+ $[10] = openId;
82
+ $[11] = t9;
83
+ } else {
84
+ t9 = $[11];
85
+ }
86
+ let t10;
87
+ let t11;
88
+ let t12;
89
+ let t13;
90
+ let t14;
91
+ if ($[12] !== allState || $[13] !== className || $[14] !== empty || $[15] !== hasDestructive || $[16] !== items || $[17] !== now || $[18] !== onApproveAll || $[19] !== onOpen || $[20] !== selectAllId || $[21] !== selectable || $[22] !== selectedIds || $[23] !== t7 || $[24] !== t9 || $[25] !== title || $[26] !== virtualize) {
92
+ const rowHandlers = {
93
+ isSelected: t7,
94
+ onSelect: t8,
95
+ isOpen: t9,
96
+ onOpen
97
+ };
98
+ t10 = "inbox";
99
+ t11 = title;
100
+ if ($[32] !== className) {
101
+ t12 = cn("flex min-w-0 flex-col gap-2", className);
102
+ $[32] = className;
103
+ $[33] = t12;
104
+ } else {
105
+ t12 = $[33];
106
+ }
107
+ let t15;
108
+ if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
109
+ t15 = /*#__PURE__*/_jsx("span", {
110
+ "aria-hidden": true,
111
+ className: lineIconClass,
112
+ children: /*#__PURE__*/_jsx(InboxIcon, {
113
+ weight: "bold",
114
+ "aria-hidden": true
115
+ })
116
+ });
117
+ $[34] = t15;
118
+ } else {
119
+ t15 = $[34];
120
+ }
121
+ let t16;
122
+ if ($[35] !== title) {
123
+ t16 = /*#__PURE__*/_jsx("h3", {
124
+ className: "min-w-0 truncate font-sans font-medium text-foreground",
125
+ children: title
126
+ });
127
+ $[35] = title;
128
+ $[36] = t16;
129
+ } else {
130
+ t16 = $[36];
131
+ }
132
+ const t17 = empty ? "text-good" : "font-medium text-warn";
133
+ let t18;
134
+ if ($[37] !== t17) {
135
+ t18 = cn("ml-auto shrink-0 text-xs", t17);
136
+ $[37] = t17;
137
+ $[38] = t18;
138
+ } else {
139
+ t18 = $[38];
140
+ }
141
+ const t19 = empty ? "All clear" : `${items.length} waiting`;
142
+ let t20;
143
+ if ($[39] !== t18 || $[40] !== t19) {
144
+ t20 = /*#__PURE__*/_jsx("span", {
145
+ "data-slot": "inbox-count",
146
+ className: t18,
147
+ children: t19
148
+ });
149
+ $[39] = t18;
150
+ $[40] = t19;
151
+ $[41] = t20;
152
+ } else {
153
+ t20 = $[41];
154
+ }
155
+ if ($[42] !== t16 || $[43] !== t20) {
156
+ t13 = /*#__PURE__*/_jsxs("header", {
157
+ className: "flex items-center gap-2 px-2 text-sm",
158
+ children: [t15, t16, t20]
159
+ });
160
+ $[42] = t16;
161
+ $[43] = t20;
162
+ $[44] = t13;
163
+ } else {
164
+ t13 = $[44];
165
+ }
166
+ t14 = empty ? /*#__PURE__*/_jsx(PanelEmpty, {
49
167
  "data-slot": "inbox-empty",
50
168
  icon: /*#__PURE__*/_jsx(InboxIcon, {
169
+ weight: "bold",
51
170
  "aria-hidden": true
52
171
  }),
53
172
  title: "Nothing waiting for you",
@@ -58,35 +177,41 @@ export function Inbox({
58
177
  now: now,
59
178
  ...rowHandlers
60
179
  }) : /*#__PURE__*/_jsx("ul", {
61
- className: "mt-4 flex flex-col divide-y border-t",
180
+ className: "flex flex-col",
62
181
  children: items.map(item => /*#__PURE__*/_jsx(InboxRow, {
63
182
  item: item,
64
183
  now: now,
65
184
  selected: rowHandlers.isSelected(item.id),
66
- onSelect: on => rowHandlers.onSelect(item.id, on),
67
- onApprove: () => onApprove(item.id),
68
- onDeny: () => onDeny(item.id)
185
+ onSelect: on_0 => rowHandlers.onSelect(item.id, on_0),
186
+ open: rowHandlers.isOpen(item.id),
187
+ onOpen: () => onOpen(item.id)
69
188
  }, item.id))
70
- }), /*#__PURE__*/_jsxs(PanelFooter, {
71
- className: "justify-between gap-3",
189
+ }), selectable.length === 0 ? /*#__PURE__*/_jsx("p", {
190
+ className: "px-2 pt-2 text-xs text-faint",
191
+ children: oneAtATimeNote
192
+ }) : /*#__PURE__*/_jsxs("div", {
193
+ className: "flex flex-wrap items-center gap-x-6 gap-y-3 px-2 pt-2",
72
194
  children: [/*#__PURE__*/_jsxs("span", {
73
- className: "flex min-w-0 items-center gap-3",
74
- children: [selectable.length > 0 && /*#__PURE__*/_jsx(Checkbox, {
195
+ className: "flex min-w-0 items-start gap-3",
196
+ children: [/*#__PURE__*/_jsx(Checkbox, {
75
197
  id: selectAllId,
198
+ className: "mt-0.5",
76
199
  checked: allState,
77
- onCheckedChange: checked => setSelected(checked === true ? new Set(selectable.map(item => item.id)) : new Set())
78
- }), /*#__PURE__*/_jsxs(Label, {
79
- htmlFor: selectAllId,
80
- className: "flex min-w-0 flex-col items-start gap-0 font-normal",
81
- children: [/*#__PURE__*/_jsxs("span", {
82
- className: "text-sm tabular-nums",
200
+ "aria-describedby": hasDestructive ? `${selectAllId}-note` : undefined,
201
+ onCheckedChange: checked => setSelected(checked === true ? new Set(selectable.map(_temp2)) : new Set())
202
+ }), /*#__PURE__*/_jsxs("span", {
203
+ className: "flex min-w-0 flex-col items-start",
204
+ children: [/*#__PURE__*/_jsxs(Label, {
205
+ htmlFor: selectAllId,
206
+ className: "text-sm font-normal tabular-nums",
83
207
  children: [/*#__PURE__*/_jsx("span", {
84
208
  className: "sr-only",
85
209
  children: "Select all that can be approved together. "
86
210
  }), selectedIds.length > 0 ? `${selectedIds.length} selected` : "Select all"]
87
211
  }), hasDestructive && /*#__PURE__*/_jsx("span", {
88
- className: "text-xs text-muted-foreground",
89
- children: "Destructive requests are approved one at a time."
212
+ id: `${selectAllId}-note`,
213
+ className: "text-xs text-faint",
214
+ children: oneAtATimeNote
90
215
  })]
91
216
  })]
92
217
  }), /*#__PURE__*/_jsx(Button, {
@@ -100,8 +225,77 @@ export function Inbox({
100
225
  children: selectedIds.length > 0 ? `Approve ${selectedIds.length} selected` : "Approve selected"
101
226
  })]
102
227
  })]
103
- }), /*#__PURE__*/_jsx(LiveStatus, {
104
- message: empty ? "No approvals waiting" : `${pluralize(items.length, "approval")} waiting, ${selectedIds.length} selected`
105
- })]
106
- });
228
+ });
229
+ $[12] = allState;
230
+ $[13] = className;
231
+ $[14] = empty;
232
+ $[15] = hasDestructive;
233
+ $[16] = items;
234
+ $[17] = now;
235
+ $[18] = onApproveAll;
236
+ $[19] = onOpen;
237
+ $[20] = selectAllId;
238
+ $[21] = selectable;
239
+ $[22] = selectedIds;
240
+ $[23] = t7;
241
+ $[24] = t9;
242
+ $[25] = title;
243
+ $[26] = virtualize;
244
+ $[27] = t10;
245
+ $[28] = t11;
246
+ $[29] = t12;
247
+ $[30] = t13;
248
+ $[31] = t14;
249
+ } else {
250
+ t10 = $[27];
251
+ t11 = $[28];
252
+ t12 = $[29];
253
+ t13 = $[30];
254
+ t14 = $[31];
255
+ }
256
+ let t15;
257
+ if ($[45] !== empty || $[46] !== items.length || $[47] !== selectedIds) {
258
+ t15 = empty ? "No approvals waiting" : `${pluralize(items.length, "approval")} waiting, ${selectedIds.length} selected`;
259
+ $[45] = empty;
260
+ $[46] = items.length;
261
+ $[47] = selectedIds;
262
+ $[48] = t15;
263
+ } else {
264
+ t15 = $[48];
265
+ }
266
+ let t16;
267
+ if ($[49] !== t15) {
268
+ t16 = /*#__PURE__*/_jsx(LiveStatus, {
269
+ message: t15
270
+ });
271
+ $[49] = t15;
272
+ $[50] = t16;
273
+ } else {
274
+ t16 = $[50];
275
+ }
276
+ let t17;
277
+ if ($[51] !== t10 || $[52] !== t11 || $[53] !== t12 || $[54] !== t13 || $[55] !== t14 || $[56] !== t16) {
278
+ t17 = /*#__PURE__*/_jsxs("section", {
279
+ "data-slot": t10,
280
+ "aria-label": t11,
281
+ className: t12,
282
+ children: [t13, t14, t16]
283
+ });
284
+ $[51] = t10;
285
+ $[52] = t11;
286
+ $[53] = t12;
287
+ $[54] = t13;
288
+ $[55] = t14;
289
+ $[56] = t16;
290
+ $[57] = t17;
291
+ } else {
292
+ t17 = $[57];
293
+ }
294
+ return t17;
295
+ }
296
+ function _temp2(item_0) {
297
+ return item_0.id;
298
+ }
299
+ function _temp() {
300
+ return new Set();
107
301
  }
@@ -2,12 +2,12 @@ import type { PendingApproval } from "../types.js";
2
2
  export type InboxRowHandlers = {
3
3
  isSelected: (id: string) => boolean;
4
4
  onSelect: (id: string, selected: boolean) => void;
5
- onApprove: (id: string) => void;
6
- onDeny: (id: string) => void;
5
+ isOpen: (id: string) => boolean;
6
+ onOpen: (id: string) => void;
7
7
  };
8
8
  type VirtualInboxListProps = InboxRowHandlers & {
9
9
  items: PendingApproval[];
10
10
  now: number;
11
11
  };
12
- export declare function VirtualInboxList({ items, now, isSelected, onSelect, onApprove, onDeny, }: VirtualInboxListProps): import("react").JSX.Element;
12
+ export declare function VirtualInboxList({ items, now, isSelected, onSelect, isOpen, onOpen, }: VirtualInboxListProps): import("react").JSX.Element;
13
13
  export {};
@@ -1,53 +1,130 @@
1
- import { cn } from "@locusgraph/components";
1
+ "use client";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
2
4
  import { useRef } from "react";
3
5
  import { rowOffsetStyle, useListVirtualizer, virtualRowClassName } from "../../shared/virtual/use-list-virtualizer.js";
4
6
  import { InboxRow } from "./inbox-row.js";
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
6
8
  const estimatedRowHeightPx = 57;
7
- export function VirtualInboxList({
8
- items,
9
- now,
10
- isSelected,
11
- onSelect,
12
- onApprove,
13
- onDeny
14
- }) {
9
+ export function VirtualInboxList(t0) {
10
+ const $ = _c(28);
11
+ const {
12
+ items,
13
+ now,
14
+ isSelected,
15
+ onSelect,
16
+ isOpen,
17
+ onOpen
18
+ } = t0;
15
19
  const scrollRef = useRef(null);
20
+ let t1;
21
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22
+ t1 = () => scrollRef.current;
23
+ $[0] = t1;
24
+ } else {
25
+ t1 = $[0];
26
+ }
27
+ let t2;
28
+ if ($[1] !== items) {
29
+ t2 = index => items[index].id;
30
+ $[1] = items;
31
+ $[2] = t2;
32
+ } else {
33
+ t2 = $[2];
34
+ }
35
+ let t3;
36
+ if ($[3] !== items.length || $[4] !== t2) {
37
+ t3 = {
38
+ count: items.length,
39
+ getScrollElement: t1,
40
+ estimateSize: _temp,
41
+ getItemKey: t2
42
+ };
43
+ $[3] = items.length;
44
+ $[4] = t2;
45
+ $[5] = t3;
46
+ } else {
47
+ t3 = $[5];
48
+ }
16
49
  const {
17
50
  rows,
18
51
  totalSize,
19
52
  itemProps
20
- } = useListVirtualizer({
21
- count: items.length,
22
- getScrollElement: () => scrollRef.current,
23
- estimateSize: () => estimatedRowHeightPx,
24
- getItemKey: index => items[index].id
25
- });
26
- return /*#__PURE__*/_jsx("div", {
27
- ref: scrollRef,
28
- "data-slot": "inbox-scroll",
29
- className: "mt-4 max-h-[min(36rem,70vh)] overflow-y-auto overscroll-contain border-t",
30
- children: /*#__PURE__*/_jsx("ul", {
31
- className: "relative",
32
- style: {
33
- height: totalSize
34
- },
35
- children: rows.map(row => {
53
+ } = useListVirtualizer(t3);
54
+ let t4;
55
+ if ($[6] !== totalSize) {
56
+ t4 = {
57
+ height: totalSize
58
+ };
59
+ $[6] = totalSize;
60
+ $[7] = t4;
61
+ } else {
62
+ t4 = $[7];
63
+ }
64
+ let t5;
65
+ if ($[8] !== isOpen || $[9] !== isSelected || $[10] !== itemProps || $[11] !== items || $[12] !== now || $[13] !== onOpen || $[14] !== onSelect || $[15] !== rows) {
66
+ let t6;
67
+ if ($[17] !== isOpen || $[18] !== isSelected || $[19] !== itemProps || $[20] !== items || $[21] !== now || $[22] !== onOpen || $[23] !== onSelect) {
68
+ t6 = row => {
36
69
  const item = items[row.index];
37
70
  return /*#__PURE__*/_jsx(InboxRow, {
38
71
  ...itemProps(row.index),
39
72
  "aria-posinset": row.index + 1,
40
73
  "aria-setsize": items.length,
41
- className: cn(virtualRowClassName, "border-b"),
74
+ className: virtualRowClassName,
42
75
  style: rowOffsetStyle(row.start),
43
76
  item: item,
44
77
  now: now,
45
78
  selected: isSelected(item.id),
46
79
  onSelect: on => onSelect(item.id, on),
47
- onApprove: () => onApprove(item.id),
48
- onDeny: () => onDeny(item.id)
80
+ open: isOpen(item.id),
81
+ onOpen: () => onOpen(item.id)
49
82
  }, row.key);
83
+ };
84
+ $[17] = isOpen;
85
+ $[18] = isSelected;
86
+ $[19] = itemProps;
87
+ $[20] = items;
88
+ $[21] = now;
89
+ $[22] = onOpen;
90
+ $[23] = onSelect;
91
+ $[24] = t6;
92
+ } else {
93
+ t6 = $[24];
94
+ }
95
+ t5 = rows.map(t6);
96
+ $[8] = isOpen;
97
+ $[9] = isSelected;
98
+ $[10] = itemProps;
99
+ $[11] = items;
100
+ $[12] = now;
101
+ $[13] = onOpen;
102
+ $[14] = onSelect;
103
+ $[15] = rows;
104
+ $[16] = t5;
105
+ } else {
106
+ t5 = $[16];
107
+ }
108
+ let t6;
109
+ if ($[25] !== t4 || $[26] !== t5) {
110
+ t6 = /*#__PURE__*/_jsx("div", {
111
+ ref: scrollRef,
112
+ "data-slot": "inbox-scroll",
113
+ className: "max-h-[min(36rem,70vh)] overflow-y-auto overscroll-contain",
114
+ children: /*#__PURE__*/_jsx("ul", {
115
+ className: "relative",
116
+ style: t4,
117
+ children: t5
50
118
  })
51
- })
52
- });
119
+ });
120
+ $[25] = t4;
121
+ $[26] = t5;
122
+ $[27] = t6;
123
+ } else {
124
+ t6 = $[27];
125
+ }
126
+ return t6;
127
+ }
128
+ function _temp() {
129
+ return estimatedRowHeightPx;
53
130
  }