inline-chat-kit 0.57.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  import e, { createContext as t, createElement as n, forwardRef as r, isValidElement as i, memo as a, useCallback as o, useContext as s, useEffect as c, useId as l, useImperativeHandle as u, useLayoutEffect as d, useMemo as f, useRef as p, useState as m, useSyncExternalStore as h } from "react";
3
3
  import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
4
4
  import { AnimatePresence as y, LayoutGroup as b, MotionConfig as x, animate as S, motion as C, useAnimationControls as w, useMotionValue as T, useReducedMotion as E } from "motion/react";
5
- import { ArrowDown as D, ArrowLeft as O, Bookmark as k, Brain as A, Check as j, ChevronDown as M, ChevronLeft as ee, ChevronRight as N, Copy as P, CornerDownLeft as F, File as te, FileText as I, Film as ne, Highlighter as re, Image as ie, Link2 as L, Maximize2 as ae, MessageCircle as oe, Mic as se, Minimize2 as R, Moon as ce, MoreHorizontal as le, Music as ue, Palette as de, Paperclip as fe, Pencil as z, Plus as pe, RotateCcw as me, Save as he, Share as ge, Square as _e, Sun as ve, TextCursor as ye, ThumbsDown as be, ThumbsUp as xe, Trash2 as Se, TriangleAlert as Ce, X as we } from "lucide-react";
5
+ import { ArrowDown as D, ArrowLeft as O, Bookmark as k, Brain as A, Check as j, ChevronDown as M, ChevronLeft as ee, ChevronRight as te, Copy as N, CornerDownLeft as P, File as F, FileText as ne, Film as I, Highlighter as re, Image as L, Link2 as ie, Maximize2 as R, MessageCircle as ae, Mic as oe, Minimize2 as se, Moon as ce, MoreHorizontal as le, Music as ue, Palette as de, Paperclip as z, Pencil as fe, Plus as pe, RotateCcw as me, Save as he, Share as ge, Square as _e, Sun as ve, TextCursor as ye, ThumbsDown as be, ThumbsUp as xe, Trash2 as Se, TriangleAlert as Ce, X as we } from "lucide-react";
6
6
  var B = {
7
7
  btn: "ick-btn-ZW5E",
8
8
  xs: "ick-xs-rDs4",
@@ -67,7 +67,7 @@ var B = {
67
67
  })
68
68
  ]
69
69
  });
70
- }), H = {
70
+ }), De = {
71
71
  list: "ick-list-4-Xw",
72
72
  item: "ick-item-5jP3",
73
73
  picture: "ick-picture-JacB",
@@ -76,7 +76,7 @@ var B = {
76
76
  name: "ick-name-6t7S",
77
77
  size: "ick-size-sR5p",
78
78
  remove: "ick-remove-6I5y"
79
- }, De = {
79
+ }, Oe = {
80
80
  approval: {
81
81
  once: "Allow once",
82
82
  always: "Always allow",
@@ -226,9 +226,9 @@ var B = {
226
226
  paragraph: "Paragraph {index}",
227
227
  responding: "Generating response"
228
228
  }
229
- }, Oe = t({});
230
- function ke({ labels: e, children: t }) {
231
- let n = s(Oe), r = e ? JSON.stringify(e) : "", i = f(() => {
229
+ }, ke = t({});
230
+ function Ae({ labels: e, children: t }) {
231
+ let n = s(ke), r = e ? JSON.stringify(e) : "", i = f(() => {
232
232
  if (!r) return n;
233
233
  let e = JSON.parse(r), t = { ...n };
234
234
  for (let r of Object.keys(e)) t[r] = {
@@ -237,25 +237,25 @@ function ke({ labels: e, children: t }) {
237
237
  };
238
238
  return t;
239
239
  }, [n, r]);
240
- return /* @__PURE__ */ _(Oe.Provider, {
240
+ return /* @__PURE__ */ _(ke.Provider, {
241
241
  value: i,
242
242
  children: t
243
243
  });
244
244
  }
245
- function U(e, t) {
246
- let n = s(Oe)[e];
245
+ function H(e, t) {
246
+ let n = s(ke)[e];
247
247
  return {
248
- ...De[e],
248
+ ...Oe[e],
249
249
  ...n,
250
250
  ...t
251
251
  };
252
252
  }
253
- function Ae(e, t) {
253
+ function je(e, t) {
254
254
  return e.replace(/\{(\w+)\}/g, (e, n) => n in t ? String(t[n]) : e);
255
255
  }
256
256
  //#endregion
257
257
  //#region src/Attachments/Attachments.tsx
258
- function je(e) {
258
+ function Me(e) {
259
259
  if (e === void 0 || !Number.isFinite(e) || e < 0) return "";
260
260
  if (e < 1024) return `${e} B`;
261
261
  let t = [
@@ -266,43 +266,43 @@ function je(e) {
266
266
  for (; n >= 1024 && r < t.length - 1;) n /= 1024, r += 1;
267
267
  return `${n < 10 ? n.toFixed(1) : Math.round(n)} ${t[r]}`;
268
268
  }
269
- var Me = (e) => !!e.url && (e.type ?? "").startsWith("image/"), Ne = (e) => e.replace(/["\\]/g, encodeURIComponent);
269
+ var U = (e) => !!e.url && (e.type ?? "").startsWith("image/"), Ne = (e) => e.replace(/["\\]/g, encodeURIComponent);
270
270
  function Pe({ type: e }) {
271
271
  let t = (e ?? "").split("/")[0];
272
- return _(t === "image" ? ie : t === "video" ? ne : t === "audio" ? ue : e === "application/pdf" || t === "text" ? I : te, {
272
+ return _(t === "image" ? L : t === "video" ? I : t === "audio" ? ue : e === "application/pdf" || t === "text" ? ne : F, {
273
273
  size: 16,
274
274
  "aria-hidden": !0
275
275
  });
276
276
  }
277
277
  function Fe({ attachments: e, onRemove: t, labels: n, className: r, ...i }) {
278
- let a = U("attachments", n);
278
+ let a = H("attachments", n);
279
279
  return e.length === 0 ? null : /* @__PURE__ */ _("ul", {
280
- className: [H.list, r ?? ""].filter(Boolean).join(" "),
280
+ className: [De.list, r ?? ""].filter(Boolean).join(" "),
281
281
  ...i,
282
282
  children: e.map((e) => {
283
- let n = je(e.size);
283
+ let n = Me(e.size);
284
284
  return /* @__PURE__ */ v("li", {
285
- className: H.item,
286
- "data-picture": Me(e) || void 0,
287
- children: [Me(e) ? /* @__PURE__ */ _("span", {
288
- className: H.picture,
285
+ className: De.item,
286
+ "data-picture": U(e) || void 0,
287
+ children: [U(e) ? /* @__PURE__ */ _("span", {
288
+ className: De.picture,
289
289
  style: { backgroundImage: `url("${Ne(e.url)}")` },
290
290
  role: "img",
291
291
  "aria-label": e.name
292
292
  }) : /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
293
- className: H.glyph,
293
+ className: De.glyph,
294
294
  children: /* @__PURE__ */ _(Pe, { type: e.type })
295
295
  }), /* @__PURE__ */ v("span", {
296
- className: H.body,
296
+ className: De.body,
297
297
  children: [/* @__PURE__ */ _("span", {
298
- className: H.name,
298
+ className: De.name,
299
299
  children: e.name
300
300
  }), n && /* @__PURE__ */ _("span", {
301
- className: H.size,
301
+ className: De.size,
302
302
  children: n
303
303
  })]
304
304
  })] }), t && /* @__PURE__ */ _("span", {
305
- className: H.remove,
305
+ className: De.remove,
306
306
  children: /* @__PURE__ */ _(V, {
307
307
  variant: "glass",
308
308
  size: "s",
@@ -365,13 +365,13 @@ function Le({ mode: e, color: t = "currentColor", duration: n = .22, size: r = 1
365
365
  alignItems: "center",
366
366
  justifyContent: "center"
367
367
  },
368
- children: e === "send" ? /* @__PURE__ */ _(F, {
368
+ children: e === "send" ? /* @__PURE__ */ _(P, {
369
369
  size: r,
370
370
  color: t,
371
371
  strokeWidth: 1.8,
372
372
  strokeLinecap: "round",
373
373
  strokeLinejoin: "round"
374
- }) : e === "mic" ? /* @__PURE__ */ _(se, {
374
+ }) : e === "mic" ? /* @__PURE__ */ _(oe, {
375
375
  size: r,
376
376
  color: t,
377
377
  strokeWidth: 1.8,
@@ -421,7 +421,7 @@ var W = {
421
421
  //#endregion
422
422
  //#region src/ChatInput/HoverActionsRow.tsx
423
423
  function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r, onCopy: i, onEdit: a, value: o, ac: s }) {
424
- let c = U("input");
424
+ let c = H("input");
425
425
  return /* @__PURE__ */ _(y, {
426
426
  initial: !1,
427
427
  children: e && /* @__PURE__ */ v(C.div, {
@@ -483,7 +483,7 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
483
483
  })
484
484
  }, "read-more"), [{
485
485
  id: "copy",
486
- icon: /* @__PURE__ */ _(P, {
486
+ icon: /* @__PURE__ */ _(N, {
487
487
  size: 14,
488
488
  "aria-hidden": !0
489
489
  }),
@@ -491,7 +491,7 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
491
491
  label: c.copy
492
492
  }, {
493
493
  id: "edit",
494
- icon: /* @__PURE__ */ _(z, {
494
+ icon: /* @__PURE__ */ _(fe, {
495
495
  size: 14,
496
496
  "aria-hidden": !0
497
497
  }),
@@ -528,12 +528,12 @@ function Re({ showActions: e, showReadMore: t, isExpanded: n, setIsExpanded: r,
528
528
  //#endregion
529
529
  //#region src/ChatInput/AddCardsOverlay.tsx
530
530
  function ze() {
531
- let e = U("input");
531
+ let e = H("input");
532
532
  return [
533
533
  {
534
534
  id: "attach",
535
535
  label: e.attach,
536
- icon: /* @__PURE__ */ _(fe, {
536
+ icon: /* @__PURE__ */ _(z, {
537
537
  size: 16,
538
538
  "aria-hidden": !0
539
539
  })
@@ -549,7 +549,7 @@ function ze() {
549
549
  {
550
550
  id: "connectors",
551
551
  label: e.connectors,
552
- icon: /* @__PURE__ */ _(L, {
552
+ icon: /* @__PURE__ */ _(ie, {
553
553
  size: 16,
554
554
  "aria-hidden": !0
555
555
  })
@@ -557,7 +557,7 @@ function ze() {
557
557
  ];
558
558
  }
559
559
  function Be({ isAddOpen: e, setIsAddOpen: t, onAdd: n, items: r, showInlineGlyph: i, showButtons: a, ac: o }) {
560
- let s = ze(), c = r ?? s, { closeMenu: l } = U("input");
560
+ let s = ze(), c = r ?? s, { closeMenu: l } = H("input");
561
561
  return /* @__PURE__ */ _(y, { children: e && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(C.div, {
562
562
  className: W.addBackdrop,
563
563
  initial: { opacity: 0 },
@@ -698,7 +698,7 @@ function Ge(e) {
698
698
  let n = document.createElement("div");
699
699
  return n.setAttribute("role", e === "assertive" ? "alert" : "status"), n.setAttribute("aria-live", e), n.setAttribute("aria-atomic", "true"), n.dataset.inlineChatKit = "live-region", Object.assign(n.style, We), document.body.appendChild(n), He.set(e, n), n;
700
700
  }
701
- function G(e, t = "polite") {
701
+ function Ke(e, t = "polite") {
702
702
  if (!e) return;
703
703
  let n = Ge(t);
704
704
  if (!n) return;
@@ -709,9 +709,9 @@ function G(e, t = "polite") {
709
709
  }
710
710
  //#endregion
711
711
  //#region src/reducedMotion/reducedMotion.ts
712
- var K = "(prefers-reduced-motion: reduce)", Ke;
712
+ var G = "(prefers-reduced-motion: reduce)", K;
713
713
  function q() {
714
- return Ke === void 0 && (Ke = typeof window < "u" && window.matchMedia ? window.matchMedia(K) : null), Ke?.matches ?? !1;
714
+ return K === void 0 && (K = typeof window < "u" && window.matchMedia ? window.matchMedia(G) : null), K?.matches ?? !1;
715
715
  }
716
716
  //#endregion
717
717
  //#region src/voice/useVoiceInput.ts
@@ -730,7 +730,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
730
730
  onTranscript: t,
731
731
  onDone: n
732
732
  }), w = p({
733
- ...De.voice,
733
+ ...Oe.voice,
734
734
  ...i
735
735
  });
736
736
  c(() => {
@@ -739,7 +739,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
739
739
  onTranscript: t,
740
740
  onDone: n
741
741
  }, w.current = {
742
- ...De.voice,
742
+ ...Oe.voice,
743
743
  ...i
744
744
  };
745
745
  });
@@ -777,7 +777,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
777
777
  return;
778
778
  }
779
779
  let r = new AbortController();
780
- x.current = r, l("transcribing"), G(w.current.transcribing);
780
+ x.current = r, l("transcribing"), Ke(w.current.transcribing);
781
781
  try {
782
782
  let i = await D(n(e, {
783
783
  signal: r.signal,
@@ -785,13 +785,13 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
785
785
  }));
786
786
  if (r.signal.aborted) return;
787
787
  if (!i) {
788
- G(w.current.nothingHeard), l("idle");
788
+ Ke(w.current.nothingHeard), l("idle");
789
789
  return;
790
790
  }
791
- C.current.onTranscript?.(i), C.current.onDone?.(i), G(w.current.transcriptAdded), l("idle");
791
+ C.current.onTranscript?.(i), C.current.onDone?.(i), Ke(w.current.transcriptAdded), l("idle");
792
792
  } catch (e) {
793
793
  if (r.signal.aborted) return;
794
- d(e instanceof Error ? e.message : w.current.transcriptFailed), l("failed"), G(w.current.transcriptFailed, "assertive");
794
+ d(e instanceof Error ? e.message : w.current.transcriptFailed), l("failed"), Ke(w.current.transcriptFailed, "assertive");
795
795
  } finally {
796
796
  x.current = null;
797
797
  }
@@ -803,7 +803,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
803
803
  e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
804
804
  } catch (e) {
805
805
  let t = e?.name;
806
- t === "NotAllowedError" || t === "SecurityError" ? (l("denied"), G(w.current.refused, "assertive")) : (d(t === "NotFoundError" ? w.current.notFound : w.current.couldNotOpen), l("failed"), G(w.current.couldNotOpen, "assertive"));
806
+ t === "NotAllowedError" || t === "SecurityError" ? (l("denied"), Ke(w.current.refused, "assertive")) : (d(t === "NotFoundError" ? w.current.notFound : w.current.couldNotOpen), l("failed"), Ke(w.current.couldNotOpen, "assertive"));
807
807
  return;
808
808
  }
809
809
  _.current = e, b.current = [];
@@ -823,7 +823,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
823
823
  return;
824
824
  }
825
825
  O(r, e);
826
- }, n.start(), l("listening"), G(w.current.listening);
826
+ }, n.start(), l("listening"), Ke(w.current.listening);
827
827
  }, [
828
828
  E,
829
829
  T,
@@ -831,7 +831,7 @@ function Qe({ onTranscribe: e, onTranscript: t, onDone: n, meterRef: r, labels:
831
831
  ]), A = o(() => {
832
832
  let e = g.current;
833
833
  if (e && e.state !== "inactive") {
834
- G(w.current.stoppedListening), e.stop();
834
+ Ke(w.current.stoppedListening), e.stop();
835
835
  return;
836
836
  }
837
837
  x.current?.abort(), x.current = null, T(), l("idle");
@@ -944,24 +944,24 @@ var nt = .9, rt = {
944
944
  n.deleteContents();
945
945
  let r = document.createTextNode(e);
946
946
  return n.insertNode(r), n.setStartAfter(r), n.collapse(!0), t.removeAllRanges(), t.addRange(n), !1;
947
- }, ot = r(function({ state: e, value: t, onChange: n, onSubmit: r, onStop: i, onAdd: a, attachments: s, onAttach: d, onRemoveAttachment: f, accept: h = "image/*", multiple: T = !1, onTranscribe: E, onCopy: D, onEdit: O, onCancelEdit: k, isEditing: A = !1, placeholder: j, menu: M, labels: ee, animationConfig: N, style: P }, F) {
948
- let te = l(), I = U("input", ee), ne = U("voice"), re = j ?? I.placeholder, ie = M !== !1, L = p(null), ae = p(null), oe = p(null), se = p(0), R = p(!1), ce = p(null), [le, ue] = m(!1), [de, fe] = m(!1), [z, me] = m(!1), [he, ge] = m(!0), [_e, ve] = m(!1), [ye, be] = m(!1), [xe, Se] = m(!1), Ce = p(0), B = p(!1), Te = p(0), Ee = p(!1), H = p(null);
947
+ }, ot = r(function({ state: e, value: t, onChange: n, onSubmit: r, onStop: i, onAdd: a, attachments: s, onAttach: d, onRemoveAttachment: f, accept: h = "image/*", multiple: T = !1, onTranscribe: E, onCopy: D, onEdit: O, onCancelEdit: k, isEditing: A = !1, busy: j = !1, placeholder: M, menu: ee, labels: te, animationConfig: N, style: P }, F) {
948
+ let ne = l(), I = H("input", te), re = H("voice"), L = M ?? I.placeholder, ie = ee !== !1, R = p(null), ae = p(null), oe = p(null), se = p(0), ce = p(!1), le = p(null), [ue, de] = m(!1), [z, fe] = m(!1), [me, he] = m(!1), [ge, _e] = m(!0), [ve, ye] = m(!1), [be, xe] = m(!1), [Se, Ce] = m(!1), B = p(0), Te = p(!1), Ee = p(0), De = p(!1), Oe = p(null);
949
949
  c(() => () => {
950
- H.current && clearTimeout(H.current);
950
+ Oe.current && clearTimeout(Oe.current);
951
951
  }, []);
952
- let De = w(), Oe = p(e), ke = p(N);
953
- ke.current = N;
954
- let Ae = p(null), [je, Me] = m([]), Ne = s ?? je, Pe = p(Ne);
955
- Pe.current = Ne;
956
- let Ie = p([]);
952
+ let ke = w(), Ae = p(e), je = p(N);
953
+ je.current = N;
954
+ let Me = p(null), [U, Ne] = m([]), Pe = s ?? U, Ie = p(Pe);
955
+ Ie.current = Pe;
956
+ let ze = p([]);
957
957
  c(() => () => {
958
- Ie.current.forEach((e) => URL.revokeObjectURL(e)), Ie.current = [];
958
+ ze.current.forEach((e) => URL.revokeObjectURL(e)), ze.current = [];
959
959
  }, []);
960
- let ze = o((e) => {
960
+ let Ve = o((e) => {
961
961
  if (!e) return;
962
- let t = Ie.current.indexOf(e);
963
- t !== -1 && (URL.revokeObjectURL(e), Ie.current.splice(t, 1));
964
- }, []), Ve = (e) => {
962
+ let t = ze.current.indexOf(e);
963
+ t !== -1 && (URL.revokeObjectURL(e), ze.current.splice(t, 1));
964
+ }, []), He = (e) => {
965
965
  let t = Array.from(e.target.files ?? []);
966
966
  if (e.target.value = "", t.length === 0) return;
967
967
  if (d) {
@@ -970,7 +970,7 @@ var nt = .9, rt = {
970
970
  }
971
971
  let n = t.map((e) => {
972
972
  let t = URL.createObjectURL(e);
973
- return Ie.current.push(t), {
973
+ return ze.current.push(t), {
974
974
  id: `${e.name}-${e.size}-${e.lastModified}`,
975
975
  name: e.name,
976
976
  type: e.type,
@@ -978,56 +978,56 @@ var nt = .9, rt = {
978
978
  url: t
979
979
  };
980
980
  });
981
- Me((e) => {
981
+ Ne((e) => {
982
982
  if (T) return [...e, ...n];
983
983
  let t = n.slice(-1);
984
- return e.forEach((e) => ze(e.url)), n.slice(0, -1).forEach((e) => ze(e.url)), t;
984
+ return e.forEach((e) => Ve(e.url)), n.slice(0, -1).forEach((e) => Ve(e.url)), t;
985
985
  });
986
- }, He = o((e) => {
986
+ }, Ue = o((e) => {
987
987
  if (f) {
988
988
  f(e);
989
989
  return;
990
990
  }
991
- Me((t) => (ze(t.find((t) => t.id === e)?.url), t.filter((t) => t.id !== e)));
992
- }, [f, ze]);
991
+ Ne((t) => (Ve(t.find((t) => t.id === e)?.url), t.filter((t) => t.id !== e)));
992
+ }, [f, Ve]);
993
993
  u(F, () => ({
994
- focus: (e) => L.current?.focus(e),
994
+ focus: (e) => R.current?.focus(e),
995
995
  setValue: (e) => {
996
- let t = L.current;
996
+ let t = R.current;
997
997
  t && (t.textContent = e, $e(t)), n(e);
998
998
  },
999
999
  getValue: () => t
1000
1000
  }), [n, t]);
1001
- let Ue = p(null), We = p(null), Ge = p(null);
1001
+ let We = p(null), Ge = p(null), Ke = p(null);
1002
1002
  c(() => {
1003
1003
  if (!E) return;
1004
- let e = L.current;
1004
+ let e = R.current;
1005
1005
  if (!e) return;
1006
1006
  let t = () => {
1007
1007
  let t = window.getSelection();
1008
- !t || t.rangeCount === 0 || e.contains(t.getRangeAt(0).endContainer) && (Ge.current = et(e));
1008
+ !t || t.rangeCount === 0 || e.contains(t.getRangeAt(0).endContainer) && (Ke.current = et(e));
1009
1009
  };
1010
1010
  return document.addEventListener("selectionchange", t), () => document.removeEventListener("selectionchange", t);
1011
1011
  }, [E]);
1012
1012
  let G = Qe({
1013
1013
  onTranscribe: E,
1014
1014
  onTranscript: o((e) => {
1015
- let t = We.current, r = L.current;
1015
+ let t = Ge.current, r = R.current;
1016
1016
  if (!t || !r) return;
1017
1017
  let i = t.base.slice(0, t.at) + e + t.base.slice(t.at);
1018
1018
  r.textContent = i, tt(r, t.at + e.length), n(i);
1019
1019
  }, [n]),
1020
1020
  onDone: () => {
1021
- We.current = null, L.current?.focus();
1021
+ Ge.current = null, R.current?.focus();
1022
1022
  },
1023
- meterRef: Ue,
1024
- labels: ne
1025
- }), K = e === "responding" || e === "resting", Ke = K, q = t.trim().length > 0 || Ne.length > 0, qe = (e === "typing" || e === "idle") && q, Je = e === "responding", Ye = e === "resting" && le, Xe = Ye, Ze = e === "resting" && ye, rt = G.state === "listening" || G.state === "requesting" || G.state === "transcribing", ot = !!E && G.supported && !A, st = qe || Je, J = N, ct = J ? {
1023
+ meterRef: We,
1024
+ labels: re
1025
+ }), K = e === "responding" || e === "resting", q = K, qe = t.trim().length > 0 || Pe.length > 0, Je = e === "typing" || e === "idle", Ye = Je && qe && !j, Xe = !!i && (e === "responding" || j && Je), Ze = j && Je && qe && !i, rt = e === "resting" && ue, ot = rt, st = e === "resting" && be, ct = G.state === "listening" || G.state === "requesting" || G.state === "transcribing", lt = !!E && G.supported && !A, ut = Ye || Xe || Ze, J = N, dt = J ? {
1026
1026
  type: "spring",
1027
1027
  stiffness: J.bubble.stiffness,
1028
1028
  damping: J.bubble.damping,
1029
1029
  mass: J.bubble.mass
1030
- } : it, lt = o(() => {
1030
+ } : it, ft = o(() => {
1031
1031
  let e = ae.current, t = oe.current;
1032
1032
  if (!e || !t) return;
1033
1033
  if (!(e.scrollHeight > e.clientHeight)) {
@@ -1039,27 +1039,27 @@ var nt = .9, rt = {
1039
1039
  }, []);
1040
1040
  c(() => {
1041
1041
  let e = ae.current;
1042
- if (e) return e.addEventListener("scroll", lt, { passive: !0 }), () => e.removeEventListener("scroll", lt);
1043
- }, [lt]), c(() => {
1042
+ if (e) return e.addEventListener("scroll", ft, { passive: !0 }), () => e.removeEventListener("scroll", ft);
1043
+ }, [ft]), c(() => {
1044
1044
  let e = requestAnimationFrame(() => {
1045
1045
  let e = ae.current;
1046
- e && !Ke && (e.scrollTop = e.scrollHeight), lt();
1046
+ e && !q && (e.scrollTop = e.scrollHeight), ft();
1047
1047
  });
1048
1048
  return () => cancelAnimationFrame(e);
1049
1049
  }, [
1050
1050
  t,
1051
- Ke,
1052
- lt
1051
+ q,
1052
+ ft
1053
1053
  ]), c(() => {
1054
- (e === "idle" || e === "typing") && L.current?.focus({ preventScroll: !0 });
1054
+ (e === "idle" || e === "typing") && R.current?.focus({ preventScroll: !0 });
1055
1055
  }, [e]), c(() => {
1056
- let e = L.current;
1057
- e && (Ce.current = e.scrollHeight || 17);
1056
+ let e = R.current;
1057
+ e && (B.current = e.scrollHeight || 17);
1058
1058
  }, []), c(() => {
1059
- let e = L.current, t = ce.current;
1060
- !e || !Ce.current || requestAnimationFrame(() => {
1061
- let n = t ? t.offsetWidth : 0, r = e.clientWidth - 16, i = (ae.current?.scrollHeight ?? 0) > Ce.current + 2, a = ke.current;
1062
- B.current ? !(i || n >= r - 2) && n < Te.current * (a?.wrap?.exitThreshold ?? .75) && (B.current = !1, Ee.current = !1, me(!1), ge(!0), H.current &&= (clearTimeout(H.current), null)) : (Te.current = r, (i || n >= Te.current * (a?.wrap?.nearThreshold ?? .92)) && (B.current = !0, Ee.current = !0, ge(!1)));
1059
+ let e = R.current, t = le.current;
1060
+ !e || !B.current || requestAnimationFrame(() => {
1061
+ let n = t ? t.offsetWidth : 0, r = e.clientWidth - 16, i = (ae.current?.scrollHeight ?? 0) > B.current + 2, a = je.current;
1062
+ Te.current ? !(i || n >= r - 2) && n < Ee.current * (a?.wrap?.exitThreshold ?? .75) && (Te.current = !1, De.current = !1, he(!1), _e(!0), Oe.current &&= (clearTimeout(Oe.current), null)) : (Ee.current = r, (i || n >= Ee.current * (a?.wrap?.nearThreshold ?? .92)) && (Te.current = !0, De.current = !0, _e(!1)));
1063
1063
  });
1064
1064
  }, [t]), c(() => {
1065
1065
  if (!K) return;
@@ -1076,24 +1076,24 @@ var nt = .9, rt = {
1076
1076
  }
1077
1077
  });
1078
1078
  }, [K]), c(() => {
1079
- K ? Se(!1) : (ve(!1), be(!1));
1079
+ K ? Ce(!1) : (ye(!1), xe(!1));
1080
1080
  }, [K]), c(() => {
1081
1081
  if (!K) return;
1082
1082
  let e = oe.current;
1083
- e && (ye && !_e ? e.dataset.fade = "bottom" : e.removeAttribute("data-fade"));
1083
+ e && (be && !ve ? e.dataset.fade = "bottom" : e.removeAttribute("data-fade"));
1084
1084
  }, [
1085
1085
  K,
1086
- ye,
1087
- _e
1086
+ be,
1087
+ ve
1088
1088
  ]), c(() => {
1089
- let t = Oe.current;
1090
- if (Oe.current = e, t !== "responding" || e !== "resting") return;
1089
+ let t = Ae.current;
1090
+ if (Ae.current = e, t !== "responding" || e !== "resting") return;
1091
1091
  requestAnimationFrame(() => {
1092
1092
  let e = ae.current;
1093
- e && (se.current = e.scrollHeight, be(e.scrollHeight > 241), lt());
1093
+ e && (se.current = e.scrollHeight, xe(e.scrollHeight > 241), ft());
1094
1094
  }), fe(!0);
1095
- let n = ke.current;
1096
- De.start({
1095
+ let n = je.current;
1096
+ ke.start({
1097
1097
  scaleX: [
1098
1098
  1,
1099
1099
  n?.ripple?.scaleX ?? 1.018,
@@ -1118,26 +1118,31 @@ var nt = .9, rt = {
1118
1118
  return () => clearTimeout(r);
1119
1119
  }, [
1120
1120
  e,
1121
- De,
1122
- lt
1121
+ ke,
1122
+ ft
1123
1123
  ]);
1124
- let ut = o(() => {
1125
- let e = L.current;
1126
- e && (R.current = !0, n(e.textContent ?? ""));
1127
- }, [n]), dt = o((e) => {
1128
- e.preventDefault(), at(e.clipboardData.getData("text/plain")) || ut();
1129
- }, [ut]), ft = o((e) => {
1130
- e.key === "Enter" && (e.preventDefault(), !e.shiftKey && (t.trim().length > 0 || Pe.current.length > 0) ? r(t, Pe.current) : e.shiftKey && !at("\n") && ut());
1124
+ let pt = o(() => {
1125
+ let e = R.current;
1126
+ e && (ce.current = !0, n(e.textContent ?? ""));
1127
+ }, [n]), mt = o((e) => {
1128
+ e.preventDefault(), at(e.clipboardData.getData("text/plain")) || pt();
1129
+ }, [pt]), ht = o((e) => {
1130
+ if (e.key === "Enter") {
1131
+ if (e.preventDefault(), e.shiftKey) at("\n") || pt();
1132
+ else if (j) return;
1133
+ else (t.trim().length > 0 || Ie.current.length > 0) && r(t, Ie.current);
1134
+ }
1131
1135
  }, [
1132
1136
  t,
1133
1137
  r,
1134
- ut
1138
+ pt,
1139
+ j
1135
1140
  ]);
1136
1141
  return c(() => {
1137
- let e = L.current;
1142
+ let e = R.current;
1138
1143
  if (e) {
1139
- if (R.current) {
1140
- R.current = !1;
1144
+ if (ce.current) {
1145
+ ce.current = !1;
1141
1146
  return;
1142
1147
  }
1143
1148
  e.textContent !== t && (e.textContent = t, document.activeElement === e && $e(e));
@@ -1145,24 +1150,24 @@ var nt = .9, rt = {
1145
1150
  }, [t]), /* @__PURE__ */ _(x, {
1146
1151
  reducedMotion: "user",
1147
1152
  children: /* @__PURE__ */ _(b, {
1148
- id: te,
1153
+ id: ne,
1149
1154
  children: /* @__PURE__ */ v("div", {
1150
1155
  className: W.wrap,
1151
- onMouseEnter: () => ue(!0),
1152
- onMouseLeave: () => ue(!1),
1156
+ onMouseEnter: () => de(!0),
1157
+ onMouseLeave: () => de(!1),
1153
1158
  style: P,
1154
1159
  children: [
1155
1160
  /* @__PURE__ */ _(C.div, {
1156
1161
  className: `${W.root} ${K ? W.isGlassRoot : ""}`,
1157
1162
  layout: !0,
1158
- animate: { filter: xe ? `blur(${J?.addCards?.inputBlur ?? 2}px)` : "blur(0px)" },
1163
+ animate: { filter: Se ? `blur(${J?.addCards?.inputBlur ?? 2}px)` : "blur(0px)" },
1159
1164
  style: {
1160
- pointerEvents: xe ? "none" : "auto",
1165
+ pointerEvents: Se ? "none" : "auto",
1161
1166
  width: P?.width === "100%" ? "100%" : void 0,
1162
1167
  maxWidth: P?.maxWidth
1163
1168
  },
1164
1169
  transition: {
1165
- ...ct,
1170
+ ...dt,
1166
1171
  filter: {
1167
1172
  type: "tween",
1168
1173
  duration: .2,
@@ -1170,25 +1175,25 @@ var nt = .9, rt = {
1170
1175
  }
1171
1176
  },
1172
1177
  children: /* @__PURE__ */ v(C.div, {
1173
- className: `${W.surface} ${K ? W.glass : ""} ${Ye ? W.hovered : ""} ${de ? W.pulsed : ""}`,
1178
+ className: `${W.surface} ${K ? W.glass : ""} ${rt ? W.hovered : ""} ${z ? W.pulsed : ""}`,
1174
1179
  style: {
1175
1180
  alignItems: "stretch",
1176
1181
  flexDirection: "column",
1177
1182
  justifyContent: "center"
1178
1183
  },
1179
- transition: ct,
1180
- animate: De,
1181
- onClick: () => L.current?.focus(),
1184
+ transition: dt,
1185
+ animate: ke,
1186
+ onClick: () => R.current?.focus(),
1182
1187
  children: [
1183
1188
  /* @__PURE__ */ _("input", {
1184
1189
  type: "file",
1185
- ref: Ae,
1190
+ ref: Me,
1186
1191
  accept: h,
1187
1192
  multiple: T,
1188
1193
  style: { display: "none" },
1189
- onChange: Ve
1194
+ onChange: He
1190
1195
  }),
1191
- /* @__PURE__ */ _(y, { children: Ne.length > 0 && /* @__PURE__ */ _(C.div, {
1196
+ /* @__PURE__ */ _(y, { children: Pe.length > 0 && /* @__PURE__ */ _(C.div, {
1192
1197
  initial: {
1193
1198
  opacity: 0,
1194
1199
  height: 0
@@ -1215,8 +1220,8 @@ var nt = .9, rt = {
1215
1220
  className: W.attachedTray,
1216
1221
  "data-glass": K || void 0,
1217
1222
  children: /* @__PURE__ */ _(Fe, {
1218
- attachments: Ne,
1219
- onRemove: K ? void 0 : He
1223
+ attachments: Pe,
1224
+ onRemove: K ? void 0 : Ue
1220
1225
  })
1221
1226
  })
1222
1227
  }) }),
@@ -1225,15 +1230,15 @@ var nt = .9, rt = {
1225
1230
  display: "flex",
1226
1231
  flexDirection: "row",
1227
1232
  alignItems: "center",
1228
- flexWrap: z ? "wrap" : "nowrap",
1229
- justifyContent: z ? "flex-end" : "flex-start",
1233
+ flexWrap: me ? "wrap" : "nowrap",
1234
+ justifyContent: me ? "flex-end" : "flex-start",
1230
1235
  width: "100%",
1231
1236
  minWidth: 0,
1232
1237
  flex: 1
1233
1238
  },
1234
1239
  children: [
1235
1240
  /* @__PURE__ */ _("span", {
1236
- ref: ce,
1241
+ ref: le,
1237
1242
  "aria-hidden": "true",
1238
1243
  style: {
1239
1244
  position: "absolute",
@@ -1248,14 +1253,14 @@ var nt = .9, rt = {
1248
1253
  /* @__PURE__ */ _("div", {
1249
1254
  ref: oe,
1250
1255
  className: W.editorClip,
1251
- style: { flexBasis: z ? "100%" : void 0 },
1256
+ style: { flexBasis: me ? "100%" : void 0 },
1252
1257
  children: /* @__PURE__ */ _(C.div, {
1253
1258
  ref: ae,
1254
1259
  className: `${W.editorWrap} ${K ? W.editorWrapGlass : ""}`,
1255
1260
  layout: "position",
1256
- animate: K && ye ? { maxHeight: _e ? se.current : 240 } : void 0,
1261
+ animate: K && be ? { maxHeight: ve ? se.current : 240 } : void 0,
1257
1262
  transition: {
1258
- ...ct,
1263
+ ...dt,
1259
1264
  maxHeight: {
1260
1265
  type: "spring",
1261
1266
  stiffness: 300,
@@ -1264,24 +1269,24 @@ var nt = .9, rt = {
1264
1269
  }
1265
1270
  },
1266
1271
  children: /* @__PURE__ */ _("div", {
1267
- ref: L,
1272
+ ref: R,
1268
1273
  className: W.editor,
1269
- contentEditable: Ke ? "false" : "plaintext-only",
1274
+ contentEditable: q ? "false" : "plaintext-only",
1270
1275
  suppressContentEditableWarning: !0,
1271
- onInput: ut,
1272
- onKeyDown: ft,
1273
- onPaste: dt,
1276
+ onInput: pt,
1277
+ onKeyDown: ht,
1278
+ onPaste: mt,
1274
1279
  spellCheck: !1,
1275
1280
  role: "textbox",
1276
1281
  "aria-multiline": "true",
1277
- "aria-label": re,
1278
- "data-placeholder": Ke ? "" : re
1282
+ "aria-label": L,
1283
+ "data-placeholder": q ? "" : L
1279
1284
  })
1280
1285
  })
1281
1286
  }),
1282
1287
  /* @__PURE__ */ v("div", {
1283
1288
  className: W.buttonGroup,
1284
- children: [!K && he && ot && /* @__PURE__ */ _(C.div, {
1289
+ children: [!K && ge && lt && /* @__PURE__ */ _(C.div, {
1285
1290
  initial: {
1286
1291
  opacity: 0,
1287
1292
  scale: nt,
@@ -1299,7 +1304,7 @@ var nt = .9, rt = {
1299
1304
  scale: nt,
1300
1305
  width: 0,
1301
1306
  marginLeft: 0,
1302
- transition: Ee.current ? {
1307
+ transition: De.current ? {
1303
1308
  type: "tween",
1304
1309
  duration: J?.wrap?.exitDuration ?? .15,
1305
1310
  ease: "easeOut",
@@ -1328,7 +1333,7 @@ var nt = .9, rt = {
1328
1333
  variant: "ghost",
1329
1334
  "data-voice": G.state,
1330
1335
  icon: /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
1331
- ref: Ue,
1336
+ ref: We,
1332
1337
  className: W.voiceMeter,
1333
1338
  "data-live": G.state === "listening" || void 0,
1334
1339
  "aria-hidden": !0
@@ -1338,9 +1343,9 @@ var nt = .9, rt = {
1338
1343
  })] }),
1339
1344
  onClick: (e) => {
1340
1345
  if (e.stopPropagation(), G.state !== "denied") {
1341
- if (!rt) {
1342
- let e = Math.min(Ge.current ?? t.length, t.length);
1343
- We.current = {
1346
+ if (!ct) {
1347
+ let e = Math.min(Ke.current ?? t.length, t.length);
1348
+ Ge.current = {
1344
1349
  base: t,
1345
1350
  at: e
1346
1351
  };
@@ -1361,11 +1366,11 @@ var nt = .9, rt = {
1361
1366
  }, "mic"), /* @__PURE__ */ v(y, {
1362
1367
  initial: !1,
1363
1368
  onExitComplete: () => {
1364
- Ee.current && (Ee.current = !1, me(!0), H.current && clearTimeout(H.current), H.current = window.setTimeout(() => {
1365
- ge(!0), H.current = null;
1366
- }, ke.current?.wrap?.slideInDelay ?? 120));
1369
+ De.current && (De.current = !1, he(!0), Oe.current && clearTimeout(Oe.current), Oe.current = window.setTimeout(() => {
1370
+ _e(!0), Oe.current = null;
1371
+ }, je.current?.wrap?.slideInDelay ?? 120));
1367
1372
  },
1368
- children: [!K && he && (ie || A) && /* @__PURE__ */ _(C.div, {
1373
+ children: [!K && ge && (ie || A) && /* @__PURE__ */ _(C.div, {
1369
1374
  initial: {
1370
1375
  opacity: 0,
1371
1376
  scale: nt,
@@ -1380,7 +1385,7 @@ var nt = .9, rt = {
1380
1385
  opacity: 0,
1381
1386
  scale: nt,
1382
1387
  width: 0,
1383
- transition: Ee.current ? {
1388
+ transition: De.current ? {
1384
1389
  type: "tween",
1385
1390
  duration: J?.wrap?.exitDuration ?? .15,
1386
1391
  ease: "easeOut",
@@ -1448,7 +1453,7 @@ var nt = .9, rt = {
1448
1453
  height: "100%"
1449
1454
  }
1450
1455
  })
1451
- }, "cancel-btn") : ie && !xe ? /* @__PURE__ */ _(C.div, {
1456
+ }, "cancel-btn") : ie && !Se ? /* @__PURE__ */ _(C.div, {
1452
1457
  initial: {
1453
1458
  opacity: 0,
1454
1459
  scale: .5
@@ -1476,7 +1481,7 @@ var nt = .9, rt = {
1476
1481
  "aria-hidden": !0
1477
1482
  }),
1478
1483
  onClick: (e) => {
1479
- e.stopPropagation(), Se(!0);
1484
+ e.stopPropagation(), Ce(!0);
1480
1485
  },
1481
1486
  "aria-label": I.add,
1482
1487
  title: I.add,
@@ -1487,7 +1492,7 @@ var nt = .9, rt = {
1487
1492
  })
1488
1493
  }, "plus-btn") : null
1489
1494
  })
1490
- }, "lead"), st && he && /* @__PURE__ */ _(C.div, {
1495
+ }, "lead"), ut && ge && /* @__PURE__ */ _(C.div, {
1491
1496
  initial: {
1492
1497
  opacity: 0,
1493
1498
  scale: nt,
@@ -1505,7 +1510,7 @@ var nt = .9, rt = {
1505
1510
  scale: nt,
1506
1511
  width: 0,
1507
1512
  marginLeft: 0,
1508
- transition: Ee.current ? {
1513
+ transition: De.current ? {
1509
1514
  type: "tween",
1510
1515
  duration: J?.wrap?.exitDuration ?? .15,
1511
1516
  ease: "easeOut"
@@ -1517,8 +1522,8 @@ var nt = .9, rt = {
1517
1522
  type: "tween",
1518
1523
  duration: .15
1519
1524
  },
1520
- width: ct,
1521
- marginLeft: ct
1525
+ width: dt,
1526
+ marginLeft: dt
1522
1527
  }
1523
1528
  },
1524
1529
  transition: {
@@ -1541,11 +1546,12 @@ var nt = .9, rt = {
1541
1546
  },
1542
1547
  children: /* @__PURE__ */ _(V, {
1543
1548
  variant: "primary",
1544
- icon: /* @__PURE__ */ _(Le, { mode: Je ? "stop" : A ? "check" : "send" }),
1549
+ icon: /* @__PURE__ */ _(Le, { mode: Xe ? "stop" : A ? "check" : "send" }),
1545
1550
  onClick: (e) => {
1546
- e.stopPropagation(), Je ? i?.() : r(t, Ne);
1551
+ e.stopPropagation(), Xe ? i?.() : j || r(t, Pe);
1547
1552
  },
1548
- "aria-label": Je ? I.stop : A ? I.save : I.send,
1553
+ disabled: Ze,
1554
+ "aria-label": Xe ? I.stop : A ? I.save : I.send,
1549
1555
  style: {
1550
1556
  flexShrink: 0,
1551
1557
  width: 28
@@ -1560,31 +1566,31 @@ var nt = .9, rt = {
1560
1566
  })
1561
1567
  }),
1562
1568
  /* @__PURE__ */ _(Be, {
1563
- isAddOpen: xe,
1564
- setIsAddOpen: Se,
1565
- items: M || void 0,
1569
+ isAddOpen: Se,
1570
+ setIsAddOpen: Ce,
1571
+ items: ee || void 0,
1566
1572
  onAdd: (e, t) => {
1567
- let n = M ? M.find((e) => e.id === t) : void 0;
1568
- t === "attach" && !n?.onSelect && Ae.current?.click(), a?.();
1573
+ let n = ee ? ee.find((e) => e.id === t) : void 0;
1574
+ t === "attach" && !n?.onSelect && Me.current?.click(), a?.();
1569
1575
  },
1570
- showInlineGlyph: st,
1571
- showButtons: he,
1576
+ showInlineGlyph: ut,
1577
+ showButtons: ge,
1572
1578
  ac: J
1573
1579
  }),
1574
1580
  /* @__PURE__ */ _(Re, {
1575
- showActions: Xe,
1576
- showReadMore: Ze,
1577
- isExpanded: _e,
1578
- setIsExpanded: ve,
1581
+ showActions: ot,
1582
+ showReadMore: st,
1583
+ isExpanded: ve,
1584
+ setIsExpanded: ye,
1579
1585
  onCopy: D,
1580
1586
  onEdit: O,
1581
1587
  value: t,
1582
1588
  ac: J
1583
1589
  }),
1584
- ot && (G.state === "denied" || G.state === "failed") && /* @__PURE__ */ _("p", {
1590
+ lt && (G.state === "denied" || G.state === "failed") && /* @__PURE__ */ _("p", {
1585
1591
  className: W.voiceNote,
1586
1592
  "data-tone": G.state,
1587
- children: G.state === "denied" ? I.microphoneBlockedHelp : G.error ?? ne.couldNotOpen
1593
+ children: G.state === "denied" ? I.microphoneBlockedHelp : G.error ?? re.couldNotOpen
1588
1594
  })
1589
1595
  ]
1590
1596
  })
@@ -1604,8 +1610,8 @@ function st(e, t) {
1604
1610
  }
1605
1611
  //#endregion
1606
1612
  //#region src/useChatTurns/useChatTurns.ts
1607
- var J = 260, ct = 220, lt = "Generating response", ut = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2, 11), dt = () => ({
1608
- id: ut(),
1613
+ var ct = 260, lt = 220, ut = "Generating response", J = () => typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : Math.random().toString(36).slice(2, 11), dt = () => ({
1614
+ id: J(),
1609
1615
  user: "",
1610
1616
  ai: "",
1611
1617
  parts: [],
@@ -1633,13 +1639,13 @@ var J = 260, ct = 220, lt = "Generating response", ut = () => typeof crypto < "u
1633
1639
  }
1634
1640
  return i;
1635
1641
  };
1636
- function ht({ onSend: e, revealSpeed: t = J, sentencePause: n = ct, announcements: r }) {
1637
- let [i, a] = m(() => [dt()]), [s, l] = m(!1), u = p(null), d = p(null), f = p(/* @__PURE__ */ new Map()), h = p(/* @__PURE__ */ new Map()), g = p(null), _ = p(e), v = p(r), y = p(i);
1642
+ function ht({ onSend: e, revealSpeed: t = ct, sentencePause: n = lt, announcements: r, nextTurn: i = "after-answer" }) {
1643
+ let [a, s] = m(() => [dt()]), [l, u] = m(!1), d = p(null), f = p(null), h = p(/* @__PURE__ */ new Map()), g = p(/* @__PURE__ */ new Map()), _ = p(null), v = p(e), y = p(r), b = p(a);
1638
1644
  c(() => {
1639
- _.current = e, y.current = i, v.current = r;
1645
+ v.current = e, b.current = a, y.current = r;
1640
1646
  });
1641
- let b = o((e, t) => {
1642
- a((n) => {
1647
+ let x = o((e, t) => {
1648
+ s((n) => {
1643
1649
  let r = !1, i = n.map((n) => {
1644
1650
  if (n.id !== e) return n;
1645
1651
  r = !0;
@@ -1649,14 +1655,14 @@ function ht({ onSend: e, revealSpeed: t = J, sentencePause: n = ct, announcement
1649
1655
  };
1650
1656
  return "versionIndex" in t || "versions" in t ? i : ft(i);
1651
1657
  });
1652
- return r ? (y.current = i, i) : n;
1658
+ return r ? (b.current = i, i) : n;
1653
1659
  });
1654
- }, []), x = o(() => {
1655
- d.current = null;
1656
- let e = f.current, t = h.current;
1660
+ }, []), S = o(() => {
1661
+ f.current = null;
1662
+ let e = h.current, t = g.current;
1657
1663
  if (e.size === 0 && t.size === 0) return;
1658
1664
  let n = [...e], r = [...t];
1659
- e.clear(), t.clear(), a((e) => {
1665
+ e.clear(), t.clear(), s((e) => {
1660
1666
  let t = e.map((e) => {
1661
1667
  let t = n.find(([t]) => t === e.id)?.[1], i = r.find(([t]) => t === e.id)?.[1];
1662
1668
  return t === void 0 && !i ? e : ft({
@@ -1665,40 +1671,46 @@ function ht({ onSend: e, revealSpeed: t = J, sentencePause: n = ct, announcement
1665
1671
  ...i ? { parts: i.reduce(st, e.parts) } : null
1666
1672
  });
1667
1673
  });
1668
- return y.current = t, t;
1674
+ return b.current = t, t;
1669
1675
  });
1670
- }, []), S = o(() => {
1671
- d.current === null && (d.current = requestAnimationFrame(x));
1672
- }, [x]), C = o((e, t) => {
1673
- f.current.set(e, t), S();
1676
+ }, []), C = o(() => {
1677
+ f.current === null && (f.current = requestAnimationFrame(S));
1674
1678
  }, [S]), w = o((e, t) => {
1675
- let n = h.current.get(e);
1676
- n ? n.push(t) : h.current.set(e, [t]), S();
1677
- }, [S]), T = o((e, t) => {
1678
- w(e, t);
1679
- }, [w]);
1679
+ h.current.set(e, t), C();
1680
+ }, [C]), T = o((e, t) => {
1681
+ let n = g.current.get(e);
1682
+ n ? n.push(t) : g.current.set(e, [t]), C();
1683
+ }, [C]), E = o((e, t) => {
1684
+ let n = b.current.find((t) => t.id === e), r = n?.parts?.some((e) => e.id === t.id) || g.current.get(e)?.some((e) => e.id === t.id), i = h.current.get(e) ?? n?.ai ?? "";
1685
+ T(e, r || t.at !== void 0 ? t : {
1686
+ ...t,
1687
+ at: i.length
1688
+ });
1689
+ }, [T]);
1680
1690
  c(() => () => {
1681
- d.current !== null && cancelAnimationFrame(d.current), u.current?.abort();
1691
+ f.current !== null && cancelAnimationFrame(f.current), d.current?.abort();
1682
1692
  }, []);
1683
- let E = o((e, t) => {
1684
- l(!1), u.current = null, b(e, { state: "resting" }), t || a((e) => {
1685
- if (e.some((e) => e.state === "idle" && e.ai === "" && e.user === "")) return e;
1693
+ let D = o(() => {
1694
+ s((e) => {
1695
+ if (e.some((e) => (e.state === "idle" || e.state === "typing") && e.ai === "")) return e;
1686
1696
  let t = [...e, dt()];
1687
- return y.current = t, t;
1697
+ return b.current = t, t;
1688
1698
  });
1689
- }, [b]), D = o((e, r, i) => new Promise((a) => {
1699
+ }, []), O = o((e, t) => {
1700
+ u(!1), d.current = null, x(e, { state: "resting" }), t || D();
1701
+ }, [x, D]), k = o((e, r, i) => new Promise((a) => {
1690
1702
  if (q()) {
1691
- C(e, r), a();
1703
+ w(e, r), a();
1692
1704
  return;
1693
1705
  }
1694
1706
  let o = mt(r, t, n), s = performance.now(), c = 0, l = () => {
1695
1707
  if (i.aborted) {
1696
- C(e, r), a();
1708
+ w(e, r), a();
1697
1709
  return;
1698
1710
  }
1699
1711
  let t = performance.now() - s;
1700
1712
  for (; c < r.length && o[c] <= t;) c++;
1701
- if (C(e, r.slice(0, c)), c >= r.length) {
1713
+ if (w(e, r.slice(0, c)), c >= r.length) {
1702
1714
  a();
1703
1715
  return;
1704
1716
  }
@@ -1706,105 +1718,115 @@ function ht({ onSend: e, revealSpeed: t = J, sentencePause: n = ct, announcement
1706
1718
  };
1707
1719
  requestAnimationFrame(l);
1708
1720
  }), [
1709
- C,
1721
+ w,
1710
1722
  t,
1711
1723
  n
1712
- ]), O = o((e, t = "") => {
1713
- let n = v.current;
1724
+ ]), A = o((e, t = "") => {
1725
+ let n = y.current;
1714
1726
  if (n === !1) return;
1715
1727
  if (e === "responding") {
1716
- let e = n && "responding" in n ? n.responding : lt;
1717
- e && G(e);
1728
+ let e = n && "responding" in n ? n.responding : ut;
1729
+ e && Ke(e);
1718
1730
  return;
1719
1731
  }
1720
1732
  let r = n?.answer ? n.answer(t) : t;
1721
- r && G(r);
1722
- }, []), k = o(async (e, t, n, r = []) => {
1723
- let i = new AbortController();
1724
- u.current = i, l(!0);
1725
- let a = y.current.find((t) => t.id === e), o = [...a?.versions ?? [], {
1726
- id: `${e}-v${(a?.versions?.length ?? 0) + 1}`,
1733
+ r && Ke(r);
1734
+ }, []), j = o(async (e, t, n, r = []) => {
1735
+ let a = new AbortController();
1736
+ d.current = a, u(!0);
1737
+ let o = b.current.find((t) => t.id === e), s = [...o?.versions ?? [], {
1738
+ id: `${e}-v${(o?.versions?.length ?? 0) + 1}`,
1727
1739
  ai: "",
1728
1740
  parts: []
1729
1741
  }];
1730
- b(e, {
1742
+ x(e, {
1731
1743
  user: t,
1732
1744
  state: "responding",
1733
1745
  ai: "",
1734
1746
  parts: [],
1735
- versions: o,
1736
- versionIndex: o.length - 1
1737
- }), O("responding");
1738
- let s = "";
1747
+ versions: s,
1748
+ versionIndex: s.length - 1
1749
+ }), A("responding"), i === "at-send" && !n && D();
1750
+ let c = "", l = /* @__PURE__ */ new Set();
1739
1751
  try {
1740
- let n = _.current(t, {
1741
- signal: i.signal,
1752
+ let n = v.current(t, {
1753
+ signal: a.signal,
1742
1754
  turnId: e,
1743
1755
  attachments: r
1744
1756
  });
1745
1757
  if (pt(n)) for await (let t of n) {
1746
- if (i.signal.aborted) break;
1747
- typeof t == "string" ? (s += t, C(e, s)) : w(e, t);
1758
+ if (a.signal.aborted) break;
1759
+ if (typeof t == "string") c += t, w(e, c);
1760
+ else {
1761
+ let n = !l.has(t.id);
1762
+ l.add(t.id), T(e, n && t.at === void 0 ? {
1763
+ ...t,
1764
+ at: c.length
1765
+ } : t);
1766
+ }
1748
1767
  }
1749
- else s = await n ?? "", await D(e, s, i.signal);
1768
+ else c = await n ?? "", await k(e, c, a.signal);
1750
1769
  } catch (e) {
1751
- if (!i.signal.aborted) throw e;
1770
+ if (!a.signal.aborted) throw e;
1752
1771
  } finally {
1753
- x(), E(e, n), O("answer", s);
1772
+ S(), O(e, n), A("answer", c);
1754
1773
  }
1755
1774
  }, [
1775
+ S,
1776
+ i,
1777
+ D,
1756
1778
  x,
1757
- b,
1758
- C,
1759
1779
  w,
1760
- D,
1761
- E,
1762
- O
1780
+ T,
1781
+ k,
1782
+ O,
1783
+ A
1763
1784
  ]);
1764
1785
  return {
1765
- turns: i,
1786
+ turns: a,
1766
1787
  setDraft: o((e, t) => {
1767
- b(e, {
1788
+ x(e, {
1768
1789
  user: t,
1769
1790
  state: t.length > 0 ? "typing" : "idle"
1770
1791
  });
1771
- }, [b]),
1792
+ }, [x]),
1772
1793
  submit: o((e, t, n) => {
1773
- let r = y.current.find((t) => t.id === e);
1794
+ if (d.current) return;
1795
+ let r = b.current.find((t) => t.id === e);
1774
1796
  if (!r) return;
1775
1797
  let i = (t ?? r.user).trim(), a = n ?? r.attachments ?? [];
1776
1798
  if (!i && a.length === 0) return;
1777
- (a.length > 0 || r.attachments) && b(e, { attachments: a });
1799
+ (a.length > 0 || r.attachments) && x(e, { attachments: a });
1778
1800
  let o = r.ai.length > 0;
1779
- g.current = null, k(e, i, o, a);
1780
- }, [k, b]),
1801
+ _.current = null, j(e, i, o, a);
1802
+ }, [j, x]),
1781
1803
  showVersion: o((e, t) => {
1782
- let n = y.current.find((t) => t.id === e)?.versions?.[t];
1783
- n && b(e, {
1804
+ let n = b.current.find((t) => t.id === e)?.versions?.[t];
1805
+ n && x(e, {
1784
1806
  versionIndex: t,
1785
1807
  ai: n.ai,
1786
1808
  parts: n.parts
1787
1809
  });
1788
- }, [b]),
1810
+ }, [x]),
1789
1811
  stop: o(() => {
1790
- u.current?.abort();
1812
+ d.current?.abort();
1791
1813
  }, []),
1792
1814
  beginEdit: o((e) => {
1793
- let t = y.current.find((t) => t.id === e);
1794
- t && (g.current = {
1815
+ let t = b.current.find((t) => t.id === e);
1816
+ t && (_.current = {
1795
1817
  id: e,
1796
1818
  user: t.user
1797
- }), b(e, { state: "typing" });
1798
- }, [b]),
1819
+ }), x(e, { state: "typing" });
1820
+ }, [x]),
1799
1821
  cancelEdit: o((e) => {
1800
- let t = g.current;
1801
- g.current = null, b(e, {
1822
+ let t = _.current;
1823
+ _.current = null, x(e, {
1802
1824
  state: "resting",
1803
1825
  ...t && t.id === e ? { user: t.user } : {}
1804
1826
  });
1805
- }, [b]),
1806
- isStreaming: s,
1807
- updatePart: T
1827
+ }, [x]),
1828
+ isStreaming: l,
1829
+ updatePart: E
1808
1830
  };
1809
1831
  }
1810
1832
  var Y = {
@@ -1857,7 +1879,7 @@ var Y = {
1857
1879
  }
1858
1880
  return window;
1859
1881
  }, Ct = r(function({ title: e, subtitle: t, avatar: n, headingLevel: r = 2, truncate: i = !0, onBack: a, backHref: s, backLabel: l, actions: u = [], overflowLabel: d, variant: f = "plain", size: h = "m", align: g = "start", sticky: y = !1, elevateOnScroll: b = y, collapseActionsAt: x = 520, landmark: S = !0, children: C, className: w, ...T }, E) {
1860
- let D = U("header"), k = l ?? D.back, A = d ?? D.more, j = p(null), [M, ee] = m(!1), [N, P] = m(!1), F = o((e) => {
1882
+ let D = H("header"), k = l ?? D.back, A = d ?? D.more, j = p(null), [M, ee] = m(!1), [te, N] = m(!1), P = o((e) => {
1861
1883
  j.current = e, typeof E == "function" ? E(e) : E && (E.current = e);
1862
1884
  }, [E]);
1863
1885
  c(() => {
@@ -1872,13 +1894,13 @@ var Y = {
1872
1894
  if (!b) return;
1873
1895
  let e = St(j.current), t = () => {
1874
1896
  let t = e === window ? window.scrollY : e.scrollTop;
1875
- P(t > 0);
1897
+ N(t > 0);
1876
1898
  };
1877
1899
  return t(), e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
1878
1900
  }, [b]);
1879
- let te = x !== !1 && M, I = te ? u.filter((e) => e.pinned) : u, ne = te ? u.filter((e) => !e.pinned) : [], re = r ? `h${r}` : "span";
1901
+ let F = x !== !1 && M, ne = F ? u.filter((e) => e.pinned) : u, I = F ? u.filter((e) => !e.pinned) : [], re = r ? `h${r}` : "span";
1880
1902
  return /* @__PURE__ */ v(S ? "header" : "div", {
1881
- ref: F,
1903
+ ref: P,
1882
1904
  className: [
1883
1905
  Y.header,
1884
1906
  yt[h],
@@ -1887,7 +1909,7 @@ var Y = {
1887
1909
  y ? Y.sticky : "",
1888
1910
  w ?? ""
1889
1911
  ].filter(Boolean).join(" "),
1890
- "data-scrolled": b && N || void 0,
1912
+ "data-scrolled": b && te || void 0,
1891
1913
  ...T,
1892
1914
  children: [/* @__PURE__ */ v("div", {
1893
1915
  className: Y.start,
@@ -1930,12 +1952,12 @@ var Y = {
1930
1952
  className: Y.end,
1931
1953
  children: [
1932
1954
  C,
1933
- I.map((e) => /* @__PURE__ */ _(wt, {
1955
+ ne.map((e) => /* @__PURE__ */ _(wt, {
1934
1956
  action: e,
1935
1957
  size: h
1936
1958
  }, e.id)),
1937
- ne.length > 0 && /* @__PURE__ */ _(Tt, {
1938
- actions: ne,
1959
+ I.length > 0 && /* @__PURE__ */ _(Tt, {
1960
+ actions: I,
1939
1961
  size: h,
1940
1962
  label: A
1941
1963
  })
@@ -2056,12 +2078,12 @@ var Et = {
2056
2078
  reveal: "ick-reveal-z3mw"
2057
2079
  }, Dt = 1600;
2058
2080
  function Ot({ text: e, onCopy: t, onRegenerate: n, onFeedback: r, feedback: i = null, children: a, reveal: s = !1, busy: l = !1, labels: u, className: d, ...f }) {
2059
- let [h, y] = m(!1), b = p(null), x = U("answerActions", u);
2081
+ let [h, y] = m(!1), b = p(null), x = H("answerActions", u);
2060
2082
  c(() => () => {
2061
2083
  b.current && clearTimeout(b.current);
2062
2084
  }, []);
2063
2085
  let S = o(() => {
2064
- t ? t(e) : navigator.clipboard?.writeText(e), y(!0), G(x.copied), b.current && clearTimeout(b.current), b.current = setTimeout(() => y(!1), Dt);
2086
+ t ? t(e) : navigator.clipboard?.writeText(e), y(!0), Ke(x.copied), b.current && clearTimeout(b.current), b.current = setTimeout(() => y(!1), Dt);
2065
2087
  }, [
2066
2088
  x.copied,
2067
2089
  t,
@@ -2075,9 +2097,9 @@ function Ot({ text: e, onCopy: t, onRegenerate: n, onFeedback: r, feedback: i =
2075
2097
  ].filter(Boolean).join(" "),
2076
2098
  ...f,
2077
2099
  children: [
2078
- /* @__PURE__ */ _(V, {
2100
+ e.trim() && /* @__PURE__ */ _(V, {
2079
2101
  variant: "ghost",
2080
- icon: _(h ? j : P, {
2102
+ icon: _(h ? j : N, {
2081
2103
  size: 14,
2082
2104
  "aria-hidden": !0
2083
2105
  }),
@@ -2131,7 +2153,7 @@ var kt = {
2131
2153
  //#endregion
2132
2154
  //#region src/Branch/Branch.tsx
2133
2155
  function At({ total: e, index: t, onSelect: n, labels: r, className: i, ...a }) {
2134
- let o = U("branch", r);
2156
+ let o = H("branch", r);
2135
2157
  if (e < 2) return null;
2136
2158
  let s = Math.min(Math.max(t, 0), e - 1), c = o.position.replace("{index}", String(s + 1)).replace("{total}", String(e));
2137
2159
  return /* @__PURE__ */ v("div", {
@@ -2170,7 +2192,7 @@ function At({ total: e, index: t, onSelect: n, labels: r, className: i, ...a })
2170
2192
  onPointerDown: (e) => e.stopPropagation(),
2171
2193
  disabled: s === e - 1,
2172
2194
  "aria-label": o.next,
2173
- children: /* @__PURE__ */ _(N, {
2195
+ children: /* @__PURE__ */ _(te, {
2174
2196
  size: 14,
2175
2197
  "aria-hidden": !0
2176
2198
  })
@@ -2336,7 +2358,7 @@ var Bt = {
2336
2358
  //#endregion
2337
2359
  //#region src/Reasoning/Reasoning.tsx
2338
2360
  function Vt({ children: e, state: t = "done", duration: n, open: r, defaultOpen: i, onOpenChange: a, labels: o, className: s, ...c }) {
2339
- let u = U("reasoning", o), d = l(), f = t === "thinking", { isOpen: p, toggle: h } = Nt({
2361
+ let u = H("reasoning", o), d = l(), f = t === "thinking", { isOpen: p, toggle: h } = Nt({
2340
2362
  open: r,
2341
2363
  defaultOpen: i,
2342
2364
  onOpenChange: a,
@@ -2464,7 +2486,7 @@ var $t = {
2464
2486
  pre: "ick-pre-qaBX"
2465
2487
  }, en = 1600;
2466
2488
  function tn({ code: e, lang: t, label: n, copyable: r = !0, onCopy: i, copiedFor: a = en, labels: s, className: l, ...u }) {
2467
- let d = U("codeBlock", s), [h, g] = m(!1), y = p(null), [b, x] = m(Zt);
2489
+ let d = H("codeBlock", s), [h, g] = m(!1), y = p(null), [b, x] = m(Zt);
2468
2490
  c(() => {
2469
2491
  if (b || !qt(t)) return;
2470
2492
  let e = !0;
@@ -2483,7 +2505,7 @@ function tn({ code: e, lang: t, label: n, copyable: r = !0, onCopy: i, copiedFor
2483
2505
  y.current && clearTimeout(y.current);
2484
2506
  }, []);
2485
2507
  let C = o(() => {
2486
- i ? i(e) : navigator.clipboard?.writeText(e), g(!0), G(d.copiedAnnouncement), y.current && clearTimeout(y.current), y.current = setTimeout(() => g(!1), a);
2508
+ i ? i(e) : navigator.clipboard?.writeText(e), g(!0), Ke(d.copiedAnnouncement), y.current && clearTimeout(y.current), y.current = setTimeout(() => g(!1), a);
2487
2509
  }, [
2488
2510
  e,
2489
2511
  a,
@@ -2504,7 +2526,7 @@ function tn({ code: e, lang: t, label: n, copyable: r = !0, onCopy: i, copiedFor
2504
2526
  onClick: C,
2505
2527
  onPointerDown: (e) => e.stopPropagation(),
2506
2528
  "aria-label": h ? d.copied : d.copyCode,
2507
- children: [_(h ? j : P, {
2529
+ children: [_(h ? j : N, {
2508
2530
  size: 13,
2509
2531
  "aria-hidden": !0
2510
2532
  }), /* @__PURE__ */ _("span", {
@@ -2597,7 +2619,7 @@ function sn({ label: e, value: t, tone: n }) {
2597
2619
  });
2598
2620
  }
2599
2621
  function cn({ name: e, state: t = "done", summary: n, input: r, output: i, error: a, duration: o, open: s, defaultOpen: c, onOpenChange: u, labels: d, className: f, ...p }) {
2600
- let m = U("tool", d), h = l(), g = t === "error", { isOpen: y, toggle: b } = Nt({
2622
+ let m = H("tool", d), h = l(), g = t === "error", { isOpen: y, toggle: b } = Nt({
2601
2623
  open: s,
2602
2624
  defaultOpen: c,
2603
2625
  onOpenChange: u,
@@ -2673,7 +2695,7 @@ var ln = {
2673
2695
  denied: "wasDenied"
2674
2696
  };
2675
2697
  function fn({ title: e, description: t, children: n, decision: r = null, onDecide: i, readOnly: a = !1, choices: o = un, labels: s, className: c, ...u }) {
2676
- let d = U("approval", s), f = (e) => o.includes(e), p = l(), m = r !== null;
2698
+ let d = H("approval", s), f = (e) => o.includes(e), p = l(), m = r !== null;
2677
2699
  return /* @__PURE__ */ v("section", {
2678
2700
  className: [ln.approval, c ?? ""].filter(Boolean).join(" "),
2679
2701
  "data-decision": r ?? void 0,
@@ -2741,7 +2763,7 @@ var pn = {
2741
2763
  //#endregion
2742
2764
  //#region src/TaskList/TaskList.tsx
2743
2765
  function mn({ tasks: e, title: t, collapsible: n = !1, open: r, defaultOpen: i, onOpenChange: a, labels: o, className: s, ...c }) {
2744
- let u = U("tasks", o), d = l(), f = q(), p = e.filter((e) => (e.state ?? "pending") === "done").length, m = Nt({
2766
+ let u = H("tasks", o), d = l(), f = q(), p = e.filter((e) => (e.state ?? "pending") === "done").length, m = Nt({
2745
2767
  open: r,
2746
2768
  defaultOpen: i,
2747
2769
  onOpenChange: a,
@@ -2818,7 +2840,7 @@ var hn = {
2818
2840
  //#endregion
2819
2841
  //#region src/ChainOfThought/ChainOfThought.tsx
2820
2842
  function gn({ steps: e, state: t = "done", duration: n, open: r, defaultOpen: i, onOpenChange: a, labels: o, className: s, ...c }) {
2821
- let u = U("chain", o), d = l(), f = q(), p = t === "thinking", { isOpen: m, toggle: h } = Nt({
2843
+ let u = H("chain", o), d = l(), f = q(), p = t === "thinking", { isOpen: m, toggle: h } = Nt({
2822
2844
  open: r,
2823
2845
  defaultOpen: i,
2824
2846
  onOpenChange: a,
@@ -2898,7 +2920,7 @@ var _n = {
2898
2920
  //#endregion
2899
2921
  //#region src/Sources/Sources.tsx
2900
2922
  function vn({ sources: e, title: t, collapsible: n = !1, activeId: r = null, onSelect: i, open: a, defaultOpen: o, onOpenChange: s, labels: c, className: u, ...d }) {
2901
- let f = U("sources", c), p = l(), m = Nt({
2923
+ let f = H("sources", c), p = l(), m = Nt({
2902
2924
  open: a,
2903
2925
  defaultOpen: o,
2904
2926
  onOpenChange: s,
@@ -3264,7 +3286,7 @@ function Mn({ question: e, number: t, answer: n, onCommit: r, labels: i }) {
3264
3286
  });
3265
3287
  }
3266
3288
  function Nn({ question: e, number: t, state: n, answer: r, onCommit: i, onEdit: a, readOnly: o = !1, labels: s }) {
3267
- let c = U("question", s), l = n !== "upcoming", u = q(), d = p(null), f = En(d), m;
3289
+ let c = H("question", s), l = n !== "upcoming", u = q(), d = p(null), f = En(d), m;
3268
3290
  if (n === "active") m = /* @__PURE__ */ _(Mn, {
3269
3291
  question: e,
3270
3292
  number: t,
@@ -3284,7 +3306,7 @@ function Nn({ question: e, number: t, state: n, answer: r, onCommit: i, onEdit:
3284
3306
  })]
3285
3307
  }), /* @__PURE__ */ v("span", {
3286
3308
  className: X.collapsedAnswer,
3287
- children: [n.map((e, t) => /* @__PURE__ */ _(bn, { children: e }, `${e}-${t}`)), !o && /* @__PURE__ */ _(z, {
3309
+ children: [n.map((e, t) => /* @__PURE__ */ _(bn, { children: e }, `${e}-${t}`)), !o && /* @__PURE__ */ _(fe, {
3288
3310
  className: X.pencil,
3289
3311
  size: 14,
3290
3312
  "aria-hidden": !0
@@ -3357,7 +3379,7 @@ var Pn = {
3357
3379
  fadeInDelay: .08
3358
3380
  };
3359
3381
  function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null, collapsible: a = !1, onCommit: o, onEdit: s, readOnly: c = !1, labels: u, foldMotion: d, className: f }) {
3360
- let [h, g] = m(!1), [x, S] = m(!1), w = l(), T = p(null), E = En(T), D = U("questionGroup", u), O = q(), k = a && !h, A = n.map((e) => e.shortTitle).join(" · "), j = {
3382
+ let [h, g] = m(!1), [x, S] = m(!1), w = l(), T = p(null), E = En(T), D = H("questionGroup", u), O = q(), k = a && !h, A = n.map((e) => e.shortTitle).join(" · "), j = {
3361
3383
  ...In,
3362
3384
  ...d
3363
3385
  }, M = O ? { duration: 0 } : {
@@ -3367,7 +3389,7 @@ function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
3367
3389
  }, ee = {
3368
3390
  hidden: { transition: { staggerChildren: O ? 0 : j.stagger } },
3369
3391
  shown: { transition: { staggerChildren: O ? 0 : j.stagger } }
3370
- }, N = (e, t = 0) => O ? { duration: 0 } : {
3392
+ }, te = (e, t = 0) => O ? { duration: 0 } : {
3371
3393
  type: "spring",
3372
3394
  visualDuration: j.rowDuration,
3373
3395
  bounce: j.rowBounce,
@@ -3376,18 +3398,18 @@ function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
3376
3398
  duration: e,
3377
3399
  delay: t
3378
3400
  }
3379
- }, P = {
3401
+ }, N = {
3380
3402
  hidden: {
3381
3403
  opacity: 0,
3382
3404
  y: O ? 0 : j.rowOffset,
3383
- transition: N(j.fadeOut)
3405
+ transition: te(j.fadeOut)
3384
3406
  },
3385
3407
  shown: {
3386
3408
  opacity: 1,
3387
3409
  y: 0,
3388
- transition: N(j.fadeIn, O ? 0 : j.fadeInDelay)
3410
+ transition: te(j.fadeIn, O ? 0 : j.fadeInDelay)
3389
3411
  }
3390
- }, F = {
3412
+ }, P = {
3391
3413
  variants: ee,
3392
3414
  initial: "hidden",
3393
3415
  animate: "shown",
@@ -3425,9 +3447,9 @@ function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
3425
3447
  initial: !1,
3426
3448
  mode: "popLayout",
3427
3449
  children: k ? /* @__PURE__ */ _(C.div, {
3428
- ...F,
3450
+ ...P,
3429
3451
  children: /* @__PURE__ */ v(C.div, {
3430
- variants: P,
3452
+ variants: N,
3431
3453
  className: Pn.summary,
3432
3454
  children: [/* @__PURE__ */ v("span", {
3433
3455
  className: Pn.count,
@@ -3443,9 +3465,9 @@ function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
3443
3465
  })
3444
3466
  }, "summary") : /* @__PURE__ */ _(C.div, {
3445
3467
  className: Pn.list,
3446
- ...F,
3468
+ ...P,
3447
3469
  children: n.map((e, t) => /* @__PURE__ */ _(C.div, {
3448
- variants: P,
3470
+ variants: N,
3449
3471
  className: Pn.row,
3450
3472
  children: /* @__PURE__ */ _(Nn, {
3451
3473
  question: e,
@@ -3993,7 +4015,7 @@ var yr = {
3993
4015
  //#endregion
3994
4016
  //#region src/InlineCitation/InlineCitation.tsx
3995
4017
  function br({ index: e, source: t, children: n, onSelect: r, labels: i, className: a, ...o }) {
3996
- let { cite: s } = U("citation", i), c = t ? `${s} ${e}: ${t.title}` : `${s} ${e}`, l = r ? /* @__PURE__ */ _("button", {
4018
+ let { cite: s } = H("citation", i), c = t ? `${s} ${e}: ${t.title}` : `${s} ${e}`, l = r ? /* @__PURE__ */ _("button", {
3997
4019
  type: "button",
3998
4020
  className: yr.marker,
3999
4021
  onClick: () => r(e, t),
@@ -4069,50 +4091,50 @@ var xr = {
4069
4091
  t += `M ${r} ${n} L ${i} ${n} `;
4070
4092
  }), t.trim();
4071
4093
  };
4072
- function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onReplyInThread: a, sources: s, onSelectSource: u }) {
4073
- let d = U("highlighter"), h = p(null), [g, b] = m([]), [S, w] = m([]), [T, E] = m(null), [D, O] = m(!1), [k, A] = m(null), [j, M] = m(0), ee = p(null), N = p(null), [P, F] = m(null), [te, I] = m(null), ne = o((e) => {
4074
- e.viaKeyboard && (N.current = document.activeElement), M(0), A(e);
4075
- }, []), re = o((e = "none") => {
4094
+ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlightComplete: a, onReplyInThread: s, sources: u, onSelectSource: d }) {
4095
+ let h = H("highlighter"), g = p(null), [b, S] = m([]), [w, T] = m([]), [E, D] = m(null), [O, k] = m(!1), [A, j] = m(null), [M, ee] = m(0), te = p(null), N = p(null), [P, F] = m(null), [ne, I] = m(null), re = o((e) => {
4096
+ e.viaKeyboard && (N.current = document.activeElement), ee(0), j(e);
4097
+ }, []), L = o((e = "none") => {
4076
4098
  let t = N.current;
4077
- N.current = null, A(null), e !== "none" && (e === "restore" && t?.isConnected ? t.focus() : h.current?.focus());
4099
+ N.current = null, j(null), e !== "none" && (e === "restore" && t?.isConnected ? t.focus() : g.current?.focus());
4078
4100
  }, []);
4079
4101
  c(() => {
4080
4102
  let e = (e) => {
4081
- k && h.current && !h.current.contains(e.target) && re();
4103
+ A && g.current && !g.current.contains(e.target) && L();
4082
4104
  };
4083
4105
  return window.addEventListener("pointerdown", e), () => window.removeEventListener("pointerdown", e);
4084
- }, [k, re]);
4085
- let ie = f(() => vr(t), [t]), L = ie.tokens, ae = p(S), se = p(i), R = p(k);
4106
+ }, [A, L]);
4107
+ let ie = f(() => vr(t), [t]), R = ie.tokens, oe = p(w), se = p(a), ce = p(A);
4086
4108
  c(() => {
4087
- ae.current = S, se.current = i, R.current = k;
4109
+ oe.current = w, se.current = a, ce.current = A;
4088
4110
  });
4089
- let ce = f(() => [...g.map((e) => ({
4111
+ let le = f(() => [...b.map((e) => ({
4090
4112
  id: e.id,
4091
4113
  d: wr(e.points),
4092
4114
  kind: "path",
4093
4115
  item: e,
4094
- text: Dr(e.highlightedIndices, L)
4095
- })), ...S.map((e) => ({
4116
+ text: Dr(e.highlightedIndices, R)
4117
+ })), ...w.map((e) => ({
4096
4118
  id: e.id,
4097
4119
  d: kr(e.rects),
4098
4120
  kind: "selection",
4099
4121
  item: e,
4100
4122
  text: e.text
4101
4123
  }))], [
4102
- g,
4103
- S,
4104
- L
4105
- ]), le = (e, t = !1) => {
4124
+ b,
4125
+ w,
4126
+ R
4127
+ ]), ue = (e, t = !1) => {
4106
4128
  let n = e.kind === "path" ? Tr(e.item.points) : Er(e.item.rects);
4107
- ne({
4129
+ re({
4108
4130
  x: n.x,
4109
4131
  y: n.y,
4110
4132
  pathId: e.id,
4111
4133
  kind: e.kind,
4112
4134
  viaKeyboard: t
4113
4135
  });
4114
- }, ue = o((e, t, n = !1) => {
4115
- let r = h.current, i = t.trim();
4136
+ }, de = o((e, t, n = !1) => {
4137
+ let r = g.current, i = t.trim();
4116
4138
  if (!r || !i) return;
4117
4139
  let a = /* @__PURE__ */ new Set();
4118
4140
  r.querySelectorAll("span[data-index]").forEach((t) => {
@@ -4139,30 +4161,30 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4139
4161
  h: i
4140
4162
  };
4141
4163
  }), u = Date.now().toString();
4142
- w((e) => [...e, {
4164
+ T((e) => [...e, {
4143
4165
  id: u,
4144
4166
  rects: l,
4145
4167
  text: i,
4146
4168
  highlightedIndices: a
4147
4169
  }]);
4148
4170
  let d = Er(l);
4149
- ne({
4171
+ re({
4150
4172
  x: d.x,
4151
4173
  y: d.y,
4152
4174
  pathId: u,
4153
4175
  kind: "selection",
4154
4176
  viaKeyboard: n
4155
4177
  });
4156
- }, [ne]);
4178
+ }, [re]);
4157
4179
  c(() => {
4158
4180
  let e = (e) => {
4159
- if (R.current) return;
4160
- let t = h.current;
4181
+ if (ce.current) return;
4182
+ let t = g.current;
4161
4183
  if (!t) return;
4162
4184
  let n = window.getSelection();
4163
4185
  if (!n || n.isCollapsed || n.rangeCount === 0 || !n.toString().trim()) return;
4164
4186
  let r = n.getRangeAt(0);
4165
- t.contains(r.commonAncestorContainer) && (ue(r, n.toString(), e), requestAnimationFrame(() => window.getSelection()?.removeAllRanges()));
4187
+ t.contains(r.commonAncestorContainer) && (de(r, n.toString(), e), requestAnimationFrame(() => window.getSelection()?.removeAllRanges()));
4166
4188
  }, t = () => e(!1), n = (t) => {
4167
4189
  let n = (t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "a";
4168
4190
  !t.shiftKey && !n || e(!0);
@@ -4170,82 +4192,82 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4170
4192
  return document.addEventListener("mouseup", t), document.addEventListener("keyup", n), () => {
4171
4193
  document.removeEventListener("mouseup", t), document.removeEventListener("keyup", n);
4172
4194
  };
4173
- }, [ue]);
4174
- let [de, fe] = m(r);
4175
- de !== r && (fe(r), A(null));
4176
- let z = f(() => L.map((e, t) => e.trim() ? t : -1).filter((e) => e >= 0), [L]), [pe, me] = m(null), [he, ge] = m(null), _e = l(), ve = f(() => pe === null || he === null ? null : {
4177
- from: Math.min(he, pe),
4178
- to: Math.max(he, pe)
4179
- }, [pe, he]), ye = () => {
4180
- me(null), ge(null);
4181
- }, be = () => {
4182
- let e = h.current;
4183
- if (!e || !ve) return;
4184
- let t = e.querySelector(`span[data-index="${ve.from}"]`), n = e.querySelector(`span[data-index="${ve.to}"]`);
4195
+ }, [de]);
4196
+ let [z, fe] = m(i);
4197
+ z !== i && (fe(i), j(null));
4198
+ let pe = f(() => R.map((e, t) => e.trim() ? t : -1).filter((e) => e >= 0), [R]), [me, he] = m(null), [ge, _e] = m(null), ve = l(), ye = f(() => me === null || ge === null ? null : {
4199
+ from: Math.min(ge, me),
4200
+ to: Math.max(ge, me)
4201
+ }, [me, ge]), be = () => {
4202
+ he(null), _e(null);
4203
+ }, xe = () => {
4204
+ let e = g.current;
4205
+ if (!e || !ye) return;
4206
+ let t = e.querySelector(`span[data-index="${ye.from}"]`), n = e.querySelector(`span[data-index="${ye.to}"]`);
4185
4207
  if (!t || !n) return;
4186
4208
  let r = document.createRange();
4187
4209
  r.setStartBefore(t), r.setEndAfter(n);
4188
4210
  let i = "";
4189
- for (let e = ve.from; e <= ve.to; e++) i += L[e];
4190
- ue(r, i, !0), ye();
4191
- }, xe = () => [...ee.current?.querySelectorAll("[role=\"menuitem\"]") ?? []];
4211
+ for (let e = ye.from; e <= ye.to; e++) i += R[e];
4212
+ de(r, i, !0), be();
4213
+ }, Ce = () => [...te.current?.querySelectorAll("[role=\"menuitem\"]") ?? []];
4192
4214
  c(() => {
4193
- if (!k) return;
4194
- let e = xe();
4215
+ if (!A) return;
4216
+ let e = Ce();
4195
4217
  if (e.length === 0) return;
4196
- let t = ee.current?.contains(document.activeElement);
4197
- (k.viaKeyboard || t) && e[Math.min(j, e.length - 1)]?.focus();
4198
- }, [k, j]);
4199
- let Ce = (e) => {
4200
- let t = xe().length;
4218
+ let t = te.current?.contains(document.activeElement);
4219
+ (A.viaKeyboard || t) && e[Math.min(M, e.length - 1)]?.focus();
4220
+ }, [A, M]);
4221
+ let we = (e) => {
4222
+ let t = Ce().length;
4201
4223
  if (t === 0) return;
4202
4224
  let n = (n) => {
4203
- e.preventDefault(), e.stopPropagation(), M((e) => (e + n + t) % t);
4225
+ e.preventDefault(), e.stopPropagation(), ee((e) => (e + n + t) % t);
4204
4226
  };
4205
4227
  switch (e.key) {
4206
4228
  case "ArrowRight":
4207
4229
  case "ArrowDown": return n(1);
4208
4230
  case "ArrowLeft":
4209
4231
  case "ArrowUp": return n(-1);
4210
- case "Home": return e.preventDefault(), M(0);
4211
- case "End": return e.preventDefault(), M(t - 1);
4232
+ case "Home": return e.preventDefault(), ee(0);
4233
+ case "End": return e.preventDefault(), ee(t - 1);
4212
4234
  default: return;
4213
4235
  }
4214
- }, we = (e) => {
4215
- if (e.target !== e.currentTarget && e.key !== "Escape" || z.length === 0) return;
4236
+ }, B = (e) => {
4237
+ if (e.target !== e.currentTarget && e.key !== "Escape" || pe.length === 0) return;
4216
4238
  let t = (t, n) => {
4217
4239
  e.preventDefault();
4218
- let r = pe === null ? -1 : z.indexOf(pe), i = r === -1 ? z[t === 1 ? 0 : z.length - 1] : z[Math.min(z.length - 1, Math.max(0, r + t))];
4219
- me(i), (!n || he === null) && ge(i);
4240
+ let r = me === null ? -1 : pe.indexOf(me), i = r === -1 ? pe[t === 1 ? 0 : pe.length - 1] : pe[Math.min(pe.length - 1, Math.max(0, r + t))];
4241
+ he(i), (!n || ge === null) && _e(i);
4220
4242
  }, n = (t) => {
4221
- e.preventDefault(), me(t), (!e.shiftKey || he === null) && ge(t);
4243
+ e.preventDefault(), he(t), (!e.shiftKey || ge === null) && _e(t);
4222
4244
  };
4223
4245
  switch (e.key) {
4224
4246
  case "ArrowRight": return t(1, e.shiftKey);
4225
4247
  case "ArrowLeft": return t(-1, e.shiftKey);
4226
- case "Home": return n(z[0]);
4227
- case "End": return n(z[z.length - 1]);
4248
+ case "Home": return n(pe[0]);
4249
+ case "End": return n(pe[pe.length - 1]);
4228
4250
  case "Enter":
4229
- case " ": return ve ? (e.preventDefault(), be()) : void 0;
4230
- case "Escape": return !k && pe === null ? void 0 : (e.preventDefault(), re("restore"), ye());
4251
+ case " ": return ye ? (e.preventDefault(), xe()) : void 0;
4252
+ case "Escape": return !A && me === null ? void 0 : (e.preventDefault(), L("restore"), be());
4231
4253
  default: return;
4232
4254
  }
4233
- }, B = (e, t, n) => {
4255
+ }, Te = (e, t, n) => {
4234
4256
  let r = document.elementFromPoint(e, t);
4235
4257
  if (r && r.hasAttribute("data-index")) {
4236
4258
  let e = parseInt(r.getAttribute("data-index"), 10);
4237
4259
  n.add(e);
4238
4260
  }
4239
- }, Te = (e) => {
4240
- if (k) {
4241
- re();
4261
+ }, Ee = (e) => {
4262
+ if (A) {
4263
+ L();
4242
4264
  return;
4243
4265
  }
4244
- if (r === "precise" || e.button !== 0 && e.pointerType === "mouse") return;
4245
- e.preventDefault(), O(!0);
4266
+ if (i === "precise" || e.button !== 0 && e.pointerType === "mouse") return;
4267
+ e.preventDefault(), k(!0);
4246
4268
  let t = e.currentTarget;
4247
4269
  t.setPointerCapture(e.pointerId);
4248
- let n = t.getBoundingClientRect(), i = e.clientX - n.left, a = e.clientY - n.top, o = i - a * Cr, s = {
4270
+ let n = t.getBoundingClientRect(), r = e.clientX - n.left, a = e.clientY - n.top, o = r - a * Cr, s = {
4249
4271
  id: Date.now().toString(),
4250
4272
  points: [{
4251
4273
  x: o,
@@ -4253,78 +4275,80 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4253
4275
  }],
4254
4276
  highlightedIndices: /* @__PURE__ */ new Set()
4255
4277
  };
4256
- E(s), re(), B(e.clientX, e.clientY, s.highlightedIndices);
4257
- }, Ee = (e) => {
4258
- if (r === "precise" || !T) return;
4259
- let t = h.current.getBoundingClientRect(), n = e.clientX - t.left, i = e.clientY - t.top, a = n - i * Cr;
4260
- E((t) => {
4278
+ D(s), L(), Te(e.clientX, e.clientY, s.highlightedIndices);
4279
+ }, De = (e) => {
4280
+ if (i === "precise" || !E) return;
4281
+ let t = g.current.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, a = n - r * Cr;
4282
+ D((t) => {
4261
4283
  if (!t) return t;
4262
4284
  let n = new Set(t.highlightedIndices);
4263
- return B(e.clientX, e.clientY, n), {
4285
+ return Te(e.clientX, e.clientY, n), {
4264
4286
  ...t,
4265
4287
  points: [...t.points, {
4266
4288
  x: a,
4267
- y: i
4289
+ y: r
4268
4290
  }],
4269
4291
  highlightedIndices: n
4270
4292
  };
4271
4293
  });
4272
- }, H = (e) => {
4273
- if (r !== "precise" && (O(!1), T)) {
4274
- if (e.currentTarget.releasePointerCapture(e.pointerId), b((e) => [...e, T]), T.highlightedIndices.size > 0) {
4275
- let e = Tr(T.points);
4276
- ne({
4294
+ }, Oe = (e) => {
4295
+ if (i !== "precise" && (k(!1), E)) {
4296
+ if (e.currentTarget.releasePointerCapture(e.pointerId), S((e) => [...e, E]), E.highlightedIndices.size > 0) {
4297
+ let e = Tr(E.points);
4298
+ re({
4277
4299
  x: e.x,
4278
4300
  y: e.y,
4279
- pathId: T.id,
4301
+ pathId: E.id,
4280
4302
  kind: "path"
4281
4303
  });
4282
4304
  }
4283
- i && T.highlightedIndices.size > 0 && i(Dr(T.highlightedIndices, L)), E(null);
4305
+ a && E.highlightedIndices.size > 0 && a(Dr(E.highlightedIndices, R)), D(null);
4284
4306
  }
4285
- }, De = (e) => {
4286
- r !== "precise" && (O(!1), T && (e.currentTarget.releasePointerCapture(e.pointerId), E(null)));
4287
- }, Oe = (e) => {
4288
- let t = g.find((t) => t.id === e);
4289
- return t ? Dr(t.highlightedIndices, L) : "";
4290
4307
  }, ke = (e) => {
4291
- let t = k?.viaKeyboard;
4292
- k?.kind === "selection" ? w((t) => t.filter((t) => t.id !== e)) : b((t) => t.filter((t) => t.id !== e)), re(t ? "container" : "none");
4293
- }, je = () => {
4294
- let e = k?.viaKeyboard;
4295
- if (k && a) {
4296
- if (k.kind === "selection") {
4297
- let e = S.find((e) => e.id === k.pathId), t = h.current;
4308
+ i !== "precise" && (k(!1), E && (e.currentTarget.releasePointerCapture(e.pointerId), D(null)));
4309
+ }, Ae = (e) => {
4310
+ let t = b.find((t) => t.id === e);
4311
+ return t ? Dr(t.highlightedIndices, R) : "";
4312
+ }, Me = (e) => {
4313
+ let t = A?.viaKeyboard;
4314
+ A?.kind === "selection" ? T((t) => t.filter((t) => t.id !== e)) : S((t) => t.filter((t) => t.id !== e)), L(t ? "container" : "none");
4315
+ }, U = () => {
4316
+ let e = A?.viaKeyboard;
4317
+ if (A && s) {
4318
+ if (A.kind === "selection") {
4319
+ let e = w.find((e) => e.id === A.pathId), t = g.current;
4298
4320
  if (e && t) {
4299
- let n = t.getBoundingClientRect(), r = Infinity, i = Infinity, o = -Infinity, s = -Infinity;
4321
+ let n = t.getBoundingClientRect(), r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
4300
4322
  e.rects.forEach((e) => {
4301
- r = Math.min(r, e.x), i = Math.min(i, e.y), o = Math.max(o, e.x + e.w), s = Math.max(s, e.y + e.h);
4323
+ r = Math.min(r, e.x), i = Math.min(i, e.y), a = Math.max(a, e.x + e.w), o = Math.max(o, e.y + e.h);
4302
4324
  });
4303
- let c = new DOMRect(n.left + r, n.top + i, o - r, s - i);
4304
- a(e.text, c);
4325
+ let c = new DOMRect(n.left + r, n.top + i, a - r, o - i);
4326
+ s(e.text, c);
4305
4327
  }
4306
4328
  } else {
4307
- let e = Oe(k.pathId), t = document.getElementById(`highlight-path-${k.pathId}`);
4308
- t && a(e, t.getBoundingClientRect());
4329
+ let e = Ae(A.pathId), t = document.getElementById(`highlight-path-${A.pathId}`);
4330
+ t && s(e, t.getBoundingClientRect());
4309
4331
  }
4310
4332
  }
4311
- re(e ? "restore" : "none");
4312
- }, Me = (e) => {
4313
- let t = L[e], n = !1;
4314
- k && (n = (k.kind === "path" ? g.find((e) => e.id === k.pathId) : S.find((e) => e.id === k.pathId))?.highlightedIndices?.has(e) ?? !1);
4315
- let r = !1;
4316
- return P && (r = (g.find((e) => e.id === P) ?? S.find((e) => e.id === P))?.highlightedIndices?.has(e) ?? !1), /* @__PURE__ */ _("span", {
4333
+ L(e ? "restore" : "none");
4334
+ }, Ne = (e) => {
4335
+ let t = R[e];
4336
+ if (!r) return t;
4337
+ let n = !1;
4338
+ A && (n = (A.kind === "path" ? b.find((e) => e.id === A.pathId) : w.find((e) => e.id === A.pathId))?.highlightedIndices?.has(e) ?? !1);
4339
+ let i = !1;
4340
+ return P && (i = (b.find((e) => e.id === P) ?? w.find((e) => e.id === P))?.highlightedIndices?.has(e) ?? !1), /* @__PURE__ */ _("span", {
4317
4341
  "data-index": e,
4318
4342
  className: xr.token,
4319
4343
  "data-space": !t.trim() || void 0,
4320
4344
  "data-active": n || void 0,
4321
- "data-pressed": r || void 0,
4322
- "data-kbd-cursor": pe === e || void 0,
4323
- "data-kbd-selected": ve && e >= ve.from && e <= ve.to || void 0,
4345
+ "data-pressed": i || void 0,
4346
+ "data-kbd-cursor": me === e || void 0,
4347
+ "data-kbd-selected": ye && e >= ye.from && e <= ye.to || void 0,
4324
4348
  children: t
4325
4349
  }, e);
4326
- }, Ne = (e) => e.map((e, t) => {
4327
- if (e.type === "token") return Me(e.index);
4350
+ }, Pe = (e) => e.map((e, t) => {
4351
+ if (e.type === "token") return Ne(e.index);
4328
4352
  if (e.type === "code") return /* @__PURE__ */ _(tn, {
4329
4353
  code: e.value,
4330
4354
  lang: e.lang
@@ -4333,21 +4357,21 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4333
4357
  let n = Number(e.props?.index ?? 0);
4334
4358
  return /* @__PURE__ */ _(br, {
4335
4359
  index: n,
4336
- source: s?.[n - 1],
4337
- onSelect: u ? (e, t) => u(e, t) : void 0
4360
+ source: u?.[n - 1],
4361
+ onSelect: d ? (e, t) => d(e, t) : void 0
4338
4362
  }, `q${t}`);
4339
4363
  }
4340
4364
  return n(e.tag, {
4341
4365
  key: `e${t}`,
4342
4366
  ...e.props
4343
- }, e.children.length > 0 ? Ne(e.children) : void 0);
4367
+ }, e.children.length > 0 ? Pe(e.children) : void 0);
4344
4368
  });
4345
4369
  return /* @__PURE__ */ _(x, {
4346
4370
  reducedMotion: "user",
4347
4371
  children: /* @__PURE__ */ v(C.div, {
4348
- ref: h,
4349
- "data-cursor": r === "precise" ? "text" : "marker",
4350
- "data-cursor-active": D ? "true" : "false",
4372
+ ref: g,
4373
+ "data-cursor": r ? i === "precise" ? "text" : "marker" : void 0,
4374
+ "data-cursor-active": r ? O ? "true" : "false" : void 0,
4351
4375
  animate: {
4352
4376
  scale: 1,
4353
4377
  y: 0
@@ -4357,48 +4381,50 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4357
4381
  stiffness: 400,
4358
4382
  damping: 30
4359
4383
  },
4360
- "data-drawing": D || void 0,
4361
- "data-menu": !!k || void 0,
4362
- onPointerDown: Te,
4363
- onPointerMove: Ee,
4364
- onPointerUp: H,
4365
- onPointerCancel: De,
4384
+ "data-drawing": O || void 0,
4385
+ "data-menu": !!A || void 0,
4366
4386
  className: xr.surface,
4367
- tabIndex: 0,
4368
- onKeyDown: we,
4369
- onBlur: ye,
4370
- "aria-describedby": _e,
4387
+ ...r ? {
4388
+ onPointerDown: Ee,
4389
+ onPointerMove: De,
4390
+ onPointerUp: Oe,
4391
+ onPointerCancel: ke,
4392
+ tabIndex: 0,
4393
+ onKeyDown: B,
4394
+ onBlur: be,
4395
+ "aria-describedby": ve
4396
+ } : null,
4371
4397
  children: [
4372
- /* @__PURE__ */ _("span", {
4373
- id: _e,
4398
+ r && /* @__PURE__ */ _("span", {
4399
+ id: ve,
4374
4400
  className: xr.srOnly,
4375
4401
  "aria-hidden": "true",
4376
- children: d.keyboardHint
4402
+ children: h.keyboardHint
4377
4403
  }),
4378
- /* @__PURE__ */ _("div", { className: xr.hitbox }),
4404
+ r && /* @__PURE__ */ _("div", { className: xr.hitbox }),
4379
4405
  /* @__PURE__ */ _("div", {
4380
4406
  className: xr.tokens,
4381
- "data-focus": !!k || void 0,
4382
- children: Ne(ie.nodes)
4407
+ "data-focus": !!A || void 0,
4408
+ children: Pe(ie.nodes)
4383
4409
  }),
4384
- /* @__PURE__ */ _("svg", {
4410
+ r && /* @__PURE__ */ _("svg", {
4385
4411
  className: xr.canvas,
4386
4412
  children: /* @__PURE__ */ v("g", {
4387
4413
  transform: `skewX(${Sr})`,
4388
- children: [ce.map((t) => /* @__PURE__ */ v(e.Fragment, { children: [/* @__PURE__ */ _("path", {
4414
+ children: [le.map((t) => /* @__PURE__ */ v(e.Fragment, { children: [/* @__PURE__ */ _("path", {
4389
4415
  id: `highlight-${t.kind}-${t.id}`,
4390
4416
  className: xr.marker,
4391
4417
  d: t.d,
4392
4418
  "data-cursor": "pointer",
4393
4419
  "data-pressed": P === t.id || void 0,
4394
- "data-active": k?.pathId === t.id || te === t.id || void 0,
4395
- "data-dimmed": k && k.pathId !== t.id || void 0,
4396
- style: { pointerEvents: D ? "none" : "stroke" },
4420
+ "data-active": A?.pathId === t.id || ne === t.id || void 0,
4421
+ "data-dimmed": A && A.pathId !== t.id || void 0,
4422
+ style: { pointerEvents: O ? "none" : "stroke" },
4397
4423
  onPointerDown: (e) => {
4398
- D || (e.stopPropagation(), F(t.id));
4424
+ O || (e.stopPropagation(), F(t.id));
4399
4425
  },
4400
4426
  onPointerUp: (e) => {
4401
- P === t.id && (e.stopPropagation(), le(t), F(null));
4427
+ P === t.id && (e.stopPropagation(), ue(t), F(null));
4402
4428
  },
4403
4429
  onPointerLeave: () => F(null),
4404
4430
  onPointerCancel: () => F(null)
@@ -4406,35 +4432,35 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4406
4432
  className: xr.shimmer,
4407
4433
  d: t.d,
4408
4434
  pathLength: 1,
4409
- "data-active": k?.pathId === t.id || te === t.id || void 0
4410
- })] }, t.id)), T && /* @__PURE__ */ _("path", {
4435
+ "data-active": A?.pathId === t.id || ne === t.id || void 0
4436
+ })] }, t.id)), E && /* @__PURE__ */ _("path", {
4411
4437
  className: xr.marker,
4412
- d: wr(T.points)
4438
+ d: wr(E.points)
4413
4439
  })]
4414
4440
  })
4415
4441
  }),
4416
- ce.length > 0 && /* @__PURE__ */ _("div", {
4442
+ r && le.length > 0 && /* @__PURE__ */ _("div", {
4417
4443
  role: "group",
4418
- "aria-label": Ae(ce.length === 1 ? d.countOne : d.countMany, { count: ce.length }),
4419
- children: ce.map((e) => /* @__PURE__ */ _("button", {
4444
+ "aria-label": je(le.length === 1 ? h.countOne : h.countMany, { count: le.length }),
4445
+ children: le.map((e) => /* @__PURE__ */ _("button", {
4420
4446
  type: "button",
4421
4447
  className: xr.srOnly,
4422
4448
  onPointerDown: (e) => e.stopPropagation(),
4423
4449
  onFocus: () => I(e.id),
4424
4450
  onBlur: () => I(null),
4425
4451
  onClick: (t) => {
4426
- t.stopPropagation(), le(e, !0);
4452
+ t.stopPropagation(), ue(e, !0);
4427
4453
  },
4428
- children: `${d.highlight} ${Or(e.text)}`
4454
+ children: `${h.highlight} ${Or(e.text)}`
4429
4455
  }, e.id))
4430
4456
  }),
4431
- /* @__PURE__ */ _(y, { children: k && /* @__PURE__ */ v(C.div, {
4432
- ref: ee,
4457
+ /* @__PURE__ */ _(y, { children: r && A && /* @__PURE__ */ v(C.div, {
4458
+ ref: te,
4433
4459
  role: "menu",
4434
- "aria-label": d.menu,
4435
- onKeyDown: Ce,
4460
+ "aria-label": h.menu,
4461
+ onKeyDown: we,
4436
4462
  onBlur: (e) => {
4437
- e.currentTarget.contains(e.relatedTarget) || re();
4463
+ e.currentTarget.contains(e.relatedTarget) || L();
4438
4464
  },
4439
4465
  initial: { opacity: 0 },
4440
4466
  animate: {
@@ -4450,8 +4476,8 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4450
4476
  },
4451
4477
  className: xr.menu,
4452
4478
  style: {
4453
- left: k.x,
4454
- top: k.y
4479
+ left: A.x,
4480
+ top: A.y
4455
4481
  },
4456
4482
  onPointerDown: (e) => e.stopPropagation(),
4457
4483
  children: [/* @__PURE__ */ _(C.div, {
@@ -4478,13 +4504,13 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4478
4504
  children: /* @__PURE__ */ _(V, {
4479
4505
  variant: "primary",
4480
4506
  role: "menuitem",
4481
- tabIndex: j === 0 ? 0 : -1,
4482
- icon: /* @__PURE__ */ _(oe, { size: 14 }),
4507
+ tabIndex: M === 0 ? 0 : -1,
4508
+ icon: /* @__PURE__ */ _(ae, { size: 14 }),
4483
4509
  onClick: (e) => {
4484
- e.stopPropagation(), je();
4510
+ e.stopPropagation(), U();
4485
4511
  },
4486
- title: d.reply,
4487
- children: d.reply
4512
+ title: h.reply,
4513
+ children: h.reply
4488
4514
  })
4489
4515
  }), /* @__PURE__ */ _(C.div, {
4490
4516
  initial: {
@@ -4510,13 +4536,13 @@ function Ar({ text: t, selectionMode: r = "marker", onHighlightComplete: i, onRe
4510
4536
  children: /* @__PURE__ */ _(V, {
4511
4537
  variant: "primary",
4512
4538
  role: "menuitem",
4513
- tabIndex: j === 1 ? 0 : -1,
4539
+ tabIndex: M === 1 ? 0 : -1,
4514
4540
  icon: /* @__PURE__ */ _(Se, { size: 14 }),
4515
4541
  onClick: (e) => {
4516
- e.stopPropagation(), ke(k.pathId);
4542
+ e.stopPropagation(), Me(A.pathId);
4517
4543
  },
4518
- title: d.remove,
4519
- "aria-label": d.remove
4544
+ title: h.remove,
4545
+ "aria-label": h.remove
4520
4546
  })
4521
4547
  })]
4522
4548
  }) })
@@ -4533,15 +4559,131 @@ var jr = {
4533
4559
  actions: "ick-actions-CWq8"
4534
4560
  }, Mr = (e) => {
4535
4561
  navigator.clipboard?.writeText(e);
4536
- }, Nr = a(function({ turn: e, isActiveInput: t = !1, inputRef: n = null, placeholder: r, animationConfig: i, foldMotion: a, openArtifactId: o = null, onOpenArtifact: s, onArtifactChange: c, entranceDelay: l = 0, selectionMode: u = "marker", questionAlign: d = "end", onDraft: f, onSubmit: p, onStop: m, onEdit: h, onCancelEdit: g, onCopy: y = Mr, onHighlight: b, onReplyInThread: x, onRegenerate: S, onShowVersion: w, onFeedback: T, feedback: E = null, answerActions: D = !0, onAnswerQuestion: O, onEditQuestion: k, onDecideApproval: A, renderPart: j, composerMenu: M, labels: ee, className: N, onTranscribe: P }) {
4537
- let F = q(), te = F ? 0 : -16, I = e.parts ?? [], ne = I.find((e) => e.kind === "sources")?.sources, re = /* @__PURE__ */ v(C.article, {
4562
+ }, Nr = (e, t) => {
4563
+ let n = t.map((t, n) => ({
4564
+ part: t,
4565
+ order: n,
4566
+ at: Math.min(Math.max(t.at ?? 0, 0), e.length)
4567
+ })).sort((e, t) => e.at - t.at || e.order - t.order), r = [], i = 0, a = (t) => {
4568
+ let n = e.slice(i, t);
4569
+ n.trim() && r.push({
4570
+ kind: "prose",
4571
+ text: n,
4572
+ from: i
4573
+ }), i = t;
4574
+ };
4575
+ for (let { part: e, at: t } of n) t > i && a(t), r.push({
4576
+ kind: "part",
4577
+ part: e
4578
+ });
4579
+ return i < e.length && a(e.length), r;
4580
+ }, Pr = a(function({ turn: e, isActiveInput: t = !1, inputRef: n = null, placeholder: r, animationConfig: i, foldMotion: a, openArtifactId: o = null, onOpenArtifact: s, onArtifactChange: c, entranceDelay: l = 0, selectionMode: u = "marker", highlights: d = !0, questionAlign: f = "end", onDraft: p, onSubmit: m, onStop: h, busy: g, onEdit: y, onCancelEdit: b, onCopy: x = Mr, onHighlight: S, onReplyInThread: w, onRegenerate: T, onShowVersion: E, onFeedback: D, feedback: O = null, answerActions: k = !0, onAnswerQuestion: A, onEditQuestion: j, onDecideApproval: M, renderPart: ee, composerMenu: te, labels: N, className: P, onTranscribe: F }) {
4581
+ let ne = q(), I = ne ? 0 : -16, re = e.parts ?? [], L = re.find((e) => e.kind === "sources")?.sources, ie = Nr(e.ai, re), R = k && e.state === "resting" && ie.length > 0, ae = R ? ie[ie.length - 1].kind === "prose" ? ie.length - 1 : ie.length : -1, oe = R ? /* @__PURE__ */ v("div", {
4582
+ className: jr.actions,
4583
+ children: [/* @__PURE__ */ _(At, {
4584
+ total: e.versions?.length ?? 0,
4585
+ index: e.versionIndex ?? 0,
4586
+ onSelect: (t) => E?.(e.id, t)
4587
+ }), /* @__PURE__ */ _(Ot, {
4588
+ text: e.ai,
4589
+ onCopy: x,
4590
+ onRegenerate: T ? () => T(e.id) : void 0,
4591
+ onFeedback: D ? (t) => D(e.id, t) : void 0,
4592
+ feedback: O
4593
+ })]
4594
+ }) : null, se = (t) => {
4595
+ switch (t.kind) {
4596
+ case "reasoning": return /* @__PURE__ */ _(Vt, {
4597
+ state: t.state,
4598
+ duration: t.duration,
4599
+ children: t.text ?? ""
4600
+ }, t.id);
4601
+ case "tool": return /* @__PURE__ */ _(cn, {
4602
+ name: t.name ?? "",
4603
+ state: t.state,
4604
+ summary: t.summary,
4605
+ input: t.input,
4606
+ output: t.output,
4607
+ error: t.error,
4608
+ duration: t.duration
4609
+ }, t.id);
4610
+ case "tasks": return /* @__PURE__ */ _(mn, {
4611
+ title: t.title,
4612
+ tasks: t.tasks ?? [],
4613
+ collapsible: t.collapsible
4614
+ }, t.id);
4615
+ case "chain": return /* @__PURE__ */ _(gn, {
4616
+ steps: t.steps ?? [],
4617
+ state: t.state,
4618
+ duration: t.duration
4619
+ }, t.id);
4620
+ case "sources": return /* @__PURE__ */ _(vn, {
4621
+ sources: t.sources ?? [],
4622
+ title: t.title,
4623
+ collapsible: t.collapsible
4624
+ }, t.id);
4625
+ case "approval": return /* @__PURE__ */ _(fn, {
4626
+ title: t.title,
4627
+ description: t.description,
4628
+ decision: t.decision ?? null,
4629
+ choices: t.choices,
4630
+ onDecide: (n) => M?.(e.id, t.id, n),
4631
+ children: t.tool && /* @__PURE__ */ _(cn, {
4632
+ name: t.tool.name,
4633
+ state: "pending",
4634
+ input: t.tool.input,
4635
+ defaultOpen: !0
4636
+ })
4637
+ }, t.id);
4638
+ case "artifact": return /* @__PURE__ */ _(Un, {
4639
+ id: t.id,
4640
+ title: t.title,
4641
+ meta: t.meta,
4642
+ kind: t.preview,
4643
+ lang: t.lang,
4644
+ content: t.content,
4645
+ state: t.state,
4646
+ open: o === t.id,
4647
+ onOpen: s ? (t) => s(e.id, t) : void 0
4648
+ }, t.id);
4649
+ case "notice": return /* @__PURE__ */ _(zn, {
4650
+ tone: t.tone,
4651
+ children: t.text
4652
+ }, t.id);
4653
+ case "question": return /* @__PURE__ */ _(Ln, {
4654
+ id: t.id,
4655
+ title: t.title,
4656
+ questions: t.questions ?? [],
4657
+ answers: t.answers ?? {},
4658
+ activeIndex: t.activeIndex,
4659
+ collapsible: t.collapsible,
4660
+ readOnly: t.readOnly,
4661
+ foldMotion: a,
4662
+ onCommit: (n, r) => A?.(e.id, t.id, n, r),
4663
+ onEdit: (n) => j?.(e.id, t.id, n)
4664
+ }, t.id);
4665
+ case "custom": {
4666
+ let n = ee?.(t, {
4667
+ turnId: e.id,
4668
+ openArtifact: (t) => c ? c(t) : s?.(e.id, t),
4669
+ closeArtifact: () => c?.(null)
4670
+ });
4671
+ return n == null || n === !1 ? null : /* @__PURE__ */ _("div", {
4672
+ className: jr.custom,
4673
+ "data-part": "custom",
4674
+ "data-part-type": t.type,
4675
+ children: n
4676
+ }, t.id);
4677
+ }
4678
+ }
4679
+ }, ce = /* @__PURE__ */ v(C.article, {
4538
4680
  id: `turn-${e.id}`,
4539
- className: [jr.turn, N ?? ""].filter(Boolean).join(" "),
4681
+ className: [jr.turn, P ?? ""].filter(Boolean).join(" "),
4540
4682
  "data-active-input": t || void 0,
4541
4683
  "aria-busy": e.state === "responding" || void 0,
4542
4684
  initial: {
4543
4685
  opacity: 0,
4544
- y: te
4686
+ y: I
4545
4687
  },
4546
4688
  animate: {
4547
4689
  opacity: 1,
@@ -4549,10 +4691,10 @@ var jr = {
4549
4691
  },
4550
4692
  exit: {
4551
4693
  opacity: 0,
4552
- y: te
4694
+ y: I
4553
4695
  },
4554
4696
  transition: {
4555
- duration: F ? .15 : .4,
4697
+ duration: ne ? .15 : .4,
4556
4698
  ease: [
4557
4699
  .22,
4558
4700
  1,
@@ -4563,148 +4705,56 @@ var jr = {
4563
4705
  },
4564
4706
  children: [/* @__PURE__ */ _("div", {
4565
4707
  className: jr.question,
4566
- "data-align": d,
4708
+ "data-align": f,
4567
4709
  children: /* @__PURE__ */ _(ot, {
4568
4710
  ref: n,
4569
- style: d === "stretch" ? { width: "100%" } : void 0,
4711
+ style: f === "stretch" ? { width: "100%" } : void 0,
4570
4712
  state: e.state,
4571
4713
  value: e.user,
4572
- onChange: (t) => f?.(e.id, t),
4573
- onSubmit: (t, n) => p?.(e.id, t, n),
4714
+ onChange: (t) => p?.(e.id, t),
4715
+ onSubmit: (t, n) => m?.(e.id, t, n),
4574
4716
  attachments: e.attachments,
4575
- onStop: m,
4576
- onTranscribe: P,
4577
- onCopy: y,
4578
- onEdit: () => h?.(e.id),
4579
- onCancelEdit: () => g?.(e.id),
4717
+ onStop: h,
4718
+ busy: g,
4719
+ onTranscribe: F,
4720
+ onCopy: x,
4721
+ onEdit: () => y?.(e.id),
4722
+ onCancelEdit: () => b?.(e.id),
4580
4723
  isEditing: e.ai.length > 0 && e.state === "typing",
4581
4724
  animationConfig: i,
4582
4725
  placeholder: r,
4583
- menu: M
4726
+ menu: te
4584
4727
  })
4585
4728
  }), /* @__PURE__ */ v("div", {
4586
4729
  className: jr.body,
4587
4730
  children: [
4588
- I.map((t) => {
4589
- switch (t.kind) {
4590
- case "reasoning": return /* @__PURE__ */ _(Vt, {
4591
- state: t.state,
4592
- duration: t.duration,
4593
- children: t.text ?? ""
4594
- }, t.id);
4595
- case "tool": return /* @__PURE__ */ _(cn, {
4596
- name: t.name ?? "",
4597
- state: t.state,
4598
- summary: t.summary,
4599
- input: t.input,
4600
- output: t.output,
4601
- error: t.error,
4602
- duration: t.duration
4603
- }, t.id);
4604
- case "tasks": return /* @__PURE__ */ _(mn, {
4605
- title: t.title,
4606
- tasks: t.tasks ?? [],
4607
- collapsible: t.collapsible
4608
- }, t.id);
4609
- case "chain": return /* @__PURE__ */ _(gn, {
4610
- steps: t.steps ?? [],
4611
- state: t.state,
4612
- duration: t.duration
4613
- }, t.id);
4614
- case "sources": return /* @__PURE__ */ _(vn, {
4615
- sources: t.sources ?? [],
4616
- title: t.title,
4617
- collapsible: t.collapsible
4618
- }, t.id);
4619
- case "approval": return /* @__PURE__ */ _(fn, {
4620
- title: t.title,
4621
- description: t.description,
4622
- decision: t.decision ?? null,
4623
- choices: t.choices,
4624
- onDecide: (n) => A?.(e.id, t.id, n),
4625
- children: t.tool && /* @__PURE__ */ _(cn, {
4626
- name: t.tool.name,
4627
- state: "pending",
4628
- input: t.tool.input,
4629
- defaultOpen: !0
4630
- })
4631
- }, t.id);
4632
- case "artifact": return /* @__PURE__ */ _(Un, {
4633
- id: t.id,
4634
- title: t.title,
4635
- meta: t.meta,
4636
- kind: t.preview,
4637
- lang: t.lang,
4638
- content: t.content,
4639
- state: t.state,
4640
- open: o === t.id,
4641
- onOpen: s ? (t) => s(e.id, t) : void 0
4642
- }, t.id);
4643
- case "notice": return /* @__PURE__ */ _(zn, {
4644
- tone: t.tone,
4645
- children: t.text
4646
- }, t.id);
4647
- case "question": return /* @__PURE__ */ _(Ln, {
4648
- id: t.id,
4649
- title: t.title,
4650
- questions: t.questions ?? [],
4651
- answers: t.answers ?? {},
4652
- activeIndex: t.activeIndex,
4653
- collapsible: t.collapsible,
4654
- readOnly: t.readOnly,
4655
- foldMotion: a,
4656
- onCommit: (n, r) => O?.(e.id, t.id, n, r),
4657
- onEdit: (n) => k?.(e.id, t.id, n)
4658
- }, t.id);
4659
- case "custom": {
4660
- let n = j?.(t, {
4661
- turnId: e.id,
4662
- openArtifact: (t) => c ? c(t) : s?.(e.id, t),
4663
- closeArtifact: () => c?.(null)
4664
- });
4665
- return n == null || n === !1 ? null : /* @__PURE__ */ _("div", {
4666
- className: jr.custom,
4667
- "data-part": "custom",
4668
- "data-part-type": t.type,
4669
- children: n
4670
- }, t.id);
4671
- }
4672
- }
4673
- }),
4674
- e.state === "responding" && !e.ai && I.length === 0 && /* @__PURE__ */ _("div", {
4731
+ ie.map((t, n) => t.kind === "part" ? se(t.part) : /* @__PURE__ */ v("div", {
4732
+ className: jr.answer,
4733
+ children: [/* @__PURE__ */ _(Ar, {
4734
+ text: t.text,
4735
+ marking: d,
4736
+ selectionMode: u,
4737
+ sources: L,
4738
+ onHighlightComplete: d ? (t) => S?.(e.id, t) : void 0,
4739
+ onReplyInThread: d ? w : void 0
4740
+ }), ae === n && oe]
4741
+ }, `prose-${t.from}`)),
4742
+ e.state === "responding" && !e.ai && re.length === 0 && /* @__PURE__ */ _("div", {
4675
4743
  className: jr.answer,
4676
4744
  children: /* @__PURE__ */ _(Mt, {})
4677
4745
  }),
4678
- e.ai && /* @__PURE__ */ v("div", {
4746
+ ae === ie.length && /* @__PURE__ */ _("div", {
4679
4747
  className: jr.answer,
4680
- children: [/* @__PURE__ */ _(Ar, {
4681
- text: e.ai,
4682
- selectionMode: u,
4683
- sources: ne,
4684
- onHighlightComplete: (t) => b?.(e.id, t),
4685
- onReplyInThread: x
4686
- }), D && e.state === "resting" && /* @__PURE__ */ v("div", {
4687
- className: jr.actions,
4688
- children: [/* @__PURE__ */ _(At, {
4689
- total: e.versions?.length ?? 0,
4690
- index: e.versionIndex ?? 0,
4691
- onSelect: (t) => w?.(e.id, t)
4692
- }), /* @__PURE__ */ _(Ot, {
4693
- text: e.ai,
4694
- onCopy: y,
4695
- onRegenerate: S ? () => S(e.id) : void 0,
4696
- onFeedback: T ? (t) => T(e.id, t) : void 0,
4697
- feedback: E
4698
- })]
4699
- })]
4748
+ "data-actions-only": "",
4749
+ children: oe
4700
4750
  })
4701
4751
  ]
4702
4752
  })]
4703
4753
  });
4704
- return ee ? /* @__PURE__ */ _(ke, {
4705
- labels: ee,
4706
- children: re
4707
- }) : re;
4754
+ return N ? /* @__PURE__ */ _(Ae, {
4755
+ labels: N,
4756
+ children: ce
4757
+ }) : ce;
4708
4758
  }, (e, t) => {
4709
4759
  let n = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
4710
4760
  for (let r of n) {
@@ -4716,7 +4766,7 @@ var jr = {
4716
4766
  if (!Object.is(e[r], t[r])) return !1;
4717
4767
  }
4718
4768
  return !0;
4719
- }), Pr = {
4769
+ }), Fr = {
4720
4770
  context: "ick-context-ZOiv",
4721
4771
  ring: "ick-ring-uVUc",
4722
4772
  track: "ick-track---kg",
@@ -4725,7 +4775,7 @@ var jr = {
4725
4775
  };
4726
4776
  //#endregion
4727
4777
  //#region src/Context/Context.tsx
4728
- function Fr(e) {
4778
+ function Ir(e) {
4729
4779
  if (!Number.isFinite(e) || e < 0) return "";
4730
4780
  if (e >= 1e6) {
4731
4781
  let t = e / 1e6;
@@ -4737,11 +4787,11 @@ function Fr(e) {
4737
4787
  }
4738
4788
  return String(Math.round(e));
4739
4789
  }
4740
- var Ir = 6, Lr = 2 * Math.PI * Ir;
4741
- function Rr({ used: e, total: t, warnAt: n = .8, label: r, labels: i, className: a, ...o }) {
4742
- let s = U("context", i), c = t > 0 ? Math.min(1, Math.max(0, e / t)) : 0, l = Math.round(c * 100), u = c >= n, d = r === !1 ? null : r ?? `${l}%`, f = `${s.name}: ${l}%, ${Fr(e)} ${s.of} ${Fr(t)} ${s.tokens}${u ? `. ${s.nearlyFull}` : ""}`;
4790
+ var Lr = 6, Rr = 2 * Math.PI * Lr;
4791
+ function zr({ used: e, total: t, warnAt: n = .8, label: r, labels: i, className: a, ...o }) {
4792
+ let s = H("context", i), c = t > 0 ? Math.min(1, Math.max(0, e / t)) : 0, l = Math.round(c * 100), u = c >= n, d = r === !1 ? null : r ?? `${l}%`, f = `${s.name}: ${l}%, ${Ir(e)} ${s.of} ${Ir(t)} ${s.tokens}${u ? `. ${s.nearlyFull}` : ""}`;
4743
4793
  return /* @__PURE__ */ v("div", {
4744
- className: [Pr.context, a ?? ""].filter(Boolean).join(" "),
4794
+ className: [Fr.context, a ?? ""].filter(Boolean).join(" "),
4745
4795
  "data-warn": u || void 0,
4746
4796
  role: "meter",
4747
4797
  "aria-valuenow": l,
@@ -4751,31 +4801,31 @@ function Rr({ used: e, total: t, warnAt: n = .8, label: r, labels: i, className:
4751
4801
  title: f,
4752
4802
  ...o,
4753
4803
  children: [/* @__PURE__ */ v("svg", {
4754
- className: Pr.ring,
4804
+ className: Fr.ring,
4755
4805
  viewBox: "0 0 16 16",
4756
4806
  "aria-hidden": !0,
4757
4807
  focusable: "false",
4758
4808
  children: [/* @__PURE__ */ _("circle", {
4759
- className: Pr.track,
4809
+ className: Fr.track,
4760
4810
  cx: "8",
4761
4811
  cy: "8",
4762
- r: Ir
4812
+ r: Lr
4763
4813
  }), /* @__PURE__ */ _("circle", {
4764
- className: Pr.fill,
4814
+ className: Fr.fill,
4765
4815
  cx: "8",
4766
4816
  cy: "8",
4767
- r: Ir,
4768
- strokeDasharray: Lr,
4769
- strokeDashoffset: Lr * (1 - c),
4817
+ r: Lr,
4818
+ strokeDasharray: Rr,
4819
+ strokeDashoffset: Rr * (1 - c),
4770
4820
  transform: "rotate(-90 8 8)"
4771
4821
  })]
4772
4822
  }), d !== null && /* @__PURE__ */ _("span", {
4773
- className: Pr.label,
4823
+ className: Fr.label,
4774
4824
  children: d
4775
4825
  })]
4776
4826
  });
4777
4827
  }
4778
- var zr = {
4828
+ var Br = {
4779
4829
  pane: "ick-pane-Yv8Y",
4780
4830
  grabber: "ick-grabber-OhMd",
4781
4831
  head: "ick-head-p2-j",
@@ -4789,8 +4839,8 @@ var zr = {
4789
4839
  };
4790
4840
  //#endregion
4791
4841
  //#region src/Artifact/ArtifactPane.tsx
4792
- function Br({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expanded: a = !1, onToggleExpanded: o, closeLabel: s, expandLabel: u, collapseLabel: d, className: f, ...m }) {
4793
- let h = U("pane"), g = s ?? h.close, y = u ?? h.expand, b = d ?? h.collapse, x = l(), S = p(null), C = p(null);
4842
+ function Vr({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expanded: a = !1, onToggleExpanded: o, closeLabel: s, expandLabel: u, collapseLabel: d, className: f, ...m }) {
4843
+ let h = H("pane"), g = s ?? h.close, y = u ?? h.expand, b = d ?? h.collapse, x = l(), S = p(null), C = p(null);
4794
4844
  return c(() => {
4795
4845
  C.current?.focus({ preventScroll: !0 });
4796
4846
  }, []), c(() => {
@@ -4808,36 +4858,36 @@ function Br({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expande
4808
4858
  return document.addEventListener("focusin", e), () => document.removeEventListener("focusin", e);
4809
4859
  }, [i]), /* @__PURE__ */ v("div", {
4810
4860
  ref: S,
4811
- className: [zr.pane, f ?? ""].filter(Boolean).join(" "),
4861
+ className: [Br.pane, f ?? ""].filter(Boolean).join(" "),
4812
4862
  "aria-labelledby": x,
4813
4863
  "aria-modal": i || void 0,
4814
4864
  role: i ? "dialog" : "complementary",
4815
4865
  ...m,
4816
4866
  children: [
4817
4867
  i && /* @__PURE__ */ _("span", {
4818
- className: zr.grabber,
4868
+ className: Br.grabber,
4819
4869
  "aria-hidden": !0
4820
4870
  }),
4821
4871
  /* @__PURE__ */ v("div", {
4822
- className: zr.head,
4872
+ className: Br.head,
4823
4873
  children: [
4824
4874
  /* @__PURE__ */ v("div", {
4825
- className: zr.headText,
4875
+ className: Br.headText,
4826
4876
  children: [/* @__PURE__ */ _("h2", {
4827
- className: zr.title,
4877
+ className: Br.title,
4828
4878
  id: x,
4829
4879
  ref: C,
4830
4880
  tabIndex: -1,
4831
4881
  children: e
4832
4882
  }), t && /* @__PURE__ */ _("p", {
4833
- className: zr.meta,
4883
+ className: Br.meta,
4834
4884
  children: t
4835
4885
  })]
4836
4886
  }),
4837
4887
  o && !i && /* @__PURE__ */ _(V, {
4838
4888
  variant: "ghost",
4839
4889
  size: "s",
4840
- icon: _(a ? R : ae, {
4890
+ icon: _(a ? se : R, {
4841
4891
  size: 15,
4842
4892
  "aria-hidden": !0
4843
4893
  }),
@@ -4858,15 +4908,15 @@ function Br({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expande
4858
4908
  ]
4859
4909
  }),
4860
4910
  /* @__PURE__ */ _("div", {
4861
- className: zr.body,
4862
- children: n ?? /* @__PURE__ */ _(Vr, {})
4911
+ className: Br.body,
4912
+ children: n ?? /* @__PURE__ */ _(Hr, {})
4863
4913
  })
4864
4914
  ]
4865
4915
  });
4866
4916
  }
4867
- function Vr() {
4917
+ function Hr() {
4868
4918
  return /* @__PURE__ */ _("div", {
4869
- className: zr.skeleton,
4919
+ className: Br.skeleton,
4870
4920
  "aria-hidden": !0,
4871
4921
  children: [
4872
4922
  68,
@@ -4877,18 +4927,18 @@ function Vr() {
4877
4927
  100,
4878
4928
  84
4879
4929
  ].map((e, t) => /* @__PURE__ */ _("span", {
4880
- className: zr.line,
4930
+ className: Br.line,
4881
4931
  style: { width: `${e}%` }
4882
4932
  }, t))
4883
4933
  });
4884
4934
  }
4885
- var Hr = {
4935
+ var Ur = {
4886
4936
  layout: "ick-layout-nC6G",
4887
4937
  chat: "ick-chat-OTXm",
4888
4938
  card: "ick-card-Iddg",
4889
4939
  slot: "ick-slot-O--R",
4890
4940
  scrim: "ick-scrim-11Pp"
4891
- }, Ur = 760, Wr = {
4941
+ }, Wr = 760, Gr = {
4892
4942
  closed: {
4893
4943
  width: 0,
4894
4944
  transition: {
@@ -4906,7 +4956,7 @@ var Hr = {
4906
4956
  bounce: 0
4907
4957
  }
4908
4958
  }
4909
- }, Gr = {
4959
+ }, Kr = {
4910
4960
  closed: {
4911
4961
  opacity: 0,
4912
4962
  x: 24,
@@ -4925,7 +4975,7 @@ var Hr = {
4925
4975
  delay: .06
4926
4976
  }
4927
4977
  }
4928
- }, Kr = {
4978
+ }, qr = {
4929
4979
  closed: {
4930
4980
  y: "100%",
4931
4981
  transition: {
@@ -4942,7 +4992,7 @@ var Hr = {
4942
4992
  bounce: .18
4943
4993
  }
4944
4994
  }
4945
- }, qr = {
4995
+ }, Jr = {
4946
4996
  closed: {
4947
4997
  opacity: 0,
4948
4998
  transition: { duration: .18 }
@@ -4951,34 +5001,34 @@ var Hr = {
4951
5001
  opacity: 1,
4952
5002
  transition: { duration: .26 }
4953
5003
  }
4954
- }, Jr = { transition: { duration: 0 } }, Yr = (e) => ({
5004
+ }, Yr = { transition: { duration: 0 } }, Xr = (e) => ({
4955
5005
  closed: {
4956
5006
  ...e.closed,
4957
- ...Jr
5007
+ ...Yr
4958
5008
  },
4959
5009
  open: {
4960
5010
  ...e.open,
4961
- ...Jr
5011
+ ...Yr
4962
5012
  }
4963
5013
  });
4964
- function Xr({ children: e, pane: t, onDismiss: n, surface: r = "flush", className: i, ...a }) {
5014
+ function Zr({ children: e, pane: t, onDismiss: n, surface: r = "flush", className: i, ...a }) {
4965
5015
  let s = p(null), [l, u] = m(!1), [d, h] = m(!1), g = o(() => h((e) => !e), []), b = E(), [x, S, w] = f(() => {
4966
- let e = l ? Kr : Wr, t = l ? void 0 : Gr;
5016
+ let e = l ? qr : Gr, t = l ? void 0 : Kr;
4967
5017
  return b ? [
4968
- Yr(e),
4969
- t && Yr(t),
4970
- Yr(qr)
5018
+ Xr(e),
5019
+ t && Xr(t),
5020
+ Xr(Jr)
4971
5021
  ] : [
4972
5022
  e,
4973
5023
  t,
4974
- qr
5024
+ Jr
4975
5025
  ];
4976
5026
  }, [b, l]);
4977
5027
  c(() => {
4978
5028
  let e = s.current;
4979
5029
  if (!e || typeof ResizeObserver > "u") return;
4980
5030
  let t = new ResizeObserver(([e]) => {
4981
- u(e.contentRect.width <= Ur);
5031
+ u(e.contentRect.width <= Wr);
4982
5032
  });
4983
5033
  return t.observe(e), () => t.disconnect();
4984
5034
  }, []);
@@ -4989,17 +5039,17 @@ function Xr({ children: e, pane: t, onDismiss: n, surface: r = "flush", classNam
4989
5039
  });
4990
5040
  return /* @__PURE__ */ v("div", {
4991
5041
  ref: s,
4992
- className: [Hr.layout, i ?? ""].filter(Boolean).join(" "),
5042
+ className: [Ur.layout, i ?? ""].filter(Boolean).join(" "),
4993
5043
  "data-pane": T ? "" : void 0,
4994
5044
  "data-surface": r === "panes" ? "panes" : void 0,
4995
5045
  ...a,
4996
5046
  children: [/* @__PURE__ */ _("div", {
4997
- className: Hr.chat,
5047
+ className: Ur.chat,
4998
5048
  children: e
4999
5049
  }), /* @__PURE__ */ v(y, {
5000
5050
  initial: !1,
5001
5051
  children: [T && l && n && /* @__PURE__ */ _(C.div, {
5002
- className: Hr.scrim,
5052
+ className: Ur.scrim,
5003
5053
  variants: w,
5004
5054
  initial: "closed",
5005
5055
  animate: "open",
@@ -5007,13 +5057,13 @@ function Xr({ children: e, pane: t, onDismiss: n, surface: r = "flush", classNam
5007
5057
  "aria-hidden": !0,
5008
5058
  onClick: n
5009
5059
  }, "scrim"), T && /* @__PURE__ */ _(C.div, {
5010
- className: Hr.slot,
5060
+ className: Ur.slot,
5011
5061
  variants: x,
5012
5062
  initial: "closed",
5013
5063
  animate: "open",
5014
5064
  exit: "closed",
5015
5065
  children: /* @__PURE__ */ _(C.div, {
5016
- className: Hr.card,
5066
+ className: Ur.card,
5017
5067
  "data-expanded": d && !l || void 0,
5018
5068
  variants: S,
5019
5069
  ...l && n ? {
@@ -5039,7 +5089,7 @@ function Xr({ children: e, pane: t, onDismiss: n, surface: r = "flush", classNam
5039
5089
  }
5040
5090
  //#endregion
5041
5091
  //#region src/Artifact/useArtifacts.ts
5042
- function Zr(e = null) {
5092
+ function Qr(e = null) {
5043
5093
  let [t, n] = m(e);
5044
5094
  return {
5045
5095
  openId: t,
@@ -5048,105 +5098,123 @@ function Zr(e = null) {
5048
5098
  toggle: o((e) => n((t) => t === e ? null : e), [])
5049
5099
  };
5050
5100
  }
5051
- var Qr = {
5101
+ var $r = {
5052
5102
  root: "ick-root-JrOP",
5053
5103
  viewport: "ick-viewport-C3hz",
5054
5104
  content: "ick-content-33lN",
5055
5105
  jump: "ick-jump-nd6O"
5056
- }, $r = 64, ei = 500, ti = 4, ni = (e, t) => e.offsetTop - t.offsetTop, ri = (e, t) => t ? e.querySelector(`[id="${CSS.escape(t)}"]`) : null, ii = (e, t, n) => {
5106
+ }, ei = 64, ti = 500, ni = 4, ri = (e, t) => e.offsetTop - t.offsetTop, ii = (e, t) => t ? e.querySelector(`[id="${CSS.escape(t)}"]`) : null, ai = (e, t, n) => {
5057
5107
  n !== t.current && (t.current = n, e.style.setProperty("--ick-conversation-tail", `${Math.round(n)}px`));
5058
- }, ai = r(function({ children: e, anchorId: t, anchorOffset: n = 0, endOffset: r = 0, tail: i = "auto", threshold: a = $r, scrollButton: s = !0, scrollButtonLabel: l, follow: f = !0, className: h, viewportClassName: g, onScroll: y, ...b }, x) {
5059
- let S = U("conversation").jump, C = l ?? S, w = p(null);
5060
- u(x, () => w.current, []);
5061
- let T = p(null), [E, O] = m(!0), k = p(-1), A = p(null), j = p(!1), M = o(() => {
5062
- let e = w.current, t = T.current;
5108
+ }, oi = r(function({ children: e, anchorId: t, anchorOffset: n = 0, endOffset: r = 0, tail: i = "auto", threshold: a = ei, scrollButton: s = !0, scrollButtonLabel: l, follow: f = !0, dock: h = !1, className: g, viewportClassName: y, onScroll: b, ...x }, S) {
5109
+ let C = H("conversation").jump, w = l ?? C, T = p(null);
5110
+ u(S, () => T.current, []);
5111
+ let E = p(null), O = p(null), [k, A] = m(!0);
5112
+ c(() => {
5113
+ if (!h) return;
5114
+ let e = E.current, t = O.current;
5115
+ if (!e || !t || typeof ResizeObserver > "u") return;
5116
+ let n = () => {
5117
+ let n = e.lastElementChild;
5118
+ t.style.setProperty("--ick-dock-height", `${n?.offsetHeight ?? 0}px`);
5119
+ }, r = new ResizeObserver(n);
5120
+ return r.observe(e), n(), () => {
5121
+ r.disconnect(), t.style.removeProperty("--ick-dock-height");
5122
+ };
5123
+ }, [h]);
5124
+ let j = p(-1), M = p(null), ee = p(!1), te = o(() => {
5125
+ let e = T.current, t = E.current;
5063
5126
  if (!e || !t) return 0;
5064
- if (i === "auto" && j.current) return Math.max(0, e.scrollHeight - e.clientHeight);
5065
- let n = t.lastElementChild, a = n ? ni(n, e) + n.offsetHeight : ni(t, e) + t.offsetHeight - k.current;
5127
+ if (i === "auto" && ee.current) return Math.max(0, e.scrollHeight - e.clientHeight);
5128
+ let n = h ? null : t.lastElementChild, a = n ? ri(n, e) + n.offsetHeight : ri(t, e) + t.offsetHeight - (h ? 0 : j.current);
5066
5129
  return Math.max(0, a + r - e.clientHeight);
5067
- }, [r, i]), ee = o(() => {
5068
- let e = w.current, a = T.current;
5130
+ }, [
5131
+ h,
5132
+ r,
5133
+ i
5134
+ ]), N = o(() => {
5135
+ let e = T.current, a = E.current;
5069
5136
  if (!e || !a) return;
5070
- if (i !== "auto") return ii(a, k, Math.max(0, i));
5071
- let o = parseFloat(getComputedStyle(e).paddingBottom) || 0, s = Math.max(0, r - o), c = a.lastElementChild, l = ri(e, A.current);
5072
- if (j.current = !!c && !!l, !j.current || !c || !l) return ii(a, k, s);
5073
- let u = ni(c, e) + c.offsetHeight - ni(l, e), d = Math.max(s, e.clientHeight - n - u - o);
5074
- ii(a, k, t ? Math.max(d, k.current) : d);
5137
+ if (i !== "auto") return ai(a, j, Math.max(0, i));
5138
+ let o = parseFloat(getComputedStyle(e).paddingBottom) || 0, s = Math.max(0, r - o), c = a.lastElementChild, l = ii(e, M.current);
5139
+ if (ee.current = !!c && !!l, !ee.current || !c || !l) return ai(a, j, s);
5140
+ let u = ri(c, e) + c.offsetHeight - ri(l, e), d = h ? Math.max(s, j.current + (ri(l, e) - n - (e.scrollHeight - e.clientHeight))) : Math.max(s, e.clientHeight - n - u - o);
5141
+ ai(a, j, t ? Math.max(d, j.current) : d);
5075
5142
  }, [
5076
5143
  i,
5077
5144
  n,
5078
5145
  r,
5079
- t
5080
- ]), N = o(() => {
5081
- let e = w.current;
5146
+ t,
5147
+ h
5148
+ ]), P = o(() => {
5149
+ let e = T.current;
5082
5150
  if (!e) return 0;
5083
5151
  if (t) {
5084
5152
  let r = e.querySelector(`[id="${CSS.escape(t)}"]`);
5085
5153
  if (r) {
5086
- let t = Math.max(0, e.scrollHeight - e.clientHeight), i = ni(r, e), a = i - n, o = i + r.offsetHeight - e.clientHeight;
5154
+ let t = Math.max(0, e.scrollHeight - e.clientHeight), i = ri(r, e), a = i - n, o = i + r.offsetHeight - e.clientHeight;
5087
5155
  return Math.max(0, Math.min(Math.max(a, o), t));
5088
5156
  }
5089
5157
  }
5090
- return M();
5158
+ return te();
5091
5159
  }, [
5092
5160
  t,
5093
5161
  n,
5094
- M
5095
- ]), P = p(0), F = p(null), te = o((e) => {
5096
- let t = w.current;
5162
+ te
5163
+ ]), F = p(0), ne = p(null), I = o((e) => {
5164
+ let t = T.current;
5097
5165
  if (!t) return;
5098
5166
  let n = e && !q();
5099
- P.current = n ? performance.now() + ei : 0, t.scrollTo({
5100
- top: N(),
5167
+ F.current = n ? performance.now() + ti : 0, t.scrollTo({
5168
+ top: P(),
5101
5169
  behavior: n ? "smooth" : "auto"
5102
- }), O(!0);
5103
- }, [N]);
5170
+ }), A(!0);
5171
+ }, [P]);
5104
5172
  d(() => {
5105
- t && (A.current = t);
5106
- let e = w.current, n = T.current;
5107
- if (ee(), !e || !n || typeof ResizeObserver > "u") return;
5108
- let r = new ResizeObserver(ee);
5173
+ t && (M.current = t);
5174
+ let e = T.current, n = E.current;
5175
+ if (N(), !e || !n || typeof ResizeObserver > "u") return;
5176
+ let r = new ResizeObserver(N);
5109
5177
  return r.observe(n), r.observe(e), () => r.disconnect();
5110
- }, [t, ee]), d(() => {
5111
- if (!f || !E && !t) return;
5112
- let e = w.current, n = T.current;
5178
+ }, [t, N]), d(() => {
5179
+ if (!f || !k && !t) return;
5180
+ let e = T.current, n = E.current;
5113
5181
  if (!e || !n || typeof ResizeObserver > "u") return;
5114
5182
  let r = () => {
5115
- let n = N();
5116
- if (P.current) {
5117
- if (performance.now() < P.current && Math.abs(e.scrollTop - n) > 1) return;
5118
- P.current = 0;
5183
+ let n = P();
5184
+ if (F.current) {
5185
+ if (performance.now() < F.current && Math.abs(e.scrollTop - n) > 1) return;
5186
+ F.current = 0;
5119
5187
  }
5120
5188
  let r = n - e.scrollTop;
5121
- if (A.current && !t && Math.abs(r) > a && !q()) {
5122
- P.current = performance.now() + ei, e.scrollTo({
5189
+ if (M.current && !t && Math.abs(r) > a && !q()) {
5190
+ F.current = performance.now() + ti, e.scrollTo({
5123
5191
  top: n,
5124
5192
  behavior: "smooth"
5125
5193
  });
5126
5194
  return;
5127
5195
  }
5128
5196
  e.scrollTop = n;
5129
- }, i = t != null && t !== F.current;
5130
- t && (F.current = t), i && !q() && Math.abs(e.scrollTop - N()) > a ? (P.current = performance.now() + ei, e.scrollTo({
5131
- top: N(),
5197
+ }, i = t != null && t !== ne.current;
5198
+ t && (ne.current = t), i && !q() && Math.abs(e.scrollTop - P()) > a ? (F.current = performance.now() + ti, e.scrollTo({
5199
+ top: P(),
5132
5200
  behavior: "smooth"
5133
5201
  })) : r();
5134
5202
  let o = new ResizeObserver(r);
5135
5203
  return o.observe(n), () => o.disconnect();
5136
5204
  }, [
5137
5205
  f,
5138
- E,
5139
- N,
5206
+ k,
5207
+ P,
5140
5208
  t,
5141
5209
  a
5142
5210
  ]), c(() => {
5143
5211
  if (!f) return;
5144
- let e = w.current;
5212
+ let e = T.current;
5145
5213
  if (!e) return;
5146
5214
  let n = () => {
5147
- P.current = 0, Math.abs(e.scrollTop - N()) > a && O(!1);
5215
+ F.current = 0, Math.abs(e.scrollTop - P()) > a && A(!1);
5148
5216
  }, r = (e) => {
5149
- t ? n() : e.deltaY < 0 && O(!1);
5217
+ t ? n() : e.deltaY < 0 && A(!1);
5150
5218
  }, i = (e) => {
5151
5219
  [
5152
5220
  "ArrowUp",
@@ -5159,10 +5227,10 @@ var Qr = {
5159
5227
  "ArrowUp",
5160
5228
  "PageUp",
5161
5229
  "Home"
5162
- ].includes(e.key) && O(!1));
5230
+ ].includes(e.key) && A(!1));
5163
5231
  }, o = (e) => {
5164
5232
  let t = e.target;
5165
- t instanceof Element && t.closest("[aria-expanded]") && O(!1);
5233
+ t instanceof Element && t.closest("[aria-expanded]") && A(!1);
5166
5234
  };
5167
5235
  return e.addEventListener("wheel", r, { passive: !0 }), e.addEventListener("touchmove", n, { passive: !0 }), e.addEventListener("keydown", i), e.addEventListener("pointerdown", o, { passive: !0 }), () => {
5168
5236
  e.removeEventListener("wheel", r), e.removeEventListener("touchmove", n), e.removeEventListener("keydown", i), e.removeEventListener("pointerdown", o);
@@ -5170,45 +5238,48 @@ var Qr = {
5170
5238
  }, [
5171
5239
  f,
5172
5240
  a,
5173
- N,
5241
+ P,
5174
5242
  t
5175
5243
  ]);
5176
- let I = o((e) => {
5177
- if (y?.(e), !f) return;
5178
- let t = w.current;
5179
- t && Math.abs(t.scrollTop - N()) <= ti && (P.current = 0, O(!0));
5244
+ let re = o((e) => {
5245
+ if (b?.(e), !f) return;
5246
+ let t = T.current;
5247
+ t && Math.abs(t.scrollTop - P()) <= ni && (F.current = 0, A(!0));
5180
5248
  }, [
5181
5249
  f,
5182
- y,
5183
- N
5184
- ]), ne = f && !E;
5250
+ b,
5251
+ P
5252
+ ]), L = f && !k;
5185
5253
  return /* @__PURE__ */ v("div", {
5186
- className: [Qr.root, h ?? ""].filter(Boolean).join(" "),
5254
+ ref: O,
5255
+ className: [$r.root, g ?? ""].filter(Boolean).join(" "),
5256
+ "data-dock": h || void 0,
5187
5257
  children: [/* @__PURE__ */ _("div", {
5188
- ref: w,
5189
- className: [Qr.viewport, g ?? ""].filter(Boolean).join(" "),
5190
- onScroll: I,
5191
- ...b,
5258
+ ref: T,
5259
+ className: [$r.viewport, y ?? ""].filter(Boolean).join(" "),
5260
+ onScroll: re,
5261
+ ...x,
5192
5262
  children: /* @__PURE__ */ _("div", {
5193
- ref: T,
5194
- className: Qr.content,
5263
+ ref: E,
5264
+ className: $r.content,
5265
+ "data-dock": h || void 0,
5195
5266
  children: e
5196
5267
  })
5197
5268
  }), s && /* @__PURE__ */ _("button", {
5198
5269
  type: "button",
5199
- className: Qr.jump,
5200
- "data-shown": ne || void 0,
5201
- tabIndex: ne ? 0 : -1,
5202
- "aria-hidden": !ne || void 0,
5203
- onClick: () => te(!0),
5204
- "aria-label": C,
5270
+ className: $r.jump,
5271
+ "data-shown": L || void 0,
5272
+ tabIndex: L ? 0 : -1,
5273
+ "aria-hidden": !L || void 0,
5274
+ onClick: () => I(!0),
5275
+ "aria-label": w,
5205
5276
  children: /* @__PURE__ */ _(D, {
5206
5277
  size: 15,
5207
5278
  "aria-hidden": !0
5208
5279
  })
5209
5280
  })]
5210
5281
  });
5211
- }), oi = {
5282
+ }), si = {
5212
5283
  empty: "ick-empty-BP6G",
5213
5284
  icon: "ick-icon-rZWd",
5214
5285
  title: "ick-title-AoPi",
@@ -5217,26 +5288,26 @@ var Qr = {
5217
5288
  };
5218
5289
  //#endregion
5219
5290
  //#region src/EmptyState/EmptyState.tsx
5220
- function si({ icon: e, title: t, description: n, suggestions: r, onSuggestion: i, suggestionsLabel: a, children: o, className: s, ...c }) {
5221
- let l = U("emptyState").suggestions, u = a ?? l, d = i ? r ?? [] : [];
5291
+ function ci({ icon: e, title: t, description: n, suggestions: r, onSuggestion: i, suggestionsLabel: a, children: o, className: s, ...c }) {
5292
+ let l = H("emptyState").suggestions, u = a ?? l, d = i ? r ?? [] : [];
5222
5293
  return /* @__PURE__ */ v("div", {
5223
- className: [oi.empty, s ?? ""].filter(Boolean).join(" "),
5294
+ className: [si.empty, s ?? ""].filter(Boolean).join(" "),
5224
5295
  ...c,
5225
5296
  children: [
5226
5297
  e && /* @__PURE__ */ _("div", {
5227
- className: oi.icon,
5298
+ className: si.icon,
5228
5299
  children: e
5229
5300
  }),
5230
5301
  t && /* @__PURE__ */ _("div", {
5231
- className: oi.title,
5302
+ className: si.title,
5232
5303
  children: t
5233
5304
  }),
5234
5305
  n && /* @__PURE__ */ _("p", {
5235
- className: oi.description,
5306
+ className: si.description,
5236
5307
  children: n
5237
5308
  }),
5238
5309
  d.length > 0 && /* @__PURE__ */ _("div", {
5239
- className: oi.suggestions,
5310
+ className: si.suggestions,
5240
5311
  role: "group",
5241
5312
  "aria-label": u,
5242
5313
  children: d.map((e) => /* @__PURE__ */ _(V, {
@@ -5252,14 +5323,14 @@ function si({ icon: e, title: t, description: n, suggestions: r, onSuggestion: i
5252
5323
  }
5253
5324
  //#endregion
5254
5325
  //#region src/ReplyThreadPopup/placePanel.ts
5255
- var ci = 24, li = 480, ui = 80, di = 260;
5256
- function fi(e, t, n = Infinity) {
5257
- let r = Math.max(t - 48, 0), i = Math.min(Math.max(e.width + ui, li), r), a = e.left + e.width / 2 - i / 2, o = Math.min(Math.max(a, ci), t - ci - i), s = Math.max(ci, n - ci - di), c = Math.min(Math.max(e.top - ci, Math.min(ci, n)), Number.isFinite(s) ? s : Infinity);
5326
+ var li = 24, ui = 480, di = 80, fi = 260;
5327
+ function pi(e, t, n = Infinity) {
5328
+ let r = Math.max(t - 48, 0), i = Math.min(Math.max(e.width + di, ui), r), a = e.left + e.width / 2 - i / 2, o = Math.min(Math.max(a, li), t - li - i), s = Math.max(li, n - li - fi), c = Math.min(Math.max(e.top - li, Math.min(li, n)), Number.isFinite(s) ? s : Infinity);
5258
5329
  return {
5259
5330
  x: o,
5260
5331
  y: c,
5261
5332
  width: i,
5262
- maxHeight: Number.isFinite(n) ? Math.max(di, n - c - ci) : Infinity
5333
+ maxHeight: Number.isFinite(n) ? Math.max(fi, n - c - li) : Infinity
5263
5334
  };
5264
5335
  }
5265
5336
  var Q = {
@@ -5283,7 +5354,7 @@ var Q = {
5283
5354
  turn: "ick-turn-ogjU",
5284
5355
  turnRow: "ick-turnRow-0OuP",
5285
5356
  srOnly: "ick-srOnly-LwE1"
5286
- }, pi = 760, mi = {
5357
+ }, mi = 760, hi = {
5287
5358
  closed: {
5288
5359
  y: "100%",
5289
5360
  opacity: 1,
@@ -5302,11 +5373,11 @@ var Q = {
5302
5373
  bounce: .18
5303
5374
  }
5304
5375
  }
5305
- }, hi = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex=\"-1\"])";
5306
- function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5307
- let i = U("thread"), { responding: a } = U("experience"), [o, s] = m("none"), u = p(null), d = p(null), f = p(null), [h] = m(() => typeof document > "u" ? null : document.activeElement), g = l(), y = l(), b = rt, [S, w] = m(() => typeof window > "u" ? !1 : window.matchMedia?.(`(max-width: ${pi}px)`)?.matches ?? !1);
5376
+ }, gi = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex=\"-1\"])";
5377
+ function _i({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5378
+ let i = H("thread"), { responding: a } = H("experience"), [o, s] = m("none"), u = p(null), d = p(null), f = p(null), [h] = m(() => typeof document > "u" ? null : document.activeElement), g = l(), y = l(), b = rt, [S, w] = m(() => typeof window > "u" ? !1 : window.matchMedia?.(`(max-width: ${mi}px)`)?.matches ?? !1);
5308
5379
  c(() => {
5309
- let e = window.matchMedia?.(`(max-width: ${pi}px)`);
5380
+ let e = window.matchMedia?.(`(max-width: ${mi}px)`);
5310
5381
  if (!e?.addEventListener) return;
5311
5382
  let t = () => w(e.matches);
5312
5383
  return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
@@ -5325,7 +5396,7 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5325
5396
  return;
5326
5397
  }
5327
5398
  if (e.key !== "Tab") return;
5328
- let n = [...f.current?.querySelectorAll(hi) ?? []];
5399
+ let n = [...f.current?.querySelectorAll(gi) ?? []];
5329
5400
  if (n.length === 0) return;
5330
5401
  let r = n[0], i = n[n.length - 1], a = document.activeElement;
5331
5402
  e.shiftKey && a === r ? (e.preventDefault(), i.focus()) : !e.shiftKey && a === i && (e.preventDefault(), r.focus());
@@ -5357,12 +5428,12 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5357
5428
  behavior: "smooth"
5358
5429
  });
5359
5430
  }, [E]);
5360
- let { x: ee, y: N, width: P, maxHeight: F } = typeof window > "u" ? {
5431
+ let { x: ee, y: te, width: N, maxHeight: P } = typeof window > "u" ? {
5361
5432
  x: 0,
5362
5433
  y: 0,
5363
5434
  width: 480,
5364
5435
  maxHeight: Infinity
5365
- } : fi(e.rect, window.innerWidth, window.innerHeight);
5436
+ } : pi(e.rect, window.innerWidth, window.innerHeight);
5366
5437
  return /* @__PURE__ */ _(x, {
5367
5438
  reducedMotion: "user",
5368
5439
  children: /* @__PURE__ */ _("div", {
@@ -5386,8 +5457,8 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5386
5457
  },
5387
5458
  animate: S ? "open" : {
5388
5459
  left: ee,
5389
- top: N,
5390
- width: P,
5460
+ top: te,
5461
+ width: N,
5391
5462
  borderRadius: 28,
5392
5463
  opacity: 1
5393
5464
  },
@@ -5396,7 +5467,7 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5396
5467
  scale: .95,
5397
5468
  filter: "blur(4px)"
5398
5469
  },
5399
- variants: S ? mi : void 0,
5470
+ variants: S ? hi : void 0,
5400
5471
  transition: S ? void 0 : {
5401
5472
  type: "spring",
5402
5473
  bounce: 0,
@@ -5417,7 +5488,7 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5417
5488
  (n.offset.y > 120 || n.velocity.y > 600) && t();
5418
5489
  }
5419
5490
  } : {},
5420
- style: !S && Number.isFinite(F) ? { maxHeight: F } : void 0,
5491
+ style: !S && Number.isFinite(P) ? { maxHeight: P } : void 0,
5421
5492
  className: Q.panel,
5422
5493
  children: /* @__PURE__ */ v("div", {
5423
5494
  className: Q.column,
@@ -5540,7 +5611,7 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5540
5611
  }
5541
5612
  //#endregion
5542
5613
  //#region src/CustomCursor/CustomCursor.tsx
5543
- function _i() {
5614
+ function vi() {
5544
5615
  let e = T(-100), t = T(-100), [n, r] = m("default"), [i, a] = m(!1), [o, s] = m(!1);
5545
5616
  return c(() => {
5546
5617
  let n = (n) => {
@@ -5698,15 +5769,17 @@ function _i() {
5698
5769
  }
5699
5770
  //#endregion
5700
5771
  //#region src/theme/useThemeAttribute.ts
5701
- function vi(e) {
5772
+ function yi(e) {
5702
5773
  c(() => {
5703
5774
  e !== void 0 && (e ? document.documentElement.setAttribute("data-theme", e) : document.documentElement.removeAttribute("data-theme"));
5704
5775
  }, [e]);
5705
5776
  }
5706
5777
  var $ = {
5707
5778
  page: "ick-page-NK01",
5708
- paned: "ick-paned-MM8c",
5709
5779
  feed: "ick-feed-XqZl",
5780
+ dock: "ick-dock-tvIC",
5781
+ centred: "ick-centred-5tu8",
5782
+ fitted: "ick-fitted-JApW",
5710
5783
  topBlur: "ick-topBlur-69Dl",
5711
5784
  bottomBlur: "ick-bottomBlur-MXmb",
5712
5785
  header: "ick-header-pQ7Z",
@@ -5723,116 +5796,134 @@ var $ = {
5723
5796
  groupTitle: "ick-groupTitle-jiBB",
5724
5797
  marks: "ick-marks-gwsN",
5725
5798
  mark: "ick-mark-QkpW"
5726
- }, yi = () => "";
5727
- function bi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !0, composerMenu: a, onTranscribe: s, onThreadReply: l, title: u, backHref: d, backLabel: h, actions: b, placeholder: x, empty: S, contextTotal: w, contextBase: T = 0, artifact: E, openArtifactId: D, onOpenArtifactChange: O, pane: A = "inline", surface: j = "flush", theme: M, onThemeChange: ee, cursor: N = !1, selectionToggle: P = !1, anchorOffset: F = 100, endOffset: te = 120, animationConfig: I, foldMotion: ne, feedDelay: ie = 0, onAnswerQuestion: L, onEditQuestion: ae, onDecideApproval: oe, className: se }) {
5728
- let R = U("experience", r?.experience), le = u ?? R.title, [ue, de] = m([]), [fe, z] = m(!1), [pe, me] = m(null), [he, _e] = m("marker"), be = p(null), xe = M !== void 0, [Se, Ce] = m(null), we = xe ? M : Se, [B, Te] = m(() => typeof window < "u" && !!window.matchMedia?.("(prefers-color-scheme: dark)").matches);
5799
+ }, bi = () => "", xi = {
5800
+ stiffness: 170,
5801
+ damping: 24,
5802
+ mass: 1
5803
+ };
5804
+ function Si({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !0, composerMenu: a, onTranscribe: s, onThreadReply: l, title: u, backHref: d, backLabel: h, actions: b, placeholder: x, empty: S, contextTotal: w, contextBase: T = 0, artifact: E, openArtifactId: D, onOpenArtifactChange: O, pane: A = "inline", surface: j = "flush", composer: M = "inline", fill: ee = "window", theme: te, onThemeChange: N, cursor: P = !1, selectionToggle: F = !1, highlights: ne = !0, bookmarks: I = !0, anchorOffset: L = 100, endOffset: ie = 120, animationConfig: R, foldMotion: ae, feedDelay: oe = 0, onAnswerQuestion: se, onEditQuestion: le, onDecideApproval: ue, className: de }) {
5805
+ let z = H("experience", r?.experience), fe = u ?? z.title, [pe, me] = m([]), [he, _e] = m(!1), [be, xe] = m(null), [Se, Ce] = m("marker"), we = p(null), B = te !== void 0, [Te, Ee] = m(null), V = B ? te : Te, [De, Oe] = m(() => typeof window < "u" && !!window.matchMedia?.("(prefers-color-scheme: dark)").matches);
5729
5806
  c(() => {
5730
- let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => Te(e.matches);
5807
+ let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => Oe(e.matches);
5731
5808
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
5732
5809
  }, []);
5733
- let Ee = we ?? (B ? "dark" : "light");
5734
- vi(we);
5735
- let V = o((e) => {
5736
- xe || Ce(e), ee?.(e);
5737
- }, [xe, ee]), H = ht({
5738
- onSend: e ?? yi,
5739
- announcements: { responding: R.responding }
5740
- }), { turns: De, setDraft: Oe, submit: je, showVersion: Me, stop: Ne, beginEdit: Pe, cancelEdit: Fe, updatePart: Ie } = t ?? H, [Le, W] = m(null), Re = o((e, t, n) => {
5741
- W(e), je(e, t, n);
5742
- }, [je]), ze = Le ? De.find((e) => e.id === Le) ?? null : null, Be = ze && ze.state !== "resting" ? Le : null, Ve = o((e) => {
5743
- W(e), je(e);
5744
- }, [je]), He = De.length === 1 && !De[0].user && !De[0].ai, Ue = T + Math.round(De.reduce((e, t) => e + t.user.length + t.ai.length + JSON.stringify(t.parts ?? []).length, 0) / 4), We = w !== void 0 && Ue >= w, Ge = p(!1);
5810
+ let ke = V ?? (De ? "dark" : "light");
5811
+ yi(V);
5812
+ let Me = o((e) => {
5813
+ B || Ee(e), N?.(e);
5814
+ }, [B, N]), U = M === "docked", Ne = f(() => U ? {
5815
+ ...rt,
5816
+ ...R,
5817
+ bubble: R?.bubble ?? xi
5818
+ } : R, [U, R]), Pe = ht({
5819
+ onSend: e ?? bi,
5820
+ announcements: { responding: z.responding },
5821
+ nextTurn: U ? "at-send" : "after-answer"
5822
+ }), { turns: Fe, setDraft: Ie, submit: Le, showVersion: W, stop: Re, beginEdit: ze, cancelEdit: Be, updatePart: Ve, isStreaming: He } = t ?? Pe, [Ue, We] = m(null), Ge = o((e, t, n) => {
5823
+ We(e), Le(e, t, n);
5824
+ }, [Le]), G = Ue ? Fe.find((e) => e.id === Ue) ?? null : null, K = G && G.state !== "resting" ? Ue : null, [q, qe] = m(0), Je = ee === "window";
5825
+ c(() => {
5826
+ if (!U || !Je) return;
5827
+ let e = window.visualViewport;
5828
+ if (!e) return;
5829
+ let t = () => qe(Math.max(0, Math.round(window.innerHeight - e.height)));
5830
+ return t(), e.addEventListener("resize", t), () => e.removeEventListener("resize", t);
5831
+ }, [U, Je]);
5832
+ let Ye = o((e) => {
5833
+ We(e), Le(e);
5834
+ }, [Le]), Xe = Fe.length === 1 && !Fe[0].user && !Fe[0].ai, Ze = T + Math.round(Fe.reduce((e, t) => e + t.user.length + t.ai.length + JSON.stringify(t.parts ?? []).length, 0) / 4), Qe = w !== void 0 && Ze >= w, $e = p(!1);
5745
5835
  c(() => {
5746
- if (!We) {
5747
- Ge.current = !1;
5836
+ if (!Qe) {
5837
+ $e.current = !1;
5748
5838
  return;
5749
5839
  }
5750
- Ge.current || (Ge.current = !0, G(R.windowFull));
5751
- }, [We, R.windowFull]);
5752
- let K = Zr(), Ke = D !== void 0, q = Ke ? D : K.openId, qe = p({
5753
- openArtifactId: q,
5754
- artifactHeld: Ke,
5840
+ $e.current || ($e.current = !0, Ke(z.windowFull));
5841
+ }, [Qe, z.windowFull]);
5842
+ let et = Qr(), tt = D !== void 0, nt = tt ? D : et.openId, it = p({
5843
+ openArtifactId: nt,
5844
+ artifactHeld: tt,
5755
5845
  onOpenArtifactChange: O
5756
5846
  });
5757
5847
  c(() => {
5758
- qe.current = {
5759
- openArtifactId: q,
5760
- artifactHeld: Ke,
5848
+ it.current = {
5849
+ openArtifactId: nt,
5850
+ artifactHeld: tt,
5761
5851
  onOpenArtifactChange: O
5762
5852
  };
5763
5853
  });
5764
- let Je = K.open, Ye = K.close, Xe = o((e) => {
5765
- let { artifactHeld: t, onOpenArtifactChange: n } = qe.current;
5766
- t || (e === null ? Ye() : Je(e)), n?.(e);
5767
- }, [Je, Ye]), Ze = o(() => Xe(null), [Xe]), [Qe, $e] = m({}), et = o((e, t) => {
5768
- $e((n) => ({
5854
+ let at = et.open, ot = et.close, st = o((e) => {
5855
+ let { artifactHeld: t, onOpenArtifactChange: n } = it.current;
5856
+ t || (e === null ? ot() : at(e)), n?.(e);
5857
+ }, [at, ot]), ct = o(() => st(null), [st]), [lt, ut] = m({}), J = o((e, t) => {
5858
+ ut((n) => ({
5769
5859
  ...n,
5770
5860
  [e]: t
5771
5861
  }));
5772
- }, []), tt = De.find((e) => e.state !== "idle" && e.state !== "typing" && e.user.trim())?.user.trim() ?? le, nt = o((e, t) => {
5773
- t.trim().length > 0 && de((n) => [...n, {
5862
+ }, []), dt = Fe.find((e) => e.state !== "idle" && e.state !== "typing" && e.user.trim())?.user.trim() ?? fe, ft = o((e, t) => {
5863
+ I && t.trim().length > 0 && me((n) => [...n, {
5774
5864
  turnId: e,
5775
5865
  text: t.trim()
5776
5866
  }]);
5777
- }, []), rt = o((e, t) => Xe(qe.current.openArtifactId === t ? null : t), [Xe]), it = o((e, t) => {
5778
- me({
5867
+ }, [I]), pt = o((e, t) => st(it.current.openArtifactId === t ? null : t), [st]), mt = o((e, t) => {
5868
+ xe({
5779
5869
  text: e,
5780
5870
  rect: t
5781
5871
  });
5782
- }, []), at = f(() => L ? (e, t, n, r) => L(Ie, e, t, n, r) : void 0, [L, Ie]), ot = f(() => ae ? (e, t, n) => ae(Ie, e, t, n) : void 0, [ae, Ie]), st = f(() => oe ? (e, t, n) => oe(Ie, e, t, n) : void 0, [oe, Ie]), [J, ct] = m(() => typeof window > "u" || !window.matchMedia || window.matchMedia("(pointer: fine)").matches);
5872
+ }, []), Y = f(() => se ? (e, t, n, r) => se(Ve, e, t, n, r) : void 0, [se, Ve]), gt = f(() => le ? (e, t, n) => le(Ve, e, t, n) : void 0, [le, Ve]), _t = f(() => ue ? (e, t, n) => ue(Ve, e, t, n) : void 0, [ue, Ve]), [vt, yt] = m(() => typeof window > "u" || !window.matchMedia || window.matchMedia("(pointer: fine)").matches);
5783
5873
  c(() => {
5784
- if (!N) return;
5785
- let e = window.matchMedia("(pointer: fine)"), t = () => ct(e.matches);
5874
+ if (!P) return;
5875
+ let e = window.matchMedia("(pointer: fine)"), t = () => yt(e.matches);
5786
5876
  return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
5787
- }, [N]);
5788
- let lt = (e) => i === !0 || Array.isArray(i) && i.includes(e), ut = [
5789
- ...ue.length > 0 ? [{
5877
+ }, [P]);
5878
+ let bt = (e) => i === !0 || Array.isArray(i) && i.includes(e), xt = [
5879
+ ...ne && I && pe.length > 0 ? [{
5790
5880
  id: "bookmarks",
5791
- label: R.savedHighlights,
5881
+ label: z.savedHighlights,
5792
5882
  icon: /* @__PURE__ */ _(k, {
5793
5883
  size: 16,
5794
5884
  "aria-hidden": !0
5795
5885
  }),
5796
- count: ue.length,
5886
+ count: pe.length,
5797
5887
  pinned: !0,
5798
- onClick: () => z(!0)
5888
+ onClick: () => _e(!0)
5799
5889
  }] : [],
5800
- ...lt("theme") ? [{
5890
+ ...bt("theme") ? [{
5801
5891
  id: "theme",
5802
- label: Ee === "dark" ? R.themeToLight : R.themeToDark,
5803
- icon: _(Ee === "dark" ? ve : ce, {
5892
+ label: ke === "dark" ? z.themeToLight : z.themeToDark,
5893
+ icon: _(ke === "dark" ? ve : ce, {
5804
5894
  size: 16,
5805
5895
  "aria-hidden": !0
5806
5896
  }),
5807
- active: Ee === "dark",
5808
- onClick: () => V(Ee === "dark" ? "light" : "dark")
5897
+ active: ke === "dark",
5898
+ onClick: () => Me(ke === "dark" ? "light" : "dark")
5809
5899
  }] : [],
5810
- ...lt("share") ? [{
5900
+ ...bt("share") ? [{
5811
5901
  id: "share",
5812
- label: R.share,
5902
+ label: z.share,
5813
5903
  icon: /* @__PURE__ */ _(ge, {
5814
5904
  size: 16,
5815
5905
  "aria-hidden": !0
5816
5906
  }),
5817
5907
  onClick: () => navigator.share?.({
5818
- title: tt,
5908
+ title: dt,
5819
5909
  url: window.location.href
5820
5910
  })
5821
5911
  }] : [],
5822
5912
  ...b ?? []
5823
- ], dt = A === "inline" && q ? E?.(q) : null, ft = /* @__PURE__ */ v(C.div, {
5913
+ ], St = A === "inline" && nt ? E?.(nt) : null, wt = /* @__PURE__ */ v(C.div, {
5824
5914
  className: [
5825
5915
  $.page,
5826
- j === "panes" ? $.paned : "",
5916
+ j === "panes" || !Je ? $.fitted : "",
5827
5917
  "ick-chat-page",
5828
- se
5918
+ de
5829
5919
  ].filter(Boolean).join(" "),
5830
- style: { "--ick-experience-anchor": `${F}px` },
5920
+ style: { "--ick-experience-anchor": `${L}px` },
5921
+ "data-composer": U ? "docked" : void 0,
5831
5922
  initial: { opacity: 0 },
5832
5923
  animate: {
5833
- opacity: pe || fe ? .4 : 1,
5834
- filter: pe || fe ? "blur(3px)" : "blur(0px)",
5835
- scale: pe || fe ? .9 : 1
5924
+ opacity: be || he ? .4 : 1,
5925
+ filter: be || he ? "blur(3px)" : "blur(0px)",
5926
+ scale: be || he ? .9 : 1
5836
5927
  },
5837
5928
  transition: {
5838
5929
  type: "spring",
@@ -5841,126 +5932,131 @@ function bi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
5841
5932
  mass: .9
5842
5933
  },
5843
5934
  onAnimationComplete: () => {
5844
- document.activeElement && document.activeElement !== document.body || be.current?.focus();
5935
+ document.activeElement && document.activeElement !== document.body || we.current?.focus();
5845
5936
  },
5846
5937
  children: [
5847
5938
  /* @__PURE__ */ _("div", { className: $.topBlur }),
5848
5939
  /* @__PURE__ */ v(Ct, {
5849
5940
  className: `${$.header} ick-chat-header`,
5850
- title: tt,
5941
+ title: dt,
5851
5942
  backHref: d,
5852
5943
  backLabel: h,
5853
5944
  elevateOnScroll: !1,
5854
5945
  collapseActionsAt: 480,
5855
- actions: ut,
5856
- children: [w !== void 0 && /* @__PURE__ */ _(Rr, {
5946
+ actions: xt,
5947
+ children: [w !== void 0 && /* @__PURE__ */ _(zr, {
5857
5948
  className: $.context,
5858
- used: Ue,
5949
+ used: Ze,
5859
5950
  total: w
5860
- }), P && /* @__PURE__ */ v("div", {
5951
+ }), F && ne && /* @__PURE__ */ v("div", {
5861
5952
  className: $.selectMode,
5862
5953
  role: "group",
5863
- "aria-label": R.selectionMode,
5954
+ "aria-label": z.selectionMode,
5864
5955
  children: [/* @__PURE__ */ _("button", {
5865
5956
  type: "button",
5866
- "data-active": he === "marker",
5867
- onClick: () => _e("marker"),
5868
- "aria-label": R.marker,
5869
- title: R.marker,
5957
+ "data-active": Se === "marker",
5958
+ onClick: () => Ce("marker"),
5959
+ "aria-label": z.marker,
5960
+ title: z.marker,
5870
5961
  children: /* @__PURE__ */ _(re, { size: 16 })
5871
5962
  }), /* @__PURE__ */ _("button", {
5872
5963
  type: "button",
5873
- "data-active": he === "precise",
5874
- onClick: () => _e("precise"),
5875
- "aria-label": R.precise,
5876
- title: R.precise,
5964
+ "data-active": Se === "precise",
5965
+ onClick: () => Ce("precise"),
5966
+ "aria-label": z.precise,
5967
+ title: z.precise,
5877
5968
  children: /* @__PURE__ */ _(ye, { size: 16 })
5878
5969
  })]
5879
5970
  })]
5880
5971
  }),
5881
- /* @__PURE__ */ v(ai, {
5972
+ /* @__PURE__ */ v(oi, {
5882
5973
  viewportClassName: `${$.feed} ick-chat-feed`,
5883
- anchorId: Be ? `turn-${Be}` : void 0,
5884
- anchorOffset: F,
5885
- endOffset: te,
5974
+ anchorId: K ? `turn-${K}` : void 0,
5975
+ dock: U,
5976
+ anchorOffset: L,
5977
+ endOffset: U ? 0 : ie,
5886
5978
  children: [
5887
- He && S && /* @__PURE__ */ _(si, {
5888
- className: $.opening,
5979
+ Xe && S && /* @__PURE__ */ _(ci, {
5980
+ className: U ? `${$.opening} ${$.centred}` : $.opening,
5889
5981
  title: S.title,
5890
5982
  description: S.description,
5891
5983
  suggestions: S.suggestions,
5892
- onSuggestion: (e) => Re(De[0].id, e)
5984
+ onSuggestion: (e) => Ge(Fe[0].id, e)
5893
5985
  }),
5894
- /* @__PURE__ */ _(y, { children: De.map((e, t) => {
5895
- let r = t === De.length - 1 && (e.state === "idle" || e.state === "typing");
5896
- return /* @__PURE__ */ _(Nr, {
5986
+ /* @__PURE__ */ _(y, { children: Fe.map((e, t) => {
5987
+ let r = t === Fe.length - 1 && (e.state === "idle" || e.state === "typing");
5988
+ return /* @__PURE__ */ _(Pr, {
5897
5989
  turn: e,
5898
- questionAlign: He && t === 0 ? "stretch" : "end",
5899
- className: He && t === 0 ? $.opening : void 0,
5990
+ questionAlign: U && r || Xe && t === 0 ? "stretch" : "end",
5991
+ className: U && r ? $.dock : Xe && t === 0 ? $.opening : void 0,
5900
5992
  onTranscribe: s,
5901
5993
  isActiveInput: r,
5902
- inputRef: r ? be : null,
5903
- entranceDelay: t === 0 ? ie : 0,
5904
- selectionMode: he,
5905
- animationConfig: I,
5906
- foldMotion: ne,
5907
- openArtifactId: q,
5908
- onOpenArtifact: rt,
5909
- onArtifactChange: Xe,
5994
+ inputRef: r ? we : null,
5995
+ entranceDelay: t === 0 ? oe : 0,
5996
+ selectionMode: Se,
5997
+ highlights: ne,
5998
+ animationConfig: Ne,
5999
+ foldMotion: ae,
6000
+ openArtifactId: nt,
6001
+ onOpenArtifact: pt,
6002
+ onArtifactChange: st,
5910
6003
  placeholder: x,
5911
- onDraft: Oe,
5912
- onSubmit: Re,
5913
- onRegenerate: Ve,
5914
- onShowVersion: Me,
5915
- onFeedback: et,
5916
- feedback: Qe[e.id] ?? null,
5917
- onStop: Ne,
5918
- onEdit: Pe,
5919
- onCancelEdit: Fe,
5920
- onHighlight: nt,
5921
- onReplyInThread: l ? it : void 0,
5922
- onAnswerQuestion: at,
5923
- onEditQuestion: ot,
5924
- onDecideApproval: st,
6004
+ onDraft: Ie,
6005
+ onSubmit: Ge,
6006
+ onRegenerate: Ye,
6007
+ onShowVersion: W,
6008
+ onFeedback: J,
6009
+ feedback: lt[e.id] ?? null,
6010
+ onStop: !U || r ? Re : void 0,
6011
+ busy: U && r ? He : void 0,
6012
+ onEdit: ze,
6013
+ onCancelEdit: Be,
6014
+ onHighlight: ft,
6015
+ onReplyInThread: l ? mt : void 0,
6016
+ onAnswerQuestion: Y,
6017
+ onEditQuestion: gt,
6018
+ onDecideApproval: _t,
5925
6019
  renderPart: n,
5926
6020
  composerMenu: a
5927
6021
  }, e.id);
5928
6022
  }) }),
5929
- We && /* @__PURE__ */ _(zn, { children: R.windowFull })
6023
+ Qe && /* @__PURE__ */ _(zn, { children: z.windowFull })
5930
6024
  ]
5931
6025
  }),
5932
6026
  /* @__PURE__ */ _("div", { className: $.bottomBlur })
5933
6027
  ]
5934
6028
  });
5935
- return /* @__PURE__ */ v(ke, {
6029
+ return /* @__PURE__ */ v(Ae, {
5936
6030
  labels: r,
5937
6031
  children: [
5938
- N && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("style", { dangerouslySetInnerHTML: { __html: "@media (pointer: fine) { * { cursor: none !important; } }" } }), J && /* @__PURE__ */ _(_i, {})] }),
5939
- /* @__PURE__ */ _(Xr, {
6032
+ P && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("style", { dangerouslySetInnerHTML: { __html: "@media (pointer: fine) { * { cursor: none !important; } }" } }), vt && /* @__PURE__ */ _(vi, {})] }),
6033
+ /* @__PURE__ */ _(Zr, {
5940
6034
  className: $.workspace,
5941
6035
  surface: j,
5942
- onDismiss: Ze,
5943
- pane: ({ narrow: e, expanded: t, toggleExpanded: n }) => dt ? /* @__PURE__ */ _(Br, {
5944
- title: dt.title,
5945
- meta: dt.meta,
6036
+ "data-fill": Je ? void 0 : "container",
6037
+ style: Je && q > 0 ? { "--ick-keyboard": `${q}px` } : void 0,
6038
+ onDismiss: ct,
6039
+ pane: ({ narrow: e, expanded: t, toggleExpanded: n }) => St ? /* @__PURE__ */ _(Vr, {
6040
+ title: St.title,
6041
+ meta: St.meta,
5946
6042
  modal: e,
5947
6043
  expanded: t,
5948
6044
  onToggleExpanded: n,
5949
- onClose: Ze,
5950
- children: dt.children
6045
+ onClose: ct,
6046
+ children: St.children
5951
6047
  }) : null,
5952
- children: ft
6048
+ children: wt
5953
6049
  }),
5954
- /* @__PURE__ */ _(y, { children: fe && /* @__PURE__ */ _(C.div, {
6050
+ /* @__PURE__ */ _(y, { children: he && /* @__PURE__ */ _(C.div, {
5955
6051
  className: $.scrim,
5956
6052
  initial: { opacity: 0 },
5957
6053
  animate: { opacity: 1 },
5958
6054
  exit: { opacity: 0 },
5959
- onClick: () => z(!1),
6055
+ onClick: () => _e(!1),
5960
6056
  children: /* @__PURE__ */ v(C.div, {
5961
6057
  className: $.sheet,
5962
6058
  role: "dialog",
5963
- "aria-label": R.savedHighlights,
6059
+ "aria-label": z.savedHighlights,
5964
6060
  initial: {
5965
6061
  y: 20,
5966
6062
  scale: .95
@@ -5978,24 +6074,24 @@ function bi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
5978
6074
  className: $.sheetHead,
5979
6075
  children: [/* @__PURE__ */ _("h2", {
5980
6076
  className: $.sheetTitle,
5981
- children: R.highlights
6077
+ children: z.highlights
5982
6078
  }), /* @__PURE__ */ _("button", {
5983
6079
  className: $.close,
5984
- onClick: () => z(!1),
5985
- children: R.close
6080
+ onClick: () => _e(!1),
6081
+ children: z.close
5986
6082
  })]
5987
- }), Array.from(new Set(ue.map((e) => e.turnId))).map((e, t) => /* @__PURE__ */ v("div", {
6083
+ }), Array.from(new Set(pe.map((e) => e.turnId))).map((e, t) => /* @__PURE__ */ v("div", {
5988
6084
  className: $.group,
5989
6085
  children: [/* @__PURE__ */ _("h3", {
5990
6086
  className: $.groupTitle,
5991
- children: Ae(R.paragraph, { index: t + 1 })
6087
+ children: je(z.paragraph, { index: t + 1 })
5992
6088
  }), /* @__PURE__ */ _("div", {
5993
6089
  className: $.marks,
5994
- children: ue.filter((t) => t.turnId === e).map((t, n) => /* @__PURE__ */ _("button", {
6090
+ children: pe.filter((t) => t.turnId === e).map((t, n) => /* @__PURE__ */ _("button", {
5995
6091
  type: "button",
5996
6092
  className: $.mark,
5997
6093
  onClick: () => {
5998
- z(!1), setTimeout(() => {
6094
+ _e(!1), setTimeout(() => {
5999
6095
  let t = document.getElementById(`turn-${e}`), n = document.querySelector(".ick-chat-feed"), r = document.querySelector(".ick-chat-header");
6000
6096
  if (t && n) {
6001
6097
  let e = r ? r.offsetHeight : 80;
@@ -6015,15 +6111,15 @@ function bi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
6015
6111
  }, e))]
6016
6112
  })
6017
6113
  }) }),
6018
- /* @__PURE__ */ _(y, { children: pe && l && /* @__PURE__ */ _(gi, {
6019
- activeReply: pe,
6020
- onClose: () => me(null),
6114
+ /* @__PURE__ */ _(y, { children: be && l && /* @__PURE__ */ _(_i, {
6115
+ activeReply: be,
6116
+ onClose: () => xe(null),
6021
6117
  onSendMessage: l
6022
6118
  }, "thread-popup") })
6023
6119
  ]
6024
6120
  });
6025
6121
  }
6026
6122
  //#endregion
6027
- export { De as $, fn as A, _t as B, Sn as C, vn as D, bn as E, Vt as F, Qe as G, st as H, Mt as I, Re as J, G as K, At as L, tn as M, qt as N, gn as O, Qt as P, ke as Q, Ot as R, Cn as S, Tn as T, ot as U, ht as V, rt as W, Fe as X, Le as Y, je as Z, Ln as _, si as a, jn as b, Xr as c, Nr as d, V as et, Ar as f, Fn as g, zn as h, gi as i, cn as j, mn as k, Br as l, Un as m, vi as n, ai as o, br as p, Be as q, _i as r, Zr as s, bi as t, Rr as u, In as v, wn as w, xn as x, Nn as y, Ct as z };
6123
+ export { Oe as $, fn as A, _t as B, Sn as C, vn as D, bn as E, Vt as F, Qe as G, st as H, Mt as I, Re as J, Ke as K, At as L, tn as M, qt as N, gn as O, Qt as P, Ae as Q, Ot as R, Cn as S, Tn as T, ot as U, ht as V, rt as W, Fe as X, Le as Y, Me as Z, Ln as _, ci as a, jn as b, Zr as c, Pr as d, V as et, Ar as f, Fn as g, zn as h, _i as i, cn as j, mn as k, Vr as l, Un as m, yi as n, oi as o, br as p, Be as q, vi as r, Qr as s, Si as t, zr as u, In as v, wn as w, xn as x, Nn as y, Ct as z };
6028
6124
 
6029
- //# sourceMappingURL=ChatExperience-Bawy_cnn.js.map
6125
+ //# sourceMappingURL=ChatExperience-BeLjIxHU.js.map