@devalok/shilp-sutra-karm 0.17.0 → 0.18.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.
@@ -1,157 +1,130 @@
1
1
  "use client";
2
- import { jsx as e, jsxs as s, Fragment as q } from "react/jsx-runtime";
3
- import * as k from "react";
4
- import { useRef as R, useEffect as X, useState as A, useCallback as T } from "react";
5
- import { Sheet as Y, SheetContent as J, SheetTitle as Q } from "@devalok/shilp-sutra/ui/sheet";
6
- import { cn as b } from "@devalok/shilp-sutra/ui/lib/utils";
7
- import { springs as w } from "@devalok/shilp-sutra/ui/lib/motion";
8
- import { u as W } from "./use-composed-ref.js";
9
- import { M as P, A as Z, m as N } from "./vendor.js";
10
- import { IconRobot as C, IconAlertCircle as $, IconUser as O, IconSquare as S, IconSend as ee, IconMessagePlus as L, IconMessage as se, IconArchive as ae, IconTrash as re, IconChevronDown as te, IconHistory as le, IconX as de } from "@tabler/icons-react";
2
+ import { jsxs as s, jsx as e, Fragment as X } from "react/jsx-runtime";
3
+ import * as w from "react";
4
+ import { useRef as R, useEffect as Y, useState as P, useCallback as T } from "react";
5
+ import { Sheet as _, SheetContent as J, SheetTitle as Q } from "@devalok/shilp-sutra/ui/sheet";
6
+ import { AnimatePresence as W, motion as g } from "framer-motion";
7
+ import { cn as x } from "@devalok/shilp-sutra/ui/lib/utils";
8
+ import { springs as v } from "@devalok/shilp-sutra/ui/lib/motion";
9
+ import { u as Z } from "./use-composed-ref.js";
10
+ import { m as A } from "./markdown-components.js";
11
+ import { M as L } from "./vendor.js";
12
+ import { IconRobot as C, IconAlertCircle as $, IconUser as O, IconSquare as S, IconSend as ee, IconMessagePlus as E, IconMessage as se, IconArchive as ae, IconTrash as re, IconChevronDown as te, IconHistory as ie, IconX as le } from "@tabler/icons-react";
11
13
  import { Button as D } from "@devalok/shilp-sutra/ui/button";
12
- import { formatRelativeTime as ce } from "@devalok/shilp-sutra/ui/lib/date-utils";
13
- import { DropdownMenu as ie, DropdownMenuTrigger as ne, DropdownMenuContent as oe, DropdownMenuItem as me } from "@devalok/shilp-sutra/ui";
14
- const H = {
15
- p: ({ children: a }) => /* @__PURE__ */ e("p", { className: "mb-ds-03 last:mb-0", children: a }),
16
- code: ({
17
- children: a,
18
- className: t
19
- }) => (t == null ? void 0 : t.includes("language-")) ? /* @__PURE__ */ e("code", { className: t, children: a }) : /* @__PURE__ */ e("code", { className: "rounded bg-surface-3 px-ds-02 py-ds-01 text-ds-md", children: a }),
20
- pre: ({ children: a }) => /* @__PURE__ */ e("pre", { className: "mb-ds-03 overflow-x-auto rounded-ds-lg bg-surface-3 p-ds-04 text-ds-md", children: a }),
21
- ul: ({ children: a }) => /* @__PURE__ */ e("ul", { className: "mb-ds-03 list-disc pl-ds-05", children: a }),
22
- ol: ({ children: a }) => /* @__PURE__ */ e("ol", { className: "mb-ds-03 list-decimal pl-ds-05", children: a }),
23
- li: ({ children: a }) => /* @__PURE__ */ e("li", { className: "mb-ds-02", children: a }),
24
- strong: ({ children: a }) => /* @__PURE__ */ e("strong", { className: "font-semibold", children: a }),
25
- a: ({
26
- href: a,
27
- children: t,
28
- ...c
29
- }) => {
30
- const d = a && /^(https?:\/\/|mailto:)/i.test(a) ? a : "#";
31
- return /* @__PURE__ */ e(
32
- "a",
33
- {
34
- href: d,
35
- target: "_blank",
36
- rel: "noopener noreferrer",
37
- className: "text-accent-11 underline hover:text-accent-12",
38
- ...c,
39
- children: t
40
- }
41
- );
42
- }
43
- }, E = k.forwardRef(
44
- function({ text: t, isComplete: c = !1, className: d, ...u }, n) {
45
- return /* @__PURE__ */ s("div", { ref: n, className: b(d), ...u, "aria-live": "off", children: [
46
- /* @__PURE__ */ e(P, { components: H, children: t }),
47
- !c && /* @__PURE__ */ e("span", { className: "inline-block h-4 w-2 animate-pulse bg-surface-fg-muted ml-ds-01" }),
14
+ import { formatRelativeTime as de } from "@devalok/shilp-sutra/ui/lib/date-utils";
15
+ import { DropdownMenu as ce, DropdownMenuTrigger as ne, DropdownMenuContent as oe, DropdownMenuItem as me } from "@devalok/shilp-sutra/ui";
16
+ const H = w.forwardRef(
17
+ function({ text: l, isComplete: d = !1, className: i, ...f }, c) {
18
+ return /* @__PURE__ */ s("div", { ref: c, className: x(i), ...f, "aria-live": "off", children: [
19
+ /* @__PURE__ */ e(L, { components: A, children: l }),
20
+ !d && /* @__PURE__ */ e("span", { className: "inline-block h-4 w-2 animate-pulse bg-surface-fg-muted ml-ds-01" }),
48
21
  /* @__PURE__ */ e(
49
22
  "span",
50
23
  {
51
24
  className: "sr-only",
52
25
  "aria-live": "polite",
53
26
  "aria-atomic": "true",
54
- children: c ? t : ""
27
+ children: d ? l : ""
55
28
  }
56
29
  )
57
30
  ] });
58
31
  }
59
32
  );
60
- E.displayName = "StreamingText";
61
- const K = k.forwardRef(
33
+ H.displayName = "StreamingText";
34
+ const K = w.forwardRef(
62
35
  function({
63
- messages: t,
64
- isStreaming: c = !1,
65
- streamingText: d = "",
66
- isLoadingMessages: u = !1,
67
- emptyTitle: n = "Karm AI",
68
- emptyDescription: h = "Ask me about tasks, projects, attendance, or anything else.",
69
- className: m,
70
- ...f
71
- }, o) {
72
- const p = R(null), i = W(p, o);
73
- return X(() => {
74
- const r = p.current;
75
- r && (r.scrollTop = r.scrollHeight);
76
- }, [t, d]), u ? /* @__PURE__ */ e("div", { ref: o, className: b("flex flex-1 items-center justify-center", m), ...f, children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-ds-03", children: [
36
+ messages: l,
37
+ isStreaming: d = !1,
38
+ streamingText: i = "",
39
+ isLoadingMessages: f = !1,
40
+ emptyTitle: c = "Karm AI",
41
+ emptyDescription: u = "Ask me about tasks, projects, attendance, or anything else.",
42
+ className: o,
43
+ ...m
44
+ }, n) {
45
+ const h = R(null), t = Z(h, n);
46
+ return Y(() => {
47
+ const a = h.current;
48
+ a && (a.scrollTop = a.scrollHeight);
49
+ }, [l, i]), f ? /* @__PURE__ */ e("div", { ref: n, className: x("flex flex-1 items-center justify-center", o), ...m, children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-ds-03", children: [
77
50
  /* @__PURE__ */ e("div", { className: "h-ds-xs w-ds-xs animate-spin rounded-ds-full border-2 border-surface-border border-t-transparent" }),
78
51
  /* @__PURE__ */ e("p", { className: "text-ds-sm text-surface-fg-subtle", children: "Loading messages..." })
79
- ] }) }) : t.length === 0 && !c ? /* @__PURE__ */ e("div", { ref: o, className: b("flex flex-1 items-center justify-center p-ds-06", m), ...f, children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-ds-04 text-center", children: [
52
+ ] }) }) : l.length === 0 && !d ? /* @__PURE__ */ e("div", { ref: n, className: x("flex flex-1 items-center justify-center p-ds-06", o), ...m, children: /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-ds-04 text-center", children: [
80
53
  /* @__PURE__ */ e("div", { className: "flex h-ds-lg w-ds-lg items-center justify-center rounded-ds-full bg-surface-3", children: /* @__PURE__ */ e(C, { className: "h-ico-lg w-ico-lg text-surface-fg-muted" }) }),
81
- /* @__PURE__ */ e("h3", { className: "text-ds-base text-surface-fg", children: n }),
82
- /* @__PURE__ */ e("p", { className: "text-ds-sm max-w-[280px] text-surface-fg-subtle", children: h })
83
- ] }) }) : /* @__PURE__ */ e("div", { ref: i, className: b("no-scrollbar flex-1 overflow-y-auto p-ds-05", m), ...f, children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-ds-05", role: "log", "aria-label": "Chat messages", children: /* @__PURE__ */ s(Z, { initial: !1, children: [
84
- t.map((r) => r.role === "SYSTEM" ? /* @__PURE__ */ e(
85
- N.div,
54
+ /* @__PURE__ */ e("h3", { className: "text-ds-base text-surface-fg", children: c }),
55
+ /* @__PURE__ */ e("p", { className: "text-ds-sm max-w-[280px] text-surface-fg-subtle", children: u })
56
+ ] }) }) : /* @__PURE__ */ e("div", { ref: t, className: x("no-scrollbar flex-1 overflow-y-auto p-ds-05", o), ...m, children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-ds-05", role: "log", "aria-label": "Chat messages", children: /* @__PURE__ */ s(W, { initial: !1, children: [
57
+ l.map((a) => a.role === "SYSTEM" ? /* @__PURE__ */ e(
58
+ g.div,
86
59
  {
87
60
  initial: { opacity: 0, y: 10 },
88
61
  animate: { opacity: 1, y: 0 },
89
- transition: w.snappy,
62
+ transition: v.snappy,
90
63
  className: "flex justify-center",
91
64
  children: /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03 rounded-ds-lg bg-error-3 px-ds-04 py-ds-03", children: [
92
65
  /* @__PURE__ */ e($, { className: "h-ico-sm w-ico-sm shrink-0 text-error-11" }),
93
- /* @__PURE__ */ e("p", { className: "text-ds-sm text-error-11", children: r.content })
66
+ /* @__PURE__ */ e("p", { className: "text-ds-sm text-error-11", children: a.content })
94
67
  ] })
95
68
  },
96
- r.id
97
- ) : r.role === "USER" ? /* @__PURE__ */ e(
98
- N.div,
69
+ a.id
70
+ ) : a.role === "USER" ? /* @__PURE__ */ e(
71
+ g.div,
99
72
  {
100
73
  initial: { opacity: 0, y: 10 },
101
74
  animate: { opacity: 1, y: 0 },
102
- transition: w.snappy,
75
+ transition: v.snappy,
103
76
  className: "flex justify-end",
104
77
  children: /* @__PURE__ */ s("div", { className: "flex max-w-[85%] items-start gap-ds-03", children: [
105
- /* @__PURE__ */ e("div", { className: "rounded-ds-2xl rounded-br-ds-sm bg-accent-9 px-ds-04 py-ds-03 text-accent-fg", children: /* @__PURE__ */ e("p", { className: "text-ds-md whitespace-pre-wrap", children: r.content }) }),
78
+ /* @__PURE__ */ e("div", { className: "rounded-ds-2xl rounded-br-ds-sm bg-accent-9 px-ds-04 py-ds-03 text-accent-fg", children: /* @__PURE__ */ e("p", { className: "text-ds-md whitespace-pre-wrap", children: a.content }) }),
106
79
  /* @__PURE__ */ e("div", { className: "flex h-ds-xs-plus w-ds-xs-plus shrink-0 items-center justify-center rounded-ds-full bg-surface-3", children: /* @__PURE__ */ e(O, { className: "h-ico-sm w-ico-sm text-surface-fg-muted" }) })
107
80
  ] })
108
81
  },
109
- r.id
82
+ a.id
110
83
  ) : /* @__PURE__ */ e(
111
- N.div,
84
+ g.div,
112
85
  {
113
86
  initial: { opacity: 0, y: 10 },
114
87
  animate: { opacity: 1, y: 0 },
115
- transition: w.snappy,
88
+ transition: v.snappy,
116
89
  className: "flex justify-start",
117
90
  children: /* @__PURE__ */ s("div", { className: "flex max-w-[85%] items-start gap-ds-03", children: [
118
91
  /* @__PURE__ */ e("div", { className: "flex h-ds-xs-plus w-ds-xs-plus shrink-0 items-center justify-center rounded-ds-full bg-surface-3", children: /* @__PURE__ */ e(C, { className: "h-ico-sm w-ico-sm text-surface-fg-muted" }) }),
119
- /* @__PURE__ */ e("div", { className: "rounded-ds-2xl rounded-bl-ds-sm bg-surface-3 px-ds-04 py-ds-03", children: /* @__PURE__ */ e("div", { className: "text-ds-md text-surface-fg", children: /* @__PURE__ */ e(P, { components: H, children: r.content }) }) })
92
+ /* @__PURE__ */ e("div", { className: "rounded-ds-2xl rounded-bl-ds-sm bg-surface-3 px-ds-04 py-ds-03", children: /* @__PURE__ */ e("div", { className: "text-ds-md text-surface-fg", children: /* @__PURE__ */ e(L, { components: A, children: a.content }) }) })
120
93
  ] })
121
94
  },
122
- r.id
95
+ a.id
123
96
  )),
124
- c && d && /* @__PURE__ */ e(
125
- N.div,
97
+ d && i && /* @__PURE__ */ e(
98
+ g.div,
126
99
  {
127
100
  initial: { opacity: 0, y: 10 },
128
101
  animate: { opacity: 1, y: 0 },
129
- transition: w.snappy,
102
+ transition: v.snappy,
130
103
  className: "flex justify-start",
131
104
  children: /* @__PURE__ */ s("div", { className: "flex max-w-[85%] items-start gap-ds-03", children: [
132
105
  /* @__PURE__ */ e("div", { className: "flex h-ds-xs-plus w-ds-xs-plus shrink-0 items-center justify-center rounded-ds-full bg-surface-3", children: /* @__PURE__ */ e(C, { className: "h-ico-sm w-ico-sm text-surface-fg-muted" }) }),
133
- /* @__PURE__ */ e("div", { className: "rounded-ds-2xl rounded-bl-ds-sm bg-surface-3 px-ds-04 py-ds-03", children: /* @__PURE__ */ e("div", { className: "text-ds-md text-surface-fg", children: /* @__PURE__ */ e(E, { text: d }) }) })
106
+ /* @__PURE__ */ e("div", { className: "rounded-ds-2xl rounded-bl-ds-sm bg-surface-3 px-ds-04 py-ds-03", children: /* @__PURE__ */ e("div", { className: "text-ds-md text-surface-fg", children: /* @__PURE__ */ e(H, { text: i }) }) })
134
107
  ] })
135
108
  },
136
109
  "streaming-text"
137
110
  ),
138
- c && !d && /* @__PURE__ */ e(
139
- N.div,
111
+ d && !i && /* @__PURE__ */ e(
112
+ g.div,
140
113
  {
141
114
  initial: { opacity: 0, y: 10 },
142
115
  animate: { opacity: 1, y: 0 },
143
- transition: w.snappy,
116
+ transition: v.snappy,
144
117
  className: "flex justify-start",
145
118
  children: /* @__PURE__ */ s("div", { className: "flex max-w-[85%] items-start gap-ds-03", children: [
146
119
  /* @__PURE__ */ e("div", { className: "flex h-ds-xs-plus w-ds-xs-plus shrink-0 items-center justify-center rounded-ds-full bg-surface-3", children: /* @__PURE__ */ e(C, { className: "h-ico-sm w-ico-sm text-surface-fg-muted" }) }),
147
- /* @__PURE__ */ e("div", { className: "rounded-ds-2xl rounded-bl-ds-sm bg-surface-3 px-ds-04 py-ds-03", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-ds-02b py-ds-02", children: [0, 1, 2].map((r) => /* @__PURE__ */ e(
148
- N.span,
120
+ /* @__PURE__ */ e("div", { className: "rounded-ds-2xl rounded-bl-ds-sm bg-surface-3 px-ds-04 py-ds-03", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-ds-02b py-ds-02", children: [0, 1, 2].map((a) => /* @__PURE__ */ e(
121
+ g.span,
149
122
  {
150
123
  className: "h-2 w-2 rounded-ds-full bg-surface-fg-subtle",
151
124
  animate: { y: [0, -4, 0] },
152
- transition: { duration: 0.6, repeat: 1 / 0, delay: r * 0.15 }
125
+ transition: { duration: 0.6, repeat: 1 / 0, delay: a * 0.15 }
153
126
  },
154
- r
127
+ a
155
128
  )) }) })
156
129
  ] })
157
130
  },
@@ -161,119 +134,119 @@ const K = k.forwardRef(
161
134
  }
162
135
  );
163
136
  K.displayName = "MessageList";
164
- const U = k.forwardRef(
137
+ const U = w.forwardRef(
165
138
  function({
166
- onSubmit: t,
167
- onCancel: c,
168
- isStreaming: d = !1,
169
- placeholder: u = "Ask Karm AI...",
170
- disclaimer: n = "AI responses may be inaccurate. Verify important information.",
171
- className: h,
172
- ...m
173
- }, f) {
174
- const [o, p] = A(""), i = R(null), r = T(() => {
175
- const l = i.current;
176
- l && (l.style.height = "auto", l.style.height = Math.min(l.scrollHeight, 160) + "px");
139
+ onSubmit: l,
140
+ onCancel: d,
141
+ isStreaming: i = !1,
142
+ placeholder: f = "Ask Karm AI...",
143
+ disclaimer: c = "AI responses may be inaccurate. Verify important information.",
144
+ className: u,
145
+ ...o
146
+ }, m) {
147
+ const [n, h] = P(""), t = R(null), a = T(() => {
148
+ const r = t.current;
149
+ r && (r.style.height = "auto", r.style.height = Math.min(r.scrollHeight, 160) + "px");
177
150
  }, []), y = T(() => {
178
- const l = o.trim();
179
- !l || d || (p(""), i.current && (i.current.style.height = "auto"), t(l));
180
- }, [o, d, t]), v = T(
181
- (l) => {
182
- l.key === "Enter" && !l.shiftKey && (l.preventDefault(), y());
151
+ const r = n.trim();
152
+ !r || i || (h(""), t.current && (t.current.style.height = "auto"), l(r));
153
+ }, [n, i, l]), N = T(
154
+ (r) => {
155
+ r.key === "Enter" && !r.shiftKey && (r.preventDefault(), y());
183
156
  },
184
157
  [y]
185
158
  );
186
- return /* @__PURE__ */ s("div", { ref: f, className: b("border-t border-surface-border-strong bg-surface-1 p-ds-04", h), ...m, children: [
159
+ return /* @__PURE__ */ s("div", { ref: m, className: x("border-t border-surface-border-strong bg-surface-1 p-ds-04", u), ...o, children: [
187
160
  /* @__PURE__ */ s("div", { className: "flex items-end gap-ds-03 rounded-ds-xl border border-surface-border-strong bg-surface-3 px-ds-04 py-ds-03", children: [
188
161
  /* @__PURE__ */ e(
189
162
  "textarea",
190
163
  {
191
- ref: i,
192
- value: o,
193
- onChange: (l) => {
194
- p(l.target.value), r();
164
+ ref: t,
165
+ value: n,
166
+ onChange: (r) => {
167
+ h(r.target.value), a();
195
168
  },
196
- onKeyDown: v,
197
- placeholder: u,
169
+ onKeyDown: N,
170
+ placeholder: f,
198
171
  "aria-label": "Type a message",
199
- disabled: d,
172
+ disabled: i,
200
173
  rows: 1,
201
174
  className: "text-ds-md no-scrollbar max-h-[160px] min-h-ds-xs flex-1 resize-none bg-transparent text-surface-fg placeholder:text-surface-fg-subtle focus:outline-none disabled:opacity-action-disabled"
202
175
  }
203
176
  ),
204
- d ? /* @__PURE__ */ e(D, { variant: "solid", color: "error", size: "icon-sm", className: "h-ds-sm w-ds-sm shrink-0 rounded-ds-lg", onClick: c, "aria-label": "Stop generating", children: /* @__PURE__ */ e(S, { className: "h-ico-sm w-ico-sm" }) }) : /* @__PURE__ */ e(D, { size: "icon-sm", className: "h-ds-sm w-ds-sm shrink-0 rounded-ds-lg", onClick: y, disabled: !o.trim(), "aria-label": "Send message", children: /* @__PURE__ */ e(ee, { className: "h-ico-sm w-ico-sm" }) })
177
+ i ? /* @__PURE__ */ e(D, { variant: "solid", color: "error", size: "icon-sm", className: "h-ds-sm w-ds-sm shrink-0 rounded-ds-lg", onClick: d, "aria-label": "Stop generating", children: /* @__PURE__ */ e(S, { className: "h-ico-sm w-ico-sm" }) }) : /* @__PURE__ */ e(D, { size: "icon-sm", className: "h-ds-sm w-ds-sm shrink-0 rounded-ds-lg", onClick: y, disabled: !n.trim(), "aria-label": "Send message", children: /* @__PURE__ */ e(ee, { className: "h-ico-sm w-ico-sm" }) })
205
178
  ] }),
206
- n && /* @__PURE__ */ e("p", { className: "text-ds-sm mt-ds-02b text-center text-surface-fg-subtle", children: n })
179
+ c && /* @__PURE__ */ e("p", { className: "text-ds-sm mt-ds-02b text-center text-surface-fg-subtle", children: c })
207
180
  ] });
208
181
  }
209
182
  );
210
183
  U.displayName = "ChatInput";
211
- const z = k.forwardRef(
184
+ const z = w.forwardRef(
212
185
  function({
213
- conversations: t,
214
- activeConversationId: c,
215
- isLoading: d = !1,
216
- onSelect: u,
217
- onNewChat: n,
218
- onArchive: h,
219
- onDelete: m,
220
- className: f,
221
- ...o
222
- }, p) {
223
- return /* @__PURE__ */ s("div", { ref: p, className: b("flex flex-1 flex-col overflow-hidden", f), ...o, children: [
186
+ conversations: l,
187
+ activeConversationId: d,
188
+ isLoading: i = !1,
189
+ onSelect: f,
190
+ onNewChat: c,
191
+ onArchive: u,
192
+ onDelete: o,
193
+ className: m,
194
+ ...n
195
+ }, h) {
196
+ return /* @__PURE__ */ s("div", { ref: h, className: x("flex flex-1 flex-col overflow-hidden", m), ...n, children: [
224
197
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between border-b border-surface-border-strong px-ds-05 py-ds-04", children: [
225
198
  /* @__PURE__ */ e("h3", { className: "text-ds-md font-semibold text-surface-fg", children: "Conversations" }),
226
199
  /* @__PURE__ */ s(
227
200
  "button",
228
201
  {
229
- onClick: n,
202
+ onClick: c,
230
203
  className: "flex items-center gap-ds-02b rounded-ds-lg px-ds-03 py-ds-02b text-surface-fg-muted transition-colors hover:bg-surface-2",
231
204
  children: [
232
- /* @__PURE__ */ e(L, { className: "h-ico-sm w-ico-sm" }),
205
+ /* @__PURE__ */ e(E, { className: "h-ico-sm w-ico-sm" }),
233
206
  /* @__PURE__ */ e("span", { className: "text-ds-sm", children: "New Chat" })
234
207
  ]
235
208
  }
236
209
  )
237
210
  ] }),
238
- /* @__PURE__ */ e("div", { className: "no-scrollbar flex-1 overflow-y-auto", children: d ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ e("div", { className: "h-ico-md w-ico-md animate-spin rounded-ds-full border-2 border-surface-border border-t-transparent" }) }) : t.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center gap-ds-03 py-12", children: [
211
+ /* @__PURE__ */ e("div", { className: "no-scrollbar flex-1 overflow-y-auto", children: i ? /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-12", children: /* @__PURE__ */ e("div", { className: "h-ico-md w-ico-md animate-spin rounded-ds-full border-2 border-surface-border border-t-transparent" }) }) : l.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center gap-ds-03 py-12", children: [
239
212
  /* @__PURE__ */ e(se, { className: "h-ds-sm w-ds-sm text-surface-fg-subtle" }),
240
213
  /* @__PURE__ */ e("p", { className: "text-ds-md text-surface-fg-subtle", children: "No conversations yet" })
241
- ] }) : /* @__PURE__ */ e("div", { className: "flex flex-col", children: t.map((i) => /* @__PURE__ */ s(
214
+ ] }) : /* @__PURE__ */ e("div", { className: "flex flex-col", children: l.map((t) => /* @__PURE__ */ s(
242
215
  "div",
243
216
  {
244
- className: b(
217
+ className: x(
245
218
  "group flex items-center gap-ds-04 border-b border-surface-border px-ds-05 py-ds-04 transition-colors hover:bg-surface-2",
246
- c === i.id && "bg-surface-2"
219
+ d === t.id && "bg-surface-2"
247
220
  ),
248
221
  children: [
249
222
  /* @__PURE__ */ s(
250
223
  "button",
251
224
  {
252
- onClick: () => u(i.id),
225
+ onClick: () => f(t.id),
253
226
  className: "flex min-w-0 flex-1 flex-col gap-ds-01 text-left",
254
227
  children: [
255
- /* @__PURE__ */ e("p", { className: "text-ds-md truncate text-surface-fg", children: i.title || "Untitled conversation" }),
256
- /* @__PURE__ */ e("p", { className: "text-ds-sm text-surface-fg-subtle", children: ce(i.updatedAt) })
228
+ /* @__PURE__ */ e("p", { className: "text-ds-md truncate text-surface-fg", children: t.title || "Untitled conversation" }),
229
+ /* @__PURE__ */ e("p", { className: "text-ds-sm text-surface-fg-subtle", children: de(t.updatedAt) })
257
230
  ]
258
231
  }
259
232
  ),
260
233
  /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-ds-02 opacity-0 transition-opacity group-hover:opacity-100", children: [
261
- h && /* @__PURE__ */ e(
234
+ u && /* @__PURE__ */ e(
262
235
  "button",
263
236
  {
264
- onClick: (r) => {
265
- r.stopPropagation(), h(i.id);
237
+ onClick: (a) => {
238
+ a.stopPropagation(), u(t.id);
266
239
  },
267
240
  className: "flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-surface-fg-subtle transition-colors hover:bg-surface-3 hover:text-surface-fg-muted",
268
241
  "aria-label": "Archive conversation",
269
242
  children: /* @__PURE__ */ e(ae, { className: "h-ico-sm w-ico-sm" })
270
243
  }
271
244
  ),
272
- m && /* @__PURE__ */ e(
245
+ o && /* @__PURE__ */ e(
273
246
  "button",
274
247
  {
275
- onClick: (r) => {
276
- r.stopPropagation(), m(i.id);
248
+ onClick: (a) => {
249
+ a.stopPropagation(), o(t.id);
277
250
  },
278
251
  className: "flex h-ds-xs-plus w-ds-xs-plus items-center justify-center rounded-ds-md text-surface-fg-subtle transition-colors hover:bg-error-3 hover:text-error-11",
279
252
  "aria-label": "Delete conversation",
@@ -283,7 +256,7 @@ const z = k.forwardRef(
283
256
  ] })
284
257
  ]
285
258
  },
286
- i.id
259
+ t.id
287
260
  )) }) })
288
261
  ] });
289
262
  }
@@ -297,129 +270,129 @@ const fe = [
297
270
  { id: "vidwan", name: "Vidwan", desc: "Knowledge Expert" },
298
271
  { id: "sanchalak", name: "Sanchalak", desc: "Manager Advisor" },
299
272
  { id: "dwar-palak", name: "Dwar-Palak", desc: "Access Control" }
300
- ], ue = k.forwardRef(
273
+ ], ue = w.forwardRef(
301
274
  function({
302
- isOpen: t,
303
- onOpenChange: c,
304
- messages: d,
305
- conversations: u,
306
- agents: n = fe,
307
- selectedAgentId: h = "devadoot",
308
- activeConversationId: m,
309
- isStreaming: f = !1,
310
- streamingText: o = "",
311
- isLoadingMessages: p = !1,
312
- isLoadingConversations: i = !1,
313
- onSendMessage: r,
275
+ isOpen: l,
276
+ onOpenChange: d,
277
+ messages: i,
278
+ conversations: f,
279
+ agents: c = fe,
280
+ selectedAgentId: u = "devadoot",
281
+ activeConversationId: o,
282
+ isStreaming: m = !1,
283
+ streamingText: n = "",
284
+ isLoadingMessages: h = !1,
285
+ isLoadingConversations: t = !1,
286
+ onSendMessage: a,
314
287
  onCancelStream: y,
315
- onSelectAgent: v,
316
- onStartNewChat: l,
288
+ onSelectAgent: N,
289
+ onStartNewChat: r,
317
290
  onSelectConversation: I,
318
- onArchiveConversation: B,
319
- onDeleteConversation: F,
320
- className: G,
321
- ...V
322
- }, _) {
323
- const [M, j] = A(!1), g = n.find((x) => x.id === h) ?? n[0];
324
- return /* @__PURE__ */ e(Y, { open: t, onOpenChange: c, children: /* @__PURE__ */ s(
291
+ onArchiveConversation: F,
292
+ onDeleteConversation: G,
293
+ className: V,
294
+ ...q
295
+ }, B) {
296
+ const [M, j] = P(!1), b = c.find((p) => p.id === u) ?? c[0];
297
+ return /* @__PURE__ */ e(_, { open: l, onOpenChange: d, children: /* @__PURE__ */ s(
325
298
  J,
326
299
  {
327
- ref: _,
300
+ ref: B,
328
301
  side: "right",
329
- className: b("flex w-full flex-col gap-0 border-l border-surface-border-strong bg-surface-1 p-0 sm:max-w-[480px] [&>button]:hidden", G),
330
- ...V,
302
+ className: x("flex w-full flex-col gap-0 border-l border-surface-border-strong bg-surface-1 p-0 sm:max-w-[480px] [&>button]:hidden", V),
303
+ ...q,
331
304
  children: [
332
305
  /* @__PURE__ */ e(Q, { className: "sr-only", children: "AI Chat" }),
333
306
  /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03 border-b border-surface-border-strong px-ds-05 py-ds-04", children: [
334
- /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ s(ie, { children: [
307
+ /* @__PURE__ */ e("div", { className: "flex-1", children: /* @__PURE__ */ s(ce, { children: [
335
308
  /* @__PURE__ */ e(ne, { asChild: !0, children: /* @__PURE__ */ s(
336
309
  "button",
337
310
  {
338
311
  className: "flex items-center gap-ds-02b rounded-ds-lg px-ds-03 py-ds-02b transition-colors hover:bg-surface-2",
339
312
  children: [
340
- /* @__PURE__ */ e("span", { className: "text-ds-base text-surface-fg", children: g == null ? void 0 : g.name }),
341
- /* @__PURE__ */ e("span", { className: "text-ds-sm text-surface-fg-subtle", children: g == null ? void 0 : g.desc }),
313
+ /* @__PURE__ */ e("span", { className: "text-ds-base text-surface-fg", children: b == null ? void 0 : b.name }),
314
+ /* @__PURE__ */ e("span", { className: "text-ds-sm text-surface-fg-subtle", children: b == null ? void 0 : b.desc }),
342
315
  /* @__PURE__ */ e(te, { className: "h-ico-sm w-ico-sm text-surface-fg-subtle" })
343
316
  ]
344
317
  }
345
318
  ) }),
346
- /* @__PURE__ */ e(oe, { align: "start", className: "w-64", children: n.map((x) => /* @__PURE__ */ e(
319
+ /* @__PURE__ */ e(oe, { align: "start", className: "w-64", children: c.map((p) => /* @__PURE__ */ e(
347
320
  me,
348
321
  {
349
- onClick: () => v == null ? void 0 : v(x.id),
350
- className: h === x.id ? "bg-surface-2" : "",
322
+ onClick: () => N == null ? void 0 : N(p.id),
323
+ className: u === p.id ? "bg-surface-2" : "",
351
324
  children: /* @__PURE__ */ s("div", { className: "flex flex-col", children: [
352
- /* @__PURE__ */ e("span", { className: "text-ds-md text-surface-fg", children: x.name }),
353
- /* @__PURE__ */ e("span", { className: "text-ds-sm text-surface-fg-subtle", children: x.desc })
325
+ /* @__PURE__ */ e("span", { className: "text-ds-md text-surface-fg", children: p.name }),
326
+ /* @__PURE__ */ e("span", { className: "text-ds-sm text-surface-fg-subtle", children: p.desc })
354
327
  ] })
355
328
  },
356
- x.id
329
+ p.id
357
330
  )) })
358
331
  ] }) }),
359
332
  /* @__PURE__ */ e(
360
333
  "button",
361
334
  {
362
335
  onClick: () => {
363
- l == null || l(), j(!1);
336
+ r == null || r(), j(!1);
364
337
  },
365
338
  className: "flex h-ds-sm w-ds-sm items-center justify-center rounded-ds-lg text-surface-fg-muted transition-colors hover:bg-surface-2",
366
339
  "aria-label": "New chat",
367
- children: /* @__PURE__ */ e(L, { className: "h-ico-sm w-ico-sm" })
340
+ children: /* @__PURE__ */ e(E, { className: "h-ico-sm w-ico-sm" })
368
341
  }
369
342
  ),
370
343
  /* @__PURE__ */ e(
371
344
  "button",
372
345
  {
373
346
  onClick: () => j(!M),
374
- className: b(
347
+ className: x(
375
348
  "flex h-ds-sm w-ds-sm items-center justify-center rounded-ds-lg transition-colors hover:bg-surface-2",
376
349
  M ? "bg-surface-2 text-surface-fg" : "text-surface-fg-muted"
377
350
  ),
378
351
  "aria-label": "Conversation history",
379
- children: /* @__PURE__ */ e(le, { className: "h-ico-sm w-ico-sm" })
352
+ children: /* @__PURE__ */ e(ie, { className: "h-ico-sm w-ico-sm" })
380
353
  }
381
354
  ),
382
355
  /* @__PURE__ */ e(
383
356
  "button",
384
357
  {
385
- onClick: () => c(!1),
358
+ onClick: () => d(!1),
386
359
  className: "flex h-ds-sm w-ds-sm items-center justify-center rounded-ds-lg text-surface-fg-muted transition-colors hover:bg-surface-2",
387
360
  "aria-label": "Close chat",
388
- children: /* @__PURE__ */ e(de, { className: "h-ico-sm w-ico-sm" })
361
+ children: /* @__PURE__ */ e(le, { className: "h-ico-sm w-ico-sm" })
389
362
  }
390
363
  )
391
364
  ] }),
392
365
  M ? /* @__PURE__ */ e(
393
366
  z,
394
367
  {
395
- conversations: u,
396
- activeConversationId: m,
397
- isLoading: i,
398
- onSelect: (x) => {
399
- I == null || I(x), j(!1);
368
+ conversations: f,
369
+ activeConversationId: o,
370
+ isLoading: t,
371
+ onSelect: (p) => {
372
+ I == null || I(p), j(!1);
400
373
  },
401
374
  onNewChat: () => {
402
- l == null || l(), j(!1);
375
+ r == null || r(), j(!1);
403
376
  },
404
- onArchive: B,
405
- onDelete: F
377
+ onArchive: F,
378
+ onDelete: G
406
379
  }
407
- ) : /* @__PURE__ */ s(q, { children: [
380
+ ) : /* @__PURE__ */ s(X, { children: [
408
381
  /* @__PURE__ */ e(
409
382
  K,
410
383
  {
411
- messages: d,
412
- isStreaming: f,
413
- streamingText: o,
414
- isLoadingMessages: p
384
+ messages: i,
385
+ isStreaming: m,
386
+ streamingText: n,
387
+ isLoadingMessages: h
415
388
  }
416
389
  ),
417
390
  /* @__PURE__ */ e(
418
391
  U,
419
392
  {
420
- onSubmit: r,
393
+ onSubmit: a,
421
394
  onCancel: y,
422
- isStreaming: f
395
+ isStreaming: m
423
396
  }
424
397
  )
425
398
  ] })
@@ -432,7 +405,7 @@ ue.displayName = "ChatPanel";
432
405
  export {
433
406
  U as C,
434
407
  K as M,
435
- E as S,
408
+ H as S,
436
409
  ue as a,
437
410
  z as b
438
411
  };