@fencyai/react 0.1.172 → 0.1.174
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/AgentTaskProgressVerbose.d.ts.map +1 -1
- package/dist/agent-task/data-types/MemoryChatGoogleSearch.d.ts +14 -0
- package/dist/agent-task/data-types/MemoryChatGoogleSearch.d.ts.map +1 -0
- package/dist/agent-task/data-types/MemoryChatGoogleSearchResult.d.ts +14 -0
- package/dist/agent-task/data-types/MemoryChatGoogleSearchResult.d.ts.map +1 -0
- package/dist/agent-task/data-types/MemoryChatScrape.d.ts +14 -0
- package/dist/agent-task/data-types/MemoryChatScrape.d.ts.map +1 -0
- package/dist/agent-task/data-types/MemoryChatScrapeResult.d.ts +14 -0
- package/dist/agent-task/data-types/MemoryChatScrapeResult.d.ts.map +1 -0
- package/dist/agent-task/translations.d.ts +11 -0
- package/dist/agent-task/translations.d.ts.map +1 -1
- package/dist/hooks/useFencyEventSource/index.d.ts +0 -1
- package/dist/hooks/useFencyEventSource/index.d.ts.map +1 -1
- package/dist/index.js +1805 -1045
- package/dist/provider/StreamEventManager.d.ts +14 -1
- package/dist/provider/StreamEventManager.d.ts.map +1 -1
- package/dist/provider/createStreamWorkerCode.d.ts +7 -0
- package/dist/provider/createStreamWorkerCode.d.ts.map +1 -0
- package/dist/utils/base64Decode.d.ts +5 -0
- package/dist/utils/base64Decode.d.ts.map +1 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createStream as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { motion as
|
|
5
|
-
import
|
|
6
|
-
import { Prism as
|
|
7
|
-
import
|
|
8
|
-
import './assets/index.css';const
|
|
1
|
+
import { jsxs as y, jsx as o, Fragment as E } from "react/jsx-runtime";
|
|
2
|
+
import { createStream as ue, isStreamTimeoutEvent as me, isStreamNotFoundEvent as pe, isAgentTaskProgressItemUpdatedEvent as ye, createAgentTask as ge } from "@fencyai/js";
|
|
3
|
+
import { createContext as he, useState as I, useRef as A, useEffect as F, useCallback as z, useContext as fe, useMemo as P } from "react";
|
|
4
|
+
import { motion as C, useInView as Se, AnimatePresence as xe } from "motion/react";
|
|
5
|
+
import ke from "react-markdown";
|
|
6
|
+
import { Prism as ae } from "react-syntax-highlighter";
|
|
7
|
+
import be from "remark-gfm";
|
|
8
|
+
import './assets/index.css';const se = he(
|
|
9
9
|
void 0
|
|
10
10
|
);
|
|
11
|
-
async function
|
|
11
|
+
async function ve(e, r) {
|
|
12
12
|
const t = e.getReader();
|
|
13
|
-
let
|
|
14
|
-
for (; !(
|
|
15
|
-
n
|
|
13
|
+
let n;
|
|
14
|
+
for (; !(n = await t.read()).done; )
|
|
15
|
+
r(n.value);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
let
|
|
19
|
-
return function(
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
let
|
|
23
|
-
for (; t <
|
|
24
|
-
|
|
25
|
-
let
|
|
26
|
-
for (; t <
|
|
27
|
-
switch (
|
|
17
|
+
function Te(e) {
|
|
18
|
+
let r, t, n, i = !1;
|
|
19
|
+
return function(a) {
|
|
20
|
+
r === void 0 ? (r = a, t = 0, n = -1) : r = Ce(r, a);
|
|
21
|
+
const s = r.length;
|
|
22
|
+
let m = 0;
|
|
23
|
+
for (; t < s; ) {
|
|
24
|
+
i && (r[t] === 10 && (m = ++t), i = !1);
|
|
25
|
+
let p = -1;
|
|
26
|
+
for (; t < s && p === -1; ++t)
|
|
27
|
+
switch (r[t]) {
|
|
28
28
|
case 58:
|
|
29
|
-
|
|
29
|
+
n === -1 && (n = t - m);
|
|
30
30
|
break;
|
|
31
31
|
case 13:
|
|
32
|
-
|
|
32
|
+
i = !0;
|
|
33
33
|
case 10:
|
|
34
|
-
|
|
34
|
+
p = t;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
|
-
if (
|
|
37
|
+
if (p === -1)
|
|
38
38
|
break;
|
|
39
|
-
e(
|
|
39
|
+
e(r.subarray(m, p), n), m = t, n = -1;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
m === s ? r = void 0 : m !== 0 && (r = r.subarray(m), t -= m);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
let
|
|
46
|
-
const
|
|
47
|
-
return function(
|
|
48
|
-
if (
|
|
49
|
-
t == null || t(
|
|
50
|
-
else if (
|
|
51
|
-
const
|
|
52
|
-
switch (
|
|
44
|
+
function we(e, r, t) {
|
|
45
|
+
let n = J();
|
|
46
|
+
const i = new TextDecoder();
|
|
47
|
+
return function(a, s) {
|
|
48
|
+
if (a.length === 0)
|
|
49
|
+
t == null || t(n), n = J();
|
|
50
|
+
else if (s > 0) {
|
|
51
|
+
const m = i.decode(a.subarray(0, s)), p = s + (a[s + 1] === 32 ? 2 : 1), c = i.decode(a.subarray(p));
|
|
52
|
+
switch (m) {
|
|
53
53
|
case "data":
|
|
54
|
-
|
|
55
|
-
` +
|
|
54
|
+
n.data = n.data ? n.data + `
|
|
55
|
+
` + c : c;
|
|
56
56
|
break;
|
|
57
57
|
case "event":
|
|
58
|
-
|
|
58
|
+
n.event = c;
|
|
59
59
|
break;
|
|
60
60
|
case "id":
|
|
61
|
-
e(
|
|
61
|
+
e(n.id = c);
|
|
62
62
|
break;
|
|
63
63
|
case "retry":
|
|
64
|
-
const
|
|
65
|
-
isNaN(
|
|
64
|
+
const d = parseInt(c, 10);
|
|
65
|
+
isNaN(d) || r(n.retry = d);
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const t = new Uint8Array(e.length +
|
|
73
|
-
return t.set(e), t.set(
|
|
71
|
+
function Ce(e, r) {
|
|
72
|
+
const t = new Uint8Array(e.length + r.length);
|
|
73
|
+
return t.set(e), t.set(r, e.length), t;
|
|
74
74
|
}
|
|
75
75
|
function J() {
|
|
76
76
|
return {
|
|
@@ -80,110 +80,339 @@ function J() {
|
|
|
80
80
|
retry: void 0
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
var
|
|
83
|
+
var Ie = function(e, r) {
|
|
84
84
|
var t = {};
|
|
85
|
-
for (var
|
|
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
|
|
88
|
-
|
|
87
|
+
for (var i = 0, n = Object.getOwnPropertySymbols(e); i < n.length; i++)
|
|
88
|
+
r.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[i]) && (t[n[i]] = e[n[i]]);
|
|
89
89
|
return t;
|
|
90
90
|
};
|
|
91
|
-
const
|
|
92
|
-
function
|
|
93
|
-
var { signal: t, headers:
|
|
94
|
-
return new Promise((
|
|
95
|
-
const g = Object.assign({},
|
|
96
|
-
g.accept || (g.accept =
|
|
91
|
+
const O = "text/event-stream", Ee = 1e3, Y = "last-event-id";
|
|
92
|
+
function Me(e, r) {
|
|
93
|
+
var { signal: t, headers: n, onopen: i, onmessage: l, onclose: a, onerror: s, openWhenHidden: m, fetch: p } = r, c = Ie(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
|
+
return new Promise((d, u) => {
|
|
95
|
+
const g = Object.assign({}, n);
|
|
96
|
+
g.accept || (g.accept = O);
|
|
97
97
|
let h;
|
|
98
98
|
function f() {
|
|
99
|
-
h.abort(), document.hidden ||
|
|
99
|
+
h.abort(), document.hidden || x();
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
let
|
|
103
|
-
function
|
|
104
|
-
document.removeEventListener("visibilitychange", f), window.clearTimeout(
|
|
101
|
+
m || document.addEventListener("visibilitychange", f);
|
|
102
|
+
let k = Ee, b = 0;
|
|
103
|
+
function v() {
|
|
104
|
+
document.removeEventListener("visibilitychange", f), window.clearTimeout(b), h.abort();
|
|
105
105
|
}
|
|
106
106
|
t == null || t.addEventListener("abort", () => {
|
|
107
|
-
|
|
107
|
+
v(), d();
|
|
108
108
|
});
|
|
109
|
-
const
|
|
110
|
-
async function
|
|
111
|
-
var
|
|
109
|
+
const T = p ?? window.fetch, w = i ?? Re;
|
|
110
|
+
async function x() {
|
|
111
|
+
var D;
|
|
112
112
|
h = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
}, (
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
} catch (
|
|
114
|
+
const W = await T(e, Object.assign(Object.assign({}, c), { headers: g, signal: h.signal }));
|
|
115
|
+
await w(W), await ve(W.body, Te(we((R) => {
|
|
116
|
+
R ? g[Y] = R : delete g[Y];
|
|
117
|
+
}, (R) => {
|
|
118
|
+
k = R;
|
|
119
|
+
}, l))), a == null || a(), v(), d();
|
|
120
|
+
} catch (W) {
|
|
121
121
|
if (!h.signal.aborted)
|
|
122
122
|
try {
|
|
123
|
-
const
|
|
124
|
-
window.clearTimeout(
|
|
125
|
-
} catch (
|
|
126
|
-
|
|
123
|
+
const R = (D = s == null ? void 0 : s(W)) !== null && D !== void 0 ? D : k;
|
|
124
|
+
window.clearTimeout(b), b = window.setTimeout(x, R);
|
|
125
|
+
} catch (R) {
|
|
126
|
+
v(), u(R);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
x();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
const
|
|
135
|
-
if (!(
|
|
136
|
-
throw new Error(`Expected content-type to be ${
|
|
133
|
+
function Re(e) {
|
|
134
|
+
const r = e.headers.get("content-type");
|
|
135
|
+
if (!(r != null && r.startsWith(O)))
|
|
136
|
+
throw new Error(`Expected content-type to be ${O}, Actual: ${r}`);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const
|
|
140
|
-
for (let
|
|
141
|
-
t[
|
|
138
|
+
function Z(e) {
|
|
139
|
+
const r = atob(e), t = new Uint8Array(r.length);
|
|
140
|
+
for (let n = 0; n < r.length; n++)
|
|
141
|
+
t[n] = r.charCodeAt(n);
|
|
142
142
|
return new TextDecoder("utf-8").decode(t);
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function Fe() {
|
|
145
|
+
return `
|
|
146
|
+
var connections = new Map();
|
|
147
|
+
|
|
148
|
+
function disconnectStream(streamId) {
|
|
149
|
+
var entry = connections.get(streamId);
|
|
150
|
+
if (entry) {
|
|
151
|
+
try {
|
|
152
|
+
entry.cancel();
|
|
153
|
+
} catch (e) {}
|
|
154
|
+
connections.delete(streamId);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function findEventBoundary(buf) {
|
|
159
|
+
var iCRLF = buf.indexOf("\\r\\n\\r\\n");
|
|
160
|
+
var iLF = buf.indexOf("\\n\\n");
|
|
161
|
+
if (iCRLF !== -1 && (iLF === -1 || iCRLF < iLF)) {
|
|
162
|
+
return { index: iCRLF, len: 4 };
|
|
163
|
+
}
|
|
164
|
+
if (iLF !== -1) {
|
|
165
|
+
return { index: iLF, len: 2 };
|
|
166
|
+
}
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function parseSseBuffer(buffer) {
|
|
171
|
+
var events = [];
|
|
172
|
+
var rest = buffer;
|
|
173
|
+
while (true) {
|
|
174
|
+
var boundary = findEventBoundary(rest);
|
|
175
|
+
if (!boundary) break;
|
|
176
|
+
var rawEvent = rest.slice(0, boundary.index);
|
|
177
|
+
rest = rest.slice(boundary.index + boundary.len);
|
|
178
|
+
if (!rawEvent.trim()) continue;
|
|
179
|
+
|
|
180
|
+
var eventType = "";
|
|
181
|
+
var eventId = "";
|
|
182
|
+
var dataLines = [];
|
|
183
|
+
var lines = rawEvent.split(/\\r\\n|\\r|\\n/);
|
|
184
|
+
for (var i = 0; i < lines.length; i++) {
|
|
185
|
+
var line = lines[i];
|
|
186
|
+
if (line.charAt(0) === ":") continue;
|
|
187
|
+
var colon = line.indexOf(":");
|
|
188
|
+
if (colon === -1) continue;
|
|
189
|
+
var field = line.slice(0, colon);
|
|
190
|
+
var value = line.slice(colon + 1);
|
|
191
|
+
if (value.charAt(0) === " ") value = value.slice(1);
|
|
192
|
+
if (field === "data") dataLines.push(value);
|
|
193
|
+
else if (field === "event") eventType = value;
|
|
194
|
+
else if (field === "id") eventId = value;
|
|
195
|
+
}
|
|
196
|
+
var data = dataLines.join("\\n");
|
|
197
|
+
if (data.length > 0) {
|
|
198
|
+
events.push({ data: data, event: eventType, id: eventId });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return { events: events, rest: rest };
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function readStream(streamId, readableStream) {
|
|
205
|
+
disconnectStream(streamId);
|
|
206
|
+
if (!readableStream || typeof readableStream.getReader !== "function") {
|
|
207
|
+
self.postMessage({
|
|
208
|
+
type: "error",
|
|
209
|
+
streamId: streamId,
|
|
210
|
+
error: "No readable stream",
|
|
211
|
+
});
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
var reader = readableStream.getReader();
|
|
215
|
+
connections.set(streamId, {
|
|
216
|
+
cancel: function () {
|
|
217
|
+
reader.cancel().catch(function () {});
|
|
218
|
+
},
|
|
219
|
+
});
|
|
220
|
+
try {
|
|
221
|
+
var decoder = new TextDecoder();
|
|
222
|
+
var buf = "";
|
|
223
|
+
while (true) {
|
|
224
|
+
var readResult = await reader.read();
|
|
225
|
+
var done = readResult.done;
|
|
226
|
+
var value = readResult.value;
|
|
227
|
+
if (done) break;
|
|
228
|
+
buf += decoder.decode(value, { stream: true });
|
|
229
|
+
var parsed = parseSseBuffer(buf);
|
|
230
|
+
buf = parsed.rest;
|
|
231
|
+
for (var j = 0; j < parsed.events.length; j++) {
|
|
232
|
+
var ev = parsed.events[j];
|
|
233
|
+
self.postMessage({
|
|
234
|
+
type: "message",
|
|
235
|
+
streamId: streamId,
|
|
236
|
+
data: ev.data,
|
|
237
|
+
event: ev.event || undefined,
|
|
238
|
+
id: ev.id || undefined,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
buf += decoder.decode();
|
|
243
|
+
var finalParsed = parseSseBuffer(buf);
|
|
244
|
+
for (var k = 0; k < finalParsed.events.length; k++) {
|
|
245
|
+
var fev = finalParsed.events[k];
|
|
246
|
+
self.postMessage({
|
|
247
|
+
type: "message",
|
|
248
|
+
streamId: streamId,
|
|
249
|
+
data: fev.data,
|
|
250
|
+
event: fev.event || undefined,
|
|
251
|
+
id: fev.id || undefined,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
} catch (err) {
|
|
255
|
+
if (err && err.name === "AbortError") {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
var msg = err && err.message ? String(err.message) : String(err);
|
|
259
|
+
self.postMessage({ type: "error", streamId: streamId, error: msg });
|
|
260
|
+
} finally {
|
|
261
|
+
connections.delete(streamId);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
self.onmessage = function (e) {
|
|
266
|
+
var d = e.data;
|
|
267
|
+
if (!d || !d.command) return;
|
|
268
|
+
switch (d.command) {
|
|
269
|
+
case "start":
|
|
270
|
+
readStream(d.streamId, d.readableStream);
|
|
271
|
+
break;
|
|
272
|
+
case "disconnect":
|
|
273
|
+
disconnectStream(d.streamId);
|
|
274
|
+
break;
|
|
275
|
+
case "cleanup":
|
|
276
|
+
connections.forEach(function (entry) {
|
|
277
|
+
try {
|
|
278
|
+
entry.cancel();
|
|
279
|
+
} catch (e2) {}
|
|
280
|
+
});
|
|
281
|
+
connections.clear();
|
|
282
|
+
self.close();
|
|
283
|
+
break;
|
|
284
|
+
default:
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
`.trim();
|
|
289
|
+
}
|
|
290
|
+
function ee(e) {
|
|
145
291
|
return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
|
|
146
292
|
}
|
|
147
|
-
class
|
|
148
|
-
constructor(
|
|
149
|
-
this.
|
|
293
|
+
class Ae {
|
|
294
|
+
constructor(r) {
|
|
295
|
+
this.activeConnections = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.worker = null, this.workerBlobUrl = null, this.workerSupported = !1, this.fency = r, this.tryInitWorker();
|
|
296
|
+
}
|
|
297
|
+
tryInitWorker() {
|
|
298
|
+
try {
|
|
299
|
+
if (typeof Worker > "u" || typeof Blob > "u" || typeof URL > "u" || typeof URL.createObjectURL != "function" || typeof ReadableStream > "u")
|
|
300
|
+
return;
|
|
301
|
+
const r = Fe(), t = new Blob([r], { type: "application/javascript" }), n = URL.createObjectURL(t), i = new Worker(n);
|
|
302
|
+
i.onmessage = (l) => {
|
|
303
|
+
this.handleWorkerMessage(l.data);
|
|
304
|
+
}, i.onerror = (l) => {
|
|
305
|
+
console.error("Fency stream worker error:", l.message);
|
|
306
|
+
}, this.worker = i, this.workerBlobUrl = n, this.workerSupported = !0;
|
|
307
|
+
} catch {
|
|
308
|
+
this.workerSupported = !1, this.worker = null, this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
handleWorkerMessage(r) {
|
|
312
|
+
if (!r || typeof r != "object") return;
|
|
313
|
+
const t = r;
|
|
314
|
+
switch (t.type) {
|
|
315
|
+
case "message":
|
|
316
|
+
if (t.data && t.streamId) {
|
|
317
|
+
const n = Z(t.data);
|
|
318
|
+
this.broadcast(n, t.streamId);
|
|
319
|
+
}
|
|
320
|
+
break;
|
|
321
|
+
case "error":
|
|
322
|
+
t.streamId && (this.activeConnections.delete(t.streamId), this.broadcastError(t.streamId, t.error));
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
150
325
|
}
|
|
151
326
|
/**
|
|
152
327
|
* Called by FencyProvider when activeStreams changes.
|
|
153
328
|
* Creates new connections and removes old ones.
|
|
154
329
|
*/
|
|
155
|
-
updateStreams(
|
|
156
|
-
|
|
157
|
-
const
|
|
158
|
-
this.
|
|
330
|
+
updateStreams(r) {
|
|
331
|
+
r.forEach((n) => {
|
|
332
|
+
const i = n.stream.id;
|
|
333
|
+
this.activeConnections.has(i) || this.connectStream(n);
|
|
159
334
|
});
|
|
160
|
-
const t = new Set(
|
|
161
|
-
this.
|
|
162
|
-
t.has(
|
|
335
|
+
const t = new Set(r.map((n) => n.stream.id));
|
|
336
|
+
this.activeConnections.forEach((n, i) => {
|
|
337
|
+
t.has(i) || (n.abort(), this.activeConnections.delete(i));
|
|
163
338
|
});
|
|
164
339
|
}
|
|
165
|
-
connectStream(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
340
|
+
connectStream(r) {
|
|
341
|
+
this.workerSupported && this.worker ? this.connectStreamInWorker(r) : this.connectStreamOnMainThread(r);
|
|
342
|
+
}
|
|
343
|
+
connectStreamInWorker(r) {
|
|
344
|
+
const t = r.stream.id, n = `${this.fency.baseUrl}/sse/streams/${t}`, i = new AbortController(), l = {
|
|
345
|
+
accept: O,
|
|
169
346
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
170
|
-
"X-Fency-Stream-Token":
|
|
347
|
+
"X-Fency-Stream-Token": r.stream.token
|
|
348
|
+
};
|
|
349
|
+
this.activeConnections.set(t, {
|
|
350
|
+
abort: () => {
|
|
351
|
+
var a;
|
|
352
|
+
i.abort(), (a = this.worker) == null || a.postMessage({ command: "disconnect", streamId: t });
|
|
353
|
+
}
|
|
354
|
+
}), this.startWorkerStream(t, n, l, i);
|
|
355
|
+
}
|
|
356
|
+
async startWorkerStream(r, t, n, i) {
|
|
357
|
+
const l = this.worker;
|
|
358
|
+
if (!l) return;
|
|
359
|
+
const a = (s) => {
|
|
360
|
+
i.signal.aborted || (this.activeConnections.delete(r), this.broadcastError(r, s));
|
|
171
361
|
};
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
362
|
+
try {
|
|
363
|
+
const s = await fetch(t, {
|
|
364
|
+
method: "GET",
|
|
365
|
+
headers: n,
|
|
366
|
+
signal: i.signal
|
|
367
|
+
});
|
|
368
|
+
if (!s.ok) {
|
|
369
|
+
s.status >= 400 && s.status < 500 && s.status !== 429 ? a(`Client error ${s.status}`) : a(`HTTP ${s.status}`);
|
|
370
|
+
return;
|
|
371
|
+
}
|
|
372
|
+
const m = s.body;
|
|
373
|
+
if (!m) {
|
|
374
|
+
a("No response body");
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (!this.activeConnections.has(r)) {
|
|
378
|
+
await m.cancel().catch(() => {
|
|
379
|
+
});
|
|
380
|
+
return;
|
|
381
|
+
}
|
|
382
|
+
l.postMessage(
|
|
383
|
+
{ command: "start", streamId: r, readableStream: m },
|
|
384
|
+
[m]
|
|
385
|
+
);
|
|
386
|
+
} catch (s) {
|
|
387
|
+
if (i.signal.aborted) return;
|
|
388
|
+
a(ee(s));
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
connectStreamOnMainThread(r) {
|
|
392
|
+
const t = r.stream.id, n = new AbortController();
|
|
393
|
+
this.activeConnections.set(t, {
|
|
394
|
+
abort: () => n.abort()
|
|
395
|
+
});
|
|
396
|
+
const i = `${this.fency.baseUrl}/sse/streams/${t}`, l = {
|
|
397
|
+
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
398
|
+
"X-Fency-Stream-Token": r.stream.token
|
|
399
|
+
};
|
|
400
|
+
Me(i, {
|
|
401
|
+
headers: l,
|
|
402
|
+
signal: n.signal,
|
|
403
|
+
openWhenHidden: !0,
|
|
404
|
+
onopen: async (a) => {
|
|
405
|
+
if (!a.ok && a.status >= 400 && a.status < 500 && a.status !== 429)
|
|
406
|
+
throw this.activeConnections.delete(t), new Error(`Client error ${a.status}`);
|
|
178
407
|
},
|
|
179
|
-
onmessage: (
|
|
180
|
-
if (
|
|
181
|
-
const
|
|
182
|
-
this.broadcast(
|
|
408
|
+
onmessage: (a) => {
|
|
409
|
+
if (a.data) {
|
|
410
|
+
const s = Z(a.data);
|
|
411
|
+
this.broadcast(s, t);
|
|
183
412
|
}
|
|
184
413
|
},
|
|
185
|
-
onerror: (
|
|
186
|
-
throw console.error("EventSource error for stream", t, ":",
|
|
414
|
+
onerror: (a) => {
|
|
415
|
+
throw console.error("EventSource error for stream", t, ":", a), this.activeConnections.delete(t), this.broadcastError(t, ee(a)), a;
|
|
187
416
|
},
|
|
188
417
|
onclose() {
|
|
189
418
|
}
|
|
@@ -193,129 +422,136 @@ class Me {
|
|
|
193
422
|
* Subscribe to events from all active streams.
|
|
194
423
|
* Returns an unsubscribe function.
|
|
195
424
|
*/
|
|
196
|
-
subscribe(
|
|
197
|
-
return this.subscribers.set(
|
|
198
|
-
this.subscribers.delete(
|
|
425
|
+
subscribe(r, t) {
|
|
426
|
+
return this.subscribers.set(r, t), () => {
|
|
427
|
+
this.subscribers.delete(r);
|
|
199
428
|
};
|
|
200
429
|
}
|
|
201
|
-
broadcast(
|
|
202
|
-
this.subscribers.forEach((
|
|
203
|
-
|
|
430
|
+
broadcast(r, t) {
|
|
431
|
+
this.subscribers.forEach((n) => {
|
|
432
|
+
n.onMessage(r, t);
|
|
204
433
|
});
|
|
205
434
|
}
|
|
206
|
-
broadcastError(
|
|
207
|
-
this.subscribers.forEach((
|
|
208
|
-
|
|
435
|
+
broadcastError(r, t) {
|
|
436
|
+
this.subscribers.forEach((n) => {
|
|
437
|
+
n.onError(r, t);
|
|
209
438
|
});
|
|
210
439
|
}
|
|
211
440
|
/**
|
|
212
441
|
* Cleanup all connections and subscriptions
|
|
213
442
|
*/
|
|
214
443
|
cleanup() {
|
|
215
|
-
this.
|
|
444
|
+
if (this.activeConnections.forEach((r) => r.abort()), this.activeConnections.clear(), this.worker) {
|
|
445
|
+
try {
|
|
446
|
+
this.worker.postMessage({ command: "cleanup" });
|
|
447
|
+
} catch {
|
|
448
|
+
}
|
|
449
|
+
this.worker = null;
|
|
450
|
+
}
|
|
451
|
+
this.workerBlobUrl && (URL.revokeObjectURL(this.workerBlobUrl), this.workerBlobUrl = null), this.workerSupported = !1, this.subscribers.clear();
|
|
216
452
|
}
|
|
217
453
|
}
|
|
218
|
-
const
|
|
219
|
-
const
|
|
220
|
-
return e.filter((t) =>
|
|
454
|
+
const Le = 48e4, Pe = 3e5, re = (e) => {
|
|
455
|
+
const r = Date.now();
|
|
456
|
+
return e.filter((t) => r - t.createdAt < Le);
|
|
221
457
|
};
|
|
222
|
-
function
|
|
223
|
-
const [
|
|
458
|
+
function Ur({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
|
|
459
|
+
const [n, i] = I(
|
|
224
460
|
null
|
|
225
|
-
), [
|
|
226
|
-
|
|
227
|
-
e.then((
|
|
228
|
-
|
|
229
|
-
}).catch((
|
|
230
|
-
|
|
461
|
+
), [l, a] = I(!0), [s, m] = I(null), [p, c] = I([]), d = A(null), u = A(null);
|
|
462
|
+
F(() => {
|
|
463
|
+
e.then((k) => {
|
|
464
|
+
i(k), a(!1);
|
|
465
|
+
}).catch((k) => {
|
|
466
|
+
m(k), a(!1);
|
|
231
467
|
});
|
|
232
|
-
}, [e]),
|
|
233
|
-
|
|
234
|
-
}, [
|
|
235
|
-
|
|
236
|
-
}, [
|
|
237
|
-
var
|
|
238
|
-
(
|
|
239
|
-
}, []),
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
return
|
|
468
|
+
}, [e]), F(() => {
|
|
469
|
+
n && !u.current && (u.current = new Ae(n));
|
|
470
|
+
}, [n]), F(() => {
|
|
471
|
+
u.current && u.current.updateStreams(p);
|
|
472
|
+
}, [p]), F(() => () => {
|
|
473
|
+
var k;
|
|
474
|
+
(k = u.current) == null || k.cleanup();
|
|
475
|
+
}, []), F(() => {
|
|
476
|
+
const k = setInterval(() => {
|
|
477
|
+
c((b) => {
|
|
478
|
+
const v = re(b);
|
|
479
|
+
return v.length !== b.length ? v : b;
|
|
244
480
|
});
|
|
245
481
|
}, 6e4);
|
|
246
|
-
return () => clearInterval(
|
|
482
|
+
return () => clearInterval(k);
|
|
247
483
|
}, []);
|
|
248
|
-
const g =
|
|
249
|
-
async (
|
|
250
|
-
if (
|
|
251
|
-
return
|
|
252
|
-
const
|
|
253
|
-
if (
|
|
254
|
-
return
|
|
255
|
-
const
|
|
256
|
-
if (!
|
|
484
|
+
const g = z(
|
|
485
|
+
async (k = Pe) => {
|
|
486
|
+
if (d.current)
|
|
487
|
+
return d.current;
|
|
488
|
+
const b = Date.now(), v = p.length > 0 ? p[p.length - 1] : null;
|
|
489
|
+
if (v && b - v.createdAt < k)
|
|
490
|
+
return v.stream;
|
|
491
|
+
const T = (async () => {
|
|
492
|
+
if (!n)
|
|
257
493
|
throw new Error("Fency instance not initialized");
|
|
258
|
-
const
|
|
259
|
-
pk:
|
|
260
|
-
baseUrl:
|
|
261
|
-
clientToken: (
|
|
494
|
+
const w = await r(), x = await ue({
|
|
495
|
+
pk: n.publishableKey,
|
|
496
|
+
baseUrl: n.baseUrl,
|
|
497
|
+
clientToken: (w == null ? void 0 : w.clientToken) ?? ""
|
|
262
498
|
});
|
|
263
|
-
if (
|
|
264
|
-
const
|
|
265
|
-
stream:
|
|
499
|
+
if (x.type === "success") {
|
|
500
|
+
const D = {
|
|
501
|
+
stream: x.stream,
|
|
266
502
|
createdAt: Date.now()
|
|
267
503
|
};
|
|
268
|
-
return
|
|
269
|
-
const
|
|
270
|
-
return
|
|
271
|
-
}),
|
|
504
|
+
return c((W) => {
|
|
505
|
+
const R = [...W, D];
|
|
506
|
+
return re(R);
|
|
507
|
+
}), d.current = null, x.stream;
|
|
272
508
|
} else
|
|
273
|
-
throw
|
|
509
|
+
throw d.current = null, new Error("Failed to create stream");
|
|
274
510
|
})();
|
|
275
|
-
return
|
|
511
|
+
return d.current = T, T;
|
|
276
512
|
},
|
|
277
|
-
[
|
|
513
|
+
[n, p]
|
|
278
514
|
);
|
|
279
|
-
if (
|
|
280
|
-
return /* @__PURE__ */
|
|
515
|
+
if (s)
|
|
516
|
+
return /* @__PURE__ */ y("div", { children: [
|
|
281
517
|
"Fency error: ",
|
|
282
|
-
|
|
518
|
+
s.message
|
|
283
519
|
] });
|
|
284
|
-
if (!
|
|
520
|
+
if (!n)
|
|
285
521
|
return null;
|
|
286
|
-
const h =
|
|
287
|
-
fency:
|
|
288
|
-
loading:
|
|
289
|
-
error:
|
|
290
|
-
activeStreams:
|
|
522
|
+
const h = p.length > 0 ? p[p.length - 1] : null, f = {
|
|
523
|
+
fency: n,
|
|
524
|
+
loading: l,
|
|
525
|
+
error: s,
|
|
526
|
+
activeStreams: p,
|
|
291
527
|
latestStream: h,
|
|
292
|
-
eventManager:
|
|
528
|
+
eventManager: u.current,
|
|
293
529
|
getOrCreateStream: g
|
|
294
530
|
};
|
|
295
|
-
return /* @__PURE__ */ o(
|
|
531
|
+
return /* @__PURE__ */ o(se.Provider, { value: f, children: t });
|
|
296
532
|
}
|
|
297
|
-
function
|
|
298
|
-
const e =
|
|
533
|
+
function le() {
|
|
534
|
+
const e = fe(se);
|
|
299
535
|
if (e === void 0)
|
|
300
536
|
throw new Error("useFencyContext must be used within a FencyProvider");
|
|
301
537
|
return e;
|
|
302
538
|
}
|
|
303
|
-
const
|
|
539
|
+
const De = (e) => {
|
|
304
540
|
try {
|
|
305
|
-
const
|
|
306
|
-
return
|
|
307
|
-
} catch (
|
|
308
|
-
return console.error("Error parsing message:",
|
|
541
|
+
const r = JSON.parse(e);
|
|
542
|
+
return We(r);
|
|
543
|
+
} catch (r) {
|
|
544
|
+
return console.error("Error parsing message:", r), null;
|
|
309
545
|
}
|
|
310
|
-
},
|
|
546
|
+
}, We = (e) => me(e) ? ze(e) : pe(e) ? Be(e) : ye(e) ? Oe(e) : null, ze = (e) => ({
|
|
311
547
|
type: "STREAM_TIMEOUT",
|
|
312
548
|
streamId: e.streamId,
|
|
313
549
|
timestamp: e.timestamp
|
|
314
|
-
}),
|
|
550
|
+
}), Be = (e) => ({
|
|
315
551
|
type: "STREAM_NOT_FOUND",
|
|
316
552
|
streamId: e.streamId,
|
|
317
553
|
timestamp: e.timestamp
|
|
318
|
-
}),
|
|
554
|
+
}), Oe = (e) => ({
|
|
319
555
|
type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
|
|
320
556
|
streamId: e.streamId,
|
|
321
557
|
agentTaskId: e.agentTaskId,
|
|
@@ -323,349 +559,349 @@ const Fe = (e) => {
|
|
|
323
559
|
timestamp: e.timestamp,
|
|
324
560
|
createdAt: e.createdAt,
|
|
325
561
|
data: JSON.parse(e.data)
|
|
326
|
-
}),
|
|
327
|
-
const
|
|
328
|
-
return
|
|
329
|
-
if (!
|
|
330
|
-
const
|
|
331
|
-
onMessage: (
|
|
332
|
-
var
|
|
333
|
-
const
|
|
334
|
-
if (
|
|
335
|
-
switch (
|
|
562
|
+
}), $e = (e) => {
|
|
563
|
+
const r = le(), [t, n] = I(null), i = A(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
564
|
+
return F(() => {
|
|
565
|
+
if (!r.eventManager) return;
|
|
566
|
+
const a = {
|
|
567
|
+
onMessage: (m, p) => {
|
|
568
|
+
var d, u, g;
|
|
569
|
+
const c = De(m);
|
|
570
|
+
if (c)
|
|
571
|
+
switch (c.type) {
|
|
336
572
|
case "STREAM_TIMEOUT":
|
|
337
|
-
(
|
|
573
|
+
(d = e == null ? void 0 : e.onStreamTimeout) == null || d.call(e, c);
|
|
338
574
|
break;
|
|
339
575
|
case "STREAM_NOT_FOUND":
|
|
340
|
-
(
|
|
576
|
+
(u = e == null ? void 0 : e.onStreamNotFound) == null || u.call(e, c);
|
|
341
577
|
break;
|
|
342
578
|
case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
|
|
343
|
-
(g = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || g.call(e,
|
|
579
|
+
(g = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || g.call(e, c);
|
|
344
580
|
break;
|
|
345
581
|
}
|
|
346
582
|
},
|
|
347
|
-
onError: (
|
|
348
|
-
var
|
|
349
|
-
(
|
|
350
|
-
streamId:
|
|
583
|
+
onError: (m, p) => {
|
|
584
|
+
var c;
|
|
585
|
+
(c = e == null ? void 0 : e.onStreamError) == null || c.call(e, {
|
|
586
|
+
streamId: m,
|
|
351
587
|
error: {
|
|
352
588
|
code: "UnknownError",
|
|
353
|
-
message:
|
|
589
|
+
message: p ?? "Unknown error in useStream"
|
|
354
590
|
}
|
|
355
591
|
});
|
|
356
592
|
}
|
|
357
593
|
};
|
|
358
|
-
return
|
|
359
|
-
|
|
360
|
-
|
|
594
|
+
return r.eventManager.subscribe(
|
|
595
|
+
i.current,
|
|
596
|
+
a
|
|
361
597
|
);
|
|
362
|
-
}, [
|
|
598
|
+
}, [r.eventManager, e]), {
|
|
363
599
|
createStream: async () => {
|
|
364
600
|
try {
|
|
365
|
-
const
|
|
366
|
-
return
|
|
601
|
+
const a = await r.getOrCreateStream();
|
|
602
|
+
return n(a), {
|
|
367
603
|
type: "success",
|
|
368
|
-
stream:
|
|
604
|
+
stream: a
|
|
369
605
|
};
|
|
370
|
-
} catch (
|
|
606
|
+
} catch (a) {
|
|
371
607
|
return {
|
|
372
608
|
type: "error",
|
|
373
609
|
error: {
|
|
374
610
|
code: "UnknownError",
|
|
375
|
-
message:
|
|
611
|
+
message: a instanceof Error ? a.message : "Failed to create stream"
|
|
376
612
|
}
|
|
377
613
|
};
|
|
378
614
|
}
|
|
379
615
|
},
|
|
380
616
|
stream: t
|
|
381
617
|
};
|
|
382
|
-
},
|
|
383
|
-
const
|
|
384
|
-
(
|
|
385
|
-
|
|
386
|
-
const g = [], h =
|
|
387
|
-
var
|
|
388
|
-
if (f.streamId !==
|
|
389
|
-
const
|
|
390
|
-
return
|
|
618
|
+
}, _r = (e) => {
|
|
619
|
+
const r = le(), [t, n] = I([]), i = A(/* @__PURE__ */ new Set()), l = A(/* @__PURE__ */ new Map()), a = z(
|
|
620
|
+
(c, d) => {
|
|
621
|
+
n((u) => {
|
|
622
|
+
const g = [], h = u.map((f) => {
|
|
623
|
+
var b;
|
|
624
|
+
if (f.streamId !== c || !f.loading) return f;
|
|
625
|
+
const k = (b = f.confirmedData) == null ? void 0 : b.taskId;
|
|
626
|
+
return k && g.push(k), { ...f, loading: !1, error: d };
|
|
391
627
|
});
|
|
392
628
|
for (const f of g) {
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
|
|
629
|
+
i.current.delete(f);
|
|
630
|
+
const k = l.current.get(f);
|
|
631
|
+
k && (l.current.delete(f), k({ type: "error", error: d }));
|
|
396
632
|
}
|
|
397
633
|
return h;
|
|
398
634
|
});
|
|
399
635
|
},
|
|
400
636
|
[]
|
|
401
|
-
), { createStream:
|
|
402
|
-
onAgentTaskProgressItemUpdated: (
|
|
637
|
+
), { createStream: s } = $e({
|
|
638
|
+
onAgentTaskProgressItemUpdated: (c) => {
|
|
403
639
|
var g;
|
|
404
|
-
if (!
|
|
405
|
-
const
|
|
406
|
-
if (
|
|
407
|
-
const h =
|
|
408
|
-
|
|
409
|
-
h ? (
|
|
410
|
-
var
|
|
411
|
-
if (((
|
|
412
|
-
return
|
|
413
|
-
const
|
|
414
|
-
(
|
|
415
|
-
) ?
|
|
416
|
-
(
|
|
417
|
-
) : [...
|
|
640
|
+
if (!i.current.has(c.agentTaskId)) return;
|
|
641
|
+
const d = c.data;
|
|
642
|
+
if (d.taskType === "StreamingChatCompletion" && d.eventType === "Completed" || d.taskType === "StructuredChatCompletion" && d.eventType === "Completed" || d.taskType === "MemoryChat" && d.eventType === "Completed" || d.taskType === "MemorySearch" && d.eventType === "Completed") {
|
|
643
|
+
const h = d.taskType === "MemorySearch" && d.eventType === "Completed" || d.taskType === "StructuredChatCompletion" && d.eventType === "Completed";
|
|
644
|
+
n(
|
|
645
|
+
h ? (k) => k.map((b) => {
|
|
646
|
+
var w;
|
|
647
|
+
if (((w = b.confirmedData) == null ? void 0 : w.taskId) !== c.agentTaskId)
|
|
648
|
+
return b;
|
|
649
|
+
const T = b.progressItems.some(
|
|
650
|
+
(x) => x.progressItemId === c.progressItemId
|
|
651
|
+
) ? b.progressItems.map(
|
|
652
|
+
(x) => x.progressItemId === c.progressItemId ? c : x
|
|
653
|
+
) : [...b.progressItems, c];
|
|
418
654
|
return {
|
|
419
|
-
...
|
|
420
|
-
progressItems:
|
|
655
|
+
...b,
|
|
656
|
+
progressItems: T,
|
|
421
657
|
loading: !1
|
|
422
658
|
};
|
|
423
|
-
}) : (
|
|
424
|
-
(
|
|
425
|
-
var
|
|
426
|
-
return ((
|
|
659
|
+
}) : (k) => k.map(
|
|
660
|
+
(b) => {
|
|
661
|
+
var v;
|
|
662
|
+
return ((v = b.confirmedData) == null ? void 0 : v.taskId) === c.agentTaskId ? { ...b, loading: !1 } : b;
|
|
427
663
|
}
|
|
428
664
|
)
|
|
429
665
|
);
|
|
430
|
-
const f =
|
|
431
|
-
|
|
666
|
+
const f = l.current.get(
|
|
667
|
+
c.agentTaskId
|
|
432
668
|
);
|
|
433
|
-
f && (
|
|
669
|
+
f && (l.current.delete(c.agentTaskId), f({
|
|
434
670
|
type: "success",
|
|
435
|
-
streamId:
|
|
436
|
-
agentTaskId:
|
|
437
|
-
response:
|
|
671
|
+
streamId: c.streamId,
|
|
672
|
+
agentTaskId: c.agentTaskId,
|
|
673
|
+
response: d
|
|
438
674
|
}));
|
|
439
675
|
return;
|
|
440
676
|
}
|
|
441
|
-
(g = e.onAgentTaskProgressItemUpdated) == null || g.call(e,
|
|
677
|
+
(g = e.onAgentTaskProgressItemUpdated) == null || g.call(e, c), n(
|
|
442
678
|
(h) => h.map((f) => {
|
|
443
|
-
var
|
|
444
|
-
if (((
|
|
679
|
+
var v;
|
|
680
|
+
if (((v = f.confirmedData) == null ? void 0 : v.taskId) !== c.agentTaskId)
|
|
445
681
|
return f;
|
|
446
|
-
const
|
|
447
|
-
(
|
|
682
|
+
const b = f.progressItems.some(
|
|
683
|
+
(T) => T.progressItemId === c.progressItemId
|
|
448
684
|
) ? f.progressItems.map(
|
|
449
|
-
(
|
|
450
|
-
) : [...f.progressItems,
|
|
451
|
-
return { ...f, progressItems:
|
|
685
|
+
(T) => T.progressItemId === c.progressItemId ? c : T
|
|
686
|
+
) : [...f.progressItems, c];
|
|
687
|
+
return { ...f, progressItems: b };
|
|
452
688
|
})
|
|
453
689
|
);
|
|
454
690
|
},
|
|
455
|
-
onStreamError: (
|
|
456
|
-
var
|
|
457
|
-
(
|
|
691
|
+
onStreamError: (c) => {
|
|
692
|
+
var d;
|
|
693
|
+
(d = e == null ? void 0 : e.onStreamError) == null || d.call(e, c), a(c.streamId, c.error);
|
|
458
694
|
},
|
|
459
|
-
onStreamNotFound: (
|
|
460
|
-
var
|
|
461
|
-
(
|
|
695
|
+
onStreamNotFound: (c) => {
|
|
696
|
+
var d;
|
|
697
|
+
(d = e == null ? void 0 : e.onStreamNotFound) == null || d.call(e, c), a(c.streamId, {
|
|
462
698
|
code: "StreamNotFound",
|
|
463
699
|
message: "Stream not found"
|
|
464
700
|
});
|
|
465
701
|
},
|
|
466
|
-
onStreamTimeout: (
|
|
467
|
-
var
|
|
468
|
-
(
|
|
702
|
+
onStreamTimeout: (c) => {
|
|
703
|
+
var d;
|
|
704
|
+
(d = e == null ? void 0 : e.onStreamTimeout) == null || d.call(e, c), a(c.streamId, {
|
|
469
705
|
code: "StreamTimeout",
|
|
470
706
|
message: "Stream timed out"
|
|
471
707
|
});
|
|
472
708
|
}
|
|
473
|
-
}),
|
|
474
|
-
async (
|
|
709
|
+
}), m = z(
|
|
710
|
+
async (c, d) => {
|
|
475
711
|
var f;
|
|
476
|
-
const
|
|
712
|
+
const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, g = (d == null ? void 0 : d.fetchCreateAgentTaskClientToken) ?? e.fetchCreateAgentTaskClientToken;
|
|
477
713
|
if (g === void 0)
|
|
478
714
|
throw new Error(
|
|
479
715
|
"fetchCreateAgentTaskClientToken must be provided either in useAgentTasks props or in createAgentTask options"
|
|
480
716
|
);
|
|
481
|
-
const h = await
|
|
717
|
+
const h = await s();
|
|
482
718
|
if (h.type === "success") {
|
|
483
|
-
const
|
|
484
|
-
taskKey:
|
|
719
|
+
const k = (/* @__PURE__ */ new Date()).toISOString(), b = {
|
|
720
|
+
taskKey: u,
|
|
485
721
|
streamId: h.stream.id,
|
|
486
|
-
triggeredAt:
|
|
722
|
+
triggeredAt: k,
|
|
487
723
|
confirmedData: null,
|
|
488
724
|
error: null,
|
|
489
|
-
params:
|
|
725
|
+
params: c,
|
|
490
726
|
progressItems: [],
|
|
491
727
|
loading: !0,
|
|
492
|
-
loadingText:
|
|
728
|
+
loadingText: d == null ? void 0 : d.loadingText
|
|
493
729
|
};
|
|
494
|
-
|
|
730
|
+
n((v) => [...v, b]), (f = d == null ? void 0 : d.onTaskRegistered) == null || f.call(d, b);
|
|
495
731
|
try {
|
|
496
|
-
const { clientToken:
|
|
497
|
-
pk:
|
|
498
|
-
baseUrl:
|
|
499
|
-
clientToken:
|
|
732
|
+
const { clientToken: v } = await g(), T = await ge({
|
|
733
|
+
pk: r.fency.publishableKey,
|
|
734
|
+
baseUrl: r.fency.baseUrl,
|
|
735
|
+
clientToken: v,
|
|
500
736
|
streamToken: h.stream.token,
|
|
501
737
|
request: {
|
|
502
|
-
streamingChatCompletionTask:
|
|
503
|
-
messages:
|
|
504
|
-
model:
|
|
505
|
-
...
|
|
506
|
-
temperature:
|
|
738
|
+
streamingChatCompletionTask: c.type === "StreamingChatCompletion" ? {
|
|
739
|
+
messages: c.messages,
|
|
740
|
+
model: c.model,
|
|
741
|
+
...c.temperature !== void 0 ? {
|
|
742
|
+
temperature: c.temperature
|
|
507
743
|
} : {},
|
|
508
|
-
...
|
|
744
|
+
...c.topP !== void 0 ? { topP: c.topP } : {}
|
|
509
745
|
} : void 0,
|
|
510
|
-
structuredChatCompletionTask:
|
|
511
|
-
messages:
|
|
512
|
-
jsonSchema:
|
|
513
|
-
model:
|
|
514
|
-
...
|
|
515
|
-
temperature:
|
|
746
|
+
structuredChatCompletionTask: c.type === "StructuredChatCompletion" ? {
|
|
747
|
+
messages: c.messages,
|
|
748
|
+
jsonSchema: c.jsonSchema,
|
|
749
|
+
model: c.model,
|
|
750
|
+
...c.temperature !== void 0 ? {
|
|
751
|
+
temperature: c.temperature
|
|
516
752
|
} : {},
|
|
517
|
-
...
|
|
753
|
+
...c.topP !== void 0 ? { topP: c.topP } : {}
|
|
518
754
|
} : void 0,
|
|
519
|
-
memoryChatTask:
|
|
520
|
-
messages:
|
|
521
|
-
model:
|
|
522
|
-
language:
|
|
523
|
-
chunkLimit:
|
|
524
|
-
memoryScanLimit:
|
|
755
|
+
memoryChatTask: c.type === "MemoryChat" ? {
|
|
756
|
+
messages: c.messages,
|
|
757
|
+
model: c.model,
|
|
758
|
+
language: c.language ?? "en",
|
|
759
|
+
chunkLimit: c.chunkLimit ?? 10,
|
|
760
|
+
memoryScanLimit: c.memoryScanLimit ?? 3
|
|
525
761
|
} : void 0,
|
|
526
|
-
memorySearchTask:
|
|
527
|
-
query:
|
|
528
|
-
model:
|
|
529
|
-
language:
|
|
530
|
-
chunkLimit:
|
|
531
|
-
contextExpansion:
|
|
532
|
-
...
|
|
533
|
-
queryExpansion:
|
|
762
|
+
memorySearchTask: c.type === "MemorySearch" ? {
|
|
763
|
+
query: c.query,
|
|
764
|
+
model: c.model,
|
|
765
|
+
language: c.language ?? "en",
|
|
766
|
+
chunkLimit: c.chunkLimit ?? 10,
|
|
767
|
+
contextExpansion: c.contextExpansion,
|
|
768
|
+
...c.queryExpansion != null ? {
|
|
769
|
+
queryExpansion: c.queryExpansion
|
|
534
770
|
} : {}
|
|
535
771
|
} : void 0
|
|
536
772
|
}
|
|
537
773
|
});
|
|
538
|
-
if (
|
|
539
|
-
return
|
|
540
|
-
|
|
541
|
-
),
|
|
542
|
-
...
|
|
774
|
+
if (T.type === "success" && T.agentTask)
|
|
775
|
+
return i.current.add(
|
|
776
|
+
T.agentTask.id
|
|
777
|
+
), n((w) => [
|
|
778
|
+
...w.filter((x) => x.taskKey !== u),
|
|
543
779
|
{
|
|
544
|
-
taskKey:
|
|
780
|
+
taskKey: u,
|
|
545
781
|
streamId: h.stream.id,
|
|
546
782
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
547
|
-
taskId:
|
|
548
|
-
createdAt:
|
|
783
|
+
taskId: T.agentTask.id,
|
|
784
|
+
createdAt: T.agentTask.createdAt,
|
|
549
785
|
error: null,
|
|
550
|
-
params:
|
|
786
|
+
params: c,
|
|
551
787
|
progressItems: [],
|
|
552
788
|
loading: !0,
|
|
553
|
-
loadingText:
|
|
789
|
+
loadingText: d == null ? void 0 : d.loadingText,
|
|
554
790
|
confirmedData: {
|
|
555
|
-
taskId:
|
|
556
|
-
createdAt:
|
|
791
|
+
taskId: T.agentTask.id,
|
|
792
|
+
createdAt: T.agentTask.createdAt
|
|
557
793
|
}
|
|
558
794
|
}
|
|
559
795
|
]), await new Promise(
|
|
560
|
-
(
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
796
|
+
(w) => {
|
|
797
|
+
l.current.set(
|
|
798
|
+
T.agentTask.id,
|
|
799
|
+
w
|
|
564
800
|
);
|
|
565
801
|
}
|
|
566
802
|
);
|
|
567
|
-
if (
|
|
568
|
-
return
|
|
569
|
-
...
|
|
803
|
+
if (T.type === "error")
|
|
804
|
+
return n((w) => [
|
|
805
|
+
...w.filter((x) => x.taskKey !== u),
|
|
570
806
|
{
|
|
571
|
-
taskKey:
|
|
807
|
+
taskKey: u,
|
|
572
808
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
573
809
|
streamId: h.stream.id,
|
|
574
|
-
params:
|
|
575
|
-
error:
|
|
810
|
+
params: c,
|
|
811
|
+
error: T.error,
|
|
576
812
|
progressItems: [],
|
|
577
813
|
loading: !1,
|
|
578
|
-
loadingText:
|
|
814
|
+
loadingText: d == null ? void 0 : d.loadingText,
|
|
579
815
|
confirmedData: null
|
|
580
816
|
}
|
|
581
817
|
]), {
|
|
582
818
|
type: "error",
|
|
583
|
-
error:
|
|
819
|
+
error: T.error
|
|
584
820
|
};
|
|
585
821
|
{
|
|
586
|
-
const
|
|
822
|
+
const w = {
|
|
587
823
|
message: "No response received",
|
|
588
824
|
code: "UnknownError"
|
|
589
825
|
};
|
|
590
|
-
return
|
|
591
|
-
...
|
|
826
|
+
return n((x) => [
|
|
827
|
+
...x.filter((D) => D.taskKey !== u),
|
|
592
828
|
{
|
|
593
|
-
taskKey:
|
|
829
|
+
taskKey: u,
|
|
594
830
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
595
831
|
streamId: h.stream.id,
|
|
596
|
-
error:
|
|
597
|
-
params:
|
|
832
|
+
error: w,
|
|
833
|
+
params: c,
|
|
598
834
|
progressItems: [],
|
|
599
835
|
loading: !1,
|
|
600
|
-
loadingText:
|
|
836
|
+
loadingText: d == null ? void 0 : d.loadingText,
|
|
601
837
|
confirmedData: null
|
|
602
838
|
}
|
|
603
839
|
]), {
|
|
604
840
|
type: "error",
|
|
605
|
-
error:
|
|
841
|
+
error: w
|
|
606
842
|
};
|
|
607
843
|
}
|
|
608
|
-
} catch (
|
|
609
|
-
const
|
|
844
|
+
} catch (v) {
|
|
845
|
+
const T = {
|
|
610
846
|
code: "UnknownError",
|
|
611
|
-
message:
|
|
847
|
+
message: v instanceof Error ? v.message : "Unknown error during agent task creation"
|
|
612
848
|
};
|
|
613
|
-
return
|
|
614
|
-
...
|
|
849
|
+
return n((w) => [
|
|
850
|
+
...w.filter((x) => x.taskKey !== u),
|
|
615
851
|
{
|
|
616
|
-
taskKey:
|
|
852
|
+
taskKey: u,
|
|
617
853
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
618
854
|
streamId: h.stream.id,
|
|
619
|
-
params:
|
|
620
|
-
error:
|
|
855
|
+
params: c,
|
|
856
|
+
error: T,
|
|
621
857
|
progressItems: [],
|
|
622
858
|
loading: !1,
|
|
623
|
-
loadingText:
|
|
859
|
+
loadingText: d == null ? void 0 : d.loadingText,
|
|
624
860
|
confirmedData: null
|
|
625
861
|
}
|
|
626
862
|
]), {
|
|
627
863
|
type: "error",
|
|
628
|
-
error:
|
|
864
|
+
error: T
|
|
629
865
|
};
|
|
630
866
|
}
|
|
631
867
|
} else
|
|
632
868
|
return console.error(h.error), h;
|
|
633
869
|
},
|
|
634
870
|
[
|
|
635
|
-
|
|
636
|
-
|
|
871
|
+
r,
|
|
872
|
+
s,
|
|
637
873
|
e.fetchCreateAgentTaskClientToken,
|
|
638
|
-
|
|
874
|
+
a
|
|
639
875
|
]
|
|
640
|
-
),
|
|
876
|
+
), p = P(() => {
|
|
641
877
|
if (t.length !== 0)
|
|
642
|
-
return [...t].sort((
|
|
878
|
+
return [...t].sort((c, d) => new Date(d.triggeredAt).getTime() - new Date(c.triggeredAt).getTime())[0];
|
|
643
879
|
}, [t]);
|
|
644
|
-
return
|
|
645
|
-
|
|
880
|
+
return F(() => () => {
|
|
881
|
+
i.current.clear(), l.current.clear();
|
|
646
882
|
}, []), {
|
|
647
883
|
agentTasks: t,
|
|
648
|
-
createAgentTask:
|
|
649
|
-
latest:
|
|
884
|
+
createAgentTask: m,
|
|
885
|
+
latest: p
|
|
650
886
|
};
|
|
651
887
|
};
|
|
652
|
-
function
|
|
653
|
-
return e.progressItems.map((
|
|
654
|
-
const
|
|
655
|
-
let
|
|
656
|
-
if (
|
|
657
|
-
const
|
|
658
|
-
|
|
888
|
+
function Ne(e) {
|
|
889
|
+
return e.progressItems.map((r, t) => {
|
|
890
|
+
const n = e.progressItems[t + 1], i = n != null;
|
|
891
|
+
let l;
|
|
892
|
+
if (n != null && n.createdAt) {
|
|
893
|
+
const a = new Date(r.createdAt).getTime(), s = new Date(n.createdAt).getTime();
|
|
894
|
+
l = Math.round((s - a) / 1e3);
|
|
659
895
|
}
|
|
660
896
|
return {
|
|
661
|
-
item:
|
|
662
|
-
completed:
|
|
897
|
+
item: r,
|
|
898
|
+
completed: i,
|
|
663
899
|
isLatest: t === e.progressItems.length - 1,
|
|
664
|
-
durationSeconds:
|
|
900
|
+
durationSeconds: l
|
|
665
901
|
};
|
|
666
902
|
});
|
|
667
903
|
}
|
|
668
|
-
const
|
|
904
|
+
const ce = {
|
|
669
905
|
'code[class*="language-"]': {
|
|
670
906
|
color: "#f8f8f2",
|
|
671
907
|
background: "none",
|
|
@@ -816,57 +1052,57 @@ const ie = {
|
|
|
816
1052
|
italic: {
|
|
817
1053
|
fontStyle: "italic"
|
|
818
1054
|
}
|
|
819
|
-
},
|
|
1055
|
+
}, ne = ({
|
|
820
1056
|
text: e
|
|
821
1057
|
}) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
|
|
822
|
-
|
|
1058
|
+
C.div,
|
|
823
1059
|
{
|
|
824
1060
|
className: "fency-markdown-body-raw",
|
|
825
1061
|
initial: { opacity: 0, y: -10 },
|
|
826
1062
|
animate: { opacity: 1, y: 0 },
|
|
827
1063
|
transition: { duration: 0.3, delay: 0 },
|
|
828
1064
|
children: /* @__PURE__ */ o(
|
|
829
|
-
|
|
1065
|
+
ke,
|
|
830
1066
|
{
|
|
831
|
-
remarkPlugins: [
|
|
1067
|
+
remarkPlugins: [be],
|
|
832
1068
|
components: {
|
|
833
|
-
code(
|
|
834
|
-
const { children: t, className:
|
|
835
|
-
return
|
|
1069
|
+
code(r) {
|
|
1070
|
+
const { children: t, className: n, node: i, ref: l, ...a } = r, s = /language-(\w+)/.exec(n || "");
|
|
1071
|
+
return s ? (
|
|
836
1072
|
// @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
|
|
837
1073
|
/* @__PURE__ */ o(
|
|
838
|
-
|
|
1074
|
+
ae,
|
|
839
1075
|
{
|
|
840
|
-
...
|
|
1076
|
+
...a,
|
|
841
1077
|
PreTag: "div",
|
|
842
1078
|
children: String(t).replace(/\n$/, ""),
|
|
843
|
-
language:
|
|
844
|
-
style:
|
|
1079
|
+
language: s[1],
|
|
1080
|
+
style: ce
|
|
845
1081
|
}
|
|
846
1082
|
)
|
|
847
|
-
) : /* @__PURE__ */ o("code", { ...
|
|
1083
|
+
) : /* @__PURE__ */ o("code", { ...a, className: n, children: String(t) });
|
|
848
1084
|
}
|
|
849
1085
|
},
|
|
850
1086
|
children: e
|
|
851
1087
|
}
|
|
852
1088
|
)
|
|
853
1089
|
}
|
|
854
|
-
) }),
|
|
855
|
-
const
|
|
1090
|
+
) }), He = ({ data: e }) => {
|
|
1091
|
+
const r = JSON.stringify(
|
|
856
1092
|
JSON.parse(e.response.jsonResponse),
|
|
857
1093
|
null,
|
|
858
1094
|
2
|
|
859
1095
|
);
|
|
860
1096
|
return /* @__PURE__ */ o("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ o(
|
|
861
|
-
|
|
1097
|
+
C.div,
|
|
862
1098
|
{
|
|
863
1099
|
initial: { opacity: 0, y: -10 },
|
|
864
1100
|
animate: { opacity: 1, y: 0 },
|
|
865
1101
|
transition: { duration: 0.3, delay: 0 },
|
|
866
|
-
children: /* @__PURE__ */ o(
|
|
1102
|
+
children: /* @__PURE__ */ o(ae, { language: "json", style: ce, PreTag: "div", children: r })
|
|
867
1103
|
}
|
|
868
1104
|
) });
|
|
869
|
-
},
|
|
1105
|
+
}, Ge = {
|
|
870
1106
|
en: {
|
|
871
1107
|
error: "Error",
|
|
872
1108
|
streaming: "Streaming...",
|
|
@@ -926,7 +1162,18 @@ const ie = {
|
|
|
926
1162
|
memorySearchHideExploreResults: "Hide results",
|
|
927
1163
|
memorySearchExploreNoResults: "No results found",
|
|
928
1164
|
memoryChatChunkResultsInMemories: "in {n} memories",
|
|
929
|
-
memoryChatChunkResultsInOneMemory: "in 1 memory"
|
|
1165
|
+
memoryChatChunkResultsInOneMemory: "in 1 memory",
|
|
1166
|
+
googleSearchingFor: "Searching Google for '{query}'",
|
|
1167
|
+
googleSearchingForWithCountry: "Searching Google ({country}) for '{query}'",
|
|
1168
|
+
googleResultsFound: "{n} Google results found",
|
|
1169
|
+
googleResultFound: "1 Google result found",
|
|
1170
|
+
scrapingPages: "Scraping {n} pages for '{query}'",
|
|
1171
|
+
scrapingPage: "Scraping 1 page for '{query}'",
|
|
1172
|
+
scrapedPages: "Scraped {n} pages",
|
|
1173
|
+
scrapedPage: "Scraped 1 page",
|
|
1174
|
+
scrapeFailedSuffix: " — {n} failed",
|
|
1175
|
+
scrapeOkCount: "{n} ok",
|
|
1176
|
+
scrapeFailedCount: "{n} failed"
|
|
930
1177
|
},
|
|
931
1178
|
no: {
|
|
932
1179
|
error: "Feil",
|
|
@@ -987,47 +1234,58 @@ const ie = {
|
|
|
987
1234
|
memorySearchHideExploreResults: "Skjul resultater",
|
|
988
1235
|
memorySearchExploreNoResults: "Ingen resultater funnet",
|
|
989
1236
|
memoryChatChunkResultsInMemories: "i {n} minner",
|
|
990
|
-
memoryChatChunkResultsInOneMemory: "i 1 minne"
|
|
1237
|
+
memoryChatChunkResultsInOneMemory: "i 1 minne",
|
|
1238
|
+
googleSearchingFor: "Søker på Google etter '{query}'",
|
|
1239
|
+
googleSearchingForWithCountry: "Søker på Google ({country}) etter '{query}'",
|
|
1240
|
+
googleResultsFound: "{n} Google-resultater funnet",
|
|
1241
|
+
googleResultFound: "1 Google-resultat funnet",
|
|
1242
|
+
scrapingPages: "Skraper {n} sider for '{query}'",
|
|
1243
|
+
scrapingPage: "Skraper 1 side for '{query}'",
|
|
1244
|
+
scrapedPages: "Skrapet {n} sider",
|
|
1245
|
+
scrapedPage: "Skrapet 1 side",
|
|
1246
|
+
scrapeFailedSuffix: " — {n} feilet",
|
|
1247
|
+
scrapeOkCount: "{n} ok",
|
|
1248
|
+
scrapeFailedCount: "{n} feilet"
|
|
991
1249
|
}
|
|
992
1250
|
};
|
|
993
|
-
function
|
|
994
|
-
return
|
|
1251
|
+
function Ue(e) {
|
|
1252
|
+
return Ge[e];
|
|
995
1253
|
}
|
|
996
|
-
function
|
|
997
|
-
return Object.entries(
|
|
998
|
-
(t, [
|
|
1254
|
+
function S(e, r) {
|
|
1255
|
+
return Object.entries(r).reduce(
|
|
1256
|
+
(t, [n, i]) => t.replace(`{${n}}`, String(i)),
|
|
999
1257
|
e
|
|
1000
1258
|
);
|
|
1001
1259
|
}
|
|
1002
|
-
function
|
|
1003
|
-
const t = e.map((
|
|
1004
|
-
if (
|
|
1005
|
-
const
|
|
1006
|
-
return t.length > 0 ? `${t.join(", ")} ${
|
|
1260
|
+
function q(e, r) {
|
|
1261
|
+
const t = e.map((n) => `'${n}'`);
|
|
1262
|
+
if (r != null && t.length >= 2) {
|
|
1263
|
+
const n = t.pop();
|
|
1264
|
+
return t.length > 0 ? `${t.join(", ")} ${r} ${n}` : n;
|
|
1007
1265
|
}
|
|
1008
1266
|
return t.join(", ");
|
|
1009
1267
|
}
|
|
1010
1268
|
function M({
|
|
1011
1269
|
text: e,
|
|
1012
|
-
duration:
|
|
1270
|
+
duration: r = 2,
|
|
1013
1271
|
delay: t = 0,
|
|
1014
|
-
repeat:
|
|
1015
|
-
repeatDelay:
|
|
1016
|
-
className:
|
|
1017
|
-
startOnView:
|
|
1018
|
-
once:
|
|
1019
|
-
inViewMargin:
|
|
1020
|
-
spread:
|
|
1021
|
-
color:
|
|
1022
|
-
shimmerColor:
|
|
1023
|
-
direction:
|
|
1272
|
+
repeat: n = !0,
|
|
1273
|
+
repeatDelay: i = 0.5,
|
|
1274
|
+
className: l,
|
|
1275
|
+
startOnView: a = !1,
|
|
1276
|
+
once: s = !1,
|
|
1277
|
+
inViewMargin: m,
|
|
1278
|
+
spread: p = 2,
|
|
1279
|
+
color: c = "#999",
|
|
1280
|
+
shimmerColor: d = "#000",
|
|
1281
|
+
direction: u = "fromBottom"
|
|
1024
1282
|
}) {
|
|
1025
|
-
const g =
|
|
1283
|
+
const g = A(null), h = Se(g, { once: s, margin: m }), f = P(() => e.length * p, [e, p]), k = !a || h, b = u === "fromBottom" ? "100% center" : "-100% center", v = u === "fromBottom" ? "0% center" : "200% center";
|
|
1026
1284
|
return /* @__PURE__ */ o(
|
|
1027
|
-
|
|
1285
|
+
C.span,
|
|
1028
1286
|
{
|
|
1029
1287
|
ref: g,
|
|
1030
|
-
className:
|
|
1288
|
+
className: l,
|
|
1031
1289
|
style: {
|
|
1032
1290
|
position: "relative",
|
|
1033
1291
|
display: "inline-block",
|
|
@@ -1038,25 +1296,25 @@ function M({
|
|
|
1038
1296
|
WebkitTextFillColor: "transparent",
|
|
1039
1297
|
backgroundRepeat: "no-repeat, padding-box",
|
|
1040
1298
|
"--spread": `${f}px`,
|
|
1041
|
-
"--base-color":
|
|
1042
|
-
"--shimmer-color":
|
|
1299
|
+
"--base-color": c,
|
|
1300
|
+
"--shimmer-color": d,
|
|
1043
1301
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
1044
1302
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
1045
1303
|
},
|
|
1046
1304
|
initial: {
|
|
1047
|
-
backgroundPosition:
|
|
1305
|
+
backgroundPosition: b,
|
|
1048
1306
|
opacity: 0
|
|
1049
1307
|
},
|
|
1050
|
-
animate:
|
|
1051
|
-
backgroundPosition:
|
|
1308
|
+
animate: k ? {
|
|
1309
|
+
backgroundPosition: v,
|
|
1052
1310
|
opacity: 1
|
|
1053
1311
|
} : {},
|
|
1054
1312
|
transition: {
|
|
1055
1313
|
backgroundPosition: {
|
|
1056
|
-
repeat:
|
|
1057
|
-
duration:
|
|
1314
|
+
repeat: n ? 1 / 0 : 0,
|
|
1315
|
+
duration: r,
|
|
1058
1316
|
delay: t,
|
|
1059
|
-
repeatDelay:
|
|
1317
|
+
repeatDelay: i,
|
|
1060
1318
|
ease: "linear"
|
|
1061
1319
|
},
|
|
1062
1320
|
opacity: {
|
|
@@ -1068,20 +1326,20 @@ function M({
|
|
|
1068
1326
|
}
|
|
1069
1327
|
);
|
|
1070
1328
|
}
|
|
1071
|
-
const
|
|
1072
|
-
const [
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
)}` : "", f =
|
|
1076
|
-
return /* @__PURE__ */
|
|
1329
|
+
const G = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1330
|
+
const [i, l] = I(!1), s = (e.memories ?? []).map((k) => k.memoryTitle), m = s.length > 0, p = m && s.length > G, c = p && !i ? s.slice(0, G) : s, d = s.length - G, u = !p || i, g = `${n.searchingFor}'${e.queryDescription}'`, h = m ? `${n.searchingIn}${q(
|
|
1331
|
+
c,
|
|
1332
|
+
u ? n.and : void 0
|
|
1333
|
+
)}` : "", f = m ? `${g}${h}` : `${n.searchingPrefix}${e.queryDescription}`;
|
|
1334
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
1077
1335
|
/* @__PURE__ */ o(
|
|
1078
|
-
|
|
1336
|
+
C.div,
|
|
1079
1337
|
{
|
|
1080
1338
|
style: { color: "#666" },
|
|
1081
1339
|
initial: { opacity: 0, y: -10 },
|
|
1082
1340
|
animate: { opacity: 1, y: 0 },
|
|
1083
1341
|
transition: { duration: 0.3, delay: 0 },
|
|
1084
|
-
children:
|
|
1342
|
+
children: r && !t && !p ? /* @__PURE__ */ o(
|
|
1085
1343
|
M,
|
|
1086
1344
|
{
|
|
1087
1345
|
text: f,
|
|
@@ -1090,23 +1348,23 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1090
1348
|
color: "#999",
|
|
1091
1349
|
shimmerColor: "#000"
|
|
1092
1350
|
}
|
|
1093
|
-
) : /* @__PURE__ */
|
|
1094
|
-
/* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1095
|
-
|
|
1096
|
-
/* @__PURE__ */
|
|
1351
|
+
) : /* @__PURE__ */ y(E, { children: [
|
|
1352
|
+
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ y(E, { children: [
|
|
1353
|
+
n.searchingFor,
|
|
1354
|
+
/* @__PURE__ */ y("span", { style: { fontWeight: 600 }, children: [
|
|
1097
1355
|
"'",
|
|
1098
1356
|
e.queryDescription,
|
|
1099
1357
|
"'"
|
|
1100
1358
|
] }),
|
|
1101
1359
|
h
|
|
1102
|
-
] }) : `${
|
|
1103
|
-
|
|
1360
|
+
] }) : `${n.searchingPrefix}${e.queryDescription}` }),
|
|
1361
|
+
p && !i && /* @__PURE__ */ y(E, { children: [
|
|
1104
1362
|
" ",
|
|
1105
1363
|
/* @__PURE__ */ o(
|
|
1106
1364
|
"button",
|
|
1107
1365
|
{
|
|
1108
1366
|
type: "button",
|
|
1109
|
-
onClick: () =>
|
|
1367
|
+
onClick: () => l(!0),
|
|
1110
1368
|
style: {
|
|
1111
1369
|
background: "none",
|
|
1112
1370
|
border: "none",
|
|
@@ -1118,19 +1376,19 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1118
1376
|
textDecoration: "underline",
|
|
1119
1377
|
fontFamily: "inherit"
|
|
1120
1378
|
},
|
|
1121
|
-
children:
|
|
1122
|
-
n:
|
|
1379
|
+
children: S(n.moreMemories, {
|
|
1380
|
+
n: d
|
|
1123
1381
|
})
|
|
1124
1382
|
}
|
|
1125
1383
|
)
|
|
1126
1384
|
] }),
|
|
1127
|
-
|
|
1385
|
+
p && i && /* @__PURE__ */ y(E, { children: [
|
|
1128
1386
|
" ",
|
|
1129
1387
|
/* @__PURE__ */ o(
|
|
1130
1388
|
"button",
|
|
1131
1389
|
{
|
|
1132
1390
|
type: "button",
|
|
1133
|
-
onClick: () =>
|
|
1391
|
+
onClick: () => l(!1),
|
|
1134
1392
|
style: {
|
|
1135
1393
|
background: "none",
|
|
1136
1394
|
border: "none",
|
|
@@ -1142,7 +1400,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1142
1400
|
textDecoration: "underline",
|
|
1143
1401
|
fontFamily: "inherit"
|
|
1144
1402
|
},
|
|
1145
|
-
children:
|
|
1403
|
+
children: n.clickToCollapse
|
|
1146
1404
|
}
|
|
1147
1405
|
)
|
|
1148
1406
|
] })
|
|
@@ -1158,18 +1416,18 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1158
1416
|
marginTop: "4px",
|
|
1159
1417
|
fontStyle: "italic"
|
|
1160
1418
|
},
|
|
1161
|
-
children:
|
|
1419
|
+
children: S(n.tookSeconds, { n: t })
|
|
1162
1420
|
}
|
|
1163
1421
|
)
|
|
1164
1422
|
] });
|
|
1165
|
-
},
|
|
1166
|
-
const [
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
)}` :
|
|
1170
|
-
return /* @__PURE__ */
|
|
1423
|
+
}, U = 5, je = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1424
|
+
const [i, l] = I(!1), a = e.titles, s = a.length > 0, m = s && a.length > U, p = m && !i ? a.slice(0, U) : a, c = a.length - U, d = !m || i, u = s ? `${n.findingMemoriesIn}${q(
|
|
1425
|
+
p,
|
|
1426
|
+
d ? n.and : void 0
|
|
1427
|
+
)}` : n.findingMemories;
|
|
1428
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
1171
1429
|
/* @__PURE__ */ o(
|
|
1172
|
-
|
|
1430
|
+
C.div,
|
|
1173
1431
|
{
|
|
1174
1432
|
style: {
|
|
1175
1433
|
color: "#666"
|
|
@@ -1177,24 +1435,24 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1177
1435
|
initial: { opacity: 0, y: -10 },
|
|
1178
1436
|
animate: { opacity: 1, y: 0 },
|
|
1179
1437
|
transition: { duration: 0.3, delay: 0 },
|
|
1180
|
-
children:
|
|
1438
|
+
children: r && !t && !m ? /* @__PURE__ */ o(
|
|
1181
1439
|
M,
|
|
1182
1440
|
{
|
|
1183
|
-
text:
|
|
1441
|
+
text: u,
|
|
1184
1442
|
duration: 2.5,
|
|
1185
1443
|
repeat: !0,
|
|
1186
1444
|
color: "#999",
|
|
1187
1445
|
shimmerColor: "#000"
|
|
1188
1446
|
}
|
|
1189
|
-
) : /* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1191
|
-
|
|
1447
|
+
) : /* @__PURE__ */ y(E, { children: [
|
|
1448
|
+
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
|
|
1449
|
+
m && !i && /* @__PURE__ */ y(E, { children: [
|
|
1192
1450
|
" ",
|
|
1193
1451
|
/* @__PURE__ */ o(
|
|
1194
1452
|
"button",
|
|
1195
1453
|
{
|
|
1196
1454
|
type: "button",
|
|
1197
|
-
onClick: () =>
|
|
1455
|
+
onClick: () => l(!0),
|
|
1198
1456
|
style: {
|
|
1199
1457
|
background: "none",
|
|
1200
1458
|
border: "none",
|
|
@@ -1206,19 +1464,19 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1206
1464
|
textDecoration: "underline",
|
|
1207
1465
|
fontFamily: "inherit"
|
|
1208
1466
|
},
|
|
1209
|
-
children:
|
|
1210
|
-
n:
|
|
1467
|
+
children: S(n.moreMemories, {
|
|
1468
|
+
n: c
|
|
1211
1469
|
})
|
|
1212
1470
|
}
|
|
1213
1471
|
)
|
|
1214
1472
|
] }),
|
|
1215
|
-
|
|
1473
|
+
m && i && /* @__PURE__ */ y(E, { children: [
|
|
1216
1474
|
" ",
|
|
1217
1475
|
/* @__PURE__ */ o(
|
|
1218
1476
|
"button",
|
|
1219
1477
|
{
|
|
1220
1478
|
type: "button",
|
|
1221
|
-
onClick: () =>
|
|
1479
|
+
onClick: () => l(!1),
|
|
1222
1480
|
style: {
|
|
1223
1481
|
background: "none",
|
|
1224
1482
|
border: "none",
|
|
@@ -1230,7 +1488,7 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1230
1488
|
textDecoration: "underline",
|
|
1231
1489
|
fontFamily: "inherit"
|
|
1232
1490
|
},
|
|
1233
|
-
children:
|
|
1491
|
+
children: n.clickToCollapse
|
|
1234
1492
|
}
|
|
1235
1493
|
)
|
|
1236
1494
|
] })
|
|
@@ -1246,31 +1504,31 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1246
1504
|
marginTop: "4px",
|
|
1247
1505
|
fontStyle: "italic"
|
|
1248
1506
|
},
|
|
1249
|
-
children:
|
|
1507
|
+
children: S(n.tookSeconds, { n: t })
|
|
1250
1508
|
}
|
|
1251
1509
|
)
|
|
1252
1510
|
] });
|
|
1253
|
-
}, _ = 5,
|
|
1254
|
-
const [t,
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
)}` :
|
|
1511
|
+
}, _ = 5, qe = ({ data: e, t: r }) => {
|
|
1512
|
+
const [t, n] = I(!1), l = e.memories.map((g) => g.memoryTitle), a = l.length > 0, s = a && l.length > _, m = s && !t ? l.slice(0, _) : l, p = l.length - _, c = !s || t, d = l.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, u = a ? `${d}${q(
|
|
1513
|
+
m,
|
|
1514
|
+
c ? r.and : void 0
|
|
1515
|
+
)}` : r.memoriesFound;
|
|
1258
1516
|
return /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
|
|
1259
|
-
|
|
1517
|
+
C.div,
|
|
1260
1518
|
{
|
|
1261
1519
|
style: { color: "#666" },
|
|
1262
1520
|
initial: { opacity: 0, y: -10 },
|
|
1263
1521
|
animate: { opacity: 1, y: 0 },
|
|
1264
1522
|
transition: { duration: 0.3, delay: 0 },
|
|
1265
|
-
children: /* @__PURE__ */
|
|
1266
|
-
/* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1267
|
-
|
|
1523
|
+
children: /* @__PURE__ */ y(E, { children: [
|
|
1524
|
+
/* @__PURE__ */ o("span", { style: { color: "#666" }, children: u }),
|
|
1525
|
+
s && !t && /* @__PURE__ */ y(E, { children: [
|
|
1268
1526
|
" ",
|
|
1269
1527
|
/* @__PURE__ */ o(
|
|
1270
1528
|
"button",
|
|
1271
1529
|
{
|
|
1272
1530
|
type: "button",
|
|
1273
|
-
onClick: () =>
|
|
1531
|
+
onClick: () => n(!0),
|
|
1274
1532
|
style: {
|
|
1275
1533
|
background: "none",
|
|
1276
1534
|
border: "none",
|
|
@@ -1282,19 +1540,19 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1282
1540
|
textDecoration: "underline",
|
|
1283
1541
|
fontFamily: "inherit"
|
|
1284
1542
|
},
|
|
1285
|
-
children:
|
|
1286
|
-
n:
|
|
1543
|
+
children: S(r.moreMemories, {
|
|
1544
|
+
n: p
|
|
1287
1545
|
})
|
|
1288
1546
|
}
|
|
1289
1547
|
)
|
|
1290
1548
|
] }),
|
|
1291
|
-
|
|
1549
|
+
s && t && /* @__PURE__ */ y(E, { children: [
|
|
1292
1550
|
" ",
|
|
1293
1551
|
/* @__PURE__ */ o(
|
|
1294
1552
|
"button",
|
|
1295
1553
|
{
|
|
1296
1554
|
type: "button",
|
|
1297
|
-
onClick: () =>
|
|
1555
|
+
onClick: () => n(!1),
|
|
1298
1556
|
style: {
|
|
1299
1557
|
background: "none",
|
|
1300
1558
|
border: "none",
|
|
@@ -1306,18 +1564,18 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1306
1564
|
textDecoration: "underline",
|
|
1307
1565
|
fontFamily: "inherit"
|
|
1308
1566
|
},
|
|
1309
|
-
children:
|
|
1567
|
+
children: r.clickToCollapse
|
|
1310
1568
|
}
|
|
1311
1569
|
)
|
|
1312
1570
|
] })
|
|
1313
1571
|
] })
|
|
1314
1572
|
}
|
|
1315
1573
|
) });
|
|
1316
|
-
},
|
|
1317
|
-
const
|
|
1318
|
-
return /* @__PURE__ */
|
|
1574
|
+
}, Qe = ({ isLatest: e = !1, durationSeconds: r, t }) => {
|
|
1575
|
+
const n = t.addingSources;
|
|
1576
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
1319
1577
|
/* @__PURE__ */ o(
|
|
1320
|
-
|
|
1578
|
+
C.div,
|
|
1321
1579
|
{
|
|
1322
1580
|
style: {
|
|
1323
1581
|
display: "flex",
|
|
@@ -1328,19 +1586,19 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1328
1586
|
initial: { opacity: 0, y: -10 },
|
|
1329
1587
|
animate: { opacity: 1, y: 0 },
|
|
1330
1588
|
transition: { duration: 0.3, delay: 0 },
|
|
1331
|
-
children: e && !
|
|
1589
|
+
children: e && !r ? /* @__PURE__ */ o(
|
|
1332
1590
|
M,
|
|
1333
1591
|
{
|
|
1334
|
-
text:
|
|
1592
|
+
text: n,
|
|
1335
1593
|
duration: 2.5,
|
|
1336
1594
|
repeat: !0,
|
|
1337
1595
|
color: "#999",
|
|
1338
1596
|
shimmerColor: "#000"
|
|
1339
1597
|
}
|
|
1340
|
-
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children:
|
|
1598
|
+
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: n })
|
|
1341
1599
|
}
|
|
1342
1600
|
),
|
|
1343
|
-
|
|
1601
|
+
r !== void 0 && /* @__PURE__ */ o(
|
|
1344
1602
|
"div",
|
|
1345
1603
|
{
|
|
1346
1604
|
style: {
|
|
@@ -1349,28 +1607,28 @@ const $ = 5, He = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
1349
1607
|
marginTop: "4px",
|
|
1350
1608
|
fontStyle: "italic"
|
|
1351
1609
|
},
|
|
1352
|
-
children:
|
|
1610
|
+
children: S(t.tookSeconds, { n: r })
|
|
1353
1611
|
}
|
|
1354
1612
|
)
|
|
1355
1613
|
] });
|
|
1356
1614
|
};
|
|
1357
|
-
function
|
|
1615
|
+
function Ke(e, r) {
|
|
1358
1616
|
if (e.length === 0) return "";
|
|
1359
1617
|
if (e.length === 1)
|
|
1360
|
-
return
|
|
1618
|
+
return S(r.pageSingle, { n: e[0] });
|
|
1361
1619
|
if (e.length === 2)
|
|
1362
|
-
return
|
|
1620
|
+
return S(r.pageTwo, {
|
|
1363
1621
|
a: e[0],
|
|
1364
1622
|
b: e[1]
|
|
1365
1623
|
});
|
|
1366
|
-
const t = e[e.length - 1],
|
|
1367
|
-
return
|
|
1624
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1625
|
+
return S(r.pageMultiple, { list: n, n: t });
|
|
1368
1626
|
}
|
|
1369
|
-
const
|
|
1370
|
-
const [
|
|
1371
|
-
return /* @__PURE__ */
|
|
1627
|
+
const Ve = ({ data: e, onSourceClick: r, t }) => {
|
|
1628
|
+
const [n, i] = I(null);
|
|
1629
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
1372
1630
|
/* @__PURE__ */ o(
|
|
1373
|
-
|
|
1631
|
+
C.div,
|
|
1374
1632
|
{
|
|
1375
1633
|
style: {
|
|
1376
1634
|
marginBottom: "10px",
|
|
@@ -1386,51 +1644,51 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1386
1644
|
children: t.sources
|
|
1387
1645
|
}
|
|
1388
1646
|
),
|
|
1389
|
-
/* @__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((
|
|
1390
|
-
|
|
1647
|
+
/* @__PURE__ */ o("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ o("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((l, a) => /* @__PURE__ */ o(
|
|
1648
|
+
Xe,
|
|
1391
1649
|
{
|
|
1392
|
-
source:
|
|
1393
|
-
index:
|
|
1394
|
-
loadingMemoryId:
|
|
1395
|
-
setLoadingMemoryId:
|
|
1396
|
-
onSourceClick:
|
|
1650
|
+
source: l,
|
|
1651
|
+
index: a,
|
|
1652
|
+
loadingMemoryId: n,
|
|
1653
|
+
setLoadingMemoryId: i,
|
|
1654
|
+
onSourceClick: r,
|
|
1397
1655
|
t
|
|
1398
1656
|
},
|
|
1399
|
-
|
|
1657
|
+
l.memoryId
|
|
1400
1658
|
)) })
|
|
1401
1659
|
] });
|
|
1402
|
-
},
|
|
1660
|
+
}, Xe = ({
|
|
1403
1661
|
source: e,
|
|
1404
|
-
index:
|
|
1662
|
+
index: r,
|
|
1405
1663
|
loadingMemoryId: t,
|
|
1406
|
-
setLoadingMemoryId:
|
|
1407
|
-
onSourceClick:
|
|
1408
|
-
t:
|
|
1664
|
+
setLoadingMemoryId: n,
|
|
1665
|
+
onSourceClick: i,
|
|
1666
|
+
t: l
|
|
1409
1667
|
}) => {
|
|
1410
|
-
const [
|
|
1411
|
-
return /* @__PURE__ */
|
|
1412
|
-
|
|
1668
|
+
const [a, s] = I(!1), m = !!i, p = t === e.memoryId, c = e.pageNumbers ?? [], d = Ke(c, l);
|
|
1669
|
+
return /* @__PURE__ */ y(
|
|
1670
|
+
C.div,
|
|
1413
1671
|
{
|
|
1414
|
-
"aria-busy":
|
|
1672
|
+
"aria-busy": p,
|
|
1415
1673
|
initial: { opacity: 0, scale: 0.9 },
|
|
1416
1674
|
animate: { opacity: 1, scale: 1 },
|
|
1417
|
-
transition: { duration: 0.25, delay:
|
|
1418
|
-
onClick:
|
|
1419
|
-
|
|
1675
|
+
transition: { duration: 0.25, delay: r * 0.05 },
|
|
1676
|
+
onClick: m && !p ? async () => {
|
|
1677
|
+
n(e.memoryId);
|
|
1420
1678
|
try {
|
|
1421
|
-
await
|
|
1679
|
+
await i({
|
|
1422
1680
|
memoryId: e.memoryId,
|
|
1423
1681
|
memoryTitle: e.memoryTitle,
|
|
1424
1682
|
memoryTypeId: e.memoryTypeId,
|
|
1425
1683
|
memoryTypeName: e.memoryTypeName,
|
|
1426
|
-
pageNumbers: [...
|
|
1684
|
+
pageNumbers: [...c]
|
|
1427
1685
|
});
|
|
1428
1686
|
} finally {
|
|
1429
|
-
|
|
1687
|
+
n(null);
|
|
1430
1688
|
}
|
|
1431
1689
|
} : void 0,
|
|
1432
|
-
onMouseEnter:
|
|
1433
|
-
onMouseLeave:
|
|
1690
|
+
onMouseEnter: m && !p ? () => s(!0) : void 0,
|
|
1691
|
+
onMouseLeave: m && !p ? () => s(!1) : void 0,
|
|
1434
1692
|
style: {
|
|
1435
1693
|
display: "inline-flex",
|
|
1436
1694
|
flexDirection: "column",
|
|
@@ -1438,14 +1696,14 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1438
1696
|
padding: "8px 12px",
|
|
1439
1697
|
borderRadius: "6px",
|
|
1440
1698
|
border: "1px solid #e0e0e0",
|
|
1441
|
-
backgroundColor:
|
|
1442
|
-
cursor:
|
|
1699
|
+
backgroundColor: a ? "#f5f5f5" : "transparent",
|
|
1700
|
+
cursor: m && !p ? "pointer" : p ? "wait" : "default",
|
|
1443
1701
|
transition: "background-color 0.15s ease",
|
|
1444
1702
|
userSelect: "none",
|
|
1445
|
-
pointerEvents:
|
|
1703
|
+
pointerEvents: p ? "none" : void 0
|
|
1446
1704
|
},
|
|
1447
1705
|
children: [
|
|
1448
|
-
/* @__PURE__ */
|
|
1706
|
+
/* @__PURE__ */ y(
|
|
1449
1707
|
"span",
|
|
1450
1708
|
{
|
|
1451
1709
|
style: {
|
|
@@ -1457,7 +1715,7 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1457
1715
|
gap: 8
|
|
1458
1716
|
},
|
|
1459
1717
|
children: [
|
|
1460
|
-
|
|
1718
|
+
p && /* @__PURE__ */ o(
|
|
1461
1719
|
"span",
|
|
1462
1720
|
{
|
|
1463
1721
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
@@ -1468,57 +1726,57 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1468
1726
|
]
|
|
1469
1727
|
}
|
|
1470
1728
|
),
|
|
1471
|
-
|
|
1729
|
+
d && /* @__PURE__ */ o("span", { style: { fontSize: "12px", color: "#666" }, children: d })
|
|
1472
1730
|
]
|
|
1473
1731
|
}
|
|
1474
1732
|
);
|
|
1475
1733
|
}, L = ({
|
|
1476
1734
|
color: e = "#78b13f",
|
|
1477
|
-
size:
|
|
1735
|
+
size: r = 24,
|
|
1478
1736
|
borderWidth: t = 7
|
|
1479
1737
|
}) => {
|
|
1480
|
-
const
|
|
1738
|
+
const n = r * 0.5;
|
|
1481
1739
|
return /* @__PURE__ */ o(
|
|
1482
1740
|
"span",
|
|
1483
1741
|
{
|
|
1484
1742
|
style: {
|
|
1485
1743
|
display: "inline-block",
|
|
1486
1744
|
transform: "rotate(45deg)",
|
|
1487
|
-
height:
|
|
1488
|
-
width:
|
|
1745
|
+
height: r,
|
|
1746
|
+
width: n,
|
|
1489
1747
|
borderBottom: `${t}px solid ${e}`,
|
|
1490
1748
|
borderRight: `${t}px solid ${e}`
|
|
1491
1749
|
}
|
|
1492
1750
|
}
|
|
1493
1751
|
);
|
|
1494
|
-
},
|
|
1752
|
+
}, H = ({
|
|
1495
1753
|
color: e = "#333",
|
|
1496
|
-
size:
|
|
1754
|
+
size: r = 32,
|
|
1497
1755
|
lineWidth: t = 2
|
|
1498
1756
|
}) => {
|
|
1499
|
-
const
|
|
1757
|
+
const n = r + 1, i = (r - t) / 2, l = (r - n) / 2, a = {
|
|
1500
1758
|
position: "absolute",
|
|
1501
|
-
left:
|
|
1502
|
-
top:
|
|
1759
|
+
left: i,
|
|
1760
|
+
top: l,
|
|
1503
1761
|
width: t,
|
|
1504
|
-
height:
|
|
1762
|
+
height: n,
|
|
1505
1763
|
backgroundColor: e
|
|
1506
1764
|
};
|
|
1507
|
-
return /* @__PURE__ */
|
|
1765
|
+
return /* @__PURE__ */ y(
|
|
1508
1766
|
"span",
|
|
1509
1767
|
{
|
|
1510
1768
|
style: {
|
|
1511
1769
|
position: "relative",
|
|
1512
1770
|
display: "inline-block",
|
|
1513
|
-
width:
|
|
1514
|
-
height:
|
|
1771
|
+
width: r,
|
|
1772
|
+
height: r
|
|
1515
1773
|
},
|
|
1516
1774
|
children: [
|
|
1517
1775
|
/* @__PURE__ */ o(
|
|
1518
1776
|
"span",
|
|
1519
1777
|
{
|
|
1520
1778
|
style: {
|
|
1521
|
-
...
|
|
1779
|
+
...a,
|
|
1522
1780
|
transform: "rotate(45deg)"
|
|
1523
1781
|
}
|
|
1524
1782
|
}
|
|
@@ -1527,7 +1785,7 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1527
1785
|
"span",
|
|
1528
1786
|
{
|
|
1529
1787
|
style: {
|
|
1530
|
-
...
|
|
1788
|
+
...a,
|
|
1531
1789
|
transform: "rotate(-45deg)"
|
|
1532
1790
|
}
|
|
1533
1791
|
}
|
|
@@ -1536,26 +1794,26 @@ const je = ({ data: e, onSourceClick: n, t }) => {
|
|
|
1536
1794
|
}
|
|
1537
1795
|
);
|
|
1538
1796
|
};
|
|
1539
|
-
function
|
|
1797
|
+
function Je({
|
|
1540
1798
|
memory: e,
|
|
1541
|
-
completed:
|
|
1799
|
+
completed: r
|
|
1542
1800
|
}) {
|
|
1543
|
-
return e.error != null ? /* @__PURE__ */ o(
|
|
1801
|
+
return e.error != null ? /* @__PURE__ */ o(H, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
1544
1802
|
}
|
|
1545
|
-
const
|
|
1546
|
-
function
|
|
1803
|
+
const te = 80;
|
|
1804
|
+
function Ye({
|
|
1547
1805
|
memory: e,
|
|
1548
|
-
completed:
|
|
1806
|
+
completed: r,
|
|
1549
1807
|
t
|
|
1550
1808
|
}) {
|
|
1551
|
-
const [
|
|
1552
|
-
return /* @__PURE__ */
|
|
1553
|
-
|
|
1809
|
+
const [n, i] = I(!1), l = e.result ?? e.error, a = l != null && l.length > te, s = l != null ? n || !a ? l : `${l.slice(0, te)}...` : void 0, m = a, p = e.error != null;
|
|
1810
|
+
return /* @__PURE__ */ y(
|
|
1811
|
+
C.div,
|
|
1554
1812
|
{
|
|
1555
1813
|
initial: { opacity: 0 },
|
|
1556
1814
|
animate: { opacity: 1 },
|
|
1557
1815
|
transition: { duration: 0.25 },
|
|
1558
|
-
onClick:
|
|
1816
|
+
onClick: m ? () => i((c) => !c) : void 0,
|
|
1559
1817
|
style: {
|
|
1560
1818
|
paddingTop: "12px",
|
|
1561
1819
|
paddingBottom: "12px",
|
|
@@ -1565,7 +1823,7 @@ function Ve({
|
|
|
1565
1823
|
alignItems: "center",
|
|
1566
1824
|
gap: "10px",
|
|
1567
1825
|
minWidth: 0,
|
|
1568
|
-
cursor:
|
|
1826
|
+
cursor: m ? "pointer" : "default"
|
|
1569
1827
|
},
|
|
1570
1828
|
children: [
|
|
1571
1829
|
/* @__PURE__ */ o(
|
|
@@ -1578,10 +1836,10 @@ function Ve({
|
|
|
1578
1836
|
flexShrink: 0,
|
|
1579
1837
|
width: 32
|
|
1580
1838
|
},
|
|
1581
|
-
children: /* @__PURE__ */ o(
|
|
1839
|
+
children: /* @__PURE__ */ o(Je, { memory: e, completed: r })
|
|
1582
1840
|
}
|
|
1583
1841
|
),
|
|
1584
|
-
/* @__PURE__ */
|
|
1842
|
+
/* @__PURE__ */ y(
|
|
1585
1843
|
"div",
|
|
1586
1844
|
{
|
|
1587
1845
|
style: {
|
|
@@ -1598,19 +1856,19 @@ function Ve({
|
|
|
1598
1856
|
children: e.memoryTitle
|
|
1599
1857
|
}
|
|
1600
1858
|
),
|
|
1601
|
-
|
|
1859
|
+
s != null && /* @__PURE__ */ o(
|
|
1602
1860
|
"span",
|
|
1603
1861
|
{
|
|
1604
1862
|
style: {
|
|
1605
1863
|
fontSize: 12,
|
|
1606
|
-
color:
|
|
1864
|
+
color: p ? "#c62828" : "#666",
|
|
1607
1865
|
lineHeight: 1.4,
|
|
1608
|
-
whiteSpace:
|
|
1866
|
+
whiteSpace: n ? "pre-wrap" : void 0
|
|
1609
1867
|
},
|
|
1610
|
-
children:
|
|
1868
|
+
children: s
|
|
1611
1869
|
}
|
|
1612
1870
|
),
|
|
1613
|
-
|
|
1871
|
+
m && /* @__PURE__ */ o(
|
|
1614
1872
|
"span",
|
|
1615
1873
|
{
|
|
1616
1874
|
style: {
|
|
@@ -1618,7 +1876,7 @@ function Ve({
|
|
|
1618
1876
|
color: "#999",
|
|
1619
1877
|
marginTop: 2
|
|
1620
1878
|
},
|
|
1621
|
-
children:
|
|
1879
|
+
children: n ? t.clickToCollapse : t.clickToExpand
|
|
1622
1880
|
}
|
|
1623
1881
|
)
|
|
1624
1882
|
]
|
|
@@ -1628,102 +1886,102 @@ function Ve({
|
|
|
1628
1886
|
}
|
|
1629
1887
|
);
|
|
1630
1888
|
}
|
|
1631
|
-
const
|
|
1632
|
-
|
|
1889
|
+
const Ze = ({ data: e, completed: r, t }) => /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ o(
|
|
1890
|
+
Ye,
|
|
1633
1891
|
{
|
|
1634
|
-
memory:
|
|
1635
|
-
completed:
|
|
1892
|
+
memory: n,
|
|
1893
|
+
completed: r,
|
|
1636
1894
|
t
|
|
1637
1895
|
},
|
|
1638
|
-
|
|
1896
|
+
n.memoryId
|
|
1639
1897
|
)) });
|
|
1640
|
-
function
|
|
1641
|
-
const t = Math.min(e.length,
|
|
1642
|
-
for (let
|
|
1643
|
-
if (e.slice(-
|
|
1898
|
+
function er(e, r) {
|
|
1899
|
+
const t = Math.min(e.length, r.length);
|
|
1900
|
+
for (let n = t; n >= 0; n--)
|
|
1901
|
+
if (e.slice(-n) === r.slice(0, n)) return n;
|
|
1644
1902
|
return 0;
|
|
1645
1903
|
}
|
|
1646
|
-
const
|
|
1904
|
+
const rr = `
|
|
1647
1905
|
|
|
1648
1906
|
`;
|
|
1649
|
-
function
|
|
1650
|
-
var t,
|
|
1907
|
+
function Q(e) {
|
|
1908
|
+
var t, n;
|
|
1651
1909
|
if (e.length === 0) return "";
|
|
1652
|
-
let
|
|
1653
|
-
for (let
|
|
1654
|
-
const
|
|
1655
|
-
if (
|
|
1656
|
-
if (
|
|
1657
|
-
|
|
1910
|
+
let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
|
|
1911
|
+
for (let i = 1; i < e.length; i++) {
|
|
1912
|
+
const l = ((n = e[i]) == null ? void 0 : n.content) ?? "";
|
|
1913
|
+
if (l === "") continue;
|
|
1914
|
+
if (r === "") {
|
|
1915
|
+
r = l;
|
|
1658
1916
|
continue;
|
|
1659
1917
|
}
|
|
1660
|
-
const
|
|
1661
|
-
|
|
1918
|
+
const a = er(r, l);
|
|
1919
|
+
a === 0 ? r += rr + l : r += l.slice(a);
|
|
1662
1920
|
}
|
|
1663
|
-
return
|
|
1921
|
+
return r;
|
|
1664
1922
|
}
|
|
1665
|
-
function K(e,
|
|
1923
|
+
function K(e, r) {
|
|
1666
1924
|
if (e.length === 0) return "";
|
|
1667
1925
|
if (e.length === 1)
|
|
1668
|
-
return
|
|
1926
|
+
return S(r.memorySearchPagesSingle, {
|
|
1669
1927
|
n: e[0]
|
|
1670
1928
|
});
|
|
1671
1929
|
if (e.length === 2)
|
|
1672
|
-
return
|
|
1930
|
+
return S(r.memorySearchPagesTwo, {
|
|
1673
1931
|
a: e[0],
|
|
1674
1932
|
b: e[1]
|
|
1675
1933
|
});
|
|
1676
|
-
const t = e[e.length - 1],
|
|
1677
|
-
return
|
|
1678
|
-
list:
|
|
1934
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1935
|
+
return S(r.memorySearchPagesMultiple, {
|
|
1936
|
+
list: n,
|
|
1679
1937
|
n: t
|
|
1680
1938
|
});
|
|
1681
1939
|
}
|
|
1682
1940
|
function V(e) {
|
|
1683
|
-
const
|
|
1941
|
+
const r = /* @__PURE__ */ new Set();
|
|
1684
1942
|
for (const t of e)
|
|
1685
|
-
for (const
|
|
1686
|
-
return [...
|
|
1943
|
+
for (const n of t.pageNumbers) r.add(n);
|
|
1944
|
+
return [...r].sort((t, n) => t - n);
|
|
1687
1945
|
}
|
|
1688
1946
|
function X(e) {
|
|
1689
|
-
const
|
|
1690
|
-
if (
|
|
1947
|
+
const r = e.memoryTypeName.trim();
|
|
1948
|
+
if (r !== "") return r;
|
|
1691
1949
|
if (e.memoryTypeId !== "") return e.memoryTypeId;
|
|
1692
1950
|
}
|
|
1693
|
-
function
|
|
1694
|
-
return e.chunks.filter((
|
|
1951
|
+
function de(e) {
|
|
1952
|
+
return e.chunks.filter((r) => r.relation === "MATCH").length;
|
|
1695
1953
|
}
|
|
1696
|
-
function
|
|
1697
|
-
let t = 0,
|
|
1698
|
-
for (const
|
|
1699
|
-
t +=
|
|
1700
|
-
const
|
|
1701
|
-
n:
|
|
1954
|
+
function nr(e, r) {
|
|
1955
|
+
let t = 0, n = 0;
|
|
1956
|
+
for (const a of e)
|
|
1957
|
+
t += de(a), a.matchingChunkScore > n && (n = a.matchingChunkScore);
|
|
1958
|
+
const i = t === 1 ? r.chunkFound : S(r.chunksFound, { n: t }), l = S(r.scoreLabel, {
|
|
1959
|
+
n: n.toFixed(2)
|
|
1702
1960
|
});
|
|
1703
|
-
return `${
|
|
1961
|
+
return `${i} - ${l}`;
|
|
1704
1962
|
}
|
|
1705
|
-
function
|
|
1706
|
-
const
|
|
1707
|
-
return e.forEach((
|
|
1708
|
-
let
|
|
1709
|
-
if (
|
|
1710
|
-
|
|
1711
|
-
const
|
|
1712
|
-
|
|
1713
|
-
memoryId:
|
|
1714
|
-
memoryTitle:
|
|
1963
|
+
function tr(e) {
|
|
1964
|
+
const r = [], t = /* @__PURE__ */ new Map();
|
|
1965
|
+
return e.forEach((n, i) => {
|
|
1966
|
+
let l = t.get(n.memoryId);
|
|
1967
|
+
if (l == null) {
|
|
1968
|
+
r.push(n.memoryId);
|
|
1969
|
+
const a = n.memoryTitle !== "" ? n.memoryTitle : n.memoryId;
|
|
1970
|
+
l = {
|
|
1971
|
+
memoryId: n.memoryId,
|
|
1972
|
+
memoryTitle: a,
|
|
1715
1973
|
items: []
|
|
1716
|
-
}, t.set(
|
|
1974
|
+
}, t.set(n.memoryId, l);
|
|
1717
1975
|
}
|
|
1718
|
-
|
|
1719
|
-
}),
|
|
1976
|
+
l.items.push({ item: n, flatIndex: i });
|
|
1977
|
+
}), r.map((n) => t.get(n));
|
|
1720
1978
|
}
|
|
1721
|
-
function
|
|
1979
|
+
function or({
|
|
1722
1980
|
items: e,
|
|
1723
|
-
onSearchResultClick:
|
|
1981
|
+
onSearchResultClick: r,
|
|
1724
1982
|
t
|
|
1725
1983
|
}) {
|
|
1726
|
-
const [
|
|
1984
|
+
const [n, i] = I(null), l = !!r;
|
|
1727
1985
|
return /* @__PURE__ */ o(
|
|
1728
1986
|
"div",
|
|
1729
1987
|
{
|
|
@@ -1735,25 +1993,25 @@ function rr({
|
|
|
1735
1993
|
paddingTop: 8,
|
|
1736
1994
|
borderTop: "1px solid #f0f0f0"
|
|
1737
1995
|
},
|
|
1738
|
-
children: e.map((
|
|
1739
|
-
const
|
|
1740
|
-
|
|
1741
|
-
),
|
|
1742
|
-
X(
|
|
1743
|
-
|
|
1744
|
-
n:
|
|
1996
|
+
children: e.map((a, s) => {
|
|
1997
|
+
const m = V(
|
|
1998
|
+
a.chunks
|
|
1999
|
+
), p = [
|
|
2000
|
+
X(a),
|
|
2001
|
+
S(t.scoreLabel, {
|
|
2002
|
+
n: a.matchingChunkScore.toFixed(2)
|
|
1745
2003
|
}),
|
|
1746
|
-
|
|
2004
|
+
m.length > 0 ? K(m, t) : t.pagesNotAvailable
|
|
1747
2005
|
].filter(
|
|
1748
2006
|
(g) => g != null && g !== ""
|
|
1749
|
-
),
|
|
1750
|
-
memoryId:
|
|
1751
|
-
memoryTitle:
|
|
1752
|
-
memoryTypeId:
|
|
1753
|
-
memoryTypeName:
|
|
1754
|
-
pageNumbers:
|
|
1755
|
-
},
|
|
1756
|
-
return /* @__PURE__ */
|
|
2007
|
+
), c = {
|
|
2008
|
+
memoryId: a.memoryId,
|
|
2009
|
+
memoryTitle: a.memoryTitle,
|
|
2010
|
+
memoryTypeId: a.memoryTypeId,
|
|
2011
|
+
memoryTypeName: a.memoryTypeName,
|
|
2012
|
+
pageNumbers: m
|
|
2013
|
+
}, d = `${a.memoryId}-${s}`, u = n === d;
|
|
2014
|
+
return /* @__PURE__ */ y(
|
|
1757
2015
|
"div",
|
|
1758
2016
|
{
|
|
1759
2017
|
style: {
|
|
@@ -1761,13 +2019,13 @@ function rr({
|
|
|
1761
2019
|
flexDirection: "row",
|
|
1762
2020
|
alignItems: "flex-start",
|
|
1763
2021
|
gap: "12px",
|
|
1764
|
-
paddingTop:
|
|
1765
|
-
paddingBottom:
|
|
1766
|
-
borderBottom:
|
|
2022
|
+
paddingTop: s > 0 ? 12 : 0,
|
|
2023
|
+
paddingBottom: s < e.length - 1 ? 12 : 0,
|
|
2024
|
+
borderBottom: s < e.length - 1 ? "1px solid #eee" : void 0,
|
|
1767
2025
|
minWidth: 0
|
|
1768
2026
|
},
|
|
1769
2027
|
children: [
|
|
1770
|
-
/* @__PURE__ */
|
|
2028
|
+
/* @__PURE__ */ y(
|
|
1771
2029
|
"div",
|
|
1772
2030
|
{
|
|
1773
2031
|
style: {
|
|
@@ -1788,7 +2046,7 @@ function rr({
|
|
|
1788
2046
|
whiteSpace: "pre-wrap",
|
|
1789
2047
|
wordBreak: "break-word"
|
|
1790
2048
|
},
|
|
1791
|
-
children:
|
|
2049
|
+
children: Q(a.chunks)
|
|
1792
2050
|
}
|
|
1793
2051
|
),
|
|
1794
2052
|
/* @__PURE__ */ o(
|
|
@@ -1800,26 +2058,26 @@ function rr({
|
|
|
1800
2058
|
color: "#94a3b8",
|
|
1801
2059
|
lineHeight: 1.35
|
|
1802
2060
|
},
|
|
1803
|
-
children:
|
|
2061
|
+
children: p.join(" · ")
|
|
1804
2062
|
}
|
|
1805
2063
|
)
|
|
1806
2064
|
]
|
|
1807
2065
|
}
|
|
1808
2066
|
),
|
|
1809
|
-
|
|
2067
|
+
l && /* @__PURE__ */ y(
|
|
1810
2068
|
"button",
|
|
1811
2069
|
{
|
|
1812
2070
|
type: "button",
|
|
1813
|
-
"aria-busy":
|
|
1814
|
-
disabled:
|
|
2071
|
+
"aria-busy": u,
|
|
2072
|
+
disabled: u,
|
|
1815
2073
|
onClick: async () => {
|
|
1816
|
-
|
|
2074
|
+
i(d);
|
|
1817
2075
|
try {
|
|
1818
|
-
await
|
|
1819
|
-
|
|
2076
|
+
await r(
|
|
2077
|
+
c
|
|
1820
2078
|
);
|
|
1821
2079
|
} finally {
|
|
1822
|
-
|
|
2080
|
+
i(null);
|
|
1823
2081
|
}
|
|
1824
2082
|
},
|
|
1825
2083
|
style: {
|
|
@@ -1832,14 +2090,14 @@ function rr({
|
|
|
1832
2090
|
background: "#eff6ff",
|
|
1833
2091
|
border: "1px solid #bfdbfe",
|
|
1834
2092
|
borderRadius: 6,
|
|
1835
|
-
cursor:
|
|
2093
|
+
cursor: u ? "wait" : "pointer",
|
|
1836
2094
|
fontFamily: "inherit",
|
|
1837
2095
|
display: "inline-flex",
|
|
1838
2096
|
alignItems: "center",
|
|
1839
2097
|
gap: 8
|
|
1840
2098
|
},
|
|
1841
2099
|
children: [
|
|
1842
|
-
|
|
2100
|
+
u && /* @__PURE__ */ o(
|
|
1843
2101
|
"span",
|
|
1844
2102
|
{
|
|
1845
2103
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
@@ -1852,22 +2110,22 @@ function rr({
|
|
|
1852
2110
|
)
|
|
1853
2111
|
]
|
|
1854
2112
|
},
|
|
1855
|
-
|
|
2113
|
+
d
|
|
1856
2114
|
);
|
|
1857
2115
|
})
|
|
1858
2116
|
}
|
|
1859
2117
|
);
|
|
1860
2118
|
}
|
|
1861
|
-
function
|
|
2119
|
+
function ir({
|
|
1862
2120
|
group: e,
|
|
1863
|
-
t:
|
|
2121
|
+
t: r,
|
|
1864
2122
|
expanded: t,
|
|
1865
|
-
onToggle:
|
|
1866
|
-
onSearchResultClick:
|
|
2123
|
+
onToggle: n,
|
|
2124
|
+
onSearchResultClick: i
|
|
1867
2125
|
}) {
|
|
1868
|
-
const
|
|
1869
|
-
return /* @__PURE__ */
|
|
1870
|
-
|
|
2126
|
+
const l = e.items.map((s) => s.item), a = l.some((s) => s.chunks.length > 0);
|
|
2127
|
+
return /* @__PURE__ */ y(
|
|
2128
|
+
C.div,
|
|
1871
2129
|
{
|
|
1872
2130
|
initial: { opacity: 0 },
|
|
1873
2131
|
animate: { opacity: 1 },
|
|
@@ -1897,7 +2155,7 @@ function nr({
|
|
|
1897
2155
|
children: /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 })
|
|
1898
2156
|
}
|
|
1899
2157
|
),
|
|
1900
|
-
/* @__PURE__ */
|
|
2158
|
+
/* @__PURE__ */ y(
|
|
1901
2159
|
"div",
|
|
1902
2160
|
{
|
|
1903
2161
|
style: {
|
|
@@ -1920,7 +2178,7 @@ function nr({
|
|
|
1920
2178
|
children: e.memoryTitle
|
|
1921
2179
|
}
|
|
1922
2180
|
),
|
|
1923
|
-
/* @__PURE__ */
|
|
2181
|
+
/* @__PURE__ */ y(
|
|
1924
2182
|
"div",
|
|
1925
2183
|
{
|
|
1926
2184
|
style: {
|
|
@@ -1940,14 +2198,14 @@ function nr({
|
|
|
1940
2198
|
color: "#666",
|
|
1941
2199
|
whiteSpace: "nowrap"
|
|
1942
2200
|
},
|
|
1943
|
-
children:
|
|
2201
|
+
children: nr(l, r)
|
|
1944
2202
|
}
|
|
1945
2203
|
),
|
|
1946
|
-
|
|
2204
|
+
a && /* @__PURE__ */ o(
|
|
1947
2205
|
"button",
|
|
1948
2206
|
{
|
|
1949
2207
|
type: "button",
|
|
1950
|
-
onClick:
|
|
2208
|
+
onClick: n,
|
|
1951
2209
|
style: {
|
|
1952
2210
|
border: "none",
|
|
1953
2211
|
background: "none",
|
|
@@ -1958,18 +2216,18 @@ function nr({
|
|
|
1958
2216
|
textDecoration: "underline",
|
|
1959
2217
|
fontFamily: "inherit"
|
|
1960
2218
|
},
|
|
1961
|
-
children: t ?
|
|
2219
|
+
children: t ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
1962
2220
|
}
|
|
1963
2221
|
)
|
|
1964
2222
|
]
|
|
1965
2223
|
}
|
|
1966
2224
|
),
|
|
1967
|
-
t &&
|
|
1968
|
-
|
|
2225
|
+
t && a && /* @__PURE__ */ o(
|
|
2226
|
+
or,
|
|
1969
2227
|
{
|
|
1970
|
-
items:
|
|
1971
|
-
onSearchResultClick:
|
|
1972
|
-
t:
|
|
2228
|
+
items: l,
|
|
2229
|
+
onSearchResultClick: i,
|
|
2230
|
+
t: r
|
|
1973
2231
|
}
|
|
1974
2232
|
)
|
|
1975
2233
|
]
|
|
@@ -1979,26 +2237,26 @@ function nr({
|
|
|
1979
2237
|
}
|
|
1980
2238
|
);
|
|
1981
2239
|
}
|
|
1982
|
-
function
|
|
1983
|
-
return e === 1 ?
|
|
2240
|
+
function ar(e, r) {
|
|
2241
|
+
return e === 1 ? r.chunkFound : S(r.chunksFound, { n: e });
|
|
1984
2242
|
}
|
|
1985
|
-
const
|
|
2243
|
+
const sr = ({
|
|
1986
2244
|
data: e,
|
|
1987
|
-
onSearchResultClick:
|
|
2245
|
+
onSearchResultClick: r,
|
|
1988
2246
|
t
|
|
1989
2247
|
}) => {
|
|
1990
|
-
const
|
|
1991
|
-
(
|
|
2248
|
+
const n = e.items, i = n.reduce(
|
|
2249
|
+
(u, g) => u + de(g),
|
|
1992
2250
|
0
|
|
1993
|
-
),
|
|
1994
|
-
|
|
2251
|
+
), l = new Set(n.map((u) => u.memoryId)).size, [a, s] = I({}), m = z((u) => {
|
|
2252
|
+
s((g) => ({
|
|
1995
2253
|
...g,
|
|
1996
|
-
[
|
|
2254
|
+
[u]: !g[u]
|
|
1997
2255
|
}));
|
|
1998
|
-
}, []),
|
|
1999
|
-
n:
|
|
2000
|
-
}),
|
|
2001
|
-
return
|
|
2256
|
+
}, []), p = P(() => tr(n), [n]), c = l === 1 ? t.memoryChatChunkResultsInOneMemory : S(t.memoryChatChunkResultsInMemories, {
|
|
2257
|
+
n: l
|
|
2258
|
+
}), d = `${ar(i, t)} ${c}`;
|
|
2259
|
+
return n.length === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
|
|
2002
2260
|
"div",
|
|
2003
2261
|
{
|
|
2004
2262
|
style: {
|
|
@@ -2008,17 +2266,17 @@ const or = ({
|
|
|
2008
2266
|
},
|
|
2009
2267
|
children: t.memorySearchExploreNoResults
|
|
2010
2268
|
}
|
|
2011
|
-
) }) : /* @__PURE__ */
|
|
2012
|
-
|
|
2013
|
-
|
|
2269
|
+
) }) : /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
2270
|
+
p.map((u) => /* @__PURE__ */ o(
|
|
2271
|
+
ir,
|
|
2014
2272
|
{
|
|
2015
|
-
group:
|
|
2273
|
+
group: u,
|
|
2016
2274
|
t,
|
|
2017
|
-
expanded:
|
|
2018
|
-
onToggle: () => u
|
|
2019
|
-
onSearchResultClick:
|
|
2275
|
+
expanded: a[u.memoryId] === !0,
|
|
2276
|
+
onToggle: () => m(u.memoryId),
|
|
2277
|
+
onSearchResultClick: r
|
|
2020
2278
|
},
|
|
2021
|
-
|
|
2279
|
+
u.memoryId
|
|
2022
2280
|
)),
|
|
2023
2281
|
/* @__PURE__ */ o(
|
|
2024
2282
|
"div",
|
|
@@ -2029,27 +2287,501 @@ const or = ({
|
|
|
2029
2287
|
marginTop: "4px",
|
|
2030
2288
|
fontStyle: "italic"
|
|
2031
2289
|
},
|
|
2032
|
-
children:
|
|
2290
|
+
children: d
|
|
2291
|
+
}
|
|
2292
|
+
)
|
|
2293
|
+
] });
|
|
2294
|
+
}, lr = ({
|
|
2295
|
+
data: e,
|
|
2296
|
+
isLatest: r = !1,
|
|
2297
|
+
durationSeconds: t,
|
|
2298
|
+
t: n
|
|
2299
|
+
}) => {
|
|
2300
|
+
const i = e.countryCode != null && e.countryCode !== "" ? S(n.googleSearchingForWithCountry, {
|
|
2301
|
+
query: e.query,
|
|
2302
|
+
country: e.countryCode
|
|
2303
|
+
}) : S(n.googleSearchingFor, {
|
|
2304
|
+
query: e.query
|
|
2305
|
+
});
|
|
2306
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
2307
|
+
/* @__PURE__ */ o(
|
|
2308
|
+
C.div,
|
|
2309
|
+
{
|
|
2310
|
+
style: { color: "#666" },
|
|
2311
|
+
initial: { opacity: 0, y: -10 },
|
|
2312
|
+
animate: { opacity: 1, y: 0 },
|
|
2313
|
+
transition: { duration: 0.3, delay: 0 },
|
|
2314
|
+
children: r && !t ? /* @__PURE__ */ o(
|
|
2315
|
+
M,
|
|
2316
|
+
{
|
|
2317
|
+
text: i,
|
|
2318
|
+
duration: 2.5,
|
|
2319
|
+
repeat: !0,
|
|
2320
|
+
color: "#999",
|
|
2321
|
+
shimmerColor: "#000"
|
|
2322
|
+
}
|
|
2323
|
+
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: i })
|
|
2324
|
+
}
|
|
2325
|
+
),
|
|
2326
|
+
t !== void 0 && /* @__PURE__ */ o(
|
|
2327
|
+
"div",
|
|
2328
|
+
{
|
|
2329
|
+
style: {
|
|
2330
|
+
fontSize: "12px",
|
|
2331
|
+
color: "#999",
|
|
2332
|
+
marginTop: "4px",
|
|
2333
|
+
fontStyle: "italic"
|
|
2334
|
+
},
|
|
2335
|
+
children: S(n.tookSeconds, { n: t })
|
|
2336
|
+
}
|
|
2337
|
+
)
|
|
2338
|
+
] });
|
|
2339
|
+
}, oe = 80;
|
|
2340
|
+
function cr(e) {
|
|
2341
|
+
try {
|
|
2342
|
+
return new URL(e).hostname;
|
|
2343
|
+
} catch {
|
|
2344
|
+
return e;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
function dr({
|
|
2348
|
+
item: e,
|
|
2349
|
+
t: r
|
|
2350
|
+
}) {
|
|
2351
|
+
const [t, n] = I(!1), i = e.description ?? "", l = i.length > oe, a = i.length === 0 ? void 0 : t || !l ? i : `${i.slice(0, oe)}...`;
|
|
2352
|
+
return /* @__PURE__ */ y(
|
|
2353
|
+
"div",
|
|
2354
|
+
{
|
|
2355
|
+
style: {
|
|
2356
|
+
display: "flex",
|
|
2357
|
+
flexDirection: "column",
|
|
2358
|
+
gap: "6px",
|
|
2359
|
+
minWidth: 0
|
|
2360
|
+
},
|
|
2361
|
+
children: [
|
|
2362
|
+
/* @__PURE__ */ o(
|
|
2363
|
+
"a",
|
|
2364
|
+
{
|
|
2365
|
+
href: e.link,
|
|
2366
|
+
target: "_blank",
|
|
2367
|
+
rel: "noopener noreferrer",
|
|
2368
|
+
style: {
|
|
2369
|
+
fontSize: 13,
|
|
2370
|
+
fontWeight: 600,
|
|
2371
|
+
color: "#1f2937",
|
|
2372
|
+
textDecoration: "none",
|
|
2373
|
+
wordBreak: "break-word"
|
|
2374
|
+
},
|
|
2375
|
+
onMouseEnter: (s) => {
|
|
2376
|
+
s.currentTarget.style.color = "#2563eb";
|
|
2377
|
+
},
|
|
2378
|
+
onMouseLeave: (s) => {
|
|
2379
|
+
s.currentTarget.style.color = "#1f2937";
|
|
2380
|
+
},
|
|
2381
|
+
children: e.title
|
|
2382
|
+
}
|
|
2383
|
+
),
|
|
2384
|
+
/* @__PURE__ */ y(
|
|
2385
|
+
"span",
|
|
2386
|
+
{
|
|
2387
|
+
style: {
|
|
2388
|
+
fontSize: 11,
|
|
2389
|
+
color: "#94a3b8",
|
|
2390
|
+
lineHeight: 1.35
|
|
2391
|
+
},
|
|
2392
|
+
children: [
|
|
2393
|
+
e.rank,
|
|
2394
|
+
". ",
|
|
2395
|
+
cr(e.link)
|
|
2396
|
+
]
|
|
2397
|
+
}
|
|
2398
|
+
),
|
|
2399
|
+
a != null && /* @__PURE__ */ y(E, { children: [
|
|
2400
|
+
/* @__PURE__ */ o(
|
|
2401
|
+
"span",
|
|
2402
|
+
{
|
|
2403
|
+
onClick: l ? () => n((s) => !s) : void 0,
|
|
2404
|
+
style: {
|
|
2405
|
+
fontSize: 13,
|
|
2406
|
+
color: "#666",
|
|
2407
|
+
lineHeight: 1.5,
|
|
2408
|
+
whiteSpace: t ? "pre-wrap" : void 0,
|
|
2409
|
+
wordBreak: "break-word",
|
|
2410
|
+
cursor: l ? "pointer" : "default"
|
|
2411
|
+
},
|
|
2412
|
+
children: a
|
|
2413
|
+
}
|
|
2414
|
+
),
|
|
2415
|
+
l && /* @__PURE__ */ o(
|
|
2416
|
+
"span",
|
|
2417
|
+
{
|
|
2418
|
+
style: {
|
|
2419
|
+
fontSize: 11,
|
|
2420
|
+
color: "#999",
|
|
2421
|
+
marginTop: 2
|
|
2422
|
+
},
|
|
2423
|
+
children: t ? r.clickToCollapse : r.clickToExpand
|
|
2424
|
+
}
|
|
2425
|
+
)
|
|
2426
|
+
] })
|
|
2427
|
+
]
|
|
2428
|
+
}
|
|
2429
|
+
);
|
|
2430
|
+
}
|
|
2431
|
+
const ur = ({ data: e, t: r }) => {
|
|
2432
|
+
const [t, n] = I(!1), i = P(
|
|
2433
|
+
() => [...e.items].sort((s, m) => s.rank - m.rank),
|
|
2434
|
+
[e.items]
|
|
2435
|
+
), l = i.length, a = l === 1 ? r.googleResultFound : S(r.googleResultsFound, { n: l });
|
|
2436
|
+
return l === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
|
|
2437
|
+
"div",
|
|
2438
|
+
{
|
|
2439
|
+
style: {
|
|
2440
|
+
fontSize: 12,
|
|
2441
|
+
color: "#94a3b8",
|
|
2442
|
+
paddingTop: 4
|
|
2443
|
+
},
|
|
2444
|
+
children: r.memorySearchExploreNoResults
|
|
2445
|
+
}
|
|
2446
|
+
) }) : /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
2447
|
+
/* @__PURE__ */ y(
|
|
2448
|
+
C.div,
|
|
2449
|
+
{
|
|
2450
|
+
initial: { opacity: 0 },
|
|
2451
|
+
animate: { opacity: 1 },
|
|
2452
|
+
transition: { duration: 0.25 },
|
|
2453
|
+
style: {
|
|
2454
|
+
display: "flex",
|
|
2455
|
+
flexDirection: "row",
|
|
2456
|
+
flexWrap: "wrap",
|
|
2457
|
+
alignItems: "baseline",
|
|
2458
|
+
gap: "6px 12px",
|
|
2459
|
+
minWidth: 0
|
|
2460
|
+
},
|
|
2461
|
+
children: [
|
|
2462
|
+
/* @__PURE__ */ o(
|
|
2463
|
+
"span",
|
|
2464
|
+
{
|
|
2465
|
+
style: {
|
|
2466
|
+
fontSize: 12,
|
|
2467
|
+
color: "#666",
|
|
2468
|
+
whiteSpace: "nowrap"
|
|
2469
|
+
},
|
|
2470
|
+
children: a
|
|
2471
|
+
}
|
|
2472
|
+
),
|
|
2473
|
+
/* @__PURE__ */ o(
|
|
2474
|
+
"button",
|
|
2475
|
+
{
|
|
2476
|
+
type: "button",
|
|
2477
|
+
onClick: () => n((s) => !s),
|
|
2478
|
+
style: {
|
|
2479
|
+
border: "none",
|
|
2480
|
+
background: "none",
|
|
2481
|
+
padding: 0,
|
|
2482
|
+
cursor: "pointer",
|
|
2483
|
+
fontSize: 12,
|
|
2484
|
+
color: "#666",
|
|
2485
|
+
textDecoration: "underline",
|
|
2486
|
+
fontFamily: "inherit"
|
|
2487
|
+
},
|
|
2488
|
+
children: t ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2489
|
+
}
|
|
2490
|
+
)
|
|
2491
|
+
]
|
|
2492
|
+
}
|
|
2493
|
+
),
|
|
2494
|
+
t && /* @__PURE__ */ o(
|
|
2495
|
+
"div",
|
|
2496
|
+
{
|
|
2497
|
+
style: {
|
|
2498
|
+
display: "flex",
|
|
2499
|
+
flexDirection: "column",
|
|
2500
|
+
gap: 0,
|
|
2501
|
+
marginTop: 8,
|
|
2502
|
+
paddingTop: 8,
|
|
2503
|
+
borderTop: "1px solid #f0f0f0"
|
|
2504
|
+
},
|
|
2505
|
+
children: i.map((s, m) => /* @__PURE__ */ o(
|
|
2506
|
+
"div",
|
|
2507
|
+
{
|
|
2508
|
+
style: {
|
|
2509
|
+
paddingTop: m > 0 ? 12 : 0,
|
|
2510
|
+
paddingBottom: m < i.length - 1 ? 12 : 0,
|
|
2511
|
+
borderBottom: m < i.length - 1 ? "1px solid #eee" : void 0,
|
|
2512
|
+
minWidth: 0
|
|
2513
|
+
},
|
|
2514
|
+
children: /* @__PURE__ */ o(dr, { item: s, t: r })
|
|
2515
|
+
},
|
|
2516
|
+
`${s.link}-${s.rank}-${m}`
|
|
2517
|
+
))
|
|
2518
|
+
}
|
|
2519
|
+
)
|
|
2520
|
+
] });
|
|
2521
|
+
}, mr = ({
|
|
2522
|
+
data: e,
|
|
2523
|
+
isLatest: r = !1,
|
|
2524
|
+
durationSeconds: t,
|
|
2525
|
+
t: n
|
|
2526
|
+
}) => {
|
|
2527
|
+
const i = e.urls.length, l = i === 1 ? S(n.scrapingPage, { query: e.query }) : S(n.scrapingPages, { n: i, query: e.query });
|
|
2528
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
2529
|
+
/* @__PURE__ */ o(
|
|
2530
|
+
C.div,
|
|
2531
|
+
{
|
|
2532
|
+
style: { color: "#666" },
|
|
2533
|
+
initial: { opacity: 0, y: -10 },
|
|
2534
|
+
animate: { opacity: 1, y: 0 },
|
|
2535
|
+
transition: { duration: 0.3, delay: 0 },
|
|
2536
|
+
children: r && !t ? /* @__PURE__ */ o(
|
|
2537
|
+
M,
|
|
2538
|
+
{
|
|
2539
|
+
text: l,
|
|
2540
|
+
duration: 2.5,
|
|
2541
|
+
repeat: !0,
|
|
2542
|
+
color: "#999",
|
|
2543
|
+
shimmerColor: "#000"
|
|
2544
|
+
}
|
|
2545
|
+
) : /* @__PURE__ */ o("span", { style: { color: "#666" }, children: l })
|
|
2546
|
+
}
|
|
2547
|
+
),
|
|
2548
|
+
t !== void 0 && /* @__PURE__ */ o(
|
|
2549
|
+
"div",
|
|
2550
|
+
{
|
|
2551
|
+
style: {
|
|
2552
|
+
fontSize: "12px",
|
|
2553
|
+
color: "#999",
|
|
2554
|
+
marginTop: "4px",
|
|
2555
|
+
fontStyle: "italic"
|
|
2556
|
+
},
|
|
2557
|
+
children: S(n.tookSeconds, { n: t })
|
|
2558
|
+
}
|
|
2559
|
+
)
|
|
2560
|
+
] });
|
|
2561
|
+
}, ie = 80;
|
|
2562
|
+
function pr(e, r = 48) {
|
|
2563
|
+
try {
|
|
2564
|
+
const t = new URL(e), n = t.pathname.length > r ? `${t.pathname.slice(0, r)}…` : t.pathname, i = n === "/" ? "" : n;
|
|
2565
|
+
return `${t.hostname}${i}${t.search ? "…" : ""}`;
|
|
2566
|
+
} catch {
|
|
2567
|
+
return e.length > 64 ? `${e.slice(0, 64)}…` : e;
|
|
2568
|
+
}
|
|
2569
|
+
}
|
|
2570
|
+
function yr({ item: e }) {
|
|
2571
|
+
return e.error != null ? /* @__PURE__ */ o(H, { color: "#c62828", size: 15, lineWidth: 2 }) : e.summary != null && e.summary !== "" ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
|
|
2572
|
+
}
|
|
2573
|
+
function gr({
|
|
2574
|
+
item: e,
|
|
2575
|
+
t: r
|
|
2576
|
+
}) {
|
|
2577
|
+
const [t, n] = I(!1), i = e.error ?? e.summary ?? "", l = e.error != null, a = i.length > ie, s = i.length === 0 ? void 0 : t || !a ? i : `${i.slice(0, ie)}...`;
|
|
2578
|
+
return /* @__PURE__ */ y(
|
|
2579
|
+
C.div,
|
|
2580
|
+
{
|
|
2581
|
+
initial: { opacity: 0 },
|
|
2582
|
+
animate: { opacity: 1 },
|
|
2583
|
+
transition: { duration: 0.25 },
|
|
2584
|
+
style: {
|
|
2585
|
+
display: "flex",
|
|
2586
|
+
flexDirection: "row",
|
|
2587
|
+
alignItems: "flex-start",
|
|
2588
|
+
gap: "10px",
|
|
2589
|
+
minWidth: 0
|
|
2590
|
+
},
|
|
2591
|
+
children: [
|
|
2592
|
+
/* @__PURE__ */ o(
|
|
2593
|
+
"div",
|
|
2594
|
+
{
|
|
2595
|
+
style: {
|
|
2596
|
+
display: "flex",
|
|
2597
|
+
alignItems: "center",
|
|
2598
|
+
justifyContent: "center",
|
|
2599
|
+
flexShrink: 0,
|
|
2600
|
+
width: 32,
|
|
2601
|
+
paddingTop: 2
|
|
2602
|
+
},
|
|
2603
|
+
children: /* @__PURE__ */ o(yr, { item: e })
|
|
2604
|
+
}
|
|
2605
|
+
),
|
|
2606
|
+
/* @__PURE__ */ y(
|
|
2607
|
+
"div",
|
|
2608
|
+
{
|
|
2609
|
+
style: {
|
|
2610
|
+
display: "flex",
|
|
2611
|
+
flexDirection: "column",
|
|
2612
|
+
gap: "4px",
|
|
2613
|
+
minWidth: 0,
|
|
2614
|
+
flex: 1
|
|
2615
|
+
},
|
|
2616
|
+
children: [
|
|
2617
|
+
/* @__PURE__ */ o(
|
|
2618
|
+
"a",
|
|
2619
|
+
{
|
|
2620
|
+
href: e.url,
|
|
2621
|
+
target: "_blank",
|
|
2622
|
+
rel: "noopener noreferrer",
|
|
2623
|
+
style: {
|
|
2624
|
+
fontSize: 13,
|
|
2625
|
+
fontWeight: 500,
|
|
2626
|
+
color: "#2563eb",
|
|
2627
|
+
textDecoration: "none",
|
|
2628
|
+
wordBreak: "break-all"
|
|
2629
|
+
},
|
|
2630
|
+
onMouseEnter: (m) => {
|
|
2631
|
+
m.currentTarget.style.textDecoration = "underline";
|
|
2632
|
+
},
|
|
2633
|
+
onMouseLeave: (m) => {
|
|
2634
|
+
m.currentTarget.style.textDecoration = "none";
|
|
2635
|
+
},
|
|
2636
|
+
children: pr(e.url)
|
|
2637
|
+
}
|
|
2638
|
+
),
|
|
2639
|
+
s != null && /* @__PURE__ */ y(E, { children: [
|
|
2640
|
+
/* @__PURE__ */ o(
|
|
2641
|
+
"span",
|
|
2642
|
+
{
|
|
2643
|
+
onClick: a ? () => n((m) => !m) : void 0,
|
|
2644
|
+
style: {
|
|
2645
|
+
fontSize: 12,
|
|
2646
|
+
color: l ? "#c62828" : "#666",
|
|
2647
|
+
lineHeight: 1.4,
|
|
2648
|
+
whiteSpace: t ? "pre-wrap" : void 0,
|
|
2649
|
+
wordBreak: "break-word",
|
|
2650
|
+
cursor: a ? "pointer" : "default"
|
|
2651
|
+
},
|
|
2652
|
+
children: s
|
|
2653
|
+
}
|
|
2654
|
+
),
|
|
2655
|
+
a && /* @__PURE__ */ o(
|
|
2656
|
+
"span",
|
|
2657
|
+
{
|
|
2658
|
+
style: {
|
|
2659
|
+
fontSize: 11,
|
|
2660
|
+
color: "#999",
|
|
2661
|
+
marginTop: 2
|
|
2662
|
+
},
|
|
2663
|
+
children: t ? r.clickToCollapse : r.clickToExpand
|
|
2664
|
+
}
|
|
2665
|
+
)
|
|
2666
|
+
] })
|
|
2667
|
+
]
|
|
2668
|
+
}
|
|
2669
|
+
)
|
|
2670
|
+
]
|
|
2671
|
+
}
|
|
2672
|
+
);
|
|
2673
|
+
}
|
|
2674
|
+
const hr = ({
|
|
2675
|
+
data: e,
|
|
2676
|
+
t: r
|
|
2677
|
+
}) => {
|
|
2678
|
+
const [t, n] = I(!1), i = e.items, { successCount: l, errorCount: a } = P(() => {
|
|
2679
|
+
let d = 0, u = 0;
|
|
2680
|
+
for (const g of i)
|
|
2681
|
+
g.error != null ? u += 1 : d += 1;
|
|
2682
|
+
return { successCount: d, errorCount: u };
|
|
2683
|
+
}, [i]), s = i.length, m = s === 1 ? r.scrapedPage : S(r.scrapedPages, { n: s }), p = S(r.scrapeOkCount, { n: l }), c = a > 0 ? `${m} - ${p}, ${S(r.scrapeFailedCount, { n: a })}` : `${m} - ${p}`;
|
|
2684
|
+
return s === 0 ? /* @__PURE__ */ o("div", { style: { padding: "10px" }, children: /* @__PURE__ */ o(
|
|
2685
|
+
"div",
|
|
2686
|
+
{
|
|
2687
|
+
style: {
|
|
2688
|
+
fontSize: 12,
|
|
2689
|
+
color: "#94a3b8",
|
|
2690
|
+
paddingTop: 4
|
|
2691
|
+
},
|
|
2692
|
+
children: r.memorySearchExploreNoResults
|
|
2693
|
+
}
|
|
2694
|
+
) }) : /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
2695
|
+
/* @__PURE__ */ y(
|
|
2696
|
+
C.div,
|
|
2697
|
+
{
|
|
2698
|
+
initial: { opacity: 0 },
|
|
2699
|
+
animate: { opacity: 1 },
|
|
2700
|
+
transition: { duration: 0.25 },
|
|
2701
|
+
style: {
|
|
2702
|
+
display: "flex",
|
|
2703
|
+
flexDirection: "row",
|
|
2704
|
+
flexWrap: "wrap",
|
|
2705
|
+
alignItems: "baseline",
|
|
2706
|
+
gap: "6px 12px",
|
|
2707
|
+
minWidth: 0
|
|
2708
|
+
},
|
|
2709
|
+
children: [
|
|
2710
|
+
/* @__PURE__ */ o(
|
|
2711
|
+
"span",
|
|
2712
|
+
{
|
|
2713
|
+
style: {
|
|
2714
|
+
fontSize: 12,
|
|
2715
|
+
color: "#666"
|
|
2716
|
+
},
|
|
2717
|
+
children: c
|
|
2718
|
+
}
|
|
2719
|
+
),
|
|
2720
|
+
/* @__PURE__ */ o(
|
|
2721
|
+
"button",
|
|
2722
|
+
{
|
|
2723
|
+
type: "button",
|
|
2724
|
+
onClick: () => n((d) => !d),
|
|
2725
|
+
style: {
|
|
2726
|
+
border: "none",
|
|
2727
|
+
background: "none",
|
|
2728
|
+
padding: 0,
|
|
2729
|
+
cursor: "pointer",
|
|
2730
|
+
fontSize: 12,
|
|
2731
|
+
color: "#666",
|
|
2732
|
+
textDecoration: "underline",
|
|
2733
|
+
fontFamily: "inherit"
|
|
2734
|
+
},
|
|
2735
|
+
children: t ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2736
|
+
}
|
|
2737
|
+
)
|
|
2738
|
+
]
|
|
2739
|
+
}
|
|
2740
|
+
),
|
|
2741
|
+
t && /* @__PURE__ */ o(
|
|
2742
|
+
"div",
|
|
2743
|
+
{
|
|
2744
|
+
style: {
|
|
2745
|
+
display: "flex",
|
|
2746
|
+
flexDirection: "column",
|
|
2747
|
+
gap: 0,
|
|
2748
|
+
marginTop: 8,
|
|
2749
|
+
paddingTop: 8,
|
|
2750
|
+
borderTop: "1px solid #f0f0f0"
|
|
2751
|
+
},
|
|
2752
|
+
children: i.map((d, u) => /* @__PURE__ */ o(
|
|
2753
|
+
"div",
|
|
2754
|
+
{
|
|
2755
|
+
style: {
|
|
2756
|
+
paddingTop: u > 0 ? 12 : 0,
|
|
2757
|
+
paddingBottom: u < i.length - 1 ? 12 : 0,
|
|
2758
|
+
borderBottom: u < i.length - 1 ? "1px solid #eee" : void 0,
|
|
2759
|
+
minWidth: 0
|
|
2760
|
+
},
|
|
2761
|
+
children: /* @__PURE__ */ o(gr, { item: d, t: r })
|
|
2762
|
+
},
|
|
2763
|
+
`${d.url}-${u}`
|
|
2764
|
+
))
|
|
2033
2765
|
}
|
|
2034
2766
|
)
|
|
2035
2767
|
] });
|
|
2036
2768
|
};
|
|
2037
|
-
function
|
|
2038
|
-
return e.error != null ? /* @__PURE__ */ o(
|
|
2769
|
+
function fr({ item: e }) {
|
|
2770
|
+
return e.error != null ? /* @__PURE__ */ o(H, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
2039
2771
|
}
|
|
2040
|
-
function
|
|
2041
|
-
return
|
|
2772
|
+
function Sr(e, r) {
|
|
2773
|
+
return S(r.searchingInMemoriesOfType, {
|
|
2042
2774
|
name: e.memoryTypeName
|
|
2043
2775
|
});
|
|
2044
2776
|
}
|
|
2045
|
-
function
|
|
2777
|
+
function xr({
|
|
2046
2778
|
item: e,
|
|
2047
|
-
t:
|
|
2779
|
+
t: r,
|
|
2048
2780
|
showShimmerForPrimary: t
|
|
2049
2781
|
}) {
|
|
2050
|
-
const
|
|
2051
|
-
return /* @__PURE__ */
|
|
2052
|
-
|
|
2782
|
+
const n = e.result != null, i = e.error != null, l = Sr(e, r);
|
|
2783
|
+
return /* @__PURE__ */ y(
|
|
2784
|
+
C.div,
|
|
2053
2785
|
{
|
|
2054
2786
|
initial: { opacity: 0 },
|
|
2055
2787
|
animate: { opacity: 1 },
|
|
@@ -2075,10 +2807,10 @@ function sr({
|
|
|
2075
2807
|
flexShrink: 0,
|
|
2076
2808
|
width: 32
|
|
2077
2809
|
},
|
|
2078
|
-
children: /* @__PURE__ */ o(
|
|
2810
|
+
children: /* @__PURE__ */ o(fr, { item: e })
|
|
2079
2811
|
}
|
|
2080
2812
|
),
|
|
2081
|
-
/* @__PURE__ */
|
|
2813
|
+
/* @__PURE__ */ y(
|
|
2082
2814
|
"div",
|
|
2083
2815
|
{
|
|
2084
2816
|
style: {
|
|
@@ -2089,25 +2821,25 @@ function sr({
|
|
|
2089
2821
|
flex: 1
|
|
2090
2822
|
},
|
|
2091
2823
|
children: [
|
|
2092
|
-
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !
|
|
2824
|
+
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !i && t ? /* @__PURE__ */ o(
|
|
2093
2825
|
M,
|
|
2094
2826
|
{
|
|
2095
|
-
text:
|
|
2827
|
+
text: l,
|
|
2096
2828
|
duration: 2.5,
|
|
2097
2829
|
repeat: !0,
|
|
2098
2830
|
color: "#999",
|
|
2099
2831
|
shimmerColor: "#000"
|
|
2100
2832
|
}
|
|
2101
|
-
) :
|
|
2102
|
-
|
|
2103
|
-
|
|
2833
|
+
) : l }),
|
|
2834
|
+
n && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? S(
|
|
2835
|
+
r.memorySearchTypeResultSummaryOne,
|
|
2104
2836
|
{
|
|
2105
2837
|
score: e.result.highestChunkScore.toFixed(
|
|
2106
2838
|
2
|
|
2107
2839
|
)
|
|
2108
2840
|
}
|
|
2109
|
-
) :
|
|
2110
|
-
|
|
2841
|
+
) : S(
|
|
2842
|
+
r.memorySearchTypeResultSummary,
|
|
2111
2843
|
{
|
|
2112
2844
|
count: e.result.numberOfChunks,
|
|
2113
2845
|
score: e.result.highestChunkScore.toFixed(
|
|
@@ -2115,7 +2847,7 @@ function sr({
|
|
|
2115
2847
|
)
|
|
2116
2848
|
}
|
|
2117
2849
|
) }),
|
|
2118
|
-
|
|
2850
|
+
i && /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828" }, children: e.error })
|
|
2119
2851
|
]
|
|
2120
2852
|
}
|
|
2121
2853
|
)
|
|
@@ -2123,31 +2855,31 @@ function sr({
|
|
|
2123
2855
|
}
|
|
2124
2856
|
);
|
|
2125
2857
|
}
|
|
2126
|
-
const
|
|
2127
|
-
const
|
|
2128
|
-
let
|
|
2129
|
-
return e.memoryTypes.forEach((
|
|
2130
|
-
|
|
2131
|
-
}),
|
|
2858
|
+
const kr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
2859
|
+
const i = P(() => {
|
|
2860
|
+
let l = -1;
|
|
2861
|
+
return e.memoryTypes.forEach((a, s) => {
|
|
2862
|
+
a.result == null && a.error == null && (l = s);
|
|
2863
|
+
}), l;
|
|
2132
2864
|
}, [e.memoryTypes]);
|
|
2133
|
-
return /* @__PURE__ */
|
|
2134
|
-
|
|
2865
|
+
return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
2866
|
+
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
|
|
2135
2867
|
M,
|
|
2136
2868
|
{
|
|
2137
|
-
text:
|
|
2869
|
+
text: n.searchingMemoryTypes,
|
|
2138
2870
|
duration: 2.5,
|
|
2139
2871
|
repeat: !0,
|
|
2140
2872
|
color: "#999",
|
|
2141
2873
|
shimmerColor: "#000"
|
|
2142
2874
|
}
|
|
2143
|
-
) : e.memoryTypes.map((
|
|
2144
|
-
|
|
2875
|
+
) : e.memoryTypes.map((l, a) => /* @__PURE__ */ o(
|
|
2876
|
+
xr,
|
|
2145
2877
|
{
|
|
2146
|
-
item:
|
|
2147
|
-
t:
|
|
2148
|
-
showShimmerForPrimary:
|
|
2878
|
+
item: l,
|
|
2879
|
+
t: n,
|
|
2880
|
+
showShimmerForPrimary: a === i && r
|
|
2149
2881
|
},
|
|
2150
|
-
|
|
2882
|
+
l.memoryTypeId
|
|
2151
2883
|
)),
|
|
2152
2884
|
t !== void 0 && /* @__PURE__ */ o(
|
|
2153
2885
|
"div",
|
|
@@ -2158,45 +2890,45 @@ const lr = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
2158
2890
|
marginTop: "4px",
|
|
2159
2891
|
fontStyle: "italic"
|
|
2160
2892
|
},
|
|
2161
|
-
children:
|
|
2893
|
+
children: S(n.tookSeconds, { n: t })
|
|
2162
2894
|
}
|
|
2163
2895
|
)
|
|
2164
2896
|
] });
|
|
2165
|
-
},
|
|
2166
|
-
|
|
2167
|
-
),
|
|
2168
|
-
5 *
|
|
2897
|
+
}, $ = 12, N = 1.45, br = Math.ceil(
|
|
2898
|
+
$ * N
|
|
2899
|
+
), vr = Math.ceil(
|
|
2900
|
+
5 * $ * N
|
|
2169
2901
|
);
|
|
2170
|
-
function
|
|
2902
|
+
function B(e) {
|
|
2171
2903
|
return e.queries != null && e.queries.length > 0;
|
|
2172
2904
|
}
|
|
2173
|
-
function
|
|
2174
|
-
const
|
|
2175
|
-
return (
|
|
2905
|
+
function Tr(e) {
|
|
2906
|
+
const r = e.reasoning;
|
|
2907
|
+
return (r == null || r === "") && !B(e);
|
|
2176
2908
|
}
|
|
2177
|
-
function
|
|
2178
|
-
if (
|
|
2179
|
-
const
|
|
2180
|
-
return
|
|
2909
|
+
function wr(e) {
|
|
2910
|
+
if (B(e)) return 3;
|
|
2911
|
+
const r = e.reasoning;
|
|
2912
|
+
return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
|
|
2181
2913
|
}
|
|
2182
|
-
function
|
|
2914
|
+
function Cr({ phase: e }) {
|
|
2183
2915
|
return e === 3 ? /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ o("span", { className: "explore-memory-loader" });
|
|
2184
2916
|
}
|
|
2185
|
-
function
|
|
2917
|
+
function Ir({
|
|
2186
2918
|
item: e,
|
|
2187
|
-
t:
|
|
2919
|
+
t: r,
|
|
2188
2920
|
isActiveRow: t
|
|
2189
2921
|
}) {
|
|
2190
|
-
const
|
|
2191
|
-
|
|
2192
|
-
const h =
|
|
2193
|
-
h != null &&
|
|
2194
|
-
}, [
|
|
2195
|
-
const
|
|
2922
|
+
const n = Tr(e), i = wr(e), l = e.reasoning, a = l != null && l.length > 0, s = A(null), [m, p] = I(!1), c = n && t, d = i === 2 && t && !B(e);
|
|
2923
|
+
F(() => {
|
|
2924
|
+
const h = s.current;
|
|
2925
|
+
h != null && i === 1 && a && (h.scrollTop = h.scrollHeight);
|
|
2926
|
+
}, [l, i, a]);
|
|
2927
|
+
const u = S(r.searchingInMemoriesOfType, {
|
|
2196
2928
|
name: e.memoryTypeName
|
|
2197
|
-
}), g = !
|
|
2198
|
-
return /* @__PURE__ */
|
|
2199
|
-
|
|
2929
|
+
}), g = !n && i === 3;
|
|
2930
|
+
return /* @__PURE__ */ y(
|
|
2931
|
+
C.div,
|
|
2200
2932
|
{
|
|
2201
2933
|
initial: { opacity: 0 },
|
|
2202
2934
|
animate: { opacity: 1 },
|
|
@@ -2223,10 +2955,10 @@ function gr({
|
|
|
2223
2955
|
width: 32,
|
|
2224
2956
|
...g ? { paddingTop: 2 } : {}
|
|
2225
2957
|
},
|
|
2226
|
-
children: /* @__PURE__ */ o(
|
|
2958
|
+
children: /* @__PURE__ */ o(Cr, { phase: n ? 1 : i })
|
|
2227
2959
|
}
|
|
2228
2960
|
),
|
|
2229
|
-
/* @__PURE__ */
|
|
2961
|
+
/* @__PURE__ */ y(
|
|
2230
2962
|
"div",
|
|
2231
2963
|
{
|
|
2232
2964
|
style: {
|
|
@@ -2237,17 +2969,17 @@ function gr({
|
|
|
2237
2969
|
flex: 1
|
|
2238
2970
|
},
|
|
2239
2971
|
children: [
|
|
2240
|
-
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children:
|
|
2972
|
+
/* @__PURE__ */ o("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: c ? /* @__PURE__ */ o(
|
|
2241
2973
|
M,
|
|
2242
2974
|
{
|
|
2243
|
-
text:
|
|
2975
|
+
text: u,
|
|
2244
2976
|
duration: 2.5,
|
|
2245
2977
|
repeat: !0,
|
|
2246
2978
|
color: "#999",
|
|
2247
2979
|
shimmerColor: "#000"
|
|
2248
2980
|
}
|
|
2249
2981
|
) : e.memoryTypeName }),
|
|
2250
|
-
|
|
2982
|
+
i === 1 && a && !B(e) && /* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
|
|
2251
2983
|
/* @__PURE__ */ o(
|
|
2252
2984
|
"span",
|
|
2253
2985
|
{
|
|
@@ -2258,7 +2990,7 @@ function gr({
|
|
|
2258
2990
|
marginBottom: 4,
|
|
2259
2991
|
fontWeight: 500
|
|
2260
2992
|
},
|
|
2261
|
-
children:
|
|
2993
|
+
children: r.memorySearchQueryReasoningLabel
|
|
2262
2994
|
}
|
|
2263
2995
|
),
|
|
2264
2996
|
/* @__PURE__ */ o(
|
|
@@ -2273,38 +3005,38 @@ function gr({
|
|
|
2273
3005
|
children: /* @__PURE__ */ o(
|
|
2274
3006
|
"div",
|
|
2275
3007
|
{
|
|
2276
|
-
ref:
|
|
3008
|
+
ref: s,
|
|
2277
3009
|
className: "memory-search-generating-reasoning-viewport",
|
|
2278
3010
|
style: {
|
|
2279
|
-
minHeight:
|
|
2280
|
-
maxHeight:
|
|
3011
|
+
minHeight: br,
|
|
3012
|
+
maxHeight: vr,
|
|
2281
3013
|
height: "auto",
|
|
2282
3014
|
overflowY: "auto",
|
|
2283
3015
|
overflowX: "hidden",
|
|
2284
|
-
fontSize:
|
|
2285
|
-
lineHeight:
|
|
3016
|
+
fontSize: $,
|
|
3017
|
+
lineHeight: N,
|
|
2286
3018
|
whiteSpace: "pre-wrap",
|
|
2287
3019
|
wordBreak: "break-word",
|
|
2288
3020
|
color: "#888"
|
|
2289
3021
|
},
|
|
2290
|
-
children:
|
|
3022
|
+
children: l
|
|
2291
3023
|
}
|
|
2292
3024
|
)
|
|
2293
3025
|
}
|
|
2294
3026
|
)
|
|
2295
3027
|
] }),
|
|
2296
|
-
|
|
3028
|
+
i === 2 && d && /* @__PURE__ */ o("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ o(
|
|
2297
3029
|
M,
|
|
2298
3030
|
{
|
|
2299
|
-
text:
|
|
3031
|
+
text: r.memorySearchGeneratingQueriesPending,
|
|
2300
3032
|
duration: 2.5,
|
|
2301
3033
|
repeat: !0,
|
|
2302
3034
|
color: "#999",
|
|
2303
3035
|
shimmerColor: "#000"
|
|
2304
3036
|
}
|
|
2305
3037
|
) }),
|
|
2306
|
-
|
|
2307
|
-
/* @__PURE__ */
|
|
3038
|
+
i === 3 && /* @__PURE__ */ y(E, { children: [
|
|
3039
|
+
/* @__PURE__ */ y("div", { style: { minWidth: 0 }, children: [
|
|
2308
3040
|
/* @__PURE__ */ o(
|
|
2309
3041
|
"span",
|
|
2310
3042
|
{
|
|
@@ -2315,7 +3047,7 @@ function gr({
|
|
|
2315
3047
|
marginBottom: 6,
|
|
2316
3048
|
fontWeight: 500
|
|
2317
3049
|
},
|
|
2318
|
-
children:
|
|
3050
|
+
children: r.memorySearchGeneratedQueriesHeading
|
|
2319
3051
|
}
|
|
2320
3052
|
),
|
|
2321
3053
|
/* @__PURE__ */ o(
|
|
@@ -2342,12 +3074,12 @@ function gr({
|
|
|
2342
3074
|
}
|
|
2343
3075
|
)
|
|
2344
3076
|
] }),
|
|
2345
|
-
|
|
3077
|
+
a && /* @__PURE__ */ y(E, { children: [
|
|
2346
3078
|
/* @__PURE__ */ o(
|
|
2347
3079
|
"button",
|
|
2348
3080
|
{
|
|
2349
3081
|
type: "button",
|
|
2350
|
-
onClick: () =>
|
|
3082
|
+
onClick: () => p((h) => !h),
|
|
2351
3083
|
style: {
|
|
2352
3084
|
alignSelf: "flex-start",
|
|
2353
3085
|
border: "none",
|
|
@@ -2358,15 +3090,15 @@ function gr({
|
|
|
2358
3090
|
color: "#666",
|
|
2359
3091
|
textDecoration: "underline"
|
|
2360
3092
|
},
|
|
2361
|
-
children:
|
|
3093
|
+
children: m ? r.memorySearchHideReasoning : r.memorySearchViewReasoning
|
|
2362
3094
|
}
|
|
2363
3095
|
),
|
|
2364
|
-
|
|
3096
|
+
m && /* @__PURE__ */ o(
|
|
2365
3097
|
"div",
|
|
2366
3098
|
{
|
|
2367
3099
|
style: {
|
|
2368
|
-
fontSize:
|
|
2369
|
-
lineHeight:
|
|
3100
|
+
fontSize: $,
|
|
3101
|
+
lineHeight: N,
|
|
2370
3102
|
whiteSpace: "pre-wrap",
|
|
2371
3103
|
wordBreak: "break-word",
|
|
2372
3104
|
color: "#888",
|
|
@@ -2374,7 +3106,7 @@ function gr({
|
|
|
2374
3106
|
borderRadius: 6,
|
|
2375
3107
|
padding: "8px 10px"
|
|
2376
3108
|
},
|
|
2377
|
-
children:
|
|
3109
|
+
children: l
|
|
2378
3110
|
}
|
|
2379
3111
|
)
|
|
2380
3112
|
] })
|
|
@@ -2386,31 +3118,31 @@ function gr({
|
|
|
2386
3118
|
}
|
|
2387
3119
|
);
|
|
2388
3120
|
}
|
|
2389
|
-
const
|
|
2390
|
-
const
|
|
2391
|
-
let
|
|
2392
|
-
return e.memoryTypes.forEach((
|
|
2393
|
-
|
|
2394
|
-
}),
|
|
3121
|
+
const Er = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
3122
|
+
const i = P(() => {
|
|
3123
|
+
let l = -1;
|
|
3124
|
+
return e.memoryTypes.forEach((a, s) => {
|
|
3125
|
+
B(a) || (l = s);
|
|
3126
|
+
}), l;
|
|
2395
3127
|
}, [e.memoryTypes]);
|
|
2396
|
-
return /* @__PURE__ */
|
|
2397
|
-
|
|
3128
|
+
return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
3129
|
+
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ o(
|
|
2398
3130
|
M,
|
|
2399
3131
|
{
|
|
2400
|
-
text:
|
|
3132
|
+
text: n.memorySearchGeneratingQueries,
|
|
2401
3133
|
duration: 2.5,
|
|
2402
3134
|
repeat: !0,
|
|
2403
3135
|
color: "#999",
|
|
2404
3136
|
shimmerColor: "#000"
|
|
2405
3137
|
}
|
|
2406
|
-
) : e.memoryTypes.map((
|
|
2407
|
-
|
|
3138
|
+
) : e.memoryTypes.map((l, a) => /* @__PURE__ */ o(
|
|
3139
|
+
Ir,
|
|
2408
3140
|
{
|
|
2409
|
-
item:
|
|
2410
|
-
t:
|
|
2411
|
-
isActiveRow:
|
|
3141
|
+
item: l,
|
|
3142
|
+
t: n,
|
|
3143
|
+
isActiveRow: a === i && r
|
|
2412
3144
|
},
|
|
2413
|
-
|
|
3145
|
+
l.memoryTypeId
|
|
2414
3146
|
)),
|
|
2415
3147
|
t !== void 0 && /* @__PURE__ */ o(
|
|
2416
3148
|
"div",
|
|
@@ -2421,44 +3153,44 @@ const pr = ({ data: e, isLatest: n = !1, durationSeconds: t, t: r }) => {
|
|
|
2421
3153
|
marginTop: "4px",
|
|
2422
3154
|
fontStyle: "italic"
|
|
2423
3155
|
},
|
|
2424
|
-
children:
|
|
3156
|
+
children: S(n.tookSeconds, { n: t })
|
|
2425
3157
|
}
|
|
2426
3158
|
)
|
|
2427
3159
|
] });
|
|
2428
3160
|
};
|
|
2429
|
-
function
|
|
2430
|
-
return e.some((
|
|
3161
|
+
function Mr(e) {
|
|
3162
|
+
return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ o("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ o(H, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ o(L, { color: "#999", size: 15, borderWidth: 2 });
|
|
2431
3163
|
}
|
|
2432
|
-
function
|
|
3164
|
+
function Rr(e, r) {
|
|
2433
3165
|
if (e.error != null)
|
|
2434
3166
|
return /* @__PURE__ */ o("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
|
|
2435
3167
|
if (e.result == null)
|
|
2436
3168
|
return /* @__PURE__ */ o("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ o(
|
|
2437
3169
|
M,
|
|
2438
3170
|
{
|
|
2439
|
-
text:
|
|
3171
|
+
text: r.searching,
|
|
2440
3172
|
duration: 2.5,
|
|
2441
3173
|
repeat: !0,
|
|
2442
3174
|
color: "#999",
|
|
2443
3175
|
shimmerColor: "#000"
|
|
2444
3176
|
}
|
|
2445
3177
|
) });
|
|
2446
|
-
const t = e.result,
|
|
3178
|
+
const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : S(r.chunksFound, { n: t.numberOfChunks }), i = S(r.scoreLabel, {
|
|
2447
3179
|
n: t.highestChunkScore.toFixed(2)
|
|
2448
3180
|
});
|
|
2449
|
-
return /* @__PURE__ */
|
|
2450
|
-
|
|
3181
|
+
return /* @__PURE__ */ y("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
|
|
3182
|
+
n,
|
|
2451
3183
|
" · ",
|
|
2452
|
-
|
|
3184
|
+
i
|
|
2453
3185
|
] });
|
|
2454
3186
|
}
|
|
2455
|
-
function
|
|
3187
|
+
function Fr({
|
|
2456
3188
|
items: e,
|
|
2457
|
-
queryRow:
|
|
3189
|
+
queryRow: r,
|
|
2458
3190
|
onExploreQueryResultClick: t,
|
|
2459
|
-
t:
|
|
3191
|
+
t: n
|
|
2460
3192
|
}) {
|
|
2461
|
-
const [
|
|
3193
|
+
const [i, l] = I(null);
|
|
2462
3194
|
if (e.length === 0)
|
|
2463
3195
|
return /* @__PURE__ */ o(
|
|
2464
3196
|
"div",
|
|
@@ -2468,10 +3200,10 @@ function xr({
|
|
|
2468
3200
|
color: "#94a3b8",
|
|
2469
3201
|
paddingTop: 4
|
|
2470
3202
|
},
|
|
2471
|
-
children:
|
|
3203
|
+
children: n.memorySearchExploreNoResults
|
|
2472
3204
|
}
|
|
2473
3205
|
);
|
|
2474
|
-
const
|
|
3206
|
+
const a = !!t;
|
|
2475
3207
|
return /* @__PURE__ */ o(
|
|
2476
3208
|
"div",
|
|
2477
3209
|
{
|
|
@@ -2483,26 +3215,26 @@ function xr({
|
|
|
2483
3215
|
paddingTop: 8,
|
|
2484
3216
|
borderTop: "1px solid #f0f0f0"
|
|
2485
3217
|
},
|
|
2486
|
-
children: e.map((
|
|
2487
|
-
const
|
|
2488
|
-
|
|
2489
|
-
),
|
|
2490
|
-
X(
|
|
2491
|
-
|
|
2492
|
-
n:
|
|
3218
|
+
children: e.map((s, m) => {
|
|
3219
|
+
const p = s.memoryTitle !== "" ? s.memoryTitle : s.memoryId, c = V(
|
|
3220
|
+
s.chunks
|
|
3221
|
+
), d = [
|
|
3222
|
+
X(s),
|
|
3223
|
+
S(n.scoreLabel, {
|
|
3224
|
+
n: s.matchingChunkScore.toFixed(2)
|
|
2493
3225
|
}),
|
|
2494
|
-
|
|
3226
|
+
c.length > 0 ? K(c, n) : n.pagesNotAvailable
|
|
2495
3227
|
].filter(
|
|
2496
3228
|
(f) => f != null && f !== ""
|
|
2497
|
-
),
|
|
2498
|
-
memoryId:
|
|
2499
|
-
memoryTitle:
|
|
2500
|
-
pageNumbers:
|
|
2501
|
-
memoryTypeId:
|
|
2502
|
-
memoryTypeName:
|
|
2503
|
-
query:
|
|
2504
|
-
}, g = `${
|
|
2505
|
-
return /* @__PURE__ */
|
|
3229
|
+
), u = {
|
|
3230
|
+
memoryId: s.memoryId,
|
|
3231
|
+
memoryTitle: s.memoryTitle,
|
|
3232
|
+
pageNumbers: c,
|
|
3233
|
+
memoryTypeId: r.memoryTypeId,
|
|
3234
|
+
memoryTypeName: r.memoryTypeName,
|
|
3235
|
+
query: r.query
|
|
3236
|
+
}, g = `${r.query}::${s.memoryId}::${m}`, h = i === g;
|
|
3237
|
+
return /* @__PURE__ */ y(
|
|
2506
3238
|
"div",
|
|
2507
3239
|
{
|
|
2508
3240
|
style: {
|
|
@@ -2510,13 +3242,13 @@ function xr({
|
|
|
2510
3242
|
flexDirection: "row",
|
|
2511
3243
|
alignItems: "flex-start",
|
|
2512
3244
|
gap: "12px",
|
|
2513
|
-
paddingTop:
|
|
2514
|
-
paddingBottom:
|
|
2515
|
-
borderBottom:
|
|
3245
|
+
paddingTop: m > 0 ? 12 : 0,
|
|
3246
|
+
paddingBottom: m < e.length - 1 ? 12 : 0,
|
|
3247
|
+
borderBottom: m < e.length - 1 ? "1px solid #eee" : void 0,
|
|
2516
3248
|
minWidth: 0
|
|
2517
3249
|
},
|
|
2518
3250
|
children: [
|
|
2519
|
-
/* @__PURE__ */
|
|
3251
|
+
/* @__PURE__ */ y(
|
|
2520
3252
|
"div",
|
|
2521
3253
|
{
|
|
2522
3254
|
style: {
|
|
@@ -2535,7 +3267,7 @@ function xr({
|
|
|
2535
3267
|
fontWeight: 600,
|
|
2536
3268
|
color: "#333"
|
|
2537
3269
|
},
|
|
2538
|
-
children:
|
|
3270
|
+
children: p
|
|
2539
3271
|
}
|
|
2540
3272
|
),
|
|
2541
3273
|
/* @__PURE__ */ o(
|
|
@@ -2548,8 +3280,8 @@ function xr({
|
|
|
2548
3280
|
whiteSpace: "pre-wrap",
|
|
2549
3281
|
wordBreak: "break-word"
|
|
2550
3282
|
},
|
|
2551
|
-
children:
|
|
2552
|
-
|
|
3283
|
+
children: Q(
|
|
3284
|
+
s.chunks
|
|
2553
3285
|
)
|
|
2554
3286
|
}
|
|
2555
3287
|
),
|
|
@@ -2562,26 +3294,26 @@ function xr({
|
|
|
2562
3294
|
color: "#94a3b8",
|
|
2563
3295
|
lineHeight: 1.35
|
|
2564
3296
|
},
|
|
2565
|
-
children:
|
|
3297
|
+
children: d.join(" · ")
|
|
2566
3298
|
}
|
|
2567
3299
|
)
|
|
2568
3300
|
]
|
|
2569
3301
|
}
|
|
2570
3302
|
),
|
|
2571
|
-
|
|
3303
|
+
a && /* @__PURE__ */ y(
|
|
2572
3304
|
"button",
|
|
2573
3305
|
{
|
|
2574
3306
|
type: "button",
|
|
2575
3307
|
"aria-busy": h,
|
|
2576
3308
|
disabled: h,
|
|
2577
3309
|
onClick: async () => {
|
|
2578
|
-
|
|
3310
|
+
l(g);
|
|
2579
3311
|
try {
|
|
2580
3312
|
await t(
|
|
2581
|
-
|
|
3313
|
+
u
|
|
2582
3314
|
);
|
|
2583
3315
|
} finally {
|
|
2584
|
-
|
|
3316
|
+
l(null);
|
|
2585
3317
|
}
|
|
2586
3318
|
},
|
|
2587
3319
|
style: {
|
|
@@ -2608,42 +3340,42 @@ function xr({
|
|
|
2608
3340
|
"aria-hidden": !0
|
|
2609
3341
|
}
|
|
2610
3342
|
),
|
|
2611
|
-
|
|
3343
|
+
n.viewButton
|
|
2612
3344
|
]
|
|
2613
3345
|
}
|
|
2614
3346
|
)
|
|
2615
3347
|
]
|
|
2616
3348
|
},
|
|
2617
|
-
`${
|
|
3349
|
+
`${s.memoryId}-${m}`
|
|
2618
3350
|
);
|
|
2619
3351
|
})
|
|
2620
3352
|
}
|
|
2621
3353
|
);
|
|
2622
3354
|
}
|
|
2623
|
-
function
|
|
2624
|
-
const
|
|
2625
|
-
return e.forEach((
|
|
2626
|
-
let
|
|
2627
|
-
|
|
2628
|
-
memoryTypeId:
|
|
2629
|
-
memoryTypeName:
|
|
3355
|
+
function Ar(e) {
|
|
3356
|
+
const r = [], t = /* @__PURE__ */ new Map();
|
|
3357
|
+
return e.forEach((n, i) => {
|
|
3358
|
+
let l = t.get(n.memoryTypeId);
|
|
3359
|
+
l == null && (r.push(n.memoryTypeId), l = {
|
|
3360
|
+
memoryTypeId: n.memoryTypeId,
|
|
3361
|
+
memoryTypeName: n.memoryTypeName,
|
|
2630
3362
|
items: []
|
|
2631
|
-
}, t.set(
|
|
2632
|
-
}),
|
|
3363
|
+
}, t.set(n.memoryTypeId, l)), l.items.push({ item: n, flatIndex: i });
|
|
3364
|
+
}), r.map((n) => t.get(n));
|
|
2633
3365
|
}
|
|
2634
|
-
function
|
|
3366
|
+
function Lr({
|
|
2635
3367
|
group: e,
|
|
2636
|
-
t:
|
|
3368
|
+
t: r,
|
|
2637
3369
|
isLatest: t,
|
|
2638
|
-
expandedRows:
|
|
2639
|
-
toggleExpanded:
|
|
2640
|
-
onExploreQueryResultClick:
|
|
3370
|
+
expandedRows: n,
|
|
3371
|
+
toggleExpanded: i,
|
|
3372
|
+
onExploreQueryResultClick: l
|
|
2641
3373
|
}) {
|
|
2642
|
-
const
|
|
2643
|
-
(
|
|
3374
|
+
const a = e.items.map((m) => m.item), s = a.some(
|
|
3375
|
+
(m) => m.result == null && m.error == null
|
|
2644
3376
|
);
|
|
2645
|
-
return /* @__PURE__ */
|
|
2646
|
-
|
|
3377
|
+
return /* @__PURE__ */ y(
|
|
3378
|
+
C.div,
|
|
2647
3379
|
{
|
|
2648
3380
|
initial: { opacity: 0 },
|
|
2649
3381
|
animate: { opacity: 1 },
|
|
@@ -2654,7 +3386,7 @@ function Tr({
|
|
|
2654
3386
|
borderBottom: "1px solid #eee",
|
|
2655
3387
|
display: "flex",
|
|
2656
3388
|
flexDirection: "row",
|
|
2657
|
-
alignItems:
|
|
3389
|
+
alignItems: s ? "center" : "flex-start",
|
|
2658
3390
|
gap: "10px",
|
|
2659
3391
|
minWidth: 0
|
|
2660
3392
|
},
|
|
@@ -2668,12 +3400,12 @@ function Tr({
|
|
|
2668
3400
|
justifyContent: "center",
|
|
2669
3401
|
flexShrink: 0,
|
|
2670
3402
|
width: 32,
|
|
2671
|
-
...
|
|
3403
|
+
...s ? {} : { paddingTop: 2 }
|
|
2672
3404
|
},
|
|
2673
|
-
children:
|
|
3405
|
+
children: Mr(a)
|
|
2674
3406
|
}
|
|
2675
3407
|
),
|
|
2676
|
-
/* @__PURE__ */
|
|
3408
|
+
/* @__PURE__ */ y(
|
|
2677
3409
|
"div",
|
|
2678
3410
|
{
|
|
2679
3411
|
style: {
|
|
@@ -2691,15 +3423,15 @@ function Tr({
|
|
|
2691
3423
|
fontSize: 12,
|
|
2692
3424
|
color: "#888"
|
|
2693
3425
|
},
|
|
2694
|
-
children:
|
|
3426
|
+
children: S(r.memorySearchExploreQueryTypeLabel, {
|
|
2695
3427
|
name: e.memoryTypeName
|
|
2696
3428
|
})
|
|
2697
3429
|
}
|
|
2698
3430
|
),
|
|
2699
|
-
e.items.map(({ item:
|
|
3431
|
+
e.items.map(({ item: m, flatIndex: p }) => {
|
|
2700
3432
|
var f;
|
|
2701
|
-
const
|
|
2702
|
-
return /* @__PURE__ */
|
|
3433
|
+
const c = m.result != null, d = m.error != null, u = t && !c && !d, g = n[p] === !0, h = ((f = m.result) == null ? void 0 : f.items) ?? [];
|
|
3434
|
+
return /* @__PURE__ */ y(
|
|
2703
3435
|
"div",
|
|
2704
3436
|
{
|
|
2705
3437
|
style: {
|
|
@@ -2709,7 +3441,7 @@ function Tr({
|
|
|
2709
3441
|
minWidth: 0
|
|
2710
3442
|
},
|
|
2711
3443
|
children: [
|
|
2712
|
-
/* @__PURE__ */
|
|
3444
|
+
/* @__PURE__ */ y(
|
|
2713
3445
|
"div",
|
|
2714
3446
|
{
|
|
2715
3447
|
style: {
|
|
@@ -2732,19 +3464,19 @@ function Tr({
|
|
|
2732
3464
|
flex: "1 1 12rem",
|
|
2733
3465
|
minWidth: 0
|
|
2734
3466
|
},
|
|
2735
|
-
children:
|
|
3467
|
+
children: u ? /* @__PURE__ */ o(
|
|
2736
3468
|
M,
|
|
2737
3469
|
{
|
|
2738
|
-
text:
|
|
3470
|
+
text: m.query,
|
|
2739
3471
|
duration: 2.5,
|
|
2740
3472
|
repeat: !0,
|
|
2741
3473
|
color: "#999",
|
|
2742
3474
|
shimmerColor: "#000"
|
|
2743
3475
|
}
|
|
2744
|
-
) :
|
|
3476
|
+
) : m.query
|
|
2745
3477
|
}
|
|
2746
3478
|
),
|
|
2747
|
-
/* @__PURE__ */
|
|
3479
|
+
/* @__PURE__ */ y(
|
|
2748
3480
|
"div",
|
|
2749
3481
|
{
|
|
2750
3482
|
style: {
|
|
@@ -2755,12 +3487,12 @@ function Tr({
|
|
|
2755
3487
|
flexShrink: 0
|
|
2756
3488
|
},
|
|
2757
3489
|
children: [
|
|
2758
|
-
|
|
2759
|
-
|
|
3490
|
+
Rr(m, r),
|
|
3491
|
+
c && /* @__PURE__ */ o(
|
|
2760
3492
|
"button",
|
|
2761
3493
|
{
|
|
2762
3494
|
type: "button",
|
|
2763
|
-
onClick: () =>
|
|
3495
|
+
onClick: () => i(p),
|
|
2764
3496
|
style: {
|
|
2765
3497
|
border: "none",
|
|
2766
3498
|
background: "none",
|
|
@@ -2771,7 +3503,7 @@ function Tr({
|
|
|
2771
3503
|
textDecoration: "underline",
|
|
2772
3504
|
fontFamily: "inherit"
|
|
2773
3505
|
},
|
|
2774
|
-
children: g ?
|
|
3506
|
+
children: g ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2775
3507
|
}
|
|
2776
3508
|
)
|
|
2777
3509
|
]
|
|
@@ -2780,18 +3512,18 @@ function Tr({
|
|
|
2780
3512
|
]
|
|
2781
3513
|
}
|
|
2782
3514
|
),
|
|
2783
|
-
|
|
2784
|
-
|
|
3515
|
+
c && g && /* @__PURE__ */ o(
|
|
3516
|
+
Fr,
|
|
2785
3517
|
{
|
|
2786
3518
|
items: h,
|
|
2787
|
-
queryRow:
|
|
2788
|
-
onExploreQueryResultClick:
|
|
2789
|
-
t:
|
|
3519
|
+
queryRow: m,
|
|
3520
|
+
onExploreQueryResultClick: l,
|
|
3521
|
+
t: r
|
|
2790
3522
|
}
|
|
2791
3523
|
)
|
|
2792
3524
|
]
|
|
2793
3525
|
},
|
|
2794
|
-
`${e.memoryTypeId}-${
|
|
3526
|
+
`${e.memoryTypeId}-${p}-${m.query}`
|
|
2795
3527
|
);
|
|
2796
3528
|
})
|
|
2797
3529
|
]
|
|
@@ -2801,45 +3533,45 @@ function Tr({
|
|
|
2801
3533
|
}
|
|
2802
3534
|
);
|
|
2803
3535
|
}
|
|
2804
|
-
const
|
|
3536
|
+
const Pr = ({
|
|
2805
3537
|
data: e,
|
|
2806
|
-
isLatest:
|
|
3538
|
+
isLatest: r = !1,
|
|
2807
3539
|
durationSeconds: t,
|
|
2808
|
-
onExploreQueryResultClick:
|
|
2809
|
-
t:
|
|
3540
|
+
onExploreQueryResultClick: n,
|
|
3541
|
+
t: i
|
|
2810
3542
|
}) => {
|
|
2811
|
-
const [
|
|
3543
|
+
const [l, a] = I(
|
|
2812
3544
|
{}
|
|
2813
|
-
),
|
|
2814
|
-
|
|
2815
|
-
...
|
|
2816
|
-
[
|
|
3545
|
+
), s = z((p) => {
|
|
3546
|
+
a((c) => ({
|
|
3547
|
+
...c,
|
|
3548
|
+
[p]: !c[p]
|
|
2817
3549
|
}));
|
|
2818
|
-
}, []),
|
|
2819
|
-
() =>
|
|
3550
|
+
}, []), m = P(
|
|
3551
|
+
() => Ar(e.queries),
|
|
2820
3552
|
[e.queries]
|
|
2821
3553
|
);
|
|
2822
|
-
return /* @__PURE__ */
|
|
2823
|
-
|
|
3554
|
+
return /* @__PURE__ */ y("div", { style: { padding: "10px" }, children: [
|
|
3555
|
+
r && !t && e.queries.length === 0 ? /* @__PURE__ */ o(
|
|
2824
3556
|
M,
|
|
2825
3557
|
{
|
|
2826
|
-
text:
|
|
3558
|
+
text: i.memorySearchExploringQueries,
|
|
2827
3559
|
duration: 2.5,
|
|
2828
3560
|
repeat: !0,
|
|
2829
3561
|
color: "#999",
|
|
2830
3562
|
shimmerColor: "#000"
|
|
2831
3563
|
}
|
|
2832
|
-
) :
|
|
2833
|
-
|
|
3564
|
+
) : m.map((p) => /* @__PURE__ */ o(
|
|
3565
|
+
Lr,
|
|
2834
3566
|
{
|
|
2835
|
-
group:
|
|
2836
|
-
t:
|
|
2837
|
-
isLatest:
|
|
2838
|
-
expandedRows:
|
|
2839
|
-
toggleExpanded:
|
|
2840
|
-
onExploreQueryResultClick:
|
|
3567
|
+
group: p,
|
|
3568
|
+
t: i,
|
|
3569
|
+
isLatest: r,
|
|
3570
|
+
expandedRows: l,
|
|
3571
|
+
toggleExpanded: s,
|
|
3572
|
+
onExploreQueryResultClick: n
|
|
2841
3573
|
},
|
|
2842
|
-
|
|
3574
|
+
p.memoryTypeId
|
|
2843
3575
|
)),
|
|
2844
3576
|
t !== void 0 && /* @__PURE__ */ o(
|
|
2845
3577
|
"div",
|
|
@@ -2850,15 +3582,15 @@ const kr = ({
|
|
|
2850
3582
|
marginTop: "4px",
|
|
2851
3583
|
fontStyle: "italic"
|
|
2852
3584
|
},
|
|
2853
|
-
children:
|
|
3585
|
+
children: S(i.tookSeconds, { n: t })
|
|
2854
3586
|
}
|
|
2855
3587
|
)
|
|
2856
3588
|
] });
|
|
2857
|
-
},
|
|
2858
|
-
const
|
|
2859
|
-
return /* @__PURE__ */
|
|
3589
|
+
}, Dr = ({ data: e, onSearchResultClick: r, t }) => {
|
|
3590
|
+
const n = e.response.items, i = !!r, [l, a] = I(null);
|
|
3591
|
+
return /* @__PURE__ */ y("div", { style: { padding: "16px" }, children: [
|
|
2860
3592
|
/* @__PURE__ */ o(
|
|
2861
|
-
|
|
3593
|
+
C.div,
|
|
2862
3594
|
{
|
|
2863
3595
|
style: {
|
|
2864
3596
|
marginBottom: "12px",
|
|
@@ -2880,30 +3612,30 @@ const kr = ({
|
|
|
2880
3612
|
flexDirection: "column",
|
|
2881
3613
|
gap: 0
|
|
2882
3614
|
},
|
|
2883
|
-
children:
|
|
2884
|
-
const
|
|
2885
|
-
|
|
2886
|
-
),
|
|
2887
|
-
X(
|
|
2888
|
-
|
|
2889
|
-
n:
|
|
3615
|
+
children: n.map((s, m) => {
|
|
3616
|
+
const p = s.memoryTitle !== "" ? s.memoryTitle : s.memoryId, c = V(
|
|
3617
|
+
s.chunks
|
|
3618
|
+
), d = [
|
|
3619
|
+
X(s),
|
|
3620
|
+
S(t.scoreLabel, {
|
|
3621
|
+
n: s.matchingChunkScore.toFixed(2)
|
|
2890
3622
|
}),
|
|
2891
|
-
|
|
3623
|
+
c.length > 0 ? K(c, t) : t.pagesNotAvailable
|
|
2892
3624
|
].filter(
|
|
2893
3625
|
(f) => f != null && f !== ""
|
|
2894
|
-
),
|
|
2895
|
-
memoryId:
|
|
2896
|
-
memoryTitle:
|
|
2897
|
-
memoryTypeId:
|
|
2898
|
-
memoryTypeName:
|
|
2899
|
-
pageNumbers:
|
|
2900
|
-
}, g = `${
|
|
2901
|
-
return /* @__PURE__ */
|
|
2902
|
-
|
|
3626
|
+
), u = {
|
|
3627
|
+
memoryId: s.memoryId,
|
|
3628
|
+
memoryTitle: s.memoryTitle,
|
|
3629
|
+
memoryTypeId: s.memoryTypeId,
|
|
3630
|
+
memoryTypeName: s.memoryTypeName,
|
|
3631
|
+
pageNumbers: c
|
|
3632
|
+
}, g = `${s.memoryId}-${m}`, h = l === g;
|
|
3633
|
+
return /* @__PURE__ */ y(
|
|
3634
|
+
C.div,
|
|
2903
3635
|
{
|
|
2904
3636
|
initial: { opacity: 0 },
|
|
2905
3637
|
animate: { opacity: 1 },
|
|
2906
|
-
transition: { duration: 0.2, delay:
|
|
3638
|
+
transition: { duration: 0.2, delay: m * 0.04 },
|
|
2907
3639
|
style: {
|
|
2908
3640
|
display: "flex",
|
|
2909
3641
|
flexDirection: "row",
|
|
@@ -2911,11 +3643,11 @@ const kr = ({
|
|
|
2911
3643
|
gap: "12px",
|
|
2912
3644
|
paddingTop: "12px",
|
|
2913
3645
|
paddingBottom: "12px",
|
|
2914
|
-
borderBottom:
|
|
3646
|
+
borderBottom: m < n.length - 1 ? "1px solid #eee" : void 0,
|
|
2915
3647
|
minWidth: 0
|
|
2916
3648
|
},
|
|
2917
3649
|
children: [
|
|
2918
|
-
/* @__PURE__ */
|
|
3650
|
+
/* @__PURE__ */ y(
|
|
2919
3651
|
"div",
|
|
2920
3652
|
{
|
|
2921
3653
|
style: {
|
|
@@ -2934,7 +3666,7 @@ const kr = ({
|
|
|
2934
3666
|
fontWeight: 600,
|
|
2935
3667
|
color: "#333"
|
|
2936
3668
|
},
|
|
2937
|
-
children:
|
|
3669
|
+
children: p
|
|
2938
3670
|
}
|
|
2939
3671
|
),
|
|
2940
3672
|
/* @__PURE__ */ o(
|
|
@@ -2947,7 +3679,7 @@ const kr = ({
|
|
|
2947
3679
|
whiteSpace: "pre-wrap",
|
|
2948
3680
|
wordBreak: "break-word"
|
|
2949
3681
|
},
|
|
2950
|
-
children:
|
|
3682
|
+
children: Q(s.chunks)
|
|
2951
3683
|
}
|
|
2952
3684
|
),
|
|
2953
3685
|
/* @__PURE__ */ o(
|
|
@@ -2959,24 +3691,24 @@ const kr = ({
|
|
|
2959
3691
|
color: "#94a3b8",
|
|
2960
3692
|
lineHeight: 1.35
|
|
2961
3693
|
},
|
|
2962
|
-
children:
|
|
3694
|
+
children: d.join(" · ")
|
|
2963
3695
|
}
|
|
2964
3696
|
)
|
|
2965
3697
|
]
|
|
2966
3698
|
}
|
|
2967
3699
|
),
|
|
2968
|
-
|
|
3700
|
+
i && /* @__PURE__ */ y(
|
|
2969
3701
|
"button",
|
|
2970
3702
|
{
|
|
2971
3703
|
type: "button",
|
|
2972
3704
|
"aria-busy": h,
|
|
2973
3705
|
disabled: h,
|
|
2974
3706
|
onClick: async () => {
|
|
2975
|
-
|
|
3707
|
+
a(g);
|
|
2976
3708
|
try {
|
|
2977
|
-
await
|
|
3709
|
+
await r(u);
|
|
2978
3710
|
} finally {
|
|
2979
|
-
|
|
3711
|
+
a(null);
|
|
2980
3712
|
}
|
|
2981
3713
|
},
|
|
2982
3714
|
style: {
|
|
@@ -3009,14 +3741,14 @@ const kr = ({
|
|
|
3009
3741
|
)
|
|
3010
3742
|
]
|
|
3011
3743
|
},
|
|
3012
|
-
`${
|
|
3744
|
+
`${s.memoryId}-${m}`
|
|
3013
3745
|
);
|
|
3014
3746
|
})
|
|
3015
3747
|
}
|
|
3016
3748
|
)
|
|
3017
3749
|
] });
|
|
3018
|
-
},
|
|
3019
|
-
|
|
3750
|
+
}, j = ({ message: e }) => /* @__PURE__ */ o("div", { style: { padding: "16px" }, children: /* @__PURE__ */ o(
|
|
3751
|
+
C.div,
|
|
3020
3752
|
{
|
|
3021
3753
|
initial: { opacity: 0, y: -10 },
|
|
3022
3754
|
animate: { opacity: 1, y: 0 },
|
|
@@ -3038,149 +3770,173 @@ const kr = ({
|
|
|
3038
3770
|
}
|
|
3039
3771
|
)
|
|
3040
3772
|
}
|
|
3041
|
-
) }),
|
|
3773
|
+
) }), Wr = ({
|
|
3042
3774
|
progressViewItems: e,
|
|
3043
|
-
loading:
|
|
3775
|
+
loading: r,
|
|
3044
3776
|
error: t,
|
|
3045
|
-
loadingText:
|
|
3046
|
-
t:
|
|
3047
|
-
onSourceClick:
|
|
3048
|
-
onSearchResultClick:
|
|
3049
|
-
onExploreQueryResultClick:
|
|
3777
|
+
loadingText: n,
|
|
3778
|
+
t: i,
|
|
3779
|
+
onSourceClick: l,
|
|
3780
|
+
onSearchResultClick: a,
|
|
3781
|
+
onExploreQueryResultClick: s
|
|
3050
3782
|
}) => {
|
|
3051
|
-
const
|
|
3052
|
-
|
|
3053
|
-
|
|
3783
|
+
const m = A(null);
|
|
3784
|
+
F(() => {
|
|
3785
|
+
m.current && (m.current.scrollTop = m.current.scrollHeight);
|
|
3054
3786
|
}, [e.length]);
|
|
3055
|
-
const
|
|
3056
|
-
const
|
|
3057
|
-
if (
|
|
3058
|
-
return /* @__PURE__ */ o(
|
|
3059
|
-
if (
|
|
3060
|
-
return /* @__PURE__ */ o(
|
|
3061
|
-
if (
|
|
3062
|
-
switch (
|
|
3787
|
+
const p = (d) => {
|
|
3788
|
+
const u = d.item.data;
|
|
3789
|
+
if (u.taskType === "StreamingChatCompletion" && u.eventType === "Text")
|
|
3790
|
+
return /* @__PURE__ */ o(ne, { text: u.text });
|
|
3791
|
+
if (u.taskType === "StructuredChatCompletion" && u.eventType === "Completed")
|
|
3792
|
+
return /* @__PURE__ */ o(He, { data: u });
|
|
3793
|
+
if (u.taskType === "MemoryChat")
|
|
3794
|
+
switch (u.eventType) {
|
|
3063
3795
|
case "Text":
|
|
3064
|
-
return /* @__PURE__ */ o(
|
|
3796
|
+
return /* @__PURE__ */ o(ne, { text: u.text });
|
|
3065
3797
|
case "FindMemories":
|
|
3066
3798
|
return /* @__PURE__ */ o(
|
|
3067
|
-
|
|
3799
|
+
je,
|
|
3068
3800
|
{
|
|
3069
|
-
data:
|
|
3070
|
-
isLatest:
|
|
3071
|
-
durationSeconds:
|
|
3072
|
-
t:
|
|
3801
|
+
data: u,
|
|
3802
|
+
isLatest: d.isLatest,
|
|
3803
|
+
durationSeconds: d.durationSeconds,
|
|
3804
|
+
t: i
|
|
3073
3805
|
}
|
|
3074
3806
|
);
|
|
3075
3807
|
case "FindMemoriesResult":
|
|
3076
3808
|
return /* @__PURE__ */ o(
|
|
3077
|
-
|
|
3809
|
+
qe,
|
|
3078
3810
|
{
|
|
3079
|
-
data:
|
|
3080
|
-
t:
|
|
3811
|
+
data: u,
|
|
3812
|
+
t: i
|
|
3081
3813
|
}
|
|
3082
3814
|
);
|
|
3083
3815
|
case "Search":
|
|
3084
3816
|
return /* @__PURE__ */ o(
|
|
3085
|
-
|
|
3817
|
+
_e,
|
|
3086
3818
|
{
|
|
3087
|
-
data:
|
|
3088
|
-
isLatest:
|
|
3089
|
-
durationSeconds:
|
|
3090
|
-
t:
|
|
3819
|
+
data: u,
|
|
3820
|
+
isLatest: d.isLatest,
|
|
3821
|
+
durationSeconds: d.durationSeconds,
|
|
3822
|
+
t: i
|
|
3091
3823
|
}
|
|
3092
3824
|
);
|
|
3093
3825
|
case "FindSources":
|
|
3094
3826
|
return /* @__PURE__ */ o(
|
|
3095
|
-
|
|
3827
|
+
Qe,
|
|
3096
3828
|
{
|
|
3097
|
-
data:
|
|
3098
|
-
isLatest:
|
|
3099
|
-
durationSeconds:
|
|
3100
|
-
t:
|
|
3829
|
+
data: u,
|
|
3830
|
+
isLatest: d.isLatest,
|
|
3831
|
+
durationSeconds: d.durationSeconds,
|
|
3832
|
+
t: i
|
|
3101
3833
|
}
|
|
3102
3834
|
);
|
|
3103
3835
|
case "SourcesResult":
|
|
3104
3836
|
return /* @__PURE__ */ o(
|
|
3105
|
-
|
|
3837
|
+
Ve,
|
|
3106
3838
|
{
|
|
3107
|
-
data:
|
|
3108
|
-
onSourceClick:
|
|
3109
|
-
t:
|
|
3839
|
+
data: u,
|
|
3840
|
+
onSourceClick: l,
|
|
3841
|
+
t: i
|
|
3110
3842
|
}
|
|
3111
3843
|
);
|
|
3112
3844
|
case "ExploreMemories":
|
|
3113
3845
|
return /* @__PURE__ */ o(
|
|
3114
|
-
|
|
3846
|
+
Ze,
|
|
3115
3847
|
{
|
|
3116
|
-
data:
|
|
3117
|
-
completed:
|
|
3118
|
-
isLatest:
|
|
3119
|
-
t:
|
|
3848
|
+
data: u,
|
|
3849
|
+
completed: d.completed,
|
|
3850
|
+
isLatest: d.isLatest,
|
|
3851
|
+
t: i
|
|
3120
3852
|
}
|
|
3121
3853
|
);
|
|
3122
3854
|
case "ChunkResults":
|
|
3123
3855
|
return /* @__PURE__ */ o(
|
|
3124
|
-
|
|
3856
|
+
sr,
|
|
3857
|
+
{
|
|
3858
|
+
data: u,
|
|
3859
|
+
onSearchResultClick: a,
|
|
3860
|
+
t: i
|
|
3861
|
+
}
|
|
3862
|
+
);
|
|
3863
|
+
case "GoogleSearch":
|
|
3864
|
+
return /* @__PURE__ */ o(
|
|
3865
|
+
lr,
|
|
3866
|
+
{
|
|
3867
|
+
data: u,
|
|
3868
|
+
isLatest: d.isLatest,
|
|
3869
|
+
durationSeconds: d.durationSeconds,
|
|
3870
|
+
t: i
|
|
3871
|
+
}
|
|
3872
|
+
);
|
|
3873
|
+
case "GoogleSearchResult":
|
|
3874
|
+
return /* @__PURE__ */ o(ur, { data: u, t: i });
|
|
3875
|
+
case "Scrape":
|
|
3876
|
+
return /* @__PURE__ */ o(
|
|
3877
|
+
mr,
|
|
3125
3878
|
{
|
|
3126
|
-
data:
|
|
3127
|
-
|
|
3128
|
-
|
|
3879
|
+
data: u,
|
|
3880
|
+
isLatest: d.isLatest,
|
|
3881
|
+
durationSeconds: d.durationSeconds,
|
|
3882
|
+
t: i
|
|
3129
3883
|
}
|
|
3130
3884
|
);
|
|
3885
|
+
case "ScrapeResult":
|
|
3886
|
+
return /* @__PURE__ */ o(hr, { data: u, t: i });
|
|
3131
3887
|
case "Completed":
|
|
3132
3888
|
return null;
|
|
3133
3889
|
}
|
|
3134
|
-
if (
|
|
3135
|
-
switch (
|
|
3890
|
+
if (u.taskType === "MemorySearch")
|
|
3891
|
+
switch (u.eventType) {
|
|
3136
3892
|
case "GeneratingQueries":
|
|
3137
3893
|
return /* @__PURE__ */ o(
|
|
3138
|
-
|
|
3894
|
+
Er,
|
|
3139
3895
|
{
|
|
3140
|
-
data:
|
|
3141
|
-
isLatest:
|
|
3142
|
-
durationSeconds:
|
|
3143
|
-
t:
|
|
3896
|
+
data: u,
|
|
3897
|
+
isLatest: d.isLatest,
|
|
3898
|
+
durationSeconds: d.durationSeconds,
|
|
3899
|
+
t: i
|
|
3144
3900
|
}
|
|
3145
3901
|
);
|
|
3146
3902
|
case "ExploreQueries":
|
|
3147
3903
|
return /* @__PURE__ */ o(
|
|
3148
|
-
|
|
3904
|
+
Pr,
|
|
3149
3905
|
{
|
|
3150
|
-
data:
|
|
3151
|
-
isLatest:
|
|
3152
|
-
durationSeconds:
|
|
3153
|
-
onExploreQueryResultClick:
|
|
3154
|
-
t:
|
|
3906
|
+
data: u,
|
|
3907
|
+
isLatest: d.isLatest,
|
|
3908
|
+
durationSeconds: d.durationSeconds,
|
|
3909
|
+
onExploreQueryResultClick: s,
|
|
3910
|
+
t: i
|
|
3155
3911
|
}
|
|
3156
3912
|
);
|
|
3157
3913
|
case "SearchMemoryTypes":
|
|
3158
3914
|
return /* @__PURE__ */ o(
|
|
3159
|
-
|
|
3915
|
+
kr,
|
|
3160
3916
|
{
|
|
3161
|
-
data:
|
|
3162
|
-
isLatest:
|
|
3163
|
-
durationSeconds:
|
|
3164
|
-
t:
|
|
3917
|
+
data: u,
|
|
3918
|
+
isLatest: d.isLatest,
|
|
3919
|
+
durationSeconds: d.durationSeconds,
|
|
3920
|
+
t: i
|
|
3165
3921
|
}
|
|
3166
3922
|
);
|
|
3167
3923
|
case "Completed":
|
|
3168
3924
|
return /* @__PURE__ */ o(
|
|
3169
|
-
|
|
3925
|
+
Dr,
|
|
3170
3926
|
{
|
|
3171
|
-
data:
|
|
3172
|
-
onSearchResultClick:
|
|
3173
|
-
t:
|
|
3927
|
+
data: u,
|
|
3928
|
+
onSearchResultClick: a,
|
|
3929
|
+
t: i
|
|
3174
3930
|
}
|
|
3175
3931
|
);
|
|
3176
3932
|
}
|
|
3177
|
-
return
|
|
3933
|
+
return u.taskType === "StreamingChatCompletion" && u.eventType === "Completed" ? null : u.eventType === "Error" && "message" in u ? /* @__PURE__ */ o(j, { message: u.message }) : null;
|
|
3178
3934
|
};
|
|
3179
3935
|
if (e.length === 0)
|
|
3180
|
-
return t ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
|
|
3936
|
+
return t ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(j, { message: t.message }) }) : r ? /* @__PURE__ */ o("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ o(
|
|
3181
3937
|
M,
|
|
3182
3938
|
{
|
|
3183
|
-
text:
|
|
3939
|
+
text: n ?? i.processingYourTask,
|
|
3184
3940
|
duration: 1.5,
|
|
3185
3941
|
repeat: !0,
|
|
3186
3942
|
repeatDelay: 0,
|
|
@@ -3188,64 +3944,68 @@ const kr = ({
|
|
|
3188
3944
|
shimmerColor: "#000"
|
|
3189
3945
|
}
|
|
3190
3946
|
) }) : null;
|
|
3191
|
-
const
|
|
3192
|
-
const g =
|
|
3193
|
-
return g.taskType === "MemoryChat" && g.eventType === "ExploreMemories" ? !e.slice(
|
|
3947
|
+
const c = e.filter((d, u) => {
|
|
3948
|
+
const g = d.item.data;
|
|
3949
|
+
return g.taskType === "MemoryChat" && g.eventType === "ExploreMemories" ? !e.slice(u + 1).some(
|
|
3194
3950
|
(x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ExploreMemories"
|
|
3195
|
-
) : g.taskType === "MemorySearch" && g.eventType === "GeneratingQueries" ? !e.slice(
|
|
3951
|
+
) : g.taskType === "MemorySearch" && g.eventType === "GeneratingQueries" ? !e.slice(u + 1).some(
|
|
3196
3952
|
(x) => x.item.data.taskType === "MemorySearch" && x.item.data.eventType === "GeneratingQueries"
|
|
3197
|
-
) : g.taskType === "MemorySearch" && g.eventType === "ExploreQueries" ? !e.slice(
|
|
3953
|
+
) : g.taskType === "MemorySearch" && g.eventType === "ExploreQueries" ? !e.slice(u + 1).some(
|
|
3198
3954
|
(x) => x.item.data.taskType === "MemorySearch" && x.item.data.eventType === "ExploreQueries"
|
|
3199
|
-
) : g.taskType === "MemoryChat" && g.eventType === "ChunkResults" ? !e.slice(
|
|
3955
|
+
) : g.taskType === "MemoryChat" && g.eventType === "ChunkResults" ? !e.slice(u + 1).some(
|
|
3200
3956
|
(x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "ChunkResults"
|
|
3957
|
+
) : g.taskType === "MemoryChat" && g.eventType === "GoogleSearch" ? !e.slice(u + 1).some(
|
|
3958
|
+
(x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "GoogleSearch"
|
|
3959
|
+
) : g.taskType === "MemoryChat" && g.eventType === "Scrape" ? !e.slice(u + 1).some(
|
|
3960
|
+
(x) => x.item.data.taskType === "MemoryChat" && x.item.data.eventType === "Scrape"
|
|
3201
3961
|
) : !0;
|
|
3202
3962
|
});
|
|
3203
|
-
return /* @__PURE__ */
|
|
3204
|
-
/* @__PURE__ */ o(
|
|
3205
|
-
|
|
3963
|
+
return /* @__PURE__ */ y("div", { id: "agent-task-progress-verbose", ref: m, children: [
|
|
3964
|
+
/* @__PURE__ */ o(xe, { children: c.map((d, u) => /* @__PURE__ */ o(
|
|
3965
|
+
C.div,
|
|
3206
3966
|
{
|
|
3207
|
-
id: `agent-task-progress-item-${
|
|
3967
|
+
id: `agent-task-progress-item-${d.item.progressItemId}`,
|
|
3208
3968
|
initial: { opacity: 0, y: -20 },
|
|
3209
3969
|
animate: { opacity: 1, y: 0 },
|
|
3210
3970
|
transition: {
|
|
3211
3971
|
duration: 0.4,
|
|
3212
|
-
delay:
|
|
3972
|
+
delay: u * 0.1,
|
|
3213
3973
|
ease: "easeOut"
|
|
3214
3974
|
},
|
|
3215
|
-
children:
|
|
3975
|
+
children: p(d)
|
|
3216
3976
|
},
|
|
3217
|
-
|
|
3977
|
+
d.item.progressItemId
|
|
3218
3978
|
)) }),
|
|
3219
|
-
t ? /* @__PURE__ */ o("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ o(
|
|
3979
|
+
t ? /* @__PURE__ */ o("div", { style: { marginTop: 8 }, children: /* @__PURE__ */ o(j, { message: t.message }) }) : null
|
|
3220
3980
|
] });
|
|
3221
|
-
},
|
|
3981
|
+
}, jr = ({
|
|
3222
3982
|
agentTask: e,
|
|
3223
|
-
language:
|
|
3983
|
+
language: r,
|
|
3224
3984
|
onSourceClick: t,
|
|
3225
|
-
onSearchResultClick:
|
|
3226
|
-
onExploreQueryResultClick:
|
|
3985
|
+
onSearchResultClick: n,
|
|
3986
|
+
onExploreQueryResultClick: i
|
|
3227
3987
|
}) => {
|
|
3228
|
-
const
|
|
3988
|
+
const l = Ne(e), a = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : r ?? "en", s = Ue(a);
|
|
3229
3989
|
return /* @__PURE__ */ o(
|
|
3230
|
-
|
|
3990
|
+
Wr,
|
|
3231
3991
|
{
|
|
3232
|
-
progressViewItems:
|
|
3992
|
+
progressViewItems: l,
|
|
3233
3993
|
loading: e.loading,
|
|
3234
3994
|
error: e.error,
|
|
3235
3995
|
loadingText: e.loadingText,
|
|
3236
|
-
t:
|
|
3996
|
+
t: s,
|
|
3237
3997
|
onSourceClick: t,
|
|
3238
|
-
onSearchResultClick:
|
|
3239
|
-
onExploreQueryResultClick:
|
|
3998
|
+
onSearchResultClick: n,
|
|
3999
|
+
onExploreQueryResultClick: i
|
|
3240
4000
|
}
|
|
3241
4001
|
);
|
|
3242
4002
|
};
|
|
3243
4003
|
export {
|
|
3244
|
-
|
|
4004
|
+
jr as AgentTaskProgress,
|
|
3245
4005
|
L as Checkmark,
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
4006
|
+
Ur as FencyProvider,
|
|
4007
|
+
Dr as MemorySearchCompletedResults,
|
|
4008
|
+
Ae as StreamEventManager,
|
|
4009
|
+
H as XMark,
|
|
4010
|
+
_r as useAgentTasks
|
|
3251
4011
|
};
|