@fencyai/react 0.1.161 → 0.1.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as y, jsx as i, Fragment as I } from "react/jsx-runtime";
|
|
2
2
|
import { createStream as ie, isStreamTimeoutEvent as ae, isStreamNotFoundEvent as se, isAgentTaskProgressItemUpdatedEvent as le, createAgentTask as ce } from "@fencyai/js";
|
|
3
|
-
import { createContext as de, useState as
|
|
4
|
-
import { useInView as ue, motion as
|
|
3
|
+
import { createContext as de, useState as v, useRef as F, useEffect as A, useCallback as G, useContext as me, useMemo as D } from "react";
|
|
4
|
+
import { useInView as ue, motion as b, AnimatePresence as X } from "motion/react";
|
|
5
5
|
import ye from "react-markdown";
|
|
6
6
|
import { Prism as J } from "react-syntax-highlighter";
|
|
7
|
-
import
|
|
7
|
+
import ge from "remark-gfm";
|
|
8
8
|
import './assets/index.css';const Y = de(
|
|
9
9
|
void 0
|
|
10
10
|
);
|
|
11
|
-
async function
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
for (; !(
|
|
15
|
-
r(
|
|
11
|
+
async function pe(e, r) {
|
|
12
|
+
const t = e.getReader();
|
|
13
|
+
let n;
|
|
14
|
+
for (; !(n = await t.read()).done; )
|
|
15
|
+
r(n.value);
|
|
16
16
|
}
|
|
17
17
|
function he(e) {
|
|
18
|
-
let r,
|
|
18
|
+
let r, t, n, l = !1;
|
|
19
19
|
return function(s) {
|
|
20
|
-
r === void 0 ? (r = s,
|
|
20
|
+
r === void 0 ? (r = s, t = 0, n = -1) : r = Se(r, s);
|
|
21
21
|
const d = r.length;
|
|
22
22
|
let m = 0;
|
|
23
|
-
for (;
|
|
24
|
-
l && (r[
|
|
23
|
+
for (; t < d; ) {
|
|
24
|
+
l && (r[t] === 10 && (m = ++t), l = !1);
|
|
25
25
|
let o = -1;
|
|
26
|
-
for (;
|
|
27
|
-
switch (r[
|
|
26
|
+
for (; t < d && o === -1; ++t)
|
|
27
|
+
switch (r[t]) {
|
|
28
28
|
case 58:
|
|
29
|
-
|
|
29
|
+
n === -1 && (n = t - m);
|
|
30
30
|
break;
|
|
31
31
|
case 13:
|
|
32
32
|
l = !0;
|
|
33
33
|
case 10:
|
|
34
|
-
o =
|
|
34
|
+
o = t;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
37
|
if (o === -1)
|
|
38
38
|
break;
|
|
39
|
-
e(r.subarray(m, o),
|
|
39
|
+
e(r.subarray(m, o), n), m = t, n = -1;
|
|
40
40
|
}
|
|
41
|
-
m === d ? r = void 0 : m !== 0 && (r = r.subarray(m),
|
|
41
|
+
m === d ? r = void 0 : m !== 0 && (r = r.subarray(m), t -= m);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function fe(e, r,
|
|
45
|
-
let
|
|
44
|
+
function fe(e, r, t) {
|
|
45
|
+
let n = q();
|
|
46
46
|
const l = new TextDecoder();
|
|
47
47
|
return function(s, d) {
|
|
48
48
|
if (s.length === 0)
|
|
49
|
-
|
|
49
|
+
t == null || t(n), n = q();
|
|
50
50
|
else if (d > 0) {
|
|
51
51
|
const m = l.decode(s.subarray(0, d)), o = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(o));
|
|
52
52
|
switch (m) {
|
|
53
53
|
case "data":
|
|
54
|
-
|
|
54
|
+
n.data = n.data ? n.data + `
|
|
55
55
|
` + a : a;
|
|
56
56
|
break;
|
|
57
57
|
case "event":
|
|
58
|
-
|
|
58
|
+
n.event = a;
|
|
59
59
|
break;
|
|
60
60
|
case "id":
|
|
61
|
-
e(
|
|
61
|
+
e(n.id = a);
|
|
62
62
|
break;
|
|
63
63
|
case "retry":
|
|
64
64
|
const u = parseInt(a, 10);
|
|
65
|
-
isNaN(u) || r(
|
|
65
|
+
isNaN(u) || r(n.retry = u);
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
function Se(e, r) {
|
|
72
|
-
const
|
|
73
|
-
return
|
|
72
|
+
const t = new Uint8Array(e.length + r.length);
|
|
73
|
+
return t.set(e), t.set(r, e.length), t;
|
|
74
74
|
}
|
|
75
75
|
function q() {
|
|
76
76
|
return {
|
|
@@ -81,49 +81,49 @@ function q() {
|
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
var xe = function(e, r) {
|
|
84
|
-
var
|
|
85
|
-
for (var
|
|
84
|
+
var t = {};
|
|
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")
|
|
87
|
-
for (var l = 0,
|
|
88
|
-
r.indexOf(
|
|
89
|
-
return
|
|
87
|
+
for (var l = 0, n = Object.getOwnPropertySymbols(e); l < n.length; l++)
|
|
88
|
+
r.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (t[n[l]] = e[n[l]]);
|
|
89
|
+
return t;
|
|
90
90
|
};
|
|
91
91
|
const _ = "text/event-stream", Te = 1e3, U = "last-event-id";
|
|
92
92
|
function ke(e, r) {
|
|
93
|
-
var { signal:
|
|
93
|
+
var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a = xe(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
94
|
return new Promise((u, g) => {
|
|
95
|
-
const f = Object.assign({},
|
|
95
|
+
const f = Object.assign({}, n);
|
|
96
96
|
f.accept || (f.accept = _);
|
|
97
|
-
let
|
|
97
|
+
let p;
|
|
98
98
|
function S() {
|
|
99
|
-
|
|
99
|
+
p.abort(), document.hidden || R();
|
|
100
100
|
}
|
|
101
101
|
m || document.addEventListener("visibilitychange", S);
|
|
102
|
-
let h = Te,
|
|
103
|
-
function
|
|
104
|
-
document.removeEventListener("visibilitychange", S), window.clearTimeout(
|
|
102
|
+
let h = Te, T = 0;
|
|
103
|
+
function k() {
|
|
104
|
+
document.removeEventListener("visibilitychange", S), window.clearTimeout(T), p.abort();
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
t == null || t.addEventListener("abort", () => {
|
|
107
|
+
k(), u();
|
|
108
108
|
});
|
|
109
|
-
const
|
|
109
|
+
const C = o ?? window.fetch, E = l ?? be;
|
|
110
110
|
async function R() {
|
|
111
111
|
var L;
|
|
112
|
-
|
|
112
|
+
p = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const P = await
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
}, (
|
|
118
|
-
h =
|
|
119
|
-
}, c))), s == null || s(),
|
|
114
|
+
const P = await C(e, Object.assign(Object.assign({}, a), { headers: f, signal: p.signal }));
|
|
115
|
+
await E(P), await pe(P.body, he(fe((M) => {
|
|
116
|
+
M ? f[U] = M : delete f[U];
|
|
117
|
+
}, (M) => {
|
|
118
|
+
h = M;
|
|
119
|
+
}, c))), s == null || s(), k(), u();
|
|
120
120
|
} catch (P) {
|
|
121
|
-
if (!
|
|
121
|
+
if (!p.signal.aborted)
|
|
122
122
|
try {
|
|
123
|
-
const
|
|
124
|
-
window.clearTimeout(
|
|
125
|
-
} catch (
|
|
126
|
-
|
|
123
|
+
const M = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : h;
|
|
124
|
+
window.clearTimeout(T), T = window.setTimeout(R, M);
|
|
125
|
+
} catch (M) {
|
|
126
|
+
k(), g(M);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
@@ -136,10 +136,10 @@ function be(e) {
|
|
|
136
136
|
throw new Error(`Expected content-type to be ${_}, Actual: ${r}`);
|
|
137
137
|
}
|
|
138
138
|
function ve(e) {
|
|
139
|
-
const r = atob(e),
|
|
140
|
-
for (let
|
|
141
|
-
n
|
|
142
|
-
return new TextDecoder("utf-8").decode(
|
|
139
|
+
const r = atob(e), t = new Uint8Array(r.length);
|
|
140
|
+
for (let n = 0; n < r.length; n++)
|
|
141
|
+
t[n] = r.charCodeAt(n);
|
|
142
|
+
return new TextDecoder("utf-8").decode(t);
|
|
143
143
|
}
|
|
144
144
|
class Ce {
|
|
145
145
|
constructor(r) {
|
|
@@ -150,25 +150,25 @@ class Ce {
|
|
|
150
150
|
* Creates new connections and removes old ones.
|
|
151
151
|
*/
|
|
152
152
|
updateStreams(r) {
|
|
153
|
-
r.forEach((
|
|
154
|
-
const l =
|
|
155
|
-
this.eventSources.has(l) || this.connectStream(
|
|
153
|
+
r.forEach((n) => {
|
|
154
|
+
const l = n.stream.id;
|
|
155
|
+
this.eventSources.has(l) || this.connectStream(n);
|
|
156
156
|
});
|
|
157
|
-
const
|
|
158
|
-
this.eventSources.forEach((
|
|
159
|
-
|
|
157
|
+
const t = new Set(r.map((n) => n.stream.id));
|
|
158
|
+
this.eventSources.forEach((n, l) => {
|
|
159
|
+
t.has(l) || (n.abort(), this.eventSources.delete(l));
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
connectStream(r) {
|
|
163
|
-
const
|
|
164
|
-
this.eventSources.set(
|
|
165
|
-
const l = `${this.fency.baseUrl}/sse/streams/${
|
|
163
|
+
const t = r.stream.id, n = new AbortController();
|
|
164
|
+
this.eventSources.set(t, n);
|
|
165
|
+
const l = `${this.fency.baseUrl}/sse/streams/${t}`, c = {
|
|
166
166
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
167
167
|
"X-Fency-Stream-Token": r.stream.token
|
|
168
168
|
};
|
|
169
169
|
ke(l, {
|
|
170
170
|
headers: c,
|
|
171
|
-
signal:
|
|
171
|
+
signal: n.signal,
|
|
172
172
|
async onopen(s) {
|
|
173
173
|
if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
|
|
174
174
|
throw new Error(`Client error ${s.status}`);
|
|
@@ -176,11 +176,11 @@ class Ce {
|
|
|
176
176
|
onmessage: (s) => {
|
|
177
177
|
if (s.data) {
|
|
178
178
|
const d = ve(s.data);
|
|
179
|
-
this.broadcast(d,
|
|
179
|
+
this.broadcast(d, t);
|
|
180
180
|
}
|
|
181
181
|
},
|
|
182
182
|
onerror: (s) => {
|
|
183
|
-
throw console.error("EventSource error for stream",
|
|
183
|
+
throw console.error("EventSource error for stream", t, ":", s), this.broadcastError(t), s;
|
|
184
184
|
},
|
|
185
185
|
onclose() {
|
|
186
186
|
}
|
|
@@ -190,19 +190,19 @@ class Ce {
|
|
|
190
190
|
* Subscribe to events from all active streams.
|
|
191
191
|
* Returns an unsubscribe function.
|
|
192
192
|
*/
|
|
193
|
-
subscribe(r,
|
|
194
|
-
return this.subscribers.set(r,
|
|
193
|
+
subscribe(r, t) {
|
|
194
|
+
return this.subscribers.set(r, t), () => {
|
|
195
195
|
this.subscribers.delete(r);
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
broadcast(r,
|
|
199
|
-
this.subscribers.forEach((
|
|
200
|
-
|
|
198
|
+
broadcast(r, t) {
|
|
199
|
+
this.subscribers.forEach((n) => {
|
|
200
|
+
n.onMessage(r, t);
|
|
201
201
|
});
|
|
202
202
|
}
|
|
203
203
|
broadcastError(r) {
|
|
204
|
-
this.subscribers.forEach((
|
|
205
|
-
|
|
204
|
+
this.subscribers.forEach((t) => {
|
|
205
|
+
t.onError(r);
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
208
|
/**
|
|
@@ -214,23 +214,23 @@ class Ce {
|
|
|
214
214
|
}
|
|
215
215
|
const Ee = 12e4, we = (e) => {
|
|
216
216
|
const r = Date.now();
|
|
217
|
-
return e.filter((
|
|
217
|
+
return e.filter((t) => r - t.createdAt < Ee);
|
|
218
218
|
};
|
|
219
|
-
function Ir({ fency: e, fetchCreateStreamClientToken: r, children:
|
|
220
|
-
const [
|
|
219
|
+
function Ir({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
|
|
220
|
+
const [n, l] = v(
|
|
221
221
|
null
|
|
222
|
-
), [c, s] =
|
|
223
|
-
|
|
222
|
+
), [c, s] = v(!0), [d, m] = v(null), [o, a] = v([]), u = F(null), g = F(null);
|
|
223
|
+
A(() => {
|
|
224
224
|
e.then((h) => {
|
|
225
225
|
l(h), s(!1);
|
|
226
226
|
}).catch((h) => {
|
|
227
227
|
m(h), s(!1);
|
|
228
228
|
});
|
|
229
|
-
}, [e]),
|
|
230
|
-
|
|
231
|
-
}, [
|
|
229
|
+
}, [e]), A(() => {
|
|
230
|
+
n && !g.current && (g.current = new Ce(n));
|
|
231
|
+
}, [n]), A(() => {
|
|
232
232
|
g.current && g.current.updateStreams(o);
|
|
233
|
-
}, [o]),
|
|
233
|
+
}, [o]), A(() => () => {
|
|
234
234
|
var h;
|
|
235
235
|
(h = g.current) == null || h.cleanup();
|
|
236
236
|
}, []);
|
|
@@ -238,16 +238,16 @@ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
|
|
|
238
238
|
async (h = 3e4) => {
|
|
239
239
|
if (u.current)
|
|
240
240
|
return u.current;
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
return
|
|
244
|
-
const
|
|
245
|
-
if (!
|
|
241
|
+
const T = Date.now(), k = o.length > 0 ? o[o.length - 1] : null;
|
|
242
|
+
if (k && T - k.createdAt < h)
|
|
243
|
+
return k.stream;
|
|
244
|
+
const C = (async () => {
|
|
245
|
+
if (!n)
|
|
246
246
|
throw new Error("Fency instance not initialized");
|
|
247
|
-
const
|
|
248
|
-
pk:
|
|
249
|
-
baseUrl:
|
|
250
|
-
clientToken: (
|
|
247
|
+
const E = await r(), R = await ie({
|
|
248
|
+
pk: n.publishableKey,
|
|
249
|
+
baseUrl: n.baseUrl,
|
|
250
|
+
clientToken: (E == null ? void 0 : E.clientToken) ?? ""
|
|
251
251
|
});
|
|
252
252
|
if (R.type === "success") {
|
|
253
253
|
const L = {
|
|
@@ -255,33 +255,33 @@ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
|
|
|
255
255
|
createdAt: Date.now()
|
|
256
256
|
};
|
|
257
257
|
return a((P) => {
|
|
258
|
-
const
|
|
259
|
-
return we(
|
|
258
|
+
const M = [...P, L];
|
|
259
|
+
return we(M);
|
|
260
260
|
}), u.current = null, R.stream;
|
|
261
261
|
} else
|
|
262
262
|
throw u.current = null, new Error("Failed to create stream");
|
|
263
263
|
})();
|
|
264
|
-
return u.current =
|
|
264
|
+
return u.current = C, C;
|
|
265
265
|
},
|
|
266
|
-
[
|
|
266
|
+
[n, o]
|
|
267
267
|
);
|
|
268
268
|
if (d)
|
|
269
|
-
return /* @__PURE__ */
|
|
269
|
+
return /* @__PURE__ */ y("div", { children: [
|
|
270
270
|
"Fency error: ",
|
|
271
271
|
d.message
|
|
272
272
|
] });
|
|
273
|
-
if (!
|
|
273
|
+
if (!n)
|
|
274
274
|
return null;
|
|
275
|
-
const
|
|
276
|
-
fency:
|
|
275
|
+
const p = o.length > 0 ? o[o.length - 1] : null, S = {
|
|
276
|
+
fency: n,
|
|
277
277
|
loading: c,
|
|
278
278
|
error: d,
|
|
279
279
|
activeStreams: o,
|
|
280
|
-
latestStream:
|
|
280
|
+
latestStream: p,
|
|
281
281
|
eventManager: g.current,
|
|
282
282
|
getOrCreateStream: f
|
|
283
283
|
};
|
|
284
|
-
return /* @__PURE__ */ i(Y.Provider, { value: S, children:
|
|
284
|
+
return /* @__PURE__ */ i(Y.Provider, { value: S, children: t });
|
|
285
285
|
}
|
|
286
286
|
function Z() {
|
|
287
287
|
const e = me(Y);
|
|
@@ -313,8 +313,8 @@ const Ie = (e) => {
|
|
|
313
313
|
createdAt: e.createdAt,
|
|
314
314
|
data: JSON.parse(e.data)
|
|
315
315
|
}), Pe = (e) => {
|
|
316
|
-
const r = Z(), [
|
|
317
|
-
return
|
|
316
|
+
const r = Z(), [t, n] = v(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
317
|
+
return A(() => {
|
|
318
318
|
if (!r.eventManager) return;
|
|
319
319
|
const s = {
|
|
320
320
|
onMessage: (m, o) => {
|
|
@@ -352,7 +352,7 @@ const Ie = (e) => {
|
|
|
352
352
|
createStream: async () => {
|
|
353
353
|
try {
|
|
354
354
|
const s = await r.getOrCreateStream(3e4);
|
|
355
|
-
return
|
|
355
|
+
return n(s), {
|
|
356
356
|
type: "success",
|
|
357
357
|
stream: s
|
|
358
358
|
};
|
|
@@ -366,61 +366,61 @@ const Ie = (e) => {
|
|
|
366
366
|
};
|
|
367
367
|
}
|
|
368
368
|
},
|
|
369
|
-
stream:
|
|
369
|
+
stream: t
|
|
370
370
|
};
|
|
371
371
|
}, Mr = (e) => {
|
|
372
|
-
const r = Z(), [
|
|
372
|
+
const r = Z(), [t, n] = v([]), l = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), { createStream: s } = Pe({
|
|
373
373
|
onAgentTaskProgressItemUpdated: (o) => {
|
|
374
374
|
var g;
|
|
375
375
|
if (!l.current.has(o.agentTaskId)) return;
|
|
376
376
|
const a = o.data;
|
|
377
377
|
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") {
|
|
378
378
|
const f = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
|
|
379
|
-
|
|
379
|
+
n(
|
|
380
380
|
f ? (S) => S.map((h) => {
|
|
381
|
-
var
|
|
382
|
-
if (((
|
|
381
|
+
var C;
|
|
382
|
+
if (((C = h.confirmedData) == null ? void 0 : C.taskId) !== o.agentTaskId)
|
|
383
383
|
return h;
|
|
384
|
-
const
|
|
385
|
-
(
|
|
384
|
+
const k = h.progressItems.some(
|
|
385
|
+
(E) => E.progressItemId === o.progressItemId
|
|
386
386
|
) ? h.progressItems.map(
|
|
387
|
-
(
|
|
387
|
+
(E) => E.progressItemId === o.progressItemId ? o : E
|
|
388
388
|
) : [...h.progressItems, o];
|
|
389
389
|
return {
|
|
390
390
|
...h,
|
|
391
|
-
progressItems:
|
|
391
|
+
progressItems: k,
|
|
392
392
|
loading: !1
|
|
393
393
|
};
|
|
394
394
|
}) : (S) => S.map(
|
|
395
395
|
(h) => {
|
|
396
|
-
var
|
|
397
|
-
return ((
|
|
396
|
+
var T;
|
|
397
|
+
return ((T = h.confirmedData) == null ? void 0 : T.taskId) === o.agentTaskId ? { ...h, loading: !1 } : h;
|
|
398
398
|
}
|
|
399
399
|
)
|
|
400
400
|
);
|
|
401
|
-
const
|
|
401
|
+
const p = c.current.get(
|
|
402
402
|
o.agentTaskId
|
|
403
403
|
);
|
|
404
|
-
|
|
404
|
+
p && (c.current.delete(o.agentTaskId), p(a));
|
|
405
405
|
return;
|
|
406
406
|
}
|
|
407
|
-
(g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, o),
|
|
408
|
-
(f) => f.map((
|
|
409
|
-
var
|
|
410
|
-
if (((
|
|
411
|
-
return
|
|
412
|
-
const h =
|
|
413
|
-
(
|
|
414
|
-
) ?
|
|
415
|
-
(
|
|
416
|
-
) : [...
|
|
417
|
-
return { ...
|
|
407
|
+
(g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, o), n(
|
|
408
|
+
(f) => f.map((p) => {
|
|
409
|
+
var T;
|
|
410
|
+
if (((T = p.confirmedData) == null ? void 0 : T.taskId) !== o.agentTaskId)
|
|
411
|
+
return p;
|
|
412
|
+
const h = p.progressItems.some(
|
|
413
|
+
(k) => k.progressItemId === o.progressItemId
|
|
414
|
+
) ? p.progressItems.map(
|
|
415
|
+
(k) => k.progressItemId === o.progressItemId ? o : k
|
|
416
|
+
) : [...p.progressItems, o];
|
|
417
|
+
return { ...p, progressItems: h };
|
|
418
418
|
})
|
|
419
419
|
);
|
|
420
420
|
},
|
|
421
421
|
onStreamError: (o) => {
|
|
422
422
|
var a;
|
|
423
|
-
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o),
|
|
423
|
+
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), n((u) => {
|
|
424
424
|
const g = u.find((f) => f.streamId === o.streamId);
|
|
425
425
|
return g ? [
|
|
426
426
|
...u.filter((f) => f.streamId !== o.streamId),
|
|
@@ -442,26 +442,25 @@ const Ie = (e) => {
|
|
|
442
442
|
}
|
|
443
443
|
}), d = G(
|
|
444
444
|
async (o, a) => {
|
|
445
|
+
var f;
|
|
445
446
|
const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = await s();
|
|
446
447
|
if (g.type === "success") {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
]);
|
|
461
|
-
const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(o.type), y = await ce({
|
|
448
|
+
const p = (/* @__PURE__ */ new Date()).toISOString(), S = {
|
|
449
|
+
taskKey: u,
|
|
450
|
+
streamId: g.stream.id,
|
|
451
|
+
triggeredAt: p,
|
|
452
|
+
confirmedData: null,
|
|
453
|
+
error: null,
|
|
454
|
+
params: o,
|
|
455
|
+
progressItems: [],
|
|
456
|
+
loading: !0,
|
|
457
|
+
loadingText: a == null ? void 0 : a.loadingText
|
|
458
|
+
};
|
|
459
|
+
n((k) => [...k, S]), (f = a == null ? void 0 : a.onTaskRegistered) == null || f.call(a, S);
|
|
460
|
+
const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(o.type), T = await ce({
|
|
462
461
|
pk: r.fency.publishableKey,
|
|
463
462
|
baseUrl: r.fency.baseUrl,
|
|
464
|
-
clientToken:
|
|
463
|
+
clientToken: h,
|
|
465
464
|
streamToken: g.stream.token,
|
|
466
465
|
request: {
|
|
467
466
|
streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
|
|
@@ -492,50 +491,50 @@ const Ie = (e) => {
|
|
|
492
491
|
} : void 0
|
|
493
492
|
}
|
|
494
493
|
});
|
|
495
|
-
if (
|
|
494
|
+
if (T.type === "success" && T.agentTask) {
|
|
496
495
|
l.current.add(
|
|
497
|
-
|
|
498
|
-
),
|
|
499
|
-
...
|
|
496
|
+
T.agentTask.id
|
|
497
|
+
), n((C) => [
|
|
498
|
+
...C.filter((E) => E.taskKey !== u),
|
|
500
499
|
{
|
|
501
500
|
taskKey: u,
|
|
502
501
|
streamId: g.stream.id,
|
|
503
502
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
504
|
-
taskId:
|
|
505
|
-
createdAt:
|
|
503
|
+
taskId: T.agentTask.id,
|
|
504
|
+
createdAt: T.agentTask.createdAt,
|
|
506
505
|
error: null,
|
|
507
506
|
params: o,
|
|
508
507
|
progressItems: [],
|
|
509
508
|
loading: !0,
|
|
510
509
|
loadingText: a == null ? void 0 : a.loadingText,
|
|
511
510
|
confirmedData: {
|
|
512
|
-
taskId:
|
|
513
|
-
createdAt:
|
|
511
|
+
taskId: T.agentTask.id,
|
|
512
|
+
createdAt: T.agentTask.createdAt
|
|
514
513
|
}
|
|
515
514
|
}
|
|
516
515
|
]);
|
|
517
|
-
const
|
|
516
|
+
const k = await new Promise((C) => {
|
|
518
517
|
c.current.set(
|
|
519
|
-
|
|
520
|
-
|
|
518
|
+
T.agentTask.id,
|
|
519
|
+
C
|
|
521
520
|
);
|
|
522
521
|
});
|
|
523
522
|
return {
|
|
524
523
|
type: "success",
|
|
525
524
|
streamId: g.stream.id,
|
|
526
|
-
agentTaskId:
|
|
527
|
-
response:
|
|
525
|
+
agentTaskId: T.agentTask.id,
|
|
526
|
+
response: k
|
|
528
527
|
};
|
|
529
528
|
} else {
|
|
530
|
-
if (
|
|
531
|
-
return
|
|
532
|
-
...
|
|
529
|
+
if (T.type === "error")
|
|
530
|
+
return n((k) => [
|
|
531
|
+
...k.filter((C) => C.taskKey !== u),
|
|
533
532
|
{
|
|
534
533
|
taskKey: u,
|
|
535
534
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
536
535
|
streamId: g.stream.id,
|
|
537
536
|
params: o,
|
|
538
|
-
error:
|
|
537
|
+
error: T.error,
|
|
539
538
|
progressItems: [],
|
|
540
539
|
loading: !1,
|
|
541
540
|
loadingText: a == null ? void 0 : a.loadingText,
|
|
@@ -543,20 +542,20 @@ const Ie = (e) => {
|
|
|
543
542
|
}
|
|
544
543
|
]), {
|
|
545
544
|
type: "error",
|
|
546
|
-
error:
|
|
545
|
+
error: T.error
|
|
547
546
|
};
|
|
548
547
|
{
|
|
549
|
-
const
|
|
548
|
+
const k = {
|
|
550
549
|
message: "No response received",
|
|
551
550
|
code: "UnknownError"
|
|
552
551
|
};
|
|
553
|
-
return
|
|
554
|
-
...
|
|
552
|
+
return n((C) => [
|
|
553
|
+
...C.filter((E) => E.taskKey !== u),
|
|
555
554
|
{
|
|
556
555
|
taskKey: u,
|
|
557
556
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
558
557
|
streamId: g.stream.id,
|
|
559
|
-
error:
|
|
558
|
+
error: k,
|
|
560
559
|
params: o,
|
|
561
560
|
progressItems: [],
|
|
562
561
|
loading: !1,
|
|
@@ -565,47 +564,47 @@ const Ie = (e) => {
|
|
|
565
564
|
}
|
|
566
565
|
]), {
|
|
567
566
|
type: "error",
|
|
568
|
-
error:
|
|
567
|
+
error: k
|
|
569
568
|
};
|
|
570
569
|
}
|
|
571
570
|
}
|
|
572
571
|
} else
|
|
573
572
|
return console.error(g.error), g;
|
|
574
573
|
},
|
|
575
|
-
[r,
|
|
574
|
+
[r, s, e.fetchCreateAgentTaskClientToken]
|
|
576
575
|
), m = D(() => {
|
|
577
|
-
if (
|
|
578
|
-
return [...
|
|
579
|
-
}, [
|
|
580
|
-
return
|
|
576
|
+
if (t.length !== 0)
|
|
577
|
+
return [...t].sort((o, a) => new Date(a.triggeredAt).getTime() - new Date(o.triggeredAt).getTime())[0];
|
|
578
|
+
}, [t]);
|
|
579
|
+
return A(() => () => {
|
|
581
580
|
l.current.clear(), c.current.clear();
|
|
582
581
|
}, []), {
|
|
583
|
-
agentTasks:
|
|
582
|
+
agentTasks: t,
|
|
584
583
|
createAgentTask: d,
|
|
585
584
|
latest: m
|
|
586
585
|
};
|
|
587
586
|
};
|
|
588
587
|
function De(e) {
|
|
589
|
-
return e.progressItems.map((r,
|
|
590
|
-
const
|
|
588
|
+
return e.progressItems.map((r, t) => {
|
|
589
|
+
const n = e.progressItems[t + 1], l = n != null;
|
|
591
590
|
let c;
|
|
592
|
-
if (
|
|
593
|
-
const s = new Date(r.createdAt).getTime(), d = new Date(
|
|
591
|
+
if (n != null && n.createdAt) {
|
|
592
|
+
const s = new Date(r.createdAt).getTime(), d = new Date(n.createdAt).getTime();
|
|
594
593
|
c = Math.round((d - s) / 1e3);
|
|
595
594
|
}
|
|
596
595
|
return {
|
|
597
596
|
item: r,
|
|
598
597
|
completed: l,
|
|
599
|
-
isLatest:
|
|
598
|
+
isLatest: t === e.progressItems.length - 1,
|
|
600
599
|
durationSeconds: c
|
|
601
600
|
};
|
|
602
601
|
});
|
|
603
602
|
}
|
|
604
|
-
function
|
|
603
|
+
function w({
|
|
605
604
|
text: e,
|
|
606
605
|
duration: r = 2,
|
|
607
|
-
delay:
|
|
608
|
-
repeat:
|
|
606
|
+
delay: t = 0,
|
|
607
|
+
repeat: n = !0,
|
|
609
608
|
repeatDelay: l = 0.5,
|
|
610
609
|
className: c,
|
|
611
610
|
startOnView: s = !1,
|
|
@@ -616,9 +615,9 @@ function C({
|
|
|
616
615
|
shimmerColor: u = "#000",
|
|
617
616
|
direction: g = "fromBottom"
|
|
618
617
|
}) {
|
|
619
|
-
const f =
|
|
618
|
+
const f = F(null), p = ue(f, { once: d, margin: m }), S = D(() => e.length * o, [e, o]), h = !s || p, T = g === "fromBottom" ? "100% center" : "-100% center", k = g === "fromBottom" ? "0% center" : "200% center";
|
|
620
619
|
return /* @__PURE__ */ i(
|
|
621
|
-
|
|
620
|
+
b.span,
|
|
622
621
|
{
|
|
623
622
|
ref: f,
|
|
624
623
|
className: c,
|
|
@@ -638,24 +637,24 @@ function C({
|
|
|
638
637
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
639
638
|
},
|
|
640
639
|
initial: {
|
|
641
|
-
backgroundPosition:
|
|
640
|
+
backgroundPosition: T,
|
|
642
641
|
opacity: 0
|
|
643
642
|
},
|
|
644
643
|
animate: h ? {
|
|
645
|
-
backgroundPosition:
|
|
644
|
+
backgroundPosition: k,
|
|
646
645
|
opacity: 1
|
|
647
646
|
} : {},
|
|
648
647
|
transition: {
|
|
649
648
|
backgroundPosition: {
|
|
650
|
-
repeat:
|
|
649
|
+
repeat: n ? 1 / 0 : 0,
|
|
651
650
|
duration: r,
|
|
652
|
-
delay:
|
|
651
|
+
delay: t,
|
|
653
652
|
repeatDelay: l,
|
|
654
653
|
ease: "linear"
|
|
655
654
|
},
|
|
656
655
|
opacity: {
|
|
657
656
|
duration: 0.3,
|
|
658
|
-
delay:
|
|
657
|
+
delay: t
|
|
659
658
|
}
|
|
660
659
|
},
|
|
661
660
|
children: e
|
|
@@ -663,17 +662,17 @@ function C({
|
|
|
663
662
|
);
|
|
664
663
|
}
|
|
665
664
|
function Le(e, r) {
|
|
666
|
-
const
|
|
667
|
-
if (
|
|
665
|
+
const t = e.item.data;
|
|
666
|
+
if (t.eventType === "Error" && "message" in t)
|
|
668
667
|
return r.error;
|
|
669
|
-
if (
|
|
670
|
-
if (
|
|
671
|
-
if (
|
|
668
|
+
if (t.taskType === "StreamingChatCompletion") {
|
|
669
|
+
if (t.eventType === "Text") return r.streaming;
|
|
670
|
+
if (t.eventType === "Completed") return r.completed;
|
|
672
671
|
}
|
|
673
|
-
if (
|
|
672
|
+
if (t.taskType === "StructuredChatCompletion" && t.eventType === "Completed")
|
|
674
673
|
return r.completed;
|
|
675
|
-
if (
|
|
676
|
-
switch (
|
|
674
|
+
if (t.taskType === "MemorySearch")
|
|
675
|
+
switch (t.eventType) {
|
|
677
676
|
case "GeneratingQueries":
|
|
678
677
|
return r.memorySearchGeneratingQueries;
|
|
679
678
|
case "ExploreQueries":
|
|
@@ -683,8 +682,8 @@ function Le(e, r) {
|
|
|
683
682
|
case "Completed":
|
|
684
683
|
return r.completed;
|
|
685
684
|
}
|
|
686
|
-
if (
|
|
687
|
-
switch (
|
|
685
|
+
if (t.taskType === "MemoryChat")
|
|
686
|
+
switch (t.eventType) {
|
|
688
687
|
case "Text":
|
|
689
688
|
return r.streaming;
|
|
690
689
|
case "Search":
|
|
@@ -707,27 +706,27 @@ function Le(e, r) {
|
|
|
707
706
|
return r.processing;
|
|
708
707
|
}
|
|
709
708
|
const ze = ({ progressViewItems: e, t: r }) => {
|
|
710
|
-
const
|
|
711
|
-
if (!
|
|
712
|
-
const
|
|
709
|
+
const t = e[e.length - 1];
|
|
710
|
+
if (!t) return null;
|
|
711
|
+
const n = Le(t, r);
|
|
713
712
|
return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(X, { mode: "wait", children: /* @__PURE__ */ i(
|
|
714
|
-
|
|
713
|
+
b.div,
|
|
715
714
|
{
|
|
716
715
|
initial: { opacity: 0, y: 10 },
|
|
717
716
|
animate: { opacity: 1, y: 0 },
|
|
718
717
|
exit: { opacity: 0, y: -10 },
|
|
719
718
|
transition: { duration: 0.3 },
|
|
720
|
-
children:
|
|
719
|
+
children: t.completed ? /* @__PURE__ */ i(
|
|
721
720
|
"div",
|
|
722
721
|
{
|
|
723
722
|
className: "simple-mode-title",
|
|
724
723
|
style: { color: "#666" },
|
|
725
|
-
children:
|
|
724
|
+
children: n
|
|
726
725
|
}
|
|
727
726
|
) : /* @__PURE__ */ i(
|
|
728
|
-
|
|
727
|
+
w,
|
|
729
728
|
{
|
|
730
|
-
text:
|
|
729
|
+
text: n,
|
|
731
730
|
className: "simple-mode-title",
|
|
732
731
|
duration: 2.5,
|
|
733
732
|
repeat: !0,
|
|
@@ -736,7 +735,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
736
735
|
}
|
|
737
736
|
)
|
|
738
737
|
},
|
|
739
|
-
|
|
738
|
+
t.item.progressItemId
|
|
740
739
|
) }) });
|
|
741
740
|
}, ee = {
|
|
742
741
|
'code[class*="language-"]': {
|
|
@@ -892,7 +891,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
892
891
|
}, K = ({
|
|
893
892
|
text: e
|
|
894
893
|
}) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
895
|
-
|
|
894
|
+
b.div,
|
|
896
895
|
{
|
|
897
896
|
className: "fency-markdown-body-raw",
|
|
898
897
|
initial: { opacity: 0, y: -10 },
|
|
@@ -901,10 +900,10 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
901
900
|
children: /* @__PURE__ */ i(
|
|
902
901
|
ye,
|
|
903
902
|
{
|
|
904
|
-
remarkPlugins: [
|
|
903
|
+
remarkPlugins: [ge],
|
|
905
904
|
components: {
|
|
906
905
|
code(r) {
|
|
907
|
-
const { children:
|
|
906
|
+
const { children: t, className: n, node: l, ref: c, ...s } = r, d = /language-(\w+)/.exec(n || "");
|
|
908
907
|
return d ? (
|
|
909
908
|
// @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
|
|
910
909
|
/* @__PURE__ */ i(
|
|
@@ -912,12 +911,12 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
912
911
|
{
|
|
913
912
|
...s,
|
|
914
913
|
PreTag: "div",
|
|
915
|
-
children: String(
|
|
914
|
+
children: String(t).replace(/\n$/, ""),
|
|
916
915
|
language: d[1],
|
|
917
916
|
style: ee
|
|
918
917
|
}
|
|
919
918
|
)
|
|
920
|
-
) : /* @__PURE__ */ i("code", { ...s, className:
|
|
919
|
+
) : /* @__PURE__ */ i("code", { ...s, className: n, children: String(t) });
|
|
921
920
|
}
|
|
922
921
|
},
|
|
923
922
|
children: e
|
|
@@ -931,7 +930,7 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
931
930
|
2
|
|
932
931
|
);
|
|
933
932
|
return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
|
|
934
|
-
|
|
933
|
+
b.div,
|
|
935
934
|
{
|
|
936
935
|
initial: { opacity: 0, y: -10 },
|
|
937
936
|
animate: { opacity: 1, y: 0 },
|
|
@@ -1064,33 +1063,33 @@ function Be(e) {
|
|
|
1064
1063
|
}
|
|
1065
1064
|
function x(e, r) {
|
|
1066
1065
|
return Object.entries(r).reduce(
|
|
1067
|
-
(
|
|
1066
|
+
(t, [n, l]) => t.replace(`{${n}}`, String(l)),
|
|
1068
1067
|
e
|
|
1069
1068
|
);
|
|
1070
1069
|
}
|
|
1071
1070
|
function Q(e, r) {
|
|
1072
|
-
const
|
|
1073
|
-
if (r != null &&
|
|
1074
|
-
const
|
|
1075
|
-
return
|
|
1071
|
+
const t = e.map((n) => `'${n}'`);
|
|
1072
|
+
if (r != null && t.length >= 2) {
|
|
1073
|
+
const n = t.pop();
|
|
1074
|
+
return t.length > 0 ? `${t.join(", ")} ${r} ${n}` : n;
|
|
1076
1075
|
}
|
|
1077
|
-
return
|
|
1076
|
+
return t.join(", ");
|
|
1078
1077
|
}
|
|
1079
|
-
const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds:
|
|
1080
|
-
const [l, c] =
|
|
1078
|
+
const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1079
|
+
const [l, c] = v(!1), d = (e.memories ?? []).map((h) => h.memoryTitle), m = d.length > 0, o = m && d.length > W, a = o && !l ? d.slice(0, W) : d, u = d.length - W, g = !o || l, f = `${n.searchingFor}'${e.queryDescription}'`, p = m ? `${n.searchingIn}${Q(
|
|
1081
1080
|
a,
|
|
1082
|
-
g ?
|
|
1083
|
-
)}` : "", S = m ? `${f}${
|
|
1084
|
-
return /* @__PURE__ */
|
|
1081
|
+
g ? n.and : void 0
|
|
1082
|
+
)}` : "", S = m ? `${f}${p}` : `${n.searchingPrefix}${e.queryDescription}`;
|
|
1083
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
1085
1084
|
/* @__PURE__ */ i(
|
|
1086
|
-
|
|
1085
|
+
b.div,
|
|
1087
1086
|
{
|
|
1088
1087
|
style: { color: "#666" },
|
|
1089
1088
|
initial: { opacity: 0, y: -10 },
|
|
1090
1089
|
animate: { opacity: 1, y: 0 },
|
|
1091
1090
|
transition: { duration: 0.3, delay: 0 },
|
|
1092
|
-
children: r && !
|
|
1093
|
-
|
|
1091
|
+
children: r && !t && !o ? /* @__PURE__ */ i(
|
|
1092
|
+
w,
|
|
1094
1093
|
{
|
|
1095
1094
|
text: S,
|
|
1096
1095
|
duration: 2.5,
|
|
@@ -1098,17 +1097,17 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1098
1097
|
color: "#999",
|
|
1099
1098
|
shimmerColor: "#000"
|
|
1100
1099
|
}
|
|
1101
|
-
) : /* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */
|
|
1103
|
-
|
|
1104
|
-
/* @__PURE__ */
|
|
1100
|
+
) : /* @__PURE__ */ y(I, { children: [
|
|
1101
|
+
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ y(I, { children: [
|
|
1102
|
+
n.searchingFor,
|
|
1103
|
+
/* @__PURE__ */ y("span", { style: { fontWeight: 600 }, children: [
|
|
1105
1104
|
"'",
|
|
1106
1105
|
e.queryDescription,
|
|
1107
1106
|
"'"
|
|
1108
1107
|
] }),
|
|
1109
|
-
|
|
1110
|
-
] }) : `${
|
|
1111
|
-
o && !l && /* @__PURE__ */
|
|
1108
|
+
p
|
|
1109
|
+
] }) : `${n.searchingPrefix}${e.queryDescription}` }),
|
|
1110
|
+
o && !l && /* @__PURE__ */ y(I, { children: [
|
|
1112
1111
|
" ",
|
|
1113
1112
|
/* @__PURE__ */ i(
|
|
1114
1113
|
"button",
|
|
@@ -1126,13 +1125,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1126
1125
|
textDecoration: "underline",
|
|
1127
1126
|
fontFamily: "inherit"
|
|
1128
1127
|
},
|
|
1129
|
-
children: x(
|
|
1128
|
+
children: x(n.moreMemories, {
|
|
1130
1129
|
n: u
|
|
1131
1130
|
})
|
|
1132
1131
|
}
|
|
1133
1132
|
)
|
|
1134
1133
|
] }),
|
|
1135
|
-
o && l && /* @__PURE__ */
|
|
1134
|
+
o && l && /* @__PURE__ */ y(I, { children: [
|
|
1136
1135
|
" ",
|
|
1137
1136
|
/* @__PURE__ */ i(
|
|
1138
1137
|
"button",
|
|
@@ -1150,14 +1149,14 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1150
1149
|
textDecoration: "underline",
|
|
1151
1150
|
fontFamily: "inherit"
|
|
1152
1151
|
},
|
|
1153
|
-
children:
|
|
1152
|
+
children: n.clickToCollapse
|
|
1154
1153
|
}
|
|
1155
1154
|
)
|
|
1156
1155
|
] })
|
|
1157
1156
|
] })
|
|
1158
1157
|
}
|
|
1159
1158
|
),
|
|
1160
|
-
|
|
1159
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
1161
1160
|
"div",
|
|
1162
1161
|
{
|
|
1163
1162
|
style: {
|
|
@@ -1166,18 +1165,18 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1166
1165
|
marginTop: "4px",
|
|
1167
1166
|
fontStyle: "italic"
|
|
1168
1167
|
},
|
|
1169
|
-
children: x(
|
|
1168
|
+
children: x(n.tookSeconds, { n: t })
|
|
1170
1169
|
}
|
|
1171
1170
|
)
|
|
1172
1171
|
] });
|
|
1173
|
-
}, $ = 5, $e = ({ data: e, isLatest: r = !1, durationSeconds:
|
|
1174
|
-
const [l, c] =
|
|
1172
|
+
}, $ = 5, $e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1173
|
+
const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > $, o = m && !l ? s.slice(0, $) : s, a = s.length - $, u = !m || l, g = d ? `${n.findingMemoriesIn}${Q(
|
|
1175
1174
|
o,
|
|
1176
|
-
u ?
|
|
1177
|
-
)}` :
|
|
1178
|
-
return /* @__PURE__ */
|
|
1175
|
+
u ? n.and : void 0
|
|
1176
|
+
)}` : n.findingMemories;
|
|
1177
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
1179
1178
|
/* @__PURE__ */ i(
|
|
1180
|
-
|
|
1179
|
+
b.div,
|
|
1181
1180
|
{
|
|
1182
1181
|
style: {
|
|
1183
1182
|
color: "#666"
|
|
@@ -1185,8 +1184,8 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1185
1184
|
initial: { opacity: 0, y: -10 },
|
|
1186
1185
|
animate: { opacity: 1, y: 0 },
|
|
1187
1186
|
transition: { duration: 0.3, delay: 0 },
|
|
1188
|
-
children: r && !
|
|
1189
|
-
|
|
1187
|
+
children: r && !t && !m ? /* @__PURE__ */ i(
|
|
1188
|
+
w,
|
|
1190
1189
|
{
|
|
1191
1190
|
text: g,
|
|
1192
1191
|
duration: 2.5,
|
|
@@ -1194,9 +1193,9 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1194
1193
|
color: "#999",
|
|
1195
1194
|
shimmerColor: "#000"
|
|
1196
1195
|
}
|
|
1197
|
-
) : /* @__PURE__ */
|
|
1196
|
+
) : /* @__PURE__ */ y(I, { children: [
|
|
1198
1197
|
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: g }),
|
|
1199
|
-
m && !l && /* @__PURE__ */
|
|
1198
|
+
m && !l && /* @__PURE__ */ y(I, { children: [
|
|
1200
1199
|
" ",
|
|
1201
1200
|
/* @__PURE__ */ i(
|
|
1202
1201
|
"button",
|
|
@@ -1214,13 +1213,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1214
1213
|
textDecoration: "underline",
|
|
1215
1214
|
fontFamily: "inherit"
|
|
1216
1215
|
},
|
|
1217
|
-
children: x(
|
|
1216
|
+
children: x(n.moreMemories, {
|
|
1218
1217
|
n: a
|
|
1219
1218
|
})
|
|
1220
1219
|
}
|
|
1221
1220
|
)
|
|
1222
1221
|
] }),
|
|
1223
|
-
m && l && /* @__PURE__ */
|
|
1222
|
+
m && l && /* @__PURE__ */ y(I, { children: [
|
|
1224
1223
|
" ",
|
|
1225
1224
|
/* @__PURE__ */ i(
|
|
1226
1225
|
"button",
|
|
@@ -1238,14 +1237,14 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1238
1237
|
textDecoration: "underline",
|
|
1239
1238
|
fontFamily: "inherit"
|
|
1240
1239
|
},
|
|
1241
|
-
children:
|
|
1240
|
+
children: n.clickToCollapse
|
|
1242
1241
|
}
|
|
1243
1242
|
)
|
|
1244
1243
|
] })
|
|
1245
1244
|
] })
|
|
1246
1245
|
}
|
|
1247
1246
|
),
|
|
1248
|
-
|
|
1247
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
1249
1248
|
"div",
|
|
1250
1249
|
{
|
|
1251
1250
|
style: {
|
|
@@ -1254,31 +1253,31 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1254
1253
|
marginTop: "4px",
|
|
1255
1254
|
fontStyle: "italic"
|
|
1256
1255
|
},
|
|
1257
|
-
children: x(
|
|
1256
|
+
children: x(n.tookSeconds, { n: t })
|
|
1258
1257
|
}
|
|
1259
1258
|
)
|
|
1260
1259
|
] });
|
|
1261
1260
|
}, H = 5, He = ({ data: e, t: r }) => {
|
|
1262
|
-
const [
|
|
1261
|
+
const [t, n] = v(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !t ? c.slice(0, H) : c, o = c.length - H, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, g = s ? `${u}${Q(
|
|
1263
1262
|
m,
|
|
1264
1263
|
a ? r.and : void 0
|
|
1265
1264
|
)}` : r.memoriesFound;
|
|
1266
1265
|
return /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
1267
|
-
|
|
1266
|
+
b.div,
|
|
1268
1267
|
{
|
|
1269
1268
|
style: { color: "#666" },
|
|
1270
1269
|
initial: { opacity: 0, y: -10 },
|
|
1271
1270
|
animate: { opacity: 1, y: 0 },
|
|
1272
1271
|
transition: { duration: 0.3, delay: 0 },
|
|
1273
|
-
children: /* @__PURE__ */
|
|
1272
|
+
children: /* @__PURE__ */ y(I, { children: [
|
|
1274
1273
|
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: g }),
|
|
1275
|
-
d && !
|
|
1274
|
+
d && !t && /* @__PURE__ */ y(I, { children: [
|
|
1276
1275
|
" ",
|
|
1277
1276
|
/* @__PURE__ */ i(
|
|
1278
1277
|
"button",
|
|
1279
1278
|
{
|
|
1280
1279
|
type: "button",
|
|
1281
|
-
onClick: () =>
|
|
1280
|
+
onClick: () => n(!0),
|
|
1282
1281
|
style: {
|
|
1283
1282
|
background: "none",
|
|
1284
1283
|
border: "none",
|
|
@@ -1296,13 +1295,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1296
1295
|
}
|
|
1297
1296
|
)
|
|
1298
1297
|
] }),
|
|
1299
|
-
d &&
|
|
1298
|
+
d && t && /* @__PURE__ */ y(I, { children: [
|
|
1300
1299
|
" ",
|
|
1301
1300
|
/* @__PURE__ */ i(
|
|
1302
1301
|
"button",
|
|
1303
1302
|
{
|
|
1304
1303
|
type: "button",
|
|
1305
|
-
onClick: () =>
|
|
1304
|
+
onClick: () => n(!1),
|
|
1306
1305
|
style: {
|
|
1307
1306
|
background: "none",
|
|
1308
1307
|
border: "none",
|
|
@@ -1321,11 +1320,11 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1321
1320
|
] })
|
|
1322
1321
|
}
|
|
1323
1322
|
) });
|
|
1324
|
-
}, _e = ({ isLatest: e = !1, durationSeconds: r, t
|
|
1325
|
-
const
|
|
1326
|
-
return /* @__PURE__ */
|
|
1323
|
+
}, _e = ({ isLatest: e = !1, durationSeconds: r, t }) => {
|
|
1324
|
+
const n = t.addingSources;
|
|
1325
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
1327
1326
|
/* @__PURE__ */ i(
|
|
1328
|
-
|
|
1327
|
+
b.div,
|
|
1329
1328
|
{
|
|
1330
1329
|
style: {
|
|
1331
1330
|
display: "flex",
|
|
@@ -1337,15 +1336,15 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1337
1336
|
animate: { opacity: 1, y: 0 },
|
|
1338
1337
|
transition: { duration: 0.3, delay: 0 },
|
|
1339
1338
|
children: e && !r ? /* @__PURE__ */ i(
|
|
1340
|
-
|
|
1339
|
+
w,
|
|
1341
1340
|
{
|
|
1342
|
-
text:
|
|
1341
|
+
text: n,
|
|
1343
1342
|
duration: 2.5,
|
|
1344
1343
|
repeat: !0,
|
|
1345
1344
|
color: "#999",
|
|
1346
1345
|
shimmerColor: "#000"
|
|
1347
1346
|
}
|
|
1348
|
-
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children:
|
|
1347
|
+
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: n })
|
|
1349
1348
|
}
|
|
1350
1349
|
),
|
|
1351
1350
|
r !== void 0 && /* @__PURE__ */ i(
|
|
@@ -1357,7 +1356,7 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1357
1356
|
marginTop: "4px",
|
|
1358
1357
|
fontStyle: "italic"
|
|
1359
1358
|
},
|
|
1360
|
-
children: x(
|
|
1359
|
+
children: x(t.tookSeconds, { n: r })
|
|
1361
1360
|
}
|
|
1362
1361
|
)
|
|
1363
1362
|
] });
|
|
@@ -1371,14 +1370,14 @@ function Ge(e, r) {
|
|
|
1371
1370
|
a: e[0],
|
|
1372
1371
|
b: e[1]
|
|
1373
1372
|
});
|
|
1374
|
-
const
|
|
1375
|
-
return x(r.pageMultiple, { list:
|
|
1373
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1374
|
+
return x(r.pageMultiple, { list: n, n: t });
|
|
1376
1375
|
}
|
|
1377
|
-
const Qe = ({ data: e, onSourceClick: r, t
|
|
1378
|
-
const [
|
|
1379
|
-
return /* @__PURE__ */
|
|
1376
|
+
const Qe = ({ data: e, onSourceClick: r, t }) => {
|
|
1377
|
+
const [n, l] = v(null);
|
|
1378
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
1380
1379
|
/* @__PURE__ */ i(
|
|
1381
|
-
|
|
1380
|
+
b.div,
|
|
1382
1381
|
{
|
|
1383
1382
|
style: {
|
|
1384
1383
|
marginBottom: "10px",
|
|
@@ -1391,18 +1390,18 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1391
1390
|
initial: { opacity: 0, y: -10 },
|
|
1392
1391
|
animate: { opacity: 1, y: 0 },
|
|
1393
1392
|
transition: { duration: 0.3, delay: 0 },
|
|
1394
|
-
children:
|
|
1393
|
+
children: t.sources
|
|
1395
1394
|
}
|
|
1396
1395
|
),
|
|
1397
|
-
/* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children:
|
|
1396
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ i(
|
|
1398
1397
|
je,
|
|
1399
1398
|
{
|
|
1400
1399
|
source: c,
|
|
1401
1400
|
index: s,
|
|
1402
|
-
loadingMemoryId:
|
|
1401
|
+
loadingMemoryId: n,
|
|
1403
1402
|
setLoadingMemoryId: l,
|
|
1404
1403
|
onSourceClick: r,
|
|
1405
|
-
t
|
|
1404
|
+
t
|
|
1406
1405
|
},
|
|
1407
1406
|
c.memoryId
|
|
1408
1407
|
)) })
|
|
@@ -1410,21 +1409,21 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1410
1409
|
}, je = ({
|
|
1411
1410
|
source: e,
|
|
1412
1411
|
index: r,
|
|
1413
|
-
loadingMemoryId:
|
|
1414
|
-
setLoadingMemoryId:
|
|
1412
|
+
loadingMemoryId: t,
|
|
1413
|
+
setLoadingMemoryId: n,
|
|
1415
1414
|
onSourceClick: l,
|
|
1416
1415
|
t: c
|
|
1417
1416
|
}) => {
|
|
1418
|
-
const [s, d] =
|
|
1419
|
-
return /* @__PURE__ */
|
|
1420
|
-
|
|
1417
|
+
const [s, d] = v(!1), m = !!l, o = t === e.memoryId, a = e.pageNumbers ?? [], u = Ge(a, c);
|
|
1418
|
+
return /* @__PURE__ */ y(
|
|
1419
|
+
b.div,
|
|
1421
1420
|
{
|
|
1422
1421
|
"aria-busy": o,
|
|
1423
1422
|
initial: { opacity: 0, scale: 0.9 },
|
|
1424
1423
|
animate: { opacity: 1, scale: 1 },
|
|
1425
1424
|
transition: { duration: 0.25, delay: r * 0.05 },
|
|
1426
1425
|
onClick: m && !o ? async () => {
|
|
1427
|
-
|
|
1426
|
+
n(e.memoryId);
|
|
1428
1427
|
try {
|
|
1429
1428
|
await l({
|
|
1430
1429
|
memoryId: e.memoryId,
|
|
@@ -1434,7 +1433,7 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1434
1433
|
pageNumbers: [...a]
|
|
1435
1434
|
});
|
|
1436
1435
|
} finally {
|
|
1437
|
-
|
|
1436
|
+
n(null);
|
|
1438
1437
|
}
|
|
1439
1438
|
} : void 0,
|
|
1440
1439
|
onMouseEnter: m && !o ? () => d(!0) : void 0,
|
|
@@ -1453,7 +1452,7 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1453
1452
|
pointerEvents: o ? "none" : void 0
|
|
1454
1453
|
},
|
|
1455
1454
|
children: [
|
|
1456
|
-
/* @__PURE__ */
|
|
1455
|
+
/* @__PURE__ */ y(
|
|
1457
1456
|
"span",
|
|
1458
1457
|
{
|
|
1459
1458
|
style: {
|
|
@@ -1483,9 +1482,9 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1483
1482
|
}, z = ({
|
|
1484
1483
|
color: e = "#78b13f",
|
|
1485
1484
|
size: r = 24,
|
|
1486
|
-
borderWidth:
|
|
1485
|
+
borderWidth: t = 7
|
|
1487
1486
|
}) => {
|
|
1488
|
-
const
|
|
1487
|
+
const n = r * 0.5;
|
|
1489
1488
|
return /* @__PURE__ */ i(
|
|
1490
1489
|
"span",
|
|
1491
1490
|
{
|
|
@@ -1493,26 +1492,26 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1493
1492
|
display: "inline-block",
|
|
1494
1493
|
transform: "rotate(45deg)",
|
|
1495
1494
|
height: r,
|
|
1496
|
-
width:
|
|
1497
|
-
borderBottom: `${
|
|
1498
|
-
borderRight: `${
|
|
1495
|
+
width: n,
|
|
1496
|
+
borderBottom: `${t}px solid ${e}`,
|
|
1497
|
+
borderRight: `${t}px solid ${e}`
|
|
1499
1498
|
}
|
|
1500
1499
|
}
|
|
1501
1500
|
);
|
|
1502
1501
|
}, j = ({
|
|
1503
1502
|
color: e = "#333",
|
|
1504
1503
|
size: r = 32,
|
|
1505
|
-
lineWidth:
|
|
1504
|
+
lineWidth: t = 2
|
|
1506
1505
|
}) => {
|
|
1507
|
-
const
|
|
1506
|
+
const n = r + 1, l = (r - t) / 2, c = (r - n) / 2, s = {
|
|
1508
1507
|
position: "absolute",
|
|
1509
1508
|
left: l,
|
|
1510
1509
|
top: c,
|
|
1511
|
-
width:
|
|
1512
|
-
height:
|
|
1510
|
+
width: t,
|
|
1511
|
+
height: n,
|
|
1513
1512
|
backgroundColor: e
|
|
1514
1513
|
};
|
|
1515
|
-
return /* @__PURE__ */
|
|
1514
|
+
return /* @__PURE__ */ y(
|
|
1516
1515
|
"span",
|
|
1517
1516
|
{
|
|
1518
1517
|
style: {
|
|
@@ -1554,11 +1553,11 @@ const V = 80;
|
|
|
1554
1553
|
function Ue({
|
|
1555
1554
|
memory: e,
|
|
1556
1555
|
completed: r,
|
|
1557
|
-
t
|
|
1556
|
+
t
|
|
1558
1557
|
}) {
|
|
1559
|
-
const [
|
|
1560
|
-
return /* @__PURE__ */
|
|
1561
|
-
|
|
1558
|
+
const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > V, d = c != null ? n || !s ? c : `${c.slice(0, V)}...` : void 0, m = s, o = e.error != null;
|
|
1559
|
+
return /* @__PURE__ */ y(
|
|
1560
|
+
b.div,
|
|
1562
1561
|
{
|
|
1563
1562
|
initial: { opacity: 0 },
|
|
1564
1563
|
animate: { opacity: 1 },
|
|
@@ -1589,7 +1588,7 @@ function Ue({
|
|
|
1589
1588
|
children: /* @__PURE__ */ i(qe, { memory: e, completed: r })
|
|
1590
1589
|
}
|
|
1591
1590
|
),
|
|
1592
|
-
/* @__PURE__ */
|
|
1591
|
+
/* @__PURE__ */ y(
|
|
1593
1592
|
"div",
|
|
1594
1593
|
{
|
|
1595
1594
|
style: {
|
|
@@ -1613,7 +1612,7 @@ function Ue({
|
|
|
1613
1612
|
fontSize: 12,
|
|
1614
1613
|
color: o ? "#c62828" : "#666",
|
|
1615
1614
|
lineHeight: 1.4,
|
|
1616
|
-
whiteSpace:
|
|
1615
|
+
whiteSpace: n ? "pre-wrap" : void 0
|
|
1617
1616
|
},
|
|
1618
1617
|
children: d
|
|
1619
1618
|
}
|
|
@@ -1626,7 +1625,7 @@ function Ue({
|
|
|
1626
1625
|
color: "#999",
|
|
1627
1626
|
marginTop: 2
|
|
1628
1627
|
},
|
|
1629
|
-
children:
|
|
1628
|
+
children: n ? t.clickToCollapse : t.clickToExpand
|
|
1630
1629
|
}
|
|
1631
1630
|
)
|
|
1632
1631
|
]
|
|
@@ -1636,14 +1635,14 @@ function Ue({
|
|
|
1636
1635
|
}
|
|
1637
1636
|
);
|
|
1638
1637
|
}
|
|
1639
|
-
const Ke = ({ data: e, completed: r, t
|
|
1638
|
+
const Ke = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ i(
|
|
1640
1639
|
Ue,
|
|
1641
1640
|
{
|
|
1642
|
-
memory:
|
|
1641
|
+
memory: n,
|
|
1643
1642
|
completed: r,
|
|
1644
|
-
t
|
|
1643
|
+
t
|
|
1645
1644
|
},
|
|
1646
|
-
|
|
1645
|
+
n.memoryId
|
|
1647
1646
|
)) });
|
|
1648
1647
|
function Ve(e, r) {
|
|
1649
1648
|
if (e.length === 0) return "";
|
|
@@ -1654,25 +1653,25 @@ function Ve(e, r) {
|
|
|
1654
1653
|
a: e[0],
|
|
1655
1654
|
b: e[1]
|
|
1656
1655
|
});
|
|
1657
|
-
const
|
|
1658
|
-
return x(r.pageMultiple, { list:
|
|
1656
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1657
|
+
return x(r.pageMultiple, { list: n, n: t });
|
|
1659
1658
|
}
|
|
1660
1659
|
function Xe(e, r) {
|
|
1661
1660
|
return e === 1 ? r.chunkFound : x(r.chunksFound, { n: e });
|
|
1662
1661
|
}
|
|
1663
1662
|
const Je = ({ data: e, t: r }) => {
|
|
1664
|
-
const [
|
|
1665
|
-
return /* @__PURE__ */
|
|
1666
|
-
/* @__PURE__ */
|
|
1667
|
-
|
|
1663
|
+
const [t, n] = v(!1), l = e.chunks.length, c = l > 0;
|
|
1664
|
+
return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
1665
|
+
/* @__PURE__ */ y(
|
|
1666
|
+
b.div,
|
|
1668
1667
|
{
|
|
1669
1668
|
initial: { opacity: 0 },
|
|
1670
1669
|
animate: { opacity: 1 },
|
|
1671
1670
|
transition: { duration: 0.25 },
|
|
1672
|
-
onClick: c ? () =>
|
|
1671
|
+
onClick: c ? () => n((s) => !s) : void 0,
|
|
1673
1672
|
style: {
|
|
1674
|
-
paddingBottom:
|
|
1675
|
-
borderBottom:
|
|
1673
|
+
paddingBottom: t ? "12px" : 0,
|
|
1674
|
+
borderBottom: t ? "1px solid #eee" : void 0,
|
|
1676
1675
|
display: "flex",
|
|
1677
1676
|
flexDirection: "column",
|
|
1678
1677
|
gap: "4px",
|
|
@@ -1690,14 +1689,14 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1690
1689
|
color: "#999",
|
|
1691
1690
|
marginTop: 2
|
|
1692
1691
|
},
|
|
1693
|
-
children:
|
|
1692
|
+
children: t ? r.clickToCollapse : r.clickToExpand
|
|
1694
1693
|
}
|
|
1695
1694
|
)
|
|
1696
1695
|
]
|
|
1697
1696
|
}
|
|
1698
1697
|
),
|
|
1699
|
-
|
|
1700
|
-
|
|
1698
|
+
t && c && /* @__PURE__ */ i(
|
|
1699
|
+
b.div,
|
|
1701
1700
|
{
|
|
1702
1701
|
initial: { opacity: 0, height: 0 },
|
|
1703
1702
|
animate: { opacity: 1, height: "auto" },
|
|
@@ -1712,7 +1711,7 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1712
1711
|
},
|
|
1713
1712
|
children: e.chunks.map((s, d) => {
|
|
1714
1713
|
const m = s.pageNumbers ?? [], o = Ve(m, r);
|
|
1715
|
-
return /* @__PURE__ */
|
|
1714
|
+
return /* @__PURE__ */ y(
|
|
1716
1715
|
"div",
|
|
1717
1716
|
{
|
|
1718
1717
|
style: {
|
|
@@ -1735,7 +1734,7 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1735
1734
|
children: s.content
|
|
1736
1735
|
}
|
|
1737
1736
|
),
|
|
1738
|
-
/* @__PURE__ */
|
|
1737
|
+
/* @__PURE__ */ y(
|
|
1739
1738
|
"div",
|
|
1740
1739
|
{
|
|
1741
1740
|
style: {
|
|
@@ -1772,11 +1771,11 @@ function Ze(e, r) {
|
|
|
1772
1771
|
function er({
|
|
1773
1772
|
item: e,
|
|
1774
1773
|
t: r,
|
|
1775
|
-
showShimmerForPrimary:
|
|
1774
|
+
showShimmerForPrimary: t
|
|
1776
1775
|
}) {
|
|
1777
|
-
const
|
|
1778
|
-
return /* @__PURE__ */
|
|
1779
|
-
|
|
1776
|
+
const n = e.result != null, l = e.error != null, c = Ze(e, r);
|
|
1777
|
+
return /* @__PURE__ */ y(
|
|
1778
|
+
b.div,
|
|
1780
1779
|
{
|
|
1781
1780
|
initial: { opacity: 0 },
|
|
1782
1781
|
animate: { opacity: 1 },
|
|
@@ -1805,7 +1804,7 @@ function er({
|
|
|
1805
1804
|
children: /* @__PURE__ */ i(Ye, { item: e })
|
|
1806
1805
|
}
|
|
1807
1806
|
),
|
|
1808
|
-
/* @__PURE__ */
|
|
1807
|
+
/* @__PURE__ */ y(
|
|
1809
1808
|
"div",
|
|
1810
1809
|
{
|
|
1811
1810
|
style: {
|
|
@@ -1816,8 +1815,8 @@ function er({
|
|
|
1816
1815
|
flex: 1
|
|
1817
1816
|
},
|
|
1818
1817
|
children: [
|
|
1819
|
-
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !
|
|
1820
|
-
|
|
1818
|
+
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !l && t ? /* @__PURE__ */ i(
|
|
1819
|
+
w,
|
|
1821
1820
|
{
|
|
1822
1821
|
text: c,
|
|
1823
1822
|
duration: 2.5,
|
|
@@ -1826,7 +1825,7 @@ function er({
|
|
|
1826
1825
|
shimmerColor: "#000"
|
|
1827
1826
|
}
|
|
1828
1827
|
) : c }),
|
|
1829
|
-
|
|
1828
|
+
n && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? x(
|
|
1830
1829
|
r.memorySearchTypeResultSummaryOne,
|
|
1831
1830
|
{
|
|
1832
1831
|
score: e.result.highestChunkScore.toFixed(
|
|
@@ -1850,18 +1849,18 @@ function er({
|
|
|
1850
1849
|
}
|
|
1851
1850
|
);
|
|
1852
1851
|
}
|
|
1853
|
-
const rr = ({ data: e, isLatest: r = !1, durationSeconds:
|
|
1852
|
+
const rr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1854
1853
|
const l = D(() => {
|
|
1855
1854
|
let c = -1;
|
|
1856
1855
|
return e.memoryTypes.forEach((s, d) => {
|
|
1857
1856
|
s.result == null && s.error == null && (c = d);
|
|
1858
1857
|
}), c;
|
|
1859
1858
|
}, [e.memoryTypes]);
|
|
1860
|
-
return /* @__PURE__ */
|
|
1861
|
-
r && !
|
|
1862
|
-
|
|
1859
|
+
return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
1860
|
+
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
|
|
1861
|
+
w,
|
|
1863
1862
|
{
|
|
1864
|
-
text:
|
|
1863
|
+
text: n.searchingMemoryTypes,
|
|
1865
1864
|
duration: 2.5,
|
|
1866
1865
|
repeat: !0,
|
|
1867
1866
|
color: "#999",
|
|
@@ -1871,12 +1870,12 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1871
1870
|
er,
|
|
1872
1871
|
{
|
|
1873
1872
|
item: c,
|
|
1874
|
-
t,
|
|
1873
|
+
t: n,
|
|
1875
1874
|
showShimmerForPrimary: s === l && r
|
|
1876
1875
|
},
|
|
1877
1876
|
c.memoryTypeId
|
|
1878
1877
|
)),
|
|
1879
|
-
|
|
1878
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
1880
1879
|
"div",
|
|
1881
1880
|
{
|
|
1882
1881
|
style: {
|
|
@@ -1885,7 +1884,7 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1885
1884
|
marginTop: "4px",
|
|
1886
1885
|
fontStyle: "italic"
|
|
1887
1886
|
},
|
|
1888
|
-
children: x(
|
|
1887
|
+
children: x(n.tookSeconds, { n: t })
|
|
1889
1888
|
}
|
|
1890
1889
|
)
|
|
1891
1890
|
] });
|
|
@@ -1912,18 +1911,18 @@ function ar({ phase: e }) {
|
|
|
1912
1911
|
function sr({
|
|
1913
1912
|
item: e,
|
|
1914
1913
|
t: r,
|
|
1915
|
-
isActiveRow:
|
|
1914
|
+
isActiveRow: t
|
|
1916
1915
|
}) {
|
|
1917
|
-
const
|
|
1918
|
-
|
|
1919
|
-
const
|
|
1920
|
-
|
|
1916
|
+
const n = or(e), l = ir(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [m, o] = v(!1), a = n && t, u = l === 2 && t && !O(e);
|
|
1917
|
+
A(() => {
|
|
1918
|
+
const p = d.current;
|
|
1919
|
+
p != null && l === 1 && s && (p.scrollTop = p.scrollHeight);
|
|
1921
1920
|
}, [c, l, s]);
|
|
1922
1921
|
const g = x(r.searchingInMemoriesOfType, {
|
|
1923
1922
|
name: e.memoryTypeName
|
|
1924
|
-
}), f = !
|
|
1925
|
-
return /* @__PURE__ */
|
|
1926
|
-
|
|
1923
|
+
}), f = !n && l === 3;
|
|
1924
|
+
return /* @__PURE__ */ y(
|
|
1925
|
+
b.div,
|
|
1927
1926
|
{
|
|
1928
1927
|
initial: { opacity: 0 },
|
|
1929
1928
|
animate: { opacity: 1 },
|
|
@@ -1950,10 +1949,10 @@ function sr({
|
|
|
1950
1949
|
width: 32,
|
|
1951
1950
|
...f ? { paddingTop: 2 } : {}
|
|
1952
1951
|
},
|
|
1953
|
-
children: /* @__PURE__ */ i(ar, { phase:
|
|
1952
|
+
children: /* @__PURE__ */ i(ar, { phase: n ? 1 : l })
|
|
1954
1953
|
}
|
|
1955
1954
|
),
|
|
1956
|
-
/* @__PURE__ */
|
|
1955
|
+
/* @__PURE__ */ y(
|
|
1957
1956
|
"div",
|
|
1958
1957
|
{
|
|
1959
1958
|
style: {
|
|
@@ -1965,7 +1964,7 @@ function sr({
|
|
|
1965
1964
|
},
|
|
1966
1965
|
children: [
|
|
1967
1966
|
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ i(
|
|
1968
|
-
|
|
1967
|
+
w,
|
|
1969
1968
|
{
|
|
1970
1969
|
text: g,
|
|
1971
1970
|
duration: 2.5,
|
|
@@ -1974,7 +1973,7 @@ function sr({
|
|
|
1974
1973
|
shimmerColor: "#000"
|
|
1975
1974
|
}
|
|
1976
1975
|
) : e.memoryTypeName }),
|
|
1977
|
-
l === 1 && s && !O(e) && /* @__PURE__ */
|
|
1976
|
+
l === 1 && s && !O(e) && /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
|
|
1978
1977
|
/* @__PURE__ */ i(
|
|
1979
1978
|
"span",
|
|
1980
1979
|
{
|
|
@@ -2021,7 +2020,7 @@ function sr({
|
|
|
2021
2020
|
)
|
|
2022
2021
|
] }),
|
|
2023
2022
|
l === 2 && u && /* @__PURE__ */ i("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ i(
|
|
2024
|
-
|
|
2023
|
+
w,
|
|
2025
2024
|
{
|
|
2026
2025
|
text: r.memorySearchGeneratingQueriesPending,
|
|
2027
2026
|
duration: 2.5,
|
|
@@ -2030,8 +2029,8 @@ function sr({
|
|
|
2030
2029
|
shimmerColor: "#000"
|
|
2031
2030
|
}
|
|
2032
2031
|
) }),
|
|
2033
|
-
l === 3 && /* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2032
|
+
l === 3 && /* @__PURE__ */ y(I, { children: [
|
|
2033
|
+
/* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
|
|
2035
2034
|
/* @__PURE__ */ i(
|
|
2036
2035
|
"span",
|
|
2037
2036
|
{
|
|
@@ -2053,7 +2052,7 @@ function sr({
|
|
|
2053
2052
|
flexDirection: "column",
|
|
2054
2053
|
gap: 6
|
|
2055
2054
|
},
|
|
2056
|
-
children: e.queries.map((
|
|
2055
|
+
children: e.queries.map((p, S) => /* @__PURE__ */ i(
|
|
2057
2056
|
"div",
|
|
2058
2057
|
{
|
|
2059
2058
|
style: {
|
|
@@ -2062,19 +2061,19 @@ function sr({
|
|
|
2062
2061
|
lineHeight: 1.5,
|
|
2063
2062
|
wordBreak: "break-word"
|
|
2064
2063
|
},
|
|
2065
|
-
children:
|
|
2064
|
+
children: p.query
|
|
2066
2065
|
},
|
|
2067
2066
|
S
|
|
2068
2067
|
))
|
|
2069
2068
|
}
|
|
2070
2069
|
)
|
|
2071
2070
|
] }),
|
|
2072
|
-
s && /* @__PURE__ */
|
|
2071
|
+
s && /* @__PURE__ */ y(I, { children: [
|
|
2073
2072
|
/* @__PURE__ */ i(
|
|
2074
2073
|
"button",
|
|
2075
2074
|
{
|
|
2076
2075
|
type: "button",
|
|
2077
|
-
onClick: () => o((
|
|
2076
|
+
onClick: () => o((p) => !p),
|
|
2078
2077
|
style: {
|
|
2079
2078
|
alignSelf: "flex-start",
|
|
2080
2079
|
border: "none",
|
|
@@ -2113,18 +2112,18 @@ function sr({
|
|
|
2113
2112
|
}
|
|
2114
2113
|
);
|
|
2115
2114
|
}
|
|
2116
|
-
const lr = ({ data: e, isLatest: r = !1, durationSeconds:
|
|
2115
|
+
const lr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
2117
2116
|
const l = D(() => {
|
|
2118
2117
|
let c = -1;
|
|
2119
2118
|
return e.memoryTypes.forEach((s, d) => {
|
|
2120
2119
|
O(s) || (c = d);
|
|
2121
2120
|
}), c;
|
|
2122
2121
|
}, [e.memoryTypes]);
|
|
2123
|
-
return /* @__PURE__ */
|
|
2124
|
-
r && !
|
|
2125
|
-
|
|
2122
|
+
return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
2123
|
+
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
|
|
2124
|
+
w,
|
|
2126
2125
|
{
|
|
2127
|
-
text:
|
|
2126
|
+
text: n.memorySearchGeneratingQueries,
|
|
2128
2127
|
duration: 2.5,
|
|
2129
2128
|
repeat: !0,
|
|
2130
2129
|
color: "#999",
|
|
@@ -2134,12 +2133,12 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
2134
2133
|
sr,
|
|
2135
2134
|
{
|
|
2136
2135
|
item: c,
|
|
2137
|
-
t,
|
|
2136
|
+
t: n,
|
|
2138
2137
|
isActiveRow: s === l && r
|
|
2139
2138
|
},
|
|
2140
2139
|
c.memoryTypeId
|
|
2141
2140
|
)),
|
|
2142
|
-
|
|
2141
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
2143
2142
|
"div",
|
|
2144
2143
|
{
|
|
2145
2144
|
style: {
|
|
@@ -2148,26 +2147,26 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
2148
2147
|
marginTop: "4px",
|
|
2149
2148
|
fontStyle: "italic"
|
|
2150
2149
|
},
|
|
2151
|
-
children: x(
|
|
2150
|
+
children: x(n.tookSeconds, { n: t })
|
|
2152
2151
|
}
|
|
2153
2152
|
)
|
|
2154
2153
|
] });
|
|
2155
2154
|
};
|
|
2156
2155
|
function cr(e, r) {
|
|
2157
|
-
const
|
|
2158
|
-
for (let
|
|
2159
|
-
if (e.slice(-
|
|
2156
|
+
const t = Math.min(e.length, r.length);
|
|
2157
|
+
for (let n = t; n >= 0; n--)
|
|
2158
|
+
if (e.slice(-n) === r.slice(0, n)) return n;
|
|
2160
2159
|
return 0;
|
|
2161
2160
|
}
|
|
2162
2161
|
const dr = `
|
|
2163
2162
|
|
|
2164
2163
|
`;
|
|
2165
2164
|
function re(e) {
|
|
2166
|
-
var
|
|
2165
|
+
var t, n;
|
|
2167
2166
|
if (e.length === 0) return "";
|
|
2168
|
-
let r = ((
|
|
2167
|
+
let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
|
|
2169
2168
|
for (let l = 1; l < e.length; l++) {
|
|
2170
|
-
const c = ((
|
|
2169
|
+
const c = ((n = e[l]) == null ? void 0 : n.content) ?? "";
|
|
2171
2170
|
if (c === "") continue;
|
|
2172
2171
|
if (r === "") {
|
|
2173
2172
|
r = c;
|
|
@@ -2189,17 +2188,17 @@ function ne(e, r) {
|
|
|
2189
2188
|
a: e[0],
|
|
2190
2189
|
b: e[1]
|
|
2191
2190
|
});
|
|
2192
|
-
const
|
|
2191
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
2193
2192
|
return x(r.memorySearchPagesMultiple, {
|
|
2194
|
-
list:
|
|
2195
|
-
n
|
|
2193
|
+
list: n,
|
|
2194
|
+
n: t
|
|
2196
2195
|
});
|
|
2197
2196
|
}
|
|
2198
2197
|
function te(e) {
|
|
2199
2198
|
const r = /* @__PURE__ */ new Set();
|
|
2200
|
-
for (const
|
|
2201
|
-
for (const
|
|
2202
|
-
return [...r].sort((
|
|
2199
|
+
for (const t of e)
|
|
2200
|
+
for (const n of t.pageNumbers) r.add(n);
|
|
2201
|
+
return [...r].sort((t, n) => t - n);
|
|
2203
2202
|
}
|
|
2204
2203
|
function oe(e) {
|
|
2205
2204
|
const r = e.memoryTypeName.trim();
|
|
@@ -2207,14 +2206,14 @@ function oe(e) {
|
|
|
2207
2206
|
if (e.memoryTypeId !== "") return e.memoryTypeId;
|
|
2208
2207
|
}
|
|
2209
2208
|
function mr(e) {
|
|
2210
|
-
return e.some((
|
|
2209
|
+
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(j, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 });
|
|
2211
2210
|
}
|
|
2212
2211
|
function ur(e, r) {
|
|
2213
2212
|
if (e.error != null)
|
|
2214
2213
|
return /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
|
|
2215
2214
|
if (e.result == null)
|
|
2216
2215
|
return /* @__PURE__ */ i("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ i(
|
|
2217
|
-
|
|
2216
|
+
w,
|
|
2218
2217
|
{
|
|
2219
2218
|
text: r.searching,
|
|
2220
2219
|
duration: 2.5,
|
|
@@ -2223,11 +2222,11 @@ function ur(e, r) {
|
|
|
2223
2222
|
shimmerColor: "#000"
|
|
2224
2223
|
}
|
|
2225
2224
|
) });
|
|
2226
|
-
const
|
|
2227
|
-
n:
|
|
2225
|
+
const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : x(r.chunksFound, { n: t.numberOfChunks }), l = x(r.scoreLabel, {
|
|
2226
|
+
n: t.highestChunkScore.toFixed(2)
|
|
2228
2227
|
});
|
|
2229
|
-
return /* @__PURE__ */
|
|
2230
|
-
|
|
2228
|
+
return /* @__PURE__ */ y("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
|
|
2229
|
+
n,
|
|
2231
2230
|
" · ",
|
|
2232
2231
|
l
|
|
2233
2232
|
] });
|
|
@@ -2235,10 +2234,10 @@ function ur(e, r) {
|
|
|
2235
2234
|
function yr({
|
|
2236
2235
|
items: e,
|
|
2237
2236
|
queryRow: r,
|
|
2238
|
-
onExploreQueryResultClick:
|
|
2239
|
-
t
|
|
2237
|
+
onExploreQueryResultClick: t,
|
|
2238
|
+
t: n
|
|
2240
2239
|
}) {
|
|
2241
|
-
const [l, c] =
|
|
2240
|
+
const [l, c] = v(null);
|
|
2242
2241
|
if (e.length === 0)
|
|
2243
2242
|
return /* @__PURE__ */ i(
|
|
2244
2243
|
"div",
|
|
@@ -2248,10 +2247,10 @@ function yr({
|
|
|
2248
2247
|
color: "#94a3b8",
|
|
2249
2248
|
paddingTop: 4
|
|
2250
2249
|
},
|
|
2251
|
-
children:
|
|
2250
|
+
children: n.memorySearchExploreNoResults
|
|
2252
2251
|
}
|
|
2253
2252
|
);
|
|
2254
|
-
const s = !!
|
|
2253
|
+
const s = !!t;
|
|
2255
2254
|
return /* @__PURE__ */ i(
|
|
2256
2255
|
"div",
|
|
2257
2256
|
{
|
|
@@ -2268,10 +2267,10 @@ function yr({
|
|
|
2268
2267
|
d.chunks
|
|
2269
2268
|
), u = [
|
|
2270
2269
|
oe(d),
|
|
2271
|
-
x(
|
|
2270
|
+
x(n.scoreLabel, {
|
|
2272
2271
|
n: d.matchingChunkScore.toFixed(2)
|
|
2273
2272
|
}),
|
|
2274
|
-
a.length > 0 ? ne(a,
|
|
2273
|
+
a.length > 0 ? ne(a, n) : n.pagesNotAvailable
|
|
2275
2274
|
].filter(
|
|
2276
2275
|
(S) => S != null && S !== ""
|
|
2277
2276
|
), g = {
|
|
@@ -2281,8 +2280,8 @@ function yr({
|
|
|
2281
2280
|
memoryTypeId: r.memoryTypeId,
|
|
2282
2281
|
memoryTypeName: r.memoryTypeName,
|
|
2283
2282
|
query: r.query
|
|
2284
|
-
}, f = `${r.query}::${d.memoryId}::${m}`,
|
|
2285
|
-
return /* @__PURE__ */
|
|
2283
|
+
}, f = `${r.query}::${d.memoryId}::${m}`, p = l === f;
|
|
2284
|
+
return /* @__PURE__ */ y(
|
|
2286
2285
|
"div",
|
|
2287
2286
|
{
|
|
2288
2287
|
style: {
|
|
@@ -2296,7 +2295,7 @@ function yr({
|
|
|
2296
2295
|
minWidth: 0
|
|
2297
2296
|
},
|
|
2298
2297
|
children: [
|
|
2299
|
-
/* @__PURE__ */
|
|
2298
|
+
/* @__PURE__ */ y(
|
|
2300
2299
|
"div",
|
|
2301
2300
|
{
|
|
2302
2301
|
style: {
|
|
@@ -2348,16 +2347,16 @@ function yr({
|
|
|
2348
2347
|
]
|
|
2349
2348
|
}
|
|
2350
2349
|
),
|
|
2351
|
-
s && /* @__PURE__ */
|
|
2350
|
+
s && /* @__PURE__ */ y(
|
|
2352
2351
|
"button",
|
|
2353
2352
|
{
|
|
2354
2353
|
type: "button",
|
|
2355
|
-
"aria-busy":
|
|
2356
|
-
disabled:
|
|
2354
|
+
"aria-busy": p,
|
|
2355
|
+
disabled: p,
|
|
2357
2356
|
onClick: async () => {
|
|
2358
2357
|
c(f);
|
|
2359
2358
|
try {
|
|
2360
|
-
await
|
|
2359
|
+
await t(
|
|
2361
2360
|
g
|
|
2362
2361
|
);
|
|
2363
2362
|
} finally {
|
|
@@ -2374,21 +2373,21 @@ function yr({
|
|
|
2374
2373
|
background: "#eff6ff",
|
|
2375
2374
|
border: "1px solid #bfdbfe",
|
|
2376
2375
|
borderRadius: 6,
|
|
2377
|
-
cursor:
|
|
2376
|
+
cursor: p ? "wait" : "pointer",
|
|
2378
2377
|
fontFamily: "inherit",
|
|
2379
2378
|
display: "inline-flex",
|
|
2380
2379
|
alignItems: "center",
|
|
2381
2380
|
gap: 8
|
|
2382
2381
|
},
|
|
2383
2382
|
children: [
|
|
2384
|
-
|
|
2383
|
+
p && /* @__PURE__ */ i(
|
|
2385
2384
|
"span",
|
|
2386
2385
|
{
|
|
2387
2386
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
2388
2387
|
"aria-hidden": !0
|
|
2389
2388
|
}
|
|
2390
2389
|
),
|
|
2391
|
-
|
|
2390
|
+
n.viewButton
|
|
2392
2391
|
]
|
|
2393
2392
|
}
|
|
2394
2393
|
)
|
|
@@ -2400,22 +2399,22 @@ function yr({
|
|
|
2400
2399
|
}
|
|
2401
2400
|
);
|
|
2402
2401
|
}
|
|
2403
|
-
function
|
|
2404
|
-
const r = [],
|
|
2405
|
-
return e.forEach((
|
|
2406
|
-
let c =
|
|
2407
|
-
c == null && (r.push(
|
|
2408
|
-
memoryTypeId:
|
|
2409
|
-
memoryTypeName:
|
|
2402
|
+
function gr(e) {
|
|
2403
|
+
const r = [], t = /* @__PURE__ */ new Map();
|
|
2404
|
+
return e.forEach((n, l) => {
|
|
2405
|
+
let c = t.get(n.memoryTypeId);
|
|
2406
|
+
c == null && (r.push(n.memoryTypeId), c = {
|
|
2407
|
+
memoryTypeId: n.memoryTypeId,
|
|
2408
|
+
memoryTypeName: n.memoryTypeName,
|
|
2410
2409
|
items: []
|
|
2411
|
-
},
|
|
2412
|
-
}), r.map((
|
|
2410
|
+
}, t.set(n.memoryTypeId, c)), c.items.push({ item: n, flatIndex: l });
|
|
2411
|
+
}), r.map((n) => t.get(n));
|
|
2413
2412
|
}
|
|
2414
|
-
function
|
|
2413
|
+
function pr({
|
|
2415
2414
|
group: e,
|
|
2416
2415
|
t: r,
|
|
2417
|
-
lastInFlightIndex:
|
|
2418
|
-
isLatest:
|
|
2416
|
+
lastInFlightIndex: t,
|
|
2417
|
+
isLatest: n,
|
|
2419
2418
|
expandedRows: l,
|
|
2420
2419
|
toggleExpanded: c,
|
|
2421
2420
|
onExploreQueryResultClick: s
|
|
@@ -2423,8 +2422,8 @@ function gr({
|
|
|
2423
2422
|
const d = e.items.map((o) => o.item), m = d.some(
|
|
2424
2423
|
(o) => o.result == null && o.error == null
|
|
2425
2424
|
);
|
|
2426
|
-
return /* @__PURE__ */
|
|
2427
|
-
|
|
2425
|
+
return /* @__PURE__ */ y(
|
|
2426
|
+
b.div,
|
|
2428
2427
|
{
|
|
2429
2428
|
initial: { opacity: 0 },
|
|
2430
2429
|
animate: { opacity: 1 },
|
|
@@ -2454,7 +2453,7 @@ function gr({
|
|
|
2454
2453
|
children: mr(d)
|
|
2455
2454
|
}
|
|
2456
2455
|
),
|
|
2457
|
-
/* @__PURE__ */
|
|
2456
|
+
/* @__PURE__ */ y(
|
|
2458
2457
|
"div",
|
|
2459
2458
|
{
|
|
2460
2459
|
style: {
|
|
@@ -2479,8 +2478,8 @@ function gr({
|
|
|
2479
2478
|
),
|
|
2480
2479
|
e.items.map(({ item: o, flatIndex: a }) => {
|
|
2481
2480
|
var h;
|
|
2482
|
-
const u = o.result != null, g = o.error != null, f = a ===
|
|
2483
|
-
return /* @__PURE__ */
|
|
2481
|
+
const u = o.result != null, g = o.error != null, f = a === t && n && !u && !g, p = l[a] === !0, S = ((h = o.result) == null ? void 0 : h.items) ?? [];
|
|
2482
|
+
return /* @__PURE__ */ y(
|
|
2484
2483
|
"div",
|
|
2485
2484
|
{
|
|
2486
2485
|
style: {
|
|
@@ -2490,7 +2489,7 @@ function gr({
|
|
|
2490
2489
|
minWidth: 0
|
|
2491
2490
|
},
|
|
2492
2491
|
children: [
|
|
2493
|
-
/* @__PURE__ */
|
|
2492
|
+
/* @__PURE__ */ y(
|
|
2494
2493
|
"div",
|
|
2495
2494
|
{
|
|
2496
2495
|
style: {
|
|
@@ -2514,7 +2513,7 @@ function gr({
|
|
|
2514
2513
|
minWidth: 0
|
|
2515
2514
|
},
|
|
2516
2515
|
children: f ? /* @__PURE__ */ i(
|
|
2517
|
-
|
|
2516
|
+
w,
|
|
2518
2517
|
{
|
|
2519
2518
|
text: o.query,
|
|
2520
2519
|
duration: 2.5,
|
|
@@ -2525,7 +2524,7 @@ function gr({
|
|
|
2525
2524
|
) : o.query
|
|
2526
2525
|
}
|
|
2527
2526
|
),
|
|
2528
|
-
/* @__PURE__ */
|
|
2527
|
+
/* @__PURE__ */ y(
|
|
2529
2528
|
"div",
|
|
2530
2529
|
{
|
|
2531
2530
|
style: {
|
|
@@ -2552,7 +2551,7 @@ function gr({
|
|
|
2552
2551
|
textDecoration: "underline",
|
|
2553
2552
|
fontFamily: "inherit"
|
|
2554
2553
|
},
|
|
2555
|
-
children:
|
|
2554
|
+
children: p ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2556
2555
|
}
|
|
2557
2556
|
)
|
|
2558
2557
|
]
|
|
@@ -2561,7 +2560,7 @@ function gr({
|
|
|
2561
2560
|
]
|
|
2562
2561
|
}
|
|
2563
2562
|
),
|
|
2564
|
-
u &&
|
|
2563
|
+
u && p && /* @__PURE__ */ i(
|
|
2565
2564
|
yr,
|
|
2566
2565
|
{
|
|
2567
2566
|
items: S,
|
|
@@ -2585,11 +2584,11 @@ function gr({
|
|
|
2585
2584
|
const hr = ({
|
|
2586
2585
|
data: e,
|
|
2587
2586
|
isLatest: r = !1,
|
|
2588
|
-
durationSeconds:
|
|
2589
|
-
onExploreQueryResultClick:
|
|
2587
|
+
durationSeconds: t,
|
|
2588
|
+
onExploreQueryResultClick: n,
|
|
2590
2589
|
t: l
|
|
2591
2590
|
}) => {
|
|
2592
|
-
const [c, s] =
|
|
2591
|
+
const [c, s] = v(
|
|
2593
2592
|
{}
|
|
2594
2593
|
), d = G((a) => {
|
|
2595
2594
|
s((u) => ({
|
|
@@ -2602,12 +2601,12 @@ const hr = ({
|
|
|
2602
2601
|
u.result == null && u.error == null && (a = g);
|
|
2603
2602
|
}), a;
|
|
2604
2603
|
}, [e.queries]), o = D(
|
|
2605
|
-
() =>
|
|
2604
|
+
() => gr(e.queries),
|
|
2606
2605
|
[e.queries]
|
|
2607
2606
|
);
|
|
2608
|
-
return /* @__PURE__ */
|
|
2609
|
-
r && !
|
|
2610
|
-
|
|
2607
|
+
return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
2608
|
+
r && !t && e.queries.length === 0 ? /* @__PURE__ */ i(
|
|
2609
|
+
w,
|
|
2611
2610
|
{
|
|
2612
2611
|
text: l.memorySearchExploringQueries,
|
|
2613
2612
|
duration: 2.5,
|
|
@@ -2616,7 +2615,7 @@ const hr = ({
|
|
|
2616
2615
|
shimmerColor: "#000"
|
|
2617
2616
|
}
|
|
2618
2617
|
) : o.map((a) => /* @__PURE__ */ i(
|
|
2619
|
-
|
|
2618
|
+
pr,
|
|
2620
2619
|
{
|
|
2621
2620
|
group: a,
|
|
2622
2621
|
t: l,
|
|
@@ -2624,11 +2623,11 @@ const hr = ({
|
|
|
2624
2623
|
isLatest: r,
|
|
2625
2624
|
expandedRows: c,
|
|
2626
2625
|
toggleExpanded: d,
|
|
2627
|
-
onExploreQueryResultClick:
|
|
2626
|
+
onExploreQueryResultClick: n
|
|
2628
2627
|
},
|
|
2629
2628
|
a.memoryTypeId
|
|
2630
2629
|
)),
|
|
2631
|
-
|
|
2630
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
2632
2631
|
"div",
|
|
2633
2632
|
{
|
|
2634
2633
|
style: {
|
|
@@ -2637,15 +2636,15 @@ const hr = ({
|
|
|
2637
2636
|
marginTop: "4px",
|
|
2638
2637
|
fontStyle: "italic"
|
|
2639
2638
|
},
|
|
2640
|
-
children: x(l.tookSeconds, { n })
|
|
2639
|
+
children: x(l.tookSeconds, { n: t })
|
|
2641
2640
|
}
|
|
2642
2641
|
)
|
|
2643
2642
|
] });
|
|
2644
|
-
}, fr = ({ data: e, onSearchResultClick: r, t
|
|
2645
|
-
const
|
|
2646
|
-
return /* @__PURE__ */
|
|
2643
|
+
}, fr = ({ data: e, onSearchResultClick: r, t }) => {
|
|
2644
|
+
const n = e.response.items, l = !!r, [c, s] = v(null);
|
|
2645
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
2647
2646
|
/* @__PURE__ */ i(
|
|
2648
|
-
|
|
2647
|
+
b.div,
|
|
2649
2648
|
{
|
|
2650
2649
|
style: {
|
|
2651
2650
|
marginBottom: "12px",
|
|
@@ -2656,7 +2655,7 @@ const hr = ({
|
|
|
2656
2655
|
initial: { opacity: 0, y: -6 },
|
|
2657
2656
|
animate: { opacity: 1, y: 0 },
|
|
2658
2657
|
transition: { duration: 0.25 },
|
|
2659
|
-
children:
|
|
2658
|
+
children: t.resultsHeading
|
|
2660
2659
|
}
|
|
2661
2660
|
),
|
|
2662
2661
|
/* @__PURE__ */ i(
|
|
@@ -2667,15 +2666,15 @@ const hr = ({
|
|
|
2667
2666
|
flexDirection: "column",
|
|
2668
2667
|
gap: 0
|
|
2669
2668
|
},
|
|
2670
|
-
children:
|
|
2669
|
+
children: n.map((d, m) => {
|
|
2671
2670
|
const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = te(
|
|
2672
2671
|
d.chunks
|
|
2673
2672
|
), u = [
|
|
2674
2673
|
oe(d),
|
|
2675
|
-
x(
|
|
2674
|
+
x(t.scoreLabel, {
|
|
2676
2675
|
n: d.matchingChunkScore.toFixed(2)
|
|
2677
2676
|
}),
|
|
2678
|
-
a.length > 0 ? ne(a,
|
|
2677
|
+
a.length > 0 ? ne(a, t) : t.pagesNotAvailable
|
|
2679
2678
|
].filter(
|
|
2680
2679
|
(S) => S != null && S !== ""
|
|
2681
2680
|
), g = {
|
|
@@ -2684,9 +2683,9 @@ const hr = ({
|
|
|
2684
2683
|
memoryTypeId: d.memoryTypeId,
|
|
2685
2684
|
memoryTypeName: d.memoryTypeName,
|
|
2686
2685
|
pageNumbers: a
|
|
2687
|
-
}, f = `${d.memoryId}-${m}`,
|
|
2688
|
-
return /* @__PURE__ */
|
|
2689
|
-
|
|
2686
|
+
}, f = `${d.memoryId}-${m}`, p = c === f;
|
|
2687
|
+
return /* @__PURE__ */ y(
|
|
2688
|
+
b.div,
|
|
2690
2689
|
{
|
|
2691
2690
|
initial: { opacity: 0 },
|
|
2692
2691
|
animate: { opacity: 1 },
|
|
@@ -2698,11 +2697,11 @@ const hr = ({
|
|
|
2698
2697
|
gap: "12px",
|
|
2699
2698
|
paddingTop: "12px",
|
|
2700
2699
|
paddingBottom: "12px",
|
|
2701
|
-
borderBottom: m <
|
|
2700
|
+
borderBottom: m < n.length - 1 ? "1px solid #eee" : void 0,
|
|
2702
2701
|
minWidth: 0
|
|
2703
2702
|
},
|
|
2704
2703
|
children: [
|
|
2705
|
-
/* @__PURE__ */
|
|
2704
|
+
/* @__PURE__ */ y(
|
|
2706
2705
|
"div",
|
|
2707
2706
|
{
|
|
2708
2707
|
style: {
|
|
@@ -2752,12 +2751,12 @@ const hr = ({
|
|
|
2752
2751
|
]
|
|
2753
2752
|
}
|
|
2754
2753
|
),
|
|
2755
|
-
l && /* @__PURE__ */
|
|
2754
|
+
l && /* @__PURE__ */ y(
|
|
2756
2755
|
"button",
|
|
2757
2756
|
{
|
|
2758
2757
|
type: "button",
|
|
2759
|
-
"aria-busy":
|
|
2760
|
-
disabled:
|
|
2758
|
+
"aria-busy": p,
|
|
2759
|
+
disabled: p,
|
|
2761
2760
|
onClick: async () => {
|
|
2762
2761
|
s(f);
|
|
2763
2762
|
try {
|
|
@@ -2776,21 +2775,21 @@ const hr = ({
|
|
|
2776
2775
|
background: "#eff6ff",
|
|
2777
2776
|
border: "1px solid #bfdbfe",
|
|
2778
2777
|
borderRadius: 6,
|
|
2779
|
-
cursor:
|
|
2778
|
+
cursor: p ? "wait" : "pointer",
|
|
2780
2779
|
fontFamily: "inherit",
|
|
2781
2780
|
display: "inline-flex",
|
|
2782
2781
|
alignItems: "center",
|
|
2783
2782
|
gap: 8
|
|
2784
2783
|
},
|
|
2785
2784
|
children: [
|
|
2786
|
-
|
|
2785
|
+
p && /* @__PURE__ */ i(
|
|
2787
2786
|
"span",
|
|
2788
2787
|
{
|
|
2789
2788
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
2790
2789
|
"aria-hidden": !0
|
|
2791
2790
|
}
|
|
2792
2791
|
),
|
|
2793
|
-
|
|
2792
|
+
t.viewButton
|
|
2794
2793
|
]
|
|
2795
2794
|
}
|
|
2796
2795
|
)
|
|
@@ -2803,7 +2802,7 @@ const hr = ({
|
|
|
2803
2802
|
)
|
|
2804
2803
|
] });
|
|
2805
2804
|
}, Sr = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
2806
|
-
|
|
2805
|
+
b.div,
|
|
2807
2806
|
{
|
|
2808
2807
|
initial: { opacity: 0, y: -10 },
|
|
2809
2808
|
animate: { opacity: 1, y: 0 },
|
|
@@ -2828,13 +2827,13 @@ const hr = ({
|
|
|
2828
2827
|
) }), xr = ({
|
|
2829
2828
|
progressViewItems: e,
|
|
2830
2829
|
loadingText: r,
|
|
2831
|
-
t
|
|
2832
|
-
onSourceClick:
|
|
2830
|
+
t,
|
|
2831
|
+
onSourceClick: n,
|
|
2833
2832
|
onSearchResultClick: l,
|
|
2834
2833
|
onExploreQueryResultClick: c
|
|
2835
2834
|
}) => {
|
|
2836
|
-
const s =
|
|
2837
|
-
|
|
2835
|
+
const s = F(null);
|
|
2836
|
+
A(() => {
|
|
2838
2837
|
s.current && (s.current.scrollTop = s.current.scrollHeight);
|
|
2839
2838
|
}, [e.length]);
|
|
2840
2839
|
const d = (o) => {
|
|
@@ -2854,7 +2853,7 @@ const hr = ({
|
|
|
2854
2853
|
data: a,
|
|
2855
2854
|
isLatest: o.isLatest,
|
|
2856
2855
|
durationSeconds: o.durationSeconds,
|
|
2857
|
-
t
|
|
2856
|
+
t
|
|
2858
2857
|
}
|
|
2859
2858
|
);
|
|
2860
2859
|
case "FindMemoriesResult":
|
|
@@ -2862,7 +2861,7 @@ const hr = ({
|
|
|
2862
2861
|
He,
|
|
2863
2862
|
{
|
|
2864
2863
|
data: a,
|
|
2865
|
-
t
|
|
2864
|
+
t
|
|
2866
2865
|
}
|
|
2867
2866
|
);
|
|
2868
2867
|
case "Search":
|
|
@@ -2872,7 +2871,7 @@ const hr = ({
|
|
|
2872
2871
|
data: a,
|
|
2873
2872
|
isLatest: o.isLatest,
|
|
2874
2873
|
durationSeconds: o.durationSeconds,
|
|
2875
|
-
t
|
|
2874
|
+
t
|
|
2876
2875
|
}
|
|
2877
2876
|
);
|
|
2878
2877
|
case "FindSources":
|
|
@@ -2882,7 +2881,7 @@ const hr = ({
|
|
|
2882
2881
|
data: a,
|
|
2883
2882
|
isLatest: o.isLatest,
|
|
2884
2883
|
durationSeconds: o.durationSeconds,
|
|
2885
|
-
t
|
|
2884
|
+
t
|
|
2886
2885
|
}
|
|
2887
2886
|
);
|
|
2888
2887
|
case "SourcesResult":
|
|
@@ -2890,8 +2889,8 @@ const hr = ({
|
|
|
2890
2889
|
Qe,
|
|
2891
2890
|
{
|
|
2892
2891
|
data: a,
|
|
2893
|
-
onSourceClick:
|
|
2894
|
-
t
|
|
2892
|
+
onSourceClick: n,
|
|
2893
|
+
t
|
|
2895
2894
|
}
|
|
2896
2895
|
);
|
|
2897
2896
|
case "ExploreMemories":
|
|
@@ -2901,11 +2900,11 @@ const hr = ({
|
|
|
2901
2900
|
data: a,
|
|
2902
2901
|
completed: o.completed,
|
|
2903
2902
|
isLatest: o.isLatest,
|
|
2904
|
-
t
|
|
2903
|
+
t
|
|
2905
2904
|
}
|
|
2906
2905
|
);
|
|
2907
2906
|
case "ChunkResult":
|
|
2908
|
-
return /* @__PURE__ */ i(Je, { data: a, t
|
|
2907
|
+
return /* @__PURE__ */ i(Je, { data: a, t });
|
|
2909
2908
|
case "Completed":
|
|
2910
2909
|
return null;
|
|
2911
2910
|
}
|
|
@@ -2918,7 +2917,7 @@ const hr = ({
|
|
|
2918
2917
|
data: a,
|
|
2919
2918
|
isLatest: o.isLatest,
|
|
2920
2919
|
durationSeconds: o.durationSeconds,
|
|
2921
|
-
t
|
|
2920
|
+
t
|
|
2922
2921
|
}
|
|
2923
2922
|
);
|
|
2924
2923
|
case "ExploreQueries":
|
|
@@ -2929,7 +2928,7 @@ const hr = ({
|
|
|
2929
2928
|
isLatest: o.isLatest,
|
|
2930
2929
|
durationSeconds: o.durationSeconds,
|
|
2931
2930
|
onExploreQueryResultClick: c,
|
|
2932
|
-
t
|
|
2931
|
+
t
|
|
2933
2932
|
}
|
|
2934
2933
|
);
|
|
2935
2934
|
case "SearchMemoryTypes":
|
|
@@ -2939,7 +2938,7 @@ const hr = ({
|
|
|
2939
2938
|
data: a,
|
|
2940
2939
|
isLatest: o.isLatest,
|
|
2941
2940
|
durationSeconds: o.durationSeconds,
|
|
2942
|
-
t
|
|
2941
|
+
t
|
|
2943
2942
|
}
|
|
2944
2943
|
);
|
|
2945
2944
|
case "Completed":
|
|
@@ -2948,7 +2947,7 @@ const hr = ({
|
|
|
2948
2947
|
{
|
|
2949
2948
|
data: a,
|
|
2950
2949
|
onSearchResultClick: l,
|
|
2951
|
-
t
|
|
2950
|
+
t
|
|
2952
2951
|
}
|
|
2953
2952
|
);
|
|
2954
2953
|
}
|
|
@@ -2956,9 +2955,9 @@ const hr = ({
|
|
|
2956
2955
|
};
|
|
2957
2956
|
if (e.length === 0)
|
|
2958
2957
|
return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
|
|
2959
|
-
|
|
2958
|
+
w,
|
|
2960
2959
|
{
|
|
2961
|
-
text: r ??
|
|
2960
|
+
text: r ?? t.processingYourTask,
|
|
2962
2961
|
duration: 1.5,
|
|
2963
2962
|
repeat: !0,
|
|
2964
2963
|
repeatDelay: 0,
|
|
@@ -2977,7 +2976,7 @@ const hr = ({
|
|
|
2977
2976
|
) : !0;
|
|
2978
2977
|
});
|
|
2979
2978
|
return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(X, { children: m.map((o, a) => /* @__PURE__ */ i(
|
|
2980
|
-
|
|
2979
|
+
b.div,
|
|
2981
2980
|
{
|
|
2982
2981
|
id: `agent-task-progress-item-${o.item.progressItemId}`,
|
|
2983
2982
|
initial: { opacity: 0, y: -20 },
|
|
@@ -2994,12 +2993,12 @@ const hr = ({
|
|
|
2994
2993
|
}, Ar = ({
|
|
2995
2994
|
agentTask: e,
|
|
2996
2995
|
mode: r = "verbose",
|
|
2997
|
-
language:
|
|
2998
|
-
onSourceClick:
|
|
2996
|
+
language: t,
|
|
2997
|
+
onSourceClick: n,
|
|
2999
2998
|
onSearchResultClick: l,
|
|
3000
2999
|
onExploreQueryResultClick: c
|
|
3001
3000
|
}) => {
|
|
3002
|
-
const s = De(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" :
|
|
3001
|
+
const s = De(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : t ?? "en", m = Be(d);
|
|
3003
3002
|
return r === "simple" ? /* @__PURE__ */ i(
|
|
3004
3003
|
ze,
|
|
3005
3004
|
{
|
|
@@ -3012,7 +3011,7 @@ const hr = ({
|
|
|
3012
3011
|
progressViewItems: s,
|
|
3013
3012
|
loadingText: e.loadingText,
|
|
3014
3013
|
t: m,
|
|
3015
|
-
onSourceClick:
|
|
3014
|
+
onSourceClick: n,
|
|
3016
3015
|
onSearchResultClick: l,
|
|
3017
3016
|
onExploreQueryResultClick: c
|
|
3018
3017
|
}
|