@fencyai/react 0.1.148 → 0.1.150

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,32 +1,32 @@
1
1
  import { jsxs as y, jsx as i, Fragment as E } from "react/jsx-runtime";
2
- import { createStream as V, isStreamTimeoutEvent as Q, isStreamNotFoundEvent as Z, isAgentTaskProgressItemUpdatedEvent as ee, createAgentTask as te } from "@fencyai/js";
3
- import { createContext as ne, useState as x, useRef as I, useEffect as w, useCallback as H, useContext as re, useMemo as K } from "react";
4
- import { useInView as oe, motion as S, AnimatePresence as q } from "motion/react";
5
- import ie from "react-markdown";
2
+ import { createStream as Q, isStreamTimeoutEvent as Z, isStreamNotFoundEvent as ee, isAgentTaskProgressItemUpdatedEvent as te, createAgentTask as ne } from "@fencyai/js";
3
+ import { createContext as re, useState as v, useRef as F, useEffect as A, useCallback as K, useContext as oe, useMemo as W } from "react";
4
+ import { useInView as ie, motion as x, AnimatePresence as q } from "motion/react";
5
+ import ae from "react-markdown";
6
6
  import { Prism as G } from "react-syntax-highlighter";
7
- import ae from "remark-gfm";
8
- import './assets/index.css';const X = ne(
7
+ import se from "remark-gfm";
8
+ import './assets/index.css';const X = re(
9
9
  void 0
10
10
  );
11
- async function se(e, t) {
11
+ async function le(e, t) {
12
12
  const n = e.getReader();
13
13
  let r;
14
14
  for (; !(r = await n.read()).done; )
15
15
  t(r.value);
16
16
  }
17
- function le(e) {
17
+ function ce(e) {
18
18
  let t, n, r, l = !1;
19
19
  return function(a) {
20
- t === void 0 ? (t = a, n = 0, r = -1) : t = de(t, a);
21
- const c = t.length;
22
- let s = 0;
23
- for (; n < c; ) {
24
- l && (t[n] === 10 && (s = ++n), l = !1);
20
+ t === void 0 ? (t = a, n = 0, r = -1) : t = ue(t, a);
21
+ const u = t.length;
22
+ let d = 0;
23
+ for (; n < u; ) {
24
+ l && (t[n] === 10 && (d = ++n), l = !1);
25
25
  let o = -1;
26
- for (; n < c && o === -1; ++n)
26
+ for (; n < u && o === -1; ++n)
27
27
  switch (t[n]) {
28
28
  case 58:
29
- r === -1 && (r = n - s);
29
+ r === -1 && (r = n - d);
30
30
  break;
31
31
  case 13:
32
32
  l = !0;
@@ -36,39 +36,39 @@ function le(e) {
36
36
  }
37
37
  if (o === -1)
38
38
  break;
39
- e(t.subarray(s, o), r), s = n, r = -1;
39
+ e(t.subarray(d, o), r), d = n, r = -1;
40
40
  }
41
- s === c ? t = void 0 : s !== 0 && (t = t.subarray(s), n -= s);
41
+ d === u ? t = void 0 : d !== 0 && (t = t.subarray(d), n -= d);
42
42
  };
43
43
  }
44
- function ce(e, t, n) {
44
+ function de(e, t, n) {
45
45
  let r = U();
46
46
  const l = new TextDecoder();
47
- return function(a, c) {
47
+ return function(a, u) {
48
48
  if (a.length === 0)
49
49
  n == null || n(r), r = U();
50
- else if (c > 0) {
51
- const s = l.decode(a.subarray(0, c)), o = c + (a[c + 1] === 32 ? 2 : 1), d = l.decode(a.subarray(o));
52
- switch (s) {
50
+ else if (u > 0) {
51
+ const d = l.decode(a.subarray(0, u)), o = u + (a[u + 1] === 32 ? 2 : 1), c = l.decode(a.subarray(o));
52
+ switch (d) {
53
53
  case "data":
54
54
  r.data = r.data ? r.data + `
55
- ` + d : d;
55
+ ` + c : c;
56
56
  break;
57
57
  case "event":
58
- r.event = d;
58
+ r.event = c;
59
59
  break;
60
60
  case "id":
61
- e(r.id = d);
61
+ e(r.id = c);
62
62
  break;
63
63
  case "retry":
64
- const g = parseInt(d, 10);
64
+ const g = parseInt(c, 10);
65
65
  isNaN(g) || t(r.retry = g);
66
66
  break;
67
67
  }
68
68
  }
69
69
  };
70
70
  }
71
- function de(e, t) {
71
+ function ue(e, t) {
72
72
  const n = new Uint8Array(e.length + t.length);
73
73
  return n.set(e), n.set(t, e.length), n;
74
74
  }
@@ -80,7 +80,7 @@ function U() {
80
80
  retry: void 0
81
81
  };
82
82
  }
83
- var ue = function(e, t) {
83
+ var me = function(e, t) {
84
84
  var n = {};
85
85
  for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
86
86
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
@@ -88,54 +88,54 @@ var ue = function(e, t) {
88
88
  t.indexOf(r[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[l]) && (n[r[l]] = e[r[l]]);
89
89
  return n;
90
90
  };
91
- const z = "text/event-stream", me = 1e3, _ = "last-event-id";
92
- function ge(e, t) {
93
- var { signal: n, headers: r, onopen: l, onmessage: u, onclose: a, onerror: c, openWhenHidden: s, fetch: o } = t, d = ue(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
91
+ const $ = "text/event-stream", ge = 1e3, _ = "last-event-id";
92
+ function pe(e, t) {
93
+ var { signal: n, headers: r, onopen: l, onmessage: s, onclose: a, onerror: u, openWhenHidden: d, fetch: o } = t, c = me(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
94
  return new Promise((g, m) => {
95
- const p = Object.assign({}, r);
96
- p.accept || (p.accept = z);
95
+ const f = Object.assign({}, r);
96
+ f.accept || (f.accept = $);
97
97
  let h;
98
- function k() {
99
- h.abort(), document.hidden || M();
100
- }
101
- s || document.addEventListener("visibilitychange", k);
102
- let f = me, b = 0;
103
98
  function T() {
104
- document.removeEventListener("visibilitychange", k), window.clearTimeout(b), h.abort();
99
+ h.abort(), document.hidden || w();
100
+ }
101
+ d || document.addEventListener("visibilitychange", T);
102
+ let p = ge, k = 0;
103
+ function b() {
104
+ document.removeEventListener("visibilitychange", T), window.clearTimeout(k), h.abort();
105
105
  }
106
106
  n == null || n.addEventListener("abort", () => {
107
- T(), g();
107
+ b(), g();
108
108
  });
109
- const R = o ?? window.fetch, F = l ?? he;
110
- async function M() {
111
- var D;
109
+ const I = o ?? window.fetch, C = l ?? he;
110
+ async function w() {
111
+ var P;
112
112
  h = new AbortController();
113
113
  try {
114
- const A = await R(e, Object.assign(Object.assign({}, d), { headers: p, signal: h.signal }));
115
- await F(A), await se(A.body, le(ce((C) => {
116
- C ? p[_] = C : delete p[_];
117
- }, (C) => {
118
- f = C;
119
- }, u))), a == null || a(), T(), g();
120
- } catch (A) {
114
+ const R = await I(e, Object.assign(Object.assign({}, c), { headers: f, signal: h.signal }));
115
+ await C(R), await le(R.body, ce(de((M) => {
116
+ M ? f[_] = M : delete f[_];
117
+ }, (M) => {
118
+ p = M;
119
+ }, s))), a == null || a(), b(), g();
120
+ } catch (R) {
121
121
  if (!h.signal.aborted)
122
122
  try {
123
- const C = (D = c == null ? void 0 : c(A)) !== null && D !== void 0 ? D : f;
124
- window.clearTimeout(b), b = window.setTimeout(M, C);
125
- } catch (C) {
126
- T(), m(C);
123
+ const M = (P = u == null ? void 0 : u(R)) !== null && P !== void 0 ? P : p;
124
+ window.clearTimeout(k), k = window.setTimeout(w, M);
125
+ } catch (M) {
126
+ b(), m(M);
127
127
  }
128
128
  }
129
129
  }
130
- M();
130
+ w();
131
131
  });
132
132
  }
133
133
  function he(e) {
134
134
  const t = e.headers.get("content-type");
135
- if (!(t != null && t.startsWith(z)))
136
- throw new Error(`Expected content-type to be ${z}, Actual: ${t}`);
135
+ if (!(t != null && t.startsWith($)))
136
+ throw new Error(`Expected content-type to be ${$}, Actual: ${t}`);
137
137
  }
138
- function pe(e) {
138
+ function ye(e) {
139
139
  const t = atob(e), n = new Uint8Array(t.length);
140
140
  for (let r = 0; r < t.length; r++)
141
141
  n[r] = t.charCodeAt(r);
@@ -162,12 +162,12 @@ class fe {
162
162
  connectStream(t) {
163
163
  const n = t.stream.id, r = new AbortController();
164
164
  this.eventSources.set(n, r);
165
- const l = `${this.fency.baseUrl}/sse/streams/${n}`, u = {
165
+ const l = `${this.fency.baseUrl}/sse/streams/${n}`, s = {
166
166
  "X-Fency-Publishable-Key": this.fency.publishableKey,
167
167
  "X-Fency-Stream-Token": t.stream.token
168
168
  };
169
- ge(l, {
170
- headers: u,
169
+ pe(l, {
170
+ headers: s,
171
171
  signal: r.signal,
172
172
  async onopen(a) {
173
173
  if (!a.ok && a.status >= 400 && a.status < 500 && a.status !== 429)
@@ -175,8 +175,8 @@ class fe {
175
175
  },
176
176
  onmessage: (a) => {
177
177
  if (a.data) {
178
- const c = pe(a.data);
179
- this.broadcast(c, n);
178
+ const u = ye(a.data);
179
+ this.broadcast(u, n);
180
180
  }
181
181
  },
182
182
  onerror: (a) => {
@@ -212,91 +212,91 @@ class fe {
212
212
  this.eventSources.forEach((t) => t.abort()), this.eventSources.clear(), this.subscribers.clear();
213
213
  }
214
214
  }
215
- const ye = 12e4, ke = (e) => {
215
+ const Se = 12e4, Te = (e) => {
216
216
  const t = Date.now();
217
- return e.filter((n) => t - n.createdAt < ye);
217
+ return e.filter((n) => t - n.createdAt < Se);
218
218
  };
219
- function et({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
220
- const [r, l] = x(
219
+ function at({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
220
+ const [r, l] = v(
221
221
  null
222
- ), [u, a] = x(!0), [c, s] = x(null), [o, d] = x([]), g = I(null), m = I(null);
223
- w(() => {
224
- e.then((f) => {
225
- l(f), a(!1);
226
- }).catch((f) => {
227
- s(f), a(!1);
222
+ ), [s, a] = v(!0), [u, d] = v(null), [o, c] = v([]), g = F(null), m = F(null);
223
+ A(() => {
224
+ e.then((p) => {
225
+ l(p), a(!1);
226
+ }).catch((p) => {
227
+ d(p), a(!1);
228
228
  });
229
- }, [e]), w(() => {
229
+ }, [e]), A(() => {
230
230
  r && !m.current && (m.current = new fe(r));
231
- }, [r]), w(() => {
231
+ }, [r]), A(() => {
232
232
  m.current && m.current.updateStreams(o);
233
- }, [o]), w(() => () => {
234
- var f;
235
- (f = m.current) == null || f.cleanup();
233
+ }, [o]), A(() => () => {
234
+ var p;
235
+ (p = m.current) == null || p.cleanup();
236
236
  }, []);
237
- const p = H(
238
- async (f = 3e4) => {
237
+ const f = K(
238
+ async (p = 3e4) => {
239
239
  if (g.current)
240
240
  return g.current;
241
- const b = Date.now(), T = o.length > 0 ? o[o.length - 1] : null;
242
- if (T && b - T.createdAt < f)
243
- return T.stream;
244
- const R = (async () => {
241
+ const k = Date.now(), b = o.length > 0 ? o[o.length - 1] : null;
242
+ if (b && k - b.createdAt < p)
243
+ return b.stream;
244
+ const I = (async () => {
245
245
  if (!r)
246
246
  throw new Error("Fency instance not initialized");
247
- const F = await t(), M = await V({
247
+ const C = await t(), w = await Q({
248
248
  pk: r.publishableKey,
249
249
  baseUrl: r.baseUrl,
250
- clientToken: (F == null ? void 0 : F.clientToken) ?? ""
250
+ clientToken: (C == null ? void 0 : C.clientToken) ?? ""
251
251
  });
252
- if (M.type === "success") {
253
- const D = {
254
- stream: M.stream,
252
+ if (w.type === "success") {
253
+ const P = {
254
+ stream: w.stream,
255
255
  createdAt: Date.now()
256
256
  };
257
- return d((A) => {
258
- const C = [...A, D];
259
- return ke(C);
260
- }), g.current = null, M.stream;
257
+ return c((R) => {
258
+ const M = [...R, P];
259
+ return Te(M);
260
+ }), g.current = null, w.stream;
261
261
  } else
262
262
  throw g.current = null, new Error("Failed to create stream");
263
263
  })();
264
- return g.current = R, R;
264
+ return g.current = I, I;
265
265
  },
266
266
  [r, o]
267
267
  );
268
- if (c)
268
+ if (u)
269
269
  return /* @__PURE__ */ y("div", { children: [
270
270
  "Fency error: ",
271
- c.message
271
+ u.message
272
272
  ] });
273
273
  if (!r)
274
274
  return null;
275
- const h = o.length > 0 ? o[o.length - 1] : null, k = {
275
+ const h = o.length > 0 ? o[o.length - 1] : null, T = {
276
276
  fency: r,
277
- loading: u,
278
- error: c,
277
+ loading: s,
278
+ error: u,
279
279
  activeStreams: o,
280
280
  latestStream: h,
281
281
  eventManager: m.current,
282
- getOrCreateStream: p
282
+ getOrCreateStream: f
283
283
  };
284
- return /* @__PURE__ */ i(X.Provider, { value: k, children: n });
284
+ return /* @__PURE__ */ i(X.Provider, { value: T, children: n });
285
285
  }
286
286
  function J() {
287
- const e = re(X);
287
+ const e = oe(X);
288
288
  if (e === void 0)
289
289
  throw new Error("useFencyContext must be used within a FencyProvider");
290
290
  return e;
291
291
  }
292
- const Se = (e) => {
292
+ const ke = (e) => {
293
293
  try {
294
294
  const t = JSON.parse(e);
295
- return be(t);
295
+ return xe(t);
296
296
  } catch (t) {
297
297
  return console.error("Error parsing message:", t), null;
298
298
  }
299
- }, be = (e) => Q(e) ? Te(e) : Z(e) ? ve(e) : ee(e) ? xe(e) : null, Te = (e) => ({
299
+ }, xe = (e) => Z(e) ? be(e) : ee(e) ? ve(e) : te(e) ? Ce(e) : null, be = (e) => ({
300
300
  type: "STREAM_TIMEOUT",
301
301
  streamId: e.streamId,
302
302
  timestamp: e.timestamp
@@ -304,7 +304,7 @@ const Se = (e) => {
304
304
  type: "STREAM_NOT_FOUND",
305
305
  streamId: e.streamId,
306
306
  timestamp: e.timestamp
307
- }), xe = (e) => ({
307
+ }), Ce = (e) => ({
308
308
  type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
309
309
  streamId: e.streamId,
310
310
  agentTaskId: e.agentTaskId,
@@ -312,31 +312,31 @@ const Se = (e) => {
312
312
  timestamp: e.timestamp,
313
313
  createdAt: e.createdAt,
314
314
  data: JSON.parse(e.data)
315
- }), Ce = (e) => {
316
- const t = J(), [n, r] = x(null), l = I(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
317
- return w(() => {
315
+ }), Me = (e) => {
316
+ const t = J(), [n, r] = v(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
317
+ return A(() => {
318
318
  if (!t.eventManager) return;
319
319
  const a = {
320
- onMessage: (s, o) => {
321
- var g, m, p;
322
- const d = Se(s);
323
- if (d)
324
- switch (d.type) {
320
+ onMessage: (d, o) => {
321
+ var g, m, f;
322
+ const c = ke(d);
323
+ if (c)
324
+ switch (c.type) {
325
325
  case "STREAM_TIMEOUT":
326
- (g = e == null ? void 0 : e.onStreamTimeout) == null || g.call(e, d);
326
+ (g = e == null ? void 0 : e.onStreamTimeout) == null || g.call(e, c);
327
327
  break;
328
328
  case "STREAM_NOT_FOUND":
329
- (m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e, d);
329
+ (m = e == null ? void 0 : e.onStreamNotFound) == null || m.call(e, c);
330
330
  break;
331
331
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
332
- (p = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || p.call(e, d);
332
+ (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, c);
333
333
  break;
334
334
  }
335
335
  },
336
- onError: (s) => {
336
+ onError: (d) => {
337
337
  var o;
338
338
  (o = e == null ? void 0 : e.onStreamError) == null || o.call(e, {
339
- streamId: s,
339
+ streamId: d,
340
340
  error: {
341
341
  code: "UnknownError",
342
342
  message: "Unknown error in useStream"
@@ -368,47 +368,62 @@ const Se = (e) => {
368
368
  },
369
369
  stream: n
370
370
  };
371
- }, tt = (e) => {
372
- const t = J(), [n, r] = x([]), l = I(/* @__PURE__ */ new Set()), u = I(/* @__PURE__ */ new Map()), { createStream: a } = Ce({
371
+ }, st = (e) => {
372
+ const t = J(), [n, r] = v([]), l = F(/* @__PURE__ */ new Set()), s = F(/* @__PURE__ */ new Map()), { createStream: a } = Me({
373
373
  onAgentTaskProgressItemUpdated: (o) => {
374
374
  var m;
375
375
  if (!l.current.has(o.agentTaskId)) return;
376
- const d = o.data;
377
- if (d.taskType === "StreamingChatCompletion" && d.eventType === "Completed" || d.taskType === "StructuredChatCompletion" && d.eventType === "Completed" || d.taskType === "MemoryChatCompletion" && d.eventType === "Completed") {
376
+ const c = o.data;
377
+ if (c.taskType === "StreamingChatCompletion" && c.eventType === "Completed" || c.taskType === "StructuredChatCompletion" && c.eventType === "Completed" || c.taskType === "MemoryChatCompletion" && c.eventType === "Completed" || c.taskType === "MemorySearch" && c.eventType === "Completed") {
378
+ const f = c.taskType === "MemorySearch" && c.eventType === "Completed";
378
379
  r(
379
- (h) => h.map(
380
- (k) => {
381
- var f;
382
- return ((f = k.confirmedData) == null ? void 0 : f.taskId) === o.agentTaskId ? { ...k, loading: !1 } : k;
380
+ f ? (T) => T.map((p) => {
381
+ var I;
382
+ if (((I = p.confirmedData) == null ? void 0 : I.taskId) !== o.agentTaskId)
383
+ return p;
384
+ const b = p.progressItems.some(
385
+ (C) => C.progressItemId === o.progressItemId
386
+ ) ? p.progressItems.map(
387
+ (C) => C.progressItemId === o.progressItemId ? o : C
388
+ ) : [...p.progressItems, o];
389
+ return {
390
+ ...p,
391
+ progressItems: b,
392
+ loading: !1
393
+ };
394
+ }) : (T) => T.map(
395
+ (p) => {
396
+ var k;
397
+ return ((k = p.confirmedData) == null ? void 0 : k.taskId) === o.agentTaskId ? { ...p, loading: !1 } : p;
383
398
  }
384
399
  )
385
400
  );
386
- const p = u.current.get(
401
+ const h = s.current.get(
387
402
  o.agentTaskId
388
403
  );
389
- p && (u.current.delete(o.agentTaskId), p(d));
404
+ h && (s.current.delete(o.agentTaskId), h(c));
390
405
  return;
391
406
  }
392
407
  (m = e.onAgentTaskProgressItemUpdated) == null || m.call(e, o), r(
393
- (p) => p.map((h) => {
394
- var b;
395
- if (((b = h.confirmedData) == null ? void 0 : b.taskId) !== o.agentTaskId)
408
+ (f) => f.map((h) => {
409
+ var k;
410
+ if (((k = h.confirmedData) == null ? void 0 : k.taskId) !== o.agentTaskId)
396
411
  return h;
397
- const f = h.progressItems.some(
398
- (T) => T.progressItemId === o.progressItemId
412
+ const p = h.progressItems.some(
413
+ (b) => b.progressItemId === o.progressItemId
399
414
  ) ? h.progressItems.map(
400
- (T) => T.progressItemId === o.progressItemId ? o : T
415
+ (b) => b.progressItemId === o.progressItemId ? o : b
401
416
  ) : [...h.progressItems, o];
402
- return { ...h, progressItems: f };
417
+ return { ...h, progressItems: p };
403
418
  })
404
419
  );
405
420
  },
406
421
  onStreamError: (o) => {
407
- var d;
408
- (d = e == null ? void 0 : e.onStreamError) == null || d.call(e, o), r((g) => {
409
- const m = g.find((p) => p.streamId === o.streamId);
422
+ var c;
423
+ (c = e == null ? void 0 : e.onStreamError) == null || c.call(e, o), r((g) => {
424
+ const m = g.find((f) => f.streamId === o.streamId);
410
425
  return m ? [
411
- ...g.filter((p) => p.streamId !== o.streamId),
426
+ ...g.filter((f) => f.streamId !== o.streamId),
412
427
  {
413
428
  ...m,
414
429
  loading: !1,
@@ -418,15 +433,15 @@ const Se = (e) => {
418
433
  });
419
434
  },
420
435
  onStreamNotFound: (o) => {
421
- var d;
422
- (d = e == null ? void 0 : e.onStreamNotFound) == null || d.call(e, o);
436
+ var c;
437
+ (c = e == null ? void 0 : e.onStreamNotFound) == null || c.call(e, o);
423
438
  },
424
439
  onStreamTimeout: (o) => {
425
- var d;
426
- (d = e == null ? void 0 : e.onStreamTimeout) == null || d.call(e, o);
440
+ var c;
441
+ (c = e == null ? void 0 : e.onStreamTimeout) == null || c.call(e, o);
427
442
  }
428
- }), c = H(
429
- async (o, d) => {
443
+ }), u = K(
444
+ async (o, c) => {
430
445
  const g = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, m = await a();
431
446
  if (m.type === "success") {
432
447
  r([
@@ -440,13 +455,13 @@ const Se = (e) => {
440
455
  params: o,
441
456
  progressItems: [],
442
457
  loading: !0,
443
- loadingText: d == null ? void 0 : d.loadingText
458
+ loadingText: c == null ? void 0 : c.loadingText
444
459
  }
445
460
  ]);
446
- const { clientToken: p } = await e.fetchCreateAgentTaskClientToken(o.type), h = await te({
461
+ const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(o.type), h = await ne({
447
462
  pk: t.fency.publishableKey,
448
463
  baseUrl: t.fency.baseUrl,
449
- clientToken: p,
464
+ clientToken: f,
450
465
  streamToken: m.stream.token,
451
466
  request: {
452
467
  streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
@@ -464,14 +479,20 @@ const Se = (e) => {
464
479
  language: o.language ?? "en",
465
480
  chunkLimit: o.chunkLimit ?? 10,
466
481
  memoryScanLimit: o.memoryScanLimit ?? 3
482
+ } : void 0,
483
+ memorySearchTask: o.type === "MemorySearch" ? {
484
+ query: o.query,
485
+ model: o.model,
486
+ language: o.language ?? "en",
487
+ chunkLimit: o.chunkLimit ?? 10
467
488
  } : void 0
468
489
  }
469
490
  });
470
491
  if (h.type === "success" && h.agentTask) {
471
492
  l.current.add(
472
493
  h.agentTask.id
473
- ), r((f) => [
474
- ...f.filter((b) => b.taskKey !== g),
494
+ ), r((p) => [
495
+ ...p.filter((k) => k.taskKey !== g),
475
496
  {
476
497
  taskKey: g,
477
498
  streamId: m.stream.id,
@@ -482,29 +503,29 @@ const Se = (e) => {
482
503
  params: o,
483
504
  progressItems: [],
484
505
  loading: !0,
485
- loadingText: d == null ? void 0 : d.loadingText,
506
+ loadingText: c == null ? void 0 : c.loadingText,
486
507
  confirmedData: {
487
508
  taskId: h.agentTask.id,
488
509
  createdAt: h.agentTask.createdAt
489
510
  }
490
511
  }
491
512
  ]);
492
- const k = await new Promise((f) => {
493
- u.current.set(
513
+ const T = await new Promise((p) => {
514
+ s.current.set(
494
515
  h.agentTask.id,
495
- f
516
+ p
496
517
  );
497
518
  });
498
519
  return {
499
520
  type: "success",
500
521
  streamId: m.stream.id,
501
522
  agentTaskId: h.agentTask.id,
502
- response: k
523
+ response: T
503
524
  };
504
525
  } else {
505
526
  if (h.type === "error")
506
- return r((k) => [
507
- ...k.filter((f) => f.taskKey !== g),
527
+ return r((T) => [
528
+ ...T.filter((p) => p.taskKey !== g),
508
529
  {
509
530
  taskKey: g,
510
531
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -513,7 +534,7 @@ const Se = (e) => {
513
534
  error: h.error,
514
535
  progressItems: [],
515
536
  loading: !1,
516
- loadingText: d == null ? void 0 : d.loadingText,
537
+ loadingText: c == null ? void 0 : c.loadingText,
517
538
  confirmedData: null
518
539
  }
519
540
  ]), {
@@ -521,26 +542,26 @@ const Se = (e) => {
521
542
  error: h.error
522
543
  };
523
544
  {
524
- const k = {
545
+ const T = {
525
546
  message: "No response received",
526
547
  code: "UnknownError"
527
548
  };
528
- return r((f) => [
529
- ...f.filter((b) => b.taskKey !== g),
549
+ return r((p) => [
550
+ ...p.filter((k) => k.taskKey !== g),
530
551
  {
531
552
  taskKey: g,
532
553
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
533
554
  streamId: m.stream.id,
534
- error: k,
555
+ error: T,
535
556
  params: o,
536
557
  progressItems: [],
537
558
  loading: !1,
538
- loadingText: d == null ? void 0 : d.loadingText,
559
+ loadingText: c == null ? void 0 : c.loadingText,
539
560
  confirmedData: null
540
561
  }
541
562
  ]), {
542
563
  type: "error",
543
- error: k
564
+ error: T
544
565
  };
545
566
  }
546
567
  }
@@ -548,55 +569,55 @@ const Se = (e) => {
548
569
  return console.error(m.error), m;
549
570
  },
550
571
  [t, n, a]
551
- ), s = K(() => {
572
+ ), d = W(() => {
552
573
  if (n.length !== 0)
553
- return [...n].sort((o, d) => new Date(d.triggeredAt).getTime() - new Date(o.triggeredAt).getTime())[0];
574
+ return [...n].sort((o, c) => new Date(c.triggeredAt).getTime() - new Date(o.triggeredAt).getTime())[0];
554
575
  }, [n]);
555
- return w(() => () => {
556
- l.current.clear(), u.current.clear();
576
+ return A(() => () => {
577
+ l.current.clear(), s.current.clear();
557
578
  }, []), {
558
579
  agentTasks: n,
559
- createAgentTask: c,
560
- latest: s
580
+ createAgentTask: u,
581
+ latest: d
561
582
  };
562
583
  };
563
584
  function Ee(e) {
564
585
  return e.progressItems.map((t, n) => {
565
586
  const r = e.progressItems[n + 1], l = r != null;
566
- let u;
587
+ let s;
567
588
  if (r != null && r.createdAt) {
568
- const a = new Date(t.createdAt).getTime(), c = new Date(r.createdAt).getTime();
569
- u = Math.round((c - a) / 1e3);
589
+ const a = new Date(t.createdAt).getTime(), u = new Date(r.createdAt).getTime();
590
+ s = Math.round((u - a) / 1e3);
570
591
  }
571
592
  return {
572
593
  item: t,
573
594
  completed: l,
574
595
  isLatest: n === e.progressItems.length - 1,
575
- durationSeconds: u
596
+ durationSeconds: s
576
597
  };
577
598
  });
578
599
  }
579
- function P({
600
+ function D({
580
601
  text: e,
581
602
  duration: t = 2,
582
603
  delay: n = 0,
583
604
  repeat: r = !0,
584
605
  repeatDelay: l = 0.5,
585
- className: u,
606
+ className: s,
586
607
  startOnView: a = !1,
587
- once: c = !1,
588
- inViewMargin: s,
608
+ once: u = !1,
609
+ inViewMargin: d,
589
610
  spread: o = 2,
590
- color: d = "#999",
611
+ color: c = "#999",
591
612
  shimmerColor: g = "#000",
592
613
  direction: m = "fromBottom"
593
614
  }) {
594
- const p = I(null), h = oe(p, { once: c, margin: s }), k = K(() => e.length * o, [e, o]), f = !a || h, b = m === "fromBottom" ? "100% center" : "-100% center", T = m === "fromBottom" ? "0% center" : "200% center";
615
+ const f = F(null), h = ie(f, { once: u, margin: d }), T = W(() => e.length * o, [e, o]), p = !a || h, k = m === "fromBottom" ? "100% center" : "-100% center", b = m === "fromBottom" ? "0% center" : "200% center";
595
616
  return /* @__PURE__ */ i(
596
- S.span,
617
+ x.span,
597
618
  {
598
- ref: p,
599
- className: u,
619
+ ref: f,
620
+ className: s,
600
621
  style: {
601
622
  position: "relative",
602
623
  display: "inline-block",
@@ -606,18 +627,18 @@ function P({
606
627
  color: "transparent",
607
628
  WebkitTextFillColor: "transparent",
608
629
  backgroundRepeat: "no-repeat, padding-box",
609
- "--spread": `${k}px`,
610
- "--base-color": d,
630
+ "--spread": `${T}px`,
631
+ "--base-color": c,
611
632
  "--shimmer-color": g,
612
633
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
613
634
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
614
635
  },
615
636
  initial: {
616
- backgroundPosition: b,
637
+ backgroundPosition: k,
617
638
  opacity: 0
618
639
  },
619
- animate: f ? {
620
- backgroundPosition: T,
640
+ animate: p ? {
641
+ backgroundPosition: b,
621
642
  opacity: 1
622
643
  } : {},
623
644
  transition: {
@@ -637,7 +658,7 @@ function P({
637
658
  }
638
659
  );
639
660
  }
640
- function Me(e, t) {
661
+ function Ie(e, t) {
641
662
  const n = e.item.data;
642
663
  if (n.eventType === "Error" && "message" in n)
643
664
  return t.error;
@@ -649,6 +670,13 @@ function Me(e, t) {
649
670
  if (n.eventType === "Json") return t.generating;
650
671
  if (n.eventType === "Completed") return t.completed;
651
672
  }
673
+ if (n.taskType === "MemorySearch")
674
+ switch (n.eventType) {
675
+ case "SearchMemoryTypes":
676
+ return t.searchingMemoryTypes;
677
+ case "Completed":
678
+ return t.completed;
679
+ }
652
680
  if (n.taskType === "MemoryChatCompletion")
653
681
  switch (n.eventType) {
654
682
  case "Text":
@@ -675,9 +703,9 @@ function Me(e, t) {
675
703
  const we = ({ progressViewItems: e, t }) => {
676
704
  const n = e[e.length - 1];
677
705
  if (!n) return null;
678
- const r = Me(n, t);
706
+ const r = Ie(n, t);
679
707
  return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(q, { mode: "wait", children: /* @__PURE__ */ i(
680
- S.div,
708
+ x.div,
681
709
  {
682
710
  initial: { opacity: 0, y: 10 },
683
711
  animate: { opacity: 1, y: 0 },
@@ -691,7 +719,7 @@ const we = ({ progressViewItems: e, t }) => {
691
719
  children: r
692
720
  }
693
721
  ) : /* @__PURE__ */ i(
694
- P,
722
+ D,
695
723
  {
696
724
  text: r,
697
725
  className: "simple-mode-title",
@@ -704,7 +732,7 @@ const we = ({ progressViewItems: e, t }) => {
704
732
  },
705
733
  n.item.progressItemId
706
734
  ) }) });
707
- }, Y = {
735
+ }, V = {
708
736
  'code[class*="language-"]': {
709
737
  color: "#f8f8f2",
710
738
  background: "none",
@@ -855,23 +883,23 @@ const we = ({ progressViewItems: e, t }) => {
855
883
  italic: {
856
884
  fontStyle: "italic"
857
885
  }
858
- }, N = ({
886
+ }, j = ({
859
887
  text: e
860
888
  }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
861
- S.div,
889
+ x.div,
862
890
  {
863
891
  className: "fency-markdown-body-raw",
864
892
  initial: { opacity: 0, y: -10 },
865
893
  animate: { opacity: 1, y: 0 },
866
894
  transition: { duration: 0.3, delay: 0 },
867
895
  children: /* @__PURE__ */ i(
868
- ie,
896
+ ae,
869
897
  {
870
- remarkPlugins: [ae],
898
+ remarkPlugins: [se],
871
899
  components: {
872
900
  code(t) {
873
- const { children: n, className: r, node: l, ref: u, ...a } = t, c = /language-(\w+)/.exec(r || "");
874
- return c ? (
901
+ const { children: n, className: r, node: l, ref: s, ...a } = t, u = /language-(\w+)/.exec(r || "");
902
+ return u ? (
875
903
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
876
904
  /* @__PURE__ */ i(
877
905
  G,
@@ -879,8 +907,8 @@ const we = ({ progressViewItems: e, t }) => {
879
907
  ...a,
880
908
  PreTag: "div",
881
909
  children: String(n).replace(/\n$/, ""),
882
- language: c[1],
883
- style: Y
910
+ language: u[1],
911
+ style: V
884
912
  }
885
913
  )
886
914
  ) : /* @__PURE__ */ i("code", { ...a, className: r, children: String(n) });
@@ -890,18 +918,18 @@ const we = ({ progressViewItems: e, t }) => {
890
918
  }
891
919
  )
892
920
  }
893
- ) }), Ie = ({ data: e }) => {
921
+ ) }), Ae = ({ data: e }) => {
894
922
  const t = JSON.stringify(e.json, null, 2);
895
923
  return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
896
- S.div,
924
+ x.div,
897
925
  {
898
926
  initial: { opacity: 0, y: -10 },
899
927
  animate: { opacity: 1, y: 0 },
900
928
  transition: { duration: 0.3, delay: 0 },
901
- children: /* @__PURE__ */ i(G, { language: "json", style: Y, PreTag: "div", children: t })
929
+ children: /* @__PURE__ */ i(G, { language: "json", style: V, PreTag: "div", children: t })
902
930
  }
903
931
  ) });
904
- }, Ae = {
932
+ }, Fe = {
905
933
  en: {
906
934
  error: "Error",
907
935
  streaming: "Streaming...",
@@ -938,6 +966,14 @@ const we = ({ progressViewItems: e, t }) => {
938
966
  chunksFound: "{n} chunks found",
939
967
  chunksRetrieved: "Chunks retrieved",
940
968
  scoreLabel: "score: {n}",
969
+ searchingMemoryTypes: "Searching memory types...",
970
+ searchingInMemoriesOfType: "Searching in memories of type '{name}'",
971
+ memorySearchTypeResultSummary: "Found {count} results. Highest score was {score}",
972
+ memorySearchTypeResultSummaryOne: "Found 1 result. Highest score was {score}",
973
+ resultsHeading: "Results",
974
+ viewButton: "View",
975
+ pagesLabel: "Pages",
976
+ pagesNotAvailable: "—",
941
977
  and: "and"
942
978
  },
943
979
  no: {
@@ -976,19 +1012,27 @@ const we = ({ progressViewItems: e, t }) => {
976
1012
  chunksFound: "{n} deler funnet",
977
1013
  chunksRetrieved: "Deler hentet",
978
1014
  scoreLabel: "poeng: {n}",
1015
+ searchingMemoryTypes: "Søker i minnetyper...",
1016
+ searchingInMemoriesOfType: "Søker i minner av typen '{name}'",
1017
+ memorySearchTypeResultSummary: "Fant {count} resultater. Høyeste poengsum var {score}",
1018
+ memorySearchTypeResultSummaryOne: "Fant 1 resultat. Høyeste poengsum var {score}",
1019
+ resultsHeading: "Resultater",
1020
+ viewButton: "Vis",
1021
+ pagesLabel: "Sider",
1022
+ pagesNotAvailable: "—",
979
1023
  and: "og"
980
1024
  }
981
1025
  };
982
- function Fe(e) {
983
- return Ae[e];
1026
+ function De(e) {
1027
+ return Fe[e];
984
1028
  }
985
- function v(e, t) {
1029
+ function S(e, t) {
986
1030
  return Object.entries(t).reduce(
987
1031
  (n, [r, l]) => n.replace(`{${r}}`, String(l)),
988
1032
  e
989
1033
  );
990
1034
  }
991
- function B(e, t) {
1035
+ function H(e, t) {
992
1036
  const n = e.map((r) => `'${r}'`);
993
1037
  if (t != null && n.length >= 2) {
994
1038
  const r = n.pop();
@@ -996,30 +1040,30 @@ function B(e, t) {
996
1040
  }
997
1041
  return n.join(", ");
998
1042
  }
999
- const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1000
- const [l, u] = x(!1), c = (e.memories ?? []).map((f) => f.memoryTitle), s = c.length > 0, o = s && c.length > L, d = o && !l ? c.slice(0, L) : c, g = c.length - L, m = !o || l, p = `${r.searchingFor}'${e.queryDescription}'`, h = s ? `${r.searchingIn}${B(
1001
- d,
1043
+ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1044
+ const [l, s] = v(!1), u = (e.memories ?? []).map((p) => p.memoryTitle), d = u.length > 0, o = d && u.length > L, c = o && !l ? u.slice(0, L) : u, g = u.length - L, m = !o || l, f = `${r.searchingFor}'${e.queryDescription}'`, h = d ? `${r.searchingIn}${H(
1045
+ c,
1002
1046
  m ? r.and : void 0
1003
- )}` : "", k = s ? `${p}${h}` : `${r.searchingPrefix}${e.queryDescription}`;
1047
+ )}` : "", T = d ? `${f}${h}` : `${r.searchingPrefix}${e.queryDescription}`;
1004
1048
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1005
1049
  /* @__PURE__ */ i(
1006
- S.div,
1050
+ x.div,
1007
1051
  {
1008
1052
  style: { color: "#666" },
1009
1053
  initial: { opacity: 0, y: -10 },
1010
1054
  animate: { opacity: 1, y: 0 },
1011
1055
  transition: { duration: 0.3, delay: 0 },
1012
1056
  children: t && !n && !o ? /* @__PURE__ */ i(
1013
- P,
1057
+ D,
1014
1058
  {
1015
- text: k,
1059
+ text: T,
1016
1060
  duration: 2.5,
1017
1061
  repeat: !0,
1018
1062
  color: "#999",
1019
1063
  shimmerColor: "#000"
1020
1064
  }
1021
1065
  ) : /* @__PURE__ */ y(E, { children: [
1022
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: s ? /* @__PURE__ */ y(E, { children: [
1066
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: d ? /* @__PURE__ */ y(E, { children: [
1023
1067
  r.searchingFor,
1024
1068
  /* @__PURE__ */ y("span", { style: { fontWeight: 600 }, children: [
1025
1069
  "'",
@@ -1034,7 +1078,7 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1034
1078
  "button",
1035
1079
  {
1036
1080
  type: "button",
1037
- onClick: () => u(!0),
1081
+ onClick: () => s(!0),
1038
1082
  style: {
1039
1083
  background: "none",
1040
1084
  border: "none",
@@ -1046,7 +1090,7 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1046
1090
  textDecoration: "underline",
1047
1091
  fontFamily: "inherit"
1048
1092
  },
1049
- children: v(r.moreMemories, {
1093
+ children: S(r.moreMemories, {
1050
1094
  n: g
1051
1095
  })
1052
1096
  }
@@ -1058,7 +1102,7 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1058
1102
  "button",
1059
1103
  {
1060
1104
  type: "button",
1061
- onClick: () => u(!1),
1105
+ onClick: () => s(!1),
1062
1106
  style: {
1063
1107
  background: "none",
1064
1108
  border: "none",
@@ -1086,18 +1130,18 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1086
1130
  marginTop: "4px",
1087
1131
  fontStyle: "italic"
1088
1132
  },
1089
- children: v(r.tookSeconds, { n })
1133
+ children: S(r.tookSeconds, { n })
1090
1134
  }
1091
1135
  )
1092
1136
  ] });
1093
1137
  }, O = 5, Pe = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1094
- const [l, u] = x(!1), a = e.titles, c = a.length > 0, s = c && a.length > O, o = s && !l ? a.slice(0, O) : a, d = a.length - O, g = !s || l, m = c ? `${r.findingMemoriesIn}${B(
1138
+ const [l, s] = v(!1), a = e.titles, u = a.length > 0, d = u && a.length > O, o = d && !l ? a.slice(0, O) : a, c = a.length - O, g = !d || l, m = u ? `${r.findingMemoriesIn}${H(
1095
1139
  o,
1096
1140
  g ? r.and : void 0
1097
1141
  )}` : r.findingMemories;
1098
1142
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1099
1143
  /* @__PURE__ */ i(
1100
- S.div,
1144
+ x.div,
1101
1145
  {
1102
1146
  style: {
1103
1147
  color: "#666"
@@ -1105,8 +1149,8 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1105
1149
  initial: { opacity: 0, y: -10 },
1106
1150
  animate: { opacity: 1, y: 0 },
1107
1151
  transition: { duration: 0.3, delay: 0 },
1108
- children: t && !n && !s ? /* @__PURE__ */ i(
1109
- P,
1152
+ children: t && !n && !d ? /* @__PURE__ */ i(
1153
+ D,
1110
1154
  {
1111
1155
  text: m,
1112
1156
  duration: 2.5,
@@ -1116,13 +1160,13 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1116
1160
  }
1117
1161
  ) : /* @__PURE__ */ y(E, { children: [
1118
1162
  /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m }),
1119
- s && !l && /* @__PURE__ */ y(E, { children: [
1163
+ d && !l && /* @__PURE__ */ y(E, { children: [
1120
1164
  " ",
1121
1165
  /* @__PURE__ */ i(
1122
1166
  "button",
1123
1167
  {
1124
1168
  type: "button",
1125
- onClick: () => u(!0),
1169
+ onClick: () => s(!0),
1126
1170
  style: {
1127
1171
  background: "none",
1128
1172
  border: "none",
@@ -1134,19 +1178,19 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1134
1178
  textDecoration: "underline",
1135
1179
  fontFamily: "inherit"
1136
1180
  },
1137
- children: v(r.moreMemories, {
1138
- n: d
1181
+ children: S(r.moreMemories, {
1182
+ n: c
1139
1183
  })
1140
1184
  }
1141
1185
  )
1142
1186
  ] }),
1143
- s && l && /* @__PURE__ */ y(E, { children: [
1187
+ d && l && /* @__PURE__ */ y(E, { children: [
1144
1188
  " ",
1145
1189
  /* @__PURE__ */ i(
1146
1190
  "button",
1147
1191
  {
1148
1192
  type: "button",
1149
- onClick: () => u(!1),
1193
+ onClick: () => s(!1),
1150
1194
  style: {
1151
1195
  background: "none",
1152
1196
  border: "none",
@@ -1174,17 +1218,17 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1174
1218
  marginTop: "4px",
1175
1219
  fontStyle: "italic"
1176
1220
  },
1177
- children: v(r.tookSeconds, { n })
1221
+ children: S(r.tookSeconds, { n })
1178
1222
  }
1179
1223
  )
1180
1224
  ] });
1181
- }, $ = 5, Re = ({ data: e, t }) => {
1182
- const [n, r] = x(!1), u = e.memories.map((p) => p.memoryTitle), a = u.length > 0, c = a && u.length > $, s = c && !n ? u.slice(0, $) : u, o = u.length - $, d = !c || n, g = u.length === 1 ? t.memoryFound : t.memoriesFoundPrefix, m = a ? `${g}${B(
1183
- s,
1184
- d ? t.and : void 0
1225
+ }, z = 5, Le = ({ data: e, t }) => {
1226
+ const [n, r] = v(!1), s = e.memories.map((f) => f.memoryTitle), a = s.length > 0, u = a && s.length > z, d = u && !n ? s.slice(0, z) : s, o = s.length - z, c = !u || n, g = s.length === 1 ? t.memoryFound : t.memoriesFoundPrefix, m = a ? `${g}${H(
1227
+ d,
1228
+ c ? t.and : void 0
1185
1229
  )}` : t.memoriesFound;
1186
1230
  return /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1187
- S.div,
1231
+ x.div,
1188
1232
  {
1189
1233
  style: { color: "#666" },
1190
1234
  initial: { opacity: 0, y: -10 },
@@ -1192,7 +1236,7 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1192
1236
  transition: { duration: 0.3, delay: 0 },
1193
1237
  children: /* @__PURE__ */ y(E, { children: [
1194
1238
  /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m }),
1195
- c && !n && /* @__PURE__ */ y(E, { children: [
1239
+ u && !n && /* @__PURE__ */ y(E, { children: [
1196
1240
  " ",
1197
1241
  /* @__PURE__ */ i(
1198
1242
  "button",
@@ -1210,13 +1254,13 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1210
1254
  textDecoration: "underline",
1211
1255
  fontFamily: "inherit"
1212
1256
  },
1213
- children: v(t.moreMemories, {
1257
+ children: S(t.moreMemories, {
1214
1258
  n: o
1215
1259
  })
1216
1260
  }
1217
1261
  )
1218
1262
  ] }),
1219
- c && n && /* @__PURE__ */ y(E, { children: [
1263
+ u && n && /* @__PURE__ */ y(E, { children: [
1220
1264
  " ",
1221
1265
  /* @__PURE__ */ i(
1222
1266
  "button",
@@ -1241,11 +1285,11 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1241
1285
  ] })
1242
1286
  }
1243
1287
  ) });
1244
- }, Le = ({ isLatest: e = !1, durationSeconds: t, t: n }) => {
1288
+ }, Oe = ({ isLatest: e = !1, durationSeconds: t, t: n }) => {
1245
1289
  const r = n.addingSources;
1246
1290
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1247
1291
  /* @__PURE__ */ i(
1248
- S.div,
1292
+ x.div,
1249
1293
  {
1250
1294
  style: {
1251
1295
  display: "flex",
@@ -1257,7 +1301,7 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1257
1301
  animate: { opacity: 1, y: 0 },
1258
1302
  transition: { duration: 0.3, delay: 0 },
1259
1303
  children: e && !t ? /* @__PURE__ */ i(
1260
- P,
1304
+ D,
1261
1305
  {
1262
1306
  text: r,
1263
1307
  duration: 2.5,
@@ -1277,26 +1321,26 @@ const L = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1277
1321
  marginTop: "4px",
1278
1322
  fontStyle: "italic"
1279
1323
  },
1280
- children: v(n.tookSeconds, { n: t })
1324
+ children: S(n.tookSeconds, { n: t })
1281
1325
  }
1282
1326
  )
1283
1327
  ] });
1284
1328
  };
1285
- function Oe(e, t) {
1329
+ function ze(e, t) {
1286
1330
  if (e.length === 0) return "";
1287
1331
  if (e.length === 1)
1288
- return v(t.pageSingle, { n: e[0] });
1332
+ return S(t.pageSingle, { n: e[0] });
1289
1333
  if (e.length === 2)
1290
- return v(t.pageTwo, {
1334
+ return S(t.pageTwo, {
1291
1335
  a: e[0],
1292
1336
  b: e[1]
1293
1337
  });
1294
1338
  const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
1295
- return v(t.pageMultiple, { list: r, n });
1339
+ return S(t.pageMultiple, { list: r, n });
1296
1340
  }
1297
1341
  const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1298
1342
  /* @__PURE__ */ i(
1299
- S.div,
1343
+ x.div,
1300
1344
  {
1301
1345
  style: {
1302
1346
  marginBottom: "10px",
@@ -1313,7 +1357,7 @@ const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ y("div", { s
1313
1357
  }
1314
1358
  ),
1315
1359
  /* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: n.noSources }) : e.sources.map((r, l) => /* @__PURE__ */ i(
1316
- ze,
1360
+ Be,
1317
1361
  {
1318
1362
  source: r,
1319
1363
  index: l,
@@ -1322,22 +1366,22 @@ const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ y("div", { s
1322
1366
  },
1323
1367
  r.memoryId
1324
1368
  )) })
1325
- ] }), ze = ({
1369
+ ] }), Be = ({
1326
1370
  source: e,
1327
1371
  index: t,
1328
1372
  onSourceClick: n,
1329
1373
  t: r
1330
1374
  }) => {
1331
- const [l, u] = x(!1), a = !!n, c = e.pageNumbers ?? [], s = Oe(c, r);
1375
+ const [l, s] = v(!1), a = !!n, u = e.pageNumbers ?? [], d = ze(u, r);
1332
1376
  return /* @__PURE__ */ y(
1333
- S.div,
1377
+ x.div,
1334
1378
  {
1335
1379
  initial: { opacity: 0, scale: 0.9 },
1336
1380
  animate: { opacity: 1, scale: 1 },
1337
1381
  transition: { duration: 0.25, delay: t * 0.05 },
1338
1382
  onClick: a ? () => n(e.memoryId) : void 0,
1339
- onMouseEnter: a ? () => u(!0) : void 0,
1340
- onMouseLeave: a ? () => u(!1) : void 0,
1383
+ onMouseEnter: a ? () => s(!0) : void 0,
1384
+ onMouseLeave: a ? () => s(!1) : void 0,
1341
1385
  style: {
1342
1386
  display: "inline-flex",
1343
1387
  flexDirection: "column",
@@ -1352,11 +1396,11 @@ const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ y("div", { s
1352
1396
  },
1353
1397
  children: [
1354
1398
  /* @__PURE__ */ i("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1355
- s && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: s })
1399
+ d && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: d })
1356
1400
  ]
1357
1401
  }
1358
1402
  );
1359
- }, j = ({
1403
+ }, B = ({
1360
1404
  color: e = "#78b13f",
1361
1405
  size: t = 24,
1362
1406
  borderWidth: n = 7
@@ -1375,15 +1419,15 @@ const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ y("div", { s
1375
1419
  }
1376
1420
  }
1377
1421
  );
1378
- }, Be = ({
1422
+ }, Y = ({
1379
1423
  color: e = "#333",
1380
1424
  size: t = 32,
1381
1425
  lineWidth: n = 2
1382
1426
  }) => {
1383
- const r = t + 1, l = (t - n) / 2, u = (t - r) / 2, a = {
1427
+ const r = t + 1, l = (t - n) / 2, s = (t - r) / 2, a = {
1384
1428
  position: "absolute",
1385
1429
  left: l,
1386
- top: u,
1430
+ top: s,
1387
1431
  width: n,
1388
1432
  height: r,
1389
1433
  backgroundColor: e
@@ -1420,26 +1464,26 @@ const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ y("div", { s
1420
1464
  }
1421
1465
  );
1422
1466
  };
1423
- function Ue({
1467
+ function We({
1424
1468
  memory: e,
1425
1469
  completed: t
1426
1470
  }) {
1427
- return e.error != null ? /* @__PURE__ */ i(Be, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(j, { color: "#999", size: 15, borderWidth: 2 }) : t ? /* @__PURE__ */ i(j, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1471
+ return e.error != null ? /* @__PURE__ */ i(Y, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(B, { color: "#999", size: 15, borderWidth: 2 }) : t ? /* @__PURE__ */ i(B, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1428
1472
  }
1429
- const W = 80;
1430
- function _e({
1473
+ const N = 80;
1474
+ function He({
1431
1475
  memory: e,
1432
1476
  completed: t,
1433
1477
  t: n
1434
1478
  }) {
1435
- const [r, l] = x(!1), u = e.result ?? e.error, a = u != null && u.length > W, c = u != null ? r || !a ? u : `${u.slice(0, W)}...` : void 0, s = a, o = e.error != null;
1479
+ const [r, l] = v(!1), s = e.result ?? e.error, a = s != null && s.length > N, u = s != null ? r || !a ? s : `${s.slice(0, N)}...` : void 0, d = a, o = e.error != null;
1436
1480
  return /* @__PURE__ */ y(
1437
- S.div,
1481
+ x.div,
1438
1482
  {
1439
1483
  initial: { opacity: 0 },
1440
1484
  animate: { opacity: 1 },
1441
1485
  transition: { duration: 0.25 },
1442
- onClick: s ? () => l((d) => !d) : void 0,
1486
+ onClick: d ? () => l((c) => !c) : void 0,
1443
1487
  style: {
1444
1488
  paddingTop: "12px",
1445
1489
  paddingBottom: "12px",
@@ -1449,7 +1493,7 @@ function _e({
1449
1493
  alignItems: "center",
1450
1494
  gap: "10px",
1451
1495
  minWidth: 0,
1452
- cursor: s ? "pointer" : "default"
1496
+ cursor: d ? "pointer" : "default"
1453
1497
  },
1454
1498
  children: [
1455
1499
  /* @__PURE__ */ i(
@@ -1462,7 +1506,7 @@ function _e({
1462
1506
  flexShrink: 0,
1463
1507
  width: 32
1464
1508
  },
1465
- children: /* @__PURE__ */ i(Ue, { memory: e, completed: t })
1509
+ children: /* @__PURE__ */ i(We, { memory: e, completed: t })
1466
1510
  }
1467
1511
  ),
1468
1512
  /* @__PURE__ */ y(
@@ -1482,7 +1526,7 @@ function _e({
1482
1526
  children: e.memoryTitle
1483
1527
  }
1484
1528
  ),
1485
- c != null && /* @__PURE__ */ i(
1529
+ u != null && /* @__PURE__ */ i(
1486
1530
  "span",
1487
1531
  {
1488
1532
  style: {
@@ -1491,10 +1535,10 @@ function _e({
1491
1535
  lineHeight: 1.4,
1492
1536
  whiteSpace: r ? "pre-wrap" : void 0
1493
1537
  },
1494
- children: c
1538
+ children: u
1495
1539
  }
1496
1540
  ),
1497
- s && /* @__PURE__ */ i(
1541
+ d && /* @__PURE__ */ i(
1498
1542
  "span",
1499
1543
  {
1500
1544
  style: {
@@ -1512,8 +1556,8 @@ function _e({
1512
1556
  }
1513
1557
  );
1514
1558
  }
1515
- const Ne = ({ data: e, completed: t, t: n }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((r) => /* @__PURE__ */ i(
1516
- _e,
1559
+ const Ue = ({ data: e, completed: t, t: n }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((r) => /* @__PURE__ */ i(
1560
+ He,
1517
1561
  {
1518
1562
  memory: r,
1519
1563
  completed: t,
@@ -1521,31 +1565,31 @@ const Ne = ({ data: e, completed: t, t: n }) => /* @__PURE__ */ i("div", { style
1521
1565
  },
1522
1566
  r.memoryId
1523
1567
  )) });
1524
- function je(e, t) {
1568
+ function _e(e, t) {
1525
1569
  if (e.length === 0) return "";
1526
1570
  if (e.length === 1)
1527
- return v(t.pageSingle, { n: e[0] });
1571
+ return S(t.pageSingle, { n: e[0] });
1528
1572
  if (e.length === 2)
1529
- return v(t.pageTwo, {
1573
+ return S(t.pageTwo, {
1530
1574
  a: e[0],
1531
1575
  b: e[1]
1532
1576
  });
1533
1577
  const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
1534
- return v(t.pageMultiple, { list: r, n });
1578
+ return S(t.pageMultiple, { list: r, n });
1535
1579
  }
1536
- function We(e, t) {
1537
- return e === 1 ? t.chunkFound : v(t.chunksFound, { n: e });
1580
+ function je(e, t) {
1581
+ return e === 1 ? t.chunkFound : S(t.chunksFound, { n: e });
1538
1582
  }
1539
- const He = ({ data: e, t }) => {
1540
- const [n, r] = x(!1), l = e.chunks.length, u = l > 0;
1583
+ const Ne = ({ data: e, t }) => {
1584
+ const [n, r] = v(!1), l = e.chunks.length, s = l > 0;
1541
1585
  return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1542
1586
  /* @__PURE__ */ y(
1543
- S.div,
1587
+ x.div,
1544
1588
  {
1545
1589
  initial: { opacity: 0 },
1546
1590
  animate: { opacity: 1 },
1547
1591
  transition: { duration: 0.25 },
1548
- onClick: u ? () => r((a) => !a) : void 0,
1592
+ onClick: s ? () => r((a) => !a) : void 0,
1549
1593
  style: {
1550
1594
  paddingBottom: n ? "12px" : 0,
1551
1595
  borderBottom: n ? "1px solid #eee" : void 0,
@@ -1553,12 +1597,12 @@ const He = ({ data: e, t }) => {
1553
1597
  flexDirection: "column",
1554
1598
  gap: "4px",
1555
1599
  minWidth: 0,
1556
- cursor: u ? "pointer" : "default"
1600
+ cursor: s ? "pointer" : "default"
1557
1601
  },
1558
1602
  children: [
1559
1603
  /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1560
- /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: We(l, t) }),
1561
- u && /* @__PURE__ */ i(
1604
+ /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: je(l, t) }),
1605
+ s && /* @__PURE__ */ i(
1562
1606
  "span",
1563
1607
  {
1564
1608
  style: {
@@ -1572,8 +1616,8 @@ const He = ({ data: e, t }) => {
1572
1616
  ]
1573
1617
  }
1574
1618
  ),
1575
- n && u && /* @__PURE__ */ i(
1576
- S.div,
1619
+ n && s && /* @__PURE__ */ i(
1620
+ x.div,
1577
1621
  {
1578
1622
  initial: { opacity: 0, height: 0 },
1579
1623
  animate: { opacity: 1, height: "auto" },
@@ -1586,8 +1630,8 @@ const He = ({ data: e, t }) => {
1586
1630
  flexDirection: "column",
1587
1631
  gap: 8
1588
1632
  },
1589
- children: e.chunks.map((a, c) => {
1590
- const s = a.pageNumbers ?? [], o = je(s, t);
1633
+ children: e.chunks.map((a, u) => {
1634
+ const d = a.pageNumbers ?? [], o = _e(d, t);
1591
1635
  return /* @__PURE__ */ y(
1592
1636
  "div",
1593
1637
  {
@@ -1622,7 +1666,7 @@ const He = ({ data: e, t }) => {
1622
1666
  },
1623
1667
  children: [
1624
1668
  o && /* @__PURE__ */ i("span", { children: o }),
1625
- /* @__PURE__ */ i("span", { children: v(t.scoreLabel, {
1669
+ /* @__PURE__ */ i("span", { children: S(t.scoreLabel, {
1626
1670
  n: a.score
1627
1671
  }) })
1628
1672
  ]
@@ -1630,14 +1674,284 @@ const He = ({ data: e, t }) => {
1630
1674
  )
1631
1675
  ]
1632
1676
  },
1633
- c
1677
+ u
1634
1678
  );
1635
1679
  })
1636
1680
  }
1637
1681
  )
1638
1682
  ] });
1639
- }, Ke = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1640
- S.div,
1683
+ };
1684
+ function Ke({ item: e }) {
1685
+ return e.error != null ? /* @__PURE__ */ i(Y, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(B, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1686
+ }
1687
+ function qe(e, t) {
1688
+ return S(t.searchingInMemoriesOfType, {
1689
+ name: e.memoryTypeName
1690
+ });
1691
+ }
1692
+ function Ge({
1693
+ item: e,
1694
+ t,
1695
+ showShimmerForPrimary: n
1696
+ }) {
1697
+ const r = e.result != null, l = e.error != null, s = qe(e, t);
1698
+ return /* @__PURE__ */ y(
1699
+ x.div,
1700
+ {
1701
+ initial: { opacity: 0 },
1702
+ animate: { opacity: 1 },
1703
+ transition: { duration: 0.25 },
1704
+ style: {
1705
+ paddingTop: "12px",
1706
+ paddingBottom: "12px",
1707
+ borderBottom: "1px solid #eee",
1708
+ display: "flex",
1709
+ flexDirection: "row",
1710
+ alignItems: "flex-start",
1711
+ gap: "10px",
1712
+ minWidth: 0
1713
+ },
1714
+ children: [
1715
+ /* @__PURE__ */ i(
1716
+ "div",
1717
+ {
1718
+ style: {
1719
+ display: "flex",
1720
+ alignItems: "center",
1721
+ justifyContent: "center",
1722
+ flexShrink: 0,
1723
+ width: 32,
1724
+ paddingTop: 2
1725
+ },
1726
+ children: /* @__PURE__ */ i(Ke, { item: e })
1727
+ }
1728
+ ),
1729
+ /* @__PURE__ */ y(
1730
+ "div",
1731
+ {
1732
+ style: {
1733
+ display: "flex",
1734
+ flexDirection: "column",
1735
+ gap: "4px",
1736
+ minWidth: 0,
1737
+ flex: 1
1738
+ },
1739
+ children: [
1740
+ /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !r && !l && n ? /* @__PURE__ */ i(
1741
+ D,
1742
+ {
1743
+ text: s,
1744
+ duration: 2.5,
1745
+ repeat: !0,
1746
+ color: "#999",
1747
+ shimmerColor: "#000"
1748
+ }
1749
+ ) : s }),
1750
+ r && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? S(
1751
+ t.memorySearchTypeResultSummaryOne,
1752
+ {
1753
+ score: e.result.highestChunkScore.toFixed(
1754
+ 2
1755
+ )
1756
+ }
1757
+ ) : S(
1758
+ t.memorySearchTypeResultSummary,
1759
+ {
1760
+ count: e.result.numberOfChunks,
1761
+ score: e.result.highestChunkScore.toFixed(
1762
+ 2
1763
+ )
1764
+ }
1765
+ ) }),
1766
+ l && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
1767
+ ]
1768
+ }
1769
+ )
1770
+ ]
1771
+ }
1772
+ );
1773
+ }
1774
+ const Xe = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1775
+ const l = W(() => {
1776
+ let s = -1;
1777
+ return e.memoryTypes.forEach((a, u) => {
1778
+ a.result == null && a.error == null && (s = u);
1779
+ }), s;
1780
+ }, [e.memoryTypes]);
1781
+ return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1782
+ t && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
1783
+ D,
1784
+ {
1785
+ text: r.searchingMemoryTypes,
1786
+ duration: 2.5,
1787
+ repeat: !0,
1788
+ color: "#999",
1789
+ shimmerColor: "#000"
1790
+ }
1791
+ ) : e.memoryTypes.map((s, a) => /* @__PURE__ */ i(
1792
+ Ge,
1793
+ {
1794
+ item: s,
1795
+ t: r,
1796
+ showShimmerForPrimary: a === l && t
1797
+ },
1798
+ s.memoryTypeId
1799
+ )),
1800
+ n !== void 0 && /* @__PURE__ */ i(
1801
+ "div",
1802
+ {
1803
+ style: {
1804
+ fontSize: "12px",
1805
+ color: "#999",
1806
+ marginTop: "4px",
1807
+ fontStyle: "italic"
1808
+ },
1809
+ children: S(r.tookSeconds, { n })
1810
+ }
1811
+ )
1812
+ ] });
1813
+ };
1814
+ function Je(e, t) {
1815
+ if (e.length === 0) return "";
1816
+ if (e.length === 1)
1817
+ return S(t.pageSingle, { n: e[0] });
1818
+ if (e.length === 2)
1819
+ return S(t.pageTwo, {
1820
+ a: e[0],
1821
+ b: e[1]
1822
+ });
1823
+ const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
1824
+ return S(t.pageMultiple, { list: r, n });
1825
+ }
1826
+ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
1827
+ const r = e.chunkResults.chunks, l = !!t;
1828
+ return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1829
+ /* @__PURE__ */ i(
1830
+ x.div,
1831
+ {
1832
+ style: {
1833
+ marginBottom: "12px",
1834
+ fontSize: "13px",
1835
+ fontWeight: 600,
1836
+ color: "#333"
1837
+ },
1838
+ initial: { opacity: 0, y: -6 },
1839
+ animate: { opacity: 1, y: 0 },
1840
+ transition: { duration: 0.25 },
1841
+ children: n.resultsHeading
1842
+ }
1843
+ ),
1844
+ /* @__PURE__ */ i(
1845
+ "div",
1846
+ {
1847
+ style: {
1848
+ display: "flex",
1849
+ flexDirection: "column",
1850
+ gap: 0
1851
+ },
1852
+ children: r.map((s, a) => /* @__PURE__ */ y(
1853
+ x.div,
1854
+ {
1855
+ initial: { opacity: 0 },
1856
+ animate: { opacity: 1 },
1857
+ transition: { duration: 0.2, delay: a * 0.04 },
1858
+ style: {
1859
+ display: "flex",
1860
+ flexDirection: "row",
1861
+ alignItems: "flex-start",
1862
+ gap: "12px",
1863
+ paddingTop: "12px",
1864
+ paddingBottom: "12px",
1865
+ borderBottom: a < r.length - 1 ? "1px solid #eee" : void 0,
1866
+ minWidth: 0
1867
+ },
1868
+ children: [
1869
+ /* @__PURE__ */ y(
1870
+ "div",
1871
+ {
1872
+ style: {
1873
+ flex: 1,
1874
+ minWidth: 0,
1875
+ display: "flex",
1876
+ flexDirection: "column",
1877
+ gap: "6px"
1878
+ },
1879
+ children: [
1880
+ /* @__PURE__ */ i(
1881
+ "span",
1882
+ {
1883
+ style: {
1884
+ fontSize: 13,
1885
+ fontWeight: 600,
1886
+ color: "#333"
1887
+ },
1888
+ children: s.memoryTitle
1889
+ }
1890
+ ),
1891
+ /* @__PURE__ */ y(
1892
+ "div",
1893
+ {
1894
+ style: {
1895
+ fontSize: 12,
1896
+ color: "#444",
1897
+ lineHeight: 1.4
1898
+ },
1899
+ children: [
1900
+ /* @__PURE__ */ i("span", { style: { fontWeight: 600, color: "#555" }, children: n.pagesLabel }),
1901
+ ": ",
1902
+ s.pageNumbers.length > 0 ? Je(s.pageNumbers, n) : n.pagesNotAvailable
1903
+ ]
1904
+ }
1905
+ ),
1906
+ /* @__PURE__ */ i(
1907
+ "span",
1908
+ {
1909
+ style: {
1910
+ fontSize: 12,
1911
+ color: "#666",
1912
+ lineHeight: 1.45,
1913
+ whiteSpace: "pre-wrap",
1914
+ wordBreak: "break-word"
1915
+ },
1916
+ children: s.content
1917
+ }
1918
+ ),
1919
+ /* @__PURE__ */ i("span", { style: { fontSize: 11, color: "#999" }, children: S(n.scoreLabel, {
1920
+ n: s.score.toFixed(2)
1921
+ }) })
1922
+ ]
1923
+ }
1924
+ ),
1925
+ l && /* @__PURE__ */ i(
1926
+ "button",
1927
+ {
1928
+ type: "button",
1929
+ onClick: () => t(s.memoryId),
1930
+ style: {
1931
+ flexShrink: 0,
1932
+ alignSelf: "center",
1933
+ padding: "6px 12px",
1934
+ fontSize: 12,
1935
+ fontWeight: 600,
1936
+ color: "#2563eb",
1937
+ background: "#eff6ff",
1938
+ border: "1px solid #bfdbfe",
1939
+ borderRadius: 6,
1940
+ cursor: "pointer",
1941
+ fontFamily: "inherit"
1942
+ },
1943
+ children: n.viewButton
1944
+ }
1945
+ )
1946
+ ]
1947
+ },
1948
+ `${s.memoryId}-${a}`
1949
+ ))
1950
+ }
1951
+ )
1952
+ ] });
1953
+ }, Ye = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1954
+ x.div,
1641
1955
  {
1642
1956
  initial: { opacity: 0, y: -10 },
1643
1957
  animate: { opacity: 1, y: 0 },
@@ -1659,55 +1973,56 @@ const He = ({ data: e, t }) => {
1659
1973
  }
1660
1974
  )
1661
1975
  }
1662
- ) }), qe = ({
1976
+ ) }), Qe = ({
1663
1977
  progressViewItems: e,
1664
1978
  loadingText: t,
1665
1979
  t: n,
1666
- onSourceClick: r
1980
+ onSourceClick: r,
1981
+ onSearchResultClick: l
1667
1982
  }) => {
1668
- const l = I(null);
1669
- w(() => {
1670
- l.current && (l.current.scrollTop = l.current.scrollHeight);
1983
+ const s = F(null);
1984
+ A(() => {
1985
+ s.current && (s.current.scrollTop = s.current.scrollHeight);
1671
1986
  }, [e.length]);
1672
- const u = (c) => {
1673
- const s = c.item.data;
1674
- if (s.taskType === "StreamingChatCompletion" && s.eventType === "Text")
1675
- return /* @__PURE__ */ i(N, { text: s.text });
1676
- if (s.taskType === "StructuredChatCompletion" && s.eventType === "Json")
1677
- return /* @__PURE__ */ i(Ie, { data: s });
1678
- if (s.taskType === "MemoryChatCompletion")
1679
- switch (s.eventType) {
1987
+ const a = (d) => {
1988
+ const o = d.item.data;
1989
+ if (o.taskType === "StreamingChatCompletion" && o.eventType === "Text")
1990
+ return /* @__PURE__ */ i(j, { text: o.text });
1991
+ if (o.taskType === "StructuredChatCompletion" && o.eventType === "Json")
1992
+ return /* @__PURE__ */ i(Ae, { data: o });
1993
+ if (o.taskType === "MemoryChatCompletion")
1994
+ switch (o.eventType) {
1680
1995
  case "Text":
1681
- return /* @__PURE__ */ i(N, { text: s.text });
1996
+ return /* @__PURE__ */ i(j, { text: o.text });
1682
1997
  case "FindMemories":
1683
1998
  return /* @__PURE__ */ i(
1684
1999
  Pe,
1685
2000
  {
1686
- data: s,
1687
- isLatest: c.isLatest,
1688
- durationSeconds: c.durationSeconds,
2001
+ data: o,
2002
+ isLatest: d.isLatest,
2003
+ durationSeconds: d.durationSeconds,
1689
2004
  t: n
1690
2005
  }
1691
2006
  );
1692
2007
  case "FindMemoriesResult":
1693
- return /* @__PURE__ */ i(Re, { data: s, t: n });
2008
+ return /* @__PURE__ */ i(Le, { data: o, t: n });
1694
2009
  case "Search":
1695
2010
  return /* @__PURE__ */ i(
1696
- De,
2011
+ Re,
1697
2012
  {
1698
- data: s,
1699
- isLatest: c.isLatest,
1700
- durationSeconds: c.durationSeconds,
2013
+ data: o,
2014
+ isLatest: d.isLatest,
2015
+ durationSeconds: d.durationSeconds,
1701
2016
  t: n
1702
2017
  }
1703
2018
  );
1704
2019
  case "FindSources":
1705
2020
  return /* @__PURE__ */ i(
1706
- Le,
2021
+ Oe,
1707
2022
  {
1708
- data: s,
1709
- isLatest: c.isLatest,
1710
- durationSeconds: c.durationSeconds,
2023
+ data: o,
2024
+ isLatest: d.isLatest,
2025
+ durationSeconds: d.durationSeconds,
1711
2026
  t: n
1712
2027
  }
1713
2028
  );
@@ -1715,31 +2030,53 @@ const He = ({ data: e, t }) => {
1715
2030
  return /* @__PURE__ */ i(
1716
2031
  $e,
1717
2032
  {
1718
- data: s,
2033
+ data: o,
1719
2034
  onSourceClick: r,
1720
2035
  t: n
1721
2036
  }
1722
2037
  );
1723
2038
  case "ExploreMemories":
1724
2039
  return /* @__PURE__ */ i(
1725
- Ne,
2040
+ Ue,
1726
2041
  {
1727
- data: s,
1728
- completed: c.completed,
1729
- isLatest: c.isLatest,
2042
+ data: o,
2043
+ completed: d.completed,
2044
+ isLatest: d.isLatest,
1730
2045
  t: n
1731
2046
  }
1732
2047
  );
1733
2048
  case "ChunkResult":
1734
- return /* @__PURE__ */ i(He, { data: s, t: n });
2049
+ return /* @__PURE__ */ i(Ne, { data: o, t: n });
1735
2050
  case "Completed":
1736
2051
  return null;
1737
2052
  }
1738
- return s.taskType === "StreamingChatCompletion" && s.eventType === "Completed" || s.taskType === "StructuredChatCompletion" && s.eventType === "Completed" ? null : s.eventType === "Error" && "message" in s ? /* @__PURE__ */ i(Ke, { message: s.message }) : null;
2053
+ if (o.taskType === "MemorySearch")
2054
+ switch (o.eventType) {
2055
+ case "SearchMemoryTypes":
2056
+ return /* @__PURE__ */ i(
2057
+ Xe,
2058
+ {
2059
+ data: o,
2060
+ isLatest: d.isLatest,
2061
+ durationSeconds: d.durationSeconds,
2062
+ t: n
2063
+ }
2064
+ );
2065
+ case "Completed":
2066
+ return /* @__PURE__ */ i(
2067
+ Ve,
2068
+ {
2069
+ data: o,
2070
+ onSearchResultClick: l,
2071
+ t: n
2072
+ }
2073
+ );
2074
+ }
2075
+ return o.taskType === "StreamingChatCompletion" && o.eventType === "Completed" || o.taskType === "StructuredChatCompletion" && o.eventType === "Completed" ? null : o.eventType === "Error" && "message" in o ? /* @__PURE__ */ i(Ye, { message: o.message }) : null;
1739
2076
  };
1740
2077
  if (e.length === 0)
1741
2078
  return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
1742
- P,
2079
+ D,
1743
2080
  {
1744
2081
  text: t ?? n.processingYourTask,
1745
2082
  duration: 1.5,
@@ -1749,54 +2086,57 @@ const He = ({ data: e, t }) => {
1749
2086
  shimmerColor: "#000"
1750
2087
  }
1751
2088
  ) });
1752
- const a = e.filter((c, s) => {
1753
- const o = c.item.data;
1754
- return o.taskType === "MemoryChatCompletion" && o.eventType === "ExploreMemories" ? !e.slice(s + 1).some(
1755
- (m) => m.item.data.taskType === "MemoryChatCompletion" && m.item.data.eventType === "ExploreMemories"
2089
+ const u = e.filter((d, o) => {
2090
+ const c = d.item.data;
2091
+ return c.taskType === "MemoryChatCompletion" && c.eventType === "ExploreMemories" ? !e.slice(o + 1).some(
2092
+ (f) => f.item.data.taskType === "MemoryChatCompletion" && f.item.data.eventType === "ExploreMemories"
1756
2093
  ) : !0;
1757
2094
  });
1758
- return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: l, children: /* @__PURE__ */ i(q, { children: a.map((c, s) => /* @__PURE__ */ i(
1759
- S.div,
2095
+ return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(q, { children: u.map((d, o) => /* @__PURE__ */ i(
2096
+ x.div,
1760
2097
  {
1761
- id: `agent-task-progress-item-${c.item.progressItemId}`,
2098
+ id: `agent-task-progress-item-${d.item.progressItemId}`,
1762
2099
  initial: { opacity: 0, y: -20 },
1763
2100
  animate: { opacity: 1, y: 0 },
1764
2101
  transition: {
1765
2102
  duration: 0.4,
1766
- delay: s * 0.1,
2103
+ delay: o * 0.1,
1767
2104
  ease: "easeOut"
1768
2105
  },
1769
- children: u(c)
2106
+ children: a(d)
1770
2107
  },
1771
- c.item.progressItemId
2108
+ d.item.progressItemId
1772
2109
  )) }) });
1773
- }, nt = ({
2110
+ }, lt = ({
1774
2111
  agentTask: e,
1775
2112
  mode: t = "verbose",
1776
2113
  language: n,
1777
- onSourceClick: r
2114
+ onSourceClick: r,
2115
+ onSearchResultClick: l
1778
2116
  }) => {
1779
- const l = Ee(e), u = e.params.type === "MemoryChatCompletion" && "language" in e.params ? e.params.language ?? "en" : n ?? "en", a = Fe(u);
2117
+ const s = Ee(e), a = (e.params.type === "MemoryChatCompletion" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", u = De(a);
1780
2118
  return t === "simple" ? /* @__PURE__ */ i(
1781
2119
  we,
1782
2120
  {
1783
- progressViewItems: l,
1784
- t: a
2121
+ progressViewItems: s,
2122
+ t: u
1785
2123
  }
1786
2124
  ) : /* @__PURE__ */ i(
1787
- qe,
2125
+ Qe,
1788
2126
  {
1789
- progressViewItems: l,
2127
+ progressViewItems: s,
1790
2128
  loadingText: e.loadingText,
1791
- t: a,
1792
- onSourceClick: r
2129
+ t: u,
2130
+ onSourceClick: r,
2131
+ onSearchResultClick: l
1793
2132
  }
1794
2133
  );
1795
2134
  };
1796
2135
  export {
1797
- nt as AgentTaskProgress,
1798
- j as Checkmark,
1799
- et as FencyProvider,
1800
- Be as XMark,
1801
- tt as useAgentTasks
2136
+ lt as AgentTaskProgress,
2137
+ B as Checkmark,
2138
+ at as FencyProvider,
2139
+ Ve as MemorySearchCompletedResults,
2140
+ Y as XMark,
2141
+ st as useAgentTasks
1802
2142
  };