@fencyai/react 0.1.170 → 0.1.171

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,7 +1,7 @@
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 I, useRef as F, useEffect as R, useCallback as N, useContext as ye, useMemo as D } from "react";
4
- import { motion as w, useInView as ge, AnimatePresence as pe } from "motion/react";
3
+ import { createContext as ue, useState as w, useRef as F, useEffect as R, useCallback as N, useContext as ye, useMemo as z } from "react";
4
+ import { motion as I, useInView as ge, AnimatePresence as pe } from "motion/react";
5
5
  import he from "react-markdown";
6
6
  import { Prism as ne } from "react-syntax-highlighter";
7
7
  import fe from "remark-gfm";
@@ -15,41 +15,41 @@ async function xe(e, n) {
15
15
  n(r.value);
16
16
  }
17
17
  function Se(e) {
18
- let n, t, r, s = !1;
19
- return function(l) {
20
- n === void 0 ? (n = l, t = 0, r = -1) : n = ke(n, l);
18
+ let n, t, r, a = !1;
19
+ return function(s) {
20
+ n === void 0 ? (n = s, t = 0, r = -1) : n = ke(n, s);
21
21
  const d = n.length;
22
- let y = 0;
22
+ let u = 0;
23
23
  for (; t < d; ) {
24
- s && (n[t] === 10 && (y = ++t), s = !1);
25
- let u = -1;
26
- for (; t < d && u === -1; ++t)
24
+ a && (n[t] === 10 && (u = ++t), a = !1);
25
+ let y = -1;
26
+ for (; t < d && y === -1; ++t)
27
27
  switch (n[t]) {
28
28
  case 58:
29
- r === -1 && (r = t - y);
29
+ r === -1 && (r = t - u);
30
30
  break;
31
31
  case 13:
32
- s = !0;
32
+ a = !0;
33
33
  case 10:
34
- u = t;
34
+ y = t;
35
35
  break;
36
36
  }
37
- if (u === -1)
37
+ if (y === -1)
38
38
  break;
39
- e(n.subarray(y, u), r), y = t, r = -1;
39
+ e(n.subarray(u, y), r), u = t, r = -1;
40
40
  }
41
- y === d ? n = void 0 : y !== 0 && (n = n.subarray(y), t -= y);
41
+ u === d ? n = void 0 : u !== 0 && (n = n.subarray(u), t -= u);
42
42
  };
43
43
  }
44
44
  function Te(e, n, t) {
45
45
  let r = J();
46
- const s = new TextDecoder();
47
- return function(l, d) {
48
- if (l.length === 0)
46
+ const a = new TextDecoder();
47
+ return function(s, d) {
48
+ if (s.length === 0)
49
49
  t == null || t(r), r = J();
50
50
  else if (d > 0) {
51
- const y = s.decode(l.subarray(0, d)), u = d + (l[d + 1] === 32 ? 2 : 1), i = s.decode(l.subarray(u));
52
- switch (y) {
51
+ const u = a.decode(s.subarray(0, d)), y = d + (s[d + 1] === 32 ? 2 : 1), i = a.decode(s.subarray(y));
52
+ switch (u) {
53
53
  case "data":
54
54
  r.data = r.data ? r.data + `
55
55
  ` + i : i;
@@ -61,8 +61,8 @@ function Te(e, n, t) {
61
61
  e(r.id = i);
62
62
  break;
63
63
  case "retry":
64
- const a = parseInt(i, 10);
65
- isNaN(a) || n(r.retry = a);
64
+ const l = parseInt(i, 10);
65
+ isNaN(l) || n(r.retry = l);
66
66
  break;
67
67
  }
68
68
  }
@@ -84,43 +84,43 @@ var be = function(e, n) {
84
84
  var t = {};
85
85
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && n.indexOf(r) < 0 && (t[r] = e[r]);
86
86
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
87
- for (var s = 0, r = Object.getOwnPropertySymbols(e); s < r.length; s++)
88
- n.indexOf(r[s]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[s]) && (t[r[s]] = e[r[s]]);
87
+ for (var a = 0, r = Object.getOwnPropertySymbols(e); a < r.length; a++)
88
+ n.indexOf(r[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[a]) && (t[r[a]] = e[r[a]]);
89
89
  return t;
90
90
  };
91
91
  const U = "text/event-stream", ve = 1e3, Y = "last-event-id";
92
92
  function Ce(e, n) {
93
- var { signal: t, headers: r, onopen: s, onmessage: c, onclose: l, onerror: d, openWhenHidden: y, fetch: u } = n, i = be(n, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
- return new Promise((a, m) => {
93
+ var { signal: t, headers: r, onopen: a, onmessage: c, onclose: s, onerror: d, openWhenHidden: u, fetch: y } = n, i = be(n, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
+ return new Promise((l, m) => {
95
95
  const g = Object.assign({}, r);
96
96
  g.accept || (g.accept = U);
97
97
  let h;
98
98
  function f() {
99
99
  h.abort(), document.hidden || v();
100
100
  }
101
- y || document.addEventListener("visibilitychange", f);
101
+ u || document.addEventListener("visibilitychange", f);
102
102
  let S = ve, T = 0;
103
103
  function k() {
104
104
  document.removeEventListener("visibilitychange", f), window.clearTimeout(T), h.abort();
105
105
  }
106
106
  t == null || t.addEventListener("abort", () => {
107
- k(), a();
107
+ k(), l();
108
108
  });
109
- const x = u ?? window.fetch, C = s ?? Ie;
109
+ const x = y ?? window.fetch, C = a ?? we;
110
110
  async function v() {
111
111
  var P;
112
112
  h = new AbortController();
113
113
  try {
114
- const L = await x(e, Object.assign(Object.assign({}, i), { headers: g, signal: h.signal }));
115
- await C(L), await xe(L.body, Se(Te((A) => {
114
+ const D = await x(e, Object.assign(Object.assign({}, i), { headers: g, signal: h.signal }));
115
+ await C(D), await xe(D.body, Se(Te((A) => {
116
116
  A ? g[Y] = A : delete g[Y];
117
117
  }, (A) => {
118
118
  S = A;
119
- }, c))), l == null || l(), k(), a();
120
- } catch (L) {
119
+ }, c))), s == null || s(), k(), l();
120
+ } catch (D) {
121
121
  if (!h.signal.aborted)
122
122
  try {
123
- const A = (P = d == null ? void 0 : d(L)) !== null && P !== void 0 ? P : S;
123
+ const A = (P = d == null ? void 0 : d(D)) !== null && P !== void 0 ? P : S;
124
124
  window.clearTimeout(T), T = window.setTimeout(v, A);
125
125
  } catch (A) {
126
126
  k(), m(A);
@@ -130,12 +130,12 @@ function Ce(e, n) {
130
130
  v();
131
131
  });
132
132
  }
133
- function Ie(e) {
133
+ function we(e) {
134
134
  const n = e.headers.get("content-type");
135
135
  if (!(n != null && n.startsWith(U)))
136
136
  throw new Error(`Expected content-type to be ${U}, Actual: ${n}`);
137
137
  }
138
- function we(e) {
138
+ function Ie(e) {
139
139
  const n = atob(e), t = new Uint8Array(n.length);
140
140
  for (let r = 0; r < n.length; r++)
141
141
  t[r] = n.charCodeAt(r);
@@ -154,36 +154,36 @@ class Me {
154
154
  */
155
155
  updateStreams(n) {
156
156
  n.forEach((r) => {
157
- const s = r.stream.id;
158
- this.eventSources.has(s) || this.connectStream(r);
157
+ const a = r.stream.id;
158
+ this.eventSources.has(a) || this.connectStream(r);
159
159
  });
160
160
  const t = new Set(n.map((r) => r.stream.id));
161
- this.eventSources.forEach((r, s) => {
162
- t.has(s) || (r.abort(), this.eventSources.delete(s));
161
+ this.eventSources.forEach((r, a) => {
162
+ t.has(a) || (r.abort(), this.eventSources.delete(a));
163
163
  });
164
164
  }
165
165
  connectStream(n) {
166
166
  const t = n.stream.id, r = new AbortController();
167
167
  this.eventSources.set(t, r);
168
- const s = `${this.fency.baseUrl}/sse/streams/${t}`, c = {
168
+ const a = `${this.fency.baseUrl}/sse/streams/${t}`, c = {
169
169
  "X-Fency-Publishable-Key": this.fency.publishableKey,
170
170
  "X-Fency-Stream-Token": n.stream.token
171
171
  };
172
- Ce(s, {
172
+ Ce(a, {
173
173
  headers: c,
174
174
  signal: r.signal,
175
- onopen: async (l) => {
176
- if (!l.ok && l.status >= 400 && l.status < 500 && l.status !== 429)
177
- throw this.eventSources.delete(t), new Error(`Client error ${l.status}`);
175
+ onopen: async (s) => {
176
+ if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
177
+ throw this.eventSources.delete(t), new Error(`Client error ${s.status}`);
178
178
  },
179
- onmessage: (l) => {
180
- if (l.data) {
181
- const d = we(l.data);
179
+ onmessage: (s) => {
180
+ if (s.data) {
181
+ const d = Ie(s.data);
182
182
  this.broadcast(d, t);
183
183
  }
184
184
  },
185
- onerror: (l) => {
186
- throw console.error("EventSource error for stream", t, ":", l), this.eventSources.delete(t), this.broadcastError(t, Ee(l)), l;
185
+ onerror: (s) => {
186
+ throw console.error("EventSource error for stream", t, ":", s), this.eventSources.delete(t), this.broadcastError(t, Ee(s)), s;
187
187
  },
188
188
  onclose() {
189
189
  }
@@ -220,20 +220,20 @@ const Ae = 48e4, Re = 3e5, Z = (e) => {
220
220
  return e.filter((t) => n - t.createdAt < Ae);
221
221
  };
222
222
  function Fr({ fency: e, fetchCreateStreamClientToken: n, children: t }) {
223
- const [r, s] = I(
223
+ const [r, a] = w(
224
224
  null
225
- ), [c, l] = I(!0), [d, y] = I(null), [u, i] = I([]), a = F(null), m = F(null);
225
+ ), [c, s] = w(!0), [d, u] = w(null), [y, i] = w([]), l = F(null), m = F(null);
226
226
  R(() => {
227
227
  e.then((S) => {
228
- s(S), l(!1);
228
+ a(S), s(!1);
229
229
  }).catch((S) => {
230
- y(S), l(!1);
230
+ u(S), s(!1);
231
231
  });
232
232
  }, [e]), R(() => {
233
233
  r && !m.current && (m.current = new Me(r));
234
234
  }, [r]), R(() => {
235
- m.current && m.current.updateStreams(u);
236
- }, [u]), R(() => () => {
235
+ m.current && m.current.updateStreams(y);
236
+ }, [y]), R(() => () => {
237
237
  var S;
238
238
  (S = m.current) == null || S.cleanup();
239
239
  }, []), R(() => {
@@ -247,9 +247,9 @@ function Fr({ fency: e, fetchCreateStreamClientToken: n, children: t }) {
247
247
  }, []);
248
248
  const g = N(
249
249
  async (S = Re) => {
250
- if (a.current)
251
- return a.current;
252
- const T = Date.now(), k = u.length > 0 ? u[u.length - 1] : null;
250
+ if (l.current)
251
+ return l.current;
252
+ const T = Date.now(), k = y.length > 0 ? y[y.length - 1] : null;
253
253
  if (k && T - k.createdAt < S)
254
254
  return k.stream;
255
255
  const x = (async () => {
@@ -265,16 +265,16 @@ function Fr({ fency: e, fetchCreateStreamClientToken: n, children: t }) {
265
265
  stream: v.stream,
266
266
  createdAt: Date.now()
267
267
  };
268
- return i((L) => {
269
- const A = [...L, P];
268
+ return i((D) => {
269
+ const A = [...D, P];
270
270
  return Z(A);
271
- }), a.current = null, v.stream;
271
+ }), l.current = null, v.stream;
272
272
  } else
273
- throw a.current = null, new Error("Failed to create stream");
273
+ throw l.current = null, new Error("Failed to create stream");
274
274
  })();
275
- return a.current = x, x;
275
+ return l.current = x, x;
276
276
  },
277
- [r, u]
277
+ [r, y]
278
278
  );
279
279
  if (d)
280
280
  return /* @__PURE__ */ p("div", { children: [
@@ -283,11 +283,11 @@ function Fr({ fency: e, fetchCreateStreamClientToken: n, children: t }) {
283
283
  ] });
284
284
  if (!r)
285
285
  return null;
286
- const h = u.length > 0 ? u[u.length - 1] : null, f = {
286
+ const h = y.length > 0 ? y[y.length - 1] : null, f = {
287
287
  fency: r,
288
288
  loading: c,
289
289
  error: d,
290
- activeStreams: u,
290
+ activeStreams: y,
291
291
  latestStream: h,
292
292
  eventManager: m.current,
293
293
  getOrCreateStream: g
@@ -324,17 +324,17 @@ const Fe = (e) => {
324
324
  createdAt: e.createdAt,
325
325
  data: JSON.parse(e.data)
326
326
  }), Ne = (e) => {
327
- const n = oe(), [t, r] = I(null), s = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
327
+ const n = oe(), [t, r] = w(null), a = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
328
328
  return R(() => {
329
329
  if (!n.eventManager) return;
330
- const l = {
331
- onMessage: (y, u) => {
332
- var a, m, g;
333
- const i = Fe(y);
330
+ const s = {
331
+ onMessage: (u, y) => {
332
+ var l, m, g;
333
+ const i = Fe(u);
334
334
  if (i)
335
335
  switch (i.type) {
336
336
  case "STREAM_TIMEOUT":
337
- (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, i);
337
+ (l = e == null ? void 0 : e.onStreamTimeout) == null || l.call(e, i);
338
338
  break;
339
339
  case "STREAM_NOT_FOUND":
340
340
  (m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e, i);
@@ -344,35 +344,35 @@ const Fe = (e) => {
344
344
  break;
345
345
  }
346
346
  },
347
- onError: (y, u) => {
347
+ onError: (u, y) => {
348
348
  var i;
349
349
  (i = e == null ? void 0 : e.onStreamError) == null || i.call(e, {
350
- streamId: y,
350
+ streamId: u,
351
351
  error: {
352
352
  code: "UnknownError",
353
- message: u ?? "Unknown error in useStream"
353
+ message: y ?? "Unknown error in useStream"
354
354
  }
355
355
  });
356
356
  }
357
357
  };
358
358
  return n.eventManager.subscribe(
359
- s.current,
360
- l
359
+ a.current,
360
+ s
361
361
  );
362
362
  }, [n.eventManager, e]), {
363
363
  createStream: async () => {
364
364
  try {
365
- const l = await n.getOrCreateStream();
366
- return r(l), {
365
+ const s = await n.getOrCreateStream();
366
+ return r(s), {
367
367
  type: "success",
368
- stream: l
368
+ stream: s
369
369
  };
370
- } catch (l) {
370
+ } catch (s) {
371
371
  return {
372
372
  type: "error",
373
373
  error: {
374
374
  code: "UnknownError",
375
- message: l instanceof Error ? l.message : "Failed to create stream"
375
+ message: s instanceof Error ? s.message : "Failed to create stream"
376
376
  }
377
377
  };
378
378
  }
@@ -380,19 +380,19 @@ const Fe = (e) => {
380
380
  stream: t
381
381
  };
382
382
  }, Pr = (e) => {
383
- const n = oe(), [t, r] = I([]), s = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), l = N(
384
- (i, a) => {
383
+ const n = oe(), [t, r] = w([]), a = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), s = N(
384
+ (i, l) => {
385
385
  r((m) => {
386
386
  const g = [], h = m.map((f) => {
387
387
  var T;
388
388
  if (f.streamId !== i || !f.loading) return f;
389
389
  const S = (T = f.confirmedData) == null ? void 0 : T.taskId;
390
- return S && g.push(S), { ...f, loading: !1, error: a };
390
+ return S && g.push(S), { ...f, loading: !1, error: l };
391
391
  });
392
392
  for (const f of g) {
393
- s.current.delete(f);
393
+ a.current.delete(f);
394
394
  const S = c.current.get(f);
395
- S && (c.current.delete(f), S({ type: "error", error: a }));
395
+ S && (c.current.delete(f), S({ type: "error", error: l }));
396
396
  }
397
397
  return h;
398
398
  });
@@ -401,10 +401,10 @@ const Fe = (e) => {
401
401
  ), { createStream: d } = Ne({
402
402
  onAgentTaskProgressItemUpdated: (i) => {
403
403
  var g;
404
- if (!s.current.has(i.agentTaskId)) return;
405
- const a = i.data;
406
- 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") {
407
- const h = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
404
+ if (!a.current.has(i.agentTaskId)) return;
405
+ const l = i.data;
406
+ if (l.taskType === "StreamingChatCompletion" && l.eventType === "Completed" || l.taskType === "StructuredChatCompletion" && l.eventType === "Completed" || l.taskType === "MemoryChat" && l.eventType === "Completed" || l.taskType === "MemorySearch" && l.eventType === "Completed") {
407
+ const h = l.taskType === "MemorySearch" && l.eventType === "Completed" || l.taskType === "StructuredChatCompletion" && l.eventType === "Completed";
408
408
  r(
409
409
  h ? (S) => S.map((T) => {
410
410
  var C;
@@ -434,7 +434,7 @@ const Fe = (e) => {
434
434
  type: "success",
435
435
  streamId: i.streamId,
436
436
  agentTaskId: i.agentTaskId,
437
- response: a
437
+ response: l
438
438
  }));
439
439
  return;
440
440
  }
@@ -453,27 +453,27 @@ const Fe = (e) => {
453
453
  );
454
454
  },
455
455
  onStreamError: (i) => {
456
- var a;
457
- (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, i), l(i.streamId, i.error);
456
+ var l;
457
+ (l = e == null ? void 0 : e.onStreamError) == null || l.call(e, i), s(i.streamId, i.error);
458
458
  },
459
459
  onStreamNotFound: (i) => {
460
- var a;
461
- (a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, i), l(i.streamId, {
460
+ var l;
461
+ (l = e == null ? void 0 : e.onStreamNotFound) == null || l.call(e, i), s(i.streamId, {
462
462
  code: "StreamNotFound",
463
463
  message: "Stream not found"
464
464
  });
465
465
  },
466
466
  onStreamTimeout: (i) => {
467
- var a;
468
- (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, i), l(i.streamId, {
467
+ var l;
468
+ (l = e == null ? void 0 : e.onStreamTimeout) == null || l.call(e, i), s(i.streamId, {
469
469
  code: "StreamTimeout",
470
470
  message: "Stream timed out"
471
471
  });
472
472
  }
473
- }), y = N(
474
- async (i, a) => {
473
+ }), u = N(
474
+ async (i, l) => {
475
475
  var f;
476
- const m = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = (a == null ? void 0 : a.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
476
+ const m = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = (l == null ? void 0 : l.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
477
477
  if (g === void 0)
478
478
  throw new Error(
479
479
  "fetchCreateAgentTaskClientToken must be provided either in useAgentTasks props or in createAgentTask options"
@@ -489,9 +489,9 @@ const Fe = (e) => {
489
489
  params: i,
490
490
  progressItems: [],
491
491
  loading: !0,
492
- loadingText: a == null ? void 0 : a.loadingText
492
+ loadingText: l == null ? void 0 : l.loadingText
493
493
  };
494
- r((k) => [...k, T]), (f = a == null ? void 0 : a.onTaskRegistered) == null || f.call(a, T);
494
+ r((k) => [...k, T]), (f = l == null ? void 0 : l.onTaskRegistered) == null || f.call(l, T);
495
495
  try {
496
496
  const { clientToken: k } = await g(), x = await me({
497
497
  pk: n.fency.publishableKey,
@@ -536,7 +536,7 @@ const Fe = (e) => {
536
536
  }
537
537
  });
538
538
  if (x.type === "success" && x.agentTask)
539
- return s.current.add(
539
+ return a.current.add(
540
540
  x.agentTask.id
541
541
  ), r((C) => [
542
542
  ...C.filter((v) => v.taskKey !== m),
@@ -550,7 +550,7 @@ const Fe = (e) => {
550
550
  params: i,
551
551
  progressItems: [],
552
552
  loading: !0,
553
- loadingText: a == null ? void 0 : a.loadingText,
553
+ loadingText: l == null ? void 0 : l.loadingText,
554
554
  confirmedData: {
555
555
  taskId: x.agentTask.id,
556
556
  createdAt: x.agentTask.createdAt
@@ -575,7 +575,7 @@ const Fe = (e) => {
575
575
  error: x.error,
576
576
  progressItems: [],
577
577
  loading: !1,
578
- loadingText: a == null ? void 0 : a.loadingText,
578
+ loadingText: l == null ? void 0 : l.loadingText,
579
579
  confirmedData: null
580
580
  }
581
581
  ]), {
@@ -597,7 +597,7 @@ const Fe = (e) => {
597
597
  params: i,
598
598
  progressItems: [],
599
599
  loading: !1,
600
- loadingText: a == null ? void 0 : a.loadingText,
600
+ loadingText: l == null ? void 0 : l.loadingText,
601
601
  confirmedData: null
602
602
  }
603
603
  ]), {
@@ -620,7 +620,7 @@ const Fe = (e) => {
620
620
  error: x,
621
621
  progressItems: [],
622
622
  loading: !1,
623
- loadingText: a == null ? void 0 : a.loadingText,
623
+ loadingText: l == null ? void 0 : l.loadingText,
624
624
  confirmedData: null
625
625
  }
626
626
  ]), {
@@ -635,31 +635,31 @@ const Fe = (e) => {
635
635
  n,
636
636
  d,
637
637
  e.fetchCreateAgentTaskClientToken,
638
- l
638
+ s
639
639
  ]
640
- ), u = D(() => {
640
+ ), y = z(() => {
641
641
  if (t.length !== 0)
642
- return [...t].sort((i, a) => new Date(a.triggeredAt).getTime() - new Date(i.triggeredAt).getTime())[0];
642
+ return [...t].sort((i, l) => new Date(l.triggeredAt).getTime() - new Date(i.triggeredAt).getTime())[0];
643
643
  }, [t]);
644
644
  return R(() => () => {
645
- s.current.clear(), c.current.clear();
645
+ a.current.clear(), c.current.clear();
646
646
  }, []), {
647
647
  agentTasks: t,
648
- createAgentTask: y,
649
- latest: u
648
+ createAgentTask: u,
649
+ latest: y
650
650
  };
651
651
  };
652
652
  function Oe(e) {
653
653
  return e.progressItems.map((n, t) => {
654
- const r = e.progressItems[t + 1], s = r != null;
654
+ const r = e.progressItems[t + 1], a = r != null;
655
655
  let c;
656
656
  if (r != null && r.createdAt) {
657
- const l = new Date(n.createdAt).getTime(), d = new Date(r.createdAt).getTime();
658
- c = Math.round((d - l) / 1e3);
657
+ const s = new Date(n.createdAt).getTime(), d = new Date(r.createdAt).getTime();
658
+ c = Math.round((d - s) / 1e3);
659
659
  }
660
660
  return {
661
661
  item: n,
662
- completed: s,
662
+ completed: a,
663
663
  isLatest: t === e.progressItems.length - 1,
664
664
  durationSeconds: c
665
665
  };
@@ -819,7 +819,7 @@ const ie = {
819
819
  }, ee = ({
820
820
  text: e
821
821
  }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
822
- w.div,
822
+ I.div,
823
823
  {
824
824
  className: "fency-markdown-body-raw",
825
825
  initial: { opacity: 0, y: -10 },
@@ -831,20 +831,20 @@ const ie = {
831
831
  remarkPlugins: [fe],
832
832
  components: {
833
833
  code(n) {
834
- const { children: t, className: r, node: s, ref: c, ...l } = n, d = /language-(\w+)/.exec(r || "");
834
+ const { children: t, className: r, node: a, ref: c, ...s } = n, d = /language-(\w+)/.exec(r || "");
835
835
  return d ? (
836
836
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
837
837
  /* @__PURE__ */ o(
838
838
  ne,
839
839
  {
840
- ...l,
840
+ ...s,
841
841
  PreTag: "div",
842
842
  children: String(t).replace(/\n$/, ""),
843
843
  language: d[1],
844
844
  style: ie
845
845
  }
846
846
  )
847
- ) : /* @__PURE__ */ o("code", { ...l, className: r, children: String(t) });
847
+ ) : /* @__PURE__ */ o("code", { ...s, className: r, children: String(t) });
848
848
  }
849
849
  },
850
850
  children: e
@@ -858,7 +858,7 @@ const ie = {
858
858
  2
859
859
  );
860
860
  return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
861
- w.div,
861
+ I.div,
862
862
  {
863
863
  initial: { opacity: 0, y: -10 },
864
864
  animate: { opacity: 1, y: 0 },
@@ -995,7 +995,7 @@ function $e(e) {
995
995
  }
996
996
  function b(e, n) {
997
997
  return Object.entries(n).reduce(
998
- (t, [r, s]) => t.replace(`{${r}}`, String(s)),
998
+ (t, [r, a]) => t.replace(`{${r}}`, String(a)),
999
999
  e
1000
1000
  );
1001
1001
  }
@@ -1012,19 +1012,19 @@ function M({
1012
1012
  duration: n = 2,
1013
1013
  delay: t = 0,
1014
1014
  repeat: r = !0,
1015
- repeatDelay: s = 0.5,
1015
+ repeatDelay: a = 0.5,
1016
1016
  className: c,
1017
- startOnView: l = !1,
1017
+ startOnView: s = !1,
1018
1018
  once: d = !1,
1019
- inViewMargin: y,
1020
- spread: u = 2,
1019
+ inViewMargin: u,
1020
+ spread: y = 2,
1021
1021
  color: i = "#999",
1022
- shimmerColor: a = "#000",
1022
+ shimmerColor: l = "#000",
1023
1023
  direction: m = "fromBottom"
1024
1024
  }) {
1025
- const g = F(null), h = ge(g, { once: d, margin: y }), f = D(() => e.length * u, [e, u]), S = !l || h, T = m === "fromBottom" ? "100% center" : "-100% center", k = m === "fromBottom" ? "0% center" : "200% center";
1025
+ const g = F(null), h = ge(g, { once: d, margin: u }), f = z(() => e.length * y, [e, y]), S = !s || h, T = m === "fromBottom" ? "100% center" : "-100% center", k = m === "fromBottom" ? "0% center" : "200% center";
1026
1026
  return /* @__PURE__ */ o(
1027
- w.span,
1027
+ I.span,
1028
1028
  {
1029
1029
  ref: g,
1030
1030
  className: c,
@@ -1039,7 +1039,7 @@ function M({
1039
1039
  backgroundRepeat: "no-repeat, padding-box",
1040
1040
  "--spread": `${f}px`,
1041
1041
  "--base-color": i,
1042
- "--shimmer-color": a,
1042
+ "--shimmer-color": l,
1043
1043
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
1044
1044
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
1045
1045
  },
@@ -1056,7 +1056,7 @@ function M({
1056
1056
  repeat: r ? 1 / 0 : 0,
1057
1057
  duration: n,
1058
1058
  delay: t,
1059
- repeatDelay: s,
1059
+ repeatDelay: a,
1060
1060
  ease: "linear"
1061
1061
  },
1062
1062
  opacity: {
@@ -1069,19 +1069,19 @@ function M({
1069
1069
  );
1070
1070
  }
1071
1071
  const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1072
- const [s, c] = I(!1), d = (e.memories ?? []).map((S) => S.memoryTitle), y = d.length > 0, u = y && d.length > $, i = u && !s ? d.slice(0, $) : d, a = d.length - $, m = !u || s, g = `${r.searchingFor}'${e.queryDescription}'`, h = y ? `${r.searchingIn}${Q(
1072
+ const [a, c] = w(!1), d = (e.memories ?? []).map((S) => S.memoryTitle), u = d.length > 0, y = u && d.length > $, i = y && !a ? d.slice(0, $) : d, l = d.length - $, m = !y || a, g = `${r.searchingFor}'${e.queryDescription}'`, h = u ? `${r.searchingIn}${Q(
1073
1073
  i,
1074
1074
  m ? r.and : void 0
1075
- )}` : "", f = y ? `${g}${h}` : `${r.searchingPrefix}${e.queryDescription}`;
1075
+ )}` : "", f = u ? `${g}${h}` : `${r.searchingPrefix}${e.queryDescription}`;
1076
1076
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1077
1077
  /* @__PURE__ */ o(
1078
- w.div,
1078
+ I.div,
1079
1079
  {
1080
1080
  style: { color: "#666" },
1081
1081
  initial: { opacity: 0, y: -10 },
1082
1082
  animate: { opacity: 1, y: 0 },
1083
1083
  transition: { duration: 0.3, delay: 0 },
1084
- children: n && !t && !u ? /* @__PURE__ */ o(
1084
+ children: n && !t && !y ? /* @__PURE__ */ o(
1085
1085
  M,
1086
1086
  {
1087
1087
  text: f,
@@ -1091,7 +1091,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1091
1091
  shimmerColor: "#000"
1092
1092
  }
1093
1093
  ) : /* @__PURE__ */ p(E, { children: [
1094
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: y ? /* @__PURE__ */ p(E, { children: [
1094
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u ? /* @__PURE__ */ p(E, { children: [
1095
1095
  r.searchingFor,
1096
1096
  /* @__PURE__ */ p("span", { style: { fontWeight: 600 }, children: [
1097
1097
  "'",
@@ -1100,7 +1100,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1100
1100
  ] }),
1101
1101
  h
1102
1102
  ] }) : `${r.searchingPrefix}${e.queryDescription}` }),
1103
- u && !s && /* @__PURE__ */ p(E, { children: [
1103
+ y && !a && /* @__PURE__ */ p(E, { children: [
1104
1104
  " ",
1105
1105
  /* @__PURE__ */ o(
1106
1106
  "button",
@@ -1119,12 +1119,12 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1119
1119
  fontFamily: "inherit"
1120
1120
  },
1121
1121
  children: b(r.moreMemories, {
1122
- n: a
1122
+ n: l
1123
1123
  })
1124
1124
  }
1125
1125
  )
1126
1126
  ] }),
1127
- u && s && /* @__PURE__ */ p(E, { children: [
1127
+ y && a && /* @__PURE__ */ p(E, { children: [
1128
1128
  " ",
1129
1129
  /* @__PURE__ */ o(
1130
1130
  "button",
@@ -1163,13 +1163,13 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1163
1163
  )
1164
1164
  ] });
1165
1165
  }, H = 5, _e = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1166
- const [s, c] = I(!1), l = e.titles, d = l.length > 0, y = d && l.length > H, u = y && !s ? l.slice(0, H) : l, i = l.length - H, a = !y || s, m = d ? `${r.findingMemoriesIn}${Q(
1167
- u,
1168
- a ? r.and : void 0
1166
+ const [a, c] = w(!1), s = e.titles, d = s.length > 0, u = d && s.length > H, y = u && !a ? s.slice(0, H) : s, i = s.length - H, l = !u || a, m = d ? `${r.findingMemoriesIn}${Q(
1167
+ y,
1168
+ l ? r.and : void 0
1169
1169
  )}` : r.findingMemories;
1170
1170
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1171
1171
  /* @__PURE__ */ o(
1172
- w.div,
1172
+ I.div,
1173
1173
  {
1174
1174
  style: {
1175
1175
  color: "#666"
@@ -1177,7 +1177,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1177
1177
  initial: { opacity: 0, y: -10 },
1178
1178
  animate: { opacity: 1, y: 0 },
1179
1179
  transition: { duration: 0.3, delay: 0 },
1180
- children: n && !t && !y ? /* @__PURE__ */ o(
1180
+ children: n && !t && !u ? /* @__PURE__ */ o(
1181
1181
  M,
1182
1182
  {
1183
1183
  text: m,
@@ -1188,7 +1188,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1188
1188
  }
1189
1189
  ) : /* @__PURE__ */ p(E, { children: [
1190
1190
  /* @__PURE__ */ o("span", { style: { color: "#666" }, children: m }),
1191
- y && !s && /* @__PURE__ */ p(E, { children: [
1191
+ u && !a && /* @__PURE__ */ p(E, { children: [
1192
1192
  " ",
1193
1193
  /* @__PURE__ */ o(
1194
1194
  "button",
@@ -1212,7 +1212,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1212
1212
  }
1213
1213
  )
1214
1214
  ] }),
1215
- y && s && /* @__PURE__ */ p(E, { children: [
1215
+ u && a && /* @__PURE__ */ p(E, { children: [
1216
1216
  " ",
1217
1217
  /* @__PURE__ */ o(
1218
1218
  "button",
@@ -1251,12 +1251,12 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1251
1251
  )
1252
1252
  ] });
1253
1253
  }, _ = 5, Ge = ({ data: e, t: n }) => {
1254
- const [t, r] = I(!1), c = e.memories.map((g) => g.memoryTitle), l = c.length > 0, d = l && c.length > _, y = d && !t ? c.slice(0, _) : c, u = c.length - _, i = !d || t, a = c.length === 1 ? n.memoryFound : n.memoriesFoundPrefix, m = l ? `${a}${Q(
1255
- y,
1254
+ const [t, r] = w(!1), c = e.memories.map((g) => g.memoryTitle), s = c.length > 0, d = s && c.length > _, u = d && !t ? c.slice(0, _) : c, y = c.length - _, i = !d || t, l = c.length === 1 ? n.memoryFound : n.memoriesFoundPrefix, m = s ? `${l}${Q(
1255
+ u,
1256
1256
  i ? n.and : void 0
1257
1257
  )}` : n.memoriesFound;
1258
1258
  return /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
1259
- w.div,
1259
+ I.div,
1260
1260
  {
1261
1261
  style: { color: "#666" },
1262
1262
  initial: { opacity: 0, y: -10 },
@@ -1283,7 +1283,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1283
1283
  fontFamily: "inherit"
1284
1284
  },
1285
1285
  children: b(n.moreMemories, {
1286
- n: u
1286
+ n: y
1287
1287
  })
1288
1288
  }
1289
1289
  )
@@ -1317,7 +1317,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
1317
1317
  const r = t.addingSources;
1318
1318
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1319
1319
  /* @__PURE__ */ o(
1320
- w.div,
1320
+ I.div,
1321
1321
  {
1322
1322
  style: {
1323
1323
  display: "flex",
@@ -1367,10 +1367,10 @@ function Qe(e, n) {
1367
1367
  return b(n.pageMultiple, { list: r, n: t });
1368
1368
  }
1369
1369
  const je = ({ data: e, onSourceClick: n, t }) => {
1370
- const [r, s] = I(null);
1370
+ const [r, a] = w(null);
1371
1371
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1372
1372
  /* @__PURE__ */ o(
1373
- w.div,
1373
+ I.div,
1374
1374
  {
1375
1375
  style: {
1376
1376
  marginBottom: "10px",
@@ -1386,13 +1386,13 @@ const je = ({ data: e, onSourceClick: n, t }) => {
1386
1386
  children: t.sources
1387
1387
  }
1388
1388
  ),
1389
- /* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, l) => /* @__PURE__ */ o(
1389
+ /* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ o(
1390
1390
  qe,
1391
1391
  {
1392
1392
  source: c,
1393
- index: l,
1393
+ index: s,
1394
1394
  loadingMemoryId: r,
1395
- setLoadingMemoryId: s,
1395
+ setLoadingMemoryId: a,
1396
1396
  onSourceClick: n,
1397
1397
  t
1398
1398
  },
@@ -1404,21 +1404,21 @@ const je = ({ data: e, onSourceClick: n, t }) => {
1404
1404
  index: n,
1405
1405
  loadingMemoryId: t,
1406
1406
  setLoadingMemoryId: r,
1407
- onSourceClick: s,
1407
+ onSourceClick: a,
1408
1408
  t: c
1409
1409
  }) => {
1410
- const [l, d] = I(!1), y = !!s, u = t === e.memoryId, i = e.pageNumbers ?? [], a = Qe(i, c);
1410
+ const [s, d] = w(!1), u = !!a, y = t === e.memoryId, i = e.pageNumbers ?? [], l = Qe(i, c);
1411
1411
  return /* @__PURE__ */ p(
1412
- w.div,
1412
+ I.div,
1413
1413
  {
1414
- "aria-busy": u,
1414
+ "aria-busy": y,
1415
1415
  initial: { opacity: 0, scale: 0.9 },
1416
1416
  animate: { opacity: 1, scale: 1 },
1417
1417
  transition: { duration: 0.25, delay: n * 0.05 },
1418
- onClick: y && !u ? async () => {
1418
+ onClick: u && !y ? async () => {
1419
1419
  r(e.memoryId);
1420
1420
  try {
1421
- await s({
1421
+ await a({
1422
1422
  memoryId: e.memoryId,
1423
1423
  memoryTitle: e.memoryTitle,
1424
1424
  memoryTypeId: e.memoryTypeId,
@@ -1429,8 +1429,8 @@ const je = ({ data: e, onSourceClick: n, t }) => {
1429
1429
  r(null);
1430
1430
  }
1431
1431
  } : void 0,
1432
- onMouseEnter: y && !u ? () => d(!0) : void 0,
1433
- onMouseLeave: y && !u ? () => d(!1) : void 0,
1432
+ onMouseEnter: u && !y ? () => d(!0) : void 0,
1433
+ onMouseLeave: u && !y ? () => d(!1) : void 0,
1434
1434
  style: {
1435
1435
  display: "inline-flex",
1436
1436
  flexDirection: "column",
@@ -1438,11 +1438,11 @@ const je = ({ data: e, onSourceClick: n, t }) => {
1438
1438
  padding: "8px 12px",
1439
1439
  borderRadius: "6px",
1440
1440
  border: "1px solid #e0e0e0",
1441
- backgroundColor: l ? "#f5f5f5" : "transparent",
1442
- cursor: y && !u ? "pointer" : u ? "wait" : "default",
1441
+ backgroundColor: s ? "#f5f5f5" : "transparent",
1442
+ cursor: u && !y ? "pointer" : y ? "wait" : "default",
1443
1443
  transition: "background-color 0.15s ease",
1444
1444
  userSelect: "none",
1445
- pointerEvents: u ? "none" : void 0
1445
+ pointerEvents: y ? "none" : void 0
1446
1446
  },
1447
1447
  children: [
1448
1448
  /* @__PURE__ */ p(
@@ -1457,7 +1457,7 @@ const je = ({ data: e, onSourceClick: n, t }) => {
1457
1457
  gap: 8
1458
1458
  },
1459
1459
  children: [
1460
- u && /* @__PURE__ */ o(
1460
+ y && /* @__PURE__ */ o(
1461
1461
  "span",
1462
1462
  {
1463
1463
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -1468,11 +1468,11 @@ const je = ({ data: e, onSourceClick: n, t }) => {
1468
1468
  ]
1469
1469
  }
1470
1470
  ),
1471
- a && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: a })
1471
+ l && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: l })
1472
1472
  ]
1473
1473
  }
1474
1474
  );
1475
- }, z = ({
1475
+ }, L = ({
1476
1476
  color: e = "#78b13f",
1477
1477
  size: n = 24,
1478
1478
  borderWidth: t = 7
@@ -1496,9 +1496,9 @@ const je = ({ data: e, onSourceClick: n, t }) => {
1496
1496
  size: n = 32,
1497
1497
  lineWidth: t = 2
1498
1498
  }) => {
1499
- const r = n + 1, s = (n - t) / 2, c = (n - r) / 2, l = {
1499
+ const r = n + 1, a = (n - t) / 2, c = (n - r) / 2, s = {
1500
1500
  position: "absolute",
1501
- left: s,
1501
+ left: a,
1502
1502
  top: c,
1503
1503
  width: t,
1504
1504
  height: r,
@@ -1518,7 +1518,7 @@ const je = ({ data: e, onSourceClick: n, t }) => {
1518
1518
  "span",
1519
1519
  {
1520
1520
  style: {
1521
- ...l,
1521
+ ...s,
1522
1522
  transform: "rotate(45deg)"
1523
1523
  }
1524
1524
  }
@@ -1527,7 +1527,7 @@ const je = ({ data: e, onSourceClick: n, t }) => {
1527
1527
  "span",
1528
1528
  {
1529
1529
  style: {
1530
- ...l,
1530
+ ...s,
1531
1531
  transform: "rotate(-45deg)"
1532
1532
  }
1533
1533
  }
@@ -1540,7 +1540,7 @@ function Ke({
1540
1540
  memory: e,
1541
1541
  completed: n
1542
1542
  }) {
1543
- return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : n ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1543
+ return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : n ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1544
1544
  }
1545
1545
  const re = 80;
1546
1546
  function Ve({
@@ -1548,14 +1548,14 @@ function Ve({
1548
1548
  completed: n,
1549
1549
  t
1550
1550
  }) {
1551
- const [r, s] = I(!1), c = e.result ?? e.error, l = c != null && c.length > re, d = c != null ? r || !l ? c : `${c.slice(0, re)}...` : void 0, y = l, u = e.error != null;
1551
+ const [r, a] = w(!1), c = e.result ?? e.error, s = c != null && c.length > re, d = c != null ? r || !s ? c : `${c.slice(0, re)}...` : void 0, u = s, y = e.error != null;
1552
1552
  return /* @__PURE__ */ p(
1553
- w.div,
1553
+ I.div,
1554
1554
  {
1555
1555
  initial: { opacity: 0 },
1556
1556
  animate: { opacity: 1 },
1557
1557
  transition: { duration: 0.25 },
1558
- onClick: y ? () => s((i) => !i) : void 0,
1558
+ onClick: u ? () => a((i) => !i) : void 0,
1559
1559
  style: {
1560
1560
  paddingTop: "12px",
1561
1561
  paddingBottom: "12px",
@@ -1565,7 +1565,7 @@ function Ve({
1565
1565
  alignItems: "center",
1566
1566
  gap: "10px",
1567
1567
  minWidth: 0,
1568
- cursor: y ? "pointer" : "default"
1568
+ cursor: u ? "pointer" : "default"
1569
1569
  },
1570
1570
  children: [
1571
1571
  /* @__PURE__ */ o(
@@ -1603,14 +1603,14 @@ function Ve({
1603
1603
  {
1604
1604
  style: {
1605
1605
  fontSize: 12,
1606
- color: u ? "#c62828" : "#666",
1606
+ color: y ? "#c62828" : "#666",
1607
1607
  lineHeight: 1.4,
1608
1608
  whiteSpace: r ? "pre-wrap" : void 0
1609
1609
  },
1610
1610
  children: d
1611
1611
  }
1612
1612
  ),
1613
- y && /* @__PURE__ */ o(
1613
+ u && /* @__PURE__ */ o(
1614
1614
  "span",
1615
1615
  {
1616
1616
  style: {
@@ -1650,15 +1650,15 @@ function q(e) {
1650
1650
  var t, r;
1651
1651
  if (e.length === 0) return "";
1652
1652
  let n = ((t = e[0]) == null ? void 0 : t.content) ?? "";
1653
- for (let s = 1; s < e.length; s++) {
1654
- const c = ((r = e[s]) == null ? void 0 : r.content) ?? "";
1653
+ for (let a = 1; a < e.length; a++) {
1654
+ const c = ((r = e[a]) == null ? void 0 : r.content) ?? "";
1655
1655
  if (c === "") continue;
1656
1656
  if (n === "") {
1657
1657
  n = c;
1658
1658
  continue;
1659
1659
  }
1660
- const l = Je(n, c);
1661
- l === 0 ? n += Ye + c : n += c.slice(l);
1660
+ const s = Je(n, c);
1661
+ s === 0 ? n += Ye + c : n += c.slice(s);
1662
1662
  }
1663
1663
  return n;
1664
1664
  }
@@ -1695,27 +1695,27 @@ function ae(e) {
1695
1695
  }
1696
1696
  function Ze(e, n) {
1697
1697
  let t = 0, r = 0;
1698
- for (const l of e)
1699
- t += ae(l), l.matchingChunkScore > r && (r = l.matchingChunkScore);
1700
- const s = t === 1 ? n.chunkFound : b(n.chunksFound, { n: t }), c = b(n.scoreLabel, {
1698
+ for (const s of e)
1699
+ t += ae(s), s.matchingChunkScore > r && (r = s.matchingChunkScore);
1700
+ const a = t === 1 ? n.chunkFound : b(n.chunksFound, { n: t }), c = b(n.scoreLabel, {
1701
1701
  n: r.toFixed(2)
1702
1702
  });
1703
- return `${s} - ${c}`;
1703
+ return `${a} - ${c}`;
1704
1704
  }
1705
1705
  function er(e) {
1706
1706
  const n = [], t = /* @__PURE__ */ new Map();
1707
- return e.forEach((r, s) => {
1707
+ return e.forEach((r, a) => {
1708
1708
  let c = t.get(r.memoryId);
1709
1709
  if (c == null) {
1710
1710
  n.push(r.memoryId);
1711
- const l = r.memoryTitle !== "" ? r.memoryTitle : r.memoryId;
1711
+ const s = r.memoryTitle !== "" ? r.memoryTitle : r.memoryId;
1712
1712
  c = {
1713
1713
  memoryId: r.memoryId,
1714
- memoryTitle: l,
1714
+ memoryTitle: s,
1715
1715
  items: []
1716
1716
  }, t.set(r.memoryId, c);
1717
1717
  }
1718
- c.items.push({ item: r, flatIndex: s });
1718
+ c.items.push({ item: r, flatIndex: a });
1719
1719
  }), n.map((r) => t.get(r));
1720
1720
  }
1721
1721
  function rr({
@@ -1723,7 +1723,7 @@ function rr({
1723
1723
  onSearchResultClick: n,
1724
1724
  t
1725
1725
  }) {
1726
- const [r, s] = I(null), c = !!n;
1726
+ const [r, a] = w(null), c = !!n;
1727
1727
  return /* @__PURE__ */ o(
1728
1728
  "div",
1729
1729
  {
@@ -1735,24 +1735,24 @@ function rr({
1735
1735
  paddingTop: 8,
1736
1736
  borderTop: "1px solid #f0f0f0"
1737
1737
  },
1738
- children: e.map((l, d) => {
1739
- const y = V(
1740
- l.chunks
1741
- ), u = [
1742
- X(l),
1738
+ children: e.map((s, d) => {
1739
+ const u = V(
1740
+ s.chunks
1741
+ ), y = [
1742
+ X(s),
1743
1743
  b(t.scoreLabel, {
1744
- n: l.matchingChunkScore.toFixed(2)
1744
+ n: s.matchingChunkScore.toFixed(2)
1745
1745
  }),
1746
- y.length > 0 ? K(y, t) : t.pagesNotAvailable
1746
+ u.length > 0 ? K(u, t) : t.pagesNotAvailable
1747
1747
  ].filter(
1748
1748
  (g) => g != null && g !== ""
1749
1749
  ), i = {
1750
- memoryId: l.memoryId,
1751
- memoryTitle: l.memoryTitle,
1752
- memoryTypeId: l.memoryTypeId,
1753
- memoryTypeName: l.memoryTypeName,
1754
- pageNumbers: y
1755
- }, a = `${l.memoryId}-${d}`, m = r === a;
1750
+ memoryId: s.memoryId,
1751
+ memoryTitle: s.memoryTitle,
1752
+ memoryTypeId: s.memoryTypeId,
1753
+ memoryTypeName: s.memoryTypeName,
1754
+ pageNumbers: u
1755
+ }, l = `${s.memoryId}-${d}`, m = r === l;
1756
1756
  return /* @__PURE__ */ p(
1757
1757
  "div",
1758
1758
  {
@@ -1788,7 +1788,7 @@ function rr({
1788
1788
  whiteSpace: "pre-wrap",
1789
1789
  wordBreak: "break-word"
1790
1790
  },
1791
- children: q(l.chunks)
1791
+ children: q(s.chunks)
1792
1792
  }
1793
1793
  ),
1794
1794
  /* @__PURE__ */ o(
@@ -1800,7 +1800,7 @@ function rr({
1800
1800
  color: "#94a3b8",
1801
1801
  lineHeight: 1.35
1802
1802
  },
1803
- children: u.join(" · ")
1803
+ children: y.join(" · ")
1804
1804
  }
1805
1805
  )
1806
1806
  ]
@@ -1813,13 +1813,13 @@ function rr({
1813
1813
  "aria-busy": m,
1814
1814
  disabled: m,
1815
1815
  onClick: async () => {
1816
- s(a);
1816
+ a(l);
1817
1817
  try {
1818
1818
  await n(
1819
1819
  i
1820
1820
  );
1821
1821
  } finally {
1822
- s(null);
1822
+ a(null);
1823
1823
  }
1824
1824
  },
1825
1825
  style: {
@@ -1852,7 +1852,7 @@ function rr({
1852
1852
  )
1853
1853
  ]
1854
1854
  },
1855
- a
1855
+ l
1856
1856
  );
1857
1857
  })
1858
1858
  }
@@ -1863,11 +1863,11 @@ function nr({
1863
1863
  t: n,
1864
1864
  expanded: t,
1865
1865
  onToggle: r,
1866
- onSearchResultClick: s
1866
+ onSearchResultClick: a
1867
1867
  }) {
1868
- const c = e.items.map((d) => d.item), l = c.some((d) => d.chunks.length > 0);
1868
+ const c = e.items.map((d) => d.item), s = c.some((d) => d.chunks.length > 0);
1869
1869
  return /* @__PURE__ */ p(
1870
- w.div,
1870
+ I.div,
1871
1871
  {
1872
1872
  initial: { opacity: 0 },
1873
1873
  animate: { opacity: 1 },
@@ -1894,7 +1894,7 @@ function nr({
1894
1894
  width: 32,
1895
1895
  paddingTop: 2
1896
1896
  },
1897
- children: /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 })
1897
+ children: /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 })
1898
1898
  }
1899
1899
  ),
1900
1900
  /* @__PURE__ */ p(
@@ -1943,7 +1943,7 @@ function nr({
1943
1943
  children: Ze(c, n)
1944
1944
  }
1945
1945
  ),
1946
- l && /* @__PURE__ */ o(
1946
+ s && /* @__PURE__ */ o(
1947
1947
  "button",
1948
1948
  {
1949
1949
  type: "button",
@@ -1964,11 +1964,11 @@ function nr({
1964
1964
  ]
1965
1965
  }
1966
1966
  ),
1967
- t && l && /* @__PURE__ */ o(
1967
+ t && s && /* @__PURE__ */ o(
1968
1968
  rr,
1969
1969
  {
1970
1970
  items: c,
1971
- onSearchResultClick: s,
1971
+ onSearchResultClick: a,
1972
1972
  t: n
1973
1973
  }
1974
1974
  )
@@ -1987,17 +1987,17 @@ const or = ({
1987
1987
  onSearchResultClick: n,
1988
1988
  t
1989
1989
  }) => {
1990
- const r = e.items, s = r.reduce(
1990
+ const r = e.items, a = r.reduce(
1991
1991
  (m, g) => m + ae(g),
1992
1992
  0
1993
- ), c = new Set(r.map((m) => m.memoryId)).size, [l, d] = I({}), y = N((m) => {
1993
+ ), c = new Set(r.map((m) => m.memoryId)).size, [s, d] = w({}), u = N((m) => {
1994
1994
  d((g) => ({
1995
1995
  ...g,
1996
1996
  [m]: !g[m]
1997
1997
  }));
1998
- }, []), u = D(() => er(r), [r]), i = c === 1 ? t.memoryChatChunkResultsInOneMemory : b(t.memoryChatChunkResultsInMemories, {
1998
+ }, []), y = z(() => er(r), [r]), i = c === 1 ? t.memoryChatChunkResultsInOneMemory : b(t.memoryChatChunkResultsInMemories, {
1999
1999
  n: c
2000
- }), a = `${tr(s, t)} ${i}`;
2000
+ }), l = `${tr(a, t)} ${i}`;
2001
2001
  return r.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
2002
2002
  "div",
2003
2003
  {
@@ -2009,13 +2009,13 @@ const or = ({
2009
2009
  children: t.memorySearchExploreNoResults
2010
2010
  }
2011
2011
  ) }) : /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
2012
- u.map((m) => /* @__PURE__ */ o(
2012
+ y.map((m) => /* @__PURE__ */ o(
2013
2013
  nr,
2014
2014
  {
2015
2015
  group: m,
2016
2016
  t,
2017
- expanded: l[m.memoryId] === !0,
2018
- onToggle: () => y(m.memoryId),
2017
+ expanded: s[m.memoryId] === !0,
2018
+ onToggle: () => u(m.memoryId),
2019
2019
  onSearchResultClick: n
2020
2020
  },
2021
2021
  m.memoryId
@@ -2029,13 +2029,13 @@ const or = ({
2029
2029
  marginTop: "4px",
2030
2030
  fontStyle: "italic"
2031
2031
  },
2032
- children: a
2032
+ children: l
2033
2033
  }
2034
2034
  )
2035
2035
  ] });
2036
2036
  };
2037
2037
  function ir({ item: e }) {
2038
- return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2038
+ return e.error != null ? /* @__PURE__ */ o(j, { 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" });
2039
2039
  }
2040
2040
  function ar(e, n) {
2041
2041
  return b(n.searchingInMemoriesOfType, {
@@ -2047,9 +2047,9 @@ function sr({
2047
2047
  t: n,
2048
2048
  showShimmerForPrimary: t
2049
2049
  }) {
2050
- const r = e.result != null, s = e.error != null, c = ar(e, n);
2050
+ const r = e.result != null, a = e.error != null, c = ar(e, n);
2051
2051
  return /* @__PURE__ */ p(
2052
- w.div,
2052
+ I.div,
2053
2053
  {
2054
2054
  initial: { opacity: 0 },
2055
2055
  animate: { opacity: 1 },
@@ -2089,7 +2089,7 @@ function sr({
2089
2089
  flex: 1
2090
2090
  },
2091
2091
  children: [
2092
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !r && !s && t ? /* @__PURE__ */ o(
2092
+ /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !r && !a && t ? /* @__PURE__ */ o(
2093
2093
  M,
2094
2094
  {
2095
2095
  text: c,
@@ -2115,7 +2115,7 @@ function sr({
2115
2115
  )
2116
2116
  }
2117
2117
  ) }),
2118
- s && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
2118
+ a && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
2119
2119
  ]
2120
2120
  }
2121
2121
  )
@@ -2124,10 +2124,10 @@ function sr({
2124
2124
  );
2125
2125
  }
2126
2126
  const lr = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
2127
- const s = D(() => {
2127
+ const a = z(() => {
2128
2128
  let c = -1;
2129
- return e.memoryTypes.forEach((l, d) => {
2130
- l.result == null && l.error == null && (c = d);
2129
+ return e.memoryTypes.forEach((s, d) => {
2130
+ s.result == null && s.error == null && (c = d);
2131
2131
  }), c;
2132
2132
  }, [e.memoryTypes]);
2133
2133
  return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
@@ -2140,12 +2140,12 @@ const lr = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
2140
2140
  color: "#999",
2141
2141
  shimmerColor: "#000"
2142
2142
  }
2143
- ) : e.memoryTypes.map((c, l) => /* @__PURE__ */ o(
2143
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ o(
2144
2144
  sr,
2145
2145
  {
2146
2146
  item: c,
2147
2147
  t: r,
2148
- showShimmerForPrimary: l === s && n
2148
+ showShimmerForPrimary: s === a && n
2149
2149
  },
2150
2150
  c.memoryTypeId
2151
2151
  )),
@@ -2180,23 +2180,23 @@ function ur(e) {
2180
2180
  return n == null || n === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
2181
2181
  }
2182
2182
  function yr({ phase: e }) {
2183
- return e === 3 ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2183
+ return e === 3 ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2184
2184
  }
2185
2185
  function gr({
2186
2186
  item: e,
2187
2187
  t: n,
2188
2188
  isActiveRow: t
2189
2189
  }) {
2190
- const r = mr(e), s = ur(e), c = e.reasoning, l = c != null && c.length > 0, d = F(null), [y, u] = I(!1), i = r && t, a = s === 2 && t && !O(e);
2190
+ const r = mr(e), a = ur(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [u, y] = w(!1), i = r && t, l = a === 2 && t && !O(e);
2191
2191
  R(() => {
2192
2192
  const h = d.current;
2193
- h != null && s === 1 && l && (h.scrollTop = h.scrollHeight);
2194
- }, [c, s, l]);
2193
+ h != null && a === 1 && s && (h.scrollTop = h.scrollHeight);
2194
+ }, [c, a, s]);
2195
2195
  const m = b(n.searchingInMemoriesOfType, {
2196
2196
  name: e.memoryTypeName
2197
- }), g = !r && s === 3;
2197
+ }), g = !r && a === 3;
2198
2198
  return /* @__PURE__ */ p(
2199
- w.div,
2199
+ I.div,
2200
2200
  {
2201
2201
  initial: { opacity: 0 },
2202
2202
  animate: { opacity: 1 },
@@ -2223,7 +2223,7 @@ function gr({
2223
2223
  width: 32,
2224
2224
  ...g ? { paddingTop: 2 } : {}
2225
2225
  },
2226
- children: /* @__PURE__ */ o(yr, { phase: r ? 1 : s })
2226
+ children: /* @__PURE__ */ o(yr, { phase: r ? 1 : a })
2227
2227
  }
2228
2228
  ),
2229
2229
  /* @__PURE__ */ p(
@@ -2247,7 +2247,7 @@ function gr({
2247
2247
  shimmerColor: "#000"
2248
2248
  }
2249
2249
  ) : e.memoryTypeName }),
2250
- s === 1 && l && !O(e) && /* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
2250
+ a === 1 && s && !O(e) && /* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
2251
2251
  /* @__PURE__ */ o(
2252
2252
  "span",
2253
2253
  {
@@ -2293,7 +2293,7 @@ function gr({
2293
2293
  }
2294
2294
  )
2295
2295
  ] }),
2296
- s === 2 && a && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
2296
+ a === 2 && l && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
2297
2297
  M,
2298
2298
  {
2299
2299
  text: n.memorySearchGeneratingQueriesPending,
@@ -2303,7 +2303,7 @@ function gr({
2303
2303
  shimmerColor: "#000"
2304
2304
  }
2305
2305
  ) }),
2306
- s === 3 && /* @__PURE__ */ p(E, { children: [
2306
+ a === 3 && /* @__PURE__ */ p(E, { children: [
2307
2307
  /* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
2308
2308
  /* @__PURE__ */ o(
2309
2309
  "span",
@@ -2342,12 +2342,12 @@ function gr({
2342
2342
  }
2343
2343
  )
2344
2344
  ] }),
2345
- l && /* @__PURE__ */ p(E, { children: [
2345
+ s && /* @__PURE__ */ p(E, { children: [
2346
2346
  /* @__PURE__ */ o(
2347
2347
  "button",
2348
2348
  {
2349
2349
  type: "button",
2350
- onClick: () => u((h) => !h),
2350
+ onClick: () => y((h) => !h),
2351
2351
  style: {
2352
2352
  alignSelf: "flex-start",
2353
2353
  border: "none",
@@ -2358,10 +2358,10 @@ function gr({
2358
2358
  color: "#666",
2359
2359
  textDecoration: "underline"
2360
2360
  },
2361
- children: y ? n.memorySearchHideReasoning : n.memorySearchViewReasoning
2361
+ children: u ? n.memorySearchHideReasoning : n.memorySearchViewReasoning
2362
2362
  }
2363
2363
  ),
2364
- y && /* @__PURE__ */ o(
2364
+ u && /* @__PURE__ */ o(
2365
2365
  "div",
2366
2366
  {
2367
2367
  style: {
@@ -2387,10 +2387,10 @@ function gr({
2387
2387
  );
2388
2388
  }
2389
2389
  const pr = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
2390
- const s = D(() => {
2390
+ const a = z(() => {
2391
2391
  let c = -1;
2392
- return e.memoryTypes.forEach((l, d) => {
2393
- O(l) || (c = d);
2392
+ return e.memoryTypes.forEach((s, d) => {
2393
+ O(s) || (c = d);
2394
2394
  }), c;
2395
2395
  }, [e.memoryTypes]);
2396
2396
  return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
@@ -2403,12 +2403,12 @@ const pr = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
2403
2403
  color: "#999",
2404
2404
  shimmerColor: "#000"
2405
2405
  }
2406
- ) : e.memoryTypes.map((c, l) => /* @__PURE__ */ o(
2406
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ o(
2407
2407
  gr,
2408
2408
  {
2409
2409
  item: c,
2410
2410
  t: r,
2411
- isActiveRow: l === s && n
2411
+ isActiveRow: s === a && n
2412
2412
  },
2413
2413
  c.memoryTypeId
2414
2414
  )),
@@ -2427,7 +2427,7 @@ const pr = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
2427
2427
  ] });
2428
2428
  };
2429
2429
  function hr(e) {
2430
- return e.some((r) => r.result == null && r.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((r) => r.error != null) ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 });
2430
+ return e.some((r) => r.result == null && r.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((r) => r.error != null) ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
2431
2431
  }
2432
2432
  function fr(e, n) {
2433
2433
  if (e.error != null)
@@ -2443,13 +2443,13 @@ function fr(e, n) {
2443
2443
  shimmerColor: "#000"
2444
2444
  }
2445
2445
  ) });
2446
- const t = e.result, r = t.numberOfChunks === 1 ? n.chunkFound : b(n.chunksFound, { n: t.numberOfChunks }), s = b(n.scoreLabel, {
2446
+ const t = e.result, r = t.numberOfChunks === 1 ? n.chunkFound : b(n.chunksFound, { n: t.numberOfChunks }), a = b(n.scoreLabel, {
2447
2447
  n: t.highestChunkScore.toFixed(2)
2448
2448
  });
2449
2449
  return /* @__PURE__ */ p("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
2450
2450
  r,
2451
2451
  " · ",
2452
- s
2452
+ a
2453
2453
  ] });
2454
2454
  }
2455
2455
  function xr({
@@ -2458,7 +2458,7 @@ function xr({
2458
2458
  onExploreQueryResultClick: t,
2459
2459
  t: r
2460
2460
  }) {
2461
- const [s, c] = I(null);
2461
+ const [a, c] = w(null);
2462
2462
  if (e.length === 0)
2463
2463
  return /* @__PURE__ */ o(
2464
2464
  "div",
@@ -2471,7 +2471,7 @@ function xr({
2471
2471
  children: r.memorySearchExploreNoResults
2472
2472
  }
2473
2473
  );
2474
- const l = !!t;
2474
+ const s = !!t;
2475
2475
  return /* @__PURE__ */ o(
2476
2476
  "div",
2477
2477
  {
@@ -2483,10 +2483,10 @@ function xr({
2483
2483
  paddingTop: 8,
2484
2484
  borderTop: "1px solid #f0f0f0"
2485
2485
  },
2486
- children: e.map((d, y) => {
2487
- const u = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, i = V(
2486
+ children: e.map((d, u) => {
2487
+ const y = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, i = V(
2488
2488
  d.chunks
2489
- ), a = [
2489
+ ), l = [
2490
2490
  X(d),
2491
2491
  b(r.scoreLabel, {
2492
2492
  n: d.matchingChunkScore.toFixed(2)
@@ -2501,7 +2501,7 @@ function xr({
2501
2501
  memoryTypeId: n.memoryTypeId,
2502
2502
  memoryTypeName: n.memoryTypeName,
2503
2503
  query: n.query
2504
- }, g = `${n.query}::${d.memoryId}::${y}`, h = s === g;
2504
+ }, g = `${n.query}::${d.memoryId}::${u}`, h = a === g;
2505
2505
  return /* @__PURE__ */ p(
2506
2506
  "div",
2507
2507
  {
@@ -2510,9 +2510,9 @@ function xr({
2510
2510
  flexDirection: "row",
2511
2511
  alignItems: "flex-start",
2512
2512
  gap: "12px",
2513
- paddingTop: y > 0 ? 12 : 0,
2514
- paddingBottom: y < e.length - 1 ? 12 : 0,
2515
- borderBottom: y < e.length - 1 ? "1px solid #eee" : void 0,
2513
+ paddingTop: u > 0 ? 12 : 0,
2514
+ paddingBottom: u < e.length - 1 ? 12 : 0,
2515
+ borderBottom: u < e.length - 1 ? "1px solid #eee" : void 0,
2516
2516
  minWidth: 0
2517
2517
  },
2518
2518
  children: [
@@ -2535,7 +2535,7 @@ function xr({
2535
2535
  fontWeight: 600,
2536
2536
  color: "#333"
2537
2537
  },
2538
- children: u
2538
+ children: y
2539
2539
  }
2540
2540
  ),
2541
2541
  /* @__PURE__ */ o(
@@ -2562,13 +2562,13 @@ function xr({
2562
2562
  color: "#94a3b8",
2563
2563
  lineHeight: 1.35
2564
2564
  },
2565
- children: a.join(" · ")
2565
+ children: l.join(" · ")
2566
2566
  }
2567
2567
  )
2568
2568
  ]
2569
2569
  }
2570
2570
  ),
2571
- l && /* @__PURE__ */ p(
2571
+ s && /* @__PURE__ */ p(
2572
2572
  "button",
2573
2573
  {
2574
2574
  type: "button",
@@ -2614,7 +2614,7 @@ function xr({
2614
2614
  )
2615
2615
  ]
2616
2616
  },
2617
- `${d.memoryId}-${y}`
2617
+ `${d.memoryId}-${u}`
2618
2618
  );
2619
2619
  })
2620
2620
  }
@@ -2622,29 +2622,28 @@ function xr({
2622
2622
  }
2623
2623
  function Sr(e) {
2624
2624
  const n = [], t = /* @__PURE__ */ new Map();
2625
- return e.forEach((r, s) => {
2625
+ return e.forEach((r, a) => {
2626
2626
  let c = t.get(r.memoryTypeId);
2627
2627
  c == null && (n.push(r.memoryTypeId), c = {
2628
2628
  memoryTypeId: r.memoryTypeId,
2629
2629
  memoryTypeName: r.memoryTypeName,
2630
2630
  items: []
2631
- }, t.set(r.memoryTypeId, c)), c.items.push({ item: r, flatIndex: s });
2631
+ }, t.set(r.memoryTypeId, c)), c.items.push({ item: r, flatIndex: a });
2632
2632
  }), n.map((r) => t.get(r));
2633
2633
  }
2634
2634
  function Tr({
2635
2635
  group: e,
2636
2636
  t: n,
2637
- lastInFlightIndex: t,
2638
- isLatest: r,
2639
- expandedRows: s,
2640
- toggleExpanded: c,
2641
- onExploreQueryResultClick: l
2637
+ isLatest: t,
2638
+ expandedRows: r,
2639
+ toggleExpanded: a,
2640
+ onExploreQueryResultClick: c
2642
2641
  }) {
2643
- const d = e.items.map((u) => u.item), y = d.some(
2642
+ const s = e.items.map((u) => u.item), d = s.some(
2644
2643
  (u) => u.result == null && u.error == null
2645
2644
  );
2646
2645
  return /* @__PURE__ */ p(
2647
- w.div,
2646
+ I.div,
2648
2647
  {
2649
2648
  initial: { opacity: 0 },
2650
2649
  animate: { opacity: 1 },
@@ -2655,7 +2654,7 @@ function Tr({
2655
2654
  borderBottom: "1px solid #eee",
2656
2655
  display: "flex",
2657
2656
  flexDirection: "row",
2658
- alignItems: y ? "center" : "flex-start",
2657
+ alignItems: d ? "center" : "flex-start",
2659
2658
  gap: "10px",
2660
2659
  minWidth: 0
2661
2660
  },
@@ -2669,9 +2668,9 @@ function Tr({
2669
2668
  justifyContent: "center",
2670
2669
  flexShrink: 0,
2671
2670
  width: 32,
2672
- ...y ? {} : { paddingTop: 2 }
2671
+ ...d ? {} : { paddingTop: 2 }
2673
2672
  },
2674
- children: hr(d)
2673
+ children: hr(s)
2675
2674
  }
2676
2675
  ),
2677
2676
  /* @__PURE__ */ p(
@@ -2697,9 +2696,9 @@ function Tr({
2697
2696
  })
2698
2697
  }
2699
2698
  ),
2700
- e.items.map(({ item: u, flatIndex: i }) => {
2701
- var S;
2702
- const a = u.result != null, m = u.error != null, g = i === t && r && !a && !m, h = s[i] === !0, f = ((S = u.result) == null ? void 0 : S.items) ?? [];
2699
+ e.items.map(({ item: u, flatIndex: y }) => {
2700
+ var f;
2701
+ const i = u.result != null, l = u.error != null, m = t && !i && !l, g = r[y] === !0, h = ((f = u.result) == null ? void 0 : f.items) ?? [];
2703
2702
  return /* @__PURE__ */ p(
2704
2703
  "div",
2705
2704
  {
@@ -2733,7 +2732,7 @@ function Tr({
2733
2732
  flex: "1 1 12rem",
2734
2733
  minWidth: 0
2735
2734
  },
2736
- children: g ? /* @__PURE__ */ o(
2735
+ children: m ? /* @__PURE__ */ o(
2737
2736
  M,
2738
2737
  {
2739
2738
  text: u.query,
@@ -2757,11 +2756,11 @@ function Tr({
2757
2756
  },
2758
2757
  children: [
2759
2758
  fr(u, n),
2760
- a && /* @__PURE__ */ o(
2759
+ i && /* @__PURE__ */ o(
2761
2760
  "button",
2762
2761
  {
2763
2762
  type: "button",
2764
- onClick: () => c(i),
2763
+ onClick: () => a(y),
2765
2764
  style: {
2766
2765
  border: "none",
2767
2766
  background: "none",
@@ -2772,7 +2771,7 @@ function Tr({
2772
2771
  textDecoration: "underline",
2773
2772
  fontFamily: "inherit"
2774
2773
  },
2775
- children: h ? n.memorySearchHideExploreResults : n.memorySearchViewExploreResults
2774
+ children: g ? n.memorySearchHideExploreResults : n.memorySearchViewExploreResults
2776
2775
  }
2777
2776
  )
2778
2777
  ]
@@ -2781,18 +2780,18 @@ function Tr({
2781
2780
  ]
2782
2781
  }
2783
2782
  ),
2784
- a && h && /* @__PURE__ */ o(
2783
+ i && g && /* @__PURE__ */ o(
2785
2784
  xr,
2786
2785
  {
2787
- items: f,
2786
+ items: h,
2788
2787
  queryRow: u,
2789
- onExploreQueryResultClick: l,
2788
+ onExploreQueryResultClick: c,
2790
2789
  t: n
2791
2790
  }
2792
2791
  )
2793
2792
  ]
2794
2793
  },
2795
- `${e.memoryTypeId}-${i}-${u.query}`
2794
+ `${e.memoryTypeId}-${y}-${u.query}`
2796
2795
  );
2797
2796
  })
2798
2797
  ]
@@ -2807,21 +2806,16 @@ const kr = ({
2807
2806
  isLatest: n = !1,
2808
2807
  durationSeconds: t,
2809
2808
  onExploreQueryResultClick: r,
2810
- t: s
2809
+ t: a
2811
2810
  }) => {
2812
- const [c, l] = I(
2811
+ const [c, s] = w(
2813
2812
  {}
2814
- ), d = N((i) => {
2815
- l((a) => ({
2816
- ...a,
2817
- [i]: !a[i]
2813
+ ), d = N((y) => {
2814
+ s((i) => ({
2815
+ ...i,
2816
+ [y]: !i[y]
2818
2817
  }));
2819
- }, []), y = D(() => {
2820
- let i = -1;
2821
- return e.queries.forEach((a, m) => {
2822
- a.result == null && a.error == null && (i = m);
2823
- }), i;
2824
- }, [e.queries]), u = D(
2818
+ }, []), u = z(
2825
2819
  () => Sr(e.queries),
2826
2820
  [e.queries]
2827
2821
  );
@@ -2829,24 +2823,23 @@ const kr = ({
2829
2823
  n && !t && e.queries.length === 0 ? /* @__PURE__ */ o(
2830
2824
  M,
2831
2825
  {
2832
- text: s.memorySearchExploringQueries,
2826
+ text: a.memorySearchExploringQueries,
2833
2827
  duration: 2.5,
2834
2828
  repeat: !0,
2835
2829
  color: "#999",
2836
2830
  shimmerColor: "#000"
2837
2831
  }
2838
- ) : u.map((i) => /* @__PURE__ */ o(
2832
+ ) : u.map((y) => /* @__PURE__ */ o(
2839
2833
  Tr,
2840
2834
  {
2841
- group: i,
2842
- t: s,
2843
- lastInFlightIndex: y,
2835
+ group: y,
2836
+ t: a,
2844
2837
  isLatest: n,
2845
2838
  expandedRows: c,
2846
2839
  toggleExpanded: d,
2847
2840
  onExploreQueryResultClick: r
2848
2841
  },
2849
- i.memoryTypeId
2842
+ y.memoryTypeId
2850
2843
  )),
2851
2844
  t !== void 0 && /* @__PURE__ */ o(
2852
2845
  "div",
@@ -2857,15 +2850,15 @@ const kr = ({
2857
2850
  marginTop: "4px",
2858
2851
  fontStyle: "italic"
2859
2852
  },
2860
- children: b(s.tookSeconds, { n: t })
2853
+ children: b(a.tookSeconds, { n: t })
2861
2854
  }
2862
2855
  )
2863
2856
  ] });
2864
2857
  }, br = ({ data: e, onSearchResultClick: n, t }) => {
2865
- const r = e.response.items, s = !!n, [c, l] = I(null);
2858
+ const r = e.response.items, a = !!n, [c, s] = w(null);
2866
2859
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
2867
2860
  /* @__PURE__ */ o(
2868
- w.div,
2861
+ I.div,
2869
2862
  {
2870
2863
  style: {
2871
2864
  marginBottom: "12px",
@@ -2887,10 +2880,10 @@ const kr = ({
2887
2880
  flexDirection: "column",
2888
2881
  gap: 0
2889
2882
  },
2890
- children: r.map((d, y) => {
2891
- const u = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, i = V(
2883
+ children: r.map((d, u) => {
2884
+ const y = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, i = V(
2892
2885
  d.chunks
2893
- ), a = [
2886
+ ), l = [
2894
2887
  X(d),
2895
2888
  b(t.scoreLabel, {
2896
2889
  n: d.matchingChunkScore.toFixed(2)
@@ -2904,13 +2897,13 @@ const kr = ({
2904
2897
  memoryTypeId: d.memoryTypeId,
2905
2898
  memoryTypeName: d.memoryTypeName,
2906
2899
  pageNumbers: i
2907
- }, g = `${d.memoryId}-${y}`, h = c === g;
2900
+ }, g = `${d.memoryId}-${u}`, h = c === g;
2908
2901
  return /* @__PURE__ */ p(
2909
- w.div,
2902
+ I.div,
2910
2903
  {
2911
2904
  initial: { opacity: 0 },
2912
2905
  animate: { opacity: 1 },
2913
- transition: { duration: 0.2, delay: y * 0.04 },
2906
+ transition: { duration: 0.2, delay: u * 0.04 },
2914
2907
  style: {
2915
2908
  display: "flex",
2916
2909
  flexDirection: "row",
@@ -2918,7 +2911,7 @@ const kr = ({
2918
2911
  gap: "12px",
2919
2912
  paddingTop: "12px",
2920
2913
  paddingBottom: "12px",
2921
- borderBottom: y < r.length - 1 ? "1px solid #eee" : void 0,
2914
+ borderBottom: u < r.length - 1 ? "1px solid #eee" : void 0,
2922
2915
  minWidth: 0
2923
2916
  },
2924
2917
  children: [
@@ -2941,7 +2934,7 @@ const kr = ({
2941
2934
  fontWeight: 600,
2942
2935
  color: "#333"
2943
2936
  },
2944
- children: u
2937
+ children: y
2945
2938
  }
2946
2939
  ),
2947
2940
  /* @__PURE__ */ o(
@@ -2966,24 +2959,24 @@ const kr = ({
2966
2959
  color: "#94a3b8",
2967
2960
  lineHeight: 1.35
2968
2961
  },
2969
- children: a.join(" · ")
2962
+ children: l.join(" · ")
2970
2963
  }
2971
2964
  )
2972
2965
  ]
2973
2966
  }
2974
2967
  ),
2975
- s && /* @__PURE__ */ p(
2968
+ a && /* @__PURE__ */ p(
2976
2969
  "button",
2977
2970
  {
2978
2971
  type: "button",
2979
2972
  "aria-busy": h,
2980
2973
  disabled: h,
2981
2974
  onClick: async () => {
2982
- l(g);
2975
+ s(g);
2983
2976
  try {
2984
2977
  await n(m);
2985
2978
  } finally {
2986
- l(null);
2979
+ s(null);
2987
2980
  }
2988
2981
  },
2989
2982
  style: {
@@ -3016,14 +3009,14 @@ const kr = ({
3016
3009
  )
3017
3010
  ]
3018
3011
  },
3019
- `${d.memoryId}-${y}`
3012
+ `${d.memoryId}-${u}`
3020
3013
  );
3021
3014
  })
3022
3015
  }
3023
3016
  )
3024
3017
  ] });
3025
3018
  }, G = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
3026
- w.div,
3019
+ I.div,
3027
3020
  {
3028
3021
  initial: { opacity: 0, y: -10 },
3029
3022
  animate: { opacity: 1, y: 0 },
@@ -3050,17 +3043,17 @@ const kr = ({
3050
3043
  loading: n,
3051
3044
  error: t,
3052
3045
  loadingText: r,
3053
- t: s,
3046
+ t: a,
3054
3047
  onSourceClick: c,
3055
- onSearchResultClick: l,
3048
+ onSearchResultClick: s,
3056
3049
  onExploreQueryResultClick: d
3057
3050
  }) => {
3058
- const y = F(null);
3051
+ const u = F(null);
3059
3052
  R(() => {
3060
- y.current && (y.current.scrollTop = y.current.scrollHeight);
3053
+ u.current && (u.current.scrollTop = u.current.scrollHeight);
3061
3054
  }, [e.length]);
3062
- const u = (a) => {
3063
- const m = a.item.data;
3055
+ const y = (l) => {
3056
+ const m = l.item.data;
3064
3057
  if (m.taskType === "StreamingChatCompletion" && m.eventType === "Text")
3065
3058
  return /* @__PURE__ */ o(ee, { text: m.text });
3066
3059
  if (m.taskType === "StructuredChatCompletion" && m.eventType === "Completed")
@@ -3074,9 +3067,9 @@ const kr = ({
3074
3067
  _e,
3075
3068
  {
3076
3069
  data: m,
3077
- isLatest: a.isLatest,
3078
- durationSeconds: a.durationSeconds,
3079
- t: s
3070
+ isLatest: l.isLatest,
3071
+ durationSeconds: l.durationSeconds,
3072
+ t: a
3080
3073
  }
3081
3074
  );
3082
3075
  case "FindMemoriesResult":
@@ -3084,7 +3077,7 @@ const kr = ({
3084
3077
  Ge,
3085
3078
  {
3086
3079
  data: m,
3087
- t: s
3080
+ t: a
3088
3081
  }
3089
3082
  );
3090
3083
  case "Search":
@@ -3092,9 +3085,9 @@ const kr = ({
3092
3085
  He,
3093
3086
  {
3094
3087
  data: m,
3095
- isLatest: a.isLatest,
3096
- durationSeconds: a.durationSeconds,
3097
- t: s
3088
+ isLatest: l.isLatest,
3089
+ durationSeconds: l.durationSeconds,
3090
+ t: a
3098
3091
  }
3099
3092
  );
3100
3093
  case "FindSources":
@@ -3102,9 +3095,9 @@ const kr = ({
3102
3095
  Ue,
3103
3096
  {
3104
3097
  data: m,
3105
- isLatest: a.isLatest,
3106
- durationSeconds: a.durationSeconds,
3107
- t: s
3098
+ isLatest: l.isLatest,
3099
+ durationSeconds: l.durationSeconds,
3100
+ t: a
3108
3101
  }
3109
3102
  );
3110
3103
  case "SourcesResult":
@@ -3113,7 +3106,7 @@ const kr = ({
3113
3106
  {
3114
3107
  data: m,
3115
3108
  onSourceClick: c,
3116
- t: s
3109
+ t: a
3117
3110
  }
3118
3111
  );
3119
3112
  case "ExploreMemories":
@@ -3121,9 +3114,9 @@ const kr = ({
3121
3114
  Xe,
3122
3115
  {
3123
3116
  data: m,
3124
- completed: a.completed,
3125
- isLatest: a.isLatest,
3126
- t: s
3117
+ completed: l.completed,
3118
+ isLatest: l.isLatest,
3119
+ t: a
3127
3120
  }
3128
3121
  );
3129
3122
  case "ChunkResults":
@@ -3131,8 +3124,8 @@ const kr = ({
3131
3124
  or,
3132
3125
  {
3133
3126
  data: m,
3134
- onSearchResultClick: l,
3135
- t: s
3127
+ onSearchResultClick: s,
3128
+ t: a
3136
3129
  }
3137
3130
  );
3138
3131
  case "Completed":
@@ -3145,9 +3138,9 @@ const kr = ({
3145
3138
  pr,
3146
3139
  {
3147
3140
  data: m,
3148
- isLatest: a.isLatest,
3149
- durationSeconds: a.durationSeconds,
3150
- t: s
3141
+ isLatest: l.isLatest,
3142
+ durationSeconds: l.durationSeconds,
3143
+ t: a
3151
3144
  }
3152
3145
  );
3153
3146
  case "ExploreQueries":
@@ -3155,10 +3148,10 @@ const kr = ({
3155
3148
  kr,
3156
3149
  {
3157
3150
  data: m,
3158
- isLatest: a.isLatest,
3159
- durationSeconds: a.durationSeconds,
3151
+ isLatest: l.isLatest,
3152
+ durationSeconds: l.durationSeconds,
3160
3153
  onExploreQueryResultClick: d,
3161
- t: s
3154
+ t: a
3162
3155
  }
3163
3156
  );
3164
3157
  case "SearchMemoryTypes":
@@ -3166,9 +3159,9 @@ const kr = ({
3166
3159
  lr,
3167
3160
  {
3168
3161
  data: m,
3169
- isLatest: a.isLatest,
3170
- durationSeconds: a.durationSeconds,
3171
- t: s
3162
+ isLatest: l.isLatest,
3163
+ durationSeconds: l.durationSeconds,
3164
+ t: a
3172
3165
  }
3173
3166
  );
3174
3167
  case "Completed":
@@ -3176,8 +3169,8 @@ const kr = ({
3176
3169
  br,
3177
3170
  {
3178
3171
  data: m,
3179
- onSearchResultClick: l,
3180
- t: s
3172
+ onSearchResultClick: s,
3173
+ t: a
3181
3174
  }
3182
3175
  );
3183
3176
  }
@@ -3187,7 +3180,7 @@ const kr = ({
3187
3180
  return t ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(G, { message: t.message }) }) : n ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
3188
3181
  M,
3189
3182
  {
3190
- text: r ?? s.processingYourTask,
3183
+ text: r ?? a.processingYourTask,
3191
3184
  duration: 1.5,
3192
3185
  repeat: !0,
3193
3186
  repeatDelay: 0,
@@ -3195,8 +3188,8 @@ const kr = ({
3195
3188
  shimmerColor: "#000"
3196
3189
  }
3197
3190
  ) }) : null;
3198
- const i = e.filter((a, m) => {
3199
- const g = a.item.data;
3191
+ const i = e.filter((l, m) => {
3192
+ const g = l.item.data;
3200
3193
  return g.taskType === "MemoryChat" && g.eventType === "ExploreMemories" ? !e.slice(m + 1).some(
3201
3194
  (x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ExploreMemories"
3202
3195
  ) : g.taskType === "MemorySearch" && g.eventType === "GeneratingQueries" ? !e.slice(m + 1).some(
@@ -3207,11 +3200,11 @@ const kr = ({
3207
3200
  (x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ChunkResults"
3208
3201
  ) : !0;
3209
3202
  });
3210
- return /* @__PURE__ */ p("div", { id: "agent-task-progress-verbose", ref: y, children: [
3211
- /* @__PURE__ */ o(pe, { children: i.map((a, m) => /* @__PURE__ */ o(
3212
- w.div,
3203
+ return /* @__PURE__ */ p("div", { id: "agent-task-progress-verbose", ref: u, children: [
3204
+ /* @__PURE__ */ o(pe, { children: i.map((l, m) => /* @__PURE__ */ o(
3205
+ I.div,
3213
3206
  {
3214
- id: `agent-task-progress-item-${a.item.progressItemId}`,
3207
+ id: `agent-task-progress-item-${l.item.progressItemId}`,
3215
3208
  initial: { opacity: 0, y: -20 },
3216
3209
  animate: { opacity: 1, y: 0 },
3217
3210
  transition: {
@@ -3219,9 +3212,9 @@ const kr = ({
3219
3212
  delay: m * 0.1,
3220
3213
  ease: "easeOut"
3221
3214
  },
3222
- children: u(a)
3215
+ children: y(l)
3223
3216
  },
3224
- a.item.progressItemId
3217
+ l.item.progressItemId
3225
3218
  )) }),
3226
3219
  t ? /* @__PURE__ */ o("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ o(G, { message: t.message }) }) : null
3227
3220
  ] });
@@ -3230,9 +3223,9 @@ const kr = ({
3230
3223
  language: n,
3231
3224
  onSourceClick: t,
3232
3225
  onSearchResultClick: r,
3233
- onExploreQueryResultClick: s
3226
+ onExploreQueryResultClick: a
3234
3227
  }) => {
3235
- const c = Oe(e), l = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", d = $e(l);
3228
+ const c = Oe(e), s = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", d = $e(s);
3236
3229
  return /* @__PURE__ */ o(
3237
3230
  vr,
3238
3231
  {
@@ -3243,13 +3236,13 @@ const kr = ({
3243
3236
  t: d,
3244
3237
  onSourceClick: t,
3245
3238
  onSearchResultClick: r,
3246
- onExploreQueryResultClick: s
3239
+ onExploreQueryResultClick: a
3247
3240
  }
3248
3241
  );
3249
3242
  };
3250
3243
  export {
3251
3244
  Dr as AgentTaskProgress,
3252
- z as Checkmark,
3245
+ L as Checkmark,
3253
3246
  Fr as FencyProvider,
3254
3247
  br as MemorySearchCompletedResults,
3255
3248
  Me as StreamEventManager,