@apteva/apteva-kit 0.1.2 → 0.1.7

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.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
2
 
3
3
  // src/components/Chat/Chat.tsx
4
- var _react = require('react');
4
+ var _react = require('react'); var _react2 = _interopRequireDefault(_react);
5
5
 
6
6
  // src/components/Chat/MessageList.tsx
7
7
 
@@ -190,14 +190,14 @@ function generateMockStreamingResponse(text, onChunk, typingSpeed = 30) {
190
190
  var _jsxruntime = require('react/jsx-runtime');
191
191
  function Card({ widget, onAction }) {
192
192
  const { title, description, image, footer } = widget.props;
193
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-widget-card", children: [
193
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border border-gray-200 dark:border-gray-700 rounded-xl bg-white dark:bg-gray-900 overflow-hidden", children: [
194
194
  image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: image, alt: title, className: "w-full h-48 object-cover" }),
195
195
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4", children: [
196
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: title }),
197
- description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-gray-600 dark:text-gray-400 mt-2", children: description })
196
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: title }),
197
+ description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!text-gray-600 dark:!text-gray-400 mt-2", children: description })
198
198
  ] }),
199
199
  (footer || widget.actions && widget.actions.length > 0) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border-t border-gray-200 dark:border-gray-700 p-4 flex justify-between items-center", children: [
200
- footer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm text-gray-600 dark:text-gray-400", children: footer }),
200
+ footer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm !text-gray-600 dark:!text-gray-400", children: footer }),
201
201
  widget.actions && widget.actions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex gap-2", children: widget.actions.map((action, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
202
202
  "button",
203
203
  {
@@ -207,7 +207,7 @@ function Card({ widget, onAction }) {
207
207
  widgetId: widget.id,
208
208
  timestamp: /* @__PURE__ */ new Date()
209
209
  })]),
210
- className: "apteva-widget-button",
210
+ className: "px-3 py-1.5 !text-sm rounded-lg font-medium transition-colors bg-blue-500 !text-white hover:bg-blue-600",
211
211
  children: action.label
212
212
  },
213
213
  idx
@@ -220,28 +220,35 @@ function Card({ widget, onAction }) {
220
220
 
221
221
  function List({ widget, onAction }) {
222
222
  const { items } = widget.props;
223
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "apteva-widget-list", children: items.map((item) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center p-4 hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors", children: [
224
- item.image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: item.image, alt: item.title, className: "w-16 h-16 rounded object-cover" }),
225
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 ml-4", children: [
226
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold text-gray-900 dark:text-white", children: item.title }),
227
- item.subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-sm text-gray-600 dark:text-gray-400", children: item.subtitle }),
228
- item.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-xs text-gray-500 dark:text-gray-500 mt-1", children: item.description })
229
- ] }),
230
- widget.actions && widget.actions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex gap-2", children: widget.actions.map((action, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
231
- "button",
232
- {
233
- onClick: () => _optionalChain([onAction, 'optionalCall', _2 => _2({
234
- type: action.type,
235
- payload: item.metadata || item,
236
- widgetId: widget.id,
237
- timestamp: /* @__PURE__ */ new Date()
238
- })]),
239
- className: "px-3 py-1.5 text-sm rounded-lg font-medium transition-colors bg-apteva-500 text-white hover:bg-apteva-600",
240
- children: action.label
241
- },
242
- idx
243
- )) })
244
- ] }, item.id)) });
223
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border border-gray-200 dark:border-gray-700 rounded-xl bg-white dark:bg-gray-900 overflow-hidden", children: items.map((item, index) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
224
+ "div",
225
+ {
226
+ className: `flex items-center p-4 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors ${index !== items.length - 1 ? "border-b border-gray-200 dark:border-gray-700" : ""}`,
227
+ children: [
228
+ item.image && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "img", { src: item.image, alt: item.title, className: "w-16 h-16 rounded object-cover" }),
229
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: `flex-1 ${item.image ? "ml-4" : ""}`, children: [
230
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h4", { className: "font-semibold !text-gray-900 dark:!text-white", children: item.title }),
231
+ item.subtitle && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!text-sm !text-gray-600 dark:!text-gray-400", children: item.subtitle }),
232
+ item.description && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "!text-xs !text-gray-500 dark:!text-gray-500 mt-1", children: item.description })
233
+ ] }),
234
+ widget.actions && widget.actions.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex gap-2", children: widget.actions.map((action, idx) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
235
+ "button",
236
+ {
237
+ onClick: () => _optionalChain([onAction, 'optionalCall', _2 => _2({
238
+ type: action.type,
239
+ payload: item.metadata || item,
240
+ widgetId: widget.id,
241
+ timestamp: /* @__PURE__ */ new Date()
242
+ })]),
243
+ className: "px-3 py-1.5 !text-sm rounded-lg font-medium transition-colors bg-blue-500 !text-white hover:bg-blue-600",
244
+ children: action.label
245
+ },
246
+ idx
247
+ )) })
248
+ ]
249
+ },
250
+ item.id
251
+ )) });
245
252
  }
246
253
 
247
254
  // src/components/Widgets/widget-library/Button.tsx
@@ -249,10 +256,10 @@ function List({ widget, onAction }) {
249
256
  function Button({ widget, onAction }) {
250
257
  const { label, variant = "primary", disabled = false } = widget.props;
251
258
  const variantClasses = {
252
- primary: "bg-apteva-500 text-white hover:bg-apteva-600",
253
- secondary: "bg-gray-500 text-white hover:bg-gray-600",
254
- outline: "border-2 border-apteva-500 text-apteva-500 hover:bg-apteva-50",
255
- ghost: "text-apteva-500 hover:bg-apteva-50"
259
+ primary: "bg-blue-500 !text-white hover:bg-blue-600",
260
+ secondary: "bg-gray-500 !text-white hover:bg-gray-600",
261
+ outline: "border-2 border-blue-500 !text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900",
262
+ ghost: "!text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900"
256
263
  };
257
264
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
258
265
  "button",
@@ -326,11 +333,20 @@ function Widgets({
326
333
 
327
334
  function Message({ message, onAction }) {
328
335
  const isUser = message.role === "user";
329
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("apteva-message", isUser ? "apteva-message-user" : "apteva-message-assistant"), children: [
330
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "whitespace-pre-wrap", children: message.content }),
331
- message.widgets && message.widgets.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "mt-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
332
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-xs opacity-70 mt-2", children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
333
- ] });
336
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
337
+ "div",
338
+ {
339
+ className: cn(
340
+ "max-w-[80%]",
341
+ isUser ? "px-4 py-2.5 rounded-xl bg-gray-100 dark:bg-gray-800 !text-gray-900 dark:!text-gray-100 ml-auto" : "!text-gray-900 dark:!text-gray-100"
342
+ ),
343
+ children: [
344
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "whitespace-pre-wrap !text-sm leading-relaxed", children: message.content }),
345
+ message.widgets && message.widgets.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn(isUser ? "mt-3" : "mt-2"), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Widgets, { widgets: message.widgets, onAction, layout: "stack" }) }),
346
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: cn("!text-xs opacity-70", isUser ? "mt-1.5 !text-gray-500 dark:!text-gray-400" : "mt-1 !text-gray-500 dark:!text-gray-400"), suppressHydrationWarning: true, children: message.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) })
347
+ ]
348
+ }
349
+ );
334
350
  }
335
351
 
336
352
  // src/components/Chat/MessageList.tsx
@@ -342,7 +358,7 @@ function MessageList({ messages, onAction }) {
342
358
  listRef.current.scrollTop = listRef.current.scrollHeight;
343
359
  }
344
360
  }, [messages]);
345
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: listRef, className: "apteva-message-list", children: messages.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center h-full text-gray-500", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center space-y-2", children: [
361
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: listRef, className: "flex-1 overflow-y-auto px-4 py-4 space-y-3", children: messages.length === 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "flex items-center justify-center h-full !text-gray-500 dark:!text-gray-400", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "text-center space-y-2", children: [
346
362
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-4xl", children: "\u{1F4AC}" }),
347
363
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "No messages yet. Start a conversation!" })
348
364
  ] }) }) : messages.map((message) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Message, { message, onAction }, message.id)) });
@@ -351,9 +367,11 @@ function MessageList({ messages, onAction }) {
351
367
  // src/components/Chat/Composer.tsx
352
368
 
353
369
 
354
- function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false }) {
370
+ function Composer({ onSendMessage, placeholder = "Type a message...", disabled = false, onFileUpload }) {
355
371
  const [text, setText] = _react.useState.call(void 0, "");
372
+ const [showMenu, setShowMenu] = _react.useState.call(void 0, false);
356
373
  const textareaRef = _react.useRef.call(void 0, null);
374
+ const fileInputRef = _react.useRef.call(void 0, null);
357
375
  const handleKeyDown = (e) => {
358
376
  if (e.key === "Enter" && !e.shiftKey) {
359
377
  e.preventDefault();
@@ -374,8 +392,37 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
374
392
  e.target.style.height = "auto";
375
393
  e.target.style.height = `${e.target.scrollHeight}px`;
376
394
  };
377
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "apteva-composer", children: [
378
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex gap-2", children: [
395
+ const handleFileSelect = (e) => {
396
+ if (e.target.files && e.target.files.length > 0) {
397
+ _optionalChain([onFileUpload, 'optionalCall', _7 => _7(e.target.files)]);
398
+ setShowMenu(false);
399
+ }
400
+ };
401
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "px-4 py-3 bg-white dark:bg-gray-900 relative", children: [
402
+ showMenu && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
403
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "fixed inset-0 z-10", onClick: () => setShowMenu(false) }),
404
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "absolute bottom-full left-4 mb-2 bg-gray-800 dark:bg-gray-700 rounded-xl shadow-lg overflow-hidden z-20 min-w-[240px]", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
405
+ "button",
406
+ {
407
+ onClick: () => _optionalChain([fileInputRef, 'access', _8 => _8.current, 'optionalAccess', _9 => _9.click, 'call', _10 => _10()]),
408
+ className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-gray-700 dark:hover:bg-gray-600 transition-colors !text-white text-left",
409
+ children: [
410
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10.5 3.5L5.5 8.5C4.67157 9.32843 4.67157 10.6716 5.5 11.5C6.32843 12.3284 7.67157 12.3284 8.5 11.5L14.5 5.5C15.8807 4.11929 15.8807 1.88071 14.5 0.5C13.1193 -0.880711 10.8807 -0.880711 9.5 0.5L3.5 6.5C1.56846 8.43154 1.56846 11.5685 3.5 13.5C5.43154 15.4315 8.56846 15.4315 10.5 13.5L15.5 8.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(2, 3)" }) }),
411
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-sm font-medium", children: "Add photos & files" })
412
+ ]
413
+ }
414
+ ) })
415
+ ] }),
416
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative border-2 border-gray-300 dark:border-gray-700 rounded-xl bg-white dark:bg-gray-900 transition-all duration-300 flex items-center px-3 py-2 gap-3", children: [
417
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
418
+ "button",
419
+ {
420
+ onClick: () => setShowMenu(!showMenu),
421
+ className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-700 dark:!text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",
422
+ title: "More options",
423
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M10 5v10M5 10h10", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
424
+ }
425
+ ),
379
426
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
380
427
  "textarea",
381
428
  {
@@ -385,9 +432,9 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
385
432
  onKeyDown: handleKeyDown,
386
433
  placeholder,
387
434
  disabled,
388
- className: "apteva-composer-input",
435
+ className: "flex-1 resize-none bg-transparent border-none focus:outline-none !text-gray-900 dark:!text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 py-1 disabled:opacity-50 disabled:cursor-not-allowed",
389
436
  rows: 1,
390
- style: { maxHeight: "200px" }
437
+ style: { maxHeight: "120px" }
391
438
  }
392
439
  ),
393
440
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -395,12 +442,23 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
395
442
  {
396
443
  onClick: handleSend,
397
444
  disabled: !text.trim() || disabled,
398
- className: "px-6 py-2 bg-apteva-500 text-white rounded-lg hover:bg-apteva-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-medium",
399
- children: "Send"
445
+ className: "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0 border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 !text-gray-700 dark:!text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-30 disabled:cursor-not-allowed !text-lg",
446
+ title: "Send message",
447
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
400
448
  }
401
449
  )
402
450
  ] }),
403
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-xs text-gray-500 mt-2", children: "Press Enter to send, Shift+Enter for new line" })
451
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
452
+ "input",
453
+ {
454
+ ref: fileInputRef,
455
+ type: "file",
456
+ multiple: true,
457
+ onChange: handleFileSelect,
458
+ className: "hidden",
459
+ accept: "image/*,application/pdf,.doc,.docx,.txt"
460
+ }
461
+ )
404
462
  ] });
405
463
  }
406
464
 
@@ -413,6 +471,7 @@ function Chat({
413
471
  onThreadChange,
414
472
  onMessageSent,
415
473
  onAction,
474
+ onFileUpload,
416
475
  placeholder = "Type a message...",
417
476
  showHeader = true,
418
477
  headerTitle = "Chat",
@@ -423,7 +482,7 @@ function Chat({
423
482
  _react.useEffect.call(void 0, () => {
424
483
  if (threadId) {
425
484
  console.log("Loading thread:", threadId);
426
- _optionalChain([onThreadChange, 'optionalCall', _7 => _7(threadId)]);
485
+ _optionalChain([onThreadChange, 'optionalCall', _11 => _11(threadId)]);
427
486
  }
428
487
  }, [threadId, onThreadChange]);
429
488
  const handleSendMessage = async (text) => {
@@ -434,7 +493,7 @@ function Chat({
434
493
  timestamp: /* @__PURE__ */ new Date()
435
494
  };
436
495
  setMessages((prev) => [...prev, userMessage]);
437
- _optionalChain([onMessageSent, 'optionalCall', _8 => _8(userMessage)]);
496
+ _optionalChain([onMessageSent, 'optionalCall', _12 => _12(userMessage)]);
438
497
  setIsLoading(true);
439
498
  try {
440
499
  const response = await generateMockResponse(1e3);
@@ -445,17 +504,17 @@ function Chat({
445
504
  setIsLoading(false);
446
505
  }
447
506
  };
448
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("apteva-chat-container", className), children: [
449
- showHeader && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "border-b border-gray-200 dark:border-gray-700 px-4 py-3", children: [
450
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "text-lg font-semibold text-gray-900 dark:text-white", children: headerTitle }),
451
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
507
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: cn("flex flex-col h-full bg-white dark:bg-gray-900", className), children: [
508
+ showHeader && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "px-4 py-3 bg-white dark:bg-gray-900", children: [
509
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h2", { className: "!text-lg font-semibold !text-gray-900 dark:!text-white", children: headerTitle }),
510
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "!text-xs !text-gray-500 dark:!text-gray-400", children: [
452
511
  "Agent: ",
453
512
  agentId
454
513
  ] })
455
514
  ] }),
456
515
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, MessageList, { messages, onAction }),
457
- isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-4 py-2 text-sm text-gray-500 italic", children: "AI is thinking..." }),
458
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Composer, { onSendMessage: handleSendMessage, placeholder, disabled: isLoading })
516
+ isLoading && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "px-4 py-2 !text-sm !text-gray-500 dark:!text-gray-400 italic", children: "AI is thinking..." }),
517
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Composer, { onSendMessage: handleSendMessage, placeholder, disabled: isLoading, onFileUpload })
459
518
  ] });
460
519
  }
461
520
 
@@ -476,6 +535,7 @@ function Command({
476
535
  onChunk,
477
536
  onComplete,
478
537
  onError,
538
+ onFileUpload,
479
539
  loadingText = "Processing...",
480
540
  showProgress = true,
481
541
  enableStreaming = false,
@@ -488,6 +548,7 @@ function Command({
488
548
  const [progress, setProgress] = _react.useState.call(void 0, 0);
489
549
  const [command, setCommand] = _react.useState.call(void 0, initialCommand || "");
490
550
  const [streamedContent, setStreamedContent] = _react.useState.call(void 0, "");
551
+ const fileInputRef = _react2.default.useRef(null);
491
552
  _react.useEffect.call(void 0, () => {
492
553
  if (autoExecute && state === "idle" && command) {
493
554
  executeCommand();
@@ -499,11 +560,13 @@ function Command({
499
560
  setState("error");
500
561
  return;
501
562
  }
563
+ const currentCommand = command;
502
564
  setState("loading");
503
565
  setError(null);
504
566
  setProgress(0);
505
567
  setStreamedContent("");
506
- _optionalChain([onStart, 'optionalCall', _9 => _9()]);
568
+ setCommand("");
569
+ _optionalChain([onStart, 'optionalCall', _13 => _13()]);
507
570
  try {
508
571
  if (enableStreaming) {
509
572
  const mockStreamChunks = [
@@ -519,14 +582,14 @@ function Command({
519
582
  await new Promise((resolve) => setTimeout(resolve, 600 + Math.random() * 400));
520
583
  const chunk = mockStreamChunks[i];
521
584
  setStreamedContent(chunk);
522
- _optionalChain([onChunk, 'optionalCall', _10 => _10(chunk)]);
585
+ _optionalChain([onChunk, 'optionalCall', _14 => _14(chunk)]);
523
586
  setProgress(Math.round((i + 1) / mockStreamChunks.length * 100));
524
- _optionalChain([onProgress, 'optionalCall', _11 => _11(Math.round((i + 1) / mockStreamChunks.length * 100))]);
587
+ _optionalChain([onProgress, 'optionalCall', _15 => _15(Math.round((i + 1) / mockStreamChunks.length * 100))]);
525
588
  }
526
589
  const mockResult = {
527
590
  success: true,
528
591
  data: {
529
- summary: `Successfully processed: "${command}"`,
592
+ summary: `Successfully processed: "${currentCommand}"`,
530
593
  agentId,
531
594
  context,
532
595
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
@@ -536,12 +599,12 @@ function Command({
536
599
  setResult(mockResult);
537
600
  setState("success");
538
601
  setProgress(100);
539
- _optionalChain([onComplete, 'optionalCall', _12 => _12(mockResult)]);
602
+ _optionalChain([onComplete, 'optionalCall', _16 => _16(mockResult)]);
540
603
  } else {
541
604
  const progressInterval = setInterval(() => {
542
605
  setProgress((prev) => {
543
606
  const next = Math.min(prev + 10, 90);
544
- _optionalChain([onProgress, 'optionalCall', _13 => _13(next)]);
607
+ _optionalChain([onProgress, 'optionalCall', _17 => _17(next)]);
545
608
  return next;
546
609
  });
547
610
  }, 200);
@@ -550,7 +613,7 @@ function Command({
550
613
  const mockResult = {
551
614
  success: true,
552
615
  data: {
553
- summary: `Command "${command}" executed successfully`,
616
+ summary: `Command "${currentCommand}" executed successfully`,
554
617
  agentId,
555
618
  context,
556
619
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
@@ -560,13 +623,13 @@ function Command({
560
623
  setResult(mockResult);
561
624
  setState("success");
562
625
  setProgress(100);
563
- _optionalChain([onComplete, 'optionalCall', _14 => _14(mockResult)]);
626
+ _optionalChain([onComplete, 'optionalCall', _18 => _18(mockResult)]);
564
627
  }
565
628
  } catch (err) {
566
629
  const error2 = err instanceof Error ? err : new Error("Unknown error");
567
630
  setError(error2);
568
631
  setState("error");
569
- _optionalChain([onError, 'optionalCall', _15 => _15(error2)]);
632
+ _optionalChain([onError, 'optionalCall', _19 => _19(error2)]);
570
633
  }
571
634
  };
572
635
  const resetCommand = () => {
@@ -576,6 +639,11 @@ function Command({
576
639
  setProgress(0);
577
640
  setCommand("");
578
641
  };
642
+ const handleFileSelect = (e) => {
643
+ if (e.target.files && e.target.files.length > 0) {
644
+ _optionalChain([onFileUpload, 'optionalCall', _20 => _20(e.target.files)]);
645
+ }
646
+ };
579
647
  const isCompact = variant === "compact";
580
648
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
581
649
  "div",
@@ -604,11 +672,20 @@ function Command({
604
672
  }
605
673
  },
606
674
  placeholder,
607
- className: "flex-1 w-full resize-none bg-transparent border-none focus:outline-none text-gray-900 dark:!text-gray-100 placeholder-gray-400 dark:placeholder-gray-500",
675
+ className: "flex-1 w-full resize-none bg-transparent border-none focus:outline-none !text-gray-900 dark:!text-gray-100 placeholder-gray-400 dark:placeholder-gray-500",
608
676
  rows: 6
609
677
  }
610
678
  ),
611
679
  state === "idle" && allowInput && isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
680
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
681
+ "button",
682
+ {
683
+ onClick: () => _optionalChain([fileInputRef, 'access', _21 => _21.current, 'optionalAccess', _22 => _22.click, 'call', _23 => _23()]),
684
+ className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-500 dark:!text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",
685
+ title: "Attach file",
686
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
687
+ }
688
+ ),
612
689
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
613
690
  "input",
614
691
  {
@@ -622,7 +699,7 @@ function Command({
622
699
  }
623
700
  },
624
701
  placeholder,
625
- className: "flex-1 bg-transparent border-none focus:outline-none text-gray-900 dark:!text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 py-1"
702
+ className: "flex-1 bg-transparent border-none focus:outline-none !text-gray-900 dark:!text-gray-100 placeholder-gray-400 dark:placeholder-gray-500 py-1"
626
703
  }
627
704
  ),
628
705
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -634,13 +711,14 @@ function Command({
634
711
  "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0",
635
712
  "border border-gray-300 dark:border-gray-600",
636
713
  "bg-white dark:bg-gray-800",
637
- "text-gray-700 dark:text-gray-300",
714
+ "!text-gray-700 dark:!text-gray-300",
638
715
  "hover:bg-gray-50 dark:hover:bg-gray-700",
639
716
  "disabled:opacity-30 disabled:cursor-not-allowed",
640
- !command.trim() && "border-gray-200 dark:border-gray-700 text-gray-400 dark:text-gray-600"
717
+ "!text-lg",
718
+ !command.trim() && "border-gray-200 dark:border-gray-700 !text-gray-400 dark:!text-gray-600"
641
719
  ),
642
720
  title: "Execute",
643
- children: "\u2191"
721
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
644
722
  }
645
723
  )
646
724
  ] }),
@@ -674,10 +752,11 @@ function Command({
674
752
  "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0",
675
753
  "border border-gray-200 dark:border-gray-700",
676
754
  "bg-white dark:bg-gray-800",
677
- "text-gray-400 dark:text-gray-600",
755
+ "!text-gray-400 dark:!text-gray-600",
756
+ "!text-lg",
678
757
  "opacity-30 cursor-not-allowed"
679
758
  ),
680
- children: "\u2191"
759
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
681
760
  }
682
761
  )
683
762
  ] }),
@@ -686,7 +765,7 @@ function Command({
686
765
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-5 h-5 text-red-600 mt-0.5 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
687
766
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
688
767
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
689
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess', _16 => _16.message]) })
768
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess', _24 => _24.message]) })
690
769
  ] })
691
770
  ] }) }),
692
771
  allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -714,57 +793,96 @@ function Command({
714
793
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-green-700 dark:text-green-300 text-sm", children: result.message || "Command executed successfully" })
715
794
  ] })
716
795
  ] }),
717
- _optionalChain([result, 'access', _17 => _17.data, 'optionalAccess', _18 => _18.summary]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed", children: result.data.summary })
796
+ _optionalChain([result, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.summary]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-gray-700 dark:text-gray-300 text-sm leading-relaxed", children: result.data.summary })
718
797
  ] }) }),
719
798
  state === "success" && result && isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
720
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex-1 flex items-center gap-2 py-1", children: [
721
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
722
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-green-700 dark:text-green-300 text-sm truncate", children: resultRenderer ? resultRenderer(result.data) : result.message || "Command executed successfully" })
723
- ] }),
799
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
800
+ "div",
801
+ {
802
+ className: "flex-1 flex items-center gap-2 py-1 cursor-text",
803
+ onClick: () => {
804
+ setState("idle");
805
+ setResult(null);
806
+ },
807
+ children: [
808
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { className: "w-4 h-4 text-green-600 flex-shrink-0", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
809
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-green-700 dark:text-green-300 text-sm truncate", children: resultRenderer ? resultRenderer(result.data) : result.message || "Command executed successfully" })
810
+ ]
811
+ }
812
+ ),
724
813
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
725
814
  "button",
726
815
  {
727
- disabled: true,
816
+ onClick: () => {
817
+ setState("idle");
818
+ setResult(null);
819
+ },
728
820
  className: cn(
729
821
  "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all flex-shrink-0",
730
- "border border-gray-200 dark:border-gray-700",
822
+ "border border-gray-300 dark:border-gray-600",
731
823
  "bg-white dark:bg-gray-800",
732
- "text-gray-400 dark:text-gray-600",
733
- "opacity-30 cursor-not-allowed"
824
+ "!text-gray-700 dark:!text-gray-300",
825
+ "hover:bg-gray-50 dark:hover:bg-gray-700",
826
+ "!text-lg"
734
827
  ),
735
- children: "\u2191"
828
+ title: "New command",
829
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
736
830
  }
737
831
  )
738
832
  ] })
739
833
  ] }),
740
- !isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-3 flex items-center justify-end gap-2", children: [
741
- (state === "success" || state === "error") && allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
834
+ !isCompact && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-3 flex items-center justify-between gap-2", children: [
835
+ state === "idle" && allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
742
836
  "button",
743
837
  {
744
- onClick: resetCommand,
745
- className: "px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",
746
- children: "Reset"
838
+ onClick: () => _optionalChain([fileInputRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.click, 'call', _29 => _29()]),
839
+ className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-gray-500 dark:!text-gray-500 hover:bg-gray-100 dark:hover:bg-gray-800",
840
+ title: "Attach file",
841
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8.4 2.8L4.4 6.8C3.736 7.464 3.736 8.536 4.4 9.2C5.064 9.864 6.136 9.864 6.8 9.2L11.6 4.4C12.704 3.296 12.704 1.504 11.6 0.4C10.496 -0.704 8.704 -0.704 7.6 0.4L2.8 5.2C1.256 6.744 1.256 9.256 2.8 10.8C4.344 12.344 6.856 12.344 8.4 10.8L12.4 6.8", stroke: "currentColor", strokeWidth: "1.2", strokeLinecap: "round", strokeLinejoin: "round", transform: "translate(1.6, 2.4)" }) })
747
842
  }
748
843
  ),
749
- (state === "idle" || state === "error") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
750
- "button",
751
- {
752
- onClick: executeCommand,
753
- disabled: !command.trim(),
754
- className: cn(
755
- "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all",
756
- "border border-gray-300 dark:border-gray-600",
757
- "bg-white dark:bg-gray-800",
758
- "text-gray-700 dark:text-gray-300",
759
- "hover:bg-gray-50 dark:hover:bg-gray-700",
760
- "disabled:opacity-30 disabled:cursor-not-allowed",
761
- !command.trim() && "border-gray-200 dark:border-gray-700 text-gray-400 dark:text-gray-600"
762
- ),
763
- title: state === "error" ? "Retry" : "Execute",
764
- children: state === "error" ? "\u21BB" : "\u2191"
765
- }
766
- )
844
+ !(state === "idle" && allowInput) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", {}),
845
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex items-center gap-2", children: [
846
+ (state === "success" || state === "error") && allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
847
+ "button",
848
+ {
849
+ onClick: resetCommand,
850
+ className: "px-3 py-1.5 text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",
851
+ children: "Reset"
852
+ }
853
+ ),
854
+ (state === "idle" || state === "error") && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
855
+ "button",
856
+ {
857
+ onClick: executeCommand,
858
+ disabled: !command.trim(),
859
+ className: cn(
860
+ "w-8 h-8 rounded-lg flex items-center justify-center font-bold transition-all",
861
+ "border border-gray-300 dark:border-gray-600",
862
+ "bg-white dark:bg-gray-800",
863
+ "!text-gray-700 dark:!text-gray-300",
864
+ "hover:bg-gray-50 dark:hover:bg-gray-700",
865
+ "disabled:opacity-30 disabled:cursor-not-allowed",
866
+ "!text-lg",
867
+ !command.trim() && "border-gray-200 dark:border-gray-700 !text-gray-400 dark:!text-gray-600"
868
+ ),
869
+ title: state === "error" ? "Retry" : "Execute",
870
+ children: state === "error" ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M13 8C13 10.7614 10.7614 13 8 13C5.23858 13 3 10.7614 3 8C3 5.23858 5.23858 3 8 3C9.65685 3 11.1257 3.82818 12 5.09091M12 3V5.09091M12 5.09091H9.81818", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M8 3L8 13M8 3L4 7M8 3L12 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) })
871
+ }
872
+ )
873
+ ] })
767
874
  ] }),
875
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
876
+ "input",
877
+ {
878
+ ref: fileInputRef,
879
+ type: "file",
880
+ multiple: true,
881
+ onChange: handleFileSelect,
882
+ className: "hidden",
883
+ accept: "image/*,application/pdf,.doc,.docx,.txt"
884
+ }
885
+ ),
768
886
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { dangerouslySetInnerHTML: {
769
887
  __html: `
770
888
  @keyframes pulse-border {
@@ -810,17 +928,17 @@ function Prompt({
810
928
  const newValue = e.target.value;
811
929
  if (!maxLength || newValue.length <= maxLength) {
812
930
  setValue(newValue);
813
- _optionalChain([onChange, 'optionalCall', _19 => _19(newValue)]);
931
+ _optionalChain([onChange, 'optionalCall', _30 => _30(newValue)]);
814
932
  }
815
933
  };
816
934
  const handleSubmit = async () => {
817
935
  if (value.length < minLength) return;
818
- _optionalChain([onSubmit, 'optionalCall', _20 => _20(value)]);
936
+ _optionalChain([onSubmit, 'optionalCall', _31 => _31(value)]);
819
937
  setIsLoading(true);
820
938
  try {
821
939
  await new Promise((resolve) => setTimeout(resolve, 1500));
822
940
  const mockResult = `Enhanced version: ${value} [AI-generated content]`;
823
- _optionalChain([onResult, 'optionalCall', _21 => _21(mockResult)]);
941
+ _optionalChain([onResult, 'optionalCall', _32 => _32(mockResult)]);
824
942
  setValue("");
825
943
  } catch (error) {
826
944
  console.error("Error processing prompt:", error);
@@ -913,23 +1031,23 @@ function Stream({
913
1031
  }, [autoStart]);
914
1032
  const startStreaming = async () => {
915
1033
  setIsStreaming(true);
916
- _optionalChain([onStart, 'optionalCall', _22 => _22()]);
1034
+ _optionalChain([onStart, 'optionalCall', _33 => _33()]);
917
1035
  const mockText = "This is a simulated streaming response from the AI agent. In a real implementation, this would stream data from your backend API. The text appears word by word to simulate the streaming effect. You can customize the typing speed and styling based on your needs.";
918
1036
  try {
919
1037
  await generateMockStreamingResponse(
920
1038
  mockText,
921
1039
  (chunk) => {
922
1040
  setText((prev) => prev + chunk);
923
- _optionalChain([onChunk, 'optionalCall', _23 => _23(chunk)]);
1041
+ _optionalChain([onChunk, 'optionalCall', _34 => _34(chunk)]);
924
1042
  },
925
1043
  typingSpeed
926
1044
  );
927
1045
  setIsComplete(true);
928
1046
  setIsStreaming(false);
929
- _optionalChain([onComplete, 'optionalCall', _24 => _24(text + mockText)]);
1047
+ _optionalChain([onComplete, 'optionalCall', _35 => _35(text + mockText)]);
930
1048
  } catch (error) {
931
1049
  const err = error instanceof Error ? error : new Error("Streaming error");
932
- _optionalChain([onError, 'optionalCall', _25 => _25(err)]);
1050
+ _optionalChain([onError, 'optionalCall', _36 => _36(err)]);
933
1051
  setIsStreaming(false);
934
1052
  }
935
1053
  };
@@ -1021,7 +1139,7 @@ function ThreadList({
1021
1139
  }) {
1022
1140
  const [searchQuery, setSearchQuery] = _react.useState.call(void 0, "");
1023
1141
  const filteredThreads = threads.filter(
1024
- (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access', _26 => _26.preview, 'optionalAccess', _27 => _27.toLowerCase, 'call', _28 => _28(), 'access', _29 => _29.includes, 'call', _30 => _30(searchQuery.toLowerCase())])
1142
+ (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access', _37 => _37.preview, 'optionalAccess', _38 => _38.toLowerCase, 'call', _39 => _39(), 'access', _40 => _40.includes, 'call', _41 => _41(searchQuery.toLowerCase())])
1025
1143
  );
1026
1144
  const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
1027
1145
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col h-full", children: [
@@ -1043,8 +1161,8 @@ function ThreadList({
1043
1161
  {
1044
1162
  thread,
1045
1163
  isActive: thread.id === currentThreadId,
1046
- onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _31 => _31(thread.id)]),
1047
- onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _32 => _32(thread.id)])
1164
+ onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _42 => _42(thread.id)]),
1165
+ onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _43 => _43(thread.id)])
1048
1166
  },
1049
1167
  thread.id
1050
1168
  ))
@@ -1106,7 +1224,7 @@ function Threads({
1106
1224
  threads.slice(0, 5).map((thread) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1107
1225
  "button",
1108
1226
  {
1109
- onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _33 => _33(thread.id)]),
1227
+ onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _44 => _44(thread.id)]),
1110
1228
  className: cn(
1111
1229
  "px-4 py-2 whitespace-nowrap font-medium transition-colors",
1112
1230
  thread.id === currentThreadId ? "border-b-2 border-apteva-500 text-apteva-500" : "text-gray-600 hover:text-gray-900"