reifyui 0.12.0 → 0.13.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 (82) hide show
  1. package/README.md +29 -0
  2. package/dist/chart.js +2 -0
  3. package/dist/chart.js.map +1 -1
  4. package/dist/chunk-EL2DHWOH.js +1710 -0
  5. package/dist/chunk-EL2DHWOH.js.map +1 -0
  6. package/dist/chunk-J633KV57.js +41 -0
  7. package/dist/chunk-J633KV57.js.map +1 -0
  8. package/dist/chunk-J7SECRIG.js +295 -0
  9. package/dist/chunk-J7SECRIG.js.map +1 -0
  10. package/dist/chunk-PIRPLH2Z.js +231 -0
  11. package/dist/chunk-PIRPLH2Z.js.map +1 -0
  12. package/dist/chunk-PZ5AY32C.js +10 -0
  13. package/dist/chunk-PZ5AY32C.js.map +1 -0
  14. package/dist/chunk-UKG4Z6QK.js +130 -0
  15. package/dist/chunk-UKG4Z6QK.js.map +1 -0
  16. package/dist/chunk-ZYWE47EO.js +19 -0
  17. package/dist/chunk-ZYWE47EO.js.map +1 -0
  18. package/dist/collab.cjs +169 -0
  19. package/dist/collab.cjs.map +1 -0
  20. package/dist/collab.d.ts +30 -0
  21. package/dist/collab.js +18 -0
  22. package/dist/collab.js.map +1 -0
  23. package/dist/graph.cjs +2244 -0
  24. package/dist/graph.cjs.map +1 -0
  25. package/dist/graph.d.ts +41 -0
  26. package/dist/graph.js +1870 -0
  27. package/dist/graph.js.map +1 -0
  28. package/dist/harness.js +1 -0
  29. package/dist/harness.js.map +1 -1
  30. package/dist/index.cjs +1699 -817
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.ts +3 -0
  33. package/dist/index.js +680 -1769
  34. package/dist/index.js.map +1 -1
  35. package/dist/sheet-doc.cjs +235 -0
  36. package/dist/sheet-doc.cjs.map +1 -0
  37. package/dist/sheet-doc.d.ts +16 -0
  38. package/dist/sheet-doc.js +20 -0
  39. package/dist/sheet-doc.js.map +1 -0
  40. package/dist/sheet.cjs +2322 -0
  41. package/dist/sheet.cjs.map +1 -0
  42. package/dist/sheet.d.ts +23 -0
  43. package/dist/sheet.js +237 -0
  44. package/dist/sheet.js.map +1 -0
  45. package/dist/slides.js +2 -0
  46. package/dist/slides.js.map +1 -1
  47. package/package.json +34 -2
  48. package/src/auth/client.js +4 -2
  49. package/src/collab/colors.js +18 -0
  50. package/src/collab/index.d.ts +30 -0
  51. package/src/collab/index.js +8 -0
  52. package/src/collab/keepAlive.js +34 -0
  53. package/src/collab/useLiveDoc.js +76 -0
  54. package/src/components/CascadeMenu.jsx +9 -3
  55. package/src/components/Composer.jsx +37 -3
  56. package/src/components/resizable.jsx +82 -12
  57. package/src/graph/ConnectPane.jsx +634 -0
  58. package/src/graph/ConnectToolDetail.jsx +565 -0
  59. package/src/graph/LogsPane.jsx +328 -0
  60. package/src/graph/Skeleton.jsx +13 -0
  61. package/src/graph/draft.js +108 -0
  62. package/src/graph/format.js +37 -0
  63. package/src/graph/index.d.ts +41 -0
  64. package/src/graph/index.js +14 -0
  65. package/src/graph/useGraphCollab.js +299 -0
  66. package/src/graph/vgraph.js +215 -0
  67. package/src/index.d.ts +3 -0
  68. package/src/index.js +4 -1
  69. package/src/mention/MentionInput.jsx +420 -0
  70. package/src/mention/mentionModel.js +177 -0
  71. package/src/sheet/RunStrip.jsx +57 -0
  72. package/src/sheet/SheetGrid.jsx +448 -423
  73. package/src/sheet/doc.d.ts +16 -0
  74. package/src/sheet/index.d.ts +23 -0
  75. package/src/sheet/index.js +10 -0
  76. package/src/sheet/sheetDoc.js +203 -0
  77. package/src/sheet/useSheetCollab.js +102 -0
  78. package/src/sheet/useSheetRun.js +80 -0
  79. package/styles/chat.css +2 -0
  80. package/styles/graph.css +395 -0
  81. package/styles/mention.css +79 -0
  82. package/styles/sheet.css +156 -112
package/dist/index.js CHANGED
@@ -4,6 +4,44 @@ import {
4
4
  readSSEStream,
5
5
  turnsToMessages
6
6
  } from "./chunk-NTIWFHR4.js";
7
+ import {
8
+ MentionInput,
9
+ MentionText,
10
+ Popover,
11
+ SheetGrid,
12
+ sheetToAoA,
13
+ sheetToDelimited
14
+ } from "./chunk-EL2DHWOH.js";
15
+ import {
16
+ Chevron,
17
+ CodeBlock,
18
+ IcCheck,
19
+ IcDoc,
20
+ IcDownload,
21
+ IcEye,
22
+ IcGlobe,
23
+ IcList,
24
+ IcMic,
25
+ IcPanelRight,
26
+ IcPaperclip,
27
+ IcPlug,
28
+ IcScroll,
29
+ IcSearch,
30
+ IcSend,
31
+ IcSkill,
32
+ IcSpawn,
33
+ IcTerminal,
34
+ IcThink,
35
+ IcTool,
36
+ IcX,
37
+ Modal,
38
+ Svg
39
+ } from "./chunk-J7SECRIG.js";
40
+ import {
41
+ useOverlayEscape
42
+ } from "./chunk-J633KV57.js";
43
+ import "./chunk-ZYWE47EO.js";
44
+ import "./chunk-PZ5AY32C.js";
7
45
 
8
46
  // src/state/blocks.js
9
47
  function withText(blocks, d) {
@@ -92,106 +130,6 @@ function createConversationStore(makeInitial) {
92
130
  return { get, set, seed, updateLastAssistant, use };
93
131
  }
94
132
 
95
- // src/components/icons.jsx
96
- import React from "react";
97
- import { jsx, jsxs } from "react/jsx-runtime";
98
- function Svg({ children, s = 16 }) {
99
- return /* @__PURE__ */ jsx(
100
- "svg",
101
- {
102
- width: s,
103
- height: s,
104
- viewBox: "0 0 24 24",
105
- fill: "none",
106
- stroke: "currentColor",
107
- strokeWidth: "1.8",
108
- strokeLinecap: "round",
109
- strokeLinejoin: "round",
110
- children
111
- }
112
- );
113
- }
114
- function Chevron({ dir, size = 16 }) {
115
- const d = dir === "left" ? "M15 18l-6-6 6-6" : dir === "right" ? "M9 18l6-6-6-6" : "M6 9l6 6 6-6";
116
- return /* @__PURE__ */ jsx(
117
- "svg",
118
- {
119
- width: size,
120
- height: size,
121
- viewBox: "0 0 24 24",
122
- fill: "none",
123
- stroke: "currentColor",
124
- strokeWidth: "2",
125
- strokeLinecap: "round",
126
- strokeLinejoin: "round",
127
- children: /* @__PURE__ */ jsx("path", { d })
128
- }
129
- );
130
- }
131
- var IcTool = () => /* @__PURE__ */ jsx(Svg, { s: 17, children: /* @__PURE__ */ jsx("path", { d: "M14.7 6.3a4 4 0 0 1-5.4 5.4L4 17v3h3l5.3-5.3a4 4 0 0 1 5.4-5.4l-2.3 2.3-1.7-1.7 2.3-2.3a4 4 0 0 0-1.6 0Z" }) });
132
- var IcPlug = () => /* @__PURE__ */ jsxs(Svg, { s: 17, children: [
133
- /* @__PURE__ */ jsx("path", { d: "M9 2v6M15 2v6M6 8h12v3a6 6 0 0 1-12 0z" }),
134
- /* @__PURE__ */ jsx("path", { d: "M12 17v5" })
135
- ] });
136
- var IcSkill = () => /* @__PURE__ */ jsxs(Svg, { s: 17, children: [
137
- /* @__PURE__ */ jsx("path", { d: "M9 18h6M10 22h4" }),
138
- /* @__PURE__ */ jsx("path", { d: "M12 2a7 7 0 0 0-4 12.7c.6.5 1 1.3 1 2.1V18h6v-1.2c0-.8.4-1.6 1-2.1A7 7 0 0 0 12 2z" })
139
- ] });
140
- var IcTerminal = () => /* @__PURE__ */ jsxs(Svg, { s: 17, children: [
141
- /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
142
- /* @__PURE__ */ jsx("path", { d: "M7 9l3 3-3 3M13 15h4" })
143
- ] });
144
- var IcDoc = () => /* @__PURE__ */ jsxs(Svg, { s: 17, children: [
145
- /* @__PURE__ */ jsx("path", { d: "M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z" }),
146
- /* @__PURE__ */ jsx("path", { d: "M14 3v6h6M8 13h8M8 17h6" })
147
- ] });
148
- var IcList = () => /* @__PURE__ */ jsx(Svg, { s: 17, children: /* @__PURE__ */ jsx("path", { d: "M8 6h12M8 12h12M8 18h12M3.5 6h.01M3.5 12h.01M3.5 18h.01" }) });
149
- var IcGlobe = () => /* @__PURE__ */ jsxs(Svg, { s: 17, children: [
150
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
151
- /* @__PURE__ */ jsx("path", { d: "M3 12h18M12 3a15 15 0 0 1 0 18a15 15 0 0 1 0-18z" })
152
- ] });
153
- var IcSearch = () => /* @__PURE__ */ jsxs(Svg, { s: 17, children: [
154
- /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "7" }),
155
- /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" })
156
- ] });
157
- var IcScroll = () => /* @__PURE__ */ jsxs(Svg, { s: 17, children: [
158
- /* @__PURE__ */ jsx("path", { d: "M6 3h10a2 2 0 0 1 2 2v12a3 3 0 0 0 3 3H8a2 2 0 0 1-2-2V3z" }),
159
- /* @__PURE__ */ jsx("path", { d: "M6 3a2 2 0 0 0-2 2v2h2M10 8h6M10 12h6" })
160
- ] });
161
- var IcSpawn = () => /* @__PURE__ */ jsxs(Svg, { s: 17, children: [
162
- /* @__PURE__ */ jsx("circle", { cx: "6", cy: "6", r: "3" }),
163
- /* @__PURE__ */ jsx("circle", { cx: "18", cy: "18", r: "3" }),
164
- /* @__PURE__ */ jsx("path", { d: "M6 9v3a3 3 0 0 0 3 3h6" })
165
- ] });
166
- var IcCheck = () => /* @__PURE__ */ jsxs(Svg, { s: 17, children: [
167
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "9" }),
168
- /* @__PURE__ */ jsx("path", { d: "m9 12 2 2 4-4" })
169
- ] });
170
- var IcThink = () => /* @__PURE__ */ jsx(Svg, { s: 16, children: /* @__PURE__ */ jsx("path", { d: "M9.5 2a5.5 5.5 0 0 0-3 10.1V15a2 2 0 0 0 2 2h3a2 2 0 0 0 2-2v-2.9A5.5 5.5 0 0 0 9.5 2zM9 20h4M10 22h2" }) });
171
- var IcSend = () => /* @__PURE__ */ jsxs(Svg, { s: 16, children: [
172
- /* @__PURE__ */ jsx("path", { d: "M12 19V5" }),
173
- /* @__PURE__ */ jsx("path", { d: "M5 12l7-7 7 7" })
174
- ] });
175
- var IcX = ({ size = 14 }) => /* @__PURE__ */ jsx(Svg, { s: size, children: /* @__PURE__ */ jsx("path", { d: "M18 6 6 18M6 6l12 12" }) });
176
- var IcMic = ({ size = 15 }) => /* @__PURE__ */ jsxs(Svg, { s: size, children: [
177
- /* @__PURE__ */ jsx("rect", { x: "9", y: "2", width: "6", height: "12", rx: "3" }),
178
- /* @__PURE__ */ jsx("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v4M8 22h8" })
179
- ] });
180
- var IcPaperclip = ({ size = 16 }) => /* @__PURE__ */ jsx(Svg, { s: size, children: /* @__PURE__ */ jsx("path", { d: "M21.4 11.1 12.2 20.3a5.5 5.5 0 0 1-7.8-7.8l9.2-9.2a3.7 3.7 0 0 1 5.2 5.2l-9.2 9.2a1.8 1.8 0 0 1-2.6-2.6l8.5-8.5" }) });
181
- var IcPanelRight = ({ size = 17 }) => /* @__PURE__ */ jsxs(Svg, { s: size, children: [
182
- /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "16", rx: "2" }),
183
- /* @__PURE__ */ jsx("path", { d: "M15 4v16" })
184
- ] });
185
- var IcDownload = ({ size = 16 }) => /* @__PURE__ */ jsxs(Svg, { s: size, children: [
186
- /* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
187
- /* @__PURE__ */ jsx("path", { d: "M7 10l5 5 5-5" }),
188
- /* @__PURE__ */ jsx("path", { d: "M12 15V3" })
189
- ] });
190
- var IcEye = ({ size = 15 }) => /* @__PURE__ */ jsxs(Svg, { s: size, children: [
191
- /* @__PURE__ */ jsx("path", { d: "M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7-10-7-10-7z" }),
192
- /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
193
- ] });
194
-
195
133
  // src/components/toolMeta.js
196
134
  function humanize(s) {
197
135
  return (s || "").replace(/[_\-]+/g, " ").trim().replace(/\b\w/g, (c) => c.toUpperCase());
@@ -332,8 +270,8 @@ function summarizeSteps(steps) {
332
270
  }
333
271
 
334
272
  // src/components/ToolSteps.jsx
335
- import React2, { useEffect, useState } from "react";
336
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
273
+ import React, { useEffect, useState } from "react";
274
+ import { jsx, jsxs } from "react/jsx-runtime";
337
275
  function ToolGroup(props) {
338
276
  const {
339
277
  reasoning,
@@ -351,29 +289,29 @@ function ToolGroup(props) {
351
289
  }, [running]);
352
290
  if (!reasoning && steps.length === 0) return null;
353
291
  const summary = running ? workingLabel : steps.length ? summarizeSteps(steps) : thoughtLabel;
354
- return /* @__PURE__ */ jsxs2("div", { className: "wbx-acts" + (open ? " open" : ""), children: [
355
- /* @__PURE__ */ jsxs2("button", { className: "wbx-acts-sum", onClick: () => setOpen((v) => !v), children: [
356
- /* @__PURE__ */ jsx2(Chevron, { dir: open ? "down" : "right", size: 13 }),
357
- /* @__PURE__ */ jsx2("span", { children: summary })
292
+ return /* @__PURE__ */ jsxs("div", { className: "wbx-acts" + (open ? " open" : ""), children: [
293
+ /* @__PURE__ */ jsxs("button", { className: "wbx-acts-sum", onClick: () => setOpen((v) => !v), children: [
294
+ /* @__PURE__ */ jsx(Chevron, { dir: open ? "down" : "right", size: 13 }),
295
+ /* @__PURE__ */ jsx("span", { children: summary })
358
296
  ] }),
359
- open && /* @__PURE__ */ jsxs2("div", { className: "wbx-acts-body", children: [
360
- reasoning && /* @__PURE__ */ jsxs2("div", { className: "wbx-act", children: [
361
- /* @__PURE__ */ jsx2("span", { className: "wbx-act-ic-t thinking", children: /* @__PURE__ */ jsx2(IcThink, {}) }),
362
- /* @__PURE__ */ jsxs2("div", { className: "wbx-act-main", children: [
363
- /* @__PURE__ */ jsx2("div", { className: "wbx-act-k", children: thinkingLabel }),
364
- /* @__PURE__ */ jsx2("div", { className: "wbx-act-v", children: reasoning })
297
+ open && /* @__PURE__ */ jsxs("div", { className: "wbx-acts-body", children: [
298
+ reasoning && /* @__PURE__ */ jsxs("div", { className: "wbx-act", children: [
299
+ /* @__PURE__ */ jsx("span", { className: "wbx-act-ic-t thinking", children: /* @__PURE__ */ jsx(IcThink, {}) }),
300
+ /* @__PURE__ */ jsxs("div", { className: "wbx-act-main", children: [
301
+ /* @__PURE__ */ jsx("div", { className: "wbx-act-k", children: thinkingLabel }),
302
+ /* @__PURE__ */ jsx("div", { className: "wbx-act-v", children: reasoning })
365
303
  ] })
366
304
  ] }),
367
305
  steps.map((s, j) => {
368
306
  if (renderStep) {
369
307
  const el = renderStep(s, j);
370
- if (el !== void 0) return /* @__PURE__ */ jsx2(React2.Fragment, { children: el }, j);
308
+ if (el !== void 0) return /* @__PURE__ */ jsx(React.Fragment, { children: el }, j);
371
309
  }
372
- return /* @__PURE__ */ jsx2(ToolRow, { step: s }, j);
310
+ return /* @__PURE__ */ jsx(ToolRow, { step: s }, j);
373
311
  }),
374
- !running && /* @__PURE__ */ jsxs2("div", { className: "wbx-act", children: [
375
- /* @__PURE__ */ jsx2("span", { className: "wbx-act-ic-t done", children: /* @__PURE__ */ jsx2(IcCheck, {}) }),
376
- /* @__PURE__ */ jsx2("div", { className: "wbx-act-main", children: /* @__PURE__ */ jsx2("div", { className: "wbx-act-k", children: doneLabel }) })
312
+ !running && /* @__PURE__ */ jsxs("div", { className: "wbx-act", children: [
313
+ /* @__PURE__ */ jsx("span", { className: "wbx-act-ic-t done", children: /* @__PURE__ */ jsx(IcCheck, {}) }),
314
+ /* @__PURE__ */ jsx("div", { className: "wbx-act-main", children: /* @__PURE__ */ jsx("div", { className: "wbx-act-k", children: doneLabel }) })
377
315
  ] })
378
316
  ] })
379
317
  ] });
@@ -384,22 +322,22 @@ function ToolRow(props) {
384
322
  const meta = toolMeta(step.name, step.args);
385
323
  const Icon = meta.Icon;
386
324
  const hasDetail = !!(step.args && step.args !== "{}") || step.result !== void 0;
387
- return /* @__PURE__ */ jsxs2("div", { className: "wbx-act", children: [
388
- /* @__PURE__ */ jsx2("span", { className: "wbx-act-ic-t", children: /* @__PURE__ */ jsx2(Icon, {}) }),
389
- /* @__PURE__ */ jsxs2("div", { className: "wbx-act-main", children: [
390
- /* @__PURE__ */ jsxs2("button", { className: "wbx-act-row" + (open ? " open" : ""), disabled: !hasDetail, onClick: () => setOpen((v) => !v), children: [
391
- /* @__PURE__ */ jsx2("span", { className: "wbx-act-k", children: meta.label }),
392
- meta.chip && /* @__PURE__ */ jsx2("span", { className: "wbx-act-chip", children: meta.chip }),
393
- hasDetail && /* @__PURE__ */ jsx2("span", { className: "wbx-act-exp", children: /* @__PURE__ */ jsx2(Chevron, { dir: open ? "down" : "right", size: 12 }) })
325
+ return /* @__PURE__ */ jsxs("div", { className: "wbx-act", children: [
326
+ /* @__PURE__ */ jsx("span", { className: "wbx-act-ic-t", children: /* @__PURE__ */ jsx(Icon, {}) }),
327
+ /* @__PURE__ */ jsxs("div", { className: "wbx-act-main", children: [
328
+ /* @__PURE__ */ jsxs("button", { className: "wbx-act-row" + (open ? " open" : ""), disabled: !hasDetail, onClick: () => setOpen((v) => !v), children: [
329
+ /* @__PURE__ */ jsx("span", { className: "wbx-act-k", children: meta.label }),
330
+ meta.chip && /* @__PURE__ */ jsx("span", { className: "wbx-act-chip", children: meta.chip }),
331
+ hasDetail && /* @__PURE__ */ jsx("span", { className: "wbx-act-exp", children: /* @__PURE__ */ jsx(Chevron, { dir: open ? "down" : "right", size: 12 }) })
394
332
  ] }),
395
- open && /* @__PURE__ */ jsxs2("div", { className: "wbx-act-detail", children: [
396
- step.args && step.args !== "{}" && /* @__PURE__ */ jsxs2("div", { className: "wbx-act-block", children: [
397
- /* @__PURE__ */ jsx2("div", { className: "wbx-act-block-h", children: requestLabel }),
398
- /* @__PURE__ */ jsx2("pre", { className: "wbx-act-pre", children: prettyJson(step.args) })
333
+ open && /* @__PURE__ */ jsxs("div", { className: "wbx-act-detail", children: [
334
+ step.args && step.args !== "{}" && /* @__PURE__ */ jsxs("div", { className: "wbx-act-block", children: [
335
+ /* @__PURE__ */ jsx("div", { className: "wbx-act-block-h", children: requestLabel }),
336
+ /* @__PURE__ */ jsx("pre", { className: "wbx-act-pre", children: prettyJson(step.args) })
399
337
  ] }),
400
- step.result !== void 0 && /* @__PURE__ */ jsxs2("div", { className: "wbx-act-block", children: [
401
- /* @__PURE__ */ jsx2("div", { className: "wbx-act-block-h", children: resultLabel }),
402
- /* @__PURE__ */ jsx2("pre", { className: "wbx-act-pre", children: String(step.result).slice(0, 4e3) })
338
+ step.result !== void 0 && /* @__PURE__ */ jsxs("div", { className: "wbx-act-block", children: [
339
+ /* @__PURE__ */ jsx("div", { className: "wbx-act-block-h", children: resultLabel }),
340
+ /* @__PURE__ */ jsx("pre", { className: "wbx-act-pre", children: String(step.result).slice(0, 4e3) })
403
341
  ] })
404
342
  ] })
405
343
  ] })
@@ -407,8 +345,8 @@ function ToolRow(props) {
407
345
  }
408
346
 
409
347
  // src/components/ChatMessages.jsx
410
- import React3 from "react";
411
- import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
348
+ import React2 from "react";
349
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
412
350
  var DEFAULT_STATUS_LABELS = {
413
351
  failed: "\u2715 Failed. See the output above for the reason",
414
352
  cancelled: "\u25FC Stopped by you",
@@ -419,18 +357,18 @@ var DEFAULT_STATUS_LABELS = {
419
357
  // assistantFooter).
420
358
  incomplete: "\u25D4 Stopped before finishing. Continue to resume"
421
359
  };
422
- var defaultMarkdown = (text) => /* @__PURE__ */ jsx3("div", { style: { whiteSpace: "pre-wrap" }, children: text });
360
+ var defaultMarkdown = (text) => /* @__PURE__ */ jsx2("div", { style: { whiteSpace: "pre-wrap" }, children: text });
423
361
  var REDUCED_MOTION = typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
424
362
  var REVEAL_SEC = 3;
425
363
  var MIN_CPS = 10;
426
364
  function TypewriterText(props) {
427
365
  const { text, render } = props;
428
366
  const active = props.active && !REDUCED_MOTION;
429
- const [n, setN] = React3.useState(() => text ? text.length : 0);
430
- const textRef = React3.useRef(text);
367
+ const [n, setN] = React2.useState(() => text ? text.length : 0);
368
+ const textRef = React2.useRef(text);
431
369
  textRef.current = text;
432
- const accRef = React3.useRef(text ? text.length : 0);
433
- React3.useEffect(() => {
370
+ const accRef = React2.useRef(text ? text.length : 0);
371
+ React2.useEffect(() => {
434
372
  if (!active) {
435
373
  setN(textRef.current ? textRef.current.length : 0);
436
374
  return void 0;
@@ -458,12 +396,12 @@ function TypewriterText(props) {
458
396
  }
459
397
  function UserTurn(props) {
460
398
  const { msg, children, label } = props;
461
- const bubble = /* @__PURE__ */ jsxs3("div", { className: "wbx-bubble-user", children: [
399
+ const bubble = /* @__PURE__ */ jsxs2("div", { className: "wbx-bubble-user", children: [
462
400
  children,
463
- msg.text && /* @__PURE__ */ jsx3("div", { className: "wbx-bubble-text", children: msg.text })
401
+ msg.text && /* @__PURE__ */ jsx2("div", { className: "wbx-bubble-text", children: msg.text })
464
402
  ] });
465
- return /* @__PURE__ */ jsx3("div", { className: "wbx-turn user", children: label ? /* @__PURE__ */ jsxs3("div", { className: "wbx-turn-body", children: [
466
- /* @__PURE__ */ jsx3("div", { className: "wbx-role", children: label }),
403
+ return /* @__PURE__ */ jsx2("div", { className: "wbx-turn user", children: label ? /* @__PURE__ */ jsxs2("div", { className: "wbx-turn-body", children: [
404
+ /* @__PURE__ */ jsx2("div", { className: "wbx-role", children: label }),
467
405
  bubble
468
406
  ] }) : bubble });
469
407
  }
@@ -479,9 +417,9 @@ function AssistantTurn(props) {
479
417
  footer,
480
418
  label
481
419
  } = props;
482
- return /* @__PURE__ */ jsxs3("div", { className: "wbx-turn asst", children: [
483
- label ? /* @__PURE__ */ jsx3("div", { className: "wbx-role", children: label }) : null,
484
- msg.blocks.map((b, bi) => b.kind === "tools" ? /* @__PURE__ */ jsx3(
420
+ return /* @__PURE__ */ jsxs2("div", { className: "wbx-turn asst", children: [
421
+ label ? /* @__PURE__ */ jsx2("div", { className: "wbx-role", children: label }) : null,
422
+ msg.blocks.map((b, bi) => b.kind === "tools" ? /* @__PURE__ */ jsx2(
485
423
  ToolGroup,
486
424
  {
487
425
  reasoning: b.reasoning,
@@ -491,7 +429,7 @@ function AssistantTurn(props) {
491
429
  ...toolLabels || {}
492
430
  },
493
431
  bi
494
- ) : /* @__PURE__ */ jsx3("div", { className: "wbx-md", children: /* @__PURE__ */ jsx3(
432
+ ) : /* @__PURE__ */ jsx2("div", { className: "wbx-md", children: /* @__PURE__ */ jsx2(
495
433
  TypewriterText,
496
434
  {
497
435
  text: b.text,
@@ -499,16 +437,16 @@ function AssistantTurn(props) {
499
437
  active: msg.status === "running" && bi === msg.blocks.length - 1
500
438
  }
501
439
  ) }, bi)),
502
- msg.status === "running" && /* @__PURE__ */ jsxs3("div", { className: "wbx-working", "aria-label": "Working", children: [
503
- /* @__PURE__ */ jsxs3("span", { className: "wbx-working-dots", children: [
504
- /* @__PURE__ */ jsx3("span", {}),
505
- /* @__PURE__ */ jsx3("span", {}),
506
- /* @__PURE__ */ jsx3("span", {})
440
+ msg.status === "running" && /* @__PURE__ */ jsxs2("div", { className: "wbx-working", "aria-label": "Working", children: [
441
+ /* @__PURE__ */ jsxs2("span", { className: "wbx-working-dots", children: [
442
+ /* @__PURE__ */ jsx2("span", {}),
443
+ /* @__PURE__ */ jsx2("span", {}),
444
+ /* @__PURE__ */ jsx2("span", {})
507
445
  ] }),
508
- /* @__PURE__ */ jsx3("span", { className: "wbx-working-txt", children: workingLabel }),
446
+ /* @__PURE__ */ jsx2("span", { className: "wbx-working-txt", children: workingLabel }),
509
447
  workingExtra
510
448
  ] }),
511
- (msg.status === "failed" || msg.status === "cancelled" || msg.status === "incomplete") && /* @__PURE__ */ jsx3("div", { className: "wbx-turnbadge " + msg.status, role: "status", children: statusLabels[msg.status] }),
449
+ (msg.status === "failed" || msg.status === "cancelled" || msg.status === "incomplete") && /* @__PURE__ */ jsx2("div", { className: "wbx-turnbadge " + msg.status, role: "status", children: statusLabels[msg.status] }),
512
450
  footer
513
451
  ] });
514
452
  }
@@ -520,7 +458,7 @@ var DEFAULT_SKELETON_TURNS = [
520
458
  ];
521
459
  function ChatMessagesSkeleton(props) {
522
460
  const turns = props && props.turns || DEFAULT_SKELETON_TURNS;
523
- return /* @__PURE__ */ jsx3("div", { className: "wbx-skel", "aria-busy": "true", "aria-label": "Loading conversation", children: turns.map((t, i) => t.role === "user" ? /* @__PURE__ */ jsx3("div", { className: "wbx-turn user wbx-skel-turn", "aria-hidden": "true", children: /* @__PURE__ */ jsx3("div", { className: "wbx-bubble-user wbx-skel-lines", style: { width: t.width }, children: t.lines.map((w, j) => /* @__PURE__ */ jsx3("span", { className: "wbx-skel-bar", style: { width: w } }, j)) }) }, i) : /* @__PURE__ */ jsx3("div", { className: "wbx-turn asst wbx-skel-turn", "aria-hidden": "true", children: /* @__PURE__ */ jsx3("div", { className: "wbx-md wbx-skel-lines", children: t.lines.map((w, j) => /* @__PURE__ */ jsx3("span", { className: "wbx-skel-bar", style: { width: w } }, j)) }) }, i)) });
461
+ return /* @__PURE__ */ jsx2("div", { className: "wbx-skel", "aria-busy": "true", "aria-label": "Loading conversation", children: turns.map((t, i) => t.role === "user" ? /* @__PURE__ */ jsx2("div", { className: "wbx-turn user wbx-skel-turn", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("div", { className: "wbx-bubble-user wbx-skel-lines", style: { width: t.width }, children: t.lines.map((w, j) => /* @__PURE__ */ jsx2("span", { className: "wbx-skel-bar", style: { width: w } }, j)) }) }, i) : /* @__PURE__ */ jsx2("div", { className: "wbx-turn asst wbx-skel-turn", "aria-hidden": "true", children: /* @__PURE__ */ jsx2("div", { className: "wbx-md wbx-skel-lines", children: t.lines.map((w, j) => /* @__PURE__ */ jsx2("span", { className: "wbx-skel-bar", style: { width: w } }, j)) }) }, i)) });
524
462
  }
525
463
  function ChatMessages(props) {
526
464
  const {
@@ -536,12 +474,12 @@ function ChatMessages(props) {
536
474
  toolLabels,
537
475
  roleLabel
538
476
  } = props;
539
- return /* @__PURE__ */ jsx3(Fragment, { children: messages.map((m, i) => {
477
+ return /* @__PURE__ */ jsx2(Fragment, { children: messages.map((m, i) => {
540
478
  if (renderMessage) {
541
479
  const el = renderMessage(m, i);
542
- if (el !== void 0) return /* @__PURE__ */ jsx3(React3.Fragment, { children: el }, i);
480
+ if (el !== void 0) return /* @__PURE__ */ jsx2(React2.Fragment, { children: el }, i);
543
481
  }
544
- return m.role === "user" ? /* @__PURE__ */ jsx3(UserTurn, { msg: m, label: roleLabel?.(m, i), children: userExtras?.(m, i) }, i) : /* @__PURE__ */ jsx3(
482
+ return m.role === "user" ? /* @__PURE__ */ jsx2(UserTurn, { msg: m, label: roleLabel?.(m, i), children: userExtras?.(m, i) }, i) : /* @__PURE__ */ jsx2(
545
483
  AssistantTurn,
546
484
  {
547
485
  msg: m,
@@ -560,8 +498,8 @@ function ChatMessages(props) {
560
498
  }
561
499
 
562
500
  // src/components/Composer.jsx
563
- import React4, { useEffect as useEffect2, useRef } from "react";
564
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
501
+ import React3, { useEffect as useEffect2, useRef, useState as useState2 } from "react";
502
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
565
503
  function Composer(props) {
566
504
  const {
567
505
  value,
@@ -581,6 +519,8 @@ function Composer(props) {
581
519
  inputAriaLabel,
582
520
  attachments,
583
521
  tray,
522
+ onFiles,
523
+ dropTargetRef,
584
524
  accessoriesLeft,
585
525
  accessoriesRight,
586
526
  renderSend,
@@ -589,6 +529,50 @@ function Composer(props) {
589
529
  } = props;
590
530
  const ownRef = useRef(null);
591
531
  const taRef = inputRef || ownRef;
532
+ const rootRef = useRef(null);
533
+ const [dropping, setDropping] = useState2(false);
534
+ useEffect2(() => {
535
+ if (!onFiles || disabled) return void 0;
536
+ const el = dropTargetRef && dropTargetRef.current || rootRef.current;
537
+ if (!el) return void 0;
538
+ let depth = 0;
539
+ const hasFiles = (e) => Array.from(e.dataTransfer && e.dataTransfer.types || []).includes("Files");
540
+ const enter = (e) => {
541
+ if (!hasFiles(e)) return;
542
+ e.preventDefault();
543
+ depth += 1;
544
+ setDropping(true);
545
+ };
546
+ const over = (e) => {
547
+ if (!hasFiles(e)) return;
548
+ e.preventDefault();
549
+ e.dataTransfer.dropEffect = "copy";
550
+ };
551
+ const leave = (e) => {
552
+ if (!hasFiles(e)) return;
553
+ e.preventDefault();
554
+ depth = Math.max(0, depth - 1);
555
+ if (depth === 0) setDropping(false);
556
+ };
557
+ const drop = (e) => {
558
+ if (!hasFiles(e)) return;
559
+ e.preventDefault();
560
+ depth = 0;
561
+ setDropping(false);
562
+ if (e.dataTransfer.files && e.dataTransfer.files.length) onFiles(e.dataTransfer.files);
563
+ };
564
+ el.addEventListener("dragenter", enter);
565
+ el.addEventListener("dragover", over);
566
+ el.addEventListener("dragleave", leave);
567
+ el.addEventListener("drop", drop);
568
+ return () => {
569
+ el.removeEventListener("dragenter", enter);
570
+ el.removeEventListener("dragover", over);
571
+ el.removeEventListener("dragleave", leave);
572
+ el.removeEventListener("drop", drop);
573
+ };
574
+ }, [onFiles, disabled, dropTargetRef]);
575
+ const rootClass = (classNames.root ?? "wbx-composer") + (dropping ? " is-dropping" : "");
592
576
  useEffect2(() => {
593
577
  if (!autoGrow) return;
594
578
  const el = taRef.current;
@@ -600,13 +584,13 @@ function Composer(props) {
600
584
  el.style.height = Math.min(el.scrollHeight, max) + "px";
601
585
  el.style.overflowY = el.scrollHeight > max ? "auto" : "hidden";
602
586
  }, [value, autoGrow, maxRows, taRef]);
603
- const sendEl = renderSend ? renderSend() : /* @__PURE__ */ jsx4("button", { type: "button", className: "uic-send", disabled: sendDisabled, onClick: () => onSend(), "aria-label": "Send message", children: /* @__PURE__ */ jsx4(IcSend, {}) });
587
+ const sendEl = renderSend ? renderSend() : /* @__PURE__ */ jsx3("button", { type: "button", className: "uic-send", disabled: sendDisabled, onClick: () => onSend(), "aria-label": "Send message", children: /* @__PURE__ */ jsx3(IcSend, {}) });
604
588
  if (inline) {
605
- return /* @__PURE__ */ jsxs4("div", { className: classNames.root ?? "wbx-composer", children: [
589
+ return /* @__PURE__ */ jsxs3("div", { ref: rootRef, className: rootClass, children: [
606
590
  attachments,
607
- /* @__PURE__ */ jsxs4("div", { className: "uic-composer-line", children: [
591
+ /* @__PURE__ */ jsxs3("div", { className: "uic-composer-line", children: [
608
592
  accessoriesLeft,
609
- /* @__PURE__ */ jsx4(
593
+ /* @__PURE__ */ jsx3(
610
594
  "textarea",
611
595
  {
612
596
  ref: taRef,
@@ -629,12 +613,12 @@ function Composer(props) {
629
613
  accessoriesRight,
630
614
  sendEl
631
615
  ] }),
632
- tray ? /* @__PURE__ */ jsx4("div", { className: "uic-composer-tray", children: tray }) : null
616
+ tray ? /* @__PURE__ */ jsx3("div", { className: "uic-composer-tray", children: tray }) : null
633
617
  ] });
634
618
  }
635
- return /* @__PURE__ */ jsxs4("div", { className: classNames.root ?? "wbx-composer", children: [
619
+ return /* @__PURE__ */ jsxs3("div", { ref: rootRef, className: rootClass, children: [
636
620
  attachments,
637
- /* @__PURE__ */ jsx4(
621
+ /* @__PURE__ */ jsx3(
638
622
  "textarea",
639
623
  {
640
624
  ref: taRef,
@@ -653,22 +637,22 @@ function Composer(props) {
653
637
  }
654
638
  }
655
639
  ),
656
- /* @__PURE__ */ jsxs4("div", { className: classNames.row ?? "wbx-composer-row", children: [
640
+ /* @__PURE__ */ jsxs3("div", { className: classNames.row ?? "wbx-composer-row", children: [
657
641
  accessoriesLeft,
658
- /* @__PURE__ */ jsx4("span", { style: { flex: 1 } }),
642
+ /* @__PURE__ */ jsx3("span", { style: { flex: 1 } }),
659
643
  accessoriesRight,
660
- renderSend ? renderSend() : /* @__PURE__ */ jsx4("button", { type: "button", className: "uic-send", disabled: sendDisabled, onClick: () => onSend(), "aria-label": "Send message", children: /* @__PURE__ */ jsx4(IcSend, {}) })
644
+ renderSend ? renderSend() : /* @__PURE__ */ jsx3("button", { type: "button", className: "uic-send", disabled: sendDisabled, onClick: () => onSend(), "aria-label": "Send message", children: /* @__PURE__ */ jsx3(IcSend, {}) })
661
645
  ] }),
662
- tray ? /* @__PURE__ */ jsx4("div", { className: "uic-composer-tray", children: tray }) : null
646
+ tray ? /* @__PURE__ */ jsx3("div", { className: "uic-composer-tray", children: tray }) : null
663
647
  ] });
664
648
  }
665
649
 
666
650
  // src/components/ChatPanel.jsx
667
- import React6, { useCallback, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
651
+ import React5, { useCallback, useEffect as useEffect3, useRef as useRef2, useState as useState3 } from "react";
668
652
 
669
653
  // src/components/Chip.jsx
670
- import React5, { forwardRef } from "react";
671
- import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
654
+ import React4, { forwardRef } from "react";
655
+ import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
672
656
  var Chip = forwardRef(function Chip2(props, ref) {
673
657
  const {
674
658
  label,
@@ -690,31 +674,31 @@ var Chip = forwardRef(function Chip2(props, ref) {
690
674
  isSlot ? "is-open" : "",
691
675
  className || ""
692
676
  ].filter(Boolean).join(" ");
693
- const body = /* @__PURE__ */ jsxs5(Fragment2, { children: [
694
- icon ? /* @__PURE__ */ jsx5("span", { className: "uic-chip-ic", "aria-hidden": "true", children: icon }) : null,
695
- /* @__PURE__ */ jsx5("span", { className: "uic-chip-l", children: label })
677
+ const body = /* @__PURE__ */ jsxs4(Fragment2, { children: [
678
+ icon ? /* @__PURE__ */ jsx4("span", { className: "uic-chip-ic", "aria-hidden": "true", children: icon }) : null,
679
+ /* @__PURE__ */ jsx4("span", { className: "uic-chip-l", children: label })
696
680
  ] });
697
- const trail = trailing ? /* @__PURE__ */ jsx5("span", { className: "uic-chip-tr", children: trailing }) : null;
681
+ const trail = trailing ? /* @__PURE__ */ jsx4("span", { className: "uic-chip-tr", children: trailing }) : null;
698
682
  if (onClick && onRemove) {
699
- return /* @__PURE__ */ jsxs5("span", { ref, className: cls, title, children: [
700
- /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-press", onClick, ...rest, children: body }),
683
+ return /* @__PURE__ */ jsxs4("span", { ref, className: cls, title, children: [
684
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "uic-chip-press", onClick, ...rest, children: body }),
701
685
  trail,
702
- /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx5(IcX, { size: 12 }) })
686
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx4(IcX, { size: 12 }) })
703
687
  ] });
704
688
  }
705
689
  if (onClick) {
706
690
  if (trailing) {
707
- return /* @__PURE__ */ jsxs5("span", { ref, className: cls, title, children: [
708
- /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-press", onClick, ...rest, children: body }),
691
+ return /* @__PURE__ */ jsxs4("span", { ref, className: cls, title, children: [
692
+ /* @__PURE__ */ jsx4("button", { type: "button", className: "uic-chip-press", onClick, ...rest, children: body }),
709
693
  trail
710
694
  ] });
711
695
  }
712
- return /* @__PURE__ */ jsx5("button", { ref, type: "button", className: cls, title, onClick, ...rest, children: body });
696
+ return /* @__PURE__ */ jsx4("button", { ref, type: "button", className: cls, title, onClick, ...rest, children: body });
713
697
  }
714
- return /* @__PURE__ */ jsxs5("span", { ref, className: cls, title, ...rest, children: [
698
+ return /* @__PURE__ */ jsxs4("span", { ref, className: cls, title, ...rest, children: [
715
699
  body,
716
700
  trail,
717
- onRemove ? /* @__PURE__ */ jsx5("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx5(IcX, { size: 12 }) }) : null
701
+ onRemove ? /* @__PURE__ */ jsx4("button", { type: "button", className: "uic-chip-x", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx4(IcX, { size: 12 }) }) : null
718
702
  ] });
719
703
  });
720
704
 
@@ -727,7 +711,7 @@ function bytesLabel(n) {
727
711
  }
728
712
 
729
713
  // src/components/ChatPanel.jsx
730
- import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
714
+ import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
731
715
  var POLL_MS = 3e3;
732
716
  var RETRY_MS = 2e4;
733
717
  var PIN_PX = 80;
@@ -765,14 +749,14 @@ function ChatPanel(props) {
765
749
  toolLabels,
766
750
  classNames = {}
767
751
  } = props;
768
- const [messages, setMessages] = useState2([]);
769
- const [draft, setDraft] = useState2("");
770
- const [busy, setBusy] = useState2(false);
771
- const [connecting, setConnecting] = useState2(false);
772
- const [histLoading, setHistLoading] = useState2(true);
773
- const [staged, setStaged] = useState2([]);
774
- const [attachErr, setAttachErr] = useState2("");
775
- const [listening2, setListening] = useState2(false);
752
+ const [messages, setMessages] = useState3([]);
753
+ const [draft, setDraft] = useState3("");
754
+ const [busy, setBusy] = useState3(false);
755
+ const [connecting, setConnecting] = useState3(false);
756
+ const [histLoading, setHistLoading] = useState3(true);
757
+ const [staged, setStaged] = useState3([]);
758
+ const [attachErr, setAttachErr] = useState3("");
759
+ const [listening, setListening] = useState3(false);
776
760
  const pendingRef = useRef2(null);
777
761
  const seededRef = useRef2(false);
778
762
  const adoptedRef = useRef2(null);
@@ -855,7 +839,7 @@ function ChatPanel(props) {
855
839
  function send() {
856
840
  const t = draft.trim();
857
841
  if (!t || sendBlocked) return;
858
- if (listening2) {
842
+ if (listening) {
859
843
  dictation?.stop();
860
844
  setListening(false);
861
845
  }
@@ -941,7 +925,7 @@ function ChatPanel(props) {
941
925
  }
942
926
  function toggleDictation() {
943
927
  if (!dictation) return;
944
- if (listening2) {
928
+ if (listening) {
945
929
  dictation.stop();
946
930
  setListening(false);
947
931
  return;
@@ -954,7 +938,7 @@ function ChatPanel(props) {
954
938
  });
955
939
  }
956
940
  const rootCls = ["uic-chat", collapsed ? "is-collapsed" : "", classNames.root || ""].filter(Boolean).join(" ");
957
- const toggle = onToggleCollapse ? /* @__PURE__ */ jsx6(
941
+ const toggle = onToggleCollapse ? /* @__PURE__ */ jsx5(
958
942
  "button",
959
943
  {
960
944
  type: "button",
@@ -963,15 +947,15 @@ function ChatPanel(props) {
963
947
  title: collapsed ? "Show the conversation" : "Hide the conversation",
964
948
  "aria-label": collapsed ? "Show the conversation" : "Hide the conversation",
965
949
  "aria-expanded": !collapsed,
966
- children: /* @__PURE__ */ jsx6(IcPanelRight, {})
950
+ children: /* @__PURE__ */ jsx5(IcPanelRight, {})
967
951
  }
968
952
  ) : null;
969
953
  if (collapsed) {
970
- return /* @__PURE__ */ jsx6("aside", { className: rootCls, children: /* @__PURE__ */ jsx6("div", { className: "uic-chat-h", children: toggle }) });
954
+ return /* @__PURE__ */ jsx5("aside", { className: rootCls, children: /* @__PURE__ */ jsx5("div", { className: "uic-chat-h", children: toggle }) });
971
955
  }
972
956
  const empty = messages.length === 0;
973
- const attachControl = attachments ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
974
- /* @__PURE__ */ jsx6(
957
+ const attachControl = attachments ? /* @__PURE__ */ jsxs5(Fragment3, { children: [
958
+ /* @__PURE__ */ jsx5(
975
959
  "input",
976
960
  {
977
961
  ref: fileRef,
@@ -985,7 +969,7 @@ function ChatPanel(props) {
985
969
  }
986
970
  }
987
971
  ),
988
- /* @__PURE__ */ jsx6(
972
+ /* @__PURE__ */ jsx5(
989
973
  "button",
990
974
  {
991
975
  type: "button",
@@ -993,35 +977,35 @@ function ChatPanel(props) {
993
977
  "aria-label": "Attach a file",
994
978
  disabled: busy,
995
979
  onClick: () => fileRef.current?.click(),
996
- children: /* @__PURE__ */ jsx6(IcPaperclip, {})
980
+ children: /* @__PURE__ */ jsx5(IcPaperclip, {})
997
981
  }
998
982
  )
999
983
  ] }) : null;
1000
- const micControl = dictation ? /* @__PURE__ */ jsx6(
984
+ const micControl = dictation ? /* @__PURE__ */ jsx5(
1001
985
  "button",
1002
986
  {
1003
987
  type: "button",
1004
- className: "uic-chat-icon" + (listening2 ? " is-on" : ""),
1005
- "aria-label": listening2 ? "Stop dictating" : "Dictate",
1006
- "aria-pressed": listening2,
988
+ className: "uic-chat-icon" + (listening ? " is-on" : ""),
989
+ "aria-label": listening ? "Stop dictating" : "Dictate",
990
+ "aria-pressed": listening,
1007
991
  disabled: busy,
1008
992
  onClick: toggleDictation,
1009
- children: /* @__PURE__ */ jsx6(IcMic, {})
993
+ children: /* @__PURE__ */ jsx5(IcMic, {})
1010
994
  }
1011
995
  ) : null;
1012
- const defaultBusyState = /* @__PURE__ */ jsxs6("div", { className: "uic-chat-empty", children: [
1013
- /* @__PURE__ */ jsx6("span", { className: "uic-chat-pulse", "aria-hidden": "true" }),
1014
- /* @__PURE__ */ jsx6("div", { className: "uic-chat-empty-t", children: workingLabel })
996
+ const defaultBusyState = /* @__PURE__ */ jsxs5("div", { className: "uic-chat-empty", children: [
997
+ /* @__PURE__ */ jsx5("span", { className: "uic-chat-pulse", "aria-hidden": "true" }),
998
+ /* @__PURE__ */ jsx5("div", { className: "uic-chat-empty-t", children: workingLabel })
1015
999
  ] });
1016
- return /* @__PURE__ */ jsxs6("aside", { className: rootCls, style: width ? { flex: `0 0 ${width}px` } : void 0, children: [
1017
- /* @__PURE__ */ jsxs6("div", { className: "uic-chat-h", children: [
1000
+ return /* @__PURE__ */ jsxs5("aside", { className: rootCls, style: width ? { flex: `0 0 ${width}px` } : void 0, children: [
1001
+ /* @__PURE__ */ jsxs5("div", { className: "uic-chat-h", children: [
1018
1002
  toggle,
1019
- title ? /* @__PURE__ */ jsx6("span", { className: "uic-chat-title", title, children: title }) : null,
1003
+ title ? /* @__PURE__ */ jsx5("span", { className: "uic-chat-title", title, children: title }) : null,
1020
1004
  headerRight,
1021
- connecting ? /* @__PURE__ */ jsx6("span", { className: "uic-chat-conn", children: connectingLabel }) : null
1005
+ connecting ? /* @__PURE__ */ jsx5("span", { className: "uic-chat-conn", children: connectingLabel }) : null
1022
1006
  ] }),
1023
- /* @__PURE__ */ jsxs6("div", { className: "uic-chat-body", ref: bodyRef, onScroll: onBodyScroll, role: "log", "aria-live": "polite", children: [
1024
- histLoading ? /* @__PURE__ */ jsx6(ChatMessagesSkeleton, {}) : empty && externalBusy ? busyState === void 0 ? defaultBusyState : busyState : empty ? emptyState : /* @__PURE__ */ jsx6(
1007
+ /* @__PURE__ */ jsxs5("div", { className: "uic-chat-body", ref: bodyRef, onScroll: onBodyScroll, role: "log", "aria-live": "polite", children: [
1008
+ histLoading ? /* @__PURE__ */ jsx5(ChatMessagesSkeleton, {}) : empty && externalBusy ? busyState === void 0 ? defaultBusyState : busyState : empty ? emptyState : /* @__PURE__ */ jsx5(
1025
1009
  ChatMessages,
1026
1010
  {
1027
1011
  messages,
@@ -1030,19 +1014,19 @@ function ChatPanel(props) {
1030
1014
  const own = userExtras?.(m, i);
1031
1015
  if (own !== void 0) return own;
1032
1016
  if (!m.files?.length) return void 0;
1033
- return /* @__PURE__ */ jsx6("span", { className: "uic-chat-msg-files", children: m.files.map((n) => /* @__PURE__ */ jsx6(Chip, { icon: /* @__PURE__ */ jsx6(IcPaperclip, { size: 11 }), label: n, title: n }, n)) });
1017
+ return /* @__PURE__ */ jsx5("span", { className: "uic-chat-msg-files", children: m.files.map((n) => /* @__PURE__ */ jsx5(Chip, { icon: /* @__PURE__ */ jsx5(IcPaperclip, { size: 11 }), label: n, title: n }, n)) });
1034
1018
  },
1035
1019
  workingLabel,
1036
1020
  toolLabels: { workingLabel, ...toolLabels || {} },
1037
1021
  statusLabels
1038
1022
  }
1039
1023
  ),
1040
- connecting ? /* @__PURE__ */ jsxs6("div", { className: "uic-chat-note", role: "status", children: [
1041
- /* @__PURE__ */ jsx6("span", { className: "uic-chat-dot", "aria-hidden": "true" }),
1024
+ connecting ? /* @__PURE__ */ jsxs5("div", { className: "uic-chat-note", role: "status", children: [
1025
+ /* @__PURE__ */ jsx5("span", { className: "uic-chat-dot", "aria-hidden": "true" }),
1042
1026
  connectingNote
1043
1027
  ] }) : null
1044
1028
  ] }),
1045
- /* @__PURE__ */ jsx6(
1029
+ /* @__PURE__ */ jsx5(
1046
1030
  Composer,
1047
1031
  {
1048
1032
  value: draft,
@@ -1054,26 +1038,26 @@ function ChatPanel(props) {
1054
1038
  rows: 2,
1055
1039
  autoGrow: false,
1056
1040
  classNames: { root: "uic-chat-cmp", input: "uic-chat-cmp-input", row: "uic-chat-cmp-row" },
1057
- attachments: staged.length > 0 || attachErr ? /* @__PURE__ */ jsxs6("div", { className: "uic-chat-files", children: [
1058
- staged.map((f, i) => /* @__PURE__ */ jsx6(
1041
+ attachments: staged.length > 0 || attachErr ? /* @__PURE__ */ jsxs5("div", { className: "uic-chat-files", children: [
1042
+ staged.map((f, i) => /* @__PURE__ */ jsx5(
1059
1043
  Chip,
1060
1044
  {
1061
- icon: /* @__PURE__ */ jsx6(IcPaperclip, { size: 11 }),
1045
+ icon: /* @__PURE__ */ jsx5(IcPaperclip, { size: 11 }),
1062
1046
  title: f.name,
1063
- label: /* @__PURE__ */ jsxs6(Fragment3, { children: [
1064
- /* @__PURE__ */ jsx6("span", { className: "uic-chip-t", children: f.name }),
1065
- /* @__PURE__ */ jsx6("span", { className: "uic-chip-meta", children: f.pending ? "\u2026" : bytesLabel(f.size) })
1047
+ label: /* @__PURE__ */ jsxs5(Fragment3, { children: [
1048
+ /* @__PURE__ */ jsx5("span", { className: "uic-chip-t", children: f.name }),
1049
+ /* @__PURE__ */ jsx5("span", { className: "uic-chip-meta", children: f.pending ? "\u2026" : bytesLabel(f.size) })
1066
1050
  ] }),
1067
1051
  onRemove: () => setStaged((c) => c.filter((_, j) => j !== i)),
1068
1052
  removeLabel: `Remove ${f.name}`
1069
1053
  },
1070
1054
  `${f.name}-${i}`
1071
1055
  )),
1072
- attachErr ? /* @__PURE__ */ jsx6("span", { className: "uic-chat-file-err", children: attachErr }) : null
1056
+ attachErr ? /* @__PURE__ */ jsx5("span", { className: "uic-chat-file-err", children: attachErr }) : null
1073
1057
  ] }) : null,
1074
1058
  accessoriesLeft: attachControl,
1075
1059
  accessoriesRight: micControl,
1076
- renderSend: () => /* @__PURE__ */ jsx6(
1060
+ renderSend: () => /* @__PURE__ */ jsx5(
1077
1061
  "button",
1078
1062
  {
1079
1063
  type: "button",
@@ -1081,7 +1065,7 @@ function ChatPanel(props) {
1081
1065
  onClick: send,
1082
1066
  disabled: sendBlocked || !draft.trim(),
1083
1067
  "aria-label": "Send message",
1084
- children: /* @__PURE__ */ jsx6(IcSend, {})
1068
+ children: /* @__PURE__ */ jsx5(IcSend, {})
1085
1069
  }
1086
1070
  )
1087
1071
  }
@@ -1138,109 +1122,9 @@ function createDictation({ lang } = {}) {
1138
1122
  };
1139
1123
  }
1140
1124
 
1141
- // src/components/CodeBlock.jsx
1142
- import React7 from "react";
1143
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
1144
- var _hljsPromise = null;
1145
- function loadHljs() {
1146
- if (!_hljsPromise) {
1147
- _hljsPromise = import("highlight.js/lib/core").then((m) => m.default || m);
1148
- }
1149
- return _hljsPromise;
1150
- }
1151
- var GRAMMARS = {
1152
- javascript: () => import("highlight.js/lib/languages/javascript"),
1153
- typescript: () => import("highlight.js/lib/languages/typescript"),
1154
- python: () => import("highlight.js/lib/languages/python"),
1155
- json: () => import("highlight.js/lib/languages/json"),
1156
- bash: () => import("highlight.js/lib/languages/bash"),
1157
- sql: () => import("highlight.js/lib/languages/sql"),
1158
- java: () => import("highlight.js/lib/languages/java"),
1159
- go: () => import("highlight.js/lib/languages/go"),
1160
- rust: () => import("highlight.js/lib/languages/rust"),
1161
- xml: () => import("highlight.js/lib/languages/xml"),
1162
- css: () => import("highlight.js/lib/languages/css"),
1163
- yaml: () => import("highlight.js/lib/languages/yaml"),
1164
- groovy: () => import("highlight.js/lib/languages/groovy")
1165
- };
1166
- var ALIASES = {
1167
- js: "javascript",
1168
- jsx: "javascript",
1169
- mjs: "javascript",
1170
- cjs: "javascript",
1171
- node: "javascript",
1172
- ts: "typescript",
1173
- tsx: "typescript",
1174
- py: "python",
1175
- python3: "python",
1176
- sh: "bash",
1177
- shell: "bash",
1178
- zsh: "bash",
1179
- console: "bash",
1180
- html: "xml",
1181
- xhtml: "xml",
1182
- svg: "xml",
1183
- yml: "yaml",
1184
- golang: "go",
1185
- rs: "rust",
1186
- jsonc: "json",
1187
- postgres: "sql",
1188
- postgresql: "sql",
1189
- mysql: "sql",
1190
- plsql: "sql",
1191
- gremlin: "groovy"
1192
- };
1193
- function canonicalLang(tag) {
1194
- const t = String(tag || "").toLowerCase();
1195
- if (!t) return null;
1196
- const name = ALIASES[t] || t;
1197
- return GRAMMARS[name] ? name : null;
1198
- }
1199
- var _ready = /* @__PURE__ */ new Map();
1200
- function ensureLanguage(name) {
1201
- if (!_ready.has(name)) {
1202
- const p = Promise.all([loadHljs(), GRAMMARS[name]()]).then(([hljs, mod2]) => {
1203
- if (!hljs.getLanguage(name)) hljs.registerLanguage(name, mod2.default || mod2);
1204
- return hljs;
1205
- }).catch(() => null);
1206
- _ready.set(name, p);
1207
- }
1208
- return _ready.get(name);
1209
- }
1210
- function CodeBlock(props) {
1211
- const { code, language, className } = props;
1212
- const src = String(code || "");
1213
- const lang = canonicalLang(language);
1214
- const [hl, setHl] = React7.useState(null);
1215
- React7.useEffect(() => {
1216
- if (!lang || !src) return void 0;
1217
- let cancelled = false;
1218
- const timer = setTimeout(() => {
1219
- ensureLanguage(lang).then((hljs) => {
1220
- if (!hljs || cancelled) return;
1221
- try {
1222
- const out = hljs.highlight(src, { language: lang, ignoreIllegals: true });
1223
- if (!cancelled) setHl({ src, html: out.value });
1224
- } catch {
1225
- }
1226
- });
1227
- }, 200);
1228
- return () => {
1229
- cancelled = true;
1230
- clearTimeout(timer);
1231
- };
1232
- }, [src, lang]);
1233
- const html = hl && hl.src === src ? hl.html : null;
1234
- const label = String(language || "").toLowerCase();
1235
- return /* @__PURE__ */ jsxs7("pre", { className: "wbx-code" + (className ? " " + className : ""), children: [
1236
- label ? /* @__PURE__ */ jsx7("span", { className: "wbx-code-lang", "aria-hidden": "true", children: label }) : null,
1237
- html != null ? /* @__PURE__ */ jsx7("code", { className: "hljs language-" + label, dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsx7("code", { className: label ? "language-" + label : void 0, children: src })
1238
- ] });
1239
- }
1240
-
1241
1125
  // src/components/resizable.jsx
1242
- import React8, { useCallback as useCallback2, useRef as useRef3, useState as useState3 } from "react";
1243
- import { jsx as jsx8 } from "react/jsx-runtime";
1126
+ import React6, { useCallback as useCallback2, useRef as useRef3, useState as useState4 } from "react";
1127
+ import { jsx as jsx6 } from "react/jsx-runtime";
1244
1128
  function useResizablePane(opts = {}) {
1245
1129
  const {
1246
1130
  initial = 380,
@@ -1250,16 +1134,22 @@ function useResizablePane(opts = {}) {
1250
1134
  maxFraction = null,
1251
1135
  // viewport-width fraction cap, e.g. 0.6 for 60vw (null = none)
1252
1136
  fromRight = false,
1253
- // divider sits on the pane's LEFT edge (dragging right shrinks)
1254
- storageKey = null
1255
- // persist the chosen width per user (localStorage)
1137
+ // divider sits on the pane's LEFT/TOP edge (dragging toward it shrinks)
1138
+ storageKey = null,
1139
+ // persist the chosen size per user (localStorage)
1140
+ axis = "x"
1141
+ // 'x' = width (col-resize), 'y' = height (row-resize)
1256
1142
  } = opts;
1143
+ const vertical = axis === "y";
1144
+ const coord = (e) => vertical ? e.clientY : e.clientX;
1145
+ const viewportExtent = () => typeof window === "undefined" ? 0 : vertical ? window.innerHeight : window.innerWidth;
1146
+ const cursor = vertical ? "row-resize" : "col-resize";
1257
1147
  const clamp2 = useCallback2((x) => {
1258
1148
  let hi = max ?? Infinity;
1259
- if (maxFraction && typeof window !== "undefined") hi = Math.min(hi, Math.round(window.innerWidth * maxFraction));
1149
+ if (maxFraction && typeof window !== "undefined") hi = Math.min(hi, Math.round(viewportExtent() * maxFraction));
1260
1150
  return Math.min(hi, Math.max(min, x));
1261
- }, [min, max, maxFraction]);
1262
- const [width, setWidth] = useState3(() => {
1151
+ }, [min, max, maxFraction, vertical]);
1152
+ const [width, setWidth] = useState4(() => {
1263
1153
  if (storageKey && typeof window !== "undefined") {
1264
1154
  try {
1265
1155
  const n = parseInt(window.localStorage.getItem(storageKey) || "", 10);
@@ -1280,9 +1170,9 @@ function useResizablePane(opts = {}) {
1280
1170
  }, [storageKey]);
1281
1171
  const onMouseDown = useCallback2((e) => {
1282
1172
  e.preventDefault();
1283
- const sx = e.clientX, base = widthRef.current, dir = fromRight ? -1 : 1;
1173
+ const sx = coord(e), base = widthRef.current, dir = fromRight ? -1 : 1;
1284
1174
  document.body.classList.add("uic-resizing");
1285
- const move = (ev) => setWidth(clamp2(base + dir * (ev.clientX - sx)));
1175
+ const move = (ev) => setWidth(clamp2(base + dir * (coord(ev) - sx)));
1286
1176
  const up = () => {
1287
1177
  window.removeEventListener("mousemove", move);
1288
1178
  window.removeEventListener("mouseup", up);
@@ -1292,8 +1182,35 @@ function useResizablePane(opts = {}) {
1292
1182
  };
1293
1183
  window.addEventListener("mousemove", move);
1294
1184
  window.addEventListener("mouseup", up);
1295
- document.body.style.cursor = "col-resize";
1296
- }, [clamp2, fromRight, persist]);
1185
+ document.body.style.cursor = cursor;
1186
+ }, [clamp2, fromRight, persist, vertical]);
1187
+ const onPointerDown = useCallback2((e) => {
1188
+ if (e.pointerType === "mouse") return;
1189
+ e.preventDefault();
1190
+ const sx = coord(e), base = widthRef.current, dir = fromRight ? -1 : 1;
1191
+ const el = e.currentTarget;
1192
+ document.body.classList.add("uic-resizing");
1193
+ try {
1194
+ el.setPointerCapture(e.pointerId);
1195
+ } catch {
1196
+ }
1197
+ const move = (ev) => setWidth(clamp2(base + dir * (coord(ev) - sx)));
1198
+ const up = () => {
1199
+ el.removeEventListener("pointermove", move);
1200
+ el.removeEventListener("pointerup", up);
1201
+ el.removeEventListener("pointercancel", up);
1202
+ document.body.classList.remove("uic-resizing");
1203
+ persist(widthRef.current);
1204
+ };
1205
+ el.addEventListener("pointermove", move);
1206
+ el.addEventListener("pointerup", up);
1207
+ el.addEventListener("pointercancel", up);
1208
+ }, [clamp2, fromRight, persist, vertical]);
1209
+ const nudge = useCallback2((delta) => {
1210
+ const w = clamp2(widthRef.current + delta);
1211
+ setWidth(w);
1212
+ persist(w);
1213
+ }, [clamp2, persist]);
1297
1214
  const reset = useCallback2(() => {
1298
1215
  setWidth(initial);
1299
1216
  if (storageKey) {
@@ -1303,26 +1220,49 @@ function useResizablePane(opts = {}) {
1303
1220
  }
1304
1221
  }
1305
1222
  }, [initial, storageKey]);
1306
- return { width, onMouseDown, reset };
1223
+ let maxResolved = max ?? null;
1224
+ if (maxFraction && typeof window !== "undefined") {
1225
+ const frac = Math.round(viewportExtent() * maxFraction);
1226
+ maxResolved = maxResolved == null ? frac : Math.min(maxResolved, frac);
1227
+ }
1228
+ return { width, onMouseDown, onPointerDown, nudge, reset, min, max: maxResolved, fromRight, axis };
1307
1229
  }
1308
1230
  function PaneResizer(props) {
1309
1231
  const { pane, className, title = "Drag to resize (double-click to reset)" } = props;
1310
- return /* @__PURE__ */ jsx8(
1232
+ const vertical = pane.axis === "y";
1233
+ const onKeyDown = (e) => {
1234
+ const keys = vertical ? ["ArrowUp", "ArrowDown"] : ["ArrowLeft", "ArrowRight"];
1235
+ if (!keys.includes(e.key)) return;
1236
+ if (!pane.nudge) return;
1237
+ e.preventDefault();
1238
+ const step = e.shiftKey ? 96 : 24;
1239
+ const forward = e.key === "ArrowRight" || e.key === "ArrowDown";
1240
+ const dir = (forward ? 1 : -1) * (pane.fromRight ? -1 : 1);
1241
+ pane.nudge(dir * step);
1242
+ };
1243
+ return /* @__PURE__ */ jsx6(
1311
1244
  "div",
1312
1245
  {
1313
- className: className ?? "uic-vresize",
1246
+ className: className ?? (vertical ? "uic-hresize" : "uic-vresize"),
1314
1247
  role: "separator",
1315
- "aria-orientation": "vertical",
1248
+ "aria-orientation": vertical ? "horizontal" : "vertical",
1249
+ "aria-label": title,
1250
+ "aria-valuenow": Math.round(pane.width),
1251
+ "aria-valuemin": pane.min != null ? Math.round(pane.min) : void 0,
1252
+ "aria-valuemax": pane.max != null ? Math.round(pane.max) : void 0,
1253
+ tabIndex: 0,
1316
1254
  title,
1317
1255
  onMouseDown: pane.onMouseDown,
1256
+ onPointerDown: pane.onPointerDown,
1257
+ onKeyDown,
1318
1258
  onDoubleClick: pane.reset
1319
1259
  }
1320
1260
  );
1321
1261
  }
1322
1262
 
1323
1263
  // src/components/TaskList.jsx
1324
- import { useCallback as useCallback3, useEffect as useEffect4, useMemo, useRef as useRef4, useState as useState4 } from "react";
1325
- import { Fragment as Fragment4, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1264
+ import { useCallback as useCallback3, useEffect as useEffect4, useMemo, useRef as useRef4, useState as useState5 } from "react";
1265
+ import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1326
1266
  var STATUS_GROUPS = {
1327
1267
  all: () => true,
1328
1268
  working: (s) => ["running", "starting", "queued", "in_progress"].includes(s),
@@ -1360,12 +1300,12 @@ function TaskList({
1360
1300
  statusKey = "status",
1361
1301
  timeKey = "updated_at"
1362
1302
  }) {
1363
- const [head, setHead] = useState4(null);
1364
- const [tail, setTail] = useState4([]);
1365
- const [cursor, setCursor] = useState4("");
1366
- const [loadingMore, setLoadingMore] = useState4(false);
1367
- const [q, setQ] = useState4("");
1368
- const [statusFilter, setStatusFilter] = useState4("all");
1303
+ const [head, setHead] = useState5(null);
1304
+ const [tail, setTail] = useState5([]);
1305
+ const [cursor, setCursor] = useState5("");
1306
+ const [loadingMore, setLoadingMore] = useState5(false);
1307
+ const [q, setQ] = useState5("");
1308
+ const [statusFilter, setStatusFilter] = useState5("all");
1369
1309
  const alive = useRef4(true);
1370
1310
  useEffect4(() => () => {
1371
1311
  alive.current = false;
@@ -1413,14 +1353,14 @@ function TaskList({
1413
1353
  const el = e.currentTarget;
1414
1354
  if (el.scrollTop + el.clientHeight > el.scrollHeight - 140) loadMore();
1415
1355
  };
1416
- return /* @__PURE__ */ jsxs8("div", { className: "rui-tasks", children: [
1417
- header ? /* @__PURE__ */ jsx9("div", { className: "rui-tasks-header", children: header }) : null,
1418
- onNew ? /* @__PURE__ */ jsxs8("button", { type: "button", className: "rui-tasks-new", onClick: onNew, children: [
1356
+ return /* @__PURE__ */ jsxs6("div", { className: "rui-tasks", children: [
1357
+ header ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-header", children: header }) : null,
1358
+ onNew ? /* @__PURE__ */ jsxs6("button", { type: "button", className: "rui-tasks-new", onClick: onNew, children: [
1419
1359
  "+ ",
1420
1360
  newLabel
1421
1361
  ] }) : null,
1422
- /* @__PURE__ */ jsxs8("div", { className: "rui-tasks-filters", children: [
1423
- /* @__PURE__ */ jsx9(
1362
+ /* @__PURE__ */ jsxs6("div", { className: "rui-tasks-filters", children: [
1363
+ /* @__PURE__ */ jsx7(
1424
1364
  "input",
1425
1365
  {
1426
1366
  className: "rui-tasks-search",
@@ -1430,7 +1370,7 @@ function TaskList({
1430
1370
  "aria-label": "Filter tasks"
1431
1371
  }
1432
1372
  ),
1433
- /* @__PURE__ */ jsxs8(
1373
+ /* @__PURE__ */ jsxs6(
1434
1374
  "select",
1435
1375
  {
1436
1376
  className: "rui-tasks-status",
@@ -1438,19 +1378,19 @@ function TaskList({
1438
1378
  onChange: (e) => setStatusFilter(e.target.value),
1439
1379
  "aria-label": "Filter by status",
1440
1380
  children: [
1441
- /* @__PURE__ */ jsx9("option", { value: "all", children: "All" }),
1442
- /* @__PURE__ */ jsx9("option", { value: "working", children: "Working" }),
1443
- /* @__PURE__ */ jsx9("option", { value: "done", children: "Done" }),
1444
- /* @__PURE__ */ jsx9("option", { value: "failed", children: "Failed" })
1381
+ /* @__PURE__ */ jsx7("option", { value: "all", children: "All" }),
1382
+ /* @__PURE__ */ jsx7("option", { value: "working", children: "Working" }),
1383
+ /* @__PURE__ */ jsx7("option", { value: "done", children: "Done" }),
1384
+ /* @__PURE__ */ jsx7("option", { value: "failed", children: "Failed" })
1445
1385
  ]
1446
1386
  }
1447
1387
  )
1448
1388
  ] }),
1449
- /* @__PURE__ */ jsxs8("div", { className: "rui-tasks-list", onScroll, children: [
1450
- head === null ? /* @__PURE__ */ jsx9("div", { className: "rui-tasks-empty", children: "Loading\u2026" }) : shown.length === 0 ? /* @__PURE__ */ jsx9("div", { className: "rui-tasks-empty", children: items.length ? "No matching tasks" : emptyLabel }) : shown.map((it) => {
1389
+ /* @__PURE__ */ jsxs6("div", { className: "rui-tasks-list", onScroll, children: [
1390
+ head === null ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-empty", children: "Loading\u2026" }) : shown.length === 0 ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-empty", children: items.length ? "No matching tasks" : emptyLabel }) : shown.map((it) => {
1451
1391
  const id = it?.[idKey];
1452
1392
  const group = taskStatusGroup(it?.[statusKey]);
1453
- return /* @__PURE__ */ jsxs8(
1393
+ return /* @__PURE__ */ jsxs6(
1454
1394
  "div",
1455
1395
  {
1456
1396
  className: `rui-task${id === selected ? " is-selected" : ""}`,
@@ -1461,15 +1401,15 @@ function TaskList({
1461
1401
  if (e.key === "Enter" || e.key === " ") onSelect?.(id);
1462
1402
  },
1463
1403
  children: [
1464
- /* @__PURE__ */ jsxs8("div", { className: "rui-task-main", children: [
1465
- /* @__PURE__ */ jsx9("div", { className: "rui-task-title", children: it?.[titleKey] || "Untitled task" }),
1466
- /* @__PURE__ */ jsx9("div", { className: "rui-task-meta", children: renderMeta ? renderMeta(it) : /* @__PURE__ */ jsxs8(Fragment4, { children: [
1467
- /* @__PURE__ */ jsx9("span", { className: `rui-task-dot is-${group}` }),
1468
- /* @__PURE__ */ jsx9("span", { className: "rui-task-status", children: it?.[statusKey] || "" }),
1469
- it?.[timeKey] ? /* @__PURE__ */ jsx9("span", { className: "rui-task-time", children: relTime(it[timeKey]) }) : null
1404
+ /* @__PURE__ */ jsxs6("div", { className: "rui-task-main", children: [
1405
+ /* @__PURE__ */ jsx7("div", { className: "rui-task-title", children: it?.[titleKey] || "Untitled task" }),
1406
+ /* @__PURE__ */ jsx7("div", { className: "rui-task-meta", children: renderMeta ? renderMeta(it) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
1407
+ /* @__PURE__ */ jsx7("span", { className: `rui-task-dot is-${group}` }),
1408
+ /* @__PURE__ */ jsx7("span", { className: "rui-task-status", children: it?.[statusKey] || "" }),
1409
+ it?.[timeKey] ? /* @__PURE__ */ jsx7("span", { className: "rui-task-time", children: relTime(it[timeKey]) }) : null
1470
1410
  ] }) })
1471
1411
  ] }),
1472
- onDelete ? /* @__PURE__ */ jsx9(
1412
+ onDelete ? /* @__PURE__ */ jsx7(
1473
1413
  "button",
1474
1414
  {
1475
1415
  type: "button",
@@ -1487,7 +1427,7 @@ function TaskList({
1487
1427
  id
1488
1428
  );
1489
1429
  }),
1490
- loadingMore ? /* @__PURE__ */ jsx9("div", { className: "rui-tasks-empty", children: "Loading more\u2026" }) : null
1430
+ loadingMore ? /* @__PURE__ */ jsx7("div", { className: "rui-tasks-empty", children: "Loading more\u2026" }) : null
1491
1431
  ] })
1492
1432
  ] });
1493
1433
  }
@@ -1497,53 +1437,14 @@ import {
1497
1437
  createContext,
1498
1438
  useCallback as useCallback4,
1499
1439
  useContext,
1500
- useEffect as useEffect6,
1440
+ useEffect as useEffect5,
1501
1441
  useId,
1502
1442
  useMemo as useMemo2,
1503
1443
  useRef as useRef5,
1504
- useState as useState5
1444
+ useState as useState6
1505
1445
  } from "react";
1506
1446
  import { createPortal } from "react-dom";
1507
-
1508
- // src/components/overlay.js
1509
- import { useEffect as useEffect5 } from "react";
1510
- var stack = [];
1511
- var listening = false;
1512
- function onKey(e) {
1513
- if (e.key !== "Escape") return;
1514
- const top = stack[stack.length - 1];
1515
- if (!top) return;
1516
- e.preventDefault();
1517
- top.onEscape?.();
1518
- }
1519
- function listen() {
1520
- if (listening || typeof document === "undefined") return;
1521
- document.addEventListener("keydown", onKey);
1522
- listening = true;
1523
- }
1524
- function unlisten() {
1525
- if (!listening || stack.length) return;
1526
- document.removeEventListener("keydown", onKey);
1527
- listening = false;
1528
- }
1529
- function pushOverlay(entry) {
1530
- stack.push(entry);
1531
- listen();
1532
- return () => {
1533
- const i = stack.indexOf(entry);
1534
- if (i >= 0) stack.splice(i, 1);
1535
- unlisten();
1536
- };
1537
- }
1538
- function useOverlayEscape(active, onEscape) {
1539
- useEffect5(() => {
1540
- if (!active) return void 0;
1541
- return pushOverlay({ onEscape });
1542
- }, [active, onEscape]);
1543
- }
1544
-
1545
- // src/components/Dialog.jsx
1546
- import { Fragment as Fragment5, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1447
+ import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1547
1448
  var DialogCtx = createContext(null);
1548
1449
  var LABELS = {
1549
1450
  en: { confirm: "Confirm", cancel: "Cancel", ok: "OK", create: "Create", required: "Please enter a value" },
@@ -1551,7 +1452,7 @@ var LABELS = {
1551
1452
  };
1552
1453
  var _idSeq = 0;
1553
1454
  function DialogHost({ children, locale = "en", labels }) {
1554
- const [stack2, setStack] = useState5([]);
1455
+ const [stack, setStack] = useState6([]);
1555
1456
  const t = useMemo2(
1556
1457
  () => ({ ...LABELS[locale] || LABELS.en, ...labels || {} }),
1557
1458
  [locale, labels]
@@ -1573,10 +1474,10 @@ function DialogHost({ children, locale = "en", labels }) {
1573
1474
  create: (opts) => open({ kind: "create", ...opts }),
1574
1475
  labels: t
1575
1476
  }), [open, t]);
1576
- return /* @__PURE__ */ jsxs9(DialogCtx.Provider, { value: ctx, children: [
1477
+ return /* @__PURE__ */ jsxs7(DialogCtx.Provider, { value: ctx, children: [
1577
1478
  children,
1578
- stack2.length > 0 && typeof document !== "undefined" && createPortal(
1579
- /* @__PURE__ */ jsx10("div", { className: "rui-dlg-root", role: "presentation", children: stack2.map((d, i) => /* @__PURE__ */ jsx10(DialogShell, { dialog: d, isTop: i === stack2.length - 1, onClose: close, t }, d.id)) }),
1479
+ stack.length > 0 && typeof document !== "undefined" && createPortal(
1480
+ /* @__PURE__ */ jsx8("div", { className: "rui-dlg-root", role: "presentation", children: stack.map((d, i) => /* @__PURE__ */ jsx8(DialogShell, { dialog: d, isTop: i === stack.length - 1, onClose: close, t }, d.id)) }),
1580
1481
  document.body
1581
1482
  )
1582
1483
  ] });
@@ -1593,7 +1494,7 @@ function DialogShell({ dialog, isTop, onClose, t }) {
1593
1494
  const titleId = useId();
1594
1495
  const escape = useCallback4(() => onClose(id, cancelValue(spec.kind)), [id, onClose, spec.kind]);
1595
1496
  useOverlayEscape(isTop, escape);
1596
- useEffect6(() => {
1497
+ useEffect5(() => {
1597
1498
  if (!isTop || !ref.current) return;
1598
1499
  const el = ref.current.querySelector("input, textarea") || ref.current.querySelector(".rui-dlg-primary") || ref.current.querySelector("button");
1599
1500
  el?.focus();
@@ -1602,7 +1503,7 @@ function DialogShell({ dialog, isTop, onClose, t }) {
1602
1503
  if (e.target === e.currentTarget && isTop) onClose(id, cancelValue(spec.kind));
1603
1504
  };
1604
1505
  const done = (v) => onClose(id, v);
1605
- return /* @__PURE__ */ jsx10("div", { className: "rui-dlg-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ jsxs9(
1506
+ return /* @__PURE__ */ jsx8("div", { className: "rui-dlg-backdrop", onClick: onBackdrop, children: /* @__PURE__ */ jsxs7(
1606
1507
  "div",
1607
1508
  {
1608
1509
  ref,
@@ -1611,34 +1512,34 @@ function DialogShell({ dialog, isTop, onClose, t }) {
1611
1512
  "aria-labelledby": spec.title ? titleId : void 0,
1612
1513
  className: `rui-dlg-card${spec.kind === "create" ? " is-wide" : ""}`,
1613
1514
  children: [
1614
- spec.kind === "alert" && /* @__PURE__ */ jsx10(AlertBody, { spec, onClose: done, t, titleId }),
1615
- spec.kind === "confirm" && /* @__PURE__ */ jsx10(ConfirmBody, { spec, onClose: done, t, titleId }),
1616
- spec.kind === "prompt" && /* @__PURE__ */ jsx10(PromptBody, { spec, onClose: done, t, titleId }),
1617
- spec.kind === "create" && /* @__PURE__ */ jsx10(CreateBody, { spec, onClose: done, t, titleId })
1515
+ spec.kind === "alert" && /* @__PURE__ */ jsx8(AlertBody, { spec, onClose: done, t, titleId }),
1516
+ spec.kind === "confirm" && /* @__PURE__ */ jsx8(ConfirmBody, { spec, onClose: done, t, titleId }),
1517
+ spec.kind === "prompt" && /* @__PURE__ */ jsx8(PromptBody, { spec, onClose: done, t, titleId }),
1518
+ spec.kind === "create" && /* @__PURE__ */ jsx8(CreateBody, { spec, onClose: done, t, titleId })
1618
1519
  ]
1619
1520
  }
1620
1521
  ) });
1621
1522
  }
1622
1523
  function Header({ title, variant, titleId }) {
1623
1524
  if (!title) return null;
1624
- return /* @__PURE__ */ jsx10("div", { className: `rui-dlg-h${variant ? ` is-${variant}` : ""}`, children: /* @__PURE__ */ jsx10("div", { className: "rui-dlg-title", id: titleId, children: title }) });
1525
+ return /* @__PURE__ */ jsx8("div", { className: `rui-dlg-h${variant ? ` is-${variant}` : ""}`, children: /* @__PURE__ */ jsx8("div", { className: "rui-dlg-title", id: titleId, children: title }) });
1625
1526
  }
1626
- var Footer = ({ children }) => /* @__PURE__ */ jsx10("div", { className: "rui-dlg-f", children });
1527
+ var Footer = ({ children }) => /* @__PURE__ */ jsx8("div", { className: "rui-dlg-f", children });
1627
1528
  function AlertBody({ spec, onClose, t, titleId }) {
1628
- return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1629
- /* @__PURE__ */ jsx10(Header, { title: spec.title, variant: spec.variant, titleId }),
1630
- /* @__PURE__ */ jsx10("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
1631
- /* @__PURE__ */ jsx10(Footer, { children: /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: () => onClose(true), children: spec.confirmLabel || t.ok }) })
1529
+ return /* @__PURE__ */ jsxs7(Fragment5, { children: [
1530
+ /* @__PURE__ */ jsx8(Header, { title: spec.title, variant: spec.variant, titleId }),
1531
+ /* @__PURE__ */ jsx8("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
1532
+ /* @__PURE__ */ jsx8(Footer, { children: /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: () => onClose(true), children: spec.confirmLabel || t.ok }) })
1632
1533
  ] });
1633
1534
  }
1634
1535
  function ConfirmBody({ spec, onClose, t, titleId }) {
1635
1536
  const destructive = !!spec.destructive;
1636
- return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1637
- /* @__PURE__ */ jsx10(Header, { title: spec.title, variant: destructive ? "destructive" : spec.variant, titleId }),
1638
- /* @__PURE__ */ jsx10("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
1639
- /* @__PURE__ */ jsxs9(Footer, { children: [
1640
- /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(false), children: spec.cancelLabel || t.cancel }),
1641
- /* @__PURE__ */ jsx10(
1537
+ return /* @__PURE__ */ jsxs7(Fragment5, { children: [
1538
+ /* @__PURE__ */ jsx8(Header, { title: spec.title, variant: destructive ? "destructive" : spec.variant, titleId }),
1539
+ /* @__PURE__ */ jsx8("div", { className: "rui-dlg-b", children: spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null }),
1540
+ /* @__PURE__ */ jsxs7(Footer, { children: [
1541
+ /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(false), children: spec.cancelLabel || t.cancel }),
1542
+ /* @__PURE__ */ jsx8(
1642
1543
  "button",
1643
1544
  {
1644
1545
  type: "button",
@@ -1651,8 +1552,8 @@ function ConfirmBody({ spec, onClose, t, titleId }) {
1651
1552
  ] });
1652
1553
  }
1653
1554
  function PromptBody({ spec, onClose, t, titleId }) {
1654
- const [value, setValue] = useState5(spec.defaultValue ?? "");
1655
- const [err, setErr] = useState5(null);
1555
+ const [value, setValue] = useState6(spec.defaultValue ?? "");
1556
+ const [err, setErr] = useState6(null);
1656
1557
  const inputId = useId();
1657
1558
  const Field2 = spec.multiline ? "textarea" : "input";
1658
1559
  const submit = () => {
@@ -1667,12 +1568,12 @@ function PromptBody({ spec, onClose, t, titleId }) {
1667
1568
  }
1668
1569
  onClose(String(value));
1669
1570
  };
1670
- return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1671
- /* @__PURE__ */ jsx10(Header, { title: spec.title, variant: spec.variant, titleId }),
1672
- /* @__PURE__ */ jsxs9("div", { className: "rui-dlg-b", children: [
1673
- spec.message ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-msg", children: spec.message }) : null,
1674
- spec.label ? /* @__PURE__ */ jsx10("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label }) : null,
1675
- /* @__PURE__ */ jsx10(
1571
+ return /* @__PURE__ */ jsxs7(Fragment5, { children: [
1572
+ /* @__PURE__ */ jsx8(Header, { title: spec.title, variant: spec.variant, titleId }),
1573
+ /* @__PURE__ */ jsxs7("div", { className: "rui-dlg-b", children: [
1574
+ spec.message ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-msg", children: spec.message }) : null,
1575
+ spec.label ? /* @__PURE__ */ jsx8("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label }) : null,
1576
+ /* @__PURE__ */ jsx8(
1676
1577
  Field2,
1677
1578
  {
1678
1579
  id: inputId,
@@ -1695,20 +1596,20 @@ function PromptBody({ spec, onClose, t, titleId }) {
1695
1596
  spellCheck: "false"
1696
1597
  }
1697
1598
  ),
1698
- err ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-err", children: err }) : null,
1699
- !err && spec.help ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-help", children: spec.help }) : null
1599
+ err ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-err", children: err }) : null,
1600
+ !err && spec.help ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-help", children: spec.help }) : null
1700
1601
  ] }),
1701
- /* @__PURE__ */ jsxs9(Footer, { children: [
1702
- /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
1703
- /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.confirm })
1602
+ /* @__PURE__ */ jsxs7(Footer, { children: [
1603
+ /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
1604
+ /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.confirm })
1704
1605
  ] })
1705
1606
  ] });
1706
1607
  }
1707
1608
  function CreateBody({ spec, onClose, t, titleId }) {
1708
1609
  const types = spec.types || [];
1709
- const [kind, setKind] = useState5(spec.defaultKind || types[0]?.kind || "");
1710
- const [value, setValue] = useState5(spec.defaultValue ?? "");
1711
- const [err, setErr] = useState5(null);
1610
+ const [kind, setKind] = useState6(spec.defaultKind || types[0]?.kind || "");
1611
+ const [value, setValue] = useState6(spec.defaultValue ?? "");
1612
+ const [err, setErr] = useState6(null);
1712
1613
  const inputId = useId();
1713
1614
  const sel = types.find((x) => x.kind === kind) || types[0] || {};
1714
1615
  const submit = () => {
@@ -1718,24 +1619,24 @@ function CreateBody({ spec, onClose, t, titleId }) {
1718
1619
  }
1719
1620
  onClose({ kind, name: String(value).trim() });
1720
1621
  };
1721
- return /* @__PURE__ */ jsxs9(Fragment5, { children: [
1722
- /* @__PURE__ */ jsx10(Header, { title: spec.title, titleId }),
1723
- /* @__PURE__ */ jsxs9("div", { className: "rui-dlg-b", children: [
1724
- types.length > 0 ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-typegrid", children: types.map((ty) => /* @__PURE__ */ jsxs9(
1622
+ return /* @__PURE__ */ jsxs7(Fragment5, { children: [
1623
+ /* @__PURE__ */ jsx8(Header, { title: spec.title, titleId }),
1624
+ /* @__PURE__ */ jsxs7("div", { className: "rui-dlg-b", children: [
1625
+ types.length > 0 ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-typegrid", children: types.map((ty) => /* @__PURE__ */ jsxs7(
1725
1626
  "button",
1726
1627
  {
1727
1628
  type: "button",
1728
1629
  className: `rui-dlg-type${ty.kind === kind ? " is-on" : ""}`,
1729
1630
  onClick: () => setKind(ty.kind),
1730
1631
  children: [
1731
- ty.icon ? /* @__PURE__ */ jsx10("span", { className: "rui-dlg-type-ic", style: ty.color ? { color: ty.color, background: `${ty.color}1f` } : void 0, children: ty.icon }) : null,
1732
- /* @__PURE__ */ jsx10("span", { className: "rui-dlg-type-lbl", children: ty.label })
1632
+ ty.icon ? /* @__PURE__ */ jsx8("span", { className: "rui-dlg-type-ic", style: ty.color ? { color: ty.color, background: `${ty.color}1f` } : void 0, children: ty.icon }) : null,
1633
+ /* @__PURE__ */ jsx8("span", { className: "rui-dlg-type-lbl", children: ty.label })
1733
1634
  ]
1734
1635
  },
1735
1636
  ty.kind
1736
1637
  )) }) : null,
1737
- /* @__PURE__ */ jsx10("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label || `${sel.label || "Item"} name` }),
1738
- /* @__PURE__ */ jsx10(
1638
+ /* @__PURE__ */ jsx8("label", { className: "rui-dlg-label", htmlFor: inputId, children: spec.label || `${sel.label || "Item"} name` }),
1639
+ /* @__PURE__ */ jsx8(
1739
1640
  "input",
1740
1641
  {
1741
1642
  id: inputId,
@@ -1756,26 +1657,27 @@ function CreateBody({ spec, onClose, t, titleId }) {
1756
1657
  spellCheck: "false"
1757
1658
  }
1758
1659
  ),
1759
- err ? /* @__PURE__ */ jsx10("div", { className: "rui-dlg-err", children: err }) : null
1660
+ err ? /* @__PURE__ */ jsx8("div", { className: "rui-dlg-err", children: err }) : null
1760
1661
  ] }),
1761
- /* @__PURE__ */ jsxs9(Footer, { children: [
1762
- /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
1763
- /* @__PURE__ */ jsx10("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.create })
1662
+ /* @__PURE__ */ jsxs7(Footer, { children: [
1663
+ /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-secondary", onClick: () => onClose(null), children: spec.cancelLabel || t.cancel }),
1664
+ /* @__PURE__ */ jsx8("button", { type: "button", className: "rui-dlg-btn rui-dlg-primary", onClick: submit, children: spec.confirmLabel || t.create })
1764
1665
  ] })
1765
1666
  ] });
1766
1667
  }
1767
1668
 
1768
1669
  // src/auth/client.js
1769
1670
  var _cfg = {
1770
- engine: "",
1771
- // REQUIRED: your auth backend base URL, set via configureAuth
1671
+ // Same-origin. A product that forgets to configure gets the working default rather than the
1672
+ // engine's Azure FQDN, which no browser may call — its ingress admits only the VM that fronts
1673
+ // these apps, so a direct call 403s and reads as "Failed to fetch".
1674
+ engine: "/engine",
1772
1675
  product: "",
1773
1676
  loginHash: "#/login"
1774
1677
  };
1775
1678
  function configureAuth(cfg) {
1776
1679
  Object.assign(_cfg, cfg);
1777
1680
  if (!_cfg.product) throw new Error("configureAuth: product is required");
1778
- if (!_cfg.engine) throw new Error("configureAuth: engine (auth backend base URL) is required");
1779
1681
  }
1780
1682
  function authConfig() {
1781
1683
  return { ..._cfg };
@@ -1914,18 +1816,18 @@ async function fetchBalance() {
1914
1816
  }
1915
1817
 
1916
1818
  // src/auth/AuthForm.jsx
1917
- import { useState as useState7 } from "react";
1819
+ import { useState as useState8 } from "react";
1918
1820
 
1919
1821
  // src/auth/GoogleButton.jsx
1920
- import { useEffect as useEffect7, useRef as useRef6, useState as useState6 } from "react";
1921
- import { Fragment as Fragment6, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1822
+ import { useEffect as useEffect6, useRef as useRef6, useState as useState7 } from "react";
1823
+ import { Fragment as Fragment6, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1922
1824
  var CLIENT_ID = "247853836408-ojk91u8901hdlbkevid4fohmrfdot17l.apps.googleusercontent.com";
1923
1825
  function GoogleButton({ onCredential, onError }) {
1924
1826
  const ref = useRef6(null);
1925
- const [failed, setFailed] = useState6(false);
1827
+ const [failed, setFailed] = useState7(false);
1926
1828
  const cb = useRef6({ onCredential, onError });
1927
1829
  cb.current = { onCredential, onError };
1928
- useEffect7(() => {
1830
+ useEffect6(() => {
1929
1831
  if (!CLIENT_ID || !ref.current) return void 0;
1930
1832
  const SRC = "https://accounts.google.com/gsi/client";
1931
1833
  let done = false;
@@ -1976,24 +1878,24 @@ function GoogleButton({ onCredential, onError }) {
1976
1878
  };
1977
1879
  }, []);
1978
1880
  if (!CLIENT_ID || failed) return null;
1979
- return /* @__PURE__ */ jsxs10(Fragment6, { children: [
1980
- /* @__PURE__ */ jsx11("div", { className: "auth-or", children: /* @__PURE__ */ jsx11("span", { children: "or" }) }),
1981
- /* @__PURE__ */ jsx11("div", { ref, className: "auth-gwrap" })
1881
+ return /* @__PURE__ */ jsxs8(Fragment6, { children: [
1882
+ /* @__PURE__ */ jsx9("div", { className: "auth-or", children: /* @__PURE__ */ jsx9("span", { children: "or" }) }),
1883
+ /* @__PURE__ */ jsx9("div", { ref, className: "auth-gwrap" })
1982
1884
  ] });
1983
1885
  }
1984
1886
  var GOOGLE_ENABLED = !!CLIENT_ID;
1985
1887
 
1986
1888
  // src/auth/AuthForm.jsx
1987
- import { Fragment as Fragment7, jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1889
+ import { Fragment as Fragment7, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1988
1890
  function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = "" }) {
1989
- const [mode, setMode] = useState7("signin");
1990
- const [email, setEmail] = useState7("");
1991
- const [password, setPassword] = useState7("");
1992
- const [name, setName] = useState7("");
1993
- const [err, setErr] = useState7("");
1994
- const [busy, setBusy] = useState7(false);
1995
- const [choices, setChoices] = useState7(null);
1996
- const [resetSent, setResetSent] = useState7(false);
1891
+ const [mode, setMode] = useState8("signin");
1892
+ const [email, setEmail] = useState8("");
1893
+ const [password, setPassword] = useState8("");
1894
+ const [name, setName] = useState8("");
1895
+ const [err, setErr] = useState8("");
1896
+ const [busy, setBusy] = useState8(false);
1897
+ const [choices, setChoices] = useState8(null);
1898
+ const [resetSent, setResetSent] = useState8(false);
1997
1899
  async function enter(orgId) {
1998
1900
  const session = await switchOrg(orgId);
1999
1901
  onDone(session);
@@ -2034,10 +1936,10 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
2034
1936
  }
2035
1937
  }
2036
1938
  if (choices) {
2037
- return /* @__PURE__ */ jsxs11("div", { children: [
2038
- /* @__PURE__ */ jsx12("div", { className: "logo", children: brand }),
2039
- /* @__PURE__ */ jsx12("h1", { children: "Choose workspace" }),
2040
- /* @__PURE__ */ jsx12("div", { className: "org-list", children: choices.map((o) => /* @__PURE__ */ jsx12(
1939
+ return /* @__PURE__ */ jsxs9("div", { children: [
1940
+ /* @__PURE__ */ jsx10("div", { className: "logo", children: brand }),
1941
+ /* @__PURE__ */ jsx10("h1", { children: "Choose workspace" }),
1942
+ /* @__PURE__ */ jsx10("div", { className: "org-list", children: choices.map((o) => /* @__PURE__ */ jsx10(
2041
1943
  "button",
2042
1944
  {
2043
1945
  type: "button",
@@ -2055,20 +1957,20 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
2055
1957
  },
2056
1958
  o.id
2057
1959
  )) }),
2058
- err && /* @__PURE__ */ jsx12("div", { className: "auth-err", children: err })
1960
+ err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err })
2059
1961
  ] });
2060
1962
  }
2061
- return /* @__PURE__ */ jsxs11("form", { onSubmit: submit, children: [
2062
- /* @__PURE__ */ jsx12("div", { className: "logo", children: brand }),
2063
- /* @__PURE__ */ jsx12("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
2064
- /* @__PURE__ */ jsx12("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle2 || "Welcome back." }),
2065
- mode === "forgot" ? resetSent ? /* @__PURE__ */ jsxs11(Fragment7, { children: [
2066
- /* @__PURE__ */ jsxs11("div", { className: "auth-note", children: [
1963
+ return /* @__PURE__ */ jsxs9("form", { onSubmit: submit, children: [
1964
+ /* @__PURE__ */ jsx10("div", { className: "logo", children: brand }),
1965
+ /* @__PURE__ */ jsx10("h1", { children: mode === "register" ? "Create your account" : mode === "forgot" ? "Reset password" : "Sign in" }),
1966
+ /* @__PURE__ */ jsx10("p", { className: "sub", children: mode === "register" ? "Get started in seconds." : mode === "forgot" ? "We will email you a reset link." : subtitle2 || "Welcome back." }),
1967
+ mode === "forgot" ? resetSent ? /* @__PURE__ */ jsxs9(Fragment7, { children: [
1968
+ /* @__PURE__ */ jsxs9("div", { className: "auth-note", children: [
2067
1969
  "If an account exists for ",
2068
- /* @__PURE__ */ jsx12("b", { children: email.trim() }),
1970
+ /* @__PURE__ */ jsx10("b", { children: email.trim() }),
2069
1971
  ", a password reset link is on its way. It is valid for 1 hour."
2070
1972
  ] }),
2071
- /* @__PURE__ */ jsx12(
1973
+ /* @__PURE__ */ jsx10(
2072
1974
  "button",
2073
1975
  {
2074
1976
  type: "button",
@@ -2082,36 +1984,36 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
2082
1984
  children: "Back to sign in"
2083
1985
  }
2084
1986
  )
2085
- ] }) : /* @__PURE__ */ jsxs11(Fragment7, { children: [
2086
- /* @__PURE__ */ jsxs11("div", { className: "field", children: [
2087
- /* @__PURE__ */ jsx12("label", { children: "Email" }),
2088
- /* @__PURE__ */ jsx12("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
1987
+ ] }) : /* @__PURE__ */ jsxs9(Fragment7, { children: [
1988
+ /* @__PURE__ */ jsxs9("div", { className: "field", children: [
1989
+ /* @__PURE__ */ jsx10("label", { children: "Email" }),
1990
+ /* @__PURE__ */ jsx10("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
2089
1991
  ] }),
2090
- err && /* @__PURE__ */ jsx12("div", { className: "auth-err", children: err }),
2091
- /* @__PURE__ */ jsx12("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
2092
- /* @__PURE__ */ jsx12("p", { className: "auth-switch", children: /* @__PURE__ */ jsx12("button", { type: "button", onClick: () => {
1992
+ err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err }),
1993
+ /* @__PURE__ */ jsx10("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : "Send reset link" }),
1994
+ /* @__PURE__ */ jsx10("p", { className: "auth-switch", children: /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => {
2093
1995
  setErr("");
2094
1996
  setMode("signin");
2095
1997
  }, children: "Back to sign in" }) })
2096
- ] }) : /* @__PURE__ */ jsxs11(Fragment7, { children: [
2097
- mode === "register" && /* @__PURE__ */ jsxs11("div", { className: "field", children: [
2098
- /* @__PURE__ */ jsx12("label", { children: "Name" }),
2099
- /* @__PURE__ */ jsx12("input", { className: "input", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", placeholder: "Jane Doe" })
1998
+ ] }) : /* @__PURE__ */ jsxs9(Fragment7, { children: [
1999
+ mode === "register" && /* @__PURE__ */ jsxs9("div", { className: "field", children: [
2000
+ /* @__PURE__ */ jsx10("label", { children: "Name" }),
2001
+ /* @__PURE__ */ jsx10("input", { className: "input", value: name, onChange: (e) => setName(e.target.value), autoComplete: "name", placeholder: "Jane Doe" })
2100
2002
  ] }),
2101
- /* @__PURE__ */ jsxs11("div", { className: "field", children: [
2102
- /* @__PURE__ */ jsx12("label", { children: "Email" }),
2103
- /* @__PURE__ */ jsx12("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
2003
+ /* @__PURE__ */ jsxs9("div", { className: "field", children: [
2004
+ /* @__PURE__ */ jsx10("label", { children: "Email" }),
2005
+ /* @__PURE__ */ jsx10("input", { className: "input", type: "email", value: email, onChange: (e) => setEmail(e.target.value), autoFocus: true, required: true, autoComplete: "email" })
2104
2006
  ] }),
2105
- /* @__PURE__ */ jsxs11("div", { className: "field", children: [
2106
- /* @__PURE__ */ jsxs11("div", { className: "field-row", children: [
2107
- /* @__PURE__ */ jsx12("label", { children: "Password" }),
2108
- mode === "signin" && /* @__PURE__ */ jsx12("button", { type: "button", className: "link-sm", onClick: () => {
2007
+ /* @__PURE__ */ jsxs9("div", { className: "field", children: [
2008
+ /* @__PURE__ */ jsxs9("div", { className: "field-row", children: [
2009
+ /* @__PURE__ */ jsx10("label", { children: "Password" }),
2010
+ mode === "signin" && /* @__PURE__ */ jsx10("button", { type: "button", className: "link-sm", onClick: () => {
2109
2011
  setErr("");
2110
2012
  setResetSent(false);
2111
2013
  setMode("forgot");
2112
2014
  }, children: "Forgot password?" })
2113
2015
  ] }),
2114
- /* @__PURE__ */ jsx12(
2016
+ /* @__PURE__ */ jsx10(
2115
2017
  "input",
2116
2018
  {
2117
2019
  className: "input",
@@ -2124,13 +2026,13 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
2124
2026
  }
2125
2027
  )
2126
2028
  ] }),
2127
- err && /* @__PURE__ */ jsx12("div", { className: "auth-err", children: err }),
2128
- /* @__PURE__ */ jsx12("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : mode === "register" ? "Create account" : "Sign in" }),
2129
- GOOGLE_ENABLED && /* @__PURE__ */ jsx12(GoogleButton, { onCredential: onGoogle, onError: setErr }),
2130
- /* @__PURE__ */ jsxs11("p", { className: "auth-switch", children: [
2029
+ err && /* @__PURE__ */ jsx10("div", { className: "auth-err", children: err }),
2030
+ /* @__PURE__ */ jsx10("button", { type: "submit", className: "btn primary lg", style: { width: "100%", marginTop: 8 }, disabled: busy, children: busy ? "Please wait..." : mode === "register" ? "Create account" : "Sign in" }),
2031
+ GOOGLE_ENABLED && /* @__PURE__ */ jsx10(GoogleButton, { onCredential: onGoogle, onError: setErr }),
2032
+ /* @__PURE__ */ jsxs9("p", { className: "auth-switch", children: [
2131
2033
  mode === "register" ? "Already have an account?" : `New to ${productName || "the product"}?`,
2132
2034
  " ",
2133
- /* @__PURE__ */ jsx12("button", { type: "button", onClick: () => {
2035
+ /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => {
2134
2036
  setErr("");
2135
2037
  setMode(mode === "register" ? "signin" : "register");
2136
2038
  }, children: mode === "register" ? "Sign in" : "Create one" })
@@ -2139,863 +2041,9 @@ function AuthForm({ onDone, subtitle: subtitle2, brand = null, productName = ""
2139
2041
  ] });
2140
2042
  }
2141
2043
 
2142
- // src/sheet/SheetGrid.jsx
2143
- import { useEffect as useEffect8, useLayoutEffect, useRef as useRef7, useState as useState8 } from "react";
2144
- import { createPortal as createPortal2 } from "react-dom";
2145
- import { Fragment as Fragment8, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
2146
- var CLAMP_LINE = 18;
2147
- var CLAMP_PAD = 10;
2148
- var CLAMP_TEXT_SEL = "[data-shg-clamp-text]";
2149
- var cellKey = (rowId, colId) => `${rowId}:${colId}`;
2150
- var uid = (p) => `${p}_${Math.random().toString(36).slice(2, 10)}`;
2151
- var DEFAULT_COLUMN_TYPES = [
2152
- { type: "text", label: "Text" },
2153
- { type: "number", label: "Number" },
2154
- { type: "select", label: "Select" },
2155
- { type: "tags", label: "Tags" },
2156
- { type: "checkbox", label: "Checkbox" },
2157
- { type: "date", label: "Date" },
2158
- { type: "url", label: "Link" },
2159
- { type: "resource", label: "Resource" },
2160
- {
2161
- type: "compute",
2162
- label: "Computed",
2163
- computed: true,
2164
- configKey: "compute",
2165
- badge: (col) => col.compute?.kind
2166
- }
2167
- ];
2168
- var COMPUTE_KINDS = [
2169
- { kind: "prompt", label: "AI prompt" },
2170
- { kind: "harness", label: "Agent (harness)" },
2171
- { kind: "workflow", label: "Workflow" },
2172
- { kind: "image", label: "Generate image" }
2173
- ];
2174
- var RESOURCE_KINDS = ["image", "sheet", "slides", "workflow", "graph"];
2175
- var RESOURCE_ICON = { image: "\u{1F5BC}", sheet: "\u25A6", slides: "\u25A4", workflow: "\u2699", graph: "\u25C9" };
2176
- function PopPortal({ anchor, width = 250, estHeight = 300, className, children, onClose }) {
2177
- const boxRef = useRef7(null);
2178
- useEffect8(() => {
2179
- if (!onClose) return void 0;
2180
- const close = () => onClose();
2181
- const onDown = (e) => {
2182
- if (boxRef.current && boxRef.current.contains(e.target)) return;
2183
- if (anchor && e.clientX >= anchor.left && e.clientX <= anchor.right && e.clientY >= anchor.top && e.clientY <= anchor.bottom) return;
2184
- onClose();
2185
- };
2186
- window.addEventListener("mousedown", onDown);
2187
- window.addEventListener("scroll", close, true);
2188
- window.addEventListener("resize", close);
2189
- return () => {
2190
- window.removeEventListener("mousedown", onDown);
2191
- window.removeEventListener("scroll", close, true);
2192
- window.removeEventListener("resize", close);
2193
- };
2194
- }, [onClose, anchor]);
2195
- if (!anchor) return null;
2196
- const left = Math.max(8, Math.min(anchor.right - width, window.innerWidth - width - 8));
2197
- let top = anchor.bottom + 6;
2198
- if (top + estHeight > window.innerHeight - 8) top = Math.max(8, anchor.top - estHeight - 6);
2199
- return createPortal2(
2200
- /* @__PURE__ */ jsx13("div", { ref: boxRef, className, style: { position: "fixed", top, left, width, zIndex: 1e3 }, children }),
2201
- document.body
2202
- );
2203
- }
2204
- var PILL_FALLBACKS = ["#E0E7FF", "#FCE7F3", "#D1FAE5", "#FEF3C7", "#E0F2FE", "#F3E8FF", "#FFE4E6"];
2205
- function normOptions(options) {
2206
- return (options || []).map((o, i) => {
2207
- if (typeof o === "string") return { label: o, color: PILL_FALLBACKS[i % PILL_FALLBACKS.length] };
2208
- return { label: o.label ?? String(o.value ?? ""), color: o.color || PILL_FALLBACKS[i % PILL_FALLBACKS.length] };
2209
- });
2210
- }
2211
- function pillColor(label, options) {
2212
- const opts = normOptions(options);
2213
- const hit = opts.find((o) => o.label === label);
2214
- if (hit) return hit.color;
2215
- let h = 0;
2216
- for (const ch of String(label)) h = h * 31 + ch.charCodeAt(0) >>> 0;
2217
- return PILL_FALLBACKS[h % PILL_FALLBACKS.length];
2218
- }
2219
- function RefImage({ refVal, fetchBlobUrl }) {
2220
- const [src, setSrc] = useState8(/^https?:\/\//i.test(refVal.url || "") ? refVal.url : null);
2221
- useEffect8(() => {
2222
- let dead = false;
2223
- let obj = null;
2224
- if (!src && refVal.url && fetchBlobUrl) {
2225
- fetchBlobUrl(refVal.url).then((u) => {
2226
- if (!dead) {
2227
- obj = u;
2228
- setSrc(u);
2229
- }
2230
- });
2231
- }
2232
- return () => {
2233
- dead = true;
2234
- if (obj) URL.revokeObjectURL(obj);
2235
- };
2236
- }, [refVal.url]);
2237
- if (!src) return /* @__PURE__ */ jsxs12("span", { className: "shg-refchip", children: [
2238
- RESOURCE_ICON.image,
2239
- " ",
2240
- refVal.name || "image"
2241
- ] });
2242
- return /* @__PURE__ */ jsx13("img", { className: "shg-refimg", src, alt: refVal.name || "", title: refVal.name || "" });
2243
- }
2244
- function ResourceChip({ refVal, onOpen }) {
2245
- const icon = RESOURCE_ICON[refVal.kind] || "\u25C7";
2246
- return /* @__PURE__ */ jsxs12(
2247
- "button",
2248
- {
2249
- className: "shg-refchip shg-refchip-btn",
2250
- title: `Open ${refVal.kind}`,
2251
- onClick: (e) => {
2252
- e.stopPropagation();
2253
- onOpen && onOpen(refVal);
2254
- },
2255
- children: [
2256
- /* @__PURE__ */ jsx13("span", { className: "shg-refchip-ic", children: icon }),
2257
- /* @__PURE__ */ jsx13("span", { className: "shg-refchip-name", children: refVal.name || refVal.id || refVal.kind })
2258
- ]
2259
- }
2260
- );
2261
- }
2262
- function StatusDot({ status }) {
2263
- if (!status || status === "empty") return null;
2264
- return /* @__PURE__ */ jsx13("span", { className: `shg-dot shg-dot-${status}`, title: status });
2265
- }
2266
- function CellValue({ cell, col, fetchBlobUrl, onOpenResource }) {
2267
- const v = cell?.value;
2268
- if (v === void 0 || v === null || v === "") return /* @__PURE__ */ jsx13("span", { className: "shg-val-txt" });
2269
- if (v && typeof v === "object" && !Array.isArray(v) && v.kind) {
2270
- if (v.kind === "image") return /* @__PURE__ */ jsx13(RefImage, { refVal: v, fetchBlobUrl });
2271
- return /* @__PURE__ */ jsx13(ResourceChip, { refVal: v, onOpen: onOpenResource });
2272
- }
2273
- switch (col.type) {
2274
- case "select":
2275
- return /* @__PURE__ */ jsx13("span", { className: "shg-pill", style: { background: pillColor(String(v), col.options) }, children: String(v) });
2276
- case "tags": {
2277
- const tags = Array.isArray(v) ? v : String(v).split(",").map((s) => s.trim()).filter(Boolean);
2278
- return /* @__PURE__ */ jsx13("span", { className: "shg-pills", children: tags.map((t) => /* @__PURE__ */ jsx13("span", { className: "shg-pill", style: { background: pillColor(t, col.options) }, children: t }, t)) });
2279
- }
2280
- case "checkbox":
2281
- return /* @__PURE__ */ jsx13("span", { className: "shg-check" + (v ? " on" : ""), children: v ? "\u2713" : "" });
2282
- case "url": {
2283
- const href = /^https?:\/\//i.test(String(v)) ? String(v) : `https://${v}`;
2284
- return /* @__PURE__ */ jsx13("a", { className: "shg-link", href, target: "_blank", rel: "noreferrer", onClick: (e) => e.stopPropagation(), children: String(v) });
2285
- }
2286
- case "number":
2287
- return /* @__PURE__ */ jsx13("span", { className: "shg-val-txt shg-num", children: String(v) });
2288
- default:
2289
- return /* @__PURE__ */ jsx13("span", { className: "shg-val-txt", children: typeof v === "object" ? JSON.stringify(v) : String(v) });
2290
- }
2291
- }
2292
- function SheetGrid({
2293
- sheet,
2294
- onChange,
2295
- onRunCell,
2296
- onRunColumn,
2297
- readOnly = false,
2298
- fetchBlobUrl,
2299
- onOpenResource,
2300
- peerMarks,
2301
- onActiveCell,
2302
- columnTypes = DEFAULT_COLUMN_TYPES,
2303
- renderCell,
2304
- renderColumnConfig
2305
- }) {
2306
- const columns = sheet?.columns || [];
2307
- const rows = sheet?.rows || [];
2308
- const cells = sheet?.cells || {};
2309
- const [editing, setEditing] = useState8(null);
2310
- const [draft, setDraft] = useState8("");
2311
- const [menuCol, setMenuCol] = useState8(null);
2312
- const [sizeDraft, setSizeDraft] = useState8({});
2313
- const [dnd, setDnd] = useState8(null);
2314
- const [dropAt, setDropAt] = useState8(null);
2315
- const inputRef = useRef7(null);
2316
- const dragRef = useRef7(null);
2317
- const gridRef = useRef7(null);
2318
- const descOf = (type) => columnTypes.find((t) => t.type === type) || { type, label: type };
2319
- const isComputed = (col) => !!descOf(col?.type).computed;
2320
- const isEditable = (col) => {
2321
- const d = descOf(col?.type);
2322
- return d.editable ?? !d.computed;
2323
- };
2324
- const startResize = (e, kind, id, start) => {
2325
- if (readOnly) return;
2326
- e.preventDefault();
2327
- e.stopPropagation();
2328
- const origin = kind === "col" ? e.clientX : e.clientY;
2329
- dragRef.current = { kind, id, start, origin, last: start };
2330
- const onMove = (ev) => {
2331
- const d = dragRef.current;
2332
- if (!d) return;
2333
- const delta = (d.kind === "col" ? ev.clientX : ev.clientY) - d.origin;
2334
- const next = Math.max(d.kind === "col" ? 90 : 26, d.start + delta);
2335
- d.last = next;
2336
- setSizeDraft((sd) => ({ ...sd, [d.kind]: { ...sd[d.kind] || {}, [d.id]: next } }));
2337
- };
2338
- const onUp = () => {
2339
- const d = dragRef.current;
2340
- dragRef.current = null;
2341
- window.removeEventListener("mousemove", onMove);
2342
- window.removeEventListener("mouseup", onUp);
2343
- document.body.style.cursor = "";
2344
- if (!d) return;
2345
- setSizeDraft({});
2346
- mutate((n) => {
2347
- if (d.kind === "col") {
2348
- const c = n.columns.find((x) => x.id === d.id);
2349
- if (c) c.width = Math.round(d.last);
2350
- } else {
2351
- const r = n.rows.find((x) => x.id === d.id);
2352
- if (r) r.height = Math.round(d.last);
2353
- }
2354
- });
2355
- };
2356
- window.addEventListener("mousemove", onMove);
2357
- window.addEventListener("mouseup", onUp);
2358
- document.body.style.cursor = kind === "col" ? "col-resize" : "row-resize";
2359
- };
2360
- const colWidth = (col) => sizeDraft.col && sizeDraft.col[col.id] || col.width || void 0;
2361
- const reorder = (kind, fromId, toId, after) => mutate((n) => {
2362
- const arr = kind === "col" ? n.columns : n.rows;
2363
- const i = arr.findIndex((x) => x.id === fromId);
2364
- if (i < 0 || fromId === toId) return;
2365
- const [item] = arr.splice(i, 1);
2366
- let j = arr.findIndex((x) => x.id === toId);
2367
- if (j < 0) {
2368
- arr.splice(i, 0, item);
2369
- return;
2370
- }
2371
- if (after) j += 1;
2372
- arr.splice(j, 0, item);
2373
- });
2374
- const dndProps = (kind, id) => readOnly ? {} : {
2375
- draggable: true,
2376
- onDragStart: (e) => {
2377
- if (e.target.closest && e.target.closest(".shg-resize-col, .shg-resize-row, input, button")) {
2378
- e.preventDefault();
2379
- return;
2380
- }
2381
- e.dataTransfer.effectAllowed = "move";
2382
- e.dataTransfer.setData("text/plain", `${kind}:${id}`);
2383
- setDnd({ kind, id });
2384
- },
2385
- onDragOver: (e) => {
2386
- if (!dnd || dnd.kind !== kind || dnd.id === id) return;
2387
- e.preventDefault();
2388
- const r = e.currentTarget.getBoundingClientRect();
2389
- const after = kind === "col" ? e.clientX > r.x + r.width / 2 : e.clientY > r.y + r.height / 2;
2390
- setDropAt((d) => d && d.id === id && d.after === after ? d : { kind, id, after });
2391
- },
2392
- onDrop: (e) => {
2393
- e.preventDefault();
2394
- if (dnd && dnd.kind === kind && dnd.id !== id) {
2395
- const r = e.currentTarget.getBoundingClientRect();
2396
- const after = kind === "col" ? e.clientX > r.x + r.width / 2 : e.clientY > r.y + r.height / 2;
2397
- reorder(kind, dnd.id, id, after);
2398
- }
2399
- setDnd(null);
2400
- setDropAt(null);
2401
- },
2402
- onDragEnd: () => {
2403
- setDnd(null);
2404
- setDropAt(null);
2405
- }
2406
- };
2407
- const dndClass = (kind, id) => {
2408
- let cls = "";
2409
- if (dnd && dnd.kind === kind && dnd.id === id) cls += " shg-dragging";
2410
- if (dropAt && dropAt.kind === kind && dropAt.id === id) {
2411
- cls += dropAt.after ? kind === "col" ? " shg-drop-after" : " shg-drop-below" : kind === "col" ? " shg-drop-before" : " shg-drop-above";
2412
- }
2413
- return cls;
2414
- };
2415
- const numW = Math.max(48, 30 + String(rows.length || 1).length * 9);
2416
- const numStyle = { width: numW, minWidth: numW, maxWidth: numW };
2417
- const rowHeight = (row) => sizeDraft.row && sizeDraft.row[row.id] || row.height || void 0;
2418
- useEffect8(() => {
2419
- if (editing && inputRef.current) inputRef.current.focus();
2420
- }, [editing]);
2421
- useLayoutEffect(() => {
2422
- const rowsEl = gridRef.current?.querySelectorAll("tbody tr[data-row-id]");
2423
- if (!rowsEl || !rowsEl.length) return;
2424
- const trs = Array.from(rowsEl);
2425
- for (const tr of trs) {
2426
- tr.style.removeProperty("--shg-clamp");
2427
- for (const td of tr.children) td.style.setProperty("--shg-clamp", "1");
2428
- }
2429
- const plan = trs.map((tr) => ({
2430
- base: tr.offsetHeight,
2431
- cells: Array.from(tr.children).map((td) => {
2432
- const txt = td.querySelector(CLAMP_TEXT_SEL);
2433
- const box = txt && txt.parentElement;
2434
- return { td, extra: box ? Math.max(0, box.scrollHeight - txt.offsetHeight) : 0 };
2435
- })
2436
- }));
2437
- for (const { base, cells: cells2 } of plan) {
2438
- const floorLines = Math.max(1, Math.floor((base - CLAMP_PAD) / CLAMP_LINE));
2439
- const need = Math.max(...cells2.map((c) => c.extra)) + floorLines * CLAMP_LINE + CLAMP_PAD;
2440
- for (const { td, extra } of cells2) {
2441
- const lines = Math.max(floorLines, Math.floor((need - extra - CLAMP_PAD) / CLAMP_LINE));
2442
- td.style.setProperty("--shg-clamp", String(lines));
2443
- }
2444
- }
2445
- });
2446
- const mutate = (fn) => {
2447
- if (readOnly || !onChange) return;
2448
- const next = JSON.parse(JSON.stringify(sheet));
2449
- fn(next);
2450
- onChange(next);
2451
- };
2452
- const setCell = (rowId, colId, value) => mutate((n) => {
2453
- n.cells = n.cells || {};
2454
- const k = cellKey(rowId, colId);
2455
- const col = (n.columns || []).find((c) => c.id === colId);
2456
- const prev = n.cells[k];
2457
- n.cells[k] = isComputed(col) && prev ? { ...prev, value } : { value };
2458
- });
2459
- const openEdit = (rowId, col, anchorEl) => {
2460
- if (readOnly) return;
2461
- if (!isEditable(col)) return;
2462
- if (col.type === "checkbox") {
2463
- const cur = cells[cellKey(rowId, col.id)];
2464
- setCell(rowId, col.id, !(cur && cur.value));
2465
- return;
2466
- }
2467
- const c = cells[cellKey(rowId, col.id)];
2468
- const v = c?.value;
2469
- if (col.type === "tags") setDraft(Array.isArray(v) ? v.join(", ") : v || "");
2470
- else if (col.type === "resource") setDraft(v && typeof v === "object" ? v : { kind: "sheet", name: "", id: "", url: "" });
2471
- else setDraft(v == null ? "" : String(v));
2472
- setEditing({ rowId, colId: col.id, type: col.type, rect: anchorEl?.getBoundingClientRect?.() || null });
2473
- onActiveCell && onActiveCell(cellKey(rowId, col.id));
2474
- };
2475
- const commitEdit = () => {
2476
- onActiveCell && onActiveCell(null);
2477
- if (!editing) return;
2478
- const { rowId, colId, type } = editing;
2479
- let value = draft;
2480
- if (type === "number") value = draft === "" ? null : Number(draft);
2481
- else if (type === "tags") value = draft ? draft.split(",").map((s) => s.trim()).filter(Boolean) : [];
2482
- setCell(rowId, colId, value);
2483
- setEditing(null);
2484
- };
2485
- const addColumn = () => mutate((n) => {
2486
- n.columns.push({ id: uid("col"), name: `Column ${n.columns.length + 1}`, type: "text" });
2487
- });
2488
- const addRow = () => mutate((n) => {
2489
- n.rows.push({ id: uid("row") });
2490
- });
2491
- const deleteColumn = (colId) => mutate((n) => {
2492
- n.columns = n.columns.filter((c) => c.id !== colId);
2493
- for (const k of Object.keys(n.cells || {})) if (k.endsWith(`:${colId}`)) delete n.cells[k];
2494
- });
2495
- const deleteRow = (rowId) => mutate((n) => {
2496
- n.rows = n.rows.filter((r) => r.id !== rowId);
2497
- for (const k of Object.keys(n.cells || {})) if (k.startsWith(`${rowId}:`)) delete n.cells[k];
2498
- });
2499
- const renameColumn = (colId, name) => mutate((n) => {
2500
- const c = n.columns.find((x) => x.id === colId);
2501
- if (c) c.name = name;
2502
- });
2503
- const configureColumn = (colId, patch) => mutate((n) => {
2504
- const c = n.columns.find((x) => x.id === colId);
2505
- if (!c) return;
2506
- Object.assign(c, patch);
2507
- if (patch.type) {
2508
- for (const d of columnTypes) if (d.configKey && d.type !== patch.type) delete c[d.configKey];
2509
- }
2510
- });
2511
- const renderEditor = (col) => {
2512
- if (col.type === "resource") {
2513
- const d = typeof draft === "object" && draft ? draft : { kind: "sheet" };
2514
- const set = (k, v) => setDraft({ ...d, [k]: v });
2515
- return /* @__PURE__ */ jsx13(
2516
- PopPortal,
2517
- {
2518
- anchor: editing.rect,
2519
- width: 240,
2520
- estHeight: 230,
2521
- className: "shg-select-pop shg-ref-pop",
2522
- onClose: () => setEditing(null),
2523
- children: /* @__PURE__ */ jsxs12("div", { onClick: (e) => e.stopPropagation(), children: [
2524
- /* @__PURE__ */ jsx13("select", { className: "shg-menu-input", value: d.kind || "sheet", onChange: (e) => set("kind", e.target.value), children: RESOURCE_KINDS.map((k) => /* @__PURE__ */ jsx13("option", { value: k, children: k }, k)) }),
2525
- /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", placeholder: "Name", value: d.name || "", onChange: (e) => set("name", e.target.value) }),
2526
- /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", placeholder: "Resource id (e.g. sheet.\u2026)", value: d.id || "", onChange: (e) => set("id", e.target.value) }),
2527
- /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", placeholder: "or URL", value: d.url || "", onChange: (e) => set("url", e.target.value) }),
2528
- /* @__PURE__ */ jsxs12("div", { className: "shg-menu-actions", children: [
2529
- /* @__PURE__ */ jsx13("button", { className: "shg-pop-clear", onClick: () => {
2530
- setCell(editing.rowId, editing.colId, null);
2531
- setEditing(null);
2532
- }, children: "Clear" }),
2533
- /* @__PURE__ */ jsx13("button", { className: "shg-menu-apply", onClick: () => {
2534
- setCell(editing.rowId, editing.colId, d);
2535
- setEditing(null);
2536
- }, children: "Set" })
2537
- ] })
2538
- ] })
2539
- }
2540
- );
2541
- }
2542
- if (col.type === "select") {
2543
- const opts = normOptions(col.options);
2544
- return /* @__PURE__ */ jsxs12(
2545
- PopPortal,
2546
- {
2547
- anchor: editing.rect,
2548
- width: 190,
2549
- estHeight: 40 + opts.length * 30,
2550
- className: "shg-select-pop",
2551
- onClose: () => setEditing(null),
2552
- children: [
2553
- opts.length === 0 && /* @__PURE__ */ jsx13("div", { className: "shg-pop-note", children: "No options yet \u2014 add them in the column menu." }),
2554
- opts.map((o) => /* @__PURE__ */ jsx13(
2555
- "button",
2556
- {
2557
- className: "shg-pill shg-pill-btn",
2558
- style: { background: o.color },
2559
- onClick: (e) => {
2560
- e.stopPropagation();
2561
- setCell(editing.rowId, editing.colId, o.label);
2562
- setEditing(null);
2563
- },
2564
- children: o.label
2565
- },
2566
- o.label
2567
- )),
2568
- /* @__PURE__ */ jsx13(
2569
- "button",
2570
- {
2571
- className: "shg-pop-clear",
2572
- onClick: (e) => {
2573
- e.stopPropagation();
2574
- setCell(editing.rowId, editing.colId, null);
2575
- setEditing(null);
2576
- },
2577
- children: "Clear"
2578
- }
2579
- )
2580
- ]
2581
- }
2582
- );
2583
- }
2584
- const inputType = col.type === "date" ? "date" : col.type === "number" ? "number" : "text";
2585
- return /* @__PURE__ */ jsx13(
2586
- "input",
2587
- {
2588
- ref: inputRef,
2589
- className: "shg-input",
2590
- type: inputType,
2591
- value: draft,
2592
- placeholder: col.type === "tags" ? "tag, tag, \u2026" : "",
2593
- onChange: (e) => setDraft(e.target.value),
2594
- onBlur: commitEdit,
2595
- onKeyDown: (e) => {
2596
- if (e.key === "Enter") commitEdit();
2597
- if (e.key === "Escape") setEditing(null);
2598
- }
2599
- }
2600
- );
2601
- };
2602
- return /* @__PURE__ */ jsx13("div", { className: "shg", ref: gridRef, children: /* @__PURE__ */ jsx13("div", { className: "shg-scroll", children: /* @__PURE__ */ jsxs12("table", { className: "shg-table", children: [
2603
- /* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsxs12("tr", { children: [
2604
- /* @__PURE__ */ jsx13("th", { className: "shg-corner", style: numStyle }),
2605
- columns.map((col) => /* @__PURE__ */ jsxs12(
2606
- "th",
2607
- {
2608
- className: "shg-col" + (isComputed(col) ? " shg-col-compute" : "") + dndClass("col", col.id),
2609
- style: colWidth(col) ? { width: colWidth(col), minWidth: colWidth(col), maxWidth: colWidth(col) } : void 0,
2610
- ...dndProps("col", col.id),
2611
- children: [
2612
- !readOnly && /* @__PURE__ */ jsx13("span", { className: "shg-resize-col", onMouseDown: (e) => startResize(e, "col", col.id, colWidth(col) || e.currentTarget.closest("th").offsetWidth) }),
2613
- /* @__PURE__ */ jsx13("div", { className: "shg-col-h", children: /* @__PURE__ */ jsx13(
2614
- ColumnHeader,
2615
- {
2616
- col,
2617
- columns,
2618
- readOnly,
2619
- desc: descOf(col.type),
2620
- columnTypes,
2621
- renderColumnConfig,
2622
- menuOpen: menuCol?.id === col.id,
2623
- menuAnchor: menuCol?.id === col.id ? menuCol.rect : null,
2624
- onMenu: (e) => setMenuCol(menuCol?.id === col.id ? null : { id: col.id, rect: e.currentTarget.getBoundingClientRect() }),
2625
- onCloseMenu: () => setMenuCol(null),
2626
- onRename: renameColumn,
2627
- onConfigure: configureColumn,
2628
- onDelete: () => {
2629
- setMenuCol(null);
2630
- deleteColumn(col.id);
2631
- },
2632
- onRun: isComputed(col) && onRunColumn ? () => onRunColumn(col.id) : null
2633
- }
2634
- ) })
2635
- ]
2636
- },
2637
- col.id
2638
- )),
2639
- !readOnly && /* @__PURE__ */ jsx13("th", { className: "shg-add-col", children: /* @__PURE__ */ jsx13("button", { className: "shg-add", onClick: addColumn, title: "Add column", children: "+" }) })
2640
- ] }) }),
2641
- /* @__PURE__ */ jsxs12("tbody", { children: [
2642
- rows.map((row, ri) => /* @__PURE__ */ jsxs12(
2643
- "tr",
2644
- {
2645
- "data-row-id": row.id,
2646
- style: rowHeight(row) ? { height: rowHeight(row) } : void 0,
2647
- children: [
2648
- /* @__PURE__ */ jsxs12(
2649
- "td",
2650
- {
2651
- className: "shg-rownum" + dndClass("row", row.id),
2652
- style: numStyle,
2653
- title: "Drag to reorder",
2654
- ...dndProps("row", row.id),
2655
- children: [
2656
- /* @__PURE__ */ jsx13("span", { children: ri + 1 }),
2657
- !readOnly && /* @__PURE__ */ jsx13("button", { className: "shg-rowdel", onClick: () => deleteRow(row.id), title: "Delete row", children: "\xD7" }),
2658
- !readOnly && /* @__PURE__ */ jsx13("span", { className: "shg-resize-row", onMouseDown: (e) => startResize(e, "row", row.id, rowHeight(row) || e.currentTarget.closest("tr").offsetHeight) })
2659
- ]
2660
- }
2661
- ),
2662
- columns.map((col) => {
2663
- const c = cells[cellKey(row.id, col.id)] || {};
2664
- const computed = isComputed(col);
2665
- const isEditing = editing && editing.rowId === row.id && editing.colId === col.id;
2666
- const peer = peerMarks && peerMarks[cellKey(row.id, col.id)];
2667
- const custom = renderCell && renderCell({
2668
- cell: c,
2669
- column: col,
2670
- row,
2671
- rowIndex: ri,
2672
- sheet,
2673
- computed,
2674
- width: colWidth(col),
2675
- height: rowHeight(row),
2676
- editing: !!isEditing,
2677
- readOnly,
2678
- setCell: (v) => setCell(row.id, col.id, v),
2679
- runCell: onRunCell && !readOnly ? () => onRunCell(row.id, col.id) : null
2680
- });
2681
- return /* @__PURE__ */ jsxs12(
2682
- "td",
2683
- {
2684
- "data-col-id": col.id,
2685
- className: "shg-cell" + (computed ? " shg-cell-compute" : "") + (c.status && computed ? ` shg-cell-${c.status}` : "") + (peer ? " shg-cell-peer" : ""),
2686
- style: peer ? { boxShadow: `inset 0 0 0 2px ${peer.color}` } : void 0,
2687
- onClick: (e) => {
2688
- if (!isEditing) openEdit(row.id, col, e.currentTarget);
2689
- },
2690
- title: c.error || "",
2691
- children: [
2692
- !readOnly && /* @__PURE__ */ jsxs12(Fragment8, { children: [
2693
- /* @__PURE__ */ jsx13(
2694
- "span",
2695
- {
2696
- className: "shg-resize-col shg-resize-in-cell",
2697
- onClick: (e) => e.stopPropagation(),
2698
- onMouseDown: (e) => startResize(
2699
- e,
2700
- "col",
2701
- col.id,
2702
- colWidth(col) || e.currentTarget.closest("td").offsetWidth
2703
- )
2704
- }
2705
- ),
2706
- /* @__PURE__ */ jsx13(
2707
- "span",
2708
- {
2709
- className: "shg-resize-row shg-resize-in-cell",
2710
- onClick: (e) => e.stopPropagation(),
2711
- onMouseDown: (e) => startResize(
2712
- e,
2713
- "row",
2714
- row.id,
2715
- rowHeight(row) || e.currentTarget.closest("tr").offsetHeight
2716
- )
2717
- }
2718
- )
2719
- ] }),
2720
- peer && /* @__PURE__ */ jsx13("span", { className: "shg-peer-flag", style: { background: peer.color }, children: peer.name }),
2721
- isEditing ? renderEditor(col) : /* @__PURE__ */ jsx13("div", { className: "shg-val", children: custom !== void 0 ? custom : /* @__PURE__ */ jsxs12(Fragment8, { children: [
2722
- computed && /* @__PURE__ */ jsx13(StatusDot, { status: c.status }),
2723
- /* @__PURE__ */ jsx13(CellValue, { cell: c, col, fetchBlobUrl, onOpenResource }),
2724
- computed && !readOnly && onRunCell && /* @__PURE__ */ jsx13(
2725
- "button",
2726
- {
2727
- className: "shg-runcell",
2728
- title: "Run this cell",
2729
- onClick: (e) => {
2730
- e.stopPropagation();
2731
- onRunCell(row.id, col.id);
2732
- },
2733
- children: "\u25B6"
2734
- }
2735
- )
2736
- ] }) })
2737
- ]
2738
- },
2739
- col.id
2740
- );
2741
- }),
2742
- !readOnly && /* @__PURE__ */ jsx13("td", { className: "shg-pad" })
2743
- ]
2744
- },
2745
- row.id
2746
- )),
2747
- !readOnly && /* @__PURE__ */ jsxs12("tr", { className: "shg-ghost-row", onClick: addRow, children: [
2748
- /* @__PURE__ */ jsx13("td", { className: "shg-rownum shg-ghost-num", style: numStyle, children: "+" }),
2749
- /* @__PURE__ */ jsx13("td", { className: "shg-ghost-cell", colSpan: columns.length + 1, children: "New row" })
2750
- ] })
2751
- ] })
2752
- ] }) }) });
2753
- }
2754
- function ColumnHeader({
2755
- col,
2756
- columns,
2757
- readOnly,
2758
- desc,
2759
- columnTypes,
2760
- renderColumnConfig,
2761
- menuOpen,
2762
- menuAnchor,
2763
- onMenu,
2764
- onCloseMenu,
2765
- onRename,
2766
- onConfigure,
2767
- onDelete,
2768
- onRun
2769
- }) {
2770
- const [editing, setEditing] = useState8(false);
2771
- const [name, setName] = useState8(col.name);
2772
- useEffect8(() => setName(col.name), [col.name]);
2773
- const badge = desc.badge ? desc.badge(col) : void 0;
2774
- return /* @__PURE__ */ jsxs12("div", { className: "shg-colhdr", children: [
2775
- /* @__PURE__ */ jsxs12("div", { className: "shg-colhdr-main", children: [
2776
- editing && !readOnly ? /* @__PURE__ */ jsx13(
2777
- "input",
2778
- {
2779
- className: "shg-colname-input",
2780
- value: name,
2781
- autoFocus: true,
2782
- onChange: (e) => setName(e.target.value),
2783
- onBlur: () => {
2784
- setEditing(false);
2785
- if (name.trim() && name !== col.name) onRename(col.id, name.trim());
2786
- },
2787
- onKeyDown: (e) => {
2788
- if (e.key === "Enter") e.target.blur();
2789
- }
2790
- }
2791
- ) : /* @__PURE__ */ jsx13("span", { className: "shg-colname", onDoubleClick: () => !readOnly && setEditing(true), title: col.name, children: col.name }),
2792
- /* @__PURE__ */ jsxs12("span", { className: "shg-coltype" + (desc.computed ? " compute" : ""), children: [
2793
- desc.label || col.type,
2794
- badge ? ` \xB7 ${badge}` : ""
2795
- ] })
2796
- ] }),
2797
- !readOnly && /* @__PURE__ */ jsxs12("div", { className: "shg-colhdr-tools", children: [
2798
- onRun && /* @__PURE__ */ jsx13("button", { className: "shg-colrun", onClick: onRun, title: "Run this column", children: "\u25B6 Run" }),
2799
- /* @__PURE__ */ jsx13("button", { className: "shg-colmenu-btn", onClick: (e) => onMenu(e), title: "Column settings", children: "\u22EF" })
2800
- ] }),
2801
- menuOpen && !readOnly && /* @__PURE__ */ jsx13(
2802
- ColumnMenu,
2803
- {
2804
- col,
2805
- columns,
2806
- anchor: menuAnchor,
2807
- columnTypes,
2808
- renderColumnConfig,
2809
- onApply: (patch) => {
2810
- onConfigure(col.id, patch);
2811
- onCloseMenu();
2812
- },
2813
- onDelete,
2814
- onClose: onCloseMenu
2815
- }
2816
- )
2817
- ] });
2818
- }
2819
- function ColumnMenu({ col, columns, anchor, columnTypes, renderColumnConfig, onApply, onDelete, onClose }) {
2820
- const [type, setType] = useState8(col.type || "text");
2821
- const [optText, setOptText] = useState8(
2822
- normOptions(col.options).map((o) => o.label).join("\n")
2823
- );
2824
- const comp = col.compute || {};
2825
- const [kind, setKind] = useState8(comp.kind || "prompt");
2826
- const [prompt, setPrompt] = useState8(comp.prompt || "");
2827
- const [harnessId, setHarnessId] = useState8(comp.harness_id || "");
2828
- const [wfSlug, setWfSlug] = useState8(comp.workflow_slug || "");
2829
- const [outKey, setOutKey] = useState8(comp.output_key || "");
2830
- const [deps, setDeps] = useState8(new Set(comp.deps || []));
2831
- const others = columns.filter((c) => c.id !== col.id);
2832
- const toggleDep = (id) => setDeps((s) => {
2833
- const n = new Set(s);
2834
- if (n.has(id)) n.delete(id);
2835
- else n.add(id);
2836
- return n;
2837
- });
2838
- const apply = () => {
2839
- const patch = { type };
2840
- if (type === "select" || type === "tags") {
2841
- patch.options = optText.split("\n").map((s) => s.trim()).filter(Boolean);
2842
- }
2843
- if (type === "compute") {
2844
- const compute = { kind, deps: [...deps] };
2845
- if (kind === "prompt") compute.prompt = prompt;
2846
- if (kind === "harness") {
2847
- compute.harness_id = harnessId;
2848
- compute.prompt = prompt;
2849
- }
2850
- if (kind === "workflow") {
2851
- compute.workflow_slug = wfSlug;
2852
- compute.output_key = outKey;
2853
- }
2854
- patch.compute = compute;
2855
- }
2856
- onApply(patch);
2857
- };
2858
- const custom = renderColumnConfig && renderColumnConfig({
2859
- column: col,
2860
- columns,
2861
- type,
2862
- applyPatch: (patch) => onApply({ type, ...patch }),
2863
- deleteColumn: onDelete,
2864
- close: onClose
2865
- });
2866
- const desc = columnTypes.find((t) => t.type === type) || {};
2867
- return /* @__PURE__ */ jsx13(
2868
- PopPortal,
2869
- {
2870
- anchor,
2871
- width: desc.configWidth || 250,
2872
- estHeight: desc.configHeight || 340,
2873
- className: "shg-menu",
2874
- onClose,
2875
- children: /* @__PURE__ */ jsxs12("div", { onClick: (e) => e.stopPropagation(), children: [
2876
- /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2877
- "Type",
2878
- /* @__PURE__ */ jsx13("select", { className: "shg-menu-input", value: type, onChange: (e) => setType(e.target.value), children: columnTypes.map((t) => /* @__PURE__ */ jsx13("option", { value: t.type, children: t.label }, t.type)) })
2879
- ] }),
2880
- (type === "select" || type === "tags") && /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2881
- "Options (one per line)",
2882
- /* @__PURE__ */ jsx13(
2883
- "textarea",
2884
- {
2885
- className: "shg-menu-input",
2886
- rows: 3,
2887
- value: optText,
2888
- onChange: (e) => setOptText(e.target.value),
2889
- placeholder: "Todo\nDoing\nDone"
2890
- }
2891
- )
2892
- ] }),
2893
- custom !== void 0 ? custom : /* @__PURE__ */ jsxs12(Fragment8, { children: [
2894
- type === "compute" && /* @__PURE__ */ jsxs12(Fragment8, { children: [
2895
- /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2896
- "Runs",
2897
- /* @__PURE__ */ jsx13("select", { className: "shg-menu-input", value: kind, onChange: (e) => setKind(e.target.value), children: COMPUTE_KINDS.map((k) => /* @__PURE__ */ jsx13("option", { value: k.kind, children: k.label }, k.kind)) })
2898
- ] }),
2899
- (kind === "prompt" || kind === "harness") && /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2900
- "Prompt \u2014 reference columns as ",
2901
- "{{Name}}",
2902
- /* @__PURE__ */ jsx13(
2903
- "textarea",
2904
- {
2905
- className: "shg-menu-input",
2906
- rows: 3,
2907
- value: prompt,
2908
- onChange: (e) => setPrompt(e.target.value),
2909
- placeholder: "Summarize {{Company}} in one line"
2910
- }
2911
- )
2912
- ] }),
2913
- kind === "harness" && /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2914
- "Agent id",
2915
- /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", value: harnessId, onChange: (e) => setHarnessId(e.target.value), placeholder: "chrn_\u2026" })
2916
- ] }),
2917
- kind === "workflow" && /* @__PURE__ */ jsxs12(Fragment8, { children: [
2918
- /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2919
- "Workflow id",
2920
- /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", value: wfSlug, onChange: (e) => setWfSlug(e.target.value), placeholder: "my-workflow" })
2921
- ] }),
2922
- /* @__PURE__ */ jsxs12("label", { className: "shg-menu-lbl", children: [
2923
- "Output key (optional)",
2924
- /* @__PURE__ */ jsx13("input", { className: "shg-menu-input", value: outKey, onChange: (e) => setOutKey(e.target.value), placeholder: "summary" })
2925
- ] })
2926
- ] }),
2927
- others.length > 0 && /* @__PURE__ */ jsxs12("div", { className: "shg-menu-lbl", children: [
2928
- "Reads columns",
2929
- /* @__PURE__ */ jsx13("div", { className: "shg-menu-deps", children: others.map((c) => /* @__PURE__ */ jsxs12("label", { className: "shg-menu-dep", children: [
2930
- /* @__PURE__ */ jsx13("input", { type: "checkbox", checked: deps.has(c.id), onChange: () => toggleDep(c.id) }),
2931
- " ",
2932
- c.name
2933
- ] }, c.id)) })
2934
- ] })
2935
- ] }),
2936
- /* @__PURE__ */ jsxs12("div", { className: "shg-menu-actions", children: [
2937
- /* @__PURE__ */ jsx13("button", { className: "shg-menu-del", onClick: onDelete, children: "Delete column" }),
2938
- /* @__PURE__ */ jsx13("button", { className: "shg-menu-apply", onClick: apply, children: "Apply" })
2939
- ] })
2940
- ] })
2941
- ] })
2942
- }
2943
- );
2944
- }
2945
- function fitRowHeights(container, { rowIds, min = 34, max = 320, padding = 12 } = {}) {
2946
- if (!container) return {};
2947
- const out = {};
2948
- const rows = container.querySelectorAll("tr[data-row-id]");
2949
- for (const tr of rows) {
2950
- const id = tr.getAttribute("data-row-id");
2951
- if (rowIds && !rowIds.includes(id)) continue;
2952
- let tallest = 0;
2953
- for (const cell of tr.querySelectorAll("td[data-col-id] .shg-val")) {
2954
- tallest = Math.max(tallest, cell.scrollHeight);
2955
- }
2956
- if (tallest) out[id] = Math.min(max, Math.max(min, Math.round(tallest + padding)));
2957
- }
2958
- return out;
2959
- }
2960
- function defaultCellText(cell) {
2961
- const v = cell?.value;
2962
- if (v == null) return "";
2963
- if (Array.isArray(v)) return v.join(", ");
2964
- if (typeof v === "object") return JSON.stringify(v);
2965
- return String(v);
2966
- }
2967
- function sheetToDelimited(sheet, sep = ",", { cellText = defaultCellText } = {}) {
2968
- const cols = sheet?.columns || [];
2969
- const rows = sheet?.rows || [];
2970
- const cells = sheet?.cells || {};
2971
- const esc = (s) => {
2972
- if (sep === "," && /[",\n]/.test(s)) return `"${s.replace(/"/g, '""')}"`;
2973
- return s;
2974
- };
2975
- const header = cols.map((c) => esc(c.name)).join(sep);
2976
- const body = rows.map((r) => cols.map((c) => esc(String(cellText(cells[cellKey(r.id, c.id)], c) ?? ""))).join(sep));
2977
- return [header, ...body].join("\n");
2978
- }
2979
- function defaultCellValue(cell) {
2980
- const v = cell?.value;
2981
- if (v == null) return "";
2982
- if (Array.isArray(v)) return v.join(", ");
2983
- if (typeof v === "object") return JSON.stringify(v);
2984
- return v;
2985
- }
2986
- function sheetToAoA(sheet, { cellText = defaultCellValue } = {}) {
2987
- const cols = sheet?.columns || [];
2988
- const rows = sheet?.rows || [];
2989
- const cells = sheet?.cells || {};
2990
- return [
2991
- cols.map((c) => c.name),
2992
- ...rows.map((r) => cols.map((c) => cellText(cells[cellKey(r.id, c.id)], c) ?? ""))
2993
- ];
2994
- }
2995
-
2996
2044
  // src/components/FileTypeIcon.jsx
2997
- import { useEffect as useEffect9, useState as useState9 } from "react";
2998
- import { jsx as jsx14 } from "react/jsx-runtime";
2045
+ import { useEffect as useEffect7, useState as useState9 } from "react";
2046
+ import { jsx as jsx11 } from "react/jsx-runtime";
2999
2047
  function extOf(name) {
3000
2048
  const m = String(name || "").toLowerCase().match(/\.([a-z0-9]+)$/);
3001
2049
  return m ? m[1] : "";
@@ -3005,7 +2053,7 @@ var tried = false;
3005
2053
  function FileTypeIcon({ name, size = 36 }) {
3006
2054
  const [, force] = useState9(0);
3007
2055
  const ext = extOf(name);
3008
- useEffect9(() => {
2056
+ useEffect7(() => {
3009
2057
  if (tried || mod) return;
3010
2058
  tried = true;
3011
2059
  import("react-file-icon").then((m) => {
@@ -3016,15 +2064,15 @@ function FileTypeIcon({ name, size = 36 }) {
3016
2064
  }, []);
3017
2065
  const box = { width: size, height: Math.round(size * 1.16), display: "inline-block", flex: "0 0 auto" };
3018
2066
  if (!mod) {
3019
- return /* @__PURE__ */ jsx14("span", { className: "uic-fileglyph", style: box, "aria-hidden": "true", children: /* @__PURE__ */ jsx14("span", { className: "uic-fileglyph-ext", children: (ext || "file").slice(0, 4) }) });
2067
+ return /* @__PURE__ */ jsx11("span", { className: "uic-fileglyph", style: box, "aria-hidden": "true", children: /* @__PURE__ */ jsx11("span", { className: "uic-fileglyph-ext", children: (ext || "file").slice(0, 4) }) });
3020
2068
  }
3021
2069
  const { FileIcon, defaultStyles } = mod;
3022
2070
  const style = defaultStyles?.[ext] || {};
3023
- return /* @__PURE__ */ jsx14("span", { style: box, children: /* @__PURE__ */ jsx14(FileIcon, { extension: ext || void 0, ...style }) });
2071
+ return /* @__PURE__ */ jsx11("span", { style: box, children: /* @__PURE__ */ jsx11(FileIcon, { extension: ext || void 0, ...style }) });
3024
2072
  }
3025
2073
 
3026
2074
  // src/components/FileCard.jsx
3027
- import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
2075
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
3028
2076
  function subtitle(name, origin, bytes) {
3029
2077
  const parts = [(extOf(name) || "file").toUpperCase()];
3030
2078
  if (origin) parts.push(origin);
@@ -3042,7 +2090,7 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, class
3042
2090
  e.stopPropagation();
3043
2091
  onPreview();
3044
2092
  } : void 0;
3045
- return /* @__PURE__ */ jsxs13(
2093
+ return /* @__PURE__ */ jsxs10(
3046
2094
  "div",
3047
2095
  {
3048
2096
  className: "uic-filecard" + (open ? " is-clickable" : "") + (className ? " " + className : ""),
@@ -3057,12 +2105,12 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, class
3057
2105
  } : void 0,
3058
2106
  title: name,
3059
2107
  children: [
3060
- /* @__PURE__ */ jsx15("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx15(FileTypeIcon, { name, size: 32 }) }),
3061
- /* @__PURE__ */ jsxs13("span", { className: "uic-filecard-meta", children: [
3062
- /* @__PURE__ */ jsx15("span", { className: "uic-filecard-name", children: name }),
3063
- /* @__PURE__ */ jsx15("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
2108
+ /* @__PURE__ */ jsx12("span", { className: "uic-filecard-ic", children: /* @__PURE__ */ jsx12(FileTypeIcon, { name, size: 32 }) }),
2109
+ /* @__PURE__ */ jsxs10("span", { className: "uic-filecard-meta", children: [
2110
+ /* @__PURE__ */ jsx12("span", { className: "uic-filecard-name", children: name }),
2111
+ /* @__PURE__ */ jsx12("span", { className: "uic-filecard-sub", children: subtitle(name, origin, bytes) })
3064
2112
  ] }),
3065
- onDownload && /* @__PURE__ */ jsx15(
2113
+ onDownload && /* @__PURE__ */ jsx12(
3066
2114
  "button",
3067
2115
  {
3068
2116
  type: "button",
@@ -3073,18 +2121,18 @@ function FileCard({ name, origin = "output", bytes, onPreview, onDownload, class
3073
2121
  e.stopPropagation();
3074
2122
  onDownload();
3075
2123
  },
3076
- children: /* @__PURE__ */ jsx15(IcDownload, { size: 18 })
2124
+ children: /* @__PURE__ */ jsx12(IcDownload, { size: 18 })
3077
2125
  }
3078
2126
  ),
3079
- onPreview && /* @__PURE__ */ jsx15("button", { type: "button", className: "uic-filecard-open", "aria-label": `Preview ${name}`, onClick: open, children: "Preview" })
2127
+ onPreview && /* @__PURE__ */ jsx12("button", { type: "button", className: "uic-filecard-open", "aria-label": `Preview ${name}`, onClick: open, children: "Preview" })
3080
2128
  ]
3081
2129
  }
3082
2130
  );
3083
2131
  }
3084
2132
 
3085
2133
  // src/components/FilePreview.jsx
3086
- import { useEffect as useEffect10, useState as useState10 } from "react";
3087
- import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
2134
+ import { useEffect as useEffect8, useState as useState10 } from "react";
2135
+ import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
3088
2136
  var LANG = {
3089
2137
  js: "javascript",
3090
2138
  mjs: "javascript",
@@ -3160,11 +2208,11 @@ function delimitedToRows(text, sep) {
3160
2208
  });
3161
2209
  }
3162
2210
  function Grid({ rows }) {
3163
- if (!rows?.length) return /* @__PURE__ */ jsx16("div", { className: "uic-fp-empty", children: "This file is empty." });
2211
+ if (!rows?.length) return /* @__PURE__ */ jsx13("div", { className: "uic-fp-empty", children: "This file is empty." });
3164
2212
  const [head, ...body] = rows;
3165
- return /* @__PURE__ */ jsx16("div", { className: "uic-fp-sheet", children: /* @__PURE__ */ jsxs14("table", { children: [
3166
- /* @__PURE__ */ jsx16("thead", { children: /* @__PURE__ */ jsx16("tr", { children: head.map((c, i) => /* @__PURE__ */ jsx16("th", { children: c }, i)) }) }),
3167
- /* @__PURE__ */ jsx16("tbody", { children: body.map((r, i) => /* @__PURE__ */ jsx16("tr", { children: r.map((c, j) => /* @__PURE__ */ jsx16("td", { children: c }, j)) }, i)) })
2213
+ return /* @__PURE__ */ jsx13("div", { className: "uic-fp-sheet", children: /* @__PURE__ */ jsxs11("table", { children: [
2214
+ /* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsx13("tr", { children: head.map((c, i) => /* @__PURE__ */ jsx13("th", { children: c }, i)) }) }),
2215
+ /* @__PURE__ */ jsx13("tbody", { children: body.map((r, i) => /* @__PURE__ */ jsx13("tr", { children: r.map((c, j) => /* @__PURE__ */ jsx13("td", { children: c }, j)) }, i)) })
3168
2216
  ] }) });
3169
2217
  }
3170
2218
  var defaultDownload = (url, name) => {
@@ -3189,7 +2237,7 @@ function FilePreview({
3189
2237
  const { url, name } = file || {};
3190
2238
  const [st, setSt] = useState10({ kind: "loading" });
3191
2239
  const [tab, setTab] = useState10(0);
3192
- useEffect10(() => {
2240
+ useEffect8(() => {
3193
2241
  if (!url) return void 0;
3194
2242
  let alive = true;
3195
2243
  let obj;
@@ -3251,11 +2299,11 @@ function FilePreview({
3251
2299
  };
3252
2300
  }, [url, name, fetchFile, officePdfUrl, parseWorkbook]);
3253
2301
  const download = () => onDownload ? onDownload(url, name) : defaultDownload(url, name);
3254
- return /* @__PURE__ */ jsxs14("aside", { className: "uic-fp", "aria-label": title || `Preview of ${name}`, children: [
3255
- /* @__PURE__ */ jsxs14("header", { className: "uic-fp-head", children: [
3256
- /* @__PURE__ */ jsx16("span", { className: "uic-fp-ic", children: /* @__PURE__ */ jsx16(FileTypeIcon, { name, size: 20 }) }),
3257
- /* @__PURE__ */ jsx16("span", { className: "uic-fp-name", title: name, children: name }),
3258
- /* @__PURE__ */ jsx16(
2302
+ return /* @__PURE__ */ jsxs11("aside", { className: "uic-fp", "aria-label": title || `Preview of ${name}`, children: [
2303
+ /* @__PURE__ */ jsxs11("header", { className: "uic-fp-head", children: [
2304
+ /* @__PURE__ */ jsx13("span", { className: "uic-fp-ic", children: /* @__PURE__ */ jsx13(FileTypeIcon, { name, size: 20 }) }),
2305
+ /* @__PURE__ */ jsx13("span", { className: "uic-fp-name", title: name, children: name }),
2306
+ /* @__PURE__ */ jsx13(
3259
2307
  "button",
3260
2308
  {
3261
2309
  type: "button",
@@ -3263,10 +2311,10 @@ function FilePreview({
3263
2311
  "aria-label": `Download ${name}`,
3264
2312
  title: "Download",
3265
2313
  onClick: download,
3266
- children: /* @__PURE__ */ jsx16(IcDownload, {})
2314
+ children: /* @__PURE__ */ jsx13(IcDownload, {})
3267
2315
  }
3268
2316
  ),
3269
- onClose && /* @__PURE__ */ jsx16(
2317
+ onClose && /* @__PURE__ */ jsx13(
3270
2318
  "button",
3271
2319
  {
3272
2320
  type: "button",
@@ -3274,22 +2322,22 @@ function FilePreview({
3274
2322
  "aria-label": "Close preview",
3275
2323
  title: "Close",
3276
2324
  onClick: onClose,
3277
- children: /* @__PURE__ */ jsx16(IcX, { size: 18 })
2325
+ children: /* @__PURE__ */ jsx13(IcX, { size: 18 })
3278
2326
  }
3279
2327
  )
3280
2328
  ] }),
3281
- /* @__PURE__ */ jsxs14("div", { className: "uic-fp-body", children: [
3282
- st.kind === "loading" && /* @__PURE__ */ jsx16("div", { className: "uic-fp-pad", children: /* @__PURE__ */ jsx16("span", { className: "uic-skel uic-fp-skel" }) }),
3283
- st.kind === "image" && st.objUrl && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx16("img", { className: "uic-fp-img", src: st.objUrl, alt: name }) }),
3284
- st.kind === "pdf" && st.objUrl && /* @__PURE__ */ jsx16("iframe", { className: "uic-fp-frame", src: st.objUrl, title: name }),
3285
- st.kind === "video" && st.objUrl && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx16("video", { className: "uic-fp-media", src: st.objUrl, controls: true }) }),
3286
- st.kind === "audio" && st.objUrl && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx16("audio", { src: st.objUrl, controls: true }) }),
3287
- st.kind === "markdown" && /* @__PURE__ */ jsx16("div", { className: "uic-fp-doc", children: renderMarkdown ? renderMarkdown(st.text || "") : /* @__PURE__ */ jsx16("pre", { className: "uic-fp-pre", children: st.text }) }),
3288
- st.kind === "code" && /* @__PURE__ */ jsx16(CodeBlock, { code: st.text || "", lang: LANG[extOf(name)] || "plaintext" }),
3289
- st.kind === "csv" && /* @__PURE__ */ jsx16(Grid, { rows: st.rows }),
3290
- st.kind === "sheet" && st.sheets && /* @__PURE__ */ jsxs14("div", { className: "uic-fp-xlsx", children: [
3291
- st.sheets[tab]?.filled ? /* @__PURE__ */ jsx16(Grid, { rows: st.sheets[tab].rows }) : /* @__PURE__ */ jsx16("div", { className: "uic-fp-empty", children: "This sheet is empty." }),
3292
- /* @__PURE__ */ jsx16("div", { className: "uic-fp-tabs", children: st.sheets.map((s, i) => /* @__PURE__ */ jsx16(
2329
+ /* @__PURE__ */ jsxs11("div", { className: "uic-fp-body", children: [
2330
+ st.kind === "loading" && /* @__PURE__ */ jsx13("div", { className: "uic-fp-pad", children: /* @__PURE__ */ jsx13("span", { className: "uic-skel uic-fp-skel" }) }),
2331
+ st.kind === "image" && st.objUrl && /* @__PURE__ */ jsx13("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx13("img", { className: "uic-fp-img", src: st.objUrl, alt: name }) }),
2332
+ st.kind === "pdf" && st.objUrl && /* @__PURE__ */ jsx13("iframe", { className: "uic-fp-frame", src: st.objUrl, title: name }),
2333
+ st.kind === "video" && st.objUrl && /* @__PURE__ */ jsx13("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx13("video", { className: "uic-fp-media", src: st.objUrl, controls: true }) }),
2334
+ st.kind === "audio" && st.objUrl && /* @__PURE__ */ jsx13("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsx13("audio", { src: st.objUrl, controls: true }) }),
2335
+ st.kind === "markdown" && /* @__PURE__ */ jsx13("div", { className: "uic-fp-doc", children: renderMarkdown ? renderMarkdown(st.text || "") : /* @__PURE__ */ jsx13("pre", { className: "uic-fp-pre", children: st.text }) }),
2336
+ st.kind === "code" && /* @__PURE__ */ jsx13(CodeBlock, { code: st.text || "", lang: LANG[extOf(name)] || "plaintext" }),
2337
+ st.kind === "csv" && /* @__PURE__ */ jsx13(Grid, { rows: st.rows }),
2338
+ st.kind === "sheet" && st.sheets && /* @__PURE__ */ jsxs11("div", { className: "uic-fp-xlsx", children: [
2339
+ st.sheets[tab]?.filled ? /* @__PURE__ */ jsx13(Grid, { rows: st.sheets[tab].rows }) : /* @__PURE__ */ jsx13("div", { className: "uic-fp-empty", children: "This sheet is empty." }),
2340
+ /* @__PURE__ */ jsx13("div", { className: "uic-fp-tabs", children: st.sheets.map((s, i) => /* @__PURE__ */ jsx13(
3293
2341
  "button",
3294
2342
  {
3295
2343
  type: "button",
@@ -3301,10 +2349,10 @@ function FilePreview({
3301
2349
  s.name + i
3302
2350
  )) })
3303
2351
  ] }),
3304
- st.kind === "binary" && /* @__PURE__ */ jsx16("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsxs14("div", { className: "uic-fp-fallback", children: [
3305
- /* @__PURE__ */ jsx16(FileTypeIcon, { name, size: 56 }),
3306
- /* @__PURE__ */ jsx16("p", { children: st.error || "No inline preview for this file type." }),
3307
- /* @__PURE__ */ jsx16("button", { type: "button", className: "uic-fp-dl", onClick: download, children: "Download" })
2352
+ st.kind === "binary" && /* @__PURE__ */ jsx13("div", { className: "uic-fp-center", children: /* @__PURE__ */ jsxs11("div", { className: "uic-fp-fallback", children: [
2353
+ /* @__PURE__ */ jsx13(FileTypeIcon, { name, size: 56 }),
2354
+ /* @__PURE__ */ jsx13("p", { children: st.error || "No inline preview for this file type." }),
2355
+ /* @__PURE__ */ jsx13("button", { type: "button", className: "uic-fp-dl", onClick: download, children: "Download" })
3308
2356
  ] }) })
3309
2357
  ] })
3310
2358
  ] });
@@ -3312,29 +2360,29 @@ function FilePreview({
3312
2360
 
3313
2361
  // src/components/form.jsx
3314
2362
  import { useId as useId2 } from "react";
3315
- import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
2363
+ import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
3316
2364
  function Field({ label, hint, error, htmlFor, required, children, className = "" }) {
3317
- return /* @__PURE__ */ jsxs15("div", { className: "uic-field" + (error ? " is-error" : "") + (className ? " " + className : ""), children: [
3318
- label && /* @__PURE__ */ jsxs15("label", { className: "uic-field-label", htmlFor, children: [
2365
+ return /* @__PURE__ */ jsxs12("div", { className: "uic-field" + (error ? " is-error" : "") + (className ? " " + className : ""), children: [
2366
+ label && /* @__PURE__ */ jsxs12("label", { className: "uic-field-label", htmlFor, children: [
3319
2367
  label,
3320
- required && /* @__PURE__ */ jsx17("span", { className: "uic-field-req", "aria-hidden": "true", children: "*" })
2368
+ required && /* @__PURE__ */ jsx14("span", { className: "uic-field-req", "aria-hidden": "true", children: "*" })
3321
2369
  ] }),
3322
2370
  children,
3323
- error ? /* @__PURE__ */ jsx17("p", { className: "uic-field-err", children: error }) : hint ? /* @__PURE__ */ jsx17("p", { className: "uic-field-hint", children: hint }) : null
2371
+ error ? /* @__PURE__ */ jsx14("p", { className: "uic-field-err", children: error }) : hint ? /* @__PURE__ */ jsx14("p", { className: "uic-field-hint", children: hint }) : null
3324
2372
  ] });
3325
2373
  }
3326
2374
  function withField(Control) {
3327
2375
  return function Fielded({ label, hint, error, required, id, className, ...rest }) {
3328
2376
  const auto = useId2();
3329
2377
  const inputId = id || auto;
3330
- return /* @__PURE__ */ jsx17(Field, { label, hint, error, required, htmlFor: inputId, className, children: /* @__PURE__ */ jsx17(Control, { id: inputId, invalid: !!error, required, ...rest }) });
2378
+ return /* @__PURE__ */ jsx14(Field, { label, hint, error, required, htmlFor: inputId, className, children: /* @__PURE__ */ jsx14(Control, { id: inputId, invalid: !!error, required, ...rest }) });
3331
2379
  };
3332
2380
  }
3333
2381
  function BareInput({ invalid, ...rest }) {
3334
- return /* @__PURE__ */ jsx17("input", { className: "uic-input" + (invalid ? " is-error" : ""), "aria-invalid": invalid || void 0, ...rest });
2382
+ return /* @__PURE__ */ jsx14("input", { className: "uic-input" + (invalid ? " is-error" : ""), "aria-invalid": invalid || void 0, ...rest });
3335
2383
  }
3336
2384
  function BareTextarea({ invalid, rows = 4, ...rest }) {
3337
- return /* @__PURE__ */ jsx17(
2385
+ return /* @__PURE__ */ jsx14(
3338
2386
  "textarea",
3339
2387
  {
3340
2388
  className: "uic-input uic-textarea" + (invalid ? " is-error" : ""),
@@ -3345,42 +2393,42 @@ function BareTextarea({ invalid, rows = 4, ...rest }) {
3345
2393
  );
3346
2394
  }
3347
2395
  function BareSelect({ invalid, options = [], placeholder, ...rest }) {
3348
- return /* @__PURE__ */ jsxs15("span", { className: "uic-select-wrap", children: [
3349
- /* @__PURE__ */ jsxs15(
2396
+ return /* @__PURE__ */ jsxs12("span", { className: "uic-select-wrap", children: [
2397
+ /* @__PURE__ */ jsxs12(
3350
2398
  "select",
3351
2399
  {
3352
2400
  className: "uic-input uic-select" + (invalid ? " is-error" : ""),
3353
2401
  "aria-invalid": invalid || void 0,
3354
2402
  ...rest,
3355
2403
  children: [
3356
- placeholder && /* @__PURE__ */ jsx17("option", { value: "", children: placeholder }),
2404
+ placeholder && /* @__PURE__ */ jsx14("option", { value: "", children: placeholder }),
3357
2405
  options.map((o) => {
3358
2406
  const opt = typeof o === "string" ? { value: o, label: o } : o;
3359
- return /* @__PURE__ */ jsx17("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value);
2407
+ return /* @__PURE__ */ jsx14("option", { value: opt.value, disabled: opt.disabled, children: opt.label }, opt.value);
3360
2408
  })
3361
2409
  ]
3362
2410
  }
3363
2411
  ),
3364
- /* @__PURE__ */ jsx17("span", { className: "uic-select-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(Chevron, { dir: "down", size: 14 }) })
2412
+ /* @__PURE__ */ jsx14("span", { className: "uic-select-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(Chevron, { dir: "down", size: 14 }) })
3365
2413
  ] });
3366
2414
  }
3367
2415
  var Input = withField(BareInput);
3368
2416
  var Textarea = withField(BareTextarea);
3369
2417
  var Select = withField(BareSelect);
3370
2418
  function FormActions({ children, align = "end", className = "" }) {
3371
- return /* @__PURE__ */ jsx17("div", { className: `uic-form-actions is-${align}${className ? " " + className : ""}`, children });
2419
+ return /* @__PURE__ */ jsx14("div", { className: `uic-form-actions is-${align}${className ? " " + className : ""}`, children });
3372
2420
  }
3373
2421
  function Button({ variant = "default", size = "md", type = "button", className = "", ...rest }) {
3374
- return /* @__PURE__ */ jsx17("button", { type, className: `uic-btn is-${variant} is-${size}${className ? " " + className : ""}`, ...rest });
2422
+ return /* @__PURE__ */ jsx14("button", { type, className: `uic-btn is-${variant} is-${size}${className ? " " + className : ""}`, ...rest });
3375
2423
  }
3376
2424
 
3377
2425
  // src/components/Carousel.jsx
3378
- import React9, { useCallback as useCallback5, useEffect as useEffect11, useRef as useRef8, useState as useState11 } from "react";
3379
- import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
2426
+ import React7, { useCallback as useCallback5, useEffect as useEffect9, useRef as useRef7, useState as useState11 } from "react";
2427
+ import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
3380
2428
  var EDGE = 2;
3381
2429
  function Carousel(props) {
3382
2430
  const { label, step, children, classNames = {} } = props;
3383
- const ref = useRef8(null);
2431
+ const ref = useRef7(null);
3384
2432
  const [edges, setEdges] = useState11({ start: true, end: true, overflow: false });
3385
2433
  const measure = useCallback5(() => {
3386
2434
  const el = ref.current;
@@ -3392,7 +2440,7 @@ function Carousel(props) {
3392
2440
  end: el.scrollLeft >= el.scrollWidth - el.clientWidth - EDGE
3393
2441
  });
3394
2442
  }, []);
3395
- useEffect11(() => {
2443
+ useEffect9(() => {
3396
2444
  const el = ref.current;
3397
2445
  if (!el) return void 0;
3398
2446
  measure();
@@ -3406,8 +2454,8 @@ function Carousel(props) {
3406
2454
  if (!el) return;
3407
2455
  el.scrollBy({ left: dir * (step || Math.round(el.clientWidth * 0.9)), behavior: "smooth" });
3408
2456
  };
3409
- return /* @__PURE__ */ jsxs16("div", { className: ["uic-carousel-wrap", classNames.root || ""].filter(Boolean).join(" "), children: [
3410
- edges.overflow ? /* @__PURE__ */ jsx18(
2457
+ return /* @__PURE__ */ jsxs13("div", { className: ["uic-carousel-wrap", classNames.root || ""].filter(Boolean).join(" "), children: [
2458
+ edges.overflow ? /* @__PURE__ */ jsx15(
3411
2459
  "button",
3412
2460
  {
3413
2461
  type: "button",
@@ -3415,10 +2463,10 @@ function Carousel(props) {
3415
2463
  onClick: () => scroll(-1),
3416
2464
  disabled: edges.start,
3417
2465
  "aria-label": `Scroll ${label} left`,
3418
- children: /* @__PURE__ */ jsx18(Chevron, { dir: "left" })
2466
+ children: /* @__PURE__ */ jsx15(Chevron, { dir: "left" })
3419
2467
  }
3420
2468
  ) : null,
3421
- /* @__PURE__ */ jsx18(
2469
+ /* @__PURE__ */ jsx15(
3422
2470
  "div",
3423
2471
  {
3424
2472
  className: ["uic-carousel", classNames.viewport || ""].filter(Boolean).join(" "),
@@ -3429,7 +2477,7 @@ function Carousel(props) {
3429
2477
  children
3430
2478
  }
3431
2479
  ),
3432
- edges.overflow ? /* @__PURE__ */ jsx18(
2480
+ edges.overflow ? /* @__PURE__ */ jsx15(
3433
2481
  "button",
3434
2482
  {
3435
2483
  type: "button",
@@ -3437,42 +2485,42 @@ function Carousel(props) {
3437
2485
  onClick: () => scroll(1),
3438
2486
  disabled: edges.end,
3439
2487
  "aria-label": `Scroll ${label} right`,
3440
- children: /* @__PURE__ */ jsx18(Chevron, { dir: "right" })
2488
+ children: /* @__PURE__ */ jsx15(Chevron, { dir: "right" })
3441
2489
  }
3442
2490
  ) : null
3443
2491
  ] });
3444
2492
  }
3445
2493
 
3446
2494
  // src/components/Card.jsx
3447
- import React10 from "react";
3448
- import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
2495
+ import React8 from "react";
2496
+ import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
3449
2497
  function Card(props) {
3450
2498
  const { art, title, subtitle: subtitle2, onClick, selected = false, overlay, actions, classNames = {} } = props;
3451
- const foot = /* @__PURE__ */ jsxs17("span", { className: "uic-card-foot", children: [
3452
- /* @__PURE__ */ jsx19("span", { className: "uic-card-name", children: title }),
3453
- subtitle2 ? /* @__PURE__ */ jsx19("span", { className: "uic-card-sub", children: subtitle2 }) : null
2499
+ const foot = /* @__PURE__ */ jsxs14("span", { className: "uic-card-foot", children: [
2500
+ /* @__PURE__ */ jsx16("span", { className: "uic-card-name", children: title }),
2501
+ subtitle2 ? /* @__PURE__ */ jsx16("span", { className: "uic-card-sub", children: subtitle2 }) : null
3454
2502
  ] });
3455
- return /* @__PURE__ */ jsxs17("div", { className: ["uic-card", selected ? "is-selected" : "", classNames.root || ""].filter(Boolean).join(" "), children: [
3456
- onClick ? /* @__PURE__ */ jsxs17("button", { type: "button", className: "uic-card-main", onClick, "aria-pressed": selected || void 0, children: [
3457
- /* @__PURE__ */ jsx19("span", { className: "uic-card-art", children: art }),
2503
+ return /* @__PURE__ */ jsxs14("div", { className: ["uic-card", selected ? "is-selected" : "", classNames.root || ""].filter(Boolean).join(" "), children: [
2504
+ onClick ? /* @__PURE__ */ jsxs14("button", { type: "button", className: "uic-card-main", onClick, "aria-pressed": selected || void 0, children: [
2505
+ /* @__PURE__ */ jsx16("span", { className: "uic-card-art", children: art }),
3458
2506
  foot
3459
- ] }) : /* @__PURE__ */ jsxs17("div", { className: "uic-card-main", children: [
3460
- /* @__PURE__ */ jsx19("span", { className: "uic-card-art", children: art }),
2507
+ ] }) : /* @__PURE__ */ jsxs14("div", { className: "uic-card-main", children: [
2508
+ /* @__PURE__ */ jsx16("span", { className: "uic-card-art", children: art }),
3461
2509
  foot
3462
2510
  ] }),
3463
- overlay ? /* @__PURE__ */ jsx19("div", { className: "uic-card-overlay", children: overlay }) : null,
3464
- actions ? /* @__PURE__ */ jsx19("div", { className: "uic-card-actions", children: actions }) : null
2511
+ overlay ? /* @__PURE__ */ jsx16("div", { className: "uic-card-overlay", children: overlay }) : null,
2512
+ actions ? /* @__PURE__ */ jsx16("div", { className: "uic-card-actions", children: actions }) : null
3465
2513
  ] });
3466
2514
  }
3467
2515
 
3468
2516
  // src/components/SearchField.jsx
3469
- import React11 from "react";
3470
- import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
2517
+ import React9 from "react";
2518
+ import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
3471
2519
  function SearchField(props) {
3472
2520
  const { value, onChange, placeholder, clearLabel = "Clear search", className } = props;
3473
- return /* @__PURE__ */ jsxs18("label", { className: ["uic-search", className || ""].filter(Boolean).join(" "), children: [
3474
- /* @__PURE__ */ jsx20("span", { className: "uic-search-ic", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(IcSearch, {}) }),
3475
- /* @__PURE__ */ jsx20(
2521
+ return /* @__PURE__ */ jsxs15("label", { className: ["uic-search", className || ""].filter(Boolean).join(" "), children: [
2522
+ /* @__PURE__ */ jsx17("span", { className: "uic-search-ic", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(IcSearch, {}) }),
2523
+ /* @__PURE__ */ jsx17(
3476
2524
  "input",
3477
2525
  {
3478
2526
  type: "search",
@@ -3482,90 +2530,14 @@ function SearchField(props) {
3482
2530
  onChange: (e) => onChange(e.target.value)
3483
2531
  }
3484
2532
  ),
3485
- value ? /* @__PURE__ */ jsx20("button", { type: "button", className: "uic-search-x", "aria-label": clearLabel, onClick: () => onChange(""), children: /* @__PURE__ */ jsx20(IcX, { size: 12 }) }) : null
2533
+ value ? /* @__PURE__ */ jsx17("button", { type: "button", className: "uic-search-x", "aria-label": clearLabel, onClick: () => onChange(""), children: /* @__PURE__ */ jsx17(IcX, { size: 12 }) }) : null
3486
2534
  ] });
3487
2535
  }
3488
2536
 
3489
- // src/components/Popover.jsx
3490
- import React12, { useCallback as useCallback6, useEffect as useEffect12, useRef as useRef9, useState as useState12 } from "react";
3491
- import { createPortal as createPortal3 } from "react-dom";
3492
- import { jsx as jsx21 } from "react/jsx-runtime";
3493
- var GAP = 6;
3494
- var MARGIN = 8;
3495
- function Popover(props) {
3496
- const {
3497
- open,
3498
- anchorRef,
3499
- onClose,
3500
- width = 280,
3501
- minHeight = 140,
3502
- placement = "auto",
3503
- children,
3504
- className,
3505
- label
3506
- } = props;
3507
- const popRef = useRef9(null);
3508
- const [pos, setPos] = useState12(null);
3509
- useEffect12(() => {
3510
- if (!open) {
3511
- setPos(null);
3512
- return void 0;
3513
- }
3514
- const place = () => {
3515
- const el = anchorRef?.current;
3516
- if (!el) return;
3517
- const r = el.getBoundingClientRect();
3518
- const vw = window.innerWidth;
3519
- const vh = window.innerHeight;
3520
- const w = Math.min(width, vw - MARGIN * 2);
3521
- const below = vh - r.bottom - GAP - MARGIN;
3522
- const above = r.top - GAP - MARGIN;
3523
- const up = placement === "above" || placement === "auto" && below < minHeight && above > below;
3524
- const maxHeight = Math.max(minHeight, Math.floor(up ? above : below));
3525
- const left = Math.max(MARGIN, Math.min(r.left, vw - w - MARGIN));
3526
- setPos(up ? { left, bottom: Math.round(vh - r.top + GAP), width: w, maxHeight } : { left, top: Math.round(r.bottom + GAP), width: w, maxHeight });
3527
- };
3528
- place();
3529
- window.addEventListener("resize", place);
3530
- window.addEventListener("scroll", place, true);
3531
- return () => {
3532
- window.removeEventListener("resize", place);
3533
- window.removeEventListener("scroll", place, true);
3534
- };
3535
- }, [open, anchorRef, width, minHeight, placement]);
3536
- useEffect12(() => {
3537
- if (!open) return void 0;
3538
- const onDown = (e) => {
3539
- if (popRef.current?.contains(e.target)) return;
3540
- if (anchorRef?.current?.contains(e.target)) return;
3541
- onClose?.();
3542
- };
3543
- document.addEventListener("pointerdown", onDown);
3544
- return () => document.removeEventListener("pointerdown", onDown);
3545
- }, [open, anchorRef, onClose]);
3546
- const escape = useCallback6(() => onClose?.(), [onClose]);
3547
- useOverlayEscape(open, escape);
3548
- if (!open || !pos || typeof document === "undefined") return null;
3549
- return createPortal3(
3550
- /* @__PURE__ */ jsx21(
3551
- "div",
3552
- {
3553
- ref: popRef,
3554
- className: ["uic-pop", className || ""].filter(Boolean).join(" "),
3555
- style: pos,
3556
- role: "dialog",
3557
- "aria-label": label,
3558
- children
3559
- }
3560
- ),
3561
- document.body
3562
- );
3563
- }
3564
-
3565
2537
  // src/components/CascadeMenu.jsx
3566
- import React13, { Fragment as Fragment9, useCallback as useCallback7, useEffect as useEffect13, useMemo as useMemo3, useRef as useRef10, useState as useState13 } from "react";
3567
- import { jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
3568
- var Tick = () => /* @__PURE__ */ jsx22(Svg, { s: 14, children: /* @__PURE__ */ jsx22("path", { d: "M20 6 9 17l-5-5" }) });
2538
+ import React10, { Fragment as Fragment8, useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo3, useRef as useRef8, useState as useState12 } from "react";
2539
+ import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
2540
+ var Tick = () => /* @__PURE__ */ jsx18(Svg, { s: 14, children: /* @__PURE__ */ jsx18("path", { d: "M20 6 9 17l-5-5" }) });
3569
2541
  var FILTER_PAST = 8;
3570
2542
  var itemsOf = (groups) => groups.flatMap((g) => g.items);
3571
2543
  function CascadeMenu(props) {
@@ -3583,16 +2555,17 @@ function CascadeMenu(props) {
3583
2555
  noOptionsText = "Nothing to choose here.",
3584
2556
  optionsLabel = "Options",
3585
2557
  backLabel = "Back",
2558
+ optionsFooter,
3586
2559
  width = 520,
3587
2560
  stackBelow = 560,
3588
2561
  className,
3589
2562
  value
3590
2563
  } = props;
3591
- const rootRef = useRef10(null);
3592
- const [q, setQ] = useState13("");
3593
- const [activeId, setActiveId] = useState13(null);
3594
- const [stage, setStage] = useState13("items");
3595
- const [stacked, setStacked] = useState13(false);
2564
+ const rootRef = useRef8(null);
2565
+ const [q, setQ] = useState12("");
2566
+ const [activeId, setActiveId] = useState12(null);
2567
+ const [stage, setStage] = useState12("items");
2568
+ const [stacked, setStacked] = useState12(false);
3596
2569
  const visible = useMemo3(() => {
3597
2570
  const needle = q.trim().toLowerCase();
3598
2571
  if (!needle) return groups.filter((g) => g.items.length > 0);
@@ -3602,7 +2575,7 @@ function CascadeMenu(props) {
3602
2575
  const active = flat.find((it) => it.id === activeId) || flat[0] || null;
3603
2576
  const options = useMemo3(() => active && optionsOf ? optionsOf(active) : [], [active, optionsOf]);
3604
2577
  const showFilter = filter === true || filter === "auto" && itemsOf(groups).length > FILTER_PAST;
3605
- useEffect13(() => {
2578
+ useEffect10(() => {
3606
2579
  if (!open) return void 0;
3607
2580
  setQ("");
3608
2581
  setActiveId(value?.item ?? null);
@@ -3621,20 +2594,20 @@ function CascadeMenu(props) {
3621
2594
  anchor?.focus?.({ preventScroll: true });
3622
2595
  };
3623
2596
  }, [open, stackBelow]);
3624
- const focusIn = useCallback7((col, index = 0) => {
2597
+ const focusIn = useCallback6((col, index = 0) => {
3625
2598
  const list = rootRef.current?.querySelectorAll(`.uic-cascade-${col} .uic-pop-item:not(:disabled)`);
3626
2599
  if (!list || !list.length) return false;
3627
2600
  const i = Math.max(0, Math.min(index, list.length - 1));
3628
2601
  list[i].focus({ preventScroll: true });
3629
2602
  return true;
3630
2603
  }, []);
3631
- const enterOptions = useCallback7(() => {
2604
+ const enterOptions = useCallback6(() => {
3632
2605
  if (stacked) {
3633
2606
  setStage("options");
3634
2607
  requestAnimationFrame(() => focusIn("options"));
3635
2608
  } else focusIn("options");
3636
2609
  }, [stacked, focusIn]);
3637
- const onKey2 = (e) => {
2610
+ const onKey = (e) => {
3638
2611
  const el = document.activeElement;
3639
2612
  const col = el?.closest?.(".uic-cascade-col");
3640
2613
  const inItems = col?.classList.contains("uic-cascade-items");
@@ -3668,7 +2641,7 @@ function CascadeMenu(props) {
3668
2641
  };
3669
2642
  const showItems = !stacked || stage === "items";
3670
2643
  const showOptions = !stacked || stage === "options";
3671
- return /* @__PURE__ */ jsx22(
2644
+ return /* @__PURE__ */ jsx18(
3672
2645
  Popover,
3673
2646
  {
3674
2647
  open,
@@ -3678,15 +2651,15 @@ function CascadeMenu(props) {
3678
2651
  width: stacked ? 320 : width,
3679
2652
  minHeight: 260,
3680
2653
  className: ["uic-cascade-pop", className || ""].filter(Boolean).join(" "),
3681
- children: /* @__PURE__ */ jsxs19("div", { ref: rootRef, className: "uic-cascade" + (stacked ? " is-stacked" : ""), onKeyDown: onKey2, children: [
3682
- showItems && /* @__PURE__ */ jsxs19("div", { className: "uic-cascade-col uic-cascade-items", children: [
3683
- showFilter ? /* @__PURE__ */ jsx22(SearchField, { className: "uic-cascade-filter", value: q, onChange: setQ, placeholder: filterPlaceholder }) : null,
3684
- /* @__PURE__ */ jsxs19("div", { className: "uic-pop-list", children: [
3685
- visible.map((g, gi) => /* @__PURE__ */ jsxs19(Fragment9, { children: [
3686
- g.label ? /* @__PURE__ */ jsx22("div", { className: "uic-cascade-group", children: g.label }) : null,
2654
+ children: /* @__PURE__ */ jsxs16("div", { ref: rootRef, className: "uic-cascade" + (stacked ? " is-stacked" : ""), onKeyDown: onKey, children: [
2655
+ showItems && /* @__PURE__ */ jsxs16("div", { className: "uic-cascade-col uic-cascade-items", children: [
2656
+ showFilter ? /* @__PURE__ */ jsx18(SearchField, { className: "uic-cascade-filter", value: q, onChange: setQ, placeholder: filterPlaceholder }) : null,
2657
+ /* @__PURE__ */ jsxs16("div", { className: "uic-pop-list", children: [
2658
+ visible.map((g, gi) => /* @__PURE__ */ jsxs16(Fragment8, { children: [
2659
+ g.label ? /* @__PURE__ */ jsx18("div", { className: "uic-cascade-group", children: g.label }) : null,
3687
2660
  g.items.map((it) => {
3688
2661
  const on = active?.id === it.id;
3689
- return /* @__PURE__ */ jsxs19(
2662
+ return /* @__PURE__ */ jsxs16(
3690
2663
  "button",
3691
2664
  {
3692
2665
  type: "button",
@@ -3699,22 +2672,22 @@ function CascadeMenu(props) {
3699
2672
  enterOptions();
3700
2673
  },
3701
2674
  children: [
3702
- it.icon ? /* @__PURE__ */ jsx22("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: it.icon }) : null,
3703
- /* @__PURE__ */ jsx22("span", { className: "uic-chip-t", children: it.label }),
3704
- it.note ? /* @__PURE__ */ jsx22("span", { className: "uic-cascade-note", children: it.note }) : null,
3705
- /* @__PURE__ */ jsx22("span", { className: "uic-cascade-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx22(Chevron, { dir: "right", size: 14 }) })
2675
+ it.icon ? /* @__PURE__ */ jsx18("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: it.icon }) : null,
2676
+ /* @__PURE__ */ jsx18("span", { className: "uic-chip-t", children: it.label }),
2677
+ it.note ? /* @__PURE__ */ jsx18("span", { className: "uic-cascade-note", children: it.note }) : null,
2678
+ /* @__PURE__ */ jsx18("span", { className: "uic-cascade-chev", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(Chevron, { dir: "right", size: 14 }) })
3706
2679
  ]
3707
2680
  },
3708
2681
  it.id
3709
2682
  );
3710
2683
  })
3711
2684
  ] }, g.label || gi)),
3712
- flat.length === 0 ? /* @__PURE__ */ jsx22("div", { className: "uic-pop-note", children: emptyText }) : null
2685
+ flat.length === 0 ? /* @__PURE__ */ jsx18("div", { className: "uic-pop-note", children: emptyText }) : null
3713
2686
  ] })
3714
2687
  ] }),
3715
- showOptions && /* @__PURE__ */ jsxs19("div", { className: "uic-cascade-col uic-cascade-options", role: "group", "aria-label": optionsLabel, children: [
3716
- /* @__PURE__ */ jsxs19("div", { className: "uic-cascade-head", children: [
3717
- stacked ? /* @__PURE__ */ jsx22(
2688
+ showOptions && /* @__PURE__ */ jsxs16("div", { className: "uic-cascade-col uic-cascade-options", role: "group", "aria-label": optionsLabel, children: [
2689
+ /* @__PURE__ */ jsxs16("div", { className: "uic-cascade-head", children: [
2690
+ stacked ? /* @__PURE__ */ jsx18(
3718
2691
  "button",
3719
2692
  {
3720
2693
  type: "button",
@@ -3724,115 +2697,52 @@ function CascadeMenu(props) {
3724
2697
  setStage("items");
3725
2698
  requestAnimationFrame(() => focusIn("items", flat.indexOf(active)));
3726
2699
  },
3727
- children: /* @__PURE__ */ jsx22(Chevron, { dir: "left", size: 14 })
2700
+ children: /* @__PURE__ */ jsx18(Chevron, { dir: "left", size: 14 })
3728
2701
  }
3729
2702
  ) : null,
3730
- active?.icon ? /* @__PURE__ */ jsx22("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: active.icon }) : null,
3731
- /* @__PURE__ */ jsx22("span", { className: "uic-chip-t", children: active ? active.label : "" })
2703
+ active?.icon ? /* @__PURE__ */ jsx18("span", { className: "uic-cascade-ic", "aria-hidden": "true", children: active.icon }) : null,
2704
+ /* @__PURE__ */ jsx18("span", { className: "uic-chip-t", children: active ? active.label : "" })
3732
2705
  ] }),
3733
- /* @__PURE__ */ jsxs19("div", { className: "uic-pop-list", children: [
2706
+ /* @__PURE__ */ jsxs16("div", { className: "uic-pop-list", children: [
3734
2707
  options.map((o) => {
3735
2708
  const on = !!value && active?.id === value.item && o.id === value.option;
3736
- return /* @__PURE__ */ jsxs19(
2709
+ return /* @__PURE__ */ jsxs16(
3737
2710
  "button",
3738
2711
  {
3739
2712
  type: "button",
3740
- className: "uic-pop-item uic-cascade-opt" + (on ? " is-on" : ""),
2713
+ className: "uic-pop-item uic-cascade-opt" + (on ? " is-on" : "") + (o.badge ? " has-badge" : ""),
3741
2714
  "aria-current": on ? "true" : void 0,
3742
2715
  disabled: !!o.disabled,
3743
2716
  onClick: () => onPick?.(active, o),
3744
2717
  children: [
3745
- value ? /* @__PURE__ */ jsx22("span", { className: "uic-pop-check", "aria-hidden": "true", children: on ? /* @__PURE__ */ jsx22(Tick, {}) : null }) : null,
3746
- /* @__PURE__ */ jsx22("span", { className: "uic-chip-t", children: o.label }),
3747
- o.note ? /* @__PURE__ */ jsx22("span", { className: "uic-cascade-note", children: o.note }) : null
2718
+ value ? /* @__PURE__ */ jsx18("span", { className: "uic-pop-check", "aria-hidden": "true", children: on ? /* @__PURE__ */ jsx18(Tick, {}) : null }) : null,
2719
+ /* @__PURE__ */ jsx18("span", { className: "uic-chip-t", children: o.label }),
2720
+ o.note ? /* @__PURE__ */ jsx18("span", { className: "uic-cascade-note", children: o.note }) : null,
2721
+ o.badge || null
3748
2722
  ]
3749
2723
  },
3750
2724
  o.id
3751
2725
  );
3752
2726
  }),
3753
- active && options.length === 0 ? /* @__PURE__ */ jsx22("div", { className: "uic-pop-note", children: noOptionsText }) : null
3754
- ] })
2727
+ active && options.length === 0 ? /* @__PURE__ */ jsx18("div", { className: "uic-pop-note", children: noOptionsText }) : null
2728
+ ] }),
2729
+ optionsFooter || null
3755
2730
  ] })
3756
2731
  ] })
3757
2732
  }
3758
2733
  );
3759
2734
  }
3760
2735
 
3761
- // src/components/Modal.jsx
3762
- import React14, { useCallback as useCallback8, useEffect as useEffect14, useId as useId3 } from "react";
3763
- import { createPortal as createPortal4 } from "react-dom";
3764
- import { jsx as jsx23, jsxs as jsxs20 } from "react/jsx-runtime";
3765
- function Modal(props) {
3766
- const {
3767
- open,
3768
- onClose,
3769
- title,
3770
- description,
3771
- actions,
3772
- size = "md",
3773
- width,
3774
- labelledBy,
3775
- children,
3776
- classNames = {}
3777
- } = props;
3778
- const titleId = useId3();
3779
- const escape = useCallback8(() => onClose?.(), [onClose]);
3780
- useOverlayEscape(open, escape);
3781
- useEffect14(() => {
3782
- if (!open || typeof document === "undefined") return void 0;
3783
- const prev = document.body.style.overflow;
3784
- document.body.style.overflow = "hidden";
3785
- return () => {
3786
- document.body.style.overflow = prev;
3787
- };
3788
- }, [open]);
3789
- if (!open || typeof document === "undefined") return null;
3790
- const onBackdrop = (e) => {
3791
- if (e.target === e.currentTarget) onClose?.();
3792
- };
3793
- return createPortal4(
3794
- /* @__PURE__ */ jsx23(
3795
- "div",
3796
- {
3797
- className: ["uic-modal-backdrop", classNames.backdrop || ""].filter(Boolean).join(" "),
3798
- onMouseDown: onBackdrop,
3799
- children: /* @__PURE__ */ jsxs20(
3800
- "div",
3801
- {
3802
- className: ["uic-modal", `is-${size}`, classNames.root || ""].filter(Boolean).join(" "),
3803
- style: width ? { width } : void 0,
3804
- role: "dialog",
3805
- "aria-modal": "true",
3806
- "aria-labelledby": labelledBy || (title ? titleId : void 0),
3807
- children: [
3808
- title || actions ? /* @__PURE__ */ jsxs20("div", { className: "uic-modal-h", children: [
3809
- /* @__PURE__ */ jsxs20("div", { className: "uic-modal-title", children: [
3810
- title ? /* @__PURE__ */ jsx23("h3", { id: titleId, children: title }) : null,
3811
- description ? /* @__PURE__ */ jsx23("p", { children: description }) : null
3812
- ] }),
3813
- actions,
3814
- /* @__PURE__ */ jsx23("button", { type: "button", className: "uic-modal-x", "aria-label": "Close", onClick: onClose, children: /* @__PURE__ */ jsx23(IcX, { size: 18 }) })
3815
- ] }) : null,
3816
- /* @__PURE__ */ jsx23("div", { className: ["uic-modal-b", classNames.body || ""].filter(Boolean).join(" "), children })
3817
- ]
3818
- }
3819
- )
3820
- }
3821
- ),
3822
- document.body
3823
- );
3824
- }
3825
-
3826
2736
  // src/hooks/useTypewriter.js
3827
- import { useEffect as useEffect15, useRef as useRef11, useState as useState14 } from "react";
2737
+ import { useEffect as useEffect11, useRef as useRef9, useState as useState13 } from "react";
3828
2738
  var CHAR_MS = 26;
3829
2739
  var HOLD_MS = 2600;
3830
2740
  function useTypewriter(phrases, { active = true } = {}) {
3831
2741
  const list = phrases && phrases.length ? phrases : [""];
3832
- const [text, setText] = useState14(list[0]);
3833
- const listRef = useRef11(list);
2742
+ const [text, setText] = useState13(list[0]);
2743
+ const listRef = useRef9(list);
3834
2744
  listRef.current = list;
3835
- useEffect15(() => {
2745
+ useEffect11(() => {
3836
2746
  if (!active) return void 0;
3837
2747
  if (typeof window === "undefined") return void 0;
3838
2748
  if (window.matchMedia?.("(prefers-reduced-motion: reduce)")?.matches) {
@@ -3863,7 +2773,7 @@ function useTypewriter(phrases, { active = true } = {}) {
3863
2773
  }
3864
2774
 
3865
2775
  // src/components/Panel.jsx
3866
- import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
2776
+ import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
3867
2777
  function Panel(props) {
3868
2778
  const {
3869
2779
  title,
@@ -3885,43 +2795,43 @@ function Panel(props) {
3885
2795
  classNames = {},
3886
2796
  children
3887
2797
  } = props;
3888
- const body = loading ? /* @__PURE__ */ jsxs21("div", { className: "uic-panel-load", children: [
3889
- /* @__PURE__ */ jsx24("span", { className: "uic-panel-load-bar" }),
3890
- /* @__PURE__ */ jsx24("span", { className: "uic-panel-load-bar" }),
3891
- /* @__PURE__ */ jsx24("span", { className: "uic-panel-load-bar" }),
3892
- /* @__PURE__ */ jsx24("span", { className: "uic-sr", children: loadingLabel })
3893
- ] }) : error ? /* @__PURE__ */ jsxs21("div", { className: "uic-panel-fail", children: [
3894
- /* @__PURE__ */ jsx24("p", { className: "uic-panel-fail-t", children: errorTitle }),
3895
- /* @__PURE__ */ jsx24("pre", { className: "uic-panel-fail-m", children: error }),
3896
- errorDetail ? /* @__PURE__ */ jsxs21("details", { className: "uic-panel-fail-d", children: [
3897
- /* @__PURE__ */ jsx24("summary", { children: detailLabel }),
3898
- /* @__PURE__ */ jsx24("div", { className: "uic-panel-fail-dd", children: errorDetail })
2798
+ const body = loading ? /* @__PURE__ */ jsxs17("div", { className: "uic-panel-load", children: [
2799
+ /* @__PURE__ */ jsx19("span", { className: "uic-panel-load-bar" }),
2800
+ /* @__PURE__ */ jsx19("span", { className: "uic-panel-load-bar" }),
2801
+ /* @__PURE__ */ jsx19("span", { className: "uic-panel-load-bar" }),
2802
+ /* @__PURE__ */ jsx19("span", { className: "uic-sr", children: loadingLabel })
2803
+ ] }) : error ? /* @__PURE__ */ jsxs17("div", { className: "uic-panel-fail", children: [
2804
+ /* @__PURE__ */ jsx19("p", { className: "uic-panel-fail-t", children: errorTitle }),
2805
+ /* @__PURE__ */ jsx19("pre", { className: "uic-panel-fail-m", children: error }),
2806
+ errorDetail ? /* @__PURE__ */ jsxs17("details", { className: "uic-panel-fail-d", children: [
2807
+ /* @__PURE__ */ jsx19("summary", { children: detailLabel }),
2808
+ /* @__PURE__ */ jsx19("div", { className: "uic-panel-fail-dd", children: errorDetail })
3899
2809
  ] }) : null,
3900
- onRetry ? /* @__PURE__ */ jsx24("div", { className: "uic-panel-fail-act", children: /* @__PURE__ */ jsx24(Button, { size: "sm", onClick: onRetry, children: retryLabel }) }) : null
2810
+ onRetry ? /* @__PURE__ */ jsx19("div", { className: "uic-panel-fail-act", children: /* @__PURE__ */ jsx19(Button, { size: "sm", onClick: onRetry, children: retryLabel }) }) : null
3901
2811
  ] }) : children;
3902
- return /* @__PURE__ */ jsxs21(
2812
+ return /* @__PURE__ */ jsxs17(
3903
2813
  "section",
3904
2814
  {
3905
2815
  className: ["uic-panel", className, classNames.root || ""].filter(Boolean).join(" "),
3906
2816
  "aria-busy": loading || busy || void 0,
3907
2817
  children: [
3908
- /* @__PURE__ */ jsxs21("header", { className: ["uic-panel-head", classNames.head || ""].filter(Boolean).join(" "), children: [
3909
- /* @__PURE__ */ jsxs21("div", { className: "uic-panel-titles", children: [
3910
- title ? /* @__PURE__ */ jsx24(Heading, { className: "uic-panel-title", children: title }) : null,
3911
- meta ? /* @__PURE__ */ jsx24("p", { className: "uic-panel-meta", children: meta }) : null
2818
+ /* @__PURE__ */ jsxs17("header", { className: ["uic-panel-head", classNames.head || ""].filter(Boolean).join(" "), children: [
2819
+ /* @__PURE__ */ jsxs17("div", { className: "uic-panel-titles", children: [
2820
+ title ? /* @__PURE__ */ jsx19(Heading, { className: "uic-panel-title", children: title }) : null,
2821
+ meta ? /* @__PURE__ */ jsx19("p", { className: "uic-panel-meta", children: meta }) : null
3912
2822
  ] }),
3913
- actions ? /* @__PURE__ */ jsx24("div", { className: "uic-panel-acts", children: actions }) : null
2823
+ actions ? /* @__PURE__ */ jsx19("div", { className: "uic-panel-acts", children: actions }) : null
3914
2824
  ] }),
3915
- busy ? /* @__PURE__ */ jsx24("div", { className: "uic-panel-busy", role: "status", "aria-label": busyLabel }) : null,
3916
- /* @__PURE__ */ jsx24("div", { className: ["uic-panel-body", classNames.body || ""].filter(Boolean).join(" "), children: body }),
3917
- footer ? /* @__PURE__ */ jsx24("footer", { className: "uic-panel-foot", children: footer }) : null
2825
+ busy ? /* @__PURE__ */ jsx19("div", { className: "uic-panel-busy", role: "status", "aria-label": busyLabel }) : null,
2826
+ /* @__PURE__ */ jsx19("div", { className: ["uic-panel-body", classNames.body || ""].filter(Boolean).join(" "), children: body }),
2827
+ footer ? /* @__PURE__ */ jsx19("footer", { className: "uic-panel-foot", children: footer }) : null
3918
2828
  ]
3919
2829
  }
3920
2830
  );
3921
2831
  }
3922
2832
 
3923
2833
  // src/grid/PanelGrid.jsx
3924
- import React15, { useCallback as useCallback9, useEffect as useEffect16, useLayoutEffect as useLayoutEffect2, useMemo as useMemo4, useRef as useRef12, useState as useState15 } from "react";
2834
+ import React11, { useCallback as useCallback7, useEffect as useEffect12, useLayoutEffect, useMemo as useMemo4, useRef as useRef10, useState as useState14 } from "react";
3925
2835
 
3926
2836
  // src/grid/layout.js
3927
2837
  function sortLayout(layout2) {
@@ -3994,11 +2904,11 @@ function sameLayout(a, b) {
3994
2904
  }
3995
2905
 
3996
2906
  // src/grid/PanelGrid.jsx
3997
- import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
2907
+ import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
3998
2908
  function useMeasuredWidth() {
3999
- const ref = useRef12(null);
4000
- const [width, setWidth] = useState15(0);
4001
- useLayoutEffect2(() => {
2909
+ const ref = useRef10(null);
2910
+ const [width, setWidth] = useState14(0);
2911
+ useLayoutEffect(() => {
4002
2912
  const el = ref.current;
4003
2913
  if (!el) return void 0;
4004
2914
  const measure = () => setWidth(el.clientWidth);
@@ -4025,9 +2935,9 @@ function PanelGrid(props) {
4025
2935
  className = ""
4026
2936
  } = props;
4027
2937
  const [wrapRef, width] = useMeasuredWidth();
4028
- const [drag, setDrag] = useState15(null);
4029
- const dragRef = useRef12(null);
4030
- const swallowClick = useRef12(false);
2938
+ const [drag, setDrag] = useState14(null);
2939
+ const dragRef = useRef10(null);
2940
+ const swallowClick = useRef10(false);
4031
2941
  const stacked = width > 0 && width < stackAt;
4032
2942
  const arrangeable = editable && !stacked;
4033
2943
  const live = drag ? drag.preview : layout2;
@@ -4035,7 +2945,7 @@ function PanelGrid(props) {
4035
2945
  const cellW = colW + gap;
4036
2946
  const cellH = rowHeight + gap;
4037
2947
  const rowsToPx = (h) => h * rowHeight + (h - 1) * gap;
4038
- const stack2 = useMemo4(() => {
2948
+ const stack = useMemo4(() => {
4039
2949
  if (!stacked) return null;
4040
2950
  const tops = /* @__PURE__ */ new Map();
4041
2951
  let y = 0;
@@ -4046,12 +2956,12 @@ function PanelGrid(props) {
4046
2956
  return { tops, height: Math.max(0, y - gap) };
4047
2957
  }, [stacked, live, rowHeight, gap]);
4048
2958
  const rows = layoutRows(live);
4049
- const height = stacked ? stack2.height : rows ? rowsToPx(rows) : 0;
4050
- const commit = useCallback9((next) => {
2959
+ const height = stacked ? stack.height : rows ? rowsToPx(rows) : 0;
2960
+ const commit = useCallback7((next) => {
4051
2961
  if (onLayoutChange && !sameLayout(next, layout2)) onLayoutChange(next);
4052
2962
  }, [onLayoutChange, layout2]);
4053
- const detach = useRef12(null);
4054
- useEffect16(() => () => detach.current?.(), []);
2963
+ const detach = useRef10(null);
2964
+ useEffect12(() => () => detach.current?.(), []);
4055
2965
  const start = (id, mode) => (e) => {
4056
2966
  if (!arrangeable || e.button !== 0) return;
4057
2967
  const item = layout2.find((it) => it.i === id);
@@ -4082,7 +2992,7 @@ function PanelGrid(props) {
4082
2992
  if (d && commitIt) commit(d.preview);
4083
2993
  };
4084
2994
  const onUp = end(true);
4085
- const onKey2 = (ev) => {
2995
+ const onKey = (ev) => {
4086
2996
  if (ev.key === "Escape") end(false)();
4087
2997
  };
4088
2998
  function off() {
@@ -4090,13 +3000,13 @@ function PanelGrid(props) {
4090
3000
  window.removeEventListener("pointermove", onMove);
4091
3001
  window.removeEventListener("pointerup", onUp);
4092
3002
  window.removeEventListener("pointercancel", onUp);
4093
- window.removeEventListener("keydown", onKey2);
3003
+ window.removeEventListener("keydown", onKey);
4094
3004
  }
4095
3005
  detach.current = off;
4096
3006
  window.addEventListener("pointermove", onMove);
4097
3007
  window.addEventListener("pointerup", onUp);
4098
3008
  window.addEventListener("pointercancel", onUp);
4099
- window.addEventListener("keydown", onKey2);
3009
+ window.addEventListener("keydown", onKey);
4100
3010
  };
4101
3011
  const onClickCapture = (e) => {
4102
3012
  if (!swallowClick.current) return;
@@ -4112,11 +3022,11 @@ function PanelGrid(props) {
4112
3022
  e.preventDefault();
4113
3023
  commit(e.shiftKey ? nudgeItem(layout2, id, step[0], step[1], cols) : resizeItem(layout2, id, item.w + step[0], item.h + step[1], cols));
4114
3024
  };
4115
- const boxOf = (it) => stacked ? { left: 0, top: stack2.tops.get(it.i), width, height: rowsToPx(it.h || 1) } : { left: it.x * cellW, top: it.y * cellH, width: it.w * colW + (it.w - 1) * gap, height: rowsToPx(it.h) };
3025
+ const boxOf = (it) => stacked ? { left: 0, top: stack.tops.get(it.i), width, height: rowsToPx(it.h || 1) } : { left: it.x * cellW, top: it.y * cellH, width: it.w * colW + (it.w - 1) * gap, height: rowsToPx(it.h) };
4116
3026
  const byId = new Map(live.map((it) => [it.i, it]));
4117
3027
  const ghost = drag && drag.mode === "move" && byId.has(drag.id) ? boxOf(byId.get(drag.id)) : null;
4118
3028
  const cls = ["uic-pg", arrangeable ? "is-editable" : "", stacked ? "is-stacked" : "", className].filter(Boolean).join(" ");
4119
- return /* @__PURE__ */ jsxs22(
3029
+ return /* @__PURE__ */ jsxs18(
4120
3030
  "div",
4121
3031
  {
4122
3032
  ref: wrapRef,
@@ -4127,15 +3037,15 @@ function PanelGrid(props) {
4127
3037
  swallowClick.current = false;
4128
3038
  },
4129
3039
  children: [
4130
- ghost ? /* @__PURE__ */ jsx25("div", { className: "uic-pg-ghost", "aria-hidden": "true", style: ghost }) : null,
4131
- width > 0 && React15.Children.map(children, (child) => {
4132
- if (!React15.isValidElement(child) || child.key == null) return null;
3040
+ ghost ? /* @__PURE__ */ jsx20("div", { className: "uic-pg-ghost", "aria-hidden": "true", style: ghost }) : null,
3041
+ width > 0 && React11.Children.map(children, (child) => {
3042
+ if (!React11.isValidElement(child) || child.key == null) return null;
4133
3043
  const id = String(child.key).replace(/^\.\$/, "");
4134
3044
  const it = byId.get(id);
4135
3045
  if (!it) return null;
4136
3046
  const moving = drag && drag.id === id;
4137
3047
  const offset = moving && drag.mode === "move" ? { transform: `translate(${drag.dx}px, ${drag.dy}px)` } : null;
4138
- return /* @__PURE__ */ jsxs22(
3048
+ return /* @__PURE__ */ jsxs18(
4139
3049
  "div",
4140
3050
  {
4141
3051
  className: "uic-pg-item" + (moving ? " is-moving" : ""),
@@ -4143,7 +3053,7 @@ function PanelGrid(props) {
4143
3053
  onPointerDown: arrangeable ? start(id, "move") : void 0,
4144
3054
  children: [
4145
3055
  child,
4146
- arrangeable && !it.static ? /* @__PURE__ */ jsx25(
3056
+ arrangeable && !it.static ? /* @__PURE__ */ jsx20(
4147
3057
  "button",
4148
3058
  {
4149
3059
  type: "button",
@@ -4151,7 +3061,7 @@ function PanelGrid(props) {
4151
3061
  "aria-label": resizeLabel ? resizeLabel(id) : "Resize panel. Arrow keys resize it; shift with arrow keys moves it past its neighbours.",
4152
3062
  onPointerDown: start(id, "resize"),
4153
3063
  onKeyDown: onHandleKey(id),
4154
- children: /* @__PURE__ */ jsx25("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ jsx25("path", { d: "M9 1v8H1", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) })
3064
+ children: /* @__PURE__ */ jsx20("svg", { width: "10", height: "10", viewBox: "0 0 10 10", "aria-hidden": "true", children: /* @__PURE__ */ jsx20("path", { d: "M9 1v8H1", fill: "none", stroke: "currentColor", strokeWidth: "1.4", strokeLinecap: "round" }) })
4155
3065
  }
4156
3066
  ) : null
4157
3067
  ]
@@ -4168,8 +3078,8 @@ function packLayout(layout2, cols = 12) {
4168
3078
  }
4169
3079
 
4170
3080
  // src/timeline/Timeline.jsx
4171
- import { useCallback as useCallback10, useEffect as useEffect17, useLayoutEffect as useLayoutEffect3, useMemo as useMemo5, useRef as useRef13, useState as useState16 } from "react";
4172
- import { Fragment as Fragment10, jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
3081
+ import { useCallback as useCallback8, useEffect as useEffect13, useLayoutEffect as useLayoutEffect2, useMemo as useMemo5, useRef as useRef11, useState as useState15 } from "react";
3082
+ import { Fragment as Fragment9, jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
4173
3083
  var TL_MIN_PPS = 4;
4174
3084
  var TL_MAX_PPS = 400;
4175
3085
  var TL_DEFAULT_PPS = 26;
@@ -4258,20 +3168,20 @@ function Timeline({
4258
3168
  emptyLabel = "Nothing here yet.",
4259
3169
  className = ""
4260
3170
  }) {
4261
- const scroller = useRef13(null);
4262
- const innerRef = useRef13(null);
4263
- const [pps, setPps] = useState16(() => {
3171
+ const scroller = useRef11(null);
3172
+ const innerRef = useRef11(null);
3173
+ const [pps, setPps] = useState15(() => {
4264
3174
  if (zoomStorageKey && typeof window !== "undefined") {
4265
3175
  const n = parseFloat(window.localStorage.getItem(zoomStorageKey) || "");
4266
3176
  if (Number.isFinite(n)) return clamp(n, TL_MIN_PPS, TL_MAX_PPS);
4267
3177
  }
4268
3178
  return TL_DEFAULT_PPS;
4269
3179
  });
4270
- const [snapping, setSnapping] = useState16(() => snapStorageKey && typeof window !== "undefined" ? window.localStorage.getItem(snapStorageKey) !== "0" : true);
4271
- const gesture = useRef13(null);
4272
- const [drag, setDrag] = useState16(null);
4273
- const anchor = useRef13(null);
4274
- const [dropAt, setDropAt] = useState16(null);
3180
+ const [snapping, setSnapping] = useState15(() => snapStorageKey && typeof window !== "undefined" ? window.localStorage.getItem(snapStorageKey) !== "0" : true);
3181
+ const gesture = useRef11(null);
3182
+ const [drag, setDrag] = useState15(null);
3183
+ const anchor = useRef11(null);
3184
+ const [dropAt, setDropAt] = useState15(null);
4275
3185
  const rows = useMemo5(
4276
3186
  () => tracks.map((t) => ({
4277
3187
  ...t,
@@ -4293,7 +3203,7 @@ function Timeline({
4293
3203
  }
4294
3204
  return out;
4295
3205
  }, [rows, pps, currentTime]);
4296
- const setZoom = useCallback10((next, clientX) => {
3206
+ const setZoom = useCallback8((next, clientX) => {
4297
3207
  const v = clamp(next, TL_MIN_PPS, TL_MAX_PPS);
4298
3208
  const el = scroller.current;
4299
3209
  if (el) {
@@ -4309,21 +3219,21 @@ function Timeline({
4309
3219
  }
4310
3220
  }
4311
3221
  }, [pps, zoomStorageKey]);
4312
- const fitPps = useCallback10((seconds) => {
3222
+ const fitPps = useCallback8((seconds) => {
4313
3223
  const el = scroller.current;
4314
3224
  if (!el || !(seconds > 0)) return null;
4315
3225
  const room = el.clientWidth - TL_HEAD_W - 56;
4316
3226
  return room > 0 ? clamp(room / seconds, TL_MIN_PPS, TL_MAX_PPS) : null;
4317
3227
  }, []);
4318
- const fit = useCallback10(() => {
3228
+ const fit = useCallback8(() => {
4319
3229
  const v = fitPps(contentSeconds);
4320
3230
  if (v !== null) {
4321
3231
  setPps(v);
4322
3232
  if (scroller.current) scroller.current.scrollLeft = 0;
4323
3233
  }
4324
3234
  }, [fitPps, contentSeconds]);
4325
- const fitted = useRef13(false);
4326
- useLayoutEffect3(() => {
3235
+ const fitted = useRef11(false);
3236
+ useLayoutEffect2(() => {
4327
3237
  if (fitted.current || !(contentSeconds > 0)) return;
4328
3238
  if (zoomStorageKey && typeof window !== "undefined" && window.localStorage.getItem(zoomStorageKey)) {
4329
3239
  fitted.current = true;
@@ -4335,13 +3245,13 @@ function Timeline({
4335
3245
  setPps(v);
4336
3246
  }
4337
3247
  }, [contentSeconds, fitPps, zoomStorageKey]);
4338
- useLayoutEffect3(() => {
3248
+ useLayoutEffect2(() => {
4339
3249
  const a = anchor.current;
4340
3250
  if (!a || !scroller.current) return;
4341
3251
  anchor.current = null;
4342
3252
  scroller.current.scrollLeft = Math.max(0, TL_HEAD_W + a.t * pps - a.vx);
4343
3253
  }, [pps]);
4344
- useEffect17(() => {
3254
+ useEffect13(() => {
4345
3255
  const el = scroller.current;
4346
3256
  if (!el) return void 0;
4347
3257
  const onWheel = (e) => {
@@ -4352,12 +3262,12 @@ function Timeline({
4352
3262
  el.addEventListener("wheel", onWheel, { passive: false });
4353
3263
  return () => el.removeEventListener("wheel", onWheel);
4354
3264
  }, [pps, setZoom]);
4355
- const timeAt = useCallback10((clientX) => {
3265
+ const timeAt = useCallback8((clientX) => {
4356
3266
  const el = innerRef.current;
4357
3267
  if (!el) return 0;
4358
3268
  return Math.max(0, (clientX - el.getBoundingClientRect().left - TL_HEAD_W) / pps);
4359
3269
  }, [pps]);
4360
- const beginGesture = useCallback10((e, spec) => {
3270
+ const beginGesture = useCallback8((e, spec) => {
4361
3271
  e.preventDefault();
4362
3272
  e.stopPropagation();
4363
3273
  gesture.current = { ...spec, startX: e.clientX, active: false, value: null };
@@ -4391,7 +3301,7 @@ function Timeline({
4391
3301
  window.addEventListener("pointermove", move);
4392
3302
  window.addEventListener("pointerup", up);
4393
3303
  }, [timeAt, snapping, snapTimes, pps, onSeek]);
4394
- const onScrub = useCallback10((e) => {
3304
+ const onScrub = useCallback8((e) => {
4395
3305
  if (!onSeek) return;
4396
3306
  onSeek(timeAt(e.clientX));
4397
3307
  beginGesture(e, { kind: "scrub" });
@@ -4408,7 +3318,7 @@ function Timeline({
4408
3318
  }
4409
3319
  return null;
4410
3320
  }, [rows, currentTime, onSplit]);
4411
- const doSplit = useCallback10(() => {
3321
+ const doSplit = useCallback8(() => {
4412
3322
  if (!splitTarget) return;
4413
3323
  onSplit(splitTarget.l.clip, currentTime - splitTarget.l.t0, splitTarget.track);
4414
3324
  }, [splitTarget, currentTime, onSplit]);
@@ -4418,7 +3328,7 @@ function Timeline({
4418
3328
  }
4419
3329
  return null;
4420
3330
  }, [rows, selectedClipId]);
4421
- const onKeyDown = useCallback10((e) => {
3331
+ const onKeyDown = useCallback8((e) => {
4422
3332
  const tag = e.target?.tagName;
4423
3333
  if (tag === "INPUT" || tag === "TEXTAREA" || e.target?.isContentEditable) return;
4424
3334
  if (e.key === "+" || e.key === "=") {
@@ -4435,7 +3345,7 @@ function Timeline({
4435
3345
  onDeleteClip(selected.l.clip, selected.track);
4436
3346
  }
4437
3347
  }, [pps, setZoom, doSplit, selected, onDeleteClip]);
4438
- const toggleSnap = useCallback10(() => {
3348
+ const toggleSnap = useCallback8(() => {
4439
3349
  setSnapping((v) => {
4440
3350
  const next = !v;
4441
3351
  if (snapStorageKey && typeof window !== "undefined") {
@@ -4452,9 +3362,9 @@ function Timeline({
4452
3362
  const laneW = Math.max(contentSeconds * pps + 140, 320);
4453
3363
  const ticks = [];
4454
3364
  for (let t = 0; t <= contentSeconds + major; t += major) ticks.push(t);
4455
- return /* @__PURE__ */ jsxs23("div", { className: `rui-tl ${className}`, onKeyDown, tabIndex: 0, children: [
4456
- /* @__PURE__ */ jsxs23("div", { className: "rui-tl-bar", children: [
4457
- onSplit && /* @__PURE__ */ jsxs23(
3365
+ return /* @__PURE__ */ jsxs19("div", { className: `rui-tl ${className}`, onKeyDown, tabIndex: 0, children: [
3366
+ /* @__PURE__ */ jsxs19("div", { className: "rui-tl-bar", children: [
3367
+ onSplit && /* @__PURE__ */ jsxs19(
4458
3368
  "button",
4459
3369
  {
4460
3370
  type: "button",
@@ -4463,7 +3373,7 @@ function Timeline({
4463
3373
  disabled: !splitTarget,
4464
3374
  title: splitTarget ? "Split at the playhead (B)" : "Move the playhead inside a clip to split it",
4465
3375
  children: [
4466
- /* @__PURE__ */ jsxs23(
3376
+ /* @__PURE__ */ jsxs19(
4467
3377
  "svg",
4468
3378
  {
4469
3379
  width: "13",
@@ -4475,19 +3385,19 @@ function Timeline({
4475
3385
  strokeLinecap: "round",
4476
3386
  "aria-hidden": "true",
4477
3387
  children: [
4478
- /* @__PURE__ */ jsx26("circle", { cx: "6", cy: "6", r: "3" }),
4479
- /* @__PURE__ */ jsx26("circle", { cx: "6", cy: "18", r: "3" }),
4480
- /* @__PURE__ */ jsx26("line", { x1: "20", y1: "4", x2: "8.12", y2: "15.88" }),
4481
- /* @__PURE__ */ jsx26("line", { x1: "14.47", y1: "14.48", x2: "20", y2: "20" }),
4482
- /* @__PURE__ */ jsx26("line", { x1: "8.12", y1: "8.12", x2: "12", y2: "12" })
3388
+ /* @__PURE__ */ jsx21("circle", { cx: "6", cy: "6", r: "3" }),
3389
+ /* @__PURE__ */ jsx21("circle", { cx: "6", cy: "18", r: "3" }),
3390
+ /* @__PURE__ */ jsx21("line", { x1: "20", y1: "4", x2: "8.12", y2: "15.88" }),
3391
+ /* @__PURE__ */ jsx21("line", { x1: "14.47", y1: "14.48", x2: "20", y2: "20" }),
3392
+ /* @__PURE__ */ jsx21("line", { x1: "8.12", y1: "8.12", x2: "12", y2: "12" })
4483
3393
  ]
4484
3394
  }
4485
3395
  ),
4486
- /* @__PURE__ */ jsx26("span", { children: "Split" })
3396
+ /* @__PURE__ */ jsx21("span", { children: "Split" })
4487
3397
  ]
4488
3398
  }
4489
3399
  ),
4490
- onDeleteClip && /* @__PURE__ */ jsx26(
3400
+ onDeleteClip && /* @__PURE__ */ jsx21(
4491
3401
  "button",
4492
3402
  {
4493
3403
  type: "button",
@@ -4498,7 +3408,7 @@ function Timeline({
4498
3408
  children: "Remove"
4499
3409
  }
4500
3410
  ),
4501
- /* @__PURE__ */ jsx26(
3411
+ /* @__PURE__ */ jsx21(
4502
3412
  "button",
4503
3413
  {
4504
3414
  type: "button",
@@ -4509,9 +3419,9 @@ function Timeline({
4509
3419
  children: "Snap"
4510
3420
  }
4511
3421
  ),
4512
- /* @__PURE__ */ jsx26("span", { className: "rui-tl-time", "aria-label": "Playhead position", children: exactLabel(currentTime) }),
4513
- /* @__PURE__ */ jsx26("span", { className: "rui-tl-spacer" }),
4514
- /* @__PURE__ */ jsx26(
3422
+ /* @__PURE__ */ jsx21("span", { className: "rui-tl-time", "aria-label": "Playhead position", children: exactLabel(currentTime) }),
3423
+ /* @__PURE__ */ jsx21("span", { className: "rui-tl-spacer" }),
3424
+ /* @__PURE__ */ jsx21(
4515
3425
  "button",
4516
3426
  {
4517
3427
  type: "button",
@@ -4523,7 +3433,7 @@ function Timeline({
4523
3433
  children: "\u2212"
4524
3434
  }
4525
3435
  ),
4526
- /* @__PURE__ */ jsx26(
3436
+ /* @__PURE__ */ jsx21(
4527
3437
  "button",
4528
3438
  {
4529
3439
  type: "button",
@@ -4535,7 +3445,7 @@ function Timeline({
4535
3445
  children: "+"
4536
3446
  }
4537
3447
  ),
4538
- /* @__PURE__ */ jsx26(
3448
+ /* @__PURE__ */ jsx21(
4539
3449
  "button",
4540
3450
  {
4541
3451
  type: "button",
@@ -4547,10 +3457,10 @@ function Timeline({
4547
3457
  }
4548
3458
  )
4549
3459
  ] }),
4550
- /* @__PURE__ */ jsx26("div", { className: "rui-tl-scroll", ref: scroller, children: /* @__PURE__ */ jsxs23("div", { className: "rui-tl-inner", ref: innerRef, style: { width: TL_HEAD_W + laneW }, children: [
4551
- /* @__PURE__ */ jsxs23("div", { className: "rui-tl-row rui-tl-rulerrow", children: [
4552
- /* @__PURE__ */ jsx26("div", { className: "rui-tl-head rui-tl-rulerhead", "aria-hidden": "true" }),
4553
- /* @__PURE__ */ jsx26(
3460
+ /* @__PURE__ */ jsx21("div", { className: "rui-tl-scroll", ref: scroller, children: /* @__PURE__ */ jsxs19("div", { className: "rui-tl-inner", ref: innerRef, style: { width: TL_HEAD_W + laneW }, children: [
3461
+ /* @__PURE__ */ jsxs19("div", { className: "rui-tl-row rui-tl-rulerrow", children: [
3462
+ /* @__PURE__ */ jsx21("div", { className: "rui-tl-head rui-tl-rulerhead", "aria-hidden": "true" }),
3463
+ /* @__PURE__ */ jsx21(
4554
3464
  "div",
4555
3465
  {
4556
3466
  className: "rui-tl-ruler",
@@ -4579,17 +3489,17 @@ function Timeline({
4579
3489
  onSeek(currentTime + step);
4580
3490
  }
4581
3491
  } : void 0,
4582
- children: ticks.map((t) => /* @__PURE__ */ jsx26("span", { className: "rui-tl-ticklbl", style: { left: t * pps }, children: tickLabel(t, major) }, t))
3492
+ children: ticks.map((t) => /* @__PURE__ */ jsx21("span", { className: "rui-tl-ticklbl", style: { left: t * pps }, children: tickLabel(t, major) }, t))
4583
3493
  }
4584
3494
  )
4585
3495
  ] }),
4586
- rows.length === 0 && /* @__PURE__ */ jsx26("p", { className: "rui-tl-empty", children: emptyLabel }),
4587
- rows.map((track) => /* @__PURE__ */ jsxs23("div", { className: "rui-tl-row", children: [
4588
- /* @__PURE__ */ jsxs23("div", { className: "rui-tl-head", title: track.title || track.label, children: [
3496
+ rows.length === 0 && /* @__PURE__ */ jsx21("p", { className: "rui-tl-empty", children: emptyLabel }),
3497
+ rows.map((track) => /* @__PURE__ */ jsxs19("div", { className: "rui-tl-row", children: [
3498
+ /* @__PURE__ */ jsxs19("div", { className: "rui-tl-head", title: track.title || track.label, children: [
4589
3499
  track.icon,
4590
- /* @__PURE__ */ jsx26("span", { className: "rui-tl-headlbl", children: track.label })
3500
+ /* @__PURE__ */ jsx21("span", { className: "rui-tl-headlbl", children: track.label })
4591
3501
  ] }),
4592
- /* @__PURE__ */ jsxs23(
3502
+ /* @__PURE__ */ jsxs19(
4593
3503
  "div",
4594
3504
  {
4595
3505
  className: "rui-tl-lane" + (dropAt?.trackId === track.id ? " is-dropping" : ""),
@@ -4620,8 +3530,8 @@ function Timeline({
4620
3530
  onDropClip(payload, { trackId: track.id, seconds: t, index });
4621
3531
  } : void 0,
4622
3532
  children: [
4623
- track.laid.length === 0 && track.emptyLabel && /* @__PURE__ */ jsx26("p", { className: "rui-tl-laneempty", children: track.emptyLabel }),
4624
- track.laid.map((l) => /* @__PURE__ */ jsx26(
3533
+ track.laid.length === 0 && track.emptyLabel && /* @__PURE__ */ jsx21("p", { className: "rui-tl-laneempty", children: track.emptyLabel }),
3534
+ track.laid.map((l) => /* @__PURE__ */ jsx21(
4625
3535
  Clip,
4626
3536
  {
4627
3537
  l,
@@ -4637,7 +3547,7 @@ function Timeline({
4637
3547
  },
4638
3548
  l.clip.id ?? l.i
4639
3549
  )),
4640
- dropAt?.trackId === track.id && /* @__PURE__ */ jsx26(
3550
+ dropAt?.trackId === track.id && /* @__PURE__ */ jsx21(
4641
3551
  "span",
4642
3552
  {
4643
3553
  className: "rui-tl-dropmark",
@@ -4645,7 +3555,7 @@ function Timeline({
4645
3555
  "aria-hidden": "true"
4646
3556
  }
4647
3557
  ),
4648
- laneAppend && /* @__PURE__ */ jsx26(
3558
+ laneAppend && /* @__PURE__ */ jsx21(
4649
3559
  "span",
4650
3560
  {
4651
3561
  className: "rui-tl-append",
@@ -4657,9 +3567,9 @@ function Timeline({
4657
3567
  }
4658
3568
  )
4659
3569
  ] }, track.id)),
4660
- onDropClip && newLaneLabel && /* @__PURE__ */ jsxs23("div", { className: "rui-tl-row", children: [
4661
- /* @__PURE__ */ jsx26("div", { className: "rui-tl-head rui-tl-newhead", "aria-hidden": "true" }),
4662
- /* @__PURE__ */ jsx26(
3570
+ onDropClip && newLaneLabel && /* @__PURE__ */ jsxs19("div", { className: "rui-tl-row", children: [
3571
+ /* @__PURE__ */ jsx21("div", { className: "rui-tl-head rui-tl-newhead", "aria-hidden": "true" }),
3572
+ /* @__PURE__ */ jsx21(
4663
3573
  "div",
4664
3574
  {
4665
3575
  className: "rui-tl-newlane" + (dropAt?.trackId === null ? " is-dropping" : ""),
@@ -4681,11 +3591,11 @@ function Timeline({
4681
3591
  e.preventDefault();
4682
3592
  onDropClip(payload, { trackId: null, seconds: timeAt(e.clientX), index: 0 });
4683
3593
  },
4684
- children: /* @__PURE__ */ jsx26("span", { className: "rui-tl-newlbl", children: newLaneLabel })
3594
+ children: /* @__PURE__ */ jsx21("span", { className: "rui-tl-newlbl", children: newLaneLabel })
4685
3595
  }
4686
3596
  )
4687
3597
  ] }),
4688
- drag?.guide != null && /* @__PURE__ */ jsx26(
3598
+ drag?.guide != null && /* @__PURE__ */ jsx21(
4689
3599
  "div",
4690
3600
  {
4691
3601
  className: "rui-tl-guide",
@@ -4693,16 +3603,16 @@ function Timeline({
4693
3603
  "aria-hidden": "true"
4694
3604
  }
4695
3605
  ),
4696
- Number.isFinite(currentTime) && /* @__PURE__ */ jsx26(
3606
+ Number.isFinite(currentTime) && /* @__PURE__ */ jsx21(
4697
3607
  "div",
4698
3608
  {
4699
3609
  className: "rui-tl-playhead",
4700
3610
  style: { left: TL_HEAD_W + currentTime * pps },
4701
3611
  "aria-hidden": "true",
4702
- children: /* @__PURE__ */ jsx26("span", { className: "rui-tl-playhead-grip" })
3612
+ children: /* @__PURE__ */ jsx21("span", { className: "rui-tl-playhead-grip" })
4703
3613
  }
4704
3614
  ),
4705
- drag?.annotation && /* @__PURE__ */ jsx26("div", { className: "rui-tl-annot", style: { left: TL_HEAD_W + (drag.annotAt || 0) * pps }, children: drag.annotation })
3615
+ drag?.annotation && /* @__PURE__ */ jsx21("div", { className: "rui-tl-annot", style: { left: TL_HEAD_W + (drag.annotAt || 0) * pps }, children: drag.annotation })
4706
3616
  ] }) })
4707
3617
  ] });
4708
3618
  }
@@ -4778,7 +3688,7 @@ function Clip({
4778
3688
  click: onSelect
4779
3689
  });
4780
3690
  };
4781
- return /* @__PURE__ */ jsxs23(
3691
+ return /* @__PURE__ */ jsxs19(
4782
3692
  "article",
4783
3693
  {
4784
3694
  className: "rui-tl-clip" + (clip.state ? ` is-${clip.state}` : "") + (known ? "" : " is-unmeasured") + (selected ? " is-selected" : "") + (live ? " is-live" : ""),
@@ -4793,10 +3703,10 @@ function Clip({
4793
3703
  }
4794
3704
  },
4795
3705
  children: [
4796
- clip.poster ? /* @__PURE__ */ jsx26("span", { className: "rui-tl-strip", style: {
3706
+ clip.poster ? /* @__PURE__ */ jsx21("span", { className: "rui-tl-strip", style: {
4797
3707
  backgroundImage: `url("${String(clip.poster).replace(/"/g, '\\"')}")`,
4798
3708
  backgroundSize: `${tileW}px 100%`
4799
- } }) : clip.video ? /* @__PURE__ */ jsx26(
3709
+ } }) : clip.video ? /* @__PURE__ */ jsx21(
4800
3710
  "video",
4801
3711
  {
4802
3712
  className: "rui-tl-frame",
@@ -4807,12 +3717,12 @@ function Clip({
4807
3717
  tabIndex: -1,
4808
3718
  "aria-hidden": "true"
4809
3719
  }
4810
- ) : /* @__PURE__ */ jsx26("span", { className: "rui-tl-blank", "aria-hidden": "true", children: clip.glyph }),
4811
- clip.badge && /* @__PURE__ */ jsx26("span", { className: "rui-tl-badge", children: clip.badge }),
4812
- known && width > 46 && /* @__PURE__ */ jsx26("span", { className: "rui-tl-dur", children: durationLabel(clip.duration) }),
4813
- clip.label && width > 104 && /* @__PURE__ */ jsx26("span", { className: "rui-tl-name", children: clip.label }),
4814
- onTrim && known && /* @__PURE__ */ jsxs23(Fragment10, { children: [
4815
- /* @__PURE__ */ jsx26(
3720
+ ) : /* @__PURE__ */ jsx21("span", { className: "rui-tl-blank", "aria-hidden": "true", children: clip.glyph }),
3721
+ clip.badge && /* @__PURE__ */ jsx21("span", { className: "rui-tl-badge", children: clip.badge }),
3722
+ known && width > 46 && /* @__PURE__ */ jsx21("span", { className: "rui-tl-dur", children: durationLabel(clip.duration) }),
3723
+ clip.label && width > 104 && /* @__PURE__ */ jsx21("span", { className: "rui-tl-name", children: clip.label }),
3724
+ onTrim && known && /* @__PURE__ */ jsxs19(Fragment9, { children: [
3725
+ /* @__PURE__ */ jsx21(
4816
3726
  "span",
4817
3727
  {
4818
3728
  className: "rui-tl-trim l",
@@ -4821,7 +3731,7 @@ function Clip({
4821
3731
  "aria-label": `Trim the start of ${clip.label || "this clip"}`
4822
3732
  }
4823
3733
  ),
4824
- /* @__PURE__ */ jsx26(
3734
+ /* @__PURE__ */ jsx21(
4825
3735
  "span",
4826
3736
  {
4827
3737
  className: "rui-tl-trim r",
@@ -4878,6 +3788,8 @@ export {
4878
3788
  IcTool,
4879
3789
  IcX,
4880
3790
  Input,
3791
+ MentionInput,
3792
+ MentionText,
4881
3793
  Modal,
4882
3794
  PaneResizer,
4883
3795
  Panel,
@@ -4910,7 +3822,6 @@ export {
4910
3822
  createResponsesDispatcher,
4911
3823
  extOf,
4912
3824
  fetchBalance,
4913
- fitRowHeights,
4914
3825
  getSession,
4915
3826
  getToken,
4916
3827
  googleSignIn,