@fencyai/react 0.1.166 → 0.1.167

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs as p, jsx as o, Fragment as E } from "react/jsx-runtime";
2
2
  import { createStream as se, isStreamTimeoutEvent as le, isStreamNotFoundEvent as ce, isAgentTaskProgressItemUpdatedEvent as de, createAgentTask as me } from "@fencyai/js";
3
- import { createContext as ue, useState as v, useRef as R, useEffect as A, useCallback as W, useContext as ye, useMemo as P } from "react";
3
+ import { createContext as ue, useState as C, useRef as F, useEffect as R, useCallback as W, useContext as ye, useMemo as P } from "react";
4
4
  import { useInView as pe, motion as b, AnimatePresence as re } from "motion/react";
5
5
  import ge from "react-markdown";
6
6
  import { Prism as ne } from "react-syntax-highlighter";
@@ -61,8 +61,8 @@ function Se(e, r, t) {
61
61
  e(n.id = a);
62
62
  break;
63
63
  case "retry":
64
- const y = parseInt(a, 10);
65
- isNaN(y) || r(n.retry = y);
64
+ const u = parseInt(a, 10);
65
+ isNaN(u) || r(n.retry = u);
66
66
  break;
67
67
  }
68
68
  }
@@ -91,43 +91,43 @@ var ke = function(e, r) {
91
91
  const G = "text/event-stream", be = 1e3, J = "last-event-id";
92
92
  function ve(e, r) {
93
93
  var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: i } = r, a = ke(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
- return new Promise((y, u) => {
95
- const h = Object.assign({}, n);
96
- h.accept || (h.accept = G);
97
- let g;
94
+ return new Promise((u, y) => {
95
+ const g = Object.assign({}, n);
96
+ g.accept || (g.accept = G);
97
+ let h;
98
98
  function k() {
99
- g.abort(), document.hidden || F();
99
+ h.abort(), document.hidden || M();
100
100
  }
101
101
  m || document.addEventListener("visibilitychange", k);
102
- let x = be, f = 0;
103
- function T() {
104
- document.removeEventListener("visibilitychange", k), window.clearTimeout(f), g.abort();
102
+ let f = be, x = 0;
103
+ function S() {
104
+ document.removeEventListener("visibilitychange", k), window.clearTimeout(x), h.abort();
105
105
  }
106
106
  t == null || t.addEventListener("abort", () => {
107
- T(), y();
107
+ S(), u();
108
108
  });
109
- const C = i ?? window.fetch, w = l ?? Ce;
110
- async function F() {
109
+ const w = i ?? window.fetch, v = l ?? Ce;
110
+ async function M() {
111
111
  var z;
112
- g = new AbortController();
112
+ h = new AbortController();
113
113
  try {
114
- const D = await C(e, Object.assign(Object.assign({}, a), { headers: h, signal: g.signal }));
115
- await w(D), await fe(D.body, xe(Se((M) => {
116
- M ? h[J] = M : delete h[J];
117
- }, (M) => {
118
- x = M;
119
- }, c))), s == null || s(), T(), y();
114
+ const D = await w(e, Object.assign(Object.assign({}, a), { headers: g, signal: h.signal }));
115
+ await v(D), await fe(D.body, xe(Se((A) => {
116
+ A ? g[J] = A : delete g[J];
117
+ }, (A) => {
118
+ f = A;
119
+ }, c))), s == null || s(), S(), u();
120
120
  } catch (D) {
121
- if (!g.signal.aborted)
121
+ if (!h.signal.aborted)
122
122
  try {
123
- const M = (z = d == null ? void 0 : d(D)) !== null && z !== void 0 ? z : x;
124
- window.clearTimeout(f), f = window.setTimeout(F, M);
125
- } catch (M) {
126
- T(), u(M);
123
+ const A = (z = d == null ? void 0 : d(D)) !== null && z !== void 0 ? z : f;
124
+ window.clearTimeout(x), x = window.setTimeout(M, A);
125
+ } catch (A) {
126
+ S(), y(A);
127
127
  }
128
128
  }
129
129
  }
130
- F();
130
+ M();
131
131
  });
132
132
  }
133
133
  function Ce(e) {
@@ -220,59 +220,59 @@ const Me = 48e4, Ae = 3e5, Y = (e) => {
220
220
  return e.filter((t) => r - t.createdAt < Me);
221
221
  };
222
222
  function Dr({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
223
- const [n, l] = v(
223
+ const [n, l] = C(
224
224
  null
225
- ), [c, s] = v(!0), [d, m] = v(null), [i, a] = v([]), y = R(null), u = R(null);
226
- A(() => {
227
- e.then((x) => {
228
- l(x), s(!1);
229
- }).catch((x) => {
230
- m(x), s(!1);
225
+ ), [c, s] = C(!0), [d, m] = C(null), [i, a] = C([]), u = F(null), y = F(null);
226
+ R(() => {
227
+ e.then((f) => {
228
+ l(f), s(!1);
229
+ }).catch((f) => {
230
+ m(f), s(!1);
231
231
  });
232
- }, [e]), A(() => {
233
- n && !u.current && (u.current = new Ee(n));
234
- }, [n]), A(() => {
235
- u.current && u.current.updateStreams(i);
236
- }, [i]), A(() => () => {
237
- var x;
238
- (x = u.current) == null || x.cleanup();
239
- }, []), A(() => {
240
- const x = setInterval(() => {
241
- a((f) => {
242
- const T = Y(f);
243
- return T.length !== f.length ? T : f;
232
+ }, [e]), R(() => {
233
+ n && !y.current && (y.current = new Ee(n));
234
+ }, [n]), R(() => {
235
+ y.current && y.current.updateStreams(i);
236
+ }, [i]), R(() => () => {
237
+ var f;
238
+ (f = y.current) == null || f.cleanup();
239
+ }, []), R(() => {
240
+ const f = setInterval(() => {
241
+ a((x) => {
242
+ const S = Y(x);
243
+ return S.length !== x.length ? S : x;
244
244
  });
245
245
  }, 6e4);
246
- return () => clearInterval(x);
246
+ return () => clearInterval(f);
247
247
  }, []);
248
- const h = W(
249
- async (x = Ae) => {
250
- if (y.current)
251
- return y.current;
252
- const f = Date.now(), T = i.length > 0 ? i[i.length - 1] : null;
253
- if (T && f - T.createdAt < x)
254
- return T.stream;
255
- const C = (async () => {
248
+ const g = W(
249
+ async (f = Ae) => {
250
+ if (u.current)
251
+ return u.current;
252
+ const x = Date.now(), S = i.length > 0 ? i[i.length - 1] : null;
253
+ if (S && x - S.createdAt < f)
254
+ return S.stream;
255
+ const w = (async () => {
256
256
  if (!n)
257
257
  throw new Error("Fency instance not initialized");
258
- const w = await r(), F = await se({
258
+ const v = await r(), M = await se({
259
259
  pk: n.publishableKey,
260
260
  baseUrl: n.baseUrl,
261
- clientToken: (w == null ? void 0 : w.clientToken) ?? ""
261
+ clientToken: (v == null ? void 0 : v.clientToken) ?? ""
262
262
  });
263
- if (F.type === "success") {
263
+ if (M.type === "success") {
264
264
  const z = {
265
- stream: F.stream,
265
+ stream: M.stream,
266
266
  createdAt: Date.now()
267
267
  };
268
268
  return a((D) => {
269
- const M = [...D, z];
270
- return Y(M);
271
- }), y.current = null, F.stream;
269
+ const A = [...D, z];
270
+ return Y(A);
271
+ }), u.current = null, M.stream;
272
272
  } else
273
- throw y.current = null, new Error("Failed to create stream");
273
+ throw u.current = null, new Error("Failed to create stream");
274
274
  })();
275
- return y.current = C, C;
275
+ return u.current = w, w;
276
276
  },
277
277
  [n, i]
278
278
  );
@@ -283,14 +283,14 @@ function Dr({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
283
283
  ] });
284
284
  if (!n)
285
285
  return null;
286
- const g = i.length > 0 ? i[i.length - 1] : null, k = {
286
+ const h = i.length > 0 ? i[i.length - 1] : null, k = {
287
287
  fency: n,
288
288
  loading: c,
289
289
  error: d,
290
290
  activeStreams: i,
291
- latestStream: g,
292
- eventManager: u.current,
293
- getOrCreateStream: h
291
+ latestStream: h,
292
+ eventManager: y.current,
293
+ getOrCreateStream: g
294
294
  };
295
295
  return /* @__PURE__ */ o(te.Provider, { value: k, children: t });
296
296
  }
@@ -324,23 +324,23 @@ const Re = (e) => {
324
324
  createdAt: e.createdAt,
325
325
  data: JSON.parse(e.data)
326
326
  }), ze = (e) => {
327
- const r = oe(), [t, n] = v(null), l = R(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
328
- return A(() => {
327
+ const r = oe(), [t, n] = C(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
328
+ return R(() => {
329
329
  if (!r.eventManager) return;
330
330
  const s = {
331
331
  onMessage: (m, i) => {
332
- var y, u, h;
332
+ var u, y, g;
333
333
  const a = Re(m);
334
334
  if (a)
335
335
  switch (a.type) {
336
336
  case "STREAM_TIMEOUT":
337
- (y = e == null ? void 0 : e.onStreamTimeout) == null || y.call(e, a);
337
+ (u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, a);
338
338
  break;
339
339
  case "STREAM_NOT_FOUND":
340
- (u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, a);
340
+ (y = e == null ? void 0 : e.onStreamNotFound) == null || y.call(e, a);
341
341
  break;
342
342
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
343
- (h = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || h.call(e, a);
343
+ (g = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || g.call(e, a);
344
344
  break;
345
345
  }
346
346
  },
@@ -380,59 +380,59 @@ const Re = (e) => {
380
380
  stream: t
381
381
  };
382
382
  }, Lr = (e) => {
383
- const r = oe(), [t, n] = v([]), l = R(/* @__PURE__ */ new Set()), c = R(/* @__PURE__ */ new Map()), { createStream: s } = ze({
383
+ const r = oe(), [t, n] = C([]), l = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), { createStream: s } = ze({
384
384
  onAgentTaskProgressItemUpdated: (i) => {
385
- var u;
385
+ var y;
386
386
  if (!l.current.has(i.agentTaskId)) return;
387
387
  const a = i.data;
388
388
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChat" && a.eventType === "Completed" || a.taskType === "MemorySearch" && a.eventType === "Completed") {
389
- const h = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
389
+ const g = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
390
390
  n(
391
- h ? (k) => k.map((x) => {
392
- var C;
393
- if (((C = x.confirmedData) == null ? void 0 : C.taskId) !== i.agentTaskId)
394
- return x;
395
- const T = x.progressItems.some(
396
- (w) => w.progressItemId === i.progressItemId
397
- ) ? x.progressItems.map(
398
- (w) => w.progressItemId === i.progressItemId ? i : w
399
- ) : [...x.progressItems, i];
391
+ g ? (k) => k.map((f) => {
392
+ var w;
393
+ if (((w = f.confirmedData) == null ? void 0 : w.taskId) !== i.agentTaskId)
394
+ return f;
395
+ const S = f.progressItems.some(
396
+ (v) => v.progressItemId === i.progressItemId
397
+ ) ? f.progressItems.map(
398
+ (v) => v.progressItemId === i.progressItemId ? i : v
399
+ ) : [...f.progressItems, i];
400
400
  return {
401
- ...x,
402
- progressItems: T,
401
+ ...f,
402
+ progressItems: S,
403
403
  loading: !1
404
404
  };
405
405
  }) : (k) => k.map(
406
- (x) => {
407
- var f;
408
- return ((f = x.confirmedData) == null ? void 0 : f.taskId) === i.agentTaskId ? { ...x, loading: !1 } : x;
406
+ (f) => {
407
+ var x;
408
+ return ((x = f.confirmedData) == null ? void 0 : x.taskId) === i.agentTaskId ? { ...f, loading: !1 } : f;
409
409
  }
410
410
  )
411
411
  );
412
- const g = c.current.get(
412
+ const h = c.current.get(
413
413
  i.agentTaskId
414
414
  );
415
- g && (c.current.delete(i.agentTaskId), g(a));
415
+ h && (c.current.delete(i.agentTaskId), h(a));
416
416
  return;
417
417
  }
418
- (u = e.onAgentTaskProgressItemUpdated) == null || u.call(e, i), n(
419
- (h) => h.map((g) => {
420
- var f;
421
- if (((f = g.confirmedData) == null ? void 0 : f.taskId) !== i.agentTaskId)
422
- return g;
423
- const x = g.progressItems.some(
424
- (T) => T.progressItemId === i.progressItemId
425
- ) ? g.progressItems.map(
426
- (T) => T.progressItemId === i.progressItemId ? i : T
427
- ) : [...g.progressItems, i];
428
- return { ...g, progressItems: x };
418
+ (y = e.onAgentTaskProgressItemUpdated) == null || y.call(e, i), n(
419
+ (g) => g.map((h) => {
420
+ var x;
421
+ if (((x = h.confirmedData) == null ? void 0 : x.taskId) !== i.agentTaskId)
422
+ return h;
423
+ const f = h.progressItems.some(
424
+ (S) => S.progressItemId === i.progressItemId
425
+ ) ? h.progressItems.map(
426
+ (S) => S.progressItemId === i.progressItemId ? i : S
427
+ ) : [...h.progressItems, i];
428
+ return { ...h, progressItems: f };
429
429
  })
430
430
  );
431
431
  },
432
432
  onStreamError: (i) => {
433
433
  var a;
434
434
  (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, i), n(
435
- (y) => y.map((u) => u.streamId !== i.streamId || !u.loading ? u : { ...u, loading: !1, error: i.error })
435
+ (u) => u.map((y) => y.streamId !== i.streamId || !y.loading ? y : { ...y, loading: !1, error: i.error })
436
436
  );
437
437
  },
438
438
  onStreamNotFound: (i) => {
@@ -446,12 +446,17 @@ const Re = (e) => {
446
446
  }), d = W(
447
447
  async (i, a) => {
448
448
  var h;
449
- const y = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, u = await s();
450
- if (u.type === "success") {
451
- const g = (/* @__PURE__ */ new Date()).toISOString(), k = {
452
- taskKey: y,
453
- streamId: u.stream.id,
454
- triggeredAt: g,
449
+ const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, y = (a == null ? void 0 : a.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
450
+ if (y === void 0)
451
+ throw new Error(
452
+ "fetchCreateAgentTaskClientToken must be provided either in useAgentTasks props or in createAgentTask options"
453
+ );
454
+ const g = await s();
455
+ if (g.type === "success") {
456
+ const k = (/* @__PURE__ */ new Date()).toISOString(), f = {
457
+ taskKey: u,
458
+ streamId: g.stream.id,
459
+ triggeredAt: k,
455
460
  confirmedData: null,
456
461
  error: null,
457
462
  params: i,
@@ -459,12 +464,12 @@ const Re = (e) => {
459
464
  loading: !0,
460
465
  loadingText: a == null ? void 0 : a.loadingText
461
466
  };
462
- n((T) => [...T, k]), (h = a == null ? void 0 : a.onTaskRegistered) == null || h.call(a, k);
463
- const { clientToken: x } = await e.fetchCreateAgentTaskClientToken(i.type), f = await me({
467
+ n((w) => [...w, f]), (h = a == null ? void 0 : a.onTaskRegistered) == null || h.call(a, f);
468
+ const { clientToken: x } = await y(), S = await me({
464
469
  pk: r.fency.publishableKey,
465
470
  baseUrl: r.fency.baseUrl,
466
471
  clientToken: x,
467
- streamToken: u.stream.token,
472
+ streamToken: g.stream.token,
468
473
  request: {
469
474
  streamingChatCompletionTask: i.type === "StreamingChatCompletion" ? {
470
475
  messages: i.messages,
@@ -494,50 +499,50 @@ const Re = (e) => {
494
499
  } : void 0
495
500
  }
496
501
  });
497
- if (f.type === "success" && f.agentTask) {
502
+ if (S.type === "success" && S.agentTask) {
498
503
  l.current.add(
499
- f.agentTask.id
500
- ), n((C) => [
501
- ...C.filter((w) => w.taskKey !== y),
504
+ S.agentTask.id
505
+ ), n((v) => [
506
+ ...v.filter((M) => M.taskKey !== u),
502
507
  {
503
- taskKey: y,
504
- streamId: u.stream.id,
508
+ taskKey: u,
509
+ streamId: g.stream.id,
505
510
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
506
- taskId: f.agentTask.id,
507
- createdAt: f.agentTask.createdAt,
511
+ taskId: S.agentTask.id,
512
+ createdAt: S.agentTask.createdAt,
508
513
  error: null,
509
514
  params: i,
510
515
  progressItems: [],
511
516
  loading: !0,
512
517
  loadingText: a == null ? void 0 : a.loadingText,
513
518
  confirmedData: {
514
- taskId: f.agentTask.id,
515
- createdAt: f.agentTask.createdAt
519
+ taskId: S.agentTask.id,
520
+ createdAt: S.agentTask.createdAt
516
521
  }
517
522
  }
518
523
  ]);
519
- const T = await new Promise((C) => {
524
+ const w = await new Promise((v) => {
520
525
  c.current.set(
521
- f.agentTask.id,
522
- C
526
+ S.agentTask.id,
527
+ v
523
528
  );
524
529
  });
525
530
  return {
526
531
  type: "success",
527
- streamId: u.stream.id,
528
- agentTaskId: f.agentTask.id,
529
- response: T
532
+ streamId: g.stream.id,
533
+ agentTaskId: S.agentTask.id,
534
+ response: w
530
535
  };
531
536
  } else {
532
- if (f.type === "error")
533
- return n((T) => [
534
- ...T.filter((C) => C.taskKey !== y),
537
+ if (S.type === "error")
538
+ return n((w) => [
539
+ ...w.filter((v) => v.taskKey !== u),
535
540
  {
536
- taskKey: y,
541
+ taskKey: u,
537
542
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
538
- streamId: u.stream.id,
543
+ streamId: g.stream.id,
539
544
  params: i,
540
- error: f.error,
545
+ error: S.error,
541
546
  progressItems: [],
542
547
  loading: !1,
543
548
  loadingText: a == null ? void 0 : a.loadingText,
@@ -545,20 +550,20 @@ const Re = (e) => {
545
550
  }
546
551
  ]), {
547
552
  type: "error",
548
- error: f.error
553
+ error: S.error
549
554
  };
550
555
  {
551
- const T = {
556
+ const w = {
552
557
  message: "No response received",
553
558
  code: "UnknownError"
554
559
  };
555
- return n((C) => [
556
- ...C.filter((w) => w.taskKey !== y),
560
+ return n((v) => [
561
+ ...v.filter((M) => M.taskKey !== u),
557
562
  {
558
- taskKey: y,
563
+ taskKey: u,
559
564
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
560
- streamId: u.stream.id,
561
- error: T,
565
+ streamId: g.stream.id,
566
+ error: w,
562
567
  params: i,
563
568
  progressItems: [],
564
569
  loading: !1,
@@ -567,19 +572,19 @@ const Re = (e) => {
567
572
  }
568
573
  ]), {
569
574
  type: "error",
570
- error: T
575
+ error: w
571
576
  };
572
577
  }
573
578
  }
574
579
  } else
575
- return console.error(u.error), u;
580
+ return console.error(g.error), g;
576
581
  },
577
582
  [r, s, e.fetchCreateAgentTaskClientToken]
578
583
  ), m = P(() => {
579
584
  if (t.length !== 0)
580
585
  return [...t].sort((i, a) => new Date(a.triggeredAt).getTime() - new Date(i.triggeredAt).getTime())[0];
581
586
  }, [t]);
582
- return A(() => () => {
587
+ return R(() => () => {
583
588
  l.current.clear(), c.current.clear();
584
589
  }, []), {
585
590
  agentTasks: t,
@@ -615,14 +620,14 @@ function I({
615
620
  inViewMargin: m,
616
621
  spread: i = 2,
617
622
  color: a = "#999",
618
- shimmerColor: y = "#000",
619
- direction: u = "fromBottom"
623
+ shimmerColor: u = "#000",
624
+ direction: y = "fromBottom"
620
625
  }) {
621
- const h = R(null), g = pe(h, { once: d, margin: m }), k = P(() => e.length * i, [e, i]), x = !s || g, f = u === "fromBottom" ? "100% center" : "-100% center", T = u === "fromBottom" ? "0% center" : "200% center";
626
+ const g = F(null), h = pe(g, { once: d, margin: m }), k = P(() => e.length * i, [e, i]), f = !s || h, x = y === "fromBottom" ? "100% center" : "-100% center", S = y === "fromBottom" ? "0% center" : "200% center";
622
627
  return /* @__PURE__ */ o(
623
628
  b.span,
624
629
  {
625
- ref: h,
630
+ ref: g,
626
631
  className: c,
627
632
  style: {
628
633
  position: "relative",
@@ -635,16 +640,16 @@ function I({
635
640
  backgroundRepeat: "no-repeat, padding-box",
636
641
  "--spread": `${k}px`,
637
642
  "--base-color": a,
638
- "--shimmer-color": y,
643
+ "--shimmer-color": u,
639
644
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
640
645
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
641
646
  },
642
647
  initial: {
643
- backgroundPosition: f,
648
+ backgroundPosition: x,
644
649
  opacity: 0
645
650
  },
646
- animate: x ? {
647
- backgroundPosition: T,
651
+ animate: f ? {
652
+ backgroundPosition: S,
648
653
  opacity: 1
649
654
  } : {},
650
655
  transition: {
@@ -1068,7 +1073,7 @@ const Be = ({ progressViewItems: e, t: r }) => {
1068
1073
  function He(e) {
1069
1074
  return $e[e];
1070
1075
  }
1071
- function S(e, r) {
1076
+ function T(e, r) {
1072
1077
  return Object.entries(r).reduce(
1073
1078
  (t, [n, l]) => t.replace(`{${n}}`, String(l)),
1074
1079
  e
@@ -1083,10 +1088,10 @@ function Q(e, r) {
1083
1088
  return t.join(", ");
1084
1089
  }
1085
1090
  const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1086
- const [l, c] = v(!1), d = (e.memories ?? []).map((x) => x.memoryTitle), m = d.length > 0, i = m && d.length > $, a = i && !l ? d.slice(0, $) : d, y = d.length - $, u = !i || l, h = `${n.searchingFor}'${e.queryDescription}'`, g = m ? `${n.searchingIn}${Q(
1091
+ const [l, c] = C(!1), d = (e.memories ?? []).map((f) => f.memoryTitle), m = d.length > 0, i = m && d.length > $, a = i && !l ? d.slice(0, $) : d, u = d.length - $, y = !i || l, g = `${n.searchingFor}'${e.queryDescription}'`, h = m ? `${n.searchingIn}${Q(
1087
1092
  a,
1088
- u ? n.and : void 0
1089
- )}` : "", k = m ? `${h}${g}` : `${n.searchingPrefix}${e.queryDescription}`;
1093
+ y ? n.and : void 0
1094
+ )}` : "", k = m ? `${g}${h}` : `${n.searchingPrefix}${e.queryDescription}`;
1090
1095
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1091
1096
  /* @__PURE__ */ o(
1092
1097
  b.div,
@@ -1112,7 +1117,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1112
1117
  e.queryDescription,
1113
1118
  "'"
1114
1119
  ] }),
1115
- g
1120
+ h
1116
1121
  ] }) : `${n.searchingPrefix}${e.queryDescription}` }),
1117
1122
  i && !l && /* @__PURE__ */ p(E, { children: [
1118
1123
  " ",
@@ -1132,8 +1137,8 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1132
1137
  textDecoration: "underline",
1133
1138
  fontFamily: "inherit"
1134
1139
  },
1135
- children: S(n.moreMemories, {
1136
- n: y
1140
+ children: T(n.moreMemories, {
1141
+ n: u
1137
1142
  })
1138
1143
  }
1139
1144
  )
@@ -1172,14 +1177,14 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1172
1177
  marginTop: "4px",
1173
1178
  fontStyle: "italic"
1174
1179
  },
1175
- children: S(n.tookSeconds, { n: t })
1180
+ children: T(n.tookSeconds, { n: t })
1176
1181
  }
1177
1182
  )
1178
1183
  ] });
1179
1184
  }, H = 5, Ge = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1180
- const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > H, i = m && !l ? s.slice(0, H) : s, a = s.length - H, y = !m || l, u = d ? `${n.findingMemoriesIn}${Q(
1185
+ const [l, c] = C(!1), s = e.titles, d = s.length > 0, m = d && s.length > H, i = m && !l ? s.slice(0, H) : s, a = s.length - H, u = !m || l, y = d ? `${n.findingMemoriesIn}${Q(
1181
1186
  i,
1182
- y ? n.and : void 0
1187
+ u ? n.and : void 0
1183
1188
  )}` : n.findingMemories;
1184
1189
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1185
1190
  /* @__PURE__ */ o(
@@ -1194,14 +1199,14 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1194
1199
  children: r && !t && !m ? /* @__PURE__ */ o(
1195
1200
  I,
1196
1201
  {
1197
- text: u,
1202
+ text: y,
1198
1203
  duration: 2.5,
1199
1204
  repeat: !0,
1200
1205
  color: "#999",
1201
1206
  shimmerColor: "#000"
1202
1207
  }
1203
1208
  ) : /* @__PURE__ */ p(E, { children: [
1204
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
1209
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: y }),
1205
1210
  m && !l && /* @__PURE__ */ p(E, { children: [
1206
1211
  " ",
1207
1212
  /* @__PURE__ */ o(
@@ -1220,7 +1225,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1220
1225
  textDecoration: "underline",
1221
1226
  fontFamily: "inherit"
1222
1227
  },
1223
- children: S(n.moreMemories, {
1228
+ children: T(n.moreMemories, {
1224
1229
  n: a
1225
1230
  })
1226
1231
  }
@@ -1260,12 +1265,12 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1260
1265
  marginTop: "4px",
1261
1266
  fontStyle: "italic"
1262
1267
  },
1263
- children: S(n.tookSeconds, { n: t })
1268
+ children: T(n.tookSeconds, { n: t })
1264
1269
  }
1265
1270
  )
1266
1271
  ] });
1267
1272
  }, _ = 5, Qe = ({ data: e, t: r }) => {
1268
- const [t, n] = v(!1), c = e.memories.map((h) => h.memoryTitle), s = c.length > 0, d = s && c.length > _, m = d && !t ? c.slice(0, _) : c, i = c.length - _, a = !d || t, y = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, u = s ? `${y}${Q(
1273
+ const [t, n] = C(!1), c = e.memories.map((g) => g.memoryTitle), s = c.length > 0, d = s && c.length > _, m = d && !t ? c.slice(0, _) : c, i = c.length - _, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, y = s ? `${u}${Q(
1269
1274
  m,
1270
1275
  a ? r.and : void 0
1271
1276
  )}` : r.memoriesFound;
@@ -1277,7 +1282,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1277
1282
  animate: { opacity: 1, y: 0 },
1278
1283
  transition: { duration: 0.3, delay: 0 },
1279
1284
  children: /* @__PURE__ */ p(E, { children: [
1280
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
1285
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: y }),
1281
1286
  d && !t && /* @__PURE__ */ p(E, { children: [
1282
1287
  " ",
1283
1288
  /* @__PURE__ */ o(
@@ -1296,7 +1301,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1296
1301
  textDecoration: "underline",
1297
1302
  fontFamily: "inherit"
1298
1303
  },
1299
- children: S(r.moreMemories, {
1304
+ children: T(r.moreMemories, {
1300
1305
  n: i
1301
1306
  })
1302
1307
  }
@@ -1363,7 +1368,7 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1363
1368
  marginTop: "4px",
1364
1369
  fontStyle: "italic"
1365
1370
  },
1366
- children: S(t.tookSeconds, { n: r })
1371
+ children: T(t.tookSeconds, { n: r })
1367
1372
  }
1368
1373
  )
1369
1374
  ] });
@@ -1371,17 +1376,17 @@ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1371
1376
  function je(e, r) {
1372
1377
  if (e.length === 0) return "";
1373
1378
  if (e.length === 1)
1374
- return S(r.pageSingle, { n: e[0] });
1379
+ return T(r.pageSingle, { n: e[0] });
1375
1380
  if (e.length === 2)
1376
- return S(r.pageTwo, {
1381
+ return T(r.pageTwo, {
1377
1382
  a: e[0],
1378
1383
  b: e[1]
1379
1384
  });
1380
1385
  const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1381
- return S(r.pageMultiple, { list: n, n: t });
1386
+ return T(r.pageMultiple, { list: n, n: t });
1382
1387
  }
1383
1388
  const qe = ({ data: e, onSourceClick: r, t }) => {
1384
- const [n, l] = v(null);
1389
+ const [n, l] = C(null);
1385
1390
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1386
1391
  /* @__PURE__ */ o(
1387
1392
  b.div,
@@ -1421,7 +1426,7 @@ const qe = ({ data: e, onSourceClick: r, t }) => {
1421
1426
  onSourceClick: l,
1422
1427
  t: c
1423
1428
  }) => {
1424
- const [s, d] = v(!1), m = !!l, i = t === e.memoryId, a = e.pageNumbers ?? [], y = je(a, c);
1429
+ const [s, d] = C(!1), m = !!l, i = t === e.memoryId, a = e.pageNumbers ?? [], u = je(a, c);
1425
1430
  return /* @__PURE__ */ p(
1426
1431
  b.div,
1427
1432
  {
@@ -1482,7 +1487,7 @@ const qe = ({ data: e, onSourceClick: r, t }) => {
1482
1487
  ]
1483
1488
  }
1484
1489
  ),
1485
- y && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: y })
1490
+ u && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: u })
1486
1491
  ]
1487
1492
  }
1488
1493
  );
@@ -1562,7 +1567,7 @@ function Xe({
1562
1567
  completed: r,
1563
1568
  t
1564
1569
  }) {
1565
- const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > ee, d = c != null ? n || !s ? c : `${c.slice(0, ee)}...` : void 0, m = s, i = e.error != null;
1570
+ const [n, l] = C(!1), c = e.result ?? e.error, s = c != null && c.length > ee, d = c != null ? n || !s ? c : `${c.slice(0, ee)}...` : void 0, m = s, i = e.error != null;
1566
1571
  return /* @__PURE__ */ p(
1567
1572
  b.div,
1568
1573
  {
@@ -1679,16 +1684,16 @@ function j(e) {
1679
1684
  function q(e, r) {
1680
1685
  if (e.length === 0) return "";
1681
1686
  if (e.length === 1)
1682
- return S(r.memorySearchPagesSingle, {
1687
+ return T(r.memorySearchPagesSingle, {
1683
1688
  n: e[0]
1684
1689
  });
1685
1690
  if (e.length === 2)
1686
- return S(r.memorySearchPagesTwo, {
1691
+ return T(r.memorySearchPagesTwo, {
1687
1692
  a: e[0],
1688
1693
  b: e[1]
1689
1694
  });
1690
1695
  const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1691
- return S(r.memorySearchPagesMultiple, {
1696
+ return T(r.memorySearchPagesMultiple, {
1692
1697
  list: n,
1693
1698
  n: t
1694
1699
  });
@@ -1711,7 +1716,7 @@ function er(e, r) {
1711
1716
  let t = 0, n = 0;
1712
1717
  for (const s of e)
1713
1718
  t += ae(s), s.matchingChunkScore > n && (n = s.matchingChunkScore);
1714
- const l = t === 1 ? r.chunkFound : S(r.chunksFound, { n: t }), c = S(r.scoreLabel, {
1719
+ const l = t === 1 ? r.chunkFound : T(r.chunksFound, { n: t }), c = T(r.scoreLabel, {
1715
1720
  n: n.toFixed(2)
1716
1721
  });
1717
1722
  return `${l} - ${c}`;
@@ -1737,7 +1742,7 @@ function nr({
1737
1742
  onSearchResultClick: r,
1738
1743
  t
1739
1744
  }) {
1740
- const [n, l] = v(null), c = !!r;
1745
+ const [n, l] = C(null), c = !!r;
1741
1746
  return /* @__PURE__ */ o(
1742
1747
  "div",
1743
1748
  {
@@ -1754,19 +1759,19 @@ function nr({
1754
1759
  s.chunks
1755
1760
  ), i = [
1756
1761
  V(s),
1757
- S(t.scoreLabel, {
1762
+ T(t.scoreLabel, {
1758
1763
  n: s.matchingChunkScore.toFixed(2)
1759
1764
  }),
1760
1765
  m.length > 0 ? q(m, t) : t.pagesNotAvailable
1761
1766
  ].filter(
1762
- (h) => h != null && h !== ""
1767
+ (g) => g != null && g !== ""
1763
1768
  ), a = {
1764
1769
  memoryId: s.memoryId,
1765
1770
  memoryTitle: s.memoryTitle,
1766
1771
  memoryTypeId: s.memoryTypeId,
1767
1772
  memoryTypeName: s.memoryTypeName,
1768
1773
  pageNumbers: m
1769
- }, y = `${s.memoryId}-${d}`, u = n === y;
1774
+ }, u = `${s.memoryId}-${d}`, y = n === u;
1770
1775
  return /* @__PURE__ */ p(
1771
1776
  "div",
1772
1777
  {
@@ -1824,10 +1829,10 @@ function nr({
1824
1829
  "button",
1825
1830
  {
1826
1831
  type: "button",
1827
- "aria-busy": u,
1828
- disabled: u,
1832
+ "aria-busy": y,
1833
+ disabled: y,
1829
1834
  onClick: async () => {
1830
- l(y);
1835
+ l(u);
1831
1836
  try {
1832
1837
  await r(
1833
1838
  a
@@ -1846,14 +1851,14 @@ function nr({
1846
1851
  background: "#eff6ff",
1847
1852
  border: "1px solid #bfdbfe",
1848
1853
  borderRadius: 6,
1849
- cursor: u ? "wait" : "pointer",
1854
+ cursor: y ? "wait" : "pointer",
1850
1855
  fontFamily: "inherit",
1851
1856
  display: "inline-flex",
1852
1857
  alignItems: "center",
1853
1858
  gap: 8
1854
1859
  },
1855
1860
  children: [
1856
- u && /* @__PURE__ */ o(
1861
+ y && /* @__PURE__ */ o(
1857
1862
  "span",
1858
1863
  {
1859
1864
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -1866,7 +1871,7 @@ function nr({
1866
1871
  )
1867
1872
  ]
1868
1873
  },
1869
- y
1874
+ u
1870
1875
  );
1871
1876
  })
1872
1877
  }
@@ -1994,7 +1999,7 @@ function tr({
1994
1999
  );
1995
2000
  }
1996
2001
  function or(e, r) {
1997
- return e === 1 ? r.chunkFound : S(r.chunksFound, { n: e });
2002
+ return e === 1 ? r.chunkFound : T(r.chunksFound, { n: e });
1998
2003
  }
1999
2004
  const ir = ({
2000
2005
  data: e,
@@ -2002,16 +2007,16 @@ const ir = ({
2002
2007
  t
2003
2008
  }) => {
2004
2009
  const n = e.items, l = n.reduce(
2005
- (u, h) => u + ae(h),
2010
+ (y, g) => y + ae(g),
2006
2011
  0
2007
- ), c = new Set(n.map((u) => u.memoryId)).size, [s, d] = v({}), m = W((u) => {
2008
- d((h) => ({
2009
- ...h,
2010
- [u]: !h[u]
2012
+ ), c = new Set(n.map((y) => y.memoryId)).size, [s, d] = C({}), m = W((y) => {
2013
+ d((g) => ({
2014
+ ...g,
2015
+ [y]: !g[y]
2011
2016
  }));
2012
- }, []), i = P(() => rr(n), [n]), a = c === 1 ? t.memoryChatChunkResultsInOneMemory : S(t.memoryChatChunkResultsInMemories, {
2017
+ }, []), i = P(() => rr(n), [n]), a = c === 1 ? t.memoryChatChunkResultsInOneMemory : T(t.memoryChatChunkResultsInMemories, {
2013
2018
  n: c
2014
- }), y = `${or(l, t)} ${a}`;
2019
+ }), u = `${or(l, t)} ${a}`;
2015
2020
  return n.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
2016
2021
  "div",
2017
2022
  {
@@ -2023,16 +2028,16 @@ const ir = ({
2023
2028
  children: t.memorySearchExploreNoResults
2024
2029
  }
2025
2030
  ) }) : /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
2026
- i.map((u) => /* @__PURE__ */ o(
2031
+ i.map((y) => /* @__PURE__ */ o(
2027
2032
  tr,
2028
2033
  {
2029
- group: u,
2034
+ group: y,
2030
2035
  t,
2031
- expanded: s[u.memoryId] === !0,
2032
- onToggle: () => m(u.memoryId),
2036
+ expanded: s[y.memoryId] === !0,
2037
+ onToggle: () => m(y.memoryId),
2033
2038
  onSearchResultClick: r
2034
2039
  },
2035
- u.memoryId
2040
+ y.memoryId
2036
2041
  )),
2037
2042
  /* @__PURE__ */ o(
2038
2043
  "div",
@@ -2043,7 +2048,7 @@ const ir = ({
2043
2048
  marginTop: "4px",
2044
2049
  fontStyle: "italic"
2045
2050
  },
2046
- children: y
2051
+ children: u
2047
2052
  }
2048
2053
  )
2049
2054
  ] });
@@ -2052,7 +2057,7 @@ function ar({ item: e }) {
2052
2057
  return e.error != null ? /* @__PURE__ */ o(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2053
2058
  }
2054
2059
  function sr(e, r) {
2055
- return S(r.searchingInMemoriesOfType, {
2060
+ return T(r.searchingInMemoriesOfType, {
2056
2061
  name: e.memoryTypeName
2057
2062
  });
2058
2063
  }
@@ -2113,14 +2118,14 @@ function lr({
2113
2118
  shimmerColor: "#000"
2114
2119
  }
2115
2120
  ) : c }),
2116
- n && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? S(
2121
+ n && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? T(
2117
2122
  r.memorySearchTypeResultSummaryOne,
2118
2123
  {
2119
2124
  score: e.result.highestChunkScore.toFixed(
2120
2125
  2
2121
2126
  )
2122
2127
  }
2123
- ) : S(
2128
+ ) : T(
2124
2129
  r.memorySearchTypeResultSummary,
2125
2130
  {
2126
2131
  count: e.result.numberOfChunks,
@@ -2172,7 +2177,7 @@ const cr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2172
2177
  marginTop: "4px",
2173
2178
  fontStyle: "italic"
2174
2179
  },
2175
- children: S(n.tookSeconds, { n: t })
2180
+ children: T(n.tookSeconds, { n: t })
2176
2181
  }
2177
2182
  )
2178
2183
  ] });
@@ -2201,14 +2206,14 @@ function gr({
2201
2206
  t: r,
2202
2207
  isActiveRow: t
2203
2208
  }) {
2204
- const n = ur(e), l = yr(e), c = e.reasoning, s = c != null && c.length > 0, d = R(null), [m, i] = v(!1), a = n && t, y = l === 2 && t && !N(e);
2205
- A(() => {
2206
- const g = d.current;
2207
- g != null && l === 1 && s && (g.scrollTop = g.scrollHeight);
2209
+ const n = ur(e), l = yr(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [m, i] = C(!1), a = n && t, u = l === 2 && t && !N(e);
2210
+ R(() => {
2211
+ const h = d.current;
2212
+ h != null && l === 1 && s && (h.scrollTop = h.scrollHeight);
2208
2213
  }, [c, l, s]);
2209
- const u = S(r.searchingInMemoriesOfType, {
2214
+ const y = T(r.searchingInMemoriesOfType, {
2210
2215
  name: e.memoryTypeName
2211
- }), h = !n && l === 3;
2216
+ }), g = !n && l === 3;
2212
2217
  return /* @__PURE__ */ p(
2213
2218
  b.div,
2214
2219
  {
@@ -2221,7 +2226,7 @@ function gr({
2221
2226
  borderBottom: "1px solid #eee",
2222
2227
  display: "flex",
2223
2228
  flexDirection: "row",
2224
- alignItems: h ? "flex-start" : "center",
2229
+ alignItems: g ? "flex-start" : "center",
2225
2230
  gap: "10px",
2226
2231
  minWidth: 0
2227
2232
  },
@@ -2235,7 +2240,7 @@ function gr({
2235
2240
  justifyContent: "center",
2236
2241
  flexShrink: 0,
2237
2242
  width: 32,
2238
- ...h ? { paddingTop: 2 } : {}
2243
+ ...g ? { paddingTop: 2 } : {}
2239
2244
  },
2240
2245
  children: /* @__PURE__ */ o(pr, { phase: n ? 1 : l })
2241
2246
  }
@@ -2254,7 +2259,7 @@ function gr({
2254
2259
  /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ o(
2255
2260
  I,
2256
2261
  {
2257
- text: u,
2262
+ text: y,
2258
2263
  duration: 2.5,
2259
2264
  repeat: !0,
2260
2265
  color: "#999",
@@ -2307,7 +2312,7 @@ function gr({
2307
2312
  }
2308
2313
  )
2309
2314
  ] }),
2310
- l === 2 && y && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
2315
+ l === 2 && u && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
2311
2316
  I,
2312
2317
  {
2313
2318
  text: r.memorySearchGeneratingQueriesPending,
@@ -2340,7 +2345,7 @@ function gr({
2340
2345
  flexDirection: "column",
2341
2346
  gap: 6
2342
2347
  },
2343
- children: e.queries.map((g, k) => /* @__PURE__ */ o(
2348
+ children: e.queries.map((h, k) => /* @__PURE__ */ o(
2344
2349
  "div",
2345
2350
  {
2346
2351
  style: {
@@ -2349,7 +2354,7 @@ function gr({
2349
2354
  lineHeight: 1.5,
2350
2355
  wordBreak: "break-word"
2351
2356
  },
2352
- children: g.query
2357
+ children: h.query
2353
2358
  },
2354
2359
  k
2355
2360
  ))
@@ -2361,7 +2366,7 @@ function gr({
2361
2366
  "button",
2362
2367
  {
2363
2368
  type: "button",
2364
- onClick: () => i((g) => !g),
2369
+ onClick: () => i((h) => !h),
2365
2370
  style: {
2366
2371
  alignSelf: "flex-start",
2367
2372
  border: "none",
@@ -2435,7 +2440,7 @@ const hr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2435
2440
  marginTop: "4px",
2436
2441
  fontStyle: "italic"
2437
2442
  },
2438
- children: S(n.tookSeconds, { n: t })
2443
+ children: T(n.tookSeconds, { n: t })
2439
2444
  }
2440
2445
  )
2441
2446
  ] });
@@ -2457,7 +2462,7 @@ function xr(e, r) {
2457
2462
  shimmerColor: "#000"
2458
2463
  }
2459
2464
  ) });
2460
- const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : S(r.chunksFound, { n: t.numberOfChunks }), l = S(r.scoreLabel, {
2465
+ const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : T(r.chunksFound, { n: t.numberOfChunks }), l = T(r.scoreLabel, {
2461
2466
  n: t.highestChunkScore.toFixed(2)
2462
2467
  });
2463
2468
  return /* @__PURE__ */ p("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
@@ -2472,7 +2477,7 @@ function Sr({
2472
2477
  onExploreQueryResultClick: t,
2473
2478
  t: n
2474
2479
  }) {
2475
- const [l, c] = v(null);
2480
+ const [l, c] = C(null);
2476
2481
  if (e.length === 0)
2477
2482
  return /* @__PURE__ */ o(
2478
2483
  "div",
@@ -2500,22 +2505,22 @@ function Sr({
2500
2505
  children: e.map((d, m) => {
2501
2506
  const i = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = K(
2502
2507
  d.chunks
2503
- ), y = [
2508
+ ), u = [
2504
2509
  V(d),
2505
- S(n.scoreLabel, {
2510
+ T(n.scoreLabel, {
2506
2511
  n: d.matchingChunkScore.toFixed(2)
2507
2512
  }),
2508
2513
  a.length > 0 ? q(a, n) : n.pagesNotAvailable
2509
2514
  ].filter(
2510
2515
  (k) => k != null && k !== ""
2511
- ), u = {
2516
+ ), y = {
2512
2517
  memoryId: d.memoryId,
2513
2518
  memoryTitle: d.memoryTitle,
2514
2519
  pageNumbers: a,
2515
2520
  memoryTypeId: r.memoryTypeId,
2516
2521
  memoryTypeName: r.memoryTypeName,
2517
2522
  query: r.query
2518
- }, h = `${r.query}::${d.memoryId}::${m}`, g = l === h;
2523
+ }, g = `${r.query}::${d.memoryId}::${m}`, h = l === g;
2519
2524
  return /* @__PURE__ */ p(
2520
2525
  "div",
2521
2526
  {
@@ -2576,7 +2581,7 @@ function Sr({
2576
2581
  color: "#94a3b8",
2577
2582
  lineHeight: 1.35
2578
2583
  },
2579
- children: y.join(" · ")
2584
+ children: u.join(" · ")
2580
2585
  }
2581
2586
  )
2582
2587
  ]
@@ -2586,13 +2591,13 @@ function Sr({
2586
2591
  "button",
2587
2592
  {
2588
2593
  type: "button",
2589
- "aria-busy": g,
2590
- disabled: g,
2594
+ "aria-busy": h,
2595
+ disabled: h,
2591
2596
  onClick: async () => {
2592
- c(h);
2597
+ c(g);
2593
2598
  try {
2594
2599
  await t(
2595
- u
2600
+ y
2596
2601
  );
2597
2602
  } finally {
2598
2603
  c(null);
@@ -2608,14 +2613,14 @@ function Sr({
2608
2613
  background: "#eff6ff",
2609
2614
  border: "1px solid #bfdbfe",
2610
2615
  borderRadius: 6,
2611
- cursor: g ? "wait" : "pointer",
2616
+ cursor: h ? "wait" : "pointer",
2612
2617
  fontFamily: "inherit",
2613
2618
  display: "inline-flex",
2614
2619
  alignItems: "center",
2615
2620
  gap: 8
2616
2621
  },
2617
2622
  children: [
2618
- g && /* @__PURE__ */ o(
2623
+ h && /* @__PURE__ */ o(
2619
2624
  "span",
2620
2625
  {
2621
2626
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -2706,14 +2711,14 @@ function kr({
2706
2711
  fontSize: 12,
2707
2712
  color: "#888"
2708
2713
  },
2709
- children: S(r.memorySearchExploreQueryTypeLabel, {
2714
+ children: T(r.memorySearchExploreQueryTypeLabel, {
2710
2715
  name: e.memoryTypeName
2711
2716
  })
2712
2717
  }
2713
2718
  ),
2714
2719
  e.items.map(({ item: i, flatIndex: a }) => {
2715
- var x;
2716
- const y = i.result != null, u = i.error != null, h = a === t && n && !y && !u, g = l[a] === !0, k = ((x = i.result) == null ? void 0 : x.items) ?? [];
2720
+ var f;
2721
+ const u = i.result != null, y = i.error != null, g = a === t && n && !u && !y, h = l[a] === !0, k = ((f = i.result) == null ? void 0 : f.items) ?? [];
2717
2722
  return /* @__PURE__ */ p(
2718
2723
  "div",
2719
2724
  {
@@ -2747,7 +2752,7 @@ function kr({
2747
2752
  flex: "1 1 12rem",
2748
2753
  minWidth: 0
2749
2754
  },
2750
- children: h ? /* @__PURE__ */ o(
2755
+ children: g ? /* @__PURE__ */ o(
2751
2756
  I,
2752
2757
  {
2753
2758
  text: i.query,
@@ -2771,7 +2776,7 @@ function kr({
2771
2776
  },
2772
2777
  children: [
2773
2778
  xr(i, r),
2774
- y && /* @__PURE__ */ o(
2779
+ u && /* @__PURE__ */ o(
2775
2780
  "button",
2776
2781
  {
2777
2782
  type: "button",
@@ -2786,7 +2791,7 @@ function kr({
2786
2791
  textDecoration: "underline",
2787
2792
  fontFamily: "inherit"
2788
2793
  },
2789
- children: g ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2794
+ children: h ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2790
2795
  }
2791
2796
  )
2792
2797
  ]
@@ -2795,7 +2800,7 @@ function kr({
2795
2800
  ]
2796
2801
  }
2797
2802
  ),
2798
- y && g && /* @__PURE__ */ o(
2803
+ u && h && /* @__PURE__ */ o(
2799
2804
  Sr,
2800
2805
  {
2801
2806
  items: k,
@@ -2823,17 +2828,17 @@ const br = ({
2823
2828
  onExploreQueryResultClick: n,
2824
2829
  t: l
2825
2830
  }) => {
2826
- const [c, s] = v(
2831
+ const [c, s] = C(
2827
2832
  {}
2828
2833
  ), d = W((a) => {
2829
- s((y) => ({
2830
- ...y,
2831
- [a]: !y[a]
2834
+ s((u) => ({
2835
+ ...u,
2836
+ [a]: !u[a]
2832
2837
  }));
2833
2838
  }, []), m = P(() => {
2834
2839
  let a = -1;
2835
- return e.queries.forEach((y, u) => {
2836
- y.result == null && y.error == null && (a = u);
2840
+ return e.queries.forEach((u, y) => {
2841
+ u.result == null && u.error == null && (a = y);
2837
2842
  }), a;
2838
2843
  }, [e.queries]), i = P(
2839
2844
  () => Tr(e.queries),
@@ -2871,12 +2876,12 @@ const br = ({
2871
2876
  marginTop: "4px",
2872
2877
  fontStyle: "italic"
2873
2878
  },
2874
- children: S(l.tookSeconds, { n: t })
2879
+ children: T(l.tookSeconds, { n: t })
2875
2880
  }
2876
2881
  )
2877
2882
  ] });
2878
2883
  }, vr = ({ data: e, onSearchResultClick: r, t }) => {
2879
- const n = e.response.items, l = !!r, [c, s] = v(null);
2884
+ const n = e.response.items, l = !!r, [c, s] = C(null);
2880
2885
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
2881
2886
  /* @__PURE__ */ o(
2882
2887
  b.div,
@@ -2904,21 +2909,21 @@ const br = ({
2904
2909
  children: n.map((d, m) => {
2905
2910
  const i = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = K(
2906
2911
  d.chunks
2907
- ), y = [
2912
+ ), u = [
2908
2913
  V(d),
2909
- S(t.scoreLabel, {
2914
+ T(t.scoreLabel, {
2910
2915
  n: d.matchingChunkScore.toFixed(2)
2911
2916
  }),
2912
2917
  a.length > 0 ? q(a, t) : t.pagesNotAvailable
2913
2918
  ].filter(
2914
2919
  (k) => k != null && k !== ""
2915
- ), u = {
2920
+ ), y = {
2916
2921
  memoryId: d.memoryId,
2917
2922
  memoryTitle: d.memoryTitle,
2918
2923
  memoryTypeId: d.memoryTypeId,
2919
2924
  memoryTypeName: d.memoryTypeName,
2920
2925
  pageNumbers: a
2921
- }, h = `${d.memoryId}-${m}`, g = c === h;
2926
+ }, g = `${d.memoryId}-${m}`, h = c === g;
2922
2927
  return /* @__PURE__ */ p(
2923
2928
  b.div,
2924
2929
  {
@@ -2980,7 +2985,7 @@ const br = ({
2980
2985
  color: "#94a3b8",
2981
2986
  lineHeight: 1.35
2982
2987
  },
2983
- children: y.join(" · ")
2988
+ children: u.join(" · ")
2984
2989
  }
2985
2990
  )
2986
2991
  ]
@@ -2990,12 +2995,12 @@ const br = ({
2990
2995
  "button",
2991
2996
  {
2992
2997
  type: "button",
2993
- "aria-busy": g,
2994
- disabled: g,
2998
+ "aria-busy": h,
2999
+ disabled: h,
2995
3000
  onClick: async () => {
2996
- s(h);
3001
+ s(g);
2997
3002
  try {
2998
- await r(u);
3003
+ await r(y);
2999
3004
  } finally {
3000
3005
  s(null);
3001
3006
  }
@@ -3010,14 +3015,14 @@ const br = ({
3010
3015
  background: "#eff6ff",
3011
3016
  border: "1px solid #bfdbfe",
3012
3017
  borderRadius: 6,
3013
- cursor: g ? "wait" : "pointer",
3018
+ cursor: h ? "wait" : "pointer",
3014
3019
  fontFamily: "inherit",
3015
3020
  display: "inline-flex",
3016
3021
  alignItems: "center",
3017
3022
  gap: 8
3018
3023
  },
3019
3024
  children: [
3020
- g && /* @__PURE__ */ o(
3025
+ h && /* @__PURE__ */ o(
3021
3026
  "span",
3022
3027
  {
3023
3028
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -3067,8 +3072,8 @@ const br = ({
3067
3072
  onSearchResultClick: l,
3068
3073
  onExploreQueryResultClick: c
3069
3074
  }) => {
3070
- const s = R(null);
3071
- A(() => {
3075
+ const s = F(null);
3076
+ R(() => {
3072
3077
  s.current && (s.current.scrollTop = s.current.scrollHeight);
3073
3078
  }, [e.length]);
3074
3079
  const d = (i) => {
@@ -3208,15 +3213,15 @@ const br = ({
3208
3213
  }
3209
3214
  ) });
3210
3215
  const m = e.filter((i, a) => {
3211
- const y = i.item.data;
3212
- return y.taskType === "MemoryChat" && y.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
3213
- (f) => f.item.data.taskType === "MemoryChat" && f.item.data.eventType === "ExploreMemories"
3214
- ) : y.taskType === "MemorySearch" && y.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
3215
- (f) => f.item.data.taskType === "MemorySearch" && f.item.data.eventType === "GeneratingQueries"
3216
- ) : y.taskType === "MemorySearch" && y.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
3217
- (f) => f.item.data.taskType === "MemorySearch" && f.item.data.eventType === "ExploreQueries"
3218
- ) : y.taskType === "MemoryChat" && y.eventType === "ChunkResults" ? !e.slice(a + 1).some(
3219
- (f) => f.item.data.taskType === "MemoryChat" && f.item.data.eventType === "ChunkResults"
3216
+ const u = i.item.data;
3217
+ return u.taskType === "MemoryChat" && u.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
3218
+ (x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ExploreMemories"
3219
+ ) : u.taskType === "MemorySearch" && u.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
3220
+ (x) => x.item.data.taskType === "MemorySearch" && x.item.data.eventType === "GeneratingQueries"
3221
+ ) : u.taskType === "MemorySearch" && u.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
3222
+ (x) => x.item.data.taskType === "MemorySearch" && x.item.data.eventType === "ExploreQueries"
3223
+ ) : u.taskType === "MemoryChat" && u.eventType === "ChunkResults" ? !e.slice(a + 1).some(
3224
+ (x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ChunkResults"
3220
3225
  ) : !0;
3221
3226
  });
3222
3227
  return /* @__PURE__ */ o("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ o(re, { children: m.map((i, a) => /* @__PURE__ */ o(
@@ -3266,6 +3271,7 @@ export {
3266
3271
  L as Checkmark,
3267
3272
  Dr as FencyProvider,
3268
3273
  vr as MemorySearchCompletedResults,
3274
+ Ee as StreamEventManager,
3269
3275
  U as XMark,
3270
3276
  Lr as useAgentTasks
3271
3277
  };