@apteva/apteva-kit 0.1.59 → 0.1.61

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
@@ -913,6 +913,120 @@ function Table({ widget, onAction }) {
913
913
  ] }) }) });
914
914
  }
915
915
 
916
+ // src/components/Widgets/widget-library/Form.tsx
917
+
918
+
919
+ function Form({ widget, onAction }) {
920
+ const { title, fields } = widget.props;
921
+ const [formData, setFormData] = _react.useState.call(void 0, () => {
922
+ const initial = {};
923
+ fields.forEach((field) => {
924
+ initial[field.name] = _nullishCoalesce(field.defaultValue, () => ( (field.type === "checkbox" ? false : "")));
925
+ });
926
+ return initial;
927
+ });
928
+ const handleChange = (name, value) => {
929
+ setFormData((prev) => ({ ...prev, [name]: value }));
930
+ };
931
+ const handleSubmit = (e) => {
932
+ e.preventDefault();
933
+ if (_optionalChain([widget, 'access', _18 => _18.actions, 'optionalAccess', _19 => _19[0]]) && onAction) {
934
+ onAction({
935
+ type: widget.actions[0].type,
936
+ payload: { ...widget.actions[0].payload, formData },
937
+ widgetId: widget.id,
938
+ timestamp: /* @__PURE__ */ new Date()
939
+ });
940
+ }
941
+ };
942
+ const renderField = (field) => {
943
+ const baseInputClass = "w-full px-3 py-2 rounded-lg border transition-colors border-neutral-200 dark:border-neutral-600 bg-neutral-50 dark:bg-neutral-800 !text-neutral-900 dark:!text-neutral-100 placeholder-neutral-400 dark:placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent";
944
+ switch (field.type) {
945
+ case "text":
946
+ case "password":
947
+ case "number":
948
+ case "date":
949
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
950
+ "input",
951
+ {
952
+ type: field.type,
953
+ name: field.name,
954
+ value: formData[field.name] || "",
955
+ onChange: (e) => handleChange(field.name, field.type === "number" ? Number(e.target.value) : e.target.value),
956
+ placeholder: field.placeholder,
957
+ required: field.required,
958
+ className: baseInputClass
959
+ }
960
+ );
961
+ case "textarea":
962
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
963
+ "textarea",
964
+ {
965
+ name: field.name,
966
+ value: formData[field.name] || "",
967
+ onChange: (e) => handleChange(field.name, e.target.value),
968
+ placeholder: field.placeholder,
969
+ required: field.required,
970
+ rows: 3,
971
+ className: baseInputClass
972
+ }
973
+ );
974
+ case "select":
975
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
976
+ "select",
977
+ {
978
+ name: field.name,
979
+ value: formData[field.name] || "",
980
+ onChange: (e) => handleChange(field.name, e.target.value),
981
+ required: field.required,
982
+ className: baseInputClass,
983
+ children: [
984
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: "", children: field.placeholder || "Select..." }),
985
+ _optionalChain([field, 'access', _20 => _20.options, 'optionalAccess', _21 => _21.map, 'call', _22 => _22((opt) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "option", { value: opt.value, children: opt.label }, opt.value))])
986
+ ]
987
+ }
988
+ );
989
+ case "checkbox":
990
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "flex items-center gap-2 cursor-pointer", children: [
991
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
992
+ "input",
993
+ {
994
+ type: "checkbox",
995
+ name: field.name,
996
+ checked: formData[field.name] || false,
997
+ onChange: (e) => handleChange(field.name, e.target.checked),
998
+ className: "w-4 h-4 rounded border-neutral-300 dark:border-neutral-600 text-blue-500 focus:ring-blue-500"
999
+ }
1000
+ ),
1001
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "!text-neutral-700 dark:!text-neutral-300", children: field.label })
1002
+ ] });
1003
+ default:
1004
+ return null;
1005
+ }
1006
+ };
1007
+ const submitAction = _optionalChain([widget, 'access', _23 => _23.actions, 'optionalAccess', _24 => _24.find, 'call', _25 => _25((a) => a.type === "submit")]) || _optionalChain([widget, 'access', _26 => _26.actions, 'optionalAccess', _27 => _27[0]]);
1008
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "form", { onSubmit: handleSubmit, className: "border border-neutral-200 dark:border-neutral-700 rounded-xl bg-white dark:bg-neutral-900 overflow-hidden", children: [
1009
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4", children: [
1010
+ title && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "!text-lg font-semibold !text-neutral-900 dark:!text-white mb-4", children: title }),
1011
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-3", children: fields.map((field) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: field.type === "checkbox" ? "" : "space-y-1", children: [
1012
+ field.type !== "checkbox" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: "block !text-sm font-medium !text-neutral-600 dark:!text-neutral-400", children: [
1013
+ field.label,
1014
+ field.required && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-red-500 ml-1", children: "*" })
1015
+ ] }),
1016
+ renderField(field)
1017
+ ] }, field.name)) })
1018
+ ] }),
1019
+ submitAction && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "border-t border-neutral-200 dark:border-neutral-700 p-4", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1020
+ "button",
1021
+ {
1022
+ type: "submit",
1023
+ className: "px-3 py-1.5 !text-sm rounded-lg font-medium transition-colors bg-blue-500 !text-white hover:bg-blue-600",
1024
+ children: submitAction.label || "Submit"
1025
+ }
1026
+ ) })
1027
+ ] });
1028
+ }
1029
+
916
1030
  // src/components/Widgets/WidgetRenderer.tsx
917
1031
 
918
1032
  function WidgetRenderer({ widget, onAction }) {
@@ -928,6 +1042,8 @@ function WidgetRenderer({ widget, onAction }) {
928
1042
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ButtonGroup, { widget, onAction });
929
1043
  case "table":
930
1044
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Table, { widget, onAction });
1045
+ case "form":
1046
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Form, { widget, onAction });
931
1047
  default:
932
1048
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "p-4 border border-yellow-300 bg-yellow-50 rounded-lg", children: [
933
1049
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { className: "text-sm text-yellow-800", children: [
@@ -954,7 +1070,7 @@ function Widgets({
954
1070
  }) {
955
1071
  _react.useEffect.call(void 0, () => {
956
1072
  widgets.forEach((widget) => {
957
- _optionalChain([onWidgetMount, 'optionalCall', _18 => _18(widget.id)]);
1073
+ _optionalChain([onWidgetMount, 'optionalCall', _28 => _28(widget.id)]);
958
1074
  });
959
1075
  }, [widgets, onWidgetMount]);
960
1076
  const layoutClasses = {
@@ -1257,8 +1373,8 @@ function ToolCall({ name, status }) {
1257
1373
 
1258
1374
  function Message({ message, onAction, enableWidgets, onWidgetRender }) {
1259
1375
  const isUser = message.role === "user";
1260
- const contentSegments = _optionalChain([message, 'access', _19 => _19.metadata, 'optionalAccess', _20 => _20.content_segments]);
1261
- const isStreaming = _optionalChain([message, 'access', _21 => _21.metadata, 'optionalAccess', _22 => _22.isStreaming]) === true;
1376
+ const contentSegments = _optionalChain([message, 'access', _29 => _29.metadata, 'optionalAccess', _30 => _30.content_segments]);
1377
+ const isStreaming = _optionalChain([message, 'access', _31 => _31.metadata, 'optionalAccess', _32 => _32.isStreaming]) === true;
1262
1378
  const hasContent = message.content || contentSegments && contentSegments.length > 0;
1263
1379
  const reportedWidgetsRef = _react.useRef.call(void 0, /* @__PURE__ */ new Set());
1264
1380
  const parsedWidgets = _react.useMemo.call(void 0, () => {
@@ -1698,7 +1814,7 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1698
1814
  setFileError(errors.join(", "));
1699
1815
  setTimeout(() => setFileError(null), 5e3);
1700
1816
  }
1701
- _optionalChain([onFileUpload, 'optionalCall', _23 => _23(e.target.files)]);
1817
+ _optionalChain([onFileUpload, 'optionalCall', _33 => _33(e.target.files)]);
1702
1818
  setShowMenu(false);
1703
1819
  e.target.value = "";
1704
1820
  }
@@ -1768,15 +1884,15 @@ function Composer({ onSendMessage, placeholder = "Type a message...", disabled =
1768
1884
  {
1769
1885
  className: "apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
1770
1886
  style: {
1771
- left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _24 => _24.current, 'optionalAccess', _25 => _25.getBoundingClientRect, 'call', _26 => _26(), 'access', _27 => _27.left]), () => ( 0)),
1772
- top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _28 => _28.current, 'optionalAccess', _29 => _29.getBoundingClientRect, 'call', _30 => _30(), 'access', _31 => _31.bottom]), () => ( 0))) + 8
1887
+ left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _34 => _34.current, 'optionalAccess', _35 => _35.getBoundingClientRect, 'call', _36 => _36(), 'access', _37 => _37.left]), () => ( 0)),
1888
+ top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _38 => _38.current, 'optionalAccess', _39 => _39.getBoundingClientRect, 'call', _40 => _40(), 'access', _41 => _41.bottom]), () => ( 0))) + 8
1773
1889
  },
1774
1890
  children: [
1775
1891
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1776
1892
  "button",
1777
1893
  {
1778
1894
  onClick: () => {
1779
- _optionalChain([fileInputRef, 'access', _32 => _32.current, 'optionalAccess', _33 => _33.click, 'call', _34 => _34()]);
1895
+ _optionalChain([fileInputRef, 'access', _42 => _42.current, 'optionalAccess', _43 => _43.click, 'call', _44 => _44()]);
1780
1896
  setShowMenu(false);
1781
1897
  },
1782
1898
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left",
@@ -1895,8 +2011,8 @@ function CommandComposer({
1895
2011
  }
1896
2012
  };
1897
2013
  const handleNewCommand = () => {
1898
- _optionalChain([onReset, 'optionalCall', _35 => _35()]);
1899
- _optionalChain([inputRef, 'access', _36 => _36.current, 'optionalAccess', _37 => _37.focus, 'call', _38 => _38()]);
2014
+ _optionalChain([onReset, 'optionalCall', _45 => _45()]);
2015
+ _optionalChain([inputRef, 'access', _46 => _46.current, 'optionalAccess', _47 => _47.focus, 'call', _48 => _48()]);
1900
2016
  };
1901
2017
  const handleInputChange = (value) => {
1902
2018
  setInput(value);
@@ -2010,15 +2126,15 @@ function CommandComposer({
2010
2126
  {
2011
2127
  className: "apteva-composer-menu fixed bg-neutral-800 dark:bg-neutral-800 rounded-xl shadow-lg overflow-hidden z-[9999] min-w-[200px]",
2012
2128
  style: {
2013
- left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.getBoundingClientRect, 'call', _41 => _41(), 'access', _42 => _42.left]), () => ( 0)),
2014
- top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.getBoundingClientRect, 'call', _45 => _45(), 'access', _46 => _46.bottom]), () => ( 0))) + 8
2129
+ left: _nullishCoalesce(_optionalChain([menuButtonRef, 'access', _49 => _49.current, 'optionalAccess', _50 => _50.getBoundingClientRect, 'call', _51 => _51(), 'access', _52 => _52.left]), () => ( 0)),
2130
+ top: (_nullishCoalesce(_optionalChain([menuButtonRef, 'access', _53 => _53.current, 'optionalAccess', _54 => _54.getBoundingClientRect, 'call', _55 => _55(), 'access', _56 => _56.bottom]), () => ( 0))) + 8
2015
2131
  },
2016
2132
  children: [
2017
2133
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
2018
2134
  "button",
2019
2135
  {
2020
2136
  onClick: () => {
2021
- _optionalChain([fileInputRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.click, 'call', _49 => _49()]);
2137
+ _optionalChain([fileInputRef, 'access', _57 => _57.current, 'optionalAccess', _58 => _58.click, 'call', _59 => _59()]);
2022
2138
  setShowMenu(false);
2023
2139
  },
2024
2140
  className: "w-full flex items-center gap-3 px-4 py-3 hover:bg-neutral-700 dark:hover:bg-neutral-700 transition-colors !text-white text-left",
@@ -2259,7 +2375,7 @@ var AptevaClient = class {
2259
2375
  const error = await response.json().catch(() => ({ error: "Request failed" }));
2260
2376
  throw new Error(error.error || `Request failed with status ${response.status}`);
2261
2377
  }
2262
- const reader = _optionalChain([response, 'access', _50 => _50.body, 'optionalAccess', _51 => _51.getReader, 'call', _52 => _52()]);
2378
+ const reader = _optionalChain([response, 'access', _60 => _60.body, 'optionalAccess', _61 => _61.getReader, 'call', _62 => _62()]);
2263
2379
  if (!reader) {
2264
2380
  throw new Error("Response body is not readable");
2265
2381
  }
@@ -2277,7 +2393,7 @@ var AptevaClient = class {
2277
2393
  if (line.startsWith("data: ")) {
2278
2394
  const data = line.slice(6);
2279
2395
  if (data === "[DONE]") {
2280
- _optionalChain([onComplete, 'optionalCall', _53 => _53(threadId)]);
2396
+ _optionalChain([onComplete, 'optionalCall', _63 => _63(threadId)]);
2281
2397
  return;
2282
2398
  }
2283
2399
  try {
@@ -2292,10 +2408,10 @@ var AptevaClient = class {
2292
2408
  }
2293
2409
  }
2294
2410
  }
2295
- _optionalChain([onComplete, 'optionalCall', _54 => _54(threadId)]);
2411
+ _optionalChain([onComplete, 'optionalCall', _64 => _64(threadId)]);
2296
2412
  } catch (error) {
2297
2413
  const err = error instanceof Error ? error : new Error("Unknown error");
2298
- _optionalChain([onError, 'optionalCall', _55 => _55(err)]);
2414
+ _optionalChain([onError, 'optionalCall', _65 => _65(err)]);
2299
2415
  throw err;
2300
2416
  }
2301
2417
  }
@@ -2455,7 +2571,7 @@ ${widgetContext}` : widgetContext;
2455
2571
  }, [apiUrl, apiKey]);
2456
2572
  _react.useEffect.call(void 0, () => {
2457
2573
  if (threadId) {
2458
- _optionalChain([onThreadChange, 'optionalCall', _56 => _56(threadId)]);
2574
+ _optionalChain([onThreadChange, 'optionalCall', _66 => _66(threadId)]);
2459
2575
  }
2460
2576
  }, [threadId, onThreadChange]);
2461
2577
  _react.useEffect.call(void 0, () => {
@@ -2473,7 +2589,7 @@ ${widgetContext}` : widgetContext;
2473
2589
  }, [showSettingsMenu]);
2474
2590
  const handleModeChange = (newMode) => {
2475
2591
  setMode(newMode);
2476
- _optionalChain([onModeChange, 'optionalCall', _57 => _57(newMode)]);
2592
+ _optionalChain([onModeChange, 'optionalCall', _67 => _67(newMode)]);
2477
2593
  if (newMode === "command") {
2478
2594
  setCommandState("idle");
2479
2595
  setCommandResult(null);
@@ -2494,7 +2610,7 @@ ${widgetContext}` : widgetContext;
2494
2610
  metadata: hasFiles ? { attachments: fileNames } : void 0
2495
2611
  };
2496
2612
  setMessages((prev) => [...prev, userMessage]);
2497
- _optionalChain([onMessageSent, 'optionalCall', _58 => _58(userMessage)]);
2613
+ _optionalChain([onMessageSent, 'optionalCall', _68 => _68(userMessage)]);
2498
2614
  }
2499
2615
  setIsLoading(true);
2500
2616
  try {
@@ -2561,7 +2677,7 @@ ${widgetContext}` : widgetContext;
2561
2677
  responseThreadId = chunk.thread_id;
2562
2678
  if (!currentThreadId) {
2563
2679
  setCurrentThreadId(chunk.thread_id);
2564
- _optionalChain([onThreadChange, 'optionalCall', _59 => _59(chunk.thread_id)]);
2680
+ _optionalChain([onThreadChange, 'optionalCall', _69 => _69(chunk.thread_id)]);
2565
2681
  }
2566
2682
  }
2567
2683
  break;
@@ -2586,7 +2702,7 @@ ${widgetContext}` : widgetContext;
2586
2702
  contentSegments.push({ type: "tool", id: chunk.tool_id, name: chunk.tool_name });
2587
2703
  toolInputBuffer = "";
2588
2704
  setChatToolName(chunk.tool_name);
2589
- _optionalChain([onToolCall, 'optionalCall', _60 => _60(chunk.tool_name, chunk.tool_id)]);
2705
+ _optionalChain([onToolCall, 'optionalCall', _70 => _70(chunk.tool_name, chunk.tool_id)]);
2590
2706
  updateMessage();
2591
2707
  }
2592
2708
  break;
@@ -2600,7 +2716,7 @@ ${widgetContext}` : widgetContext;
2600
2716
  const toolSegment = contentSegments.find((s) => s.type === "tool" && s.id === chunk.tool_id);
2601
2717
  if (toolSegment) {
2602
2718
  toolSegment.result = chunk.content;
2603
- _optionalChain([onToolResult, 'optionalCall', _61 => _61(toolSegment.name, chunk.content)]);
2719
+ _optionalChain([onToolResult, 'optionalCall', _71 => _71(toolSegment.name, chunk.content)]);
2604
2720
  }
2605
2721
  setChatToolName(null);
2606
2722
  updateMessage();
@@ -2643,7 +2759,7 @@ ${widgetContext}` : widgetContext;
2643
2759
  });
2644
2760
  if (threadId2 && threadId2 !== currentThreadId) {
2645
2761
  setCurrentThreadId(threadId2);
2646
- _optionalChain([onThreadChange, 'optionalCall', _62 => _62(threadId2)]);
2762
+ _optionalChain([onThreadChange, 'optionalCall', _72 => _72(threadId2)]);
2647
2763
  }
2648
2764
  setIsLoading(false);
2649
2765
  setCurrentRequestId(null);
@@ -2667,7 +2783,7 @@ ${widgetContext}` : widgetContext;
2667
2783
  setIsLoading(false);
2668
2784
  setCurrentRequestId(null);
2669
2785
  setChatToolName(null);
2670
- _optionalChain([onError, 'optionalCall', _63 => _63(error)]);
2786
+ _optionalChain([onError, 'optionalCall', _73 => _73(error)]);
2671
2787
  }
2672
2788
  );
2673
2789
  }
@@ -2680,7 +2796,7 @@ ${widgetContext}` : widgetContext;
2680
2796
  metadata: { error: true }
2681
2797
  };
2682
2798
  setMessages((prev) => [...prev, errorMessage]);
2683
- _optionalChain([onError, 'optionalCall', _64 => _64(error instanceof Error ? error : new Error("Unknown error"))]);
2799
+ _optionalChain([onError, 'optionalCall', _74 => _74(error instanceof Error ? error : new Error("Unknown error"))]);
2684
2800
  } finally {
2685
2801
  setIsLoading(false);
2686
2802
  }
@@ -2726,7 +2842,7 @@ ${planningInstruction}` : planningInstruction;
2726
2842
  const error = err instanceof Error ? err : new Error("Failed to generate plan");
2727
2843
  setCommandError(error);
2728
2844
  setCommandState("error");
2729
- _optionalChain([onError, 'optionalCall', _65 => _65(error)]);
2845
+ _optionalChain([onError, 'optionalCall', _75 => _75(error)]);
2730
2846
  }
2731
2847
  }
2732
2848
  return;
@@ -2759,12 +2875,12 @@ ${planningInstruction}` : planningInstruction;
2759
2875
  setCommandResult(result);
2760
2876
  setCommandState("success");
2761
2877
  setProgress(100);
2762
- _optionalChain([onComplete, 'optionalCall', _66 => _66(result)]);
2878
+ _optionalChain([onComplete, 'optionalCall', _76 => _76(result)]);
2763
2879
  },
2764
2880
  (error) => {
2765
2881
  setCommandError(error);
2766
2882
  setCommandState("error");
2767
- _optionalChain([onError, 'optionalCall', _67 => _67(error)]);
2883
+ _optionalChain([onError, 'optionalCall', _77 => _77(error)]);
2768
2884
  }
2769
2885
  );
2770
2886
  } else {
@@ -2777,7 +2893,7 @@ ${planningInstruction}` : planningInstruction;
2777
2893
  setCommandResult(result);
2778
2894
  setCommandState("success");
2779
2895
  setProgress(100);
2780
- _optionalChain([onComplete, 'optionalCall', _68 => _68(result)]);
2896
+ _optionalChain([onComplete, 'optionalCall', _78 => _78(result)]);
2781
2897
  }
2782
2898
  } else {
2783
2899
  const commandInstruction = `CRITICAL COMMAND MODE: Maximum 10 words per response. Execute the command immediately. Make reasonable assumptions based on context. Use sensible defaults for missing details. DO NOT ask questions unless something is truly impossible without user input (e.g., missing required password). State what you're doing or the result. Examples: "Analyzing customer data from last quarter..." or "Created 5 new database entries successfully" or "Search complete: found 12 matching results". NO greetings, NO filler words, NO clarification requests. Action/result only.`;
@@ -2806,16 +2922,16 @@ ${commandInstruction}` : commandInstruction;
2806
2922
  } else if (chunk.type === "tool_call" && chunk.tool_name) {
2807
2923
  lastToolName = chunk.tool_name;
2808
2924
  setCurrentToolName(chunk.tool_name);
2809
- _optionalChain([onToolCall, 'optionalCall', _69 => _69(chunk.tool_name, chunk.tool_id || "")]);
2925
+ _optionalChain([onToolCall, 'optionalCall', _79 => _79(chunk.tool_name, chunk.tool_id || "")]);
2810
2926
  accumulatedContent = "";
2811
2927
  setStreamedContent("");
2812
2928
  } else if (chunk.type === "tool_result") {
2813
- _optionalChain([onToolResult, 'optionalCall', _70 => _70(lastToolName, chunk.content)]);
2929
+ _optionalChain([onToolResult, 'optionalCall', _80 => _80(lastToolName, chunk.content)]);
2814
2930
  setCurrentToolName(null);
2815
2931
  } else if (chunk.type === "thread_id" && chunk.thread_id) {
2816
2932
  if (!currentThreadId) {
2817
2933
  setCurrentThreadId(chunk.thread_id);
2818
- _optionalChain([onThreadChange, 'optionalCall', _71 => _71(chunk.thread_id)]);
2934
+ _optionalChain([onThreadChange, 'optionalCall', _81 => _81(chunk.thread_id)]);
2819
2935
  }
2820
2936
  } else if (chunk.type === "request_id" && chunk.request_id) {
2821
2937
  setCurrentRequestId(chunk.request_id);
@@ -2831,13 +2947,13 @@ ${commandInstruction}` : commandInstruction;
2831
2947
  setCommandState("success");
2832
2948
  setProgress(100);
2833
2949
  setCurrentRequestId(null);
2834
- _optionalChain([onComplete, 'optionalCall', _72 => _72(result)]);
2950
+ _optionalChain([onComplete, 'optionalCall', _82 => _82(result)]);
2835
2951
  },
2836
2952
  (error) => {
2837
2953
  setCommandError(error);
2838
2954
  setCommandState("error");
2839
2955
  setCurrentRequestId(null);
2840
- _optionalChain([onError, 'optionalCall', _73 => _73(error)]);
2956
+ _optionalChain([onError, 'optionalCall', _83 => _83(error)]);
2841
2957
  }
2842
2958
  );
2843
2959
  } else {
@@ -2857,14 +2973,14 @@ ${commandInstruction}` : commandInstruction;
2857
2973
  setCommandResult(result);
2858
2974
  setCommandState("success");
2859
2975
  setProgress(100);
2860
- _optionalChain([onComplete, 'optionalCall', _74 => _74(result)]);
2976
+ _optionalChain([onComplete, 'optionalCall', _84 => _84(result)]);
2861
2977
  }
2862
2978
  }
2863
2979
  } catch (err) {
2864
2980
  const error = err instanceof Error ? err : new Error("Unknown error");
2865
2981
  setCommandError(error);
2866
2982
  setCommandState("error");
2867
- _optionalChain([onError, 'optionalCall', _75 => _75(error)]);
2983
+ _optionalChain([onError, 'optionalCall', _85 => _85(error)]);
2868
2984
  }
2869
2985
  };
2870
2986
  const resetCommand = () => {
@@ -2956,8 +3072,8 @@ ${planToExecute}`;
2956
3072
  executeCommand(text, files);
2957
3073
  },
2958
3074
  state: commandState,
2959
- response: _optionalChain([commandResult, 'optionalAccess', _76 => _76.data, 'optionalAccess', _77 => _77.summary]) || _optionalChain([commandResult, 'optionalAccess', _78 => _78.message]),
2960
- error: _optionalChain([commandError, 'optionalAccess', _79 => _79.message]),
3075
+ response: _optionalChain([commandResult, 'optionalAccess', _86 => _86.data, 'optionalAccess', _87 => _87.summary]) || _optionalChain([commandResult, 'optionalAccess', _88 => _88.message]),
3076
+ error: _optionalChain([commandError, 'optionalAccess', _89 => _89.message]),
2961
3077
  plan,
2962
3078
  streamedContent,
2963
3079
  toolName: currentToolName,
@@ -3125,13 +3241,13 @@ ${planningInstruction}` : planningInstruction;
3125
3241
  const error2 = err instanceof Error ? err : new Error("Failed to generate plan");
3126
3242
  setError(error2);
3127
3243
  setState("error");
3128
- _optionalChain([onError, 'optionalCall', _80 => _80(error2)]);
3244
+ _optionalChain([onError, 'optionalCall', _90 => _90(error2)]);
3129
3245
  });
3130
3246
  } catch (err) {
3131
3247
  const error2 = err instanceof Error ? err : new Error("Failed to generate plan");
3132
3248
  setError(error2);
3133
3249
  setState("error");
3134
- _optionalChain([onError, 'optionalCall', _81 => _81(error2)]);
3250
+ _optionalChain([onError, 'optionalCall', _91 => _91(error2)]);
3135
3251
  }
3136
3252
  }
3137
3253
  return;
@@ -3142,7 +3258,7 @@ ${planningInstruction}` : planningInstruction;
3142
3258
  setStreamedContent("");
3143
3259
  setCommand("");
3144
3260
  setUploadedFiles([]);
3145
- _optionalChain([onStart, 'optionalCall', _82 => _82()]);
3261
+ _optionalChain([onStart, 'optionalCall', _92 => _92()]);
3146
3262
  try {
3147
3263
  if (useMock) {
3148
3264
  if (enableStreaming) {
@@ -3153,16 +3269,16 @@ ${planningInstruction}` : planningInstruction;
3153
3269
  if (chunk.type === "token" && chunk.content) {
3154
3270
  accumulatedContent += chunk.content;
3155
3271
  setStreamedContent(accumulatedContent);
3156
- _optionalChain([onChunk, 'optionalCall', _83 => _83(chunk.content)]);
3272
+ _optionalChain([onChunk, 'optionalCall', _93 => _93(chunk.content)]);
3157
3273
  const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
3158
3274
  setProgress(estimatedProgress);
3159
- _optionalChain([onProgress, 'optionalCall', _84 => _84(estimatedProgress)]);
3275
+ _optionalChain([onProgress, 'optionalCall', _94 => _94(estimatedProgress)]);
3160
3276
  } else if (chunk.type === "widget" && chunk.widget) {
3161
3277
  const widget = chunk.widget;
3162
3278
  setResult((prev) => ({
3163
3279
  success: true,
3164
- data: _optionalChain([prev, 'optionalAccess', _85 => _85.data]) || {},
3165
- widgets: [..._optionalChain([prev, 'optionalAccess', _86 => _86.widgets]) || [], widget],
3280
+ data: _optionalChain([prev, 'optionalAccess', _95 => _95.data]) || {},
3281
+ widgets: [..._optionalChain([prev, 'optionalAccess', _96 => _96.widgets]) || [], widget],
3166
3282
  message: accumulatedContent || "Command executed successfully"
3167
3283
  }));
3168
3284
  }
@@ -3182,19 +3298,19 @@ ${planningInstruction}` : planningInstruction;
3182
3298
  setResult(result2);
3183
3299
  setState("success");
3184
3300
  setProgress(100);
3185
- _optionalChain([onComplete, 'optionalCall', _87 => _87(result2)]);
3301
+ _optionalChain([onComplete, 'optionalCall', _97 => _97(result2)]);
3186
3302
  },
3187
3303
  (error2) => {
3188
3304
  setError(error2);
3189
3305
  setState("error");
3190
- _optionalChain([onError, 'optionalCall', _88 => _88(error2)]);
3306
+ _optionalChain([onError, 'optionalCall', _98 => _98(error2)]);
3191
3307
  }
3192
3308
  );
3193
3309
  } else {
3194
3310
  const progressInterval = setInterval(() => {
3195
3311
  setProgress((prev) => {
3196
3312
  const next = Math.min(prev + 10, 90);
3197
- _optionalChain([onProgress, 'optionalCall', _89 => _89(next)]);
3313
+ _optionalChain([onProgress, 'optionalCall', _99 => _99(next)]);
3198
3314
  return next;
3199
3315
  });
3200
3316
  }, 200);
@@ -3218,7 +3334,7 @@ ${planningInstruction}` : planningInstruction;
3218
3334
  setResult(result2);
3219
3335
  setState("success");
3220
3336
  setProgress(100);
3221
- _optionalChain([onComplete, 'optionalCall', _90 => _90(result2)]);
3337
+ _optionalChain([onComplete, 'optionalCall', _100 => _100(result2)]);
3222
3338
  }
3223
3339
  } else {
3224
3340
  if (enableStreaming) {
@@ -3264,16 +3380,16 @@ ${commandInstruction}` : commandInstruction;
3264
3380
  if (chunk.type === "token" && chunk.content) {
3265
3381
  accumulatedContent += chunk.content;
3266
3382
  setStreamedContent(accumulatedContent);
3267
- _optionalChain([onChunk, 'optionalCall', _91 => _91(chunk.content)]);
3383
+ _optionalChain([onChunk, 'optionalCall', _101 => _101(chunk.content)]);
3268
3384
  const estimatedProgress = Math.min(Math.round(accumulatedContent.length / 10), 90);
3269
3385
  setProgress(estimatedProgress);
3270
- _optionalChain([onProgress, 'optionalCall', _92 => _92(estimatedProgress)]);
3386
+ _optionalChain([onProgress, 'optionalCall', _102 => _102(estimatedProgress)]);
3271
3387
  } else if (chunk.type === "widget" && chunk.widget) {
3272
3388
  const widget = chunk.widget;
3273
3389
  setResult((prev) => ({
3274
3390
  success: true,
3275
- data: _optionalChain([prev, 'optionalAccess', _93 => _93.data]) || {},
3276
- widgets: [..._optionalChain([prev, 'optionalAccess', _94 => _94.widgets]) || [], widget],
3391
+ data: _optionalChain([prev, 'optionalAccess', _103 => _103.data]) || {},
3392
+ widgets: [..._optionalChain([prev, 'optionalAccess', _104 => _104.widgets]) || [], widget],
3277
3393
  message: accumulatedContent || "Command executed successfully"
3278
3394
  }));
3279
3395
  }
@@ -3293,20 +3409,20 @@ ${commandInstruction}` : commandInstruction;
3293
3409
  setResult(result2);
3294
3410
  setState("success");
3295
3411
  setProgress(100);
3296
- _optionalChain([onComplete, 'optionalCall', _95 => _95(result2)]);
3412
+ _optionalChain([onComplete, 'optionalCall', _105 => _105(result2)]);
3297
3413
  },
3298
3414
  (error2) => {
3299
3415
  const err = error2 instanceof Error ? error2 : new Error("Unknown error");
3300
3416
  setError(err);
3301
3417
  setState("error");
3302
- _optionalChain([onError, 'optionalCall', _96 => _96(err)]);
3418
+ _optionalChain([onError, 'optionalCall', _106 => _106(err)]);
3303
3419
  }
3304
3420
  );
3305
3421
  } else {
3306
3422
  const progressInterval = setInterval(() => {
3307
3423
  setProgress((prev) => {
3308
3424
  const next = Math.min(prev + 10, 90);
3309
- _optionalChain([onProgress, 'optionalCall', _97 => _97(next)]);
3425
+ _optionalChain([onProgress, 'optionalCall', _107 => _107(next)]);
3310
3426
  return next;
3311
3427
  });
3312
3428
  }, 200);
@@ -3362,14 +3478,14 @@ ${commandInstruction}` : commandInstruction;
3362
3478
  setResult(result2);
3363
3479
  setState("success");
3364
3480
  setProgress(100);
3365
- _optionalChain([onComplete, 'optionalCall', _98 => _98(result2)]);
3481
+ _optionalChain([onComplete, 'optionalCall', _108 => _108(result2)]);
3366
3482
  }
3367
3483
  }
3368
3484
  } catch (err) {
3369
3485
  const error2 = err instanceof Error ? err : new Error("Unknown error");
3370
3486
  setError(error2);
3371
3487
  setState("error");
3372
- _optionalChain([onError, 'optionalCall', _99 => _99(error2)]);
3488
+ _optionalChain([onError, 'optionalCall', _109 => _109(error2)]);
3373
3489
  }
3374
3490
  };
3375
3491
  const resetCommand = () => {
@@ -3402,14 +3518,14 @@ ${planToExecute}`;
3402
3518
  };
3403
3519
  const handleFileSelect = async (e) => {
3404
3520
  if (e.target.files && e.target.files.length > 0) {
3405
- _optionalChain([onFileUpload, 'optionalCall', _100 => _100(e.target.files)]);
3521
+ _optionalChain([onFileUpload, 'optionalCall', _110 => _110(e.target.files)]);
3406
3522
  const files = [];
3407
3523
  for (let i = 0; i < e.target.files.length; i++) {
3408
3524
  const file = e.target.files[i];
3409
3525
  const reader = new FileReader();
3410
3526
  await new Promise((resolve) => {
3411
3527
  reader.onload = (event) => {
3412
- if (_optionalChain([event, 'access', _101 => _101.target, 'optionalAccess', _102 => _102.result])) {
3528
+ if (_optionalChain([event, 'access', _111 => _111.target, 'optionalAccess', _112 => _112.result])) {
3413
3529
  const fullDataUrl = event.target.result;
3414
3530
  const base64Data = fullDataUrl.split(",")[1];
3415
3531
  if (file.type.startsWith("image/")) {
@@ -3503,7 +3619,7 @@ ${planToExecute}`;
3503
3619
  enableFileUpload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3504
3620
  "button",
3505
3621
  {
3506
- onClick: () => _optionalChain([fileInputRef, 'access', _103 => _103.current, 'optionalAccess', _104 => _104.click, 'call', _105 => _105()]),
3622
+ onClick: () => _optionalChain([fileInputRef, 'access', _113 => _113.current, 'optionalAccess', _114 => _114.click, 'call', _115 => _115()]),
3507
3623
  className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-neutral-500 dark:!text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800",
3508
3624
  title: "Attach file",
3509
3625
  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)" }) })
@@ -3722,7 +3838,7 @@ ${planToExecute}`;
3722
3838
  /* @__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" }) }),
3723
3839
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { children: [
3724
3840
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { className: "text-sm font-semibold text-red-800 dark:text-red-400", children: "Error" }),
3725
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess', _106 => _106.message]) })
3841
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-red-700 dark:text-red-300 text-sm mt-1", children: _optionalChain([error, 'optionalAccess', _116 => _116.message]) })
3726
3842
  ] })
3727
3843
  ] }) }),
3728
3844
  allowInput && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -3750,7 +3866,7 @@ ${planToExecute}`;
3750
3866
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { className: "text-green-700 dark:text-green-300 text-sm", children: "Command executed successfully" })
3751
3867
  ] })
3752
3868
  ] }),
3753
- _optionalChain([result, 'access', _107 => _107.data, 'optionalAccess', _108 => _108.summary]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-neutral-700 dark:text-neutral-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
3869
+ _optionalChain([result, 'access', _117 => _117.data, 'optionalAccess', _118 => _118.summary]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "text-neutral-700 dark:text-neutral-300 text-sm leading-relaxed whitespace-pre-line", children: result.data.summary }),
3754
3870
  result.widgets && result.widgets.length > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "space-y-3", children: result.widgets.map((widget) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3755
3871
  WidgetRenderer,
3756
3872
  {
@@ -3801,7 +3917,7 @@ ${planToExecute}`;
3801
3917
  enableFileUpload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
3802
3918
  "button",
3803
3919
  {
3804
- onClick: () => _optionalChain([fileInputRef, 'access', _109 => _109.current, 'optionalAccess', _110 => _110.click, 'call', _111 => _111()]),
3920
+ onClick: () => _optionalChain([fileInputRef, 'access', _119 => _119.current, 'optionalAccess', _120 => _120.click, 'call', _121 => _121()]),
3805
3921
  className: "w-8 h-8 rounded-lg flex items-center justify-center transition-all flex-shrink-0 !text-neutral-500 dark:!text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800",
3806
3922
  title: "Attach file",
3807
3923
  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)" }) })
@@ -3987,25 +4103,25 @@ function Prompt({
3987
4103
  const newValue = e.target.value;
3988
4104
  if (!maxLength || newValue.length <= maxLength) {
3989
4105
  setValue(newValue);
3990
- _optionalChain([onChange, 'optionalCall', _112 => _112(newValue)]);
4106
+ _optionalChain([onChange, 'optionalCall', _122 => _122(newValue)]);
3991
4107
  }
3992
4108
  };
3993
4109
  const handleSubmit = async () => {
3994
4110
  if (value.length < minLength) return;
3995
- _optionalChain([onSubmit, 'optionalCall', _113 => _113(value)]);
4111
+ _optionalChain([onSubmit, 'optionalCall', _123 => _123(value)]);
3996
4112
  setIsLoading(true);
3997
4113
  try {
3998
4114
  if (useMock) {
3999
4115
  await new Promise((resolve) => setTimeout(resolve, 1500));
4000
4116
  const mockResult = `Enhanced version: ${value} [AI-generated content]`;
4001
- _optionalChain([onResult, 'optionalCall', _114 => _114(mockResult)]);
4117
+ _optionalChain([onResult, 'optionalCall', _124 => _124(mockResult)]);
4002
4118
  setValue("");
4003
4119
  } else {
4004
4120
  const response = await aptevaClient.chat({
4005
4121
  agent_id: agentId,
4006
4122
  message: value
4007
4123
  });
4008
- _optionalChain([onResult, 'optionalCall', _115 => _115(response.message)]);
4124
+ _optionalChain([onResult, 'optionalCall', _125 => _125(response.message)]);
4009
4125
  setValue("");
4010
4126
  }
4011
4127
  } catch (error) {
@@ -4100,7 +4216,7 @@ function Stream({
4100
4216
  }, [autoStart]);
4101
4217
  const startStreaming = async () => {
4102
4218
  setIsStreaming(true);
4103
- _optionalChain([onStart, 'optionalCall', _116 => _116()]);
4219
+ _optionalChain([onStart, 'optionalCall', _126 => _126()]);
4104
4220
  try {
4105
4221
  if (useMock) {
4106
4222
  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.";
@@ -4108,13 +4224,13 @@ function Stream({
4108
4224
  mockText,
4109
4225
  (chunk) => {
4110
4226
  setText((prev) => prev + chunk);
4111
- _optionalChain([onChunk, 'optionalCall', _117 => _117(chunk)]);
4227
+ _optionalChain([onChunk, 'optionalCall', _127 => _127(chunk)]);
4112
4228
  },
4113
4229
  typingSpeed
4114
4230
  );
4115
4231
  setIsComplete(true);
4116
4232
  setIsStreaming(false);
4117
- _optionalChain([onComplete, 'optionalCall', _118 => _118(text + mockText)]);
4233
+ _optionalChain([onComplete, 'optionalCall', _128 => _128(text + mockText)]);
4118
4234
  } else {
4119
4235
  let accumulatedText = "";
4120
4236
  await aptevaClient.chatStream(
@@ -4127,24 +4243,24 @@ function Stream({
4127
4243
  if (chunk.type === "token" && chunk.content) {
4128
4244
  accumulatedText += chunk.content;
4129
4245
  setText(accumulatedText);
4130
- _optionalChain([onChunk, 'optionalCall', _119 => _119(chunk.content)]);
4246
+ _optionalChain([onChunk, 'optionalCall', _129 => _129(chunk.content)]);
4131
4247
  }
4132
4248
  },
4133
4249
  () => {
4134
4250
  setIsComplete(true);
4135
4251
  setIsStreaming(false);
4136
- _optionalChain([onComplete, 'optionalCall', _120 => _120(accumulatedText)]);
4252
+ _optionalChain([onComplete, 'optionalCall', _130 => _130(accumulatedText)]);
4137
4253
  },
4138
4254
  (error) => {
4139
4255
  const err = error instanceof Error ? error : new Error("Streaming error");
4140
- _optionalChain([onError, 'optionalCall', _121 => _121(err)]);
4256
+ _optionalChain([onError, 'optionalCall', _131 => _131(err)]);
4141
4257
  setIsStreaming(false);
4142
4258
  }
4143
4259
  );
4144
4260
  }
4145
4261
  } catch (error) {
4146
4262
  const err = error instanceof Error ? error : new Error("Streaming error");
4147
- _optionalChain([onError, 'optionalCall', _122 => _122(err)]);
4263
+ _optionalChain([onError, 'optionalCall', _132 => _132(err)]);
4148
4264
  setIsStreaming(false);
4149
4265
  }
4150
4266
  };
@@ -4236,7 +4352,7 @@ function ThreadList({
4236
4352
  }) {
4237
4353
  const [searchQuery, setSearchQuery] = _react.useState.call(void 0, "");
4238
4354
  const filteredThreads = threads.filter(
4239
- (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access', _123 => _123.preview, 'optionalAccess', _124 => _124.toLowerCase, 'call', _125 => _125(), 'access', _126 => _126.includes, 'call', _127 => _127(searchQuery.toLowerCase())])
4355
+ (thread) => thread.title.toLowerCase().includes(searchQuery.toLowerCase()) || _optionalChain([thread, 'access', _133 => _133.preview, 'optionalAccess', _134 => _134.toLowerCase, 'call', _135 => _135(), 'access', _136 => _136.includes, 'call', _137 => _137(searchQuery.toLowerCase())])
4240
4356
  );
4241
4357
  const groupedThreads = groupBy === "date" ? groupThreadsByDate(filteredThreads) : { All: filteredThreads };
4242
4358
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "flex flex-col h-full", children: [
@@ -4258,8 +4374,8 @@ function ThreadList({
4258
4374
  {
4259
4375
  thread,
4260
4376
  isActive: thread.id === currentThreadId,
4261
- onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _128 => _128(thread.id)]),
4262
- onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _129 => _129(thread.id)])
4377
+ onSelect: () => _optionalChain([onThreadSelect, 'optionalCall', _138 => _138(thread.id)]),
4378
+ onDelete: () => _optionalChain([onThreadDelete, 'optionalCall', _139 => _139(thread.id)])
4263
4379
  },
4264
4380
  thread.id
4265
4381
  ))
@@ -4321,7 +4437,7 @@ function Threads({
4321
4437
  threads.slice(0, 5).map((thread) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
4322
4438
  "button",
4323
4439
  {
4324
- onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _130 => _130(thread.id)]),
4440
+ onClick: () => _optionalChain([onThreadSelect, 'optionalCall', _140 => _140(thread.id)]),
4325
4441
  className: cn(
4326
4442
  "px-4 py-2 whitespace-nowrap font-medium transition-colors",
4327
4443
  thread.id === currentThreadId ? "border-b-2 border-apteva-500 text-apteva-500" : "text-neutral-600 hover:text-neutral-900"