@fencyai/react 0.1.157 → 0.1.159

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,55 +1,55 @@
1
- import { jsxs as y, jsx as o, Fragment as E } from "react/jsx-runtime";
1
+ import { jsxs as y, jsx as i, Fragment as E } from "react/jsx-runtime";
2
2
  import { createStream as ie, isStreamTimeoutEvent as ae, isStreamNotFoundEvent as se, isAgentTaskProgressItemUpdatedEvent as le, createAgentTask as ce } from "@fencyai/js";
3
- import { createContext as de, useState as v, useRef as A, useEffect as I, useCallback as G, useContext as ue, useMemo as D } from "react";
4
- import { useInView as me, motion as T, AnimatePresence as X } from "motion/react";
3
+ import { createContext as de, useState as b, useRef as A, useEffect as M, useCallback as G, useContext as me, useMemo as D } from "react";
4
+ import { useInView as ue, motion as T, AnimatePresence as X } from "motion/react";
5
5
  import pe from "react-markdown";
6
6
  import { Prism as J } from "react-syntax-highlighter";
7
- import ge from "remark-gfm";
7
+ import ye from "remark-gfm";
8
8
  import './assets/index.css';const Y = de(
9
9
  void 0
10
10
  );
11
- async function ye(e, r) {
11
+ async function ge(e, r) {
12
12
  const n = e.getReader();
13
13
  let t;
14
14
  for (; !(t = await n.read()).done; )
15
15
  r(t.value);
16
16
  }
17
17
  function he(e) {
18
- let r, n, t, c = !1;
19
- return function(l) {
20
- r === void 0 ? (r = l, n = 0, t = -1) : r = Se(r, l);
18
+ let r, n, t, l = !1;
19
+ return function(s) {
20
+ r === void 0 ? (r = s, n = 0, t = -1) : r = Se(r, s);
21
21
  const d = r.length;
22
- let u = 0;
22
+ let m = 0;
23
23
  for (; n < d; ) {
24
- c && (r[n] === 10 && (u = ++n), c = !1);
25
- let i = -1;
26
- for (; n < d && i === -1; ++n)
24
+ l && (r[n] === 10 && (m = ++n), l = !1);
25
+ let o = -1;
26
+ for (; n < d && o === -1; ++n)
27
27
  switch (r[n]) {
28
28
  case 58:
29
- t === -1 && (t = n - u);
29
+ t === -1 && (t = n - m);
30
30
  break;
31
31
  case 13:
32
- c = !0;
32
+ l = !0;
33
33
  case 10:
34
- i = n;
34
+ o = n;
35
35
  break;
36
36
  }
37
- if (i === -1)
37
+ if (o === -1)
38
38
  break;
39
- e(r.subarray(u, i), t), u = n, t = -1;
39
+ e(r.subarray(m, o), t), m = n, t = -1;
40
40
  }
41
- u === d ? r = void 0 : u !== 0 && (r = r.subarray(u), n -= u);
41
+ m === d ? r = void 0 : m !== 0 && (r = r.subarray(m), n -= m);
42
42
  };
43
43
  }
44
44
  function fe(e, r, n) {
45
45
  let t = q();
46
- const c = new TextDecoder();
47
- return function(l, d) {
48
- if (l.length === 0)
46
+ const l = new TextDecoder();
47
+ return function(s, d) {
48
+ if (s.length === 0)
49
49
  n == null || n(t), t = q();
50
50
  else if (d > 0) {
51
- const u = c.decode(l.subarray(0, d)), i = d + (l[d + 1] === 32 ? 2 : 1), a = c.decode(l.subarray(i));
52
- switch (u) {
51
+ const m = l.decode(s.subarray(0, d)), o = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(o));
52
+ switch (m) {
53
53
  case "data":
54
54
  t.data = t.data ? t.data + `
55
55
  ` + a : a;
@@ -61,8 +61,8 @@ function fe(e, r, n) {
61
61
  e(t.id = a);
62
62
  break;
63
63
  case "retry":
64
- const m = parseInt(a, 10);
65
- isNaN(m) || r(t.retry = m);
64
+ const u = parseInt(a, 10);
65
+ isNaN(u) || r(t.retry = u);
66
66
  break;
67
67
  }
68
68
  }
@@ -84,46 +84,46 @@ var xe = function(e, r) {
84
84
  var n = {};
85
85
  for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && r.indexOf(t) < 0 && (n[t] = e[t]);
86
86
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
87
- for (var c = 0, t = Object.getOwnPropertySymbols(e); c < t.length; c++)
88
- r.indexOf(t[c]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[c]) && (n[t[c]] = e[t[c]]);
87
+ for (var l = 0, t = Object.getOwnPropertySymbols(e); l < t.length; l++)
88
+ r.indexOf(t[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[l]) && (n[t[l]] = e[t[l]]);
89
89
  return n;
90
90
  };
91
91
  const _ = "text/event-stream", Te = 1e3, U = "last-event-id";
92
92
  function ke(e, r) {
93
- var { signal: n, headers: t, onopen: c, onmessage: s, onclose: l, onerror: d, openWhenHidden: u, fetch: i } = r, a = xe(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
- return new Promise((m, h) => {
93
+ var { signal: n, headers: t, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a = xe(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
+ return new Promise((u, g) => {
95
95
  const f = Object.assign({}, t);
96
96
  f.accept || (f.accept = _);
97
- let g;
98
- function x() {
99
- g.abort(), document.hidden || R();
97
+ let p;
98
+ function S() {
99
+ p.abort(), document.hidden || R();
100
100
  }
101
- u || document.addEventListener("visibilitychange", x);
102
- let p = Te, k = 0;
103
- function b() {
104
- document.removeEventListener("visibilitychange", x), window.clearTimeout(k), g.abort();
101
+ m || document.addEventListener("visibilitychange", S);
102
+ let h = Te, k = 0;
103
+ function v() {
104
+ document.removeEventListener("visibilitychange", S), window.clearTimeout(k), p.abort();
105
105
  }
106
106
  n == null || n.addEventListener("abort", () => {
107
- b(), m();
107
+ v(), u();
108
108
  });
109
- const F = i ?? window.fetch, w = c ?? be;
109
+ const F = o ?? window.fetch, w = l ?? be;
110
110
  async function R() {
111
111
  var L;
112
- g = new AbortController();
112
+ p = new AbortController();
113
113
  try {
114
- const P = await F(e, Object.assign(Object.assign({}, a), { headers: f, signal: g.signal }));
115
- await w(P), await ye(P.body, he(fe((M) => {
116
- M ? f[U] = M : delete f[U];
117
- }, (M) => {
118
- p = M;
119
- }, s))), l == null || l(), b(), m();
114
+ const P = await F(e, Object.assign(Object.assign({}, a), { headers: f, signal: p.signal }));
115
+ await w(P), await ge(P.body, he(fe((I) => {
116
+ I ? f[U] = I : delete f[U];
117
+ }, (I) => {
118
+ h = I;
119
+ }, c))), s == null || s(), v(), u();
120
120
  } catch (P) {
121
- if (!g.signal.aborted)
121
+ if (!p.signal.aborted)
122
122
  try {
123
- const M = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : p;
124
- window.clearTimeout(k), k = window.setTimeout(R, M);
125
- } catch (M) {
126
- b(), h(M);
123
+ const I = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : h;
124
+ window.clearTimeout(k), k = window.setTimeout(R, I);
125
+ } catch (I) {
126
+ v(), g(I);
127
127
  }
128
128
  }
129
129
  }
@@ -151,36 +151,36 @@ class Ce {
151
151
  */
152
152
  updateStreams(r) {
153
153
  r.forEach((t) => {
154
- const c = t.stream.id;
155
- this.eventSources.has(c) || this.connectStream(t);
154
+ const l = t.stream.id;
155
+ this.eventSources.has(l) || this.connectStream(t);
156
156
  });
157
157
  const n = new Set(r.map((t) => t.stream.id));
158
- this.eventSources.forEach((t, c) => {
159
- n.has(c) || (t.abort(), this.eventSources.delete(c));
158
+ this.eventSources.forEach((t, l) => {
159
+ n.has(l) || (t.abort(), this.eventSources.delete(l));
160
160
  });
161
161
  }
162
162
  connectStream(r) {
163
163
  const n = r.stream.id, t = new AbortController();
164
164
  this.eventSources.set(n, t);
165
- const c = `${this.fency.baseUrl}/sse/streams/${n}`, s = {
165
+ const l = `${this.fency.baseUrl}/sse/streams/${n}`, c = {
166
166
  "X-Fency-Publishable-Key": this.fency.publishableKey,
167
167
  "X-Fency-Stream-Token": r.stream.token
168
168
  };
169
- ke(c, {
170
- headers: s,
169
+ ke(l, {
170
+ headers: c,
171
171
  signal: t.signal,
172
- async onopen(l) {
173
- if (!l.ok && l.status >= 400 && l.status < 500 && l.status !== 429)
174
- throw new Error(`Client error ${l.status}`);
172
+ async onopen(s) {
173
+ if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
174
+ throw new Error(`Client error ${s.status}`);
175
175
  },
176
- onmessage: (l) => {
177
- if (l.data) {
178
- const d = ve(l.data);
176
+ onmessage: (s) => {
177
+ if (s.data) {
178
+ const d = ve(s.data);
179
179
  this.broadcast(d, n);
180
180
  }
181
181
  },
182
- onerror: (l) => {
183
- throw console.error("EventSource error for stream", n, ":", l), this.broadcastError(n), l;
182
+ onerror: (s) => {
183
+ throw console.error("EventSource error for stream", n, ":", s), this.broadcastError(n), s;
184
184
  },
185
185
  onclose() {
186
186
  }
@@ -216,31 +216,31 @@ const Ee = 12e4, we = (e) => {
216
216
  const r = Date.now();
217
217
  return e.filter((n) => r - n.createdAt < Ee);
218
218
  };
219
- function Mr({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
220
- const [t, c] = v(
219
+ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
220
+ const [t, l] = b(
221
221
  null
222
- ), [s, l] = v(!0), [d, u] = v(null), [i, a] = v([]), m = A(null), h = A(null);
223
- I(() => {
224
- e.then((p) => {
225
- c(p), l(!1);
226
- }).catch((p) => {
227
- u(p), l(!1);
222
+ ), [c, s] = b(!0), [d, m] = b(null), [o, a] = b([]), u = A(null), g = A(null);
223
+ M(() => {
224
+ e.then((h) => {
225
+ l(h), s(!1);
226
+ }).catch((h) => {
227
+ m(h), s(!1);
228
228
  });
229
- }, [e]), I(() => {
230
- t && !h.current && (h.current = new Ce(t));
231
- }, [t]), I(() => {
232
- h.current && h.current.updateStreams(i);
233
- }, [i]), I(() => () => {
234
- var p;
235
- (p = h.current) == null || p.cleanup();
229
+ }, [e]), M(() => {
230
+ t && !g.current && (g.current = new Ce(t));
231
+ }, [t]), M(() => {
232
+ g.current && g.current.updateStreams(o);
233
+ }, [o]), M(() => () => {
234
+ var h;
235
+ (h = g.current) == null || h.cleanup();
236
236
  }, []);
237
237
  const f = G(
238
- async (p = 3e4) => {
239
- if (m.current)
240
- return m.current;
241
- const k = Date.now(), b = i.length > 0 ? i[i.length - 1] : null;
242
- if (b && k - b.createdAt < p)
243
- return b.stream;
238
+ async (h = 3e4) => {
239
+ if (u.current)
240
+ return u.current;
241
+ const k = Date.now(), v = o.length > 0 ? o[o.length - 1] : null;
242
+ if (v && k - v.createdAt < h)
243
+ return v.stream;
244
244
  const F = (async () => {
245
245
  if (!t)
246
246
  throw new Error("Fency instance not initialized");
@@ -255,15 +255,15 @@ function Mr({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
255
255
  createdAt: Date.now()
256
256
  };
257
257
  return a((P) => {
258
- const M = [...P, L];
259
- return we(M);
260
- }), m.current = null, R.stream;
258
+ const I = [...P, L];
259
+ return we(I);
260
+ }), u.current = null, R.stream;
261
261
  } else
262
- throw m.current = null, new Error("Failed to create stream");
262
+ throw u.current = null, new Error("Failed to create stream");
263
263
  })();
264
- return m.current = F, F;
264
+ return u.current = F, F;
265
265
  },
266
- [t, i]
266
+ [t, o]
267
267
  );
268
268
  if (d)
269
269
  return /* @__PURE__ */ y("div", { children: [
@@ -272,31 +272,31 @@ function Mr({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
272
272
  ] });
273
273
  if (!t)
274
274
  return null;
275
- const g = i.length > 0 ? i[i.length - 1] : null, x = {
275
+ const p = o.length > 0 ? o[o.length - 1] : null, S = {
276
276
  fency: t,
277
- loading: s,
277
+ loading: c,
278
278
  error: d,
279
- activeStreams: i,
280
- latestStream: g,
281
- eventManager: h.current,
279
+ activeStreams: o,
280
+ latestStream: p,
281
+ eventManager: g.current,
282
282
  getOrCreateStream: f
283
283
  };
284
- return /* @__PURE__ */ o(Y.Provider, { value: x, children: n });
284
+ return /* @__PURE__ */ i(Y.Provider, { value: S, children: n });
285
285
  }
286
286
  function Z() {
287
- const e = ue(Y);
287
+ const e = me(Y);
288
288
  if (e === void 0)
289
289
  throw new Error("useFencyContext must be used within a FencyProvider");
290
290
  return e;
291
291
  }
292
- const Me = (e) => {
292
+ const Ie = (e) => {
293
293
  try {
294
294
  const r = JSON.parse(e);
295
- return Ie(r);
295
+ return Me(r);
296
296
  } catch (r) {
297
297
  return console.error("Error parsing message:", r), null;
298
298
  }
299
- }, Ie = (e) => ae(e) ? Ae(e) : se(e) ? Fe(e) : le(e) ? Re(e) : null, Ae = (e) => ({
299
+ }, Me = (e) => ae(e) ? Ae(e) : se(e) ? Fe(e) : le(e) ? Re(e) : null, Ae = (e) => ({
300
300
  type: "STREAM_TIMEOUT",
301
301
  streamId: e.streamId,
302
302
  timestamp: e.timestamp
@@ -313,30 +313,30 @@ const Me = (e) => {
313
313
  createdAt: e.createdAt,
314
314
  data: JSON.parse(e.data)
315
315
  }), Pe = (e) => {
316
- const r = Z(), [n, t] = v(null), c = A(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
317
- return I(() => {
316
+ const r = Z(), [n, t] = b(null), l = A(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
317
+ return M(() => {
318
318
  if (!r.eventManager) return;
319
- const l = {
320
- onMessage: (u, i) => {
321
- var m, h, f;
322
- const a = Me(u);
319
+ const s = {
320
+ onMessage: (m, o) => {
321
+ var u, g, f;
322
+ const a = Ie(m);
323
323
  if (a)
324
324
  switch (a.type) {
325
325
  case "STREAM_TIMEOUT":
326
- (m = e == null ? void 0 : e.onStreamTimeout) == null || m.call(e, a);
326
+ (u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, a);
327
327
  break;
328
328
  case "STREAM_NOT_FOUND":
329
- (h = e == null ? void 0 : e.onStreamNotFound) == null || h.call(e, a);
329
+ (g = e == null ? void 0 : e.onStreamNotFound) == null || g.call(e, a);
330
330
  break;
331
331
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
332
332
  (f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, a);
333
333
  break;
334
334
  }
335
335
  },
336
- onError: (u) => {
337
- var i;
338
- (i = e == null ? void 0 : e.onStreamError) == null || i.call(e, {
339
- streamId: u,
336
+ onError: (m) => {
337
+ var o;
338
+ (o = e == null ? void 0 : e.onStreamError) == null || o.call(e, {
339
+ streamId: m,
340
340
  error: {
341
341
  code: "UnknownError",
342
342
  message: "Unknown error in useStream"
@@ -345,197 +345,197 @@ const Me = (e) => {
345
345
  }
346
346
  };
347
347
  return r.eventManager.subscribe(
348
- c.current,
349
- l
348
+ l.current,
349
+ s
350
350
  );
351
351
  }, [r.eventManager, e]), {
352
352
  createStream: async () => {
353
353
  try {
354
- const l = await r.getOrCreateStream(3e4);
355
- return t(l), {
354
+ const s = await r.getOrCreateStream(3e4);
355
+ return t(s), {
356
356
  type: "success",
357
- stream: l
357
+ stream: s
358
358
  };
359
- } catch (l) {
359
+ } catch (s) {
360
360
  return {
361
361
  type: "error",
362
362
  error: {
363
363
  code: "UnknownError",
364
- message: l instanceof Error ? l.message : "Failed to create stream"
364
+ message: s instanceof Error ? s.message : "Failed to create stream"
365
365
  }
366
366
  };
367
367
  }
368
368
  },
369
369
  stream: n
370
370
  };
371
- }, Ir = (e) => {
372
- const r = Z(), [n, t] = v([]), c = A(/* @__PURE__ */ new Set()), s = A(/* @__PURE__ */ new Map()), { createStream: l } = Pe({
373
- onAgentTaskProgressItemUpdated: (i) => {
374
- var h;
375
- if (!c.current.has(i.agentTaskId)) return;
376
- const a = i.data;
371
+ }, Mr = (e) => {
372
+ const r = Z(), [n, t] = b([]), l = A(/* @__PURE__ */ new Set()), c = A(/* @__PURE__ */ new Map()), { createStream: s } = Pe({
373
+ onAgentTaskProgressItemUpdated: (o) => {
374
+ var g;
375
+ if (!l.current.has(o.agentTaskId)) return;
376
+ const a = o.data;
377
377
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChatCompletion" && a.eventType === "Completed" || a.taskType === "MemorySearch" && a.eventType === "Completed") {
378
378
  const f = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
379
379
  t(
380
- f ? (x) => x.map((p) => {
380
+ f ? (S) => S.map((h) => {
381
381
  var F;
382
- if (((F = p.confirmedData) == null ? void 0 : F.taskId) !== i.agentTaskId)
383
- return p;
384
- const b = p.progressItems.some(
385
- (w) => w.progressItemId === i.progressItemId
386
- ) ? p.progressItems.map(
387
- (w) => w.progressItemId === i.progressItemId ? i : w
388
- ) : [...p.progressItems, i];
382
+ if (((F = h.confirmedData) == null ? void 0 : F.taskId) !== o.agentTaskId)
383
+ return h;
384
+ const v = h.progressItems.some(
385
+ (w) => w.progressItemId === o.progressItemId
386
+ ) ? h.progressItems.map(
387
+ (w) => w.progressItemId === o.progressItemId ? o : w
388
+ ) : [...h.progressItems, o];
389
389
  return {
390
- ...p,
391
- progressItems: b,
390
+ ...h,
391
+ progressItems: v,
392
392
  loading: !1
393
393
  };
394
- }) : (x) => x.map(
395
- (p) => {
394
+ }) : (S) => S.map(
395
+ (h) => {
396
396
  var k;
397
- return ((k = p.confirmedData) == null ? void 0 : k.taskId) === i.agentTaskId ? { ...p, loading: !1 } : p;
397
+ return ((k = h.confirmedData) == null ? void 0 : k.taskId) === o.agentTaskId ? { ...h, loading: !1 } : h;
398
398
  }
399
399
  )
400
400
  );
401
- const g = s.current.get(
402
- i.agentTaskId
401
+ const p = c.current.get(
402
+ o.agentTaskId
403
403
  );
404
- g && (s.current.delete(i.agentTaskId), g(a));
404
+ p && (c.current.delete(o.agentTaskId), p(a));
405
405
  return;
406
406
  }
407
- (h = e.onAgentTaskProgressItemUpdated) == null || h.call(e, i), t(
408
- (f) => f.map((g) => {
407
+ (g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, o), t(
408
+ (f) => f.map((p) => {
409
409
  var k;
410
- if (((k = g.confirmedData) == null ? void 0 : k.taskId) !== i.agentTaskId)
411
- return g;
412
- const p = g.progressItems.some(
413
- (b) => b.progressItemId === i.progressItemId
414
- ) ? g.progressItems.map(
415
- (b) => b.progressItemId === i.progressItemId ? i : b
416
- ) : [...g.progressItems, i];
417
- return { ...g, progressItems: p };
410
+ if (((k = p.confirmedData) == null ? void 0 : k.taskId) !== o.agentTaskId)
411
+ return p;
412
+ const h = p.progressItems.some(
413
+ (v) => v.progressItemId === o.progressItemId
414
+ ) ? p.progressItems.map(
415
+ (v) => v.progressItemId === o.progressItemId ? o : v
416
+ ) : [...p.progressItems, o];
417
+ return { ...p, progressItems: h };
418
418
  })
419
419
  );
420
420
  },
421
- onStreamError: (i) => {
421
+ onStreamError: (o) => {
422
422
  var a;
423
- (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, i), t((m) => {
424
- const h = m.find((f) => f.streamId === i.streamId);
425
- return h ? [
426
- ...m.filter((f) => f.streamId !== i.streamId),
423
+ (a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), t((u) => {
424
+ const g = u.find((f) => f.streamId === o.streamId);
425
+ return g ? [
426
+ ...u.filter((f) => f.streamId !== o.streamId),
427
427
  {
428
- ...h,
428
+ ...g,
429
429
  loading: !1,
430
- error: i.error
430
+ error: o.error
431
431
  }
432
- ] : m;
432
+ ] : u;
433
433
  });
434
434
  },
435
- onStreamNotFound: (i) => {
435
+ onStreamNotFound: (o) => {
436
436
  var a;
437
- (a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, i);
437
+ (a = e == null ? void 0 : e.onStreamNotFound) == null || a.call(e, o);
438
438
  },
439
- onStreamTimeout: (i) => {
439
+ onStreamTimeout: (o) => {
440
440
  var a;
441
- (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, i);
441
+ (a = e == null ? void 0 : e.onStreamTimeout) == null || a.call(e, o);
442
442
  }
443
443
  }), d = G(
444
- async (i, a) => {
445
- const m = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, h = await l();
446
- if (h.type === "success") {
444
+ async (o, a) => {
445
+ const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = await s();
446
+ if (g.type === "success") {
447
447
  t([
448
448
  ...n,
449
449
  {
450
- taskKey: m,
451
- streamId: h.stream.id,
450
+ taskKey: u,
451
+ streamId: g.stream.id,
452
452
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
453
453
  confirmedData: null,
454
454
  error: null,
455
- params: i,
455
+ params: o,
456
456
  progressItems: [],
457
457
  loading: !0,
458
458
  loadingText: a == null ? void 0 : a.loadingText
459
459
  }
460
460
  ]);
461
- const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(i.type), g = await ce({
461
+ const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(o.type), p = await ce({
462
462
  pk: r.fency.publishableKey,
463
463
  baseUrl: r.fency.baseUrl,
464
464
  clientToken: f,
465
- streamToken: h.stream.token,
465
+ streamToken: g.stream.token,
466
466
  request: {
467
- streamingChatCompletionTask: i.type === "StreamingChatCompletion" ? {
468
- messages: i.messages,
469
- model: i.model
467
+ streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
468
+ messages: o.messages,
469
+ model: o.model
470
470
  } : void 0,
471
- structuredChatCompletionTask: i.type === "StructuredChatCompletion" ? {
472
- messages: i.messages,
473
- jsonSchema: i.jsonSchema,
474
- model: i.model
471
+ structuredChatCompletionTask: o.type === "StructuredChatCompletion" ? {
472
+ messages: o.messages,
473
+ jsonSchema: o.jsonSchema,
474
+ model: o.model
475
475
  } : void 0,
476
- memoryChatCompletionTask: i.type === "MemoryChatCompletion" ? {
477
- messages: i.messages,
478
- model: i.model,
479
- language: i.language ?? "en",
480
- chunkLimit: i.chunkLimit ?? 10,
481
- memoryScanLimit: i.memoryScanLimit ?? 3
476
+ memoryChatCompletionTask: o.type === "MemoryChatCompletion" ? {
477
+ messages: o.messages,
478
+ model: o.model,
479
+ language: o.language ?? "en",
480
+ chunkLimit: o.chunkLimit ?? 10,
481
+ memoryScanLimit: o.memoryScanLimit ?? 3
482
482
  } : void 0,
483
- memorySearchTask: i.type === "MemorySearch" ? {
484
- query: i.query,
485
- model: i.model,
486
- language: i.language ?? "en",
487
- chunkLimit: i.chunkLimit ?? 10,
488
- contextExpansion: i.contextExpansion,
489
- ...i.queryExpansion != null ? {
490
- queryExpansion: i.queryExpansion
483
+ memorySearchTask: o.type === "MemorySearch" ? {
484
+ query: o.query,
485
+ model: o.model,
486
+ language: o.language ?? "en",
487
+ chunkLimit: o.chunkLimit ?? 10,
488
+ contextExpansion: o.contextExpansion,
489
+ ...o.queryExpansion != null ? {
490
+ queryExpansion: o.queryExpansion
491
491
  } : {}
492
492
  } : void 0
493
493
  }
494
494
  });
495
- if (g.type === "success" && g.agentTask) {
496
- c.current.add(
497
- g.agentTask.id
498
- ), t((p) => [
499
- ...p.filter((k) => k.taskKey !== m),
495
+ if (p.type === "success" && p.agentTask) {
496
+ l.current.add(
497
+ p.agentTask.id
498
+ ), t((h) => [
499
+ ...h.filter((k) => k.taskKey !== u),
500
500
  {
501
- taskKey: m,
502
- streamId: h.stream.id,
501
+ taskKey: u,
502
+ streamId: g.stream.id,
503
503
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
504
- taskId: g.agentTask.id,
505
- createdAt: g.agentTask.createdAt,
504
+ taskId: p.agentTask.id,
505
+ createdAt: p.agentTask.createdAt,
506
506
  error: null,
507
- params: i,
507
+ params: o,
508
508
  progressItems: [],
509
509
  loading: !0,
510
510
  loadingText: a == null ? void 0 : a.loadingText,
511
511
  confirmedData: {
512
- taskId: g.agentTask.id,
513
- createdAt: g.agentTask.createdAt
512
+ taskId: p.agentTask.id,
513
+ createdAt: p.agentTask.createdAt
514
514
  }
515
515
  }
516
516
  ]);
517
- const x = await new Promise((p) => {
518
- s.current.set(
519
- g.agentTask.id,
520
- p
517
+ const S = await new Promise((h) => {
518
+ c.current.set(
519
+ p.agentTask.id,
520
+ h
521
521
  );
522
522
  });
523
523
  return {
524
524
  type: "success",
525
- streamId: h.stream.id,
526
- agentTaskId: g.agentTask.id,
527
- response: x
525
+ streamId: g.stream.id,
526
+ agentTaskId: p.agentTask.id,
527
+ response: S
528
528
  };
529
529
  } else {
530
- if (g.type === "error")
531
- return t((x) => [
532
- ...x.filter((p) => p.taskKey !== m),
530
+ if (p.type === "error")
531
+ return t((S) => [
532
+ ...S.filter((h) => h.taskKey !== u),
533
533
  {
534
- taskKey: m,
534
+ taskKey: u,
535
535
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
536
- streamId: h.stream.id,
537
- params: i,
538
- error: g.error,
536
+ streamId: g.stream.id,
537
+ params: o,
538
+ error: p.error,
539
539
  progressItems: [],
540
540
  loading: !1,
541
541
  loadingText: a == null ? void 0 : a.loadingText,
@@ -543,21 +543,21 @@ const Me = (e) => {
543
543
  }
544
544
  ]), {
545
545
  type: "error",
546
- error: g.error
546
+ error: p.error
547
547
  };
548
548
  {
549
- const x = {
549
+ const S = {
550
550
  message: "No response received",
551
551
  code: "UnknownError"
552
552
  };
553
- return t((p) => [
554
- ...p.filter((k) => k.taskKey !== m),
553
+ return t((h) => [
554
+ ...h.filter((k) => k.taskKey !== u),
555
555
  {
556
- taskKey: m,
556
+ taskKey: u,
557
557
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
558
- streamId: h.stream.id,
559
- error: x,
560
- params: i,
558
+ streamId: g.stream.id,
559
+ error: S,
560
+ params: o,
561
561
  progressItems: [],
562
562
  loading: !1,
563
563
  loadingText: a == null ? void 0 : a.loadingText,
@@ -565,39 +565,39 @@ const Me = (e) => {
565
565
  }
566
566
  ]), {
567
567
  type: "error",
568
- error: x
568
+ error: S
569
569
  };
570
570
  }
571
571
  }
572
572
  } else
573
- return console.error(h.error), h;
573
+ return console.error(g.error), g;
574
574
  },
575
- [r, n, l]
576
- ), u = D(() => {
575
+ [r, n, s]
576
+ ), m = D(() => {
577
577
  if (n.length !== 0)
578
- return [...n].sort((i, a) => new Date(a.triggeredAt).getTime() - new Date(i.triggeredAt).getTime())[0];
578
+ return [...n].sort((o, a) => new Date(a.triggeredAt).getTime() - new Date(o.triggeredAt).getTime())[0];
579
579
  }, [n]);
580
- return I(() => () => {
581
- c.current.clear(), s.current.clear();
580
+ return M(() => () => {
581
+ l.current.clear(), c.current.clear();
582
582
  }, []), {
583
583
  agentTasks: n,
584
584
  createAgentTask: d,
585
- latest: u
585
+ latest: m
586
586
  };
587
587
  };
588
588
  function De(e) {
589
589
  return e.progressItems.map((r, n) => {
590
- const t = e.progressItems[n + 1], c = t != null;
591
- let s;
590
+ const t = e.progressItems[n + 1], l = t != null;
591
+ let c;
592
592
  if (t != null && t.createdAt) {
593
- const l = new Date(r.createdAt).getTime(), d = new Date(t.createdAt).getTime();
594
- s = Math.round((d - l) / 1e3);
593
+ const s = new Date(r.createdAt).getTime(), d = new Date(t.createdAt).getTime();
594
+ c = Math.round((d - s) / 1e3);
595
595
  }
596
596
  return {
597
597
  item: r,
598
- completed: c,
598
+ completed: l,
599
599
  isLatest: n === e.progressItems.length - 1,
600
- durationSeconds: s
600
+ durationSeconds: c
601
601
  };
602
602
  });
603
603
  }
@@ -606,22 +606,22 @@ function C({
606
606
  duration: r = 2,
607
607
  delay: n = 0,
608
608
  repeat: t = !0,
609
- repeatDelay: c = 0.5,
610
- className: s,
611
- startOnView: l = !1,
609
+ repeatDelay: l = 0.5,
610
+ className: c,
611
+ startOnView: s = !1,
612
612
  once: d = !1,
613
- inViewMargin: u,
614
- spread: i = 2,
613
+ inViewMargin: m,
614
+ spread: o = 2,
615
615
  color: a = "#999",
616
- shimmerColor: m = "#000",
617
- direction: h = "fromBottom"
616
+ shimmerColor: u = "#000",
617
+ direction: g = "fromBottom"
618
618
  }) {
619
- const f = A(null), g = me(f, { once: d, margin: u }), x = D(() => e.length * i, [e, i]), p = !l || g, k = h === "fromBottom" ? "100% center" : "-100% center", b = h === "fromBottom" ? "0% center" : "200% center";
620
- return /* @__PURE__ */ o(
619
+ const f = A(null), p = ue(f, { once: d, margin: m }), S = D(() => e.length * o, [e, o]), h = !s || p, k = g === "fromBottom" ? "100% center" : "-100% center", v = g === "fromBottom" ? "0% center" : "200% center";
620
+ return /* @__PURE__ */ i(
621
621
  T.span,
622
622
  {
623
623
  ref: f,
624
- className: s,
624
+ className: c,
625
625
  style: {
626
626
  position: "relative",
627
627
  display: "inline-block",
@@ -631,9 +631,9 @@ function C({
631
631
  color: "transparent",
632
632
  WebkitTextFillColor: "transparent",
633
633
  backgroundRepeat: "no-repeat, padding-box",
634
- "--spread": `${x}px`,
634
+ "--spread": `${S}px`,
635
635
  "--base-color": a,
636
- "--shimmer-color": m,
636
+ "--shimmer-color": u,
637
637
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
638
638
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
639
639
  },
@@ -641,8 +641,8 @@ function C({
641
641
  backgroundPosition: k,
642
642
  opacity: 0
643
643
  },
644
- animate: p ? {
645
- backgroundPosition: b,
644
+ animate: h ? {
645
+ backgroundPosition: v,
646
646
  opacity: 1
647
647
  } : {},
648
648
  transition: {
@@ -650,7 +650,7 @@ function C({
650
650
  repeat: t ? 1 / 0 : 0,
651
651
  duration: r,
652
652
  delay: n,
653
- repeatDelay: c,
653
+ repeatDelay: l,
654
654
  ease: "linear"
655
655
  },
656
656
  opacity: {
@@ -710,21 +710,21 @@ const ze = ({ progressViewItems: e, t: r }) => {
710
710
  const n = e[e.length - 1];
711
711
  if (!n) return null;
712
712
  const t = Le(n, r);
713
- return /* @__PURE__ */ o("div", { className: "simple-mode-container", children: /* @__PURE__ */ o(X, { mode: "wait", children: /* @__PURE__ */ o(
713
+ return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(X, { mode: "wait", children: /* @__PURE__ */ i(
714
714
  T.div,
715
715
  {
716
716
  initial: { opacity: 0, y: 10 },
717
717
  animate: { opacity: 1, y: 0 },
718
718
  exit: { opacity: 0, y: -10 },
719
719
  transition: { duration: 0.3 },
720
- children: n.completed ? /* @__PURE__ */ o(
720
+ children: n.completed ? /* @__PURE__ */ i(
721
721
  "div",
722
722
  {
723
723
  className: "simple-mode-title",
724
724
  style: { color: "#666" },
725
725
  children: t
726
726
  }
727
- ) : /* @__PURE__ */ o(
727
+ ) : /* @__PURE__ */ i(
728
728
  C,
729
729
  {
730
730
  text: t,
@@ -889,35 +889,35 @@ const ze = ({ progressViewItems: e, t: r }) => {
889
889
  italic: {
890
890
  fontStyle: "italic"
891
891
  }
892
- }, V = ({
892
+ }, K = ({
893
893
  text: e
894
- }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
894
+ }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
895
895
  T.div,
896
896
  {
897
897
  className: "fency-markdown-body-raw",
898
898
  initial: { opacity: 0, y: -10 },
899
899
  animate: { opacity: 1, y: 0 },
900
900
  transition: { duration: 0.3, delay: 0 },
901
- children: /* @__PURE__ */ o(
901
+ children: /* @__PURE__ */ i(
902
902
  pe,
903
903
  {
904
- remarkPlugins: [ge],
904
+ remarkPlugins: [ye],
905
905
  components: {
906
906
  code(r) {
907
- const { children: n, className: t, node: c, ref: s, ...l } = r, d = /language-(\w+)/.exec(t || "");
907
+ const { children: n, className: t, node: l, ref: c, ...s } = r, d = /language-(\w+)/.exec(t || "");
908
908
  return d ? (
909
909
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
910
- /* @__PURE__ */ o(
910
+ /* @__PURE__ */ i(
911
911
  J,
912
912
  {
913
- ...l,
913
+ ...s,
914
914
  PreTag: "div",
915
915
  children: String(n).replace(/\n$/, ""),
916
916
  language: d[1],
917
917
  style: ee
918
918
  }
919
919
  )
920
- ) : /* @__PURE__ */ o("code", { ...l, className: t, children: String(n) });
920
+ ) : /* @__PURE__ */ i("code", { ...s, className: t, children: String(n) });
921
921
  }
922
922
  },
923
923
  children: e
@@ -930,13 +930,13 @@ const ze = ({ progressViewItems: e, t: r }) => {
930
930
  null,
931
931
  2
932
932
  );
933
- return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
933
+ return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
934
934
  T.div,
935
935
  {
936
936
  initial: { opacity: 0, y: -10 },
937
937
  animate: { opacity: 1, y: 0 },
938
938
  transition: { duration: 0.3, delay: 0 },
939
- children: /* @__PURE__ */ o(J, { language: "json", style: ee, PreTag: "div", children: r })
939
+ children: /* @__PURE__ */ i(J, { language: "json", style: ee, PreTag: "div", children: r })
940
940
  }
941
941
  ) });
942
942
  }, Be = {
@@ -1059,12 +1059,12 @@ const ze = ({ progressViewItems: e, t: r }) => {
1059
1059
  memorySearchExploreNoResults: "Ingen resultater funnet"
1060
1060
  }
1061
1061
  };
1062
- function We(e) {
1062
+ function Ne(e) {
1063
1063
  return Be[e];
1064
1064
  }
1065
- function S(e, r) {
1065
+ function x(e, r) {
1066
1066
  return Object.entries(r).reduce(
1067
- (n, [t, c]) => n.replace(`{${t}}`, String(c)),
1067
+ (n, [t, l]) => n.replace(`{${t}}`, String(l)),
1068
1068
  e
1069
1069
  );
1070
1070
  }
@@ -1076,45 +1076,45 @@ function Q(e, r) {
1076
1076
  }
1077
1077
  return n.join(", ");
1078
1078
  }
1079
- const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1080
- const [c, s] = v(!1), d = (e.memories ?? []).map((p) => p.memoryTitle), u = d.length > 0, i = u && d.length > N, a = i && !c ? d.slice(0, N) : d, m = d.length - N, h = !i || c, f = `${t.searchingFor}'${e.queryDescription}'`, g = u ? `${t.searchingIn}${Q(
1079
+ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1080
+ const [l, c] = b(!1), d = (e.memories ?? []).map((h) => h.memoryTitle), m = d.length > 0, o = m && d.length > W, a = o && !l ? d.slice(0, W) : d, u = d.length - W, g = !o || l, f = `${t.searchingFor}'${e.queryDescription}'`, p = m ? `${t.searchingIn}${Q(
1081
1081
  a,
1082
- h ? t.and : void 0
1083
- )}` : "", x = u ? `${f}${g}` : `${t.searchingPrefix}${e.queryDescription}`;
1082
+ g ? t.and : void 0
1083
+ )}` : "", S = m ? `${f}${p}` : `${t.searchingPrefix}${e.queryDescription}`;
1084
1084
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1085
- /* @__PURE__ */ o(
1085
+ /* @__PURE__ */ i(
1086
1086
  T.div,
1087
1087
  {
1088
1088
  style: { color: "#666" },
1089
1089
  initial: { opacity: 0, y: -10 },
1090
1090
  animate: { opacity: 1, y: 0 },
1091
1091
  transition: { duration: 0.3, delay: 0 },
1092
- children: r && !n && !i ? /* @__PURE__ */ o(
1092
+ children: r && !n && !o ? /* @__PURE__ */ i(
1093
1093
  C,
1094
1094
  {
1095
- text: x,
1095
+ text: S,
1096
1096
  duration: 2.5,
1097
1097
  repeat: !0,
1098
1098
  color: "#999",
1099
1099
  shimmerColor: "#000"
1100
1100
  }
1101
1101
  ) : /* @__PURE__ */ y(E, { children: [
1102
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u ? /* @__PURE__ */ y(E, { children: [
1102
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ y(E, { children: [
1103
1103
  t.searchingFor,
1104
1104
  /* @__PURE__ */ y("span", { style: { fontWeight: 600 }, children: [
1105
1105
  "'",
1106
1106
  e.queryDescription,
1107
1107
  "'"
1108
1108
  ] }),
1109
- g
1109
+ p
1110
1110
  ] }) : `${t.searchingPrefix}${e.queryDescription}` }),
1111
- i && !c && /* @__PURE__ */ y(E, { children: [
1111
+ o && !l && /* @__PURE__ */ y(E, { children: [
1112
1112
  " ",
1113
- /* @__PURE__ */ o(
1113
+ /* @__PURE__ */ i(
1114
1114
  "button",
1115
1115
  {
1116
1116
  type: "button",
1117
- onClick: () => s(!0),
1117
+ onClick: () => c(!0),
1118
1118
  style: {
1119
1119
  background: "none",
1120
1120
  border: "none",
@@ -1126,19 +1126,19 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1126
1126
  textDecoration: "underline",
1127
1127
  fontFamily: "inherit"
1128
1128
  },
1129
- children: S(t.moreMemories, {
1130
- n: m
1129
+ children: x(t.moreMemories, {
1130
+ n: u
1131
1131
  })
1132
1132
  }
1133
1133
  )
1134
1134
  ] }),
1135
- i && c && /* @__PURE__ */ y(E, { children: [
1135
+ o && l && /* @__PURE__ */ y(E, { children: [
1136
1136
  " ",
1137
- /* @__PURE__ */ o(
1137
+ /* @__PURE__ */ i(
1138
1138
  "button",
1139
1139
  {
1140
1140
  type: "button",
1141
- onClick: () => s(!1),
1141
+ onClick: () => c(!1),
1142
1142
  style: {
1143
1143
  background: "none",
1144
1144
  border: "none",
@@ -1157,7 +1157,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1157
1157
  ] })
1158
1158
  }
1159
1159
  ),
1160
- n !== void 0 && /* @__PURE__ */ o(
1160
+ n !== void 0 && /* @__PURE__ */ i(
1161
1161
  "div",
1162
1162
  {
1163
1163
  style: {
@@ -1166,17 +1166,17 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1166
1166
  marginTop: "4px",
1167
1167
  fontStyle: "italic"
1168
1168
  },
1169
- children: S(t.tookSeconds, { n })
1169
+ children: x(t.tookSeconds, { n })
1170
1170
  }
1171
1171
  )
1172
1172
  ] });
1173
- }, H = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1174
- const [c, s] = v(!1), l = e.titles, d = l.length > 0, u = d && l.length > H, i = u && !c ? l.slice(0, H) : l, a = l.length - H, m = !u || c, h = d ? `${t.findingMemoriesIn}${Q(
1175
- i,
1176
- m ? t.and : void 0
1173
+ }, $ = 5, $e = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1174
+ const [l, c] = b(!1), s = e.titles, d = s.length > 0, m = d && s.length > $, o = m && !l ? s.slice(0, $) : s, a = s.length - $, u = !m || l, g = d ? `${t.findingMemoriesIn}${Q(
1175
+ o,
1176
+ u ? t.and : void 0
1177
1177
  )}` : t.findingMemories;
1178
1178
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1179
- /* @__PURE__ */ o(
1179
+ /* @__PURE__ */ i(
1180
1180
  T.div,
1181
1181
  {
1182
1182
  style: {
@@ -1185,24 +1185,24 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1185
1185
  initial: { opacity: 0, y: -10 },
1186
1186
  animate: { opacity: 1, y: 0 },
1187
1187
  transition: { duration: 0.3, delay: 0 },
1188
- children: r && !n && !u ? /* @__PURE__ */ o(
1188
+ children: r && !n && !m ? /* @__PURE__ */ i(
1189
1189
  C,
1190
1190
  {
1191
- text: h,
1191
+ text: g,
1192
1192
  duration: 2.5,
1193
1193
  repeat: !0,
1194
1194
  color: "#999",
1195
1195
  shimmerColor: "#000"
1196
1196
  }
1197
1197
  ) : /* @__PURE__ */ y(E, { children: [
1198
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: h }),
1199
- u && !c && /* @__PURE__ */ y(E, { children: [
1198
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: g }),
1199
+ m && !l && /* @__PURE__ */ y(E, { children: [
1200
1200
  " ",
1201
- /* @__PURE__ */ o(
1201
+ /* @__PURE__ */ i(
1202
1202
  "button",
1203
1203
  {
1204
1204
  type: "button",
1205
- onClick: () => s(!0),
1205
+ onClick: () => c(!0),
1206
1206
  style: {
1207
1207
  background: "none",
1208
1208
  border: "none",
@@ -1214,19 +1214,19 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1214
1214
  textDecoration: "underline",
1215
1215
  fontFamily: "inherit"
1216
1216
  },
1217
- children: S(t.moreMemories, {
1217
+ children: x(t.moreMemories, {
1218
1218
  n: a
1219
1219
  })
1220
1220
  }
1221
1221
  )
1222
1222
  ] }),
1223
- u && c && /* @__PURE__ */ y(E, { children: [
1223
+ m && l && /* @__PURE__ */ y(E, { children: [
1224
1224
  " ",
1225
- /* @__PURE__ */ o(
1225
+ /* @__PURE__ */ i(
1226
1226
  "button",
1227
1227
  {
1228
1228
  type: "button",
1229
- onClick: () => s(!1),
1229
+ onClick: () => c(!1),
1230
1230
  style: {
1231
1231
  background: "none",
1232
1232
  border: "none",
@@ -1245,7 +1245,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1245
1245
  ] })
1246
1246
  }
1247
1247
  ),
1248
- n !== void 0 && /* @__PURE__ */ o(
1248
+ n !== void 0 && /* @__PURE__ */ i(
1249
1249
  "div",
1250
1250
  {
1251
1251
  style: {
@@ -1254,16 +1254,16 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1254
1254
  marginTop: "4px",
1255
1255
  fontStyle: "italic"
1256
1256
  },
1257
- children: S(t.tookSeconds, { n })
1257
+ children: x(t.tookSeconds, { n })
1258
1258
  }
1259
1259
  )
1260
1260
  ] });
1261
- }, $ = 5, $e = ({ data: e, t: r }) => {
1262
- const [n, t] = v(!1), s = e.memories.map((f) => f.memoryTitle), l = s.length > 0, d = l && s.length > $, u = d && !n ? s.slice(0, $) : s, i = s.length - $, a = !d || n, m = s.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, h = l ? `${m}${Q(
1263
- u,
1261
+ }, H = 5, He = ({ data: e, t: r }) => {
1262
+ const [n, t] = b(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !n ? c.slice(0, H) : c, o = c.length - H, a = !d || n, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, g = s ? `${u}${Q(
1263
+ m,
1264
1264
  a ? r.and : void 0
1265
1265
  )}` : r.memoriesFound;
1266
- return /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
1266
+ return /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
1267
1267
  T.div,
1268
1268
  {
1269
1269
  style: { color: "#666" },
@@ -1271,10 +1271,10 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1271
1271
  animate: { opacity: 1, y: 0 },
1272
1272
  transition: { duration: 0.3, delay: 0 },
1273
1273
  children: /* @__PURE__ */ y(E, { children: [
1274
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: h }),
1274
+ /* @__PURE__ */ i("span", { style: { color: "#666" }, children: g }),
1275
1275
  d && !n && /* @__PURE__ */ y(E, { children: [
1276
1276
  " ",
1277
- /* @__PURE__ */ o(
1277
+ /* @__PURE__ */ i(
1278
1278
  "button",
1279
1279
  {
1280
1280
  type: "button",
@@ -1290,15 +1290,15 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1290
1290
  textDecoration: "underline",
1291
1291
  fontFamily: "inherit"
1292
1292
  },
1293
- children: S(r.moreMemories, {
1294
- n: i
1293
+ children: x(r.moreMemories, {
1294
+ n: o
1295
1295
  })
1296
1296
  }
1297
1297
  )
1298
1298
  ] }),
1299
1299
  d && n && /* @__PURE__ */ y(E, { children: [
1300
1300
  " ",
1301
- /* @__PURE__ */ o(
1301
+ /* @__PURE__ */ i(
1302
1302
  "button",
1303
1303
  {
1304
1304
  type: "button",
@@ -1324,7 +1324,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1324
1324
  }, _e = ({ isLatest: e = !1, durationSeconds: r, t: n }) => {
1325
1325
  const t = n.addingSources;
1326
1326
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1327
- /* @__PURE__ */ o(
1327
+ /* @__PURE__ */ i(
1328
1328
  T.div,
1329
1329
  {
1330
1330
  style: {
@@ -1336,7 +1336,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1336
1336
  initial: { opacity: 0, y: -10 },
1337
1337
  animate: { opacity: 1, y: 0 },
1338
1338
  transition: { duration: 0.3, delay: 0 },
1339
- children: e && !r ? /* @__PURE__ */ o(
1339
+ children: e && !r ? /* @__PURE__ */ i(
1340
1340
  C,
1341
1341
  {
1342
1342
  text: t,
@@ -1345,10 +1345,10 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1345
1345
  color: "#999",
1346
1346
  shimmerColor: "#000"
1347
1347
  }
1348
- ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: t })
1348
+ ) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: t })
1349
1349
  }
1350
1350
  ),
1351
- r !== void 0 && /* @__PURE__ */ o(
1351
+ r !== void 0 && /* @__PURE__ */ i(
1352
1352
  "div",
1353
1353
  {
1354
1354
  style: {
@@ -1357,7 +1357,7 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1357
1357
  marginTop: "4px",
1358
1358
  fontStyle: "italic"
1359
1359
  },
1360
- children: S(n.tookSeconds, { n: r })
1360
+ children: x(n.tookSeconds, { n: r })
1361
1361
  }
1362
1362
  )
1363
1363
  ] });
@@ -1365,62 +1365,77 @@ const N = 5, Ne = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1365
1365
  function Ge(e, r) {
1366
1366
  if (e.length === 0) return "";
1367
1367
  if (e.length === 1)
1368
- return S(r.pageSingle, { n: e[0] });
1368
+ return x(r.pageSingle, { n: e[0] });
1369
1369
  if (e.length === 2)
1370
- return S(r.pageTwo, {
1370
+ return x(r.pageTwo, {
1371
1371
  a: e[0],
1372
1372
  b: e[1]
1373
1373
  });
1374
1374
  const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
1375
- return S(r.pageMultiple, { list: t, n });
1375
+ return x(r.pageMultiple, { list: t, n });
1376
1376
  }
1377
- const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1378
- /* @__PURE__ */ o(
1379
- T.div,
1380
- {
1381
- style: {
1382
- marginBottom: "10px",
1383
- fontSize: "11px",
1384
- fontWeight: 500,
1385
- letterSpacing: "0.05em",
1386
- textTransform: "uppercase",
1387
- color: "#999"
1377
+ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
1378
+ const [t, l] = b(null);
1379
+ return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1380
+ /* @__PURE__ */ i(
1381
+ T.div,
1382
+ {
1383
+ style: {
1384
+ marginBottom: "10px",
1385
+ fontSize: "11px",
1386
+ fontWeight: 500,
1387
+ letterSpacing: "0.05em",
1388
+ textTransform: "uppercase",
1389
+ color: "#999"
1390
+ },
1391
+ initial: { opacity: 0, y: -10 },
1392
+ animate: { opacity: 1, y: 0 },
1393
+ transition: { duration: 0.3, delay: 0 },
1394
+ children: n.sources
1395
+ }
1396
+ ),
1397
+ /* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: n.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ i(
1398
+ je,
1399
+ {
1400
+ source: c,
1401
+ index: s,
1402
+ loadingMemoryId: t,
1403
+ setLoadingMemoryId: l,
1404
+ onSourceClick: r,
1405
+ t: n
1388
1406
  },
1389
- initial: { opacity: 0, y: -10 },
1390
- animate: { opacity: 1, y: 0 },
1391
- transition: { duration: 0.3, delay: 0 },
1392
- children: n.sources
1393
- }
1394
- ),
1395
- /* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: n.noSources }) : e.sources.map((t, c) => /* @__PURE__ */ o(
1396
- je,
1397
- {
1398
- source: t,
1399
- index: c,
1400
- onSourceClick: r,
1401
- t: n
1402
- },
1403
- t.memoryId
1404
- )) })
1405
- ] }), je = ({
1407
+ c.memoryId
1408
+ )) })
1409
+ ] });
1410
+ }, je = ({
1406
1411
  source: e,
1407
1412
  index: r,
1408
- onSourceClick: n,
1409
- t
1413
+ loadingMemoryId: n,
1414
+ setLoadingMemoryId: t,
1415
+ onSourceClick: l,
1416
+ t: c
1410
1417
  }) => {
1411
- const [c, s] = v(!1), l = !!n, d = e.pageNumbers ?? [], u = Ge(d, t);
1418
+ const [s, d] = b(!1), m = !!l, o = n === e.memoryId, a = e.pageNumbers ?? [], u = Ge(a, c);
1412
1419
  return /* @__PURE__ */ y(
1413
1420
  T.div,
1414
1421
  {
1422
+ "aria-busy": o,
1415
1423
  initial: { opacity: 0, scale: 0.9 },
1416
1424
  animate: { opacity: 1, scale: 1 },
1417
1425
  transition: { duration: 0.25, delay: r * 0.05 },
1418
- onClick: l ? () => n({
1419
- memoryId: e.memoryId,
1420
- pageNumbers: [...d]
1421
- }) : void 0,
1422
- onMouseEnter: l ? () => s(!0) : void 0,
1423
- onMouseLeave: l ? () => s(!1) : void 0,
1426
+ onClick: m && !o ? async () => {
1427
+ t(e.memoryId);
1428
+ try {
1429
+ await l({
1430
+ memoryId: e.memoryId,
1431
+ pageNumbers: [...a]
1432
+ });
1433
+ } finally {
1434
+ t(null);
1435
+ }
1436
+ } : void 0,
1437
+ onMouseEnter: m && !o ? () => d(!0) : void 0,
1438
+ onMouseLeave: m && !o ? () => d(!1) : void 0,
1424
1439
  style: {
1425
1440
  display: "inline-flex",
1426
1441
  flexDirection: "column",
@@ -1428,14 +1443,37 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { s
1428
1443
  padding: "8px 12px",
1429
1444
  borderRadius: "6px",
1430
1445
  border: "1px solid #e0e0e0",
1431
- backgroundColor: c ? "#f5f5f5" : "transparent",
1432
- cursor: l ? "pointer" : "default",
1446
+ backgroundColor: s ? "#f5f5f5" : "transparent",
1447
+ cursor: m && !o ? "pointer" : o ? "wait" : "default",
1433
1448
  transition: "background-color 0.15s ease",
1434
- userSelect: "none"
1449
+ userSelect: "none",
1450
+ pointerEvents: o ? "none" : void 0
1435
1451
  },
1436
1452
  children: [
1437
- /* @__PURE__ */ o("span", { style: { fontSize: "13px", fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1438
- u && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: u })
1453
+ /* @__PURE__ */ y(
1454
+ "span",
1455
+ {
1456
+ style: {
1457
+ fontSize: "13px",
1458
+ fontWeight: 500,
1459
+ color: "#333",
1460
+ display: "inline-flex",
1461
+ alignItems: "center",
1462
+ gap: 8
1463
+ },
1464
+ children: [
1465
+ o && /* @__PURE__ */ i(
1466
+ "span",
1467
+ {
1468
+ className: "explore-memory-loader explore-memory-loader--callback",
1469
+ "aria-hidden": !0
1470
+ }
1471
+ ),
1472
+ e.memoryTitle
1473
+ ]
1474
+ }
1475
+ ),
1476
+ u && /* @__PURE__ */ i("span", { style: { fontSize: "12px", color: "#666" }, children: u })
1439
1477
  ]
1440
1478
  }
1441
1479
  );
@@ -1445,7 +1483,7 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { s
1445
1483
  borderWidth: n = 7
1446
1484
  }) => {
1447
1485
  const t = r * 0.5;
1448
- return /* @__PURE__ */ o(
1486
+ return /* @__PURE__ */ i(
1449
1487
  "span",
1450
1488
  {
1451
1489
  style: {
@@ -1463,10 +1501,10 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { s
1463
1501
  size: r = 32,
1464
1502
  lineWidth: n = 2
1465
1503
  }) => {
1466
- const t = r + 1, c = (r - n) / 2, s = (r - t) / 2, l = {
1504
+ const t = r + 1, l = (r - n) / 2, c = (r - t) / 2, s = {
1467
1505
  position: "absolute",
1468
- left: c,
1469
- top: s,
1506
+ left: l,
1507
+ top: c,
1470
1508
  width: n,
1471
1509
  height: t,
1472
1510
  backgroundColor: e
@@ -1481,20 +1519,20 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => /* @__PURE__ */ y("div", { s
1481
1519
  height: r
1482
1520
  },
1483
1521
  children: [
1484
- /* @__PURE__ */ o(
1522
+ /* @__PURE__ */ i(
1485
1523
  "span",
1486
1524
  {
1487
1525
  style: {
1488
- ...l,
1526
+ ...s,
1489
1527
  transform: "rotate(45deg)"
1490
1528
  }
1491
1529
  }
1492
1530
  ),
1493
- /* @__PURE__ */ o(
1531
+ /* @__PURE__ */ i(
1494
1532
  "span",
1495
1533
  {
1496
1534
  style: {
1497
- ...l,
1535
+ ...s,
1498
1536
  transform: "rotate(-45deg)"
1499
1537
  }
1500
1538
  }
@@ -1507,22 +1545,22 @@ function qe({
1507
1545
  memory: e,
1508
1546
  completed: r
1509
1547
  }) {
1510
- 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 }) : r ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1548
+ return e.error != null ? /* @__PURE__ */ i(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1511
1549
  }
1512
- const K = 80;
1550
+ const V = 80;
1513
1551
  function Ue({
1514
1552
  memory: e,
1515
1553
  completed: r,
1516
1554
  t: n
1517
1555
  }) {
1518
- const [t, c] = v(!1), s = e.result ?? e.error, l = s != null && s.length > K, d = s != null ? t || !l ? s : `${s.slice(0, K)}...` : void 0, u = l, i = e.error != null;
1556
+ const [t, l] = b(!1), c = e.result ?? e.error, s = c != null && c.length > V, d = c != null ? t || !s ? c : `${c.slice(0, V)}...` : void 0, m = s, o = e.error != null;
1519
1557
  return /* @__PURE__ */ y(
1520
1558
  T.div,
1521
1559
  {
1522
1560
  initial: { opacity: 0 },
1523
1561
  animate: { opacity: 1 },
1524
1562
  transition: { duration: 0.25 },
1525
- onClick: u ? () => c((a) => !a) : void 0,
1563
+ onClick: m ? () => l((a) => !a) : void 0,
1526
1564
  style: {
1527
1565
  paddingTop: "12px",
1528
1566
  paddingBottom: "12px",
@@ -1532,10 +1570,10 @@ function Ue({
1532
1570
  alignItems: "center",
1533
1571
  gap: "10px",
1534
1572
  minWidth: 0,
1535
- cursor: u ? "pointer" : "default"
1573
+ cursor: m ? "pointer" : "default"
1536
1574
  },
1537
1575
  children: [
1538
- /* @__PURE__ */ o(
1576
+ /* @__PURE__ */ i(
1539
1577
  "div",
1540
1578
  {
1541
1579
  style: {
@@ -1545,7 +1583,7 @@ function Ue({
1545
1583
  flexShrink: 0,
1546
1584
  width: 32
1547
1585
  },
1548
- children: /* @__PURE__ */ o(qe, { memory: e, completed: r })
1586
+ children: /* @__PURE__ */ i(qe, { memory: e, completed: r })
1549
1587
  }
1550
1588
  ),
1551
1589
  /* @__PURE__ */ y(
@@ -1558,26 +1596,26 @@ function Ue({
1558
1596
  minWidth: 0
1559
1597
  },
1560
1598
  children: [
1561
- /* @__PURE__ */ o(
1599
+ /* @__PURE__ */ i(
1562
1600
  "span",
1563
1601
  {
1564
1602
  style: { fontSize: 13, fontWeight: 500, color: "#333" },
1565
1603
  children: e.memoryTitle
1566
1604
  }
1567
1605
  ),
1568
- d != null && /* @__PURE__ */ o(
1606
+ d != null && /* @__PURE__ */ i(
1569
1607
  "span",
1570
1608
  {
1571
1609
  style: {
1572
1610
  fontSize: 12,
1573
- color: i ? "#c62828" : "#666",
1611
+ color: o ? "#c62828" : "#666",
1574
1612
  lineHeight: 1.4,
1575
1613
  whiteSpace: t ? "pre-wrap" : void 0
1576
1614
  },
1577
1615
  children: d
1578
1616
  }
1579
1617
  ),
1580
- u && /* @__PURE__ */ o(
1618
+ m && /* @__PURE__ */ i(
1581
1619
  "span",
1582
1620
  {
1583
1621
  style: {
@@ -1595,7 +1633,7 @@ function Ue({
1595
1633
  }
1596
1634
  );
1597
1635
  }
1598
- const Ve = ({ data: e, completed: r, t: n }) => /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: e.memories.map((t) => /* @__PURE__ */ o(
1636
+ const Ke = ({ data: e, completed: r, t: n }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((t) => /* @__PURE__ */ i(
1599
1637
  Ue,
1600
1638
  {
1601
1639
  memory: t,
@@ -1604,23 +1642,23 @@ const Ve = ({ data: e, completed: r, t: n }) => /* @__PURE__ */ o("div", { style
1604
1642
  },
1605
1643
  t.memoryId
1606
1644
  )) });
1607
- function Ke(e, r) {
1645
+ function Ve(e, r) {
1608
1646
  if (e.length === 0) return "";
1609
1647
  if (e.length === 1)
1610
- return S(r.pageSingle, { n: e[0] });
1648
+ return x(r.pageSingle, { n: e[0] });
1611
1649
  if (e.length === 2)
1612
- return S(r.pageTwo, {
1650
+ return x(r.pageTwo, {
1613
1651
  a: e[0],
1614
1652
  b: e[1]
1615
1653
  });
1616
1654
  const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
1617
- return S(r.pageMultiple, { list: t, n });
1655
+ return x(r.pageMultiple, { list: t, n });
1618
1656
  }
1619
1657
  function Xe(e, r) {
1620
- return e === 1 ? r.chunkFound : S(r.chunksFound, { n: e });
1658
+ return e === 1 ? r.chunkFound : x(r.chunksFound, { n: e });
1621
1659
  }
1622
1660
  const Je = ({ data: e, t: r }) => {
1623
- const [n, t] = v(!1), c = e.chunks.length, s = c > 0;
1661
+ const [n, t] = b(!1), l = e.chunks.length, c = l > 0;
1624
1662
  return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1625
1663
  /* @__PURE__ */ y(
1626
1664
  T.div,
@@ -1628,7 +1666,7 @@ const Je = ({ data: e, t: r }) => {
1628
1666
  initial: { opacity: 0 },
1629
1667
  animate: { opacity: 1 },
1630
1668
  transition: { duration: 0.25 },
1631
- onClick: s ? () => t((l) => !l) : void 0,
1669
+ onClick: c ? () => t((s) => !s) : void 0,
1632
1670
  style: {
1633
1671
  paddingBottom: n ? "12px" : 0,
1634
1672
  borderBottom: n ? "1px solid #eee" : void 0,
@@ -1636,12 +1674,12 @@ const Je = ({ data: e, t: r }) => {
1636
1674
  flexDirection: "column",
1637
1675
  gap: "4px",
1638
1676
  minWidth: 0,
1639
- cursor: s ? "pointer" : "default"
1677
+ cursor: c ? "pointer" : "default"
1640
1678
  },
1641
1679
  children: [
1642
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1643
- /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: Xe(c, r) }),
1644
- s && /* @__PURE__ */ o(
1680
+ /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
1681
+ /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: Xe(l, r) }),
1682
+ c && /* @__PURE__ */ i(
1645
1683
  "span",
1646
1684
  {
1647
1685
  style: {
@@ -1655,7 +1693,7 @@ const Je = ({ data: e, t: r }) => {
1655
1693
  ]
1656
1694
  }
1657
1695
  ),
1658
- n && s && /* @__PURE__ */ o(
1696
+ n && c && /* @__PURE__ */ i(
1659
1697
  T.div,
1660
1698
  {
1661
1699
  initial: { opacity: 0, height: 0 },
@@ -1669,8 +1707,8 @@ const Je = ({ data: e, t: r }) => {
1669
1707
  flexDirection: "column",
1670
1708
  gap: 8
1671
1709
  },
1672
- children: e.chunks.map((l, d) => {
1673
- const u = l.pageNumbers ?? [], i = Ke(u, r);
1710
+ children: e.chunks.map((s, d) => {
1711
+ const m = s.pageNumbers ?? [], o = Ve(m, r);
1674
1712
  return /* @__PURE__ */ y(
1675
1713
  "div",
1676
1714
  {
@@ -1681,7 +1719,7 @@ const Je = ({ data: e, t: r }) => {
1681
1719
  backgroundColor: "#fafafa"
1682
1720
  },
1683
1721
  children: [
1684
- /* @__PURE__ */ o(
1722
+ /* @__PURE__ */ i(
1685
1723
  "span",
1686
1724
  {
1687
1725
  style: {
@@ -1691,7 +1729,7 @@ const Je = ({ data: e, t: r }) => {
1691
1729
  display: "block",
1692
1730
  marginBottom: 4
1693
1731
  },
1694
- children: l.content
1732
+ children: s.content
1695
1733
  }
1696
1734
  ),
1697
1735
  /* @__PURE__ */ y(
@@ -1704,9 +1742,9 @@ const Je = ({ data: e, t: r }) => {
1704
1742
  color: "#666"
1705
1743
  },
1706
1744
  children: [
1707
- i && /* @__PURE__ */ o("span", { children: i }),
1708
- /* @__PURE__ */ o("span", { children: S(r.scoreLabel, {
1709
- n: l.score
1745
+ o && /* @__PURE__ */ i("span", { children: o }),
1746
+ /* @__PURE__ */ i("span", { children: x(r.scoreLabel, {
1747
+ n: s.score
1710
1748
  }) })
1711
1749
  ]
1712
1750
  }
@@ -1721,10 +1759,10 @@ const Je = ({ data: e, t: r }) => {
1721
1759
  ] });
1722
1760
  };
1723
1761
  function Ye({ item: e }) {
1724
- 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" });
1762
+ return e.error != null ? /* @__PURE__ */ i(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1725
1763
  }
1726
1764
  function Ze(e, r) {
1727
- return S(r.searchingInMemoriesOfType, {
1765
+ return x(r.searchingInMemoriesOfType, {
1728
1766
  name: e.memoryTypeName
1729
1767
  });
1730
1768
  }
@@ -1733,7 +1771,7 @@ function er({
1733
1771
  t: r,
1734
1772
  showShimmerForPrimary: n
1735
1773
  }) {
1736
- const t = e.result != null, c = e.error != null, s = Ze(e, r);
1774
+ const t = e.result != null, l = e.error != null, c = Ze(e, r);
1737
1775
  return /* @__PURE__ */ y(
1738
1776
  T.div,
1739
1777
  {
@@ -1751,7 +1789,7 @@ function er({
1751
1789
  minWidth: 0
1752
1790
  },
1753
1791
  children: [
1754
- /* @__PURE__ */ o(
1792
+ /* @__PURE__ */ i(
1755
1793
  "div",
1756
1794
  {
1757
1795
  style: {
@@ -1761,7 +1799,7 @@ function er({
1761
1799
  flexShrink: 0,
1762
1800
  width: 32
1763
1801
  },
1764
- children: /* @__PURE__ */ o(Ye, { item: e })
1802
+ children: /* @__PURE__ */ i(Ye, { item: e })
1765
1803
  }
1766
1804
  ),
1767
1805
  /* @__PURE__ */ y(
@@ -1775,24 +1813,24 @@ function er({
1775
1813
  flex: 1
1776
1814
  },
1777
1815
  children: [
1778
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !t && !c && n ? /* @__PURE__ */ o(
1816
+ /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !t && !l && n ? /* @__PURE__ */ i(
1779
1817
  C,
1780
1818
  {
1781
- text: s,
1819
+ text: c,
1782
1820
  duration: 2.5,
1783
1821
  repeat: !0,
1784
1822
  color: "#999",
1785
1823
  shimmerColor: "#000"
1786
1824
  }
1787
- ) : s }),
1788
- t && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? S(
1825
+ ) : c }),
1826
+ t && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? x(
1789
1827
  r.memorySearchTypeResultSummaryOne,
1790
1828
  {
1791
1829
  score: e.result.highestChunkScore.toFixed(
1792
1830
  2
1793
1831
  )
1794
1832
  }
1795
- ) : S(
1833
+ ) : x(
1796
1834
  r.memorySearchTypeResultSummary,
1797
1835
  {
1798
1836
  count: e.result.numberOfChunks,
@@ -1801,7 +1839,7 @@ function er({
1801
1839
  )
1802
1840
  }
1803
1841
  ) }),
1804
- c && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
1842
+ l && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
1805
1843
  ]
1806
1844
  }
1807
1845
  )
@@ -1810,14 +1848,14 @@ function er({
1810
1848
  );
1811
1849
  }
1812
1850
  const rr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1813
- const c = D(() => {
1814
- let s = -1;
1815
- return e.memoryTypes.forEach((l, d) => {
1816
- l.result == null && l.error == null && (s = d);
1817
- }), s;
1851
+ const l = D(() => {
1852
+ let c = -1;
1853
+ return e.memoryTypes.forEach((s, d) => {
1854
+ s.result == null && s.error == null && (c = d);
1855
+ }), c;
1818
1856
  }, [e.memoryTypes]);
1819
1857
  return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
1820
- r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
1858
+ r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
1821
1859
  C,
1822
1860
  {
1823
1861
  text: t.searchingMemoryTypes,
@@ -1826,16 +1864,16 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1826
1864
  color: "#999",
1827
1865
  shimmerColor: "#000"
1828
1866
  }
1829
- ) : e.memoryTypes.map((s, l) => /* @__PURE__ */ o(
1867
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
1830
1868
  er,
1831
1869
  {
1832
- item: s,
1870
+ item: c,
1833
1871
  t,
1834
- showShimmerForPrimary: l === c && r
1872
+ showShimmerForPrimary: s === l && r
1835
1873
  },
1836
- s.memoryTypeId
1874
+ c.memoryTypeId
1837
1875
  )),
1838
- n !== void 0 && /* @__PURE__ */ o(
1876
+ n !== void 0 && /* @__PURE__ */ i(
1839
1877
  "div",
1840
1878
  {
1841
1879
  style: {
@@ -1844,14 +1882,14 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1844
1882
  marginTop: "4px",
1845
1883
  fontStyle: "italic"
1846
1884
  },
1847
- children: S(t.tookSeconds, { n })
1885
+ children: x(t.tookSeconds, { n })
1848
1886
  }
1849
1887
  )
1850
1888
  ] });
1851
- }, B = 12, W = 1.45, nr = Math.ceil(
1852
- B * W
1889
+ }, B = 12, N = 1.45, nr = Math.ceil(
1890
+ B * N
1853
1891
  ), tr = Math.ceil(
1854
- 5 * B * W
1892
+ 5 * B * N
1855
1893
  );
1856
1894
  function O(e) {
1857
1895
  return e.queries != null && e.queries.length > 0;
@@ -1866,21 +1904,21 @@ function ir(e) {
1866
1904
  return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
1867
1905
  }
1868
1906
  function ar({ phase: e }) {
1869
- return e === 3 ? /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1907
+ return e === 3 ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
1870
1908
  }
1871
1909
  function sr({
1872
1910
  item: e,
1873
1911
  t: r,
1874
1912
  isActiveRow: n
1875
1913
  }) {
1876
- const t = or(e), c = ir(e), s = e.reasoning, l = s != null && s.length > 0, d = A(null), [u, i] = v(!1), a = t && n, m = c === 2 && n && !O(e);
1877
- I(() => {
1878
- const g = d.current;
1879
- g != null && c === 1 && l && (g.scrollTop = g.scrollHeight);
1880
- }, [s, c, l]);
1881
- const h = S(r.searchingInMemoriesOfType, {
1914
+ const t = or(e), l = ir(e), c = e.reasoning, s = c != null && c.length > 0, d = A(null), [m, o] = b(!1), a = t && n, u = l === 2 && n && !O(e);
1915
+ M(() => {
1916
+ const p = d.current;
1917
+ p != null && l === 1 && s && (p.scrollTop = p.scrollHeight);
1918
+ }, [c, l, s]);
1919
+ const g = x(r.searchingInMemoriesOfType, {
1882
1920
  name: e.memoryTypeName
1883
- }), f = !t && c === 3;
1921
+ }), f = !t && l === 3;
1884
1922
  return /* @__PURE__ */ y(
1885
1923
  T.div,
1886
1924
  {
@@ -1898,7 +1936,7 @@ function sr({
1898
1936
  minWidth: 0
1899
1937
  },
1900
1938
  children: [
1901
- /* @__PURE__ */ o(
1939
+ /* @__PURE__ */ i(
1902
1940
  "div",
1903
1941
  {
1904
1942
  style: {
@@ -1909,7 +1947,7 @@ function sr({
1909
1947
  width: 32,
1910
1948
  ...f ? { paddingTop: 2 } : {}
1911
1949
  },
1912
- children: /* @__PURE__ */ o(ar, { phase: t ? 1 : c })
1950
+ children: /* @__PURE__ */ i(ar, { phase: t ? 1 : l })
1913
1951
  }
1914
1952
  ),
1915
1953
  /* @__PURE__ */ y(
@@ -1923,18 +1961,18 @@ function sr({
1923
1961
  flex: 1
1924
1962
  },
1925
1963
  children: [
1926
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ o(
1964
+ /* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ i(
1927
1965
  C,
1928
1966
  {
1929
- text: h,
1967
+ text: g,
1930
1968
  duration: 2.5,
1931
1969
  repeat: !0,
1932
1970
  color: "#999",
1933
1971
  shimmerColor: "#000"
1934
1972
  }
1935
1973
  ) : e.memoryTypeName }),
1936
- c === 1 && l && !O(e) && /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
1937
- /* @__PURE__ */ o(
1974
+ l === 1 && s && !O(e) && /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
1975
+ /* @__PURE__ */ i(
1938
1976
  "span",
1939
1977
  {
1940
1978
  style: {
@@ -1947,7 +1985,7 @@ function sr({
1947
1985
  children: r.memorySearchQueryReasoningLabel
1948
1986
  }
1949
1987
  ),
1950
- /* @__PURE__ */ o(
1988
+ /* @__PURE__ */ i(
1951
1989
  "div",
1952
1990
  {
1953
1991
  style: {
@@ -1956,7 +1994,7 @@ function sr({
1956
1994
  padding: "8px 10px",
1957
1995
  boxSizing: "border-box"
1958
1996
  },
1959
- children: /* @__PURE__ */ o(
1997
+ children: /* @__PURE__ */ i(
1960
1998
  "div",
1961
1999
  {
1962
2000
  ref: d,
@@ -1968,18 +2006,18 @@ function sr({
1968
2006
  overflowY: "auto",
1969
2007
  overflowX: "hidden",
1970
2008
  fontSize: B,
1971
- lineHeight: W,
2009
+ lineHeight: N,
1972
2010
  whiteSpace: "pre-wrap",
1973
2011
  wordBreak: "break-word",
1974
2012
  color: "#888"
1975
2013
  },
1976
- children: s
2014
+ children: c
1977
2015
  }
1978
2016
  )
1979
2017
  }
1980
2018
  )
1981
2019
  ] }),
1982
- c === 2 && m && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
2020
+ l === 2 && u && /* @__PURE__ */ i("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ i(
1983
2021
  C,
1984
2022
  {
1985
2023
  text: r.memorySearchGeneratingQueriesPending,
@@ -1989,9 +2027,9 @@ function sr({
1989
2027
  shimmerColor: "#000"
1990
2028
  }
1991
2029
  ) }),
1992
- c === 3 && /* @__PURE__ */ y(E, { children: [
2030
+ l === 3 && /* @__PURE__ */ y(E, { children: [
1993
2031
  /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
1994
- /* @__PURE__ */ o(
2032
+ /* @__PURE__ */ i(
1995
2033
  "span",
1996
2034
  {
1997
2035
  style: {
@@ -2004,7 +2042,7 @@ function sr({
2004
2042
  children: r.memorySearchGeneratedQueriesHeading
2005
2043
  }
2006
2044
  ),
2007
- /* @__PURE__ */ o(
2045
+ /* @__PURE__ */ i(
2008
2046
  "div",
2009
2047
  {
2010
2048
  style: {
@@ -2012,7 +2050,7 @@ function sr({
2012
2050
  flexDirection: "column",
2013
2051
  gap: 6
2014
2052
  },
2015
- children: e.queries.map((g, x) => /* @__PURE__ */ o(
2053
+ children: e.queries.map((p, S) => /* @__PURE__ */ i(
2016
2054
  "div",
2017
2055
  {
2018
2056
  style: {
@@ -2021,19 +2059,19 @@ function sr({
2021
2059
  lineHeight: 1.5,
2022
2060
  wordBreak: "break-word"
2023
2061
  },
2024
- children: g.query
2062
+ children: p.query
2025
2063
  },
2026
- x
2064
+ S
2027
2065
  ))
2028
2066
  }
2029
2067
  )
2030
2068
  ] }),
2031
- l && /* @__PURE__ */ y(E, { children: [
2032
- /* @__PURE__ */ o(
2069
+ s && /* @__PURE__ */ y(E, { children: [
2070
+ /* @__PURE__ */ i(
2033
2071
  "button",
2034
2072
  {
2035
2073
  type: "button",
2036
- onClick: () => i((g) => !g),
2074
+ onClick: () => o((p) => !p),
2037
2075
  style: {
2038
2076
  alignSelf: "flex-start",
2039
2077
  border: "none",
@@ -2044,15 +2082,15 @@ function sr({
2044
2082
  color: "#666",
2045
2083
  textDecoration: "underline"
2046
2084
  },
2047
- children: u ? r.memorySearchHideReasoning : r.memorySearchViewReasoning
2085
+ children: m ? r.memorySearchHideReasoning : r.memorySearchViewReasoning
2048
2086
  }
2049
2087
  ),
2050
- u && /* @__PURE__ */ o(
2088
+ m && /* @__PURE__ */ i(
2051
2089
  "div",
2052
2090
  {
2053
2091
  style: {
2054
2092
  fontSize: B,
2055
- lineHeight: W,
2093
+ lineHeight: N,
2056
2094
  whiteSpace: "pre-wrap",
2057
2095
  wordBreak: "break-word",
2058
2096
  color: "#888",
@@ -2060,7 +2098,7 @@ function sr({
2060
2098
  borderRadius: 6,
2061
2099
  padding: "8px 10px"
2062
2100
  },
2063
- children: s
2101
+ children: c
2064
2102
  }
2065
2103
  )
2066
2104
  ] })
@@ -2073,14 +2111,14 @@ function sr({
2073
2111
  );
2074
2112
  }
2075
2113
  const lr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
2076
- const c = D(() => {
2077
- let s = -1;
2078
- return e.memoryTypes.forEach((l, d) => {
2079
- O(l) || (s = d);
2080
- }), s;
2114
+ const l = D(() => {
2115
+ let c = -1;
2116
+ return e.memoryTypes.forEach((s, d) => {
2117
+ O(s) || (c = d);
2118
+ }), c;
2081
2119
  }, [e.memoryTypes]);
2082
2120
  return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2083
- r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
2121
+ r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
2084
2122
  C,
2085
2123
  {
2086
2124
  text: t.memorySearchGeneratingQueries,
@@ -2089,16 +2127,16 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
2089
2127
  color: "#999",
2090
2128
  shimmerColor: "#000"
2091
2129
  }
2092
- ) : e.memoryTypes.map((s, l) => /* @__PURE__ */ o(
2130
+ ) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
2093
2131
  sr,
2094
2132
  {
2095
- item: s,
2133
+ item: c,
2096
2134
  t,
2097
- isActiveRow: l === c && r
2135
+ isActiveRow: s === l && r
2098
2136
  },
2099
- s.memoryTypeId
2137
+ c.memoryTypeId
2100
2138
  )),
2101
- n !== void 0 && /* @__PURE__ */ o(
2139
+ n !== void 0 && /* @__PURE__ */ i(
2102
2140
  "div",
2103
2141
  {
2104
2142
  style: {
@@ -2107,7 +2145,7 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
2107
2145
  marginTop: "4px",
2108
2146
  fontStyle: "italic"
2109
2147
  },
2110
- children: S(t.tookSeconds, { n })
2148
+ children: x(t.tookSeconds, { n })
2111
2149
  }
2112
2150
  )
2113
2151
  ] });
@@ -2125,31 +2163,31 @@ function re(e) {
2125
2163
  var n, t;
2126
2164
  if (e.length === 0) return "";
2127
2165
  let r = ((n = e[0]) == null ? void 0 : n.content) ?? "";
2128
- for (let c = 1; c < e.length; c++) {
2129
- const s = ((t = e[c]) == null ? void 0 : t.content) ?? "";
2130
- if (s === "") continue;
2166
+ for (let l = 1; l < e.length; l++) {
2167
+ const c = ((t = e[l]) == null ? void 0 : t.content) ?? "";
2168
+ if (c === "") continue;
2131
2169
  if (r === "") {
2132
- r = s;
2170
+ r = c;
2133
2171
  continue;
2134
2172
  }
2135
- const l = cr(r, s);
2136
- l === 0 ? r += dr + s : r += s.slice(l);
2173
+ const s = cr(r, c);
2174
+ s === 0 ? r += dr + c : r += c.slice(s);
2137
2175
  }
2138
2176
  return r;
2139
2177
  }
2140
2178
  function ne(e, r) {
2141
2179
  if (e.length === 0) return "";
2142
2180
  if (e.length === 1)
2143
- return S(r.memorySearchPagesSingle, {
2181
+ return x(r.memorySearchPagesSingle, {
2144
2182
  n: e[0]
2145
2183
  });
2146
2184
  if (e.length === 2)
2147
- return S(r.memorySearchPagesTwo, {
2185
+ return x(r.memorySearchPagesTwo, {
2148
2186
  a: e[0],
2149
2187
  b: e[1]
2150
2188
  });
2151
2189
  const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
2152
- return S(r.memorySearchPagesMultiple, {
2190
+ return x(r.memorySearchPagesMultiple, {
2153
2191
  list: t,
2154
2192
  n
2155
2193
  });
@@ -2165,14 +2203,14 @@ function oe(e) {
2165
2203
  if (r !== "") return r;
2166
2204
  if (e.memoryTypeId !== "") return e.memoryTypeId;
2167
2205
  }
2168
- function ur(e) {
2169
- return e.some((t) => t.result == null && t.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((t) => t.error != null) ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(z, { color: "#999", size: 15, borderWidth: 2 });
2206
+ function mr(e) {
2207
+ return e.some((t) => t.result == null && t.error == null) ? /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : e.some((t) => t.error != null) ? /* @__PURE__ */ i(j, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 });
2170
2208
  }
2171
- function mr(e, r) {
2209
+ function ur(e, r) {
2172
2210
  if (e.error != null)
2173
- return /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
2211
+ return /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
2174
2212
  if (e.result == null)
2175
- return /* @__PURE__ */ o("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ o(
2213
+ return /* @__PURE__ */ i("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ i(
2176
2214
  C,
2177
2215
  {
2178
2216
  text: r.searching,
@@ -2182,13 +2220,13 @@ function mr(e, r) {
2182
2220
  shimmerColor: "#000"
2183
2221
  }
2184
2222
  ) });
2185
- const n = e.result, t = n.numberOfChunks === 1 ? r.chunkFound : S(r.chunksFound, { n: n.numberOfChunks }), c = S(r.scoreLabel, {
2223
+ const n = e.result, t = n.numberOfChunks === 1 ? r.chunkFound : x(r.chunksFound, { n: n.numberOfChunks }), l = x(r.scoreLabel, {
2186
2224
  n: n.highestChunkScore.toFixed(2)
2187
2225
  });
2188
2226
  return /* @__PURE__ */ y("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
2189
2227
  t,
2190
2228
  " · ",
2191
- c
2229
+ l
2192
2230
  ] });
2193
2231
  }
2194
2232
  function pr({
@@ -2197,8 +2235,9 @@ function pr({
2197
2235
  onExploreQueryResultClick: n,
2198
2236
  t
2199
2237
  }) {
2238
+ const [l, c] = b(null);
2200
2239
  if (e.length === 0)
2201
- return /* @__PURE__ */ o(
2240
+ return /* @__PURE__ */ i(
2202
2241
  "div",
2203
2242
  {
2204
2243
  style: {
@@ -2209,8 +2248,8 @@ function pr({
2209
2248
  children: t.memorySearchExploreNoResults
2210
2249
  }
2211
2250
  );
2212
- const c = !!n;
2213
- return /* @__PURE__ */ o(
2251
+ const s = !!n;
2252
+ return /* @__PURE__ */ i(
2214
2253
  "div",
2215
2254
  {
2216
2255
  style: {
@@ -2221,24 +2260,24 @@ function pr({
2221
2260
  paddingTop: 8,
2222
2261
  borderTop: "1px solid #f0f0f0"
2223
2262
  },
2224
- children: e.map((s, l) => {
2225
- const d = s.memory.title != null && s.memory.title !== "" ? s.memory.title : s.memory.id, u = te(
2226
- s.chunks
2227
- ), i = [
2228
- oe(s.memory),
2229
- S(t.scoreLabel, {
2230
- n: s.score.toFixed(2)
2263
+ children: e.map((d, m) => {
2264
+ const o = d.memory.title != null && d.memory.title !== "" ? d.memory.title : d.memory.id, a = te(
2265
+ d.chunks
2266
+ ), u = [
2267
+ oe(d.memory),
2268
+ x(t.scoreLabel, {
2269
+ n: d.score.toFixed(2)
2231
2270
  }),
2232
- u.length > 0 ? ne(u, t) : t.pagesNotAvailable
2271
+ a.length > 0 ? ne(a, t) : t.pagesNotAvailable
2233
2272
  ].filter(
2234
- (m) => m != null && m !== ""
2235
- ), a = {
2236
- memoryId: s.memory.id,
2237
- pageNumbers: u,
2273
+ (S) => S != null && S !== ""
2274
+ ), g = {
2275
+ memoryId: d.memory.id,
2276
+ pageNumbers: a,
2238
2277
  memoryTypeId: r.memoryTypeId,
2239
2278
  memoryTypeName: r.memoryTypeName,
2240
2279
  query: r.query
2241
- };
2280
+ }, f = `${r.query}::${d.memory.id}::${m}`, p = l === f;
2242
2281
  return /* @__PURE__ */ y(
2243
2282
  "div",
2244
2283
  {
@@ -2247,9 +2286,9 @@ function pr({
2247
2286
  flexDirection: "row",
2248
2287
  alignItems: "flex-start",
2249
2288
  gap: "12px",
2250
- paddingTop: l > 0 ? 12 : 0,
2251
- paddingBottom: l < e.length - 1 ? 12 : 0,
2252
- borderBottom: l < e.length - 1 ? "1px solid #eee" : void 0,
2289
+ paddingTop: m > 0 ? 12 : 0,
2290
+ paddingBottom: m < e.length - 1 ? 12 : 0,
2291
+ borderBottom: m < e.length - 1 ? "1px solid #eee" : void 0,
2253
2292
  minWidth: 0
2254
2293
  },
2255
2294
  children: [
@@ -2264,7 +2303,7 @@ function pr({
2264
2303
  gap: "6px"
2265
2304
  },
2266
2305
  children: [
2267
- /* @__PURE__ */ o(
2306
+ /* @__PURE__ */ i(
2268
2307
  "span",
2269
2308
  {
2270
2309
  style: {
@@ -2272,10 +2311,10 @@ function pr({
2272
2311
  fontWeight: 600,
2273
2312
  color: "#333"
2274
2313
  },
2275
- children: d
2314
+ children: o
2276
2315
  }
2277
2316
  ),
2278
- /* @__PURE__ */ o(
2317
+ /* @__PURE__ */ i(
2279
2318
  "span",
2280
2319
  {
2281
2320
  style: {
@@ -2286,11 +2325,11 @@ function pr({
2286
2325
  wordBreak: "break-word"
2287
2326
  },
2288
2327
  children: re(
2289
- s.chunks
2328
+ d.chunks
2290
2329
  )
2291
2330
  }
2292
2331
  ),
2293
- /* @__PURE__ */ o(
2332
+ /* @__PURE__ */ i(
2294
2333
  "div",
2295
2334
  {
2296
2335
  style: {
@@ -2299,17 +2338,28 @@ function pr({
2299
2338
  color: "#94a3b8",
2300
2339
  lineHeight: 1.35
2301
2340
  },
2302
- children: i.join(" · ")
2341
+ children: u.join(" · ")
2303
2342
  }
2304
2343
  )
2305
2344
  ]
2306
2345
  }
2307
2346
  ),
2308
- c && /* @__PURE__ */ o(
2347
+ s && /* @__PURE__ */ y(
2309
2348
  "button",
2310
2349
  {
2311
2350
  type: "button",
2312
- onClick: () => n(a),
2351
+ "aria-busy": p,
2352
+ disabled: p,
2353
+ onClick: async () => {
2354
+ c(f);
2355
+ try {
2356
+ await n(
2357
+ g
2358
+ );
2359
+ } finally {
2360
+ c(null);
2361
+ }
2362
+ },
2313
2363
  style: {
2314
2364
  flexShrink: 0,
2315
2365
  alignSelf: "center",
@@ -2320,42 +2370,54 @@ function pr({
2320
2370
  background: "#eff6ff",
2321
2371
  border: "1px solid #bfdbfe",
2322
2372
  borderRadius: 6,
2323
- cursor: "pointer",
2324
- fontFamily: "inherit"
2373
+ cursor: p ? "wait" : "pointer",
2374
+ fontFamily: "inherit",
2375
+ display: "inline-flex",
2376
+ alignItems: "center",
2377
+ gap: 8
2325
2378
  },
2326
- children: t.viewButton
2379
+ children: [
2380
+ p && /* @__PURE__ */ i(
2381
+ "span",
2382
+ {
2383
+ className: "explore-memory-loader explore-memory-loader--callback",
2384
+ "aria-hidden": !0
2385
+ }
2386
+ ),
2387
+ t.viewButton
2388
+ ]
2327
2389
  }
2328
2390
  )
2329
2391
  ]
2330
2392
  },
2331
- `${s.memory.id}-${l}`
2393
+ `${d.memory.id}-${m}`
2332
2394
  );
2333
2395
  })
2334
2396
  }
2335
2397
  );
2336
2398
  }
2337
- function gr(e) {
2399
+ function yr(e) {
2338
2400
  const r = [], n = /* @__PURE__ */ new Map();
2339
- return e.forEach((t, c) => {
2340
- let s = n.get(t.memoryTypeId);
2341
- s == null && (r.push(t.memoryTypeId), s = {
2401
+ return e.forEach((t, l) => {
2402
+ let c = n.get(t.memoryTypeId);
2403
+ c == null && (r.push(t.memoryTypeId), c = {
2342
2404
  memoryTypeId: t.memoryTypeId,
2343
2405
  memoryTypeName: t.memoryTypeName,
2344
2406
  items: []
2345
- }, n.set(t.memoryTypeId, s)), s.items.push({ item: t, flatIndex: c });
2407
+ }, n.set(t.memoryTypeId, c)), c.items.push({ item: t, flatIndex: l });
2346
2408
  }), r.map((t) => n.get(t));
2347
2409
  }
2348
- function yr({
2410
+ function gr({
2349
2411
  group: e,
2350
2412
  t: r,
2351
2413
  lastInFlightIndex: n,
2352
2414
  isLatest: t,
2353
- expandedRows: c,
2354
- toggleExpanded: s,
2355
- onExploreQueryResultClick: l
2415
+ expandedRows: l,
2416
+ toggleExpanded: c,
2417
+ onExploreQueryResultClick: s
2356
2418
  }) {
2357
- const d = e.items.map((i) => i.item), u = d.some(
2358
- (i) => i.result == null && i.error == null
2419
+ const d = e.items.map((o) => o.item), m = d.some(
2420
+ (o) => o.result == null && o.error == null
2359
2421
  );
2360
2422
  return /* @__PURE__ */ y(
2361
2423
  T.div,
@@ -2369,12 +2431,12 @@ function yr({
2369
2431
  borderBottom: "1px solid #eee",
2370
2432
  display: "flex",
2371
2433
  flexDirection: "row",
2372
- alignItems: u ? "center" : "flex-start",
2434
+ alignItems: m ? "center" : "flex-start",
2373
2435
  gap: "10px",
2374
2436
  minWidth: 0
2375
2437
  },
2376
2438
  children: [
2377
- /* @__PURE__ */ o(
2439
+ /* @__PURE__ */ i(
2378
2440
  "div",
2379
2441
  {
2380
2442
  style: {
@@ -2383,9 +2445,9 @@ function yr({
2383
2445
  justifyContent: "center",
2384
2446
  flexShrink: 0,
2385
2447
  width: 32,
2386
- ...u ? {} : { paddingTop: 2 }
2448
+ ...m ? {} : { paddingTop: 2 }
2387
2449
  },
2388
- children: ur(d)
2450
+ children: mr(d)
2389
2451
  }
2390
2452
  ),
2391
2453
  /* @__PURE__ */ y(
@@ -2399,21 +2461,21 @@ function yr({
2399
2461
  flex: 1
2400
2462
  },
2401
2463
  children: [
2402
- /* @__PURE__ */ o(
2464
+ /* @__PURE__ */ i(
2403
2465
  "span",
2404
2466
  {
2405
2467
  style: {
2406
2468
  fontSize: 12,
2407
2469
  color: "#888"
2408
2470
  },
2409
- children: S(r.memorySearchExploreQueryTypeLabel, {
2471
+ children: x(r.memorySearchExploreQueryTypeLabel, {
2410
2472
  name: e.memoryTypeName
2411
2473
  })
2412
2474
  }
2413
2475
  ),
2414
- e.items.map(({ item: i, flatIndex: a }) => {
2415
- var p;
2416
- const m = i.result != null, h = i.error != null, f = a === n && t && !m && !h, g = c[a] === !0, x = ((p = i.result) == null ? void 0 : p.items) ?? [];
2476
+ e.items.map(({ item: o, flatIndex: a }) => {
2477
+ var h;
2478
+ const u = o.result != null, g = o.error != null, f = a === n && t && !u && !g, p = l[a] === !0, S = ((h = o.result) == null ? void 0 : h.items) ?? [];
2417
2479
  return /* @__PURE__ */ y(
2418
2480
  "div",
2419
2481
  {
@@ -2436,7 +2498,7 @@ function yr({
2436
2498
  minWidth: 0
2437
2499
  },
2438
2500
  children: [
2439
- /* @__PURE__ */ o(
2501
+ /* @__PURE__ */ i(
2440
2502
  "span",
2441
2503
  {
2442
2504
  style: {
@@ -2447,16 +2509,16 @@ function yr({
2447
2509
  flex: "1 1 12rem",
2448
2510
  minWidth: 0
2449
2511
  },
2450
- children: f ? /* @__PURE__ */ o(
2512
+ children: f ? /* @__PURE__ */ i(
2451
2513
  C,
2452
2514
  {
2453
- text: i.query,
2515
+ text: o.query,
2454
2516
  duration: 2.5,
2455
2517
  repeat: !0,
2456
2518
  color: "#999",
2457
2519
  shimmerColor: "#000"
2458
2520
  }
2459
- ) : i.query
2521
+ ) : o.query
2460
2522
  }
2461
2523
  ),
2462
2524
  /* @__PURE__ */ y(
@@ -2470,12 +2532,12 @@ function yr({
2470
2532
  flexShrink: 0
2471
2533
  },
2472
2534
  children: [
2473
- mr(i, r),
2474
- m && /* @__PURE__ */ o(
2535
+ ur(o, r),
2536
+ u && /* @__PURE__ */ i(
2475
2537
  "button",
2476
2538
  {
2477
2539
  type: "button",
2478
- onClick: () => s(a),
2540
+ onClick: () => c(a),
2479
2541
  style: {
2480
2542
  border: "none",
2481
2543
  background: "none",
@@ -2486,7 +2548,7 @@ function yr({
2486
2548
  textDecoration: "underline",
2487
2549
  fontFamily: "inherit"
2488
2550
  },
2489
- children: g ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2551
+ children: p ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2490
2552
  }
2491
2553
  )
2492
2554
  ]
@@ -2495,18 +2557,18 @@ function yr({
2495
2557
  ]
2496
2558
  }
2497
2559
  ),
2498
- m && g && /* @__PURE__ */ o(
2560
+ u && p && /* @__PURE__ */ i(
2499
2561
  pr,
2500
2562
  {
2501
- items: x,
2502
- queryRow: i,
2503
- onExploreQueryResultClick: l,
2563
+ items: S,
2564
+ queryRow: o,
2565
+ onExploreQueryResultClick: s,
2504
2566
  t: r
2505
2567
  }
2506
2568
  )
2507
2569
  ]
2508
2570
  },
2509
- `${e.memoryTypeId}-${a}-${i.query}`
2571
+ `${e.memoryTypeId}-${a}-${o.query}`
2510
2572
  );
2511
2573
  })
2512
2574
  ]
@@ -2521,48 +2583,48 @@ const hr = ({
2521
2583
  isLatest: r = !1,
2522
2584
  durationSeconds: n,
2523
2585
  onExploreQueryResultClick: t,
2524
- t: c
2586
+ t: l
2525
2587
  }) => {
2526
- const [s, l] = v(
2588
+ const [c, s] = b(
2527
2589
  {}
2528
2590
  ), d = G((a) => {
2529
- l((m) => ({
2530
- ...m,
2531
- [a]: !m[a]
2591
+ s((u) => ({
2592
+ ...u,
2593
+ [a]: !u[a]
2532
2594
  }));
2533
- }, []), u = D(() => {
2595
+ }, []), m = D(() => {
2534
2596
  let a = -1;
2535
- return e.queries.forEach((m, h) => {
2536
- m.result == null && m.error == null && (a = h);
2597
+ return e.queries.forEach((u, g) => {
2598
+ u.result == null && u.error == null && (a = g);
2537
2599
  }), a;
2538
- }, [e.queries]), i = D(
2539
- () => gr(e.queries),
2600
+ }, [e.queries]), o = D(
2601
+ () => yr(e.queries),
2540
2602
  [e.queries]
2541
2603
  );
2542
2604
  return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2543
- r && !n && e.queries.length === 0 ? /* @__PURE__ */ o(
2605
+ r && !n && e.queries.length === 0 ? /* @__PURE__ */ i(
2544
2606
  C,
2545
2607
  {
2546
- text: c.memorySearchExploringQueries,
2608
+ text: l.memorySearchExploringQueries,
2547
2609
  duration: 2.5,
2548
2610
  repeat: !0,
2549
2611
  color: "#999",
2550
2612
  shimmerColor: "#000"
2551
2613
  }
2552
- ) : i.map((a) => /* @__PURE__ */ o(
2553
- yr,
2614
+ ) : o.map((a) => /* @__PURE__ */ i(
2615
+ gr,
2554
2616
  {
2555
2617
  group: a,
2556
- t: c,
2557
- lastInFlightIndex: u,
2618
+ t: l,
2619
+ lastInFlightIndex: m,
2558
2620
  isLatest: r,
2559
- expandedRows: s,
2621
+ expandedRows: c,
2560
2622
  toggleExpanded: d,
2561
2623
  onExploreQueryResultClick: t
2562
2624
  },
2563
2625
  a.memoryTypeId
2564
2626
  )),
2565
- n !== void 0 && /* @__PURE__ */ o(
2627
+ n !== void 0 && /* @__PURE__ */ i(
2566
2628
  "div",
2567
2629
  {
2568
2630
  style: {
@@ -2571,14 +2633,14 @@ const hr = ({
2571
2633
  marginTop: "4px",
2572
2634
  fontStyle: "italic"
2573
2635
  },
2574
- children: S(c.tookSeconds, { n })
2636
+ children: x(l.tookSeconds, { n })
2575
2637
  }
2576
2638
  )
2577
2639
  ] });
2578
2640
  }, fr = ({ data: e, onSearchResultClick: r, t: n }) => {
2579
- const t = e.response.items, c = !!r;
2641
+ const t = e.response.items, l = !!r, [c, s] = b(null);
2580
2642
  return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
2581
- /* @__PURE__ */ o(
2643
+ /* @__PURE__ */ i(
2582
2644
  T.div,
2583
2645
  {
2584
2646
  style: {
@@ -2593,7 +2655,7 @@ const hr = ({
2593
2655
  children: n.resultsHeading
2594
2656
  }
2595
2657
  ),
2596
- /* @__PURE__ */ o(
2658
+ /* @__PURE__ */ i(
2597
2659
  "div",
2598
2660
  {
2599
2661
  style: {
@@ -2601,27 +2663,27 @@ const hr = ({
2601
2663
  flexDirection: "column",
2602
2664
  gap: 0
2603
2665
  },
2604
- children: t.map((s, l) => {
2605
- const d = s.memory.title != null && s.memory.title !== "" ? s.memory.title : s.memory.id, u = te(
2606
- s.chunks
2607
- ), i = [
2608
- oe(s.memory),
2609
- S(n.scoreLabel, {
2610
- n: s.score.toFixed(2)
2666
+ children: t.map((d, m) => {
2667
+ const o = d.memory.title != null && d.memory.title !== "" ? d.memory.title : d.memory.id, a = te(
2668
+ d.chunks
2669
+ ), u = [
2670
+ oe(d.memory),
2671
+ x(n.scoreLabel, {
2672
+ n: d.score.toFixed(2)
2611
2673
  }),
2612
- u.length > 0 ? ne(u, n) : n.pagesNotAvailable
2674
+ a.length > 0 ? ne(a, n) : n.pagesNotAvailable
2613
2675
  ].filter(
2614
- (m) => m != null && m !== ""
2615
- ), a = {
2616
- memoryId: s.memory.id,
2617
- pageNumbers: u
2618
- };
2676
+ (S) => S != null && S !== ""
2677
+ ), g = {
2678
+ memoryId: d.memory.id,
2679
+ pageNumbers: a
2680
+ }, f = `${d.memory.id}-${m}`, p = c === f;
2619
2681
  return /* @__PURE__ */ y(
2620
2682
  T.div,
2621
2683
  {
2622
2684
  initial: { opacity: 0 },
2623
2685
  animate: { opacity: 1 },
2624
- transition: { duration: 0.2, delay: l * 0.04 },
2686
+ transition: { duration: 0.2, delay: m * 0.04 },
2625
2687
  style: {
2626
2688
  display: "flex",
2627
2689
  flexDirection: "row",
@@ -2629,7 +2691,7 @@ const hr = ({
2629
2691
  gap: "12px",
2630
2692
  paddingTop: "12px",
2631
2693
  paddingBottom: "12px",
2632
- borderBottom: l < t.length - 1 ? "1px solid #eee" : void 0,
2694
+ borderBottom: m < t.length - 1 ? "1px solid #eee" : void 0,
2633
2695
  minWidth: 0
2634
2696
  },
2635
2697
  children: [
@@ -2644,7 +2706,7 @@ const hr = ({
2644
2706
  gap: "6px"
2645
2707
  },
2646
2708
  children: [
2647
- /* @__PURE__ */ o(
2709
+ /* @__PURE__ */ i(
2648
2710
  "span",
2649
2711
  {
2650
2712
  style: {
@@ -2652,10 +2714,10 @@ const hr = ({
2652
2714
  fontWeight: 600,
2653
2715
  color: "#333"
2654
2716
  },
2655
- children: d
2717
+ children: o
2656
2718
  }
2657
2719
  ),
2658
- /* @__PURE__ */ o(
2720
+ /* @__PURE__ */ i(
2659
2721
  "span",
2660
2722
  {
2661
2723
  style: {
@@ -2665,10 +2727,10 @@ const hr = ({
2665
2727
  whiteSpace: "pre-wrap",
2666
2728
  wordBreak: "break-word"
2667
2729
  },
2668
- children: re(s.chunks)
2730
+ children: re(d.chunks)
2669
2731
  }
2670
2732
  ),
2671
- /* @__PURE__ */ o(
2733
+ /* @__PURE__ */ i(
2672
2734
  "div",
2673
2735
  {
2674
2736
  style: {
@@ -2677,17 +2739,26 @@ const hr = ({
2677
2739
  color: "#94a3b8",
2678
2740
  lineHeight: 1.35
2679
2741
  },
2680
- children: i.join(" · ")
2742
+ children: u.join(" · ")
2681
2743
  }
2682
2744
  )
2683
2745
  ]
2684
2746
  }
2685
2747
  ),
2686
- c && /* @__PURE__ */ o(
2748
+ l && /* @__PURE__ */ y(
2687
2749
  "button",
2688
2750
  {
2689
2751
  type: "button",
2690
- onClick: () => r(a),
2752
+ "aria-busy": p,
2753
+ disabled: p,
2754
+ onClick: async () => {
2755
+ s(f);
2756
+ try {
2757
+ await r(g);
2758
+ } finally {
2759
+ s(null);
2760
+ }
2761
+ },
2691
2762
  style: {
2692
2763
  flexShrink: 0,
2693
2764
  alignSelf: "center",
@@ -2698,21 +2769,33 @@ const hr = ({
2698
2769
  background: "#eff6ff",
2699
2770
  border: "1px solid #bfdbfe",
2700
2771
  borderRadius: 6,
2701
- cursor: "pointer",
2702
- fontFamily: "inherit"
2772
+ cursor: p ? "wait" : "pointer",
2773
+ fontFamily: "inherit",
2774
+ display: "inline-flex",
2775
+ alignItems: "center",
2776
+ gap: 8
2703
2777
  },
2704
- children: n.viewButton
2778
+ children: [
2779
+ p && /* @__PURE__ */ i(
2780
+ "span",
2781
+ {
2782
+ className: "explore-memory-loader explore-memory-loader--callback",
2783
+ "aria-hidden": !0
2784
+ }
2785
+ ),
2786
+ n.viewButton
2787
+ ]
2705
2788
  }
2706
2789
  )
2707
2790
  ]
2708
2791
  },
2709
- `${s.memory.id}-${l}`
2792
+ `${d.memory.id}-${m}`
2710
2793
  );
2711
2794
  })
2712
2795
  }
2713
2796
  )
2714
2797
  ] });
2715
- }, Sr = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
2798
+ }, Sr = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
2716
2799
  T.div,
2717
2800
  {
2718
2801
  initial: { opacity: 0, y: -10 },
@@ -2723,7 +2806,7 @@ const hr = ({
2723
2806
  alignItems: "flex-start",
2724
2807
  gap: "10px"
2725
2808
  },
2726
- children: /* @__PURE__ */ o(
2809
+ children: /* @__PURE__ */ i(
2727
2810
  "span",
2728
2811
  {
2729
2812
  style: {
@@ -2740,63 +2823,63 @@ const hr = ({
2740
2823
  loadingText: r,
2741
2824
  t: n,
2742
2825
  onSourceClick: t,
2743
- onSearchResultClick: c,
2744
- onExploreQueryResultClick: s
2826
+ onSearchResultClick: l,
2827
+ onExploreQueryResultClick: c
2745
2828
  }) => {
2746
- const l = A(null);
2747
- I(() => {
2748
- l.current && (l.current.scrollTop = l.current.scrollHeight);
2829
+ const s = A(null);
2830
+ M(() => {
2831
+ s.current && (s.current.scrollTop = s.current.scrollHeight);
2749
2832
  }, [e.length]);
2750
- const d = (i) => {
2751
- const a = i.item.data;
2833
+ const d = (o) => {
2834
+ const a = o.item.data;
2752
2835
  if (a.taskType === "StreamingChatCompletion" && a.eventType === "Text")
2753
- return /* @__PURE__ */ o(V, { text: a.text });
2836
+ return /* @__PURE__ */ i(K, { text: a.text });
2754
2837
  if (a.taskType === "StructuredChatCompletion" && a.eventType === "Completed")
2755
- return /* @__PURE__ */ o(Oe, { data: a });
2838
+ return /* @__PURE__ */ i(Oe, { data: a });
2756
2839
  if (a.taskType === "MemoryChatCompletion")
2757
2840
  switch (a.eventType) {
2758
2841
  case "Text":
2759
- return /* @__PURE__ */ o(V, { text: a.text });
2842
+ return /* @__PURE__ */ i(K, { text: a.text });
2760
2843
  case "FindMemories":
2761
- return /* @__PURE__ */ o(
2762
- He,
2844
+ return /* @__PURE__ */ i(
2845
+ $e,
2763
2846
  {
2764
2847
  data: a,
2765
- isLatest: i.isLatest,
2766
- durationSeconds: i.durationSeconds,
2848
+ isLatest: o.isLatest,
2849
+ durationSeconds: o.durationSeconds,
2767
2850
  t: n
2768
2851
  }
2769
2852
  );
2770
2853
  case "FindMemoriesResult":
2771
- return /* @__PURE__ */ o(
2772
- $e,
2854
+ return /* @__PURE__ */ i(
2855
+ He,
2773
2856
  {
2774
2857
  data: a,
2775
2858
  t: n
2776
2859
  }
2777
2860
  );
2778
2861
  case "Search":
2779
- return /* @__PURE__ */ o(
2780
- Ne,
2862
+ return /* @__PURE__ */ i(
2863
+ We,
2781
2864
  {
2782
2865
  data: a,
2783
- isLatest: i.isLatest,
2784
- durationSeconds: i.durationSeconds,
2866
+ isLatest: o.isLatest,
2867
+ durationSeconds: o.durationSeconds,
2785
2868
  t: n
2786
2869
  }
2787
2870
  );
2788
2871
  case "FindSources":
2789
- return /* @__PURE__ */ o(
2872
+ return /* @__PURE__ */ i(
2790
2873
  _e,
2791
2874
  {
2792
2875
  data: a,
2793
- isLatest: i.isLatest,
2794
- durationSeconds: i.durationSeconds,
2876
+ isLatest: o.isLatest,
2877
+ durationSeconds: o.durationSeconds,
2795
2878
  t: n
2796
2879
  }
2797
2880
  );
2798
2881
  case "SourcesResult":
2799
- return /* @__PURE__ */ o(
2882
+ return /* @__PURE__ */ i(
2800
2883
  Qe,
2801
2884
  {
2802
2885
  data: a,
@@ -2805,67 +2888,67 @@ const hr = ({
2805
2888
  }
2806
2889
  );
2807
2890
  case "ExploreMemories":
2808
- return /* @__PURE__ */ o(
2809
- Ve,
2891
+ return /* @__PURE__ */ i(
2892
+ Ke,
2810
2893
  {
2811
2894
  data: a,
2812
- completed: i.completed,
2813
- isLatest: i.isLatest,
2895
+ completed: o.completed,
2896
+ isLatest: o.isLatest,
2814
2897
  t: n
2815
2898
  }
2816
2899
  );
2817
2900
  case "ChunkResult":
2818
- return /* @__PURE__ */ o(Je, { data: a, t: n });
2901
+ return /* @__PURE__ */ i(Je, { data: a, t: n });
2819
2902
  case "Completed":
2820
2903
  return null;
2821
2904
  }
2822
2905
  if (a.taskType === "MemorySearch")
2823
2906
  switch (a.eventType) {
2824
2907
  case "GeneratingQueries":
2825
- return /* @__PURE__ */ o(
2908
+ return /* @__PURE__ */ i(
2826
2909
  lr,
2827
2910
  {
2828
2911
  data: a,
2829
- isLatest: i.isLatest,
2830
- durationSeconds: i.durationSeconds,
2912
+ isLatest: o.isLatest,
2913
+ durationSeconds: o.durationSeconds,
2831
2914
  t: n
2832
2915
  }
2833
2916
  );
2834
2917
  case "ExploreQueries":
2835
- return /* @__PURE__ */ o(
2918
+ return /* @__PURE__ */ i(
2836
2919
  hr,
2837
2920
  {
2838
2921
  data: a,
2839
- isLatest: i.isLatest,
2840
- durationSeconds: i.durationSeconds,
2841
- onExploreQueryResultClick: s,
2922
+ isLatest: o.isLatest,
2923
+ durationSeconds: o.durationSeconds,
2924
+ onExploreQueryResultClick: c,
2842
2925
  t: n
2843
2926
  }
2844
2927
  );
2845
2928
  case "SearchMemoryTypes":
2846
- return /* @__PURE__ */ o(
2929
+ return /* @__PURE__ */ i(
2847
2930
  rr,
2848
2931
  {
2849
2932
  data: a,
2850
- isLatest: i.isLatest,
2851
- durationSeconds: i.durationSeconds,
2933
+ isLatest: o.isLatest,
2934
+ durationSeconds: o.durationSeconds,
2852
2935
  t: n
2853
2936
  }
2854
2937
  );
2855
2938
  case "Completed":
2856
- return /* @__PURE__ */ o(
2939
+ return /* @__PURE__ */ i(
2857
2940
  fr,
2858
2941
  {
2859
2942
  data: a,
2860
- onSearchResultClick: c,
2943
+ onSearchResultClick: l,
2861
2944
  t: n
2862
2945
  }
2863
2946
  );
2864
2947
  }
2865
- return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ o(Sr, { message: a.message }) : null;
2948
+ return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(Sr, { message: a.message }) : null;
2866
2949
  };
2867
2950
  if (e.length === 0)
2868
- return /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
2951
+ return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
2869
2952
  C,
2870
2953
  {
2871
2954
  text: r ?? n.processingYourTask,
@@ -2876,20 +2959,20 @@ const hr = ({
2876
2959
  shimmerColor: "#000"
2877
2960
  }
2878
2961
  ) });
2879
- const u = e.filter((i, a) => {
2880
- const m = i.item.data;
2881
- return m.taskType === "MemoryChatCompletion" && m.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
2882
- (p) => p.item.data.taskType === "MemoryChatCompletion" && p.item.data.eventType === "ExploreMemories"
2883
- ) : m.taskType === "MemorySearch" && m.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
2884
- (p) => p.item.data.taskType === "MemorySearch" && p.item.data.eventType === "GeneratingQueries"
2885
- ) : m.taskType === "MemorySearch" && m.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
2886
- (p) => p.item.data.taskType === "MemorySearch" && p.item.data.eventType === "ExploreQueries"
2962
+ const m = e.filter((o, a) => {
2963
+ const u = o.item.data;
2964
+ return u.taskType === "MemoryChatCompletion" && u.eventType === "ExploreMemories" ? !e.slice(a + 1).some(
2965
+ (h) => h.item.data.taskType === "MemoryChatCompletion" && h.item.data.eventType === "ExploreMemories"
2966
+ ) : u.taskType === "MemorySearch" && u.eventType === "GeneratingQueries" ? !e.slice(a + 1).some(
2967
+ (h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "GeneratingQueries"
2968
+ ) : u.taskType === "MemorySearch" && u.eventType === "ExploreQueries" ? !e.slice(a + 1).some(
2969
+ (h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "ExploreQueries"
2887
2970
  ) : !0;
2888
2971
  });
2889
- return /* @__PURE__ */ o("div", { id: "agent-task-progress-verbose", ref: l, children: /* @__PURE__ */ o(X, { children: u.map((i, a) => /* @__PURE__ */ o(
2972
+ return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(X, { children: m.map((o, a) => /* @__PURE__ */ i(
2890
2973
  T.div,
2891
2974
  {
2892
- id: `agent-task-progress-item-${i.item.progressItemId}`,
2975
+ id: `agent-task-progress-item-${o.item.progressItemId}`,
2893
2976
  initial: { opacity: 0, y: -20 },
2894
2977
  animate: { opacity: 1, y: 0 },
2895
2978
  transition: {
@@ -2897,42 +2980,42 @@ const hr = ({
2897
2980
  delay: a * 0.1,
2898
2981
  ease: "easeOut"
2899
2982
  },
2900
- children: d(i)
2983
+ children: d(o)
2901
2984
  },
2902
- i.item.progressItemId
2985
+ o.item.progressItemId
2903
2986
  )) }) });
2904
2987
  }, Ar = ({
2905
2988
  agentTask: e,
2906
2989
  mode: r = "verbose",
2907
2990
  language: n,
2908
2991
  onSourceClick: t,
2909
- onSearchResultClick: c,
2910
- onExploreQueryResultClick: s
2992
+ onSearchResultClick: l,
2993
+ onExploreQueryResultClick: c
2911
2994
  }) => {
2912
- const l = De(e), d = (e.params.type === "MemoryChatCompletion" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", u = We(d);
2913
- return r === "simple" ? /* @__PURE__ */ o(
2995
+ const s = De(e), d = (e.params.type === "MemoryChatCompletion" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : n ?? "en", m = Ne(d);
2996
+ return r === "simple" ? /* @__PURE__ */ i(
2914
2997
  ze,
2915
2998
  {
2916
- progressViewItems: l,
2917
- t: u
2999
+ progressViewItems: s,
3000
+ t: m
2918
3001
  }
2919
- ) : /* @__PURE__ */ o(
3002
+ ) : /* @__PURE__ */ i(
2920
3003
  xr,
2921
3004
  {
2922
- progressViewItems: l,
3005
+ progressViewItems: s,
2923
3006
  loadingText: e.loadingText,
2924
- t: u,
3007
+ t: m,
2925
3008
  onSourceClick: t,
2926
- onSearchResultClick: c,
2927
- onExploreQueryResultClick: s
3009
+ onSearchResultClick: l,
3010
+ onExploreQueryResultClick: c
2928
3011
  }
2929
3012
  );
2930
3013
  };
2931
3014
  export {
2932
3015
  Ar as AgentTaskProgress,
2933
3016
  z as Checkmark,
2934
- Mr as FencyProvider,
3017
+ Ir as FencyProvider,
2935
3018
  fr as MemorySearchCompletedResults,
2936
3019
  j as XMark,
2937
- Ir as useAgentTasks
3020
+ Mr as useAgentTasks
2938
3021
  };