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