@fencyai/react 0.1.151 → 0.1.153

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
- import { jsxs as y, jsx as i, Fragment as E } from "react/jsx-runtime";
1
+ import { jsxs as f, jsx as i, Fragment as E } from "react/jsx-runtime";
2
2
  import { createStream as Q, isStreamTimeoutEvent as Z, isStreamNotFoundEvent as ee, isAgentTaskProgressItemUpdatedEvent as te, createAgentTask as ne } from "@fencyai/js";
3
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";
4
+ import { useInView as ie, motion as k, AnimatePresence as q } from "motion/react";
5
5
  import ae from "react-markdown";
6
6
  import { Prism as G } from "react-syntax-highlighter";
7
7
  import se from "remark-gfm";
@@ -17,13 +17,13 @@ async function le(e, t) {
17
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 = ue(t, a);
21
- const u = t.length;
20
+ t === void 0 ? (t = a, n = 0, r = -1) : t = me(t, a);
21
+ const m = t.length;
22
22
  let d = 0;
23
- for (; n < u; ) {
23
+ for (; n < m; ) {
24
24
  l && (t[n] === 10 && (d = ++n), l = !1);
25
25
  let o = -1;
26
- for (; n < u && o === -1; ++n)
26
+ for (; n < m && o === -1; ++n)
27
27
  switch (t[n]) {
28
28
  case 58:
29
29
  r === -1 && (r = n - d);
@@ -38,17 +38,17 @@ function ce(e) {
38
38
  break;
39
39
  e(t.subarray(d, o), r), d = n, r = -1;
40
40
  }
41
- d === u ? t = void 0 : d !== 0 && (t = t.subarray(d), n -= d);
41
+ d === m ? t = void 0 : d !== 0 && (t = t.subarray(d), n -= d);
42
42
  };
43
43
  }
44
44
  function de(e, t, n) {
45
- let r = U();
45
+ let r = N();
46
46
  const l = new TextDecoder();
47
- return function(a, u) {
47
+ return function(a, m) {
48
48
  if (a.length === 0)
49
- n == null || n(r), r = U();
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));
49
+ n == null || n(r), r = N();
50
+ else if (m > 0) {
51
+ const d = l.decode(a.subarray(0, m)), o = m + (a[m + 1] === 32 ? 2 : 1), c = l.decode(a.subarray(o));
52
52
  switch (d) {
53
53
  case "data":
54
54
  r.data = r.data ? r.data + `
@@ -68,11 +68,11 @@ function de(e, t, n) {
68
68
  }
69
69
  };
70
70
  }
71
- function ue(e, t) {
71
+ function me(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
  }
75
- function U() {
75
+ function N() {
76
76
  return {
77
77
  data: "",
78
78
  event: "",
@@ -80,7 +80,7 @@ function U() {
80
80
  retry: void 0
81
81
  };
82
82
  }
83
- var me = function(e, t) {
83
+ var ue = 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 me = 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 $ = "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
- return new Promise((g, m) => {
95
- const f = Object.assign({}, r);
96
- f.accept || (f.accept = $);
97
- let h;
91
+ const $ = "text/event-stream", ge = 1e3, U = "last-event-id";
92
+ function ye(e, t) {
93
+ var { signal: n, headers: r, onopen: l, onmessage: s, onclose: a, onerror: m, openWhenHidden: d, fetch: o } = t, c = ue(t, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
+ return new Promise((g, u) => {
95
+ const h = Object.assign({}, r);
96
+ h.accept || (h.accept = $);
97
+ let p;
98
98
  function T() {
99
- h.abort(), document.hidden || w();
99
+ p.abort(), document.hidden || w();
100
100
  }
101
101
  d || document.addEventListener("visibilitychange", T);
102
- let p = ge, k = 0;
102
+ let y = ge, x = 0;
103
103
  function b() {
104
- document.removeEventListener("visibilitychange", T), window.clearTimeout(k), h.abort();
104
+ document.removeEventListener("visibilitychange", T), window.clearTimeout(x), p.abort();
105
105
  }
106
106
  n == null || n.addEventListener("abort", () => {
107
107
  b(), g();
108
108
  });
109
- const I = o ?? window.fetch, C = l ?? he;
109
+ const I = o ?? window.fetch, C = l ?? pe;
110
110
  async function w() {
111
- var P;
112
- h = new AbortController();
111
+ var R;
112
+ p = new AbortController();
113
113
  try {
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[_];
114
+ const D = await I(e, Object.assign(Object.assign({}, c), { headers: h, signal: p.signal }));
115
+ await C(D), await le(D.body, ce(de((M) => {
116
+ M ? h[U] = M : delete h[U];
117
117
  }, (M) => {
118
- p = M;
118
+ y = M;
119
119
  }, s))), a == null || a(), b(), g();
120
- } catch (R) {
121
- if (!h.signal.aborted)
120
+ } catch (D) {
121
+ if (!p.signal.aborted)
122
122
  try {
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);
123
+ const M = (R = m == null ? void 0 : m(D)) !== null && R !== void 0 ? R : y;
124
+ window.clearTimeout(x), x = window.setTimeout(w, M);
125
125
  } catch (M) {
126
- b(), m(M);
126
+ b(), u(M);
127
127
  }
128
128
  }
129
129
  }
130
130
  w();
131
131
  });
132
132
  }
133
- function he(e) {
133
+ function pe(e) {
134
134
  const t = e.headers.get("content-type");
135
135
  if (!(t != null && t.startsWith($)))
136
136
  throw new Error(`Expected content-type to be ${$}, Actual: ${t}`);
137
137
  }
138
- function ye(e) {
138
+ function he(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);
@@ -166,7 +166,7 @@ class fe {
166
166
  "X-Fency-Publishable-Key": this.fency.publishableKey,
167
167
  "X-Fency-Stream-Token": t.stream.token
168
168
  };
169
- pe(l, {
169
+ ye(l, {
170
170
  headers: s,
171
171
  signal: r.signal,
172
172
  async onopen(a) {
@@ -175,8 +175,8 @@ class fe {
175
175
  },
176
176
  onmessage: (a) => {
177
177
  if (a.data) {
178
- const u = ye(a.data);
179
- this.broadcast(u, n);
178
+ const m = he(a.data);
179
+ this.broadcast(m, n);
180
180
  }
181
181
  },
182
182
  onerror: (a) => {
@@ -219,27 +219,27 @@ const Se = 12e4, Te = (e) => {
219
219
  function at({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
220
220
  const [r, l] = v(
221
221
  null
222
- ), [s, a] = v(!0), [u, d] = v(null), [o, c] = v([]), g = F(null), m = F(null);
222
+ ), [s, a] = v(!0), [m, d] = v(null), [o, c] = v([]), g = F(null), u = F(null);
223
223
  A(() => {
224
- e.then((p) => {
225
- l(p), a(!1);
226
- }).catch((p) => {
227
- d(p), a(!1);
224
+ e.then((y) => {
225
+ l(y), a(!1);
226
+ }).catch((y) => {
227
+ d(y), a(!1);
228
228
  });
229
229
  }, [e]), A(() => {
230
- r && !m.current && (m.current = new fe(r));
230
+ r && !u.current && (u.current = new fe(r));
231
231
  }, [r]), A(() => {
232
- m.current && m.current.updateStreams(o);
232
+ u.current && u.current.updateStreams(o);
233
233
  }, [o]), A(() => () => {
234
- var p;
235
- (p = m.current) == null || p.cleanup();
234
+ var y;
235
+ (y = u.current) == null || y.cleanup();
236
236
  }, []);
237
- const f = K(
238
- async (p = 3e4) => {
237
+ const h = K(
238
+ async (y = 3e4) => {
239
239
  if (g.current)
240
240
  return g.current;
241
- const k = Date.now(), b = o.length > 0 ? o[o.length - 1] : null;
242
- if (b && k - b.createdAt < p)
241
+ const x = Date.now(), b = o.length > 0 ? o[o.length - 1] : null;
242
+ if (b && x - b.createdAt < y)
243
243
  return b.stream;
244
244
  const I = (async () => {
245
245
  if (!r)
@@ -250,12 +250,12 @@ function at({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
250
250
  clientToken: (C == null ? void 0 : C.clientToken) ?? ""
251
251
  });
252
252
  if (w.type === "success") {
253
- const P = {
253
+ const R = {
254
254
  stream: w.stream,
255
255
  createdAt: Date.now()
256
256
  };
257
- return c((R) => {
258
- const M = [...R, P];
257
+ return c((D) => {
258
+ const M = [...D, R];
259
259
  return Te(M);
260
260
  }), g.current = null, w.stream;
261
261
  } else
@@ -265,21 +265,21 @@ function at({ fency: e, fetchCreateStreamClientToken: t, children: n }) {
265
265
  },
266
266
  [r, o]
267
267
  );
268
- if (u)
269
- return /* @__PURE__ */ y("div", { children: [
268
+ if (m)
269
+ return /* @__PURE__ */ f("div", { children: [
270
270
  "Fency error: ",
271
- u.message
271
+ m.message
272
272
  ] });
273
273
  if (!r)
274
274
  return null;
275
- const h = o.length > 0 ? o[o.length - 1] : null, T = {
275
+ const p = o.length > 0 ? o[o.length - 1] : null, T = {
276
276
  fency: r,
277
277
  loading: s,
278
- error: u,
278
+ error: m,
279
279
  activeStreams: o,
280
- latestStream: h,
281
- eventManager: m.current,
282
- getOrCreateStream: f
280
+ latestStream: p,
281
+ eventManager: u.current,
282
+ getOrCreateStream: h
283
283
  };
284
284
  return /* @__PURE__ */ i(X.Provider, { value: T, children: n });
285
285
  }
@@ -289,14 +289,14 @@ function J() {
289
289
  throw new Error("useFencyContext must be used within a FencyProvider");
290
290
  return e;
291
291
  }
292
- const ke = (e) => {
292
+ const xe = (e) => {
293
293
  try {
294
294
  const t = JSON.parse(e);
295
- return xe(t);
295
+ return ke(t);
296
296
  } catch (t) {
297
297
  return console.error("Error parsing message:", t), null;
298
298
  }
299
- }, xe = (e) => Z(e) ? be(e) : ee(e) ? ve(e) : te(e) ? Ce(e) : null, be = (e) => ({
299
+ }, ke = (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
@@ -318,18 +318,18 @@ const ke = (e) => {
318
318
  if (!t.eventManager) return;
319
319
  const a = {
320
320
  onMessage: (d, o) => {
321
- var g, m, f;
322
- const c = ke(d);
321
+ var g, u, h;
322
+ const c = xe(d);
323
323
  if (c)
324
324
  switch (c.type) {
325
325
  case "STREAM_TIMEOUT":
326
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, c);
329
+ (u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, c);
330
330
  break;
331
331
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
332
- (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, c);
332
+ (h = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || h.call(e, c);
333
333
  break;
334
334
  }
335
335
  },
@@ -371,61 +371,61 @@ const ke = (e) => {
371
371
  }, st = (e) => {
372
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
- var m;
374
+ var u;
375
375
  if (!l.current.has(o.agentTaskId)) return;
376
376
  const c = o.data;
377
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
+ const h = c.taskType === "MemorySearch" && c.eventType === "Completed";
379
379
  r(
380
- f ? (T) => T.map((p) => {
380
+ h ? (T) => T.map((y) => {
381
381
  var I;
382
- if (((I = p.confirmedData) == null ? void 0 : I.taskId) !== o.agentTaskId)
383
- return p;
384
- const b = p.progressItems.some(
382
+ if (((I = y.confirmedData) == null ? void 0 : I.taskId) !== o.agentTaskId)
383
+ return y;
384
+ const b = y.progressItems.some(
385
385
  (C) => C.progressItemId === o.progressItemId
386
- ) ? p.progressItems.map(
386
+ ) ? y.progressItems.map(
387
387
  (C) => C.progressItemId === o.progressItemId ? o : C
388
- ) : [...p.progressItems, o];
388
+ ) : [...y.progressItems, o];
389
389
  return {
390
- ...p,
390
+ ...y,
391
391
  progressItems: b,
392
392
  loading: !1
393
393
  };
394
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;
395
+ (y) => {
396
+ var x;
397
+ return ((x = y.confirmedData) == null ? void 0 : x.taskId) === o.agentTaskId ? { ...y, loading: !1 } : y;
398
398
  }
399
399
  )
400
400
  );
401
- const h = s.current.get(
401
+ const p = s.current.get(
402
402
  o.agentTaskId
403
403
  );
404
- h && (s.current.delete(o.agentTaskId), h(c));
404
+ p && (s.current.delete(o.agentTaskId), p(c));
405
405
  return;
406
406
  }
407
- (m = e.onAgentTaskProgressItemUpdated) == null || m.call(e, o), r(
408
- (f) => f.map((h) => {
409
- var k;
410
- if (((k = h.confirmedData) == null ? void 0 : k.taskId) !== o.agentTaskId)
411
- return h;
412
- const p = h.progressItems.some(
407
+ (u = e.onAgentTaskProgressItemUpdated) == null || u.call(e, o), r(
408
+ (h) => h.map((p) => {
409
+ var x;
410
+ if (((x = p.confirmedData) == null ? void 0 : x.taskId) !== o.agentTaskId)
411
+ return p;
412
+ const y = p.progressItems.some(
413
413
  (b) => b.progressItemId === o.progressItemId
414
- ) ? h.progressItems.map(
414
+ ) ? p.progressItems.map(
415
415
  (b) => b.progressItemId === o.progressItemId ? o : b
416
- ) : [...h.progressItems, o];
417
- return { ...h, progressItems: p };
416
+ ) : [...p.progressItems, o];
417
+ return { ...p, progressItems: y };
418
418
  })
419
419
  );
420
420
  },
421
421
  onStreamError: (o) => {
422
422
  var c;
423
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);
425
- return m ? [
426
- ...g.filter((f) => f.streamId !== o.streamId),
424
+ const u = g.find((h) => h.streamId === o.streamId);
425
+ return u ? [
426
+ ...g.filter((h) => h.streamId !== o.streamId),
427
427
  {
428
- ...m,
428
+ ...u,
429
429
  loading: !1,
430
430
  error: o.error
431
431
  }
@@ -440,15 +440,15 @@ const ke = (e) => {
440
440
  var c;
441
441
  (c = e == null ? void 0 : e.onStreamTimeout) == null || c.call(e, o);
442
442
  }
443
- }), u = K(
443
+ }), m = K(
444
444
  async (o, c) => {
445
- const g = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, m = await a();
446
- if (m.type === "success") {
445
+ const g = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, u = await a();
446
+ if (u.type === "success") {
447
447
  r([
448
448
  ...n,
449
449
  {
450
450
  taskKey: g,
451
- streamId: m.stream.id,
451
+ streamId: u.stream.id,
452
452
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
453
453
  confirmedData: null,
454
454
  error: null,
@@ -458,11 +458,11 @@ const ke = (e) => {
458
458
  loadingText: c == null ? void 0 : c.loadingText
459
459
  }
460
460
  ]);
461
- const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(o.type), h = await ne({
461
+ const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(o.type), p = await ne({
462
462
  pk: t.fency.publishableKey,
463
463
  baseUrl: t.fency.baseUrl,
464
- clientToken: f,
465
- streamToken: m.stream.token,
464
+ clientToken: h,
465
+ streamToken: u.stream.token,
466
466
  request: {
467
467
  streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
468
468
  messages: o.messages,
@@ -488,50 +488,50 @@ const ke = (e) => {
488
488
  } : void 0
489
489
  }
490
490
  });
491
- if (h.type === "success" && h.agentTask) {
491
+ if (p.type === "success" && p.agentTask) {
492
492
  l.current.add(
493
- h.agentTask.id
494
- ), r((p) => [
495
- ...p.filter((k) => k.taskKey !== g),
493
+ p.agentTask.id
494
+ ), r((y) => [
495
+ ...y.filter((x) => x.taskKey !== g),
496
496
  {
497
497
  taskKey: g,
498
- streamId: m.stream.id,
498
+ streamId: u.stream.id,
499
499
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
500
- taskId: h.agentTask.id,
501
- createdAt: h.agentTask.createdAt,
500
+ taskId: p.agentTask.id,
501
+ createdAt: p.agentTask.createdAt,
502
502
  error: null,
503
503
  params: o,
504
504
  progressItems: [],
505
505
  loading: !0,
506
506
  loadingText: c == null ? void 0 : c.loadingText,
507
507
  confirmedData: {
508
- taskId: h.agentTask.id,
509
- createdAt: h.agentTask.createdAt
508
+ taskId: p.agentTask.id,
509
+ createdAt: p.agentTask.createdAt
510
510
  }
511
511
  }
512
512
  ]);
513
- const T = await new Promise((p) => {
513
+ const T = await new Promise((y) => {
514
514
  s.current.set(
515
- h.agentTask.id,
516
- p
515
+ p.agentTask.id,
516
+ y
517
517
  );
518
518
  });
519
519
  return {
520
520
  type: "success",
521
- streamId: m.stream.id,
522
- agentTaskId: h.agentTask.id,
521
+ streamId: u.stream.id,
522
+ agentTaskId: p.agentTask.id,
523
523
  response: T
524
524
  };
525
525
  } else {
526
- if (h.type === "error")
526
+ if (p.type === "error")
527
527
  return r((T) => [
528
- ...T.filter((p) => p.taskKey !== g),
528
+ ...T.filter((y) => y.taskKey !== g),
529
529
  {
530
530
  taskKey: g,
531
531
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
532
- streamId: m.stream.id,
532
+ streamId: u.stream.id,
533
533
  params: o,
534
- error: h.error,
534
+ error: p.error,
535
535
  progressItems: [],
536
536
  loading: !1,
537
537
  loadingText: c == null ? void 0 : c.loadingText,
@@ -539,19 +539,19 @@ const ke = (e) => {
539
539
  }
540
540
  ]), {
541
541
  type: "error",
542
- error: h.error
542
+ error: p.error
543
543
  };
544
544
  {
545
545
  const T = {
546
546
  message: "No response received",
547
547
  code: "UnknownError"
548
548
  };
549
- return r((p) => [
550
- ...p.filter((k) => k.taskKey !== g),
549
+ return r((y) => [
550
+ ...y.filter((x) => x.taskKey !== g),
551
551
  {
552
552
  taskKey: g,
553
553
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
554
- streamId: m.stream.id,
554
+ streamId: u.stream.id,
555
555
  error: T,
556
556
  params: o,
557
557
  progressItems: [],
@@ -566,7 +566,7 @@ const ke = (e) => {
566
566
  }
567
567
  }
568
568
  } else
569
- return console.error(m.error), m;
569
+ return console.error(u.error), u;
570
570
  },
571
571
  [t, n, a]
572
572
  ), d = W(() => {
@@ -577,7 +577,7 @@ const ke = (e) => {
577
577
  l.current.clear(), s.current.clear();
578
578
  }, []), {
579
579
  agentTasks: n,
580
- createAgentTask: u,
580
+ createAgentTask: m,
581
581
  latest: d
582
582
  };
583
583
  };
@@ -586,8 +586,8 @@ function Ee(e) {
586
586
  const r = e.progressItems[n + 1], l = r != null;
587
587
  let s;
588
588
  if (r != null && r.createdAt) {
589
- const a = new Date(t.createdAt).getTime(), u = new Date(r.createdAt).getTime();
590
- s = Math.round((u - a) / 1e3);
589
+ const a = new Date(t.createdAt).getTime(), m = new Date(r.createdAt).getTime();
590
+ s = Math.round((m - a) / 1e3);
591
591
  }
592
592
  return {
593
593
  item: t,
@@ -597,7 +597,7 @@ function Ee(e) {
597
597
  };
598
598
  });
599
599
  }
600
- function D({
600
+ function P({
601
601
  text: e,
602
602
  duration: t = 2,
603
603
  delay: n = 0,
@@ -605,18 +605,18 @@ function D({
605
605
  repeatDelay: l = 0.5,
606
606
  className: s,
607
607
  startOnView: a = !1,
608
- once: u = !1,
608
+ once: m = !1,
609
609
  inViewMargin: d,
610
610
  spread: o = 2,
611
611
  color: c = "#999",
612
612
  shimmerColor: g = "#000",
613
- direction: m = "fromBottom"
613
+ direction: u = "fromBottom"
614
614
  }) {
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";
615
+ const h = F(null), p = ie(h, { once: m, margin: d }), T = W(() => e.length * o, [e, o]), y = !a || p, x = u === "fromBottom" ? "100% center" : "-100% center", b = u === "fromBottom" ? "0% center" : "200% center";
616
616
  return /* @__PURE__ */ i(
617
- x.span,
617
+ k.span,
618
618
  {
619
- ref: f,
619
+ ref: h,
620
620
  className: s,
621
621
  style: {
622
622
  position: "relative",
@@ -634,10 +634,10 @@ function D({
634
634
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
635
635
  },
636
636
  initial: {
637
- backgroundPosition: k,
637
+ backgroundPosition: x,
638
638
  opacity: 0
639
639
  },
640
- animate: p ? {
640
+ animate: y ? {
641
641
  backgroundPosition: b,
642
642
  opacity: 1
643
643
  } : {},
@@ -705,7 +705,7 @@ const we = ({ progressViewItems: e, t }) => {
705
705
  if (!n) return null;
706
706
  const r = Ie(n, t);
707
707
  return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(q, { mode: "wait", children: /* @__PURE__ */ i(
708
- x.div,
708
+ k.div,
709
709
  {
710
710
  initial: { opacity: 0, y: 10 },
711
711
  animate: { opacity: 1, y: 0 },
@@ -719,7 +719,7 @@ const we = ({ progressViewItems: e, t }) => {
719
719
  children: r
720
720
  }
721
721
  ) : /* @__PURE__ */ i(
722
- D,
722
+ P,
723
723
  {
724
724
  text: r,
725
725
  className: "simple-mode-title",
@@ -883,10 +883,10 @@ const we = ({ progressViewItems: e, t }) => {
883
883
  italic: {
884
884
  fontStyle: "italic"
885
885
  }
886
- }, j = ({
886
+ }, _ = ({
887
887
  text: e
888
888
  }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
889
- x.div,
889
+ k.div,
890
890
  {
891
891
  className: "fency-markdown-body-raw",
892
892
  initial: { opacity: 0, y: -10 },
@@ -898,8 +898,8 @@ const we = ({ progressViewItems: e, t }) => {
898
898
  remarkPlugins: [se],
899
899
  components: {
900
900
  code(t) {
901
- const { children: n, className: r, node: l, ref: s, ...a } = t, u = /language-(\w+)/.exec(r || "");
902
- return u ? (
901
+ const { children: n, className: r, node: l, ref: s, ...a } = t, m = /language-(\w+)/.exec(r || "");
902
+ return m ? (
903
903
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
904
904
  /* @__PURE__ */ i(
905
905
  G,
@@ -907,7 +907,7 @@ const we = ({ progressViewItems: e, t }) => {
907
907
  ...a,
908
908
  PreTag: "div",
909
909
  children: String(n).replace(/\n$/, ""),
910
- language: u[1],
910
+ language: m[1],
911
911
  style: V
912
912
  }
913
913
  )
@@ -921,7 +921,7 @@ const we = ({ progressViewItems: e, t }) => {
921
921
  ) }), Ae = ({ data: e }) => {
922
922
  const t = JSON.stringify(e.json, null, 2);
923
923
  return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
924
- x.div,
924
+ k.div,
925
925
  {
926
926
  initial: { opacity: 0, y: -10 },
927
927
  animate: { opacity: 1, y: 0 },
@@ -972,7 +972,9 @@ const we = ({ progressViewItems: e, t }) => {
972
972
  memorySearchTypeResultSummaryOne: "Found 1 result. Highest score was {score}",
973
973
  resultsHeading: "Results",
974
974
  viewButton: "View",
975
- pagesLabel: "Pages",
975
+ memorySearchPagesSingle: "Pages {n}",
976
+ memorySearchPagesTwo: "Pages {a} and {b}",
977
+ memorySearchPagesMultiple: "Pages {list} and {n}",
976
978
  pagesNotAvailable: "—",
977
979
  and: "and"
978
980
  },
@@ -1018,12 +1020,14 @@ const we = ({ progressViewItems: e, t }) => {
1018
1020
  memorySearchTypeResultSummaryOne: "Fant 1 resultat. Høyeste poengsum var {score}",
1019
1021
  resultsHeading: "Resultater",
1020
1022
  viewButton: "Vis",
1021
- pagesLabel: "Sider",
1023
+ memorySearchPagesSingle: "Side {n}",
1024
+ memorySearchPagesTwo: "Sider {a} og {b}",
1025
+ memorySearchPagesMultiple: "Sider {list} og {n}",
1022
1026
  pagesNotAvailable: "—",
1023
1027
  and: "og"
1024
1028
  }
1025
1029
  };
1026
- function De(e) {
1030
+ function Pe(e) {
1027
1031
  return Fe[e];
1028
1032
  }
1029
1033
  function S(e, t) {
@@ -1040,21 +1044,21 @@ function H(e, t) {
1040
1044
  }
1041
1045
  return n.join(", ");
1042
1046
  }
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(
1047
+ const O = 5, De = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1048
+ const [l, s] = v(!1), m = (e.memories ?? []).map((y) => y.memoryTitle), d = m.length > 0, o = d && m.length > O, c = o && !l ? m.slice(0, O) : m, g = m.length - O, u = !o || l, h = `${r.searchingFor}'${e.queryDescription}'`, p = d ? `${r.searchingIn}${H(
1045
1049
  c,
1046
- m ? r.and : void 0
1047
- )}` : "", T = d ? `${f}${h}` : `${r.searchingPrefix}${e.queryDescription}`;
1048
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1050
+ u ? r.and : void 0
1051
+ )}` : "", T = d ? `${h}${p}` : `${r.searchingPrefix}${e.queryDescription}`;
1052
+ return /* @__PURE__ */ f("div", { style: { padding: "16px" }, children: [
1049
1053
  /* @__PURE__ */ i(
1050
- x.div,
1054
+ k.div,
1051
1055
  {
1052
1056
  style: { color: "#666" },
1053
1057
  initial: { opacity: 0, y: -10 },
1054
1058
  animate: { opacity: 1, y: 0 },
1055
1059
  transition: { duration: 0.3, delay: 0 },
1056
1060
  children: t && !n && !o ? /* @__PURE__ */ i(
1057
- D,
1061
+ P,
1058
1062
  {
1059
1063
  text: T,
1060
1064
  duration: 2.5,
@@ -1062,17 +1066,17 @@ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1062
1066
  color: "#999",
1063
1067
  shimmerColor: "#000"
1064
1068
  }
1065
- ) : /* @__PURE__ */ y(E, { children: [
1066
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: d ? /* @__PURE__ */ y(E, { children: [
1069
+ ) : /* @__PURE__ */ f(E, { children: [
1070
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: d ? /* @__PURE__ */ f(E, { children: [
1067
1071
  r.searchingFor,
1068
- /* @__PURE__ */ y("span", { style: { fontWeight: 600 }, children: [
1072
+ /* @__PURE__ */ f("span", { style: { fontWeight: 600 }, children: [
1069
1073
  "'",
1070
1074
  e.queryDescription,
1071
1075
  "'"
1072
1076
  ] }),
1073
- h
1077
+ p
1074
1078
  ] }) : `${r.searchingPrefix}${e.queryDescription}` }),
1075
- o && !l && /* @__PURE__ */ y(E, { children: [
1079
+ o && !l && /* @__PURE__ */ f(E, { children: [
1076
1080
  " ",
1077
1081
  /* @__PURE__ */ i(
1078
1082
  "button",
@@ -1096,7 +1100,7 @@ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1096
1100
  }
1097
1101
  )
1098
1102
  ] }),
1099
- o && l && /* @__PURE__ */ y(E, { children: [
1103
+ o && l && /* @__PURE__ */ f(E, { children: [
1100
1104
  " ",
1101
1105
  /* @__PURE__ */ i(
1102
1106
  "button",
@@ -1134,14 +1138,14 @@ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1134
1138
  }
1135
1139
  )
1136
1140
  ] });
1137
- }, O = 5, Pe = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
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(
1141
+ }, L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1142
+ const [l, s] = v(!1), a = e.titles, m = a.length > 0, d = m && a.length > L, o = d && !l ? a.slice(0, L) : a, c = a.length - L, g = !d || l, u = m ? `${r.findingMemoriesIn}${H(
1139
1143
  o,
1140
1144
  g ? r.and : void 0
1141
1145
  )}` : r.findingMemories;
1142
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1146
+ return /* @__PURE__ */ f("div", { style: { padding: "16px" }, children: [
1143
1147
  /* @__PURE__ */ i(
1144
- x.div,
1148
+ k.div,
1145
1149
  {
1146
1150
  style: {
1147
1151
  color: "#666"
@@ -1150,17 +1154,17 @@ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1150
1154
  animate: { opacity: 1, y: 0 },
1151
1155
  transition: { duration: 0.3, delay: 0 },
1152
1156
  children: t && !n && !d ? /* @__PURE__ */ i(
1153
- D,
1157
+ P,
1154
1158
  {
1155
- text: m,
1159
+ text: u,
1156
1160
  duration: 2.5,
1157
1161
  repeat: !0,
1158
1162
  color: "#999",
1159
1163
  shimmerColor: "#000"
1160
1164
  }
1161
- ) : /* @__PURE__ */ y(E, { children: [
1162
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m }),
1163
- d && !l && /* @__PURE__ */ y(E, { children: [
1165
+ ) : /* @__PURE__ */ f(E, { children: [
1166
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: u }),
1167
+ d && !l && /* @__PURE__ */ f(E, { children: [
1164
1168
  " ",
1165
1169
  /* @__PURE__ */ i(
1166
1170
  "button",
@@ -1184,7 +1188,7 @@ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1184
1188
  }
1185
1189
  )
1186
1190
  ] }),
1187
- d && l && /* @__PURE__ */ y(E, { children: [
1191
+ d && l && /* @__PURE__ */ f(E, { children: [
1188
1192
  " ",
1189
1193
  /* @__PURE__ */ i(
1190
1194
  "button",
@@ -1222,21 +1226,21 @@ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1222
1226
  }
1223
1227
  )
1224
1228
  ] });
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(
1229
+ }, z = 5, Oe = ({ data: e, t }) => {
1230
+ const [n, r] = v(!1), s = e.memories.map((h) => h.memoryTitle), a = s.length > 0, m = a && s.length > z, d = m && !n ? s.slice(0, z) : s, o = s.length - z, c = !m || n, g = s.length === 1 ? t.memoryFound : t.memoriesFoundPrefix, u = a ? `${g}${H(
1227
1231
  d,
1228
1232
  c ? t.and : void 0
1229
1233
  )}` : t.memoriesFound;
1230
1234
  return /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1231
- x.div,
1235
+ k.div,
1232
1236
  {
1233
1237
  style: { color: "#666" },
1234
1238
  initial: { opacity: 0, y: -10 },
1235
1239
  animate: { opacity: 1, y: 0 },
1236
1240
  transition: { duration: 0.3, delay: 0 },
1237
- children: /* @__PURE__ */ y(E, { children: [
1238
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m }),
1239
- u && !n && /* @__PURE__ */ y(E, { children: [
1241
+ children: /* @__PURE__ */ f(E, { children: [
1242
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: u }),
1243
+ m && !n && /* @__PURE__ */ f(E, { children: [
1240
1244
  " ",
1241
1245
  /* @__PURE__ */ i(
1242
1246
  "button",
@@ -1260,7 +1264,7 @@ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1260
1264
  }
1261
1265
  )
1262
1266
  ] }),
1263
- u && n && /* @__PURE__ */ y(E, { children: [
1267
+ m && n && /* @__PURE__ */ f(E, { children: [
1264
1268
  " ",
1265
1269
  /* @__PURE__ */ i(
1266
1270
  "button",
@@ -1285,11 +1289,11 @@ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1285
1289
  ] })
1286
1290
  }
1287
1291
  ) });
1288
- }, Oe = ({ isLatest: e = !1, durationSeconds: t, t: n }) => {
1292
+ }, Le = ({ isLatest: e = !1, durationSeconds: t, t: n }) => {
1289
1293
  const r = n.addingSources;
1290
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1294
+ return /* @__PURE__ */ f("div", { style: { padding: "16px" }, children: [
1291
1295
  /* @__PURE__ */ i(
1292
- x.div,
1296
+ k.div,
1293
1297
  {
1294
1298
  style: {
1295
1299
  display: "flex",
@@ -1301,7 +1305,7 @@ const L = 5, Re = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1301
1305
  animate: { opacity: 1, y: 0 },
1302
1306
  transition: { duration: 0.3, delay: 0 },
1303
1307
  children: e && !t ? /* @__PURE__ */ i(
1304
- D,
1308
+ P,
1305
1309
  {
1306
1310
  text: r,
1307
1311
  duration: 2.5,
@@ -1338,9 +1342,9 @@ function ze(e, t) {
1338
1342
  const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
1339
1343
  return S(t.pageMultiple, { list: r, n });
1340
1344
  }
1341
- const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1345
+ const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ f("div", { style: { padding: "16px" }, children: [
1342
1346
  /* @__PURE__ */ i(
1343
- x.div,
1347
+ k.div,
1344
1348
  {
1345
1349
  style: {
1346
1350
  marginBottom: "10px",
@@ -1372,14 +1376,17 @@ const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ y("div", { s
1372
1376
  onSourceClick: n,
1373
1377
  t: r
1374
1378
  }) => {
1375
- const [l, s] = v(!1), a = !!n, u = e.pageNumbers ?? [], d = ze(u, r);
1376
- return /* @__PURE__ */ y(
1377
- x.div,
1379
+ const [l, s] = v(!1), a = !!n, m = e.pageNumbers ?? [], d = ze(m, r);
1380
+ return /* @__PURE__ */ f(
1381
+ k.div,
1378
1382
  {
1379
1383
  initial: { opacity: 0, scale: 0.9 },
1380
1384
  animate: { opacity: 1, scale: 1 },
1381
1385
  transition: { duration: 0.25, delay: t * 0.05 },
1382
- onClick: a ? () => n(e.memoryId) : void 0,
1386
+ onClick: a ? () => n({
1387
+ memoryId: e.memoryId,
1388
+ pageNumbers: [...m]
1389
+ }) : void 0,
1383
1390
  onMouseEnter: a ? () => s(!0) : void 0,
1384
1391
  onMouseLeave: a ? () => s(!1) : void 0,
1385
1392
  style: {
@@ -1432,7 +1439,7 @@ const $e = ({ data: e, onSourceClick: t, t: n }) => /* @__PURE__ */ y("div", { s
1432
1439
  height: r,
1433
1440
  backgroundColor: e
1434
1441
  };
1435
- return /* @__PURE__ */ y(
1442
+ return /* @__PURE__ */ f(
1436
1443
  "span",
1437
1444
  {
1438
1445
  style: {
@@ -1470,15 +1477,15 @@ function We({
1470
1477
  }) {
1471
1478
  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" });
1472
1479
  }
1473
- const N = 80;
1480
+ const j = 80;
1474
1481
  function He({
1475
1482
  memory: e,
1476
1483
  completed: t,
1477
1484
  t: n
1478
1485
  }) {
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;
1480
- return /* @__PURE__ */ y(
1481
- x.div,
1486
+ const [r, l] = v(!1), s = e.result ?? e.error, a = s != null && s.length > j, m = s != null ? r || !a ? s : `${s.slice(0, j)}...` : void 0, d = a, o = e.error != null;
1487
+ return /* @__PURE__ */ f(
1488
+ k.div,
1482
1489
  {
1483
1490
  initial: { opacity: 0 },
1484
1491
  animate: { opacity: 1 },
@@ -1509,7 +1516,7 @@ function He({
1509
1516
  children: /* @__PURE__ */ i(We, { memory: e, completed: t })
1510
1517
  }
1511
1518
  ),
1512
- /* @__PURE__ */ y(
1519
+ /* @__PURE__ */ f(
1513
1520
  "div",
1514
1521
  {
1515
1522
  style: {
@@ -1526,7 +1533,7 @@ function He({
1526
1533
  children: e.memoryTitle
1527
1534
  }
1528
1535
  ),
1529
- u != null && /* @__PURE__ */ i(
1536
+ m != null && /* @__PURE__ */ i(
1530
1537
  "span",
1531
1538
  {
1532
1539
  style: {
@@ -1535,7 +1542,7 @@ function He({
1535
1542
  lineHeight: 1.4,
1536
1543
  whiteSpace: r ? "pre-wrap" : void 0
1537
1544
  },
1538
- children: u
1545
+ children: m
1539
1546
  }
1540
1547
  ),
1541
1548
  d && /* @__PURE__ */ i(
@@ -1556,7 +1563,7 @@ function He({
1556
1563
  }
1557
1564
  );
1558
1565
  }
1559
- const Ue = ({ data: e, completed: t, t: n }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((r) => /* @__PURE__ */ i(
1566
+ const Ne = ({ data: e, completed: t, t: n }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((r) => /* @__PURE__ */ i(
1560
1567
  He,
1561
1568
  {
1562
1569
  memory: r,
@@ -1565,7 +1572,7 @@ const Ue = ({ data: e, completed: t, t: n }) => /* @__PURE__ */ i("div", { style
1565
1572
  },
1566
1573
  r.memoryId
1567
1574
  )) });
1568
- function _e(e, t) {
1575
+ function Ue(e, t) {
1569
1576
  if (e.length === 0) return "";
1570
1577
  if (e.length === 1)
1571
1578
  return S(t.pageSingle, { n: e[0] });
@@ -1577,14 +1584,14 @@ function _e(e, t) {
1577
1584
  const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
1578
1585
  return S(t.pageMultiple, { list: r, n });
1579
1586
  }
1580
- function je(e, t) {
1587
+ function _e(e, t) {
1581
1588
  return e === 1 ? t.chunkFound : S(t.chunksFound, { n: e });
1582
1589
  }
1583
- const Ne = ({ data: e, t }) => {
1590
+ const je = ({ data: e, t }) => {
1584
1591
  const [n, r] = v(!1), l = e.chunks.length, s = l > 0;
1585
- return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1586
- /* @__PURE__ */ y(
1587
- x.div,
1592
+ return /* @__PURE__ */ f("div", { style: { padding: "10px" }, children: [
1593
+ /* @__PURE__ */ f(
1594
+ k.div,
1588
1595
  {
1589
1596
  initial: { opacity: 0 },
1590
1597
  animate: { opacity: 1 },
@@ -1601,7 +1608,7 @@ const Ne = ({ data: e, t }) => {
1601
1608
  },
1602
1609
  children: [
1603
1610
  /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1604
- /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: je(l, t) }),
1611
+ /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: _e(l, t) }),
1605
1612
  s && /* @__PURE__ */ i(
1606
1613
  "span",
1607
1614
  {
@@ -1617,7 +1624,7 @@ const Ne = ({ data: e, t }) => {
1617
1624
  }
1618
1625
  ),
1619
1626
  n && s && /* @__PURE__ */ i(
1620
- x.div,
1627
+ k.div,
1621
1628
  {
1622
1629
  initial: { opacity: 0, height: 0 },
1623
1630
  animate: { opacity: 1, height: "auto" },
@@ -1630,9 +1637,9 @@ const Ne = ({ data: e, t }) => {
1630
1637
  flexDirection: "column",
1631
1638
  gap: 8
1632
1639
  },
1633
- children: e.chunks.map((a, u) => {
1634
- const d = a.pageNumbers ?? [], o = _e(d, t);
1635
- return /* @__PURE__ */ y(
1640
+ children: e.chunks.map((a, m) => {
1641
+ const d = a.pageNumbers ?? [], o = Ue(d, t);
1642
+ return /* @__PURE__ */ f(
1636
1643
  "div",
1637
1644
  {
1638
1645
  style: {
@@ -1655,7 +1662,7 @@ const Ne = ({ data: e, t }) => {
1655
1662
  children: a.content
1656
1663
  }
1657
1664
  ),
1658
- /* @__PURE__ */ y(
1665
+ /* @__PURE__ */ f(
1659
1666
  "div",
1660
1667
  {
1661
1668
  style: {
@@ -1674,7 +1681,7 @@ const Ne = ({ data: e, t }) => {
1674
1681
  )
1675
1682
  ]
1676
1683
  },
1677
- u
1684
+ m
1678
1685
  );
1679
1686
  })
1680
1687
  }
@@ -1695,8 +1702,8 @@ function Ge({
1695
1702
  showShimmerForPrimary: n
1696
1703
  }) {
1697
1704
  const r = e.result != null, l = e.error != null, s = qe(e, t);
1698
- return /* @__PURE__ */ y(
1699
- x.div,
1705
+ return /* @__PURE__ */ f(
1706
+ k.div,
1700
1707
  {
1701
1708
  initial: { opacity: 0 },
1702
1709
  animate: { opacity: 1 },
@@ -1707,7 +1714,7 @@ function Ge({
1707
1714
  borderBottom: "1px solid #eee",
1708
1715
  display: "flex",
1709
1716
  flexDirection: "row",
1710
- alignItems: "flex-start",
1717
+ alignItems: "center",
1711
1718
  gap: "10px",
1712
1719
  minWidth: 0
1713
1720
  },
@@ -1720,13 +1727,12 @@ function Ge({
1720
1727
  alignItems: "center",
1721
1728
  justifyContent: "center",
1722
1729
  flexShrink: 0,
1723
- width: 32,
1724
- paddingTop: 2
1730
+ width: 32
1725
1731
  },
1726
1732
  children: /* @__PURE__ */ i(Ke, { item: e })
1727
1733
  }
1728
1734
  ),
1729
- /* @__PURE__ */ y(
1735
+ /* @__PURE__ */ f(
1730
1736
  "div",
1731
1737
  {
1732
1738
  style: {
@@ -1738,7 +1744,7 @@ function Ge({
1738
1744
  },
1739
1745
  children: [
1740
1746
  /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !r && !l && n ? /* @__PURE__ */ i(
1741
- D,
1747
+ P,
1742
1748
  {
1743
1749
  text: s,
1744
1750
  duration: 2.5,
@@ -1774,13 +1780,13 @@ function Ge({
1774
1780
  const Xe = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1775
1781
  const l = W(() => {
1776
1782
  let s = -1;
1777
- return e.memoryTypes.forEach((a, u) => {
1778
- a.result == null && a.error == null && (s = u);
1783
+ return e.memoryTypes.forEach((a, m) => {
1784
+ a.result == null && a.error == null && (s = m);
1779
1785
  }), s;
1780
1786
  }, [e.memoryTypes]);
1781
- return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1787
+ return /* @__PURE__ */ f("div", { style: { padding: "10px" }, children: [
1782
1788
  t && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
1783
- D,
1789
+ P,
1784
1790
  {
1785
1791
  text: r.searchingMemoryTypes,
1786
1792
  duration: 2.5,
@@ -1814,26 +1820,31 @@ const Xe = ({ data: e, isLatest: t = !1, durationSeconds: n, t: r }) => {
1814
1820
  function Je(e, t) {
1815
1821
  if (e.length === 0) return "";
1816
1822
  if (e.length === 1)
1817
- return S(t.pageSingle, { n: e[0] });
1823
+ return S(t.memorySearchPagesSingle, {
1824
+ n: e[0]
1825
+ });
1818
1826
  if (e.length === 2)
1819
- return S(t.pageTwo, {
1827
+ return S(t.memorySearchPagesTwo, {
1820
1828
  a: e[0],
1821
1829
  b: e[1]
1822
1830
  });
1823
1831
  const n = e[e.length - 1], r = e.slice(0, -1).join(", ");
1824
- return S(t.pageMultiple, { list: r, n });
1832
+ return S(t.memorySearchPagesMultiple, {
1833
+ list: r,
1834
+ n
1835
+ });
1825
1836
  }
1826
1837
  const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
1827
1838
  const r = e.chunkResults.chunks, l = !!t;
1828
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1839
+ return /* @__PURE__ */ f("div", { style: { padding: "16px" }, children: [
1829
1840
  /* @__PURE__ */ i(
1830
- x.div,
1841
+ k.div,
1831
1842
  {
1832
1843
  style: {
1833
1844
  marginBottom: "12px",
1834
- fontSize: "13px",
1835
- fontWeight: 600,
1836
- color: "#333"
1845
+ fontSize: "12px",
1846
+ fontWeight: 500,
1847
+ color: "#9ca3af"
1837
1848
  },
1838
1849
  initial: { opacity: 0, y: -6 },
1839
1850
  animate: { opacity: 1, y: 0 },
@@ -1849,8 +1860,8 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
1849
1860
  flexDirection: "column",
1850
1861
  gap: 0
1851
1862
  },
1852
- children: r.map((s, a) => /* @__PURE__ */ y(
1853
- x.div,
1863
+ children: r.map((s, a) => /* @__PURE__ */ f(
1864
+ k.div,
1854
1865
  {
1855
1866
  initial: { opacity: 0 },
1856
1867
  animate: { opacity: 1 },
@@ -1866,7 +1877,7 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
1866
1877
  minWidth: 0
1867
1878
  },
1868
1879
  children: [
1869
- /* @__PURE__ */ y(
1880
+ /* @__PURE__ */ f(
1870
1881
  "div",
1871
1882
  {
1872
1883
  style: {
@@ -1888,37 +1899,42 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
1888
1899
  children: s.memoryTitle
1889
1900
  }
1890
1901
  ),
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
1902
  /* @__PURE__ */ i(
1907
1903
  "span",
1908
1904
  {
1909
1905
  style: {
1910
- fontSize: 12,
1911
- color: "#666",
1912
- lineHeight: 1.45,
1906
+ fontSize: 13,
1907
+ color: "#1f2937",
1908
+ lineHeight: 1.5,
1913
1909
  whiteSpace: "pre-wrap",
1914
1910
  wordBreak: "break-word"
1915
1911
  },
1916
1912
  children: s.content
1917
1913
  }
1918
1914
  ),
1919
- /* @__PURE__ */ i("span", { style: { fontSize: 11, color: "#999" }, children: S(n.scoreLabel, {
1920
- n: s.score.toFixed(2)
1921
- }) })
1915
+ /* @__PURE__ */ i(
1916
+ "div",
1917
+ {
1918
+ style: {
1919
+ fontSize: 11,
1920
+ fontWeight: 400,
1921
+ color: "#94a3b8",
1922
+ lineHeight: 1.35
1923
+ },
1924
+ children: [
1925
+ s.memoryTypeName != null && s.memoryTypeName !== "" ? s.memoryTypeName : void 0,
1926
+ S(n.scoreLabel, {
1927
+ n: s.score.toFixed(2)
1928
+ }),
1929
+ s.pageNumbers.length > 0 ? Je(
1930
+ s.pageNumbers,
1931
+ n
1932
+ ) : n.pagesNotAvailable
1933
+ ].filter(
1934
+ (m) => m != null && m !== ""
1935
+ ).join(" · ")
1936
+ }
1937
+ )
1922
1938
  ]
1923
1939
  }
1924
1940
  ),
@@ -1926,7 +1942,10 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
1926
1942
  "button",
1927
1943
  {
1928
1944
  type: "button",
1929
- onClick: () => t(s.memoryId),
1945
+ onClick: () => t({
1946
+ memoryId: s.memoryId,
1947
+ pageNumbers: [...s.pageNumbers]
1948
+ }),
1930
1949
  style: {
1931
1950
  flexShrink: 0,
1932
1951
  alignSelf: "center",
@@ -1951,7 +1970,7 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
1951
1970
  )
1952
1971
  ] });
1953
1972
  }, Ye = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1954
- x.div,
1973
+ k.div,
1955
1974
  {
1956
1975
  initial: { opacity: 0, y: -10 },
1957
1976
  animate: { opacity: 1, y: 0 },
@@ -1987,16 +2006,16 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
1987
2006
  const a = (d) => {
1988
2007
  const o = d.item.data;
1989
2008
  if (o.taskType === "StreamingChatCompletion" && o.eventType === "Text")
1990
- return /* @__PURE__ */ i(j, { text: o.text });
2009
+ return /* @__PURE__ */ i(_, { text: o.text });
1991
2010
  if (o.taskType === "StructuredChatCompletion" && o.eventType === "Json")
1992
2011
  return /* @__PURE__ */ i(Ae, { data: o });
1993
2012
  if (o.taskType === "MemoryChatCompletion")
1994
2013
  switch (o.eventType) {
1995
2014
  case "Text":
1996
- return /* @__PURE__ */ i(j, { text: o.text });
2015
+ return /* @__PURE__ */ i(_, { text: o.text });
1997
2016
  case "FindMemories":
1998
2017
  return /* @__PURE__ */ i(
1999
- Pe,
2018
+ Re,
2000
2019
  {
2001
2020
  data: o,
2002
2021
  isLatest: d.isLatest,
@@ -2005,10 +2024,10 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
2005
2024
  }
2006
2025
  );
2007
2026
  case "FindMemoriesResult":
2008
- return /* @__PURE__ */ i(Le, { data: o, t: n });
2027
+ return /* @__PURE__ */ i(Oe, { data: o, t: n });
2009
2028
  case "Search":
2010
2029
  return /* @__PURE__ */ i(
2011
- Re,
2030
+ De,
2012
2031
  {
2013
2032
  data: o,
2014
2033
  isLatest: d.isLatest,
@@ -2018,7 +2037,7 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
2018
2037
  );
2019
2038
  case "FindSources":
2020
2039
  return /* @__PURE__ */ i(
2021
- Oe,
2040
+ Le,
2022
2041
  {
2023
2042
  data: o,
2024
2043
  isLatest: d.isLatest,
@@ -2037,7 +2056,7 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
2037
2056
  );
2038
2057
  case "ExploreMemories":
2039
2058
  return /* @__PURE__ */ i(
2040
- Ue,
2059
+ Ne,
2041
2060
  {
2042
2061
  data: o,
2043
2062
  completed: d.completed,
@@ -2046,7 +2065,7 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
2046
2065
  }
2047
2066
  );
2048
2067
  case "ChunkResult":
2049
- return /* @__PURE__ */ i(Ne, { data: o, t: n });
2068
+ return /* @__PURE__ */ i(je, { data: o, t: n });
2050
2069
  case "Completed":
2051
2070
  return null;
2052
2071
  }
@@ -2076,7 +2095,7 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
2076
2095
  };
2077
2096
  if (e.length === 0)
2078
2097
  return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
2079
- D,
2098
+ P,
2080
2099
  {
2081
2100
  text: t ?? n.processingYourTask,
2082
2101
  duration: 1.5,
@@ -2086,14 +2105,14 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
2086
2105
  shimmerColor: "#000"
2087
2106
  }
2088
2107
  ) });
2089
- const u = e.filter((d, o) => {
2108
+ const m = e.filter((d, o) => {
2090
2109
  const c = d.item.data;
2091
2110
  return c.taskType === "MemoryChatCompletion" && c.eventType === "ExploreMemories" ? !e.slice(o + 1).some(
2092
- (f) => f.item.data.taskType === "MemoryChatCompletion" && f.item.data.eventType === "ExploreMemories"
2111
+ (h) => h.item.data.taskType === "MemoryChatCompletion" && h.item.data.eventType === "ExploreMemories"
2093
2112
  ) : !0;
2094
2113
  });
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,
2114
+ return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(q, { children: m.map((d, o) => /* @__PURE__ */ i(
2115
+ k.div,
2097
2116
  {
2098
2117
  id: `agent-task-progress-item-${d.item.progressItemId}`,
2099
2118
  initial: { opacity: 0, y: -20 },
@@ -2114,19 +2133,19 @@ const Ve = ({ data: e, onSearchResultClick: t, t: n }) => {
2114
2133
  onSourceClick: r,
2115
2134
  onSearchResultClick: l
2116
2135
  }) => {
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);
2136
+ const s = Ee(e), a = (e.params.type === "MemoryChatCompletion" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", m = Pe(a);
2118
2137
  return t === "simple" ? /* @__PURE__ */ i(
2119
2138
  we,
2120
2139
  {
2121
2140
  progressViewItems: s,
2122
- t: u
2141
+ t: m
2123
2142
  }
2124
2143
  ) : /* @__PURE__ */ i(
2125
2144
  Qe,
2126
2145
  {
2127
2146
  progressViewItems: s,
2128
2147
  loadingText: e.loadingText,
2129
- t: u,
2148
+ t: m,
2130
2149
  onSourceClick: r,
2131
2150
  onSearchResultClick: l
2132
2151
  }