@elevasis/ui 1.0.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 (97) hide show
  1. package/dist/api/index.d.ts +87 -0
  2. package/dist/api/index.js +3 -0
  3. package/dist/auth/context.d.ts +19 -0
  4. package/dist/auth/context.js +1 -0
  5. package/dist/auth/index.d.ts +85 -0
  6. package/dist/auth/index.js +3 -0
  7. package/dist/chunk-3KMDHCAR.js +52 -0
  8. package/dist/chunk-5UWFGBFM.js +129 -0
  9. package/dist/chunk-6BJOYF6E.js +8 -0
  10. package/dist/chunk-6M6OLGQY.js +36 -0
  11. package/dist/chunk-7AI5ZYJ4.js +202 -0
  12. package/dist/chunk-7PLEQFHO.js +18 -0
  13. package/dist/chunk-GDV44UWF.js +138 -0
  14. package/dist/chunk-GEFB5YIR.js +338 -0
  15. package/dist/chunk-HBRMWW6V.js +43 -0
  16. package/dist/chunk-HUWJXLLF.js +681 -0
  17. package/dist/chunk-J3FALDQE.js +176 -0
  18. package/dist/chunk-JKERRYVS.js +109 -0
  19. package/dist/chunk-KA7LO7U5.js +28 -0
  20. package/dist/chunk-LHQTTUL2.js +27 -0
  21. package/dist/chunk-MAAS6CGR.js +1299 -0
  22. package/dist/chunk-NE36BUGQ.js +146 -0
  23. package/dist/chunk-NGXCFBCS.js +398 -0
  24. package/dist/chunk-OEYU5O27.js +235 -0
  25. package/dist/chunk-OUHGHTE7.js +748 -0
  26. package/dist/chunk-OXVOHOP3.js +661 -0
  27. package/dist/chunk-PSLKGOBZ.js +58 -0
  28. package/dist/chunk-PYL4XW6H.js +107 -0
  29. package/dist/chunk-Q47SPRY7.js +1 -0
  30. package/dist/chunk-Q7DJKLEN.js +18 -0
  31. package/dist/chunk-RJCA5672.js +1664 -0
  32. package/dist/chunk-S66I2PYB.js +748 -0
  33. package/dist/chunk-W7ZBF5AA.js +1 -0
  34. package/dist/chunk-WNWKOCGJ.js +1067 -0
  35. package/dist/chunk-XCYKC6OZ.js +1 -0
  36. package/dist/chunk-YULUKCS6.js +56 -0
  37. package/dist/chunk-YZ6GTZXL.js +48 -0
  38. package/dist/chunk-ZGHDPDTF.js +379 -0
  39. package/dist/components/command-queue/index.css +53 -0
  40. package/dist/components/command-queue/index.d.ts +204 -0
  41. package/dist/components/command-queue/index.js +10 -0
  42. package/dist/components/forms/index.d.ts +56 -0
  43. package/dist/components/forms/index.js +2 -0
  44. package/dist/components/index.css +443 -0
  45. package/dist/components/index.d.ts +1354 -0
  46. package/dist/components/index.js +18 -0
  47. package/dist/components/monitoring/index.d.ts +66 -0
  48. package/dist/components/monitoring/index.js +2 -0
  49. package/dist/components/navigation/index.d.ts +54 -0
  50. package/dist/components/navigation/index.js +91 -0
  51. package/dist/components/notifications/index.d.ts +52 -0
  52. package/dist/components/notifications/index.js +4 -0
  53. package/dist/components/resource-definition/index.css +388 -0
  54. package/dist/components/resource-definition/index.d.ts +301 -0
  55. package/dist/components/resource-definition/index.js +3 -0
  56. package/dist/display/index.css +53 -0
  57. package/dist/display/index.d.ts +606 -0
  58. package/dist/display/index.js +6 -0
  59. package/dist/execution/index.css +388 -0
  60. package/dist/execution/index.d.ts +1090 -0
  61. package/dist/execution/index.js +4 -0
  62. package/dist/graph/index.css +388 -0
  63. package/dist/graph/index.d.ts +429 -0
  64. package/dist/graph/index.js +1 -0
  65. package/dist/hooks/index.d.ts +1927 -0
  66. package/dist/hooks/index.js +6 -0
  67. package/dist/hooks/published.d.ts +1653 -0
  68. package/dist/hooks/published.js +4 -0
  69. package/dist/index.css +505 -0
  70. package/dist/index.d.ts +7284 -0
  71. package/dist/index.js +31 -0
  72. package/dist/initialization/index.d.ts +2325 -0
  73. package/dist/initialization/index.js +4 -0
  74. package/dist/organization/index.d.ts +225 -0
  75. package/dist/organization/index.js +4 -0
  76. package/dist/profile/index.d.ts +2265 -0
  77. package/dist/profile/index.js +3 -0
  78. package/dist/provider/index.css +61 -0
  79. package/dist/provider/index.d.ts +291 -0
  80. package/dist/provider/index.js +7 -0
  81. package/dist/provider/published.d.ts +198 -0
  82. package/dist/provider/published.js +6 -0
  83. package/dist/router/context.d.ts +19 -0
  84. package/dist/router/context.js +1 -0
  85. package/dist/router/index.d.ts +31 -0
  86. package/dist/router/index.js +2 -0
  87. package/dist/sse/index.d.ts +83 -0
  88. package/dist/sse/index.js +185 -0
  89. package/dist/supabase/index.d.ts +4289 -0
  90. package/dist/supabase/index.js +47 -0
  91. package/dist/typeform/index.d.ts +458 -0
  92. package/dist/typeform/index.js +1976 -0
  93. package/dist/typeform/schemas.d.ts +67 -0
  94. package/dist/typeform/schemas.js +1 -0
  95. package/dist/utils/index.d.ts +177 -0
  96. package/dist/utils/index.js +1 -0
  97. package/package.json +88 -0
@@ -0,0 +1,748 @@
1
+ import { CustomModal } from './chunk-ZGHDPDTF.js';
2
+ import { StyledMarkdown } from './chunk-3KMDHCAR.js';
3
+ import { memo, useState, useCallback, cloneElement, useRef, useEffect, useMemo } from 'react';
4
+ import { Stack, Group, Text, Tooltip, ActionIcon, Paper, Textarea, Box, Collapse, Center, Space, Button, Title, TextInput, Alert, Badge, Progress, Loader } from '@mantine/core';
5
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
6
+ import { IconCheck, IconCopy, IconSend, IconChevronDown, IconAlertCircle, IconAlertTriangle } from '@tabler/icons-react';
7
+ import { useClipboard } from '@mantine/hooks';
8
+ import JSONPretty from 'react-json-pretty';
9
+
10
+ var ConfirmationModal = ({
11
+ opened,
12
+ onClose,
13
+ loading,
14
+ icon,
15
+ confirmationHandler,
16
+ style,
17
+ title,
18
+ text,
19
+ buttonText,
20
+ buttonColor,
21
+ centerText
22
+ }) => {
23
+ const styledIcon = cloneElement(icon, {
24
+ size: 55,
25
+ strokeWidth: 1.5
26
+ });
27
+ return /* @__PURE__ */ jsxs(CustomModal, { opened, onClose, loading, style, children: [
28
+ /* @__PURE__ */ jsx(Center, { children: styledIcon }),
29
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
30
+ /* @__PURE__ */ jsx(Center, { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx(Text, { size: "lg", c: "var(--color-text)", children: title }) }),
31
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
32
+ text && /* @__PURE__ */ jsxs(Fragment, { children: [
33
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text-dimmed)", style: { textAlign: centerText ? "center" : "left" }, children: text }),
34
+ /* @__PURE__ */ jsx(Space, { h: 16 })
35
+ ] }),
36
+ /* @__PURE__ */ jsx(Button, { color: buttonColor || "blue", fullWidth: true, onClick: confirmationHandler, loading, children: buttonText || "Confirm" })
37
+ ] });
38
+ };
39
+ var ConfirmationInputModal = ({
40
+ opened,
41
+ onClose,
42
+ loading,
43
+ icon,
44
+ confirmationHandler,
45
+ style,
46
+ title,
47
+ text,
48
+ buttonText,
49
+ buttonColor,
50
+ inputValue,
51
+ onInputChange,
52
+ expectedValue,
53
+ placeholder
54
+ }) => {
55
+ const styledIcon = cloneElement(icon, {
56
+ size: 55,
57
+ strokeWidth: 1.5
58
+ });
59
+ return /* @__PURE__ */ jsxs(CustomModal, { opened, onClose, loading, style, children: [
60
+ /* @__PURE__ */ jsx(Center, { children: styledIcon }),
61
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
62
+ /* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx(Title, { order: 3, children: title }) }),
63
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
64
+ text && /* @__PURE__ */ jsxs(Fragment, { children: [
65
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text-dimmed)", children: text }),
66
+ /* @__PURE__ */ jsx(Space, { h: 8 })
67
+ ] }),
68
+ /* @__PURE__ */ jsx(
69
+ TextInput,
70
+ {
71
+ placeholder: placeholder || "Enter confirmation text",
72
+ value: inputValue,
73
+ onChange: (event) => onInputChange(event.currentTarget.value)
74
+ }
75
+ ),
76
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
77
+ /* @__PURE__ */ jsx(
78
+ Button,
79
+ {
80
+ color: buttonColor || "blue",
81
+ fullWidth: true,
82
+ onClick: confirmationHandler,
83
+ loading,
84
+ disabled: inputValue !== expectedValue,
85
+ children: buttonText || "Confirm"
86
+ }
87
+ )
88
+ ] });
89
+ };
90
+ var jsonTheme = {
91
+ main: "line-height:1.3;color:var(--color-text);background:transparent;overflow:auto;",
92
+ error: "line-height:1.3;color:var(--color-error);background:transparent;overflow:auto;",
93
+ key: "color:var(--color-text-dimmed);",
94
+ string: "color:var(--color-success);",
95
+ value: "color:var(--color-warning);",
96
+ boolean: "color:var(--color-text-dimmed);"
97
+ };
98
+ var ENTRANCE_DURATION = "0.35s";
99
+ var ENTRANCE_EASING = "cubic-bezier(0.16, 1, 0.3, 1)";
100
+ var slideFromLeft = {
101
+ animation: `assistantSlideIn ${ENTRANCE_DURATION} ${ENTRANCE_EASING} both`
102
+ };
103
+ var slideFromRight = {
104
+ animation: `assistantSlideInRight ${ENTRANCE_DURATION} ${ENTRANCE_EASING} both`
105
+ };
106
+ var keyframesInjected = false;
107
+ function ensureKeyframes() {
108
+ if (keyframesInjected || typeof document === "undefined") return;
109
+ keyframesInjected = true;
110
+ const style = document.createElement("style");
111
+ style.textContent = `
112
+ @keyframes assistantSlideIn {
113
+ from { opacity: 0; transform: translateX(-12px); }
114
+ to { opacity: 1; transform: translateX(0); }
115
+ }
116
+ @keyframes assistantSlideInRight {
117
+ from { opacity: 0; transform: translateX(12px); }
118
+ to { opacity: 1; transform: translateX(0); }
119
+ }
120
+ `;
121
+ document.head.appendChild(style);
122
+ }
123
+ var monoMeta = {
124
+ fontFamily: "var(--mantine-font-family-monospace)",
125
+ fontSize: "0.65rem",
126
+ letterSpacing: "0.06em"
127
+ };
128
+ function AgentActivityBubble({
129
+ icon,
130
+ title,
131
+ color,
132
+ collapsible = false,
133
+ expanded = false,
134
+ onToggle,
135
+ children
136
+ }) {
137
+ return /* @__PURE__ */ jsx(Box, { style: { alignSelf: "flex-start", width: "100%", maxWidth: "75%", ...slideFromLeft }, children: /* @__PURE__ */ jsxs(
138
+ Paper,
139
+ {
140
+ p: "xs",
141
+ withBorder: false,
142
+ style: {
143
+ backgroundColor: "var(--color-surface)",
144
+ border: "none",
145
+ boxShadow: "var(--standard-box-shadow)"
146
+ },
147
+ children: [
148
+ /* @__PURE__ */ jsxs(
149
+ Group,
150
+ {
151
+ gap: "xs",
152
+ onClick: collapsible ? onToggle : void 0,
153
+ style: {
154
+ cursor: collapsible ? "pointer" : "default",
155
+ userSelect: collapsible ? "none" : "auto"
156
+ },
157
+ children: [
158
+ /* @__PURE__ */ jsxs(Text, { size: "sm", c: color, ff: "monospace", style: { letterSpacing: "0.04em" }, children: [
159
+ icon,
160
+ " ",
161
+ title
162
+ ] }),
163
+ collapsible && /* @__PURE__ */ jsx(
164
+ IconChevronDown,
165
+ {
166
+ size: 14,
167
+ style: {
168
+ transform: expanded ? "rotate(180deg)" : "none",
169
+ transition: "transform var(--duration-fast)"
170
+ }
171
+ }
172
+ )
173
+ ]
174
+ }
175
+ ),
176
+ collapsible ? /* @__PURE__ */ jsx(Collapse, { in: expanded, children: /* @__PURE__ */ jsx(Box, { mt: "xs", p: "xs", children }) }) : /* @__PURE__ */ jsx(Box, { mt: "xs", p: "xs", children })
177
+ ]
178
+ }
179
+ ) });
180
+ }
181
+ var MessageBubble = memo(function MessageBubble2({ message }) {
182
+ ensureKeyframes();
183
+ const [expanded, setExpanded] = useState(false);
184
+ switch (message.messageType) {
185
+ case "user_message":
186
+ case "assistant_message":
187
+ return /* @__PURE__ */ jsx(TextMessage, { message });
188
+ case "agent:started":
189
+ case "agent:completed":
190
+ return null;
191
+ // Don't render system lifecycle messages
192
+ case "agent:reasoning": {
193
+ const event = message.metadata;
194
+ return /* @__PURE__ */ jsx(
195
+ ReasoningMessage,
196
+ {
197
+ iteration: event.iteration,
198
+ reasoning: event.reasoning,
199
+ expanded,
200
+ onToggle: () => setExpanded(!expanded)
201
+ }
202
+ );
203
+ }
204
+ case "agent:tool_call": {
205
+ const event = message.metadata;
206
+ return /* @__PURE__ */ jsx(
207
+ ToolCallMessage,
208
+ {
209
+ toolName: event.toolName,
210
+ args: event.args,
211
+ expanded,
212
+ onToggle: () => setExpanded(!expanded)
213
+ }
214
+ );
215
+ }
216
+ case "agent:tool_result": {
217
+ const event = message.metadata;
218
+ return /* @__PURE__ */ jsx(
219
+ ToolResultMessage,
220
+ {
221
+ success: event.success,
222
+ result: event.result,
223
+ error: event.error,
224
+ expanded,
225
+ onToggle: () => setExpanded(!expanded)
226
+ }
227
+ );
228
+ }
229
+ case "agent:error": {
230
+ const event = message.metadata;
231
+ return /* @__PURE__ */ jsx(ErrorMessage, { error: event.error, expanded, onToggle: () => setExpanded(!expanded) });
232
+ }
233
+ default:
234
+ return null;
235
+ }
236
+ });
237
+ function TextMessage({ message }) {
238
+ const isUser = message.role === "user";
239
+ const clipboard = useClipboard({ timeout: 2e3 });
240
+ return /* @__PURE__ */ jsxs(
241
+ Stack,
242
+ {
243
+ gap: 4,
244
+ style: {
245
+ alignSelf: isUser ? "flex-end" : "flex-start",
246
+ maxWidth: "75%",
247
+ ...isUser ? slideFromRight : slideFromLeft
248
+ },
249
+ children: [
250
+ /* @__PURE__ */ jsxs(Group, { gap: 6, justify: isUser ? "flex-end" : "flex-start", children: [
251
+ /* @__PURE__ */ jsx(
252
+ Text,
253
+ {
254
+ size: "xs",
255
+ fw: 600,
256
+ c: isUser ? "var(--color-primary)" : "var(--color-text-subtle)",
257
+ tt: "uppercase",
258
+ style: { ...monoMeta, fontWeight: 600 },
259
+ children: isUser ? "USER" : "AGENT"
260
+ }
261
+ ),
262
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", style: monoMeta, children: message.createdAt.toLocaleTimeString() }),
263
+ /* @__PURE__ */ jsx(Tooltip, { label: clipboard.copied ? "Copied!" : "Copy message", position: "top", children: /* @__PURE__ */ jsx(
264
+ ActionIcon,
265
+ {
266
+ size: "xs",
267
+ variant: "subtle",
268
+ color: "gray",
269
+ onClick: () => clipboard.copy(message.text),
270
+ style: { opacity: 0.5, transition: "opacity var(--duration-fast)" },
271
+ onMouseEnter: (e) => e.currentTarget.style.opacity = "1",
272
+ onMouseLeave: (e) => e.currentTarget.style.opacity = "0.5",
273
+ children: clipboard.copied ? /* @__PURE__ */ jsx(IconCheck, { size: 12 }) : /* @__PURE__ */ jsx(IconCopy, { size: 12 })
274
+ }
275
+ ) })
276
+ ] }),
277
+ /* @__PURE__ */ jsx(
278
+ Paper,
279
+ {
280
+ p: "xs",
281
+ c: isUser ? "var(--color-primary-contrast)" : "var(--color-text)",
282
+ style: {
283
+ backgroundColor: isUser ? "var(--color-primary)" : "var(--color-surface)",
284
+ borderLeft: isUser ? "none" : "2px solid color-mix(in srgb, var(--color-primary) 30%, transparent)",
285
+ border: isUser ? "none" : void 0,
286
+ boxShadow: isUser ? "0 2px 8px color-mix(in srgb, var(--color-primary) 30%, transparent)" : "var(--standard-box-shadow)"
287
+ },
288
+ children: isUser ? /* @__PURE__ */ jsx(Text, { size: "sm", style: { lineHeight: 1.55 }, children: message.text }) : /* @__PURE__ */ jsx(
289
+ StyledMarkdown,
290
+ {
291
+ components: {
292
+ p: ({ children }) => /* @__PURE__ */ jsx(Text, { size: "sm", style: { lineHeight: 1.55, margin: "0.25rem 0" }, component: "p", children })
293
+ },
294
+ children: message.text
295
+ }
296
+ )
297
+ }
298
+ )
299
+ ]
300
+ }
301
+ );
302
+ }
303
+ function ReasoningMessage({
304
+ iteration,
305
+ reasoning,
306
+ expanded,
307
+ onToggle
308
+ }) {
309
+ return /* @__PURE__ */ jsx(
310
+ AgentActivityBubble,
311
+ {
312
+ icon: "\u{1F4AD}",
313
+ title: `Reasoning (Iteration ${iteration})`,
314
+ color: "var(--color-primary)",
315
+ collapsible: true,
316
+ expanded,
317
+ onToggle,
318
+ children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text)", style: { whiteSpace: "pre-wrap", lineHeight: 1.6 }, children: reasoning })
319
+ }
320
+ );
321
+ }
322
+ function ToolCallMessage({
323
+ toolName,
324
+ args,
325
+ expanded,
326
+ onToggle
327
+ }) {
328
+ return /* @__PURE__ */ jsx(
329
+ AgentActivityBubble,
330
+ {
331
+ icon: "\u{1F527}",
332
+ title: `Tool: ${toolName}`,
333
+ color: "var(--mantine-color-cyan-6)",
334
+ collapsible: true,
335
+ expanded,
336
+ onToggle,
337
+ children: /* @__PURE__ */ jsx(
338
+ "div",
339
+ {
340
+ style: {
341
+ fontSize: "0.75rem",
342
+ fontFamily: "var(--mantine-font-family-monospace)",
343
+ padding: "0.5rem",
344
+ overflow: "auto",
345
+ background: "var(--color-background)",
346
+ borderRadius: "var(--mantine-radius-sm)"
347
+ },
348
+ children: /* @__PURE__ */ jsx(JSONPretty, { data: args, theme: jsonTheme })
349
+ }
350
+ )
351
+ }
352
+ );
353
+ }
354
+ function ToolResultMessage({
355
+ success,
356
+ result,
357
+ error,
358
+ expanded,
359
+ onToggle
360
+ }) {
361
+ const color = success ? "green" : "orange";
362
+ const icon = success ? "\u2705" : "\u26A0\uFE0F";
363
+ return /* @__PURE__ */ jsx(
364
+ AgentActivityBubble,
365
+ {
366
+ icon,
367
+ title: "Tool Result",
368
+ color: `var(--mantine-color-${color}-6)`,
369
+ collapsible: true,
370
+ expanded,
371
+ onToggle,
372
+ children: success ? /* @__PURE__ */ jsx(
373
+ "div",
374
+ {
375
+ style: {
376
+ fontSize: "0.75rem",
377
+ fontFamily: "var(--mantine-font-family-monospace)",
378
+ padding: "0.5rem",
379
+ overflow: "auto",
380
+ background: "var(--color-background)",
381
+ borderRadius: "var(--mantine-radius-sm)"
382
+ },
383
+ children: /* @__PURE__ */ jsx(JSONPretty, { data: result, theme: jsonTheme })
384
+ }
385
+ ) : /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text)", style: { whiteSpace: "pre-wrap", lineHeight: 1.6 }, children: error })
386
+ }
387
+ );
388
+ }
389
+ function ErrorMessage({ error, expanded, onToggle }) {
390
+ return /* @__PURE__ */ jsx(
391
+ AgentActivityBubble,
392
+ {
393
+ icon: "\u274C",
394
+ title: "Agent Error",
395
+ color: "var(--color-error)",
396
+ collapsible: true,
397
+ expanded,
398
+ onToggle,
399
+ children: /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text)", style: { whiteSpace: "pre-wrap", lineHeight: 1.6 }, children: error })
400
+ }
401
+ );
402
+ }
403
+ var ChatInputArea = memo(function ChatInputArea2({
404
+ input,
405
+ onInputChange,
406
+ onSend,
407
+ isDisabled = false,
408
+ isProcessing = false,
409
+ isConnected = true,
410
+ placeholder = "Message the agent..."
411
+ }) {
412
+ const [focused, setFocused] = useState(false);
413
+ const handleKeyDown = useCallback(
414
+ (e) => {
415
+ if (e.key === "Enter" && !e.shiftKey) {
416
+ e.preventDefault();
417
+ onSend();
418
+ }
419
+ },
420
+ [onSend]
421
+ );
422
+ const canSend = isConnected && !isDisabled && !isProcessing && input.trim();
423
+ return /* @__PURE__ */ jsx(Stack, { gap: 4, pt: 6, children: /* @__PURE__ */ jsxs(
424
+ "div",
425
+ {
426
+ style: {
427
+ display: "flex",
428
+ gap: "10px",
429
+ alignItems: "flex-end",
430
+ background: "var(--color-surface)",
431
+ border: focused ? "1px solid color-mix(in srgb, var(--color-primary) 50%, var(--color-border))" : "1px solid var(--color-border)",
432
+ borderRadius: "14px",
433
+ padding: "6px 6px 6px 16px",
434
+ transition: "border-color 180ms, box-shadow 180ms",
435
+ boxShadow: focused ? "0 0 0 1px color-mix(in srgb, var(--color-primary) 15%, transparent), 0 0 12px color-mix(in srgb, var(--color-primary) 10%, transparent), inset 0 0 8px color-mix(in srgb, var(--color-primary) 4%, transparent)" : "var(--standard-box-shadow)"
436
+ },
437
+ children: [
438
+ /* @__PURE__ */ jsx(
439
+ Textarea,
440
+ {
441
+ placeholder,
442
+ value: input,
443
+ onChange: (e) => onInputChange(e.currentTarget.value),
444
+ onKeyDown: handleKeyDown,
445
+ onFocus: () => setFocused(true),
446
+ onBlur: () => setFocused(false),
447
+ autosize: true,
448
+ minRows: 1,
449
+ maxRows: 6,
450
+ style: { flex: 1 },
451
+ disabled: !isConnected || isProcessing || isDisabled,
452
+ styles: {
453
+ input: {
454
+ border: "none",
455
+ background: "transparent",
456
+ fontSize: "14px",
457
+ padding: "6px 0",
458
+ color: "var(--color-text)",
459
+ "&:focus": {
460
+ outline: "none"
461
+ },
462
+ "&::placeholder": {
463
+ color: "var(--color-text-subtle)",
464
+ fontWeight: 400,
465
+ opacity: 0.6
466
+ }
467
+ }
468
+ }
469
+ }
470
+ ),
471
+ /* @__PURE__ */ jsx(
472
+ "button",
473
+ {
474
+ onClick: onSend,
475
+ disabled: !canSend,
476
+ "aria-label": "Send message",
477
+ style: {
478
+ display: "flex",
479
+ alignItems: "center",
480
+ justifyContent: "center",
481
+ width: 36,
482
+ height: 36,
483
+ flexShrink: 0,
484
+ border: "none",
485
+ borderRadius: "10px",
486
+ cursor: canSend ? "pointer" : "default",
487
+ background: canSend ? "linear-gradient(135deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 80%, black))" : "var(--color-surface-hover)",
488
+ boxShadow: canSend ? "0 2px 8px color-mix(in srgb, var(--color-primary) 35%, transparent), inset 0 1px 0 rgba(255,255,255,0.1)" : "none",
489
+ transition: "all 180ms",
490
+ transform: canSend ? "scale(1)" : "scale(0.92)",
491
+ opacity: canSend ? 1 : 0.35
492
+ },
493
+ children: /* @__PURE__ */ jsx(IconSend, { size: 16, color: "white", style: { marginLeft: -1 } })
494
+ }
495
+ )
496
+ ]
497
+ }
498
+ ) });
499
+ });
500
+ var TEXT = "PROCESSING...";
501
+ var STREAK_DURATION = 1.8;
502
+ var BRIGHT_WIDTH = 3;
503
+ function ProcessingIndicator() {
504
+ const letters = useMemo(
505
+ () => TEXT.split("").map((char, i) => ({
506
+ char,
507
+ delay: i / TEXT.length * STREAK_DURATION
508
+ })),
509
+ []
510
+ );
511
+ return /* @__PURE__ */ jsxs(
512
+ "div",
513
+ {
514
+ style: {
515
+ fontFamily: "monospace",
516
+ fontSize: "var(--mantine-font-size-xs)",
517
+ letterSpacing: "0.06em",
518
+ paddingLeft: "var(--mantine-spacing-xs)",
519
+ paddingRight: "var(--mantine-spacing-xs)",
520
+ display: "inline-flex"
521
+ },
522
+ children: [
523
+ /* @__PURE__ */ jsx("style", { children: `
524
+ @keyframes processing-streak {
525
+ 0%, 100% {
526
+ color: color-mix(in srgb, var(--color-primary) 40%, transparent);
527
+ text-shadow: none;
528
+ }
529
+ ${Math.round(BRIGHT_WIDTH / TEXT.length * 50)}% {
530
+ color: color-mix(in srgb, var(--color-primary) 100%, white);
531
+ text-shadow: 0 0 8px color-mix(in srgb, var(--color-primary) 60%, transparent);
532
+ }
533
+ }
534
+ ` }),
535
+ letters.map((letter, i) => /* @__PURE__ */ jsx(
536
+ "span",
537
+ {
538
+ style: {
539
+ color: "color-mix(in srgb, var(--color-primary) 40%, transparent)",
540
+ animation: `processing-streak ${STREAK_DURATION}s ease-in-out ${letter.delay}s infinite`
541
+ },
542
+ children: letter.char
543
+ },
544
+ i
545
+ ))
546
+ ]
547
+ }
548
+ );
549
+ }
550
+ function MessageAreaContent({
551
+ isConnected,
552
+ isProcessing,
553
+ error,
554
+ messages,
555
+ emptyStateText,
556
+ emptyStateSubtext,
557
+ scrollRef
558
+ }) {
559
+ if (!isConnected) {
560
+ return /* @__PURE__ */ jsx(Center, { style: { flex: 1, width: "100%", marginTop: "auto", marginBottom: "auto" }, children: error ? /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "xs", children: [
561
+ /* @__PURE__ */ jsx(IconAlertTriangle, { size: 40, color: "var(--mantine-color-red-6)" }),
562
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "red", children: error })
563
+ ] }) : /* @__PURE__ */ jsx(Loader, { size: "lg" }) });
564
+ }
565
+ if (messages.length === 0) {
566
+ return /* @__PURE__ */ jsx(Center, { style: { flex: 1, width: "100%", marginTop: "auto", marginBottom: "auto" }, children: /* @__PURE__ */ jsxs(Stack, { align: "center", children: [
567
+ /* @__PURE__ */ jsx(Text, { c: "dimmed", children: emptyStateText }),
568
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: emptyStateSubtext })
569
+ ] }) });
570
+ }
571
+ return /* @__PURE__ */ jsxs(Stack, { pb: 4, pr: "sm", style: { marginTop: "auto" }, children: [
572
+ messages.map((msg) => /* @__PURE__ */ jsx(MessageBubble, { message: msg }, msg.id)),
573
+ isProcessing && /* @__PURE__ */ jsx(ProcessingIndicator, {}),
574
+ /* @__PURE__ */ jsx("div", { ref: scrollRef })
575
+ ] });
576
+ }
577
+ function ChatInterface({
578
+ messages,
579
+ input,
580
+ onInputChange,
581
+ onSendMessage,
582
+ isProcessing = false,
583
+ isConnected = true,
584
+ error,
585
+ onClearError,
586
+ emptyStateText = "No messages yet",
587
+ emptyStateSubtext = "Send a message to start the conversation",
588
+ placeholder = "Message the agent..."
589
+ }) {
590
+ const scrollRef = useRef(null);
591
+ const scrollContainerRef = useRef(null);
592
+ useEffect(() => {
593
+ if (scrollContainerRef.current) {
594
+ scrollContainerRef.current.scrollTop = scrollContainerRef.current.scrollHeight;
595
+ }
596
+ }, [messages.length, isConnected, isProcessing]);
597
+ return /* @__PURE__ */ jsxs(Stack, { gap: 0, style: { height: "100%", overflow: "hidden" }, children: [
598
+ /* @__PURE__ */ jsx(ScrollableContainer, { containerRef: scrollContainerRef, children: /* @__PURE__ */ jsx(
599
+ MessageAreaContent,
600
+ {
601
+ isConnected,
602
+ isProcessing,
603
+ error,
604
+ messages,
605
+ emptyStateText,
606
+ emptyStateSubtext,
607
+ scrollRef
608
+ }
609
+ ) }),
610
+ isConnected && error && onClearError && /* @__PURE__ */ jsx(
611
+ Alert,
612
+ {
613
+ icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }),
614
+ color: "red",
615
+ variant: "light",
616
+ withCloseButton: true,
617
+ onClose: onClearError,
618
+ radius: 0,
619
+ style: { flexShrink: 0 },
620
+ children: error
621
+ }
622
+ ),
623
+ /* @__PURE__ */ jsx(
624
+ ChatInputArea,
625
+ {
626
+ input,
627
+ onInputChange,
628
+ onSend: onSendMessage,
629
+ isProcessing,
630
+ isConnected,
631
+ placeholder
632
+ }
633
+ )
634
+ ] });
635
+ }
636
+ function ScrollableContainer({
637
+ children,
638
+ containerRef
639
+ }) {
640
+ return /* @__PURE__ */ jsx(
641
+ "div",
642
+ {
643
+ ref: containerRef,
644
+ style: {
645
+ flex: 1,
646
+ display: "flex",
647
+ flexDirection: "column",
648
+ overflowY: "auto",
649
+ overflowX: "hidden",
650
+ scrollBehavior: "smooth",
651
+ backgroundColor: "var(--color-background)",
652
+ backgroundImage: [
653
+ "linear-gradient(color-mix(in srgb, var(--color-primary) 5%, transparent) 1px, transparent 1px)",
654
+ "linear-gradient(90deg, color-mix(in srgb, var(--color-primary) 5%, transparent) 1px, transparent 1px)",
655
+ "radial-gradient(ellipse at 50% 50%, color-mix(in srgb, var(--color-primary) 5%, transparent) 0%, transparent 70%)"
656
+ ].join(", "),
657
+ backgroundSize: "40px 40px, 40px 40px, 100% 100%",
658
+ borderRadius: "var(--mantine-radius-sm)",
659
+ padding: "8px",
660
+ // Custom scrollbar styling
661
+ scrollbarWidth: "thin",
662
+ scrollbarColor: "color-mix(in srgb, var(--color-text-subtle) 50%, var(--color-border)) transparent"
663
+ },
664
+ children
665
+ }
666
+ );
667
+ }
668
+ function ChatHeader({
669
+ title,
670
+ status,
671
+ contextUsage,
672
+ sidebarIcon,
673
+ onToggleSidebar,
674
+ isSidebarOpen = false,
675
+ sidebarTooltip
676
+ }) {
677
+ const percentage = contextUsage ? Math.round(contextUsage.used / contextUsage.total * 100) : 0;
678
+ const progressColor = percentage > 90 ? "red" : percentage > 75 ? "orange" : "blue";
679
+ return /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "center", children: [
680
+ /* @__PURE__ */ jsxs(Group, { gap: "sm", children: [
681
+ /* @__PURE__ */ jsx(Title, { order: 3, children: title }),
682
+ status && /* @__PURE__ */ jsx(Badge, { size: "sm", variant: "light", color: status.color, children: status.label })
683
+ ] }),
684
+ /* @__PURE__ */ jsxs(Group, { children: [
685
+ contextUsage && /* @__PURE__ */ jsx(
686
+ Tooltip,
687
+ {
688
+ label: `${contextUsage.used.toLocaleString()} / ${contextUsage.total.toLocaleString()} tokens used`,
689
+ position: "bottom",
690
+ children: /* @__PURE__ */ jsx("div", { style: { width: "180px" }, children: /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
691
+ /* @__PURE__ */ jsxs(Group, { justify: "space-between", children: [
692
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: "Context" }),
693
+ /* @__PURE__ */ jsxs(Text, { size: "xs", fw: 600, c: progressColor, children: [
694
+ percentage,
695
+ "%"
696
+ ] })
697
+ ] }),
698
+ /* @__PURE__ */ jsx(Progress, { value: percentage, color: progressColor, size: "sm" })
699
+ ] }) })
700
+ }
701
+ ),
702
+ sidebarIcon && onToggleSidebar && /* @__PURE__ */ jsx(Tooltip, { label: sidebarTooltip || (isSidebarOpen ? "Close sidebar" : "Open sidebar"), position: "left", children: /* @__PURE__ */ jsx(
703
+ ActionIcon,
704
+ {
705
+ variant: "subtle",
706
+ size: "lg",
707
+ onClick: onToggleSidebar,
708
+ style: {
709
+ transform: isSidebarOpen ? "rotate(180deg)" : "rotate(0deg)",
710
+ transition: "transform var(--duration-normal) var(--easing)",
711
+ color: "var(--color-text-subtle)",
712
+ marginRight: 4
713
+ },
714
+ children: sidebarIcon
715
+ }
716
+ ) })
717
+ ] })
718
+ ] });
719
+ }
720
+ function ChatSidebar({ isOpen, title = "Details", children, width = 320, zIndex = 10 }) {
721
+ return /* @__PURE__ */ jsxs(
722
+ Paper,
723
+ {
724
+ withBorder: isOpen,
725
+ style: {
726
+ position: "absolute",
727
+ top: 0,
728
+ right: 0,
729
+ bottom: 0,
730
+ width: `${width}px`,
731
+ transform: isOpen ? "translateX(0)" : "translateX(100%)",
732
+ opacity: isOpen ? 1 : 0,
733
+ transition: "transform var(--duration-normal) var(--easing), opacity var(--duration-normal) var(--easing)",
734
+ background: "var(--glass-background)",
735
+ zIndex,
736
+ display: "flex",
737
+ flexDirection: "column",
738
+ margin: 8
739
+ },
740
+ children: [
741
+ /* @__PURE__ */ jsx(Group, { justify: "space-between", p: "sm", style: { borderBottom: "1px solid var(--color-border)" }, children: /* @__PURE__ */ jsx(Text, { fw: 600, size: "sm", style: { fontFamily: "var(--mantine-font-family-headings)" }, children: title }) }),
742
+ children
743
+ ]
744
+ }
745
+ );
746
+ }
747
+
748
+ export { ChatHeader, ChatInputArea, ChatInterface, ChatSidebar, ConfirmationInputModal, ConfirmationModal, MessageBubble };