@fencyai/react 0.1.167 → 0.1.168

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