@levo-so/site-runtime 0.3.10 → 0.3.12

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,23 +1,23 @@
1
1
  "use client";
2
- import { _ as e, a as t, b as n, c as r, f as i, g as a, h as o, i as s, l as c, m as l, n as u, o as d, r as f, s as p, t as m, u as h, v as g, x as _, y as v } from "./pillChrome-_hpGdrBS.js";
3
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
4
- import { Children as S, createContext as C, isValidElement as w, useCallback as T, useContext as E, useEffect as D, useLayoutEffect as O, useRef as k, useState as A } from "react";
5
- import { ArrowUp as j, Check as M, ChevronDown as N, Copy as P, MessageSquarePlus as F, Mic as ee, RefreshCw as I, Sparkles as te, Square as L, X as R } from "lucide-react";
6
- import { ActionBarPrimitive as z, AssistantRuntimeProvider as ne, ComposerPrimitive as B, MessagePrimitive as V, ThreadPrimitive as H, WebSpeechDictationAdapter as re, useAui as U, useAuiState as W } from "@assistant-ui/react";
7
- import { AssistantChatTransport as ie, useChatRuntime as ae } from "@assistant-ui/react-ai-sdk";
8
- import { MarkdownTextPrimitive as oe } from "@assistant-ui/react-markdown";
9
- import se from "remark-gfm";
2
+ import { S as e, _ as t, a as n, b as r, c as i, f as a, g as o, h as s, i as c, l, m as u, n as d, o as f, r as p, s as m, t as h, u as g, v as _, x as v, y } from "./pillChrome-CEpWGNZB.js";
3
+ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
4
+ import { Children as C, createContext as w, isValidElement as T, useCallback as E, useContext as D, useEffect as O, useLayoutEffect as k, useRef as A, useState as j } from "react";
5
+ import { ArrowUp as M, Check as N, ChevronDown as P, Copy as F, MessageSquarePlus as I, Mic as L, RefreshCw as R, Sparkles as ee, Square as z, X as B } from "lucide-react";
6
+ import { ActionBarPrimitive as V, AssistantRuntimeProvider as te, ComposerPrimitive as H, MessagePrimitive as U, ThreadPrimitive as W, WebSpeechDictationAdapter as ne, useAui as G, useAuiState as K } from "@assistant-ui/react";
7
+ import { AssistantChatTransport as re, useChatRuntime as ie } from "@assistant-ui/react-ai-sdk";
8
+ import { MarkdownTextPrimitive as ae } from "@assistant-ui/react-markdown";
9
+ import oe from "remark-gfm";
10
10
  //#region ../../libraries/ai-chat/src/FollowUpChips.tsx
11
- var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipClassName: i }) => {
11
+ var q = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipClassName: i }) => {
12
12
  if (e.length === 0) return null;
13
13
  let a = [
14
14
  "rounded-full border border-zinc-200 bg-white text-zinc-700",
15
15
  "transition-all duration-150 hover:border-zinc-300 hover:bg-zinc-50 hover:text-zinc-900 active:scale-95",
16
16
  n === "compact" ? "px-2.5 py-1 text-[11px] leading-none" : "px-3.5 py-1.5 text-xs"
17
17
  ].join(" ");
18
- return /* @__PURE__ */ b("div", {
18
+ return /* @__PURE__ */ x("div", {
19
19
  className: ["flex flex-wrap gap-1.5", r].filter(Boolean).join(" "),
20
- children: e.map((e, n) => /* @__PURE__ */ b("button", {
20
+ children: e.map((e, n) => /* @__PURE__ */ x("button", {
21
21
  type: "button",
22
22
  onClick: () => t(e),
23
23
  className: ["ai-chat-chip", i ?? a].join(" "),
@@ -25,7 +25,7 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
25
25
  children: e
26
26
  }, `${n}-${e}`))
27
27
  });
28
- }, ce = ({ api: e, headers: t, credentials: n, getBody: r, getHeaders: i, onSendStart: a }) => new ie({
28
+ }, se = ({ api: e, headers: t, credentials: n, getBody: r, getHeaders: i, onSendStart: a }) => new re({
29
29
  api: e,
30
30
  headers: t,
31
31
  credentials: n,
@@ -36,11 +36,11 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
36
36
  ...i?.(e)
37
37
  }
38
38
  })
39
- }), le = (e) => {
40
- let t = k(null), n = k(null);
39
+ }), ce = (e) => {
40
+ let t = A(null), n = A(null);
41
41
  return n.current !== (e ?? null) && (n.current = e ?? null, t.current = null), {
42
42
  conversationIdRef: t,
43
- handleFinish: T(({ message: e }) => {
43
+ handleFinish: E(({ message: e }) => {
44
44
  let n = e.metadata;
45
45
  if (!n || typeof n != "object") return;
46
46
  let r = n.conversation_id;
@@ -48,33 +48,33 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
48
48
  let i = r.trim();
49
49
  i.length !== 0 && t.current !== i && (t.current = i);
50
50
  }, []),
51
- reset: T(() => {
51
+ reset: E(() => {
52
52
  t.current = null;
53
53
  }, [])
54
54
  };
55
- }, ue = (e = []) => {
56
- let [t, n] = A(e);
55
+ }, le = (e = []) => {
56
+ let [t, n] = j(e);
57
57
  return {
58
58
  followUps: t,
59
59
  setFollowUps: n,
60
- clearOnSend: T(() => n([]), []),
61
- handleData: T((e) => {
60
+ clearOnSend: E(() => n([]), []),
61
+ handleData: E((e) => {
62
62
  if (e.type !== "data-follow_ups") return !1;
63
63
  let t = e.data?.suggestions;
64
64
  return Array.isArray(t) ? (n(t.filter((e) => typeof e == "string")), !0) : !1;
65
65
  }, [])
66
66
  };
67
- }, de = (e) => e instanceof Error && e.message.includes("intelligence.site_agent.NO_ACTIVE_AGENT"), K = C({ agentUnavailable: !1 }), fe = () => E(K), pe = (...e) => e.filter(Boolean).join(" "), me = "inline-flex items-center justify-center gap-1.5 transition-all duration-200", he = "rounded-full border border-zinc-200 bg-white/95 px-3 py-1.5 font-medium text-xs text-zinc-500 shadow-lg backdrop-blur-sm hover:text-zinc-900", ge = ({ onClick: e, isRunning: t = !1, iconOnly: n = !1, icon: r = /* @__PURE__ */ b(N, { className: "h-3 w-3" }), className: i = he }) => /* @__PURE__ */ x("button", {
67
+ }, ue = (e) => e instanceof Error && e.message.includes("intelligence.site_agent.NO_ACTIVE_AGENT"), J = w({ agentUnavailable: !1 }), de = () => D(J), fe = (...e) => e.filter(Boolean).join(" "), pe = "inline-flex items-center justify-center gap-1.5 transition-all duration-200", me = "rounded-full border border-zinc-200 bg-white/95 px-3 py-1.5 font-medium text-xs text-zinc-500 shadow-lg backdrop-blur-sm hover:text-zinc-900", he = ({ onClick: e, isRunning: t = !1, iconOnly: n = !1, icon: r = /* @__PURE__ */ x(P, { className: "h-3 w-3" }), className: i = me }) => /* @__PURE__ */ S("button", {
68
68
  type: "button",
69
69
  "aria-label": "Scroll to bottom",
70
70
  onClick: e,
71
- className: pe(me, i),
71
+ className: fe(pe, i),
72
72
  children: [r, !n && (t ? "New messages" : "Scroll to bottom")]
73
- }), _e = ({ endpoint: e, headers: t, fallback: n, enabled: r = !0 }) => {
74
- let [i, a] = A(null), o = t ? JSON.stringify(t) : "", s = k(t);
73
+ }), ge = ({ endpoint: e, headers: t, fallback: n, enabled: r = !0 }) => {
74
+ let [i, a] = j(null), o = t ? JSON.stringify(t) : "", s = A(t);
75
75
  s.current = t;
76
- let c = k(n);
77
- return c.current = n, D(() => {
76
+ let c = A(n);
77
+ return c.current = n, O(() => {
78
78
  if (!r || !e) {
79
79
  a([...c.current]);
80
80
  return;
@@ -103,11 +103,11 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
103
103
  r,
104
104
  o
105
105
  ]), i;
106
- }, ve = 36, ye = 80, be = ({ viewportRef: e, isRunning: t, onRunStart: n, anchorOnRunStart: r = !0, atBottomThreshold: i }) => {
107
- let a = k(!1), [o, s] = A(!0), c = k(n);
106
+ }, _e = 36, ve = 80, ye = ({ viewportRef: e, isRunning: t, onRunStart: n, anchorOnRunStart: r = !0, atBottomThreshold: i }) => {
107
+ let a = A(!1), [o, s] = j(!0), c = A(n);
108
108
  c.current = n;
109
- let l = k(i);
110
- return l.current = i, D(() => {
109
+ let l = A(i);
110
+ return l.current = i, O(() => {
111
111
  let n = a.current;
112
112
  if (a.current = t, !t || n || (c.current?.(), !r)) return;
113
113
  let i = null, o = null;
@@ -115,7 +115,7 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
115
115
  o = requestAnimationFrame(() => {
116
116
  let t = e.current;
117
117
  if (!t) return;
118
- let n = Math.max(0, t.scrollHeight - t.clientHeight - ve);
118
+ let n = Math.max(0, t.scrollHeight - t.clientHeight - _e);
119
119
  n > t.clientHeight * .3 && t.scrollTo({
120
120
  top: n,
121
121
  behavior: "smooth"
@@ -128,11 +128,11 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
128
128
  t,
129
129
  e,
130
130
  r
131
- ]), D(() => {
131
+ ]), O(() => {
132
132
  let t = e.current;
133
133
  if (!t) return;
134
134
  let n = () => {
135
- let e = l.current?.(t.clientHeight) ?? ye;
135
+ let e = l.current?.(t.clientHeight) ?? ve;
136
136
  s(t.scrollHeight - t.scrollTop - t.clientHeight < e);
137
137
  };
138
138
  t.addEventListener("scroll", n, { passive: !0 });
@@ -151,7 +151,7 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
151
151
  });
152
152
  }
153
153
  };
154
- }, q = (...e) => e.filter(Boolean).join(" "), J = ({ onStop: e }) => /* @__PURE__ */ b("button", {
154
+ }, be = (...e) => e.filter(Boolean).join(" "), xe = ({ onStop: e }) => /* @__PURE__ */ x("button", {
155
155
  type: "button",
156
156
  onClick: e,
157
157
  "aria-label": "Stop generating",
@@ -160,36 +160,36 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
160
160
  backgroundColor: "var(--color-brand, #0a0a0a)",
161
161
  color: "var(--color-brand-foreground, #fff)"
162
162
  },
163
- children: /* @__PURE__ */ b(L, { className: "h-3.5 w-3.5 fill-current" })
164
- }), xe = () => /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(B.If, {
163
+ children: /* @__PURE__ */ x(z, { className: "h-3.5 w-3.5 fill-current" })
164
+ }), Se = () => /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(H.If, {
165
165
  dictation: !1,
166
- children: /* @__PURE__ */ b(B.Dictate, {
166
+ children: /* @__PURE__ */ x(H.Dictate, {
167
167
  className: "flex h-8 w-8 items-center justify-center rounded-md text-zinc-500 transition-colors hover:bg-zinc-100 hover:text-zinc-900",
168
- children: /* @__PURE__ */ b(ee, { className: "h-4 w-4" })
168
+ children: /* @__PURE__ */ x(L, { className: "h-4 w-4" })
169
169
  })
170
- }), /* @__PURE__ */ b(B.If, {
170
+ }), /* @__PURE__ */ x(H.If, {
171
171
  dictation: !0,
172
- children: /* @__PURE__ */ b(B.StopDictation, {
172
+ children: /* @__PURE__ */ x(H.StopDictation, {
173
173
  className: "flex h-8 w-8 animate-pulse items-center justify-center rounded-md bg-red-500/15 text-red-500 transition-colors hover:bg-red-500/25",
174
- children: /* @__PURE__ */ b(L, { className: "h-3 w-3 fill-current" })
174
+ children: /* @__PURE__ */ x(z, { className: "h-3 w-3 fill-current" })
175
175
  })
176
- })] }), Se = () => /* @__PURE__ */ b(B.Send, {
176
+ })] }), Ce = () => /* @__PURE__ */ x(H.Send, {
177
177
  "aria-label": "Send message",
178
178
  className: "flex h-9 w-9 items-center justify-center rounded-md shadow-md transition-all duration-300 hover:scale-110 active:scale-95 disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100",
179
179
  style: {
180
180
  backgroundColor: "var(--color-brand, #0a0a0a)",
181
181
  color: "var(--color-brand-foreground, #fff)"
182
182
  },
183
- children: /* @__PURE__ */ b(j, { className: "h-5 w-5 stroke-[2.5px]" })
184
- }), Ce = ({ variant: t, isRunning: n, onStop: r }) => {
185
- let i = (e) => {
186
- e.nativeEvent.isComposing || n && e.key === "Enter" && !e.shiftKey && e.preventDefault();
183
+ children: /* @__PURE__ */ x(M, { className: "h-5 w-5 stroke-[2.5px]" })
184
+ }), we = ({ variant: e, isRunning: t, onStop: n }) => {
185
+ let r = (e) => {
186
+ e.nativeEvent.isComposing || t && e.key === "Enter" && !e.shiftKey && e.preventDefault();
187
187
  };
188
- return t === "expanded" ? /* @__PURE__ */ x("div", {
188
+ return e === "expanded" ? /* @__PURE__ */ S("div", {
189
189
  className: "rounded-lg border border-zinc-200 bg-white shadow-sm transition-colors focus-within:border-[var(--color-brand,#a1a1aa)]",
190
- children: [/* @__PURE__ */ b(B.Input, {
190
+ children: [/* @__PURE__ */ x(H.Input, {
191
191
  "data-ai-chat-composer": "",
192
- className: q("ai-chat-textarea w-full resize-none overflow-y-auto bg-transparent px-6 pt-4 text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[160px]"),
192
+ className: be("ai-chat-textarea w-full resize-none overflow-y-auto bg-transparent px-6 pt-4 text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[160px]"),
193
193
  placeholder: "Ask anything about this site…",
194
194
  rows: 1,
195
195
  submitMode: "enter",
@@ -197,18 +197,18 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
197
197
  autoCorrect: "off",
198
198
  autoCapitalize: "none",
199
199
  inputMode: "text",
200
- onInput: (t) => e(t.currentTarget),
201
- onKeyDown: i
202
- }), /* @__PURE__ */ x("div", {
200
+ onInput: (e) => _(e.currentTarget),
201
+ onKeyDown: r
202
+ }), /* @__PURE__ */ S("div", {
203
203
  className: "flex items-center justify-between px-3 pt-1 pb-2",
204
- children: [/* @__PURE__ */ b(xe, {}), n ? /* @__PURE__ */ b(J, { onStop: r }) : /* @__PURE__ */ b(Se, {})]
204
+ children: [/* @__PURE__ */ x(Se, {}), t ? /* @__PURE__ */ x(xe, { onStop: n }) : /* @__PURE__ */ x(Ce, {})]
205
205
  })]
206
- }) : /* @__PURE__ */ x("div", {
206
+ }) : /* @__PURE__ */ S("div", {
207
207
  className: "flex items-end gap-2 rounded-lg border border-zinc-200 bg-white p-2 shadow-sm transition-colors focus-within:border-[var(--color-brand,#a1a1aa)]",
208
208
  children: [
209
- /* @__PURE__ */ b(B.Input, {
209
+ /* @__PURE__ */ x(H.Input, {
210
210
  "data-ai-chat-composer": "",
211
- className: q("ai-chat-textarea min-w-0 flex-1 resize-none overflow-y-auto bg-transparent px-2 py-1.5 text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[120px]"),
211
+ className: be("ai-chat-textarea min-w-0 flex-1 resize-none overflow-y-auto bg-transparent px-2 py-1.5 text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", "max-h-[120px]"),
212
212
  placeholder: "Ask a follow-up…",
213
213
  rows: 1,
214
214
  submitMode: "enter",
@@ -216,40 +216,40 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
216
216
  autoCorrect: "off",
217
217
  autoCapitalize: "none",
218
218
  inputMode: "text",
219
- onInput: (t) => e(t.currentTarget),
220
- onKeyDown: i
219
+ onInput: (e) => _(e.currentTarget),
220
+ onKeyDown: r
221
221
  }),
222
- /* @__PURE__ */ b(xe, {}),
223
- n ? /* @__PURE__ */ b(J, { onStop: r }) : /* @__PURE__ */ b(Se, {})
222
+ /* @__PURE__ */ x(Se, {}),
223
+ t ? /* @__PURE__ */ x(xe, { onStop: n }) : /* @__PURE__ */ x(Ce, {})
224
224
  ]
225
225
  });
226
- }, we = "rounded-2xl border border-zinc-200 bg-zinc-100 px-3.5 py-2.5", Te = "ai-chat-textarea w-full resize-none bg-transparent text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", Ee = "rounded-md px-2 py-1 text-xs text-zinc-500 transition-colors hover:bg-zinc-100", De = "rounded-md px-2 py-1 text-xs transition-opacity hover:opacity-80", Oe = ({ autoGrowMax: t, boxClassName: n = we, inputClassName: r = Te, cancelClassName: i = Ee, sendClassName: o = De, sendStyle: s }) => {
227
- let c = W((e) => e.thread.isRunning);
228
- return /* @__PURE__ */ b(V.Root, {
226
+ }, Te = "rounded-2xl border border-zinc-200 bg-zinc-100 px-3.5 py-2.5", Ee = "ai-chat-textarea w-full resize-none bg-transparent text-base text-zinc-900 leading-relaxed placeholder:text-zinc-500 focus:outline-none", De = "rounded-md px-2 py-1 text-xs text-zinc-500 transition-colors hover:bg-zinc-100", Oe = "rounded-md px-2 py-1 text-xs transition-opacity hover:opacity-80", ke = ({ autoGrowMax: e, boxClassName: n = Te, inputClassName: r = Ee, cancelClassName: i = De, sendClassName: a = Oe, sendStyle: o }) => {
227
+ let s = K((e) => e.thread.isRunning);
228
+ return /* @__PURE__ */ x(U.Root, {
229
229
  className: "mb-4 pr-2 pl-0",
230
- children: /* @__PURE__ */ x(B.Root, { children: [/* @__PURE__ */ b("div", {
230
+ children: /* @__PURE__ */ S(H.Root, { children: [/* @__PURE__ */ x("div", {
231
231
  className: n,
232
- children: /* @__PURE__ */ b(B.Input, {
232
+ children: /* @__PURE__ */ x(H.Input, {
233
233
  className: r,
234
234
  rows: 1,
235
- onInput: (n) => e(n.currentTarget, t)
235
+ onInput: (t) => _(t.currentTarget, e)
236
236
  })
237
- }), /* @__PURE__ */ x("div", {
237
+ }), /* @__PURE__ */ S("div", {
238
238
  className: "mt-2 flex justify-end gap-1.5",
239
- children: [/* @__PURE__ */ b(B.Cancel, {
239
+ children: [/* @__PURE__ */ x(H.Cancel, {
240
240
  className: i,
241
241
  children: "Cancel"
242
- }), /* @__PURE__ */ b(B.Send, {
243
- disabled: c,
244
- className: `${o} ${a}`,
245
- style: s,
242
+ }), /* @__PURE__ */ x(H.Send, {
243
+ disabled: s,
244
+ className: `${a} ${t}`,
245
+ style: o,
246
246
  children: "Save"
247
247
  })]
248
248
  })] })
249
249
  });
250
- }, ke = ({ idleClassName: e = "text-zinc-500 hover:text-zinc-900", copiedClassName: t = "text-emerald-500", errorClassName: n = "text-rose-500", className: r = "rounded p-1.5 transition-colors", iconClassName: i = "h-3 w-3" }) => {
251
- let [a, o] = A("idle"), s = W((e) => e.message);
252
- D(() => {
250
+ }, Ae = ({ idleClassName: e = "text-zinc-500 hover:text-zinc-900", copiedClassName: t = "text-emerald-500", errorClassName: n = "text-rose-500", className: r = "rounded p-1.5 transition-colors", iconClassName: i = "h-3 w-3" }) => {
251
+ let [a, o] = j("idle"), s = K((e) => e.message);
252
+ O(() => {
253
253
  if (a === "idle") return;
254
254
  let e = setTimeout(() => o("idle"), 1500);
255
255
  return () => clearTimeout(e);
@@ -261,59 +261,59 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
261
261
  } catch {
262
262
  o("error");
263
263
  }
264
- }, l = a === "copied" ? t ?? e : a === "error" ? n ?? e : e, u = a === "copied" ? "Copied" : a === "error" ? "Copy failed" : "Copy message", d = a === "copied" ? M : a === "error" ? R : P;
265
- return /* @__PURE__ */ b("button", {
264
+ }, l = a === "copied" ? t ?? e : a === "error" ? n ?? e : e, u = a === "copied" ? "Copied" : a === "error" ? "Copy failed" : "Copy message", d = a === "copied" ? N : a === "error" ? B : F;
265
+ return /* @__PURE__ */ x("button", {
266
266
  type: "button",
267
267
  "aria-label": u,
268
268
  onClick: c,
269
269
  className: [r, l].filter(Boolean).join(" "),
270
- children: /* @__PURE__ */ b(d, { className: i })
270
+ children: /* @__PURE__ */ x(d, { className: i })
271
271
  });
272
- }, Ae = ({ children: e }) => {
273
- let [t, n] = A(!1), r = "plaintext", i = "";
274
- return S.forEach(e, (e) => {
275
- if (w(e)) {
272
+ }, je = ({ children: e }) => {
273
+ let [t, n] = j(!1), r = "plaintext", i = "";
274
+ return C.forEach(e, (e) => {
275
+ if (T(e)) {
276
276
  let t = e.props, n = /language-(\w+)/.exec(t.className ?? "");
277
277
  n && (r = n[1] ?? r), typeof t.children == "string" && (i = t.children.trim());
278
278
  }
279
- }), /* @__PURE__ */ x("div", {
279
+ }), /* @__PURE__ */ S("div", {
280
280
  className: "ai-chat-code not-prose my-4 overflow-hidden rounded-xl border",
281
- children: [/* @__PURE__ */ x("div", {
281
+ children: [/* @__PURE__ */ S("div", {
282
282
  className: "ai-chat-code__header flex items-center justify-between px-4 py-2",
283
- children: [/* @__PURE__ */ b("span", {
283
+ children: [/* @__PURE__ */ x("span", {
284
284
  className: "ai-chat-code__label font-mono text-[10px] uppercase tracking-widest",
285
285
  children: r
286
- }), /* @__PURE__ */ b("button", {
286
+ }), /* @__PURE__ */ x("button", {
287
287
  type: "button",
288
288
  onClick: () => navigator.clipboard.writeText(i).then(() => {
289
289
  n(!0), setTimeout(() => n(!1), 2e3);
290
290
  }).catch(() => {}),
291
291
  className: "ai-chat-code__copy flex items-center gap-1.5 rounded px-2 py-0.5 text-[10px] transition-colors",
292
- children: t ? /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(M, { className: "h-3 w-3 text-emerald-500" }), /* @__PURE__ */ b("span", { children: "Copied!" })] }) : /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(P, { className: "h-3 w-3" }), /* @__PURE__ */ b("span", { children: "Copy" })] })
292
+ children: t ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(N, { className: "h-3 w-3 text-emerald-500" }), /* @__PURE__ */ x("span", { children: "Copied!" })] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(F, { className: "h-3 w-3" }), /* @__PURE__ */ x("span", { children: "Copy" })] })
293
293
  })]
294
- }), /* @__PURE__ */ b("pre", {
294
+ }), /* @__PURE__ */ x("pre", {
295
295
  className: "ai-chat-code__pre overflow-x-auto px-4 py-4 font-mono text-sm leading-relaxed",
296
296
  children: e
297
297
  })]
298
298
  });
299
- }, je = (e) => /* @__PURE__ */ b("a", {
299
+ }, Me = (e) => /* @__PURE__ */ x("a", {
300
300
  ...e,
301
301
  target: "_blank",
302
302
  rel: "noopener noreferrer"
303
- }), Me = ({ className: e, ...t }) => /* @__PURE__ */ b("div", {
303
+ }), Ne = ({ className: e, ...t }) => /* @__PURE__ */ x("div", {
304
304
  className: "w-full max-w-full overflow-x-auto",
305
- children: /* @__PURE__ */ b("table", {
305
+ children: /* @__PURE__ */ x("table", {
306
306
  ...t,
307
307
  className: ["w-max min-w-full [&_td]:max-w-[20rem] [&_th]:max-w-[20rem]", e].filter(Boolean).join(" ")
308
308
  })
309
- }), Ne = () => /* @__PURE__ */ b(oe, {
310
- remarkPlugins: [se],
309
+ }), Pe = () => /* @__PURE__ */ x(ae, {
310
+ remarkPlugins: [oe],
311
311
  components: {
312
- pre: Ae,
313
- a: je,
314
- table: Me
312
+ pre: je,
313
+ a: Me,
314
+ table: Ne
315
315
  }
316
- }), Pe = [
316
+ }), Fe = [
317
317
  "Thinking",
318
318
  "Pondering",
319
319
  "Drafting",
@@ -327,12 +327,12 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
327
327
  "Untangling",
328
328
  "Threading the needle",
329
329
  "Lining up ideas"
330
- ], Fe = (e) => {
330
+ ], Ie = (e) => {
331
331
  let t = Math.floor(e / 60), n = e % 60;
332
332
  return t > 0 ? `${t}m ${n.toString().padStart(2, "0")}s` : `${n}s`;
333
- }, Ie = ({ phrases: e = Pe, textClassName: t = "ai-thinking-text", timerClassName: n = "text-xs text-zinc-500/70 tabular-nums", longRunningClassName: r = "ml-1.5 text-zinc-500/45", longRunningHint: i = "· hang tight" }) => {
334
- let [a, o] = A(() => e.length > 0 ? Math.floor(Math.random() * e.length) : 0), [s, c] = A(0);
335
- D(() => {
333
+ }, Le = ({ phrases: e = Fe, textClassName: t = "ai-thinking-text", timerClassName: n = "text-xs text-zinc-500/70 tabular-nums", longRunningClassName: r = "ml-1.5 text-zinc-500/45", longRunningHint: i = "· hang tight" }) => {
334
+ let [a, o] = j(() => e.length > 0 ? Math.floor(Math.random() * e.length) : 0), [s, c] = j(0);
335
+ O(() => {
336
336
  let t = e.length > 0 ? setInterval(() => {
337
337
  o((t) => (t + 1) % e.length);
338
338
  }, 2800) : null, n = setInterval(() => {
@@ -343,190 +343,190 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
343
343
  };
344
344
  }, [e.length]);
345
345
  let l = e[a] ?? "Thinking", u = s >= 3, d = s >= 30;
346
- return /* @__PURE__ */ x("div", {
346
+ return /* @__PURE__ */ S("div", {
347
347
  className: "flex flex-wrap items-center gap-x-3 gap-y-0.5 py-1",
348
- children: [/* @__PURE__ */ x("div", {
348
+ children: [/* @__PURE__ */ S("div", {
349
349
  className: "flex min-w-0 items-center gap-3",
350
- children: [/* @__PURE__ */ x("div", {
350
+ children: [/* @__PURE__ */ S("div", {
351
351
  className: "ai-dust",
352
352
  children: [
353
- /* @__PURE__ */ b("span", { style: {
353
+ /* @__PURE__ */ x("span", { style: {
354
354
  left: "4px",
355
355
  "--delay": ".3s"
356
356
  } }),
357
- /* @__PURE__ */ b("span", { style: {
357
+ /* @__PURE__ */ x("span", { style: {
358
358
  left: "12px",
359
359
  "--delay": "0s"
360
360
  } }),
361
- /* @__PURE__ */ b("span", { style: {
361
+ /* @__PURE__ */ x("span", { style: {
362
362
  left: "20px",
363
363
  "--delay": ".6s"
364
364
  } })
365
365
  ]
366
- }), /* @__PURE__ */ x("span", {
366
+ }), /* @__PURE__ */ S("span", {
367
367
  className: `${t} min-w-0 truncate font-semibold text-sm transition-opacity duration-500`,
368
368
  children: [l, "…"]
369
369
  })]
370
- }), u && /* @__PURE__ */ x("span", {
370
+ }), u && /* @__PURE__ */ S("span", {
371
371
  className: `${n} min-w-0 truncate`,
372
- children: [Fe(s), d && /* @__PURE__ */ b("span", {
372
+ children: [Ie(s), d && /* @__PURE__ */ x("span", {
373
373
  className: r,
374
374
  children: i
375
375
  })]
376
376
  })]
377
377
  });
378
- }, Le = () => null, Re = "max-w-none text-sm text-zinc-900 leading-relaxed [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&_a:hover]:text-sky-700 [&_a]:break-words [&_a]:font-medium [&_a]:text-sky-600 [&_a]:underline [&_a]:underline-offset-2 [&_li]:text-sm [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-2 [&_p]:text-sm [&_strong]:font-semibold [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5", ze = "group pr-4 pb-6", Be = "mt-2 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100", Ve = "text-xs text-zinc-500/60", He = "rounded p-1.5 text-zinc-500 transition-colors hover:text-zinc-900", Ue = ({ tools: e = Le, Parts: t, thinkingIndicator: r = /* @__PURE__ */ b(Ie, {}), rootClassName: i = ze, contentClassName: a = Re, metaClassName: o = Be, wrapContent: s, metaSlot: c, copyIdleClassName: l, copyCopiedClassName: u, reloadClassName: d = He, timeClassName: f = Ve, timeFormatOptions: p, readOnly: m = !1, belowContent: h, footerSlot: g }) => {
379
- let y = W((e) => e.message), S = _(y), C = t ?? V.Content, w = y.status?.type === "running", T = /* @__PURE__ */ b("div", {
380
- className: a,
381
- children: /* @__PURE__ */ b(C, { components: {
382
- Text: Ne,
383
- tools: { Fallback: e }
378
+ }, Re = () => null, ze = "max-w-none text-sm text-zinc-900 leading-relaxed [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 [&_a:hover]:text-sky-700 [&_a]:break-words [&_a]:font-medium [&_a]:text-sky-600 [&_a]:underline [&_a]:underline-offset-2 [&_li]:text-sm [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p]:my-2 [&_p]:text-sm [&_strong]:font-semibold [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5", Be = "group pr-4 pb-6", Ve = "mt-2 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100", He = "text-xs text-zinc-500/60", Ue = "rounded p-1.5 text-zinc-500 transition-colors hover:text-zinc-900", We = ({ tools: t = Re, Parts: n, thinkingIndicator: i = /* @__PURE__ */ x(Le, {}), rootClassName: a = Be, contentClassName: o = ze, metaClassName: s = Ve, wrapContent: c, metaSlot: l, copyIdleClassName: u, copyCopiedClassName: d, reloadClassName: f = Ue, timeClassName: p = He, timeFormatOptions: m, readOnly: h = !1, belowContent: g, footerSlot: _ }) => {
379
+ let y = K((e) => e.message), b = e(y), C = n ?? U.Content, w = y.status?.type === "running", T = /* @__PURE__ */ x("div", {
380
+ className: o,
381
+ children: /* @__PURE__ */ x(C, { components: {
382
+ Text: Pe,
383
+ tools: { Fallback: t }
384
384
  } })
385
385
  });
386
- return /* @__PURE__ */ b(V.Root, {
387
- className: i,
388
- children: /* @__PURE__ */ x("div", {
386
+ return /* @__PURE__ */ x(U.Root, {
387
+ className: a,
388
+ children: /* @__PURE__ */ S("div", {
389
389
  className: "flex min-w-0 flex-col",
390
390
  children: [
391
- s ? s(T) : T,
392
- w && /* @__PURE__ */ b("div", {
391
+ c ? c(T) : T,
392
+ w && /* @__PURE__ */ x("div", {
393
393
  className: "mt-1",
394
- children: r
394
+ children: i
395
395
  }),
396
- !w && h && /* @__PURE__ */ b("div", {
396
+ !w && g && /* @__PURE__ */ x("div", {
397
397
  className: "mt-2",
398
- children: h
398
+ children: g
399
399
  }),
400
- !w && /* @__PURE__ */ x("div", {
401
- className: o,
400
+ !w && /* @__PURE__ */ S("div", {
401
+ className: s,
402
402
  children: [
403
- /* @__PURE__ */ b("span", {
404
- className: f,
405
- title: v(S) || void 0,
406
- children: n(S, p)
403
+ /* @__PURE__ */ x("span", {
404
+ className: p,
405
+ title: r(b) || void 0,
406
+ children: v(b, m)
407
407
  }),
408
- c,
409
- /* @__PURE__ */ x(z.Root, {
408
+ l,
409
+ /* @__PURE__ */ S(V.Root, {
410
410
  className: "flex items-center gap-0.5",
411
- children: [/* @__PURE__ */ b(ke, {
412
- idleClassName: l,
413
- copiedClassName: u
414
- }), !m && /* @__PURE__ */ b(z.Reload, {
415
- className: `${d} disabled:cursor-not-allowed disabled:opacity-40`,
416
- children: /* @__PURE__ */ b(I, { className: "h-3 w-3" })
411
+ children: [/* @__PURE__ */ x(Ae, {
412
+ idleClassName: u,
413
+ copiedClassName: d
414
+ }), !h && /* @__PURE__ */ x(V.Reload, {
415
+ className: `${f} disabled:cursor-not-allowed disabled:opacity-40`,
416
+ children: /* @__PURE__ */ x(R, { className: "h-3 w-3" })
417
417
  })]
418
418
  })
419
419
  ]
420
420
  }),
421
- !w && g
421
+ !w && _
422
422
  ]
423
423
  })
424
424
  });
425
- }, We = "group flex flex-col items-end pb-4 pl-12", Ge = "rounded-2xl border border-zinc-200 bg-zinc-100 px-3.5 py-2.5 text-sm text-zinc-900 leading-relaxed", Ke = "mt-1 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100", qe = "text-xs text-zinc-500/60", Je = "rounded px-2 py-1 font-medium text-xs text-zinc-500 transition-colors hover:text-zinc-900", Ye = ({ attachmentsSlot: e, rootClassName: t = We, bubbleClassName: r = Ge, contentSlot: i, metaClassName: a = Ke, timeClassName: o = qe, editClassName: s = Je, copyIdleClassName: c, copyCopiedClassName: l, timeFormatOptions: u, readOnly: d = !1 }) => {
426
- let f = W((e) => e.message), p = W((e) => e.thread.isRunning), m = _(f);
427
- return /* @__PURE__ */ x(V.Root, {
428
- className: t,
425
+ }, Ge = "group flex flex-col items-end pb-4 pl-12", Ke = "rounded-2xl border border-zinc-200 bg-zinc-100 px-3.5 py-2.5 text-sm text-zinc-900 leading-relaxed", qe = "mt-1 flex items-center gap-2 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100", Je = "text-xs text-zinc-500/60", Ye = "rounded px-2 py-1 font-medium text-xs text-zinc-500 transition-colors hover:text-zinc-900", Xe = ({ attachmentsSlot: t, rootClassName: n = Ge, bubbleClassName: i = Ke, contentSlot: a, metaClassName: o = qe, timeClassName: s = Je, editClassName: c = Ye, copyIdleClassName: l, copyCopiedClassName: u, timeFormatOptions: d, readOnly: f = !1 }) => {
426
+ let p = K((e) => e.message), m = K((e) => e.thread.isRunning), h = e(p);
427
+ return /* @__PURE__ */ S(U.Root, {
428
+ className: n,
429
429
  "data-user-message": "true",
430
430
  children: [
431
- e,
432
- /* @__PURE__ */ b("div", {
433
- className: r,
434
- children: i ?? /* @__PURE__ */ b(V.Content, {})
435
- }),
431
+ t,
436
432
  /* @__PURE__ */ x("div", {
437
- className: a,
438
- children: [/* @__PURE__ */ b("span", {
439
- className: o,
440
- title: v(m) || void 0,
441
- children: n(m, u)
442
- }), /* @__PURE__ */ x(z.Root, {
433
+ className: i,
434
+ children: a ?? /* @__PURE__ */ x(U.Content, {})
435
+ }),
436
+ /* @__PURE__ */ S("div", {
437
+ className: o,
438
+ children: [/* @__PURE__ */ x("span", {
439
+ className: s,
440
+ title: r(h) || void 0,
441
+ children: v(h, d)
442
+ }), /* @__PURE__ */ S(V.Root, {
443
443
  className: "flex items-center gap-0.5",
444
- children: [/* @__PURE__ */ b(ke, {
445
- idleClassName: c,
446
- copiedClassName: l
447
- }), !d && /* @__PURE__ */ b(z.Edit, {
448
- disabled: p,
449
- className: `${s} disabled:cursor-not-allowed disabled:opacity-40`,
444
+ children: [/* @__PURE__ */ x(Ae, {
445
+ idleClassName: l,
446
+ copiedClassName: u
447
+ }), !f && /* @__PURE__ */ x(V.Edit, {
448
+ disabled: m,
449
+ className: `${c} disabled:cursor-not-allowed disabled:opacity-40`,
450
450
  children: "Edit"
451
451
  })]
452
452
  })]
453
453
  })
454
454
  ]
455
455
  });
456
- }, Xe = () => /* @__PURE__ */ b(Oe, { sendStyle: {
456
+ }, Ze = () => /* @__PURE__ */ x(ke, { sendStyle: {
457
457
  backgroundColor: "var(--color-brand, #0a0a0a)",
458
458
  color: "var(--color-brand-foreground, #fff)"
459
- } }), Ze = [
459
+ } }), Qe = [
460
460
  "What do you offer?",
461
461
  "How much does it cost?",
462
462
  "Why should I choose you?",
463
463
  "How do I get in touch?"
464
- ], Qe = [
464
+ ], $e = [
465
465
  "w-3/4",
466
466
  "w-4/5",
467
467
  "w-2/3",
468
468
  "w-3/5"
469
- ], $e = ({ workspaceId: e, siteName: t, siteLogo: n, apiBaseUrl: r, authHeaders: i, agentId: a, followUps: o, hideComposer: s = !1 }) => {
470
- let c = U(), l = W((e) => e.thread.isRunning), { agentUnavailable: u } = fe(), d = k(null), { isAtBottom: f, scrollToBottom: p } = be({
471
- viewportRef: d,
472
- isRunning: l
473
- }), m = _e({
469
+ ], et = ({ workspaceId: e, siteName: t, siteLogo: n, apiBaseUrl: r, authHeaders: i, agentId: a, followUps: s, hideComposer: c = !1 }) => {
470
+ let l = G(), u = K((e) => e.thread.isRunning), { agentUnavailable: d } = de(), f = A(null), { isAtBottom: p, scrollToBottom: m } = ye({
471
+ viewportRef: f,
472
+ isRunning: u
473
+ }), h = ge({
474
474
  endpoint: e ? `${r}/suggestions${a ? `?agent_id=${encodeURIComponent(a)}` : ""}` : void 0,
475
475
  headers: e ? {
476
- ...i,
476
+ ...o(i),
477
477
  "Levo-Workspace": e
478
478
  } : void 0,
479
- fallback: Ze
480
- }), h = T((e) => {
481
- g(c.thread.composer(), e);
482
- }, [c]), _ = T(() => c.thread.cancelRun(), [c]), v = k(l);
483
- return D(() => {
484
- v.current = l;
485
- }, [l]), D(() => {
479
+ fallback: Qe
480
+ }), g = E((e) => {
481
+ y(l.thread.composer(), e);
482
+ }, [l]), _ = E(() => l.thread.cancelRun(), [l]), v = A(u);
483
+ return O(() => {
484
+ v.current = u;
485
+ }, [u]), O(() => {
486
486
  let e = (e) => {
487
- e.key !== "Escape" || e.isComposing || !v.current || (e.preventDefault(), e.stopImmediatePropagation(), c.thread.cancelRun());
487
+ e.key !== "Escape" || e.isComposing || !v.current || (e.preventDefault(), e.stopImmediatePropagation(), l.thread.cancelRun());
488
488
  };
489
489
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
490
- }, [c]), /* @__PURE__ */ x(H.Root, {
490
+ }, [l]), /* @__PURE__ */ S(W.Root, {
491
491
  className: "relative flex flex-1 flex-col overflow-hidden",
492
492
  children: [
493
- /* @__PURE__ */ b(H.If, {
493
+ /* @__PURE__ */ x(W.If, {
494
494
  empty: !0,
495
- children: /* @__PURE__ */ b("div", {
495
+ children: /* @__PURE__ */ x("div", {
496
496
  className: "pointer-events-none absolute inset-0 z-0 overflow-hidden",
497
- children: /* @__PURE__ */ b("div", {
497
+ children: /* @__PURE__ */ x("div", {
498
498
  className: "absolute inset-0",
499
499
  style: { background: ["radial-gradient(at 12% 18%, color-mix(in oklch, var(--color-brand, #4691e8) 12%, transparent) 0px, transparent 55%)", "radial-gradient(at 88% 82%, color-mix(in oklch, var(--color-brand-secondary, #db646d) 8%, transparent) 0px, transparent 55%)"].join(", ") }
500
500
  })
501
501
  })
502
502
  }),
503
- u && /* @__PURE__ */ b("div", {
503
+ d && /* @__PURE__ */ x("div", {
504
504
  role: "alert",
505
505
  className: "relative z-20 shrink-0 border-amber-200 border-b bg-amber-50 px-4 py-2.5 text-amber-800 text-xs",
506
506
  children: "This conversation is no longer available. Please refresh the page to start a new chat."
507
507
  }),
508
- /* @__PURE__ */ x(H.Viewport, {
509
- ref: d,
508
+ /* @__PURE__ */ S(W.Viewport, {
509
+ ref: f,
510
510
  turnAnchor: "top",
511
511
  className: "relative z-10 flex-1 overflow-y-auto",
512
512
  autoScroll: !1,
513
513
  scrollToBottomOnRunStart: !1,
514
514
  scrollToBottomOnInitialize: !1,
515
515
  scrollToBottomOnThreadSwitch: !1,
516
- children: [/* @__PURE__ */ b(H.Empty, { children: /* @__PURE__ */ x("div", {
516
+ children: [/* @__PURE__ */ x(W.Empty, { children: /* @__PURE__ */ S("div", {
517
517
  className: "flex min-h-full flex-col items-center justify-center px-6 py-6",
518
- children: [/* @__PURE__ */ x("div", {
518
+ children: [/* @__PURE__ */ S("div", {
519
519
  className: "mb-5 flex flex-col items-center gap-2 text-center",
520
520
  children: [
521
- n ? /* @__PURE__ */ b("img", {
521
+ n ? /* @__PURE__ */ x("img", {
522
522
  src: n,
523
523
  alt: t ?? "Site logo",
524
524
  className: "mb-1 h-12 w-auto max-w-[180px] object-contain"
525
- }) : /* @__PURE__ */ b("span", {
525
+ }) : /* @__PURE__ */ x("span", {
526
526
  className: "font-semibold text-lg text-zinc-900 tracking-tight",
527
527
  children: t ?? "This site"
528
528
  }),
529
- /* @__PURE__ */ b("p", {
529
+ /* @__PURE__ */ x("p", {
530
530
  className: "mt-1 text-2xl text-zinc-900 tracking-tight",
531
531
  style: {
532
532
  fontFamily: "var(--font-heading, inherit)",
@@ -534,89 +534,89 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
534
534
  },
535
535
  children: "Ask anything"
536
536
  }),
537
- /* @__PURE__ */ b("p", {
537
+ /* @__PURE__ */ x("p", {
538
538
  className: "text-sm text-zinc-500",
539
539
  style: { fontFamily: "var(--font-heading, inherit)" },
540
540
  children: "Get instant answers about products, pricing, and how to get started."
541
541
  })
542
542
  ]
543
- }), /* @__PURE__ */ b("div", {
543
+ }), /* @__PURE__ */ x("div", {
544
544
  className: "flex w-full max-w-md flex-col gap-2",
545
- children: m === null ? Qe.map((e, t) => /* @__PURE__ */ b("div", {
545
+ children: h === null ? $e.map((e, t) => /* @__PURE__ */ x("div", {
546
546
  className: "flex h-[42px] items-center rounded-xl border border-zinc-200 bg-white px-4",
547
- children: /* @__PURE__ */ b("span", { className: `block h-3 animate-pulse rounded bg-zinc-200 ${e}` })
548
- }, `skeleton-${t}`)) : m.map((e, t) => /* @__PURE__ */ b("button", {
547
+ children: /* @__PURE__ */ x("span", { className: `block h-3 animate-pulse rounded bg-zinc-200 ${e}` })
548
+ }, `skeleton-${t}`)) : h.map((e, t) => /* @__PURE__ */ x("button", {
549
549
  type: "button",
550
- onClick: () => h(e),
550
+ onClick: () => g(e),
551
551
  className: "ai-chat-suggestion rounded-xl border border-zinc-200 bg-white px-4 py-2.5 text-left text-sm text-zinc-700 transition-[border-color,background-color,transform] duration-150 hover:border-zinc-300 hover:bg-zinc-50 active:scale-[0.98]",
552
552
  style: { animationDelay: `${t * 40}ms` },
553
553
  children: e
554
554
  }, e))
555
555
  })]
556
- }) }), /* @__PURE__ */ b(H.If, {
556
+ }) }), /* @__PURE__ */ x(W.If, {
557
557
  empty: !1,
558
- children: /* @__PURE__ */ b("div", {
558
+ children: /* @__PURE__ */ x("div", {
559
559
  className: "ai-chat-kb-messages mx-auto max-w-3xl px-6 py-6 pt-8",
560
- children: /* @__PURE__ */ b(H.Messages, { components: {
561
- UserMessage: Ye,
562
- AssistantMessage: Ue,
563
- EditComposer: Xe
560
+ children: /* @__PURE__ */ x(W.Messages, { components: {
561
+ UserMessage: Xe,
562
+ AssistantMessage: We,
563
+ EditComposer: Ze
564
564
  } })
565
565
  })
566
566
  })]
567
567
  }),
568
- !s && /* @__PURE__ */ b("div", {
568
+ !c && /* @__PURE__ */ x("div", {
569
569
  className: "relative z-10 shrink-0 border-zinc-200 border-t bg-white/95 backdrop-blur-sm",
570
- children: /* @__PURE__ */ x("div", {
570
+ children: /* @__PURE__ */ S("div", {
571
571
  className: "relative mx-auto max-w-3xl px-4 pt-3 pb-3",
572
572
  children: [
573
- !f && /* @__PURE__ */ b("div", {
573
+ !p && /* @__PURE__ */ x("div", {
574
574
  className: "pointer-events-none absolute inset-x-0 -top-9 z-20 flex justify-center",
575
- children: /* @__PURE__ */ b(ge, {
576
- onClick: p,
577
- isRunning: l,
575
+ children: /* @__PURE__ */ x(he, {
576
+ onClick: m,
577
+ isRunning: u,
578
578
  className: "pointer-events-auto rounded-full border border-zinc-200 bg-white/95 px-3 py-1.5 font-medium text-xs text-zinc-500 shadow-lg backdrop-blur-sm hover:text-zinc-900"
579
579
  })
580
580
  }),
581
- o.length > 0 && !l && /* @__PURE__ */ b("div", {
581
+ s.length > 0 && !u && /* @__PURE__ */ x("div", {
582
582
  className: "mb-2",
583
- children: /* @__PURE__ */ b(G, {
584
- chips: o,
585
- onSelect: h,
583
+ children: /* @__PURE__ */ x(q, {
584
+ chips: s,
585
+ onSelect: g,
586
586
  size: "compact"
587
587
  })
588
588
  }),
589
- /* @__PURE__ */ x(B.Root, { children: [
590
- /* @__PURE__ */ b(H.If, {
589
+ /* @__PURE__ */ S(H.Root, { children: [
590
+ /* @__PURE__ */ x(W.If, {
591
591
  empty: !0,
592
- children: /* @__PURE__ */ b(Ce, {
592
+ children: /* @__PURE__ */ x(we, {
593
593
  variant: "expanded",
594
- isRunning: l,
594
+ isRunning: u,
595
595
  onStop: _
596
596
  })
597
597
  }),
598
- /* @__PURE__ */ b(H.If, {
598
+ /* @__PURE__ */ x(W.If, {
599
599
  empty: !1,
600
- children: /* @__PURE__ */ b(Ce, {
600
+ children: /* @__PURE__ */ x(we, {
601
601
  variant: "compact",
602
- isRunning: l,
602
+ isRunning: u,
603
603
  onStop: _
604
604
  })
605
605
  }),
606
- /* @__PURE__ */ b(B.If, {
606
+ /* @__PURE__ */ x(H.If, {
607
607
  dictation: !0,
608
- children: /* @__PURE__ */ x("div", {
608
+ children: /* @__PURE__ */ S("div", {
609
609
  className: "mt-2 flex items-center justify-center gap-2",
610
- children: [/* @__PURE__ */ b("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-red-500" }), /* @__PURE__ */ b("span", {
610
+ children: [/* @__PURE__ */ x("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-red-500" }), /* @__PURE__ */ x("span", {
611
611
  className: "font-medium text-red-500 text-xs tracking-wide",
612
612
  children: "Listening… speak now"
613
613
  })]
614
614
  })
615
615
  })
616
616
  ] }),
617
- /* @__PURE__ */ b(H.If, {
617
+ /* @__PURE__ */ x(W.If, {
618
618
  empty: !1,
619
- children: /* @__PURE__ */ b("p", {
619
+ children: /* @__PURE__ */ x("p", {
620
620
  className: "mt-2 text-center text-[10px] text-zinc-500/70",
621
621
  children: "Answers can be inaccurate. Verify before relying on them."
622
622
  })
@@ -626,88 +626,87 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
626
626
  })
627
627
  ]
628
628
  });
629
- }, Y = 4096, et = 400, tt = 300, nt = 2e3, rt = (e) => document.querySelector(e)?.content?.trim() || void 0, it = (e) => {
629
+ }, Y = 4096, tt = 400, nt = 300, rt = 2e3, it = (e) => document.querySelector(e)?.content?.trim() || void 0, at = (e) => {
630
630
  for (let t of e) {
631
- let e = rt(t);
631
+ let e = it(t);
632
632
  if (e) return e;
633
633
  }
634
- }, at = (e, t) => e.length > t ? `${e.slice(0, t - 1).trimEnd()}…` : e, X = (e) => JSON.stringify(e).length, ot = () => {
634
+ }, ot = (e, t) => e.length > t ? `${e.slice(0, t - 1).trimEnd()}…` : e, X = (e) => JSON.stringify(e).length, st = () => {
635
635
  if (typeof window > "u" || typeof document > "u") return;
636
636
  let e = {}, t = window.location?.href;
637
637
  t && (e.url = t);
638
- let n = document.title?.trim() || it(["meta[property=\"og:title\"]", "meta[name=\"twitter:title\"]"]);
639
- n && (e.page_title = at(n, tt));
640
- let r = it([
638
+ let n = document.title?.trim() || at(["meta[property=\"og:title\"]", "meta[name=\"twitter:title\"]"]);
639
+ n && (e.page_title = ot(n, nt));
640
+ let r = at([
641
641
  "meta[name=\"description\"]",
642
642
  "meta[property=\"og:description\"]",
643
643
  "meta[name=\"twitter:description\"]"
644
644
  ]);
645
- r && (e.description = at(r, et));
645
+ r && (e.description = ot(r, tt));
646
646
  let i = document.referrer?.trim();
647
- if (i && (e.referrer = i), Object.keys(e).length !== 0) return e.description && X(e) > Y && delete e.description, e.referrer && X(e) > Y && delete e.referrer, e.url && X(e) > Y && (e.url = e.url.slice(0, nt)), e;
648
- }, st = ({ workspaceId: e, siteName: t, siteLogo: n, agentId: r, apiBaseUrl: i, authHeaders: a, children: o }) => {
649
- let s = k(e);
650
- s.current = e;
651
- let c = k(r);
652
- c.current = r;
653
- let { followUps: l, clearOnSend: u, handleData: d } = ue(), [f, p] = A(!1), { conversationIdRef: m, handleFinish: h, reset: g } = le(e), _ = ae({
647
+ if (i && (e.referrer = i), Object.keys(e).length !== 0) return e.description && X(e) > Y && delete e.description, e.referrer && X(e) > Y && delete e.referrer, e.url && X(e) > Y && (e.url = e.url.slice(0, rt)), e;
648
+ }, ct = ({ workspaceId: e, siteName: t, siteLogo: n, agentId: r, apiBaseUrl: i, authHeaders: a, children: s }) => {
649
+ let c = A(e);
650
+ c.current = e;
651
+ let l = A(r);
652
+ l.current = r;
653
+ let { followUps: u, clearOnSend: d, handleData: f } = le(), [p, m] = j(!1), { conversationIdRef: h, handleFinish: g, reset: _ } = ce(e), v = ie({
654
654
  joinStrategy: "none",
655
- transport: ce({
655
+ transport: se({
656
656
  api: `${i}/stream`,
657
657
  credentials: "include",
658
- headers: a,
659
658
  onSendStart: () => {
660
- u(), p(!1);
659
+ d(), m(!1);
661
660
  },
662
661
  getHeaders: () => {
663
- let e = {};
664
- return s.current && (e["Levo-Workspace"] = s.current), e;
662
+ let e = { ...o(a) };
663
+ return c.current && (e["Levo-Workspace"] = c.current), e;
665
664
  },
666
665
  getBody: (e) => {
667
666
  let t = {
668
667
  messages: e.messages,
669
- workspace_id: s.current
668
+ workspace_id: c.current
670
669
  };
671
- m.current && (t.conversation_id = m.current), c.current && (t.agent_id = c.current);
672
- let n = ot();
670
+ h.current && (t.conversation_id = h.current), l.current && (t.agent_id = l.current);
671
+ let n = st();
673
672
  return n && (t.context = n), t;
674
673
  }
675
674
  }),
676
- adapters: { dictation: new re({ interimResults: !1 }) },
677
- onData: d,
678
- onFinish: h,
675
+ adapters: { dictation: new ne({ interimResults: !1 }) },
676
+ onData: f,
677
+ onFinish: g,
679
678
  onError: (e) => {
680
- de(e) ? p(!0) : console.warn("[levo-kb-chat] stream error:", e);
679
+ ue(e) ? m(!0) : console.warn("[levo-kb-chat] stream error:", e);
681
680
  }
682
- }), v = T(() => {
683
- _.threads.switchToNewThread().catch((e) => {
681
+ }), y = E(() => {
682
+ v.threads.switchToNewThread().catch((e) => {
684
683
  console.warn("[levo-kb-chat] switchToNewThread failed:", e);
685
- }), g(), u(), p(!1);
684
+ }), _(), d(), m(!1);
686
685
  }, [
686
+ v,
687
687
  _,
688
- g,
689
- u
688
+ d
690
689
  ]);
691
- return /* @__PURE__ */ b(ne, {
692
- runtime: _,
693
- children: /* @__PURE__ */ b(K.Provider, {
694
- value: { agentUnavailable: f },
695
- children: o ? o({
696
- followUps: l,
697
- onResetChat: v
698
- }) : /* @__PURE__ */ b($e, {
690
+ return /* @__PURE__ */ x(te, {
691
+ runtime: v,
692
+ children: /* @__PURE__ */ x(J.Provider, {
693
+ value: { agentUnavailable: p },
694
+ children: s ? s({
695
+ followUps: u,
696
+ onResetChat: y
697
+ }) : /* @__PURE__ */ x(et, {
699
698
  workspaceId: e,
700
699
  siteName: t,
701
700
  siteLogo: n,
702
701
  apiBaseUrl: i,
703
702
  authHeaders: a,
704
703
  agentId: r,
705
- followUps: l
704
+ followUps: u
706
705
  })
707
706
  })
708
707
  });
709
- }, ct = (e, t, n) => {
710
- D(() => {
708
+ }, lt = (e, t, n) => {
709
+ O(() => {
711
710
  if (!e) return;
712
711
  let r = (e) => {
713
712
  if (e.key !== "Escape" || e.isComposing) return;
@@ -724,14 +723,14 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
724
723
  t,
725
724
  n
726
725
  ]);
727
- }, Z = "(max-width: 639px)", lt = () => {
728
- let [e, t] = A(() => typeof window < "u" && window.matchMedia(Z).matches);
729
- return D(() => {
726
+ }, Z = "(max-width: 639px)", ut = () => {
727
+ let [e, t] = j(() => typeof window < "u" && window.matchMedia(Z).matches);
728
+ return O(() => {
730
729
  let e = window.matchMedia(Z), n = () => t(e.matches);
731
730
  return n(), e.addEventListener("change", n), () => e.removeEventListener("change", n);
732
731
  }, []), e;
733
- }, ut = (e, t) => {
734
- D(() => {
732
+ }, dt = (e, t) => {
733
+ O(() => {
735
734
  let n = t.current, r = window.visualViewport;
736
735
  if (!e || !n || !r || !window.matchMedia(Z).matches) return;
737
736
  let i = () => {
@@ -741,8 +740,8 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
741
740
  r.removeEventListener("resize", i), r.removeEventListener("scroll", i), n.style.removeProperty("--ai-vv-top"), n.style.removeProperty("--ai-vv-height");
742
741
  };
743
742
  }, [e, t]);
744
- }, dt = (e, t, n) => {
745
- D(() => {
743
+ }, ft = (e, t, n) => {
744
+ O(() => {
746
745
  if (!e) return;
747
746
  let r = (e) => {
748
747
  let r = e.composedPath();
@@ -754,56 +753,56 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
754
753
  t,
755
754
  n
756
755
  ]);
757
- }, Q = (...e) => e.filter(Boolean).join(" "), ft = ({ open: e, onToggle: n, askLabel: a, panelId: o, initialDraft: g }) => {
758
- let _ = U(), v = lt(), S = W((e) => e.thread.isRunning), C = W((e) => e.thread.messages.length > 0), w = W((e) => e.composer.text), T = w.trim().length > 0, [E, M] = A(!1);
759
- D(() => {
760
- g && _.thread.composer().setText(g);
761
- }, []);
762
- let N = k(null), P = k(null), F = k(!1);
756
+ }, Q = (...e) => e.filter(Boolean).join(" "), pt = ({ open: e, onToggle: t, askLabel: r, panelId: o, initialDraft: s }) => {
757
+ let _ = G(), v = ut(), y = K((e) => e.thread.isRunning), C = K((e) => e.thread.messages.length > 0), w = K((e) => e.composer.text), T = w.trim().length > 0, [E, D] = j(!1);
763
758
  O(() => {
759
+ s && _.thread.composer().setText(s);
760
+ }, []);
761
+ let N = A(null), P = A(null), F = A(!1);
762
+ k(() => {
764
763
  let e = N.current;
765
764
  !e || document.activeElement === e || (F.current = !0, e.focus({ preventScroll: !0 }));
766
- }, []), O(() => {
765
+ }, []), k(() => {
767
766
  let t = N.current, n = P.current;
768
767
  if (!(!t || !n)) {
769
768
  if (!e) {
770
- t.style.height = "", M(!1);
769
+ t.style.height = "", D(!1);
771
770
  return;
772
771
  }
773
- M(l(n, t));
772
+ D(u(n, t));
774
773
  }
775
774
  }, [w, e]);
776
- let I = k(e);
777
- D(() => {
775
+ let I = A(e);
776
+ O(() => {
778
777
  let t = I.current;
779
778
  I.current = e;
780
779
  let n = N.current;
781
780
  e || !t || !n || document.activeElement === n && n.blur();
782
781
  }, [e]);
783
- let R = k(S);
784
- D(() => {
785
- let e = !R.current && S;
786
- R.current = S, v && e && N.current?.blur();
787
- }, [S, v]);
788
- let z = C ? "Continue conversation" : a;
789
- return /* @__PURE__ */ b("div", {
790
- className: Q(u, e ? p : r),
791
- children: /* @__PURE__ */ x("div", {
782
+ let R = A(y);
783
+ O(() => {
784
+ let e = !R.current && y;
785
+ R.current = y, v && e && N.current?.blur();
786
+ }, [y, v]);
787
+ let B = C ? "Continue conversation" : r;
788
+ return /* @__PURE__ */ x("div", {
789
+ className: Q(d, e ? m : i),
790
+ children: /* @__PURE__ */ S("div", {
792
791
  ref: P,
793
- className: Q(h, E && "ai-chat-pill-surface--stacked"),
792
+ className: Q(g, E && "ai-chat-pill-surface--stacked"),
794
793
  children: [
795
- /* @__PURE__ */ b("button", {
794
+ /* @__PURE__ */ x("button", {
796
795
  type: "button",
797
- onClick: n,
796
+ onClick: t,
798
797
  "aria-label": e ? "Collapse AI chat" : "Expand AI chat",
799
798
  "aria-expanded": e,
800
799
  "aria-controls": o,
801
- className: c,
802
- children: /* @__PURE__ */ b(te, { className: "h-5 w-5" })
800
+ className: l,
801
+ children: /* @__PURE__ */ x(ee, { className: "h-5 w-5" })
803
802
  }),
804
- /* @__PURE__ */ x("div", {
805
- className: f,
806
- children: [/* @__PURE__ */ b(B.Input, {
803
+ /* @__PURE__ */ S("div", {
804
+ className: p,
805
+ children: [/* @__PURE__ */ x(H.Input, {
807
806
  ref: N,
808
807
  "data-ai-chat-composer": "",
809
808
  placeholder: e ? "Ask anything…" : "",
@@ -812,10 +811,10 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
812
811
  F.current = !1;
813
812
  return;
814
813
  }
815
- e || n();
814
+ e || t();
816
815
  },
817
816
  onKeyDown: (e) => {
818
- e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !S && T && _.thread.composer().send());
817
+ e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !y && T && _.thread.composer().send());
819
818
  },
820
819
  rows: 1,
821
820
  submitMode: "enter",
@@ -826,74 +825,74 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
826
825
  autoCorrect: "off",
827
826
  autoCapitalize: "none",
828
827
  inputMode: "text",
829
- className: Q(i, "transition-opacity duration-200", !e && "opacity-0")
830
- }), /* @__PURE__ */ b("span", {
831
- className: Q(s, "transition-opacity duration-150", e && "opacity-0"),
828
+ className: Q(a, "transition-opacity duration-200", !e && "opacity-0")
829
+ }), /* @__PURE__ */ x("span", {
830
+ className: Q(c, "transition-opacity duration-150", e && "opacity-0"),
832
831
  "aria-hidden": !0,
833
- children: z
832
+ children: B
834
833
  })]
835
834
  }),
836
- /* @__PURE__ */ x("div", {
837
- className: m,
838
- children: [e && /* @__PURE__ */ x(y, { children: [/* @__PURE__ */ b(B.If, {
835
+ /* @__PURE__ */ S("div", {
836
+ className: h,
837
+ children: [e && /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(H.If, {
839
838
  dictation: !1,
840
- children: /* @__PURE__ */ b(B.Dictate, {
839
+ children: /* @__PURE__ */ x(H.Dictate, {
841
840
  "aria-label": "Start dictation",
842
841
  className: "ai-chat-icon-btn flex h-11 w-11 flex-shrink-0 items-center justify-center rounded-full transition-colors active:scale-95",
843
- children: /* @__PURE__ */ b(ee, { className: "h-5 w-5" })
842
+ children: /* @__PURE__ */ x(L, { className: "h-5 w-5" })
844
843
  })
845
- }), /* @__PURE__ */ b(B.If, {
844
+ }), /* @__PURE__ */ x(H.If, {
846
845
  dictation: !0,
847
- children: /* @__PURE__ */ b(B.StopDictation, {
846
+ children: /* @__PURE__ */ x(H.StopDictation, {
848
847
  "aria-label": "Stop dictation",
849
848
  className: "flex h-11 w-11 flex-shrink-0 animate-pulse items-center justify-center rounded-full bg-red-500/15 text-red-500 transition-colors hover:bg-red-500/25",
850
- children: /* @__PURE__ */ b(L, { className: "h-4 w-4 fill-current" })
849
+ children: /* @__PURE__ */ x(z, { className: "h-4 w-4 fill-current" })
851
850
  })
852
- })] }), e ? S ? /* @__PURE__ */ b("button", {
851
+ })] }), e ? y ? /* @__PURE__ */ x("button", {
853
852
  type: "button",
854
853
  onClick: () => _.thread.cancelRun(),
855
854
  "aria-label": "Stop generating",
856
- className: t,
857
- style: d,
858
- children: /* @__PURE__ */ b(L, { className: "h-4 w-4 fill-current" })
859
- }) : /* @__PURE__ */ b(B.Send, {
855
+ className: n,
856
+ style: f,
857
+ children: /* @__PURE__ */ x(z, { className: "h-4 w-4 fill-current" })
858
+ }) : /* @__PURE__ */ x(H.Send, {
860
859
  "aria-label": "Send message",
861
- className: Q(t, "disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100"),
862
- style: d,
863
- children: /* @__PURE__ */ b(j, { className: "h-5 w-5 stroke-[2.5px]" })
864
- }) : /* @__PURE__ */ b("button", {
860
+ className: Q(n, "disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100"),
861
+ style: f,
862
+ children: /* @__PURE__ */ x(M, { className: "h-5 w-5 stroke-[2.5px]" })
863
+ }) : /* @__PURE__ */ x("button", {
865
864
  type: "button",
866
- onClick: n,
865
+ onClick: t,
867
866
  "aria-label": "Open AI chat",
868
- className: t,
869
- style: d,
870
- children: /* @__PURE__ */ b(j, { className: "h-5 w-5 stroke-[2.5px]" })
867
+ className: n,
868
+ style: f,
869
+ children: /* @__PURE__ */ x(M, { className: "h-5 w-5 stroke-[2.5px]" })
871
870
  })]
872
871
  })
873
872
  ]
874
873
  })
875
874
  });
876
- }, pt = "linear-gradient(to right, color-mix(in oklch, var(--ai-chat-thinking-1, oklch(0.65 0.15 253.81)) 40%, transparent), color-mix(in oklch, var(--ai-chat-thinking-2, oklch(0.65 0.15 17.5826)) 40%, transparent))", $ = (...e) => e.filter(Boolean).join(" "), mt = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, siteSlug: i, agentId: a, apiBaseUrl: s, authHeaders: c, initialOpen: l, initialDraft: u, showBranding: d = !0 }) => {
877
- let [f, p] = A(!1);
878
- D(() => {
875
+ }, mt = "linear-gradient(to right, color-mix(in oklch, var(--ai-chat-thinking-1, oklch(0.65 0.15 253.81)) 40%, transparent), color-mix(in oklch, var(--ai-chat-thinking-2, oklch(0.65 0.15 17.5826)) 40%, transparent))", $ = (...e) => e.filter(Boolean).join(" "), ht = ({ workspaceId: e, siteName: t, siteLogo: n, siteIcon: r, siteSlug: i, agentId: a, apiBaseUrl: o, authHeaders: c, initialOpen: l, initialDraft: u, showBranding: d = !0 }) => {
876
+ let [f, p] = j(!1);
877
+ O(() => {
879
878
  if (!l) return;
880
879
  let e = requestAnimationFrame(() => p(!0));
881
880
  return () => cancelAnimationFrame(e);
882
881
  }, [l]);
883
- let m = `kb-chat-panel-${e ?? "default"}`, h = k(null), g = k(null), _ = T(() => p(!1), []);
884
- ct(f, g, _), dt(f, h, _), ut(f, h);
885
- let v = o(t);
886
- return /* @__PURE__ */ b("div", {
882
+ let m = `kb-chat-panel-${e ?? "default"}`, h = A(null), g = A(null), _ = E(() => p(!1), []);
883
+ lt(f, g, _), ft(f, h, _), dt(f, h);
884
+ let v = s(t);
885
+ return /* @__PURE__ */ x("div", {
887
886
  ref: h,
888
887
  className: $("ai-chat-launcher pointer-events-none fixed bottom-5 left-1/2 z-[60] flex -translate-x-1/2 flex-col", "ai-chat-kb-wrap", f ? "w-[min(34rem,calc(100vw-1.5rem))]" : "ai-chat-kb-wrap-closed w-[19.5rem]"),
889
- children: /* @__PURE__ */ b(st, {
888
+ children: /* @__PURE__ */ x(ct, {
890
889
  workspaceId: e,
891
890
  siteName: t,
892
891
  siteLogo: n,
893
892
  agentId: a,
894
- apiBaseUrl: s,
893
+ apiBaseUrl: o,
895
894
  authHeaders: c,
896
- children: ({ followUps: o, onResetChat: l }) => /* @__PURE__ */ b(gt, {
895
+ children: ({ followUps: s, onResetChat: l }) => /* @__PURE__ */ x(_t, {
897
896
  open: f,
898
897
  onToggle: () => p((e) => !e),
899
898
  threadStateRef: g,
@@ -905,27 +904,27 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
905
904
  siteSlug: i,
906
905
  initialDraft: u,
907
906
  showBranding: d,
908
- followUps: o,
909
- thread: /* @__PURE__ */ b($e, {
907
+ followUps: s,
908
+ thread: /* @__PURE__ */ x(et, {
910
909
  workspaceId: e,
911
910
  siteName: t,
912
911
  siteLogo: n,
913
912
  agentId: a,
914
- apiBaseUrl: s,
913
+ apiBaseUrl: o,
915
914
  authHeaders: c,
916
- followUps: o,
915
+ followUps: s,
917
916
  hideComposer: !0
918
917
  })
919
918
  })
920
919
  })
921
920
  });
922
- }, ht = [
921
+ }, gt = [
923
922
  "rounded-full border border-zinc-200 bg-white text-zinc-700",
924
923
  "px-3 py-1 text-[13px] leading-snug",
925
924
  "transition-[border-color,background-color,color,transform] duration-150 hover:border-zinc-300 hover:bg-zinc-50 hover:text-zinc-900 active:scale-95"
926
- ].join(" "), gt = ({ open: e, onToggle: t, threadStateRef: n, onResetChat: r, askLabel: i, panelId: a, siteName: o, siteIcon: s, siteSlug: c, initialDraft: l, showBranding: u, followUps: d, thread: f }) => {
927
- let p = U(), m = W((e) => e.thread.isRunning), h = W((e) => e.thread.messages.length > 0), _ = lt() ? d.slice(0, 2) : d;
928
- D(() => (n.current = {
925
+ ].join(" "), _t = ({ open: e, onToggle: t, threadStateRef: n, onResetChat: r, askLabel: i, panelId: a, siteName: o, siteIcon: s, siteSlug: c, initialDraft: l, showBranding: u, followUps: d, thread: f }) => {
926
+ let p = G(), m = K((e) => e.thread.isRunning), h = K((e) => e.thread.messages.length > 0), g = ut() ? d.slice(0, 2) : d;
927
+ O(() => (n.current = {
929
928
  isRunning: m,
930
929
  cancelRun: () => p.thread.cancelRun()
931
930
  }, () => {
@@ -935,74 +934,74 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
935
934
  p,
936
935
  n
937
936
  ]);
938
- let v = T((e) => {
939
- g(p.thread.composer(), e);
940
- }, [p]), S = o ?? "Ask AI", C = `https://levo.so/?utm_source=${encodeURIComponent(c || "website")}&utm_term=Powered%20By%20levo.so&utm_campaign=site_agent&utm_medium=organic_site_agent`;
941
- return /* @__PURE__ */ x(y, { children: [
942
- /* @__PURE__ */ b("div", {
937
+ let _ = E((e) => {
938
+ y(p.thread.composer(), e);
939
+ }, [p]), v = o ?? "Ask AI", C = `https://levo.so/?utm_source=${encodeURIComponent(c || "website")}&utm_term=Powered%20By%20levo.so&utm_campaign=site_agent&utm_medium=organic_site_agent`;
940
+ return /* @__PURE__ */ S(b, { children: [
941
+ /* @__PURE__ */ x("div", {
943
942
  "aria-hidden": !0,
944
943
  className: $("absolute inset-0", e ? "pointer-events-auto" : "pointer-events-none"),
945
944
  style: { filter: "drop-shadow(0 16px 32px rgba(0,0,0,0.16)) drop-shadow(0 2px 8px rgba(0,0,0,0.08))" },
946
- children: /* @__PURE__ */ b("div", {
945
+ children: /* @__PURE__ */ x("div", {
947
946
  className: $("ai-chat-kb-surface h-full w-full p-[2px]", !e && "ai-chat-kb-surface-closed"),
948
- style: { background: pt },
949
- children: /* @__PURE__ */ b("div", { className: "h-full w-full rounded-t-[26px] rounded-b-[40px] bg-white" })
947
+ style: { background: mt },
948
+ children: /* @__PURE__ */ x("div", { className: "h-full w-full rounded-t-[26px] rounded-b-[40px] bg-white" })
950
949
  })
951
950
  }),
952
- /* @__PURE__ */ x("section", {
951
+ /* @__PURE__ */ S("section", {
953
952
  id: a,
954
953
  "aria-label": "AI chat",
955
954
  inert: !e,
956
955
  className: $("relative z-10 flex min-h-0 flex-col", "ai-chat-kb-content", e ? "pointer-events-auto" : "ai-chat-kb-content-closed pointer-events-none"),
957
956
  children: [
958
- /* @__PURE__ */ x("header", {
957
+ /* @__PURE__ */ S("header", {
959
958
  className: "flex h-14 w-full shrink-0 items-center justify-between gap-2 px-4",
960
- children: [/* @__PURE__ */ x("div", {
959
+ children: [/* @__PURE__ */ S("div", {
961
960
  className: "flex min-w-0 items-center gap-2",
962
- children: [s ? /* @__PURE__ */ b("img", {
961
+ children: [s ? /* @__PURE__ */ x("img", {
963
962
  src: s,
964
963
  alt: "",
965
964
  className: "h-6 w-6 shrink-0 rounded-sm object-contain"
966
- }) : null, /* @__PURE__ */ b("span", {
965
+ }) : null, /* @__PURE__ */ x("span", {
967
966
  className: "truncate font-semibold text-sm text-zinc-900",
968
- children: S
967
+ children: v
969
968
  })]
970
- }), /* @__PURE__ */ x("div", {
969
+ }), /* @__PURE__ */ S("div", {
971
970
  className: "flex flex-shrink-0 items-center gap-1",
972
- children: [h && /* @__PURE__ */ b("button", {
971
+ children: [h && /* @__PURE__ */ x("button", {
973
972
  type: "button",
974
973
  onClick: r,
975
974
  "aria-label": "Start new chat",
976
975
  title: "Start new chat",
977
976
  className: "ai-chat-icon-btn flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full transition-[background-color,color,transform] duration-150 active:scale-95",
978
- children: /* @__PURE__ */ b(F, { className: "h-4 w-4" })
979
- }), /* @__PURE__ */ b("button", {
977
+ children: /* @__PURE__ */ x(I, { className: "h-4 w-4" })
978
+ }), /* @__PURE__ */ x("button", {
980
979
  type: "button",
981
980
  onClick: t,
982
981
  "aria-label": "Close AI chat",
983
982
  className: "ai-chat-icon-btn flex h-8 w-8 flex-shrink-0 items-center justify-center rounded-full transition-[background-color,color,transform] duration-150 active:scale-95",
984
- children: /* @__PURE__ */ b(R, { className: "h-4 w-4" })
983
+ children: /* @__PURE__ */ x(B, { className: "h-4 w-4" })
985
984
  })]
986
985
  })]
987
986
  }),
988
- /* @__PURE__ */ b("div", { className: "mx-4 h-px shrink-0 bg-zinc-100" }),
989
- /* @__PURE__ */ b("div", {
987
+ /* @__PURE__ */ x("div", { className: "mx-4 h-px shrink-0 bg-zinc-100" }),
988
+ /* @__PURE__ */ x("div", {
990
989
  className: "ai-chat-kb-thread flex max-h-[min(60vh,32rem)] min-h-0 flex-col overflow-hidden",
991
990
  children: f
992
991
  }),
993
- _.length > 0 && !m && /* @__PURE__ */ b("div", {
992
+ g.length > 0 && !m && /* @__PURE__ */ x("div", {
994
993
  className: "shrink-0 px-4 pt-1 pb-2",
995
- children: /* @__PURE__ */ b(G, {
996
- chips: _,
997
- onSelect: v,
998
- chipClassName: ht
994
+ children: /* @__PURE__ */ x(q, {
995
+ chips: g,
996
+ onSelect: _,
997
+ chipClassName: gt
999
998
  })
1000
999
  })
1001
1000
  ]
1002
1001
  }),
1003
- /* @__PURE__ */ b("div", {
1002
+ /* @__PURE__ */ x("div", {
1004
1003
  className: "ai-chat-kb-pillbox pointer-events-auto relative z-20 mx-3 mt-1",
1005
- children: /* @__PURE__ */ b(ft, {
1004
+ children: /* @__PURE__ */ x(pt, {
1006
1005
  open: e,
1007
1006
  onToggle: t,
1008
1007
  askLabel: i,
@@ -1010,13 +1009,13 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1010
1009
  initialDraft: l
1011
1010
  })
1012
1011
  }),
1013
- u && /* @__PURE__ */ b("div", {
1012
+ u && /* @__PURE__ */ x("div", {
1014
1013
  className: $("pointer-events-none relative z-20 grid shrink-0 transition-[grid-template-rows] duration-[450ms] ease-[cubic-bezier(0.32,0.72,0,1)]", e ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
1015
- children: /* @__PURE__ */ b("div", {
1014
+ children: /* @__PURE__ */ x("div", {
1016
1015
  className: "overflow-hidden",
1017
- children: /* @__PURE__ */ x("p", {
1016
+ children: /* @__PURE__ */ S("p", {
1018
1017
  className: "pt-2 text-center text-[11px] text-zinc-400",
1019
- children: ["Powered by ", /* @__PURE__ */ b("a", {
1018
+ children: ["Powered by ", /* @__PURE__ */ x("a", {
1020
1019
  href: C,
1021
1020
  target: "_blank",
1022
1021
  rel: "noopener noreferrer",
@@ -1026,8 +1025,8 @@ var G = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1026
1025
  })
1027
1026
  })
1028
1027
  }),
1029
- /* @__PURE__ */ b("div", { className: "h-3" })
1028
+ /* @__PURE__ */ x("div", { className: "h-3" })
1030
1029
  ] });
1031
1030
  };
1032
1031
  //#endregion
1033
- export { mt as KBChatWidget };
1032
+ export { ht as KBChatWidget };