@levo-so/site-runtime 0.3.7 → 0.3.9

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 (45) hide show
  1. package/CollectionField-C-6a1ud4.js +270 -0
  2. package/{CollectionInput-B1qV4QEH.js → CollectionInput-BJ__qcbk.js} +40 -40
  3. package/DateTimeWidget-LfaosVVW.js +255 -0
  4. package/{Dialog-DVB4WpBS.js → Dialog-dT7y641z.js} +43 -43
  5. package/{KBChatWidget-Cnq0DCOQ.js → KBChatWidget-CuAtGhHT.js} +240 -239
  6. package/{LevoProvider-nmIbMlsk.js → LevoProvider-Bsjkcwc8.js} +8 -8
  7. package/PhoneWidget-D-CcDuie.js +99 -0
  8. package/{Popover-C7zZHBIc.js → Popover-BTdlOQP_.js} +20 -20
  9. package/{PopupBody-DZVwDLkg-yrot8Uqb.js → PopupBody-BI-MJqmd-C0qNyN7V.js} +299 -182
  10. package/PopupRenderer-D66Gx63H-C6RnOnl2.js +388 -0
  11. package/{RichTextWidget-BOrVIR2j.js → RichTextWidget-BFWVevY7.js} +140 -140
  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-Cb6sb7nO.js → dist-Rjs__H25.js} +14 -14
  16. package/dist-orLT2eNz.js +3663 -0
  17. package/index.d.ts +1071 -3
  18. package/index.js +1365 -733
  19. package/inlineBaseTheme-BB9e6h5f.js +9 -0
  20. package/{inlineCollectionTheme-DYYMrmcE.js → inlineCollectionTheme-CWcMCUti.js} +1 -1
  21. package/{kbChat-DIb4AS7E.js → kbChat-L55effMi.js} +28 -28
  22. package/{nodeAlignment-D70kOcui.js → nodeAlignment-COvc-rIj.js} +1 -1
  23. package/package.json +37 -27
  24. package/popups.js +1 -1
  25. package/{react-6kO0cqgr.js → react-B9yvlbH0.js} +1 -1
  26. package/routes-CyKmkoRM.js +316 -0
  27. package/start.d.ts +38 -0
  28. package/start.js +19 -0
  29. package/styles.css +1 -1
  30. package/{generateRadiusScale-54mE9ikx.js → themeVars.cssm-ByhhC2Jm.js} +17 -17
  31. package/usePopupRedirect-CAAdcpaW-D9XoiVhG.js +82 -0
  32. package/CollectionField-C59pmeQw.js +0 -270
  33. package/DateTimeWidget-Cctsvcrs.js +0 -255
  34. package/PhoneWidget-J3VTMWJH.js +0 -99
  35. package/PopupRenderer-BjW1jg70-Biwj2bIc.js +0 -387
  36. package/ThemeProvider-BQmIB5tr.js +0 -116
  37. package/dist-C8gLeklT.js +0 -3559
  38. package/inlineBaseTheme-B6E9zzyp.js +0 -9
  39. package/usePopupRedirect-BThP_YPW-DoixMAB9.js +0 -80
  40. /package/{createThemeExtension-DhGk81nV.js → createThemeExtension-4AUn51iJ.js} +0 -0
  41. /package/{es-CztjLuNy.js → es-Bj3CsMJz.js} +0 -0
  42. /package/{pillChrome-BAu5AfCT.js → pillChrome-uieiq_SK.js} +0 -0
  43. /package/{popupState-JmpeKzgM-qhNTV79U.js → popupState-JmpeKzgM-D_77LiAa.js} +0 -0
  44. /package/{rteTheme.cssm-xg0gJ28J.js → rteTheme.cssm-CaRzrwtu.js} +0 -0
  45. /package/{theme.cssm-mkQwezuj.js → theme.cssm-DUzmx76l.js} +0 -0
@@ -1,7 +1,7 @@
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-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";
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-uieiq_SK.js";
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,106 +339,107 @@ 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, footerSlot: g }) => {
376
+ let y = V((e) => e.message), b = t ?? R.Content, x = y.status?.type === "running", S = /* @__PURE__ */ _("div", {
377
377
  className: i,
378
- children: /* @__PURE__ */ E(_, { components: {
378
+ children: /* @__PURE__ */ _(b, { 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(S) : S,
389
+ x && /* @__PURE__ */ _("div", {
390
390
  className: "mt-1",
391
391
  children: n
392
392
  }),
393
- !v && m && /* @__PURE__ */ E("div", {
393
+ !x && m && /* @__PURE__ */ _("div", {
394
394
  className: "mt-2",
395
395
  children: m
396
396
  }),
397
- !v && /* @__PURE__ */ D("div", {
397
+ !x && /* @__PURE__ */ v("div", {
398
398
  className: a,
399
399
  children: [
400
- /* @__PURE__ */ E("span", {
400
+ /* @__PURE__ */ _("span", {
401
401
  className: d,
402
- children: h(g.createdAt, f)
402
+ children: h(y.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
  ]
416
- })
416
+ }),
417
+ !x && g
417
418
  ]
418
419
  })
419
420
  });
420
421
  }, 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
422
  let d = V((e) => e.message);
422
- return /* @__PURE__ */ D(R.Root, {
423
+ return /* @__PURE__ */ v(R.Root, {
423
424
  className: t,
424
425
  "data-user-message": "true",
425
426
  children: [
426
427
  e,
427
- /* @__PURE__ */ E("div", {
428
+ /* @__PURE__ */ _("div", {
428
429
  className: n,
429
- children: r ?? /* @__PURE__ */ E(R.Content, {})
430
+ children: r ?? /* @__PURE__ */ _(R.Content, {})
430
431
  }),
431
- /* @__PURE__ */ D("div", {
432
+ /* @__PURE__ */ v("div", {
432
433
  className: i,
433
- children: [/* @__PURE__ */ E("span", {
434
+ children: [/* @__PURE__ */ _("span", {
434
435
  className: a,
435
436
  children: h(d.createdAt, l)
436
- }), /* @__PURE__ */ D(F.Root, {
437
+ }), /* @__PURE__ */ v(F.Root, {
437
438
  className: "flex items-center gap-0.5",
438
- children: [/* @__PURE__ */ E(Oe, {
439
+ children: [/* @__PURE__ */ _(Oe, {
439
440
  idleClassName: s,
440
441
  copiedClassName: c
441
- }), !u && /* @__PURE__ */ E(F.Edit, {
442
+ }), !u && /* @__PURE__ */ _(F.Edit, {
442
443
  className: o,
443
444
  children: "Edit"
444
445
  })]
@@ -446,7 +447,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
446
447
  })
447
448
  ]
448
449
  });
449
- }, Ye = () => /* @__PURE__ */ E(De, { sendStyle: {
450
+ }, Ye = () => /* @__PURE__ */ _(De, { sendStyle: {
450
451
  backgroundColor: "var(--color-brand, #0a0a0a)",
451
452
  color: "var(--color-brand-foreground, #fff)"
452
453
  } }), Xe = [
@@ -460,7 +461,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
460
461
  "w-2/3",
461
462
  "w-3/5"
462
463
  ], 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
+ let l = B(), u = V((e) => e.thread.isRunning), { agentUnavailable: d } = fe(), f = E(null), { isAtBottom: p, scrollToBottom: m } = be({
464
465
  viewportRef: f,
465
466
  isRunning: u
466
467
  }), h = _e({
@@ -470,35 +471,35 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
470
471
  "Levo-Workspace": t
471
472
  } : void 0,
472
473
  fallback: Xe
473
- }), g = y((t) => {
474
+ }), g = S((t) => {
474
475
  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(() => {
476
+ }, [l]), y = S(() => l.thread.cancelRun(), [l]), b = E(u);
477
+ return w(() => {
478
+ b.current = u;
479
+ }, [u]), w(() => {
479
480
  let e = (e) => {
480
- e.key !== "Escape" || e.isComposing || !v.current || (e.preventDefault(), e.stopImmediatePropagation(), l.thread.cancelRun());
481
+ e.key !== "Escape" || e.isComposing || !b.current || (e.preventDefault(), e.stopImmediatePropagation(), l.thread.cancelRun());
481
482
  };
482
483
  return window.addEventListener("keydown", e, !0), () => window.removeEventListener("keydown", e, !0);
483
- }, [l]), /* @__PURE__ */ D(z.Root, {
484
+ }, [l]), /* @__PURE__ */ v(z.Root, {
484
485
  className: "relative flex flex-1 flex-col overflow-hidden",
485
486
  children: [
486
- /* @__PURE__ */ E(z.If, {
487
+ /* @__PURE__ */ _(z.If, {
487
488
  empty: !0,
488
- children: /* @__PURE__ */ E("div", {
489
+ children: /* @__PURE__ */ _("div", {
489
490
  className: "pointer-events-none absolute inset-0 z-0 overflow-hidden",
490
- children: /* @__PURE__ */ E("div", {
491
+ children: /* @__PURE__ */ _("div", {
491
492
  className: "absolute inset-0",
492
493
  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
494
  })
494
495
  })
495
496
  }),
496
- d && /* @__PURE__ */ E("div", {
497
+ d && /* @__PURE__ */ _("div", {
497
498
  role: "alert",
498
499
  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
500
  children: "This conversation is no longer available. Please refresh the page to start a new chat."
500
501
  }),
501
- /* @__PURE__ */ D(z.Viewport, {
502
+ /* @__PURE__ */ v(z.Viewport, {
502
503
  ref: f,
503
504
  turnAnchor: "top",
504
505
  className: "relative z-10 flex-1 overflow-y-auto",
@@ -506,20 +507,20 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
506
507
  scrollToBottomOnRunStart: !1,
507
508
  scrollToBottomOnInitialize: !1,
508
509
  scrollToBottomOnThreadSwitch: !1,
509
- children: [/* @__PURE__ */ E(z.Empty, { children: /* @__PURE__ */ D("div", {
510
+ children: [/* @__PURE__ */ _(z.Empty, { children: /* @__PURE__ */ v("div", {
510
511
  className: "flex min-h-full flex-col items-center justify-center px-6 py-6",
511
- children: [/* @__PURE__ */ D("div", {
512
+ children: [/* @__PURE__ */ v("div", {
512
513
  className: "mb-5 flex flex-col items-center gap-2 text-center",
513
514
  children: [
514
- r ? /* @__PURE__ */ E("img", {
515
+ r ? /* @__PURE__ */ _("img", {
515
516
  src: r,
516
517
  alt: n ?? "Site logo",
517
518
  className: "mb-1 h-12 w-auto max-w-[180px] object-contain"
518
- }) : /* @__PURE__ */ E("span", {
519
+ }) : /* @__PURE__ */ _("span", {
519
520
  className: "font-semibold text-lg text-zinc-900 tracking-tight",
520
521
  children: n ?? "This site"
521
522
  }),
522
- /* @__PURE__ */ E("p", {
523
+ /* @__PURE__ */ _("p", {
523
524
  className: "mt-1 text-2xl text-zinc-900 tracking-tight",
524
525
  style: {
525
526
  fontFamily: "var(--font-heading, inherit)",
@@ -527,18 +528,18 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
527
528
  },
528
529
  children: "Ask anything"
529
530
  }),
530
- /* @__PURE__ */ E("p", {
531
+ /* @__PURE__ */ _("p", {
531
532
  className: "text-sm text-zinc-500",
532
533
  style: { fontFamily: "var(--font-heading, inherit)" },
533
534
  children: "Get instant answers about products, pricing, and how to get started."
534
535
  })
535
536
  ]
536
- }), /* @__PURE__ */ E("div", {
537
+ }), /* @__PURE__ */ _("div", {
537
538
  className: "flex w-full max-w-md flex-col gap-2",
538
- children: h === null ? Ze.map((e, t) => /* @__PURE__ */ E("div", {
539
+ children: h === null ? Ze.map((e, t) => /* @__PURE__ */ _("div", {
539
540
  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", {
541
+ children: /* @__PURE__ */ _("span", { className: `block h-3 animate-pulse rounded bg-zinc-200 ${e}` })
542
+ }, `skeleton-${t}`)) : h.map((e, t) => /* @__PURE__ */ _("button", {
542
543
  type: "button",
543
544
  onClick: () => g(e),
544
545
  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 +547,11 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
546
547
  children: e
547
548
  }, e))
548
549
  })]
549
- }) }), /* @__PURE__ */ E(z.If, {
550
+ }) }), /* @__PURE__ */ _(z.If, {
550
551
  empty: !1,
551
- children: /* @__PURE__ */ E("div", {
552
+ children: /* @__PURE__ */ _("div", {
552
553
  className: "ai-chat-kb-messages mx-auto max-w-3xl px-6 py-6 pt-8",
553
- children: /* @__PURE__ */ E(z.Messages, { components: {
554
+ children: /* @__PURE__ */ _(z.Messages, { components: {
554
555
  UserMessage: Je,
555
556
  AssistantMessage: He,
556
557
  EditComposer: Ye
@@ -558,58 +559,58 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
558
559
  })
559
560
  })]
560
561
  }),
561
- !c && /* @__PURE__ */ E("div", {
562
+ !c && /* @__PURE__ */ _("div", {
562
563
  className: "relative z-10 shrink-0 border-zinc-200 border-t bg-white/95 backdrop-blur-sm",
563
- children: /* @__PURE__ */ D("div", {
564
+ children: /* @__PURE__ */ v("div", {
564
565
  className: "relative mx-auto max-w-3xl px-4 pt-3 pb-3",
565
566
  children: [
566
- !p && /* @__PURE__ */ E("div", {
567
+ !p && /* @__PURE__ */ _("div", {
567
568
  className: "pointer-events-none absolute inset-x-0 -top-9 z-20 flex justify-center",
568
- children: /* @__PURE__ */ E(ge, {
569
+ children: /* @__PURE__ */ _(ge, {
569
570
  onClick: m,
570
571
  isRunning: u,
571
572
  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
573
  })
573
574
  }),
574
- s.length > 0 && !u && /* @__PURE__ */ E("div", {
575
+ s.length > 0 && !u && /* @__PURE__ */ _("div", {
575
576
  className: "mb-2",
576
- children: /* @__PURE__ */ E(H, {
577
+ children: /* @__PURE__ */ _(H, {
577
578
  chips: s,
578
579
  onSelect: g,
579
580
  size: "compact"
580
581
  })
581
582
  }),
582
- /* @__PURE__ */ D(L.Root, { children: [
583
- /* @__PURE__ */ E(z.If, {
583
+ /* @__PURE__ */ v(L.Root, { children: [
584
+ /* @__PURE__ */ _(z.If, {
584
585
  empty: !0,
585
- children: /* @__PURE__ */ E(Se, {
586
+ children: /* @__PURE__ */ _(Se, {
586
587
  variant: "expanded",
587
588
  isRunning: u,
588
- onStop: _
589
+ onStop: y
589
590
  })
590
591
  }),
591
- /* @__PURE__ */ E(z.If, {
592
+ /* @__PURE__ */ _(z.If, {
592
593
  empty: !1,
593
- children: /* @__PURE__ */ E(Se, {
594
+ children: /* @__PURE__ */ _(Se, {
594
595
  variant: "compact",
595
596
  isRunning: u,
596
- onStop: _
597
+ onStop: y
597
598
  })
598
599
  }),
599
- /* @__PURE__ */ E(L.If, {
600
+ /* @__PURE__ */ _(L.If, {
600
601
  dictation: !0,
601
- children: /* @__PURE__ */ D("div", {
602
+ children: /* @__PURE__ */ v("div", {
602
603
  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", {
604
+ children: [/* @__PURE__ */ _("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-red-500" }), /* @__PURE__ */ _("span", {
604
605
  className: "font-medium text-red-500 text-xs tracking-wide",
605
606
  children: "Listening… speak now"
606
607
  })]
607
608
  })
608
609
  })
609
610
  ] }),
610
- /* @__PURE__ */ E(z.If, {
611
+ /* @__PURE__ */ _(z.If, {
611
612
  empty: !1,
612
- children: /* @__PURE__ */ E("p", {
613
+ children: /* @__PURE__ */ _("p", {
613
614
  className: "mt-2 text-center text-[10px] text-zinc-500/70",
614
615
  children: "Answers can be inaccurate. Verify before relying on them."
615
616
  })
@@ -639,11 +640,11 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
639
640
  let i = document.referrer?.trim();
640
641
  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
642
  }, at = ({ workspaceId: e, siteName: t, siteLogo: n, agentId: r, apiBaseUrl: i, authHeaders: a, children: o }) => {
642
- let s = C(e);
643
+ let s = E(e);
643
644
  s.current = e;
644
- let c = C(r);
645
+ let c = E(r);
645
646
  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({
647
+ let { followUps: l, clearOnSend: u, handleData: d } = ue(), [f, p] = D(!1), { conversationIdRef: m, handleFinish: h, reset: g } = le(e), v = ae({
647
648
  joinStrategy: "none",
648
649
  transport: ce({
649
650
  api: `${i}/stream`,
@@ -672,23 +673,23 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
672
673
  onError: (e) => {
673
674
  de(e) ? p(!0) : console.warn("[levo-kb-chat] stream error:", e);
674
675
  }
675
- }), v = y(() => {
676
- _.threads.switchToNewThread().catch((e) => {
676
+ }), y = S(() => {
677
+ v.threads.switchToNewThread().catch((e) => {
677
678
  console.warn("[levo-kb-chat] switchToNewThread failed:", e);
678
679
  }), g(), u(), p(!1);
679
680
  }, [
680
- _,
681
+ v,
681
682
  g,
682
683
  u
683
684
  ]);
684
- return /* @__PURE__ */ E(I, {
685
- runtime: _,
686
- children: /* @__PURE__ */ E(U.Provider, {
685
+ return /* @__PURE__ */ _(I, {
686
+ runtime: v,
687
+ children: /* @__PURE__ */ _(U.Provider, {
687
688
  value: { agentUnavailable: f },
688
689
  children: o ? o({
689
690
  followUps: l,
690
- onResetChat: v
691
- }) : /* @__PURE__ */ E(Qe, {
691
+ onResetChat: y
692
+ }) : /* @__PURE__ */ _(Qe, {
692
693
  workspaceId: e,
693
694
  siteName: t,
694
695
  siteLogo: n,
@@ -700,7 +701,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
700
701
  })
701
702
  });
702
703
  }, ot = (e, t, n) => {
703
- x(() => {
704
+ w(() => {
704
705
  if (!e) return;
705
706
  let r = (e) => {
706
707
  if (e.key !== "Escape" || e.isComposing) return;
@@ -718,13 +719,13 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
718
719
  n
719
720
  ]);
720
721
  }, X = "(max-width: 639px)", Z = () => {
721
- let [e, t] = w(() => typeof window < "u" && window.matchMedia(X).matches);
722
- return x(() => {
722
+ let [e, t] = D(() => typeof window < "u" && window.matchMedia(X).matches);
723
+ return w(() => {
723
724
  let e = window.matchMedia(X), n = () => t(e.matches);
724
725
  return n(), e.addEventListener("change", n), () => e.removeEventListener("change", n);
725
726
  }, []), e;
726
727
  }, st = (e, t) => {
727
- x(() => {
728
+ w(() => {
728
729
  let n = t.current, r = window.visualViewport;
729
730
  if (!e || !n || !r || !window.matchMedia(X).matches) return;
730
731
  let i = () => {
@@ -735,7 +736,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
735
736
  };
736
737
  }, [e, t]);
737
738
  }, ct = (e, t, n) => {
738
- x(() => {
739
+ w(() => {
739
740
  if (!e) return;
740
741
  let r = (e) => {
741
742
  let r = e.composedPath();
@@ -747,16 +748,16 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
747
748
  t,
748
749
  n
749
750
  ]);
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);
751
+ }, Q = (...e) => e.filter(Boolean).join(" "), lt = ({ open: e, onToggle: i, askLabel: a, panelId: h, initialDraft: y }) => {
752
+ 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);
753
+ w(() => {
754
+ y && b.thread.composer().setText(y);
754
755
  }, []);
755
- let M = C(null), P = C(null), F = C(!1);
756
- S(() => {
756
+ let M = E(null), P = E(null), F = E(!1);
757
+ T(() => {
757
758
  let e = M.current;
758
759
  !e || document.activeElement === e || (F.current = !0, e.focus({ preventScroll: !0 }));
759
- }, []), S(() => {
760
+ }, []), T(() => {
760
761
  let t = M.current, n = P.current;
761
762
  if (!(!t || !n)) {
762
763
  if (!e) {
@@ -766,37 +767,37 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
766
767
  j(c(n, t));
767
768
  }
768
769
  }, [k, e]);
769
- let I = C(e);
770
- x(() => {
770
+ let I = E(e);
771
+ w(() => {
771
772
  let t = I.current;
772
773
  I.current = e;
773
774
  let n = M.current;
774
775
  e || !t || !n || document.activeElement === n && n.blur();
775
776
  }, [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", {
777
+ let R = E(S);
778
+ w(() => {
779
+ let e = !R.current && S;
780
+ R.current = S, x && e && M.current?.blur();
781
+ }, [S, x]);
782
+ let z = C ? "Continue conversation" : a;
783
+ return /* @__PURE__ */ _("div", {
783
784
  className: Q(l, e ? f : n),
784
- children: /* @__PURE__ */ D("div", {
785
+ children: /* @__PURE__ */ v("div", {
785
786
  ref: P,
786
787
  className: Q(m, A && "ai-chat-pill-surface--stacked"),
787
788
  children: [
788
- /* @__PURE__ */ E("button", {
789
+ /* @__PURE__ */ _("button", {
789
790
  type: "button",
790
791
  onClick: i,
791
792
  "aria-label": e ? "Collapse AI chat" : "Expand AI chat",
792
793
  "aria-expanded": e,
793
794
  "aria-controls": h,
794
795
  className: s,
795
- children: /* @__PURE__ */ E(ne, { className: "h-5 w-5" })
796
+ children: /* @__PURE__ */ _(ne, { className: "h-5 w-5" })
796
797
  }),
797
- /* @__PURE__ */ D("div", {
798
+ /* @__PURE__ */ v("div", {
798
799
  className: d,
799
- children: [/* @__PURE__ */ E(L.Input, {
800
+ children: [/* @__PURE__ */ _(L.Input, {
800
801
  ref: M,
801
802
  "data-ai-chat-composer": "",
802
803
  placeholder: e ? "Ask anything…" : "",
@@ -808,90 +809,90 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
808
809
  e || i();
809
810
  },
810
811
  onKeyDown: (e) => {
811
- e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !y && ee && _.thread.composer().send());
812
+ e.nativeEvent.isComposing || e.key !== "Enter" || e.shiftKey || (e.preventDefault(), !S && ee && b.thread.composer().send());
812
813
  },
813
814
  rows: 1,
814
815
  submitMode: "enter",
815
- unstable_focusOnRunStart: !v,
816
- unstable_focusOnScrollToBottom: !v,
817
- unstable_focusOnThreadSwitched: !v,
816
+ unstable_focusOnRunStart: !x,
817
+ unstable_focusOnScrollToBottom: !x,
818
+ unstable_focusOnThreadSwitched: !x,
818
819
  autoComplete: "off",
819
820
  autoCorrect: "off",
820
821
  autoCapitalize: "none",
821
822
  inputMode: "text",
822
823
  className: Q(r, "transition-opacity duration-200", !e && "opacity-0")
823
- }), /* @__PURE__ */ E("span", {
824
+ }), /* @__PURE__ */ _("span", {
824
825
  className: Q(o, "transition-opacity duration-150", e && "opacity-0"),
825
826
  "aria-hidden": !0,
826
827
  children: z
827
828
  })]
828
829
  }),
829
- /* @__PURE__ */ D("div", {
830
+ /* @__PURE__ */ v("div", {
830
831
  className: p,
831
- children: [e && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(L.If, {
832
+ children: [e && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(L.If, {
832
833
  dictation: !1,
833
- children: /* @__PURE__ */ E(L.Dictate, {
834
+ children: /* @__PURE__ */ _(L.Dictate, {
834
835
  "aria-label": "Start dictation",
835
836
  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" })
837
+ children: /* @__PURE__ */ _(te, { className: "h-5 w-5" })
837
838
  })
838
- }), /* @__PURE__ */ E(L.If, {
839
+ }), /* @__PURE__ */ _(L.If, {
839
840
  dictation: !0,
840
- children: /* @__PURE__ */ E(L.StopDictation, {
841
+ children: /* @__PURE__ */ _(L.StopDictation, {
841
842
  "aria-label": "Stop dictation",
842
843
  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" })
844
+ children: /* @__PURE__ */ _(N, { className: "h-4 w-4 fill-current" })
844
845
  })
845
- })] }), e ? y ? /* @__PURE__ */ E("button", {
846
+ })] }), e ? S ? /* @__PURE__ */ _("button", {
846
847
  type: "button",
847
- onClick: () => _.thread.cancelRun(),
848
+ onClick: () => b.thread.cancelRun(),
848
849
  "aria-label": "Stop generating",
849
850
  className: t,
850
851
  style: u,
851
- children: /* @__PURE__ */ E(N, { className: "h-4 w-4 fill-current" })
852
- }) : /* @__PURE__ */ E(L.Send, {
852
+ children: /* @__PURE__ */ _(N, { className: "h-4 w-4 fill-current" })
853
+ }) : /* @__PURE__ */ _(L.Send, {
853
854
  "aria-label": "Send message",
854
855
  className: Q(t, "disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:scale-100"),
855
856
  style: u,
856
- children: /* @__PURE__ */ E(O, { className: "h-5 w-5 stroke-[2.5px]" })
857
- }) : /* @__PURE__ */ E("button", {
857
+ children: /* @__PURE__ */ _(O, { className: "h-5 w-5 stroke-[2.5px]" })
858
+ }) : /* @__PURE__ */ _("button", {
858
859
  type: "button",
859
860
  onClick: i,
860
861
  "aria-label": "Open AI chat",
861
862
  className: t,
862
863
  style: u,
863
- children: /* @__PURE__ */ E(O, { className: "h-5 w-5 stroke-[2.5px]" })
864
+ children: /* @__PURE__ */ _(O, { className: "h-5 w-5 stroke-[2.5px]" })
864
865
  })]
865
866
  })
866
867
  ]
867
868
  })
868
869
  });
869
870
  }, 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(() => {
871
+ let [f, p] = D(!1);
872
+ w(() => {
872
873
  if (!l) return;
873
874
  let e = requestAnimationFrame(() => p(!0));
874
875
  return () => cancelAnimationFrame(e);
875
876
  }, [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", {
877
+ let m = `kb-chat-panel-${e ?? "default"}`, h = E(null), g = E(null), v = S(() => p(!1), []);
878
+ ot(f, g, v), ct(f, h, v), st(f, h);
879
+ let y = a(t);
880
+ return /* @__PURE__ */ _("div", {
880
881
  ref: h,
881
882
  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, {
883
+ children: /* @__PURE__ */ _(at, {
883
884
  workspaceId: e,
884
885
  siteName: t,
885
886
  siteLogo: n,
886
887
  agentId: o,
887
888
  apiBaseUrl: s,
888
889
  authHeaders: c,
889
- children: ({ followUps: a, onResetChat: l }) => /* @__PURE__ */ E(pt, {
890
+ children: ({ followUps: a, onResetChat: l }) => /* @__PURE__ */ _(pt, {
890
891
  open: f,
891
892
  onToggle: () => p((e) => !e),
892
893
  threadStateRef: g,
893
894
  onResetChat: l,
894
- askLabel: v,
895
+ askLabel: y,
895
896
  panelId: m,
896
897
  siteName: t,
897
898
  siteIcon: r,
@@ -899,7 +900,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
899
900
  initialDraft: u,
900
901
  showBranding: d,
901
902
  followUps: a,
902
- thread: /* @__PURE__ */ E(Qe, {
903
+ thread: /* @__PURE__ */ _(Qe, {
903
904
  workspaceId: e,
904
905
  siteName: t,
905
906
  siteLogo: n,
@@ -917,8 +918,8 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
917
918
  "px-3 py-1 text-[13px] leading-snug",
918
919
  "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
920
  ].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 = {
921
+ let m = B(), h = V((e) => e.thread.isRunning), y = V((e) => e.thread.messages.length > 0), b = Z() ? f.slice(0, 2) : f;
922
+ w(() => (r.current = {
922
923
  isRunning: h,
923
924
  cancelRun: () => m.thread.cancelRun()
924
925
  }, () => {
@@ -928,74 +929,74 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
928
929
  m,
929
930
  r
930
931
  ]);
931
- let v = y((t) => {
932
+ let x = S((t) => {
932
933
  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", {
934
+ }, [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`;
935
+ return /* @__PURE__ */ v(g, { children: [
936
+ /* @__PURE__ */ _("div", {
936
937
  "aria-hidden": !0,
937
938
  className: $("absolute inset-0", t ? "pointer-events-auto" : "pointer-events-none"),
938
939
  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", {
940
+ children: /* @__PURE__ */ _("div", {
940
941
  className: $("ai-chat-kb-surface h-full w-full p-[2px]", !t && "ai-chat-kb-surface-closed"),
941
942
  style: { background: ut },
942
- children: /* @__PURE__ */ E("div", { className: "h-full w-full rounded-t-[26px] rounded-b-[40px] bg-white" })
943
+ children: /* @__PURE__ */ _("div", { className: "h-full w-full rounded-t-[26px] rounded-b-[40px] bg-white" })
943
944
  })
944
945
  }),
945
- /* @__PURE__ */ D("section", {
946
+ /* @__PURE__ */ v("section", {
946
947
  id: o,
947
948
  "aria-label": "AI chat",
948
949
  inert: !t,
949
950
  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
951
  children: [
951
- /* @__PURE__ */ D("header", {
952
+ /* @__PURE__ */ v("header", {
952
953
  className: "flex h-14 w-full shrink-0 items-center justify-between gap-2 px-4",
953
- children: [/* @__PURE__ */ D("div", {
954
+ children: [/* @__PURE__ */ v("div", {
954
955
  className: "flex min-w-0 items-center gap-2",
955
- children: [c ? /* @__PURE__ */ E("img", {
956
+ children: [c ? /* @__PURE__ */ _("img", {
956
957
  src: c,
957
958
  alt: "",
958
959
  className: "h-6 w-6 shrink-0 rounded-sm object-contain"
959
- }) : null, /* @__PURE__ */ E("span", {
960
+ }) : null, /* @__PURE__ */ _("span", {
960
961
  className: "truncate font-semibold text-sm text-zinc-900",
961
- children: b
962
+ children: C
962
963
  })]
963
- }), /* @__PURE__ */ D("div", {
964
+ }), /* @__PURE__ */ v("div", {
964
965
  className: "flex flex-shrink-0 items-center gap-1",
965
- children: [g && /* @__PURE__ */ E("button", {
966
+ children: [y && /* @__PURE__ */ _("button", {
966
967
  type: "button",
967
968
  onClick: i,
968
969
  "aria-label": "Start new chat",
969
970
  title: "Start new chat",
970
971
  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", {
972
+ children: /* @__PURE__ */ _(j, { className: "h-4 w-4" })
973
+ }), /* @__PURE__ */ _("button", {
973
974
  type: "button",
974
975
  onClick: n,
975
976
  "aria-label": "Close AI chat",
976
977
  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" })
978
+ children: /* @__PURE__ */ _(P, { className: "h-4 w-4" })
978
979
  })]
979
980
  })]
980
981
  }),
981
- /* @__PURE__ */ E("div", { className: "mx-4 h-px shrink-0 bg-zinc-100" }),
982
- /* @__PURE__ */ E("div", {
982
+ /* @__PURE__ */ _("div", { className: "mx-4 h-px shrink-0 bg-zinc-100" }),
983
+ /* @__PURE__ */ _("div", {
983
984
  className: "ai-chat-kb-thread flex max-h-[min(60vh,32rem)] min-h-0 flex-col overflow-hidden",
984
985
  children: p
985
986
  }),
986
- _.length > 0 && !h && /* @__PURE__ */ E("div", {
987
+ b.length > 0 && !h && /* @__PURE__ */ _("div", {
987
988
  className: "shrink-0 px-4 pt-1 pb-2",
988
- children: /* @__PURE__ */ E(H, {
989
- chips: _,
990
- onSelect: v,
989
+ children: /* @__PURE__ */ _(H, {
990
+ chips: b,
991
+ onSelect: x,
991
992
  chipClassName: ft
992
993
  })
993
994
  })
994
995
  ]
995
996
  }),
996
- /* @__PURE__ */ E("div", {
997
+ /* @__PURE__ */ _("div", {
997
998
  className: "ai-chat-kb-pillbox pointer-events-auto relative z-20 mx-3 mt-1",
998
- children: /* @__PURE__ */ E(lt, {
999
+ children: /* @__PURE__ */ _(lt, {
999
1000
  open: t,
1000
1001
  onToggle: n,
1001
1002
  askLabel: a,
@@ -1003,14 +1004,14 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1003
1004
  initialDraft: u
1004
1005
  })
1005
1006
  }),
1006
- d && /* @__PURE__ */ E("div", {
1007
+ d && /* @__PURE__ */ _("div", {
1007
1008
  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", {
1009
+ children: /* @__PURE__ */ _("div", {
1009
1010
  className: "overflow-hidden",
1010
- children: /* @__PURE__ */ D("p", {
1011
+ children: /* @__PURE__ */ v("p", {
1011
1012
  className: "pt-2 text-center text-[11px] text-zinc-400",
1012
- children: ["Powered by ", /* @__PURE__ */ E("a", {
1013
- href: S,
1013
+ children: ["Powered by ", /* @__PURE__ */ _("a", {
1014
+ href: T,
1014
1015
  target: "_blank",
1015
1016
  rel: "noopener noreferrer",
1016
1017
  className: "pointer-events-auto font-medium text-zinc-500 underline-offset-2 transition-colors hover:text-zinc-700 hover:underline",
@@ -1019,7 +1020,7 @@ var H = ({ chips: e, onSelect: t, size: n = "comfortable", className: r, chipCla
1019
1020
  })
1020
1021
  })
1021
1022
  }),
1022
- /* @__PURE__ */ E("div", { className: "h-3" })
1023
+ /* @__PURE__ */ _("div", { className: "h-3" })
1023
1024
  ] });
1024
1025
  };
1025
1026
  //#endregion