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