@levo-so/site-runtime 0.3.7 → 0.3.8

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.
Files changed (37) hide show
  1. package/CollectionField-C-6a1ud4.js +270 -0
  2. package/{CollectionInput-B1qV4QEH.js → CollectionInput-BJ__qcbk.js} +40 -40
  3. package/DateTimeWidget-hFjcn3o6.js +255 -0
  4. package/{Dialog-DVB4WpBS.js → Dialog-dT7y641z.js} +43 -43
  5. package/{KBChatWidget-Cnq0DCOQ.js → KBChatWidget-ClHFDgJ5.js} +236 -236
  6. package/{LevoProvider-nmIbMlsk.js → LevoProvider-Bsjkcwc8.js} +8 -8
  7. package/PhoneWidget-BmBO-kvA.js +99 -0
  8. package/{Popover-C7zZHBIc.js → Popover-3N88sRp4.js} +20 -20
  9. package/{PopupBody-DZVwDLkg-yrot8Uqb.js → PopupBody-DZVwDLkg-Cfy3lWGs.js} +33 -33
  10. package/{PopupRenderer-BjW1jg70-Biwj2bIc.js → PopupRenderer-BjW1jg70-W2y-PEPH.js} +81 -81
  11. package/{RichTextWidget-BOrVIR2j.js → RichTextWidget-DkKHEq4j.js} +139 -139
  12. package/ThemeProvider-DutrjSTF.js +116 -0
  13. package/{Tooltip-BIgrpetu.js → Tooltip-CQB0LyxK.js} +20 -20
  14. package/{VerifyButton-CA1GtEZJ.js → VerifyButton-BUT70lgz.js} +65 -65
  15. package/dist-CRDgdAkQ.js +3631 -0
  16. package/{dist-Cb6sb7nO.js → dist-DPmVG7VB.js} +13 -13
  17. package/index.d.ts +560 -3
  18. package/index.js +1203 -713
  19. package/inlineBaseTheme-BB9e6h5f.js +9 -0
  20. package/{inlineCollectionTheme-DYYMrmcE.js → inlineCollectionTheme-CWcMCUti.js} +1 -1
  21. package/{kbChat-DIb4AS7E.js → kbChat-C00LVlxP.js} +27 -27
  22. package/{nodeAlignment-D70kOcui.js → nodeAlignment-BnJljFlw.js} +1 -1
  23. package/package.json +3 -3
  24. package/popups.js +1 -1
  25. package/{react-6kO0cqgr.js → react-CV3jf2mc.js} +1 -1
  26. package/styles.css +1 -1
  27. package/{generateRadiusScale-54mE9ikx.js → themeVars.cssm-ByhhC2Jm.js} +17 -17
  28. package/usePopupRedirect-BThP_YPW-COUseDik.js +80 -0
  29. package/CollectionField-C59pmeQw.js +0 -270
  30. package/DateTimeWidget-Cctsvcrs.js +0 -255
  31. package/PhoneWidget-J3VTMWJH.js +0 -99
  32. package/ThemeProvider-BQmIB5tr.js +0 -116
  33. package/dist-C8gLeklT.js +0 -3559
  34. package/inlineBaseTheme-B6E9zzyp.js +0 -9
  35. package/usePopupRedirect-BThP_YPW-DoixMAB9.js +0 -80
  36. /package/{createThemeExtension-DhGk81nV.js → createThemeExtension-4AUn51iJ.js} +0 -0
  37. /package/{theme.cssm-mkQwezuj.js → theme.cssm-DUzmx76l.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use client";
2
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";
3
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
4
+ import { Children as y, createContext as b, isValidElement as x, useCallback as S, useContext as C, useEffect as w, useLayoutEffect as T, useRef as E, useState as D } from "react";
5
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
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
7
  import { AssistantChatTransport as ie, useChatRuntime as ae } from "@assistant-ui/react-ai-sdk";
@@ -15,9 +15,9 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
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__ */ E("div", {
18
+ return /* @__PURE__ */ _("div", {
19
19
  className: ["flex flex-wrap gap-1.5", r].filter(Boolean).join(" "),
20
- children: e.map((e, n) => /* @__PURE__ */ E("button", {
20
+ children: e.map((e, n) => /* @__PURE__ */ _("button", {
21
21
  type: "button",
22
22
  onClick: () => t(e),
23
23
  className: ["ai-chat-chip", i ?? a].join(" "),
@@ -37,10 +37,10 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
37
37
  }
38
38
  })
39
39
  }), le = (e) => {
40
- let t = C(null), n = C(null);
40
+ let t = E(null), n = E(null);
41
41
  return n.current !== (e ?? null) && (n.current = e ?? null, t.current = null), {
42
42
  conversationIdRef: t,
43
- handleFinish: y(({ message: e }) => {
43
+ handleFinish: S(({ 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 H = ({ 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: y(() => {
51
+ reset: S(() => {
52
52
  t.current = null;
53
53
  }, [])
54
54
  };
55
55
  }, ue = (e = []) => {
56
- let [t, n] = w(e);
56
+ let [t, n] = D(e);
57
57
  return {
58
58
  followUps: t,
59
59
  setFollowUps: n,
60
- clearOnSend: y(() => n([]), []),
61
- handleData: y((e) => {
60
+ clearOnSend: S(() => n([]), []),
61
+ handleData: S((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"), 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", {
67
+ }, de = (e) => e instanceof Error && e.message.includes("intelligence.site_agent.NO_ACTIVE_AGENT"), U = b({ agentUnavailable: !1 }), fe = () => C(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__ */ v("button", {
68
68
  type: "button",
69
69
  "aria-label": "Scroll to bottom",
70
70
  onClick: e,
71
71
  className: pe(me, r),
72
- children: [/* @__PURE__ */ E(ee, { className: "h-3 w-3" }), !n && (t ? "New messages" : "Scroll to bottom")]
72
+ children: [/* @__PURE__ */ _(ee, { className: "h-3 w-3" }), !n && (t ? "New messages" : "Scroll to bottom")]
73
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);
74
+ let [i, a] = D(null), o = t ? JSON.stringify(t) : "", s = E(t);
75
75
  s.current = t;
76
- let c = C(n);
77
- return c.current = n, x(() => {
76
+ let c = E(n);
77
+ return c.current = n, w(() => {
78
78
  if (!r || !e) {
79
79
  a([...c.current]);
80
80
  return;
@@ -104,10 +104,10 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
104
104
  o
105
105
  ]), i;
106
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);
107
+ let a = E(!1), [o, s] = D(!0), c = E(n);
108
108
  c.current = n;
109
- let l = C(i);
110
- return l.current = i, x(() => {
109
+ let l = E(i);
110
+ return l.current = i, w(() => {
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;
@@ -128,7 +128,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
128
128
  t,
129
129
  e,
130
130
  r
131
- ]), x(() => {
131
+ ]), w(() => {
132
132
  let t = e.current;
133
133
  if (!t) return;
134
134
  let n = () => {
@@ -151,7 +151,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
151
151
  });
152
152
  }
153
153
  };
154
- }, W = (...e) => e.filter(Boolean).join(" "), G = ({ onStop: e }) => /* @__PURE__ */ E("button", {
154
+ }, W = (...e) => e.filter(Boolean).join(" "), G = ({ onStop: e }) => /* @__PURE__ */ _("button", {
155
155
  type: "button",
156
156
  onClick: e,
157
157
  "aria-label": "Stop generating",
@@ -160,34 +160,34 @@ var H = ({ 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__ */ E(N, { className: "h-3.5 w-3.5 fill-current" })
164
- }), K = () => /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(L.If, {
163
+ children: /* @__PURE__ */ _(N, { className: "h-3.5 w-3.5 fill-current" })
164
+ }), K = () => /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(L.If, {
165
165
  dictation: !1,
166
- children: /* @__PURE__ */ E(L.Dictate, {
166
+ children: /* @__PURE__ */ _(L.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__ */ E(te, { className: "h-4 w-4" })
168
+ children: /* @__PURE__ */ _(te, { className: "h-4 w-4" })
169
169
  })
170
- }), /* @__PURE__ */ E(L.If, {
170
+ }), /* @__PURE__ */ _(L.If, {
171
171
  dictation: !0,
172
- children: /* @__PURE__ */ E(L.StopDictation, {
172
+ children: /* @__PURE__ */ _(L.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__ */ E(N, { className: "h-3 w-3 fill-current" })
174
+ children: /* @__PURE__ */ _(N, { className: "h-3 w-3 fill-current" })
175
175
  })
176
- })] }), xe = () => /* @__PURE__ */ E(L.Send, {
176
+ })] }), xe = () => /* @__PURE__ */ _(L.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__ */ E(O, { className: "h-5 w-5 stroke-[2.5px]" })
183
+ children: /* @__PURE__ */ _(O, { className: "h-5 w-5 stroke-[2.5px]" })
184
184
  }), Se = ({ variant: e, isRunning: t, onStop: n }) => {
185
185
  let r = (e) => {
186
186
  e.nativeEvent.isComposing || t && e.key === "Enter" && !e.shiftKey && e.preventDefault();
187
187
  };
188
- return e === "expanded" ? /* @__PURE__ */ D("div", {
188
+ return e === "expanded" ? /* @__PURE__ */ v("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__ */ E(L.Input, {
190
+ children: [/* @__PURE__ */ _(L.Input, {
191
191
  "data-ai-chat-composer": "",
192
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]"),
193
193
  placeholder: "Ask anything about this site…",
@@ -199,14 +199,14 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
199
199
  inputMode: "text",
200
200
  onInput: (e) => i(e.currentTarget),
201
201
  onKeyDown: r
202
- }), /* @__PURE__ */ D("div", {
202
+ }), /* @__PURE__ */ v("div", {
203
203
  className: "flex items-center justify-between px-3 pt-1 pb-2",
204
- children: [/* @__PURE__ */ E(K, {}), t ? /* @__PURE__ */ E(G, { onStop: n }) : /* @__PURE__ */ E(xe, {})]
204
+ children: [/* @__PURE__ */ _(K, {}), t ? /* @__PURE__ */ _(G, { onStop: n }) : /* @__PURE__ */ _(xe, {})]
205
205
  })]
206
- }) : /* @__PURE__ */ D("div", {
206
+ }) : /* @__PURE__ */ v("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__ */ E(L.Input, {
209
+ /* @__PURE__ */ _(L.Input, {
210
210
  "data-ai-chat-composer": "",
211
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]"),
212
212
  placeholder: "Ask a follow-up…",
@@ -219,33 +219,33 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
219
219
  onInput: (e) => i(e.currentTarget),
220
220
  onKeyDown: r
221
221
  }),
222
- /* @__PURE__ */ E(K, {}),
223
- t ? /* @__PURE__ */ E(G, { onStop: n }) : /* @__PURE__ */ E(xe, {})
222
+ /* @__PURE__ */ _(K, {}),
223
+ t ? /* @__PURE__ */ _(G, { onStop: n }) : /* @__PURE__ */ _(xe, {})
224
224
  ]
225
225
  });
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, {
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__ */ _(R.Root, {
227
227
  className: "mb-4 pr-2 pl-0",
228
- children: /* @__PURE__ */ D(L.Root, { children: [/* @__PURE__ */ E("div", {
228
+ children: /* @__PURE__ */ v(L.Root, { children: [/* @__PURE__ */ _("div", {
229
229
  className: t,
230
- children: /* @__PURE__ */ E(L.Input, {
230
+ children: /* @__PURE__ */ _(L.Input, {
231
231
  className: n,
232
232
  rows: 1,
233
233
  onInput: (t) => i(t.currentTarget, e)
234
234
  })
235
- }), /* @__PURE__ */ D("div", {
235
+ }), /* @__PURE__ */ v("div", {
236
236
  className: "mt-2 flex justify-end gap-1.5",
237
- children: [/* @__PURE__ */ E(L.Cancel, {
237
+ children: [/* @__PURE__ */ _(L.Cancel, {
238
238
  className: r,
239
239
  children: "Cancel"
240
- }), /* @__PURE__ */ E(L.Send, {
240
+ }), /* @__PURE__ */ _(L.Send, {
241
241
  className: a,
242
242
  style: o,
243
243
  children: "Save"
244
244
  })]
245
245
  })] })
246
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);
248
- x(() => {
247
+ let [a, o] = D("idle"), s = V((e) => e.message);
248
+ w(() => {
249
249
  if (a === "idle") return;
250
250
  let e = setTimeout(() => o("idle"), 1500);
251
251
  return () => clearTimeout(e);
@@ -258,51 +258,51 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
258
258
  o("error");
259
259
  }
260
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", {
261
+ return /* @__PURE__ */ _("button", {
262
262
  type: "button",
263
263
  "aria-label": u,
264
264
  onClick: c,
265
265
  className: [r, l].filter(Boolean).join(" "),
266
- children: /* @__PURE__ */ E(d, { className: i })
266
+ children: /* @__PURE__ */ _(d, { className: i })
267
267
  });
268
268
  }, ke = ({ children: e }) => {
269
- let [t, n] = w(!1), r = "plaintext", i = "";
270
- return g.forEach(e, (e) => {
271
- if (v(e)) {
269
+ let [t, n] = D(!1), r = "plaintext", i = "";
270
+ return y.forEach(e, (e) => {
271
+ if (x(e)) {
272
272
  let t = e.props, n = /language-(\w+)/.exec(t.className ?? "");
273
273
  n && (r = n[1] ?? r), typeof t.children == "string" && (i = t.children.trim());
274
274
  }
275
- }), /* @__PURE__ */ D("div", {
275
+ }), /* @__PURE__ */ v("div", {
276
276
  className: "ai-chat-code not-prose my-4 overflow-hidden rounded-xl border",
277
- children: [/* @__PURE__ */ D("div", {
277
+ children: [/* @__PURE__ */ v("div", {
278
278
  className: "ai-chat-code__header flex items-center justify-between px-4 py-2",
279
- children: [/* @__PURE__ */ E("span", {
279
+ children: [/* @__PURE__ */ _("span", {
280
280
  className: "ai-chat-code__label font-mono text-[10px] uppercase tracking-widest",
281
281
  children: r
282
- }), /* @__PURE__ */ E("button", {
282
+ }), /* @__PURE__ */ _("button", {
283
283
  type: "button",
284
284
  onClick: () => navigator.clipboard.writeText(i).then(() => {
285
285
  n(!0), setTimeout(() => n(!1), 2e3);
286
286
  }).catch(() => {}),
287
287
  className: "ai-chat-code__copy flex items-center gap-1.5 rounded px-2 py-0.5 text-[10px] transition-colors",
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" })] })
288
+ children: t ? /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(k, { className: "h-3 w-3 text-emerald-500" }), /* @__PURE__ */ _("span", { children: "Copied!" })] }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(A, { className: "h-3 w-3" }), /* @__PURE__ */ _("span", { children: "Copy" })] })
289
289
  })]
290
- }), /* @__PURE__ */ E("pre", {
290
+ }), /* @__PURE__ */ _("pre", {
291
291
  className: "ai-chat-code__pre overflow-x-auto px-4 py-4 font-mono text-sm leading-relaxed",
292
292
  children: e
293
293
  })]
294
294
  });
295
- }, Ae = (e) => /* @__PURE__ */ E("a", {
295
+ }, Ae = (e) => /* @__PURE__ */ _("a", {
296
296
  ...e,
297
297
  target: "_blank",
298
298
  rel: "noopener noreferrer"
299
- }), je = ({ className: e, ...t }) => /* @__PURE__ */ E("div", {
299
+ }), je = ({ className: e, ...t }) => /* @__PURE__ */ _("div", {
300
300
  className: "w-full max-w-full overflow-x-auto",
301
- children: /* @__PURE__ */ E("table", {
301
+ children: /* @__PURE__ */ _("table", {
302
302
  ...t,
303
303
  className: ["w-max min-w-full [&_td]:max-w-[20rem] [&_th]:max-w-[20rem]", e].filter(Boolean).join(" ")
304
304
  })
305
- }), Me = () => /* @__PURE__ */ E(oe, {
305
+ }), Me = () => /* @__PURE__ */ _(oe, {
306
306
  remarkPlugins: [se],
307
307
  components: {
308
308
  pre: ke,
@@ -327,8 +327,8 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
327
327
  let t = Math.floor(e / 60), n = e % 60;
328
328
  return t > 0 ? `${t}m ${n.toString().padStart(2, "0")}s` : `${n}s`;
329
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);
331
- x(() => {
330
+ let [a, o] = D(() => e.length > 0 ? Math.floor(Math.random() * e.length) : 0), [s, c] = D(0);
331
+ w(() => {
332
332
  let t = e.length > 0 ? setInterval(() => {
333
333
  o((t) => (t + 1) % e.length);
334
334
  }, 2800) : null, n = setInterval(() => {
@@ -339,77 +339,77 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
339
339
  };
340
340
  }, [e.length]);
341
341
  let l = e[a] ?? "Thinking", u = s >= 3, d = s >= 30;
342
- return /* @__PURE__ */ D("div", {
342
+ return /* @__PURE__ */ v("div", {
343
343
  className: "flex items-center gap-3 py-1",
344
344
  children: [
345
- /* @__PURE__ */ D("div", {
345
+ /* @__PURE__ */ v("div", {
346
346
  className: "ai-dust",
347
347
  children: [
348
- /* @__PURE__ */ E("span", { style: {
348
+ /* @__PURE__ */ _("span", { style: {
349
349
  left: "4px",
350
350
  "--delay": ".3s"
351
351
  } }),
352
- /* @__PURE__ */ E("span", { style: {
352
+ /* @__PURE__ */ _("span", { style: {
353
353
  left: "12px",
354
354
  "--delay": "0s"
355
355
  } }),
356
- /* @__PURE__ */ E("span", { style: {
356
+ /* @__PURE__ */ _("span", { style: {
357
357
  left: "20px",
358
358
  "--delay": ".6s"
359
359
  } })
360
360
  ]
361
361
  }),
362
- /* @__PURE__ */ D("span", {
362
+ /* @__PURE__ */ v("span", {
363
363
  className: `${t} font-semibold text-sm transition-opacity duration-500`,
364
364
  children: [l, "…"]
365
365
  }),
366
- u && /* @__PURE__ */ D("span", {
366
+ u && /* @__PURE__ */ v("span", {
367
367
  className: n,
368
- children: [Pe(s), d && /* @__PURE__ */ E("span", {
368
+ children: [Pe(s), d && /* @__PURE__ */ _("span", {
369
369
  className: r,
370
370
  children: i
371
371
  })]
372
372
  })
373
373
  ]
374
374
  });
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", {
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__ */ _(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), y = t ?? R.Content, b = g.status?.type === "running", x = /* @__PURE__ */ _("div", {
377
377
  className: i,
378
- children: /* @__PURE__ */ E(_, { components: {
378
+ children: /* @__PURE__ */ _(y, { components: {
379
379
  Text: Me,
380
380
  tools: { Fallback: e }
381
381
  } })
382
382
  });
383
- return /* @__PURE__ */ E(R.Root, {
383
+ return /* @__PURE__ */ _(R.Root, {
384
384
  className: r,
385
- children: /* @__PURE__ */ D("div", {
385
+ children: /* @__PURE__ */ v("div", {
386
386
  className: "flex min-w-0 flex-col",
387
387
  children: [
388
- o ? o(y) : y,
389
- v && /* @__PURE__ */ E("div", {
388
+ o ? o(x) : x,
389
+ b && /* @__PURE__ */ _("div", {
390
390
  className: "mt-1",
391
391
  children: n
392
392
  }),
393
- !v && m && /* @__PURE__ */ E("div", {
393
+ !b && m && /* @__PURE__ */ _("div", {
394
394
  className: "mt-2",
395
395
  children: m
396
396
  }),
397
- !v && /* @__PURE__ */ D("div", {
397
+ !b && /* @__PURE__ */ v("div", {
398
398
  className: a,
399
399
  children: [
400
- /* @__PURE__ */ E("span", {
400
+ /* @__PURE__ */ _("span", {
401
401
  className: d,
402
402
  children: h(g.createdAt, f)
403
403
  }),
404
404
  s,
405
- /* @__PURE__ */ D(F.Root, {
405
+ /* @__PURE__ */ v(F.Root, {
406
406
  className: "flex items-center gap-0.5",
407
- children: [/* @__PURE__ */ E(Oe, {
407
+ children: [/* @__PURE__ */ _(Oe, {
408
408
  idleClassName: c,
409
409
  copiedClassName: l
410
- }), !p && /* @__PURE__ */ E(F.Reload, {
410
+ }), !p && /* @__PURE__ */ _(F.Reload, {
411
411
  className: u,
412
- children: /* @__PURE__ */ E(M, { className: "h-3 w-3" })
412
+ children: /* @__PURE__ */ _(M, { className: "h-3 w-3" })
413
413
  })]
414
414
  })
415
415
  ]
@@ -419,26 +419,26 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
419
419
  });
420
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
421
  let d = V((e) => e.message);
422
- return /* @__PURE__ */ D(R.Root, {
422
+ return /* @__PURE__ */ v(R.Root, {
423
423
  className: t,
424
424
  "data-user-message": "true",
425
425
  children: [
426
426
  e,
427
- /* @__PURE__ */ E("div", {
427
+ /* @__PURE__ */ _("div", {
428
428
  className: n,
429
- children: r ?? /* @__PURE__ */ E(R.Content, {})
429
+ children: r ?? /* @__PURE__ */ _(R.Content, {})
430
430
  }),
431
- /* @__PURE__ */ D("div", {
431
+ /* @__PURE__ */ v("div", {
432
432
  className: i,
433
- children: [/* @__PURE__ */ E("span", {
433
+ children: [/* @__PURE__ */ _("span", {
434
434
  className: a,
435
435
  children: h(d.createdAt, l)
436
- }), /* @__PURE__ */ D(F.Root, {
436
+ }), /* @__PURE__ */ v(F.Root, {
437
437
  className: "flex items-center gap-0.5",
438
- children: [/* @__PURE__ */ E(Oe, {
438
+ children: [/* @__PURE__ */ _(Oe, {
439
439
  idleClassName: s,
440
440
  copiedClassName: c
441
- }), !u && /* @__PURE__ */ E(F.Edit, {
441
+ }), !u && /* @__PURE__ */ _(F.Edit, {
442
442
  className: o,
443
443
  children: "Edit"
444
444
  })]
@@ -446,7 +446,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
446
446
  })
447
447
  ]
448
448
  });
449
- }, Ye = () => /* @__PURE__ */ E(De, { sendStyle: {
449
+ }, Ye = () => /* @__PURE__ */ _(De, { sendStyle: {
450
450
  backgroundColor: "var(--color-brand, #0a0a0a)",
451
451
  color: "var(--color-brand-foreground, #fff)"
452
452
  } }), Xe = [
@@ -460,7 +460,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
460
460
  "w-2/3",
461
461
  "w-3/5"
462
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({
463
+ let l = B(), u = V((e) => e.thread.isRunning), { agentUnavailable: d } = fe(), f = E(null), { isAtBottom: p, scrollToBottom: m } = be({
464
464
  viewportRef: f,
465
465
  isRunning: u
466
466
  }), h = _e({
@@ -470,35 +470,35 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
470
470
  "Levo-Workspace": t
471
471
  } : void 0,
472
472
  fallback: Xe
473
- }), g = y((t) => {
473
+ }), g = S((t) => {
474
474
  e(l.thread.composer(), t);
475
- }, [l]), _ = y(() => l.thread.cancelRun(), [l]), v = C(u);
476
- return x(() => {
477
- v.current = u;
478
- }, [u]), x(() => {
475
+ }, [l]), y = S(() => l.thread.cancelRun(), [l]), b = E(u);
476
+ return w(() => {
477
+ b.current = u;
478
+ }, [u]), w(() => {
479
479
  let e = (e) => {
480
- e.key !== "Escape" || e.isComposing || !v.current || (e.preventDefault(), e.stopImmediatePropagation(), l.thread.cancelRun());
480
+ e.key !== "Escape" || e.isComposing || !b.current || (e.preventDefault(), e.stopImmediatePropagation(), l.thread.cancelRun());
481
481
  };
482
482
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
483
- }, [l]), /* @__PURE__ */ D(z.Root, {
483
+ }, [l]), /* @__PURE__ */ v(z.Root, {
484
484
  className: "relative flex flex-1 flex-col overflow-hidden",
485
485
  children: [
486
- /* @__PURE__ */ E(z.If, {
486
+ /* @__PURE__ */ _(z.If, {
487
487
  empty: !0,
488
- children: /* @__PURE__ */ E("div", {
488
+ children: /* @__PURE__ */ _("div", {
489
489
  className: "pointer-events-none absolute inset-0 z-0 overflow-hidden",
490
- children: /* @__PURE__ */ E("div", {
490
+ children: /* @__PURE__ */ _("div", {
491
491
  className: "absolute inset-0",
492
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(", ") }
493
493
  })
494
494
  })
495
495
  }),
496
- d && /* @__PURE__ */ E("div", {
496
+ d && /* @__PURE__ */ _("div", {
497
497
  role: "alert",
498
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",
499
499
  children: "This conversation is no longer available. Please refresh the page to start a new chat."
500
500
  }),
501
- /* @__PURE__ */ D(z.Viewport, {
501
+ /* @__PURE__ */ v(z.Viewport, {
502
502
  ref: f,
503
503
  turnAnchor: "top",
504
504
  className: "relative z-10 flex-1 overflow-y-auto",
@@ -506,20 +506,20 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
506
506
  scrollToBottomOnRunStart: !1,
507
507
  scrollToBottomOnInitialize: !1,
508
508
  scrollToBottomOnThreadSwitch: !1,
509
- children: [/* @__PURE__ */ E(z.Empty, { children: /* @__PURE__ */ D("div", {
509
+ children: [/* @__PURE__ */ _(z.Empty, { children: /* @__PURE__ */ v("div", {
510
510
  className: "flex min-h-full flex-col items-center justify-center px-6 py-6",
511
- children: [/* @__PURE__ */ D("div", {
511
+ children: [/* @__PURE__ */ v("div", {
512
512
  className: "mb-5 flex flex-col items-center gap-2 text-center",
513
513
  children: [
514
- r ? /* @__PURE__ */ E("img", {
514
+ r ? /* @__PURE__ */ _("img", {
515
515
  src: r,
516
516
  alt: n ?? "Site logo",
517
517
  className: "mb-1 h-12 w-auto max-w-[180px] object-contain"
518
- }) : /* @__PURE__ */ E("span", {
518
+ }) : /* @__PURE__ */ _("span", {
519
519
  className: "font-semibold text-lg text-zinc-900 tracking-tight",
520
520
  children: n ?? "This site"
521
521
  }),
522
- /* @__PURE__ */ E("p", {
522
+ /* @__PURE__ */ _("p", {
523
523
  className: "mt-1 text-2xl text-zinc-900 tracking-tight",
524
524
  style: {
525
525
  fontFamily: "var(--font-heading, inherit)",
@@ -527,18 +527,18 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
527
527
  },
528
528
  children: "Ask anything"
529
529
  }),
530
- /* @__PURE__ */ E("p", {
530
+ /* @__PURE__ */ _("p", {
531
531
  className: "text-sm text-zinc-500",
532
532
  style: { fontFamily: "var(--font-heading, inherit)" },
533
533
  children: "Get instant answers about products, pricing, and how to get started."
534
534
  })
535
535
  ]
536
- }), /* @__PURE__ */ E("div", {
536
+ }), /* @__PURE__ */ _("div", {
537
537
  className: "flex w-full max-w-md flex-col gap-2",
538
- children: h === null ? Ze.map((e, t) => /* @__PURE__ */ E("div", {
538
+ children: h === null ? Ze.map((e, t) => /* @__PURE__ */ _("div", {
539
539
  className: "flex h-[42px] items-center rounded-xl border border-zinc-200 bg-white px-4",
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", {
540
+ children: /* @__PURE__ */ _("span", { className: `block h-3 animate-pulse rounded bg-zinc-200 ${e}` })
541
+ }, `skeleton-${t}`)) : h.map((e, t) => /* @__PURE__ */ _("button", {
542
542
  type: "button",
543
543
  onClick: () => g(e),
544
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]",
@@ -546,11 +546,11 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
546
546
  children: e
547
547
  }, e))
548
548
  })]
549
- }) }), /* @__PURE__ */ E(z.If, {
549
+ }) }), /* @__PURE__ */ _(z.If, {
550
550
  empty: !1,
551
- children: /* @__PURE__ */ E("div", {
551
+ children: /* @__PURE__ */ _("div", {
552
552
  className: "ai-chat-kb-messages mx-auto max-w-3xl px-6 py-6 pt-8",
553
- children: /* @__PURE__ */ E(z.Messages, { components: {
553
+ children: /* @__PURE__ */ _(z.Messages, { components: {
554
554
  UserMessage: Je,
555
555
  AssistantMessage: He,
556
556
  EditComposer: Ye
@@ -558,58 +558,58 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
558
558
  })
559
559
  })]
560
560
  }),
561
- !c && /* @__PURE__ */ E("div", {
561
+ !c && /* @__PURE__ */ _("div", {
562
562
  className: "relative z-10 shrink-0 border-zinc-200 border-t bg-white/95 backdrop-blur-sm",
563
- children: /* @__PURE__ */ D("div", {
563
+ children: /* @__PURE__ */ v("div", {
564
564
  className: "relative mx-auto max-w-3xl px-4 pt-3 pb-3",
565
565
  children: [
566
- !p && /* @__PURE__ */ E("div", {
566
+ !p && /* @__PURE__ */ _("div", {
567
567
  className: "pointer-events-none absolute inset-x-0 -top-9 z-20 flex justify-center",
568
- children: /* @__PURE__ */ E(ge, {
568
+ children: /* @__PURE__ */ _(ge, {
569
569
  onClick: m,
570
570
  isRunning: u,
571
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"
572
572
  })
573
573
  }),
574
- s.length > 0 && !u && /* @__PURE__ */ E("div", {
574
+ s.length > 0 && !u && /* @__PURE__ */ _("div", {
575
575
  className: "mb-2",
576
- children: /* @__PURE__ */ E(H, {
576
+ children: /* @__PURE__ */ _(H, {
577
577
  chips: s,
578
578
  onSelect: g,
579
579
  size: "compact"
580
580
  })
581
581
  }),
582
- /* @__PURE__ */ D(L.Root, { children: [
583
- /* @__PURE__ */ E(z.If, {
582
+ /* @__PURE__ */ v(L.Root, { children: [
583
+ /* @__PURE__ */ _(z.If, {
584
584
  empty: !0,
585
- children: /* @__PURE__ */ E(Se, {
585
+ children: /* @__PURE__ */ _(Se, {
586
586
  variant: "expanded",
587
587
  isRunning: u,
588
- onStop: _
588
+ onStop: y
589
589
  })
590
590
  }),
591
- /* @__PURE__ */ E(z.If, {
591
+ /* @__PURE__ */ _(z.If, {
592
592
  empty: !1,
593
- children: /* @__PURE__ */ E(Se, {
593
+ children: /* @__PURE__ */ _(Se, {
594
594
  variant: "compact",
595
595
  isRunning: u,
596
- onStop: _
596
+ onStop: y
597
597
  })
598
598
  }),
599
- /* @__PURE__ */ E(L.If, {
599
+ /* @__PURE__ */ _(L.If, {
600
600
  dictation: !0,
601
- children: /* @__PURE__ */ D("div", {
601
+ children: /* @__PURE__ */ v("div", {
602
602
  className: "mt-2 flex items-center justify-center gap-2",
603
- children: [/* @__PURE__ */ E("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-red-500" }), /* @__PURE__ */ E("span", {
603
+ children: [/* @__PURE__ */ _("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-red-500" }), /* @__PURE__ */ _("span", {
604
604
  className: "font-medium text-red-500 text-xs tracking-wide",
605
605
  children: "Listening… speak now"
606
606
  })]
607
607
  })
608
608
  })
609
609
  ] }),
610
- /* @__PURE__ */ E(z.If, {
610
+ /* @__PURE__ */ _(z.If, {
611
611
  empty: !1,
612
- children: /* @__PURE__ */ E("p", {
612
+ children: /* @__PURE__ */ _("p", {
613
613
  className: "mt-2 text-center text-[10px] text-zinc-500/70",
614
614
  children: "Answers can be inaccurate. Verify before relying on them."
615
615
  })
@@ -639,11 +639,11 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
639
639
  let i = document.referrer?.trim();
640
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
641
  }, at = ({ workspaceId: e, siteName: t, siteLogo: n, agentId: r, apiBaseUrl: i, authHeaders: a, children: o }) => {
642
- let s = C(e);
642
+ let s = E(e);
643
643
  s.current = e;
644
- let c = C(r);
644
+ let c = E(r);
645
645
  c.current = r;
646
- let { followUps: l, clearOnSend: u, handleData: d } = ue(), [f, p] = w(!1), { conversationIdRef: m, handleFinish: h, reset: g } = le(e), _ = ae({
646
+ let { followUps: l, clearOnSend: u, handleData: d } = ue(), [f, p] = D(!1), { conversationIdRef: m, handleFinish: h, reset: g } = le(e), v = ae({
647
647
  joinStrategy: "none",
648
648
  transport: ce({
649
649
  api: `${i}/stream`,
@@ -672,23 +672,23 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
672
672
  onError: (e) => {
673
673
  de(e) ? p(!0) : console.warn("[levo-kb-chat] stream error:", e);
674
674
  }
675
- }), v = y(() => {
676
- _.threads.switchToNewThread().catch((e) => {
675
+ }), y = S(() => {
676
+ v.threads.switchToNewThread().catch((e) => {
677
677
  console.warn("[levo-kb-chat] switchToNewThread failed:", e);
678
678
  }), g(), u(), p(!1);
679
679
  }, [
680
- _,
680
+ v,
681
681
  g,
682
682
  u
683
683
  ]);
684
- return /* @__PURE__ */ E(I, {
685
- runtime: _,
686
- children: /* @__PURE__ */ E(U.Provider, {
684
+ return /* @__PURE__ */ _(I, {
685
+ runtime: v,
686
+ children: /* @__PURE__ */ _(U.Provider, {
687
687
  value: { agentUnavailable: f },
688
688
  children: o ? o({
689
689
  followUps: l,
690
- onResetChat: v
691
- }) : /* @__PURE__ */ E(Qe, {
690
+ onResetChat: y
691
+ }) : /* @__PURE__ */ _(Qe, {
692
692
  workspaceId: e,
693
693
  siteName: t,
694
694
  siteLogo: n,
@@ -700,7 +700,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
700
700
  })
701
701
  });
702
702
  }, ot = (e, t, n) => {
703
- x(() => {
703
+ w(() => {
704
704
  if (!e) return;
705
705
  let r = (e) => {
706
706
  if (e.key !== "Escape" || e.isComposing) return;
@@ -718,13 +718,13 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
718
718
  n
719
719
  ]);
720
720
  }, X = "(max-width: 639px)", Z = () => {
721
- let [e, t] = w(() => typeof window < "u" && window.matchMedia(X).matches);
722
- return x(() => {
721
+ let [e, t] = D(() => typeof window < "u" && window.matchMedia(X).matches);
722
+ return w(() => {
723
723
  let e = window.matchMedia(X), n = () => t(e.matches);
724
724
  return n(), e.addEventListener("change", n), () => e.removeEventListener("change", n);
725
725
  }, []), e;
726
726
  }, st = (e, t) => {
727
- x(() => {
727
+ w(() => {
728
728
  let n = t.current, r = window.visualViewport;
729
729
  if (!e || !n || !r || !window.matchMedia(X).matches) return;
730
730
  let i = () => {
@@ -735,7 +735,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
735
735
  };
736
736
  }, [e, t]);
737
737
  }, ct = (e, t, n) => {
738
- x(() => {
738
+ w(() => {
739
739
  if (!e) return;
740
740
  let r = (e) => {
741
741
  let r = e.composedPath();
@@ -747,16 +747,16 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
747
747
  t,
748
748
  n
749
749
  ]);
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);
752
- x(() => {
753
- g && _.thread.composer().setText(g);
750
+ }, Q = (...e) => e.filter(Boolean).join(" "), lt = ({ open: e, onToggle: i, askLabel: a, panelId: h, initialDraft: y }) => {
751
+ let b = B(), x = Z(), S = V((e) => e.thread.isRunning), C = V((e) => e.thread.messages.length > 0), k = V((e) => e.composer.text), ee = k.trim().length > 0, [A, j] = D(!1);
752
+ w(() => {
753
+ y && b.thread.composer().setText(y);
754
754
  }, []);
755
- let M = C(null), P = C(null), F = C(!1);
756
- S(() => {
755
+ let M = E(null), P = E(null), F = E(!1);
756
+ T(() => {
757
757
  let e = M.current;
758
758
  !e || document.activeElement === e || (F.current = !0, e.focus({ preventScroll: !0 }));
759
- }, []), S(() => {
759
+ }, []), T(() => {
760
760
  let t = M.current, n = P.current;
761
761
  if (!(!t || !n)) {
762
762
  if (!e) {
@@ -766,37 +766,37 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
766
766
  j(c(n, t));
767
767
  }
768
768
  }, [k, e]);
769
- let I = C(e);
770
- x(() => {
769
+ let I = E(e);
770
+ w(() => {
771
771
  let t = I.current;
772
772
  I.current = e;
773
773
  let n = M.current;
774
774
  e || !t || !n || document.activeElement === n && n.blur();
775
775
  }, [e]);
776
- let R = C(y);
777
- x(() => {
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", {
776
+ let R = E(S);
777
+ w(() => {
778
+ let e = !R.current && S;
779
+ R.current = S, x && e && M.current?.blur();
780
+ }, [S, x]);
781
+ let z = C ? "Continue conversation" : a;
782
+ return /* @__PURE__ */ _("div", {
783
783
  className: Q(l, e ? f : n),
784
- children: /* @__PURE__ */ D("div", {
784
+ children: /* @__PURE__ */ v("div", {
785
785
  ref: P,
786
786
  className: Q(m, A && "ai-chat-pill-surface--stacked"),
787
787
  children: [
788
- /* @__PURE__ */ E("button", {
788
+ /* @__PURE__ */ _("button", {
789
789
  type: "button",
790
790
  onClick: i,
791
791
  "aria-label": e ? "Collapse AI chat" : "Expand AI chat",
792
792
  "aria-expanded": e,
793
793
  "aria-controls": h,
794
794
  className: s,
795
- children: /* @__PURE__ */ E(ne, { className: "h-5 w-5" })
795
+ children: /* @__PURE__ */ _(ne, { className: "h-5 w-5" })
796
796
  }),
797
- /* @__PURE__ */ D("div", {
797
+ /* @__PURE__ */ v("div", {
798
798
  className: d,
799
- children: [/* @__PURE__ */ E(L.Input, {
799
+ children: [/* @__PURE__ */ _(L.Input, {
800
800
  ref: M,
801
801
  "data-ai-chat-composer": "",
802
802
  placeholder: e ? "Ask anything…" : "",
@@ -808,90 +808,90 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
808
808
  e || i();
809
809
  },
810
810
  onKeyDown: (e) => {
811
- e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !y && ee && _.thread.composer().send());
811
+ e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !S && ee && b.thread.composer().send());
812
812
  },
813
813
  rows: 1,
814
814
  submitMode: "enter",
815
- unstable_focusOnRunStart: !v,
816
- unstable_focusOnScrollToBottom: !v,
817
- unstable_focusOnThreadSwitched: !v,
815
+ unstable_focusOnRunStart: !x,
816
+ unstable_focusOnScrollToBottom: !x,
817
+ unstable_focusOnThreadSwitched: !x,
818
818
  autoComplete: "off",
819
819
  autoCorrect: "off",
820
820
  autoCapitalize: "none",
821
821
  inputMode: "text",
822
822
  className: Q(r, "transition-opacity duration-200", !e && "opacity-0")
823
- }), /* @__PURE__ */ E("span", {
823
+ }), /* @__PURE__ */ _("span", {
824
824
  className: Q(o, "transition-opacity duration-150", e && "opacity-0"),
825
825
  "aria-hidden": !0,
826
826
  children: z
827
827
  })]
828
828
  }),
829
- /* @__PURE__ */ D("div", {
829
+ /* @__PURE__ */ v("div", {
830
830
  className: p,
831
- children: [e && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(L.If, {
831
+ children: [e && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(L.If, {
832
832
  dictation: !1,
833
- children: /* @__PURE__ */ E(L.Dictate, {
833
+ children: /* @__PURE__ */ _(L.Dictate, {
834
834
  "aria-label": "Start dictation",
835
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",
836
- children: /* @__PURE__ */ E(te, { className: "h-5 w-5" })
836
+ children: /* @__PURE__ */ _(te, { className: "h-5 w-5" })
837
837
  })
838
- }), /* @__PURE__ */ E(L.If, {
838
+ }), /* @__PURE__ */ _(L.If, {
839
839
  dictation: !0,
840
- children: /* @__PURE__ */ E(L.StopDictation, {
840
+ children: /* @__PURE__ */ _(L.StopDictation, {
841
841
  "aria-label": "Stop dictation",
842
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",
843
- children: /* @__PURE__ */ E(N, { className: "h-4 w-4 fill-current" })
843
+ children: /* @__PURE__ */ _(N, { className: "h-4 w-4 fill-current" })
844
844
  })
845
- })] }), e ? y ? /* @__PURE__ */ E("button", {
845
+ })] }), e ? S ? /* @__PURE__ */ _("button", {
846
846
  type: "button",
847
- onClick: () => _.thread.cancelRun(),
847
+ onClick: () => b.thread.cancelRun(),
848
848
  "aria-label": "Stop generating",
849
849
  className: t,
850
850
  style: u,
851
- children: /* @__PURE__ */ E(N, { className: "h-4 w-4 fill-current" })
852
- }) : /* @__PURE__ */ E(L.Send, {
851
+ children: /* @__PURE__ */ _(N, { className: "h-4 w-4 fill-current" })
852
+ }) : /* @__PURE__ */ _(L.Send, {
853
853
  "aria-label": "Send message",
854
854
  className: Q(t, "disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100"),
855
855
  style: u,
856
- children: /* @__PURE__ */ E(O, { className: "h-5 w-5 stroke-[2.5px]" })
857
- }) : /* @__PURE__ */ E("button", {
856
+ children: /* @__PURE__ */ _(O, { className: "h-5 w-5 stroke-[2.5px]" })
857
+ }) : /* @__PURE__ */ _("button", {
858
858
  type: "button",
859
859
  onClick: i,
860
860
  "aria-label": "Open AI chat",
861
861
  className: t,
862
862
  style: u,
863
- children: /* @__PURE__ */ E(O, { className: "h-5 w-5 stroke-[2.5px]" })
863
+ children: /* @__PURE__ */ _(O, { className: "h-5 w-5 stroke-[2.5px]" })
864
864
  })]
865
865
  })
866
866
  ]
867
867
  })
868
868
  });
869
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);
871
- x(() => {
870
+ let [f, p] = D(!1);
871
+ w(() => {
872
872
  if (!l) return;
873
873
  let e = requestAnimationFrame(() => p(!0));
874
874
  return () => cancelAnimationFrame(e);
875
875
  }, [l]);
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);
878
- let v = a(t);
879
- return /* @__PURE__ */ E("div", {
876
+ let m = `kb-chat-panel-${e ?? "default"}`, h = E(null), g = E(null), v = S(() => p(!1), []);
877
+ ot(f, g, v), ct(f, h, v), st(f, h);
878
+ let y = a(t);
879
+ return /* @__PURE__ */ _("div", {
880
880
  ref: h,
881
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]"),
882
- children: /* @__PURE__ */ E(at, {
882
+ children: /* @__PURE__ */ _(at, {
883
883
  workspaceId: e,
884
884
  siteName: t,
885
885
  siteLogo: n,
886
886
  agentId: o,
887
887
  apiBaseUrl: s,
888
888
  authHeaders: c,
889
- children: ({ followUps: a, onResetChat: l }) => /* @__PURE__ */ E(pt, {
889
+ children: ({ followUps: a, onResetChat: l }) => /* @__PURE__ */ _(pt, {
890
890
  open: f,
891
891
  onToggle: () => p((e) => !e),
892
892
  threadStateRef: g,
893
893
  onResetChat: l,
894
- askLabel: v,
894
+ askLabel: y,
895
895
  panelId: m,
896
896
  siteName: t,
897
897
  siteIcon: r,
@@ -899,7 +899,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
899
899
  initialDraft: u,
900
900
  showBranding: d,
901
901
  followUps: a,
902
- thread: /* @__PURE__ */ E(Qe, {
902
+ thread: /* @__PURE__ */ _(Qe, {
903
903
  workspaceId: e,
904
904
  siteName: t,
905
905
  siteLogo: n,
@@ -917,8 +917,8 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
917
917
  "px-3 py-1 text-[13px] leading-snug",
918
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"
919
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 = {
920
+ let m = B(), h = V((e) => e.thread.isRunning), y = V((e) => e.thread.messages.length > 0), b = Z() ? f.slice(0, 2) : f;
921
+ w(() => (r.current = {
922
922
  isRunning: h,
923
923
  cancelRun: () => m.thread.cancelRun()
924
924
  }, () => {
@@ -928,74 +928,74 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
928
928
  m,
929
929
  r
930
930
  ]);
931
- let v = y((t) => {
931
+ let x = S((t) => {
932
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", {
933
+ }, [m]), C = s ?? "Ask AI", T = `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__ */ v(g, { children: [
935
+ /* @__PURE__ */ _("div", {
936
936
  "aria-hidden": !0,
937
937
  className: $("absolute inset-0", t ? "pointer-events-auto" : "pointer-events-none"),
938
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))" },
939
- children: /* @__PURE__ */ E("div", {
939
+ children: /* @__PURE__ */ _("div", {
940
940
  className: $("ai-chat-kb-surface h-full w-full p-[2px]", !t && "ai-chat-kb-surface-closed"),
941
941
  style: { background: ut },
942
- children: /* @__PURE__ */ E("div", { className: "h-full w-full rounded-t-[26px] rounded-b-[40px] bg-white" })
942
+ children: /* @__PURE__ */ _("div", { className: "h-full w-full rounded-t-[26px] rounded-b-[40px] bg-white" })
943
943
  })
944
944
  }),
945
- /* @__PURE__ */ D("section", {
945
+ /* @__PURE__ */ v("section", {
946
946
  id: o,
947
947
  "aria-label": "AI chat",
948
948
  inert: !t,
949
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"),
950
950
  children: [
951
- /* @__PURE__ */ D("header", {
951
+ /* @__PURE__ */ v("header", {
952
952
  className: "flex h-14 w-full shrink-0 items-center justify-between gap-2 px-4",
953
- children: [/* @__PURE__ */ D("div", {
953
+ children: [/* @__PURE__ */ v("div", {
954
954
  className: "flex min-w-0 items-center gap-2",
955
- children: [c ? /* @__PURE__ */ E("img", {
955
+ children: [c ? /* @__PURE__ */ _("img", {
956
956
  src: c,
957
957
  alt: "",
958
958
  className: "h-6 w-6 shrink-0 rounded-sm object-contain"
959
- }) : null, /* @__PURE__ */ E("span", {
959
+ }) : null, /* @__PURE__ */ _("span", {
960
960
  className: "truncate font-semibold text-sm text-zinc-900",
961
- children: b
961
+ children: C
962
962
  })]
963
- }), /* @__PURE__ */ D("div", {
963
+ }), /* @__PURE__ */ v("div", {
964
964
  className: "flex flex-shrink-0 items-center gap-1",
965
- children: [g && /* @__PURE__ */ E("button", {
965
+ children: [y && /* @__PURE__ */ _("button", {
966
966
  type: "button",
967
967
  onClick: i,
968
968
  "aria-label": "Start new chat",
969
969
  title: "Start new chat",
970
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",
971
- children: /* @__PURE__ */ E(j, { className: "h-4 w-4" })
972
- }), /* @__PURE__ */ E("button", {
971
+ children: /* @__PURE__ */ _(j, { className: "h-4 w-4" })
972
+ }), /* @__PURE__ */ _("button", {
973
973
  type: "button",
974
974
  onClick: n,
975
975
  "aria-label": "Close AI chat",
976
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",
977
- children: /* @__PURE__ */ E(P, { className: "h-4 w-4" })
977
+ children: /* @__PURE__ */ _(P, { className: "h-4 w-4" })
978
978
  })]
979
979
  })]
980
980
  }),
981
- /* @__PURE__ */ E("div", { className: "mx-4 h-px shrink-0 bg-zinc-100" }),
982
- /* @__PURE__ */ E("div", {
981
+ /* @__PURE__ */ _("div", { className: "mx-4 h-px shrink-0 bg-zinc-100" }),
982
+ /* @__PURE__ */ _("div", {
983
983
  className: "ai-chat-kb-thread flex max-h-[min(60vh,32rem)] min-h-0 flex-col overflow-hidden",
984
984
  children: p
985
985
  }),
986
- _.length > 0 && !h && /* @__PURE__ */ E("div", {
986
+ b.length > 0 && !h && /* @__PURE__ */ _("div", {
987
987
  className: "shrink-0 px-4 pt-1 pb-2",
988
- children: /* @__PURE__ */ E(H, {
989
- chips: _,
990
- onSelect: v,
988
+ children: /* @__PURE__ */ _(H, {
989
+ chips: b,
990
+ onSelect: x,
991
991
  chipClassName: ft
992
992
  })
993
993
  })
994
994
  ]
995
995
  }),
996
- /* @__PURE__ */ E("div", {
996
+ /* @__PURE__ */ _("div", {
997
997
  className: "ai-chat-kb-pillbox pointer-events-auto relative z-20 mx-3 mt-1",
998
- children: /* @__PURE__ */ E(lt, {
998
+ children: /* @__PURE__ */ _(lt, {
999
999
  open: t,
1000
1000
  onToggle: n,
1001
1001
  askLabel: a,
@@ -1003,14 +1003,14 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1003
1003
  initialDraft: u
1004
1004
  })
1005
1005
  }),
1006
- d && /* @__PURE__ */ E("div", {
1006
+ d && /* @__PURE__ */ _("div", {
1007
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", {
1008
+ children: /* @__PURE__ */ _("div", {
1009
1009
  className: "overflow-hidden",
1010
- children: /* @__PURE__ */ D("p", {
1010
+ children: /* @__PURE__ */ v("p", {
1011
1011
  className: "pt-2 text-center text-[11px] text-zinc-400",
1012
- children: ["Powered by ", /* @__PURE__ */ E("a", {
1013
- href: S,
1012
+ children: ["Powered by ", /* @__PURE__ */ _("a", {
1013
+ href: T,
1014
1014
  target: "_blank",
1015
1015
  rel: "noopener noreferrer",
1016
1016
  className: "pointer-events-auto font-medium text-zinc-500 underline-offset-2 transition-colors hover:text-zinc-700 hover:underline",
@@ -1019,7 +1019,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1019
1019
  })
1020
1020
  })
1021
1021
  }),
1022
- /* @__PURE__ */ E("div", { className: "h-3" })
1022
+ /* @__PURE__ */ _("div", { className: "h-3" })
1023
1023
  ] });
1024
1024
  };
1025
1025
  //#endregion