@fencyai/react 0.1.165 → 0.1.166

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,29 +1,29 @@
1
- import { jsxs as p, jsx as i, Fragment as I } from "react/jsx-runtime";
2
- import { createStream as ae, isStreamTimeoutEvent as se, isStreamNotFoundEvent as le, isAgentTaskProgressItemUpdatedEvent as ce, createAgentTask as de } from "@fencyai/js";
3
- import { createContext as me, useState as v, useRef as F, useEffect as A, useCallback as G, useContext as ue, useMemo as D } from "react";
4
- import { useInView as ye, motion as b, AnimatePresence as J } from "motion/react";
5
- import pe from "react-markdown";
6
- import { Prism as Y } from "react-syntax-highlighter";
7
- import ge from "remark-gfm";
8
- import './assets/index.css';const Z = me(
1
+ import { jsxs as p, jsx as o, Fragment as E } from "react/jsx-runtime";
2
+ import { createStream as se, isStreamTimeoutEvent as le, isStreamNotFoundEvent as ce, isAgentTaskProgressItemUpdatedEvent as de, createAgentTask as me } from "@fencyai/js";
3
+ import { createContext as ue, useState as v, useRef as R, useEffect as A, useCallback as W, useContext as ye, useMemo as P } from "react";
4
+ import { useInView as pe, motion as b, AnimatePresence as re } from "motion/react";
5
+ import ge from "react-markdown";
6
+ import { Prism as ne } from "react-syntax-highlighter";
7
+ import he from "remark-gfm";
8
+ import './assets/index.css';const te = ue(
9
9
  void 0
10
10
  );
11
- async function he(e, r) {
11
+ async function fe(e, r) {
12
12
  const t = e.getReader();
13
13
  let n;
14
14
  for (; !(n = await t.read()).done; )
15
15
  r(n.value);
16
16
  }
17
- function fe(e) {
17
+ function xe(e) {
18
18
  let r, t, n, l = !1;
19
19
  return function(s) {
20
- r === void 0 ? (r = s, t = 0, n = -1) : r = xe(r, s);
20
+ r === void 0 ? (r = s, t = 0, n = -1) : r = Te(r, s);
21
21
  const d = r.length;
22
22
  let m = 0;
23
23
  for (; t < d; ) {
24
24
  l && (r[t] === 10 && (m = ++t), l = !1);
25
- let o = -1;
26
- for (; t < d && o === -1; ++t)
25
+ let i = -1;
26
+ for (; t < d && i === -1; ++t)
27
27
  switch (r[t]) {
28
28
  case 58:
29
29
  n === -1 && (n = t - m);
@@ -31,24 +31,24 @@ function fe(e) {
31
31
  case 13:
32
32
  l = !0;
33
33
  case 10:
34
- o = t;
34
+ i = t;
35
35
  break;
36
36
  }
37
- if (o === -1)
37
+ if (i === -1)
38
38
  break;
39
- e(r.subarray(m, o), n), m = t, n = -1;
39
+ e(r.subarray(m, i), n), m = t, n = -1;
40
40
  }
41
41
  m === d ? r = void 0 : m !== 0 && (r = r.subarray(m), t -= m);
42
42
  };
43
43
  }
44
44
  function Se(e, r, t) {
45
- let n = j();
45
+ let n = X();
46
46
  const l = new TextDecoder();
47
47
  return function(s, d) {
48
48
  if (s.length === 0)
49
- t == null || t(n), n = j();
49
+ t == null || t(n), n = X();
50
50
  else if (d > 0) {
51
- const m = l.decode(s.subarray(0, d)), o = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(o));
51
+ const m = l.decode(s.subarray(0, d)), i = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(i));
52
52
  switch (m) {
53
53
  case "data":
54
54
  n.data = n.data ? n.data + `
@@ -61,18 +61,18 @@ function Se(e, r, t) {
61
61
  e(n.id = a);
62
62
  break;
63
63
  case "retry":
64
- const u = parseInt(a, 10);
65
- isNaN(u) || r(n.retry = u);
64
+ const y = parseInt(a, 10);
65
+ isNaN(y) || r(n.retry = y);
66
66
  break;
67
67
  }
68
68
  }
69
69
  };
70
70
  }
71
- function xe(e, r) {
71
+ function Te(e, r) {
72
72
  const t = new Uint8Array(e.length + r.length);
73
73
  return t.set(e), t.set(r, e.length), t;
74
74
  }
75
- function j() {
75
+ function X() {
76
76
  return {
77
77
  data: "",
78
78
  event: "",
@@ -80,7 +80,7 @@ function j() {
80
80
  retry: void 0
81
81
  };
82
82
  }
83
- var Te = function(e, r) {
83
+ var ke = function(e, r) {
84
84
  var t = {};
85
85
  for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
86
86
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
@@ -88,52 +88,52 @@ var Te = function(e, r) {
88
88
  r.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (t[n[l]] = e[n[l]]);
89
89
  return t;
90
90
  };
91
- const _ = "text/event-stream", ke = 1e3, q = "last-event-id";
92
- function be(e, r) {
93
- var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a = Te(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
- return new Promise((u, y) => {
95
- const f = Object.assign({}, n);
96
- f.accept || (f.accept = _);
91
+ const G = "text/event-stream", be = 1e3, J = "last-event-id";
92
+ function ve(e, r) {
93
+ var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: i } = r, a = ke(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
+ return new Promise((y, u) => {
95
+ const h = Object.assign({}, n);
96
+ h.accept || (h.accept = G);
97
97
  let g;
98
- function x() {
99
- g.abort(), document.hidden || R();
100
- }
101
- m || document.addEventListener("visibilitychange", x);
102
- let h = ke, S = 0;
103
98
  function k() {
104
- document.removeEventListener("visibilitychange", x), window.clearTimeout(S), g.abort();
99
+ g.abort(), document.hidden || F();
100
+ }
101
+ m || document.addEventListener("visibilitychange", k);
102
+ let x = be, f = 0;
103
+ function T() {
104
+ document.removeEventListener("visibilitychange", k), window.clearTimeout(f), g.abort();
105
105
  }
106
106
  t == null || t.addEventListener("abort", () => {
107
- k(), u();
107
+ T(), y();
108
108
  });
109
- const w = o ?? window.fetch, C = l ?? ve;
110
- async function R() {
111
- var L;
109
+ const C = i ?? window.fetch, w = l ?? Ce;
110
+ async function F() {
111
+ var z;
112
112
  g = new AbortController();
113
113
  try {
114
- const P = await w(e, Object.assign(Object.assign({}, a), { headers: f, signal: g.signal }));
115
- await C(P), await he(P.body, fe(Se((M) => {
116
- M ? f[q] = M : delete f[q];
114
+ const D = await C(e, Object.assign(Object.assign({}, a), { headers: h, signal: g.signal }));
115
+ await w(D), await fe(D.body, xe(Se((M) => {
116
+ M ? h[J] = M : delete h[J];
117
117
  }, (M) => {
118
- h = M;
119
- }, c))), s == null || s(), k(), u();
120
- } catch (P) {
118
+ x = M;
119
+ }, c))), s == null || s(), T(), y();
120
+ } catch (D) {
121
121
  if (!g.signal.aborted)
122
122
  try {
123
- const M = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : h;
124
- window.clearTimeout(S), S = window.setTimeout(R, M);
123
+ const M = (z = d == null ? void 0 : d(D)) !== null && z !== void 0 ? z : x;
124
+ window.clearTimeout(f), f = window.setTimeout(F, M);
125
125
  } catch (M) {
126
- k(), y(M);
126
+ T(), u(M);
127
127
  }
128
128
  }
129
129
  }
130
- R();
130
+ F();
131
131
  });
132
132
  }
133
- function ve(e) {
133
+ function Ce(e) {
134
134
  const r = e.headers.get("content-type");
135
- if (!(r != null && r.startsWith(_)))
136
- throw new Error(`Expected content-type to be ${_}, Actual: ${r}`);
135
+ if (!(r != null && r.startsWith(G)))
136
+ throw new Error(`Expected content-type to be ${G}, Actual: ${r}`);
137
137
  }
138
138
  function we(e) {
139
139
  const r = atob(e), t = new Uint8Array(r.length);
@@ -141,7 +141,7 @@ function we(e) {
141
141
  t[n] = r.charCodeAt(n);
142
142
  return new TextDecoder("utf-8").decode(t);
143
143
  }
144
- function Ce(e) {
144
+ function Ie(e) {
145
145
  return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
146
146
  }
147
147
  class Ee {
@@ -169,7 +169,7 @@ class Ee {
169
169
  "X-Fency-Publishable-Key": this.fency.publishableKey,
170
170
  "X-Fency-Stream-Token": r.stream.token
171
171
  };
172
- be(l, {
172
+ ve(l, {
173
173
  headers: c,
174
174
  signal: n.signal,
175
175
  onopen: async (s) => {
@@ -183,7 +183,7 @@ class Ee {
183
183
  }
184
184
  },
185
185
  onerror: (s) => {
186
- throw console.error("EventSource error for stream", t, ":", s), this.eventSources.delete(t), this.broadcastError(t, Ce(s)), s;
186
+ throw console.error("EventSource error for stream", t, ":", s), this.eventSources.delete(t), this.broadcastError(t, Ie(s)), s;
187
187
  },
188
188
  onclose() {
189
189
  }
@@ -215,66 +215,66 @@ class Ee {
215
215
  this.eventSources.forEach((r) => r.abort()), this.eventSources.clear(), this.subscribers.clear();
216
216
  }
217
217
  }
218
- const Ie = 48e4, Me = 3e5, K = (e) => {
218
+ const Me = 48e4, Ae = 3e5, Y = (e) => {
219
219
  const r = Date.now();
220
- return e.filter((t) => r - t.createdAt < Ie);
220
+ return e.filter((t) => r - t.createdAt < Me);
221
221
  };
222
- function Ar({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
222
+ function Dr({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
223
223
  const [n, l] = v(
224
224
  null
225
- ), [c, s] = v(!0), [d, m] = v(null), [o, a] = v([]), u = F(null), y = F(null);
225
+ ), [c, s] = v(!0), [d, m] = v(null), [i, a] = v([]), y = R(null), u = R(null);
226
226
  A(() => {
227
- e.then((h) => {
228
- l(h), s(!1);
229
- }).catch((h) => {
230
- m(h), s(!1);
227
+ e.then((x) => {
228
+ l(x), s(!1);
229
+ }).catch((x) => {
230
+ m(x), s(!1);
231
231
  });
232
232
  }, [e]), A(() => {
233
- n && !y.current && (y.current = new Ee(n));
233
+ n && !u.current && (u.current = new Ee(n));
234
234
  }, [n]), A(() => {
235
- y.current && y.current.updateStreams(o);
236
- }, [o]), A(() => () => {
237
- var h;
238
- (h = y.current) == null || h.cleanup();
235
+ u.current && u.current.updateStreams(i);
236
+ }, [i]), A(() => () => {
237
+ var x;
238
+ (x = u.current) == null || x.cleanup();
239
239
  }, []), A(() => {
240
- const h = setInterval(() => {
241
- a((S) => {
242
- const k = K(S);
243
- return k.length !== S.length ? k : S;
240
+ const x = setInterval(() => {
241
+ a((f) => {
242
+ const T = Y(f);
243
+ return T.length !== f.length ? T : f;
244
244
  });
245
245
  }, 6e4);
246
- return () => clearInterval(h);
246
+ return () => clearInterval(x);
247
247
  }, []);
248
- const f = G(
249
- async (h = Me) => {
250
- if (u.current)
251
- return u.current;
252
- const S = Date.now(), k = o.length > 0 ? o[o.length - 1] : null;
253
- if (k && S - k.createdAt < h)
254
- return k.stream;
255
- const w = (async () => {
248
+ const h = W(
249
+ async (x = Ae) => {
250
+ if (y.current)
251
+ return y.current;
252
+ const f = Date.now(), T = i.length > 0 ? i[i.length - 1] : null;
253
+ if (T && f - T.createdAt < x)
254
+ return T.stream;
255
+ const C = (async () => {
256
256
  if (!n)
257
257
  throw new Error("Fency instance not initialized");
258
- const C = await r(), R = await ae({
258
+ const w = await r(), F = await se({
259
259
  pk: n.publishableKey,
260
260
  baseUrl: n.baseUrl,
261
- clientToken: (C == null ? void 0 : C.clientToken) ?? ""
261
+ clientToken: (w == null ? void 0 : w.clientToken) ?? ""
262
262
  });
263
- if (R.type === "success") {
264
- const L = {
265
- stream: R.stream,
263
+ if (F.type === "success") {
264
+ const z = {
265
+ stream: F.stream,
266
266
  createdAt: Date.now()
267
267
  };
268
- return a((P) => {
269
- const M = [...P, L];
270
- return K(M);
271
- }), u.current = null, R.stream;
268
+ return a((D) => {
269
+ const M = [...D, z];
270
+ return Y(M);
271
+ }), y.current = null, F.stream;
272
272
  } else
273
- throw u.current = null, new Error("Failed to create stream");
273
+ throw y.current = null, new Error("Failed to create stream");
274
274
  })();
275
- return u.current = w, w;
275
+ return y.current = C, C;
276
276
  },
277
- [n, o]
277
+ [n, i]
278
278
  );
279
279
  if (d)
280
280
  return /* @__PURE__ */ p("div", { children: [
@@ -283,39 +283,39 @@ function Ar({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
283
283
  ] });
284
284
  if (!n)
285
285
  return null;
286
- const g = o.length > 0 ? o[o.length - 1] : null, x = {
286
+ const g = i.length > 0 ? i[i.length - 1] : null, k = {
287
287
  fency: n,
288
288
  loading: c,
289
289
  error: d,
290
- activeStreams: o,
290
+ activeStreams: i,
291
291
  latestStream: g,
292
- eventManager: y.current,
293
- getOrCreateStream: f
292
+ eventManager: u.current,
293
+ getOrCreateStream: h
294
294
  };
295
- return /* @__PURE__ */ i(Z.Provider, { value: x, children: t });
295
+ return /* @__PURE__ */ o(te.Provider, { value: k, children: t });
296
296
  }
297
- function ee() {
298
- const e = ue(Z);
297
+ function oe() {
298
+ const e = ye(te);
299
299
  if (e === void 0)
300
300
  throw new Error("useFencyContext must be used within a FencyProvider");
301
301
  return e;
302
302
  }
303
- const Ae = (e) => {
303
+ const Re = (e) => {
304
304
  try {
305
305
  const r = JSON.parse(e);
306
306
  return Fe(r);
307
307
  } catch (r) {
308
308
  return console.error("Error parsing message:", r), null;
309
309
  }
310
- }, Fe = (e) => se(e) ? Re(e) : le(e) ? Pe(e) : ce(e) ? De(e) : null, Re = (e) => ({
310
+ }, Fe = (e) => le(e) ? Pe(e) : ce(e) ? De(e) : de(e) ? Le(e) : null, Pe = (e) => ({
311
311
  type: "STREAM_TIMEOUT",
312
312
  streamId: e.streamId,
313
313
  timestamp: e.timestamp
314
- }), Pe = (e) => ({
314
+ }), De = (e) => ({
315
315
  type: "STREAM_NOT_FOUND",
316
316
  streamId: e.streamId,
317
317
  timestamp: e.timestamp
318
- }), De = (e) => ({
318
+ }), Le = (e) => ({
319
319
  type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
320
320
  streamId: e.streamId,
321
321
  agentTaskId: e.agentTaskId,
@@ -323,34 +323,34 @@ const Ae = (e) => {
323
323
  timestamp: e.timestamp,
324
324
  createdAt: e.createdAt,
325
325
  data: JSON.parse(e.data)
326
- }), Le = (e) => {
327
- const r = ee(), [t, n] = v(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
326
+ }), ze = (e) => {
327
+ const r = oe(), [t, n] = v(null), l = R(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
328
328
  return A(() => {
329
329
  if (!r.eventManager) return;
330
330
  const s = {
331
- onMessage: (m, o) => {
332
- var u, y, f;
333
- const a = Ae(m);
331
+ onMessage: (m, i) => {
332
+ var y, u, h;
333
+ const a = Re(m);
334
334
  if (a)
335
335
  switch (a.type) {
336
336
  case "STREAM_TIMEOUT":
337
- (u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, a);
337
+ (y = e == null ? void 0 : e.onStreamTimeout) == null || y.call(e, a);
338
338
  break;
339
339
  case "STREAM_NOT_FOUND":
340
- (y = e == null ? void 0 : e.onStreamNotFound) == null || y.call(e, a);
340
+ (u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, a);
341
341
  break;
342
342
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
343
- (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, a);
343
+ (h = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || h.call(e, a);
344
344
  break;
345
345
  }
346
346
  },
347
- onError: (m, o) => {
347
+ onError: (m, i) => {
348
348
  var a;
349
349
  (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
350
350
  streamId: m,
351
351
  error: {
352
352
  code: "UnknownError",
353
- message: o ?? "Unknown error in useStream"
353
+ message: i ?? "Unknown error in useStream"
354
354
  }
355
355
  });
356
356
  }
@@ -379,165 +379,165 @@ const Ae = (e) => {
379
379
  },
380
380
  stream: t
381
381
  };
382
- }, Fr = (e) => {
383
- const r = ee(), [t, n] = v([]), l = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), { createStream: s } = Le({
384
- onAgentTaskProgressItemUpdated: (o) => {
385
- var y;
386
- if (!l.current.has(o.agentTaskId)) return;
387
- const a = o.data;
382
+ }, Lr = (e) => {
383
+ const r = oe(), [t, n] = v([]), l = R(/* @__PURE__ */ new Set()), c = R(/* @__PURE__ */ new Map()), { createStream: s } = ze({
384
+ onAgentTaskProgressItemUpdated: (i) => {
385
+ var u;
386
+ if (!l.current.has(i.agentTaskId)) return;
387
+ const a = i.data;
388
388
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChat" && a.eventType === "Completed" || a.taskType === "MemorySearch" && a.eventType === "Completed") {
389
- const f = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
389
+ const h = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
390
390
  n(
391
- f ? (x) => x.map((h) => {
392
- var w;
393
- if (((w = h.confirmedData) == null ? void 0 : w.taskId) !== o.agentTaskId)
394
- return h;
395
- const k = h.progressItems.some(
396
- (C) => C.progressItemId === o.progressItemId
397
- ) ? h.progressItems.map(
398
- (C) => C.progressItemId === o.progressItemId ? o : C
399
- ) : [...h.progressItems, o];
391
+ h ? (k) => k.map((x) => {
392
+ var C;
393
+ if (((C = x.confirmedData) == null ? void 0 : C.taskId) !== i.agentTaskId)
394
+ return x;
395
+ const T = x.progressItems.some(
396
+ (w) => w.progressItemId === i.progressItemId
397
+ ) ? x.progressItems.map(
398
+ (w) => w.progressItemId === i.progressItemId ? i : w
399
+ ) : [...x.progressItems, i];
400
400
  return {
401
- ...h,
402
- progressItems: k,
401
+ ...x,
402
+ progressItems: T,
403
403
  loading: !1
404
404
  };
405
- }) : (x) => x.map(
406
- (h) => {
407
- var S;
408
- return ((S = h.confirmedData) == null ? void 0 : S.taskId) === o.agentTaskId ? { ...h, loading: !1 } : h;
405
+ }) : (k) => k.map(
406
+ (x) => {
407
+ var f;
408
+ return ((f = x.confirmedData) == null ? void 0 : f.taskId) === i.agentTaskId ? { ...x, loading: !1 } : x;
409
409
  }
410
410
  )
411
411
  );
412
412
  const g = c.current.get(
413
- o.agentTaskId
413
+ i.agentTaskId
414
414
  );
415
- g && (c.current.delete(o.agentTaskId), g(a));
415
+ g && (c.current.delete(i.agentTaskId), g(a));
416
416
  return;
417
417
  }
418
- (y = e.onAgentTaskProgressItemUpdated) == null || y.call(e, o), n(
419
- (f) => f.map((g) => {
420
- var S;
421
- if (((S = g.confirmedData) == null ? void 0 : S.taskId) !== o.agentTaskId)
418
+ (u = e.onAgentTaskProgressItemUpdated) == null || u.call(e, i), n(
419
+ (h) => h.map((g) => {
420
+ var f;
421
+ if (((f = g.confirmedData) == null ? void 0 : f.taskId) !== i.agentTaskId)
422
422
  return g;
423
- const h = g.progressItems.some(
424
- (k) => k.progressItemId === o.progressItemId
423
+ const x = g.progressItems.some(
424
+ (T) => T.progressItemId === i.progressItemId
425
425
  ) ? g.progressItems.map(
426
- (k) => k.progressItemId === o.progressItemId ? o : k
427
- ) : [...g.progressItems, o];
428
- return { ...g, progressItems: h };
426
+ (T) => T.progressItemId === i.progressItemId ? i : T
427
+ ) : [...g.progressItems, i];
428
+ return { ...g, progressItems: x };
429
429
  })
430
430
  );
431
431
  },
432
- onStreamError: (o) => {
432
+ onStreamError: (i) => {
433
433
  var a;
434
- (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), n(
435
- (u) => u.map((y) => y.streamId !== o.streamId || !y.loading ? y : { ...y, loading: !1, error: o.error })
434
+ (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, i), n(
435
+ (y) => y.map((u) => u.streamId !== i.streamId || !u.loading ? u : { ...u, loading: !1, error: i.error })
436
436
  );
437
437
  },
438
- onStreamNotFound: (o) => {
438
+ onStreamNotFound: (i) => {
439
439
  var a;
440
- (a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, o);
440
+ (a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, i);
441
441
  },
442
- onStreamTimeout: (o) => {
442
+ onStreamTimeout: (i) => {
443
443
  var a;
444
- (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, o);
444
+ (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, i);
445
445
  }
446
- }), d = G(
447
- async (o, a) => {
448
- var f;
449
- const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, y = await s();
450
- if (y.type === "success") {
451
- const g = (/* @__PURE__ */ new Date()).toISOString(), x = {
452
- taskKey: u,
453
- streamId: y.stream.id,
446
+ }), d = W(
447
+ async (i, a) => {
448
+ var h;
449
+ const y = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, u = await s();
450
+ if (u.type === "success") {
451
+ const g = (/* @__PURE__ */ new Date()).toISOString(), k = {
452
+ taskKey: y,
453
+ streamId: u.stream.id,
454
454
  triggeredAt: g,
455
455
  confirmedData: null,
456
456
  error: null,
457
- params: o,
457
+ params: i,
458
458
  progressItems: [],
459
459
  loading: !0,
460
460
  loadingText: a == null ? void 0 : a.loadingText
461
461
  };
462
- n((k) => [...k, x]), (f = a == null ? void 0 : a.onTaskRegistered) == null || f.call(a, x);
463
- const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(o.type), S = await de({
462
+ n((T) => [...T, k]), (h = a == null ? void 0 : a.onTaskRegistered) == null || h.call(a, k);
463
+ const { clientToken: x } = await e.fetchCreateAgentTaskClientToken(i.type), f = await me({
464
464
  pk: r.fency.publishableKey,
465
465
  baseUrl: r.fency.baseUrl,
466
- clientToken: h,
467
- streamToken: y.stream.token,
466
+ clientToken: x,
467
+ streamToken: u.stream.token,
468
468
  request: {
469
- streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
470
- messages: o.messages,
471
- model: o.model
469
+ streamingChatCompletionTask: i.type === "StreamingChatCompletion" ? {
470
+ messages: i.messages,
471
+ model: i.model
472
472
  } : void 0,
473
- structuredChatCompletionTask: o.type === "StructuredChatCompletion" ? {
474
- messages: o.messages,
475
- jsonSchema: o.jsonSchema,
476
- model: o.model
473
+ structuredChatCompletionTask: i.type === "StructuredChatCompletion" ? {
474
+ messages: i.messages,
475
+ jsonSchema: i.jsonSchema,
476
+ model: i.model
477
477
  } : void 0,
478
- memoryChatTask: o.type === "MemoryChat" ? {
479
- messages: o.messages,
480
- model: o.model,
481
- language: o.language ?? "en",
482
- chunkLimit: o.chunkLimit ?? 10,
483
- memoryScanLimit: o.memoryScanLimit ?? 3
478
+ memoryChatTask: i.type === "MemoryChat" ? {
479
+ messages: i.messages,
480
+ model: i.model,
481
+ language: i.language ?? "en",
482
+ chunkLimit: i.chunkLimit ?? 10,
483
+ memoryScanLimit: i.memoryScanLimit ?? 3
484
484
  } : void 0,
485
- memorySearchTask: o.type === "MemorySearch" ? {
486
- query: o.query,
487
- model: o.model,
488
- language: o.language ?? "en",
489
- chunkLimit: o.chunkLimit ?? 10,
490
- contextExpansion: o.contextExpansion,
491
- ...o.queryExpansion != null ? {
492
- queryExpansion: o.queryExpansion
485
+ memorySearchTask: i.type === "MemorySearch" ? {
486
+ query: i.query,
487
+ model: i.model,
488
+ language: i.language ?? "en",
489
+ chunkLimit: i.chunkLimit ?? 10,
490
+ contextExpansion: i.contextExpansion,
491
+ ...i.queryExpansion != null ? {
492
+ queryExpansion: i.queryExpansion
493
493
  } : {}
494
494
  } : void 0
495
495
  }
496
496
  });
497
- if (S.type === "success" && S.agentTask) {
497
+ if (f.type === "success" && f.agentTask) {
498
498
  l.current.add(
499
- S.agentTask.id
500
- ), n((w) => [
501
- ...w.filter((C) => C.taskKey !== u),
499
+ f.agentTask.id
500
+ ), n((C) => [
501
+ ...C.filter((w) => w.taskKey !== y),
502
502
  {
503
- taskKey: u,
504
- streamId: y.stream.id,
503
+ taskKey: y,
504
+ streamId: u.stream.id,
505
505
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
506
- taskId: S.agentTask.id,
507
- createdAt: S.agentTask.createdAt,
506
+ taskId: f.agentTask.id,
507
+ createdAt: f.agentTask.createdAt,
508
508
  error: null,
509
- params: o,
509
+ params: i,
510
510
  progressItems: [],
511
511
  loading: !0,
512
512
  loadingText: a == null ? void 0 : a.loadingText,
513
513
  confirmedData: {
514
- taskId: S.agentTask.id,
515
- createdAt: S.agentTask.createdAt
514
+ taskId: f.agentTask.id,
515
+ createdAt: f.agentTask.createdAt
516
516
  }
517
517
  }
518
518
  ]);
519
- const k = await new Promise((w) => {
519
+ const T = await new Promise((C) => {
520
520
  c.current.set(
521
- S.agentTask.id,
522
- w
521
+ f.agentTask.id,
522
+ C
523
523
  );
524
524
  });
525
525
  return {
526
526
  type: "success",
527
- streamId: y.stream.id,
528
- agentTaskId: S.agentTask.id,
529
- response: k
527
+ streamId: u.stream.id,
528
+ agentTaskId: f.agentTask.id,
529
+ response: T
530
530
  };
531
531
  } else {
532
- if (S.type === "error")
533
- return n((k) => [
534
- ...k.filter((w) => w.taskKey !== u),
532
+ if (f.type === "error")
533
+ return n((T) => [
534
+ ...T.filter((C) => C.taskKey !== y),
535
535
  {
536
- taskKey: u,
536
+ taskKey: y,
537
537
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
538
- streamId: y.stream.id,
539
- params: o,
540
- error: S.error,
538
+ streamId: u.stream.id,
539
+ params: i,
540
+ error: f.error,
541
541
  progressItems: [],
542
542
  loading: !1,
543
543
  loadingText: a == null ? void 0 : a.loadingText,
@@ -545,21 +545,21 @@ const Ae = (e) => {
545
545
  }
546
546
  ]), {
547
547
  type: "error",
548
- error: S.error
548
+ error: f.error
549
549
  };
550
550
  {
551
- const k = {
551
+ const T = {
552
552
  message: "No response received",
553
553
  code: "UnknownError"
554
554
  };
555
- return n((w) => [
556
- ...w.filter((C) => C.taskKey !== u),
555
+ return n((C) => [
556
+ ...C.filter((w) => w.taskKey !== y),
557
557
  {
558
- taskKey: u,
558
+ taskKey: y,
559
559
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
560
- streamId: y.stream.id,
561
- error: k,
562
- params: o,
560
+ streamId: u.stream.id,
561
+ error: T,
562
+ params: i,
563
563
  progressItems: [],
564
564
  loading: !1,
565
565
  loadingText: a == null ? void 0 : a.loadingText,
@@ -567,17 +567,17 @@ const Ae = (e) => {
567
567
  }
568
568
  ]), {
569
569
  type: "error",
570
- error: k
570
+ error: T
571
571
  };
572
572
  }
573
573
  }
574
574
  } else
575
- return console.error(y.error), y;
575
+ return console.error(u.error), u;
576
576
  },
577
577
  [r, s, e.fetchCreateAgentTaskClientToken]
578
- ), m = D(() => {
578
+ ), m = P(() => {
579
579
  if (t.length !== 0)
580
- return [...t].sort((o, a) => new Date(a.triggeredAt).getTime() - new Date(o.triggeredAt).getTime())[0];
580
+ return [...t].sort((i, a) => new Date(a.triggeredAt).getTime() - new Date(i.triggeredAt).getTime())[0];
581
581
  }, [t]);
582
582
  return A(() => () => {
583
583
  l.current.clear(), c.current.clear();
@@ -587,7 +587,7 @@ const Ae = (e) => {
587
587
  latest: m
588
588
  };
589
589
  };
590
- function ze(e) {
590
+ function Ne(e) {
591
591
  return e.progressItems.map((r, t) => {
592
592
  const n = e.progressItems[t + 1], l = n != null;
593
593
  let c;
@@ -603,7 +603,7 @@ function ze(e) {
603
603
  };
604
604
  });
605
605
  }
606
- function E({
606
+ function I({
607
607
  text: e,
608
608
  duration: r = 2,
609
609
  delay: t = 0,
@@ -613,16 +613,16 @@ function E({
613
613
  startOnView: s = !1,
614
614
  once: d = !1,
615
615
  inViewMargin: m,
616
- spread: o = 2,
616
+ spread: i = 2,
617
617
  color: a = "#999",
618
- shimmerColor: u = "#000",
619
- direction: y = "fromBottom"
618
+ shimmerColor: y = "#000",
619
+ direction: u = "fromBottom"
620
620
  }) {
621
- const f = F(null), g = ye(f, { once: d, margin: m }), x = D(() => e.length * o, [e, o]), h = !s || g, S = y === "fromBottom" ? "100% center" : "-100% center", k = y === "fromBottom" ? "0% center" : "200% center";
622
- return /* @__PURE__ */ i(
621
+ const h = R(null), g = pe(h, { once: d, margin: m }), k = P(() => e.length * i, [e, i]), x = !s || g, f = u === "fromBottom" ? "100% center" : "-100% center", T = u === "fromBottom" ? "0% center" : "200% center";
622
+ return /* @__PURE__ */ o(
623
623
  b.span,
624
624
  {
625
- ref: f,
625
+ ref: h,
626
626
  className: c,
627
627
  style: {
628
628
  position: "relative",
@@ -633,18 +633,18 @@ function E({
633
633
  color: "transparent",
634
634
  WebkitTextFillColor: "transparent",
635
635
  backgroundRepeat: "no-repeat, padding-box",
636
- "--spread": `${x}px`,
636
+ "--spread": `${k}px`,
637
637
  "--base-color": a,
638
- "--shimmer-color": u,
638
+ "--shimmer-color": y,
639
639
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
640
640
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
641
641
  },
642
642
  initial: {
643
- backgroundPosition: S,
643
+ backgroundPosition: f,
644
644
  opacity: 0
645
645
  },
646
- animate: h ? {
647
- backgroundPosition: k,
646
+ animate: x ? {
647
+ backgroundPosition: T,
648
648
  opacity: 1
649
649
  } : {},
650
650
  transition: {
@@ -701,33 +701,33 @@ function Oe(e, r) {
701
701
  return r.sourcesAdded;
702
702
  case "ExploreMemories":
703
703
  return e.completed ? r.memoriesExplored : r.exploringMemories;
704
- case "ChunkResult":
704
+ case "ChunkResults":
705
705
  return r.chunksRetrieved;
706
706
  case "Completed":
707
707
  return r.completed;
708
708
  }
709
709
  return r.processing;
710
710
  }
711
- const Ne = ({ progressViewItems: e, t: r }) => {
711
+ const Be = ({ progressViewItems: e, t: r }) => {
712
712
  const t = e[e.length - 1];
713
713
  if (!t) return null;
714
714
  const n = Oe(t, r);
715
- return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(J, { mode: "wait", children: /* @__PURE__ */ i(
715
+ return /* @__PURE__ */ o("div", { className: "simple-mode-container", children: /* @__PURE__ */ o(re, { mode: "wait", children: /* @__PURE__ */ o(
716
716
  b.div,
717
717
  {
718
718
  initial: { opacity: 0, y: 10 },
719
719
  animate: { opacity: 1, y: 0 },
720
720
  exit: { opacity: 0, y: -10 },
721
721
  transition: { duration: 0.3 },
722
- children: t.completed ? /* @__PURE__ */ i(
722
+ children: t.completed ? /* @__PURE__ */ o(
723
723
  "div",
724
724
  {
725
725
  className: "simple-mode-title",
726
726
  style: { color: "#666" },
727
727
  children: n
728
728
  }
729
- ) : /* @__PURE__ */ i(
730
- E,
729
+ ) : /* @__PURE__ */ o(
730
+ I,
731
731
  {
732
732
  text: n,
733
733
  className: "simple-mode-title",
@@ -740,7 +740,7 @@ const Ne = ({ progressViewItems: e, t: r }) => {
740
740
  },
741
741
  t.item.progressItemId
742
742
  ) }) });
743
- }, re = {
743
+ }, ie = {
744
744
  'code[class*="language-"]': {
745
745
  color: "#f8f8f2",
746
746
  background: "none",
@@ -891,57 +891,57 @@ const Ne = ({ progressViewItems: e, t: r }) => {
891
891
  italic: {
892
892
  fontStyle: "italic"
893
893
  }
894
- }, V = ({
894
+ }, Z = ({
895
895
  text: e
896
- }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
896
+ }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
897
897
  b.div,
898
898
  {
899
899
  className: "fency-markdown-body-raw",
900
900
  initial: { opacity: 0, y: -10 },
901
901
  animate: { opacity: 1, y: 0 },
902
902
  transition: { duration: 0.3, delay: 0 },
903
- children: /* @__PURE__ */ i(
904
- pe,
903
+ children: /* @__PURE__ */ o(
904
+ ge,
905
905
  {
906
- remarkPlugins: [ge],
906
+ remarkPlugins: [he],
907
907
  components: {
908
908
  code(r) {
909
909
  const { children: t, className: n, node: l, ref: c, ...s } = r, d = /language-(\w+)/.exec(n || "");
910
910
  return d ? (
911
911
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
912
- /* @__PURE__ */ i(
913
- Y,
912
+ /* @__PURE__ */ o(
913
+ ne,
914
914
  {
915
915
  ...s,
916
916
  PreTag: "div",
917
917
  children: String(t).replace(/\n$/, ""),
918
918
  language: d[1],
919
- style: re
919
+ style: ie
920
920
  }
921
921
  )
922
- ) : /* @__PURE__ */ i("code", { ...s, className: n, children: String(t) });
922
+ ) : /* @__PURE__ */ o("code", { ...s, className: n, children: String(t) });
923
923
  }
924
924
  },
925
925
  children: e
926
926
  }
927
927
  )
928
928
  }
929
- ) }), Be = ({ data: e }) => {
929
+ ) }), We = ({ data: e }) => {
930
930
  const r = JSON.stringify(
931
931
  JSON.parse(e.response.jsonResponse),
932
932
  null,
933
933
  2
934
934
  );
935
- return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
935
+ return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
936
936
  b.div,
937
937
  {
938
938
  initial: { opacity: 0, y: -10 },
939
939
  animate: { opacity: 1, y: 0 },
940
940
  transition: { duration: 0.3, delay: 0 },
941
- children: /* @__PURE__ */ i(Y, { language: "json", style: re, PreTag: "div", children: r })
941
+ children: /* @__PURE__ */ o(ne, { language: "json", style: ie, PreTag: "div", children: r })
942
942
  }
943
943
  ) });
944
- }, We = {
944
+ }, $e = {
945
945
  en: {
946
946
  error: "Error",
947
947
  streaming: "Streaming...",
@@ -999,7 +999,9 @@ const Ne = ({ progressViewItems: e, t: r }) => {
999
999
  memorySearchGeneratedQueriesHeading: "Generated queries",
1000
1000
  memorySearchViewExploreResults: "View results",
1001
1001
  memorySearchHideExploreResults: "Hide results",
1002
- memorySearchExploreNoResults: "No results found"
1002
+ memorySearchExploreNoResults: "No results found",
1003
+ memoryChatChunkResultsInMemories: "in {n} memories",
1004
+ memoryChatChunkResultsInOneMemory: "in 1 memory"
1003
1005
  },
1004
1006
  no: {
1005
1007
  error: "Feil",
@@ -1058,13 +1060,15 @@ const Ne = ({ progressViewItems: e, t: r }) => {
1058
1060
  memorySearchGeneratedQueriesHeading: "Genererte spørringer",
1059
1061
  memorySearchViewExploreResults: "Vis resultater",
1060
1062
  memorySearchHideExploreResults: "Skjul resultater",
1061
- memorySearchExploreNoResults: "Ingen resultater funnet"
1063
+ memorySearchExploreNoResults: "Ingen resultater funnet",
1064
+ memoryChatChunkResultsInMemories: "i {n} minner",
1065
+ memoryChatChunkResultsInOneMemory: "i 1 minne"
1062
1066
  }
1063
1067
  };
1064
- function $e(e) {
1065
- return We[e];
1068
+ function He(e) {
1069
+ return $e[e];
1066
1070
  }
1067
- function T(e, r) {
1071
+ function S(e, r) {
1068
1072
  return Object.entries(r).reduce(
1069
1073
  (t, [n, l]) => t.replace(`{${n}}`, String(l)),
1070
1074
  e
@@ -1078,30 +1082,30 @@ function Q(e, r) {
1078
1082
  }
1079
1083
  return t.join(", ");
1080
1084
  }
1081
- const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1082
- const [l, c] = v(!1), d = (e.memories ?? []).map((h) => h.memoryTitle), m = d.length > 0, o = m && d.length > W, a = o && !l ? d.slice(0, W) : d, u = d.length - W, y = !o || l, f = `${n.searchingFor}'${e.queryDescription}'`, g = m ? `${n.searchingIn}${Q(
1085
+ const $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1086
+ const [l, c] = v(!1), d = (e.memories ?? []).map((x) => x.memoryTitle), m = d.length > 0, i = m && d.length > $, a = i && !l ? d.slice(0, $) : d, y = d.length - $, u = !i || l, h = `${n.searchingFor}'${e.queryDescription}'`, g = m ? `${n.searchingIn}${Q(
1083
1087
  a,
1084
- y ? n.and : void 0
1085
- )}` : "", x = m ? `${f}${g}` : `${n.searchingPrefix}${e.queryDescription}`;
1088
+ u ? n.and : void 0
1089
+ )}` : "", k = m ? `${h}${g}` : `${n.searchingPrefix}${e.queryDescription}`;
1086
1090
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1087
- /* @__PURE__ */ i(
1091
+ /* @__PURE__ */ o(
1088
1092
  b.div,
1089
1093
  {
1090
1094
  style: { color: "#666" },
1091
1095
  initial: { opacity: 0, y: -10 },
1092
1096
  animate: { opacity: 1, y: 0 },
1093
1097
  transition: { duration: 0.3, delay: 0 },
1094
- children: r && !t && !o ? /* @__PURE__ */ i(
1095
- E,
1098
+ children: r && !t && !i ? /* @__PURE__ */ o(
1099
+ I,
1096
1100
  {
1097
- text: x,
1101
+ text: k,
1098
1102
  duration: 2.5,
1099
1103
  repeat: !0,
1100
1104
  color: "#999",
1101
1105
  shimmerColor: "#000"
1102
1106
  }
1103
- ) : /* @__PURE__ */ p(I, { children: [
1104
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ p(I, { children: [
1107
+ ) : /* @__PURE__ */ p(E, { children: [
1108
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ p(E, { children: [
1105
1109
  n.searchingFor,
1106
1110
  /* @__PURE__ */ p("span", { style: { fontWeight: 600 }, children: [
1107
1111
  "'",
@@ -1110,9 +1114,9 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1110
1114
  ] }),
1111
1115
  g
1112
1116
  ] }) : `${n.searchingPrefix}${e.queryDescription}` }),
1113
- o && !l && /* @__PURE__ */ p(I, { children: [
1117
+ i && !l && /* @__PURE__ */ p(E, { children: [
1114
1118
  " ",
1115
- /* @__PURE__ */ i(
1119
+ /* @__PURE__ */ o(
1116
1120
  "button",
1117
1121
  {
1118
1122
  type: "button",
@@ -1128,15 +1132,15 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1128
1132
  textDecoration: "underline",
1129
1133
  fontFamily: "inherit"
1130
1134
  },
1131
- children: T(n.moreMemories, {
1132
- n: u
1135
+ children: S(n.moreMemories, {
1136
+ n: y
1133
1137
  })
1134
1138
  }
1135
1139
  )
1136
1140
  ] }),
1137
- o && l && /* @__PURE__ */ p(I, { children: [
1141
+ i && l && /* @__PURE__ */ p(E, { children: [
1138
1142
  " ",
1139
- /* @__PURE__ */ i(
1143
+ /* @__PURE__ */ o(
1140
1144
  "button",
1141
1145
  {
1142
1146
  type: "button",
@@ -1159,7 +1163,7 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1159
1163
  ] })
1160
1164
  }
1161
1165
  ),
1162
- t !== void 0 && /* @__PURE__ */ i(
1166
+ t !== void 0 && /* @__PURE__ */ o(
1163
1167
  "div",
1164
1168
  {
1165
1169
  style: {
@@ -1168,17 +1172,17 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1168
1172
  marginTop: "4px",
1169
1173
  fontStyle: "italic"
1170
1174
  },
1171
- children: T(n.tookSeconds, { n: t })
1175
+ children: S(n.tookSeconds, { n: t })
1172
1176
  }
1173
1177
  )
1174
1178
  ] });
1175
- }, $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1176
- const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > $, o = m && !l ? s.slice(0, $) : s, a = s.length - $, u = !m || l, y = d ? `${n.findingMemoriesIn}${Q(
1177
- o,
1178
- u ? n.and : void 0
1179
+ }, H = 5, Ge = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1180
+ const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > H, i = m && !l ? s.slice(0, H) : s, a = s.length - H, y = !m || l, u = d ? `${n.findingMemoriesIn}${Q(
1181
+ i,
1182
+ y ? n.and : void 0
1179
1183
  )}` : n.findingMemories;
1180
1184
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1181
- /* @__PURE__ */ i(
1185
+ /* @__PURE__ */ o(
1182
1186
  b.div,
1183
1187
  {
1184
1188
  style: {
@@ -1187,20 +1191,20 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1187
1191
  initial: { opacity: 0, y: -10 },
1188
1192
  animate: { opacity: 1, y: 0 },
1189
1193
  transition: { duration: 0.3, delay: 0 },
1190
- children: r && !t && !m ? /* @__PURE__ */ i(
1191
- E,
1194
+ children: r && !t && !m ? /* @__PURE__ */ o(
1195
+ I,
1192
1196
  {
1193
- text: y,
1197
+ text: u,
1194
1198
  duration: 2.5,
1195
1199
  repeat: !0,
1196
1200
  color: "#999",
1197
1201
  shimmerColor: "#000"
1198
1202
  }
1199
- ) : /* @__PURE__ */ p(I, { children: [
1200
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
1201
- m && !l && /* @__PURE__ */ p(I, { children: [
1203
+ ) : /* @__PURE__ */ p(E, { children: [
1204
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
1205
+ m && !l && /* @__PURE__ */ p(E, { children: [
1202
1206
  " ",
1203
- /* @__PURE__ */ i(
1207
+ /* @__PURE__ */ o(
1204
1208
  "button",
1205
1209
  {
1206
1210
  type: "button",
@@ -1216,15 +1220,15 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1216
1220
  textDecoration: "underline",
1217
1221
  fontFamily: "inherit"
1218
1222
  },
1219
- children: T(n.moreMemories, {
1223
+ children: S(n.moreMemories, {
1220
1224
  n: a
1221
1225
  })
1222
1226
  }
1223
1227
  )
1224
1228
  ] }),
1225
- m && l && /* @__PURE__ */ p(I, { children: [
1229
+ m && l && /* @__PURE__ */ p(E, { children: [
1226
1230
  " ",
1227
- /* @__PURE__ */ i(
1231
+ /* @__PURE__ */ o(
1228
1232
  "button",
1229
1233
  {
1230
1234
  type: "button",
@@ -1247,7 +1251,7 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1247
1251
  ] })
1248
1252
  }
1249
1253
  ),
1250
- t !== void 0 && /* @__PURE__ */ i(
1254
+ t !== void 0 && /* @__PURE__ */ o(
1251
1255
  "div",
1252
1256
  {
1253
1257
  style: {
@@ -1256,27 +1260,27 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1256
1260
  marginTop: "4px",
1257
1261
  fontStyle: "italic"
1258
1262
  },
1259
- children: T(n.tookSeconds, { n: t })
1263
+ children: S(n.tookSeconds, { n: t })
1260
1264
  }
1261
1265
  )
1262
1266
  ] });
1263
- }, H = 5, Ge = ({ data: e, t: r }) => {
1264
- const [t, n] = v(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !t ? c.slice(0, H) : c, o = c.length - H, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, y = s ? `${u}${Q(
1267
+ }, _ = 5, Qe = ({ data: e, t: r }) => {
1268
+ const [t, n] = v(!1), c = e.memories.map((h) => h.memoryTitle), s = c.length > 0, d = s && c.length > _, m = d && !t ? c.slice(0, _) : c, i = c.length - _, a = !d || t, y = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, u = s ? `${y}${Q(
1265
1269
  m,
1266
1270
  a ? r.and : void 0
1267
1271
  )}` : r.memoriesFound;
1268
- return /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1272
+ return /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
1269
1273
  b.div,
1270
1274
  {
1271
1275
  style: { color: "#666" },
1272
1276
  initial: { opacity: 0, y: -10 },
1273
1277
  animate: { opacity: 1, y: 0 },
1274
1278
  transition: { duration: 0.3, delay: 0 },
1275
- children: /* @__PURE__ */ p(I, { children: [
1276
- /* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
1277
- d && !t && /* @__PURE__ */ p(I, { children: [
1279
+ children: /* @__PURE__ */ p(E, { children: [
1280
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
1281
+ d && !t && /* @__PURE__ */ p(E, { children: [
1278
1282
  " ",
1279
- /* @__PURE__ */ i(
1283
+ /* @__PURE__ */ o(
1280
1284
  "button",
1281
1285
  {
1282
1286
  type: "button",
@@ -1292,15 +1296,15 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1292
1296
  textDecoration: "underline",
1293
1297
  fontFamily: "inherit"
1294
1298
  },
1295
- children: T(r.moreMemories, {
1296
- n: o
1299
+ children: S(r.moreMemories, {
1300
+ n: i
1297
1301
  })
1298
1302
  }
1299
1303
  )
1300
1304
  ] }),
1301
- d && t && /* @__PURE__ */ p(I, { children: [
1305
+ d && t && /* @__PURE__ */ p(E, { children: [
1302
1306
  " ",
1303
- /* @__PURE__ */ i(
1307
+ /* @__PURE__ */ o(
1304
1308
  "button",
1305
1309
  {
1306
1310
  type: "button",
@@ -1323,10 +1327,10 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1323
1327
  ] })
1324
1328
  }
1325
1329
  ) });
1326
- }, Qe = ({ isLatest: e = !1, durationSeconds: r, t }) => {
1330
+ }, Ue = ({ isLatest: e = !1, durationSeconds: r, t }) => {
1327
1331
  const n = t.addingSources;
1328
1332
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1329
- /* @__PURE__ */ i(
1333
+ /* @__PURE__ */ o(
1330
1334
  b.div,
1331
1335
  {
1332
1336
  style: {
@@ -1338,8 +1342,8 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1338
1342
  initial: { opacity: 0, y: -10 },
1339
1343
  animate: { opacity: 1, y: 0 },
1340
1344
  transition: { duration: 0.3, delay: 0 },
1341
- children: e && !r ? /* @__PURE__ */ i(
1342
- E,
1345
+ children: e && !r ? /* @__PURE__ */ o(
1346
+ I,
1343
1347
  {
1344
1348
  text: n,
1345
1349
  duration: 2.5,
@@ -1347,10 +1351,10 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1347
1351
  color: "#999",
1348
1352
  shimmerColor: "#000"
1349
1353
  }
1350
- ) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: n })
1354
+ ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: n })
1351
1355
  }
1352
1356
  ),
1353
- r !== void 0 && /* @__PURE__ */ i(
1357
+ r !== void 0 && /* @__PURE__ */ o(
1354
1358
  "div",
1355
1359
  {
1356
1360
  style: {
@@ -1359,27 +1363,27 @@ const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1359
1363
  marginTop: "4px",
1360
1364
  fontStyle: "italic"
1361
1365
  },
1362
- children: T(t.tookSeconds, { n: r })
1366
+ children: S(t.tookSeconds, { n: r })
1363
1367
  }
1364
1368
  )
1365
1369
  ] });
1366
1370
  };
1367
- function Ue(e, r) {
1371
+ function je(e, r) {
1368
1372
  if (e.length === 0) return "";
1369
1373
  if (e.length === 1)
1370
- return T(r.pageSingle, { n: e[0] });
1374
+ return S(r.pageSingle, { n: e[0] });
1371
1375
  if (e.length === 2)
1372
- return T(r.pageTwo, {
1376
+ return S(r.pageTwo, {
1373
1377
  a: e[0],
1374
1378
  b: e[1]
1375
1379
  });
1376
1380
  const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1377
- return T(r.pageMultiple, { list: n, n: t });
1381
+ return S(r.pageMultiple, { list: n, n: t });
1378
1382
  }
1379
- const je = ({ data: e, onSourceClick: r, t }) => {
1383
+ const qe = ({ data: e, onSourceClick: r, t }) => {
1380
1384
  const [n, l] = v(null);
1381
1385
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
1382
- /* @__PURE__ */ i(
1386
+ /* @__PURE__ */ o(
1383
1387
  b.div,
1384
1388
  {
1385
1389
  style: {
@@ -1396,8 +1400,8 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1396
1400
  children: t.sources
1397
1401
  }
1398
1402
  ),
1399
- /* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ i(
1400
- qe,
1403
+ /* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ o(
1404
+ Ke,
1401
1405
  {
1402
1406
  source: c,
1403
1407
  index: s,
@@ -1409,7 +1413,7 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1409
1413
  c.memoryId
1410
1414
  )) })
1411
1415
  ] });
1412
- }, qe = ({
1416
+ }, Ke = ({
1413
1417
  source: e,
1414
1418
  index: r,
1415
1419
  loadingMemoryId: t,
@@ -1417,15 +1421,15 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1417
1421
  onSourceClick: l,
1418
1422
  t: c
1419
1423
  }) => {
1420
- const [s, d] = v(!1), m = !!l, o = t === e.memoryId, a = e.pageNumbers ?? [], u = Ue(a, c);
1424
+ const [s, d] = v(!1), m = !!l, i = t === e.memoryId, a = e.pageNumbers ?? [], y = je(a, c);
1421
1425
  return /* @__PURE__ */ p(
1422
1426
  b.div,
1423
1427
  {
1424
- "aria-busy": o,
1428
+ "aria-busy": i,
1425
1429
  initial: { opacity: 0, scale: 0.9 },
1426
1430
  animate: { opacity: 1, scale: 1 },
1427
1431
  transition: { duration: 0.25, delay: r * 0.05 },
1428
- onClick: m && !o ? async () => {
1432
+ onClick: m && !i ? async () => {
1429
1433
  n(e.memoryId);
1430
1434
  try {
1431
1435
  await l({
@@ -1439,8 +1443,8 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1439
1443
  n(null);
1440
1444
  }
1441
1445
  } : void 0,
1442
- onMouseEnter: m && !o ? () => d(!0) : void 0,
1443
- onMouseLeave: m && !o ? () => d(!1) : void 0,
1446
+ onMouseEnter: m && !i ? () => d(!0) : void 0,
1447
+ onMouseLeave: m && !i ? () => d(!1) : void 0,
1444
1448
  style: {
1445
1449
  display: "inline-flex",
1446
1450
  flexDirection: "column",
@@ -1449,10 +1453,10 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1449
1453
  borderRadius: "6px",
1450
1454
  border: "1px solid #e0e0e0",
1451
1455
  backgroundColor: s ? "#f5f5f5" : "transparent",
1452
- cursor: m && !o ? "pointer" : o ? "wait" : "default",
1456
+ cursor: m && !i ? "pointer" : i ? "wait" : "default",
1453
1457
  transition: "background-color 0.15s ease",
1454
1458
  userSelect: "none",
1455
- pointerEvents: o ? "none" : void 0
1459
+ pointerEvents: i ? "none" : void 0
1456
1460
  },
1457
1461
  children: [
1458
1462
  /* @__PURE__ */ p(
@@ -1467,7 +1471,7 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1467
1471
  gap: 8
1468
1472
  },
1469
1473
  children: [
1470
- o && /* @__PURE__ */ i(
1474
+ i && /* @__PURE__ */ o(
1471
1475
  "span",
1472
1476
  {
1473
1477
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -1478,17 +1482,17 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1478
1482
  ]
1479
1483
  }
1480
1484
  ),
1481
- u && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: u })
1485
+ y && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: y })
1482
1486
  ]
1483
1487
  }
1484
1488
  );
1485
- }, z = ({
1489
+ }, L = ({
1486
1490
  color: e = "#78b13f",
1487
1491
  size: r = 24,
1488
1492
  borderWidth: t = 7
1489
1493
  }) => {
1490
1494
  const n = r * 0.5;
1491
- return /* @__PURE__ */ i(
1495
+ return /* @__PURE__ */ o(
1492
1496
  "span",
1493
1497
  {
1494
1498
  style: {
@@ -1524,7 +1528,7 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1524
1528
  height: r
1525
1529
  },
1526
1530
  children: [
1527
- /* @__PURE__ */ i(
1531
+ /* @__PURE__ */ o(
1528
1532
  "span",
1529
1533
  {
1530
1534
  style: {
@@ -1533,7 +1537,7 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1533
1537
  }
1534
1538
  }
1535
1539
  ),
1536
- /* @__PURE__ */ i(
1540
+ /* @__PURE__ */ o(
1537
1541
  "span",
1538
1542
  {
1539
1543
  style: {
@@ -1546,19 +1550,19 @@ const je = ({ data: e, onSourceClick: r, t }) => {
1546
1550
  }
1547
1551
  );
1548
1552
  };
1549
- function Ke({
1553
+ function Ve({
1550
1554
  memory: e,
1551
1555
  completed: r
1552
1556
  }) {
1553
- return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1557
+ return e.error != null ? /* @__PURE__ */ o(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1554
1558
  }
1555
- const X = 80;
1556
- function Ve({
1559
+ const ee = 80;
1560
+ function Xe({
1557
1561
  memory: e,
1558
1562
  completed: r,
1559
1563
  t
1560
1564
  }) {
1561
- const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > X, d = c != null ? n || !s ? c : `${c.slice(0, X)}...` : void 0, m = s, o = e.error != null;
1565
+ const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > ee, d = c != null ? n || !s ? c : `${c.slice(0, ee)}...` : void 0, m = s, i = e.error != null;
1562
1566
  return /* @__PURE__ */ p(
1563
1567
  b.div,
1564
1568
  {
@@ -1578,7 +1582,7 @@ function Ve({
1578
1582
  cursor: m ? "pointer" : "default"
1579
1583
  },
1580
1584
  children: [
1581
- /* @__PURE__ */ i(
1585
+ /* @__PURE__ */ o(
1582
1586
  "div",
1583
1587
  {
1584
1588
  style: {
@@ -1588,7 +1592,7 @@ function Ve({
1588
1592
  flexShrink: 0,
1589
1593
  width: 32
1590
1594
  },
1591
- children: /* @__PURE__ */ i(Ke, { memory: e, completed: r })
1595
+ children: /* @__PURE__ */ o(Ve, { memory: e, completed: r })
1592
1596
  }
1593
1597
  ),
1594
1598
  /* @__PURE__ */ p(
@@ -1601,26 +1605,26 @@ function Ve({
1601
1605
  minWidth: 0
1602
1606
  },
1603
1607
  children: [
1604
- /* @__PURE__ */ i(
1608
+ /* @__PURE__ */ o(
1605
1609
  "span",
1606
1610
  {
1607
1611
  style: { fontSize: 13, fontWeight: 500, color: "#333" },
1608
1612
  children: e.memoryTitle
1609
1613
  }
1610
1614
  ),
1611
- d != null && /* @__PURE__ */ i(
1615
+ d != null && /* @__PURE__ */ o(
1612
1616
  "span",
1613
1617
  {
1614
1618
  style: {
1615
1619
  fontSize: 12,
1616
- color: o ? "#c62828" : "#666",
1620
+ color: i ? "#c62828" : "#666",
1617
1621
  lineHeight: 1.4,
1618
1622
  whiteSpace: n ? "pre-wrap" : void 0
1619
1623
  },
1620
1624
  children: d
1621
1625
  }
1622
1626
  ),
1623
- m && /* @__PURE__ */ i(
1627
+ m && /* @__PURE__ */ o(
1624
1628
  "span",
1625
1629
  {
1626
1630
  style: {
@@ -1638,8 +1642,8 @@ function Ve({
1638
1642
  }
1639
1643
  );
1640
1644
  }
1641
- const Xe = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ i(
1642
- Ve,
1645
+ const Je = ({ data: e, completed: r, t }) => /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ o(
1646
+ Xe,
1643
1647
  {
1644
1648
  memory: n,
1645
1649
  completed: r,
@@ -1647,193 +1651,417 @@ const Xe = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: {
1647
1651
  },
1648
1652
  n.memoryId
1649
1653
  )) });
1650
- function Je(e, r) {
1654
+ function Ye(e, r) {
1655
+ const t = Math.min(e.length, r.length);
1656
+ for (let n = t; n >= 0; n--)
1657
+ if (e.slice(-n) === r.slice(0, n)) return n;
1658
+ return 0;
1659
+ }
1660
+ const Ze = `
1661
+
1662
+ `;
1663
+ function j(e) {
1664
+ var t, n;
1665
+ if (e.length === 0) return "";
1666
+ let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
1667
+ for (let l = 1; l < e.length; l++) {
1668
+ const c = ((n = e[l]) == null ? void 0 : n.content) ?? "";
1669
+ if (c === "") continue;
1670
+ if (r === "") {
1671
+ r = c;
1672
+ continue;
1673
+ }
1674
+ const s = Ye(r, c);
1675
+ s === 0 ? r += Ze + c : r += c.slice(s);
1676
+ }
1677
+ return r;
1678
+ }
1679
+ function q(e, r) {
1651
1680
  if (e.length === 0) return "";
1652
1681
  if (e.length === 1)
1653
- return T(r.pageSingle, { n: e[0] });
1682
+ return S(r.memorySearchPagesSingle, {
1683
+ n: e[0]
1684
+ });
1654
1685
  if (e.length === 2)
1655
- return T(r.pageTwo, {
1686
+ return S(r.memorySearchPagesTwo, {
1656
1687
  a: e[0],
1657
1688
  b: e[1]
1658
1689
  });
1659
1690
  const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1660
- return T(r.pageMultiple, { list: n, n: t });
1691
+ return S(r.memorySearchPagesMultiple, {
1692
+ list: n,
1693
+ n: t
1694
+ });
1661
1695
  }
1662
- function Ye(e, r) {
1663
- return e === 1 ? r.chunkFound : T(r.chunksFound, { n: e });
1696
+ function K(e) {
1697
+ const r = /* @__PURE__ */ new Set();
1698
+ for (const t of e)
1699
+ for (const n of t.pageNumbers) r.add(n);
1700
+ return [...r].sort((t, n) => t - n);
1664
1701
  }
1665
- const Ze = ({ data: e, t: r }) => {
1666
- const [t, n] = v(!1), l = e.chunks.length, c = l > 0;
1667
- return /* @__PURE__ */ p("div", { style: { padding: "8px 10px" }, children: [
1668
- /* @__PURE__ */ p(
1669
- b.div,
1702
+ function V(e) {
1703
+ const r = e.memoryTypeName.trim();
1704
+ if (r !== "") return r;
1705
+ if (e.memoryTypeId !== "") return e.memoryTypeId;
1706
+ }
1707
+ function ae(e) {
1708
+ return e.chunks.filter((r) => r.relation === "MATCH").length;
1709
+ }
1710
+ function er(e, r) {
1711
+ let t = 0, n = 0;
1712
+ for (const s of e)
1713
+ t += ae(s), s.matchingChunkScore > n && (n = s.matchingChunkScore);
1714
+ const l = t === 1 ? r.chunkFound : S(r.chunksFound, { n: t }), c = S(r.scoreLabel, {
1715
+ n: n.toFixed(2)
1716
+ });
1717
+ return `${l} - ${c}`;
1718
+ }
1719
+ function rr(e) {
1720
+ const r = [], t = /* @__PURE__ */ new Map();
1721
+ return e.forEach((n, l) => {
1722
+ let c = t.get(n.memoryId);
1723
+ if (c == null) {
1724
+ r.push(n.memoryId);
1725
+ const s = n.memoryTitle !== "" ? n.memoryTitle : n.memoryId;
1726
+ c = {
1727
+ memoryId: n.memoryId,
1728
+ memoryTitle: s,
1729
+ items: []
1730
+ }, t.set(n.memoryId, c);
1731
+ }
1732
+ c.items.push({ item: n, flatIndex: l });
1733
+ }), r.map((n) => t.get(n));
1734
+ }
1735
+ function nr({
1736
+ items: e,
1737
+ onSearchResultClick: r,
1738
+ t
1739
+ }) {
1740
+ const [n, l] = v(null), c = !!r;
1741
+ return /* @__PURE__ */ o(
1742
+ "div",
1743
+ {
1744
+ style: {
1745
+ display: "flex",
1746
+ flexDirection: "column",
1747
+ gap: 0,
1748
+ marginTop: 8,
1749
+ paddingTop: 8,
1750
+ borderTop: "1px solid #f0f0f0"
1751
+ },
1752
+ children: e.map((s, d) => {
1753
+ const m = K(
1754
+ s.chunks
1755
+ ), i = [
1756
+ V(s),
1757
+ S(t.scoreLabel, {
1758
+ n: s.matchingChunkScore.toFixed(2)
1759
+ }),
1760
+ m.length > 0 ? q(m, t) : t.pagesNotAvailable
1761
+ ].filter(
1762
+ (h) => h != null && h !== ""
1763
+ ), a = {
1764
+ memoryId: s.memoryId,
1765
+ memoryTitle: s.memoryTitle,
1766
+ memoryTypeId: s.memoryTypeId,
1767
+ memoryTypeName: s.memoryTypeName,
1768
+ pageNumbers: m
1769
+ }, y = `${s.memoryId}-${d}`, u = n === y;
1770
+ return /* @__PURE__ */ p(
1771
+ "div",
1772
+ {
1773
+ style: {
1774
+ display: "flex",
1775
+ flexDirection: "row",
1776
+ alignItems: "flex-start",
1777
+ gap: "12px",
1778
+ paddingTop: d > 0 ? 12 : 0,
1779
+ paddingBottom: d < e.length - 1 ? 12 : 0,
1780
+ borderBottom: d < e.length - 1 ? "1px solid #eee" : void 0,
1781
+ minWidth: 0
1782
+ },
1783
+ children: [
1784
+ /* @__PURE__ */ p(
1785
+ "div",
1786
+ {
1787
+ style: {
1788
+ flex: 1,
1789
+ minWidth: 0,
1790
+ display: "flex",
1791
+ flexDirection: "column",
1792
+ gap: "6px"
1793
+ },
1794
+ children: [
1795
+ /* @__PURE__ */ o(
1796
+ "span",
1797
+ {
1798
+ style: {
1799
+ fontSize: 13,
1800
+ color: "#1f2937",
1801
+ lineHeight: 1.5,
1802
+ whiteSpace: "pre-wrap",
1803
+ wordBreak: "break-word"
1804
+ },
1805
+ children: j(s.chunks)
1806
+ }
1807
+ ),
1808
+ /* @__PURE__ */ o(
1809
+ "div",
1810
+ {
1811
+ style: {
1812
+ fontSize: 11,
1813
+ fontWeight: 400,
1814
+ color: "#94a3b8",
1815
+ lineHeight: 1.35
1816
+ },
1817
+ children: i.join(" · ")
1818
+ }
1819
+ )
1820
+ ]
1821
+ }
1822
+ ),
1823
+ c && /* @__PURE__ */ p(
1824
+ "button",
1825
+ {
1826
+ type: "button",
1827
+ "aria-busy": u,
1828
+ disabled: u,
1829
+ onClick: async () => {
1830
+ l(y);
1831
+ try {
1832
+ await r(
1833
+ a
1834
+ );
1835
+ } finally {
1836
+ l(null);
1837
+ }
1838
+ },
1839
+ style: {
1840
+ flexShrink: 0,
1841
+ alignSelf: "center",
1842
+ padding: "6px 12px",
1843
+ fontSize: 12,
1844
+ fontWeight: 600,
1845
+ color: "#2563eb",
1846
+ background: "#eff6ff",
1847
+ border: "1px solid #bfdbfe",
1848
+ borderRadius: 6,
1849
+ cursor: u ? "wait" : "pointer",
1850
+ fontFamily: "inherit",
1851
+ display: "inline-flex",
1852
+ alignItems: "center",
1853
+ gap: 8
1854
+ },
1855
+ children: [
1856
+ u && /* @__PURE__ */ o(
1857
+ "span",
1858
+ {
1859
+ className: "explore-memory-loader explore-memory-loader--callback",
1860
+ "aria-hidden": !0
1861
+ }
1862
+ ),
1863
+ t.viewButton
1864
+ ]
1865
+ }
1866
+ )
1867
+ ]
1868
+ },
1869
+ y
1870
+ );
1871
+ })
1872
+ }
1873
+ );
1874
+ }
1875
+ function tr({
1876
+ group: e,
1877
+ t: r,
1878
+ expanded: t,
1879
+ onToggle: n,
1880
+ onSearchResultClick: l
1881
+ }) {
1882
+ const c = e.items.map((d) => d.item), s = c.some((d) => d.chunks.length > 0);
1883
+ return /* @__PURE__ */ p(
1884
+ b.div,
1885
+ {
1886
+ initial: { opacity: 0 },
1887
+ animate: { opacity: 1 },
1888
+ transition: { duration: 0.25 },
1889
+ style: {
1890
+ paddingTop: "12px",
1891
+ paddingBottom: "12px",
1892
+ borderBottom: "1px solid #eee",
1893
+ display: "flex",
1894
+ flexDirection: "row",
1895
+ alignItems: "flex-start",
1896
+ gap: "10px",
1897
+ minWidth: 0
1898
+ },
1899
+ children: [
1900
+ /* @__PURE__ */ o(
1901
+ "div",
1902
+ {
1903
+ style: {
1904
+ display: "flex",
1905
+ alignItems: "center",
1906
+ justifyContent: "center",
1907
+ flexShrink: 0,
1908
+ width: 32,
1909
+ paddingTop: 2
1910
+ },
1911
+ children: /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 })
1912
+ }
1913
+ ),
1914
+ /* @__PURE__ */ p(
1915
+ "div",
1916
+ {
1917
+ style: {
1918
+ display: "flex",
1919
+ flexDirection: "column",
1920
+ gap: "4px",
1921
+ minWidth: 0,
1922
+ flex: 1
1923
+ },
1924
+ children: [
1925
+ /* @__PURE__ */ o(
1926
+ "span",
1927
+ {
1928
+ style: {
1929
+ fontSize: 13,
1930
+ fontWeight: 600,
1931
+ color: "#333",
1932
+ wordBreak: "break-word"
1933
+ },
1934
+ children: e.memoryTitle
1935
+ }
1936
+ ),
1937
+ /* @__PURE__ */ p(
1938
+ "div",
1939
+ {
1940
+ style: {
1941
+ display: "flex",
1942
+ flexDirection: "row",
1943
+ flexWrap: "wrap",
1944
+ alignItems: "baseline",
1945
+ gap: "6px 12px",
1946
+ minWidth: 0
1947
+ },
1948
+ children: [
1949
+ /* @__PURE__ */ o(
1950
+ "span",
1951
+ {
1952
+ style: {
1953
+ fontSize: 12,
1954
+ color: "#666",
1955
+ whiteSpace: "nowrap"
1956
+ },
1957
+ children: er(c, r)
1958
+ }
1959
+ ),
1960
+ s && /* @__PURE__ */ o(
1961
+ "button",
1962
+ {
1963
+ type: "button",
1964
+ onClick: n,
1965
+ style: {
1966
+ border: "none",
1967
+ background: "none",
1968
+ padding: 0,
1969
+ cursor: "pointer",
1970
+ fontSize: 12,
1971
+ color: "#666",
1972
+ textDecoration: "underline",
1973
+ fontFamily: "inherit"
1974
+ },
1975
+ children: t ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
1976
+ }
1977
+ )
1978
+ ]
1979
+ }
1980
+ ),
1981
+ t && s && /* @__PURE__ */ o(
1982
+ nr,
1983
+ {
1984
+ items: c,
1985
+ onSearchResultClick: l,
1986
+ t: r
1987
+ }
1988
+ )
1989
+ ]
1990
+ }
1991
+ )
1992
+ ]
1993
+ }
1994
+ );
1995
+ }
1996
+ function or(e, r) {
1997
+ return e === 1 ? r.chunkFound : S(r.chunksFound, { n: e });
1998
+ }
1999
+ const ir = ({
2000
+ data: e,
2001
+ onSearchResultClick: r,
2002
+ t
2003
+ }) => {
2004
+ const n = e.items, l = n.reduce(
2005
+ (u, h) => u + ae(h),
2006
+ 0
2007
+ ), c = new Set(n.map((u) => u.memoryId)).size, [s, d] = v({}), m = W((u) => {
2008
+ d((h) => ({
2009
+ ...h,
2010
+ [u]: !h[u]
2011
+ }));
2012
+ }, []), i = P(() => rr(n), [n]), a = c === 1 ? t.memoryChatChunkResultsInOneMemory : S(t.memoryChatChunkResultsInMemories, {
2013
+ n: c
2014
+ }), y = `${or(l, t)} ${a}`;
2015
+ return n.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
2016
+ "div",
2017
+ {
2018
+ style: {
2019
+ fontSize: 12,
2020
+ color: "#94a3b8",
2021
+ paddingTop: 4
2022
+ },
2023
+ children: t.memorySearchExploreNoResults
2024
+ }
2025
+ ) }) : /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
2026
+ i.map((u) => /* @__PURE__ */ o(
2027
+ tr,
1670
2028
  {
1671
- initial: { opacity: 0 },
1672
- animate: { opacity: 1 },
1673
- transition: { duration: 0.25 },
1674
- onClick: c ? () => n((s) => !s) : void 0,
1675
- role: c ? "button" : void 0,
1676
- tabIndex: c ? 0 : void 0,
1677
- onKeyDown: c ? (s) => {
1678
- (s.key === "Enter" || s.key === " ") && (s.preventDefault(), n((d) => !d));
1679
- } : void 0,
1680
- style: {
1681
- paddingBottom: t ? "10px" : 0,
1682
- borderBottom: t ? "1px solid #eee" : void 0,
1683
- display: "flex",
1684
- flexDirection: "row",
1685
- alignItems: "center",
1686
- justifyContent: "space-between",
1687
- gap: 8,
1688
- minWidth: 0,
1689
- cursor: c ? "pointer" : "default"
1690
- },
1691
- children: [
1692
- /* @__PURE__ */ p(
1693
- "div",
1694
- {
1695
- style: {
1696
- display: "flex",
1697
- flexDirection: "row",
1698
- alignItems: "center",
1699
- flexWrap: "wrap",
1700
- gap: "0 8px",
1701
- flex: "1 1 auto",
1702
- minWidth: 0
1703
- },
1704
- children: [
1705
- /* @__PURE__ */ i(
1706
- "span",
1707
- {
1708
- style: {
1709
- fontSize: 13,
1710
- fontWeight: 600,
1711
- color: "#333",
1712
- wordBreak: "break-word"
1713
- },
1714
- children: e.memoryTitle
1715
- }
1716
- ),
1717
- /* @__PURE__ */ i(
1718
- "span",
1719
- {
1720
- style: {
1721
- fontSize: 13,
1722
- color: "#9ca3af",
1723
- flexShrink: 0
1724
- },
1725
- "aria-hidden": !0,
1726
- children: "·"
1727
- }
1728
- ),
1729
- /* @__PURE__ */ i(
1730
- "span",
1731
- {
1732
- style: {
1733
- fontSize: 12,
1734
- color: "#666",
1735
- flexShrink: 0
1736
- },
1737
- children: Ye(l, r)
1738
- }
1739
- )
1740
- ]
1741
- }
1742
- ),
1743
- c && /* @__PURE__ */ i(
1744
- "span",
1745
- {
1746
- style: {
1747
- fontSize: 11,
1748
- color: "#999",
1749
- flexShrink: 0,
1750
- whiteSpace: "nowrap"
1751
- },
1752
- children: t ? r.clickToCollapse : r.clickToExpand
1753
- }
1754
- )
1755
- ]
1756
- }
1757
- ),
1758
- t && c && /* @__PURE__ */ i(
1759
- b.div,
2029
+ group: u,
2030
+ t,
2031
+ expanded: s[u.memoryId] === !0,
2032
+ onToggle: () => m(u.memoryId),
2033
+ onSearchResultClick: r
2034
+ },
2035
+ u.memoryId
2036
+ )),
2037
+ /* @__PURE__ */ o(
2038
+ "div",
1760
2039
  {
1761
- initial: { opacity: 0, height: 0 },
1762
- animate: { opacity: 1, height: "auto" },
1763
- transition: { duration: 0.2 },
1764
2040
  style: {
1765
- maxHeight: 220,
1766
- overflowY: "auto",
1767
- marginTop: 12,
1768
- display: "flex",
1769
- flexDirection: "column",
1770
- gap: 8
2041
+ fontSize: "12px",
2042
+ color: "#999",
2043
+ marginTop: "4px",
2044
+ fontStyle: "italic"
1771
2045
  },
1772
- children: e.chunks.map((s, d) => {
1773
- const m = s.pageNumbers ?? [], o = Je(m, r);
1774
- return /* @__PURE__ */ p(
1775
- "div",
1776
- {
1777
- style: {
1778
- padding: "8px 12px",
1779
- borderRadius: 6,
1780
- border: "1px solid #e0e0e0",
1781
- backgroundColor: "#fafafa"
1782
- },
1783
- children: [
1784
- /* @__PURE__ */ i(
1785
- "span",
1786
- {
1787
- style: {
1788
- fontSize: 12,
1789
- color: "#333",
1790
- lineHeight: 1.4,
1791
- display: "block",
1792
- marginBottom: 4
1793
- },
1794
- children: s.content
1795
- }
1796
- ),
1797
- /* @__PURE__ */ p(
1798
- "div",
1799
- {
1800
- style: {
1801
- display: "flex",
1802
- gap: 8,
1803
- fontSize: 11,
1804
- color: "#666"
1805
- },
1806
- children: [
1807
- o && /* @__PURE__ */ i("span", { children: o }),
1808
- /* @__PURE__ */ i("span", { children: T(r.scoreLabel, {
1809
- n: s.score
1810
- }) })
1811
- ]
1812
- }
1813
- )
1814
- ]
1815
- },
1816
- d
1817
- );
1818
- })
2046
+ children: y
1819
2047
  }
1820
2048
  )
1821
2049
  ] });
1822
2050
  };
1823
- function er({ item: e }) {
1824
- return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
2051
+ function ar({ item: e }) {
2052
+ return e.error != null ? /* @__PURE__ */ o(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1825
2053
  }
1826
- function rr(e, r) {
1827
- return T(r.searchingInMemoriesOfType, {
2054
+ function sr(e, r) {
2055
+ return S(r.searchingInMemoriesOfType, {
1828
2056
  name: e.memoryTypeName
1829
2057
  });
1830
2058
  }
1831
- function nr({
2059
+ function lr({
1832
2060
  item: e,
1833
2061
  t: r,
1834
2062
  showShimmerForPrimary: t
1835
2063
  }) {
1836
- const n = e.result != null, l = e.error != null, c = rr(e, r);
2064
+ const n = e.result != null, l = e.error != null, c = sr(e, r);
1837
2065
  return /* @__PURE__ */ p(
1838
2066
  b.div,
1839
2067
  {
@@ -1851,7 +2079,7 @@ function nr({
1851
2079
  minWidth: 0
1852
2080
  },
1853
2081
  children: [
1854
- /* @__PURE__ */ i(
2082
+ /* @__PURE__ */ o(
1855
2083
  "div",
1856
2084
  {
1857
2085
  style: {
@@ -1861,7 +2089,7 @@ function nr({
1861
2089
  flexShrink: 0,
1862
2090
  width: 32
1863
2091
  },
1864
- children: /* @__PURE__ */ i(er, { item: e })
2092
+ children: /* @__PURE__ */ o(ar, { item: e })
1865
2093
  }
1866
2094
  ),
1867
2095
  /* @__PURE__ */ p(
@@ -1875,8 +2103,8 @@ function nr({
1875
2103
  flex: 1
1876
2104
  },
1877
2105
  children: [
1878
- /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !l && t ? /* @__PURE__ */ i(
1879
- E,
2106
+ /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !l && t ? /* @__PURE__ */ o(
2107
+ I,
1880
2108
  {
1881
2109
  text: c,
1882
2110
  duration: 2.5,
@@ -1885,14 +2113,14 @@ function nr({
1885
2113
  shimmerColor: "#000"
1886
2114
  }
1887
2115
  ) : c }),
1888
- n && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? T(
2116
+ n && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? S(
1889
2117
  r.memorySearchTypeResultSummaryOne,
1890
2118
  {
1891
2119
  score: e.result.highestChunkScore.toFixed(
1892
2120
  2
1893
2121
  )
1894
2122
  }
1895
- ) : T(
2123
+ ) : S(
1896
2124
  r.memorySearchTypeResultSummary,
1897
2125
  {
1898
2126
  count: e.result.numberOfChunks,
@@ -1901,7 +2129,7 @@ function nr({
1901
2129
  )
1902
2130
  }
1903
2131
  ) }),
1904
- l && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
2132
+ l && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
1905
2133
  ]
1906
2134
  }
1907
2135
  )
@@ -1909,16 +2137,16 @@ function nr({
1909
2137
  }
1910
2138
  );
1911
2139
  }
1912
- const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1913
- const l = D(() => {
2140
+ const cr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2141
+ const l = P(() => {
1914
2142
  let c = -1;
1915
2143
  return e.memoryTypes.forEach((s, d) => {
1916
2144
  s.result == null && s.error == null && (c = d);
1917
2145
  }), c;
1918
2146
  }, [e.memoryTypes]);
1919
2147
  return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
1920
- r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
1921
- E,
2148
+ r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
2149
+ I,
1922
2150
  {
1923
2151
  text: n.searchingMemoryTypes,
1924
2152
  duration: 2.5,
@@ -1926,8 +2154,8 @@ const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1926
2154
  color: "#999",
1927
2155
  shimmerColor: "#000"
1928
2156
  }
1929
- ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
1930
- nr,
2157
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ o(
2158
+ lr,
1931
2159
  {
1932
2160
  item: c,
1933
2161
  t: n,
@@ -1935,7 +2163,7 @@ const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1935
2163
  },
1936
2164
  c.memoryTypeId
1937
2165
  )),
1938
- t !== void 0 && /* @__PURE__ */ i(
2166
+ t !== void 0 && /* @__PURE__ */ o(
1939
2167
  "div",
1940
2168
  {
1941
2169
  style: {
@@ -1944,43 +2172,43 @@ const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1944
2172
  marginTop: "4px",
1945
2173
  fontStyle: "italic"
1946
2174
  },
1947
- children: T(n.tookSeconds, { n: t })
2175
+ children: S(n.tookSeconds, { n: t })
1948
2176
  }
1949
2177
  )
1950
2178
  ] });
1951
- }, N = 12, B = 1.45, or = Math.ceil(
1952
- N * B
1953
- ), ir = Math.ceil(
1954
- 5 * N * B
2179
+ }, O = 12, B = 1.45, dr = Math.ceil(
2180
+ O * B
2181
+ ), mr = Math.ceil(
2182
+ 5 * O * B
1955
2183
  );
1956
- function O(e) {
2184
+ function N(e) {
1957
2185
  return e.queries != null && e.queries.length > 0;
1958
2186
  }
1959
- function ar(e) {
2187
+ function ur(e) {
1960
2188
  const r = e.reasoning;
1961
- return (r == null || r === "") && !O(e);
2189
+ return (r == null || r === "") && !N(e);
1962
2190
  }
1963
- function sr(e) {
1964
- if (O(e)) return 3;
2191
+ function yr(e) {
2192
+ if (N(e)) return 3;
1965
2193
  const r = e.reasoning;
1966
2194
  return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
1967
2195
  }
1968
- function lr({ phase: e }) {
1969
- return e === 3 ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
2196
+ function pr({ phase: e }) {
2197
+ return e === 3 ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1970
2198
  }
1971
- function cr({
2199
+ function gr({
1972
2200
  item: e,
1973
2201
  t: r,
1974
2202
  isActiveRow: t
1975
2203
  }) {
1976
- const n = ar(e), l = sr(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [m, o] = v(!1), a = n && t, u = l === 2 && t && !O(e);
2204
+ const n = ur(e), l = yr(e), c = e.reasoning, s = c != null && c.length > 0, d = R(null), [m, i] = v(!1), a = n && t, y = l === 2 && t && !N(e);
1977
2205
  A(() => {
1978
2206
  const g = d.current;
1979
2207
  g != null && l === 1 && s && (g.scrollTop = g.scrollHeight);
1980
2208
  }, [c, l, s]);
1981
- const y = T(r.searchingInMemoriesOfType, {
2209
+ const u = S(r.searchingInMemoriesOfType, {
1982
2210
  name: e.memoryTypeName
1983
- }), f = !n && l === 3;
2211
+ }), h = !n && l === 3;
1984
2212
  return /* @__PURE__ */ p(
1985
2213
  b.div,
1986
2214
  {
@@ -1993,12 +2221,12 @@ function cr({
1993
2221
  borderBottom: "1px solid #eee",
1994
2222
  display: "flex",
1995
2223
  flexDirection: "row",
1996
- alignItems: f ? "flex-start" : "center",
2224
+ alignItems: h ? "flex-start" : "center",
1997
2225
  gap: "10px",
1998
2226
  minWidth: 0
1999
2227
  },
2000
2228
  children: [
2001
- /* @__PURE__ */ i(
2229
+ /* @__PURE__ */ o(
2002
2230
  "div",
2003
2231
  {
2004
2232
  style: {
@@ -2007,9 +2235,9 @@ function cr({
2007
2235
  justifyContent: "center",
2008
2236
  flexShrink: 0,
2009
2237
  width: 32,
2010
- ...f ? { paddingTop: 2 } : {}
2238
+ ...h ? { paddingTop: 2 } : {}
2011
2239
  },
2012
- children: /* @__PURE__ */ i(lr, { phase: n ? 1 : l })
2240
+ children: /* @__PURE__ */ o(pr, { phase: n ? 1 : l })
2013
2241
  }
2014
2242
  ),
2015
2243
  /* @__PURE__ */ p(
@@ -2023,18 +2251,18 @@ function cr({
2023
2251
  flex: 1
2024
2252
  },
2025
2253
  children: [
2026
- /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ i(
2027
- E,
2254
+ /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ o(
2255
+ I,
2028
2256
  {
2029
- text: y,
2257
+ text: u,
2030
2258
  duration: 2.5,
2031
2259
  repeat: !0,
2032
2260
  color: "#999",
2033
2261
  shimmerColor: "#000"
2034
2262
  }
2035
2263
  ) : e.memoryTypeName }),
2036
- l === 1 && s && !O(e) && /* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
2037
- /* @__PURE__ */ i(
2264
+ l === 1 && s && !N(e) && /* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
2265
+ /* @__PURE__ */ o(
2038
2266
  "span",
2039
2267
  {
2040
2268
  style: {
@@ -2047,7 +2275,7 @@ function cr({
2047
2275
  children: r.memorySearchQueryReasoningLabel
2048
2276
  }
2049
2277
  ),
2050
- /* @__PURE__ */ i(
2278
+ /* @__PURE__ */ o(
2051
2279
  "div",
2052
2280
  {
2053
2281
  style: {
@@ -2056,18 +2284,18 @@ function cr({
2056
2284
  padding: "8px 10px",
2057
2285
  boxSizing: "border-box"
2058
2286
  },
2059
- children: /* @__PURE__ */ i(
2287
+ children: /* @__PURE__ */ o(
2060
2288
  "div",
2061
2289
  {
2062
2290
  ref: d,
2063
2291
  className: "memory-search-generating-reasoning-viewport",
2064
2292
  style: {
2065
- minHeight: or,
2066
- maxHeight: ir,
2293
+ minHeight: dr,
2294
+ maxHeight: mr,
2067
2295
  height: "auto",
2068
2296
  overflowY: "auto",
2069
2297
  overflowX: "hidden",
2070
- fontSize: N,
2298
+ fontSize: O,
2071
2299
  lineHeight: B,
2072
2300
  whiteSpace: "pre-wrap",
2073
2301
  wordBreak: "break-word",
@@ -2079,8 +2307,8 @@ function cr({
2079
2307
  }
2080
2308
  )
2081
2309
  ] }),
2082
- l === 2 && u && /* @__PURE__ */ i("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ i(
2083
- E,
2310
+ l === 2 && y && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
2311
+ I,
2084
2312
  {
2085
2313
  text: r.memorySearchGeneratingQueriesPending,
2086
2314
  duration: 2.5,
@@ -2089,9 +2317,9 @@ function cr({
2089
2317
  shimmerColor: "#000"
2090
2318
  }
2091
2319
  ) }),
2092
- l === 3 && /* @__PURE__ */ p(I, { children: [
2320
+ l === 3 && /* @__PURE__ */ p(E, { children: [
2093
2321
  /* @__PURE__ */ p("div", { style: { minWidth: 0 }, children: [
2094
- /* @__PURE__ */ i(
2322
+ /* @__PURE__ */ o(
2095
2323
  "span",
2096
2324
  {
2097
2325
  style: {
@@ -2104,7 +2332,7 @@ function cr({
2104
2332
  children: r.memorySearchGeneratedQueriesHeading
2105
2333
  }
2106
2334
  ),
2107
- /* @__PURE__ */ i(
2335
+ /* @__PURE__ */ o(
2108
2336
  "div",
2109
2337
  {
2110
2338
  style: {
@@ -2112,7 +2340,7 @@ function cr({
2112
2340
  flexDirection: "column",
2113
2341
  gap: 6
2114
2342
  },
2115
- children: e.queries.map((g, x) => /* @__PURE__ */ i(
2343
+ children: e.queries.map((g, k) => /* @__PURE__ */ o(
2116
2344
  "div",
2117
2345
  {
2118
2346
  style: {
@@ -2123,17 +2351,17 @@ function cr({
2123
2351
  },
2124
2352
  children: g.query
2125
2353
  },
2126
- x
2354
+ k
2127
2355
  ))
2128
2356
  }
2129
2357
  )
2130
2358
  ] }),
2131
- s && /* @__PURE__ */ p(I, { children: [
2132
- /* @__PURE__ */ i(
2359
+ s && /* @__PURE__ */ p(E, { children: [
2360
+ /* @__PURE__ */ o(
2133
2361
  "button",
2134
2362
  {
2135
2363
  type: "button",
2136
- onClick: () => o((g) => !g),
2364
+ onClick: () => i((g) => !g),
2137
2365
  style: {
2138
2366
  alignSelf: "flex-start",
2139
2367
  border: "none",
@@ -2147,11 +2375,11 @@ function cr({
2147
2375
  children: m ? r.memorySearchHideReasoning : r.memorySearchViewReasoning
2148
2376
  }
2149
2377
  ),
2150
- m && /* @__PURE__ */ i(
2378
+ m && /* @__PURE__ */ o(
2151
2379
  "div",
2152
2380
  {
2153
2381
  style: {
2154
- fontSize: N,
2382
+ fontSize: O,
2155
2383
  lineHeight: B,
2156
2384
  whiteSpace: "pre-wrap",
2157
2385
  wordBreak: "break-word",
@@ -2172,16 +2400,16 @@ function cr({
2172
2400
  }
2173
2401
  );
2174
2402
  }
2175
- const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2176
- const l = D(() => {
2403
+ const hr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2404
+ const l = P(() => {
2177
2405
  let c = -1;
2178
2406
  return e.memoryTypes.forEach((s, d) => {
2179
- O(s) || (c = d);
2407
+ N(s) || (c = d);
2180
2408
  }), c;
2181
2409
  }, [e.memoryTypes]);
2182
2410
  return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
2183
- r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
2184
- E,
2411
+ r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
2412
+ I,
2185
2413
  {
2186
2414
  text: n.memorySearchGeneratingQueries,
2187
2415
  duration: 2.5,
@@ -2189,8 +2417,8 @@ const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2189
2417
  color: "#999",
2190
2418
  shimmerColor: "#000"
2191
2419
  }
2192
- ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
2193
- cr,
2420
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ o(
2421
+ gr,
2194
2422
  {
2195
2423
  item: c,
2196
2424
  t: n,
@@ -2198,7 +2426,7 @@ const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2198
2426
  },
2199
2427
  c.memoryTypeId
2200
2428
  )),
2201
- t !== void 0 && /* @__PURE__ */ i(
2429
+ t !== void 0 && /* @__PURE__ */ o(
2202
2430
  "div",
2203
2431
  {
2204
2432
  style: {
@@ -2207,73 +2435,20 @@ const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2207
2435
  marginTop: "4px",
2208
2436
  fontStyle: "italic"
2209
2437
  },
2210
- children: T(n.tookSeconds, { n: t })
2438
+ children: S(n.tookSeconds, { n: t })
2211
2439
  }
2212
2440
  )
2213
2441
  ] });
2214
2442
  };
2215
- function mr(e, r) {
2216
- const t = Math.min(e.length, r.length);
2217
- for (let n = t; n >= 0; n--)
2218
- if (e.slice(-n) === r.slice(0, n)) return n;
2219
- return 0;
2220
- }
2221
- const ur = `
2222
-
2223
- `;
2224
- function ne(e) {
2225
- var t, n;
2226
- if (e.length === 0) return "";
2227
- let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
2228
- for (let l = 1; l < e.length; l++) {
2229
- const c = ((n = e[l]) == null ? void 0 : n.content) ?? "";
2230
- if (c === "") continue;
2231
- if (r === "") {
2232
- r = c;
2233
- continue;
2234
- }
2235
- const s = mr(r, c);
2236
- s === 0 ? r += ur + c : r += c.slice(s);
2237
- }
2238
- return r;
2239
- }
2240
- function te(e, r) {
2241
- if (e.length === 0) return "";
2242
- if (e.length === 1)
2243
- return T(r.memorySearchPagesSingle, {
2244
- n: e[0]
2245
- });
2246
- if (e.length === 2)
2247
- return T(r.memorySearchPagesTwo, {
2248
- a: e[0],
2249
- b: e[1]
2250
- });
2251
- const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
2252
- return T(r.memorySearchPagesMultiple, {
2253
- list: n,
2254
- n: t
2255
- });
2443
+ function fr(e) {
2444
+ return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ o(U, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
2256
2445
  }
2257
- function oe(e) {
2258
- const r = /* @__PURE__ */ new Set();
2259
- for (const t of e)
2260
- for (const n of t.pageNumbers) r.add(n);
2261
- return [...r].sort((t, n) => t - n);
2262
- }
2263
- function ie(e) {
2264
- const r = e.memoryTypeName.trim();
2265
- if (r !== "") return r;
2266
- if (e.memoryTypeId !== "") return e.memoryTypeId;
2267
- }
2268
- function yr(e) {
2269
- return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 });
2270
- }
2271
- function pr(e, r) {
2446
+ function xr(e, r) {
2272
2447
  if (e.error != null)
2273
- return /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
2448
+ return /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
2274
2449
  if (e.result == null)
2275
- return /* @__PURE__ */ i("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ i(
2276
- E,
2450
+ return /* @__PURE__ */ o("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ o(
2451
+ I,
2277
2452
  {
2278
2453
  text: r.searching,
2279
2454
  duration: 2.5,
@@ -2282,7 +2457,7 @@ function pr(e, r) {
2282
2457
  shimmerColor: "#000"
2283
2458
  }
2284
2459
  ) });
2285
- const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : T(r.chunksFound, { n: t.numberOfChunks }), l = T(r.scoreLabel, {
2460
+ const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : S(r.chunksFound, { n: t.numberOfChunks }), l = S(r.scoreLabel, {
2286
2461
  n: t.highestChunkScore.toFixed(2)
2287
2462
  });
2288
2463
  return /* @__PURE__ */ p("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
@@ -2291,7 +2466,7 @@ function pr(e, r) {
2291
2466
  l
2292
2467
  ] });
2293
2468
  }
2294
- function gr({
2469
+ function Sr({
2295
2470
  items: e,
2296
2471
  queryRow: r,
2297
2472
  onExploreQueryResultClick: t,
@@ -2299,7 +2474,7 @@ function gr({
2299
2474
  }) {
2300
2475
  const [l, c] = v(null);
2301
2476
  if (e.length === 0)
2302
- return /* @__PURE__ */ i(
2477
+ return /* @__PURE__ */ o(
2303
2478
  "div",
2304
2479
  {
2305
2480
  style: {
@@ -2311,7 +2486,7 @@ function gr({
2311
2486
  }
2312
2487
  );
2313
2488
  const s = !!t;
2314
- return /* @__PURE__ */ i(
2489
+ return /* @__PURE__ */ o(
2315
2490
  "div",
2316
2491
  {
2317
2492
  style: {
@@ -2323,24 +2498,24 @@ function gr({
2323
2498
  borderTop: "1px solid #f0f0f0"
2324
2499
  },
2325
2500
  children: e.map((d, m) => {
2326
- const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
2501
+ const i = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = K(
2327
2502
  d.chunks
2328
- ), u = [
2329
- ie(d),
2330
- T(n.scoreLabel, {
2503
+ ), y = [
2504
+ V(d),
2505
+ S(n.scoreLabel, {
2331
2506
  n: d.matchingChunkScore.toFixed(2)
2332
2507
  }),
2333
- a.length > 0 ? te(a, n) : n.pagesNotAvailable
2508
+ a.length > 0 ? q(a, n) : n.pagesNotAvailable
2334
2509
  ].filter(
2335
- (x) => x != null && x !== ""
2336
- ), y = {
2510
+ (k) => k != null && k !== ""
2511
+ ), u = {
2337
2512
  memoryId: d.memoryId,
2338
2513
  memoryTitle: d.memoryTitle,
2339
2514
  pageNumbers: a,
2340
2515
  memoryTypeId: r.memoryTypeId,
2341
2516
  memoryTypeName: r.memoryTypeName,
2342
2517
  query: r.query
2343
- }, f = `${r.query}::${d.memoryId}::${m}`, g = l === f;
2518
+ }, h = `${r.query}::${d.memoryId}::${m}`, g = l === h;
2344
2519
  return /* @__PURE__ */ p(
2345
2520
  "div",
2346
2521
  {
@@ -2366,7 +2541,7 @@ function gr({
2366
2541
  gap: "6px"
2367
2542
  },
2368
2543
  children: [
2369
- /* @__PURE__ */ i(
2544
+ /* @__PURE__ */ o(
2370
2545
  "span",
2371
2546
  {
2372
2547
  style: {
@@ -2374,10 +2549,10 @@ function gr({
2374
2549
  fontWeight: 600,
2375
2550
  color: "#333"
2376
2551
  },
2377
- children: o
2552
+ children: i
2378
2553
  }
2379
2554
  ),
2380
- /* @__PURE__ */ i(
2555
+ /* @__PURE__ */ o(
2381
2556
  "span",
2382
2557
  {
2383
2558
  style: {
@@ -2387,12 +2562,12 @@ function gr({
2387
2562
  whiteSpace: "pre-wrap",
2388
2563
  wordBreak: "break-word"
2389
2564
  },
2390
- children: ne(
2565
+ children: j(
2391
2566
  d.chunks
2392
2567
  )
2393
2568
  }
2394
2569
  ),
2395
- /* @__PURE__ */ i(
2570
+ /* @__PURE__ */ o(
2396
2571
  "div",
2397
2572
  {
2398
2573
  style: {
@@ -2401,7 +2576,7 @@ function gr({
2401
2576
  color: "#94a3b8",
2402
2577
  lineHeight: 1.35
2403
2578
  },
2404
- children: u.join(" · ")
2579
+ children: y.join(" · ")
2405
2580
  }
2406
2581
  )
2407
2582
  ]
@@ -2414,10 +2589,10 @@ function gr({
2414
2589
  "aria-busy": g,
2415
2590
  disabled: g,
2416
2591
  onClick: async () => {
2417
- c(f);
2592
+ c(h);
2418
2593
  try {
2419
2594
  await t(
2420
- y
2595
+ u
2421
2596
  );
2422
2597
  } finally {
2423
2598
  c(null);
@@ -2440,7 +2615,7 @@ function gr({
2440
2615
  gap: 8
2441
2616
  },
2442
2617
  children: [
2443
- g && /* @__PURE__ */ i(
2618
+ g && /* @__PURE__ */ o(
2444
2619
  "span",
2445
2620
  {
2446
2621
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -2459,7 +2634,7 @@ function gr({
2459
2634
  }
2460
2635
  );
2461
2636
  }
2462
- function hr(e) {
2637
+ function Tr(e) {
2463
2638
  const r = [], t = /* @__PURE__ */ new Map();
2464
2639
  return e.forEach((n, l) => {
2465
2640
  let c = t.get(n.memoryTypeId);
@@ -2470,7 +2645,7 @@ function hr(e) {
2470
2645
  }, t.set(n.memoryTypeId, c)), c.items.push({ item: n, flatIndex: l });
2471
2646
  }), r.map((n) => t.get(n));
2472
2647
  }
2473
- function fr({
2648
+ function kr({
2474
2649
  group: e,
2475
2650
  t: r,
2476
2651
  lastInFlightIndex: t,
@@ -2479,8 +2654,8 @@ function fr({
2479
2654
  toggleExpanded: c,
2480
2655
  onExploreQueryResultClick: s
2481
2656
  }) {
2482
- const d = e.items.map((o) => o.item), m = d.some(
2483
- (o) => o.result == null && o.error == null
2657
+ const d = e.items.map((i) => i.item), m = d.some(
2658
+ (i) => i.result == null && i.error == null
2484
2659
  );
2485
2660
  return /* @__PURE__ */ p(
2486
2661
  b.div,
@@ -2499,7 +2674,7 @@ function fr({
2499
2674
  minWidth: 0
2500
2675
  },
2501
2676
  children: [
2502
- /* @__PURE__ */ i(
2677
+ /* @__PURE__ */ o(
2503
2678
  "div",
2504
2679
  {
2505
2680
  style: {
@@ -2510,7 +2685,7 @@ function fr({
2510
2685
  width: 32,
2511
2686
  ...m ? {} : { paddingTop: 2 }
2512
2687
  },
2513
- children: yr(d)
2688
+ children: fr(d)
2514
2689
  }
2515
2690
  ),
2516
2691
  /* @__PURE__ */ p(
@@ -2524,21 +2699,21 @@ function fr({
2524
2699
  flex: 1
2525
2700
  },
2526
2701
  children: [
2527
- /* @__PURE__ */ i(
2702
+ /* @__PURE__ */ o(
2528
2703
  "span",
2529
2704
  {
2530
2705
  style: {
2531
2706
  fontSize: 12,
2532
2707
  color: "#888"
2533
2708
  },
2534
- children: T(r.memorySearchExploreQueryTypeLabel, {
2709
+ children: S(r.memorySearchExploreQueryTypeLabel, {
2535
2710
  name: e.memoryTypeName
2536
2711
  })
2537
2712
  }
2538
2713
  ),
2539
- e.items.map(({ item: o, flatIndex: a }) => {
2540
- var h;
2541
- const u = o.result != null, y = o.error != null, f = a === t && n && !u && !y, g = l[a] === !0, x = ((h = o.result) == null ? void 0 : h.items) ?? [];
2714
+ e.items.map(({ item: i, flatIndex: a }) => {
2715
+ var x;
2716
+ const y = i.result != null, u = i.error != null, h = a === t && n && !y && !u, g = l[a] === !0, k = ((x = i.result) == null ? void 0 : x.items) ?? [];
2542
2717
  return /* @__PURE__ */ p(
2543
2718
  "div",
2544
2719
  {
@@ -2561,7 +2736,7 @@ function fr({
2561
2736
  minWidth: 0
2562
2737
  },
2563
2738
  children: [
2564
- /* @__PURE__ */ i(
2739
+ /* @__PURE__ */ o(
2565
2740
  "span",
2566
2741
  {
2567
2742
  style: {
@@ -2572,16 +2747,16 @@ function fr({
2572
2747
  flex: "1 1 12rem",
2573
2748
  minWidth: 0
2574
2749
  },
2575
- children: f ? /* @__PURE__ */ i(
2576
- E,
2750
+ children: h ? /* @__PURE__ */ o(
2751
+ I,
2577
2752
  {
2578
- text: o.query,
2753
+ text: i.query,
2579
2754
  duration: 2.5,
2580
2755
  repeat: !0,
2581
2756
  color: "#999",
2582
2757
  shimmerColor: "#000"
2583
2758
  }
2584
- ) : o.query
2759
+ ) : i.query
2585
2760
  }
2586
2761
  ),
2587
2762
  /* @__PURE__ */ p(
@@ -2595,8 +2770,8 @@ function fr({
2595
2770
  flexShrink: 0
2596
2771
  },
2597
2772
  children: [
2598
- pr(o, r),
2599
- u && /* @__PURE__ */ i(
2773
+ xr(i, r),
2774
+ y && /* @__PURE__ */ o(
2600
2775
  "button",
2601
2776
  {
2602
2777
  type: "button",
@@ -2620,18 +2795,18 @@ function fr({
2620
2795
  ]
2621
2796
  }
2622
2797
  ),
2623
- u && g && /* @__PURE__ */ i(
2624
- gr,
2798
+ y && g && /* @__PURE__ */ o(
2799
+ Sr,
2625
2800
  {
2626
- items: x,
2627
- queryRow: o,
2801
+ items: k,
2802
+ queryRow: i,
2628
2803
  onExploreQueryResultClick: s,
2629
2804
  t: r
2630
2805
  }
2631
2806
  )
2632
2807
  ]
2633
2808
  },
2634
- `${e.memoryTypeId}-${a}-${o.query}`
2809
+ `${e.memoryTypeId}-${a}-${i.query}`
2635
2810
  );
2636
2811
  })
2637
2812
  ]
@@ -2641,7 +2816,7 @@ function fr({
2641
2816
  }
2642
2817
  );
2643
2818
  }
2644
- const Sr = ({
2819
+ const br = ({
2645
2820
  data: e,
2646
2821
  isLatest: r = !1,
2647
2822
  durationSeconds: t,
@@ -2650,23 +2825,23 @@ const Sr = ({
2650
2825
  }) => {
2651
2826
  const [c, s] = v(
2652
2827
  {}
2653
- ), d = G((a) => {
2654
- s((u) => ({
2655
- ...u,
2656
- [a]: !u[a]
2828
+ ), d = W((a) => {
2829
+ s((y) => ({
2830
+ ...y,
2831
+ [a]: !y[a]
2657
2832
  }));
2658
- }, []), m = D(() => {
2833
+ }, []), m = P(() => {
2659
2834
  let a = -1;
2660
- return e.queries.forEach((u, y) => {
2661
- u.result == null && u.error == null && (a = y);
2835
+ return e.queries.forEach((y, u) => {
2836
+ y.result == null && y.error == null && (a = u);
2662
2837
  }), a;
2663
- }, [e.queries]), o = D(
2664
- () => hr(e.queries),
2838
+ }, [e.queries]), i = P(
2839
+ () => Tr(e.queries),
2665
2840
  [e.queries]
2666
2841
  );
2667
2842
  return /* @__PURE__ */ p("div", { style: { padding: "10px" }, children: [
2668
- r && !t && e.queries.length === 0 ? /* @__PURE__ */ i(
2669
- E,
2843
+ r && !t && e.queries.length === 0 ? /* @__PURE__ */ o(
2844
+ I,
2670
2845
  {
2671
2846
  text: l.memorySearchExploringQueries,
2672
2847
  duration: 2.5,
@@ -2674,8 +2849,8 @@ const Sr = ({
2674
2849
  color: "#999",
2675
2850
  shimmerColor: "#000"
2676
2851
  }
2677
- ) : o.map((a) => /* @__PURE__ */ i(
2678
- fr,
2852
+ ) : i.map((a) => /* @__PURE__ */ o(
2853
+ kr,
2679
2854
  {
2680
2855
  group: a,
2681
2856
  t: l,
@@ -2687,7 +2862,7 @@ const Sr = ({
2687
2862
  },
2688
2863
  a.memoryTypeId
2689
2864
  )),
2690
- t !== void 0 && /* @__PURE__ */ i(
2865
+ t !== void 0 && /* @__PURE__ */ o(
2691
2866
  "div",
2692
2867
  {
2693
2868
  style: {
@@ -2696,14 +2871,14 @@ const Sr = ({
2696
2871
  marginTop: "4px",
2697
2872
  fontStyle: "italic"
2698
2873
  },
2699
- children: T(l.tookSeconds, { n: t })
2874
+ children: S(l.tookSeconds, { n: t })
2700
2875
  }
2701
2876
  )
2702
2877
  ] });
2703
- }, xr = ({ data: e, onSearchResultClick: r, t }) => {
2878
+ }, vr = ({ data: e, onSearchResultClick: r, t }) => {
2704
2879
  const n = e.response.items, l = !!r, [c, s] = v(null);
2705
2880
  return /* @__PURE__ */ p("div", { style: { padding: "16px" }, children: [
2706
- /* @__PURE__ */ i(
2881
+ /* @__PURE__ */ o(
2707
2882
  b.div,
2708
2883
  {
2709
2884
  style: {
@@ -2718,7 +2893,7 @@ const Sr = ({
2718
2893
  children: t.resultsHeading
2719
2894
  }
2720
2895
  ),
2721
- /* @__PURE__ */ i(
2896
+ /* @__PURE__ */ o(
2722
2897
  "div",
2723
2898
  {
2724
2899
  style: {
@@ -2727,23 +2902,23 @@ const Sr = ({
2727
2902
  gap: 0
2728
2903
  },
2729
2904
  children: n.map((d, m) => {
2730
- const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
2905
+ const i = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = K(
2731
2906
  d.chunks
2732
- ), u = [
2733
- ie(d),
2734
- T(t.scoreLabel, {
2907
+ ), y = [
2908
+ V(d),
2909
+ S(t.scoreLabel, {
2735
2910
  n: d.matchingChunkScore.toFixed(2)
2736
2911
  }),
2737
- a.length > 0 ? te(a, t) : t.pagesNotAvailable
2912
+ a.length > 0 ? q(a, t) : t.pagesNotAvailable
2738
2913
  ].filter(
2739
- (x) => x != null && x !== ""
2740
- ), y = {
2914
+ (k) => k != null && k !== ""
2915
+ ), u = {
2741
2916
  memoryId: d.memoryId,
2742
2917
  memoryTitle: d.memoryTitle,
2743
2918
  memoryTypeId: d.memoryTypeId,
2744
2919
  memoryTypeName: d.memoryTypeName,
2745
2920
  pageNumbers: a
2746
- }, f = `${d.memoryId}-${m}`, g = c === f;
2921
+ }, h = `${d.memoryId}-${m}`, g = c === h;
2747
2922
  return /* @__PURE__ */ p(
2748
2923
  b.div,
2749
2924
  {
@@ -2772,7 +2947,7 @@ const Sr = ({
2772
2947
  gap: "6px"
2773
2948
  },
2774
2949
  children: [
2775
- /* @__PURE__ */ i(
2950
+ /* @__PURE__ */ o(
2776
2951
  "span",
2777
2952
  {
2778
2953
  style: {
@@ -2780,10 +2955,10 @@ const Sr = ({
2780
2955
  fontWeight: 600,
2781
2956
  color: "#333"
2782
2957
  },
2783
- children: o
2958
+ children: i
2784
2959
  }
2785
2960
  ),
2786
- /* @__PURE__ */ i(
2961
+ /* @__PURE__ */ o(
2787
2962
  "span",
2788
2963
  {
2789
2964
  style: {
@@ -2793,10 +2968,10 @@ const Sr = ({
2793
2968
  whiteSpace: "pre-wrap",
2794
2969
  wordBreak: "break-word"
2795
2970
  },
2796
- children: ne(d.chunks)
2971
+ children: j(d.chunks)
2797
2972
  }
2798
2973
  ),
2799
- /* @__PURE__ */ i(
2974
+ /* @__PURE__ */ o(
2800
2975
  "div",
2801
2976
  {
2802
2977
  style: {
@@ -2805,7 +2980,7 @@ const Sr = ({
2805
2980
  color: "#94a3b8",
2806
2981
  lineHeight: 1.35
2807
2982
  },
2808
- children: u.join(" · ")
2983
+ children: y.join(" · ")
2809
2984
  }
2810
2985
  )
2811
2986
  ]
@@ -2818,9 +2993,9 @@ const Sr = ({
2818
2993
  "aria-busy": g,
2819
2994
  disabled: g,
2820
2995
  onClick: async () => {
2821
- s(f);
2996
+ s(h);
2822
2997
  try {
2823
- await r(y);
2998
+ await r(u);
2824
2999
  } finally {
2825
3000
  s(null);
2826
3001
  }
@@ -2842,7 +3017,7 @@ const Sr = ({
2842
3017
  gap: 8
2843
3018
  },
2844
3019
  children: [
2845
- g && /* @__PURE__ */ i(
3020
+ g && /* @__PURE__ */ o(
2846
3021
  "span",
2847
3022
  {
2848
3023
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -2861,7 +3036,7 @@ const Sr = ({
2861
3036
  }
2862
3037
  )
2863
3038
  ] });
2864
- }, Tr = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
3039
+ }, Cr = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
2865
3040
  b.div,
2866
3041
  {
2867
3042
  initial: { opacity: 0, y: -10 },
@@ -2872,7 +3047,7 @@ const Sr = ({
2872
3047
  alignItems: "flex-start",
2873
3048
  gap: "10px"
2874
3049
  },
2875
- children: /* @__PURE__ */ i(
3050
+ children: /* @__PURE__ */ o(
2876
3051
  "span",
2877
3052
  {
2878
3053
  style: {
@@ -2884,7 +3059,7 @@ const Sr = ({
2884
3059
  }
2885
3060
  )
2886
3061
  }
2887
- ) }), kr = ({
3062
+ ) }), wr = ({
2888
3063
  progressViewItems: e,
2889
3064
  loadingText: r,
2890
3065
  t,
@@ -2892,61 +3067,61 @@ const Sr = ({
2892
3067
  onSearchResultClick: l,
2893
3068
  onExploreQueryResultClick: c
2894
3069
  }) => {
2895
- const s = F(null);
3070
+ const s = R(null);
2896
3071
  A(() => {
2897
3072
  s.current && (s.current.scrollTop = s.current.scrollHeight);
2898
3073
  }, [e.length]);
2899
- const d = (o) => {
2900
- const a = o.item.data;
3074
+ const d = (i) => {
3075
+ const a = i.item.data;
2901
3076
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Text")
2902
- return /* @__PURE__ */ i(V, { text: a.text });
3077
+ return /* @__PURE__ */ o(Z, { text: a.text });
2903
3078
  if (a.taskType === "StructuredChatCompletion" && a.eventType === "Completed")
2904
- return /* @__PURE__ */ i(Be, { data: a });
3079
+ return /* @__PURE__ */ o(We, { data: a });
2905
3080
  if (a.taskType === "MemoryChat")
2906
3081
  switch (a.eventType) {
2907
3082
  case "Text":
2908
- return /* @__PURE__ */ i(V, { text: a.text });
3083
+ return /* @__PURE__ */ o(Z, { text: a.text });
2909
3084
  case "FindMemories":
2910
- return /* @__PURE__ */ i(
2911
- _e,
3085
+ return /* @__PURE__ */ o(
3086
+ Ge,
2912
3087
  {
2913
3088
  data: a,
2914
- isLatest: o.isLatest,
2915
- durationSeconds: o.durationSeconds,
3089
+ isLatest: i.isLatest,
3090
+ durationSeconds: i.durationSeconds,
2916
3091
  t
2917
3092
  }
2918
3093
  );
2919
3094
  case "FindMemoriesResult":
2920
- return /* @__PURE__ */ i(
2921
- Ge,
3095
+ return /* @__PURE__ */ o(
3096
+ Qe,
2922
3097
  {
2923
3098
  data: a,
2924
3099
  t
2925
3100
  }
2926
3101
  );
2927
3102
  case "Search":
2928
- return /* @__PURE__ */ i(
2929
- He,
3103
+ return /* @__PURE__ */ o(
3104
+ _e,
2930
3105
  {
2931
3106
  data: a,
2932
- isLatest: o.isLatest,
2933
- durationSeconds: o.durationSeconds,
3107
+ isLatest: i.isLatest,
3108
+ durationSeconds: i.durationSeconds,
2934
3109
  t
2935
3110
  }
2936
3111
  );
2937
3112
  case "FindSources":
2938
- return /* @__PURE__ */ i(
2939
- Qe,
3113
+ return /* @__PURE__ */ o(
3114
+ Ue,
2940
3115
  {
2941
3116
  data: a,
2942
- isLatest: o.isLatest,
2943
- durationSeconds: o.durationSeconds,
3117
+ isLatest: i.isLatest,
3118
+ durationSeconds: i.durationSeconds,
2944
3119
  t
2945
3120
  }
2946
3121
  );
2947
3122
  case "SourcesResult":
2948
- return /* @__PURE__ */ i(
2949
- je,
3123
+ return /* @__PURE__ */ o(
3124
+ qe,
2950
3125
  {
2951
3126
  data: a,
2952
3127
  onSourceClick: n,
@@ -2954,56 +3129,63 @@ const Sr = ({
2954
3129
  }
2955
3130
  );
2956
3131
  case "ExploreMemories":
2957
- return /* @__PURE__ */ i(
2958
- Xe,
3132
+ return /* @__PURE__ */ o(
3133
+ Je,
2959
3134
  {
2960
3135
  data: a,
2961
- completed: o.completed,
2962
- isLatest: o.isLatest,
3136
+ completed: i.completed,
3137
+ isLatest: i.isLatest,
3138
+ t
3139
+ }
3140
+ );
3141
+ case "ChunkResults":
3142
+ return /* @__PURE__ */ o(
3143
+ ir,
3144
+ {
3145
+ data: a,
3146
+ onSearchResultClick: l,
2963
3147
  t
2964
3148
  }
2965
3149
  );
2966
- case "ChunkResult":
2967
- return /* @__PURE__ */ i(Ze, { data: a, t });
2968
3150
  case "Completed":
2969
3151
  return null;
2970
3152
  }
2971
3153
  if (a.taskType === "MemorySearch")
2972
3154
  switch (a.eventType) {
2973
3155
  case "GeneratingQueries":
2974
- return /* @__PURE__ */ i(
2975
- dr,
3156
+ return /* @__PURE__ */ o(
3157
+ hr,
2976
3158
  {
2977
3159
  data: a,
2978
- isLatest: o.isLatest,
2979
- durationSeconds: o.durationSeconds,
3160
+ isLatest: i.isLatest,
3161
+ durationSeconds: i.durationSeconds,
2980
3162
  t
2981
3163
  }
2982
3164
  );
2983
3165
  case "ExploreQueries":
2984
- return /* @__PURE__ */ i(
2985
- Sr,
3166
+ return /* @__PURE__ */ o(
3167
+ br,
2986
3168
  {
2987
3169
  data: a,
2988
- isLatest: o.isLatest,
2989
- durationSeconds: o.durationSeconds,
3170
+ isLatest: i.isLatest,
3171
+ durationSeconds: i.durationSeconds,
2990
3172
  onExploreQueryResultClick: c,
2991
3173
  t
2992
3174
  }
2993
3175
  );
2994
3176
  case "SearchMemoryTypes":
2995
- return /* @__PURE__ */ i(
2996
- tr,
3177
+ return /* @__PURE__ */ o(
3178
+ cr,
2997
3179
  {
2998
3180
  data: a,
2999
- isLatest: o.isLatest,
3000
- durationSeconds: o.durationSeconds,
3181
+ isLatest: i.isLatest,
3182
+ durationSeconds: i.durationSeconds,
3001
3183
  t
3002
3184
  }
3003
3185
  );
3004
3186
  case "Completed":
3005
- return /* @__PURE__ */ i(
3006
- xr,
3187
+ return /* @__PURE__ */ o(
3188
+ vr,
3007
3189
  {
3008
3190
  data: a,
3009
3191
  onSearchResultClick: l,
@@ -3011,11 +3193,11 @@ const Sr = ({
3011
3193
  }
3012
3194
  );
3013
3195
  }
3014
- return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(Tr, { message: a.message }) : null;
3196
+ return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ o(Cr, { message: a.message }) : null;
3015
3197
  };
3016
3198
  if (e.length === 0)
3017
- return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
3018
- E,
3199
+ return /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
3200
+ I,
3019
3201
  {
3020
3202
  text: r ?? t.processingYourTask,
3021
3203
  duration: 1.5,
@@ -3025,20 +3207,22 @@ const Sr = ({
3025
3207
  shimmerColor: "#000"
3026
3208
  }
3027
3209
  ) });
3028
- const m = e.filter((o, a) => {
3029
- const u = o.item.data;
3030
- return u.taskType === "MemoryChat" && u.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
3031
- (h) => h.item.data.taskType === "MemoryChat" && h.item.data.eventType === "ExploreMemories"
3032
- ) : u.taskType === "MemorySearch" && u.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
3033
- (h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "GeneratingQueries"
3034
- ) : u.taskType === "MemorySearch" && u.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
3035
- (h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "ExploreQueries"
3210
+ const m = e.filter((i, a) => {
3211
+ const y = i.item.data;
3212
+ return y.taskType === "MemoryChat" && y.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
3213
+ (f) => f.item.data.taskType === "MemoryChat" && f.item.data.eventType === "ExploreMemories"
3214
+ ) : y.taskType === "MemorySearch" && y.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
3215
+ (f) => f.item.data.taskType === "MemorySearch" && f.item.data.eventType === "GeneratingQueries"
3216
+ ) : y.taskType === "MemorySearch" && y.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
3217
+ (f) => f.item.data.taskType === "MemorySearch" && f.item.data.eventType === "ExploreQueries"
3218
+ ) : y.taskType === "MemoryChat" && y.eventType === "ChunkResults" ? !e.slice(a + 1).some(
3219
+ (f) => f.item.data.taskType === "MemoryChat" && f.item.data.eventType === "ChunkResults"
3036
3220
  ) : !0;
3037
3221
  });
3038
- return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(J, { children: m.map((o, a) => /* @__PURE__ */ i(
3222
+ return /* @__PURE__ */ o("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ o(re, { children: m.map((i, a) => /* @__PURE__ */ o(
3039
3223
  b.div,
3040
3224
  {
3041
- id: `agent-task-progress-item-${o.item.progressItemId}`,
3225
+ id: `agent-task-progress-item-${i.item.progressItemId}`,
3042
3226
  initial: { opacity: 0, y: -20 },
3043
3227
  animate: { opacity: 1, y: 0 },
3044
3228
  transition: {
@@ -3046,11 +3230,11 @@ const Sr = ({
3046
3230
  delay: a * 0.1,
3047
3231
  ease: "easeOut"
3048
3232
  },
3049
- children: d(o)
3233
+ children: d(i)
3050
3234
  },
3051
- o.item.progressItemId
3235
+ i.item.progressItemId
3052
3236
  )) }) });
3053
- }, Rr = ({
3237
+ }, zr = ({
3054
3238
  agentTask: e,
3055
3239
  mode: r = "verbose",
3056
3240
  language: t,
@@ -3058,15 +3242,15 @@ const Sr = ({
3058
3242
  onSearchResultClick: l,
3059
3243
  onExploreQueryResultClick: c
3060
3244
  }) => {
3061
- const s = ze(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : t ?? "en", m = $e(d);
3062
- return r === "simple" ? /* @__PURE__ */ i(
3063
- Ne,
3245
+ const s = Ne(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : t ?? "en", m = He(d);
3246
+ return r === "simple" ? /* @__PURE__ */ o(
3247
+ Be,
3064
3248
  {
3065
3249
  progressViewItems: s,
3066
3250
  t: m
3067
3251
  }
3068
- ) : /* @__PURE__ */ i(
3069
- kr,
3252
+ ) : /* @__PURE__ */ o(
3253
+ wr,
3070
3254
  {
3071
3255
  progressViewItems: s,
3072
3256
  loadingText: e.loadingText,
@@ -3078,10 +3262,10 @@ const Sr = ({
3078
3262
  );
3079
3263
  };
3080
3264
  export {
3081
- Rr as AgentTaskProgress,
3082
- z as Checkmark,
3083
- Ar as FencyProvider,
3084
- xr as MemorySearchCompletedResults,
3265
+ zr as AgentTaskProgress,
3266
+ L as Checkmark,
3267
+ Dr as FencyProvider,
3268
+ vr as MemorySearchCompletedResults,
3085
3269
  U as XMark,
3086
- Fr as useAgentTasks
3270
+ Lr as useAgentTasks
3087
3271
  };