@fencyai/react 0.1.175 → 0.1.177

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,78 +1,79 @@
1
- import { jsxs as y, jsx as o, Fragment as E } from "react/jsx-runtime";
2
- import { createStream as ue, isStreamTimeoutEvent as me, isStreamNotFoundEvent as pe, isAgentTaskProgressItemUpdatedEvent as ye, createAgentTask as ge } from "@fencyai/js";
3
- import { createContext as he, useState as I, useRef as A, useEffect as F, useCallback as z, useContext as fe, useMemo as P } from "react";
4
- import { motion as C, useInView as Se, AnimatePresence as xe } from "motion/react";
5
- import ke from "react-markdown";
6
- import { Prism as ae } from "react-syntax-highlighter";
7
- import be from "remark-gfm";
8
- import './assets/index.css';const se = he(
1
+ import { jsxs as g, jsx as o, Fragment as F } from "react/jsx-runtime";
2
+ import { createStream as xe, isStreamTimeoutEvent as be, isStreamNotFoundEvent as ke, isAgentTaskProgressItemUpdatedEvent as ve, createAgentTask as Ce } from "@fencyai/js";
3
+ import we, { createContext as Ie, useState as E, useRef as D, useEffect as P, useCallback as O, useContext as Ee, useMemo as z } from "react";
4
+ import { z as a } from "zod";
5
+ import { motion as I, useInView as Me, AnimatePresence as Re } from "motion/react";
6
+ import Fe from "react-markdown";
7
+ import { Prism as ue } from "react-syntax-highlighter";
8
+ import Ae from "remark-gfm";
9
+ import './assets/index.css';const me = Ie(
9
10
  void 0
10
11
  );
11
- async function ve(e, r) {
12
- const t = e.getReader();
13
- let n;
14
- for (; !(n = await t.read()).done; )
15
- r(n.value);
16
- }
17
- function Te(e) {
18
- let r, t, n, i = !1;
19
- return function(a) {
20
- r === void 0 ? (r = a, t = 0, n = -1) : r = Ce(r, a);
21
- const s = r.length;
12
+ async function Pe(e, r) {
13
+ const n = e.getReader();
14
+ let t;
15
+ for (; !(t = await n.read()).done; )
16
+ r(t.value);
17
+ }
18
+ function De(e) {
19
+ let r, n, t, i = !1;
20
+ return function(s) {
21
+ r === void 0 ? (r = s, n = 0, t = -1) : r = ze(r, s);
22
+ const c = r.length;
22
23
  let m = 0;
23
- for (; t < s; ) {
24
- i && (r[t] === 10 && (m = ++t), i = !1);
25
- let p = -1;
26
- for (; t < s && p === -1; ++t)
27
- switch (r[t]) {
24
+ for (; n < c; ) {
25
+ i && (r[n] === 10 && (m = ++n), i = !1);
26
+ let y = -1;
27
+ for (; n < c && y === -1; ++n)
28
+ switch (r[n]) {
28
29
  case 58:
29
- n === -1 && (n = t - m);
30
+ t === -1 && (t = n - m);
30
31
  break;
31
32
  case 13:
32
33
  i = !0;
33
34
  case 10:
34
- p = t;
35
+ y = n;
35
36
  break;
36
37
  }
37
- if (p === -1)
38
+ if (y === -1)
38
39
  break;
39
- e(r.subarray(m, p), n), m = t, n = -1;
40
+ e(r.subarray(m, y), t), m = n, t = -1;
40
41
  }
41
- m === s ? r = void 0 : m !== 0 && (r = r.subarray(m), t -= m);
42
+ m === c ? r = void 0 : m !== 0 && (r = r.subarray(m), n -= m);
42
43
  };
43
44
  }
44
- function we(e, r, t) {
45
- let n = J();
45
+ function Le(e, r, n) {
46
+ let t = re();
46
47
  const i = new TextDecoder();
47
- return function(a, s) {
48
- if (a.length === 0)
49
- t == null || t(n), n = J();
50
- else if (s > 0) {
51
- const m = i.decode(a.subarray(0, s)), p = s + (a[s + 1] === 32 ? 2 : 1), c = i.decode(a.subarray(p));
48
+ return function(s, c) {
49
+ if (s.length === 0)
50
+ n == null || n(t), t = re();
51
+ else if (c > 0) {
52
+ const m = i.decode(s.subarray(0, c)), y = c + (s[c + 1] === 32 ? 2 : 1), d = i.decode(s.subarray(y));
52
53
  switch (m) {
53
54
  case "data":
54
- n.data = n.data ? n.data + `
55
- ` + c : c;
55
+ t.data = t.data ? t.data + `
56
+ ` + d : d;
56
57
  break;
57
58
  case "event":
58
- n.event = c;
59
+ t.event = d;
59
60
  break;
60
61
  case "id":
61
- e(n.id = c);
62
+ e(t.id = d);
62
63
  break;
63
64
  case "retry":
64
- const d = parseInt(c, 10);
65
- isNaN(d) || r(n.retry = d);
65
+ const u = parseInt(d, 10);
66
+ isNaN(u) || r(t.retry = u);
66
67
  break;
67
68
  }
68
69
  }
69
70
  };
70
71
  }
71
- function Ce(e, r) {
72
- const t = new Uint8Array(e.length + r.length);
73
- return t.set(e), t.set(r, e.length), t;
72
+ function ze(e, r) {
73
+ const n = new Uint8Array(e.length + r.length);
74
+ return n.set(e), n.set(r, e.length), n;
74
75
  }
75
- function J() {
76
+ function re() {
76
77
  return {
77
78
  data: "",
78
79
  event: "",
@@ -80,68 +81,68 @@ function J() {
80
81
  retry: void 0
81
82
  };
82
83
  }
83
- var Ie = function(e, r) {
84
- var t = {};
85
- for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
84
+ var We = function(e, r) {
85
+ var n = {};
86
+ for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && r.indexOf(t) < 0 && (n[t] = e[t]);
86
87
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
87
- for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
88
- r.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (t[n[i]] = e[n[i]]);
89
- return t;
88
+ for (var i = 0, t = Object.getOwnPropertySymbols(e); i < t.length; i++)
89
+ r.indexOf(t[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[i]) && (n[t[i]] = e[t[i]]);
90
+ return n;
90
91
  };
91
- const O = "text/event-stream", Ee = 1e3, Y = "last-event-id";
92
- function Me(e, r) {
93
- var { signal: t, headers: n, onopen: i, onmessage: l, onclose: a, onerror: s, openWhenHidden: m, fetch: p } = r, c = Ie(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
94
- return new Promise((d, u) => {
95
- const g = Object.assign({}, n);
96
- g.accept || (g.accept = O);
97
- let h;
98
- function f() {
99
- h.abort(), document.hidden || x();
92
+ const $ = "text/event-stream", Ne = 1e3, te = "last-event-id";
93
+ function Oe(e, r) {
94
+ var { signal: n, headers: t, onopen: i, onmessage: l, onclose: s, onerror: c, openWhenHidden: m, fetch: y } = r, d = We(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
95
+ return new Promise((u, p) => {
96
+ const h = Object.assign({}, t);
97
+ h.accept || (h.accept = $);
98
+ let f;
99
+ function S() {
100
+ f.abort(), document.hidden || w();
100
101
  }
101
- m || document.addEventListener("visibilitychange", f);
102
- let k = Ee, b = 0;
102
+ m || document.addEventListener("visibilitychange", S);
103
+ let x = Ne, b = 0;
103
104
  function v() {
104
- document.removeEventListener("visibilitychange", f), window.clearTimeout(b), h.abort();
105
+ document.removeEventListener("visibilitychange", S), window.clearTimeout(b), f.abort();
105
106
  }
106
- t == null || t.addEventListener("abort", () => {
107
- v(), d();
107
+ n == null || n.addEventListener("abort", () => {
108
+ v(), u();
108
109
  });
109
- const T = p ?? window.fetch, w = i ?? Re;
110
- async function x() {
111
- var D;
112
- h = new AbortController();
110
+ const C = y ?? window.fetch, M = i ?? Be;
111
+ async function w() {
112
+ var k;
113
+ f = new AbortController();
113
114
  try {
114
- const W = await T(e, Object.assign(Object.assign({}, c), { headers: g, signal: h.signal }));
115
- await w(W), await ve(W.body, Te(we((R) => {
116
- R ? g[Y] = R : delete g[Y];
117
- }, (R) => {
118
- k = R;
119
- }, l))), a == null || a(), v(), d();
115
+ const W = await C(e, Object.assign(Object.assign({}, d), { headers: h, signal: f.signal }));
116
+ await M(W), await Pe(W.body, De(Le((A) => {
117
+ A ? h[te] = A : delete h[te];
118
+ }, (A) => {
119
+ x = A;
120
+ }, l))), s == null || s(), v(), u();
120
121
  } catch (W) {
121
- if (!h.signal.aborted)
122
+ if (!f.signal.aborted)
122
123
  try {
123
- const R = (D = s == null ? void 0 : s(W)) !== null && D !== void 0 ? D : k;
124
- window.clearTimeout(b), b = window.setTimeout(x, R);
125
- } catch (R) {
126
- v(), u(R);
124
+ const A = (k = c == null ? void 0 : c(W)) !== null && k !== void 0 ? k : x;
125
+ window.clearTimeout(b), b = window.setTimeout(w, A);
126
+ } catch (A) {
127
+ v(), p(A);
127
128
  }
128
129
  }
129
130
  }
130
- x();
131
+ w();
131
132
  });
132
133
  }
133
- function Re(e) {
134
+ function Be(e) {
134
135
  const r = e.headers.get("content-type");
135
- if (!(r != null && r.startsWith(O)))
136
- throw new Error(`Expected content-type to be ${O}, Actual: ${r}`);
136
+ if (!(r != null && r.startsWith($)))
137
+ throw new Error(`Expected content-type to be ${$}, Actual: ${r}`);
137
138
  }
138
- function Z(e) {
139
- const r = atob(e), t = new Uint8Array(r.length);
140
- for (let n = 0; n < r.length; n++)
141
- t[n] = r.charCodeAt(n);
142
- return new TextDecoder("utf-8").decode(t);
139
+ function ne(e) {
140
+ const r = atob(e), n = new Uint8Array(r.length);
141
+ for (let t = 0; t < r.length; t++)
142
+ n[t] = r.charCodeAt(t);
143
+ return new TextDecoder("utf-8").decode(n);
143
144
  }
144
- function Fe() {
145
+ function je() {
145
146
  return `
146
147
  var connections = new Map();
147
148
 
@@ -287,10 +288,10 @@ self.onmessage = function (e) {
287
288
  };
288
289
  `.trim();
289
290
  }
290
- function ee(e) {
291
+ function oe(e) {
291
292
  return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
292
293
  }
293
- class Ae {
294
+ class $e {
294
295
  constructor(r) {
295
296
  this.activeConnections = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.worker = null, this.workerBlobUrl = null, this.workerSupported = !1, this.fency = r, this.tryInitWorker();
296
297
  }
@@ -298,28 +299,28 @@ class Ae {
298
299
  try {
299
300
  if (typeof Worker > "u" || typeof Blob > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function" || typeof ReadableStream > "u")
300
301
  return;
301
- const r = Fe(), t = new Blob([r], { type: "application/javascript" }), n = URL.createObjectURL(t), i = new Worker(n);
302
+ const r = je(), n = new Blob([r], { type: "application/javascript" }), t = URL.createObjectURL(n), i = new Worker(t);
302
303
  i.onmessage = (l) => {
303
304
  this.handleWorkerMessage(l.data);
304
305
  }, i.onerror = (l) => {
305
306
  console.error("Fency stream worker error:", l.message);
306
- }, this.worker = i, this.workerBlobUrl = n, this.workerSupported = !0;
307
+ }, this.worker = i, this.workerBlobUrl = t, this.workerSupported = !0;
307
308
  } catch {
308
309
  this.workerSupported = !1, this.worker = null, this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null);
309
310
  }
310
311
  }
311
312
  handleWorkerMessage(r) {
312
313
  if (!r || typeof r != "object") return;
313
- const t = r;
314
- switch (t.type) {
314
+ const n = r;
315
+ switch (n.type) {
315
316
  case "message":
316
- if (t.data && t.streamId) {
317
- const n = Z(t.data);
318
- this.broadcast(n, t.streamId);
317
+ if (n.data && n.streamId) {
318
+ const t = ne(n.data);
319
+ this.broadcast(t, n.streamId);
319
320
  }
320
321
  break;
321
322
  case "error":
322
- t.streamId && (this.activeConnections.delete(t.streamId), this.broadcastError(t.streamId, t.error));
323
+ n.streamId && (this.activeConnections.delete(n.streamId), this.broadcastError(n.streamId, n.error));
323
324
  break;
324
325
  }
325
326
  }
@@ -328,50 +329,50 @@ class Ae {
328
329
  * Creates new connections and removes old ones.
329
330
  */
330
331
  updateStreams(r) {
331
- r.forEach((n) => {
332
- const i = n.stream.id;
333
- this.activeConnections.has(i) || this.connectStream(n);
332
+ r.forEach((t) => {
333
+ const i = t.stream.id;
334
+ this.activeConnections.has(i) || this.connectStream(t);
334
335
  });
335
- const t = new Set(r.map((n) => n.stream.id));
336
- this.activeConnections.forEach((n, i) => {
337
- t.has(i) || (n.abort(), this.activeConnections.delete(i));
336
+ const n = new Set(r.map((t) => t.stream.id));
337
+ this.activeConnections.forEach((t, i) => {
338
+ n.has(i) || (t.abort(), this.activeConnections.delete(i));
338
339
  });
339
340
  }
340
341
  connectStream(r) {
341
342
  this.workerSupported && this.worker ? this.connectStreamInWorker(r) : this.connectStreamOnMainThread(r);
342
343
  }
343
344
  connectStreamInWorker(r) {
344
- const t = r.stream.id, n = `${this.fency.baseUrl}/sse/streams/${t}`, i = new AbortController(), l = {
345
- accept: O,
345
+ const n = r.stream.id, t = `${this.fency.baseUrl}/sse/streams/${n}`, i = new AbortController(), l = {
346
+ accept: $,
346
347
  "X-Fency-Publishable-Key": this.fency.publishableKey,
347
348
  "X-Fency-Stream-Token": r.stream.token
348
349
  };
349
- this.activeConnections.set(t, {
350
+ this.activeConnections.set(n, {
350
351
  abort: () => {
351
- var a;
352
- i.abort(), (a = this.worker) == null || a.postMessage({ command: "disconnect", streamId: t });
352
+ var s;
353
+ i.abort(), (s = this.worker) == null || s.postMessage({ command: "disconnect", streamId: n });
353
354
  }
354
- }), this.startWorkerStream(t, n, l, i);
355
+ }), this.startWorkerStream(n, t, l, i);
355
356
  }
356
- async startWorkerStream(r, t, n, i) {
357
+ async startWorkerStream(r, n, t, i) {
357
358
  const l = this.worker;
358
359
  if (!l) return;
359
- const a = (s) => {
360
- i.signal.aborted || (this.activeConnections.delete(r), this.broadcastError(r, s));
360
+ const s = (c) => {
361
+ i.signal.aborted || (this.activeConnections.delete(r), this.broadcastError(r, c));
361
362
  };
362
363
  try {
363
- const s = await fetch(t, {
364
+ const c = await fetch(n, {
364
365
  method: "GET",
365
- headers: n,
366
+ headers: t,
366
367
  signal: i.signal
367
368
  });
368
- if (!s.ok) {
369
- s.status >= 400 && s.status < 500 && s.status !== 429 ? a(`Client error ${s.status}`) : a(`HTTP ${s.status}`);
369
+ if (!c.ok) {
370
+ c.status >= 400 && c.status < 500 && c.status !== 429 ? s(`Client error ${c.status}`) : s(`HTTP ${c.status}`);
370
371
  return;
371
372
  }
372
- const m = s.body;
373
+ const m = c.body;
373
374
  if (!m) {
374
- a("No response body");
375
+ s("No response body");
375
376
  return;
376
377
  }
377
378
  if (!this.activeConnections.has(r)) {
@@ -383,36 +384,36 @@ class Ae {
383
384
  { command: "start", streamId: r, readableStream: m },
384
385
  [m]
385
386
  );
386
- } catch (s) {
387
+ } catch (c) {
387
388
  if (i.signal.aborted) return;
388
- a(ee(s));
389
+ s(oe(c));
389
390
  }
390
391
  }
391
392
  connectStreamOnMainThread(r) {
392
- const t = r.stream.id, n = new AbortController();
393
- this.activeConnections.set(t, {
394
- abort: () => n.abort()
393
+ const n = r.stream.id, t = new AbortController();
394
+ this.activeConnections.set(n, {
395
+ abort: () => t.abort()
395
396
  });
396
- const i = `${this.fency.baseUrl}/sse/streams/${t}`, l = {
397
+ const i = `${this.fency.baseUrl}/sse/streams/${n}`, l = {
397
398
  "X-Fency-Publishable-Key": this.fency.publishableKey,
398
399
  "X-Fency-Stream-Token": r.stream.token
399
400
  };
400
- Me(i, {
401
+ Oe(i, {
401
402
  headers: l,
402
- signal: n.signal,
403
+ signal: t.signal,
403
404
  openWhenHidden: !0,
404
- onopen: async (a) => {
405
- if (!a.ok && a.status >= 400 && a.status < 500 && a.status !== 429)
406
- throw this.activeConnections.delete(t), new Error(`Client error ${a.status}`);
405
+ onopen: async (s) => {
406
+ if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
407
+ throw this.activeConnections.delete(n), new Error(`Client error ${s.status}`);
407
408
  },
408
- onmessage: (a) => {
409
- if (a.data) {
410
- const s = Z(a.data);
411
- this.broadcast(s, t);
409
+ onmessage: (s) => {
410
+ if (s.data) {
411
+ const c = ne(s.data);
412
+ this.broadcast(c, n);
412
413
  }
413
414
  },
414
- onerror: (a) => {
415
- throw console.error("EventSource error for stream", t, ":", a), this.activeConnections.delete(t), this.broadcastError(t, ee(a)), a;
415
+ onerror: (s) => {
416
+ throw console.error("EventSource error for stream", n, ":", s), this.activeConnections.delete(n), this.broadcastError(n, oe(s)), s;
416
417
  },
417
418
  onclose() {
418
419
  }
@@ -422,19 +423,19 @@ class Ae {
422
423
  * Subscribe to events from all active streams.
423
424
  * Returns an unsubscribe function.
424
425
  */
425
- subscribe(r, t) {
426
- return this.subscribers.set(r, t), () => {
426
+ subscribe(r, n) {
427
+ return this.subscribers.set(r, n), () => {
427
428
  this.subscribers.delete(r);
428
429
  };
429
430
  }
430
- broadcast(r, t) {
431
- this.subscribers.forEach((n) => {
432
- n.onMessage(r, t);
431
+ broadcast(r, n) {
432
+ this.subscribers.forEach((t) => {
433
+ t.onMessage(r, n);
433
434
  });
434
435
  }
435
- broadcastError(r, t) {
436
- this.subscribers.forEach((n) => {
437
- n.onError(r, t);
436
+ broadcastError(r, n) {
437
+ this.subscribers.forEach((t) => {
438
+ t.onError(r, n);
438
439
  });
439
440
  }
440
441
  /**
@@ -451,457 +452,714 @@ class Ae {
451
452
  this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null), this.workerSupported = !1, this.subscribers.clear();
452
453
  }
453
454
  }
454
- const Le = 48e4, Pe = 3e5, re = (e) => {
455
+ const He = 48e4, Ue = 3e5, ae = (e) => {
455
456
  const r = Date.now();
456
- return e.filter((t) => r - t.createdAt < Le);
457
+ return e.filter((n) => r - n.createdAt < He);
457
458
  };
458
- function Ur({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
459
- const [n, i] = I(
459
+ function Lt({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
460
+ const [t, i] = E(
460
461
  null
461
- ), [l, a] = I(!0), [s, m] = I(null), [p, c] = I([]), d = A(null), u = A(null);
462
- F(() => {
463
- e.then((k) => {
464
- i(k), a(!1);
465
- }).catch((k) => {
466
- m(k), a(!1);
462
+ ), [l, s] = E(!0), [c, m] = E(null), [y, d] = E([]), u = D(null), p = D(null);
463
+ P(() => {
464
+ e.then((x) => {
465
+ i(x), s(!1);
466
+ }).catch((x) => {
467
+ m(x), s(!1);
467
468
  });
468
- }, [e]), F(() => {
469
- n && !u.current && (u.current = new Ae(n));
470
- }, [n]), F(() => {
471
- u.current && u.current.updateStreams(p);
472
- }, [p]), F(() => () => {
473
- var k;
474
- (k = u.current) == null || k.cleanup();
475
- }, []), F(() => {
476
- const k = setInterval(() => {
477
- c((b) => {
478
- const v = re(b);
469
+ }, [e]), P(() => {
470
+ t && !p.current && (p.current = new $e(t));
471
+ }, [t]), P(() => {
472
+ p.current && p.current.updateStreams(y);
473
+ }, [y]), P(() => () => {
474
+ var x;
475
+ (x = p.current) == null || x.cleanup();
476
+ }, []), P(() => {
477
+ const x = setInterval(() => {
478
+ d((b) => {
479
+ const v = ae(b);
479
480
  return v.length !== b.length ? v : b;
480
481
  });
481
482
  }, 6e4);
482
- return () => clearInterval(k);
483
+ return () => clearInterval(x);
483
484
  }, []);
484
- const g = z(
485
- async (k = Pe) => {
486
- if (d.current)
487
- return d.current;
488
- const b = Date.now(), v = p.length > 0 ? p[p.length - 1] : null;
489
- if (v && b - v.createdAt < k)
485
+ const h = O(
486
+ async (x = Ue) => {
487
+ if (u.current)
488
+ return u.current;
489
+ const b = Date.now(), v = y.length > 0 ? y[y.length - 1] : null;
490
+ if (v && b - v.createdAt < x)
490
491
  return v.stream;
491
- const T = (async () => {
492
- if (!n)
492
+ const C = (async () => {
493
+ if (!t)
493
494
  throw new Error("Fency instance not initialized");
494
- const w = await r(), x = await ue({
495
- pk: n.publishableKey,
496
- baseUrl: n.baseUrl,
497
- clientToken: (w == null ? void 0 : w.clientToken) ?? ""
495
+ const M = await r(), w = await xe({
496
+ pk: t.publishableKey,
497
+ baseUrl: t.baseUrl,
498
+ clientToken: (M == null ? void 0 : M.clientToken) ?? ""
498
499
  });
499
- if (x.type === "success") {
500
- const D = {
501
- stream: x.stream,
500
+ if (w.type === "success") {
501
+ const k = {
502
+ stream: w.stream,
502
503
  createdAt: Date.now()
503
504
  };
504
- return c((W) => {
505
- const R = [...W, D];
506
- return re(R);
507
- }), d.current = null, x.stream;
505
+ return d((W) => {
506
+ const A = [...W, k];
507
+ return ae(A);
508
+ }), u.current = null, w.stream;
508
509
  } else
509
- throw d.current = null, new Error("Failed to create stream");
510
+ throw u.current = null, new Error("Failed to create stream");
510
511
  })();
511
- return d.current = T, T;
512
+ return u.current = C, C;
512
513
  },
513
- [n, p]
514
+ [t, y]
514
515
  );
515
- if (s)
516
- return /* @__PURE__ */ y("div", { children: [
516
+ if (c)
517
+ return /* @__PURE__ */ g("div", { children: [
517
518
  "Fency error: ",
518
- s.message
519
+ c.message
519
520
  ] });
520
- if (!n)
521
+ if (!t)
521
522
  return null;
522
- const h = p.length > 0 ? p[p.length - 1] : null, f = {
523
- fency: n,
523
+ const f = y.length > 0 ? y[y.length - 1] : null, S = {
524
+ fency: t,
524
525
  loading: l,
525
- error: s,
526
- activeStreams: p,
527
- latestStream: h,
528
- eventManager: u.current,
529
- getOrCreateStream: g
526
+ error: c,
527
+ activeStreams: y,
528
+ latestStream: f,
529
+ eventManager: p.current,
530
+ getOrCreateStream: h
530
531
  };
531
- return /* @__PURE__ */ o(se.Provider, { value: f, children: t });
532
+ return /* @__PURE__ */ o(me.Provider, { value: S, children: n });
532
533
  }
533
- function le() {
534
- const e = fe(se);
534
+ function pe() {
535
+ const e = Ee(me);
535
536
  if (e === void 0)
536
537
  throw new Error("useFencyContext must be used within a FencyProvider");
537
538
  return e;
538
539
  }
539
- const De = (e) => {
540
+ const ye = a.object({
541
+ role: a.enum(["SYSTEM", "USER", "ASSISTANT"]),
542
+ content: a.string()
543
+ }).passthrough(), Q = a.object({
544
+ memoryId: a.string(),
545
+ memoryTitle: a.string(),
546
+ memoryTypeId: a.string(),
547
+ memoryTypeName: a.string(),
548
+ matchingChunkScore: a.number(),
549
+ matchingChunk: a.object({
550
+ chunkNumber: a.number(),
551
+ pageNumbers: a.array(a.number()),
552
+ content: a.string()
553
+ }).passthrough(),
554
+ chunks: a.array(
555
+ a.object({
556
+ chunkNumber: a.number(),
557
+ pageNumbers: a.array(a.number()),
558
+ content: a.string(),
559
+ relation: a.enum([
560
+ "MATCH",
561
+ "CONTEXT_BEFORE",
562
+ "CONTEXT_AFTER"
563
+ ])
564
+ }).passthrough()
565
+ )
566
+ }).passthrough(), he = a.object({
567
+ memoryId: a.string(),
568
+ memoryTitle: a.string()
569
+ }).passthrough(), _e = a.object({
570
+ taskType: a.literal("StreamingChatCompletion"),
571
+ eventType: a.literal("Text"),
572
+ text: a.string()
573
+ }).passthrough(), Ge = a.object({
574
+ taskType: a.literal("StreamingChatCompletion"),
575
+ eventType: a.literal("Completed"),
576
+ response: a.object({
577
+ textResponse: a.string(),
578
+ messages: a.array(ye)
579
+ }).passthrough()
580
+ }).passthrough(), qe = a.object({
581
+ taskType: a.literal("StreamingChatCompletion"),
582
+ eventType: a.literal("Error"),
583
+ message: a.string()
584
+ }).passthrough(), Qe = a.object({
585
+ taskType: a.literal("StructuredChatCompletion"),
586
+ eventType: a.literal("Completed"),
587
+ response: a.object({
588
+ jsonResponse: a.string(),
589
+ messages: a.array(ye)
590
+ }).passthrough()
591
+ }).passthrough(), Ke = a.object({
592
+ taskType: a.literal("StructuredChatCompletion"),
593
+ eventType: a.literal("Error"),
594
+ message: a.string()
595
+ }).passthrough(), Xe = a.object({
596
+ taskType: a.literal("MemoryChat"),
597
+ eventType: a.literal("Text"),
598
+ text: a.string()
599
+ }).passthrough(), Ve = a.object({
600
+ taskType: a.literal("MemoryChat"),
601
+ eventType: a.literal("Thinking")
602
+ }).passthrough(), Ye = a.object({
603
+ taskType: a.literal("MemoryChat"),
604
+ eventType: a.literal("Search"),
605
+ queryDescription: a.string(),
606
+ memories: a.array(he).optional()
607
+ }).passthrough(), Je = a.object({
608
+ taskType: a.literal("MemoryChat"),
609
+ eventType: a.literal("FindMemories"),
610
+ titles: a.array(a.string())
611
+ }).passthrough(), Ze = a.object({
612
+ taskType: a.literal("MemoryChat"),
613
+ eventType: a.literal("FindMemoriesResult"),
614
+ memories: a.array(he)
615
+ }).passthrough(), er = a.enum([
616
+ "downloading",
617
+ "downloaded",
618
+ "analyzing",
619
+ "summarizing"
620
+ ]), rr = a.object({
621
+ taskType: a.literal("MemoryChat"),
622
+ eventType: a.literal("ScrapeWebsites"),
623
+ input: a.object({
624
+ query: a.string(),
625
+ urls: a.array(a.string())
626
+ }).passthrough(),
627
+ results: a.array(
628
+ a.object({
629
+ url: a.string(),
630
+ status: er.optional(),
631
+ summary: a.string().optional(),
632
+ error: a.string().optional()
633
+ }).passthrough()
634
+ ).optional()
635
+ }).passthrough(), tr = a.object({
636
+ taskType: a.literal("MemoryChat"),
637
+ eventType: a.literal("GoogleSearch"),
638
+ input: a.object({
639
+ query: a.string(),
640
+ countryCode: a.string().optional()
641
+ }).passthrough(),
642
+ results: a.array(
643
+ a.object({
644
+ rank: a.number(),
645
+ title: a.string(),
646
+ link: a.string(),
647
+ description: a.string()
648
+ }).passthrough()
649
+ ).optional()
650
+ }).passthrough(), nr = a.object({
651
+ taskType: a.literal("MemoryChat"),
652
+ eventType: a.literal("FindSources")
653
+ }).passthrough(), or = a.object({
654
+ taskType: a.literal("MemoryChat"),
655
+ eventType: a.literal("ExploreMemories"),
656
+ memories: a.array(
657
+ a.object({
658
+ memoryId: a.string(),
659
+ memoryTitle: a.string(),
660
+ result: a.string().optional(),
661
+ error: a.string().optional()
662
+ }).passthrough()
663
+ )
664
+ }).passthrough(), ar = a.object({
665
+ taskType: a.literal("MemoryChat"),
666
+ eventType: a.literal("ChunkResults"),
667
+ items: a.array(Q)
668
+ }).passthrough(), ir = a.object({
669
+ taskType: a.literal("MemoryChat"),
670
+ eventType: a.literal("SourcesResult"),
671
+ sources: a.array(
672
+ a.object({
673
+ memoryId: a.string(),
674
+ memoryTitle: a.string(),
675
+ memoryTypeId: a.string(),
676
+ memoryTypeName: a.string(),
677
+ pageNumbers: a.array(a.number())
678
+ }).passthrough()
679
+ )
680
+ }).passthrough(), sr = a.object({
681
+ taskType: a.literal("MemoryChat"),
682
+ eventType: a.literal("Completed"),
683
+ response: a.object({
684
+ textResponse: a.string(),
685
+ sources: a.array(
686
+ a.object({
687
+ memoryId: a.string(),
688
+ memoryTitle: a.string(),
689
+ memoryTypeId: a.string(),
690
+ memoryTypeName: a.string(),
691
+ pageNumbers: a.array(a.number())
692
+ }).passthrough()
693
+ )
694
+ }).passthrough()
695
+ }).passthrough(), lr = a.object({
696
+ taskType: a.literal("MemoryChat"),
697
+ eventType: a.literal("Error"),
698
+ message: a.string()
699
+ }).passthrough(), cr = a.object({
700
+ taskType: a.literal("MemorySearch"),
701
+ eventType: a.literal("GeneratingQueries"),
702
+ memoryTypes: a.array(
703
+ a.object({
704
+ memoryTypeId: a.string(),
705
+ memoryTypeName: a.string(),
706
+ reasoning: a.string().optional(),
707
+ reasoningCompleted: a.boolean().optional(),
708
+ queries: a.array(a.object({ query: a.string() }).passthrough()).optional()
709
+ }).passthrough()
710
+ )
711
+ }).passthrough(), dr = a.object({
712
+ taskType: a.literal("MemorySearch"),
713
+ eventType: a.literal("ExploreQueries"),
714
+ queries: a.array(
715
+ a.object({
716
+ query: a.string(),
717
+ memoryTypeId: a.string(),
718
+ memoryTypeName: a.string(),
719
+ result: a.object({
720
+ numberOfChunks: a.number(),
721
+ highestChunkScore: a.number(),
722
+ items: a.array(Q)
723
+ }).passthrough().optional(),
724
+ error: a.string().optional()
725
+ }).passthrough()
726
+ )
727
+ }).passthrough(), ur = a.object({
728
+ taskType: a.literal("MemorySearch"),
729
+ eventType: a.literal("SearchMemoryTypes"),
730
+ memoryTypes: a.array(
731
+ a.object({
732
+ memoryTypeId: a.string(),
733
+ memoryTypeName: a.string(),
734
+ result: a.object({
735
+ numberOfChunks: a.number(),
736
+ highestChunkScore: a.number()
737
+ }).passthrough().optional(),
738
+ error: a.string().optional()
739
+ }).passthrough()
740
+ )
741
+ }).passthrough(), mr = a.object({
742
+ taskType: a.literal("MemorySearch"),
743
+ eventType: a.literal("Completed"),
744
+ response: a.object({
745
+ query: a.string(),
746
+ items: a.array(Q)
747
+ }).passthrough()
748
+ }).passthrough(), pr = a.object({
749
+ taskType: a.literal("MemorySearch"),
750
+ eventType: a.literal("Error"),
751
+ message: a.string()
752
+ }).passthrough(), yr = a.union([
753
+ _e,
754
+ Ge,
755
+ qe,
756
+ Qe,
757
+ Ke,
758
+ Xe,
759
+ Ve,
760
+ Ye,
761
+ Je,
762
+ Ze,
763
+ rr,
764
+ tr,
765
+ nr,
766
+ or,
767
+ ar,
768
+ ir,
769
+ sr,
770
+ lr,
771
+ cr,
772
+ dr,
773
+ ur,
774
+ mr,
775
+ pr
776
+ ]);
777
+ function hr(e) {
778
+ const r = yr.safeParse(e);
779
+ return r.success ? r.data : (console.warn(
780
+ "[fency] Dropping unrecognized or malformed agent task event:",
781
+ r.error.format(),
782
+ e
783
+ ), null);
784
+ }
785
+ const gr = (e) => {
540
786
  try {
541
787
  const r = JSON.parse(e);
542
- return We(r);
788
+ return fr(r);
543
789
  } catch (r) {
544
790
  return console.error("Error parsing message:", r), null;
545
791
  }
546
- }, We = (e) => me(e) ? ze(e) : pe(e) ? Be(e) : ye(e) ? Oe(e) : null, ze = (e) => ({
792
+ }, fr = (e) => be(e) ? Sr(e) : ke(e) ? Tr(e) : ve(e) ? xr(e) : null, Sr = (e) => ({
547
793
  type: "STREAM_TIMEOUT",
548
794
  streamId: e.streamId,
549
795
  timestamp: e.timestamp
550
- }), Be = (e) => ({
796
+ }), Tr = (e) => ({
551
797
  type: "STREAM_NOT_FOUND",
552
798
  streamId: e.streamId,
553
799
  timestamp: e.timestamp
554
- }), Oe = (e) => ({
555
- type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
556
- streamId: e.streamId,
557
- agentTaskId: e.agentTaskId,
558
- progressItemId: e.progressItemId,
559
- timestamp: e.timestamp,
560
- createdAt: e.createdAt,
561
- data: JSON.parse(e.data)
562
- }), $e = (e) => {
563
- const r = le(), [t, n] = I(null), i = A(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
564
- return F(() => {
800
+ }), xr = (e) => {
801
+ let r;
802
+ try {
803
+ r = JSON.parse(e.data);
804
+ } catch (t) {
805
+ return console.warn(
806
+ "[fency] Invalid JSON in AGENT_TASK_PROGRESS_ITEM_UPDATED data payload:",
807
+ t
808
+ ), null;
809
+ }
810
+ const n = hr(r);
811
+ return n === null ? null : {
812
+ type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
813
+ streamId: e.streamId,
814
+ agentTaskId: e.agentTaskId,
815
+ progressItemId: e.progressItemId,
816
+ timestamp: e.timestamp,
817
+ createdAt: e.createdAt,
818
+ data: n
819
+ };
820
+ }, br = (e) => {
821
+ const r = pe(), [n, t] = E(null), i = D(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
822
+ return P(() => {
565
823
  if (!r.eventManager) return;
566
- const a = {
567
- onMessage: (m, p) => {
568
- var d, u, g;
569
- const c = De(m);
570
- if (c)
571
- switch (c.type) {
824
+ const s = {
825
+ onMessage: (m, y) => {
826
+ var u, p, h;
827
+ const d = gr(m);
828
+ if (d)
829
+ switch (d.type) {
572
830
  case "STREAM_TIMEOUT":
573
- (d = e == null ? void 0 : e.onStreamTimeout) == null || d.call(e, c);
831
+ (u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, d);
574
832
  break;
575
833
  case "STREAM_NOT_FOUND":
576
- (u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, c);
834
+ (p = e == null ? void 0 : e.onStreamNotFound) == null || p.call(e, d);
577
835
  break;
578
836
  case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
579
- (g = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || g.call(e, c);
837
+ (h = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || h.call(e, d);
580
838
  break;
581
839
  }
582
840
  },
583
- onError: (m, p) => {
584
- var c;
585
- (c = e == null ? void 0 : e.onStreamError) == null || c.call(e, {
841
+ onError: (m, y) => {
842
+ var d;
843
+ (d = e == null ? void 0 : e.onStreamError) == null || d.call(e, {
586
844
  streamId: m,
587
845
  error: {
588
846
  code: "UnknownError",
589
- message: p ?? "Unknown error in useStream"
847
+ message: y ?? "Unknown error in useStream"
590
848
  }
591
849
  });
592
850
  }
593
851
  };
594
852
  return r.eventManager.subscribe(
595
853
  i.current,
596
- a
854
+ s
597
855
  );
598
856
  }, [r.eventManager, e]), {
599
857
  createStream: async () => {
600
858
  try {
601
- const a = await r.getOrCreateStream();
602
- return n(a), {
859
+ const s = await r.getOrCreateStream();
860
+ return t(s), {
603
861
  type: "success",
604
- stream: a
862
+ stream: s
605
863
  };
606
- } catch (a) {
864
+ } catch (s) {
607
865
  return {
608
866
  type: "error",
609
867
  error: {
610
868
  code: "UnknownError",
611
- message: a instanceof Error ? a.message : "Failed to create stream"
869
+ message: s instanceof Error ? s.message : "Failed to create stream"
612
870
  }
613
871
  };
614
872
  }
615
873
  },
616
- stream: t
874
+ stream: n
617
875
  };
618
- }, _r = (e) => {
619
- const r = le(), [t, n] = I([]), i = A(/* @__PURE__ */ new Set()), l = A(/* @__PURE__ */ new Map()), a = z(
620
- (c, d) => {
621
- n((u) => {
622
- const g = [], h = u.map((f) => {
876
+ }, zt = (e) => {
877
+ const r = pe(), [n, t] = E([]), i = D(/* @__PURE__ */ new Set()), l = D(/* @__PURE__ */ new Map()), s = O(
878
+ (d, u) => {
879
+ t((p) => {
880
+ const h = [], f = p.map((S) => {
623
881
  var b;
624
- if (f.streamId !== c || !f.loading) return f;
625
- const k = (b = f.confirmedData) == null ? void 0 : b.taskId;
626
- return k && g.push(k), { ...f, loading: !1, error: d };
882
+ if (S.streamId !== d || !S.loading) return S;
883
+ const x = (b = S.confirmedData) == null ? void 0 : b.taskId;
884
+ return x && h.push(x), { ...S, loading: !1, error: u };
627
885
  });
628
- for (const f of g) {
629
- i.current.delete(f);
630
- const k = l.current.get(f);
631
- k && (l.current.delete(f), k({ type: "error", error: d }));
886
+ for (const S of h) {
887
+ i.current.delete(S);
888
+ const x = l.current.get(S);
889
+ x && (l.current.delete(S), x({ type: "error", error: u }));
632
890
  }
633
- return h;
891
+ return f;
634
892
  });
635
893
  },
636
894
  []
637
- ), { createStream: s } = $e({
638
- onAgentTaskProgressItemUpdated: (c) => {
639
- var g;
640
- if (!i.current.has(c.agentTaskId)) return;
641
- const d = c.data;
642
- if (d.taskType === "StreamingChatCompletion" && d.eventType === "Completed" || d.taskType === "StructuredChatCompletion" && d.eventType === "Completed" || d.taskType === "MemoryChat" && d.eventType === "Completed" || d.taskType === "MemorySearch" && d.eventType === "Completed") {
643
- const h = d.taskType === "MemorySearch" && d.eventType === "Completed" || d.taskType === "StructuredChatCompletion" && d.eventType === "Completed";
644
- n(
645
- h ? (k) => k.map((b) => {
646
- var w;
647
- if (((w = b.confirmedData) == null ? void 0 : w.taskId) !== c.agentTaskId)
895
+ ), { createStream: c } = br({
896
+ onAgentTaskProgressItemUpdated: (d) => {
897
+ var h;
898
+ if (!i.current.has(d.agentTaskId)) return;
899
+ const u = d.data;
900
+ if (u.taskType === "StreamingChatCompletion" && u.eventType === "Completed" || u.taskType === "StructuredChatCompletion" && u.eventType === "Completed" || u.taskType === "MemoryChat" && u.eventType === "Completed" || u.taskType === "MemorySearch" && u.eventType === "Completed") {
901
+ const f = u.taskType === "MemorySearch" && u.eventType === "Completed" || u.taskType === "StructuredChatCompletion" && u.eventType === "Completed";
902
+ t(
903
+ f ? (x) => x.map((b) => {
904
+ var M;
905
+ if (((M = b.confirmedData) == null ? void 0 : M.taskId) !== d.agentTaskId)
648
906
  return b;
649
- const T = b.progressItems.some(
650
- (x) => x.progressItemId === c.progressItemId
907
+ const C = b.progressItems.some(
908
+ (w) => w.progressItemId === d.progressItemId
651
909
  ) ? b.progressItems.map(
652
- (x) => x.progressItemId === c.progressItemId ? c : x
653
- ) : [...b.progressItems, c];
910
+ (w) => w.progressItemId === d.progressItemId ? d : w
911
+ ) : [...b.progressItems, d];
654
912
  return {
655
913
  ...b,
656
- progressItems: T,
914
+ progressItems: C,
657
915
  loading: !1
658
916
  };
659
- }) : (k) => k.map(
917
+ }) : (x) => x.map(
660
918
  (b) => {
661
919
  var v;
662
- return ((v = b.confirmedData) == null ? void 0 : v.taskId) === c.agentTaskId ? { ...b, loading: !1 } : b;
920
+ return ((v = b.confirmedData) == null ? void 0 : v.taskId) === d.agentTaskId ? { ...b, loading: !1 } : b;
663
921
  }
664
922
  )
665
923
  );
666
- const f = l.current.get(
667
- c.agentTaskId
924
+ const S = l.current.get(
925
+ d.agentTaskId
668
926
  );
669
- f && (l.current.delete(c.agentTaskId), f({
927
+ S && (l.current.delete(d.agentTaskId), S({
670
928
  type: "success",
671
- streamId: c.streamId,
672
- agentTaskId: c.agentTaskId,
673
- response: d
929
+ streamId: d.streamId,
930
+ agentTaskId: d.agentTaskId,
931
+ response: u
674
932
  }));
675
933
  return;
676
934
  }
677
- (g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, c), n(
678
- (h) => h.map((f) => {
935
+ (h = e.onAgentTaskProgressItemUpdated) == null || h.call(e, d), t(
936
+ (f) => f.map((S) => {
679
937
  var v;
680
- if (((v = f.confirmedData) == null ? void 0 : v.taskId) !== c.agentTaskId)
681
- return f;
682
- const b = f.progressItems.some(
683
- (T) => T.progressItemId === c.progressItemId
684
- ) ? f.progressItems.map(
685
- (T) => T.progressItemId === c.progressItemId ? c : T
686
- ) : [...f.progressItems, c];
687
- return { ...f, progressItems: b };
938
+ if (((v = S.confirmedData) == null ? void 0 : v.taskId) !== d.agentTaskId)
939
+ return S;
940
+ const b = S.progressItems.some(
941
+ (C) => C.progressItemId === d.progressItemId
942
+ ) ? S.progressItems.map(
943
+ (C) => C.progressItemId === d.progressItemId ? d : C
944
+ ) : [...S.progressItems, d];
945
+ return { ...S, progressItems: b };
688
946
  })
689
947
  );
690
948
  },
691
- onStreamError: (c) => {
692
- var d;
693
- (d = e == null ? void 0 : e.onStreamError) == null || d.call(e, c), a(c.streamId, c.error);
949
+ onStreamError: (d) => {
950
+ var u;
951
+ (u = e == null ? void 0 : e.onStreamError) == null || u.call(e, d), s(d.streamId, d.error);
694
952
  },
695
- onStreamNotFound: (c) => {
696
- var d;
697
- (d = e == null ? void 0 : e.onStreamNotFound) == null || d.call(e, c), a(c.streamId, {
953
+ onStreamNotFound: (d) => {
954
+ var u;
955
+ (u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, d), s(d.streamId, {
698
956
  code: "StreamNotFound",
699
957
  message: "Stream not found"
700
958
  });
701
959
  },
702
- onStreamTimeout: (c) => {
703
- var d;
704
- (d = e == null ? void 0 : e.onStreamTimeout) == null || d.call(e, c), a(c.streamId, {
960
+ onStreamTimeout: (d) => {
961
+ var u;
962
+ (u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, d), s(d.streamId, {
705
963
  code: "StreamTimeout",
706
964
  message: "Stream timed out"
707
965
  });
708
966
  }
709
- }), m = z(
710
- async (c, d) => {
711
- var f;
712
- const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = (d == null ? void 0 : d.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
713
- if (g === void 0)
967
+ }), m = O(
968
+ async (d, u) => {
969
+ var S;
970
+ const p = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, h = (u == null ? void 0 : u.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
971
+ if (h === void 0)
714
972
  throw new Error(
715
973
  "fetchCreateAgentTaskClientToken must be provided either in useAgentTasks props or in createAgentTask options"
716
974
  );
717
- const h = await s();
718
- if (h.type === "success") {
719
- const k = (/* @__PURE__ */ new Date()).toISOString(), b = {
720
- taskKey: u,
721
- streamId: h.stream.id,
722
- triggeredAt: k,
975
+ const f = await c();
976
+ if (f.type === "success") {
977
+ const x = (/* @__PURE__ */ new Date()).toISOString(), b = {
978
+ taskKey: p,
979
+ streamId: f.stream.id,
980
+ triggeredAt: x,
723
981
  confirmedData: null,
724
982
  error: null,
725
- params: c,
983
+ params: d,
726
984
  progressItems: [],
727
985
  loading: !0,
728
- loadingText: d == null ? void 0 : d.loadingText
986
+ loadingText: u == null ? void 0 : u.loadingText
729
987
  };
730
- n((v) => [...v, b]), (f = d == null ? void 0 : d.onTaskRegistered) == null || f.call(d, b);
988
+ t((v) => [...v, b]), (S = u == null ? void 0 : u.onTaskRegistered) == null || S.call(u, b);
731
989
  try {
732
- const { clientToken: v } = await g(), T = await ge({
990
+ const { clientToken: v } = await h(), C = await Ce({
733
991
  pk: r.fency.publishableKey,
734
992
  baseUrl: r.fency.baseUrl,
735
993
  clientToken: v,
736
- streamToken: h.stream.token,
994
+ streamToken: f.stream.token,
737
995
  request: {
738
- streamingChatCompletionTask: c.type === "StreamingChatCompletion" ? {
739
- messages: c.messages,
740
- model: c.model,
741
- ...c.temperature !== void 0 ? {
742
- temperature: c.temperature
996
+ streamingChatCompletionTask: d.type === "StreamingChatCompletion" ? {
997
+ messages: d.messages,
998
+ model: d.model,
999
+ ...d.temperature !== void 0 ? {
1000
+ temperature: d.temperature
743
1001
  } : {},
744
- ...c.topP !== void 0 ? { topP: c.topP } : {}
1002
+ ...d.topP !== void 0 ? { topP: d.topP } : {}
745
1003
  } : void 0,
746
- structuredChatCompletionTask: c.type === "StructuredChatCompletion" ? {
747
- messages: c.messages,
748
- jsonSchema: c.jsonSchema,
749
- model: c.model,
750
- ...c.temperature !== void 0 ? {
751
- temperature: c.temperature
1004
+ structuredChatCompletionTask: d.type === "StructuredChatCompletion" ? {
1005
+ messages: d.messages,
1006
+ jsonSchema: d.jsonSchema,
1007
+ model: d.model,
1008
+ ...d.temperature !== void 0 ? {
1009
+ temperature: d.temperature
752
1010
  } : {},
753
- ...c.topP !== void 0 ? { topP: c.topP } : {}
1011
+ ...d.topP !== void 0 ? { topP: d.topP } : {}
754
1012
  } : void 0,
755
- memoryChatTask: c.type === "MemoryChat" ? {
756
- messages: c.messages,
757
- model: c.model,
758
- language: c.language ?? "en",
759
- chunkLimit: c.chunkLimit ?? 10,
760
- memoryScanLimit: c.memoryScanLimit ?? 3
1013
+ memoryChatTask: d.type === "MemoryChat" ? {
1014
+ messages: d.messages,
1015
+ model: d.model,
1016
+ language: d.language ?? "en",
1017
+ chunkLimit: d.chunkLimit ?? 10,
1018
+ memoryScanLimit: d.memoryScanLimit ?? 3
761
1019
  } : void 0,
762
- memorySearchTask: c.type === "MemorySearch" ? {
763
- query: c.query,
764
- model: c.model,
765
- language: c.language ?? "en",
766
- chunkLimit: c.chunkLimit ?? 10,
767
- contextExpansion: c.contextExpansion,
768
- ...c.queryExpansion != null ? {
769
- queryExpansion: c.queryExpansion
1020
+ memorySearchTask: d.type === "MemorySearch" ? {
1021
+ query: d.query,
1022
+ model: d.model,
1023
+ language: d.language ?? "en",
1024
+ chunkLimit: d.chunkLimit ?? 10,
1025
+ contextExpansion: d.contextExpansion,
1026
+ ...d.queryExpansion != null ? {
1027
+ queryExpansion: d.queryExpansion
770
1028
  } : {}
771
1029
  } : void 0
772
1030
  }
773
1031
  });
774
- if (T.type === "success" && T.agentTask)
1032
+ if (C.type === "success" && C.agentTask)
775
1033
  return i.current.add(
776
- T.agentTask.id
777
- ), n((w) => [
778
- ...w.filter((x) => x.taskKey !== u),
1034
+ C.agentTask.id
1035
+ ), t((M) => [
1036
+ ...M.filter((w) => w.taskKey !== p),
779
1037
  {
780
- taskKey: u,
781
- streamId: h.stream.id,
1038
+ taskKey: p,
1039
+ streamId: f.stream.id,
782
1040
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
783
- taskId: T.agentTask.id,
784
- createdAt: T.agentTask.createdAt,
1041
+ taskId: C.agentTask.id,
1042
+ createdAt: C.agentTask.createdAt,
785
1043
  error: null,
786
- params: c,
1044
+ params: d,
787
1045
  progressItems: [],
788
1046
  loading: !0,
789
- loadingText: d == null ? void 0 : d.loadingText,
1047
+ loadingText: u == null ? void 0 : u.loadingText,
790
1048
  confirmedData: {
791
- taskId: T.agentTask.id,
792
- createdAt: T.agentTask.createdAt
1049
+ taskId: C.agentTask.id,
1050
+ createdAt: C.agentTask.createdAt
793
1051
  }
794
1052
  }
795
1053
  ]), await new Promise(
796
- (w) => {
1054
+ (M) => {
797
1055
  l.current.set(
798
- T.agentTask.id,
799
- w
1056
+ C.agentTask.id,
1057
+ M
800
1058
  );
801
1059
  }
802
1060
  );
803
- if (T.type === "error")
804
- return n((w) => [
805
- ...w.filter((x) => x.taskKey !== u),
1061
+ if (C.type === "error")
1062
+ return t((M) => [
1063
+ ...M.filter((w) => w.taskKey !== p),
806
1064
  {
807
- taskKey: u,
1065
+ taskKey: p,
808
1066
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
809
- streamId: h.stream.id,
810
- params: c,
811
- error: T.error,
1067
+ streamId: f.stream.id,
1068
+ params: d,
1069
+ error: C.error,
812
1070
  progressItems: [],
813
1071
  loading: !1,
814
- loadingText: d == null ? void 0 : d.loadingText,
1072
+ loadingText: u == null ? void 0 : u.loadingText,
815
1073
  confirmedData: null
816
1074
  }
817
1075
  ]), {
818
1076
  type: "error",
819
- error: T.error
1077
+ error: C.error
820
1078
  };
821
1079
  {
822
- const w = {
1080
+ const M = {
823
1081
  message: "No response received",
824
1082
  code: "UnknownError"
825
1083
  };
826
- return n((x) => [
827
- ...x.filter((D) => D.taskKey !== u),
1084
+ return t((w) => [
1085
+ ...w.filter((k) => k.taskKey !== p),
828
1086
  {
829
- taskKey: u,
1087
+ taskKey: p,
830
1088
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
831
- streamId: h.stream.id,
832
- error: w,
833
- params: c,
1089
+ streamId: f.stream.id,
1090
+ error: M,
1091
+ params: d,
834
1092
  progressItems: [],
835
1093
  loading: !1,
836
- loadingText: d == null ? void 0 : d.loadingText,
1094
+ loadingText: u == null ? void 0 : u.loadingText,
837
1095
  confirmedData: null
838
1096
  }
839
1097
  ]), {
840
1098
  type: "error",
841
- error: w
1099
+ error: M
842
1100
  };
843
1101
  }
844
1102
  } catch (v) {
845
- const T = {
1103
+ const C = {
846
1104
  code: "UnknownError",
847
1105
  message: v instanceof Error ? v.message : "Unknown error during agent task creation"
848
1106
  };
849
- return n((w) => [
850
- ...w.filter((x) => x.taskKey !== u),
1107
+ return t((M) => [
1108
+ ...M.filter((w) => w.taskKey !== p),
851
1109
  {
852
- taskKey: u,
1110
+ taskKey: p,
853
1111
  triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
854
- streamId: h.stream.id,
855
- params: c,
856
- error: T,
1112
+ streamId: f.stream.id,
1113
+ params: d,
1114
+ error: C,
857
1115
  progressItems: [],
858
1116
  loading: !1,
859
- loadingText: d == null ? void 0 : d.loadingText,
1117
+ loadingText: u == null ? void 0 : u.loadingText,
860
1118
  confirmedData: null
861
1119
  }
862
1120
  ]), {
863
1121
  type: "error",
864
- error: T
1122
+ error: C
865
1123
  };
866
1124
  }
867
1125
  } else
868
- return console.error(h.error), h;
1126
+ return console.error(f.error), f;
869
1127
  },
870
1128
  [
871
1129
  r,
872
- s,
1130
+ c,
873
1131
  e.fetchCreateAgentTaskClientToken,
874
- a
1132
+ s
875
1133
  ]
876
- ), p = P(() => {
877
- if (t.length !== 0)
878
- return [...t].sort((c, d) => new Date(d.triggeredAt).getTime() - new Date(c.triggeredAt).getTime())[0];
879
- }, [t]);
880
- return F(() => () => {
1134
+ ), y = z(() => {
1135
+ if (n.length !== 0)
1136
+ return [...n].sort((d, u) => new Date(u.triggeredAt).getTime() - new Date(d.triggeredAt).getTime())[0];
1137
+ }, [n]);
1138
+ return P(() => () => {
881
1139
  i.current.clear(), l.current.clear();
882
1140
  }, []), {
883
- agentTasks: t,
1141
+ agentTasks: n,
884
1142
  createAgentTask: m,
885
- latest: p
1143
+ latest: y
886
1144
  };
887
1145
  };
888
- function Ne(e) {
889
- return e.progressItems.map((r, t) => {
890
- const n = e.progressItems[t + 1], i = n != null;
1146
+ function kr(e) {
1147
+ return e.progressItems.map((r, n) => {
1148
+ const t = e.progressItems[n + 1], i = t != null;
891
1149
  let l;
892
- if (n != null && n.createdAt) {
893
- const a = new Date(r.createdAt).getTime(), s = new Date(n.createdAt).getTime();
894
- l = Math.round((s - a) / 1e3);
1150
+ if (t != null && t.createdAt) {
1151
+ const s = new Date(r.createdAt).getTime(), c = new Date(t.createdAt).getTime();
1152
+ l = Math.round((c - s) / 1e3);
895
1153
  }
896
1154
  return {
897
1155
  item: r,
898
1156
  completed: i,
899
- isLatest: t === e.progressItems.length - 1,
1157
+ isLatest: n === e.progressItems.length - 1,
900
1158
  durationSeconds: l
901
1159
  };
902
1160
  });
903
1161
  }
904
- const ce = {
1162
+ const ge = {
905
1163
  'code[class*="language-"]': {
906
1164
  color: "#f8f8f2",
907
1165
  background: "none",
@@ -1052,57 +1310,61 @@ const ce = {
1052
1310
  italic: {
1053
1311
  fontStyle: "italic"
1054
1312
  }
1055
- }, ne = ({
1313
+ }, ie = ({
1056
1314
  text: e
1057
1315
  }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
1058
- C.div,
1316
+ I.div,
1059
1317
  {
1060
1318
  className: "fency-markdown-body-raw",
1061
1319
  initial: { opacity: 0, y: -10 },
1062
1320
  animate: { opacity: 1, y: 0 },
1063
1321
  transition: { duration: 0.3, delay: 0 },
1064
1322
  children: /* @__PURE__ */ o(
1065
- ke,
1323
+ Fe,
1066
1324
  {
1067
- remarkPlugins: [be],
1325
+ remarkPlugins: [Ae],
1068
1326
  components: {
1069
1327
  code(r) {
1070
- const { children: t, className: n, node: i, ref: l, ...a } = r, s = /language-(\w+)/.exec(n || "");
1071
- return s ? (
1328
+ const { children: n, className: t, node: i, ref: l, ...s } = r, c = /language-(\w+)/.exec(t || "");
1329
+ return c ? (
1072
1330
  // @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
1073
1331
  /* @__PURE__ */ o(
1074
- ae,
1332
+ ue,
1075
1333
  {
1076
- ...a,
1334
+ ...s,
1077
1335
  PreTag: "div",
1078
- children: String(t).replace(/\n$/, ""),
1079
- language: s[1],
1080
- style: ce
1336
+ children: String(n).replace(/\n$/, ""),
1337
+ language: c[1],
1338
+ style: ge
1081
1339
  }
1082
1340
  )
1083
- ) : /* @__PURE__ */ o("code", { ...a, className: n, children: String(t) });
1341
+ ) : /* @__PURE__ */ o("code", { ...s, className: t, children: String(n) });
1084
1342
  }
1085
1343
  },
1086
1344
  children: e
1087
1345
  }
1088
1346
  )
1089
1347
  }
1090
- ) }), He = ({ data: e }) => {
1091
- const r = JSON.stringify(
1092
- JSON.parse(e.response.jsonResponse),
1093
- null,
1094
- 2
1095
- );
1348
+ ) }), vr = ({ data: e }) => {
1349
+ const r = e.response.jsonResponse;
1350
+ let n;
1351
+ try {
1352
+ n = JSON.stringify(JSON.parse(r), null, 2);
1353
+ } catch {
1354
+ console.warn(
1355
+ "[fency] StructuredChatCompletion jsonResponse is not valid JSON; showing raw string"
1356
+ ), n = r;
1357
+ }
1096
1358
  return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
1097
- C.div,
1359
+ I.div,
1098
1360
  {
1099
1361
  initial: { opacity: 0, y: -10 },
1100
1362
  animate: { opacity: 1, y: 0 },
1101
1363
  transition: { duration: 0.3, delay: 0 },
1102
- children: /* @__PURE__ */ o(ae, { language: "json", style: ce, PreTag: "div", children: r })
1364
+ children: /* @__PURE__ */ o(ue, { language: "json", style: ge, PreTag: "div", children: n })
1103
1365
  }
1104
1366
  ) });
1105
- }, Ge = {
1367
+ }, Cr = {
1106
1368
  en: {
1107
1369
  error: "Error",
1108
1370
  streaming: "Streaming...",
@@ -1173,7 +1435,12 @@ const ce = {
1173
1435
  scrapedPage: "Scraped 1 page",
1174
1436
  scrapeFailedSuffix: " — {n} failed",
1175
1437
  scrapeOkCount: "{n} ok",
1176
- scrapeFailedCount: "{n} failed"
1438
+ scrapeFailedCount: "{n} failed",
1439
+ memoryChatThinking: "Thinking...",
1440
+ scrapeStatusDownloading: "Downloading…",
1441
+ scrapeStatusDownloaded: "Downloaded",
1442
+ scrapeStatusAnalyzing: "Analyzing document…",
1443
+ scrapeStatusSummarizing: "Summarizing…"
1177
1444
  },
1178
1445
  no: {
1179
1446
  error: "Feil",
@@ -1245,46 +1512,51 @@ const ce = {
1245
1512
  scrapedPage: "Skrapet 1 side",
1246
1513
  scrapeFailedSuffix: " — {n} feilet",
1247
1514
  scrapeOkCount: "{n} ok",
1248
- scrapeFailedCount: "{n} feilet"
1515
+ scrapeFailedCount: "{n} feilet",
1516
+ memoryChatThinking: "Tenker…",
1517
+ scrapeStatusDownloading: "Laster ned…",
1518
+ scrapeStatusDownloaded: "Nedlastet",
1519
+ scrapeStatusAnalyzing: "Analyserer dokumentet…",
1520
+ scrapeStatusSummarizing: "Oppsummerer…"
1249
1521
  }
1250
1522
  };
1251
- function Ue(e) {
1252
- return Ge[e];
1523
+ function wr(e) {
1524
+ return Cr[e];
1253
1525
  }
1254
- function S(e, r) {
1526
+ function T(e, r) {
1255
1527
  return Object.entries(r).reduce(
1256
- (t, [n, i]) => t.replace(`{${n}}`, String(i)),
1528
+ (n, [t, i]) => n.replace(`{${t}}`, String(i)),
1257
1529
  e
1258
1530
  );
1259
1531
  }
1260
- function q(e, r) {
1261
- const t = e.map((n) => `'${n}'`);
1262
- if (r != null && t.length >= 2) {
1263
- const n = t.pop();
1264
- return t.length > 0 ? `${t.join(", ")} ${r} ${n}` : n;
1532
+ function K(e, r) {
1533
+ const n = e.map((t) => `'${t}'`);
1534
+ if (r != null && n.length >= 2) {
1535
+ const t = n.pop();
1536
+ return n.length > 0 ? `${n.join(", ")} ${r} ${t}` : t;
1265
1537
  }
1266
- return t.join(", ");
1538
+ return n.join(", ");
1267
1539
  }
1268
- function M({
1540
+ function R({
1269
1541
  text: e,
1270
1542
  duration: r = 2,
1271
- delay: t = 0,
1272
- repeat: n = !0,
1543
+ delay: n = 0,
1544
+ repeat: t = !0,
1273
1545
  repeatDelay: i = 0.5,
1274
1546
  className: l,
1275
- startOnView: a = !1,
1276
- once: s = !1,
1547
+ startOnView: s = !1,
1548
+ once: c = !1,
1277
1549
  inViewMargin: m,
1278
- spread: p = 2,
1279
- color: c = "#999",
1280
- shimmerColor: d = "#000",
1281
- direction: u = "fromBottom"
1550
+ spread: y = 2,
1551
+ color: d = "#999",
1552
+ shimmerColor: u = "#000",
1553
+ direction: p = "fromBottom"
1282
1554
  }) {
1283
- const g = A(null), h = Se(g, { once: s, margin: m }), f = P(() => e.length * p, [e, p]), k = !a || h, b = u === "fromBottom" ? "100% center" : "-100% center", v = u === "fromBottom" ? "0% center" : "200% center";
1555
+ const h = D(null), f = Me(h, { once: c, margin: m }), S = z(() => e.length * y, [e, y]), x = !s || f, b = p === "fromBottom" ? "100% center" : "-100% center", v = p === "fromBottom" ? "0% center" : "200% center";
1284
1556
  return /* @__PURE__ */ o(
1285
- C.span,
1557
+ I.span,
1286
1558
  {
1287
- ref: g,
1559
+ ref: h,
1288
1560
  className: l,
1289
1561
  style: {
1290
1562
  position: "relative",
@@ -1295,9 +1567,9 @@ function M({
1295
1567
  color: "transparent",
1296
1568
  WebkitTextFillColor: "transparent",
1297
1569
  backgroundRepeat: "no-repeat, padding-box",
1298
- "--spread": `${f}px`,
1299
- "--base-color": c,
1300
- "--shimmer-color": d,
1570
+ "--spread": `${S}px`,
1571
+ "--base-color": d,
1572
+ "--shimmer-color": u,
1301
1573
  "--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
1302
1574
  backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
1303
1575
  },
@@ -1305,60 +1577,60 @@ function M({
1305
1577
  backgroundPosition: b,
1306
1578
  opacity: 0
1307
1579
  },
1308
- animate: k ? {
1580
+ animate: x ? {
1309
1581
  backgroundPosition: v,
1310
1582
  opacity: 1
1311
1583
  } : {},
1312
1584
  transition: {
1313
1585
  backgroundPosition: {
1314
- repeat: n ? 1 / 0 : 0,
1586
+ repeat: t ? 1 / 0 : 0,
1315
1587
  duration: r,
1316
- delay: t,
1588
+ delay: n,
1317
1589
  repeatDelay: i,
1318
1590
  ease: "linear"
1319
1591
  },
1320
1592
  opacity: {
1321
1593
  duration: 0.3,
1322
- delay: t
1594
+ delay: n
1323
1595
  }
1324
1596
  },
1325
1597
  children: e
1326
1598
  }
1327
1599
  );
1328
1600
  }
1329
- const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1330
- const [i, l] = I(!1), s = (e.memories ?? []).map((k) => k.memoryTitle), m = s.length > 0, p = m && s.length > G, c = p && !i ? s.slice(0, G) : s, d = s.length - G, u = !p || i, g = `${n.searchingFor}'${e.queryDescription}'`, h = m ? `${n.searchingIn}${q(
1331
- c,
1332
- u ? n.and : void 0
1333
- )}` : "", f = m ? `${g}${h}` : `${n.searchingPrefix}${e.queryDescription}`;
1334
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1601
+ const _ = 5, Ir = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1602
+ const [i, l] = E(!1), c = (e.memories ?? []).map((x) => x.memoryTitle), m = c.length > 0, y = m && c.length > _, d = y && !i ? c.slice(0, _) : c, u = c.length - _, p = !y || i, h = `${t.searchingFor}'${e.queryDescription}'`, f = m ? `${t.searchingIn}${K(
1603
+ d,
1604
+ p ? t.and : void 0
1605
+ )}` : "", S = m ? `${h}${f}` : `${t.searchingPrefix}${e.queryDescription}`;
1606
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1335
1607
  /* @__PURE__ */ o(
1336
- C.div,
1608
+ I.div,
1337
1609
  {
1338
1610
  style: { color: "#666" },
1339
1611
  initial: { opacity: 0, y: -10 },
1340
1612
  animate: { opacity: 1, y: 0 },
1341
1613
  transition: { duration: 0.3, delay: 0 },
1342
- children: r && !t && !p ? /* @__PURE__ */ o(
1343
- M,
1614
+ children: r && !n && !y ? /* @__PURE__ */ o(
1615
+ R,
1344
1616
  {
1345
- text: f,
1617
+ text: S,
1346
1618
  duration: 2.5,
1347
1619
  repeat: !0,
1348
1620
  color: "#999",
1349
1621
  shimmerColor: "#000"
1350
1622
  }
1351
- ) : /* @__PURE__ */ y(E, { children: [
1352
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ y(E, { children: [
1353
- n.searchingFor,
1354
- /* @__PURE__ */ y("span", { style: { fontWeight: 600 }, children: [
1623
+ ) : /* @__PURE__ */ g(F, { children: [
1624
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ g(F, { children: [
1625
+ t.searchingFor,
1626
+ /* @__PURE__ */ g("span", { style: { fontWeight: 600 }, children: [
1355
1627
  "'",
1356
1628
  e.queryDescription,
1357
1629
  "'"
1358
1630
  ] }),
1359
- h
1360
- ] }) : `${n.searchingPrefix}${e.queryDescription}` }),
1361
- p && !i && /* @__PURE__ */ y(E, { children: [
1631
+ f
1632
+ ] }) : `${t.searchingPrefix}${e.queryDescription}` }),
1633
+ y && !i && /* @__PURE__ */ g(F, { children: [
1362
1634
  " ",
1363
1635
  /* @__PURE__ */ o(
1364
1636
  "button",
@@ -1376,13 +1648,13 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1376
1648
  textDecoration: "underline",
1377
1649
  fontFamily: "inherit"
1378
1650
  },
1379
- children: S(n.moreMemories, {
1380
- n: d
1651
+ children: T(t.moreMemories, {
1652
+ n: u
1381
1653
  })
1382
1654
  }
1383
1655
  )
1384
1656
  ] }),
1385
- p && i && /* @__PURE__ */ y(E, { children: [
1657
+ y && i && /* @__PURE__ */ g(F, { children: [
1386
1658
  " ",
1387
1659
  /* @__PURE__ */ o(
1388
1660
  "button",
@@ -1400,14 +1672,14 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1400
1672
  textDecoration: "underline",
1401
1673
  fontFamily: "inherit"
1402
1674
  },
1403
- children: n.clickToCollapse
1675
+ children: t.clickToCollapse
1404
1676
  }
1405
1677
  )
1406
1678
  ] })
1407
1679
  ] })
1408
1680
  }
1409
1681
  ),
1410
- t !== void 0 && /* @__PURE__ */ o(
1682
+ n !== void 0 && /* @__PURE__ */ o(
1411
1683
  "div",
1412
1684
  {
1413
1685
  style: {
@@ -1416,18 +1688,18 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1416
1688
  marginTop: "4px",
1417
1689
  fontStyle: "italic"
1418
1690
  },
1419
- children: S(n.tookSeconds, { n: t })
1691
+ children: T(t.tookSeconds, { n })
1420
1692
  }
1421
1693
  )
1422
1694
  ] });
1423
- }, U = 5, je = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1424
- const [i, l] = I(!1), a = e.titles, s = a.length > 0, m = s && a.length > U, p = m && !i ? a.slice(0, U) : a, c = a.length - U, d = !m || i, u = s ? `${n.findingMemoriesIn}${q(
1425
- p,
1426
- d ? n.and : void 0
1427
- )}` : n.findingMemories;
1428
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1695
+ }, G = 5, Er = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
1696
+ const [i, l] = E(!1), s = e.titles, c = s.length > 0, m = c && s.length > G, y = m && !i ? s.slice(0, G) : s, d = s.length - G, u = !m || i, p = c ? `${t.findingMemoriesIn}${K(
1697
+ y,
1698
+ u ? t.and : void 0
1699
+ )}` : t.findingMemories;
1700
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1429
1701
  /* @__PURE__ */ o(
1430
- C.div,
1702
+ I.div,
1431
1703
  {
1432
1704
  style: {
1433
1705
  color: "#666"
@@ -1435,18 +1707,18 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1435
1707
  initial: { opacity: 0, y: -10 },
1436
1708
  animate: { opacity: 1, y: 0 },
1437
1709
  transition: { duration: 0.3, delay: 0 },
1438
- children: r && !t && !m ? /* @__PURE__ */ o(
1439
- M,
1710
+ children: r && !n && !m ? /* @__PURE__ */ o(
1711
+ R,
1440
1712
  {
1441
- text: u,
1713
+ text: p,
1442
1714
  duration: 2.5,
1443
1715
  repeat: !0,
1444
1716
  color: "#999",
1445
1717
  shimmerColor: "#000"
1446
1718
  }
1447
- ) : /* @__PURE__ */ y(E, { children: [
1448
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
1449
- m && !i && /* @__PURE__ */ y(E, { children: [
1719
+ ) : /* @__PURE__ */ g(F, { children: [
1720
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: p }),
1721
+ m && !i && /* @__PURE__ */ g(F, { children: [
1450
1722
  " ",
1451
1723
  /* @__PURE__ */ o(
1452
1724
  "button",
@@ -1464,13 +1736,13 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1464
1736
  textDecoration: "underline",
1465
1737
  fontFamily: "inherit"
1466
1738
  },
1467
- children: S(n.moreMemories, {
1468
- n: c
1739
+ children: T(t.moreMemories, {
1740
+ n: d
1469
1741
  })
1470
1742
  }
1471
1743
  )
1472
1744
  ] }),
1473
- m && i && /* @__PURE__ */ y(E, { children: [
1745
+ m && i && /* @__PURE__ */ g(F, { children: [
1474
1746
  " ",
1475
1747
  /* @__PURE__ */ o(
1476
1748
  "button",
@@ -1488,14 +1760,14 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1488
1760
  textDecoration: "underline",
1489
1761
  fontFamily: "inherit"
1490
1762
  },
1491
- children: n.clickToCollapse
1763
+ children: t.clickToCollapse
1492
1764
  }
1493
1765
  )
1494
1766
  ] })
1495
1767
  ] })
1496
1768
  }
1497
1769
  ),
1498
- t !== void 0 && /* @__PURE__ */ o(
1770
+ n !== void 0 && /* @__PURE__ */ o(
1499
1771
  "div",
1500
1772
  {
1501
1773
  style: {
@@ -1504,31 +1776,31 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1504
1776
  marginTop: "4px",
1505
1777
  fontStyle: "italic"
1506
1778
  },
1507
- children: S(n.tookSeconds, { n: t })
1779
+ children: T(t.tookSeconds, { n })
1508
1780
  }
1509
1781
  )
1510
1782
  ] });
1511
- }, _ = 5, qe = ({ data: e, t: r }) => {
1512
- const [t, n] = I(!1), l = e.memories.map((g) => g.memoryTitle), a = l.length > 0, s = a && l.length > _, m = s && !t ? l.slice(0, _) : l, p = l.length - _, c = !s || t, d = l.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, u = a ? `${d}${q(
1783
+ }, q = 5, Mr = ({ data: e, t: r }) => {
1784
+ const [n, t] = E(!1), l = e.memories.map((h) => h.memoryTitle), s = l.length > 0, c = s && l.length > q, m = c && !n ? l.slice(0, q) : l, y = l.length - q, d = !c || n, u = l.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, p = s ? `${u}${K(
1513
1785
  m,
1514
- c ? r.and : void 0
1786
+ d ? r.and : void 0
1515
1787
  )}` : r.memoriesFound;
1516
1788
  return /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
1517
- C.div,
1789
+ I.div,
1518
1790
  {
1519
1791
  style: { color: "#666" },
1520
1792
  initial: { opacity: 0, y: -10 },
1521
1793
  animate: { opacity: 1, y: 0 },
1522
1794
  transition: { duration: 0.3, delay: 0 },
1523
- children: /* @__PURE__ */ y(E, { children: [
1524
- /* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
1525
- s && !t && /* @__PURE__ */ y(E, { children: [
1795
+ children: /* @__PURE__ */ g(F, { children: [
1796
+ /* @__PURE__ */ o("span", { style: { color: "#666" }, children: p }),
1797
+ c && !n && /* @__PURE__ */ g(F, { children: [
1526
1798
  " ",
1527
1799
  /* @__PURE__ */ o(
1528
1800
  "button",
1529
1801
  {
1530
1802
  type: "button",
1531
- onClick: () => n(!0),
1803
+ onClick: () => t(!0),
1532
1804
  style: {
1533
1805
  background: "none",
1534
1806
  border: "none",
@@ -1540,19 +1812,19 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1540
1812
  textDecoration: "underline",
1541
1813
  fontFamily: "inherit"
1542
1814
  },
1543
- children: S(r.moreMemories, {
1544
- n: p
1815
+ children: T(r.moreMemories, {
1816
+ n: y
1545
1817
  })
1546
1818
  }
1547
1819
  )
1548
1820
  ] }),
1549
- s && t && /* @__PURE__ */ y(E, { children: [
1821
+ c && n && /* @__PURE__ */ g(F, { children: [
1550
1822
  " ",
1551
1823
  /* @__PURE__ */ o(
1552
1824
  "button",
1553
1825
  {
1554
1826
  type: "button",
1555
- onClick: () => n(!1),
1827
+ onClick: () => t(!1),
1556
1828
  style: {
1557
1829
  background: "none",
1558
1830
  border: "none",
@@ -1571,11 +1843,11 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1571
1843
  ] })
1572
1844
  }
1573
1845
  ) });
1574
- }, Qe = ({ isLatest: e = !1, durationSeconds: r, t }) => {
1575
- const n = t.addingSources;
1576
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1846
+ }, Rr = ({ isLatest: e = !1, durationSeconds: r, t: n }) => {
1847
+ const t = n.addingSources;
1848
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1577
1849
  /* @__PURE__ */ o(
1578
- C.div,
1850
+ I.div,
1579
1851
  {
1580
1852
  style: {
1581
1853
  display: "flex",
@@ -1587,15 +1859,15 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1587
1859
  animate: { opacity: 1, y: 0 },
1588
1860
  transition: { duration: 0.3, delay: 0 },
1589
1861
  children: e && !r ? /* @__PURE__ */ o(
1590
- M,
1862
+ R,
1591
1863
  {
1592
- text: n,
1864
+ text: t,
1593
1865
  duration: 2.5,
1594
1866
  repeat: !0,
1595
1867
  color: "#999",
1596
1868
  shimmerColor: "#000"
1597
1869
  }
1598
- ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: n })
1870
+ ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: t })
1599
1871
  }
1600
1872
  ),
1601
1873
  r !== void 0 && /* @__PURE__ */ o(
@@ -1607,28 +1879,28 @@ const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
1607
1879
  marginTop: "4px",
1608
1880
  fontStyle: "italic"
1609
1881
  },
1610
- children: S(t.tookSeconds, { n: r })
1882
+ children: T(n.tookSeconds, { n: r })
1611
1883
  }
1612
1884
  )
1613
1885
  ] });
1614
1886
  };
1615
- function Ke(e, r) {
1887
+ function Fr(e, r) {
1616
1888
  if (e.length === 0) return "";
1617
1889
  if (e.length === 1)
1618
- return S(r.pageSingle, { n: e[0] });
1890
+ return T(r.pageSingle, { n: e[0] });
1619
1891
  if (e.length === 2)
1620
- return S(r.pageTwo, {
1892
+ return T(r.pageTwo, {
1621
1893
  a: e[0],
1622
1894
  b: e[1]
1623
1895
  });
1624
- const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1625
- return S(r.pageMultiple, { list: n, n: t });
1896
+ const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
1897
+ return T(r.pageMultiple, { list: t, n });
1626
1898
  }
1627
- const Ve = ({ data: e, onSourceClick: r, t }) => {
1628
- const [n, i] = I(null);
1629
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
1899
+ const Ar = ({ data: e, onSourceClick: r, t: n }) => {
1900
+ const [t, i] = E(null);
1901
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
1630
1902
  /* @__PURE__ */ o(
1631
- C.div,
1903
+ I.div,
1632
1904
  {
1633
1905
  style: {
1634
1906
  marginBottom: "10px",
@@ -1641,54 +1913,54 @@ const Ve = ({ data: e, onSourceClick: r, t }) => {
1641
1913
  initial: { opacity: 0, y: -10 },
1642
1914
  animate: { opacity: 1, y: 0 },
1643
1915
  transition: { duration: 0.3, delay: 0 },
1644
- children: t.sources
1916
+ children: n.sources
1645
1917
  }
1646
1918
  ),
1647
- /* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((l, a) => /* @__PURE__ */ o(
1648
- Xe,
1919
+ /* @__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((l, s) => /* @__PURE__ */ o(
1920
+ Pr,
1649
1921
  {
1650
1922
  source: l,
1651
- index: a,
1652
- loadingMemoryId: n,
1923
+ index: s,
1924
+ loadingMemoryId: t,
1653
1925
  setLoadingMemoryId: i,
1654
1926
  onSourceClick: r,
1655
- t
1927
+ t: n
1656
1928
  },
1657
1929
  l.memoryId
1658
1930
  )) })
1659
1931
  ] });
1660
- }, Xe = ({
1932
+ }, Pr = ({
1661
1933
  source: e,
1662
1934
  index: r,
1663
- loadingMemoryId: t,
1664
- setLoadingMemoryId: n,
1935
+ loadingMemoryId: n,
1936
+ setLoadingMemoryId: t,
1665
1937
  onSourceClick: i,
1666
1938
  t: l
1667
1939
  }) => {
1668
- const [a, s] = I(!1), m = !!i, p = t === e.memoryId, c = e.pageNumbers ?? [], d = Ke(c, l);
1669
- return /* @__PURE__ */ y(
1670
- C.div,
1940
+ const [s, c] = E(!1), m = !!i, y = n === e.memoryId, d = e.pageNumbers ?? [], u = Fr(d, l);
1941
+ return /* @__PURE__ */ g(
1942
+ I.div,
1671
1943
  {
1672
- "aria-busy": p,
1944
+ "aria-busy": y,
1673
1945
  initial: { opacity: 0, scale: 0.9 },
1674
1946
  animate: { opacity: 1, scale: 1 },
1675
1947
  transition: { duration: 0.25, delay: r * 0.05 },
1676
- onClick: m && !p ? async () => {
1677
- n(e.memoryId);
1948
+ onClick: m && !y ? async () => {
1949
+ t(e.memoryId);
1678
1950
  try {
1679
1951
  await i({
1680
1952
  memoryId: e.memoryId,
1681
1953
  memoryTitle: e.memoryTitle,
1682
1954
  memoryTypeId: e.memoryTypeId,
1683
1955
  memoryTypeName: e.memoryTypeName,
1684
- pageNumbers: [...c]
1956
+ pageNumbers: [...d]
1685
1957
  });
1686
1958
  } finally {
1687
- n(null);
1959
+ t(null);
1688
1960
  }
1689
1961
  } : void 0,
1690
- onMouseEnter: m && !p ? () => s(!0) : void 0,
1691
- onMouseLeave: m && !p ? () => s(!1) : void 0,
1962
+ onMouseEnter: m && !y ? () => c(!0) : void 0,
1963
+ onMouseLeave: m && !y ? () => c(!1) : void 0,
1692
1964
  style: {
1693
1965
  display: "inline-flex",
1694
1966
  flexDirection: "column",
@@ -1696,14 +1968,14 @@ const Ve = ({ data: e, onSourceClick: r, t }) => {
1696
1968
  padding: "8px 12px",
1697
1969
  borderRadius: "6px",
1698
1970
  border: "1px solid #e0e0e0",
1699
- backgroundColor: a ? "#f5f5f5" : "transparent",
1700
- cursor: m && !p ? "pointer" : p ? "wait" : "default",
1971
+ backgroundColor: s ? "#f5f5f5" : "transparent",
1972
+ cursor: m && !y ? "pointer" : y ? "wait" : "default",
1701
1973
  transition: "background-color 0.15s ease",
1702
1974
  userSelect: "none",
1703
- pointerEvents: p ? "none" : void 0
1975
+ pointerEvents: y ? "none" : void 0
1704
1976
  },
1705
1977
  children: [
1706
- /* @__PURE__ */ y(
1978
+ /* @__PURE__ */ g(
1707
1979
  "span",
1708
1980
  {
1709
1981
  style: {
@@ -1715,7 +1987,7 @@ const Ve = ({ data: e, onSourceClick: r, t }) => {
1715
1987
  gap: 8
1716
1988
  },
1717
1989
  children: [
1718
- p && /* @__PURE__ */ o(
1990
+ y && /* @__PURE__ */ o(
1719
1991
  "span",
1720
1992
  {
1721
1993
  className: "explore-memory-loader explore-memory-loader--callback",
@@ -1726,16 +1998,16 @@ const Ve = ({ data: e, onSourceClick: r, t }) => {
1726
1998
  ]
1727
1999
  }
1728
2000
  ),
1729
- d && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: d })
2001
+ u && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: u })
1730
2002
  ]
1731
2003
  }
1732
2004
  );
1733
2005
  }, L = ({
1734
2006
  color: e = "#78b13f",
1735
2007
  size: r = 24,
1736
- borderWidth: t = 7
2008
+ borderWidth: n = 7
1737
2009
  }) => {
1738
- const n = r * 0.5;
2010
+ const t = r * 0.5;
1739
2011
  return /* @__PURE__ */ o(
1740
2012
  "span",
1741
2013
  {
@@ -1743,26 +2015,26 @@ const Ve = ({ data: e, onSourceClick: r, t }) => {
1743
2015
  display: "inline-block",
1744
2016
  transform: "rotate(45deg)",
1745
2017
  height: r,
1746
- width: n,
1747
- borderBottom: `${t}px solid ${e}`,
1748
- borderRight: `${t}px solid ${e}`
2018
+ width: t,
2019
+ borderBottom: `${n}px solid ${e}`,
2020
+ borderRight: `${n}px solid ${e}`
1749
2021
  }
1750
2022
  }
1751
2023
  );
1752
- }, H = ({
2024
+ }, j = ({
1753
2025
  color: e = "#333",
1754
2026
  size: r = 32,
1755
- lineWidth: t = 2
2027
+ lineWidth: n = 2
1756
2028
  }) => {
1757
- const n = r + 1, i = (r - t) / 2, l = (r - n) / 2, a = {
2029
+ const t = r + 1, i = (r - n) / 2, l = (r - t) / 2, s = {
1758
2030
  position: "absolute",
1759
2031
  left: i,
1760
2032
  top: l,
1761
- width: t,
1762
- height: n,
2033
+ width: n,
2034
+ height: t,
1763
2035
  backgroundColor: e
1764
2036
  };
1765
- return /* @__PURE__ */ y(
2037
+ return /* @__PURE__ */ g(
1766
2038
  "span",
1767
2039
  {
1768
2040
  style: {
@@ -1776,7 +2048,7 @@ const Ve = ({ data: e, onSourceClick: r, t }) => {
1776
2048
  "span",
1777
2049
  {
1778
2050
  style: {
1779
- ...a,
2051
+ ...s,
1780
2052
  transform: "rotate(45deg)"
1781
2053
  }
1782
2054
  }
@@ -1785,7 +2057,7 @@ const Ve = ({ data: e, onSourceClick: r, t }) => {
1785
2057
  "span",
1786
2058
  {
1787
2059
  style: {
1788
- ...a,
2060
+ ...s,
1789
2061
  transform: "rotate(-45deg)"
1790
2062
  }
1791
2063
  }
@@ -1794,26 +2066,26 @@ const Ve = ({ data: e, onSourceClick: r, t }) => {
1794
2066
  }
1795
2067
  );
1796
2068
  };
1797
- function Je({
2069
+ function Dr({
1798
2070
  memory: e,
1799
2071
  completed: r
1800
2072
  }) {
1801
- return e.error != null ? /* @__PURE__ */ o(H, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2073
+ return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
1802
2074
  }
1803
- const te = 80;
1804
- function Ye({
2075
+ const se = 80;
2076
+ function Lr({
1805
2077
  memory: e,
1806
2078
  completed: r,
1807
- t
2079
+ t: n
1808
2080
  }) {
1809
- const [n, i] = I(!1), l = e.result ?? e.error, a = l != null && l.length > te, s = l != null ? n || !a ? l : `${l.slice(0, te)}...` : void 0, m = a, p = e.error != null;
1810
- return /* @__PURE__ */ y(
1811
- C.div,
2081
+ const [t, i] = E(!1), l = e.result ?? e.error, s = l != null && l.length > se, c = l != null ? t || !s ? l : `${l.slice(0, se)}...` : void 0, m = s, y = e.error != null;
2082
+ return /* @__PURE__ */ g(
2083
+ I.div,
1812
2084
  {
1813
2085
  initial: { opacity: 0 },
1814
2086
  animate: { opacity: 1 },
1815
2087
  transition: { duration: 0.25 },
1816
- onClick: m ? () => i((c) => !c) : void 0,
2088
+ onClick: m ? () => i((d) => !d) : void 0,
1817
2089
  style: {
1818
2090
  paddingTop: "12px",
1819
2091
  paddingBottom: "12px",
@@ -1836,10 +2108,10 @@ function Ye({
1836
2108
  flexShrink: 0,
1837
2109
  width: 32
1838
2110
  },
1839
- children: /* @__PURE__ */ o(Je, { memory: e, completed: r })
2111
+ children: /* @__PURE__ */ o(Dr, { memory: e, completed: r })
1840
2112
  }
1841
2113
  ),
1842
- /* @__PURE__ */ y(
2114
+ /* @__PURE__ */ g(
1843
2115
  "div",
1844
2116
  {
1845
2117
  style: {
@@ -1856,16 +2128,16 @@ function Ye({
1856
2128
  children: e.memoryTitle
1857
2129
  }
1858
2130
  ),
1859
- s != null && /* @__PURE__ */ o(
2131
+ c != null && /* @__PURE__ */ o(
1860
2132
  "span",
1861
2133
  {
1862
2134
  style: {
1863
2135
  fontSize: 12,
1864
- color: p ? "#c62828" : "#666",
2136
+ color: y ? "#c62828" : "#666",
1865
2137
  lineHeight: 1.4,
1866
- whiteSpace: n ? "pre-wrap" : void 0
2138
+ whiteSpace: t ? "pre-wrap" : void 0
1867
2139
  },
1868
- children: s
2140
+ children: c
1869
2141
  }
1870
2142
  ),
1871
2143
  m && /* @__PURE__ */ o(
@@ -1876,7 +2148,7 @@ function Ye({
1876
2148
  color: "#999",
1877
2149
  marginTop: 2
1878
2150
  },
1879
- children: n ? t.clickToCollapse : t.clickToExpand
2151
+ children: t ? n.clickToCollapse : n.clickToExpand
1880
2152
  }
1881
2153
  )
1882
2154
  ]
@@ -1886,102 +2158,102 @@ function Ye({
1886
2158
  }
1887
2159
  );
1888
2160
  }
1889
- const Ze = ({ data: e, completed: r, t }) => /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ o(
1890
- Ye,
2161
+ const zr = ({ data: e, completed: r, t: n }) => /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: e.memories.map((t) => /* @__PURE__ */ o(
2162
+ Lr,
1891
2163
  {
1892
- memory: n,
2164
+ memory: t,
1893
2165
  completed: r,
1894
- t
2166
+ t: n
1895
2167
  },
1896
- n.memoryId
2168
+ t.memoryId
1897
2169
  )) });
1898
- function er(e, r) {
1899
- const t = Math.min(e.length, r.length);
1900
- for (let n = t; n >= 0; n--)
1901
- if (e.slice(-n) === r.slice(0, n)) return n;
2170
+ function Wr(e, r) {
2171
+ const n = Math.min(e.length, r.length);
2172
+ for (let t = n; t >= 0; t--)
2173
+ if (e.slice(-t) === r.slice(0, t)) return t;
1902
2174
  return 0;
1903
2175
  }
1904
- const rr = `
2176
+ const Nr = `
1905
2177
 
1906
2178
  `;
1907
- function Q(e) {
1908
- var t, n;
2179
+ function X(e) {
2180
+ var n, t;
1909
2181
  if (e.length === 0) return "";
1910
- let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
2182
+ let r = ((n = e[0]) == null ? void 0 : n.content) ?? "";
1911
2183
  for (let i = 1; i < e.length; i++) {
1912
- const l = ((n = e[i]) == null ? void 0 : n.content) ?? "";
2184
+ const l = ((t = e[i]) == null ? void 0 : t.content) ?? "";
1913
2185
  if (l === "") continue;
1914
2186
  if (r === "") {
1915
2187
  r = l;
1916
2188
  continue;
1917
2189
  }
1918
- const a = er(r, l);
1919
- a === 0 ? r += rr + l : r += l.slice(a);
2190
+ const s = Wr(r, l);
2191
+ s === 0 ? r += Nr + l : r += l.slice(s);
1920
2192
  }
1921
2193
  return r;
1922
2194
  }
1923
- function K(e, r) {
2195
+ function V(e, r) {
1924
2196
  if (e.length === 0) return "";
1925
2197
  if (e.length === 1)
1926
- return S(r.memorySearchPagesSingle, {
2198
+ return T(r.memorySearchPagesSingle, {
1927
2199
  n: e[0]
1928
2200
  });
1929
2201
  if (e.length === 2)
1930
- return S(r.memorySearchPagesTwo, {
2202
+ return T(r.memorySearchPagesTwo, {
1931
2203
  a: e[0],
1932
2204
  b: e[1]
1933
2205
  });
1934
- const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
1935
- return S(r.memorySearchPagesMultiple, {
1936
- list: n,
1937
- n: t
2206
+ const n = e[e.length - 1], t = e.slice(0, -1).join(", ");
2207
+ return T(r.memorySearchPagesMultiple, {
2208
+ list: t,
2209
+ n
1938
2210
  });
1939
2211
  }
1940
- function V(e) {
2212
+ function Y(e) {
1941
2213
  const r = /* @__PURE__ */ new Set();
1942
- for (const t of e)
1943
- for (const n of t.pageNumbers) r.add(n);
1944
- return [...r].sort((t, n) => t - n);
2214
+ for (const n of e)
2215
+ for (const t of n.pageNumbers) r.add(t);
2216
+ return [...r].sort((n, t) => n - t);
1945
2217
  }
1946
- function X(e) {
2218
+ function J(e) {
1947
2219
  const r = e.memoryTypeName.trim();
1948
2220
  if (r !== "") return r;
1949
2221
  if (e.memoryTypeId !== "") return e.memoryTypeId;
1950
2222
  }
1951
- function de(e) {
2223
+ function fe(e) {
1952
2224
  return e.chunks.filter((r) => r.relation === "MATCH").length;
1953
2225
  }
1954
- function nr(e, r) {
1955
- let t = 0, n = 0;
1956
- for (const a of e)
1957
- t += de(a), a.matchingChunkScore > n && (n = a.matchingChunkScore);
1958
- const i = t === 1 ? r.chunkFound : S(r.chunksFound, { n: t }), l = S(r.scoreLabel, {
1959
- n: n.toFixed(2)
2226
+ function Or(e, r) {
2227
+ let n = 0, t = 0;
2228
+ for (const s of e)
2229
+ n += fe(s), s.matchingChunkScore > t && (t = s.matchingChunkScore);
2230
+ const i = n === 1 ? r.chunkFound : T(r.chunksFound, { n }), l = T(r.scoreLabel, {
2231
+ n: t.toFixed(2)
1960
2232
  });
1961
2233
  return `${i} - ${l}`;
1962
2234
  }
1963
- function tr(e) {
1964
- const r = [], t = /* @__PURE__ */ new Map();
1965
- return e.forEach((n, i) => {
1966
- let l = t.get(n.memoryId);
2235
+ function Br(e) {
2236
+ const r = [], n = /* @__PURE__ */ new Map();
2237
+ return e.forEach((t, i) => {
2238
+ let l = n.get(t.memoryId);
1967
2239
  if (l == null) {
1968
- r.push(n.memoryId);
1969
- const a = n.memoryTitle !== "" ? n.memoryTitle : n.memoryId;
2240
+ r.push(t.memoryId);
2241
+ const s = t.memoryTitle !== "" ? t.memoryTitle : t.memoryId;
1970
2242
  l = {
1971
- memoryId: n.memoryId,
1972
- memoryTitle: a,
2243
+ memoryId: t.memoryId,
2244
+ memoryTitle: s,
1973
2245
  items: []
1974
- }, t.set(n.memoryId, l);
2246
+ }, n.set(t.memoryId, l);
1975
2247
  }
1976
- l.items.push({ item: n, flatIndex: i });
1977
- }), r.map((n) => t.get(n));
2248
+ l.items.push({ item: t, flatIndex: i });
2249
+ }), r.map((t) => n.get(t));
1978
2250
  }
1979
- function or({
2251
+ function jr({
1980
2252
  items: e,
1981
2253
  onSearchResultClick: r,
1982
- t
2254
+ t: n
1983
2255
  }) {
1984
- const [n, i] = I(null), l = !!r;
2256
+ const [t, i] = E(null), l = !!r;
1985
2257
  return /* @__PURE__ */ o(
1986
2258
  "div",
1987
2259
  {
@@ -1993,25 +2265,25 @@ function or({
1993
2265
  paddingTop: 8,
1994
2266
  borderTop: "1px solid #f0f0f0"
1995
2267
  },
1996
- children: e.map((a, s) => {
1997
- const m = V(
1998
- a.chunks
1999
- ), p = [
2000
- X(a),
2001
- S(t.scoreLabel, {
2002
- n: a.matchingChunkScore.toFixed(2)
2268
+ children: e.map((s, c) => {
2269
+ const m = Y(
2270
+ s.chunks
2271
+ ), y = [
2272
+ J(s),
2273
+ T(n.scoreLabel, {
2274
+ n: s.matchingChunkScore.toFixed(2)
2003
2275
  }),
2004
- m.length > 0 ? K(m, t) : t.pagesNotAvailable
2276
+ m.length > 0 ? V(m, n) : n.pagesNotAvailable
2005
2277
  ].filter(
2006
- (g) => g != null && g !== ""
2007
- ), c = {
2008
- memoryId: a.memoryId,
2009
- memoryTitle: a.memoryTitle,
2010
- memoryTypeId: a.memoryTypeId,
2011
- memoryTypeName: a.memoryTypeName,
2278
+ (h) => h != null && h !== ""
2279
+ ), d = {
2280
+ memoryId: s.memoryId,
2281
+ memoryTitle: s.memoryTitle,
2282
+ memoryTypeId: s.memoryTypeId,
2283
+ memoryTypeName: s.memoryTypeName,
2012
2284
  pageNumbers: m
2013
- }, d = `${a.memoryId}-${s}`, u = n === d;
2014
- return /* @__PURE__ */ y(
2285
+ }, u = `${s.memoryId}-${c}`, p = t === u;
2286
+ return /* @__PURE__ */ g(
2015
2287
  "div",
2016
2288
  {
2017
2289
  style: {
@@ -2019,13 +2291,13 @@ function or({
2019
2291
  flexDirection: "row",
2020
2292
  alignItems: "flex-start",
2021
2293
  gap: "12px",
2022
- paddingTop: s > 0 ? 12 : 0,
2023
- paddingBottom: s < e.length - 1 ? 12 : 0,
2024
- borderBottom: s < e.length - 1 ? "1px solid #eee" : void 0,
2294
+ paddingTop: c > 0 ? 12 : 0,
2295
+ paddingBottom: c < e.length - 1 ? 12 : 0,
2296
+ borderBottom: c < e.length - 1 ? "1px solid #eee" : void 0,
2025
2297
  minWidth: 0
2026
2298
  },
2027
2299
  children: [
2028
- /* @__PURE__ */ y(
2300
+ /* @__PURE__ */ g(
2029
2301
  "div",
2030
2302
  {
2031
2303
  style: {
@@ -2046,7 +2318,7 @@ function or({
2046
2318
  whiteSpace: "pre-wrap",
2047
2319
  wordBreak: "break-word"
2048
2320
  },
2049
- children: Q(a.chunks)
2321
+ children: X(s.chunks)
2050
2322
  }
2051
2323
  ),
2052
2324
  /* @__PURE__ */ o(
@@ -2058,23 +2330,23 @@ function or({
2058
2330
  color: "#94a3b8",
2059
2331
  lineHeight: 1.35
2060
2332
  },
2061
- children: p.join(" · ")
2333
+ children: y.join(" · ")
2062
2334
  }
2063
2335
  )
2064
2336
  ]
2065
2337
  }
2066
2338
  ),
2067
- l && /* @__PURE__ */ y(
2339
+ l && /* @__PURE__ */ g(
2068
2340
  "button",
2069
2341
  {
2070
2342
  type: "button",
2071
- "aria-busy": u,
2072
- disabled: u,
2343
+ "aria-busy": p,
2344
+ disabled: p,
2073
2345
  onClick: async () => {
2074
- i(d);
2346
+ i(u);
2075
2347
  try {
2076
2348
  await r(
2077
- c
2349
+ d
2078
2350
  );
2079
2351
  } finally {
2080
2352
  i(null);
@@ -2090,42 +2362,42 @@ function or({
2090
2362
  background: "#eff6ff",
2091
2363
  border: "1px solid #bfdbfe",
2092
2364
  borderRadius: 6,
2093
- cursor: u ? "wait" : "pointer",
2365
+ cursor: p ? "wait" : "pointer",
2094
2366
  fontFamily: "inherit",
2095
2367
  display: "inline-flex",
2096
2368
  alignItems: "center",
2097
2369
  gap: 8
2098
2370
  },
2099
2371
  children: [
2100
- u && /* @__PURE__ */ o(
2372
+ p && /* @__PURE__ */ o(
2101
2373
  "span",
2102
2374
  {
2103
2375
  className: "explore-memory-loader explore-memory-loader--callback",
2104
2376
  "aria-hidden": !0
2105
2377
  }
2106
2378
  ),
2107
- t.viewButton
2379
+ n.viewButton
2108
2380
  ]
2109
2381
  }
2110
2382
  )
2111
2383
  ]
2112
2384
  },
2113
- d
2385
+ u
2114
2386
  );
2115
2387
  })
2116
2388
  }
2117
2389
  );
2118
2390
  }
2119
- function ir({
2391
+ function $r({
2120
2392
  group: e,
2121
2393
  t: r,
2122
- expanded: t,
2123
- onToggle: n,
2394
+ expanded: n,
2395
+ onToggle: t,
2124
2396
  onSearchResultClick: i
2125
2397
  }) {
2126
- const l = e.items.map((s) => s.item), a = l.some((s) => s.chunks.length > 0);
2127
- return /* @__PURE__ */ y(
2128
- C.div,
2398
+ const l = e.items.map((c) => c.item), s = l.some((c) => c.chunks.length > 0);
2399
+ return /* @__PURE__ */ g(
2400
+ I.div,
2129
2401
  {
2130
2402
  initial: { opacity: 0 },
2131
2403
  animate: { opacity: 1 },
@@ -2155,7 +2427,7 @@ function ir({
2155
2427
  children: /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 })
2156
2428
  }
2157
2429
  ),
2158
- /* @__PURE__ */ y(
2430
+ /* @__PURE__ */ g(
2159
2431
  "div",
2160
2432
  {
2161
2433
  style: {
@@ -2178,7 +2450,7 @@ function ir({
2178
2450
  children: e.memoryTitle
2179
2451
  }
2180
2452
  ),
2181
- /* @__PURE__ */ y(
2453
+ /* @__PURE__ */ g(
2182
2454
  "div",
2183
2455
  {
2184
2456
  style: {
@@ -2198,14 +2470,14 @@ function ir({
2198
2470
  color: "#666",
2199
2471
  whiteSpace: "nowrap"
2200
2472
  },
2201
- children: nr(l, r)
2473
+ children: Or(l, r)
2202
2474
  }
2203
2475
  ),
2204
- a && /* @__PURE__ */ o(
2476
+ s && /* @__PURE__ */ o(
2205
2477
  "button",
2206
2478
  {
2207
2479
  type: "button",
2208
- onClick: n,
2480
+ onClick: t,
2209
2481
  style: {
2210
2482
  border: "none",
2211
2483
  background: "none",
@@ -2216,14 +2488,14 @@ function ir({
2216
2488
  textDecoration: "underline",
2217
2489
  fontFamily: "inherit"
2218
2490
  },
2219
- children: t ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2491
+ children: n ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2220
2492
  }
2221
2493
  )
2222
2494
  ]
2223
2495
  }
2224
2496
  ),
2225
- t && a && /* @__PURE__ */ o(
2226
- or,
2497
+ n && s && /* @__PURE__ */ o(
2498
+ jr,
2227
2499
  {
2228
2500
  items: l,
2229
2501
  onSearchResultClick: i,
@@ -2237,26 +2509,26 @@ function ir({
2237
2509
  }
2238
2510
  );
2239
2511
  }
2240
- function ar(e, r) {
2241
- return e === 1 ? r.chunkFound : S(r.chunksFound, { n: e });
2512
+ function Hr(e, r) {
2513
+ return e === 1 ? r.chunkFound : T(r.chunksFound, { n: e });
2242
2514
  }
2243
- const sr = ({
2515
+ const Ur = ({
2244
2516
  data: e,
2245
2517
  onSearchResultClick: r,
2246
- t
2518
+ t: n
2247
2519
  }) => {
2248
- const n = e.items, i = n.reduce(
2249
- (u, g) => u + de(g),
2520
+ const t = e.items, i = t.reduce(
2521
+ (p, h) => p + fe(h),
2250
2522
  0
2251
- ), l = new Set(n.map((u) => u.memoryId)).size, [a, s] = I({}), m = z((u) => {
2252
- s((g) => ({
2253
- ...g,
2254
- [u]: !g[u]
2523
+ ), l = new Set(t.map((p) => p.memoryId)).size, [s, c] = E({}), m = O((p) => {
2524
+ c((h) => ({
2525
+ ...h,
2526
+ [p]: !h[p]
2255
2527
  }));
2256
- }, []), p = P(() => tr(n), [n]), c = l === 1 ? t.memoryChatChunkResultsInOneMemory : S(t.memoryChatChunkResultsInMemories, {
2528
+ }, []), y = z(() => Br(t), [t]), d = l === 1 ? n.memoryChatChunkResultsInOneMemory : T(n.memoryChatChunkResultsInMemories, {
2257
2529
  n: l
2258
- }), d = `${ar(i, t)} ${c}`;
2259
- return n.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
2530
+ }), u = `${Hr(i, n)} ${d}`;
2531
+ return t.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
2260
2532
  "div",
2261
2533
  {
2262
2534
  style: {
@@ -2264,19 +2536,19 @@ const sr = ({
2264
2536
  color: "#94a3b8",
2265
2537
  paddingTop: 4
2266
2538
  },
2267
- children: t.memorySearchExploreNoResults
2539
+ children: n.memorySearchExploreNoResults
2268
2540
  }
2269
- ) }) : /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2270
- p.map((u) => /* @__PURE__ */ o(
2271
- ir,
2541
+ ) }) : /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
2542
+ y.map((p) => /* @__PURE__ */ o(
2543
+ $r,
2272
2544
  {
2273
- group: u,
2274
- t,
2275
- expanded: a[u.memoryId] === !0,
2276
- onToggle: () => m(u.memoryId),
2545
+ group: p,
2546
+ t: n,
2547
+ expanded: s[p.memoryId] === !0,
2548
+ onToggle: () => m(p.memoryId),
2277
2549
  onSearchResultClick: r
2278
2550
  },
2279
- u.memoryId
2551
+ p.memoryId
2280
2552
  )),
2281
2553
  /* @__PURE__ */ o(
2282
2554
  "div",
@@ -2287,69 +2559,24 @@ const sr = ({
2287
2559
  marginTop: "4px",
2288
2560
  fontStyle: "italic"
2289
2561
  },
2290
- children: d
2562
+ children: u
2291
2563
  }
2292
2564
  )
2293
2565
  ] });
2294
- }, lr = ({
2295
- data: e,
2296
- isLatest: r = !1,
2297
- durationSeconds: t,
2298
- t: n
2299
- }) => {
2300
- const i = e.countryCode != null && e.countryCode !== "" ? S(n.googleSearchingForWithCountry, {
2301
- query: e.query,
2302
- country: e.countryCode
2303
- }) : S(n.googleSearchingFor, {
2304
- query: e.query
2305
- });
2306
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
2307
- /* @__PURE__ */ o(
2308
- C.div,
2309
- {
2310
- style: { color: "#666" },
2311
- initial: { opacity: 0, y: -10 },
2312
- animate: { opacity: 1, y: 0 },
2313
- transition: { duration: 0.3, delay: 0 },
2314
- children: r && !t ? /* @__PURE__ */ o(
2315
- M,
2316
- {
2317
- text: i,
2318
- duration: 2.5,
2319
- repeat: !0,
2320
- color: "#999",
2321
- shimmerColor: "#000"
2322
- }
2323
- ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: i })
2324
- }
2325
- ),
2326
- t !== void 0 && /* @__PURE__ */ o(
2327
- "div",
2328
- {
2329
- style: {
2330
- fontSize: "12px",
2331
- color: "#999",
2332
- marginTop: "4px",
2333
- fontStyle: "italic"
2334
- },
2335
- children: S(n.tookSeconds, { n: t })
2336
- }
2337
- )
2338
- ] });
2339
- }, oe = 80;
2340
- function cr(e) {
2566
+ }, le = 80;
2567
+ function _r(e) {
2341
2568
  try {
2342
2569
  return new URL(e).hostname;
2343
2570
  } catch {
2344
2571
  return e;
2345
2572
  }
2346
2573
  }
2347
- function dr({
2574
+ function Gr({
2348
2575
  item: e,
2349
2576
  t: r
2350
2577
  }) {
2351
- const [t, n] = I(!1), i = e.description ?? "", l = i.length > oe, a = i.length === 0 ? void 0 : t || !l ? i : `${i.slice(0, oe)}...`;
2352
- return /* @__PURE__ */ y(
2578
+ const [n, t] = E(!1), i = e.description ?? "", l = i.length > le, s = i.length === 0 ? void 0 : n || !l ? i : `${i.slice(0, le)}...`;
2579
+ return /* @__PURE__ */ g(
2353
2580
  "div",
2354
2581
  {
2355
2582
  style: {
@@ -2372,16 +2599,16 @@ function dr({
2372
2599
  textDecoration: "none",
2373
2600
  wordBreak: "break-word"
2374
2601
  },
2375
- onMouseEnter: (s) => {
2376
- s.currentTarget.style.color = "#2563eb";
2602
+ onMouseEnter: (c) => {
2603
+ c.currentTarget.style.color = "#2563eb";
2377
2604
  },
2378
- onMouseLeave: (s) => {
2379
- s.currentTarget.style.color = "#1f2937";
2605
+ onMouseLeave: (c) => {
2606
+ c.currentTarget.style.color = "#1f2937";
2380
2607
  },
2381
2608
  children: e.title
2382
2609
  }
2383
2610
  ),
2384
- /* @__PURE__ */ y(
2611
+ /* @__PURE__ */ g(
2385
2612
  "span",
2386
2613
  {
2387
2614
  style: {
@@ -2392,24 +2619,24 @@ function dr({
2392
2619
  children: [
2393
2620
  e.rank,
2394
2621
  ". ",
2395
- cr(e.link)
2622
+ _r(e.link)
2396
2623
  ]
2397
2624
  }
2398
2625
  ),
2399
- a != null && /* @__PURE__ */ y(E, { children: [
2626
+ s != null && /* @__PURE__ */ g(F, { children: [
2400
2627
  /* @__PURE__ */ o(
2401
2628
  "span",
2402
2629
  {
2403
- onClick: l ? () => n((s) => !s) : void 0,
2630
+ onClick: l ? () => t((c) => !c) : void 0,
2404
2631
  style: {
2405
2632
  fontSize: 13,
2406
2633
  color: "#666",
2407
2634
  lineHeight: 1.5,
2408
- whiteSpace: t ? "pre-wrap" : void 0,
2635
+ whiteSpace: n ? "pre-wrap" : void 0,
2409
2636
  wordBreak: "break-word",
2410
2637
  cursor: l ? "pointer" : "default"
2411
2638
  },
2412
- children: a
2639
+ children: s
2413
2640
  }
2414
2641
  ),
2415
2642
  l && /* @__PURE__ */ o(
@@ -2420,7 +2647,7 @@ function dr({
2420
2647
  color: "#999",
2421
2648
  marginTop: 2
2422
2649
  },
2423
- children: t ? r.clickToCollapse : r.clickToExpand
2650
+ children: n ? r.clickToCollapse : r.clickToExpand
2424
2651
  }
2425
2652
  )
2426
2653
  ] })
@@ -2428,11 +2655,57 @@ function dr({
2428
2655
  }
2429
2656
  );
2430
2657
  }
2431
- const ur = ({ data: e, t: r }) => {
2432
- const [t, n] = I(!1), i = P(
2433
- () => [...e.items].sort((s, m) => s.rank - m.rank),
2434
- [e.items]
2435
- ), l = i.length, a = l === 1 ? r.googleResultFound : S(r.googleResultsFound, { n: l });
2658
+ function qr({
2659
+ data: e,
2660
+ isLatest: r,
2661
+ durationSeconds: n,
2662
+ t
2663
+ }) {
2664
+ const i = e.input.countryCode, l = e.input.query, s = i != null && i !== "" ? T(t.googleSearchingForWithCountry, {
2665
+ query: l,
2666
+ country: i
2667
+ }) : T(t.googleSearchingFor, {
2668
+ query: l
2669
+ });
2670
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
2671
+ /* @__PURE__ */ o(
2672
+ I.div,
2673
+ {
2674
+ style: { color: "#666" },
2675
+ initial: { opacity: 0, y: -10 },
2676
+ animate: { opacity: 1, y: 0 },
2677
+ transition: { duration: 0.3, delay: 0 },
2678
+ children: r && !n ? /* @__PURE__ */ o(
2679
+ R,
2680
+ {
2681
+ text: s,
2682
+ duration: 2.5,
2683
+ repeat: !0,
2684
+ color: "#999",
2685
+ shimmerColor: "#000"
2686
+ }
2687
+ ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: s })
2688
+ }
2689
+ ),
2690
+ n !== void 0 && /* @__PURE__ */ o(
2691
+ "div",
2692
+ {
2693
+ style: {
2694
+ fontSize: "12px",
2695
+ color: "#999",
2696
+ marginTop: "4px",
2697
+ fontStyle: "italic"
2698
+ },
2699
+ children: T(t.tookSeconds, { n })
2700
+ }
2701
+ )
2702
+ ] });
2703
+ }
2704
+ function Qr({
2705
+ data: e,
2706
+ t: r
2707
+ }) {
2708
+ const [n, t] = E(!1), i = z(() => [...e.results ?? []].sort((m, y) => m.rank - y.rank), [e.results]), l = i.length, s = l === 1 ? r.googleResultFound : T(r.googleResultsFound, { n: l });
2436
2709
  return l === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
2437
2710
  "div",
2438
2711
  {
@@ -2443,9 +2716,9 @@ const ur = ({ data: e, t: r }) => {
2443
2716
  },
2444
2717
  children: r.memorySearchExploreNoResults
2445
2718
  }
2446
- ) }) : /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2447
- /* @__PURE__ */ y(
2448
- C.div,
2719
+ ) }) : /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
2720
+ /* @__PURE__ */ g(
2721
+ I.div,
2449
2722
  {
2450
2723
  initial: { opacity: 0 },
2451
2724
  animate: { opacity: 1 },
@@ -2467,14 +2740,14 @@ const ur = ({ data: e, t: r }) => {
2467
2740
  color: "#666",
2468
2741
  whiteSpace: "nowrap"
2469
2742
  },
2470
- children: a
2743
+ children: s
2471
2744
  }
2472
2745
  ),
2473
2746
  /* @__PURE__ */ o(
2474
2747
  "button",
2475
2748
  {
2476
2749
  type: "button",
2477
- onClick: () => n((s) => !s),
2750
+ onClick: () => t((c) => !c),
2478
2751
  style: {
2479
2752
  border: "none",
2480
2753
  background: "none",
@@ -2485,13 +2758,13 @@ const ur = ({ data: e, t: r }) => {
2485
2758
  textDecoration: "underline",
2486
2759
  fontFamily: "inherit"
2487
2760
  },
2488
- children: t ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2761
+ children: n ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
2489
2762
  }
2490
2763
  )
2491
2764
  ]
2492
2765
  }
2493
2766
  ),
2494
- t && /* @__PURE__ */ o(
2767
+ n && /* @__PURE__ */ o(
2495
2768
  "div",
2496
2769
  {
2497
2770
  style: {
@@ -2502,7 +2775,7 @@ const ur = ({ data: e, t: r }) => {
2502
2775
  paddingTop: 8,
2503
2776
  borderTop: "1px solid #f0f0f0"
2504
2777
  },
2505
- children: i.map((s, m) => /* @__PURE__ */ o(
2778
+ children: i.map((c, m) => /* @__PURE__ */ o(
2506
2779
  "div",
2507
2780
  {
2508
2781
  style: {
@@ -2511,72 +2784,191 @@ const ur = ({ data: e, t: r }) => {
2511
2784
  borderBottom: m < i.length - 1 ? "1px solid #eee" : void 0,
2512
2785
  minWidth: 0
2513
2786
  },
2514
- children: /* @__PURE__ */ o(dr, { item: s, t: r })
2787
+ children: /* @__PURE__ */ o(Gr, { item: c, t: r })
2515
2788
  },
2516
- `${s.link}-${s.rank}-${m}`
2789
+ `${c.link}-${c.rank}-${m}`
2517
2790
  ))
2518
2791
  }
2519
2792
  )
2520
2793
  ] });
2521
- }, mr = ({
2794
+ }
2795
+ const Kr = ({
2522
2796
  data: e,
2523
2797
  isLatest: r = !1,
2524
- durationSeconds: t,
2525
- t: n
2526
- }) => {
2527
- const i = e.urls.length, l = i === 1 ? S(n.scrapingPage, { query: e.query }) : S(n.scrapingPages, { n: i, query: e.query });
2528
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
2529
- /* @__PURE__ */ o(
2530
- C.div,
2531
- {
2532
- style: { color: "#666" },
2533
- initial: { opacity: 0, y: -10 },
2534
- animate: { opacity: 1, y: 0 },
2535
- transition: { duration: 0.3, delay: 0 },
2536
- children: r && !t ? /* @__PURE__ */ o(
2537
- M,
2538
- {
2539
- text: l,
2540
- duration: 2.5,
2541
- repeat: !0,
2542
- color: "#999",
2543
- shimmerColor: "#000"
2544
- }
2545
- ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: l })
2546
- }
2547
- ),
2548
- t !== void 0 && /* @__PURE__ */ o(
2549
- "div",
2550
- {
2551
- style: {
2552
- fontSize: "12px",
2553
- color: "#999",
2554
- marginTop: "4px",
2555
- fontStyle: "italic"
2556
- },
2557
- children: S(n.tookSeconds, { n: t })
2558
- }
2559
- )
2560
- ] });
2561
- }, ie = 80;
2562
- function pr(e, r = 48) {
2798
+ durationSeconds: n,
2799
+ t
2800
+ }) => e.results === void 0 ? /* @__PURE__ */ o(
2801
+ qr,
2802
+ {
2803
+ data: e,
2804
+ isLatest: r,
2805
+ durationSeconds: n,
2806
+ t
2807
+ }
2808
+ ) : /* @__PURE__ */ o(Qr, { data: e, t });
2809
+ function Se(e, r) {
2810
+ if (e.error != null)
2811
+ return null;
2812
+ switch (e.status) {
2813
+ case "downloading":
2814
+ return r.scrapeStatusDownloading;
2815
+ case "downloaded":
2816
+ return r.scrapeStatusDownloaded;
2817
+ case "analyzing":
2818
+ return r.scrapeStatusAnalyzing;
2819
+ case "summarizing":
2820
+ return r.scrapeStatusSummarizing;
2821
+ default:
2822
+ return null;
2823
+ }
2824
+ }
2825
+ function Xr(e) {
2826
+ var r;
2827
+ return e.error != null ? !0 : e.status != null ? !1 : (((r = e.summary) == null ? void 0 : r.length) ?? 0) > 0;
2828
+ }
2829
+ const ce = 80, Z = 12, ee = 1.4, Vr = Math.ceil(
2830
+ Z * ee
2831
+ ), Yr = Math.ceil(
2832
+ 5 * Z * ee
2833
+ );
2834
+ function Te(e, r = 48) {
2563
2835
  try {
2564
- const t = new URL(e), n = t.pathname.length > r ? `${t.pathname.slice(0, r)}…` : t.pathname, i = n === "/" ? "" : n;
2565
- return `${t.hostname}${i}${t.search ? "…" : ""}`;
2836
+ const n = new URL(e), t = n.pathname.length > r ? `${n.pathname.slice(0, r)}…` : n.pathname, i = t === "/" ? "" : t;
2837
+ return `${n.hostname}${i}${n.search ? "…" : ""}`;
2566
2838
  } catch {
2567
2839
  return e.length > 64 ? `${e.slice(0, 64)}…` : e;
2568
2840
  }
2569
2841
  }
2570
- function yr({ item: e }) {
2571
- return e.error != null ? /* @__PURE__ */ o(H, { color: "#c62828", size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
2842
+ function Jr({ item: e }) {
2843
+ return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : e.status != null ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
2844
+ }
2845
+ function Zr({ item: e }) {
2846
+ return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : e.status != null ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2847
+ }
2848
+ function et({
2849
+ item: e,
2850
+ t: r,
2851
+ isLatest: n = !1
2852
+ }) {
2853
+ const t = e.error ?? e.summary ?? "", i = t.length > 0, l = e.error != null, s = D(null), c = e.summary != null && e.summary !== "", m = Se(e, r), y = l || c || !i && m != null, d = e.error == null && (e.summary == null || e.summary === "");
2854
+ return P(() => {
2855
+ const u = s.current;
2856
+ u != null && i && (u.scrollTop = u.scrollHeight);
2857
+ }, [t, i]), /* @__PURE__ */ g(
2858
+ I.div,
2859
+ {
2860
+ initial: { opacity: 0 },
2861
+ animate: { opacity: 1 },
2862
+ transition: { duration: 0.25 },
2863
+ style: {
2864
+ display: "flex",
2865
+ flexDirection: "row",
2866
+ alignItems: d ? "center" : y ? "flex-start" : "center",
2867
+ gap: "10px",
2868
+ minWidth: 0
2869
+ },
2870
+ children: [
2871
+ /* @__PURE__ */ o(
2872
+ "div",
2873
+ {
2874
+ style: {
2875
+ display: "flex",
2876
+ alignItems: "center",
2877
+ justifyContent: "center",
2878
+ flexShrink: 0,
2879
+ width: 32,
2880
+ ...d || !y ? {} : { paddingTop: 2 }
2881
+ },
2882
+ children: /* @__PURE__ */ o(Zr, { item: e })
2883
+ }
2884
+ ),
2885
+ /* @__PURE__ */ g(
2886
+ "div",
2887
+ {
2888
+ style: {
2889
+ display: "flex",
2890
+ flexDirection: "column",
2891
+ gap: "8px",
2892
+ minWidth: 0,
2893
+ flex: 1
2894
+ },
2895
+ children: [
2896
+ /* @__PURE__ */ o(
2897
+ "a",
2898
+ {
2899
+ href: e.url,
2900
+ target: "_blank",
2901
+ rel: "noopener noreferrer",
2902
+ style: {
2903
+ fontSize: 13,
2904
+ fontWeight: 500,
2905
+ color: "#2563eb",
2906
+ textDecoration: "none",
2907
+ wordBreak: "break-all"
2908
+ },
2909
+ onMouseEnter: (u) => {
2910
+ u.currentTarget.style.textDecoration = "underline";
2911
+ },
2912
+ onMouseLeave: (u) => {
2913
+ u.currentTarget.style.textDecoration = "none";
2914
+ },
2915
+ children: Te(e.url)
2916
+ }
2917
+ ),
2918
+ !i && m != null && /* @__PURE__ */ o("div", { style: { fontSize: 12, color: "#888", minHeight: 18 }, children: n ? /* @__PURE__ */ o(
2919
+ R,
2920
+ {
2921
+ text: m,
2922
+ duration: 2.5,
2923
+ repeat: !0,
2924
+ color: "#999",
2925
+ shimmerColor: "#000"
2926
+ }
2927
+ ) : /* @__PURE__ */ o("span", { style: { color: "#888" }, children: m }) }),
2928
+ i && /* @__PURE__ */ o(
2929
+ "div",
2930
+ {
2931
+ style: {
2932
+ backgroundColor: "#f7f7f7",
2933
+ borderRadius: 6,
2934
+ padding: "8px 10px",
2935
+ boxSizing: "border-box"
2936
+ },
2937
+ children: /* @__PURE__ */ o(
2938
+ "div",
2939
+ {
2940
+ ref: s,
2941
+ style: {
2942
+ minHeight: Vr,
2943
+ maxHeight: Yr,
2944
+ height: "auto",
2945
+ overflowY: "auto",
2946
+ overflowX: "hidden",
2947
+ fontSize: Z,
2948
+ lineHeight: ee,
2949
+ whiteSpace: "pre-wrap",
2950
+ wordBreak: "break-word",
2951
+ color: l ? "#c62828" : "#888"
2952
+ },
2953
+ children: t
2954
+ }
2955
+ )
2956
+ }
2957
+ )
2958
+ ]
2959
+ }
2960
+ )
2961
+ ]
2962
+ }
2963
+ );
2572
2964
  }
2573
- function gr({
2965
+ function rt({
2574
2966
  item: e,
2575
2967
  t: r
2576
2968
  }) {
2577
- const [t, n] = I(!1), i = e.error ?? e.summary ?? "", l = e.error != null, a = i.length > ie, s = i.length === 0 ? void 0 : t || !a ? i : `${i.slice(0, ie)}...`;
2578
- return /* @__PURE__ */ y(
2579
- C.div,
2969
+ const [n, t] = E(!1), i = e.error ?? e.summary ?? "", l = e.error != null, s = i.length > ce, c = i.length === 0 ? void 0 : n || !s ? i : `${i.slice(0, ce)}...`, m = Se(e, r), y = e.error == null && (e.summary == null || e.summary === "") && e.status != null;
2970
+ return /* @__PURE__ */ g(
2971
+ I.div,
2580
2972
  {
2581
2973
  initial: { opacity: 0 },
2582
2974
  animate: { opacity: 1 },
@@ -2584,7 +2976,7 @@ function gr({
2584
2976
  style: {
2585
2977
  display: "flex",
2586
2978
  flexDirection: "row",
2587
- alignItems: "flex-start",
2979
+ alignItems: y ? "center" : "flex-start",
2588
2980
  gap: "10px",
2589
2981
  minWidth: 0
2590
2982
  },
@@ -2598,12 +2990,12 @@ function gr({
2598
2990
  justifyContent: "center",
2599
2991
  flexShrink: 0,
2600
2992
  width: 32,
2601
- paddingTop: 2
2993
+ ...y ? {} : { paddingTop: 2 }
2602
2994
  },
2603
- children: /* @__PURE__ */ o(yr, { item: e })
2995
+ children: /* @__PURE__ */ o(Jr, { item: e })
2604
2996
  }
2605
2997
  ),
2606
- /* @__PURE__ */ y(
2998
+ /* @__PURE__ */ g(
2607
2999
  "div",
2608
3000
  {
2609
3001
  style: {
@@ -2627,32 +3019,43 @@ function gr({
2627
3019
  textDecoration: "none",
2628
3020
  wordBreak: "break-all"
2629
3021
  },
2630
- onMouseEnter: (m) => {
2631
- m.currentTarget.style.textDecoration = "underline";
3022
+ onMouseEnter: (d) => {
3023
+ d.currentTarget.style.textDecoration = "underline";
2632
3024
  },
2633
- onMouseLeave: (m) => {
2634
- m.currentTarget.style.textDecoration = "none";
3025
+ onMouseLeave: (d) => {
3026
+ d.currentTarget.style.textDecoration = "none";
2635
3027
  },
2636
- children: pr(e.url)
3028
+ children: Te(e.url)
2637
3029
  }
2638
3030
  ),
2639
- s != null && /* @__PURE__ */ y(E, { children: [
3031
+ c == null && m != null && /* @__PURE__ */ o(
3032
+ "span",
3033
+ {
3034
+ style: {
3035
+ fontSize: 12,
3036
+ color: "#888",
3037
+ lineHeight: 1.4
3038
+ },
3039
+ children: m
3040
+ }
3041
+ ),
3042
+ c != null && /* @__PURE__ */ g(F, { children: [
2640
3043
  /* @__PURE__ */ o(
2641
3044
  "span",
2642
3045
  {
2643
- onClick: a ? () => n((m) => !m) : void 0,
3046
+ onClick: s ? () => t((d) => !d) : void 0,
2644
3047
  style: {
2645
3048
  fontSize: 12,
2646
3049
  color: l ? "#c62828" : "#666",
2647
3050
  lineHeight: 1.4,
2648
- whiteSpace: t ? "pre-wrap" : void 0,
3051
+ whiteSpace: n ? "pre-wrap" : void 0,
2649
3052
  wordBreak: "break-word",
2650
- cursor: a ? "pointer" : "default"
3053
+ cursor: s ? "pointer" : "default"
2651
3054
  },
2652
- children: s
3055
+ children: c
2653
3056
  }
2654
3057
  ),
2655
- a && /* @__PURE__ */ o(
3058
+ s && /* @__PURE__ */ o(
2656
3059
  "span",
2657
3060
  {
2658
3061
  style: {
@@ -2660,7 +3063,7 @@ function gr({
2660
3063
  color: "#999",
2661
3064
  marginTop: 2
2662
3065
  },
2663
- children: t ? r.clickToCollapse : r.clickToExpand
3066
+ children: n ? r.clickToCollapse : r.clickToExpand
2664
3067
  }
2665
3068
  )
2666
3069
  ] })
@@ -2671,17 +3074,87 @@ function gr({
2671
3074
  }
2672
3075
  );
2673
3076
  }
2674
- const hr = ({
3077
+ function de(e, r) {
3078
+ return /* @__PURE__ */ o(
3079
+ "div",
3080
+ {
3081
+ style: {
3082
+ display: "flex",
3083
+ flexDirection: "column",
3084
+ gap: 0,
3085
+ marginTop: 8,
3086
+ paddingTop: 8,
3087
+ borderTop: "1px solid #f0f0f0"
3088
+ },
3089
+ children: e.map((n, t) => /* @__PURE__ */ o(
3090
+ "div",
3091
+ {
3092
+ style: {
3093
+ paddingTop: t > 0 ? 12 : 0,
3094
+ paddingBottom: t < e.length - 1 ? 12 : 0,
3095
+ borderBottom: t < e.length - 1 ? "1px solid #eee" : void 0,
3096
+ minWidth: 0
3097
+ },
3098
+ children: r(n, t)
3099
+ },
3100
+ `${n.url}-${t}`
3101
+ ))
3102
+ }
3103
+ );
3104
+ }
3105
+ function tt({
2675
3106
  data: e,
2676
- t: r
2677
- }) => {
2678
- const [t, n] = I(!1), i = e.items, { successCount: l, errorCount: a } = P(() => {
2679
- let d = 0, u = 0;
2680
- for (const g of i)
2681
- g.error != null ? u += 1 : d += 1;
2682
- return { successCount: d, errorCount: u };
2683
- }, [i]), s = i.length, m = s === 1 ? r.scrapedPage : S(r.scrapedPages, { n: s }), p = S(r.scrapeOkCount, { n: l }), c = a > 0 ? `${m} - ${p}, ${S(r.scrapeFailedCount, { n: a })}` : `${m} - ${p}`;
2684
- return s === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
3107
+ isLatest: r,
3108
+ durationSeconds: n,
3109
+ t
3110
+ }) {
3111
+ const i = e.input.urls, l = e.input.query, s = i.length, c = s === 1 ? T(t.scrapingPage, { query: l }) : T(t.scrapingPages, { n: s, query: l });
3112
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
3113
+ /* @__PURE__ */ o(
3114
+ I.div,
3115
+ {
3116
+ style: { color: "#666" },
3117
+ initial: { opacity: 0, y: -10 },
3118
+ animate: { opacity: 1, y: 0 },
3119
+ transition: { duration: 0.3, delay: 0 },
3120
+ children: r && !n ? /* @__PURE__ */ o(
3121
+ R,
3122
+ {
3123
+ text: c,
3124
+ duration: 2.5,
3125
+ repeat: !0,
3126
+ color: "#999",
3127
+ shimmerColor: "#000"
3128
+ }
3129
+ ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: c })
3130
+ }
3131
+ ),
3132
+ n !== void 0 && /* @__PURE__ */ o(
3133
+ "div",
3134
+ {
3135
+ style: {
3136
+ fontSize: "12px",
3137
+ color: "#999",
3138
+ marginTop: "4px",
3139
+ fontStyle: "italic"
3140
+ },
3141
+ children: T(t.tookSeconds, { n })
3142
+ }
3143
+ )
3144
+ ] });
3145
+ }
3146
+ function nt({
3147
+ data: e,
3148
+ isLatest: r = !1,
3149
+ t: n
3150
+ }) {
3151
+ const [t, i] = E(!1), l = e.results ?? [], { successCount: s, errorCount: c } = z(() => {
3152
+ let f = 0, S = 0;
3153
+ for (const x of l)
3154
+ x.error != null ? S += 1 : f += 1;
3155
+ return { successCount: f, errorCount: S };
3156
+ }, [l]), m = l.length, y = e.input.query, d = l.length > 0 && l.every((f) => Xr(f)), u = r && !d ? m === 1 ? T(n.scrapingPage, { query: y }) : T(n.scrapingPages, { n: m, query: y }) : m === 1 ? n.scrapedPage : T(n.scrapedPages, { n: m }), p = T(n.scrapeOkCount, { n: s }), h = c > 0 ? `${u} - ${p}, ${T(n.scrapeFailedCount, { n: c })}` : `${u} - ${p}`;
3157
+ return m === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
2685
3158
  "div",
2686
3159
  {
2687
3160
  style: {
@@ -2689,11 +3162,55 @@ const hr = ({
2689
3162
  color: "#94a3b8",
2690
3163
  paddingTop: 4
2691
3164
  },
2692
- children: r.memorySearchExploreNoResults
3165
+ children: n.memorySearchExploreNoResults
2693
3166
  }
2694
- ) }) : /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2695
- /* @__PURE__ */ y(
2696
- C.div,
3167
+ ) }) : r ? /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
3168
+ /* @__PURE__ */ o(
3169
+ I.div,
3170
+ {
3171
+ initial: { opacity: 0 },
3172
+ animate: { opacity: 1 },
3173
+ transition: { duration: 0.25 },
3174
+ style: {
3175
+ display: "flex",
3176
+ flexDirection: "row",
3177
+ flexWrap: "wrap",
3178
+ alignItems: "baseline",
3179
+ gap: "6px 12px",
3180
+ minWidth: 0
3181
+ },
3182
+ children: r && !d ? /* @__PURE__ */ o(
3183
+ R,
3184
+ {
3185
+ text: h,
3186
+ duration: 2.5,
3187
+ repeat: !0,
3188
+ color: "#999",
3189
+ shimmerColor: "#000"
3190
+ }
3191
+ ) : /* @__PURE__ */ o(
3192
+ "span",
3193
+ {
3194
+ style: {
3195
+ fontSize: 12,
3196
+ color: "#666"
3197
+ },
3198
+ children: h
3199
+ }
3200
+ )
3201
+ }
3202
+ ),
3203
+ de(l, (f) => /* @__PURE__ */ o(
3204
+ et,
3205
+ {
3206
+ item: f,
3207
+ t: n,
3208
+ isLatest: r
3209
+ }
3210
+ ))
3211
+ ] }) : /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
3212
+ /* @__PURE__ */ g(
3213
+ I.div,
2697
3214
  {
2698
3215
  initial: { opacity: 0 },
2699
3216
  animate: { opacity: 1 },
@@ -2714,14 +3231,14 @@ const hr = ({
2714
3231
  fontSize: 12,
2715
3232
  color: "#666"
2716
3233
  },
2717
- children: c
3234
+ children: h
2718
3235
  }
2719
3236
  ),
2720
3237
  /* @__PURE__ */ o(
2721
3238
  "button",
2722
3239
  {
2723
3240
  type: "button",
2724
- onClick: () => n((d) => !d),
3241
+ onClick: () => i((f) => !f),
2725
3242
  style: {
2726
3243
  border: "none",
2727
3244
  background: "none",
@@ -2732,56 +3249,87 @@ const hr = ({
2732
3249
  textDecoration: "underline",
2733
3250
  fontFamily: "inherit"
2734
3251
  },
2735
- children: t ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
3252
+ children: t ? n.memorySearchHideExploreResults : n.memorySearchViewExploreResults
2736
3253
  }
2737
3254
  )
2738
3255
  ]
2739
3256
  }
2740
3257
  ),
2741
- t && /* @__PURE__ */ o(
2742
- "div",
3258
+ t && de(l, (f) => /* @__PURE__ */ o(rt, { item: f, t: n }))
3259
+ ] });
3260
+ }
3261
+ const ot = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => e.results === void 0 ? /* @__PURE__ */ o(
3262
+ tt,
3263
+ {
3264
+ data: e,
3265
+ isLatest: r,
3266
+ durationSeconds: n,
3267
+ t
3268
+ }
3269
+ ) : /* @__PURE__ */ o(
3270
+ nt,
3271
+ {
3272
+ data: e,
3273
+ isLatest: r,
3274
+ t
3275
+ }
3276
+ ), at = (e) => {
3277
+ const { isLatest: r = !1, durationSeconds: n, t } = e, i = t.memoryChatThinking;
3278
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
3279
+ /* @__PURE__ */ o(
3280
+ I.div,
2743
3281
  {
2744
3282
  style: {
2745
3283
  display: "flex",
2746
- flexDirection: "column",
2747
- gap: 0,
2748
- marginTop: 8,
2749
- paddingTop: 8,
2750
- borderTop: "1px solid #f0f0f0"
3284
+ alignItems: "center",
3285
+ gap: "10px",
3286
+ color: "#666"
2751
3287
  },
2752
- children: i.map((d, u) => /* @__PURE__ */ o(
2753
- "div",
3288
+ initial: { opacity: 0, y: -10 },
3289
+ animate: { opacity: 1, y: 0 },
3290
+ transition: { duration: 0.3, delay: 0 },
3291
+ children: r && !n ? /* @__PURE__ */ o(
3292
+ R,
2754
3293
  {
2755
- style: {
2756
- paddingTop: u > 0 ? 12 : 0,
2757
- paddingBottom: u < i.length - 1 ? 12 : 0,
2758
- borderBottom: u < i.length - 1 ? "1px solid #eee" : void 0,
2759
- minWidth: 0
2760
- },
2761
- children: /* @__PURE__ */ o(gr, { item: d, t: r })
2762
- },
2763
- `${d.url}-${u}`
2764
- ))
3294
+ text: i,
3295
+ duration: 2.5,
3296
+ repeat: !0,
3297
+ color: "#999",
3298
+ shimmerColor: "#000"
3299
+ }
3300
+ ) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: i })
3301
+ }
3302
+ ),
3303
+ n !== void 0 && /* @__PURE__ */ o(
3304
+ "div",
3305
+ {
3306
+ style: {
3307
+ fontSize: "12px",
3308
+ color: "#999",
3309
+ marginTop: "4px",
3310
+ fontStyle: "italic"
3311
+ },
3312
+ children: T(t.tookSeconds, { n })
2765
3313
  }
2766
3314
  )
2767
3315
  ] });
2768
3316
  };
2769
- function fr({ item: e }) {
2770
- return e.error != null ? /* @__PURE__ */ o(H, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
3317
+ function it({ item: e }) {
3318
+ return e.error != null ? /* @__PURE__ */ o(j, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2771
3319
  }
2772
- function Sr(e, r) {
2773
- return S(r.searchingInMemoriesOfType, {
3320
+ function st(e, r) {
3321
+ return T(r.searchingInMemoriesOfType, {
2774
3322
  name: e.memoryTypeName
2775
3323
  });
2776
3324
  }
2777
- function xr({
3325
+ function lt({
2778
3326
  item: e,
2779
3327
  t: r,
2780
- showShimmerForPrimary: t
3328
+ showShimmerForPrimary: n
2781
3329
  }) {
2782
- const n = e.result != null, i = e.error != null, l = Sr(e, r);
2783
- return /* @__PURE__ */ y(
2784
- C.div,
3330
+ const t = e.result != null, i = e.error != null, l = st(e, r);
3331
+ return /* @__PURE__ */ g(
3332
+ I.div,
2785
3333
  {
2786
3334
  initial: { opacity: 0 },
2787
3335
  animate: { opacity: 1 },
@@ -2807,10 +3355,10 @@ function xr({
2807
3355
  flexShrink: 0,
2808
3356
  width: 32
2809
3357
  },
2810
- children: /* @__PURE__ */ o(fr, { item: e })
3358
+ children: /* @__PURE__ */ o(it, { item: e })
2811
3359
  }
2812
3360
  ),
2813
- /* @__PURE__ */ y(
3361
+ /* @__PURE__ */ g(
2814
3362
  "div",
2815
3363
  {
2816
3364
  style: {
@@ -2821,8 +3369,8 @@ function xr({
2821
3369
  flex: 1
2822
3370
  },
2823
3371
  children: [
2824
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !i && t ? /* @__PURE__ */ o(
2825
- M,
3372
+ /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !t && !i && n ? /* @__PURE__ */ o(
3373
+ R,
2826
3374
  {
2827
3375
  text: l,
2828
3376
  duration: 2.5,
@@ -2831,14 +3379,14 @@ function xr({
2831
3379
  shimmerColor: "#000"
2832
3380
  }
2833
3381
  ) : l }),
2834
- n && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? S(
3382
+ t && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? T(
2835
3383
  r.memorySearchTypeResultSummaryOne,
2836
3384
  {
2837
3385
  score: e.result.highestChunkScore.toFixed(
2838
3386
  2
2839
3387
  )
2840
3388
  }
2841
- ) : S(
3389
+ ) : T(
2842
3390
  r.memorySearchTypeResultSummary,
2843
3391
  {
2844
3392
  count: e.result.numberOfChunks,
@@ -2855,33 +3403,33 @@ function xr({
2855
3403
  }
2856
3404
  );
2857
3405
  }
2858
- const kr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2859
- const i = P(() => {
3406
+ const ct = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
3407
+ const i = z(() => {
2860
3408
  let l = -1;
2861
- return e.memoryTypes.forEach((a, s) => {
2862
- a.result == null && a.error == null && (l = s);
3409
+ return e.memoryTypes.forEach((s, c) => {
3410
+ s.result == null && s.error == null && (l = c);
2863
3411
  }), l;
2864
3412
  }, [e.memoryTypes]);
2865
- return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
2866
- r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
2867
- M,
3413
+ return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
3414
+ r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
3415
+ R,
2868
3416
  {
2869
- text: n.searchingMemoryTypes,
3417
+ text: t.searchingMemoryTypes,
2870
3418
  duration: 2.5,
2871
3419
  repeat: !0,
2872
3420
  color: "#999",
2873
3421
  shimmerColor: "#000"
2874
3422
  }
2875
- ) : e.memoryTypes.map((l, a) => /* @__PURE__ */ o(
2876
- xr,
3423
+ ) : e.memoryTypes.map((l, s) => /* @__PURE__ */ o(
3424
+ lt,
2877
3425
  {
2878
3426
  item: l,
2879
- t: n,
2880
- showShimmerForPrimary: a === i && r
3427
+ t,
3428
+ showShimmerForPrimary: s === i && r
2881
3429
  },
2882
3430
  l.memoryTypeId
2883
3431
  )),
2884
- t !== void 0 && /* @__PURE__ */ o(
3432
+ n !== void 0 && /* @__PURE__ */ o(
2885
3433
  "div",
2886
3434
  {
2887
3435
  style: {
@@ -2890,45 +3438,45 @@ const kr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
2890
3438
  marginTop: "4px",
2891
3439
  fontStyle: "italic"
2892
3440
  },
2893
- children: S(n.tookSeconds, { n: t })
3441
+ children: T(t.tookSeconds, { n })
2894
3442
  }
2895
3443
  )
2896
3444
  ] });
2897
- }, $ = 12, N = 1.45, br = Math.ceil(
2898
- $ * N
2899
- ), vr = Math.ceil(
2900
- 5 * $ * N
3445
+ }, H = 12, U = 1.45, dt = Math.ceil(
3446
+ H * U
3447
+ ), ut = Math.ceil(
3448
+ 5 * H * U
2901
3449
  );
2902
3450
  function B(e) {
2903
3451
  return e.queries != null && e.queries.length > 0;
2904
3452
  }
2905
- function Tr(e) {
3453
+ function mt(e) {
2906
3454
  const r = e.reasoning;
2907
3455
  return (r == null || r === "") && !B(e);
2908
3456
  }
2909
- function wr(e) {
3457
+ function pt(e) {
2910
3458
  if (B(e)) return 3;
2911
3459
  const r = e.reasoning;
2912
3460
  return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
2913
3461
  }
2914
- function Cr({ phase: e }) {
3462
+ function yt({ phase: e }) {
2915
3463
  return e === 3 ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
2916
3464
  }
2917
- function Ir({
3465
+ function ht({
2918
3466
  item: e,
2919
3467
  t: r,
2920
- isActiveRow: t
3468
+ isActiveRow: n
2921
3469
  }) {
2922
- const n = Tr(e), i = wr(e), l = e.reasoning, a = l != null && l.length > 0, s = A(null), [m, p] = I(!1), c = n && t, d = i === 2 && t && !B(e);
2923
- F(() => {
2924
- const h = s.current;
2925
- h != null && i === 1 && a && (h.scrollTop = h.scrollHeight);
2926
- }, [l, i, a]);
2927
- const u = S(r.searchingInMemoriesOfType, {
3470
+ const t = mt(e), i = pt(e), l = e.reasoning, s = l != null && l.length > 0, c = D(null), [m, y] = E(!1), d = t && n, u = i === 2 && n && !B(e);
3471
+ P(() => {
3472
+ const f = c.current;
3473
+ f != null && i === 1 && s && (f.scrollTop = f.scrollHeight);
3474
+ }, [l, i, s]);
3475
+ const p = T(r.searchingInMemoriesOfType, {
2928
3476
  name: e.memoryTypeName
2929
- }), g = !n && i === 3;
2930
- return /* @__PURE__ */ y(
2931
- C.div,
3477
+ }), h = !t && i === 3;
3478
+ return /* @__PURE__ */ g(
3479
+ I.div,
2932
3480
  {
2933
3481
  initial: { opacity: 0 },
2934
3482
  animate: { opacity: 1 },
@@ -2939,7 +3487,7 @@ function Ir({
2939
3487
  borderBottom: "1px solid #eee",
2940
3488
  display: "flex",
2941
3489
  flexDirection: "row",
2942
- alignItems: g ? "flex-start" : "center",
3490
+ alignItems: h ? "flex-start" : "center",
2943
3491
  gap: "10px",
2944
3492
  minWidth: 0
2945
3493
  },
@@ -2953,12 +3501,12 @@ function Ir({
2953
3501
  justifyContent: "center",
2954
3502
  flexShrink: 0,
2955
3503
  width: 32,
2956
- ...g ? { paddingTop: 2 } : {}
3504
+ ...h ? { paddingTop: 2 } : {}
2957
3505
  },
2958
- children: /* @__PURE__ */ o(Cr, { phase: n ? 1 : i })
3506
+ children: /* @__PURE__ */ o(yt, { phase: t ? 1 : i })
2959
3507
  }
2960
3508
  ),
2961
- /* @__PURE__ */ y(
3509
+ /* @__PURE__ */ g(
2962
3510
  "div",
2963
3511
  {
2964
3512
  style: {
@@ -2969,17 +3517,17 @@ function Ir({
2969
3517
  flex: 1
2970
3518
  },
2971
3519
  children: [
2972
- /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: c ? /* @__PURE__ */ o(
2973
- M,
3520
+ /* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: d ? /* @__PURE__ */ o(
3521
+ R,
2974
3522
  {
2975
- text: u,
3523
+ text: p,
2976
3524
  duration: 2.5,
2977
3525
  repeat: !0,
2978
3526
  color: "#999",
2979
3527
  shimmerColor: "#000"
2980
3528
  }
2981
3529
  ) : e.memoryTypeName }),
2982
- i === 1 && a && !B(e) && /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
3530
+ i === 1 && s && !B(e) && /* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
2983
3531
  /* @__PURE__ */ o(
2984
3532
  "span",
2985
3533
  {
@@ -3005,16 +3553,16 @@ function Ir({
3005
3553
  children: /* @__PURE__ */ o(
3006
3554
  "div",
3007
3555
  {
3008
- ref: s,
3556
+ ref: c,
3009
3557
  className: "memory-search-generating-reasoning-viewport",
3010
3558
  style: {
3011
- minHeight: br,
3012
- maxHeight: vr,
3559
+ minHeight: dt,
3560
+ maxHeight: ut,
3013
3561
  height: "auto",
3014
3562
  overflowY: "auto",
3015
3563
  overflowX: "hidden",
3016
- fontSize: $,
3017
- lineHeight: N,
3564
+ fontSize: H,
3565
+ lineHeight: U,
3018
3566
  whiteSpace: "pre-wrap",
3019
3567
  wordBreak: "break-word",
3020
3568
  color: "#888"
@@ -3025,8 +3573,8 @@ function Ir({
3025
3573
  }
3026
3574
  )
3027
3575
  ] }),
3028
- i === 2 && d && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
3029
- M,
3576
+ i === 2 && u && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
3577
+ R,
3030
3578
  {
3031
3579
  text: r.memorySearchGeneratingQueriesPending,
3032
3580
  duration: 2.5,
@@ -3035,8 +3583,8 @@ function Ir({
3035
3583
  shimmerColor: "#000"
3036
3584
  }
3037
3585
  ) }),
3038
- i === 3 && /* @__PURE__ */ y(E, { children: [
3039
- /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
3586
+ i === 3 && /* @__PURE__ */ g(F, { children: [
3587
+ /* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
3040
3588
  /* @__PURE__ */ o(
3041
3589
  "span",
3042
3590
  {
@@ -3058,7 +3606,7 @@ function Ir({
3058
3606
  flexDirection: "column",
3059
3607
  gap: 6
3060
3608
  },
3061
- children: e.queries.map((h, f) => /* @__PURE__ */ o(
3609
+ children: e.queries.map((f, S) => /* @__PURE__ */ o(
3062
3610
  "div",
3063
3611
  {
3064
3612
  style: {
@@ -3067,19 +3615,19 @@ function Ir({
3067
3615
  lineHeight: 1.5,
3068
3616
  wordBreak: "break-word"
3069
3617
  },
3070
- children: h.query
3618
+ children: f.query
3071
3619
  },
3072
- f
3620
+ S
3073
3621
  ))
3074
3622
  }
3075
3623
  )
3076
3624
  ] }),
3077
- a && /* @__PURE__ */ y(E, { children: [
3625
+ s && /* @__PURE__ */ g(F, { children: [
3078
3626
  /* @__PURE__ */ o(
3079
3627
  "button",
3080
3628
  {
3081
3629
  type: "button",
3082
- onClick: () => p((h) => !h),
3630
+ onClick: () => y((f) => !f),
3083
3631
  style: {
3084
3632
  alignSelf: "flex-start",
3085
3633
  border: "none",
@@ -3097,8 +3645,8 @@ function Ir({
3097
3645
  "div",
3098
3646
  {
3099
3647
  style: {
3100
- fontSize: $,
3101
- lineHeight: N,
3648
+ fontSize: H,
3649
+ lineHeight: U,
3102
3650
  whiteSpace: "pre-wrap",
3103
3651
  wordBreak: "break-word",
3104
3652
  color: "#888",
@@ -3118,33 +3666,33 @@ function Ir({
3118
3666
  }
3119
3667
  );
3120
3668
  }
3121
- const Er = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
3122
- const i = P(() => {
3669
+ const gt = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
3670
+ const i = z(() => {
3123
3671
  let l = -1;
3124
- return e.memoryTypes.forEach((a, s) => {
3125
- B(a) || (l = s);
3672
+ return e.memoryTypes.forEach((s, c) => {
3673
+ B(s) || (l = c);
3126
3674
  }), l;
3127
3675
  }, [e.memoryTypes]);
3128
- return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
3129
- r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
3130
- M,
3676
+ return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
3677
+ r && !n && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
3678
+ R,
3131
3679
  {
3132
- text: n.memorySearchGeneratingQueries,
3680
+ text: t.memorySearchGeneratingQueries,
3133
3681
  duration: 2.5,
3134
3682
  repeat: !0,
3135
3683
  color: "#999",
3136
3684
  shimmerColor: "#000"
3137
3685
  }
3138
- ) : e.memoryTypes.map((l, a) => /* @__PURE__ */ o(
3139
- Ir,
3686
+ ) : e.memoryTypes.map((l, s) => /* @__PURE__ */ o(
3687
+ ht,
3140
3688
  {
3141
3689
  item: l,
3142
- t: n,
3143
- isActiveRow: a === i && r
3690
+ t,
3691
+ isActiveRow: s === i && r
3144
3692
  },
3145
3693
  l.memoryTypeId
3146
3694
  )),
3147
- t !== void 0 && /* @__PURE__ */ o(
3695
+ n !== void 0 && /* @__PURE__ */ o(
3148
3696
  "div",
3149
3697
  {
3150
3698
  style: {
@@ -3153,20 +3701,20 @@ const Er = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
3153
3701
  marginTop: "4px",
3154
3702
  fontStyle: "italic"
3155
3703
  },
3156
- children: S(n.tookSeconds, { n: t })
3704
+ children: T(t.tookSeconds, { n })
3157
3705
  }
3158
3706
  )
3159
3707
  ] });
3160
3708
  };
3161
- function Mr(e) {
3162
- return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ o(H, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
3709
+ function ft(e) {
3710
+ 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(L, { color: "#999", size: 15, borderWidth: 2 });
3163
3711
  }
3164
- function Rr(e, r) {
3712
+ function St(e, r) {
3165
3713
  if (e.error != null)
3166
3714
  return /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
3167
3715
  if (e.result == null)
3168
3716
  return /* @__PURE__ */ o("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ o(
3169
- M,
3717
+ R,
3170
3718
  {
3171
3719
  text: r.searching,
3172
3720
  duration: 2.5,
@@ -3175,22 +3723,22 @@ function Rr(e, r) {
3175
3723
  shimmerColor: "#000"
3176
3724
  }
3177
3725
  ) });
3178
- const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : S(r.chunksFound, { n: t.numberOfChunks }), i = S(r.scoreLabel, {
3179
- n: t.highestChunkScore.toFixed(2)
3726
+ const n = e.result, t = n.numberOfChunks === 1 ? r.chunkFound : T(r.chunksFound, { n: n.numberOfChunks }), i = T(r.scoreLabel, {
3727
+ n: n.highestChunkScore.toFixed(2)
3180
3728
  });
3181
- return /* @__PURE__ */ y("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
3182
- n,
3729
+ return /* @__PURE__ */ g("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
3730
+ t,
3183
3731
  " · ",
3184
3732
  i
3185
3733
  ] });
3186
3734
  }
3187
- function Fr({
3735
+ function Tt({
3188
3736
  items: e,
3189
3737
  queryRow: r,
3190
- onExploreQueryResultClick: t,
3191
- t: n
3738
+ onExploreQueryResultClick: n,
3739
+ t
3192
3740
  }) {
3193
- const [i, l] = I(null);
3741
+ const [i, l] = E(null);
3194
3742
  if (e.length === 0)
3195
3743
  return /* @__PURE__ */ o(
3196
3744
  "div",
@@ -3200,10 +3748,10 @@ function Fr({
3200
3748
  color: "#94a3b8",
3201
3749
  paddingTop: 4
3202
3750
  },
3203
- children: n.memorySearchExploreNoResults
3751
+ children: t.memorySearchExploreNoResults
3204
3752
  }
3205
3753
  );
3206
- const a = !!t;
3754
+ const s = !!n;
3207
3755
  return /* @__PURE__ */ o(
3208
3756
  "div",
3209
3757
  {
@@ -3215,26 +3763,26 @@ function Fr({
3215
3763
  paddingTop: 8,
3216
3764
  borderTop: "1px solid #f0f0f0"
3217
3765
  },
3218
- children: e.map((s, m) => {
3219
- const p = s.memoryTitle !== "" ? s.memoryTitle : s.memoryId, c = V(
3220
- s.chunks
3221
- ), d = [
3222
- X(s),
3223
- S(n.scoreLabel, {
3224
- n: s.matchingChunkScore.toFixed(2)
3766
+ children: e.map((c, m) => {
3767
+ const y = c.memoryTitle !== "" ? c.memoryTitle : c.memoryId, d = Y(
3768
+ c.chunks
3769
+ ), u = [
3770
+ J(c),
3771
+ T(t.scoreLabel, {
3772
+ n: c.matchingChunkScore.toFixed(2)
3225
3773
  }),
3226
- c.length > 0 ? K(c, n) : n.pagesNotAvailable
3774
+ d.length > 0 ? V(d, t) : t.pagesNotAvailable
3227
3775
  ].filter(
3228
- (f) => f != null && f !== ""
3229
- ), u = {
3230
- memoryId: s.memoryId,
3231
- memoryTitle: s.memoryTitle,
3232
- pageNumbers: c,
3776
+ (S) => S != null && S !== ""
3777
+ ), p = {
3778
+ memoryId: c.memoryId,
3779
+ memoryTitle: c.memoryTitle,
3780
+ pageNumbers: d,
3233
3781
  memoryTypeId: r.memoryTypeId,
3234
3782
  memoryTypeName: r.memoryTypeName,
3235
3783
  query: r.query
3236
- }, g = `${r.query}::${s.memoryId}::${m}`, h = i === g;
3237
- return /* @__PURE__ */ y(
3784
+ }, h = `${r.query}::${c.memoryId}::${m}`, f = i === h;
3785
+ return /* @__PURE__ */ g(
3238
3786
  "div",
3239
3787
  {
3240
3788
  style: {
@@ -3248,7 +3796,7 @@ function Fr({
3248
3796
  minWidth: 0
3249
3797
  },
3250
3798
  children: [
3251
- /* @__PURE__ */ y(
3799
+ /* @__PURE__ */ g(
3252
3800
  "div",
3253
3801
  {
3254
3802
  style: {
@@ -3267,7 +3815,7 @@ function Fr({
3267
3815
  fontWeight: 600,
3268
3816
  color: "#333"
3269
3817
  },
3270
- children: p
3818
+ children: y
3271
3819
  }
3272
3820
  ),
3273
3821
  /* @__PURE__ */ o(
@@ -3280,8 +3828,8 @@ function Fr({
3280
3828
  whiteSpace: "pre-wrap",
3281
3829
  wordBreak: "break-word"
3282
3830
  },
3283
- children: Q(
3284
- s.chunks
3831
+ children: X(
3832
+ c.chunks
3285
3833
  )
3286
3834
  }
3287
3835
  ),
@@ -3294,23 +3842,23 @@ function Fr({
3294
3842
  color: "#94a3b8",
3295
3843
  lineHeight: 1.35
3296
3844
  },
3297
- children: d.join(" · ")
3845
+ children: u.join(" · ")
3298
3846
  }
3299
3847
  )
3300
3848
  ]
3301
3849
  }
3302
3850
  ),
3303
- a && /* @__PURE__ */ y(
3851
+ s && /* @__PURE__ */ g(
3304
3852
  "button",
3305
3853
  {
3306
3854
  type: "button",
3307
- "aria-busy": h,
3308
- disabled: h,
3855
+ "aria-busy": f,
3856
+ disabled: f,
3309
3857
  onClick: async () => {
3310
- l(g);
3858
+ l(h);
3311
3859
  try {
3312
- await t(
3313
- u
3860
+ await n(
3861
+ p
3314
3862
  );
3315
3863
  } finally {
3316
3864
  l(null);
@@ -3326,56 +3874,56 @@ function Fr({
3326
3874
  background: "#eff6ff",
3327
3875
  border: "1px solid #bfdbfe",
3328
3876
  borderRadius: 6,
3329
- cursor: h ? "wait" : "pointer",
3877
+ cursor: f ? "wait" : "pointer",
3330
3878
  fontFamily: "inherit",
3331
3879
  display: "inline-flex",
3332
3880
  alignItems: "center",
3333
3881
  gap: 8
3334
3882
  },
3335
3883
  children: [
3336
- h && /* @__PURE__ */ o(
3884
+ f && /* @__PURE__ */ o(
3337
3885
  "span",
3338
3886
  {
3339
3887
  className: "explore-memory-loader explore-memory-loader--callback",
3340
3888
  "aria-hidden": !0
3341
3889
  }
3342
3890
  ),
3343
- n.viewButton
3891
+ t.viewButton
3344
3892
  ]
3345
3893
  }
3346
3894
  )
3347
3895
  ]
3348
3896
  },
3349
- `${s.memoryId}-${m}`
3897
+ `${c.memoryId}-${m}`
3350
3898
  );
3351
3899
  })
3352
3900
  }
3353
3901
  );
3354
3902
  }
3355
- function Ar(e) {
3356
- const r = [], t = /* @__PURE__ */ new Map();
3357
- return e.forEach((n, i) => {
3358
- let l = t.get(n.memoryTypeId);
3359
- l == null && (r.push(n.memoryTypeId), l = {
3360
- memoryTypeId: n.memoryTypeId,
3361
- memoryTypeName: n.memoryTypeName,
3903
+ function xt(e) {
3904
+ const r = [], n = /* @__PURE__ */ new Map();
3905
+ return e.forEach((t, i) => {
3906
+ let l = n.get(t.memoryTypeId);
3907
+ l == null && (r.push(t.memoryTypeId), l = {
3908
+ memoryTypeId: t.memoryTypeId,
3909
+ memoryTypeName: t.memoryTypeName,
3362
3910
  items: []
3363
- }, t.set(n.memoryTypeId, l)), l.items.push({ item: n, flatIndex: i });
3364
- }), r.map((n) => t.get(n));
3911
+ }, n.set(t.memoryTypeId, l)), l.items.push({ item: t, flatIndex: i });
3912
+ }), r.map((t) => n.get(t));
3365
3913
  }
3366
- function Lr({
3914
+ function bt({
3367
3915
  group: e,
3368
3916
  t: r,
3369
- isLatest: t,
3370
- expandedRows: n,
3917
+ isLatest: n,
3918
+ expandedRows: t,
3371
3919
  toggleExpanded: i,
3372
3920
  onExploreQueryResultClick: l
3373
3921
  }) {
3374
- const a = e.items.map((m) => m.item), s = a.some(
3922
+ const s = e.items.map((m) => m.item), c = s.some(
3375
3923
  (m) => m.result == null && m.error == null
3376
3924
  );
3377
- return /* @__PURE__ */ y(
3378
- C.div,
3925
+ return /* @__PURE__ */ g(
3926
+ I.div,
3379
3927
  {
3380
3928
  initial: { opacity: 0 },
3381
3929
  animate: { opacity: 1 },
@@ -3386,7 +3934,7 @@ function Lr({
3386
3934
  borderBottom: "1px solid #eee",
3387
3935
  display: "flex",
3388
3936
  flexDirection: "row",
3389
- alignItems: s ? "center" : "flex-start",
3937
+ alignItems: c ? "center" : "flex-start",
3390
3938
  gap: "10px",
3391
3939
  minWidth: 0
3392
3940
  },
@@ -3400,12 +3948,12 @@ function Lr({
3400
3948
  justifyContent: "center",
3401
3949
  flexShrink: 0,
3402
3950
  width: 32,
3403
- ...s ? {} : { paddingTop: 2 }
3951
+ ...c ? {} : { paddingTop: 2 }
3404
3952
  },
3405
- children: Mr(a)
3953
+ children: ft(s)
3406
3954
  }
3407
3955
  ),
3408
- /* @__PURE__ */ y(
3956
+ /* @__PURE__ */ g(
3409
3957
  "div",
3410
3958
  {
3411
3959
  style: {
@@ -3423,15 +3971,15 @@ function Lr({
3423
3971
  fontSize: 12,
3424
3972
  color: "#888"
3425
3973
  },
3426
- children: S(r.memorySearchExploreQueryTypeLabel, {
3974
+ children: T(r.memorySearchExploreQueryTypeLabel, {
3427
3975
  name: e.memoryTypeName
3428
3976
  })
3429
3977
  }
3430
3978
  ),
3431
- e.items.map(({ item: m, flatIndex: p }) => {
3432
- var f;
3433
- const c = m.result != null, d = m.error != null, u = t && !c && !d, g = n[p] === !0, h = ((f = m.result) == null ? void 0 : f.items) ?? [];
3434
- return /* @__PURE__ */ y(
3979
+ e.items.map(({ item: m, flatIndex: y }) => {
3980
+ var S;
3981
+ const d = m.result != null, u = m.error != null, p = n && !d && !u, h = t[y] === !0, f = ((S = m.result) == null ? void 0 : S.items) ?? [];
3982
+ return /* @__PURE__ */ g(
3435
3983
  "div",
3436
3984
  {
3437
3985
  style: {
@@ -3441,7 +3989,7 @@ function Lr({
3441
3989
  minWidth: 0
3442
3990
  },
3443
3991
  children: [
3444
- /* @__PURE__ */ y(
3992
+ /* @__PURE__ */ g(
3445
3993
  "div",
3446
3994
  {
3447
3995
  style: {
@@ -3464,8 +4012,8 @@ function Lr({
3464
4012
  flex: "1 1 12rem",
3465
4013
  minWidth: 0
3466
4014
  },
3467
- children: u ? /* @__PURE__ */ o(
3468
- M,
4015
+ children: p ? /* @__PURE__ */ o(
4016
+ R,
3469
4017
  {
3470
4018
  text: m.query,
3471
4019
  duration: 2.5,
@@ -3476,7 +4024,7 @@ function Lr({
3476
4024
  ) : m.query
3477
4025
  }
3478
4026
  ),
3479
- /* @__PURE__ */ y(
4027
+ /* @__PURE__ */ g(
3480
4028
  "div",
3481
4029
  {
3482
4030
  style: {
@@ -3487,12 +4035,12 @@ function Lr({
3487
4035
  flexShrink: 0
3488
4036
  },
3489
4037
  children: [
3490
- Rr(m, r),
3491
- c && /* @__PURE__ */ o(
4038
+ St(m, r),
4039
+ d && /* @__PURE__ */ o(
3492
4040
  "button",
3493
4041
  {
3494
4042
  type: "button",
3495
- onClick: () => i(p),
4043
+ onClick: () => i(y),
3496
4044
  style: {
3497
4045
  border: "none",
3498
4046
  background: "none",
@@ -3503,7 +4051,7 @@ function Lr({
3503
4051
  textDecoration: "underline",
3504
4052
  fontFamily: "inherit"
3505
4053
  },
3506
- children: g ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
4054
+ children: h ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
3507
4055
  }
3508
4056
  )
3509
4057
  ]
@@ -3512,10 +4060,10 @@ function Lr({
3512
4060
  ]
3513
4061
  }
3514
4062
  ),
3515
- c && g && /* @__PURE__ */ o(
3516
- Fr,
4063
+ d && h && /* @__PURE__ */ o(
4064
+ Tt,
3517
4065
  {
3518
- items: h,
4066
+ items: f,
3519
4067
  queryRow: m,
3520
4068
  onExploreQueryResultClick: l,
3521
4069
  t: r
@@ -3523,7 +4071,7 @@ function Lr({
3523
4071
  )
3524
4072
  ]
3525
4073
  },
3526
- `${e.memoryTypeId}-${p}-${m.query}`
4074
+ `${e.memoryTypeId}-${y}-${m.query}`
3527
4075
  );
3528
4076
  })
3529
4077
  ]
@@ -3533,27 +4081,27 @@ function Lr({
3533
4081
  }
3534
4082
  );
3535
4083
  }
3536
- const Pr = ({
4084
+ const kt = ({
3537
4085
  data: e,
3538
4086
  isLatest: r = !1,
3539
- durationSeconds: t,
3540
- onExploreQueryResultClick: n,
4087
+ durationSeconds: n,
4088
+ onExploreQueryResultClick: t,
3541
4089
  t: i
3542
4090
  }) => {
3543
- const [l, a] = I(
4091
+ const [l, s] = E(
3544
4092
  {}
3545
- ), s = z((p) => {
3546
- a((c) => ({
3547
- ...c,
3548
- [p]: !c[p]
4093
+ ), c = O((y) => {
4094
+ s((d) => ({
4095
+ ...d,
4096
+ [y]: !d[y]
3549
4097
  }));
3550
- }, []), m = P(
3551
- () => Ar(e.queries),
4098
+ }, []), m = z(
4099
+ () => xt(e.queries),
3552
4100
  [e.queries]
3553
4101
  );
3554
- return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
3555
- r && !t && e.queries.length === 0 ? /* @__PURE__ */ o(
3556
- M,
4102
+ return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
4103
+ r && !n && e.queries.length === 0 ? /* @__PURE__ */ o(
4104
+ R,
3557
4105
  {
3558
4106
  text: i.memorySearchExploringQueries,
3559
4107
  duration: 2.5,
@@ -3561,19 +4109,19 @@ const Pr = ({
3561
4109
  color: "#999",
3562
4110
  shimmerColor: "#000"
3563
4111
  }
3564
- ) : m.map((p) => /* @__PURE__ */ o(
3565
- Lr,
4112
+ ) : m.map((y) => /* @__PURE__ */ o(
4113
+ bt,
3566
4114
  {
3567
- group: p,
4115
+ group: y,
3568
4116
  t: i,
3569
4117
  isLatest: r,
3570
4118
  expandedRows: l,
3571
- toggleExpanded: s,
3572
- onExploreQueryResultClick: n
4119
+ toggleExpanded: c,
4120
+ onExploreQueryResultClick: t
3573
4121
  },
3574
- p.memoryTypeId
4122
+ y.memoryTypeId
3575
4123
  )),
3576
- t !== void 0 && /* @__PURE__ */ o(
4124
+ n !== void 0 && /* @__PURE__ */ o(
3577
4125
  "div",
3578
4126
  {
3579
4127
  style: {
@@ -3582,15 +4130,15 @@ const Pr = ({
3582
4130
  marginTop: "4px",
3583
4131
  fontStyle: "italic"
3584
4132
  },
3585
- children: S(i.tookSeconds, { n: t })
4133
+ children: T(i.tookSeconds, { n })
3586
4134
  }
3587
4135
  )
3588
4136
  ] });
3589
- }, Dr = ({ data: e, onSearchResultClick: r, t }) => {
3590
- const n = e.response.items, i = !!r, [l, a] = I(null);
3591
- return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
4137
+ }, vt = ({ data: e, onSearchResultClick: r, t: n }) => {
4138
+ const t = e.response.items, i = !!r, [l, s] = E(null);
4139
+ return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
3592
4140
  /* @__PURE__ */ o(
3593
- C.div,
4141
+ I.div,
3594
4142
  {
3595
4143
  style: {
3596
4144
  marginBottom: "12px",
@@ -3601,7 +4149,7 @@ const Pr = ({
3601
4149
  initial: { opacity: 0, y: -6 },
3602
4150
  animate: { opacity: 1, y: 0 },
3603
4151
  transition: { duration: 0.25 },
3604
- children: t.resultsHeading
4152
+ children: n.resultsHeading
3605
4153
  }
3606
4154
  ),
3607
4155
  /* @__PURE__ */ o(
@@ -3612,26 +4160,26 @@ const Pr = ({
3612
4160
  flexDirection: "column",
3613
4161
  gap: 0
3614
4162
  },
3615
- children: n.map((s, m) => {
3616
- const p = s.memoryTitle !== "" ? s.memoryTitle : s.memoryId, c = V(
3617
- s.chunks
3618
- ), d = [
3619
- X(s),
3620
- S(t.scoreLabel, {
3621
- n: s.matchingChunkScore.toFixed(2)
4163
+ children: t.map((c, m) => {
4164
+ const y = c.memoryTitle !== "" ? c.memoryTitle : c.memoryId, d = Y(
4165
+ c.chunks
4166
+ ), u = [
4167
+ J(c),
4168
+ T(n.scoreLabel, {
4169
+ n: c.matchingChunkScore.toFixed(2)
3622
4170
  }),
3623
- c.length > 0 ? K(c, t) : t.pagesNotAvailable
4171
+ d.length > 0 ? V(d, n) : n.pagesNotAvailable
3624
4172
  ].filter(
3625
- (f) => f != null && f !== ""
3626
- ), u = {
3627
- memoryId: s.memoryId,
3628
- memoryTitle: s.memoryTitle,
3629
- memoryTypeId: s.memoryTypeId,
3630
- memoryTypeName: s.memoryTypeName,
3631
- pageNumbers: c
3632
- }, g = `${s.memoryId}-${m}`, h = l === g;
3633
- return /* @__PURE__ */ y(
3634
- C.div,
4173
+ (S) => S != null && S !== ""
4174
+ ), p = {
4175
+ memoryId: c.memoryId,
4176
+ memoryTitle: c.memoryTitle,
4177
+ memoryTypeId: c.memoryTypeId,
4178
+ memoryTypeName: c.memoryTypeName,
4179
+ pageNumbers: d
4180
+ }, h = `${c.memoryId}-${m}`, f = l === h;
4181
+ return /* @__PURE__ */ g(
4182
+ I.div,
3635
4183
  {
3636
4184
  initial: { opacity: 0 },
3637
4185
  animate: { opacity: 1 },
@@ -3643,11 +4191,11 @@ const Pr = ({
3643
4191
  gap: "12px",
3644
4192
  paddingTop: "12px",
3645
4193
  paddingBottom: "12px",
3646
- borderBottom: m < n.length - 1 ? "1px solid #eee" : void 0,
4194
+ borderBottom: m < t.length - 1 ? "1px solid #eee" : void 0,
3647
4195
  minWidth: 0
3648
4196
  },
3649
4197
  children: [
3650
- /* @__PURE__ */ y(
4198
+ /* @__PURE__ */ g(
3651
4199
  "div",
3652
4200
  {
3653
4201
  style: {
@@ -3666,7 +4214,7 @@ const Pr = ({
3666
4214
  fontWeight: 600,
3667
4215
  color: "#333"
3668
4216
  },
3669
- children: p
4217
+ children: y
3670
4218
  }
3671
4219
  ),
3672
4220
  /* @__PURE__ */ o(
@@ -3679,7 +4227,7 @@ const Pr = ({
3679
4227
  whiteSpace: "pre-wrap",
3680
4228
  wordBreak: "break-word"
3681
4229
  },
3682
- children: Q(s.chunks)
4230
+ children: X(c.chunks)
3683
4231
  }
3684
4232
  ),
3685
4233
  /* @__PURE__ */ o(
@@ -3691,24 +4239,24 @@ const Pr = ({
3691
4239
  color: "#94a3b8",
3692
4240
  lineHeight: 1.35
3693
4241
  },
3694
- children: d.join(" · ")
4242
+ children: u.join(" · ")
3695
4243
  }
3696
4244
  )
3697
4245
  ]
3698
4246
  }
3699
4247
  ),
3700
- i && /* @__PURE__ */ y(
4248
+ i && /* @__PURE__ */ g(
3701
4249
  "button",
3702
4250
  {
3703
4251
  type: "button",
3704
- "aria-busy": h,
3705
- disabled: h,
4252
+ "aria-busy": f,
4253
+ disabled: f,
3706
4254
  onClick: async () => {
3707
- a(g);
4255
+ s(h);
3708
4256
  try {
3709
- await r(u);
4257
+ await r(p);
3710
4258
  } finally {
3711
- a(null);
4259
+ s(null);
3712
4260
  }
3713
4261
  },
3714
4262
  style: {
@@ -3721,34 +4269,34 @@ const Pr = ({
3721
4269
  background: "#eff6ff",
3722
4270
  border: "1px solid #bfdbfe",
3723
4271
  borderRadius: 6,
3724
- cursor: h ? "wait" : "pointer",
4272
+ cursor: f ? "wait" : "pointer",
3725
4273
  fontFamily: "inherit",
3726
4274
  display: "inline-flex",
3727
4275
  alignItems: "center",
3728
4276
  gap: 8
3729
4277
  },
3730
4278
  children: [
3731
- h && /* @__PURE__ */ o(
4279
+ f && /* @__PURE__ */ o(
3732
4280
  "span",
3733
4281
  {
3734
4282
  className: "explore-memory-loader explore-memory-loader--callback",
3735
4283
  "aria-hidden": !0
3736
4284
  }
3737
4285
  ),
3738
- t.viewButton
4286
+ n.viewButton
3739
4287
  ]
3740
4288
  }
3741
4289
  )
3742
4290
  ]
3743
4291
  },
3744
- `${s.memoryId}-${m}`
4292
+ `${c.memoryId}-${m}`
3745
4293
  );
3746
4294
  })
3747
4295
  }
3748
4296
  )
3749
4297
  ] });
3750
- }, j = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
3751
- C.div,
4298
+ }, N = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
4299
+ I.div,
3752
4300
  {
3753
4301
  initial: { opacity: 0, y: -10 },
3754
4302
  animate: { opacity: 1, y: 0 },
@@ -3770,173 +4318,215 @@ const Pr = ({
3770
4318
  }
3771
4319
  )
3772
4320
  }
3773
- ) }), Wr = ({
4321
+ ) });
4322
+ class Ct extends we.Component {
4323
+ constructor(r) {
4324
+ super(r), this.state = { hasError: !1 };
4325
+ }
4326
+ static getDerivedStateFromError() {
4327
+ return { hasError: !0 };
4328
+ }
4329
+ componentDidCatch(r, n) {
4330
+ console.error(
4331
+ "[fency] Progress item render failed:",
4332
+ this.props.progressItemId,
4333
+ r,
4334
+ n.componentStack
4335
+ );
4336
+ }
4337
+ render() {
4338
+ return this.state.hasError ? null : this.props.children;
4339
+ }
4340
+ }
4341
+ const wt = ({
3774
4342
  progressViewItems: e,
3775
4343
  loading: r,
3776
- error: t,
3777
- loadingText: n,
4344
+ error: n,
4345
+ loadingText: t,
3778
4346
  t: i,
3779
4347
  onSourceClick: l,
3780
- onSearchResultClick: a,
3781
- onExploreQueryResultClick: s
4348
+ onSearchResultClick: s,
4349
+ onExploreQueryResultClick: c
3782
4350
  }) => {
3783
- const m = A(null);
3784
- F(() => {
4351
+ const m = D(null);
4352
+ P(() => {
3785
4353
  m.current && (m.current.scrollTop = m.current.scrollHeight);
3786
4354
  }, [e.length]);
3787
- const p = (d) => {
3788
- const u = d.item.data;
3789
- if (u.taskType === "StreamingChatCompletion" && u.eventType === "Text")
3790
- return /* @__PURE__ */ o(ne, { text: u.text });
3791
- if (u.taskType === "StructuredChatCompletion" && u.eventType === "Completed")
3792
- return /* @__PURE__ */ o(He, { data: u });
3793
- if (u.taskType === "MemoryChat")
3794
- switch (u.eventType) {
4355
+ const y = (u) => {
4356
+ const p = u.item.data;
4357
+ if (p.taskType === "StreamingChatCompletion" && p.eventType === "Text")
4358
+ return /* @__PURE__ */ o(ie, { text: p.text });
4359
+ if (p.taskType === "StructuredChatCompletion" && p.eventType === "Completed")
4360
+ return /* @__PURE__ */ o(vr, { data: p });
4361
+ if (p.taskType === "MemoryChat")
4362
+ switch (p.eventType) {
3795
4363
  case "Text":
3796
- return /* @__PURE__ */ o(ne, { text: u.text });
4364
+ return /* @__PURE__ */ o(ie, { text: p.text });
4365
+ case "Thinking":
4366
+ return /* @__PURE__ */ o(
4367
+ at,
4368
+ {
4369
+ data: p,
4370
+ isLatest: u.isLatest,
4371
+ durationSeconds: u.durationSeconds,
4372
+ t: i
4373
+ }
4374
+ );
3797
4375
  case "FindMemories":
3798
4376
  return /* @__PURE__ */ o(
3799
- je,
4377
+ Er,
3800
4378
  {
3801
- data: u,
3802
- isLatest: d.isLatest,
3803
- durationSeconds: d.durationSeconds,
4379
+ data: p,
4380
+ isLatest: u.isLatest,
4381
+ durationSeconds: u.durationSeconds,
3804
4382
  t: i
3805
4383
  }
3806
4384
  );
3807
4385
  case "FindMemoriesResult":
3808
4386
  return /* @__PURE__ */ o(
3809
- qe,
4387
+ Mr,
3810
4388
  {
3811
- data: u,
4389
+ data: p,
3812
4390
  t: i
3813
4391
  }
3814
4392
  );
3815
4393
  case "Search":
3816
4394
  return /* @__PURE__ */ o(
3817
- _e,
4395
+ Ir,
3818
4396
  {
3819
- data: u,
3820
- isLatest: d.isLatest,
3821
- durationSeconds: d.durationSeconds,
4397
+ data: p,
4398
+ isLatest: u.isLatest,
4399
+ durationSeconds: u.durationSeconds,
3822
4400
  t: i
3823
4401
  }
3824
4402
  );
3825
4403
  case "FindSources":
3826
4404
  return /* @__PURE__ */ o(
3827
- Qe,
4405
+ Rr,
3828
4406
  {
3829
- data: u,
3830
- isLatest: d.isLatest,
3831
- durationSeconds: d.durationSeconds,
4407
+ data: p,
4408
+ isLatest: u.isLatest,
4409
+ durationSeconds: u.durationSeconds,
3832
4410
  t: i
3833
4411
  }
3834
4412
  );
3835
4413
  case "SourcesResult":
3836
4414
  return /* @__PURE__ */ o(
3837
- Ve,
4415
+ Ar,
3838
4416
  {
3839
- data: u,
4417
+ data: p,
3840
4418
  onSourceClick: l,
3841
4419
  t: i
3842
4420
  }
3843
4421
  );
3844
4422
  case "ExploreMemories":
3845
4423
  return /* @__PURE__ */ o(
3846
- Ze,
4424
+ zr,
3847
4425
  {
3848
- data: u,
3849
- completed: d.completed,
3850
- isLatest: d.isLatest,
4426
+ data: p,
4427
+ completed: u.completed,
4428
+ isLatest: u.isLatest,
3851
4429
  t: i
3852
4430
  }
3853
4431
  );
3854
4432
  case "ChunkResults":
3855
4433
  return /* @__PURE__ */ o(
3856
- sr,
4434
+ Ur,
3857
4435
  {
3858
- data: u,
3859
- onSearchResultClick: a,
4436
+ data: p,
4437
+ onSearchResultClick: s,
3860
4438
  t: i
3861
4439
  }
3862
4440
  );
3863
4441
  case "GoogleSearch":
3864
4442
  return /* @__PURE__ */ o(
3865
- lr,
4443
+ Kr,
3866
4444
  {
3867
- data: u,
3868
- isLatest: d.isLatest,
3869
- durationSeconds: d.durationSeconds,
4445
+ data: p,
4446
+ isLatest: u.isLatest,
4447
+ durationSeconds: u.durationSeconds,
3870
4448
  t: i
3871
4449
  }
3872
4450
  );
3873
- case "GoogleSearchResult":
3874
- return /* @__PURE__ */ o(ur, { data: u, t: i });
3875
- case "Scrape":
4451
+ case "ScrapeWebsites":
3876
4452
  return /* @__PURE__ */ o(
3877
- mr,
4453
+ ot,
3878
4454
  {
3879
- data: u,
3880
- isLatest: d.isLatest,
3881
- durationSeconds: d.durationSeconds,
4455
+ data: p,
4456
+ isLatest: u.isLatest,
4457
+ durationSeconds: u.durationSeconds,
3882
4458
  t: i
3883
4459
  }
3884
4460
  );
3885
- case "ScrapeResult":
3886
- return /* @__PURE__ */ o(hr, { data: u, t: i });
3887
4461
  case "Completed":
3888
4462
  return null;
4463
+ default: {
4464
+ const h = p;
4465
+ return h.eventType === "Error" && "message" in h ? /* @__PURE__ */ o(N, { message: h.message }) : (console.warn(
4466
+ "[fency] Unknown MemoryChat eventType (no UI):",
4467
+ h.eventType,
4468
+ h
4469
+ ), null);
4470
+ }
3889
4471
  }
3890
- if (u.taskType === "MemorySearch")
3891
- switch (u.eventType) {
4472
+ if (p.taskType === "MemorySearch")
4473
+ switch (p.eventType) {
3892
4474
  case "GeneratingQueries":
3893
4475
  return /* @__PURE__ */ o(
3894
- Er,
4476
+ gt,
3895
4477
  {
3896
- data: u,
3897
- isLatest: d.isLatest,
3898
- durationSeconds: d.durationSeconds,
4478
+ data: p,
4479
+ isLatest: u.isLatest,
4480
+ durationSeconds: u.durationSeconds,
3899
4481
  t: i
3900
4482
  }
3901
4483
  );
3902
4484
  case "ExploreQueries":
3903
4485
  return /* @__PURE__ */ o(
3904
- Pr,
4486
+ kt,
3905
4487
  {
3906
- data: u,
3907
- isLatest: d.isLatest,
3908
- durationSeconds: d.durationSeconds,
3909
- onExploreQueryResultClick: s,
4488
+ data: p,
4489
+ isLatest: u.isLatest,
4490
+ durationSeconds: u.durationSeconds,
4491
+ onExploreQueryResultClick: c,
3910
4492
  t: i
3911
4493
  }
3912
4494
  );
3913
4495
  case "SearchMemoryTypes":
3914
4496
  return /* @__PURE__ */ o(
3915
- kr,
4497
+ ct,
3916
4498
  {
3917
- data: u,
3918
- isLatest: d.isLatest,
3919
- durationSeconds: d.durationSeconds,
4499
+ data: p,
4500
+ isLatest: u.isLatest,
4501
+ durationSeconds: u.durationSeconds,
3920
4502
  t: i
3921
4503
  }
3922
4504
  );
3923
4505
  case "Completed":
3924
4506
  return /* @__PURE__ */ o(
3925
- Dr,
4507
+ vt,
3926
4508
  {
3927
- data: u,
3928
- onSearchResultClick: a,
4509
+ data: p,
4510
+ onSearchResultClick: s,
3929
4511
  t: i
3930
4512
  }
3931
4513
  );
4514
+ default: {
4515
+ const h = p;
4516
+ return h.eventType === "Error" && "message" in h ? /* @__PURE__ */ o(N, { message: h.message }) : (console.warn(
4517
+ "[fency] Unknown MemorySearch eventType (no UI):",
4518
+ h.eventType,
4519
+ h
4520
+ ), null);
4521
+ }
3932
4522
  }
3933
- return u.taskType === "StreamingChatCompletion" && u.eventType === "Completed" ? null : u.eventType === "Error" && "message" in u ? /* @__PURE__ */ o(j, { message: u.message }) : null;
4523
+ return p.taskType === "StreamingChatCompletion" && p.eventType === "Completed" ? null : p.eventType === "Error" && "message" in p ? /* @__PURE__ */ o(N, { message: p.message }) : null;
3934
4524
  };
3935
4525
  if (e.length === 0)
3936
- return t ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(j, { message: t.message }) }) : r ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
3937
- M,
4526
+ return n ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(N, { message: n.message }) }) : r ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
4527
+ R,
3938
4528
  {
3939
- text: n ?? i.processingYourTask,
4529
+ text: t ?? i.processingYourTask,
3940
4530
  duration: 1.5,
3941
4531
  repeat: !0,
3942
4532
  repeatDelay: 0,
@@ -3944,68 +4534,76 @@ const Pr = ({
3944
4534
  shimmerColor: "#000"
3945
4535
  }
3946
4536
  ) }) : null;
3947
- const c = e.filter((d, u) => {
3948
- const g = d.item.data;
3949
- return g.taskType === "MemoryChat" && g.eventType === "ExploreMemories" ? !e.slice(u + 1).some(
3950
- (x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ExploreMemories"
3951
- ) : g.taskType === "MemorySearch" && g.eventType === "GeneratingQueries" ? !e.slice(u + 1).some(
3952
- (x) => x.item.data.taskType === "MemorySearch" && x.item.data.eventType === "GeneratingQueries"
3953
- ) : g.taskType === "MemorySearch" && g.eventType === "ExploreQueries" ? !e.slice(u + 1).some(
3954
- (x) => x.item.data.taskType === "MemorySearch" && x.item.data.eventType === "ExploreQueries"
3955
- ) : g.taskType === "MemoryChat" && g.eventType === "ChunkResults" ? !e.slice(u + 1).some(
3956
- (x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ChunkResults"
3957
- ) : g.taskType === "MemoryChat" && g.eventType === "GoogleSearch" ? !e.slice(u + 1).some(
3958
- (x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "GoogleSearch"
3959
- ) : g.taskType === "MemoryChat" && g.eventType === "Scrape" ? !e.slice(u + 1).some(
3960
- (x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "Scrape"
4537
+ const d = e.filter((u, p) => {
4538
+ const h = u.item.data;
4539
+ return h.taskType === "MemoryChat" && h.eventType === "ExploreMemories" ? !e.slice(p + 1).some(
4540
+ (k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "ExploreMemories"
4541
+ ) : h.taskType === "MemorySearch" && h.eventType === "GeneratingQueries" ? !e.slice(p + 1).some(
4542
+ (k) => k.item.data.taskType === "MemorySearch" && k.item.data.eventType === "GeneratingQueries"
4543
+ ) : h.taskType === "MemorySearch" && h.eventType === "ExploreQueries" ? !e.slice(p + 1).some(
4544
+ (k) => k.item.data.taskType === "MemorySearch" && k.item.data.eventType === "ExploreQueries"
4545
+ ) : h.taskType === "MemoryChat" && h.eventType === "ChunkResults" ? !e.slice(p + 1).some(
4546
+ (k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "ChunkResults"
4547
+ ) : h.taskType === "MemoryChat" && h.eventType === "GoogleSearch" ? !e.slice(p + 1).some(
4548
+ (k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "GoogleSearch"
4549
+ ) : h.taskType === "MemoryChat" && h.eventType === "Thinking" ? !e.slice(p + 1).some(
4550
+ (k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "Thinking"
4551
+ ) : h.taskType === "MemoryChat" && h.eventType === "ScrapeWebsites" ? !e.slice(p + 1).some(
4552
+ (k) => k.item.data.taskType === "MemoryChat" && k.item.data.eventType === "ScrapeWebsites"
3961
4553
  ) : !0;
3962
4554
  });
3963
- return /* @__PURE__ */ y("div", { id: "agent-task-progress-verbose", ref: m, children: [
3964
- /* @__PURE__ */ o(xe, { children: c.map((d, u) => /* @__PURE__ */ o(
3965
- C.div,
4555
+ return /* @__PURE__ */ g("div", { id: "agent-task-progress-verbose", ref: m, children: [
4556
+ /* @__PURE__ */ o(Re, { children: d.map((u, p) => /* @__PURE__ */ o(
4557
+ I.div,
3966
4558
  {
3967
- id: `agent-task-progress-item-${d.item.progressItemId}`,
4559
+ id: `agent-task-progress-item-${u.item.progressItemId}`,
3968
4560
  initial: { opacity: 0, y: -20 },
3969
4561
  animate: { opacity: 1, y: 0 },
3970
4562
  transition: {
3971
4563
  duration: 0.4,
3972
- delay: u * 0.1,
4564
+ delay: p * 0.1,
3973
4565
  ease: "easeOut"
3974
4566
  },
3975
- children: p(d)
4567
+ children: /* @__PURE__ */ o(
4568
+ Ct,
4569
+ {
4570
+ progressItemId: u.item.progressItemId,
4571
+ children: y(u)
4572
+ }
4573
+ )
3976
4574
  },
3977
- d.item.progressItemId
4575
+ u.item.progressItemId
3978
4576
  )) }),
3979
- t ? /* @__PURE__ */ o("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ o(j, { message: t.message }) }) : null
4577
+ n ? /* @__PURE__ */ o("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ o(N, { message: n.message }) }) : null
3980
4578
  ] });
3981
- }, jr = ({
4579
+ }, Wt = ({
3982
4580
  agentTask: e,
3983
4581
  language: r,
3984
- onSourceClick: t,
3985
- onSearchResultClick: n,
4582
+ onSourceClick: n,
4583
+ onSearchResultClick: t,
3986
4584
  onExploreQueryResultClick: i
3987
4585
  }) => {
3988
- const l = Ne(e), a = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : r ?? "en", s = Ue(a);
4586
+ const l = kr(e), s = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : r ?? "en", c = wr(s);
3989
4587
  return /* @__PURE__ */ o(
3990
- Wr,
4588
+ wt,
3991
4589
  {
3992
4590
  progressViewItems: l,
3993
4591
  loading: e.loading,
3994
4592
  error: e.error,
3995
4593
  loadingText: e.loadingText,
3996
- t: s,
3997
- onSourceClick: t,
3998
- onSearchResultClick: n,
4594
+ t: c,
4595
+ onSourceClick: n,
4596
+ onSearchResultClick: t,
3999
4597
  onExploreQueryResultClick: i
4000
4598
  }
4001
4599
  );
4002
4600
  };
4003
4601
  export {
4004
- jr as AgentTaskProgress,
4602
+ Wt as AgentTaskProgress,
4005
4603
  L as Checkmark,
4006
- Ur as FencyProvider,
4007
- Dr as MemorySearchCompletedResults,
4008
- Ae as StreamEventManager,
4009
- H as XMark,
4010
- _r as useAgentTasks
4604
+ Lt as FencyProvider,
4605
+ vt as MemorySearchCompletedResults,
4606
+ $e as StreamEventManager,
4607
+ j as XMark,
4608
+ zt as useAgentTasks
4011
4609
  };