@teodorruskvi/chat-core 0.1.35 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -3,7 +3,7 @@ var qt = (e, t, n) => t in e ? Wt(e, t, { enumerable: !0, configurable: !0, writ
3
3
  var at = (e, t, n) => qt(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as ie } from "react/jsx-runtime";
5
5
  import * as it from "react";
6
- import { createContext as Se, useContext as Ue, useState as B, useRef as H, useEffect as q, useCallback as z, useMemo as Q, useReducer as Jt } from "react";
6
+ import { createContext as Se, useContext as Ue, useState as D, useRef as H, useEffect as q, useCallback as z, useMemo as Q, useReducer as Jt } from "react";
7
7
  import Xt, { isCancel as Qt } from "axios";
8
8
  function It(e) {
9
9
  var t, n, r = "";
@@ -29,8 +29,8 @@ const et = "-", Zt = (e) => {
29
29
  return i[0] === "" && i.length !== 1 && i.shift(), Tt(i, t) || en(a);
30
30
  },
31
31
  getConflictingClassGroupIds: (a, i) => {
32
- const d = n[a] || [];
33
- return i && r[a] ? [...d, ...r[a]] : d;
32
+ const u = n[a] || [];
33
+ return i && r[a] ? [...u, ...r[a]] : u;
34
34
  }
35
35
  };
36
36
  }, Tt = (e, t) => {
@@ -120,18 +120,18 @@ const et = "-", Zt = (e) => {
120
120
  n.has(s) ? n.set(s, a) : o(s, a);
121
121
  }
122
122
  };
123
- }, At = "!", sn = (e) => {
123
+ }, xt = "!", sn = (e) => {
124
124
  const {
125
125
  separator: t,
126
126
  experimentalParseClassName: n
127
127
  } = e, r = t.length === 1, o = t[0], s = t.length, a = (i) => {
128
- const d = [];
128
+ const u = [];
129
129
  let c = 0, l = 0, p;
130
130
  for (let w = 0; w < i.length; w++) {
131
131
  let k = i[w];
132
132
  if (c === 0) {
133
133
  if (k === o && (r || i.slice(w, w + s) === t)) {
134
- d.push(i.slice(l, w)), l = w + s;
134
+ u.push(i.slice(l, w)), l = w + s;
135
135
  continue;
136
136
  }
137
137
  if (k === "/") {
@@ -141,9 +141,9 @@ const et = "-", Zt = (e) => {
141
141
  }
142
142
  k === "[" ? c++ : k === "]" && c--;
143
143
  }
144
- const m = d.length === 0 ? i : i.substring(l), h = m.startsWith(At), v = h ? m.substring(1) : m, f = p && p > l ? p - l : void 0;
144
+ const m = u.length === 0 ? i : i.substring(l), h = m.startsWith(xt), v = h ? m.substring(1) : m, f = p && p > l ? p - l : void 0;
145
145
  return {
146
- modifiers: d,
146
+ modifiers: u,
147
147
  hasImportantModifier: h,
148
148
  baseClassName: v,
149
149
  maybePostfixModifierPosition: f
@@ -165,15 +165,15 @@ const et = "-", Zt = (e) => {
165
165
  cache: on(e.cacheSize),
166
166
  parseClassName: sn(e),
167
167
  ...Zt(e)
168
- }), ln = /\s+/, dn = (e, t) => {
168
+ }), ln = /\s+/, un = (e, t) => {
169
169
  const {
170
170
  parseClassName: n,
171
171
  getClassGroupId: r,
172
172
  getConflictingClassGroupIds: o
173
173
  } = t, s = [], a = e.trim().split(ln);
174
174
  let i = "";
175
- for (let d = a.length - 1; d >= 0; d -= 1) {
176
- const c = a[d], {
175
+ for (let u = a.length - 1; u >= 0; u -= 1) {
176
+ const c = a[u], {
177
177
  modifiers: l,
178
178
  hasImportantModifier: p,
179
179
  baseClassName: m,
@@ -191,54 +191,54 @@ const et = "-", Zt = (e) => {
191
191
  }
192
192
  v = !1;
193
193
  }
194
- const w = an(l).join(":"), k = p ? w + At : w, C = k + f;
195
- if (s.includes(C))
194
+ const w = an(l).join(":"), k = p ? w + xt : w, E = k + f;
195
+ if (s.includes(E))
196
196
  continue;
197
- s.push(C);
197
+ s.push(E);
198
198
  const I = o(f, v);
199
- for (let R = 0; R < I.length; ++R) {
200
- const P = I[R];
199
+ for (let N = 0; N < I.length; ++N) {
200
+ const P = I[N];
201
201
  s.push(k + P);
202
202
  }
203
203
  i = c + (i.length > 0 ? " " + i : i);
204
204
  }
205
205
  return i;
206
206
  };
207
- function un() {
207
+ function dn() {
208
208
  let e = 0, t, n, r = "";
209
209
  for (; e < arguments.length; )
210
- (t = arguments[e++]) && (n = xt(t)) && (r && (r += " "), r += n);
210
+ (t = arguments[e++]) && (n = At(t)) && (r && (r += " "), r += n);
211
211
  return r;
212
212
  }
213
- const xt = (e) => {
213
+ const At = (e) => {
214
214
  if (typeof e == "string")
215
215
  return e;
216
216
  let t, n = "";
217
217
  for (let r = 0; r < e.length; r++)
218
- e[r] && (t = xt(e[r])) && (n && (n += " "), n += t);
218
+ e[r] && (t = At(e[r])) && (n && (n += " "), n += t);
219
219
  return n;
220
220
  };
221
221
  function fn(e, ...t) {
222
222
  let n, r, o, s = a;
223
- function a(d) {
223
+ function a(u) {
224
224
  const c = t.reduce((l, p) => p(l), e());
225
- return n = cn(c), r = n.cache.get, o = n.cache.set, s = i, i(d);
225
+ return n = cn(c), r = n.cache.get, o = n.cache.set, s = i, i(u);
226
226
  }
227
- function i(d) {
228
- const c = r(d);
227
+ function i(u) {
228
+ const c = r(u);
229
229
  if (c)
230
230
  return c;
231
- const l = dn(d, n);
232
- return o(d, l), l;
231
+ const l = un(u, n);
232
+ return o(u, l), l;
233
233
  }
234
234
  return function() {
235
- return s(un.apply(null, arguments));
235
+ return s(dn.apply(null, arguments));
236
236
  };
237
237
  }
238
- const D = (e) => {
238
+ const K = (e) => {
239
239
  const t = (n) => n[e] || [];
240
240
  return t.isThemeGetter = !0, t;
241
- }, St = /^\[(?:([a-z-]+):)?(.+)\]$/i, pn = /^\d+\/\d+$/, gn = /* @__PURE__ */ new Set(["px", "full", "screen"]), mn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, hn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, bn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, wn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, fe = (e) => Ae(e) || gn.has(e) || pn.test(e), be = (e) => Ce(e, "length", Cn), Ae = (e) => !!e && !Number.isNaN(Number(e)), He = (e) => Ce(e, "number", Ae), Pe = (e) => !!e && Number.isInteger(Number(e)), vn = (e) => e.endsWith("%") && Ae(e.slice(0, -1)), L = (e) => St.test(e), we = (e) => mn.test(e), kn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), In = (e) => Ce(e, kn, Ct), Tn = (e) => Ce(e, "position", Ct), An = /* @__PURE__ */ new Set(["image", "url"]), xn = (e) => Ce(e, An, En), Sn = (e) => Ce(e, "", Mn), _e = () => !0, Ce = (e, t, n) => {
241
+ }, St = /^\[(?:([a-z-]+):)?(.+)\]$/i, pn = /^\d+\/\d+$/, gn = /* @__PURE__ */ new Set(["px", "full", "screen"]), mn = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, hn = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, yn = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/, bn = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, wn = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, fe = (e) => xe(e) || gn.has(e) || pn.test(e), be = (e) => Ce(e, "length", Cn), xe = (e) => !!e && !Number.isNaN(Number(e)), He = (e) => Ce(e, "number", xe), Pe = (e) => !!e && Number.isInteger(Number(e)), vn = (e) => e.endsWith("%") && xe(e.slice(0, -1)), j = (e) => St.test(e), we = (e) => mn.test(e), kn = /* @__PURE__ */ new Set(["length", "size", "percentage"]), In = (e) => Ce(e, kn, Ct), Tn = (e) => Ce(e, "position", Ct), xn = /* @__PURE__ */ new Set(["image", "url"]), An = (e) => Ce(e, xn, En), Sn = (e) => Ce(e, "", Mn), _e = () => !0, Ce = (e, t, n) => {
242
242
  const r = St.exec(e);
243
243
  return r ? r[1] ? typeof t == "string" ? r[1] === t : t.has(r[1]) : n(r[2]) : !1;
244
244
  }, Cn = (e) => (
@@ -247,36 +247,36 @@ const D = (e) => {
247
247
  // I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
248
248
  hn.test(e) && !yn.test(e)
249
249
  ), Ct = () => !1, Mn = (e) => bn.test(e), En = (e) => wn.test(e), Pn = () => {
250
- const e = D("colors"), t = D("spacing"), n = D("blur"), r = D("brightness"), o = D("borderColor"), s = D("borderRadius"), a = D("borderSpacing"), i = D("borderWidth"), d = D("contrast"), c = D("grayscale"), l = D("hueRotate"), p = D("invert"), m = D("gap"), h = D("gradientColorStops"), v = D("gradientColorStopPositions"), f = D("inset"), w = D("margin"), k = D("opacity"), C = D("padding"), I = D("saturate"), R = D("scale"), P = D("sepia"), A = D("skew"), M = D("space"), g = D("translate"), y = () => ["auto", "contain", "none"], F = () => ["auto", "hidden", "clip", "visible", "scroll"], U = () => ["auto", L, t], S = () => [L, t], E = () => ["", fe, be], j = () => ["auto", Ae, L], N = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], V = () => ["solid", "dashed", "dotted", "double", "none"], G = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], b = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], T = () => ["", "0", L], $ = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], O = () => [Ae, L];
250
+ const e = K("colors"), t = K("spacing"), n = K("blur"), r = K("brightness"), o = K("borderColor"), s = K("borderRadius"), a = K("borderSpacing"), i = K("borderWidth"), u = K("contrast"), c = K("grayscale"), l = K("hueRotate"), p = K("invert"), m = K("gap"), h = K("gradientColorStops"), v = K("gradientColorStopPositions"), f = K("inset"), w = K("margin"), k = K("opacity"), E = K("padding"), I = K("saturate"), N = K("scale"), P = K("sepia"), x = K("skew"), S = K("space"), g = K("translate"), y = () => ["auto", "contain", "none"], F = () => ["auto", "hidden", "clip", "visible", "scroll"], U = () => ["auto", j, t], C = () => [j, t], M = () => ["", fe, be], L = () => ["auto", xe, j], R = () => ["bottom", "center", "left", "left-bottom", "left-top", "right", "right-bottom", "right-top", "top"], V = () => ["solid", "dashed", "dotted", "double", "none"], B = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], b = () => ["start", "end", "center", "between", "around", "evenly", "stretch"], T = () => ["", "0", j], $ = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], O = () => [xe, j];
251
251
  return {
252
252
  cacheSize: 500,
253
253
  separator: ":",
254
254
  theme: {
255
255
  colors: [_e],
256
256
  spacing: [fe, be],
257
- blur: ["none", "", we, L],
257
+ blur: ["none", "", we, j],
258
258
  brightness: O(),
259
259
  borderColor: [e],
260
- borderRadius: ["none", "", "full", we, L],
261
- borderSpacing: S(),
262
- borderWidth: E(),
260
+ borderRadius: ["none", "", "full", we, j],
261
+ borderSpacing: C(),
262
+ borderWidth: M(),
263
263
  contrast: O(),
264
264
  grayscale: T(),
265
265
  hueRotate: O(),
266
266
  invert: T(),
267
- gap: S(),
267
+ gap: C(),
268
268
  gradientColorStops: [e],
269
269
  gradientColorStopPositions: [vn, be],
270
270
  inset: U(),
271
271
  margin: U(),
272
272
  opacity: O(),
273
- padding: S(),
273
+ padding: C(),
274
274
  saturate: O(),
275
275
  scale: O(),
276
276
  sepia: T(),
277
277
  skew: O(),
278
- space: S(),
279
- translate: S()
278
+ space: C(),
279
+ translate: C()
280
280
  },
281
281
  classGroups: {
282
282
  // Layout
@@ -285,7 +285,7 @@ const D = (e) => {
285
285
  * @see https://tailwindcss.com/docs/aspect-ratio
286
286
  */
287
287
  aspect: [{
288
- aspect: ["auto", "square", "video", L]
288
+ aspect: ["auto", "square", "video", j]
289
289
  }],
290
290
  /**
291
291
  * Container
@@ -370,7 +370,7 @@ const D = (e) => {
370
370
  * @see https://tailwindcss.com/docs/object-position
371
371
  */
372
372
  "object-position": [{
373
- object: [...N(), L]
373
+ object: [...R(), j]
374
374
  }],
375
375
  /**
376
376
  * Overflow
@@ -492,7 +492,7 @@ const D = (e) => {
492
492
  * @see https://tailwindcss.com/docs/z-index
493
493
  */
494
494
  z: [{
495
- z: ["auto", Pe, L]
495
+ z: ["auto", Pe, j]
496
496
  }],
497
497
  // Flexbox and Grid
498
498
  /**
@@ -521,7 +521,7 @@ const D = (e) => {
521
521
  * @see https://tailwindcss.com/docs/flex
522
522
  */
523
523
  flex: [{
524
- flex: ["1", "auto", "initial", "none", L]
524
+ flex: ["1", "auto", "initial", "none", j]
525
525
  }],
526
526
  /**
527
527
  * Flex Grow
@@ -542,7 +542,7 @@ const D = (e) => {
542
542
  * @see https://tailwindcss.com/docs/order
543
543
  */
544
544
  order: [{
545
- order: ["first", "last", "none", Pe, L]
545
+ order: ["first", "last", "none", Pe, j]
546
546
  }],
547
547
  /**
548
548
  * Grid Template Columns
@@ -557,22 +557,22 @@ const D = (e) => {
557
557
  */
558
558
  "col-start-end": [{
559
559
  col: ["auto", {
560
- span: ["full", Pe, L]
561
- }, L]
560
+ span: ["full", Pe, j]
561
+ }, j]
562
562
  }],
563
563
  /**
564
564
  * Grid Column Start
565
565
  * @see https://tailwindcss.com/docs/grid-column
566
566
  */
567
567
  "col-start": [{
568
- "col-start": j()
568
+ "col-start": L()
569
569
  }],
570
570
  /**
571
571
  * Grid Column End
572
572
  * @see https://tailwindcss.com/docs/grid-column
573
573
  */
574
574
  "col-end": [{
575
- "col-end": j()
575
+ "col-end": L()
576
576
  }],
577
577
  /**
578
578
  * Grid Template Rows
@@ -587,22 +587,22 @@ const D = (e) => {
587
587
  */
588
588
  "row-start-end": [{
589
589
  row: ["auto", {
590
- span: [Pe, L]
591
- }, L]
590
+ span: [Pe, j]
591
+ }, j]
592
592
  }],
593
593
  /**
594
594
  * Grid Row Start
595
595
  * @see https://tailwindcss.com/docs/grid-row
596
596
  */
597
597
  "row-start": [{
598
- "row-start": j()
598
+ "row-start": L()
599
599
  }],
600
600
  /**
601
601
  * Grid Row End
602
602
  * @see https://tailwindcss.com/docs/grid-row
603
603
  */
604
604
  "row-end": [{
605
- "row-end": j()
605
+ "row-end": L()
606
606
  }],
607
607
  /**
608
608
  * Grid Auto Flow
@@ -616,14 +616,14 @@ const D = (e) => {
616
616
  * @see https://tailwindcss.com/docs/grid-auto-columns
617
617
  */
618
618
  "auto-cols": [{
619
- "auto-cols": ["auto", "min", "max", "fr", L]
619
+ "auto-cols": ["auto", "min", "max", "fr", j]
620
620
  }],
621
621
  /**
622
622
  * Grid Auto Rows
623
623
  * @see https://tailwindcss.com/docs/grid-auto-rows
624
624
  */
625
625
  "auto-rows": [{
626
- "auto-rows": ["auto", "min", "max", "fr", L]
626
+ "auto-rows": ["auto", "min", "max", "fr", j]
627
627
  }],
628
628
  /**
629
629
  * Gap
@@ -715,63 +715,63 @@ const D = (e) => {
715
715
  * @see https://tailwindcss.com/docs/padding
716
716
  */
717
717
  p: [{
718
- p: [C]
718
+ p: [E]
719
719
  }],
720
720
  /**
721
721
  * Padding X
722
722
  * @see https://tailwindcss.com/docs/padding
723
723
  */
724
724
  px: [{
725
- px: [C]
725
+ px: [E]
726
726
  }],
727
727
  /**
728
728
  * Padding Y
729
729
  * @see https://tailwindcss.com/docs/padding
730
730
  */
731
731
  py: [{
732
- py: [C]
732
+ py: [E]
733
733
  }],
734
734
  /**
735
735
  * Padding Start
736
736
  * @see https://tailwindcss.com/docs/padding
737
737
  */
738
738
  ps: [{
739
- ps: [C]
739
+ ps: [E]
740
740
  }],
741
741
  /**
742
742
  * Padding End
743
743
  * @see https://tailwindcss.com/docs/padding
744
744
  */
745
745
  pe: [{
746
- pe: [C]
746
+ pe: [E]
747
747
  }],
748
748
  /**
749
749
  * Padding Top
750
750
  * @see https://tailwindcss.com/docs/padding
751
751
  */
752
752
  pt: [{
753
- pt: [C]
753
+ pt: [E]
754
754
  }],
755
755
  /**
756
756
  * Padding Right
757
757
  * @see https://tailwindcss.com/docs/padding
758
758
  */
759
759
  pr: [{
760
- pr: [C]
760
+ pr: [E]
761
761
  }],
762
762
  /**
763
763
  * Padding Bottom
764
764
  * @see https://tailwindcss.com/docs/padding
765
765
  */
766
766
  pb: [{
767
- pb: [C]
767
+ pb: [E]
768
768
  }],
769
769
  /**
770
770
  * Padding Left
771
771
  * @see https://tailwindcss.com/docs/padding
772
772
  */
773
773
  pl: [{
774
- pl: [C]
774
+ pl: [E]
775
775
  }],
776
776
  /**
777
777
  * Margin
@@ -841,7 +841,7 @@ const D = (e) => {
841
841
  * @see https://tailwindcss.com/docs/space
842
842
  */
843
843
  "space-x": [{
844
- "space-x": [M]
844
+ "space-x": [S]
845
845
  }],
846
846
  /**
847
847
  * Space Between X Reverse
@@ -853,7 +853,7 @@ const D = (e) => {
853
853
  * @see https://tailwindcss.com/docs/space
854
854
  */
855
855
  "space-y": [{
856
- "space-y": [M]
856
+ "space-y": [S]
857
857
  }],
858
858
  /**
859
859
  * Space Between Y Reverse
@@ -866,21 +866,21 @@ const D = (e) => {
866
866
  * @see https://tailwindcss.com/docs/width
867
867
  */
868
868
  w: [{
869
- w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", L, t]
869
+ w: ["auto", "min", "max", "fit", "svw", "lvw", "dvw", j, t]
870
870
  }],
871
871
  /**
872
872
  * Min-Width
873
873
  * @see https://tailwindcss.com/docs/min-width
874
874
  */
875
875
  "min-w": [{
876
- "min-w": [L, t, "min", "max", "fit"]
876
+ "min-w": [j, t, "min", "max", "fit"]
877
877
  }],
878
878
  /**
879
879
  * Max-Width
880
880
  * @see https://tailwindcss.com/docs/max-width
881
881
  */
882
882
  "max-w": [{
883
- "max-w": [L, t, "none", "full", "min", "max", "fit", "prose", {
883
+ "max-w": [j, t, "none", "full", "min", "max", "fit", "prose", {
884
884
  screen: [we]
885
885
  }, we]
886
886
  }],
@@ -889,28 +889,28 @@ const D = (e) => {
889
889
  * @see https://tailwindcss.com/docs/height
890
890
  */
891
891
  h: [{
892
- h: [L, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
892
+ h: [j, t, "auto", "min", "max", "fit", "svh", "lvh", "dvh"]
893
893
  }],
894
894
  /**
895
895
  * Min-Height
896
896
  * @see https://tailwindcss.com/docs/min-height
897
897
  */
898
898
  "min-h": [{
899
- "min-h": [L, t, "min", "max", "fit", "svh", "lvh", "dvh"]
899
+ "min-h": [j, t, "min", "max", "fit", "svh", "lvh", "dvh"]
900
900
  }],
901
901
  /**
902
902
  * Max-Height
903
903
  * @see https://tailwindcss.com/docs/max-height
904
904
  */
905
905
  "max-h": [{
906
- "max-h": [L, t, "min", "max", "fit", "svh", "lvh", "dvh"]
906
+ "max-h": [j, t, "min", "max", "fit", "svh", "lvh", "dvh"]
907
907
  }],
908
908
  /**
909
909
  * Size
910
910
  * @see https://tailwindcss.com/docs/size
911
911
  */
912
912
  size: [{
913
- size: [L, t, "auto", "min", "max", "fit"]
913
+ size: [j, t, "auto", "min", "max", "fit"]
914
914
  }],
915
915
  // Typography
916
916
  /**
@@ -979,35 +979,35 @@ const D = (e) => {
979
979
  * @see https://tailwindcss.com/docs/letter-spacing
980
980
  */
981
981
  tracking: [{
982
- tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", L]
982
+ tracking: ["tighter", "tight", "normal", "wide", "wider", "widest", j]
983
983
  }],
984
984
  /**
985
985
  * Line Clamp
986
986
  * @see https://tailwindcss.com/docs/line-clamp
987
987
  */
988
988
  "line-clamp": [{
989
- "line-clamp": ["none", Ae, He]
989
+ "line-clamp": ["none", xe, He]
990
990
  }],
991
991
  /**
992
992
  * Line Height
993
993
  * @see https://tailwindcss.com/docs/line-height
994
994
  */
995
995
  leading: [{
996
- leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe, L]
996
+ leading: ["none", "tight", "snug", "normal", "relaxed", "loose", fe, j]
997
997
  }],
998
998
  /**
999
999
  * List Style Image
1000
1000
  * @see https://tailwindcss.com/docs/list-style-image
1001
1001
  */
1002
1002
  "list-image": [{
1003
- "list-image": ["none", L]
1003
+ "list-image": ["none", j]
1004
1004
  }],
1005
1005
  /**
1006
1006
  * List Style Type
1007
1007
  * @see https://tailwindcss.com/docs/list-style-type
1008
1008
  */
1009
1009
  "list-style-type": [{
1010
- list: ["none", "disc", "decimal", L]
1010
+ list: ["none", "disc", "decimal", j]
1011
1011
  }],
1012
1012
  /**
1013
1013
  * List Style Position
@@ -1076,7 +1076,7 @@ const D = (e) => {
1076
1076
  * @see https://tailwindcss.com/docs/text-underline-offset
1077
1077
  */
1078
1078
  "underline-offset": [{
1079
- "underline-offset": ["auto", fe, L]
1079
+ "underline-offset": ["auto", fe, j]
1080
1080
  }],
1081
1081
  /**
1082
1082
  * Text Decoration Color
@@ -1107,14 +1107,14 @@ const D = (e) => {
1107
1107
  * @see https://tailwindcss.com/docs/text-indent
1108
1108
  */
1109
1109
  indent: [{
1110
- indent: S()
1110
+ indent: C()
1111
1111
  }],
1112
1112
  /**
1113
1113
  * Vertical Alignment
1114
1114
  * @see https://tailwindcss.com/docs/vertical-align
1115
1115
  */
1116
1116
  "vertical-align": [{
1117
- align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", L]
1117
+ align: ["baseline", "top", "middle", "bottom", "text-top", "text-bottom", "sub", "super", j]
1118
1118
  }],
1119
1119
  /**
1120
1120
  * Whitespace
@@ -1142,7 +1142,7 @@ const D = (e) => {
1142
1142
  * @see https://tailwindcss.com/docs/content
1143
1143
  */
1144
1144
  content: [{
1145
- content: ["none", L]
1145
+ content: ["none", j]
1146
1146
  }],
1147
1147
  // Backgrounds
1148
1148
  /**
@@ -1179,7 +1179,7 @@ const D = (e) => {
1179
1179
  * @see https://tailwindcss.com/docs/background-position
1180
1180
  */
1181
1181
  "bg-position": [{
1182
- bg: [...N(), Tn]
1182
+ bg: [...R(), Tn]
1183
1183
  }],
1184
1184
  /**
1185
1185
  * Background Repeat
@@ -1204,7 +1204,7 @@ const D = (e) => {
1204
1204
  "bg-image": [{
1205
1205
  bg: ["none", {
1206
1206
  "gradient-to": ["t", "tr", "r", "br", "b", "bl", "l", "tl"]
1207
- }, xn]
1207
+ }, An]
1208
1208
  }],
1209
1209
  /**
1210
1210
  * Background Color
@@ -1558,7 +1558,7 @@ const D = (e) => {
1558
1558
  * @see https://tailwindcss.com/docs/outline-offset
1559
1559
  */
1560
1560
  "outline-offset": [{
1561
- "outline-offset": [fe, L]
1561
+ "outline-offset": [fe, j]
1562
1562
  }],
1563
1563
  /**
1564
1564
  * Outline Width
@@ -1579,7 +1579,7 @@ const D = (e) => {
1579
1579
  * @see https://tailwindcss.com/docs/ring-width
1580
1580
  */
1581
1581
  "ring-w": [{
1582
- ring: E()
1582
+ ring: M()
1583
1583
  }],
1584
1584
  /**
1585
1585
  * Ring Width Inset
@@ -1641,14 +1641,14 @@ const D = (e) => {
1641
1641
  * @see https://tailwindcss.com/docs/mix-blend-mode
1642
1642
  */
1643
1643
  "mix-blend": [{
1644
- "mix-blend": [...G(), "plus-lighter", "plus-darker"]
1644
+ "mix-blend": [...B(), "plus-lighter", "plus-darker"]
1645
1645
  }],
1646
1646
  /**
1647
1647
  * Background Blend Mode
1648
1648
  * @see https://tailwindcss.com/docs/background-blend-mode
1649
1649
  */
1650
1650
  "bg-blend": [{
1651
- "bg-blend": G()
1651
+ "bg-blend": B()
1652
1652
  }],
1653
1653
  // Filters
1654
1654
  /**
@@ -1678,14 +1678,14 @@ const D = (e) => {
1678
1678
  * @see https://tailwindcss.com/docs/contrast
1679
1679
  */
1680
1680
  contrast: [{
1681
- contrast: [d]
1681
+ contrast: [u]
1682
1682
  }],
1683
1683
  /**
1684
1684
  * Drop Shadow
1685
1685
  * @see https://tailwindcss.com/docs/drop-shadow
1686
1686
  */
1687
1687
  "drop-shadow": [{
1688
- "drop-shadow": ["", "none", we, L]
1688
+ "drop-shadow": ["", "none", we, j]
1689
1689
  }],
1690
1690
  /**
1691
1691
  * Grayscale
@@ -1749,7 +1749,7 @@ const D = (e) => {
1749
1749
  * @see https://tailwindcss.com/docs/backdrop-contrast
1750
1750
  */
1751
1751
  "backdrop-contrast": [{
1752
- "backdrop-contrast": [d]
1752
+ "backdrop-contrast": [u]
1753
1753
  }],
1754
1754
  /**
1755
1755
  * Backdrop Grayscale
@@ -1842,7 +1842,7 @@ const D = (e) => {
1842
1842
  * @see https://tailwindcss.com/docs/transition-property
1843
1843
  */
1844
1844
  transition: [{
1845
- transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", L]
1845
+ transition: ["none", "all", "", "colors", "opacity", "shadow", "transform", j]
1846
1846
  }],
1847
1847
  /**
1848
1848
  * Transition Duration
@@ -1856,7 +1856,7 @@ const D = (e) => {
1856
1856
  * @see https://tailwindcss.com/docs/transition-timing-function
1857
1857
  */
1858
1858
  ease: [{
1859
- ease: ["linear", "in", "out", "in-out", L]
1859
+ ease: ["linear", "in", "out", "in-out", j]
1860
1860
  }],
1861
1861
  /**
1862
1862
  * Transition Delay
@@ -1870,7 +1870,7 @@ const D = (e) => {
1870
1870
  * @see https://tailwindcss.com/docs/animation
1871
1871
  */
1872
1872
  animate: [{
1873
- animate: ["none", "spin", "ping", "pulse", "bounce", L]
1873
+ animate: ["none", "spin", "ping", "pulse", "bounce", j]
1874
1874
  }],
1875
1875
  // Transforms
1876
1876
  /**
@@ -1885,28 +1885,28 @@ const D = (e) => {
1885
1885
  * @see https://tailwindcss.com/docs/scale
1886
1886
  */
1887
1887
  scale: [{
1888
- scale: [R]
1888
+ scale: [N]
1889
1889
  }],
1890
1890
  /**
1891
1891
  * Scale X
1892
1892
  * @see https://tailwindcss.com/docs/scale
1893
1893
  */
1894
1894
  "scale-x": [{
1895
- "scale-x": [R]
1895
+ "scale-x": [N]
1896
1896
  }],
1897
1897
  /**
1898
1898
  * Scale Y
1899
1899
  * @see https://tailwindcss.com/docs/scale
1900
1900
  */
1901
1901
  "scale-y": [{
1902
- "scale-y": [R]
1902
+ "scale-y": [N]
1903
1903
  }],
1904
1904
  /**
1905
1905
  * Rotate
1906
1906
  * @see https://tailwindcss.com/docs/rotate
1907
1907
  */
1908
1908
  rotate: [{
1909
- rotate: [Pe, L]
1909
+ rotate: [Pe, j]
1910
1910
  }],
1911
1911
  /**
1912
1912
  * Translate X
@@ -1927,21 +1927,21 @@ const D = (e) => {
1927
1927
  * @see https://tailwindcss.com/docs/skew
1928
1928
  */
1929
1929
  "skew-x": [{
1930
- "skew-x": [A]
1930
+ "skew-x": [x]
1931
1931
  }],
1932
1932
  /**
1933
1933
  * Skew Y
1934
1934
  * @see https://tailwindcss.com/docs/skew
1935
1935
  */
1936
1936
  "skew-y": [{
1937
- "skew-y": [A]
1937
+ "skew-y": [x]
1938
1938
  }],
1939
1939
  /**
1940
1940
  * Transform Origin
1941
1941
  * @see https://tailwindcss.com/docs/transform-origin
1942
1942
  */
1943
1943
  "transform-origin": [{
1944
- origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", L]
1944
+ origin: ["center", "top", "top-right", "right", "bottom-right", "bottom", "bottom-left", "left", "top-left", j]
1945
1945
  }],
1946
1946
  // Interactivity
1947
1947
  /**
@@ -1963,7 +1963,7 @@ const D = (e) => {
1963
1963
  * @see https://tailwindcss.com/docs/cursor
1964
1964
  */
1965
1965
  cursor: [{
1966
- cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", L]
1966
+ cursor: ["auto", "default", "pointer", "wait", "text", "move", "help", "not-allowed", "none", "context-menu", "progress", "cell", "crosshair", "vertical-text", "alias", "copy", "no-drop", "grab", "grabbing", "all-scroll", "col-resize", "row-resize", "n-resize", "e-resize", "s-resize", "w-resize", "ne-resize", "nw-resize", "se-resize", "sw-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "zoom-in", "zoom-out", j]
1967
1967
  }],
1968
1968
  /**
1969
1969
  * Caret Color
@@ -1998,126 +1998,126 @@ const D = (e) => {
1998
1998
  * @see https://tailwindcss.com/docs/scroll-margin
1999
1999
  */
2000
2000
  "scroll-m": [{
2001
- "scroll-m": S()
2001
+ "scroll-m": C()
2002
2002
  }],
2003
2003
  /**
2004
2004
  * Scroll Margin X
2005
2005
  * @see https://tailwindcss.com/docs/scroll-margin
2006
2006
  */
2007
2007
  "scroll-mx": [{
2008
- "scroll-mx": S()
2008
+ "scroll-mx": C()
2009
2009
  }],
2010
2010
  /**
2011
2011
  * Scroll Margin Y
2012
2012
  * @see https://tailwindcss.com/docs/scroll-margin
2013
2013
  */
2014
2014
  "scroll-my": [{
2015
- "scroll-my": S()
2015
+ "scroll-my": C()
2016
2016
  }],
2017
2017
  /**
2018
2018
  * Scroll Margin Start
2019
2019
  * @see https://tailwindcss.com/docs/scroll-margin
2020
2020
  */
2021
2021
  "scroll-ms": [{
2022
- "scroll-ms": S()
2022
+ "scroll-ms": C()
2023
2023
  }],
2024
2024
  /**
2025
2025
  * Scroll Margin End
2026
2026
  * @see https://tailwindcss.com/docs/scroll-margin
2027
2027
  */
2028
2028
  "scroll-me": [{
2029
- "scroll-me": S()
2029
+ "scroll-me": C()
2030
2030
  }],
2031
2031
  /**
2032
2032
  * Scroll Margin Top
2033
2033
  * @see https://tailwindcss.com/docs/scroll-margin
2034
2034
  */
2035
2035
  "scroll-mt": [{
2036
- "scroll-mt": S()
2036
+ "scroll-mt": C()
2037
2037
  }],
2038
2038
  /**
2039
2039
  * Scroll Margin Right
2040
2040
  * @see https://tailwindcss.com/docs/scroll-margin
2041
2041
  */
2042
2042
  "scroll-mr": [{
2043
- "scroll-mr": S()
2043
+ "scroll-mr": C()
2044
2044
  }],
2045
2045
  /**
2046
2046
  * Scroll Margin Bottom
2047
2047
  * @see https://tailwindcss.com/docs/scroll-margin
2048
2048
  */
2049
2049
  "scroll-mb": [{
2050
- "scroll-mb": S()
2050
+ "scroll-mb": C()
2051
2051
  }],
2052
2052
  /**
2053
2053
  * Scroll Margin Left
2054
2054
  * @see https://tailwindcss.com/docs/scroll-margin
2055
2055
  */
2056
2056
  "scroll-ml": [{
2057
- "scroll-ml": S()
2057
+ "scroll-ml": C()
2058
2058
  }],
2059
2059
  /**
2060
2060
  * Scroll Padding
2061
2061
  * @see https://tailwindcss.com/docs/scroll-padding
2062
2062
  */
2063
2063
  "scroll-p": [{
2064
- "scroll-p": S()
2064
+ "scroll-p": C()
2065
2065
  }],
2066
2066
  /**
2067
2067
  * Scroll Padding X
2068
2068
  * @see https://tailwindcss.com/docs/scroll-padding
2069
2069
  */
2070
2070
  "scroll-px": [{
2071
- "scroll-px": S()
2071
+ "scroll-px": C()
2072
2072
  }],
2073
2073
  /**
2074
2074
  * Scroll Padding Y
2075
2075
  * @see https://tailwindcss.com/docs/scroll-padding
2076
2076
  */
2077
2077
  "scroll-py": [{
2078
- "scroll-py": S()
2078
+ "scroll-py": C()
2079
2079
  }],
2080
2080
  /**
2081
2081
  * Scroll Padding Start
2082
2082
  * @see https://tailwindcss.com/docs/scroll-padding
2083
2083
  */
2084
2084
  "scroll-ps": [{
2085
- "scroll-ps": S()
2085
+ "scroll-ps": C()
2086
2086
  }],
2087
2087
  /**
2088
2088
  * Scroll Padding End
2089
2089
  * @see https://tailwindcss.com/docs/scroll-padding
2090
2090
  */
2091
2091
  "scroll-pe": [{
2092
- "scroll-pe": S()
2092
+ "scroll-pe": C()
2093
2093
  }],
2094
2094
  /**
2095
2095
  * Scroll Padding Top
2096
2096
  * @see https://tailwindcss.com/docs/scroll-padding
2097
2097
  */
2098
2098
  "scroll-pt": [{
2099
- "scroll-pt": S()
2099
+ "scroll-pt": C()
2100
2100
  }],
2101
2101
  /**
2102
2102
  * Scroll Padding Right
2103
2103
  * @see https://tailwindcss.com/docs/scroll-padding
2104
2104
  */
2105
2105
  "scroll-pr": [{
2106
- "scroll-pr": S()
2106
+ "scroll-pr": C()
2107
2107
  }],
2108
2108
  /**
2109
2109
  * Scroll Padding Bottom
2110
2110
  * @see https://tailwindcss.com/docs/scroll-padding
2111
2111
  */
2112
2112
  "scroll-pb": [{
2113
- "scroll-pb": S()
2113
+ "scroll-pb": C()
2114
2114
  }],
2115
2115
  /**
2116
2116
  * Scroll Padding Left
2117
2117
  * @see https://tailwindcss.com/docs/scroll-padding
2118
2118
  */
2119
2119
  "scroll-pl": [{
2120
- "scroll-pl": S()
2120
+ "scroll-pl": C()
2121
2121
  }],
2122
2122
  /**
2123
2123
  * Scroll Snap Align
@@ -2185,7 +2185,7 @@ const D = (e) => {
2185
2185
  * @see https://tailwindcss.com/docs/will-change
2186
2186
  */
2187
2187
  "will-change": [{
2188
- "will-change": ["auto", "scroll", "contents", "transform", L]
2188
+ "will-change": ["auto", "scroll", "contents", "transform", j]
2189
2189
  }],
2190
2190
  // SVG
2191
2191
  /**
@@ -2279,7 +2279,7 @@ const D = (e) => {
2279
2279
  function to(...e) {
2280
2280
  return _n(Yt(e));
2281
2281
  }
2282
- function Rn(e) {
2282
+ function Nn(e) {
2283
2283
  let t = !1, n = "";
2284
2284
  for (const o of e) {
2285
2285
  if (o === "\\") {
@@ -2300,7 +2300,7 @@ function tt(e) {
2300
2300
  try {
2301
2301
  return JSON.parse(t);
2302
2302
  } catch {
2303
- const n = Rn(t);
2303
+ const n = Nn(t);
2304
2304
  if (n)
2305
2305
  try {
2306
2306
  return JSON.parse(n);
@@ -2310,7 +2310,7 @@ function tt(e) {
2310
2310
  return null;
2311
2311
  }
2312
2312
  }
2313
- function Nn(e) {
2313
+ function Rn(e) {
2314
2314
  return typeof e != "string" ? !1 : /^[\s\n]*[-*]\s|^[\s\n]*#+\s|```|^\s*\[.*\]\(|^>\s/.test(e);
2315
2315
  }
2316
2316
  function zn(e) {
@@ -2399,7 +2399,7 @@ function Pt(e) {
2399
2399
  }
2400
2400
  function no(e) {
2401
2401
  const t = Pt(e);
2402
- return typeof e == "string" && Nn(e) ? { content: e, isMarkdown: !0 } : { content: t, isMarkdown: !1 };
2402
+ return typeof e == "string" && Rn(e) ? { content: e, isMarkdown: !0 } : { content: t, isMarkdown: !1 };
2403
2403
  }
2404
2404
  function $n(e) {
2405
2405
  const t = (r) => {
@@ -2448,12 +2448,12 @@ function le(e) {
2448
2448
  );
2449
2449
  }
2450
2450
  function nt(e) {
2451
- var w, k, C, I, R, P;
2451
+ var w, k, E, I, N, P;
2452
2452
  if (!e || typeof e != "object") return null;
2453
2453
  const t = le(e), n = Kn(t);
2454
2454
  if (!n)
2455
2455
  return null;
2456
- const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(rt) : void 0, o = Vn(t.content ?? t.parts, !!(r != null && r.length)), s = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, a = t.createdAt ?? ((w = t.additionalKwargs) == null ? void 0 : w.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((k = t.additionalKwargs) == null ? void 0 : k.agentName) ?? void 0, d = t.model ?? ((C = t.additionalKwargs) == null ? void 0 : C.model) ?? void 0, c = t.toolCallId ?? void 0, l = t.additionalKwargs ?? void 0, p = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((I = t.additionalKwargs) == null ? void 0 : I.checkpointId) ?? void 0, h = t.checkpointNs ?? ((R = t.additionalKwargs) == null ? void 0 : R.checkpointNs) ?? void 0, v = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((P = t.additionalKwargs) != null && P.toolStreaming);
2456
+ const r = Array.isArray(t.toolCalls) ? t.toolCalls.map(rt) : void 0, o = Vn(t.content ?? t.parts, !!(r != null && r.length)), s = t.id ?? `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, a = t.createdAt ?? ((w = t.additionalKwargs) == null ? void 0 : w.createdAt) ?? (/* @__PURE__ */ new Date()).toISOString(), i = t.name ?? ((k = t.additionalKwargs) == null ? void 0 : k.agentName) ?? void 0, u = t.model ?? ((E = t.additionalKwargs) == null ? void 0 : E.model) ?? void 0, c = t.toolCallId ?? void 0, l = t.additionalKwargs ?? void 0, p = t.responseMetadata ?? void 0, m = t.checkpointId ?? ((I = t.additionalKwargs) == null ? void 0 : I.checkpointId) ?? void 0, h = t.checkpointNs ?? ((N = t.additionalKwargs) == null ? void 0 : N.checkpointNs) ?? void 0, v = typeof t.toolStreaming == "boolean" ? t.toolStreaming : !!((P = t.additionalKwargs) != null && P.toolStreaming);
2457
2457
  return {
2458
2458
  ...t,
2459
2459
  id: s,
@@ -2461,7 +2461,7 @@ function nt(e) {
2461
2461
  content: o,
2462
2462
  createdAt: a,
2463
2463
  name: i,
2464
- model: d,
2464
+ model: u,
2465
2465
  toolCallId: c,
2466
2466
  toolCalls: r,
2467
2467
  checkpointId: m,
@@ -2493,7 +2493,7 @@ function rt(e) {
2493
2493
  };
2494
2494
  }
2495
2495
  function Vn(e, t) {
2496
- return Array.isArray(e) ? e.map((n) => n.type === "tool_call" || n.type === "tool" ? t ? null : rt(le(n)) : n).filter(
2496
+ return typeof e == "string" ? [{ type: "text", text: e }] : Array.isArray(e) ? e.map((n) => typeof n == "string" ? { type: "text", text: n } : n.type === "tool_call" || n.type === "tool" ? t ? null : rt(le(n)) : n).filter(
2497
2497
  (n) => !!(n && typeof n == "object" && typeof n.type == "string")
2498
2498
  ) : [];
2499
2499
  }
@@ -2504,12 +2504,12 @@ function Kn(e) {
2504
2504
  const r = t.type;
2505
2505
  return r === "human" ? "user" : r === "ai" ? "assistant" : r === "tool" ? "tool" : r === "system" ? "system" : null;
2506
2506
  }
2507
- function dt(e) {
2507
+ function ut(e) {
2508
2508
  if (!e) return null;
2509
2509
  const t = String(e).toLowerCase();
2510
2510
  return t === "running" || t === "pending" ? "pending" : t === "completed" || t === "success" ? "completed" : t === "error" || t === "failed" || t === "failure" ? "error" : null;
2511
2511
  }
2512
- function ut(e) {
2512
+ function dt(e) {
2513
2513
  return (Array.isArray(e.toolCalls) ? e.toolCalls : Mt(e)).map(rt);
2514
2514
  }
2515
2515
  function We(e, t) {
@@ -2535,10 +2535,10 @@ function Gn(e, t) {
2535
2535
  }
2536
2536
  function Hn(e, t = []) {
2537
2537
  if (Array.isArray(e)) {
2538
- const o = e.filter((a) => a.role === "assistant").flatMap((a) => ut(a)), s = /* @__PURE__ */ new Map();
2538
+ const o = e.filter((a) => a.role === "assistant").flatMap((a) => dt(a)), s = /* @__PURE__ */ new Map();
2539
2539
  return o.forEach((a) => s.set(a.id, a)), Array.from(s.values()).map((a) => {
2540
2540
  var p, m, h;
2541
- const i = We(a.id, e) || We(a.id, t), d = Array.isArray((p = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : p.toolProgress) ? (m = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : m.toolProgress : void 0, c = (i == null ? void 0 : i.artifact) ?? a.artifact, l = dt(a.status) ?? ((h = i == null ? void 0 : i.additionalKwargs) != null && h.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
2541
+ const i = We(a.id, e) || We(a.id, t), u = Array.isArray((p = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : p.toolProgress) ? (m = i == null ? void 0 : i.additionalKwargs) == null ? void 0 : m.toolProgress : void 0, c = (i == null ? void 0 : i.artifact) ?? a.artifact, l = ut(a.status) ?? ((h = i == null ? void 0 : i.additionalKwargs) != null && h.toolStreaming ? "pending" : null) ?? (i ? "completed" : "pending");
2542
2542
  if (i && !a.content && l === "completed") {
2543
2543
  const v = ce(i);
2544
2544
  typeof v == "string" && (a.content = v);
@@ -2547,16 +2547,16 @@ function Hn(e, t = []) {
2547
2547
  call: a,
2548
2548
  result: i,
2549
2549
  state: l,
2550
- progress: d,
2550
+ progress: u,
2551
2551
  artifact: c
2552
2552
  };
2553
2553
  });
2554
2554
  }
2555
2555
  if (e.role !== "assistant") return [];
2556
- const n = ut(e);
2556
+ const n = dt(e);
2557
2557
  return n.length === 0 ? [] : n.map((r) => {
2558
- var d, c, l;
2559
- const o = We(r.id, t) ?? Gn(e, r), s = Array.isArray((d = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : d.toolProgress) ? (c = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : c.toolProgress : void 0, a = (o == null ? void 0 : o.artifact) ?? r.artifact, i = dt(r.status) ?? ((l = o == null ? void 0 : o.additionalKwargs) != null && l.toolStreaming ? "pending" : null) ?? (o ? "completed" : "pending");
2558
+ var u, c, l;
2559
+ const o = We(r.id, t) ?? Gn(e, r), s = Array.isArray((u = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : u.toolProgress) ? (c = o == null ? void 0 : o.additionalKwargs) == null ? void 0 : c.toolProgress : void 0, a = (o == null ? void 0 : o.artifact) ?? r.artifact, i = ut(r.status) ?? ((l = o == null ? void 0 : o.additionalKwargs) != null && l.toolStreaming ? "pending" : null) ?? (o ? "completed" : "pending");
2560
2560
  if (o && !r.content && i === "completed") {
2561
2561
  const p = ce(o);
2562
2562
  typeof p == "string" && (r.content = p);
@@ -2573,7 +2573,7 @@ function Hn(e, t = []) {
2573
2573
  function oo(e, t = []) {
2574
2574
  return Hn(e, t).map((n) => n.artifact).filter((n) => !!n);
2575
2575
  }
2576
- const Re = {
2576
+ const Ne = {
2577
2577
  authToken: "authToken",
2578
2578
  authTokenExpiresAt: "authTokenExpiresAt",
2579
2579
  authSessionId: "authSessionId",
@@ -2593,11 +2593,11 @@ function _t() {
2593
2593
  function ke(e) {
2594
2594
  Ge = e, Ye.forEach((t) => t(e));
2595
2595
  }
2596
- function Rt(e) {
2596
+ function Nt(e) {
2597
2597
  return Ye.add(e), () => Ye.delete(e);
2598
2598
  }
2599
2599
  const Wn = 12e4, qn = 12e4;
2600
- let Ze = Wn, Nt = qn;
2600
+ let Ze = Wn, Rt = qn;
2601
2601
  const oe = Xt.create({
2602
2602
  // BaseURL is set dynamically via ApiProvider -> api.updateConfig
2603
2603
  timeout: Ze,
@@ -2608,10 +2608,10 @@ function ft(e) {
2608
2608
  }
2609
2609
  function Jn(e) {
2610
2610
  const t = ft(e.requestTimeoutMs), n = ft(e.historyTimeoutMs);
2611
- t !== null && (Ze = t, oe.defaults.timeout = Ze), n !== null && (Nt = n);
2611
+ t !== null && (Ze = t, oe.defaults.timeout = Ze), n !== null && (Rt = n);
2612
2612
  }
2613
2613
  function Xn() {
2614
- return Nt;
2614
+ return Rt;
2615
2615
  }
2616
2616
  oe.interceptors.request.use((e) => (Ge && (e.headers.Authorization = `Bearer ${Ge}`), e));
2617
2617
  oe.interceptors.response.use(
@@ -2619,7 +2619,7 @@ oe.interceptors.response.use(
2619
2619
  if (typeof window < "u" && (e != null && e.data))
2620
2620
  try {
2621
2621
  const t = e.data, n = t.data || {}, r = typeof t.token == "string" && t.token || typeof n.token == "string" && n.token || null, o = typeof t.expires_at == "number" && t.expires_at || typeof n.expires_at == "number" && n.expires_at || typeof t.expiresAt == "number" && t.expiresAt || typeof n.expiresAt == "number" && n.expiresAt || null;
2622
- r && (localStorage.setItem(Re.authToken, r), ke(r)), o && localStorage.setItem(Re.authTokenExpiresAt, o.toString()), (r || o) && window.dispatchEvent(
2622
+ r && (localStorage.setItem(Ne.authToken, r), ke(r)), o && localStorage.setItem(Ne.authTokenExpiresAt, o.toString()), (r || o) && window.dispatchEvent(
2623
2623
  new CustomEvent("smartorg:chat-token-updated", {
2624
2624
  detail: { token: r, expiresAt: o }
2625
2625
  })
@@ -2673,7 +2673,7 @@ class Yn {
2673
2673
  ke(t);
2674
2674
  }
2675
2675
  onTokenChange(t) {
2676
- return Rt(t);
2676
+ return Nt(t);
2677
2677
  }
2678
2678
  // ---- Thread Management ----
2679
2679
  async listThreads() {
@@ -2844,7 +2844,7 @@ class er {
2844
2844
  ke(t);
2845
2845
  }
2846
2846
  onTokenChange(t) {
2847
- return Rt(t);
2847
+ return Nt(t);
2848
2848
  }
2849
2849
  // ---- User Management ----
2850
2850
  async listUsers() {
@@ -2856,8 +2856,8 @@ const tr = new er(), Lt = Se(null);
2856
2856
  function nr({ children: e, apiConfig: t }) {
2857
2857
  const n = zt, r = tr;
2858
2858
  if (t) {
2859
- const s = n.baseUrl, a = r.baseUrl, i = n.getAuthToken(), d = t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0;
2860
- (t.baseUrl || t.chatBaseUrl || d) && (d || t.chatBaseUrl && t.chatBaseUrl !== s || t.baseUrl && !s.startsWith(t.baseUrl)) && n.updateConfig(t), (t.baseUrl || t.authBaseUrl) && (t.authBaseUrl && t.authBaseUrl !== a || t.baseUrl && !a.startsWith(t.baseUrl)) && r.updateConfig(t), t.apiKey !== void 0 && t.apiKey !== i && (n.updateConfig({ apiKey: t.apiKey }), r.updateConfig({ apiKey: t.apiKey }));
2859
+ const s = n.baseUrl, a = r.baseUrl, i = n.getAuthToken(), u = t.requestTimeoutMs !== void 0 || t.historyTimeoutMs !== void 0;
2860
+ (t.baseUrl || t.chatBaseUrl || u) && (u || t.chatBaseUrl && t.chatBaseUrl !== s || t.baseUrl && !s.startsWith(t.baseUrl)) && n.updateConfig(t), (t.baseUrl || t.authBaseUrl) && (t.authBaseUrl && t.authBaseUrl !== a || t.baseUrl && !a.startsWith(t.baseUrl)) && r.updateConfig(t), t.apiKey !== void 0 && t.apiKey !== i && (n.updateConfig({ apiKey: t.apiKey }), r.updateConfig({ apiKey: t.apiKey }));
2861
2861
  }
2862
2862
  const o = {
2863
2863
  token: n.getAuthToken(),
@@ -2879,7 +2879,7 @@ async function rr(e) {
2879
2879
  const o = r.result, s = new Uint8Array(o);
2880
2880
  let a = "";
2881
2881
  const i = s.byteLength;
2882
- for (let d = 0; d < i; d++) a += String.fromCharCode(s[d]);
2882
+ for (let u = 0; u < i; u++) a += String.fromCharCode(s[u]);
2883
2883
  t(btoa(a));
2884
2884
  } catch (o) {
2885
2885
  n(o);
@@ -2944,7 +2944,7 @@ function io(e) {
2944
2944
  }).join("|") : "", r = "checkpointId" in e && e.checkpointId ? `cp:${e.checkpointId}` : "", o = "checkpointNs" in e && e.checkpointNs ? `ns:${e.checkpointNs}` : "", s = [r, o].filter(Boolean).join("|");
2945
2945
  return `${e.id}:${t}:${n}${s ? `:${s}` : ""}`;
2946
2946
  }
2947
- function xe() {
2947
+ function Ae() {
2948
2948
  const e = Ue(Lt);
2949
2949
  if (!e) throw new Error("useApi must be used within ApiProvider");
2950
2950
  return e;
@@ -2966,30 +2966,30 @@ function cr(e) {
2966
2966
  return !!e && typeof e == "object" && "data" in e;
2967
2967
  }
2968
2968
  function lr(e = {}) {
2969
- const t = e.baseUrl || "", n = e.streamPath ?? "/runs/stream", [r, o] = B(e.token ?? null), s = H(e.headers ?? {}), a = e.credentials ?? "include", i = H(e);
2969
+ const t = e.baseUrl || "", n = e.streamPath ?? "/runs/stream", [r, o] = D(e.token ?? null), s = H(e.headers ?? {}), a = e.credentials ?? "include", i = H(e);
2970
2970
  q(() => {
2971
2971
  i.current = e;
2972
2972
  }, [e]);
2973
- const d = z((g) => {
2974
- var U, S, E, j, N, V, G, b, T, $;
2973
+ const u = z((g) => {
2974
+ var U, C, M, L, R, V, B, b, T, $;
2975
2975
  const y = i.current;
2976
2976
  if (!y) return;
2977
- (U = y.onEvent) == null || U.call(y, g), g.type === "thread_info" && ((S = y.onThreadInfo) == null || S.call(y, g)), g.type === "values" && Array.isArray(g.checkpoints) && ((E = y.handleValuesEvent) == null || E.call(y, g)), g.type === "metadata" && ((j = y.onMetadataEvent) == null || j.call(y, g)), typeof g.type == "string" && (g.type === "custom" || g.type.startsWith("custom.")) && ((N = y.onCustomEvent) == null || N.call(y, g)), g.type === "updates" && ((V = y.onUpdateEvent) == null || V.call(y, g)), g.type === "tool.end" ? (G = y.onToolEnd) == null || G.call(y, g) : g.type === "tool.start" && ((b = y.onToolStart) == null || b.call(y, g)), g.type === "heartbeat" && ((T = y.onHeartbeat) == null || T.call(y, g)), g.type === "token" && (($ = y.onToken) == null || $.call(y, g.token));
2978
- }, []), [c, l] = B(!1), [p, m] = B(null), [h, v] = B(!1), [f, w] = B(null), k = H(null), C = H(!0), I = H(null), R = z((g) => {
2977
+ (U = y.onEvent) == null || U.call(y, g), g.type === "thread_info" && ((C = y.onThreadInfo) == null || C.call(y, g)), g.type === "values" && Array.isArray(g.checkpoints) && ((M = y.handleValuesEvent) == null || M.call(y, g)), g.type === "metadata" && ((L = y.onMetadataEvent) == null || L.call(y, g)), typeof g.type == "string" && (g.type === "custom" || g.type.startsWith("custom.")) && ((R = y.onCustomEvent) == null || R.call(y, g)), g.type === "updates" && ((V = y.onUpdateEvent) == null || V.call(y, g)), g.type === "tool.end" ? (B = y.onToolEnd) == null || B.call(y, g) : g.type === "tool.start" && ((b = y.onToolStart) == null || b.call(y, g)), g.type === "heartbeat" && ((T = y.onHeartbeat) == null || T.call(y, g)), g.type === "token" && (($ = y.onToken) == null || $.call(y, g.token));
2978
+ }, []), [c, l] = D(!1), [p, m] = D(null), [h, v] = D(!1), [f, w] = D(null), k = H(null), E = H(!0), I = H(null), N = z((g) => {
2979
2979
  o(g);
2980
2980
  }, []), P = z(() => {
2981
2981
  m(null), w(null);
2982
- }, []), A = z(() => {
2983
- var S, E;
2982
+ }, []), x = z(() => {
2983
+ var C, M;
2984
2984
  console.debug("[use-chat] stop() invoked - aborting stream");
2985
- const g = (S = I.current) == null ? void 0 : S.threadId, y = (E = I.current) == null ? void 0 : E.runId, F = () => {
2986
- var j;
2987
- (j = k.current) == null || j.abort(), k.current = null, I.current = null, l(!1), v(!1);
2985
+ const g = (C = I.current) == null ? void 0 : C.threadId, y = (M = I.current) == null ? void 0 : M.runId, F = () => {
2986
+ var L;
2987
+ (L = k.current) == null || L.abort(), k.current = null, I.current = null, l(!1), v(!1);
2988
2988
  };
2989
- (y || g ? zt.cancelRun(y || g).catch((j) => {
2990
- console.warn("[use-chat] cancel run failed:", j);
2989
+ (y || g ? zt.cancelRun(y || g).catch((L) => {
2990
+ console.warn("[use-chat] cancel run failed:", L);
2991
2991
  }) : Promise.resolve()).finally(F);
2992
- }, []), M = z(
2992
+ }, []), S = z(
2993
2993
  (g) => {
2994
2994
  k.current && (k.current.abort(), k.current = null);
2995
2995
  const y = {
@@ -3006,7 +3006,7 @@ function lr(e = {}) {
3006
3006
  l(!0), m(null), w(null);
3007
3007
  const F = new AbortController();
3008
3008
  k.current = F;
3009
- let U = null, S = !1;
3009
+ let U = null, C = !1;
3010
3010
  return I.current = {
3011
3011
  threadId: y.threadId ?? void 0,
3012
3012
  runId: void 0,
@@ -3014,18 +3014,18 @@ function lr(e = {}) {
3014
3014
  headers: {},
3015
3015
  isStreaming: !0
3016
3016
  }, (async () => {
3017
- var E, j, N, V, G, b;
3017
+ var M, L, R, V, B, b;
3018
3018
  try {
3019
3019
  let T = {};
3020
3020
  try {
3021
3021
  if (r)
3022
3022
  T = { Authorization: `Bearer ${r}` };
3023
3023
  else if (typeof window < "u") {
3024
- const ee = window.__AUTH_TOKEN__, ve = ((E = window.localStorage) == null ? void 0 : E.getItem(Re.authToken)) || null;
3024
+ const ee = window.__AUTH_TOKEN__, ve = ((M = window.localStorage) == null ? void 0 : M.getItem(Ne.authToken)) || null;
3025
3025
  let X = null;
3026
3026
  try {
3027
- const me = (j = window.localStorage) == null ? void 0 : j.getItem(Re.chatSettings);
3028
- me && (X = ((N = JSON.parse(me)) == null ? void 0 : N.apiKey) || null);
3027
+ const me = (L = window.localStorage) == null ? void 0 : L.getItem(Ne.chatSettings);
3028
+ me && (X = ((R = JSON.parse(me)) == null ? void 0 : R.apiKey) || null);
3029
3029
  } catch {
3030
3030
  }
3031
3031
  const Y = ee || ve || X || null;
@@ -3037,7 +3037,7 @@ function lr(e = {}) {
3037
3037
  let $ = {};
3038
3038
  if (typeof window < "u")
3039
3039
  try {
3040
- const W = (V = window.localStorage) == null ? void 0 : V.getItem(Re.authSessionId);
3040
+ const W = (V = window.localStorage) == null ? void 0 : V.getItem(Ne.authSessionId);
3041
3041
  W && ($ = { "X-Session-Id": W });
3042
3042
  } catch {
3043
3043
  }
@@ -3045,35 +3045,35 @@ function lr(e = {}) {
3045
3045
  ...T,
3046
3046
  ...$,
3047
3047
  ...s.current
3048
- }, u = {
3048
+ }, d = {
3049
3049
  "Content-Type": "application/json",
3050
3050
  Accept: "text/event-stream",
3051
3051
  ...O
3052
- }, x = await fetch(t + n, {
3052
+ }, A = await fetch(t + n, {
3053
3053
  method: "POST",
3054
- headers: u,
3054
+ headers: d,
3055
3055
  body: JSON.stringify(y),
3056
3056
  signal: F.signal,
3057
3057
  credentials: a
3058
3058
  });
3059
- if (I.current && (I.current.headers = O), !x.ok || !x.body) {
3060
- const W = await x.text().catch(() => "");
3059
+ if (I.current && (I.current.headers = O), !A.ok || !A.body) {
3060
+ const W = await A.text().catch(() => "");
3061
3061
  console.debug(
3062
3062
  "[use-chat] non-OK response",
3063
- x.status,
3063
+ A.status,
3064
3064
  W == null ? void 0 : W.slice(0, 500)
3065
3065
  );
3066
- const ee = `stream ${x.status}${W ? ": " + W : ""}`;
3066
+ const ee = `stream ${A.status}${W ? ": " + W : ""}`;
3067
3067
  throw ee && (m(ee), U = "error"), new Error(ee);
3068
3068
  }
3069
3069
  v(!0);
3070
- const _ = x.body.getReader(), te = new TextDecoder();
3071
- let J = "", K = 0, Z = Date.now();
3070
+ const _ = A.body.getReader(), te = new TextDecoder();
3071
+ let J = "", G = 0, Z = Date.now();
3072
3072
  const ae = setInterval(() => {
3073
3073
  Date.now() - Z > 18e5 && (m("Stream idle timeout"), U = "error", F.abort());
3074
- }, 5e3), de = 1024 * 1024;
3074
+ }, 5e3), ue = 1024 * 1024;
3075
3075
  try {
3076
- const W = x.headers.get("X-Thread-Id") || x.headers.get("x-thread-id"), ee = x.headers.get("X-Run-Id") || x.headers.get("x-run-id");
3076
+ const W = A.headers.get("X-Thread-Id") || A.headers.get("x-thread-id"), ee = A.headers.get("X-Run-Id") || A.headers.get("x-run-id");
3077
3077
  for (I.current && (I.current = {
3078
3078
  ...I.current,
3079
3079
  threadId: W ?? I.current.threadId,
@@ -3081,7 +3081,7 @@ function lr(e = {}) {
3081
3081
  }); ; ) {
3082
3082
  const { value: ve, done: X } = await _.read();
3083
3083
  if (X) break;
3084
- J += te.decode(ve, { stream: !0 }), J.length > de && (J = "", console.warn("Stream buffer reset: exceeded 1MB"));
3084
+ J += te.decode(ve, { stream: !0 }), J.length > ue && (J = "", console.warn("Stream buffer reset: exceeded 1MB"));
3085
3085
  let Y;
3086
3086
  for (; (Y = J.indexOf(`
3087
3087
 
@@ -3089,12 +3089,12 @@ function lr(e = {}) {
3089
3089
  const me = J.slice(0, Y);
3090
3090
  J = J.slice(Y + 2);
3091
3091
  const Le = me.split(/\r?\n/), je = [];
3092
- let ue = null;
3092
+ let de = null;
3093
3093
  for (const ye of Le)
3094
3094
  if (!ye.startsWith(":") && ye) {
3095
3095
  if (ye.startsWith("event:")) {
3096
3096
  const Te = ye.slice(6).trim();
3097
- Te && (ue = Te);
3097
+ Te && (de = Te);
3098
3098
  continue;
3099
3099
  }
3100
3100
  if (ye.startsWith("data:")) {
@@ -3112,7 +3112,7 @@ function lr(e = {}) {
3112
3112
  console.debug("[use-chat] malformed SSE:", Ie.slice(0, 200));
3113
3113
  continue;
3114
3114
  }
3115
- ue && typeof ne == "object" && ne !== null && !("type" in ne) && (ne.type = ue);
3115
+ de && typeof ne == "object" && ne !== null && !("type" in ne) && (ne.type = de);
3116
3116
  const Me = cr(ne) ? ne.data : ne;
3117
3117
  if (!Me) {
3118
3118
  console.warn("[use-chat] dropped envelope event without payload", ne);
@@ -3122,13 +3122,13 @@ function lr(e = {}) {
3122
3122
  Z = Date.now();
3123
3123
  const he = Ee.seq;
3124
3124
  if (he !== void 0) {
3125
- if (he <= K) {
3126
- console.debug("[use-chat] drop duplicate/out-of-order event", { seq: he, lastProcessedSeq: K, type: Ee.type });
3125
+ if (he <= G) {
3126
+ console.debug("[use-chat] drop duplicate/out-of-order event", { seq: he, lastProcessedSeq: G, type: Ee.type });
3127
3127
  continue;
3128
3128
  }
3129
- K = he;
3129
+ G = he;
3130
3130
  }
3131
- d(Ee);
3131
+ u(Ee);
3132
3132
  }
3133
3133
  }
3134
3134
  U === null && !F.signal.aborted && (U = "complete");
@@ -3144,7 +3144,7 @@ function lr(e = {}) {
3144
3144
  await _.cancel();
3145
3145
  } catch {
3146
3146
  } finally {
3147
- (G = _.releaseLock) == null || G.call(_);
3147
+ (B = _.releaseLock) == null || B.call(_);
3148
3148
  }
3149
3149
  clearInterval(ae);
3150
3150
  }
@@ -3153,7 +3153,7 @@ function lr(e = {}) {
3153
3153
  U = U ?? "aborted";
3154
3154
  else {
3155
3155
  const $ = T.message || String(T);
3156
- U = "error", m($), S || (S = !0, (b = e.onConnectionError) == null || b.call(e, $));
3156
+ U = "error", m($), C || (C = !0, (b = e.onConnectionError) == null || b.call(e, $));
3157
3157
  }
3158
3158
  } finally {
3159
3159
  try {
@@ -3174,11 +3174,11 @@ function lr(e = {}) {
3174
3174
  }
3175
3175
  })(), Promise.resolve();
3176
3176
  },
3177
- [t, n, r, e, d]
3177
+ [t, n, r, e, u]
3178
3178
  );
3179
3179
  return q(() => () => {
3180
3180
  var g;
3181
- C.current = !1, (g = k.current) == null || g.abort();
3181
+ E.current = !1, (g = k.current) == null || g.abort();
3182
3182
  }, []), {
3183
3183
  isStreaming: c,
3184
3184
  error: p,
@@ -3191,10 +3191,10 @@ function lr(e = {}) {
3191
3191
  // Deprecated: use checkpoint from reducer
3192
3192
  lastSeq: 0,
3193
3193
  connected: h,
3194
- stream: M,
3195
- stop: A,
3194
+ stream: S,
3195
+ stop: x,
3196
3196
  clear: P,
3197
- setToken: R,
3197
+ setToken: N,
3198
3198
  values: {},
3199
3199
  // Provide empty object for backward compatibility
3200
3200
  interrupt: () => Promise.resolve(),
@@ -3203,10 +3203,10 @@ function lr(e = {}) {
3203
3203
  connectionState: p ? "error" : c ? h ? "connected" : "connecting" : "idle",
3204
3204
  messages: [],
3205
3205
  // useStream doesn't maintain messages, use useChatSession instead
3206
- submit: M
3206
+ submit: S
3207
3207
  };
3208
3208
  }
3209
- const dr = ["detail", "message", "error", "description", "title"];
3209
+ const ur = ["detail", "message", "error", "description", "title"];
3210
3210
  function $e(e) {
3211
3211
  if (!e) return null;
3212
3212
  if (typeof e == "string") {
@@ -3223,7 +3223,7 @@ function $e(e) {
3223
3223
  }
3224
3224
  if (typeof e == "object") {
3225
3225
  const t = e;
3226
- for (const n of dr) {
3226
+ for (const n of ur) {
3227
3227
  const r = $e(t[n]);
3228
3228
  if (r)
3229
3229
  return r;
@@ -3235,7 +3235,7 @@ function $e(e) {
3235
3235
  }
3236
3236
  return null;
3237
3237
  }
3238
- function ur(e) {
3238
+ function dr(e) {
3239
3239
  if (!e) return "Request failed";
3240
3240
  const t = e.response, n = $e(t == null ? void 0 : t.data);
3241
3241
  if (n) return n;
@@ -3256,11 +3256,11 @@ function fr({
3256
3256
  onThreadChange: r,
3257
3257
  onCurrentThreadDeleted: o
3258
3258
  }) {
3259
- const [s, a] = B([]), [i, d] = B(t), [c, l] = B(!1), [p, m] = B(null), [h, v] = B([]), [f, w] = B(!1), [, k] = B(null), [C, I] = B(null), [R, P] = B(!1), A = H(i), M = H(/* @__PURE__ */ new Map());
3259
+ const [s, a] = D([]), [i, u] = D(t), [c, l] = D(!1), [p, m] = D(null), [h, v] = D([]), [f, w] = D(!1), [, k] = D(null), [E, I] = D(null), [N, P] = D(!1), x = H(i), S = H(/* @__PURE__ */ new Map());
3260
3260
  q(() => {
3261
- A.current = i;
3261
+ x.current = i;
3262
3262
  }, [i]), q(() => {
3263
- t !== void 0 && t !== A.current && d(t);
3263
+ t !== void 0 && t !== x.current && u(t);
3264
3264
  }, [t]);
3265
3265
  const g = z(async () => {
3266
3266
  l(!0), m(null);
@@ -3296,7 +3296,7 @@ function fr({
3296
3296
  async (b, T) => {
3297
3297
  try {
3298
3298
  const $ = T && typeof T == "object" ? { id: T.id, name: T.name ?? "" } : void 0, O = await e.createThread(b, $);
3299
- return d(O.threadId), await g(), O.threadId;
3299
+ return u(O.threadId), await g(), O.threadId;
3300
3300
  } catch ($) {
3301
3301
  const O = String($);
3302
3302
  return n == null || n(O), null;
@@ -3306,21 +3306,21 @@ function fr({
3306
3306
  ), U = z(
3307
3307
  async (b) => {
3308
3308
  const T = s;
3309
- a((O) => O.filter((u) => u.threadId !== b));
3309
+ a((O) => O.filter((d) => d.threadId !== b));
3310
3310
  const $ = new AbortController();
3311
- M.current.set(b, $);
3311
+ S.current.set(b, $);
3312
3312
  try {
3313
- await e.deleteThread(b), A.current === b && (d(null), o == null || o());
3313
+ await e.deleteThread(b), x.current === b && (u(null), o == null || o());
3314
3314
  } catch (O) {
3315
3315
  a(T);
3316
- const u = String(O);
3317
- n == null || n(u);
3316
+ const d = String(O);
3317
+ n == null || n(d);
3318
3318
  } finally {
3319
- M.current.delete(b);
3319
+ S.current.delete(b);
3320
3320
  }
3321
3321
  },
3322
3322
  [e, o, n, s]
3323
- ), S = z(
3323
+ ), C = z(
3324
3324
  async (b, T) => {
3325
3325
  try {
3326
3326
  await e.updateThread(b, T), await g();
@@ -3329,20 +3329,20 @@ function fr({
3329
3329
  }
3330
3330
  },
3331
3331
  [e, n, g]
3332
- ), E = z(
3332
+ ), M = z(
3333
3333
  async (b, T) => {
3334
3334
  P(!0), I("Sharing thread…");
3335
3335
  try {
3336
3336
  await e.shareThread(b, T), await y(), I("Shared successfully");
3337
3337
  } catch ($) {
3338
- const O = ur($);
3338
+ const O = dr($);
3339
3339
  throw n == null || n(O), I(`Failed to share: ${O}`), new Error(O);
3340
3340
  } finally {
3341
3341
  P(!1);
3342
3342
  }
3343
3343
  },
3344
3344
  [e, n, y]
3345
- ), j = z(
3345
+ ), L = z(
3346
3346
  async (b, T) => {
3347
3347
  try {
3348
3348
  await e.unshareThread(b, T), await y();
@@ -3352,17 +3352,17 @@ function fr({
3352
3352
  }
3353
3353
  },
3354
3354
  [e, n, y]
3355
- ), N = Q(
3355
+ ), R = Q(
3356
3356
  () => ({
3357
3357
  createThread: F,
3358
3358
  deleteThread: U,
3359
- renameThread: S,
3359
+ renameThread: C,
3360
3360
  refreshThreads: g,
3361
3361
  refreshSharedThreads: y,
3362
- shareThread: E,
3363
- unshareThread: j
3362
+ shareThread: M,
3363
+ unshareThread: L
3364
3364
  }),
3365
- [F, U, S, g, y, E, j]
3365
+ [F, U, C, g, y, M, L]
3366
3366
  ), V = z((b) => {
3367
3367
  if (!(b != null && b.threadId)) return;
3368
3368
  const T = {
@@ -3375,30 +3375,30 @@ function fr({
3375
3375
  };
3376
3376
  a(($) => {
3377
3377
  let O = !1;
3378
- const u = $.map((x) => x.threadId === T.threadId ? (O = !0, console.debug("[useThreadsState] thread_info: updating existing thread", T.threadId), {
3379
- ...x,
3380
- title: T.title ?? x.title,
3381
- project: T.project ?? x.project,
3382
- updatedAt: T.updatedAt ?? x.updatedAt,
3383
- messageCount: T.messageCount ?? x.messageCount
3384
- }) : x);
3385
- return O ? u : (console.debug("[useThreadsState] thread_info: adding thread to list", T.threadId), [T, ...$]);
3378
+ const d = $.map((A) => A.threadId === T.threadId ? (O = !0, console.debug("[useThreadsState] thread_info: updating existing thread", T.threadId), {
3379
+ ...A,
3380
+ title: T.title ?? A.title,
3381
+ project: T.project ?? A.project,
3382
+ updatedAt: T.updatedAt ?? A.updatedAt,
3383
+ messageCount: T.messageCount ?? A.messageCount
3384
+ }) : A);
3385
+ return O ? d : (console.debug("[useThreadsState] thread_info: adding thread to list", T.threadId), [T, ...$]);
3386
3386
  });
3387
- }, []), G = z(() => I(null), []);
3387
+ }, []), B = z(() => I(null), []);
3388
3388
  return {
3389
3389
  threads: s,
3390
3390
  currentThreadId: i,
3391
- currentThreadIdRef: A,
3392
- setCurrentThreadId: d,
3391
+ currentThreadIdRef: x,
3392
+ setCurrentThreadId: u,
3393
3393
  isLoadingThreads: c,
3394
3394
  threadsError: p,
3395
3395
  sharedThreads: h,
3396
3396
  isLoadingSharedThreads: f,
3397
- actions: N,
3397
+ actions: R,
3398
3398
  addThreadFromEvent: V,
3399
- shareInFlight: R,
3400
- shareStatus: C,
3401
- clearShareStatus: G
3399
+ shareInFlight: N,
3400
+ shareStatus: E,
3401
+ clearShareStatus: B
3402
3402
  };
3403
3403
  }
3404
3404
  const Ft = Se(null);
@@ -3408,11 +3408,11 @@ function pr({
3408
3408
  onError: n,
3409
3409
  onThreadChange: r
3410
3410
  }) {
3411
- const { chatApi: o } = xe(), {
3411
+ const { chatApi: o } = Ae(), {
3412
3412
  threads: s,
3413
3413
  currentThreadId: a,
3414
3414
  setCurrentThreadId: i,
3415
- currentThreadIdRef: d,
3415
+ currentThreadIdRef: u,
3416
3416
  isLoadingThreads: c,
3417
3417
  threadsError: l,
3418
3418
  sharedThreads: p,
@@ -3427,12 +3427,12 @@ function pr({
3427
3427
  initialThreadId: t,
3428
3428
  onError: n,
3429
3429
  onThreadChange: r
3430
- }), C = Q(
3430
+ }), E = Q(
3431
3431
  () => ({
3432
3432
  threads: s,
3433
3433
  currentThreadId: a,
3434
3434
  setCurrentThreadId: i,
3435
- currentThreadIdRef: d,
3435
+ currentThreadIdRef: u,
3436
3436
  isLoading: c,
3437
3437
  error: l,
3438
3438
  sharedThreads: p,
@@ -3447,7 +3447,7 @@ function pr({
3447
3447
  s,
3448
3448
  a,
3449
3449
  i,
3450
- d,
3450
+ u,
3451
3451
  c,
3452
3452
  l,
3453
3453
  p,
@@ -3459,7 +3459,7 @@ function pr({
3459
3459
  v
3460
3460
  ]
3461
3461
  );
3462
- return /* @__PURE__ */ ie(Ft.Provider, { value: C, children: e });
3462
+ return /* @__PURE__ */ ie(Ft.Provider, { value: E, children: e });
3463
3463
  }
3464
3464
  function ot(e) {
3465
3465
  const t = Ue(Ft);
@@ -3586,21 +3586,21 @@ function br(e = []) {
3586
3586
  typeof window < "u" && typeof window.requestAnimationFrame == "function" ? o.current === null && (o.current = window.requestAnimationFrame(() => s())) : setTimeout(s, 8);
3587
3587
  }, [s]), i = z((c) => {
3588
3588
  r.current.push(c), a();
3589
- }, [a]), d = Q(() => ({
3589
+ }, [a]), u = Q(() => ({
3590
3590
  setStatus: (c, l) => n({ type: "status", payload: { status: c, error: l } }),
3591
3591
  reset: (c) => n({ type: "reset", payload: { messages: c } }),
3592
3592
  seed: (c, l) => n({ type: "seed", payload: { messages: c, ...l ?? {} } }),
3593
3593
  pushUser: (c, l) => n({ type: "user_message", payload: { message: c, editingMessageId: l } }),
3594
3594
  onEvent: i
3595
3595
  }), [i]);
3596
- return { state: t, dispatch: n, ...d };
3596
+ return { state: t, dispatch: n, ...u };
3597
3597
  }
3598
3598
  function gt(e, t) {
3599
3599
  var a;
3600
3600
  const n = t, r = n == null ? void 0 : n.origin, o = n == null ? void 0 : n.scope, s = r === "task" || typeof o == "string" && o.startsWith("tools:");
3601
3601
  if (t.type === "checkpoint") {
3602
- const i = t.checkpointNs ?? e.lastCheckpointNs ?? null, d = hr(e.messages, t.checkpointId, i);
3603
- return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs: i, messages: d };
3602
+ const i = t.checkpointNs ?? e.lastCheckpointNs ?? null, u = hr(e.messages, t.checkpointId, i);
3603
+ return { ...e, lastCheckpointId: t.checkpointId, lastCheckpointNs: i, messages: u };
3604
3604
  }
3605
3605
  if (t.type === "status") {
3606
3606
  const i = n.status === "completed" || n.status === "error" ? "idle" : n.status === "interrupted" ? "awaiting_input" : e.status;
@@ -3616,7 +3616,7 @@ function gt(e, t) {
3616
3616
  return { ...e, status: "error", error: t.message, messages: [...e.messages, i] };
3617
3617
  }
3618
3618
  if (t.type === "values" && ((a = n.values) != null && a.messages)) {
3619
- const i = n.values, d = Array.isArray(i.messages) ? i.messages : [], c = Be(d), { messages: l, ...p } = i;
3619
+ const i = n.values, u = Array.isArray(i.messages) ? i.messages : [], c = Be(u), { messages: l, ...p } = i;
3620
3620
  if (s) {
3621
3621
  const m = typeof o == "string" && o.length > 0 ? o : "task";
3622
3622
  return {
@@ -3636,22 +3636,22 @@ function gt(e, t) {
3636
3636
  return t.type === "messages/partial" ? wr(e, n) : t.type === "tool.start" ? s ? e : vr(e, t) : t.type === "tool.progress" ? s ? e : kr(e, t) : t.type === "tool.end" ? s ? e : Ir(e, t) : t.type === "artifact.update" ? Tr(e, t) : e;
3637
3637
  }
3638
3638
  function wr(e, t) {
3639
- const r = (t.messages || [t]).find((d) => d.type === "ai" || d.role === "assistant");
3639
+ const r = (t.messages || [t]).find((u) => u.type === "ai" || u.role === "assistant");
3640
3640
  if (!r) return e;
3641
3641
  const o = r.id, s = r.content ?? "", a = e.assemblingId !== o;
3642
3642
  let i = [...e.messages];
3643
3643
  if (a) {
3644
- const d = nt({
3644
+ const u = nt({
3645
3645
  ...r,
3646
3646
  role: "assistant",
3647
3647
  content: typeof s == "string" ? [{ type: "text", text: s }] : s
3648
3648
  });
3649
- d && i.push(d);
3649
+ u && i.push(u);
3650
3650
  } else {
3651
- const d = i.findIndex((c) => c.id === o);
3652
- if (d !== -1) {
3653
- const c = i[d], l = s;
3654
- i[d] = {
3651
+ const u = i.findIndex((c) => c.id === o);
3652
+ if (u !== -1) {
3653
+ const c = i[u], l = s;
3654
+ i[u] = {
3655
3655
  ...c,
3656
3656
  content: [{ type: "text", text: l }]
3657
3657
  };
@@ -3680,21 +3680,21 @@ function vr(e, t) {
3680
3680
  const o = n.name || "tool", s = `Starting ${o}...`;
3681
3681
  let a = [...e.messages], i = st(a, r);
3682
3682
  if (i === -1) {
3683
- for (let d = a.length - 1; d >= 0; d--)
3684
- if (a[d].role === "assistant") {
3685
- i = d;
3683
+ for (let u = a.length - 1; u >= 0; u--)
3684
+ if (a[u].role === "assistant") {
3685
+ i = u;
3686
3686
  break;
3687
3687
  }
3688
3688
  }
3689
3689
  if (i !== -1) {
3690
- const d = a[i], c = [...d.toolCalls || []], l = c.findIndex((p) => p.id === r);
3690
+ const u = a[i], c = [...u.toolCalls || []], l = c.findIndex((p) => p.id === r);
3691
3691
  l >= 0 ? c[l] = { ...c[l], status: "running", content: s } : c.push({
3692
3692
  id: r,
3693
3693
  name: o,
3694
3694
  args: n.args || {},
3695
3695
  status: "running",
3696
3696
  content: s
3697
- }), a[i] = { ...d, toolCalls: c };
3697
+ }), a[i] = { ...u, toolCalls: c };
3698
3698
  }
3699
3699
  return { ...e, messages: a };
3700
3700
  }
@@ -3705,7 +3705,7 @@ function kr(e, t) {
3705
3705
  const o = st(r, n);
3706
3706
  if (o !== -1) {
3707
3707
  const s = r[o], a = ce(t.content), i = (s.toolCalls || []).map(
3708
- (d) => d.id === n ? { ...d, content: typeof a == "string" ? a : d.content } : d
3708
+ (u) => u.id === n ? { ...u, content: typeof a == "string" ? a : u.content } : u
3709
3709
  );
3710
3710
  r[o] = { ...s, toolCalls: i };
3711
3711
  }
@@ -3717,7 +3717,7 @@ function Ir(e, t) {
3717
3717
  let r = [...e.messages];
3718
3718
  const o = st(r, n), s = ce(t.content ?? t.error);
3719
3719
  if (o !== -1) {
3720
- const i = r[o], d = (i.toolCalls || []).map(
3720
+ const i = r[o], u = (i.toolCalls || []).map(
3721
3721
  (c) => c.id === n ? {
3722
3722
  ...c,
3723
3723
  status: t.error ? "failed" : "completed",
@@ -3725,7 +3725,7 @@ function Ir(e, t) {
3725
3725
  artifact: t.artifact
3726
3726
  } : c
3727
3727
  );
3728
- r[o] = { ...i, toolCalls: d };
3728
+ r[o] = { ...i, toolCalls: u };
3729
3729
  }
3730
3730
  const a = {
3731
3731
  id: `tool-${n}`,
@@ -3748,7 +3748,7 @@ function Tr(e, t) {
3748
3748
  });
3749
3749
  return t.partial_data && s.artifact && (s.artifact = { ...s.artifact, ...t.partial_data }), { ...e, messages: $t(e.messages, o, s) };
3750
3750
  }
3751
- function Ne(e) {
3751
+ function Re(e) {
3752
3752
  if (!(!e || typeof e != "object" || Array.isArray(e)))
3753
3753
  return { ...e };
3754
3754
  }
@@ -3760,7 +3760,7 @@ function Fe(e, t) {
3760
3760
  return r.trim();
3761
3761
  }
3762
3762
  }
3763
- function Ar(e, t) {
3763
+ function xr(e, t) {
3764
3764
  if (!e) return null;
3765
3765
  for (const n of t) {
3766
3766
  const r = e[n];
@@ -3770,12 +3770,12 @@ function Ar(e, t) {
3770
3770
  return null;
3771
3771
  }
3772
3772
  function mt(e) {
3773
- const t = Ne(e);
3773
+ const t = Re(e);
3774
3774
  if (t)
3775
- return Ne(t.configurable) ?? t;
3775
+ return Re(t.configurable) ?? t;
3776
3776
  }
3777
- async function xr(e, t) {
3778
- var i, d;
3777
+ async function Ar(e, t) {
3778
+ var i, u;
3779
3779
  if (!e) return e ?? null;
3780
3780
  const n = le(e), r = Array.isArray(n.checkpoints) ? n.checkpoints : n.checkpoints ? Object.values(n.checkpoints) : [], o = /* @__PURE__ */ new Set();
3781
3781
  for (const c of r) {
@@ -3804,7 +3804,7 @@ async function xr(e, t) {
3804
3804
  })
3805
3805
  ), a = new Map(s);
3806
3806
  for (const c of r) {
3807
- const l = (d = c == null ? void 0 : c.values) == null ? void 0 : d.messages;
3807
+ const l = (u = c == null ? void 0 : c.values) == null ? void 0 : u.messages;
3808
3808
  if (Array.isArray(l))
3809
3809
  for (const p of l) {
3810
3810
  const m = p == null ? void 0 : p.content;
@@ -3830,31 +3830,31 @@ function ht(e) {
3830
3830
  };
3831
3831
  }
3832
3832
  function Sr(e, t) {
3833
- var P, A;
3833
+ var P, x;
3834
3834
  if (!e) return null;
3835
- const n = ((P = e.values) == null ? void 0 : P.activeAgent) ?? null, r = (A = e.values) == null ? void 0 : A.messages, s = (Array.isArray(r) ? r : []).map((M) => Cr(M, n)).filter((M) => !!M), a = Ne(e.metadata) ?? {}, i = mt(e.config), d = Ne(e.parentConfig), c = mt(d), l = Fe(i, ["checkpointId"]), p = Fe(i, ["checkpointNs"]), m = Fe(c, ["checkpointId"]), h = Ne(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((M) => ({ ...M })) : e.tasks ?? null, f = Array.isArray(e.next) ? [...e.next] : e.next ?? null, w = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), k = {
3835
+ const n = ((P = e.values) == null ? void 0 : P.activeAgent) ?? null, r = (x = e.values) == null ? void 0 : x.messages, s = (Array.isArray(r) ? r : []).map((S) => Cr(S, n)).filter((S) => !!S), a = Re(e.metadata) ?? {}, i = mt(e.config), u = Re(e.parentConfig), c = mt(u), l = Fe(i, ["checkpointId"]), p = Fe(i, ["checkpointNs"]), m = Fe(c, ["checkpointId"]), h = Re(e.config), v = Array.isArray(e.tasks) ? e.tasks.map((S) => ({ ...S })) : e.tasks ?? null, f = Array.isArray(e.next) ? [...e.next] : e.next ?? null, w = typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), k = {
3836
3836
  ...a,
3837
- step: Ar(a, ["step"]) ?? 0,
3837
+ step: xr(a, ["step"]) ?? 0,
3838
3838
  source: Fe(a, ["source"]) ?? null
3839
- }, C = s.map((M) => ({
3840
- ...M,
3841
- checkpointId: M.checkpointId ?? l ?? null,
3842
- checkpointNs: M.checkpointNs ?? p ?? null
3843
- })), I = e.values, R = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(I == null ? void 0 : I.interrupts) ? I.interrupts : [];
3839
+ }, E = s.map((S) => ({
3840
+ ...S,
3841
+ checkpointId: S.checkpointId ?? l ?? null,
3842
+ checkpointNs: S.checkpointNs ?? p ?? null
3843
+ })), I = e.values, N = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(I == null ? void 0 : I.interrupts) ? I.interrupts : [];
3844
3844
  return {
3845
3845
  checkpointId: l ?? null,
3846
3846
  checkpointNs: p ?? null,
3847
3847
  createdAt: w,
3848
3848
  parentId: m ?? null,
3849
- messages: C,
3849
+ messages: E,
3850
3850
  interrupt: Mr(
3851
- R,
3851
+ N,
3852
3852
  t,
3853
3853
  l ?? null
3854
3854
  ),
3855
3855
  metadata: k,
3856
3856
  config: h ?? null,
3857
- parentConfig: d ?? null,
3857
+ parentConfig: u ?? null,
3858
3858
  next: f,
3859
3859
  tasks: v,
3860
3860
  values: e.values ?? {}
@@ -3903,10 +3903,10 @@ function _r(e) {
3903
3903
  for (let c = 0; c < e.length; c++) {
3904
3904
  const l = e[c], p = l.checkpointId, m = p ?? `cp-${c}`, h = l.metadata ?? {}, v = typeof h.step == "number" ? h.step : null, f = typeof h.source == "string" ? h.source : null;
3905
3905
  let w = null, k = null;
3906
- const C = Array.isArray(l.messages) ? l.messages : [];
3907
- for (const A of C)
3908
- A.role === "user" && (k || (k = A), A.id && (w = A.id));
3909
- const I = l.next && l.next.length > 0 ? String(l.next[0]) : null, R = l.parentConfig ?? null, P = {
3906
+ const E = Array.isArray(l.messages) ? l.messages : [];
3907
+ for (const x of E)
3908
+ x.role === "user" && (k || (k = x), x.id && (w = x.id));
3909
+ const I = l.next && l.next.length > 0 ? String(l.next[0]) : null, N = l.parentConfig ?? null, P = {
3910
3910
  id: m,
3911
3911
  step: v,
3912
3912
  source: f,
@@ -3914,12 +3914,12 @@ function _r(e) {
3914
3914
  namespace: l.checkpointNs ?? null,
3915
3915
  parentId: l.parentId ?? null,
3916
3916
  next: I,
3917
- parentConfig: R,
3917
+ parentConfig: N,
3918
3918
  userMessageId: w
3919
3919
  };
3920
3920
  if (o.push(P), p && t.set(p, P), p && k) {
3921
- const A = Pr(k);
3922
- A && r.set(p, A);
3921
+ const x = Pr(k);
3922
+ x && r.set(p, x);
3923
3923
  }
3924
3924
  n.push({
3925
3925
  id: m,
@@ -3928,7 +3928,7 @@ function _r(e) {
3928
3928
  source: f,
3929
3929
  createdAt: l.createdAt ?? null,
3930
3930
  next: I,
3931
- parentConfig: R
3931
+ parentConfig: N
3932
3932
  });
3933
3933
  }
3934
3934
  const s = /* @__PURE__ */ new Map();
@@ -3988,7 +3988,7 @@ function co(e, t, n) {
3988
3988
  attempts: r
3989
3989
  };
3990
3990
  }
3991
- function Rr(e) {
3991
+ function Nr(e) {
3992
3992
  return Q(() => _r(e), [e]);
3993
3993
  }
3994
3994
  function Dt({
@@ -4001,54 +4001,54 @@ function Dt({
4001
4001
  isStreaming: a,
4002
4002
  getMessages: i
4003
4003
  }) {
4004
- const [d, c] = B(null), p = Q(
4005
- () => ht(d),
4006
- [d]
4007
- ).checkpoints, m = Rr(p), h = m.timeline, [v, f] = B(!1), [w, k] = B(!1), [C, I] = B(null), R = H(o), P = H(null), A = H(null);
4004
+ const [u, c] = D(null), p = Q(
4005
+ () => ht(u),
4006
+ [u]
4007
+ ).checkpoints, m = Nr(p), h = m.timeline, [v, f] = D(!1), [w, k] = D(!1), [E, I] = D(null), N = H(o), P = H(null), x = H(null);
4008
4008
  q(() => {
4009
- R.current = o;
4009
+ N.current = o;
4010
4010
  }, [o]);
4011
- const M = z(
4012
- async (E) => {
4013
- const j = await e.getState({
4014
- threadId: E.threadId,
4015
- checkpointId: E.checkpointId,
4016
- checkpointNs: E.checkpointNs
4017
- }), N = {
4011
+ const S = z(
4012
+ async (M) => {
4013
+ const L = await e.getState({
4014
+ threadId: M.threadId,
4015
+ checkpointId: M.checkpointId,
4016
+ checkpointNs: M.checkpointNs
4017
+ }), R = {
4018
4018
  version: "values@1",
4019
- threadId: E.threadId,
4020
- checkpoints: [j]
4021
- }, V = t ? await xr(N, t) : N, { latest: G } = ht(V);
4022
- return G;
4019
+ threadId: M.threadId,
4020
+ checkpoints: [L]
4021
+ }, V = t ? await Ar(R, t) : R, { latest: B } = ht(V);
4022
+ return B;
4023
4023
  },
4024
4024
  [e, t]
4025
4025
  ), g = z(
4026
- async (E, j) => {
4027
- var G;
4028
- if (!E) return;
4029
- const N = `${E}:${j ?? "latest"}`;
4030
- if (P.current === N && !v) return;
4031
- (G = A.current) == null || G.abort();
4026
+ async (M, L) => {
4027
+ var B;
4028
+ if (!M) return;
4029
+ const R = `${M}:${L ?? "latest"}`;
4030
+ if (P.current === R && !v) return;
4031
+ (B = x.current) == null || B.abort();
4032
4032
  const V = new AbortController();
4033
- A.current = V, f(!0), I(null);
4033
+ x.current = V, f(!0), I(null);
4034
4034
  try {
4035
- const b = await M({
4036
- threadId: E,
4037
- checkpointId: j ?? void 0
4035
+ const b = await S({
4036
+ threadId: M,
4037
+ checkpointId: L ?? void 0
4038
4038
  });
4039
- if (R.current !== E) return;
4039
+ if (N.current !== M) return;
4040
4040
  n((b == null ? void 0 : b.messages) ?? [], {
4041
4041
  checkpointId: (b == null ? void 0 : b.checkpointId) ?? null,
4042
4042
  checkpointNs: (b == null ? void 0 : b.checkpointNs) ?? null,
4043
4043
  pendingInterrupt: (b == null ? void 0 : b.interrupt) ?? null,
4044
4044
  values: b == null ? void 0 : b.values
4045
- }), P.current = N;
4045
+ }), P.current = R;
4046
4046
  const T = await e.getStateHistory({
4047
- threadId: E,
4047
+ threadId: M,
4048
4048
  limit: 100,
4049
4049
  includeMessages: !1
4050
4050
  });
4051
- R.current === E && c(T);
4051
+ N.current === M && c(T);
4052
4052
  } catch (b) {
4053
4053
  if (!Qt(b)) {
4054
4054
  const T = String(b);
@@ -4058,46 +4058,58 @@ function Dt({
4058
4058
  f(!1);
4059
4059
  }
4060
4060
  },
4061
- [e, n, M, r, v]
4061
+ [e, n, S, r, v]
4062
4062
  ), y = z(
4063
- async (E, j) => {
4063
+ async (M, L) => {
4064
4064
  if (o) {
4065
4065
  k(!0);
4066
4066
  try {
4067
- const N = await M({
4067
+ const R = await S({
4068
4068
  threadId: o,
4069
- checkpointId: E,
4070
- checkpointNs: j ?? void 0
4069
+ checkpointId: M,
4070
+ checkpointNs: L ?? void 0
4071
4071
  });
4072
- n((N == null ? void 0 : N.messages) ?? [], {
4073
- checkpointId: (N == null ? void 0 : N.checkpointId) ?? E,
4074
- checkpointNs: (N == null ? void 0 : N.checkpointNs) ?? j,
4075
- pendingInterrupt: (N == null ? void 0 : N.interrupt) ?? null,
4076
- values: N == null ? void 0 : N.values
4072
+ n((R == null ? void 0 : R.messages) ?? [], {
4073
+ checkpointId: (R == null ? void 0 : R.checkpointId) ?? M,
4074
+ checkpointNs: (R == null ? void 0 : R.checkpointNs) ?? L,
4075
+ pendingInterrupt: (R == null ? void 0 : R.interrupt) ?? null,
4076
+ values: R == null ? void 0 : R.values
4077
4077
  });
4078
- } catch (N) {
4079
- console.error("[useThreadHistoryState] Navigation failed", N);
4078
+ } catch (R) {
4079
+ console.error("[useThreadHistoryState] Navigation failed", R);
4080
4080
  } finally {
4081
4081
  k(!1);
4082
4082
  }
4083
4083
  }
4084
4084
  },
4085
- [o, M, n]
4085
+ [o, S, n]
4086
4086
  ), F = z(async () => {
4087
4087
  o && await g(o);
4088
4088
  }, [o, g]), U = z(
4089
- async (E) => {
4090
- const j = (E == null ? void 0 : E.threadId) || o;
4091
- !j || o !== j || (c(E), P.current = `${j}:latest`);
4089
+ async (M) => {
4090
+ var V;
4091
+ const L = (M == null ? void 0 : M.threadId) || o;
4092
+ if (!L || o !== L) return;
4093
+ if (c(M), P.current = `${L}:latest`, (V = M.values) != null && V.messages) {
4094
+ const B = await S({
4095
+ threadId: L
4096
+ });
4097
+ B && n(B.messages ?? [], {
4098
+ checkpointId: B.checkpointId ?? null,
4099
+ checkpointNs: B.checkpointNs ?? null,
4100
+ pendingInterrupt: B.interrupt ?? null,
4101
+ values: B.values
4102
+ });
4103
+ }
4092
4104
  },
4093
- [o]
4105
+ [o, S, n]
4094
4106
  );
4095
4107
  q(() => {
4096
4108
  if (!s || !o || v || a) return;
4097
- const E = `${o}:latest`;
4098
- P.current !== E && g(o);
4109
+ const M = `${o}:latest`;
4110
+ P.current !== M && g(o);
4099
4111
  }, [s, o, v, a, g]);
4100
- const S = z(() => {
4112
+ const C = z(() => {
4101
4113
  c(null), f(!1), k(!1), I(null), P.current = null;
4102
4114
  }, []);
4103
4115
  return {
@@ -4106,11 +4118,11 @@ function Dt({
4106
4118
  checkpointIndex: m,
4107
4119
  isLoadingThread: v,
4108
4120
  isLoadingCheckpoint: w,
4109
- threadStateError: C,
4121
+ threadStateError: E,
4110
4122
  loadThread: g,
4111
4123
  navigateToCheckpoint: y,
4112
- setCurrentCheckpointId: (E, j) => {
4113
- n(i(), { checkpointId: E, checkpointNs: j });
4124
+ setCurrentCheckpointId: (M, L) => {
4125
+ n(i(), { checkpointId: M, checkpointNs: L });
4114
4126
  },
4115
4127
  returnToLatest: F,
4116
4128
  handleValuesEvent: U,
@@ -4118,8 +4130,8 @@ function Dt({
4118
4130
  },
4119
4131
  markStreamPendingThread: () => {
4120
4132
  },
4121
- resetHistoryState: S,
4122
- clearState: S
4133
+ resetHistoryState: C,
4134
+ clearState: C
4123
4135
  };
4124
4136
  }
4125
4137
  const Vt = Se(null), Kt = Se(null);
@@ -4128,7 +4140,7 @@ function Gt(e) {
4128
4140
  if (!t && !(e != null && e.optional)) throw new Error("useThreadState must be used within a ThreadStateProvider");
4129
4141
  return t;
4130
4142
  }
4131
- function Nr() {
4143
+ function Rr() {
4132
4144
  const e = Ue(Kt);
4133
4145
  if (!e)
4134
4146
  throw new Error("useThreadStateUpdater must be used within a ThreadStateProvider");
@@ -4143,24 +4155,24 @@ function zr({
4143
4155
  isStreaming: s,
4144
4156
  onError: a
4145
4157
  }) {
4146
- const { chatApi: i, fileApi: d } = xe(), { currentThreadId: c } = ot(), { state: l, seed: p, onEvent: m, dispatch: h } = br(), {
4158
+ const { chatApi: i, fileApi: u } = Ae(), { currentThreadId: c } = ot(), { state: l, seed: p, onEvent: m, dispatch: h } = br(), {
4147
4159
  threadCheckpoints: v,
4148
4160
  threadTimeline: f,
4149
4161
  checkpointIndex: w,
4150
4162
  isLoadingThread: k,
4151
- isLoadingCheckpoint: C,
4163
+ isLoadingCheckpoint: E,
4152
4164
  threadStateError: I,
4153
- loadThread: R,
4165
+ loadThread: N,
4154
4166
  navigateToCheckpoint: P,
4155
- setCurrentCheckpointId: A,
4156
- returnToLatest: M,
4167
+ setCurrentCheckpointId: x,
4168
+ returnToLatest: S,
4157
4169
  handleValuesEvent: g,
4158
4170
  markSkipNextLoad: y,
4159
4171
  markStreamPendingThread: F,
4160
4172
  resetHistoryState: U
4161
4173
  } = Dt({
4162
4174
  api: i,
4163
- fileApi: d,
4175
+ fileApi: u,
4164
4176
  seed: p,
4165
4177
  onError: a,
4166
4178
  currentThreadId: c,
@@ -4174,30 +4186,30 @@ function zr({
4174
4186
  q(() => {
4175
4187
  c || (p([], {}), U());
4176
4188
  }, [c, p, U]);
4177
- const S = H(null), E = z(
4178
- (u) => {
4179
- S.current = u;
4189
+ const C = H(null), M = z(
4190
+ (d) => {
4191
+ C.current = d;
4180
4192
  },
4181
4193
  []
4182
- ), j = H(null), N = z(
4183
- (u) => {
4184
- j.current = u;
4194
+ ), L = H(null), R = z(
4195
+ (d) => {
4196
+ L.current = d;
4185
4197
  },
4186
4198
  []
4187
- ), V = Q(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), G = z(
4188
- (u, x) => {
4189
- const _ = jt(u, "user");
4199
+ ), V = Q(() => ({ assemblingMessageId: l.assemblingId ?? null }), [l.assemblingId]), B = z(
4200
+ (d, A) => {
4201
+ const _ = jt(d, "user");
4190
4202
  return h({
4191
4203
  type: "user_message",
4192
4204
  payload: {
4193
4205
  message: _,
4194
- editingMessageId: x == null ? void 0 : x.editingMessageId
4206
+ editingMessageId: A == null ? void 0 : A.editingMessageId
4195
4207
  }
4196
4208
  }), _;
4197
4209
  },
4198
4210
  [h]
4199
4211
  ), b = z(async () => {
4200
- S.current ? await S.current() : (p([], {}), U());
4212
+ C.current ? await C.current() : (p([], {}), U());
4201
4213
  }, [p, U]), T = Q(() => On(l.messages), [l.messages]), $ = Q(
4202
4214
  () => ({
4203
4215
  status: l.status,
@@ -4215,36 +4227,36 @@ function zr({
4215
4227
  metadata: V,
4216
4228
  values: l.values ?? {},
4217
4229
  isLoading: k,
4218
- isLoadingCheckpoint: C,
4230
+ isLoadingCheckpoint: E,
4219
4231
  error: I,
4220
4232
  loadOlder: async () => {
4221
4233
  },
4222
4234
  // Placeholder
4223
- seedFromSnapshot: (u) => {
4224
- p(u.messages, {
4225
- checkpointId: u.checkpointId,
4226
- checkpointNs: u.checkpointNs,
4227
- pendingInterrupt: u.interrupt,
4228
- values: u.values
4235
+ seedFromSnapshot: (d) => {
4236
+ p(d.messages, {
4237
+ checkpointId: d.checkpointId,
4238
+ checkpointNs: d.checkpointNs,
4239
+ pendingInterrupt: d.interrupt,
4240
+ values: d.values
4229
4241
  });
4230
4242
  },
4231
4243
  clearState: b,
4232
4244
  navigateToCheckpoint: P,
4233
- setCurrentCheckpointId: A,
4234
- returnToLatest: M,
4235
- loadThread: async (u, x, _) => {
4236
- await R(u, x, { clearProgress: !1 });
4245
+ setCurrentCheckpointId: x,
4246
+ returnToLatest: S,
4247
+ loadThread: async (d, A, _) => {
4248
+ await N(d, A, { clearProgress: !1 });
4237
4249
  },
4238
4250
  clearThread: b,
4239
- respondToInterrupt: async (u, x, _) => {
4240
- j.current && await j.current(u, x, _);
4251
+ respondToInterrupt: async (d, A, _) => {
4252
+ L.current && await L.current(d, A, _);
4241
4253
  },
4242
4254
  messagePreviews: w.messagePreviews,
4243
4255
  handleValuesEvent: g,
4244
4256
  markSkipNextLoad: y,
4245
4257
  markStreamPendingThread: F,
4246
4258
  resetHistoryState: U,
4247
- pushUser: G,
4259
+ pushUser: B,
4248
4260
  onEvent: m,
4249
4261
  artifacts: T
4250
4262
  }),
@@ -4261,27 +4273,27 @@ function zr({
4261
4273
  w,
4262
4274
  V,
4263
4275
  k,
4264
- C,
4276
+ E,
4265
4277
  I,
4266
4278
  p,
4267
4279
  b,
4268
4280
  P,
4269
- A,
4270
- M,
4271
- R,
4281
+ x,
4282
+ S,
4283
+ N,
4272
4284
  g,
4273
4285
  y,
4274
4286
  F,
4275
- G,
4287
+ B,
4276
4288
  m,
4277
4289
  T
4278
4290
  ]
4279
4291
  ), O = Q(
4280
4292
  () => ({
4281
- registerClearThread: E,
4282
- registerRespondToInterrupt: N
4293
+ registerClearThread: M,
4294
+ registerRespondToInterrupt: R
4283
4295
  }),
4284
- [E, N]
4296
+ [M, R]
4285
4297
  );
4286
4298
  return /* @__PURE__ */ ie(Kt.Provider, { value: O, children: /* @__PURE__ */ ie(Vt.Provider, { value: $, children: e }) });
4287
4299
  }
@@ -4295,29 +4307,29 @@ function Lr({
4295
4307
  onUpdateEvent: s,
4296
4308
  onCustomEvent: a,
4297
4309
  onMetadataEvent: i,
4298
- onFinish: d,
4310
+ onFinish: u,
4299
4311
  onStreamingChange: c
4300
4312
  }) {
4301
- const { chatApi: l, baseUrl: p } = xe(), m = p, h = pe(t), v = pe(n), f = pe(r), w = pe(o), k = pe(s), C = pe(a), I = pe(i), R = pe(d), P = pe(c), A = Q(
4313
+ const { chatApi: l, baseUrl: p } = Ae(), m = p, h = pe(t), v = pe(n), f = pe(r), w = pe(o), k = pe(s), E = pe(a), I = pe(i), N = pe(u), P = pe(c), x = Q(
4302
4314
  () => ({
4303
4315
  onError: h,
4304
4316
  onAuthError: v,
4305
4317
  onConnectionError: f,
4306
4318
  onMetadataEvent: I,
4307
- onCustomEvent: C,
4319
+ onCustomEvent: E,
4308
4320
  onUpdateEvent: k,
4309
4321
  onToolEnd: w,
4310
- onFinish: R
4322
+ onFinish: N
4311
4323
  }),
4312
4324
  [
4313
4325
  h,
4314
4326
  v,
4315
4327
  f,
4316
4328
  I,
4317
- C,
4329
+ E,
4318
4330
  k,
4319
4331
  w,
4320
- R
4332
+ N
4321
4333
  ]
4322
4334
  );
4323
4335
  return /* @__PURE__ */ ie(Ur.Provider, { value: !0, children: /* @__PURE__ */ ie(
@@ -4325,7 +4337,7 @@ function Lr({
4325
4337
  {
4326
4338
  api: l,
4327
4339
  streamBaseUrl: m,
4328
- handlers: A,
4340
+ handlers: x,
4329
4341
  onStreamingChange: P,
4330
4342
  children: e
4331
4343
  }
@@ -4338,7 +4350,7 @@ function jr({
4338
4350
  handlers: r,
4339
4351
  onStreamingChange: o
4340
4352
  }) {
4341
- const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: d } = ot(), {
4353
+ const { setCurrentThreadId: s, currentThreadIdRef: a, addThreadFromEvent: i, currentThreadId: u } = ot(), {
4342
4354
  interrupt: c,
4343
4355
  checkpoint: l,
4344
4356
  timelineCheckpoints: p,
@@ -4348,18 +4360,18 @@ function jr({
4348
4360
  resetHistoryState: f,
4349
4361
  pushUser: w,
4350
4362
  onEvent: k,
4351
- messages: C
4352
- } = Gt(), { registerClearThread: I, registerRespondToInterrupt: R } = Nr(), P = z(
4353
- (u) => {
4354
- i(u), v(u.threadId), a.current !== u.threadId && ((u.created ?? !a.current) && h(u.threadId), s(u.threadId));
4363
+ messages: E
4364
+ } = Gt(), { registerClearThread: I, registerRespondToInterrupt: N } = Rr(), P = z(
4365
+ (d) => {
4366
+ i(d), v(d.threadId), a.current !== d.threadId && ((d.created ?? !a.current) && h(d.threadId), s(d.threadId));
4355
4367
  },
4356
4368
  [i, h, v, s, a]
4357
- ), A = lr({
4369
+ ), x = lr({
4358
4370
  baseUrl: n,
4359
4371
  onEvent: k,
4360
- onError: (u) => {
4361
- var x;
4362
- (x = r.onError) == null || x.call(r, (u == null ? void 0 : u.message) ?? String(u));
4372
+ onError: (d) => {
4373
+ var A;
4374
+ (A = r.onError) == null || A.call(r, (d == null ? void 0 : d.message) ?? String(d));
4363
4375
  },
4364
4376
  onAuthError: r.onAuthError,
4365
4377
  onConnectionError: r.onConnectionError,
@@ -4372,40 +4384,40 @@ function jr({
4372
4384
  handleValuesEvent: m
4373
4385
  });
4374
4386
  q(() => {
4375
- o == null || o(A.isStreaming);
4376
- }, [A.isStreaming, o]);
4377
- const { stream: M, stop: g, clear: y, isStreaming: F, error: U, connected: S, streamedMessages: E, activeMessageId: j } = A;
4387
+ o == null || o(x.isStreaming);
4388
+ }, [x.isStreaming, o]);
4389
+ const { stream: S, stop: g, clear: y, isStreaming: F, error: U, connected: C, streamedMessages: M, activeMessageId: L } = x;
4378
4390
  q(() => {
4379
- d !== void 0 && y();
4380
- }, [d, y]);
4381
- const N = z(
4382
- async (u, x) => {
4383
- await M(u, x);
4391
+ u !== void 0 && y();
4392
+ }, [u, y]);
4393
+ const R = z(
4394
+ async (d, A) => {
4395
+ await S(d, A);
4384
4396
  },
4385
- [M]
4397
+ [S]
4386
4398
  ), V = H(l);
4387
4399
  q(() => {
4388
4400
  V.current = l;
4389
4401
  }, [l]);
4390
- const G = z(
4391
- async (u, x, _) => {
4402
+ const B = z(
4403
+ async (d, A, _) => {
4392
4404
  const te = a.current;
4393
4405
  if (!te)
4394
4406
  throw new Error("No active thread to handle interrupt");
4395
- const J = u ? x ?? !0 : !1, K = V.current, Z = (_ == null ? void 0 : _.checkpointId) ?? K.id ?? void 0, ae = (_ == null ? void 0 : _.checkpointNs) ?? K.namespace ?? void 0, de = {
4407
+ const J = d ? A ?? !0 : !1, G = V.current, Z = (_ == null ? void 0 : _.checkpointId) ?? G.id ?? void 0, ae = (_ == null ? void 0 : _.checkpointNs) ?? G.namespace ?? void 0, ue = {
4396
4408
  threadId: te,
4397
4409
  checkpointId: Z,
4398
4410
  checkpointNs: ae,
4399
4411
  command: { kind: "resume", value: J },
4400
4412
  payload: _ == null ? void 0 : _.payload
4401
4413
  };
4402
- N(de);
4414
+ R(ue);
4403
4415
  },
4404
- [a, N]
4416
+ [a, R]
4405
4417
  );
4406
4418
  q(() => {
4407
- R(G);
4408
- }, [G, R]);
4419
+ N(B);
4420
+ }, [B, N]);
4409
4421
  const b = z(async () => {
4410
4422
  g(), y(), f(), s(null);
4411
4423
  }, [y, f, s, g]);
@@ -4413,79 +4425,79 @@ function jr({
4413
4425
  I(b);
4414
4426
  }, [b, I]);
4415
4427
  const T = z(
4416
- async (u, x) => {
4428
+ async (d, A) => {
4417
4429
  F && g();
4418
4430
  let _ = a.current;
4419
- const te = (u == null ? void 0 : u.text) ?? "", J = (u == null ? void 0 : u.attachments) ?? [], K = (te == null ? void 0 : te.trim()) ?? "", Z = { ...(u == null ? void 0 : u.payload) ?? {} }, ae = Array.isArray(Z.messages) ? Z.messages : void 0;
4431
+ const te = (d == null ? void 0 : d.text) ?? "", J = (d == null ? void 0 : d.attachments) ?? [], G = (te == null ? void 0 : te.trim()) ?? "", Z = { ...(d == null ? void 0 : d.payload) ?? {} }, ae = Array.isArray(Z.messages) ? Z.messages : void 0;
4420
4432
  ae && delete Z.messages;
4421
- const de = !!(ae && ae.length), W = !!(u.contentParts && u.contentParts.length > 0);
4422
- if (!_ && !K && J.length === 0 && !de && !W) return;
4433
+ const ue = !!(ae && ae.length), W = !!(d.contentParts && d.contentParts.length > 0);
4434
+ if (!_ && !G && J.length === 0 && !ue && !W) return;
4423
4435
  if (!_) {
4424
4436
  const he = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), ye = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
4425
4437
  _ = `${he}${ye}`, h(_), s(_);
4426
4438
  }
4427
4439
  let ee = null;
4428
- u.contentParts && u.contentParts.length > 0 && (ee = u.contentParts);
4440
+ d.contentParts && d.contentParts.length > 0 && (ee = d.contentParts);
4429
4441
  const { contentParts: ve, filesInfo: X } = ee ? { contentParts: ee, filesInfo: [] } : await or(J), Y = [...ve];
4430
- K && Y.push({ type: "text", text: te });
4431
- const me = u == null ? void 0 : u.originalMessageId, Le = !!(u != null && u.edit && me), je = !de && Y.length > 0;
4432
- let ue = null;
4442
+ G && Y.push({ type: "text", text: te });
4443
+ const me = d == null ? void 0 : d.originalMessageId, Le = !!(d != null && d.edit && me), je = !ue && Y.length > 0;
4444
+ let de = null;
4433
4445
  if (je) {
4434
4446
  const he = Le ? me : `msg-${Date.now()}`;
4435
- ue = jt({
4447
+ de = jt({
4436
4448
  id: he,
4437
4449
  role: "user",
4438
4450
  content: Y,
4439
4451
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
4440
- }, "user"), Le ? w(ue, { editingMessageId: me }) : w(ue);
4452
+ }, "user"), Le ? w(de, { editingMessageId: me }) : w(de);
4441
4453
  }
4442
- const Ie = de ? ae : ue ? [ue] : [], ne = {
4454
+ const Ie = ue ? ae : de ? [de] : [], ne = {
4443
4455
  ...Z,
4444
4456
  ...X.length ? { files_info: X } : {}
4445
4457
  };
4446
4458
  Ie.length ? ne.messages = Ie : "messages" in ne || (ne.messages = []);
4447
- const Me = (u == null ? void 0 : u.checkpointId) ?? l.id ?? void 0;
4448
- if (u != null && u.edit && !Me)
4459
+ const Me = (d == null ? void 0 : d.checkpointId) ?? l.id ?? void 0;
4460
+ if (d != null && d.edit && !Me)
4449
4461
  throw new Error(
4450
4462
  `[streaming] Missing checkpointId for edit submit. threadId=${_ ?? "null"}`
4451
4463
  );
4452
4464
  const Ee = {
4453
4465
  threadId: _,
4454
- content: u == null ? void 0 : u.text,
4466
+ content: d == null ? void 0 : d.text,
4455
4467
  payload: ne,
4456
- config: u == null ? void 0 : u.config,
4468
+ config: d == null ? void 0 : d.config,
4457
4469
  checkpointId: Me,
4458
- command: u == null ? void 0 : u.command,
4459
- edit: u == null ? void 0 : u.edit
4470
+ command: d == null ? void 0 : d.command,
4471
+ edit: d == null ? void 0 : d.edit
4460
4472
  };
4461
- return N(Ee, x);
4473
+ return R(Ee, A);
4462
4474
  },
4463
- [l, a, F, h, w, N, g, p]
4475
+ [l, a, F, h, w, R, g, p]
4464
4476
  ), $ = Q(() => {
4465
- const u = Object.keys(E).length > 0;
4466
- if (!F && !u)
4467
- return C;
4468
- const x = /* @__PURE__ */ new Map();
4469
- return C.forEach((_) => x.set(_.id, _)), Object.values(E).forEach((_) => {
4470
- x.set(_.id, _);
4471
- }), Array.from(x.values());
4472
- }, [F, E, C]), O = Q(
4477
+ const d = Object.keys(M).length > 0;
4478
+ if (!F && !d)
4479
+ return E;
4480
+ const A = /* @__PURE__ */ new Map();
4481
+ return E.forEach((_) => A.set(_.id, _)), Object.values(M).forEach((_) => {
4482
+ A.set(_.id, _);
4483
+ }), Array.from(A.values());
4484
+ }, [F, M, E]), O = Q(
4473
4485
  () => ({
4474
4486
  isStreaming: F,
4475
4487
  error: U,
4476
- connectionState: U ? "error" : F ? S ? "connected" : "connecting" : "idle",
4488
+ connectionState: U ? "error" : F ? C ? "connected" : "connecting" : "idle",
4477
4489
  messages: $,
4478
- activeMessageId: j,
4490
+ activeMessageId: L,
4479
4491
  submit: T,
4480
4492
  stop: g,
4481
4493
  interrupt: c,
4482
4494
  resume: () => Promise.resolve(),
4483
- goto: (u, x) => Promise.resolve(),
4495
+ goto: (d, A) => Promise.resolve(),
4484
4496
  clearError: () => {
4485
4497
  }
4486
4498
  // TODO: Implement error clearing
4487
4499
  }),
4488
- [F, U, T, g, c, S, $]
4500
+ [F, U, T, g, c, C, $]
4489
4501
  );
4490
4502
  return /* @__PURE__ */ ie(Ht.Provider, { value: O, children: e });
4491
4503
  }
@@ -4540,7 +4552,7 @@ function uo({
4540
4552
  autoLoadInitial: s = !0,
4541
4553
  onConnectionError: a,
4542
4554
  onError: i,
4543
- onAuthError: d,
4555
+ onAuthError: u,
4544
4556
  onThreadChange: c,
4545
4557
  onToolEnd: l,
4546
4558
  onUpdateEvent: p,
@@ -4548,23 +4560,23 @@ function uo({
4548
4560
  onMetadataEvent: h,
4549
4561
  onFinish: v
4550
4562
  }) {
4551
- const f = $r(t), [w, k] = B(!1), C = ge(i), I = ge(d), R = ge(a), P = ge(c), A = ge(l), M = ge(p), g = ge(m), y = ge(h), F = ge(v), U = Q(
4563
+ const f = $r(t), [w, k] = D(!1), E = ge(i), I = ge(u), N = ge(a), P = ge(c), x = ge(l), S = ge(p), g = ge(m), y = ge(h), F = ge(v), U = Q(
4552
4564
  () => ({
4553
- onError: C,
4565
+ onError: E,
4554
4566
  onAuthError: I,
4555
- onConnectionError: R,
4556
- onToolEnd: A,
4557
- onUpdateEvent: M,
4567
+ onConnectionError: N,
4568
+ onToolEnd: x,
4569
+ onUpdateEvent: S,
4558
4570
  onCustomEvent: g,
4559
4571
  onMetadataEvent: y,
4560
4572
  onFinish: F
4561
4573
  }),
4562
4574
  [
4563
- C,
4575
+ E,
4564
4576
  I,
4565
- R,
4566
- A,
4567
- M,
4577
+ N,
4578
+ x,
4579
+ S,
4568
4580
  g,
4569
4581
  y,
4570
4582
  F
@@ -4574,7 +4586,7 @@ function uo({
4574
4586
  pr,
4575
4587
  {
4576
4588
  initialThreadId: n,
4577
- onError: C,
4589
+ onError: E,
4578
4590
  onThreadChange: P,
4579
4591
  children: /* @__PURE__ */ ie(
4580
4592
  zr,
@@ -4583,7 +4595,7 @@ function uo({
4583
4595
  initialCheckpointId: r,
4584
4596
  initialCheckpointNs: o,
4585
4597
  autoLoadInitial: s,
4586
- onError: C,
4598
+ onError: E,
4587
4599
  isStreaming: w,
4588
4600
  children: /* @__PURE__ */ ie(
4589
4601
  Lr,
@@ -4698,13 +4710,13 @@ function Wr() {
4698
4710
  };
4699
4711
  }
4700
4712
  function fo(e) {
4701
- const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = xe(), { toast: o } = Wr(), [s, a] = B({}), [i, d] = B(null), [c, l] = B(!1), p = z(() => {
4702
- l(!1), d(null);
4713
+ const { allowFileOpen: t, currentThreadId: n } = e, { fileApi: r } = Ae(), { toast: o } = Wr(), [s, a] = D({}), [i, u] = D(null), [c, l] = D(!1), p = z(() => {
4714
+ l(!1), u(null);
4703
4715
  }, []), m = z((v) => {
4704
- d(v), l(!0);
4716
+ u(v), l(!0);
4705
4717
  }, []), h = z(
4706
4718
  async (v, f, w) => {
4707
- var k, C;
4719
+ var k, E;
4708
4720
  if (!t) {
4709
4721
  v.preventDefault();
4710
4722
  return;
@@ -4714,49 +4726,49 @@ function fo(e) {
4714
4726
  return;
4715
4727
  }
4716
4728
  try {
4717
- const I = String(f.url ?? ""), R = I.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
4718
- if (R) {
4729
+ const I = String(f.url ?? ""), N = I.match(/\/chat\/files\/([^/]+)(?:\/(view|download))?/);
4730
+ if (N) {
4719
4731
  v.preventDefault();
4720
- const P = R[1], A = f.name || `file_${P}`, M = f.mimeType || "application/octet-stream";
4721
- m({ id: P, name: A, mimeType: M });
4732
+ const P = N[1], x = f.name || `file_${P}`, S = f.mimeType || "application/octet-stream";
4733
+ m({ id: P, name: x, mimeType: S });
4722
4734
  return;
4723
4735
  }
4724
4736
  if (I.startsWith("data:")) {
4725
- v.preventDefault(), a((A) => ({ ...A, [w]: !0 }));
4737
+ v.preventDefault(), a((x) => ({ ...x, [w]: !0 }));
4726
4738
  const P = o({ title: "Fetching file...", description: "", open: !0 });
4727
4739
  try {
4728
- const A = await r.listFiles(n ?? void 0);
4729
- if (!A || !Array.isArray(A))
4740
+ const x = await r.listFiles(n ?? void 0);
4741
+ if (!x || !Array.isArray(x))
4730
4742
  throw new Error("Invalid file list response");
4731
- const M = A.find((g) => !g || typeof g != "object" || !((g.filename ?? "") === (f.name ?? "")) ? !1 : typeof f.size == "number" && typeof g.size == "number" ? g.size === f.size : !0);
4732
- if (!(M != null && M.id))
4743
+ const S = x.find((g) => !g || typeof g != "object" || !((g.filename ?? "") === (f.name ?? "")) ? !1 : typeof f.size == "number" && typeof g.size == "number" ? g.size === f.size : !0);
4744
+ if (!(S != null && S.id))
4733
4745
  throw new Error(`File "${f.name}" is not yet available on the server`);
4734
- if (!M.id || !M.filename)
4746
+ if (!S.id || !S.filename)
4735
4747
  throw new Error("Invalid file data received from server");
4736
4748
  m({
4737
- id: M.id,
4738
- name: f.name || M.filename || `file_${M.id}`,
4739
- mimeType: f.mimeType || M.mime_type || "application/octet-stream"
4749
+ id: S.id,
4750
+ name: f.name || S.filename || `file_${S.id}`,
4751
+ mimeType: f.mimeType || S.mime_type || "application/octet-stream"
4740
4752
  }), (k = P.update) == null || k.call(P, {
4741
4753
  id: P.id,
4742
4754
  title: "Success",
4743
4755
  description: `Opened ${f.name}`,
4744
4756
  open: !0
4745
4757
  });
4746
- } catch (A) {
4747
- console.error("Failed to fetch server file:", A);
4748
- const M = A instanceof Error ? A.message : "Unknown error occurred";
4749
- (C = P.update) == null || C.call(P, { id: P.id, title: "Failed", description: M }), o({
4758
+ } catch (x) {
4759
+ console.error("Failed to fetch server file:", x);
4760
+ const S = x instanceof Error ? x.message : "Unknown error occurred";
4761
+ (E = P.update) == null || E.call(P, { id: P.id, title: "Failed", description: S }), o({
4750
4762
  title: "Failed to fetch file",
4751
- description: M,
4763
+ description: S,
4752
4764
  open: !0
4753
4765
  });
4754
4766
  } finally {
4755
- a((A) => ({ ...A, [w]: !1 }));
4767
+ a((x) => ({ ...x, [w]: !1 }));
4756
4768
  }
4757
4769
  }
4758
4770
  } catch (I) {
4759
- console.error("File click error:", I), a((R) => ({ ...R, [w]: !1 }));
4771
+ console.error("File click error:", I), a((N) => ({ ...N, [w]: !1 }));
4760
4772
  }
4761
4773
  },
4762
4774
  [t, s, o, n, m]
@@ -4811,16 +4823,16 @@ function Jr(e) {
4811
4823
  function go(e) {
4812
4824
  return Q(() => {
4813
4825
  const t = e.content.filter(
4814
- (d) => d.type === "text"
4826
+ (u) => u.type === "text"
4815
4827
  );
4816
4828
  if (!t.length)
4817
4829
  return null;
4818
4830
  let r = t.flatMap(
4819
- (d) => qr(d.text ?? "")
4831
+ (u) => qr(u.text ?? "")
4820
4832
  );
4821
4833
  if (!r.length) {
4822
- const d = t.map((l) => l.text ?? "").join(`
4823
- `), c = tt(d);
4834
+ const u = t.map((l) => l.text ?? "").join(`
4835
+ `), c = tt(u);
4824
4836
  c && typeof c == "object" && (r = [c]);
4825
4837
  }
4826
4838
  if (!r.length)
@@ -4843,12 +4855,12 @@ function go(e) {
4843
4855
  }
4844
4856
  function Xr(e) {
4845
4857
  var F;
4846
- const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o = Gt({ optional: !0 }), s = Fr(), { currentThreadId: a, setCurrentThreadId: i, actions: d } = r || {
4858
+ const t = typeof e == "string" ? e : e == null ? void 0 : e.threadId, n = typeof e == "object" ? e.lazy : !1, r = ot({ optional: !0 }), o = Gt({ optional: !0 }), s = Fr(), { currentThreadId: a, setCurrentThreadId: i, actions: u } = r || {
4847
4859
  currentThreadId: null,
4848
4860
  setCurrentThreadId: () => {
4849
4861
  },
4850
4862
  actions: {}
4851
- }, c = !!t && t !== a, [l, p] = B([]), m = z((U) => {
4863
+ }, c = !!t && t !== a, [l, p] = D([]), m = z((U) => {
4852
4864
  p(U);
4853
4865
  }, []), {
4854
4866
  isLoadingThread: h,
@@ -4856,8 +4868,8 @@ function Xr(e) {
4856
4868
  threadCheckpoints: f,
4857
4869
  loadThread: w
4858
4870
  } = Dt({
4859
- api: xe().chatApi,
4860
- fileApi: xe().fileApi,
4871
+ api: Ae().chatApi,
4872
+ fileApi: Ae().fileApi,
4861
4873
  seed: m,
4862
4874
  currentThreadId: c ? t : null,
4863
4875
  initialThreadId: c ? t : null,
@@ -4867,17 +4879,17 @@ function Xr(e) {
4867
4879
  }), k = Q(() => {
4868
4880
  var U;
4869
4881
  return ((U = f[0]) == null ? void 0 : U.values) || {};
4870
- }, [f]), C = Q(() => ({ timeline: [], messagePreviews: {} }), []), I = t || a, R = c ? h ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", P = c ? l : (s == null ? void 0 : s.messages) || [], A = c ? h : (o == null ? void 0 : o.isLoading) || !1, M = c ? k : (o == null ? void 0 : o.values) || {}, g = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, y = c ? v : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
4882
+ }, [f]), E = Q(() => ({ timeline: [], messagePreviews: {} }), []), I = t || a, N = c ? h ? "loading" : "idle" : (o == null ? void 0 : o.status) || "idle", P = c ? l : (s == null ? void 0 : s.messages) || [], x = c ? h : (o == null ? void 0 : o.isLoading) || !1, S = c ? k : (o == null ? void 0 : o.values) || {}, g = c ? {} : (o == null ? void 0 : o.taskMessagesByScope) || {}, y = c ? v : (s == null ? void 0 : s.error) || (o == null ? void 0 : o.error) || null;
4871
4883
  return {
4872
4884
  // UNIFIED: Single thread ID concept
4873
4885
  threadId: I,
4874
- status: R,
4886
+ status: N,
4875
4887
  messages: P,
4876
- isLoading: A,
4877
- isHistoryLoading: A,
4888
+ isLoading: x,
4889
+ isHistoryLoading: x,
4878
4890
  error: y,
4879
4891
  // Values & Metadata
4880
- values: M,
4892
+ values: S,
4881
4893
  taskMessagesByScope: g,
4882
4894
  metadata: c ? {} : o == null ? void 0 : o.metadata,
4883
4895
  // Actions & State relating to Global/Active Thread only
@@ -4889,7 +4901,7 @@ function Xr(e) {
4889
4901
  }),
4890
4902
  checkpoint: c ? f[0] ? { id: f[0].checkpointId, namespace: f[0].checkpointNs } : null : (o == null ? void 0 : o.checkpoint) || null,
4891
4903
  checkpoints: c ? f : (o == null ? void 0 : o.checkpoints) || [],
4892
- checkpointIndex: c ? C : (o == null ? void 0 : o.checkpointIndex) || { timeline: [], messagePreviews: {} },
4904
+ checkpointIndex: c ? E : (o == null ? void 0 : o.checkpointIndex) || { timeline: [], messagePreviews: {} },
4893
4905
  interrupt: c ? null : (o == null ? void 0 : o.interrupt) || null,
4894
4906
  respondToInterrupt: c ? async () => {
4895
4907
  } : (o == null ? void 0 : o.respondToInterrupt) || (async () => {
@@ -4914,10 +4926,10 @@ function Xr(e) {
4914
4926
  } : async () => {
4915
4927
  },
4916
4928
  // Thread Management
4917
- createThread: d == null ? void 0 : d.createThread,
4918
- deleteThread: d == null ? void 0 : d.deleteThread,
4919
- renameThread: d == null ? void 0 : d.renameThread,
4920
- shareThread: d == null ? void 0 : d.shareThread,
4929
+ createThread: u == null ? void 0 : u.createThread,
4930
+ deleteThread: u == null ? void 0 : u.deleteThread,
4931
+ renameThread: u == null ? void 0 : u.renameThread,
4932
+ shareThread: u == null ? void 0 : u.shareThread,
4921
4933
  threads: (r == null ? void 0 : r.threads) || [],
4922
4934
  isThreadsLoading: (r == null ? void 0 : r.isLoading) || !1
4923
4935
  };
@@ -4931,42 +4943,42 @@ function mo({
4931
4943
  onExcelUploadSuccess: s,
4932
4944
  onError: a,
4933
4945
  enableMessageEditing: i,
4934
- messages: d,
4946
+ messages: u,
4935
4947
  setPendingAssistantResponse: c,
4936
4948
  project: l,
4937
4949
  onEvent: p,
4938
4950
  threadId: m,
4939
4951
  clearComposerOnSend: h = !0
4940
4952
  }) {
4941
- const { messages: v } = Xr(), [f, w] = B(null), [k, C] = B(""), [I, R] = B(null), [P, A] = B(null), [M, g] = B(!1), [y, F] = B(""), U = H(y), S = H(null);
4953
+ const { messages: v } = Xr(), [f, w] = D(null), [k, E] = D(""), [I, N] = D(null), [P, x] = D(null), [S, g] = D(!1), [y, F] = D(""), U = H(y), C = H(null);
4942
4954
  q(() => {
4943
4955
  if (!f)
4944
4956
  if (m) {
4945
- const u = localStorage.getItem(qe(m));
4946
- F(u || "");
4957
+ const d = localStorage.getItem(qe(m));
4958
+ F(d || "");
4947
4959
  } else
4948
4960
  F("");
4949
4961
  }, [m, f]);
4950
- const E = z((u) => {
4951
- F(u), !f && m && localStorage.setItem(qe(m), u);
4962
+ const M = z((d) => {
4963
+ F(d), !f && m && localStorage.setItem(qe(m), d);
4952
4964
  }, [m, f]);
4953
4965
  q(() => {
4954
4966
  U.current = y;
4955
4967
  }, [y]), q(() => {
4956
4968
  if (!f) {
4957
- S.current = null;
4969
+ C.current = null;
4958
4970
  return;
4959
4971
  }
4960
- S.current === null && (S.current = U.current), E(k ?? "");
4961
- }, [k, f, E]);
4962
- const j = z(
4963
- (u) => {
4964
- E(u);
4972
+ C.current === null && (C.current = U.current), M(k ?? "");
4973
+ }, [k, f, M]);
4974
+ const L = z(
4975
+ (d) => {
4976
+ M(d);
4965
4977
  },
4966
- [E]
4967
- ), N = async (u, x) => {
4968
- const _ = Array.isArray(x) ? { files: x } : x ?? {}, te = _.files ?? [], J = _.contentParts ?? [], K = u.trim();
4969
- if (!(!K && te.length === 0 && J.length === 0))
4978
+ [M]
4979
+ ), R = async (d, A) => {
4980
+ const _ = Array.isArray(A) ? { files: A } : A ?? {}, te = _.files ?? [], J = _.contentParts ?? [], G = d.trim();
4981
+ if (!(!G && te.length === 0 && J.length === 0))
4970
4982
  try {
4971
4983
  const Z = te.map(async (X) => {
4972
4984
  try {
@@ -4975,7 +4987,7 @@ function mo({
4975
4987
  } catch (Y) {
4976
4988
  throw console.error("Failed to upload file", X.name, Y), new Error(`Failed to upload ${X.name}`);
4977
4989
  }
4978
- }), de = (await Promise.all(Z)).map(({ record: X }) => {
4990
+ }), ue = (await Promise.all(Z)).map(({ record: X }) => {
4979
4991
  const Y = X.mime_type;
4980
4992
  return Y.startsWith("image/") ? {
4981
4993
  type: "image_url",
@@ -4987,10 +4999,10 @@ function mo({
4987
4999
  name: X.filename,
4988
5000
  size: X.size
4989
5001
  };
4990
- }), W = [...J, ...de], ee = f ? (I == null ? void 0 : I.checkpointId) ?? n ?? void 0 : n ?? void 0, ve = f ? (I == null ? void 0 : I.checkpointNs) ?? r ?? void 0 : r ?? void 0;
5002
+ }), W = [...J, ...ue], ee = f ? (I == null ? void 0 : I.checkpointId) ?? n ?? void 0 : n ?? void 0, ve = f ? (I == null ? void 0 : I.checkpointNs) ?? r ?? void 0 : r ?? void 0;
4991
5003
  await e(
4992
5004
  {
4993
- text: K || "",
5005
+ text: G || "",
4994
5006
  contentParts: W,
4995
5007
  attachments: te,
4996
5008
  payload: t.payload,
@@ -5002,18 +5014,18 @@ function mo({
5002
5014
  config: t.config
5003
5015
  },
5004
5016
  p ? { onEvent: p } : void 0
5005
- ), o == null || o(K), c(!0), h && (m && localStorage.removeItem(qe(m)), E("")), A(null), w(null), C(""), R(null);
5017
+ ), o == null || o(G), c(!0), h && (m && localStorage.removeItem(qe(m)), M("")), x(null), w(null), E(""), N(null);
5006
5018
  } catch (Z) {
5007
5019
  const ae = (Z == null ? void 0 : Z.message) || "Failed to send message";
5008
- A(ae), a == null || a(ae), c(!1);
5020
+ x(ae), a == null || a(ae), c(!1);
5009
5021
  }
5010
- }, V = (u, x) => {
5011
- x || N(u, { files: [] });
5012
- }, G = z(
5013
- async (u) => {
5022
+ }, V = (d, A) => {
5023
+ A || R(d, { files: [] });
5024
+ }, B = z(
5025
+ async (d) => {
5014
5026
  await e(
5015
5027
  {
5016
- attachments: [u],
5028
+ attachments: [d],
5017
5029
  payload: t.payload,
5018
5030
  checkpointId: n ?? void 0,
5019
5031
  checkpointNs: r ?? void 0,
@@ -5021,30 +5033,30 @@ function mo({
5021
5033
  config: t.config
5022
5034
  },
5023
5035
  p ? { onEvent: p } : void 0
5024
- ), s == null || s({ file: u });
5036
+ ), s == null || s({ file: d });
5025
5037
  },
5026
5038
  [n, r, t, s, e]
5027
5039
  ), b = z(
5028
- (u, x, _) => {
5029
- i && (S.current = y, w(u), C(x), R({
5040
+ (d, A, _) => {
5041
+ i && (C.current = y, w(d), E(A), N({
5030
5042
  checkpointId: (_ == null ? void 0 : _.checkpointId) ?? null,
5031
5043
  checkpointNs: (_ == null ? void 0 : _.checkpointNs) ?? null
5032
- }), A(null));
5044
+ }), x(null));
5033
5045
  },
5034
5046
  [y, i]
5035
5047
  ), T = z(() => {
5036
- w(null), C(""), R(null), A(null);
5037
- const u = S.current;
5038
- u !== null && F(u), S.current = null;
5039
- }, []), $ = z((u) => {
5040
- let x = null;
5041
- for (let K = u - 1; K >= 0; K--)
5042
- if (d[K].role === "user") {
5043
- x = d[K];
5048
+ w(null), E(""), N(null), x(null);
5049
+ const d = C.current;
5050
+ d !== null && F(d), C.current = null;
5051
+ }, []), $ = z((d) => {
5052
+ let A = null;
5053
+ for (let G = d - 1; G >= 0; G--)
5054
+ if (u[G].role === "user") {
5055
+ A = u[G];
5044
5056
  break;
5045
5057
  }
5046
- if (!x) return;
5047
- const _ = Array.isArray(x.content) ? x.content : [], J = _.filter((K) => (K == null ? void 0 : K.type) === "text").map((K) => K.text).join("") || (() => {
5058
+ if (!A) return;
5059
+ const _ = Array.isArray(A.content) ? A.content : [], J = _.filter((G) => (G == null ? void 0 : G.type) === "text").map((G) => G.text).join("") || (() => {
5048
5060
  try {
5049
5061
  return JSON.stringify(_, null, 2);
5050
5062
  } catch {
@@ -5058,24 +5070,24 @@ function mo({
5058
5070
  checkpointId: n ?? void 0,
5059
5071
  checkpointNs: r ?? void 0,
5060
5072
  edit: !0,
5061
- originalMessageId: x.id,
5073
+ originalMessageId: A.id,
5062
5074
  config: t.config
5063
5075
  },
5064
5076
  p ? { onEvent: p } : void 0
5065
5077
  );
5066
- }, [d, e, n, r, t]);
5078
+ }, [u, e, n, r, t]);
5067
5079
  return {
5068
5080
  editingMessageId: f,
5069
5081
  editingInitialValue: k,
5070
5082
  inputError: P,
5071
- setInputError: A,
5072
- dismissError: M,
5083
+ setInputError: x,
5084
+ dismissError: S,
5073
5085
  setDismissError: g,
5074
5086
  composerValue: y,
5075
- handleComposerChange: j,
5076
- handleSendMessage: N,
5087
+ handleComposerChange: L,
5088
+ handleSendMessage: R,
5077
5089
  handleQuickPrompt: V,
5078
- handleExcelUpload: G,
5090
+ handleExcelUpload: B,
5079
5091
  startEditing: b,
5080
5092
  cancelEditing: T,
5081
5093
  handleRegenerateCb: $,
@@ -5098,7 +5110,7 @@ function ho(e) {
5098
5110
  }, [e]);
5099
5111
  }
5100
5112
  function yo(e, t, n) {
5101
- const [r, o] = B(e), s = H(e), a = H(null);
5113
+ const [r, o] = D(e), s = H(e), a = H(null);
5102
5114
  return q(() => {
5103
5115
  s.current = e;
5104
5116
  const i = () => {
@@ -5133,17 +5145,17 @@ export {
5133
5145
  ro as hasContent,
5134
5146
  ht as hydrateHistorySnapshots,
5135
5147
  Et as isFileLike,
5136
- Nn as looksLikeMarkdown,
5148
+ Rn as looksLikeMarkdown,
5137
5149
  io as messageSignature,
5138
5150
  so as normalizeInterruptId,
5139
- Rt as onChatTokenChanged,
5151
+ Nt as onChatTokenChanged,
5140
5152
  tt as parseJsonSafe,
5141
5153
  Pt as pretty,
5142
- xr as refreshHistoryFileUrls,
5154
+ Ar as refreshHistoryFileUrls,
5143
5155
  Ke as sanitizeForDisplay,
5144
5156
  ke as setChatToken,
5145
5157
  $n as stringifyTool,
5146
- xe as useApi,
5158
+ Ae as useApi,
5147
5159
  mo as useChatController,
5148
5160
  Xr as useChatSession,
5149
5161
  fo as useFilePreview,
@@ -5153,7 +5165,7 @@ export {
5153
5165
  yo as useStreamingMarkdownBuffer,
5154
5166
  Dt as useThreadHistoryState,
5155
5167
  Gt as useThreadState,
5156
- Nr as useThreadStateUpdater,
5168
+ Rr as useThreadStateUpdater,
5157
5169
  ot as useThreads,
5158
5170
  fr as useThreadsState,
5159
5171
  go as useToolPayload