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