inline-chat-kit 0.58.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 N, ChevronRight as ee, Copy as P, CornerDownLeft as F, File as I, FileText as te, Film as L, Highlighter as ne, Image as re, 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 z, Paperclip as de, 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";
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",
@@ -255,7 +255,7 @@ function je(e, t) {
255
255
  }
256
256
  //#endregion
257
257
  //#region src/Attachments/Attachments.tsx
258
- function U(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,10 +266,10 @@ function U(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" ? re : t === "video" ? L : t === "audio" ? ue : e === "application/pdf" || t === "text" ? te : I, {
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
  });
@@ -280,11 +280,11 @@ function Fe({ attachments: e, onRemove: t, labels: n, className: r, ...i }) {
280
280
  className: [De.list, r ?? ""].filter(Boolean).join(" "),
281
281
  ...i,
282
282
  children: e.map((e) => {
283
- let n = U(e.size);
283
+ let n = Me(e.size);
284
284
  return /* @__PURE__ */ v("li", {
285
285
  className: De.item,
286
- "data-picture": Me(e) || void 0,
287
- children: [Me(e) ? /* @__PURE__ */ _("span", {
286
+ "data-picture": U(e) || void 0,
287
+ children: [U(e) ? /* @__PURE__ */ _("span", {
288
288
  className: De.picture,
289
289
  style: { backgroundImage: `url("${Ne(e.url)}")` },
290
290
  role: "img",
@@ -365,7 +365,7 @@ 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,
@@ -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
  }),
@@ -533,7 +533,7 @@ function ze() {
533
533
  {
534
534
  id: "attach",
535
535
  label: e.attach,
536
- icon: /* @__PURE__ */ _(de, {
536
+ icon: /* @__PURE__ */ _(z, {
537
537
  size: 16,
538
538
  "aria-hidden": !0
539
539
  })
@@ -541,7 +541,7 @@ function ze() {
541
541
  {
542
542
  id: "design",
543
543
  label: e.design,
544
- icon: /* @__PURE__ */ _(z, {
544
+ icon: /* @__PURE__ */ _(de, {
545
545
  size: 16,
546
546
  "aria-hidden": !0
547
547
  })
@@ -944,14 +944,14 @@ 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, busy: j = !1, placeholder: M, menu: N, labels: ee, animationConfig: P, style: F }, I) {
948
- let te = l(), L = H("input", ee), ne = H("voice"), re = M ?? L.placeholder, ie = N !== !1, R = p(null), ae = p(null), oe = p(null), se = p(0), ce = p(!1), le = p(null), [ue, z] = m(!1), [de, 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);
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
950
  Oe.current && clearTimeout(Oe.current);
951
951
  }, []);
952
- let ke = w(), Ae = p(e), je = p(P);
953
- je.current = P;
954
- let U = p(null), [Me, Ne] = m([]), Pe = s ?? Me, Ie = p(Pe);
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
955
  Ie.current = Pe;
956
956
  let ze = p([]);
957
957
  c(() => () => {
@@ -990,7 +990,7 @@ var nt = .9, rt = {
990
990
  }
991
991
  Ne((t) => (Ve(t.find((t) => t.id === e)?.url), t.filter((t) => t.id !== e)));
992
992
  }, [f, Ve]);
993
- u(I, () => ({
993
+ u(F, () => ({
994
994
  focus: (e) => R.current?.focus(e),
995
995
  setValue: (e) => {
996
996
  let t = R.current;
@@ -1021,8 +1021,8 @@ var nt = .9, rt = {
1021
1021
  Ge.current = null, R.current?.focus();
1022
1022
  },
1023
1023
  meterRef: We,
1024
- labels: ne
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 = P, dt = J ? {
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,
@@ -1150,12 +1150,12 @@ var nt = .9, rt = {
1150
1150
  }, [t]), /* @__PURE__ */ _(x, {
1151
1151
  reducedMotion: "user",
1152
1152
  children: /* @__PURE__ */ _(b, {
1153
- id: te,
1153
+ id: ne,
1154
1154
  children: /* @__PURE__ */ v("div", {
1155
1155
  className: W.wrap,
1156
- onMouseEnter: () => z(!0),
1157
- onMouseLeave: () => z(!1),
1158
- style: F,
1156
+ onMouseEnter: () => de(!0),
1157
+ onMouseLeave: () => de(!1),
1158
+ style: P,
1159
1159
  children: [
1160
1160
  /* @__PURE__ */ _(C.div, {
1161
1161
  className: `${W.root} ${K ? W.isGlassRoot : ""}`,
@@ -1163,8 +1163,8 @@ var nt = .9, rt = {
1163
1163
  animate: { filter: Se ? `blur(${J?.addCards?.inputBlur ?? 2}px)` : "blur(0px)" },
1164
1164
  style: {
1165
1165
  pointerEvents: Se ? "none" : "auto",
1166
- width: F?.width === "100%" ? "100%" : void 0,
1167
- maxWidth: F?.maxWidth
1166
+ width: P?.width === "100%" ? "100%" : void 0,
1167
+ maxWidth: P?.maxWidth
1168
1168
  },
1169
1169
  transition: {
1170
1170
  ...dt,
@@ -1175,7 +1175,7 @@ var nt = .9, rt = {
1175
1175
  }
1176
1176
  },
1177
1177
  children: /* @__PURE__ */ v(C.div, {
1178
- className: `${W.surface} ${K ? W.glass : ""} ${rt ? W.hovered : ""} ${de ? W.pulsed : ""}`,
1178
+ className: `${W.surface} ${K ? W.glass : ""} ${rt ? W.hovered : ""} ${z ? W.pulsed : ""}`,
1179
1179
  style: {
1180
1180
  alignItems: "stretch",
1181
1181
  flexDirection: "column",
@@ -1187,7 +1187,7 @@ var nt = .9, rt = {
1187
1187
  children: [
1188
1188
  /* @__PURE__ */ _("input", {
1189
1189
  type: "file",
1190
- ref: U,
1190
+ ref: Me,
1191
1191
  accept: h,
1192
1192
  multiple: T,
1193
1193
  style: { display: "none" },
@@ -1279,8 +1279,8 @@ var nt = .9, rt = {
1279
1279
  spellCheck: !1,
1280
1280
  role: "textbox",
1281
1281
  "aria-multiline": "true",
1282
- "aria-label": re,
1283
- "data-placeholder": q ? "" : re
1282
+ "aria-label": L,
1283
+ "data-placeholder": q ? "" : L
1284
1284
  })
1285
1285
  })
1286
1286
  }),
@@ -1356,7 +1356,7 @@ var nt = .9, rt = {
1356
1356
  "aria-busy": G.state === "requesting" || G.state === "transcribing",
1357
1357
  "aria-pressed": G.state === "listening",
1358
1358
  disabled: G.state === "denied",
1359
- "aria-label": G.state === "listening" ? L.stopListening : G.state === "requesting" ? L.waitingForMicrophone : G.state === "transcribing" ? L.cancelTranscription : G.state === "denied" ? L.microphoneBlocked : L.dictate,
1359
+ "aria-label": G.state === "listening" ? I.stopListening : G.state === "requesting" ? I.waitingForMicrophone : G.state === "transcribing" ? I.cancelTranscription : G.state === "denied" ? I.microphoneBlocked : I.dictate,
1360
1360
  style: {
1361
1361
  width: "100%",
1362
1362
  height: "100%",
@@ -1446,8 +1446,8 @@ var nt = .9, rt = {
1446
1446
  onClick: (e) => {
1447
1447
  e.stopPropagation(), k?.();
1448
1448
  },
1449
- "aria-label": L.cancelEdit,
1450
- title: L.cancelEdit,
1449
+ "aria-label": I.cancelEdit,
1450
+ title: I.cancelEdit,
1451
1451
  style: {
1452
1452
  width: "100%",
1453
1453
  height: "100%"
@@ -1483,8 +1483,8 @@ var nt = .9, rt = {
1483
1483
  onClick: (e) => {
1484
1484
  e.stopPropagation(), Ce(!0);
1485
1485
  },
1486
- "aria-label": L.add,
1487
- title: L.add,
1486
+ "aria-label": I.add,
1487
+ title: I.add,
1488
1488
  style: {
1489
1489
  width: "100%",
1490
1490
  height: "100%"
@@ -1551,7 +1551,7 @@ var nt = .9, rt = {
1551
1551
  e.stopPropagation(), Xe ? i?.() : j || r(t, Pe);
1552
1552
  },
1553
1553
  disabled: Ze,
1554
- "aria-label": Xe ? L.stop : A ? L.save : L.send,
1554
+ "aria-label": Xe ? I.stop : A ? I.save : I.send,
1555
1555
  style: {
1556
1556
  flexShrink: 0,
1557
1557
  width: 28
@@ -1568,10 +1568,10 @@ var nt = .9, rt = {
1568
1568
  /* @__PURE__ */ _(Be, {
1569
1569
  isAddOpen: Se,
1570
1570
  setIsAddOpen: Ce,
1571
- items: N || void 0,
1571
+ items: ee || void 0,
1572
1572
  onAdd: (e, t) => {
1573
- let n = N ? N.find((e) => e.id === t) : void 0;
1574
- t === "attach" && !n?.onSelect && U.current?.click(), a?.();
1573
+ let n = ee ? ee.find((e) => e.id === t) : void 0;
1574
+ t === "attach" && !n?.onSelect && Me.current?.click(), a?.();
1575
1575
  },
1576
1576
  showInlineGlyph: ut,
1577
1577
  showButtons: ge,
@@ -1590,7 +1590,7 @@ var nt = .9, rt = {
1590
1590
  lt && (G.state === "denied" || G.state === "failed") && /* @__PURE__ */ _("p", {
1591
1591
  className: W.voiceNote,
1592
1592
  "data-tone": G.state,
1593
- children: G.state === "denied" ? L.microphoneBlockedHelp : G.error ?? ne.couldNotOpen
1593
+ children: G.state === "denied" ? I.microphoneBlockedHelp : G.error ?? re.couldNotOpen
1594
1594
  })
1595
1595
  ]
1596
1596
  })
@@ -1681,7 +1681,11 @@ function ht({ onSend: e, revealSpeed: t = ct, sentencePause: n = lt, announcemen
1681
1681
  let n = g.current.get(e);
1682
1682
  n ? n.push(t) : g.current.set(e, [t]), C();
1683
1683
  }, [C]), E = o((e, t) => {
1684
- T(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
+ });
1685
1689
  }, [T]);
1686
1690
  c(() => () => {
1687
1691
  f.current !== null && cancelAnimationFrame(f.current), d.current?.abort();
@@ -1743,7 +1747,7 @@ function ht({ onSend: e, revealSpeed: t = ct, sentencePause: n = lt, announcemen
1743
1747
  versions: s,
1744
1748
  versionIndex: s.length - 1
1745
1749
  }), A("responding"), i === "at-send" && !n && D();
1746
- let c = "";
1750
+ let c = "", l = /* @__PURE__ */ new Set();
1747
1751
  try {
1748
1752
  let n = v.current(t, {
1749
1753
  signal: a.signal,
@@ -1752,7 +1756,14 @@ function ht({ onSend: e, revealSpeed: t = ct, sentencePause: n = lt, announcemen
1752
1756
  });
1753
1757
  if (pt(n)) for await (let t of n) {
1754
1758
  if (a.signal.aborted) break;
1755
- typeof t == "string" ? (c += t, w(e, c)) : T(e, t);
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
+ }
1756
1767
  }
1757
1768
  else c = await n ?? "", await k(e, c, a.signal);
1758
1769
  } catch (e) {
@@ -1868,7 +1879,7 @@ var Y = {
1868
1879
  }
1869
1880
  return window;
1870
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) {
1871
- let D = H("header"), k = l ?? D.back, A = d ?? D.more, j = p(null), [M, N] = m(!1), [ee, 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) => {
1872
1883
  j.current = e, typeof E == "function" ? E(e) : E && (E.current = e);
1873
1884
  }, [E]);
1874
1885
  c(() => {
@@ -1876,20 +1887,20 @@ var Y = {
1876
1887
  if (!e || x === !1 || typeof ResizeObserver > "u") return;
1877
1888
  let t = new ResizeObserver(([e]) => {
1878
1889
  let t = e.contentRect.width;
1879
- N(t > 0 && t < x);
1890
+ ee(t > 0 && t < x);
1880
1891
  });
1881
1892
  return t.observe(e), () => t.disconnect();
1882
1893
  }, [x]), c(() => {
1883
1894
  if (!b) return;
1884
1895
  let e = St(j.current), t = () => {
1885
1896
  let t = e === window ? window.scrollY : e.scrollTop;
1886
- P(t > 0);
1897
+ N(t > 0);
1887
1898
  };
1888
1899
  return t(), e.addEventListener("scroll", t, { passive: !0 }), () => e.removeEventListener("scroll", t);
1889
1900
  }, [b]);
1890
- let I = x !== !1 && M, te = I ? u.filter((e) => e.pinned) : u, L = I ? u.filter((e) => !e.pinned) : [], ne = 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";
1891
1902
  return /* @__PURE__ */ v(S ? "header" : "div", {
1892
- ref: F,
1903
+ ref: P,
1893
1904
  className: [
1894
1905
  Y.header,
1895
1906
  yt[h],
@@ -1898,7 +1909,7 @@ var Y = {
1898
1909
  y ? Y.sticky : "",
1899
1910
  w ?? ""
1900
1911
  ].filter(Boolean).join(" "),
1901
- "data-scrolled": b && ee || void 0,
1912
+ "data-scrolled": b && te || void 0,
1902
1913
  ...T,
1903
1914
  children: [/* @__PURE__ */ v("div", {
1904
1915
  className: Y.start,
@@ -1927,7 +1938,7 @@ var Y = {
1927
1938
  }),
1928
1939
  (e || t) && /* @__PURE__ */ v("div", {
1929
1940
  className: Y.titles,
1930
- children: [e && /* @__PURE__ */ _(ne, {
1941
+ children: [e && /* @__PURE__ */ _(re, {
1931
1942
  className: [Y.title, i ? Y.truncate : ""].filter(Boolean).join(" "),
1932
1943
  title: typeof e == "string" && i ? e : void 0,
1933
1944
  children: e
@@ -1941,12 +1952,12 @@ var Y = {
1941
1952
  className: Y.end,
1942
1953
  children: [
1943
1954
  C,
1944
- te.map((e) => /* @__PURE__ */ _(wt, {
1955
+ ne.map((e) => /* @__PURE__ */ _(wt, {
1945
1956
  action: e,
1946
1957
  size: h
1947
1958
  }, e.id)),
1948
- L.length > 0 && /* @__PURE__ */ _(Tt, {
1949
- actions: L,
1959
+ I.length > 0 && /* @__PURE__ */ _(Tt, {
1960
+ actions: I,
1950
1961
  size: h,
1951
1962
  label: A
1952
1963
  })
@@ -2086,9 +2097,9 @@ function Ot({ text: e, onCopy: t, onRegenerate: n, onFeedback: r, feedback: i =
2086
2097
  ].filter(Boolean).join(" "),
2087
2098
  ...f,
2088
2099
  children: [
2089
- /* @__PURE__ */ _(V, {
2100
+ e.trim() && /* @__PURE__ */ _(V, {
2090
2101
  variant: "ghost",
2091
- icon: _(h ? j : P, {
2102
+ icon: _(h ? j : N, {
2092
2103
  size: 14,
2093
2104
  "aria-hidden": !0
2094
2105
  }),
@@ -2158,7 +2169,7 @@ function At({ total: e, index: t, onSelect: n, labels: r, className: i, ...a })
2158
2169
  onPointerDown: (e) => e.stopPropagation(),
2159
2170
  disabled: s === 0,
2160
2171
  "aria-label": o.previous,
2161
- children: /* @__PURE__ */ _(N, {
2172
+ children: /* @__PURE__ */ _(ee, {
2162
2173
  size: 14,
2163
2174
  "aria-hidden": !0
2164
2175
  })
@@ -2181,7 +2192,7 @@ function At({ total: e, index: t, onSelect: n, labels: r, className: i, ...a })
2181
2192
  onPointerDown: (e) => e.stopPropagation(),
2182
2193
  disabled: s === e - 1,
2183
2194
  "aria-label": o.next,
2184
- children: /* @__PURE__ */ _(ee, {
2195
+ children: /* @__PURE__ */ _(te, {
2185
2196
  size: 14,
2186
2197
  "aria-hidden": !0
2187
2198
  })
@@ -2515,7 +2526,7 @@ function tn({ code: e, lang: t, label: n, copyable: r = !0, onCopy: i, copiedFor
2515
2526
  onClick: C,
2516
2527
  onPointerDown: (e) => e.stopPropagation(),
2517
2528
  "aria-label": h ? d.copied : d.copyCode,
2518
- children: [_(h ? j : P, {
2529
+ children: [_(h ? j : N, {
2519
2530
  size: 13,
2520
2531
  "aria-hidden": !0
2521
2532
  }), /* @__PURE__ */ _("span", {
@@ -3375,10 +3386,10 @@ function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
3375
3386
  type: "spring",
3376
3387
  visualDuration: j.visualDuration,
3377
3388
  bounce: j.bounce
3378
- }, N = {
3389
+ }, ee = {
3379
3390
  hidden: { transition: { staggerChildren: O ? 0 : j.stagger } },
3380
3391
  shown: { transition: { staggerChildren: O ? 0 : j.stagger } }
3381
- }, ee = (e, t = 0) => O ? { duration: 0 } : {
3392
+ }, te = (e, t = 0) => O ? { duration: 0 } : {
3382
3393
  type: "spring",
3383
3394
  visualDuration: j.rowDuration,
3384
3395
  bounce: j.rowBounce,
@@ -3387,19 +3398,19 @@ function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
3387
3398
  duration: e,
3388
3399
  delay: t
3389
3400
  }
3390
- }, P = {
3401
+ }, N = {
3391
3402
  hidden: {
3392
3403
  opacity: 0,
3393
3404
  y: O ? 0 : j.rowOffset,
3394
- transition: ee(j.fadeOut)
3405
+ transition: te(j.fadeOut)
3395
3406
  },
3396
3407
  shown: {
3397
3408
  opacity: 1,
3398
3409
  y: 0,
3399
- transition: ee(j.fadeIn, O ? 0 : j.fadeInDelay)
3410
+ transition: te(j.fadeIn, O ? 0 : j.fadeInDelay)
3400
3411
  }
3401
- }, F = {
3402
- variants: N,
3412
+ }, P = {
3413
+ variants: ee,
3403
3414
  initial: "hidden",
3404
3415
  animate: "shown",
3405
3416
  exit: "hidden",
@@ -3436,9 +3447,9 @@ function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
3436
3447
  initial: !1,
3437
3448
  mode: "popLayout",
3438
3449
  children: k ? /* @__PURE__ */ _(C.div, {
3439
- ...F,
3450
+ ...P,
3440
3451
  children: /* @__PURE__ */ v(C.div, {
3441
- variants: P,
3452
+ variants: N,
3442
3453
  className: Pn.summary,
3443
3454
  children: [/* @__PURE__ */ v("span", {
3444
3455
  className: Pn.count,
@@ -3454,9 +3465,9 @@ function Ln({ id: e, title: t, questions: n, answers: r, activeIndex: i = null,
3454
3465
  })
3455
3466
  }, "summary") : /* @__PURE__ */ _(C.div, {
3456
3467
  className: Pn.list,
3457
- ...F,
3468
+ ...P,
3458
3469
  children: n.map((e, t) => /* @__PURE__ */ _(C.div, {
3459
- variants: P,
3470
+ variants: N,
3460
3471
  className: Pn.row,
3461
3472
  children: /* @__PURE__ */ _(Nn, {
3462
3473
  question: e,
@@ -4081,18 +4092,18 @@ var xr = {
4081
4092
  }), t.trim();
4082
4093
  };
4083
4094
  function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlightComplete: a, onReplyInThread: s, sources: u, onSelectSource: d }) {
4084
- 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, N] = m(0), ee = p(null), P = p(null), [F, I] = m(null), [te, L] = m(null), ne = o((e) => {
4085
- e.viaKeyboard && (P.current = document.activeElement), N(0), j(e);
4086
- }, []), re = o((e = "none") => {
4087
- let t = P.current;
4088
- P.current = null, j(null), e !== "none" && (e === "restore" && t?.isConnected ? t.focus() : g.current?.focus());
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") => {
4098
+ let t = N.current;
4099
+ N.current = null, j(null), e !== "none" && (e === "restore" && t?.isConnected ? t.focus() : g.current?.focus());
4089
4100
  }, []);
4090
4101
  c(() => {
4091
4102
  let e = (e) => {
4092
- A && g.current && !g.current.contains(e.target) && re();
4103
+ A && g.current && !g.current.contains(e.target) && L();
4093
4104
  };
4094
4105
  return window.addEventListener("pointerdown", e), () => window.removeEventListener("pointerdown", e);
4095
- }, [A, re]);
4106
+ }, [A, L]);
4096
4107
  let ie = f(() => vr(t), [t]), R = ie.tokens, oe = p(w), se = p(a), ce = p(A);
4097
4108
  c(() => {
4098
4109
  oe.current = w, se.current = a, ce.current = A;
@@ -4115,14 +4126,14 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4115
4126
  R
4116
4127
  ]), ue = (e, t = !1) => {
4117
4128
  let n = e.kind === "path" ? Tr(e.item.points) : Er(e.item.rects);
4118
- ne({
4129
+ re({
4119
4130
  x: n.x,
4120
4131
  y: n.y,
4121
4132
  pathId: e.id,
4122
4133
  kind: e.kind,
4123
4134
  viaKeyboard: t
4124
4135
  });
4125
- }, z = o((e, t, n = !1) => {
4136
+ }, de = o((e, t, n = !1) => {
4126
4137
  let r = g.current, i = t.trim();
4127
4138
  if (!r || !i) return;
4128
4139
  let a = /* @__PURE__ */ new Set();
@@ -4157,14 +4168,14 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4157
4168
  highlightedIndices: a
4158
4169
  }]);
4159
4170
  let d = Er(l);
4160
- ne({
4171
+ re({
4161
4172
  x: d.x,
4162
4173
  y: d.y,
4163
4174
  pathId: u,
4164
4175
  kind: "selection",
4165
4176
  viaKeyboard: n
4166
4177
  });
4167
- }, [ne]);
4178
+ }, [re]);
4168
4179
  c(() => {
4169
4180
  let e = (e) => {
4170
4181
  if (ce.current) return;
@@ -4173,7 +4184,7 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4173
4184
  let n = window.getSelection();
4174
4185
  if (!n || n.isCollapsed || n.rangeCount === 0 || !n.toString().trim()) return;
4175
4186
  let r = n.getRangeAt(0);
4176
- t.contains(r.commonAncestorContainer) && (z(r, n.toString(), e), requestAnimationFrame(() => window.getSelection()?.removeAllRanges()));
4187
+ t.contains(r.commonAncestorContainer) && (de(r, n.toString(), e), requestAnimationFrame(() => window.getSelection()?.removeAllRanges()));
4177
4188
  }, t = () => e(!1), n = (t) => {
4178
4189
  let n = (t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "a";
4179
4190
  !t.shiftKey && !n || e(!0);
@@ -4181,9 +4192,9 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4181
4192
  return document.addEventListener("mouseup", t), document.addEventListener("keyup", n), () => {
4182
4193
  document.removeEventListener("mouseup", t), document.removeEventListener("keyup", n);
4183
4194
  };
4184
- }, [z]);
4185
- let [de, fe] = m(i);
4186
- de !== i && (fe(i), j(null));
4195
+ }, [de]);
4196
+ let [z, fe] = m(i);
4197
+ z !== i && (fe(i), j(null));
4187
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 : {
4188
4199
  from: Math.min(ge, me),
4189
4200
  to: Math.max(ge, me)
@@ -4198,28 +4209,28 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4198
4209
  r.setStartBefore(t), r.setEndAfter(n);
4199
4210
  let i = "";
4200
4211
  for (let e = ye.from; e <= ye.to; e++) i += R[e];
4201
- z(r, i, !0), be();
4202
- }, Ce = () => [...ee.current?.querySelectorAll("[role=\"menuitem\"]") ?? []];
4212
+ de(r, i, !0), be();
4213
+ }, Ce = () => [...te.current?.querySelectorAll("[role=\"menuitem\"]") ?? []];
4203
4214
  c(() => {
4204
4215
  if (!A) return;
4205
4216
  let e = Ce();
4206
4217
  if (e.length === 0) return;
4207
- let t = ee.current?.contains(document.activeElement);
4218
+ let t = te.current?.contains(document.activeElement);
4208
4219
  (A.viaKeyboard || t) && e[Math.min(M, e.length - 1)]?.focus();
4209
4220
  }, [A, M]);
4210
4221
  let we = (e) => {
4211
4222
  let t = Ce().length;
4212
4223
  if (t === 0) return;
4213
4224
  let n = (n) => {
4214
- e.preventDefault(), e.stopPropagation(), N((e) => (e + n + t) % t);
4225
+ e.preventDefault(), e.stopPropagation(), ee((e) => (e + n + t) % t);
4215
4226
  };
4216
4227
  switch (e.key) {
4217
4228
  case "ArrowRight":
4218
4229
  case "ArrowDown": return n(1);
4219
4230
  case "ArrowLeft":
4220
4231
  case "ArrowUp": return n(-1);
4221
- case "Home": return e.preventDefault(), N(0);
4222
- case "End": return e.preventDefault(), N(t - 1);
4232
+ case "Home": return e.preventDefault(), ee(0);
4233
+ case "End": return e.preventDefault(), ee(t - 1);
4223
4234
  default: return;
4224
4235
  }
4225
4236
  }, B = (e) => {
@@ -4238,7 +4249,7 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4238
4249
  case "End": return n(pe[pe.length - 1]);
4239
4250
  case "Enter":
4240
4251
  case " ": return ye ? (e.preventDefault(), xe()) : void 0;
4241
- case "Escape": return !A && me === null ? void 0 : (e.preventDefault(), re("restore"), be());
4252
+ case "Escape": return !A && me === null ? void 0 : (e.preventDefault(), L("restore"), be());
4242
4253
  default: return;
4243
4254
  }
4244
4255
  }, Te = (e, t, n) => {
@@ -4249,7 +4260,7 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4249
4260
  }
4250
4261
  }, Ee = (e) => {
4251
4262
  if (A) {
4252
- re();
4263
+ L();
4253
4264
  return;
4254
4265
  }
4255
4266
  if (i === "precise" || e.button !== 0 && e.pointerType === "mouse") return;
@@ -4264,7 +4275,7 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4264
4275
  }],
4265
4276
  highlightedIndices: /* @__PURE__ */ new Set()
4266
4277
  };
4267
- D(s), re(), Te(e.clientX, e.clientY, s.highlightedIndices);
4278
+ D(s), L(), Te(e.clientX, e.clientY, s.highlightedIndices);
4268
4279
  }, De = (e) => {
4269
4280
  if (i === "precise" || !E) return;
4270
4281
  let t = g.current.getBoundingClientRect(), n = e.clientX - t.left, r = e.clientY - t.top, a = n - r * Cr;
@@ -4284,7 +4295,7 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4284
4295
  if (i !== "precise" && (k(!1), E)) {
4285
4296
  if (e.currentTarget.releasePointerCapture(e.pointerId), S((e) => [...e, E]), E.highlightedIndices.size > 0) {
4286
4297
  let e = Tr(E.points);
4287
- ne({
4298
+ re({
4288
4299
  x: e.x,
4289
4300
  y: e.y,
4290
4301
  pathId: E.id,
@@ -4298,10 +4309,10 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4298
4309
  }, Ae = (e) => {
4299
4310
  let t = b.find((t) => t.id === e);
4300
4311
  return t ? Dr(t.highlightedIndices, R) : "";
4301
- }, U = (e) => {
4312
+ }, Me = (e) => {
4302
4313
  let t = A?.viaKeyboard;
4303
- A?.kind === "selection" ? T((t) => t.filter((t) => t.id !== e)) : S((t) => t.filter((t) => t.id !== e)), re(t ? "container" : "none");
4304
- }, Me = () => {
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 = () => {
4305
4316
  let e = A?.viaKeyboard;
4306
4317
  if (A && s) {
4307
4318
  if (A.kind === "selection") {
@@ -4319,17 +4330,19 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4319
4330
  t && s(e, t.getBoundingClientRect());
4320
4331
  }
4321
4332
  }
4322
- re(e ? "restore" : "none");
4333
+ L(e ? "restore" : "none");
4323
4334
  }, Ne = (e) => {
4324
- let t = R[e], n = !1;
4335
+ let t = R[e];
4336
+ if (!r) return t;
4337
+ let n = !1;
4325
4338
  A && (n = (A.kind === "path" ? b.find((e) => e.id === A.pathId) : w.find((e) => e.id === A.pathId))?.highlightedIndices?.has(e) ?? !1);
4326
- let r = !1;
4327
- return F && (r = (b.find((e) => e.id === F) ?? w.find((e) => e.id === F))?.highlightedIndices?.has(e) ?? !1), /* @__PURE__ */ _("span", {
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", {
4328
4341
  "data-index": e,
4329
4342
  className: xr.token,
4330
4343
  "data-space": !t.trim() || void 0,
4331
4344
  "data-active": n || void 0,
4332
- "data-pressed": r || void 0,
4345
+ "data-pressed": i || void 0,
4333
4346
  "data-kbd-cursor": me === e || void 0,
4334
4347
  "data-kbd-selected": ye && e >= ye.from && e <= ye.to || void 0,
4335
4348
  children: t
@@ -4403,23 +4416,23 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4403
4416
  className: xr.marker,
4404
4417
  d: t.d,
4405
4418
  "data-cursor": "pointer",
4406
- "data-pressed": F === t.id || void 0,
4407
- "data-active": A?.pathId === t.id || te === t.id || void 0,
4419
+ "data-pressed": P === t.id || void 0,
4420
+ "data-active": A?.pathId === t.id || ne === t.id || void 0,
4408
4421
  "data-dimmed": A && A.pathId !== t.id || void 0,
4409
4422
  style: { pointerEvents: O ? "none" : "stroke" },
4410
4423
  onPointerDown: (e) => {
4411
- O || (e.stopPropagation(), I(t.id));
4424
+ O || (e.stopPropagation(), F(t.id));
4412
4425
  },
4413
4426
  onPointerUp: (e) => {
4414
- F === t.id && (e.stopPropagation(), ue(t), I(null));
4427
+ P === t.id && (e.stopPropagation(), ue(t), F(null));
4415
4428
  },
4416
- onPointerLeave: () => I(null),
4417
- onPointerCancel: () => I(null)
4429
+ onPointerLeave: () => F(null),
4430
+ onPointerCancel: () => F(null)
4418
4431
  }), /* @__PURE__ */ _("path", {
4419
4432
  className: xr.shimmer,
4420
4433
  d: t.d,
4421
4434
  pathLength: 1,
4422
- "data-active": A?.pathId === t.id || te === t.id || void 0
4435
+ "data-active": A?.pathId === t.id || ne === t.id || void 0
4423
4436
  })] }, t.id)), E && /* @__PURE__ */ _("path", {
4424
4437
  className: xr.marker,
4425
4438
  d: wr(E.points)
@@ -4433,8 +4446,8 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4433
4446
  type: "button",
4434
4447
  className: xr.srOnly,
4435
4448
  onPointerDown: (e) => e.stopPropagation(),
4436
- onFocus: () => L(e.id),
4437
- onBlur: () => L(null),
4449
+ onFocus: () => I(e.id),
4450
+ onBlur: () => I(null),
4438
4451
  onClick: (t) => {
4439
4452
  t.stopPropagation(), ue(e, !0);
4440
4453
  },
@@ -4442,12 +4455,12 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4442
4455
  }, e.id))
4443
4456
  }),
4444
4457
  /* @__PURE__ */ _(y, { children: r && A && /* @__PURE__ */ v(C.div, {
4445
- ref: ee,
4458
+ ref: te,
4446
4459
  role: "menu",
4447
4460
  "aria-label": h.menu,
4448
4461
  onKeyDown: we,
4449
4462
  onBlur: (e) => {
4450
- e.currentTarget.contains(e.relatedTarget) || re();
4463
+ e.currentTarget.contains(e.relatedTarget) || L();
4451
4464
  },
4452
4465
  initial: { opacity: 0 },
4453
4466
  animate: {
@@ -4494,7 +4507,7 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4494
4507
  tabIndex: M === 0 ? 0 : -1,
4495
4508
  icon: /* @__PURE__ */ _(ae, { size: 14 }),
4496
4509
  onClick: (e) => {
4497
- e.stopPropagation(), Me();
4510
+ e.stopPropagation(), U();
4498
4511
  },
4499
4512
  title: h.reply,
4500
4513
  children: h.reply
@@ -4526,7 +4539,7 @@ function Ar({ text: t, marking: r = !0, selectionMode: i = "marker", onHighlight
4526
4539
  tabIndex: M === 1 ? 0 : -1,
4527
4540
  icon: /* @__PURE__ */ _(Se, { size: 14 }),
4528
4541
  onClick: (e) => {
4529
- e.stopPropagation(), U(A.pathId);
4542
+ e.stopPropagation(), Me(A.pathId);
4530
4543
  },
4531
4544
  title: h.remove,
4532
4545
  "aria-label": h.remove
@@ -4546,15 +4559,131 @@ var jr = {
4546
4559
  actions: "ick-actions-CWq8"
4547
4560
  }, Mr = (e) => {
4548
4561
  navigator.clipboard?.writeText(e);
4549
- }, 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", 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: N, composerMenu: ee, labels: P, className: F, onTranscribe: I }) {
4550
- let te = q(), L = te ? 0 : -16, ne = e.parts ?? [], re = ne.find((e) => e.kind === "sources")?.sources, ie = /* @__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, {
4551
4680
  id: `turn-${e.id}`,
4552
- className: [jr.turn, F ?? ""].filter(Boolean).join(" "),
4681
+ className: [jr.turn, P ?? ""].filter(Boolean).join(" "),
4553
4682
  "data-active-input": t || void 0,
4554
4683
  "aria-busy": e.state === "responding" || void 0,
4555
4684
  initial: {
4556
4685
  opacity: 0,
4557
- y: L
4686
+ y: I
4558
4687
  },
4559
4688
  animate: {
4560
4689
  opacity: 1,
@@ -4562,10 +4691,10 @@ var jr = {
4562
4691
  },
4563
4692
  exit: {
4564
4693
  opacity: 0,
4565
- y: L
4694
+ y: I
4566
4695
  },
4567
4696
  transition: {
4568
- duration: te ? .15 : .4,
4697
+ duration: ne ? .15 : .4,
4569
4698
  ease: [
4570
4699
  .22,
4571
4700
  1,
@@ -4587,139 +4716,45 @@ var jr = {
4587
4716
  attachments: e.attachments,
4588
4717
  onStop: h,
4589
4718
  busy: g,
4590
- onTranscribe: I,
4719
+ onTranscribe: F,
4591
4720
  onCopy: x,
4592
4721
  onEdit: () => y?.(e.id),
4593
4722
  onCancelEdit: () => b?.(e.id),
4594
4723
  isEditing: e.ai.length > 0 && e.state === "typing",
4595
4724
  animationConfig: i,
4596
4725
  placeholder: r,
4597
- menu: ee
4726
+ menu: te
4598
4727
  })
4599
4728
  }), /* @__PURE__ */ v("div", {
4600
4729
  className: jr.body,
4601
4730
  children: [
4602
- ne.map((t) => {
4603
- switch (t.kind) {
4604
- case "reasoning": return /* @__PURE__ */ _(Vt, {
4605
- state: t.state,
4606
- duration: t.duration,
4607
- children: t.text ?? ""
4608
- }, t.id);
4609
- case "tool": return /* @__PURE__ */ _(cn, {
4610
- name: t.name ?? "",
4611
- state: t.state,
4612
- summary: t.summary,
4613
- input: t.input,
4614
- output: t.output,
4615
- error: t.error,
4616
- duration: t.duration
4617
- }, t.id);
4618
- case "tasks": return /* @__PURE__ */ _(mn, {
4619
- title: t.title,
4620
- tasks: t.tasks ?? [],
4621
- collapsible: t.collapsible
4622
- }, t.id);
4623
- case "chain": return /* @__PURE__ */ _(gn, {
4624
- steps: t.steps ?? [],
4625
- state: t.state,
4626
- duration: t.duration
4627
- }, t.id);
4628
- case "sources": return /* @__PURE__ */ _(vn, {
4629
- sources: t.sources ?? [],
4630
- title: t.title,
4631
- collapsible: t.collapsible
4632
- }, t.id);
4633
- case "approval": return /* @__PURE__ */ _(fn, {
4634
- title: t.title,
4635
- description: t.description,
4636
- decision: t.decision ?? null,
4637
- choices: t.choices,
4638
- onDecide: (n) => M?.(e.id, t.id, n),
4639
- children: t.tool && /* @__PURE__ */ _(cn, {
4640
- name: t.tool.name,
4641
- state: "pending",
4642
- input: t.tool.input,
4643
- defaultOpen: !0
4644
- })
4645
- }, t.id);
4646
- case "artifact": return /* @__PURE__ */ _(Un, {
4647
- id: t.id,
4648
- title: t.title,
4649
- meta: t.meta,
4650
- kind: t.preview,
4651
- lang: t.lang,
4652
- content: t.content,
4653
- state: t.state,
4654
- open: o === t.id,
4655
- onOpen: s ? (t) => s(e.id, t) : void 0
4656
- }, t.id);
4657
- case "notice": return /* @__PURE__ */ _(zn, {
4658
- tone: t.tone,
4659
- children: t.text
4660
- }, t.id);
4661
- case "question": return /* @__PURE__ */ _(Ln, {
4662
- id: t.id,
4663
- title: t.title,
4664
- questions: t.questions ?? [],
4665
- answers: t.answers ?? {},
4666
- activeIndex: t.activeIndex,
4667
- collapsible: t.collapsible,
4668
- readOnly: t.readOnly,
4669
- foldMotion: a,
4670
- onCommit: (n, r) => A?.(e.id, t.id, n, r),
4671
- onEdit: (n) => j?.(e.id, t.id, n)
4672
- }, t.id);
4673
- case "custom": {
4674
- let n = N?.(t, {
4675
- turnId: e.id,
4676
- openArtifact: (t) => c ? c(t) : s?.(e.id, t),
4677
- closeArtifact: () => c?.(null)
4678
- });
4679
- return n == null || n === !1 ? null : /* @__PURE__ */ _("div", {
4680
- className: jr.custom,
4681
- "data-part": "custom",
4682
- "data-part-type": t.type,
4683
- children: n
4684
- }, t.id);
4685
- }
4686
- }
4687
- }),
4688
- e.state === "responding" && !e.ai && ne.length === 0 && /* @__PURE__ */ _("div", {
4689
- className: jr.answer,
4690
- children: /* @__PURE__ */ _(Mt, {})
4691
- }),
4692
- e.ai && /* @__PURE__ */ v("div", {
4731
+ ie.map((t, n) => t.kind === "part" ? se(t.part) : /* @__PURE__ */ v("div", {
4693
4732
  className: jr.answer,
4694
4733
  children: [/* @__PURE__ */ _(Ar, {
4695
- text: e.ai,
4734
+ text: t.text,
4696
4735
  marking: d,
4697
4736
  selectionMode: u,
4698
- sources: re,
4737
+ sources: L,
4699
4738
  onHighlightComplete: d ? (t) => S?.(e.id, t) : void 0,
4700
4739
  onReplyInThread: d ? w : void 0
4701
- }), k && e.state === "resting" && /* @__PURE__ */ v("div", {
4702
- className: jr.actions,
4703
- children: [/* @__PURE__ */ _(At, {
4704
- total: e.versions?.length ?? 0,
4705
- index: e.versionIndex ?? 0,
4706
- onSelect: (t) => E?.(e.id, t)
4707
- }), /* @__PURE__ */ _(Ot, {
4708
- text: e.ai,
4709
- onCopy: x,
4710
- onRegenerate: T ? () => T(e.id) : void 0,
4711
- onFeedback: D ? (t) => D(e.id, t) : void 0,
4712
- feedback: O
4713
- })]
4714
- })]
4740
+ }), ae === n && oe]
4741
+ }, `prose-${t.from}`)),
4742
+ e.state === "responding" && !e.ai && re.length === 0 && /* @__PURE__ */ _("div", {
4743
+ className: jr.answer,
4744
+ children: /* @__PURE__ */ _(Mt, {})
4745
+ }),
4746
+ ae === ie.length && /* @__PURE__ */ _("div", {
4747
+ className: jr.answer,
4748
+ "data-actions-only": "",
4749
+ children: oe
4715
4750
  })
4716
4751
  ]
4717
4752
  })]
4718
4753
  });
4719
- return P ? /* @__PURE__ */ _(Ae, {
4720
- labels: P,
4721
- children: ie
4722
- }) : ie;
4754
+ return N ? /* @__PURE__ */ _(Ae, {
4755
+ labels: N,
4756
+ children: ce
4757
+ }) : ce;
4723
4758
  }, (e, t) => {
4724
4759
  let n = /* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)]);
4725
4760
  for (let r of n) {
@@ -4731,7 +4766,7 @@ var jr = {
4731
4766
  if (!Object.is(e[r], t[r])) return !1;
4732
4767
  }
4733
4768
  return !0;
4734
- }), Pr = {
4769
+ }), Fr = {
4735
4770
  context: "ick-context-ZOiv",
4736
4771
  ring: "ick-ring-uVUc",
4737
4772
  track: "ick-track---kg",
@@ -4740,7 +4775,7 @@ var jr = {
4740
4775
  };
4741
4776
  //#endregion
4742
4777
  //#region src/Context/Context.tsx
4743
- function Fr(e) {
4778
+ function Ir(e) {
4744
4779
  if (!Number.isFinite(e) || e < 0) return "";
4745
4780
  if (e >= 1e6) {
4746
4781
  let t = e / 1e6;
@@ -4752,11 +4787,11 @@ function Fr(e) {
4752
4787
  }
4753
4788
  return String(Math.round(e));
4754
4789
  }
4755
- var Ir = 6, Lr = 2 * Math.PI * Ir;
4756
- function Rr({ used: e, total: t, warnAt: n = .8, label: r, labels: i, className: a, ...o }) {
4757
- 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}%, ${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}` : ""}`;
4758
4793
  return /* @__PURE__ */ v("div", {
4759
- className: [Pr.context, a ?? ""].filter(Boolean).join(" "),
4794
+ className: [Fr.context, a ?? ""].filter(Boolean).join(" "),
4760
4795
  "data-warn": u || void 0,
4761
4796
  role: "meter",
4762
4797
  "aria-valuenow": l,
@@ -4766,31 +4801,31 @@ function Rr({ used: e, total: t, warnAt: n = .8, label: r, labels: i, className:
4766
4801
  title: f,
4767
4802
  ...o,
4768
4803
  children: [/* @__PURE__ */ v("svg", {
4769
- className: Pr.ring,
4804
+ className: Fr.ring,
4770
4805
  viewBox: "0 0 16 16",
4771
4806
  "aria-hidden": !0,
4772
4807
  focusable: "false",
4773
4808
  children: [/* @__PURE__ */ _("circle", {
4774
- className: Pr.track,
4809
+ className: Fr.track,
4775
4810
  cx: "8",
4776
4811
  cy: "8",
4777
- r: Ir
4812
+ r: Lr
4778
4813
  }), /* @__PURE__ */ _("circle", {
4779
- className: Pr.fill,
4814
+ className: Fr.fill,
4780
4815
  cx: "8",
4781
4816
  cy: "8",
4782
- r: Ir,
4783
- strokeDasharray: Lr,
4784
- strokeDashoffset: Lr * (1 - c),
4817
+ r: Lr,
4818
+ strokeDasharray: Rr,
4819
+ strokeDashoffset: Rr * (1 - c),
4785
4820
  transform: "rotate(-90 8 8)"
4786
4821
  })]
4787
4822
  }), d !== null && /* @__PURE__ */ _("span", {
4788
- className: Pr.label,
4823
+ className: Fr.label,
4789
4824
  children: d
4790
4825
  })]
4791
4826
  });
4792
4827
  }
4793
- var zr = {
4828
+ var Br = {
4794
4829
  pane: "ick-pane-Yv8Y",
4795
4830
  grabber: "ick-grabber-OhMd",
4796
4831
  head: "ick-head-p2-j",
@@ -4804,7 +4839,7 @@ var zr = {
4804
4839
  };
4805
4840
  //#endregion
4806
4841
  //#region src/Artifact/ArtifactPane.tsx
4807
- 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 }) {
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 }) {
4808
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);
4809
4844
  return c(() => {
4810
4845
  C.current?.focus({ preventScroll: !0 });
@@ -4823,29 +4858,29 @@ function Br({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expande
4823
4858
  return document.addEventListener("focusin", e), () => document.removeEventListener("focusin", e);
4824
4859
  }, [i]), /* @__PURE__ */ v("div", {
4825
4860
  ref: S,
4826
- className: [zr.pane, f ?? ""].filter(Boolean).join(" "),
4861
+ className: [Br.pane, f ?? ""].filter(Boolean).join(" "),
4827
4862
  "aria-labelledby": x,
4828
4863
  "aria-modal": i || void 0,
4829
4864
  role: i ? "dialog" : "complementary",
4830
4865
  ...m,
4831
4866
  children: [
4832
4867
  i && /* @__PURE__ */ _("span", {
4833
- className: zr.grabber,
4868
+ className: Br.grabber,
4834
4869
  "aria-hidden": !0
4835
4870
  }),
4836
4871
  /* @__PURE__ */ v("div", {
4837
- className: zr.head,
4872
+ className: Br.head,
4838
4873
  children: [
4839
4874
  /* @__PURE__ */ v("div", {
4840
- className: zr.headText,
4875
+ className: Br.headText,
4841
4876
  children: [/* @__PURE__ */ _("h2", {
4842
- className: zr.title,
4877
+ className: Br.title,
4843
4878
  id: x,
4844
4879
  ref: C,
4845
4880
  tabIndex: -1,
4846
4881
  children: e
4847
4882
  }), t && /* @__PURE__ */ _("p", {
4848
- className: zr.meta,
4883
+ className: Br.meta,
4849
4884
  children: t
4850
4885
  })]
4851
4886
  }),
@@ -4873,15 +4908,15 @@ function Br({ title: e, meta: t, children: n, onClose: r, modal: i = !1, expande
4873
4908
  ]
4874
4909
  }),
4875
4910
  /* @__PURE__ */ _("div", {
4876
- className: zr.body,
4877
- children: n ?? /* @__PURE__ */ _(Vr, {})
4911
+ className: Br.body,
4912
+ children: n ?? /* @__PURE__ */ _(Hr, {})
4878
4913
  })
4879
4914
  ]
4880
4915
  });
4881
4916
  }
4882
- function Vr() {
4917
+ function Hr() {
4883
4918
  return /* @__PURE__ */ _("div", {
4884
- className: zr.skeleton,
4919
+ className: Br.skeleton,
4885
4920
  "aria-hidden": !0,
4886
4921
  children: [
4887
4922
  68,
@@ -4892,18 +4927,18 @@ function Vr() {
4892
4927
  100,
4893
4928
  84
4894
4929
  ].map((e, t) => /* @__PURE__ */ _("span", {
4895
- className: zr.line,
4930
+ className: Br.line,
4896
4931
  style: { width: `${e}%` }
4897
4932
  }, t))
4898
4933
  });
4899
4934
  }
4900
- var Hr = {
4935
+ var Ur = {
4901
4936
  layout: "ick-layout-nC6G",
4902
4937
  chat: "ick-chat-OTXm",
4903
4938
  card: "ick-card-Iddg",
4904
4939
  slot: "ick-slot-O--R",
4905
4940
  scrim: "ick-scrim-11Pp"
4906
- }, Ur = 760, Wr = {
4941
+ }, Wr = 760, Gr = {
4907
4942
  closed: {
4908
4943
  width: 0,
4909
4944
  transition: {
@@ -4921,7 +4956,7 @@ var Hr = {
4921
4956
  bounce: 0
4922
4957
  }
4923
4958
  }
4924
- }, Gr = {
4959
+ }, Kr = {
4925
4960
  closed: {
4926
4961
  opacity: 0,
4927
4962
  x: 24,
@@ -4940,7 +4975,7 @@ var Hr = {
4940
4975
  delay: .06
4941
4976
  }
4942
4977
  }
4943
- }, Kr = {
4978
+ }, qr = {
4944
4979
  closed: {
4945
4980
  y: "100%",
4946
4981
  transition: {
@@ -4957,7 +4992,7 @@ var Hr = {
4957
4992
  bounce: .18
4958
4993
  }
4959
4994
  }
4960
- }, qr = {
4995
+ }, Jr = {
4961
4996
  closed: {
4962
4997
  opacity: 0,
4963
4998
  transition: { duration: .18 }
@@ -4966,34 +5001,34 @@ var Hr = {
4966
5001
  opacity: 1,
4967
5002
  transition: { duration: .26 }
4968
5003
  }
4969
- }, Jr = { transition: { duration: 0 } }, Yr = (e) => ({
5004
+ }, Yr = { transition: { duration: 0 } }, Xr = (e) => ({
4970
5005
  closed: {
4971
5006
  ...e.closed,
4972
- ...Jr
5007
+ ...Yr
4973
5008
  },
4974
5009
  open: {
4975
5010
  ...e.open,
4976
- ...Jr
5011
+ ...Yr
4977
5012
  }
4978
5013
  });
4979
- 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 }) {
4980
5015
  let s = p(null), [l, u] = m(!1), [d, h] = m(!1), g = o(() => h((e) => !e), []), b = E(), [x, S, w] = f(() => {
4981
- let e = l ? Kr : Wr, t = l ? void 0 : Gr;
5016
+ let e = l ? qr : Gr, t = l ? void 0 : Kr;
4982
5017
  return b ? [
4983
- Yr(e),
4984
- t && Yr(t),
4985
- Yr(qr)
5018
+ Xr(e),
5019
+ t && Xr(t),
5020
+ Xr(Jr)
4986
5021
  ] : [
4987
5022
  e,
4988
5023
  t,
4989
- qr
5024
+ Jr
4990
5025
  ];
4991
5026
  }, [b, l]);
4992
5027
  c(() => {
4993
5028
  let e = s.current;
4994
5029
  if (!e || typeof ResizeObserver > "u") return;
4995
5030
  let t = new ResizeObserver(([e]) => {
4996
- u(e.contentRect.width <= Ur);
5031
+ u(e.contentRect.width <= Wr);
4997
5032
  });
4998
5033
  return t.observe(e), () => t.disconnect();
4999
5034
  }, []);
@@ -5004,17 +5039,17 @@ function Xr({ children: e, pane: t, onDismiss: n, surface: r = "flush", classNam
5004
5039
  });
5005
5040
  return /* @__PURE__ */ v("div", {
5006
5041
  ref: s,
5007
- className: [Hr.layout, i ?? ""].filter(Boolean).join(" "),
5042
+ className: [Ur.layout, i ?? ""].filter(Boolean).join(" "),
5008
5043
  "data-pane": T ? "" : void 0,
5009
5044
  "data-surface": r === "panes" ? "panes" : void 0,
5010
5045
  ...a,
5011
5046
  children: [/* @__PURE__ */ _("div", {
5012
- className: Hr.chat,
5047
+ className: Ur.chat,
5013
5048
  children: e
5014
5049
  }), /* @__PURE__ */ v(y, {
5015
5050
  initial: !1,
5016
5051
  children: [T && l && n && /* @__PURE__ */ _(C.div, {
5017
- className: Hr.scrim,
5052
+ className: Ur.scrim,
5018
5053
  variants: w,
5019
5054
  initial: "closed",
5020
5055
  animate: "open",
@@ -5022,13 +5057,13 @@ function Xr({ children: e, pane: t, onDismiss: n, surface: r = "flush", classNam
5022
5057
  "aria-hidden": !0,
5023
5058
  onClick: n
5024
5059
  }, "scrim"), T && /* @__PURE__ */ _(C.div, {
5025
- className: Hr.slot,
5060
+ className: Ur.slot,
5026
5061
  variants: x,
5027
5062
  initial: "closed",
5028
5063
  animate: "open",
5029
5064
  exit: "closed",
5030
5065
  children: /* @__PURE__ */ _(C.div, {
5031
- className: Hr.card,
5066
+ className: Ur.card,
5032
5067
  "data-expanded": d && !l || void 0,
5033
5068
  variants: S,
5034
5069
  ...l && n ? {
@@ -5054,7 +5089,7 @@ function Xr({ children: e, pane: t, onDismiss: n, surface: r = "flush", classNam
5054
5089
  }
5055
5090
  //#endregion
5056
5091
  //#region src/Artifact/useArtifacts.ts
5057
- function Zr(e = null) {
5092
+ function Qr(e = null) {
5058
5093
  let [t, n] = m(e);
5059
5094
  return {
5060
5095
  openId: t,
@@ -5063,14 +5098,14 @@ function Zr(e = null) {
5063
5098
  toggle: o((e) => n((t) => t === e ? null : e), [])
5064
5099
  };
5065
5100
  }
5066
- var Qr = {
5101
+ var $r = {
5067
5102
  root: "ick-root-JrOP",
5068
5103
  viewport: "ick-viewport-C3hz",
5069
5104
  content: "ick-content-33lN",
5070
5105
  jump: "ick-jump-nd6O"
5071
- }, $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) => {
5072
5107
  n !== t.current && (t.current = n, e.style.setProperty("--ick-conversation-tail", `${Math.round(n)}px`));
5073
- }, 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, dock: h = !1, className: g, viewportClassName: y, onScroll: b, ...x }, S) {
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) {
5074
5109
  let C = H("conversation").jump, w = l ?? C, T = p(null);
5075
5110
  u(S, () => T.current, []);
5076
5111
  let E = p(null), O = p(null), [k, A] = m(!0);
@@ -5086,82 +5121,82 @@ var Qr = {
5086
5121
  r.disconnect(), t.style.removeProperty("--ick-dock-height");
5087
5122
  };
5088
5123
  }, [h]);
5089
- let j = p(-1), M = p(null), N = p(!1), ee = o(() => {
5124
+ let j = p(-1), M = p(null), ee = p(!1), te = o(() => {
5090
5125
  let e = T.current, t = E.current;
5091
5126
  if (!e || !t) return 0;
5092
- if (i === "auto" && N.current) return Math.max(0, e.scrollHeight - e.clientHeight);
5093
- let n = h ? null : t.lastElementChild, a = n ? ni(n, e) + n.offsetHeight : ni(t, e) + t.offsetHeight - (h ? 0 : j.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);
5094
5129
  return Math.max(0, a + r - e.clientHeight);
5095
5130
  }, [
5096
5131
  h,
5097
5132
  r,
5098
5133
  i
5099
- ]), P = o(() => {
5134
+ ]), N = o(() => {
5100
5135
  let e = T.current, a = E.current;
5101
5136
  if (!e || !a) return;
5102
- if (i !== "auto") return ii(a, j, Math.max(0, i));
5103
- let o = parseFloat(getComputedStyle(e).paddingBottom) || 0, s = Math.max(0, r - o), c = a.lastElementChild, l = ri(e, M.current);
5104
- if (N.current = !!c && !!l, !N.current || !c || !l) return ii(a, j, s);
5105
- let u = ni(c, e) + c.offsetHeight - ni(l, e), d = h ? Math.max(s, j.current + (ni(l, e) - n - (e.scrollHeight - e.clientHeight))) : Math.max(s, e.clientHeight - n - u - o);
5106
- ii(a, j, t ? Math.max(d, j.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);
5107
5142
  }, [
5108
5143
  i,
5109
5144
  n,
5110
5145
  r,
5111
5146
  t,
5112
5147
  h
5113
- ]), F = o(() => {
5148
+ ]), P = o(() => {
5114
5149
  let e = T.current;
5115
5150
  if (!e) return 0;
5116
5151
  if (t) {
5117
5152
  let r = e.querySelector(`[id="${CSS.escape(t)}"]`);
5118
5153
  if (r) {
5119
- 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;
5120
5155
  return Math.max(0, Math.min(Math.max(a, o), t));
5121
5156
  }
5122
5157
  }
5123
- return ee();
5158
+ return te();
5124
5159
  }, [
5125
5160
  t,
5126
5161
  n,
5127
- ee
5128
- ]), I = p(0), te = p(null), L = o((e) => {
5162
+ te
5163
+ ]), F = p(0), ne = p(null), I = o((e) => {
5129
5164
  let t = T.current;
5130
5165
  if (!t) return;
5131
5166
  let n = e && !q();
5132
- I.current = n ? performance.now() + ei : 0, t.scrollTo({
5133
- top: F(),
5167
+ F.current = n ? performance.now() + ti : 0, t.scrollTo({
5168
+ top: P(),
5134
5169
  behavior: n ? "smooth" : "auto"
5135
5170
  }), A(!0);
5136
- }, [F]);
5171
+ }, [P]);
5137
5172
  d(() => {
5138
5173
  t && (M.current = t);
5139
5174
  let e = T.current, n = E.current;
5140
- if (P(), !e || !n || typeof ResizeObserver > "u") return;
5141
- let r = new ResizeObserver(P);
5175
+ if (N(), !e || !n || typeof ResizeObserver > "u") return;
5176
+ let r = new ResizeObserver(N);
5142
5177
  return r.observe(n), r.observe(e), () => r.disconnect();
5143
- }, [t, P]), d(() => {
5178
+ }, [t, N]), d(() => {
5144
5179
  if (!f || !k && !t) return;
5145
5180
  let e = T.current, n = E.current;
5146
5181
  if (!e || !n || typeof ResizeObserver > "u") return;
5147
5182
  let r = () => {
5148
- let n = F();
5149
- if (I.current) {
5150
- if (performance.now() < I.current && Math.abs(e.scrollTop - n) > 1) return;
5151
- I.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;
5152
5187
  }
5153
5188
  let r = n - e.scrollTop;
5154
5189
  if (M.current && !t && Math.abs(r) > a && !q()) {
5155
- I.current = performance.now() + ei, e.scrollTo({
5190
+ F.current = performance.now() + ti, e.scrollTo({
5156
5191
  top: n,
5157
5192
  behavior: "smooth"
5158
5193
  });
5159
5194
  return;
5160
5195
  }
5161
5196
  e.scrollTop = n;
5162
- }, i = t != null && t !== te.current;
5163
- t && (te.current = t), i && !q() && Math.abs(e.scrollTop - F()) > a ? (I.current = performance.now() + ei, e.scrollTo({
5164
- top: F(),
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(),
5165
5200
  behavior: "smooth"
5166
5201
  })) : r();
5167
5202
  let o = new ResizeObserver(r);
@@ -5169,7 +5204,7 @@ var Qr = {
5169
5204
  }, [
5170
5205
  f,
5171
5206
  k,
5172
- F,
5207
+ P,
5173
5208
  t,
5174
5209
  a
5175
5210
  ]), c(() => {
@@ -5177,7 +5212,7 @@ var Qr = {
5177
5212
  let e = T.current;
5178
5213
  if (!e) return;
5179
5214
  let n = () => {
5180
- I.current = 0, Math.abs(e.scrollTop - F()) > a && A(!1);
5215
+ F.current = 0, Math.abs(e.scrollTop - P()) > a && A(!1);
5181
5216
  }, r = (e) => {
5182
5217
  t ? n() : e.deltaY < 0 && A(!1);
5183
5218
  }, i = (e) => {
@@ -5203,40 +5238,40 @@ var Qr = {
5203
5238
  }, [
5204
5239
  f,
5205
5240
  a,
5206
- F,
5241
+ P,
5207
5242
  t
5208
5243
  ]);
5209
- let ne = o((e) => {
5244
+ let re = o((e) => {
5210
5245
  if (b?.(e), !f) return;
5211
5246
  let t = T.current;
5212
- t && Math.abs(t.scrollTop - F()) <= ti && (I.current = 0, A(!0));
5247
+ t && Math.abs(t.scrollTop - P()) <= ni && (F.current = 0, A(!0));
5213
5248
  }, [
5214
5249
  f,
5215
5250
  b,
5216
- F
5217
- ]), re = f && !k;
5251
+ P
5252
+ ]), L = f && !k;
5218
5253
  return /* @__PURE__ */ v("div", {
5219
5254
  ref: O,
5220
- className: [Qr.root, g ?? ""].filter(Boolean).join(" "),
5255
+ className: [$r.root, g ?? ""].filter(Boolean).join(" "),
5221
5256
  "data-dock": h || void 0,
5222
5257
  children: [/* @__PURE__ */ _("div", {
5223
5258
  ref: T,
5224
- className: [Qr.viewport, y ?? ""].filter(Boolean).join(" "),
5225
- onScroll: ne,
5259
+ className: [$r.viewport, y ?? ""].filter(Boolean).join(" "),
5260
+ onScroll: re,
5226
5261
  ...x,
5227
5262
  children: /* @__PURE__ */ _("div", {
5228
5263
  ref: E,
5229
- className: Qr.content,
5264
+ className: $r.content,
5230
5265
  "data-dock": h || void 0,
5231
5266
  children: e
5232
5267
  })
5233
5268
  }), s && /* @__PURE__ */ _("button", {
5234
5269
  type: "button",
5235
- className: Qr.jump,
5236
- "data-shown": re || void 0,
5237
- tabIndex: re ? 0 : -1,
5238
- "aria-hidden": !re || void 0,
5239
- onClick: () => L(!0),
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),
5240
5275
  "aria-label": w,
5241
5276
  children: /* @__PURE__ */ _(D, {
5242
5277
  size: 15,
@@ -5244,7 +5279,7 @@ var Qr = {
5244
5279
  })
5245
5280
  })]
5246
5281
  });
5247
- }), oi = {
5282
+ }), si = {
5248
5283
  empty: "ick-empty-BP6G",
5249
5284
  icon: "ick-icon-rZWd",
5250
5285
  title: "ick-title-AoPi",
@@ -5253,26 +5288,26 @@ var Qr = {
5253
5288
  };
5254
5289
  //#endregion
5255
5290
  //#region src/EmptyState/EmptyState.tsx
5256
- function si({ icon: e, title: t, description: n, suggestions: r, onSuggestion: i, suggestionsLabel: a, children: o, className: s, ...c }) {
5291
+ function ci({ icon: e, title: t, description: n, suggestions: r, onSuggestion: i, suggestionsLabel: a, children: o, className: s, ...c }) {
5257
5292
  let l = H("emptyState").suggestions, u = a ?? l, d = i ? r ?? [] : [];
5258
5293
  return /* @__PURE__ */ v("div", {
5259
- className: [oi.empty, s ?? ""].filter(Boolean).join(" "),
5294
+ className: [si.empty, s ?? ""].filter(Boolean).join(" "),
5260
5295
  ...c,
5261
5296
  children: [
5262
5297
  e && /* @__PURE__ */ _("div", {
5263
- className: oi.icon,
5298
+ className: si.icon,
5264
5299
  children: e
5265
5300
  }),
5266
5301
  t && /* @__PURE__ */ _("div", {
5267
- className: oi.title,
5302
+ className: si.title,
5268
5303
  children: t
5269
5304
  }),
5270
5305
  n && /* @__PURE__ */ _("p", {
5271
- className: oi.description,
5306
+ className: si.description,
5272
5307
  children: n
5273
5308
  }),
5274
5309
  d.length > 0 && /* @__PURE__ */ _("div", {
5275
- className: oi.suggestions,
5310
+ className: si.suggestions,
5276
5311
  role: "group",
5277
5312
  "aria-label": u,
5278
5313
  children: d.map((e) => /* @__PURE__ */ _(V, {
@@ -5288,14 +5323,14 @@ function si({ icon: e, title: t, description: n, suggestions: r, onSuggestion: i
5288
5323
  }
5289
5324
  //#endregion
5290
5325
  //#region src/ReplyThreadPopup/placePanel.ts
5291
- var ci = 24, li = 480, ui = 80, di = 260;
5292
- function fi(e, t, n = Infinity) {
5293
- 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);
5294
5329
  return {
5295
5330
  x: o,
5296
5331
  y: c,
5297
5332
  width: i,
5298
- maxHeight: Number.isFinite(n) ? Math.max(di, n - c - ci) : Infinity
5333
+ maxHeight: Number.isFinite(n) ? Math.max(fi, n - c - li) : Infinity
5299
5334
  };
5300
5335
  }
5301
5336
  var Q = {
@@ -5319,7 +5354,7 @@ var Q = {
5319
5354
  turn: "ick-turn-ogjU",
5320
5355
  turnRow: "ick-turnRow-0OuP",
5321
5356
  srOnly: "ick-srOnly-LwE1"
5322
- }, pi = 760, mi = {
5357
+ }, mi = 760, hi = {
5323
5358
  closed: {
5324
5359
  y: "100%",
5325
5360
  opacity: 1,
@@ -5338,11 +5373,11 @@ var Q = {
5338
5373
  bounce: .18
5339
5374
  }
5340
5375
  }
5341
- }, hi = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [contenteditable]:not([contenteditable=\"false\"]), [tabindex]:not([tabindex=\"-1\"])";
5342
- function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5343
- 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: ${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);
5344
5379
  c(() => {
5345
- let e = window.matchMedia?.(`(max-width: ${pi}px)`);
5380
+ let e = window.matchMedia?.(`(max-width: ${mi}px)`);
5346
5381
  if (!e?.addEventListener) return;
5347
5382
  let t = () => w(e.matches);
5348
5383
  return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
@@ -5361,7 +5396,7 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5361
5396
  return;
5362
5397
  }
5363
5398
  if (e.key !== "Tab") return;
5364
- let n = [...f.current?.querySelectorAll(hi) ?? []];
5399
+ let n = [...f.current?.querySelectorAll(gi) ?? []];
5365
5400
  if (n.length === 0) return;
5366
5401
  let r = n[0], i = n[n.length - 1], a = document.activeElement;
5367
5402
  e.shiftKey && a === r ? (e.preventDefault(), i.focus()) : !e.shiftKey && a === i && (e.preventDefault(), r.focus());
@@ -5393,12 +5428,12 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5393
5428
  behavior: "smooth"
5394
5429
  });
5395
5430
  }, [E]);
5396
- let { x: N, y: ee, width: P, maxHeight: F } = typeof window > "u" ? {
5431
+ let { x: ee, y: te, width: N, maxHeight: P } = typeof window > "u" ? {
5397
5432
  x: 0,
5398
5433
  y: 0,
5399
5434
  width: 480,
5400
5435
  maxHeight: Infinity
5401
- } : fi(e.rect, window.innerWidth, window.innerHeight);
5436
+ } : pi(e.rect, window.innerWidth, window.innerHeight);
5402
5437
  return /* @__PURE__ */ _(x, {
5403
5438
  reducedMotion: "user",
5404
5439
  children: /* @__PURE__ */ _("div", {
@@ -5421,9 +5456,9 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5421
5456
  opacity: 0
5422
5457
  },
5423
5458
  animate: S ? "open" : {
5424
- left: N,
5425
- top: ee,
5426
- width: P,
5459
+ left: ee,
5460
+ top: te,
5461
+ width: N,
5427
5462
  borderRadius: 28,
5428
5463
  opacity: 1
5429
5464
  },
@@ -5432,7 +5467,7 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5432
5467
  scale: .95,
5433
5468
  filter: "blur(4px)"
5434
5469
  },
5435
- variants: S ? mi : void 0,
5470
+ variants: S ? hi : void 0,
5436
5471
  transition: S ? void 0 : {
5437
5472
  type: "spring",
5438
5473
  bounce: 0,
@@ -5453,7 +5488,7 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5453
5488
  (n.offset.y > 120 || n.velocity.y > 600) && t();
5454
5489
  }
5455
5490
  } : {},
5456
- style: !S && Number.isFinite(F) ? { maxHeight: F } : void 0,
5491
+ style: !S && Number.isFinite(P) ? { maxHeight: P } : void 0,
5457
5492
  className: Q.panel,
5458
5493
  children: /* @__PURE__ */ v("div", {
5459
5494
  className: Q.column,
@@ -5576,7 +5611,7 @@ function gi({ activeReply: e, onClose: t, onSave: n, onSendMessage: r }) {
5576
5611
  }
5577
5612
  //#endregion
5578
5613
  //#region src/CustomCursor/CustomCursor.tsx
5579
- function _i() {
5614
+ function vi() {
5580
5615
  let e = T(-100), t = T(-100), [n, r] = m("default"), [i, a] = m(!1), [o, s] = m(!1);
5581
5616
  return c(() => {
5582
5617
  let n = (n) => {
@@ -5734,7 +5769,7 @@ function _i() {
5734
5769
  }
5735
5770
  //#endregion
5736
5771
  //#region src/theme/useThemeAttribute.ts
5737
- function vi(e) {
5772
+ function yi(e) {
5738
5773
  c(() => {
5739
5774
  e !== void 0 && (e ? document.documentElement.setAttribute("data-theme", e) : document.documentElement.removeAttribute("data-theme"));
5740
5775
  }, [e]);
@@ -5744,7 +5779,7 @@ var $ = {
5744
5779
  feed: "ick-feed-XqZl",
5745
5780
  dock: "ick-dock-tvIC",
5746
5781
  centred: "ick-centred-5tu8",
5747
- paned: "ick-paned-MM8c",
5782
+ fitted: "ick-fitted-JApW",
5748
5783
  topBlur: "ick-topBlur-69Dl",
5749
5784
  bottomBlur: "ick-bottomBlur-MXmb",
5750
5785
  header: "ick-header-pQ7Z",
@@ -5761,108 +5796,108 @@ var $ = {
5761
5796
  groupTitle: "ick-groupTitle-jiBB",
5762
5797
  marks: "ick-marks-gwsN",
5763
5798
  mark: "ick-mark-QkpW"
5764
- }, yi = () => "", bi = {
5799
+ }, bi = () => "", xi = {
5765
5800
  stiffness: 170,
5766
5801
  damping: 24,
5767
5802
  mass: 1
5768
5803
  };
5769
- function xi({ 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", theme: N, onThemeChange: ee, cursor: P = !1, selectionToggle: F = !1, highlights: I = !0, bookmarks: te = !0, anchorOffset: L = 100, endOffset: re = 120, animationConfig: ie, foldMotion: R, feedDelay: ae = 0, onAnswerQuestion: oe, onEditQuestion: se, onDecideApproval: le, className: ue }) {
5770
- let z = H("experience", r?.experience), de = u ?? z.title, [fe, pe] = m([]), [me, he] = m(!1), [_e, be] = m(null), [xe, Se] = m("marker"), Ce = p(null), we = N !== void 0, [B, Te] = m(null), Ee = we ? N : B, [V, De] = m(() => typeof window < "u" && !!window.matchMedia?.("(prefers-color-scheme: dark)").matches);
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);
5771
5806
  c(() => {
5772
- let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => De(e.matches);
5807
+ let e = window.matchMedia("(prefers-color-scheme: dark)"), t = () => Oe(e.matches);
5773
5808
  return e.addEventListener("change", t), () => e.removeEventListener("change", t);
5774
5809
  }, []);
5775
- let Oe = Ee ?? (V ? "dark" : "light");
5776
- vi(Ee);
5777
- let ke = o((e) => {
5778
- we || Te(e), ee?.(e);
5779
- }, [we, ee]), U = M === "docked", Me = f(() => U ? {
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 ? {
5780
5815
  ...rt,
5781
- ...ie,
5782
- bubble: ie?.bubble ?? bi
5783
- } : ie, [U, ie]), Ne = ht({
5784
- onSend: e ?? yi,
5816
+ ...R,
5817
+ bubble: R?.bubble ?? xi
5818
+ } : R, [U, R]), Pe = ht({
5819
+ onSend: e ?? bi,
5785
5820
  announcements: { responding: z.responding },
5786
5821
  nextTurn: U ? "at-send" : "after-answer"
5787
- }), { turns: Pe, setDraft: Fe, submit: Ie, showVersion: Le, stop: W, beginEdit: Re, cancelEdit: ze, updatePart: Be, isStreaming: Ve } = t ?? Ne, [He, Ue] = m(null), We = o((e, t, n) => {
5788
- Ue(e), Ie(e, t, n);
5789
- }, [Ie]), Ge = He ? Pe.find((e) => e.id === He) ?? null : null, G = Ge && Ge.state !== "resting" ? He : null, [K, q] = m(0);
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";
5790
5825
  c(() => {
5791
- if (!U) return;
5826
+ if (!U || !Je) return;
5792
5827
  let e = window.visualViewport;
5793
5828
  if (!e) return;
5794
- let t = () => q(Math.max(0, Math.round(window.innerHeight - e.height)));
5829
+ let t = () => qe(Math.max(0, Math.round(window.innerHeight - e.height)));
5795
5830
  return t(), e.addEventListener("resize", t), () => e.removeEventListener("resize", t);
5796
- }, [U]);
5797
- let qe = o((e) => {
5798
- Ue(e), Ie(e);
5799
- }, [Ie]), Je = Pe.length === 1 && !Pe[0].user && !Pe[0].ai, Ye = T + Math.round(Pe.reduce((e, t) => e + t.user.length + t.ai.length + JSON.stringify(t.parts ?? []).length, 0) / 4), Xe = w !== void 0 && Ye >= w, Ze = p(!1);
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);
5800
5835
  c(() => {
5801
- if (!Xe) {
5802
- Ze.current = !1;
5836
+ if (!Qe) {
5837
+ $e.current = !1;
5803
5838
  return;
5804
5839
  }
5805
- Ze.current || (Ze.current = !0, Ke(z.windowFull));
5806
- }, [Xe, z.windowFull]);
5807
- let Qe = Zr(), $e = D !== void 0, et = $e ? D : Qe.openId, tt = p({
5808
- openArtifactId: et,
5809
- artifactHeld: $e,
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,
5810
5845
  onOpenArtifactChange: O
5811
5846
  });
5812
5847
  c(() => {
5813
- tt.current = {
5814
- openArtifactId: et,
5815
- artifactHeld: $e,
5848
+ it.current = {
5849
+ openArtifactId: nt,
5850
+ artifactHeld: tt,
5816
5851
  onOpenArtifactChange: O
5817
5852
  };
5818
5853
  });
5819
- let nt = Qe.open, it = Qe.close, at = o((e) => {
5820
- let { artifactHeld: t, onOpenArtifactChange: n } = tt.current;
5821
- t || (e === null ? it() : nt(e)), n?.(e);
5822
- }, [nt, it]), ot = o(() => at(null), [at]), [st, ct] = m({}), lt = o((e, t) => {
5823
- ct((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) => ({
5824
5859
  ...n,
5825
5860
  [e]: t
5826
5861
  }));
5827
- }, []), ut = Pe.find((e) => e.state !== "idle" && e.state !== "typing" && e.user.trim())?.user.trim() ?? de, J = o((e, t) => {
5828
- te && t.trim().length > 0 && pe((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, {
5829
5864
  turnId: e,
5830
5865
  text: t.trim()
5831
5866
  }]);
5832
- }, [te]), dt = o((e, t) => at(tt.current.openArtifactId === t ? null : t), [at]), ft = o((e, t) => {
5833
- be({
5867
+ }, [I]), pt = o((e, t) => st(it.current.openArtifactId === t ? null : t), [st]), mt = o((e, t) => {
5868
+ xe({
5834
5869
  text: e,
5835
5870
  rect: t
5836
5871
  });
5837
- }, []), pt = f(() => oe ? (e, t, n, r) => oe(Be, e, t, n, r) : void 0, [oe, Be]), mt = f(() => se ? (e, t, n) => se(Be, e, t, n) : void 0, [se, Be]), Y = f(() => le ? (e, t, n) => le(Be, e, t, n) : void 0, [le, Be]), [gt, _t] = 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);
5838
5873
  c(() => {
5839
5874
  if (!P) return;
5840
- let e = window.matchMedia("(pointer: fine)"), t = () => _t(e.matches);
5875
+ let e = window.matchMedia("(pointer: fine)"), t = () => yt(e.matches);
5841
5876
  return t(), e.addEventListener("change", t), () => e.removeEventListener("change", t);
5842
5877
  }, [P]);
5843
- let vt = (e) => i === !0 || Array.isArray(i) && i.includes(e), yt = [
5844
- ...I && te && fe.length > 0 ? [{
5878
+ let bt = (e) => i === !0 || Array.isArray(i) && i.includes(e), xt = [
5879
+ ...ne && I && pe.length > 0 ? [{
5845
5880
  id: "bookmarks",
5846
5881
  label: z.savedHighlights,
5847
5882
  icon: /* @__PURE__ */ _(k, {
5848
5883
  size: 16,
5849
5884
  "aria-hidden": !0
5850
5885
  }),
5851
- count: fe.length,
5886
+ count: pe.length,
5852
5887
  pinned: !0,
5853
- onClick: () => he(!0)
5888
+ onClick: () => _e(!0)
5854
5889
  }] : [],
5855
- ...vt("theme") ? [{
5890
+ ...bt("theme") ? [{
5856
5891
  id: "theme",
5857
- label: Oe === "dark" ? z.themeToLight : z.themeToDark,
5858
- icon: _(Oe === "dark" ? ve : ce, {
5892
+ label: ke === "dark" ? z.themeToLight : z.themeToDark,
5893
+ icon: _(ke === "dark" ? ve : ce, {
5859
5894
  size: 16,
5860
5895
  "aria-hidden": !0
5861
5896
  }),
5862
- active: Oe === "dark",
5863
- onClick: () => ke(Oe === "dark" ? "light" : "dark")
5897
+ active: ke === "dark",
5898
+ onClick: () => Me(ke === "dark" ? "light" : "dark")
5864
5899
  }] : [],
5865
- ...vt("share") ? [{
5900
+ ...bt("share") ? [{
5866
5901
  id: "share",
5867
5902
  label: z.share,
5868
5903
  icon: /* @__PURE__ */ _(ge, {
@@ -5870,25 +5905,25 @@ function xi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
5870
5905
  "aria-hidden": !0
5871
5906
  }),
5872
5907
  onClick: () => navigator.share?.({
5873
- title: ut,
5908
+ title: dt,
5874
5909
  url: window.location.href
5875
5910
  })
5876
5911
  }] : [],
5877
5912
  ...b ?? []
5878
- ], bt = A === "inline" && et ? E?.(et) : null, xt = /* @__PURE__ */ v(C.div, {
5913
+ ], St = A === "inline" && nt ? E?.(nt) : null, wt = /* @__PURE__ */ v(C.div, {
5879
5914
  className: [
5880
5915
  $.page,
5881
- j === "panes" ? $.paned : "",
5916
+ j === "panes" || !Je ? $.fitted : "",
5882
5917
  "ick-chat-page",
5883
- ue
5918
+ de
5884
5919
  ].filter(Boolean).join(" "),
5885
5920
  style: { "--ick-experience-anchor": `${L}px` },
5886
5921
  "data-composer": U ? "docked" : void 0,
5887
5922
  initial: { opacity: 0 },
5888
5923
  animate: {
5889
- opacity: _e || me ? .4 : 1,
5890
- filter: _e || me ? "blur(3px)" : "blur(0px)",
5891
- scale: _e || me ? .9 : 1
5924
+ opacity: be || he ? .4 : 1,
5925
+ filter: be || he ? "blur(3px)" : "blur(0px)",
5926
+ scale: be || he ? .9 : 1
5892
5927
  },
5893
5928
  transition: {
5894
5929
  type: "spring",
@@ -5897,95 +5932,95 @@ function xi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
5897
5932
  mass: .9
5898
5933
  },
5899
5934
  onAnimationComplete: () => {
5900
- document.activeElement && document.activeElement !== document.body || Ce.current?.focus();
5935
+ document.activeElement && document.activeElement !== document.body || we.current?.focus();
5901
5936
  },
5902
5937
  children: [
5903
5938
  /* @__PURE__ */ _("div", { className: $.topBlur }),
5904
5939
  /* @__PURE__ */ v(Ct, {
5905
5940
  className: `${$.header} ick-chat-header`,
5906
- title: ut,
5941
+ title: dt,
5907
5942
  backHref: d,
5908
5943
  backLabel: h,
5909
5944
  elevateOnScroll: !1,
5910
5945
  collapseActionsAt: 480,
5911
- actions: yt,
5912
- children: [w !== void 0 && /* @__PURE__ */ _(Rr, {
5946
+ actions: xt,
5947
+ children: [w !== void 0 && /* @__PURE__ */ _(zr, {
5913
5948
  className: $.context,
5914
- used: Ye,
5949
+ used: Ze,
5915
5950
  total: w
5916
- }), F && I && /* @__PURE__ */ v("div", {
5951
+ }), F && ne && /* @__PURE__ */ v("div", {
5917
5952
  className: $.selectMode,
5918
5953
  role: "group",
5919
5954
  "aria-label": z.selectionMode,
5920
5955
  children: [/* @__PURE__ */ _("button", {
5921
5956
  type: "button",
5922
- "data-active": xe === "marker",
5923
- onClick: () => Se("marker"),
5957
+ "data-active": Se === "marker",
5958
+ onClick: () => Ce("marker"),
5924
5959
  "aria-label": z.marker,
5925
5960
  title: z.marker,
5926
- children: /* @__PURE__ */ _(ne, { size: 16 })
5961
+ children: /* @__PURE__ */ _(re, { size: 16 })
5927
5962
  }), /* @__PURE__ */ _("button", {
5928
5963
  type: "button",
5929
- "data-active": xe === "precise",
5930
- onClick: () => Se("precise"),
5964
+ "data-active": Se === "precise",
5965
+ onClick: () => Ce("precise"),
5931
5966
  "aria-label": z.precise,
5932
5967
  title: z.precise,
5933
5968
  children: /* @__PURE__ */ _(ye, { size: 16 })
5934
5969
  })]
5935
5970
  })]
5936
5971
  }),
5937
- /* @__PURE__ */ v(ai, {
5972
+ /* @__PURE__ */ v(oi, {
5938
5973
  viewportClassName: `${$.feed} ick-chat-feed`,
5939
- anchorId: G ? `turn-${G}` : void 0,
5974
+ anchorId: K ? `turn-${K}` : void 0,
5940
5975
  dock: U,
5941
5976
  anchorOffset: L,
5942
- endOffset: U ? 0 : re,
5977
+ endOffset: U ? 0 : ie,
5943
5978
  children: [
5944
- Je && S && /* @__PURE__ */ _(si, {
5979
+ Xe && S && /* @__PURE__ */ _(ci, {
5945
5980
  className: U ? `${$.opening} ${$.centred}` : $.opening,
5946
5981
  title: S.title,
5947
5982
  description: S.description,
5948
5983
  suggestions: S.suggestions,
5949
- onSuggestion: (e) => We(Pe[0].id, e)
5984
+ onSuggestion: (e) => Ge(Fe[0].id, e)
5950
5985
  }),
5951
- /* @__PURE__ */ _(y, { children: Pe.map((e, t) => {
5952
- let r = t === Pe.length - 1 && (e.state === "idle" || e.state === "typing");
5953
- 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, {
5954
5989
  turn: e,
5955
- questionAlign: U && r || Je && t === 0 ? "stretch" : "end",
5956
- className: U && r ? $.dock : Je && 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,
5957
5992
  onTranscribe: s,
5958
5993
  isActiveInput: r,
5959
- inputRef: r ? Ce : null,
5960
- entranceDelay: t === 0 ? ae : 0,
5961
- selectionMode: xe,
5962
- highlights: I,
5963
- animationConfig: Me,
5964
- foldMotion: R,
5965
- openArtifactId: et,
5966
- onOpenArtifact: dt,
5967
- onArtifactChange: at,
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,
5968
6003
  placeholder: x,
5969
- onDraft: Fe,
5970
- onSubmit: We,
5971
- onRegenerate: qe,
5972
- onShowVersion: Le,
5973
- onFeedback: lt,
5974
- feedback: st[e.id] ?? null,
5975
- onStop: !U || r ? W : void 0,
5976
- busy: U && r ? Ve : void 0,
5977
- onEdit: Re,
5978
- onCancelEdit: ze,
5979
- onHighlight: J,
5980
- onReplyInThread: l ? ft : void 0,
5981
- onAnswerQuestion: pt,
5982
- onEditQuestion: mt,
5983
- onDecideApproval: Y,
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,
5984
6019
  renderPart: n,
5985
6020
  composerMenu: a
5986
6021
  }, e.id);
5987
6022
  }) }),
5988
- Xe && /* @__PURE__ */ _(zn, { children: z.windowFull })
6023
+ Qe && /* @__PURE__ */ _(zn, { children: z.windowFull })
5989
6024
  ]
5990
6025
  }),
5991
6026
  /* @__PURE__ */ _("div", { className: $.bottomBlur })
@@ -5994,29 +6029,30 @@ function xi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
5994
6029
  return /* @__PURE__ */ v(Ae, {
5995
6030
  labels: r,
5996
6031
  children: [
5997
- P && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("style", { dangerouslySetInnerHTML: { __html: "@media (pointer: fine) { * { cursor: none !important; } }" } }), gt && /* @__PURE__ */ _(_i, {})] }),
5998
- /* @__PURE__ */ _(Xr, {
6032
+ P && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("style", { dangerouslySetInnerHTML: { __html: "@media (pointer: fine) { * { cursor: none !important; } }" } }), vt && /* @__PURE__ */ _(vi, {})] }),
6033
+ /* @__PURE__ */ _(Zr, {
5999
6034
  className: $.workspace,
6000
6035
  surface: j,
6001
- style: K > 0 ? { "--ick-keyboard": `${K}px` } : void 0,
6002
- onDismiss: ot,
6003
- pane: ({ narrow: e, expanded: t, toggleExpanded: n }) => bt ? /* @__PURE__ */ _(Br, {
6004
- title: bt.title,
6005
- meta: bt.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,
6006
6042
  modal: e,
6007
6043
  expanded: t,
6008
6044
  onToggleExpanded: n,
6009
- onClose: ot,
6010
- children: bt.children
6045
+ onClose: ct,
6046
+ children: St.children
6011
6047
  }) : null,
6012
- children: xt
6048
+ children: wt
6013
6049
  }),
6014
- /* @__PURE__ */ _(y, { children: me && /* @__PURE__ */ _(C.div, {
6050
+ /* @__PURE__ */ _(y, { children: he && /* @__PURE__ */ _(C.div, {
6015
6051
  className: $.scrim,
6016
6052
  initial: { opacity: 0 },
6017
6053
  animate: { opacity: 1 },
6018
6054
  exit: { opacity: 0 },
6019
- onClick: () => he(!1),
6055
+ onClick: () => _e(!1),
6020
6056
  children: /* @__PURE__ */ v(C.div, {
6021
6057
  className: $.sheet,
6022
6058
  role: "dialog",
@@ -6041,21 +6077,21 @@ function xi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
6041
6077
  children: z.highlights
6042
6078
  }), /* @__PURE__ */ _("button", {
6043
6079
  className: $.close,
6044
- onClick: () => he(!1),
6080
+ onClick: () => _e(!1),
6045
6081
  children: z.close
6046
6082
  })]
6047
- }), Array.from(new Set(fe.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", {
6048
6084
  className: $.group,
6049
6085
  children: [/* @__PURE__ */ _("h3", {
6050
6086
  className: $.groupTitle,
6051
6087
  children: je(z.paragraph, { index: t + 1 })
6052
6088
  }), /* @__PURE__ */ _("div", {
6053
6089
  className: $.marks,
6054
- children: fe.filter((t) => t.turnId === e).map((t, n) => /* @__PURE__ */ _("button", {
6090
+ children: pe.filter((t) => t.turnId === e).map((t, n) => /* @__PURE__ */ _("button", {
6055
6091
  type: "button",
6056
6092
  className: $.mark,
6057
6093
  onClick: () => {
6058
- he(!1), setTimeout(() => {
6094
+ _e(!1), setTimeout(() => {
6059
6095
  let t = document.getElementById(`turn-${e}`), n = document.querySelector(".ick-chat-feed"), r = document.querySelector(".ick-chat-header");
6060
6096
  if (t && n) {
6061
6097
  let e = r ? r.offsetHeight : 80;
@@ -6075,15 +6111,15 @@ function xi({ onSend: e, chat: t, renderPart: n, labels: r, headerActions: i = !
6075
6111
  }, e))]
6076
6112
  })
6077
6113
  }) }),
6078
- /* @__PURE__ */ _(y, { children: _e && l && /* @__PURE__ */ _(gi, {
6079
- activeReply: _e,
6080
- onClose: () => be(null),
6114
+ /* @__PURE__ */ _(y, { children: be && l && /* @__PURE__ */ _(_i, {
6115
+ activeReply: be,
6116
+ onClose: () => xe(null),
6081
6117
  onSendMessage: l
6082
6118
  }, "thread-popup") })
6083
6119
  ]
6084
6120
  });
6085
6121
  }
6086
6122
  //#endregion
6087
- 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, U 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, xi 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 };
6088
6124
 
6089
- //# sourceMappingURL=ChatExperience-CrWU56fi.js.map
6125
+ //# sourceMappingURL=ChatExperience-BeLjIxHU.js.map