@fencyai/react 0.1.162 → 0.1.164
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/hooks/useAgentTasks/index.d.ts.map +1 -1
- package/dist/index.js +668 -666
- package/dist/provider/FencyProvider.d.ts.map +1 -1
- package/dist/provider/StreamEventManager.d.ts +1 -1
- package/dist/provider/StreamEventManager.d.ts.map +1 -1
- package/dist/types/UseAgentTasks.d.ts +2 -0
- package/dist/types/UseAgentTasks.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { createStream as
|
|
3
|
-
import { createContext as
|
|
4
|
-
import { useInView as
|
|
5
|
-
import
|
|
6
|
-
import { Prism as
|
|
1
|
+
import { jsxs as g, jsx as i, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { createStream as ae, isStreamTimeoutEvent as se, isStreamNotFoundEvent as le, isAgentTaskProgressItemUpdatedEvent as ce, createAgentTask as de } from "@fencyai/js";
|
|
3
|
+
import { createContext as me, useState as v, useRef as F, useEffect as A, useCallback as G, useContext as ue, useMemo as D } from "react";
|
|
4
|
+
import { useInView as ye, motion as b, AnimatePresence as J } from "motion/react";
|
|
5
|
+
import ge from "react-markdown";
|
|
6
|
+
import { Prism as Y } from "react-syntax-highlighter";
|
|
7
7
|
import pe from "remark-gfm";
|
|
8
|
-
import './assets/index.css';const
|
|
8
|
+
import './assets/index.css';const Z = me(
|
|
9
9
|
void 0
|
|
10
10
|
);
|
|
11
|
-
async function
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
for (; !(
|
|
15
|
-
r(
|
|
11
|
+
async function he(e, r) {
|
|
12
|
+
const t = e.getReader();
|
|
13
|
+
let n;
|
|
14
|
+
for (; !(n = await t.read()).done; )
|
|
15
|
+
r(n.value);
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
let r,
|
|
17
|
+
function fe(e) {
|
|
18
|
+
let r, t, n, l = !1;
|
|
19
19
|
return function(s) {
|
|
20
|
-
r === void 0 ? (r = s,
|
|
20
|
+
r === void 0 ? (r = s, t = 0, n = -1) : r = xe(r, s);
|
|
21
21
|
const d = r.length;
|
|
22
22
|
let m = 0;
|
|
23
|
-
for (;
|
|
24
|
-
l && (r[
|
|
23
|
+
for (; t < d; ) {
|
|
24
|
+
l && (r[t] === 10 && (m = ++t), l = !1);
|
|
25
25
|
let o = -1;
|
|
26
|
-
for (;
|
|
27
|
-
switch (r[
|
|
26
|
+
for (; t < d && o === -1; ++t)
|
|
27
|
+
switch (r[t]) {
|
|
28
28
|
case 58:
|
|
29
|
-
|
|
29
|
+
n === -1 && (n = t - m);
|
|
30
30
|
break;
|
|
31
31
|
case 13:
|
|
32
32
|
l = !0;
|
|
33
33
|
case 10:
|
|
34
|
-
o =
|
|
34
|
+
o = t;
|
|
35
35
|
break;
|
|
36
36
|
}
|
|
37
37
|
if (o === -1)
|
|
38
38
|
break;
|
|
39
|
-
e(r.subarray(m, o),
|
|
39
|
+
e(r.subarray(m, o), n), m = t, n = -1;
|
|
40
40
|
}
|
|
41
|
-
m === d ? r = void 0 : m !== 0 && (r = r.subarray(m),
|
|
41
|
+
m === d ? r = void 0 : m !== 0 && (r = r.subarray(m), t -= m);
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
|
-
function
|
|
45
|
-
let
|
|
44
|
+
function Se(e, r, t) {
|
|
45
|
+
let n = j();
|
|
46
46
|
const l = new TextDecoder();
|
|
47
47
|
return function(s, d) {
|
|
48
48
|
if (s.length === 0)
|
|
49
|
-
|
|
49
|
+
t == null || t(n), n = j();
|
|
50
50
|
else if (d > 0) {
|
|
51
51
|
const m = l.decode(s.subarray(0, d)), o = d + (s[d + 1] === 32 ? 2 : 1), a = l.decode(s.subarray(o));
|
|
52
52
|
switch (m) {
|
|
53
53
|
case "data":
|
|
54
|
-
|
|
54
|
+
n.data = n.data ? n.data + `
|
|
55
55
|
` + a : a;
|
|
56
56
|
break;
|
|
57
57
|
case "event":
|
|
58
|
-
|
|
58
|
+
n.event = a;
|
|
59
59
|
break;
|
|
60
60
|
case "id":
|
|
61
|
-
e(
|
|
61
|
+
e(n.id = a);
|
|
62
62
|
break;
|
|
63
63
|
case "retry":
|
|
64
64
|
const u = parseInt(a, 10);
|
|
65
|
-
isNaN(u) || r(
|
|
65
|
+
isNaN(u) || r(n.retry = u);
|
|
66
66
|
break;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
return
|
|
71
|
+
function xe(e, r) {
|
|
72
|
+
const t = new Uint8Array(e.length + r.length);
|
|
73
|
+
return t.set(e), t.set(r, e.length), t;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
75
|
+
function j() {
|
|
76
76
|
return {
|
|
77
77
|
data: "",
|
|
78
78
|
event: "",
|
|
@@ -80,68 +80,71 @@ function q() {
|
|
|
80
80
|
retry: void 0
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
var
|
|
84
|
-
var
|
|
85
|
-
for (var
|
|
83
|
+
var Te = function(e, r) {
|
|
84
|
+
var t = {};
|
|
85
|
+
for (var n in e) Object.prototype.hasOwnProperty.call(e, n) && r.indexOf(n) < 0 && (t[n] = e[n]);
|
|
86
86
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
87
|
-
for (var l = 0,
|
|
88
|
-
r.indexOf(
|
|
89
|
-
return
|
|
87
|
+
for (var l = 0, n = Object.getOwnPropertySymbols(e); l < n.length; l++)
|
|
88
|
+
r.indexOf(n[l]) < 0 && Object.prototype.propertyIsEnumerable.call(e, n[l]) && (t[n[l]] = e[n[l]]);
|
|
89
|
+
return t;
|
|
90
90
|
};
|
|
91
|
-
const _ = "text/event-stream",
|
|
92
|
-
function
|
|
93
|
-
var { signal:
|
|
94
|
-
return new Promise((u,
|
|
95
|
-
const f = Object.assign({},
|
|
91
|
+
const _ = "text/event-stream", ke = 1e3, q = "last-event-id";
|
|
92
|
+
function be(e, r) {
|
|
93
|
+
var { signal: t, headers: n, onopen: l, onmessage: c, onclose: s, onerror: d, openWhenHidden: m, fetch: o } = r, a = Te(r, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
|
|
94
|
+
return new Promise((u, y) => {
|
|
95
|
+
const f = Object.assign({}, n);
|
|
96
96
|
f.accept || (f.accept = _);
|
|
97
|
-
let
|
|
98
|
-
function
|
|
99
|
-
|
|
97
|
+
let p;
|
|
98
|
+
function x() {
|
|
99
|
+
p.abort(), document.hidden || R();
|
|
100
100
|
}
|
|
101
|
-
m || document.addEventListener("visibilitychange",
|
|
102
|
-
let h =
|
|
103
|
-
function
|
|
104
|
-
document.removeEventListener("visibilitychange",
|
|
101
|
+
m || document.addEventListener("visibilitychange", x);
|
|
102
|
+
let h = ke, S = 0;
|
|
103
|
+
function k() {
|
|
104
|
+
document.removeEventListener("visibilitychange", x), window.clearTimeout(S), p.abort();
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
t == null || t.addEventListener("abort", () => {
|
|
107
|
+
k(), u();
|
|
108
108
|
});
|
|
109
|
-
const
|
|
109
|
+
const C = o ?? window.fetch, E = l ?? ve;
|
|
110
110
|
async function R() {
|
|
111
111
|
var L;
|
|
112
|
-
|
|
112
|
+
p = new AbortController();
|
|
113
113
|
try {
|
|
114
|
-
const P = await
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
}, (
|
|
118
|
-
h =
|
|
119
|
-
}, c))), s == null || s(),
|
|
114
|
+
const P = await C(e, Object.assign(Object.assign({}, a), { headers: f, signal: p.signal }));
|
|
115
|
+
await E(P), await he(P.body, fe(Se((M) => {
|
|
116
|
+
M ? f[q] = M : delete f[q];
|
|
117
|
+
}, (M) => {
|
|
118
|
+
h = M;
|
|
119
|
+
}, c))), s == null || s(), k(), u();
|
|
120
120
|
} catch (P) {
|
|
121
|
-
if (!
|
|
121
|
+
if (!p.signal.aborted)
|
|
122
122
|
try {
|
|
123
|
-
const
|
|
124
|
-
window.clearTimeout(
|
|
125
|
-
} catch (
|
|
126
|
-
|
|
123
|
+
const M = (L = d == null ? void 0 : d(P)) !== null && L !== void 0 ? L : h;
|
|
124
|
+
window.clearTimeout(S), S = window.setTimeout(R, M);
|
|
125
|
+
} catch (M) {
|
|
126
|
+
k(), y(M);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
R();
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
function
|
|
133
|
+
function ve(e) {
|
|
134
134
|
const r = e.headers.get("content-type");
|
|
135
135
|
if (!(r != null && r.startsWith(_)))
|
|
136
136
|
throw new Error(`Expected content-type to be ${_}, Actual: ${r}`);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
139
|
-
const r = atob(e),
|
|
140
|
-
for (let
|
|
141
|
-
n
|
|
142
|
-
return new TextDecoder("utf-8").decode(
|
|
138
|
+
function Ce(e) {
|
|
139
|
+
const r = atob(e), t = new Uint8Array(r.length);
|
|
140
|
+
for (let n = 0; n < r.length; n++)
|
|
141
|
+
t[n] = r.charCodeAt(n);
|
|
142
|
+
return new TextDecoder("utf-8").decode(t);
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
function Ee(e) {
|
|
145
|
+
return e instanceof Error ? e.message : typeof e == "string" ? e : "Unknown stream error";
|
|
146
|
+
}
|
|
147
|
+
class we {
|
|
145
148
|
constructor(r) {
|
|
146
149
|
this.eventSources = /* @__PURE__ */ new Map(), this.subscribers = /* @__PURE__ */ new Map(), this.fency = r;
|
|
147
150
|
}
|
|
@@ -150,37 +153,37 @@ class Ce {
|
|
|
150
153
|
* Creates new connections and removes old ones.
|
|
151
154
|
*/
|
|
152
155
|
updateStreams(r) {
|
|
153
|
-
r.forEach((
|
|
154
|
-
const l =
|
|
155
|
-
this.eventSources.has(l) || this.connectStream(
|
|
156
|
+
r.forEach((n) => {
|
|
157
|
+
const l = n.stream.id;
|
|
158
|
+
this.eventSources.has(l) || this.connectStream(n);
|
|
156
159
|
});
|
|
157
|
-
const
|
|
158
|
-
this.eventSources.forEach((
|
|
159
|
-
|
|
160
|
+
const t = new Set(r.map((n) => n.stream.id));
|
|
161
|
+
this.eventSources.forEach((n, l) => {
|
|
162
|
+
t.has(l) || (n.abort(), this.eventSources.delete(l));
|
|
160
163
|
});
|
|
161
164
|
}
|
|
162
165
|
connectStream(r) {
|
|
163
|
-
const
|
|
164
|
-
this.eventSources.set(
|
|
165
|
-
const l = `${this.fency.baseUrl}/sse/streams/${
|
|
166
|
+
const t = r.stream.id, n = new AbortController();
|
|
167
|
+
this.eventSources.set(t, n);
|
|
168
|
+
const l = `${this.fency.baseUrl}/sse/streams/${t}`, c = {
|
|
166
169
|
"X-Fency-Publishable-Key": this.fency.publishableKey,
|
|
167
170
|
"X-Fency-Stream-Token": r.stream.token
|
|
168
171
|
};
|
|
169
|
-
|
|
172
|
+
be(l, {
|
|
170
173
|
headers: c,
|
|
171
|
-
signal:
|
|
172
|
-
async
|
|
174
|
+
signal: n.signal,
|
|
175
|
+
onopen: async (s) => {
|
|
173
176
|
if (!s.ok && s.status >= 400 && s.status < 500 && s.status !== 429)
|
|
174
|
-
throw new Error(`Client error ${s.status}`);
|
|
177
|
+
throw this.eventSources.delete(t), new Error(`Client error ${s.status}`);
|
|
175
178
|
},
|
|
176
179
|
onmessage: (s) => {
|
|
177
180
|
if (s.data) {
|
|
178
|
-
const d =
|
|
179
|
-
this.broadcast(d,
|
|
181
|
+
const d = Ce(s.data);
|
|
182
|
+
this.broadcast(d, t);
|
|
180
183
|
}
|
|
181
184
|
},
|
|
182
185
|
onerror: (s) => {
|
|
183
|
-
throw console.error("EventSource error for stream",
|
|
186
|
+
throw console.error("EventSource error for stream", t, ":", s), this.eventSources.delete(t), this.broadcastError(t, Ee(s)), s;
|
|
184
187
|
},
|
|
185
188
|
onclose() {
|
|
186
189
|
}
|
|
@@ -190,19 +193,19 @@ class Ce {
|
|
|
190
193
|
* Subscribe to events from all active streams.
|
|
191
194
|
* Returns an unsubscribe function.
|
|
192
195
|
*/
|
|
193
|
-
subscribe(r,
|
|
194
|
-
return this.subscribers.set(r,
|
|
196
|
+
subscribe(r, t) {
|
|
197
|
+
return this.subscribers.set(r, t), () => {
|
|
195
198
|
this.subscribers.delete(r);
|
|
196
199
|
};
|
|
197
200
|
}
|
|
198
|
-
broadcast(r,
|
|
199
|
-
this.subscribers.forEach((
|
|
200
|
-
|
|
201
|
+
broadcast(r, t) {
|
|
202
|
+
this.subscribers.forEach((n) => {
|
|
203
|
+
n.onMessage(r, t);
|
|
201
204
|
});
|
|
202
205
|
}
|
|
203
|
-
broadcastError(r) {
|
|
206
|
+
broadcastError(r, t) {
|
|
204
207
|
this.subscribers.forEach((n) => {
|
|
205
|
-
n.onError(r);
|
|
208
|
+
n.onError(r, t);
|
|
206
209
|
});
|
|
207
210
|
}
|
|
208
211
|
/**
|
|
@@ -212,42 +215,50 @@ class Ce {
|
|
|
212
215
|
this.eventSources.forEach((r) => r.abort()), this.eventSources.clear(), this.subscribers.clear();
|
|
213
216
|
}
|
|
214
217
|
}
|
|
215
|
-
const
|
|
218
|
+
const Ie = 48e4, Me = 3e5, K = (e) => {
|
|
216
219
|
const r = Date.now();
|
|
217
|
-
return e.filter((
|
|
220
|
+
return e.filter((t) => r - t.createdAt < Ie);
|
|
218
221
|
};
|
|
219
|
-
function
|
|
220
|
-
const [
|
|
222
|
+
function Ar({ fency: e, fetchCreateStreamClientToken: r, children: t }) {
|
|
223
|
+
const [n, l] = v(
|
|
221
224
|
null
|
|
222
|
-
), [c, s] =
|
|
223
|
-
|
|
225
|
+
), [c, s] = v(!0), [d, m] = v(null), [o, a] = v([]), u = F(null), y = F(null);
|
|
226
|
+
A(() => {
|
|
224
227
|
e.then((h) => {
|
|
225
228
|
l(h), s(!1);
|
|
226
229
|
}).catch((h) => {
|
|
227
230
|
m(h), s(!1);
|
|
228
231
|
});
|
|
229
|
-
}, [e]),
|
|
230
|
-
|
|
231
|
-
}, [
|
|
232
|
-
|
|
233
|
-
}, [o]),
|
|
232
|
+
}, [e]), A(() => {
|
|
233
|
+
n && !y.current && (y.current = new we(n));
|
|
234
|
+
}, [n]), A(() => {
|
|
235
|
+
y.current && y.current.updateStreams(o);
|
|
236
|
+
}, [o]), A(() => () => {
|
|
234
237
|
var h;
|
|
235
|
-
(h =
|
|
238
|
+
(h = y.current) == null || h.cleanup();
|
|
239
|
+
}, []), A(() => {
|
|
240
|
+
const h = setInterval(() => {
|
|
241
|
+
a((S) => {
|
|
242
|
+
const k = K(S);
|
|
243
|
+
return k.length !== S.length ? k : S;
|
|
244
|
+
});
|
|
245
|
+
}, 6e4);
|
|
246
|
+
return () => clearInterval(h);
|
|
236
247
|
}, []);
|
|
237
248
|
const f = G(
|
|
238
|
-
async (h =
|
|
249
|
+
async (h = Me) => {
|
|
239
250
|
if (u.current)
|
|
240
251
|
return u.current;
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
return
|
|
244
|
-
const
|
|
245
|
-
if (!
|
|
252
|
+
const S = Date.now(), k = o.length > 0 ? o[o.length - 1] : null;
|
|
253
|
+
if (k && S - k.createdAt < h)
|
|
254
|
+
return k.stream;
|
|
255
|
+
const C = (async () => {
|
|
256
|
+
if (!n)
|
|
246
257
|
throw new Error("Fency instance not initialized");
|
|
247
|
-
const
|
|
248
|
-
pk:
|
|
249
|
-
baseUrl:
|
|
250
|
-
clientToken: (
|
|
258
|
+
const E = await r(), R = await ae({
|
|
259
|
+
pk: n.publishableKey,
|
|
260
|
+
baseUrl: n.baseUrl,
|
|
261
|
+
clientToken: (E == null ? void 0 : E.clientToken) ?? ""
|
|
251
262
|
});
|
|
252
263
|
if (R.type === "success") {
|
|
253
264
|
const L = {
|
|
@@ -255,56 +266,56 @@ function Ir({ fency: e, fetchCreateStreamClientToken: r, children: n }) {
|
|
|
255
266
|
createdAt: Date.now()
|
|
256
267
|
};
|
|
257
268
|
return a((P) => {
|
|
258
|
-
const
|
|
259
|
-
return
|
|
269
|
+
const M = [...P, L];
|
|
270
|
+
return K(M);
|
|
260
271
|
}), u.current = null, R.stream;
|
|
261
272
|
} else
|
|
262
273
|
throw u.current = null, new Error("Failed to create stream");
|
|
263
274
|
})();
|
|
264
|
-
return u.current =
|
|
275
|
+
return u.current = C, C;
|
|
265
276
|
},
|
|
266
|
-
[
|
|
277
|
+
[n, o]
|
|
267
278
|
);
|
|
268
279
|
if (d)
|
|
269
|
-
return /* @__PURE__ */
|
|
280
|
+
return /* @__PURE__ */ g("div", { children: [
|
|
270
281
|
"Fency error: ",
|
|
271
282
|
d.message
|
|
272
283
|
] });
|
|
273
|
-
if (!
|
|
284
|
+
if (!n)
|
|
274
285
|
return null;
|
|
275
|
-
const
|
|
276
|
-
fency:
|
|
286
|
+
const p = o.length > 0 ? o[o.length - 1] : null, x = {
|
|
287
|
+
fency: n,
|
|
277
288
|
loading: c,
|
|
278
289
|
error: d,
|
|
279
290
|
activeStreams: o,
|
|
280
|
-
latestStream:
|
|
281
|
-
eventManager:
|
|
291
|
+
latestStream: p,
|
|
292
|
+
eventManager: y.current,
|
|
282
293
|
getOrCreateStream: f
|
|
283
294
|
};
|
|
284
|
-
return /* @__PURE__ */ i(
|
|
295
|
+
return /* @__PURE__ */ i(Z.Provider, { value: x, children: t });
|
|
285
296
|
}
|
|
286
|
-
function
|
|
287
|
-
const e =
|
|
297
|
+
function ee() {
|
|
298
|
+
const e = ue(Z);
|
|
288
299
|
if (e === void 0)
|
|
289
300
|
throw new Error("useFencyContext must be used within a FencyProvider");
|
|
290
301
|
return e;
|
|
291
302
|
}
|
|
292
|
-
const
|
|
303
|
+
const Ae = (e) => {
|
|
293
304
|
try {
|
|
294
305
|
const r = JSON.parse(e);
|
|
295
|
-
return
|
|
306
|
+
return Fe(r);
|
|
296
307
|
} catch (r) {
|
|
297
308
|
return console.error("Error parsing message:", r), null;
|
|
298
309
|
}
|
|
299
|
-
},
|
|
310
|
+
}, Fe = (e) => se(e) ? Re(e) : le(e) ? Pe(e) : ce(e) ? De(e) : null, Re = (e) => ({
|
|
300
311
|
type: "STREAM_TIMEOUT",
|
|
301
312
|
streamId: e.streamId,
|
|
302
313
|
timestamp: e.timestamp
|
|
303
|
-
}),
|
|
314
|
+
}), Pe = (e) => ({
|
|
304
315
|
type: "STREAM_NOT_FOUND",
|
|
305
316
|
streamId: e.streamId,
|
|
306
317
|
timestamp: e.timestamp
|
|
307
|
-
}),
|
|
318
|
+
}), De = (e) => ({
|
|
308
319
|
type: "AGENT_TASK_PROGRESS_ITEM_UPDATED",
|
|
309
320
|
streamId: e.streamId,
|
|
310
321
|
agentTaskId: e.agentTaskId,
|
|
@@ -312,34 +323,34 @@ const Ie = (e) => {
|
|
|
312
323
|
timestamp: e.timestamp,
|
|
313
324
|
createdAt: e.createdAt,
|
|
314
325
|
data: JSON.parse(e.data)
|
|
315
|
-
}),
|
|
316
|
-
const r =
|
|
317
|
-
return
|
|
326
|
+
}), Le = (e) => {
|
|
327
|
+
const r = ee(), [t, n] = v(null), l = F(`subscriber-${Math.random().toString(36).substr(2, 9)}`);
|
|
328
|
+
return A(() => {
|
|
318
329
|
if (!r.eventManager) return;
|
|
319
330
|
const s = {
|
|
320
331
|
onMessage: (m, o) => {
|
|
321
|
-
var u,
|
|
322
|
-
const a =
|
|
332
|
+
var u, y, f;
|
|
333
|
+
const a = Ae(m);
|
|
323
334
|
if (a)
|
|
324
335
|
switch (a.type) {
|
|
325
336
|
case "STREAM_TIMEOUT":
|
|
326
337
|
(u = e == null ? void 0 : e.onStreamTimeout) == null || u.call(e, a);
|
|
327
338
|
break;
|
|
328
339
|
case "STREAM_NOT_FOUND":
|
|
329
|
-
(
|
|
340
|
+
(y = e == null ? void 0 : e.onStreamNotFound) == null || y.call(e, a);
|
|
330
341
|
break;
|
|
331
342
|
case "AGENT_TASK_PROGRESS_ITEM_UPDATED":
|
|
332
343
|
(f = e == null ? void 0 : e.onAgentTaskProgressItemUpdated) == null || f.call(e, a);
|
|
333
344
|
break;
|
|
334
345
|
}
|
|
335
346
|
},
|
|
336
|
-
onError: (m) => {
|
|
337
|
-
var
|
|
338
|
-
(
|
|
347
|
+
onError: (m, o) => {
|
|
348
|
+
var a;
|
|
349
|
+
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, {
|
|
339
350
|
streamId: m,
|
|
340
351
|
error: {
|
|
341
352
|
code: "UnknownError",
|
|
342
|
-
message: "Unknown error in useStream"
|
|
353
|
+
message: o ?? "Unknown error in useStream"
|
|
343
354
|
}
|
|
344
355
|
});
|
|
345
356
|
}
|
|
@@ -351,8 +362,8 @@ const Ie = (e) => {
|
|
|
351
362
|
}, [r.eventManager, e]), {
|
|
352
363
|
createStream: async () => {
|
|
353
364
|
try {
|
|
354
|
-
const s = await r.getOrCreateStream(
|
|
355
|
-
return
|
|
365
|
+
const s = await r.getOrCreateStream();
|
|
366
|
+
return n(s), {
|
|
356
367
|
type: "success",
|
|
357
368
|
stream: s
|
|
358
369
|
};
|
|
@@ -366,71 +377,63 @@ const Ie = (e) => {
|
|
|
366
377
|
};
|
|
367
378
|
}
|
|
368
379
|
},
|
|
369
|
-
stream:
|
|
380
|
+
stream: t
|
|
370
381
|
};
|
|
371
|
-
},
|
|
372
|
-
const r =
|
|
382
|
+
}, Fr = (e) => {
|
|
383
|
+
const r = ee(), [t, n] = v([]), l = F(/* @__PURE__ */ new Set()), c = F(/* @__PURE__ */ new Map()), { createStream: s } = Le({
|
|
373
384
|
onAgentTaskProgressItemUpdated: (o) => {
|
|
374
|
-
var
|
|
385
|
+
var y;
|
|
375
386
|
if (!l.current.has(o.agentTaskId)) return;
|
|
376
387
|
const a = o.data;
|
|
377
388
|
if (a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed" || a.taskType === "MemoryChat" && a.eventType === "Completed" || a.taskType === "MemorySearch" && a.eventType === "Completed") {
|
|
378
389
|
const f = a.taskType === "MemorySearch" && a.eventType === "Completed" || a.taskType === "StructuredChatCompletion" && a.eventType === "Completed";
|
|
379
|
-
|
|
380
|
-
f ? (
|
|
381
|
-
var
|
|
382
|
-
if (((
|
|
390
|
+
n(
|
|
391
|
+
f ? (x) => x.map((h) => {
|
|
392
|
+
var C;
|
|
393
|
+
if (((C = h.confirmedData) == null ? void 0 : C.taskId) !== o.agentTaskId)
|
|
383
394
|
return h;
|
|
384
|
-
const
|
|
385
|
-
(
|
|
395
|
+
const k = h.progressItems.some(
|
|
396
|
+
(E) => E.progressItemId === o.progressItemId
|
|
386
397
|
) ? h.progressItems.map(
|
|
387
|
-
(
|
|
398
|
+
(E) => E.progressItemId === o.progressItemId ? o : E
|
|
388
399
|
) : [...h.progressItems, o];
|
|
389
400
|
return {
|
|
390
401
|
...h,
|
|
391
|
-
progressItems:
|
|
402
|
+
progressItems: k,
|
|
392
403
|
loading: !1
|
|
393
404
|
};
|
|
394
|
-
}) : (
|
|
405
|
+
}) : (x) => x.map(
|
|
395
406
|
(h) => {
|
|
396
|
-
var
|
|
397
|
-
return ((
|
|
407
|
+
var S;
|
|
408
|
+
return ((S = h.confirmedData) == null ? void 0 : S.taskId) === o.agentTaskId ? { ...h, loading: !1 } : h;
|
|
398
409
|
}
|
|
399
410
|
)
|
|
400
411
|
);
|
|
401
|
-
const
|
|
412
|
+
const p = c.current.get(
|
|
402
413
|
o.agentTaskId
|
|
403
414
|
);
|
|
404
|
-
|
|
415
|
+
p && (c.current.delete(o.agentTaskId), p(a));
|
|
405
416
|
return;
|
|
406
417
|
}
|
|
407
|
-
(
|
|
408
|
-
(f) => f.map((
|
|
409
|
-
var
|
|
410
|
-
if (((
|
|
411
|
-
return
|
|
412
|
-
const h =
|
|
413
|
-
(
|
|
414
|
-
) ?
|
|
415
|
-
(
|
|
416
|
-
) : [...
|
|
417
|
-
return { ...
|
|
418
|
+
(y = e.onAgentTaskProgressItemUpdated) == null || y.call(e, o), n(
|
|
419
|
+
(f) => f.map((p) => {
|
|
420
|
+
var S;
|
|
421
|
+
if (((S = p.confirmedData) == null ? void 0 : S.taskId) !== o.agentTaskId)
|
|
422
|
+
return p;
|
|
423
|
+
const h = p.progressItems.some(
|
|
424
|
+
(k) => k.progressItemId === o.progressItemId
|
|
425
|
+
) ? p.progressItems.map(
|
|
426
|
+
(k) => k.progressItemId === o.progressItemId ? o : k
|
|
427
|
+
) : [...p.progressItems, o];
|
|
428
|
+
return { ...p, progressItems: h };
|
|
418
429
|
})
|
|
419
430
|
);
|
|
420
431
|
},
|
|
421
432
|
onStreamError: (o) => {
|
|
422
433
|
var a;
|
|
423
|
-
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o),
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
...u.filter((f) => f.streamId !== o.streamId),
|
|
427
|
-
{
|
|
428
|
-
...g,
|
|
429
|
-
loading: !1,
|
|
430
|
-
error: o.error
|
|
431
|
-
}
|
|
432
|
-
] : u;
|
|
433
|
-
});
|
|
434
|
+
(a = e == null ? void 0 : e.onStreamError) == null || a.call(e, o), n(
|
|
435
|
+
(u) => u.map((y) => y.streamId !== o.streamId || !y.loading ? y : { ...y, loading: !1, error: o.error })
|
|
436
|
+
);
|
|
434
437
|
},
|
|
435
438
|
onStreamNotFound: (o) => {
|
|
436
439
|
var a;
|
|
@@ -442,27 +445,26 @@ const Ie = (e) => {
|
|
|
442
445
|
}
|
|
443
446
|
}), d = G(
|
|
444
447
|
async (o, a) => {
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
const { clientToken: f } = await e.fetchCreateAgentTaskClientToken(o.type), y = await ce({
|
|
448
|
+
var f;
|
|
449
|
+
const u = `task-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, y = await s();
|
|
450
|
+
if (y.type === "success") {
|
|
451
|
+
const p = (/* @__PURE__ */ new Date()).toISOString(), x = {
|
|
452
|
+
taskKey: u,
|
|
453
|
+
streamId: y.stream.id,
|
|
454
|
+
triggeredAt: p,
|
|
455
|
+
confirmedData: null,
|
|
456
|
+
error: null,
|
|
457
|
+
params: o,
|
|
458
|
+
progressItems: [],
|
|
459
|
+
loading: !0,
|
|
460
|
+
loadingText: a == null ? void 0 : a.loadingText
|
|
461
|
+
};
|
|
462
|
+
n((k) => [...k, x]), (f = a == null ? void 0 : a.onTaskRegistered) == null || f.call(a, x);
|
|
463
|
+
const { clientToken: h } = await e.fetchCreateAgentTaskClientToken(o.type), S = await de({
|
|
462
464
|
pk: r.fency.publishableKey,
|
|
463
465
|
baseUrl: r.fency.baseUrl,
|
|
464
|
-
clientToken:
|
|
465
|
-
streamToken:
|
|
466
|
+
clientToken: h,
|
|
467
|
+
streamToken: y.stream.token,
|
|
466
468
|
request: {
|
|
467
469
|
streamingChatCompletionTask: o.type === "StreamingChatCompletion" ? {
|
|
468
470
|
messages: o.messages,
|
|
@@ -492,50 +494,50 @@ const Ie = (e) => {
|
|
|
492
494
|
} : void 0
|
|
493
495
|
}
|
|
494
496
|
});
|
|
495
|
-
if (
|
|
497
|
+
if (S.type === "success" && S.agentTask) {
|
|
496
498
|
l.current.add(
|
|
497
|
-
|
|
498
|
-
),
|
|
499
|
-
...
|
|
499
|
+
S.agentTask.id
|
|
500
|
+
), n((C) => [
|
|
501
|
+
...C.filter((E) => E.taskKey !== u),
|
|
500
502
|
{
|
|
501
503
|
taskKey: u,
|
|
502
|
-
streamId:
|
|
504
|
+
streamId: y.stream.id,
|
|
503
505
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
504
|
-
taskId:
|
|
505
|
-
createdAt:
|
|
506
|
+
taskId: S.agentTask.id,
|
|
507
|
+
createdAt: S.agentTask.createdAt,
|
|
506
508
|
error: null,
|
|
507
509
|
params: o,
|
|
508
510
|
progressItems: [],
|
|
509
511
|
loading: !0,
|
|
510
512
|
loadingText: a == null ? void 0 : a.loadingText,
|
|
511
513
|
confirmedData: {
|
|
512
|
-
taskId:
|
|
513
|
-
createdAt:
|
|
514
|
+
taskId: S.agentTask.id,
|
|
515
|
+
createdAt: S.agentTask.createdAt
|
|
514
516
|
}
|
|
515
517
|
}
|
|
516
518
|
]);
|
|
517
|
-
const
|
|
519
|
+
const k = await new Promise((C) => {
|
|
518
520
|
c.current.set(
|
|
519
|
-
|
|
520
|
-
|
|
521
|
+
S.agentTask.id,
|
|
522
|
+
C
|
|
521
523
|
);
|
|
522
524
|
});
|
|
523
525
|
return {
|
|
524
526
|
type: "success",
|
|
525
|
-
streamId:
|
|
526
|
-
agentTaskId:
|
|
527
|
-
response:
|
|
527
|
+
streamId: y.stream.id,
|
|
528
|
+
agentTaskId: S.agentTask.id,
|
|
529
|
+
response: k
|
|
528
530
|
};
|
|
529
531
|
} else {
|
|
530
|
-
if (
|
|
531
|
-
return
|
|
532
|
-
...
|
|
532
|
+
if (S.type === "error")
|
|
533
|
+
return n((k) => [
|
|
534
|
+
...k.filter((C) => C.taskKey !== u),
|
|
533
535
|
{
|
|
534
536
|
taskKey: u,
|
|
535
537
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
536
|
-
streamId:
|
|
538
|
+
streamId: y.stream.id,
|
|
537
539
|
params: o,
|
|
538
|
-
error:
|
|
540
|
+
error: S.error,
|
|
539
541
|
progressItems: [],
|
|
540
542
|
loading: !1,
|
|
541
543
|
loadingText: a == null ? void 0 : a.loadingText,
|
|
@@ -543,20 +545,20 @@ const Ie = (e) => {
|
|
|
543
545
|
}
|
|
544
546
|
]), {
|
|
545
547
|
type: "error",
|
|
546
|
-
error:
|
|
548
|
+
error: S.error
|
|
547
549
|
};
|
|
548
550
|
{
|
|
549
|
-
const
|
|
551
|
+
const k = {
|
|
550
552
|
message: "No response received",
|
|
551
553
|
code: "UnknownError"
|
|
552
554
|
};
|
|
553
|
-
return
|
|
554
|
-
...
|
|
555
|
+
return n((C) => [
|
|
556
|
+
...C.filter((E) => E.taskKey !== u),
|
|
555
557
|
{
|
|
556
558
|
taskKey: u,
|
|
557
559
|
triggeredAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
558
|
-
streamId:
|
|
559
|
-
error:
|
|
560
|
+
streamId: y.stream.id,
|
|
561
|
+
error: k,
|
|
560
562
|
params: o,
|
|
561
563
|
progressItems: [],
|
|
562
564
|
loading: !1,
|
|
@@ -565,47 +567,47 @@ const Ie = (e) => {
|
|
|
565
567
|
}
|
|
566
568
|
]), {
|
|
567
569
|
type: "error",
|
|
568
|
-
error:
|
|
570
|
+
error: k
|
|
569
571
|
};
|
|
570
572
|
}
|
|
571
573
|
}
|
|
572
574
|
} else
|
|
573
|
-
return console.error(
|
|
575
|
+
return console.error(y.error), y;
|
|
574
576
|
},
|
|
575
|
-
[r,
|
|
577
|
+
[r, s, e.fetchCreateAgentTaskClientToken]
|
|
576
578
|
), m = D(() => {
|
|
577
|
-
if (
|
|
578
|
-
return [...
|
|
579
|
-
}, [
|
|
580
|
-
return
|
|
579
|
+
if (t.length !== 0)
|
|
580
|
+
return [...t].sort((o, a) => new Date(a.triggeredAt).getTime() - new Date(o.triggeredAt).getTime())[0];
|
|
581
|
+
}, [t]);
|
|
582
|
+
return A(() => () => {
|
|
581
583
|
l.current.clear(), c.current.clear();
|
|
582
584
|
}, []), {
|
|
583
|
-
agentTasks:
|
|
585
|
+
agentTasks: t,
|
|
584
586
|
createAgentTask: d,
|
|
585
587
|
latest: m
|
|
586
588
|
};
|
|
587
589
|
};
|
|
588
|
-
function
|
|
589
|
-
return e.progressItems.map((r,
|
|
590
|
-
const
|
|
590
|
+
function ze(e) {
|
|
591
|
+
return e.progressItems.map((r, t) => {
|
|
592
|
+
const n = e.progressItems[t + 1], l = n != null;
|
|
591
593
|
let c;
|
|
592
|
-
if (
|
|
593
|
-
const s = new Date(r.createdAt).getTime(), d = new Date(
|
|
594
|
+
if (n != null && n.createdAt) {
|
|
595
|
+
const s = new Date(r.createdAt).getTime(), d = new Date(n.createdAt).getTime();
|
|
594
596
|
c = Math.round((d - s) / 1e3);
|
|
595
597
|
}
|
|
596
598
|
return {
|
|
597
599
|
item: r,
|
|
598
600
|
completed: l,
|
|
599
|
-
isLatest:
|
|
601
|
+
isLatest: t === e.progressItems.length - 1,
|
|
600
602
|
durationSeconds: c
|
|
601
603
|
};
|
|
602
604
|
});
|
|
603
605
|
}
|
|
604
|
-
function
|
|
606
|
+
function w({
|
|
605
607
|
text: e,
|
|
606
608
|
duration: r = 2,
|
|
607
|
-
delay:
|
|
608
|
-
repeat:
|
|
609
|
+
delay: t = 0,
|
|
610
|
+
repeat: n = !0,
|
|
609
611
|
repeatDelay: l = 0.5,
|
|
610
612
|
className: c,
|
|
611
613
|
startOnView: s = !1,
|
|
@@ -614,11 +616,11 @@ function C({
|
|
|
614
616
|
spread: o = 2,
|
|
615
617
|
color: a = "#999",
|
|
616
618
|
shimmerColor: u = "#000",
|
|
617
|
-
direction:
|
|
619
|
+
direction: y = "fromBottom"
|
|
618
620
|
}) {
|
|
619
|
-
const f =
|
|
621
|
+
const f = F(null), p = ye(f, { once: d, margin: m }), x = D(() => e.length * o, [e, o]), h = !s || p, S = y === "fromBottom" ? "100% center" : "-100% center", k = y === "fromBottom" ? "0% center" : "200% center";
|
|
620
622
|
return /* @__PURE__ */ i(
|
|
621
|
-
|
|
623
|
+
b.span,
|
|
622
624
|
{
|
|
623
625
|
ref: f,
|
|
624
626
|
className: c,
|
|
@@ -631,49 +633,49 @@ function C({
|
|
|
631
633
|
color: "transparent",
|
|
632
634
|
WebkitTextFillColor: "transparent",
|
|
633
635
|
backgroundRepeat: "no-repeat, padding-box",
|
|
634
|
-
"--spread": `${
|
|
636
|
+
"--spread": `${x}px`,
|
|
635
637
|
"--base-color": a,
|
|
636
638
|
"--shimmer-color": u,
|
|
637
639
|
"--shimmer-bg": "linear-gradient(90deg, transparent calc(50% - var(--spread)), var(--shimmer-color), transparent calc(50% + var(--spread)))",
|
|
638
640
|
backgroundImage: "var(--shimmer-bg), linear-gradient(var(--base-color), var(--base-color))"
|
|
639
641
|
},
|
|
640
642
|
initial: {
|
|
641
|
-
backgroundPosition:
|
|
643
|
+
backgroundPosition: S,
|
|
642
644
|
opacity: 0
|
|
643
645
|
},
|
|
644
646
|
animate: h ? {
|
|
645
|
-
backgroundPosition:
|
|
647
|
+
backgroundPosition: k,
|
|
646
648
|
opacity: 1
|
|
647
649
|
} : {},
|
|
648
650
|
transition: {
|
|
649
651
|
backgroundPosition: {
|
|
650
|
-
repeat:
|
|
652
|
+
repeat: n ? 1 / 0 : 0,
|
|
651
653
|
duration: r,
|
|
652
|
-
delay:
|
|
654
|
+
delay: t,
|
|
653
655
|
repeatDelay: l,
|
|
654
656
|
ease: "linear"
|
|
655
657
|
},
|
|
656
658
|
opacity: {
|
|
657
659
|
duration: 0.3,
|
|
658
|
-
delay:
|
|
660
|
+
delay: t
|
|
659
661
|
}
|
|
660
662
|
},
|
|
661
663
|
children: e
|
|
662
664
|
}
|
|
663
665
|
);
|
|
664
666
|
}
|
|
665
|
-
function
|
|
666
|
-
const
|
|
667
|
-
if (
|
|
667
|
+
function Oe(e, r) {
|
|
668
|
+
const t = e.item.data;
|
|
669
|
+
if (t.eventType === "Error" && "message" in t)
|
|
668
670
|
return r.error;
|
|
669
|
-
if (
|
|
670
|
-
if (
|
|
671
|
-
if (
|
|
671
|
+
if (t.taskType === "StreamingChatCompletion") {
|
|
672
|
+
if (t.eventType === "Text") return r.streaming;
|
|
673
|
+
if (t.eventType === "Completed") return r.completed;
|
|
672
674
|
}
|
|
673
|
-
if (
|
|
675
|
+
if (t.taskType === "StructuredChatCompletion" && t.eventType === "Completed")
|
|
674
676
|
return r.completed;
|
|
675
|
-
if (
|
|
676
|
-
switch (
|
|
677
|
+
if (t.taskType === "MemorySearch")
|
|
678
|
+
switch (t.eventType) {
|
|
677
679
|
case "GeneratingQueries":
|
|
678
680
|
return r.memorySearchGeneratingQueries;
|
|
679
681
|
case "ExploreQueries":
|
|
@@ -683,8 +685,8 @@ function Le(e, r) {
|
|
|
683
685
|
case "Completed":
|
|
684
686
|
return r.completed;
|
|
685
687
|
}
|
|
686
|
-
if (
|
|
687
|
-
switch (
|
|
688
|
+
if (t.taskType === "MemoryChat")
|
|
689
|
+
switch (t.eventType) {
|
|
688
690
|
case "Text":
|
|
689
691
|
return r.streaming;
|
|
690
692
|
case "Search":
|
|
@@ -706,28 +708,28 @@ function Le(e, r) {
|
|
|
706
708
|
}
|
|
707
709
|
return r.processing;
|
|
708
710
|
}
|
|
709
|
-
const
|
|
710
|
-
const
|
|
711
|
-
if (!
|
|
712
|
-
const
|
|
713
|
-
return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(
|
|
714
|
-
|
|
711
|
+
const Ne = ({ progressViewItems: e, t: r }) => {
|
|
712
|
+
const t = e[e.length - 1];
|
|
713
|
+
if (!t) return null;
|
|
714
|
+
const n = Oe(t, r);
|
|
715
|
+
return /* @__PURE__ */ i("div", { className: "simple-mode-container", children: /* @__PURE__ */ i(J, { mode: "wait", children: /* @__PURE__ */ i(
|
|
716
|
+
b.div,
|
|
715
717
|
{
|
|
716
718
|
initial: { opacity: 0, y: 10 },
|
|
717
719
|
animate: { opacity: 1, y: 0 },
|
|
718
720
|
exit: { opacity: 0, y: -10 },
|
|
719
721
|
transition: { duration: 0.3 },
|
|
720
|
-
children:
|
|
722
|
+
children: t.completed ? /* @__PURE__ */ i(
|
|
721
723
|
"div",
|
|
722
724
|
{
|
|
723
725
|
className: "simple-mode-title",
|
|
724
726
|
style: { color: "#666" },
|
|
725
|
-
children:
|
|
727
|
+
children: n
|
|
726
728
|
}
|
|
727
729
|
) : /* @__PURE__ */ i(
|
|
728
|
-
|
|
730
|
+
w,
|
|
729
731
|
{
|
|
730
|
-
text:
|
|
732
|
+
text: n,
|
|
731
733
|
className: "simple-mode-title",
|
|
732
734
|
duration: 2.5,
|
|
733
735
|
repeat: !0,
|
|
@@ -736,9 +738,9 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
736
738
|
}
|
|
737
739
|
)
|
|
738
740
|
},
|
|
739
|
-
|
|
741
|
+
t.item.progressItemId
|
|
740
742
|
) }) });
|
|
741
|
-
},
|
|
743
|
+
}, re = {
|
|
742
744
|
'code[class*="language-"]': {
|
|
743
745
|
color: "#f8f8f2",
|
|
744
746
|
background: "none",
|
|
@@ -889,57 +891,57 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
889
891
|
italic: {
|
|
890
892
|
fontStyle: "italic"
|
|
891
893
|
}
|
|
892
|
-
},
|
|
894
|
+
}, V = ({
|
|
893
895
|
text: e
|
|
894
896
|
}) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
895
|
-
|
|
897
|
+
b.div,
|
|
896
898
|
{
|
|
897
899
|
className: "fency-markdown-body-raw",
|
|
898
900
|
initial: { opacity: 0, y: -10 },
|
|
899
901
|
animate: { opacity: 1, y: 0 },
|
|
900
902
|
transition: { duration: 0.3, delay: 0 },
|
|
901
903
|
children: /* @__PURE__ */ i(
|
|
902
|
-
|
|
904
|
+
ge,
|
|
903
905
|
{
|
|
904
906
|
remarkPlugins: [pe],
|
|
905
907
|
components: {
|
|
906
908
|
code(r) {
|
|
907
|
-
const { children:
|
|
909
|
+
const { children: t, className: n, node: l, ref: c, ...s } = r, d = /language-(\w+)/.exec(n || "");
|
|
908
910
|
return d ? (
|
|
909
911
|
// @ts-expect-error react-syntax-highlighter types incompatible with @types/react 18
|
|
910
912
|
/* @__PURE__ */ i(
|
|
911
|
-
|
|
913
|
+
Y,
|
|
912
914
|
{
|
|
913
915
|
...s,
|
|
914
916
|
PreTag: "div",
|
|
915
|
-
children: String(
|
|
917
|
+
children: String(t).replace(/\n$/, ""),
|
|
916
918
|
language: d[1],
|
|
917
|
-
style:
|
|
919
|
+
style: re
|
|
918
920
|
}
|
|
919
921
|
)
|
|
920
|
-
) : /* @__PURE__ */ i("code", { ...s, className:
|
|
922
|
+
) : /* @__PURE__ */ i("code", { ...s, className: n, children: String(t) });
|
|
921
923
|
}
|
|
922
924
|
},
|
|
923
925
|
children: e
|
|
924
926
|
}
|
|
925
927
|
)
|
|
926
928
|
}
|
|
927
|
-
) }),
|
|
929
|
+
) }), Be = ({ data: e }) => {
|
|
928
930
|
const r = JSON.stringify(
|
|
929
931
|
JSON.parse(e.response.jsonResponse),
|
|
930
932
|
null,
|
|
931
933
|
2
|
|
932
934
|
);
|
|
933
935
|
return /* @__PURE__ */ i("div", { id: "structured-chat-completion-response", children: /* @__PURE__ */ i(
|
|
934
|
-
|
|
936
|
+
b.div,
|
|
935
937
|
{
|
|
936
938
|
initial: { opacity: 0, y: -10 },
|
|
937
939
|
animate: { opacity: 1, y: 0 },
|
|
938
940
|
transition: { duration: 0.3, delay: 0 },
|
|
939
|
-
children: /* @__PURE__ */ i(
|
|
941
|
+
children: /* @__PURE__ */ i(Y, { language: "json", style: re, PreTag: "div", children: r })
|
|
940
942
|
}
|
|
941
943
|
) });
|
|
942
|
-
},
|
|
944
|
+
}, We = {
|
|
943
945
|
en: {
|
|
944
946
|
error: "Error",
|
|
945
947
|
streaming: "Streaming...",
|
|
@@ -1059,56 +1061,56 @@ const ze = ({ progressViewItems: e, t: r }) => {
|
|
|
1059
1061
|
memorySearchExploreNoResults: "Ingen resultater funnet"
|
|
1060
1062
|
}
|
|
1061
1063
|
};
|
|
1062
|
-
function
|
|
1063
|
-
return
|
|
1064
|
+
function $e(e) {
|
|
1065
|
+
return We[e];
|
|
1064
1066
|
}
|
|
1065
|
-
function
|
|
1067
|
+
function T(e, r) {
|
|
1066
1068
|
return Object.entries(r).reduce(
|
|
1067
|
-
(
|
|
1069
|
+
(t, [n, l]) => t.replace(`{${n}}`, String(l)),
|
|
1068
1070
|
e
|
|
1069
1071
|
);
|
|
1070
1072
|
}
|
|
1071
1073
|
function Q(e, r) {
|
|
1072
|
-
const
|
|
1073
|
-
if (r != null &&
|
|
1074
|
-
const
|
|
1075
|
-
return
|
|
1074
|
+
const t = e.map((n) => `'${n}'`);
|
|
1075
|
+
if (r != null && t.length >= 2) {
|
|
1076
|
+
const n = t.pop();
|
|
1077
|
+
return t.length > 0 ? `${t.join(", ")} ${r} ${n}` : n;
|
|
1076
1078
|
}
|
|
1077
|
-
return
|
|
1079
|
+
return t.join(", ");
|
|
1078
1080
|
}
|
|
1079
|
-
const W = 5,
|
|
1080
|
-
const [l, c] =
|
|
1081
|
+
const W = 5, He = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1082
|
+
const [l, c] = v(!1), d = (e.memories ?? []).map((h) => h.memoryTitle), m = d.length > 0, o = m && d.length > W, a = o && !l ? d.slice(0, W) : d, u = d.length - W, y = !o || l, f = `${n.searchingFor}'${e.queryDescription}'`, p = m ? `${n.searchingIn}${Q(
|
|
1081
1083
|
a,
|
|
1082
|
-
|
|
1083
|
-
)}` : "",
|
|
1084
|
-
return /* @__PURE__ */
|
|
1084
|
+
y ? n.and : void 0
|
|
1085
|
+
)}` : "", x = m ? `${f}${p}` : `${n.searchingPrefix}${e.queryDescription}`;
|
|
1086
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
1085
1087
|
/* @__PURE__ */ i(
|
|
1086
|
-
|
|
1088
|
+
b.div,
|
|
1087
1089
|
{
|
|
1088
1090
|
style: { color: "#666" },
|
|
1089
1091
|
initial: { opacity: 0, y: -10 },
|
|
1090
1092
|
animate: { opacity: 1, y: 0 },
|
|
1091
1093
|
transition: { duration: 0.3, delay: 0 },
|
|
1092
|
-
children: r && !
|
|
1093
|
-
|
|
1094
|
+
children: r && !t && !o ? /* @__PURE__ */ i(
|
|
1095
|
+
w,
|
|
1094
1096
|
{
|
|
1095
|
-
text:
|
|
1097
|
+
text: x,
|
|
1096
1098
|
duration: 2.5,
|
|
1097
1099
|
repeat: !0,
|
|
1098
1100
|
color: "#999",
|
|
1099
1101
|
shimmerColor: "#000"
|
|
1100
1102
|
}
|
|
1101
|
-
) : /* @__PURE__ */
|
|
1102
|
-
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */
|
|
1103
|
-
|
|
1104
|
-
/* @__PURE__ */
|
|
1103
|
+
) : /* @__PURE__ */ g(I, { children: [
|
|
1104
|
+
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: m ? /* @__PURE__ */ g(I, { children: [
|
|
1105
|
+
n.searchingFor,
|
|
1106
|
+
/* @__PURE__ */ g("span", { style: { fontWeight: 600 }, children: [
|
|
1105
1107
|
"'",
|
|
1106
1108
|
e.queryDescription,
|
|
1107
1109
|
"'"
|
|
1108
1110
|
] }),
|
|
1109
|
-
|
|
1110
|
-
] }) : `${
|
|
1111
|
-
o && !l && /* @__PURE__ */
|
|
1111
|
+
p
|
|
1112
|
+
] }) : `${n.searchingPrefix}${e.queryDescription}` }),
|
|
1113
|
+
o && !l && /* @__PURE__ */ g(I, { children: [
|
|
1112
1114
|
" ",
|
|
1113
1115
|
/* @__PURE__ */ i(
|
|
1114
1116
|
"button",
|
|
@@ -1126,13 +1128,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1126
1128
|
textDecoration: "underline",
|
|
1127
1129
|
fontFamily: "inherit"
|
|
1128
1130
|
},
|
|
1129
|
-
children:
|
|
1131
|
+
children: T(n.moreMemories, {
|
|
1130
1132
|
n: u
|
|
1131
1133
|
})
|
|
1132
1134
|
}
|
|
1133
1135
|
)
|
|
1134
1136
|
] }),
|
|
1135
|
-
o && l && /* @__PURE__ */
|
|
1137
|
+
o && l && /* @__PURE__ */ g(I, { children: [
|
|
1136
1138
|
" ",
|
|
1137
1139
|
/* @__PURE__ */ i(
|
|
1138
1140
|
"button",
|
|
@@ -1150,14 +1152,14 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1150
1152
|
textDecoration: "underline",
|
|
1151
1153
|
fontFamily: "inherit"
|
|
1152
1154
|
},
|
|
1153
|
-
children:
|
|
1155
|
+
children: n.clickToCollapse
|
|
1154
1156
|
}
|
|
1155
1157
|
)
|
|
1156
1158
|
] })
|
|
1157
1159
|
] })
|
|
1158
1160
|
}
|
|
1159
1161
|
),
|
|
1160
|
-
|
|
1162
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
1161
1163
|
"div",
|
|
1162
1164
|
{
|
|
1163
1165
|
style: {
|
|
@@ -1166,18 +1168,18 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1166
1168
|
marginTop: "4px",
|
|
1167
1169
|
fontStyle: "italic"
|
|
1168
1170
|
},
|
|
1169
|
-
children:
|
|
1171
|
+
children: T(n.tookSeconds, { n: t })
|
|
1170
1172
|
}
|
|
1171
1173
|
)
|
|
1172
1174
|
] });
|
|
1173
|
-
}, $ = 5,
|
|
1174
|
-
const [l, c] =
|
|
1175
|
+
}, $ = 5, _e = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1176
|
+
const [l, c] = v(!1), s = e.titles, d = s.length > 0, m = d && s.length > $, o = m && !l ? s.slice(0, $) : s, a = s.length - $, u = !m || l, y = d ? `${n.findingMemoriesIn}${Q(
|
|
1175
1177
|
o,
|
|
1176
|
-
u ?
|
|
1177
|
-
)}` :
|
|
1178
|
-
return /* @__PURE__ */
|
|
1178
|
+
u ? n.and : void 0
|
|
1179
|
+
)}` : n.findingMemories;
|
|
1180
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
1179
1181
|
/* @__PURE__ */ i(
|
|
1180
|
-
|
|
1182
|
+
b.div,
|
|
1181
1183
|
{
|
|
1182
1184
|
style: {
|
|
1183
1185
|
color: "#666"
|
|
@@ -1185,18 +1187,18 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1185
1187
|
initial: { opacity: 0, y: -10 },
|
|
1186
1188
|
animate: { opacity: 1, y: 0 },
|
|
1187
1189
|
transition: { duration: 0.3, delay: 0 },
|
|
1188
|
-
children: r && !
|
|
1189
|
-
|
|
1190
|
+
children: r && !t && !m ? /* @__PURE__ */ i(
|
|
1191
|
+
w,
|
|
1190
1192
|
{
|
|
1191
|
-
text:
|
|
1193
|
+
text: y,
|
|
1192
1194
|
duration: 2.5,
|
|
1193
1195
|
repeat: !0,
|
|
1194
1196
|
color: "#999",
|
|
1195
1197
|
shimmerColor: "#000"
|
|
1196
1198
|
}
|
|
1197
|
-
) : /* @__PURE__ */
|
|
1198
|
-
/* @__PURE__ */ i("span", { style: { color: "#666" }, children:
|
|
1199
|
-
m && !l && /* @__PURE__ */
|
|
1199
|
+
) : /* @__PURE__ */ g(I, { children: [
|
|
1200
|
+
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
|
|
1201
|
+
m && !l && /* @__PURE__ */ g(I, { children: [
|
|
1200
1202
|
" ",
|
|
1201
1203
|
/* @__PURE__ */ i(
|
|
1202
1204
|
"button",
|
|
@@ -1214,13 +1216,13 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1214
1216
|
textDecoration: "underline",
|
|
1215
1217
|
fontFamily: "inherit"
|
|
1216
1218
|
},
|
|
1217
|
-
children:
|
|
1219
|
+
children: T(n.moreMemories, {
|
|
1218
1220
|
n: a
|
|
1219
1221
|
})
|
|
1220
1222
|
}
|
|
1221
1223
|
)
|
|
1222
1224
|
] }),
|
|
1223
|
-
m && l && /* @__PURE__ */
|
|
1225
|
+
m && l && /* @__PURE__ */ g(I, { children: [
|
|
1224
1226
|
" ",
|
|
1225
1227
|
/* @__PURE__ */ i(
|
|
1226
1228
|
"button",
|
|
@@ -1238,14 +1240,14 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1238
1240
|
textDecoration: "underline",
|
|
1239
1241
|
fontFamily: "inherit"
|
|
1240
1242
|
},
|
|
1241
|
-
children:
|
|
1243
|
+
children: n.clickToCollapse
|
|
1242
1244
|
}
|
|
1243
1245
|
)
|
|
1244
1246
|
] })
|
|
1245
1247
|
] })
|
|
1246
1248
|
}
|
|
1247
1249
|
),
|
|
1248
|
-
|
|
1250
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
1249
1251
|
"div",
|
|
1250
1252
|
{
|
|
1251
1253
|
style: {
|
|
@@ -1254,31 +1256,31 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1254
1256
|
marginTop: "4px",
|
|
1255
1257
|
fontStyle: "italic"
|
|
1256
1258
|
},
|
|
1257
|
-
children:
|
|
1259
|
+
children: T(n.tookSeconds, { n: t })
|
|
1258
1260
|
}
|
|
1259
1261
|
)
|
|
1260
1262
|
] });
|
|
1261
|
-
}, H = 5,
|
|
1262
|
-
const [
|
|
1263
|
+
}, H = 5, Ge = ({ data: e, t: r }) => {
|
|
1264
|
+
const [t, n] = v(!1), c = e.memories.map((f) => f.memoryTitle), s = c.length > 0, d = s && c.length > H, m = d && !t ? c.slice(0, H) : c, o = c.length - H, a = !d || t, u = c.length === 1 ? r.memoryFound : r.memoriesFoundPrefix, y = s ? `${u}${Q(
|
|
1263
1265
|
m,
|
|
1264
1266
|
a ? r.and : void 0
|
|
1265
1267
|
)}` : r.memoriesFound;
|
|
1266
1268
|
return /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
1267
|
-
|
|
1269
|
+
b.div,
|
|
1268
1270
|
{
|
|
1269
1271
|
style: { color: "#666" },
|
|
1270
1272
|
initial: { opacity: 0, y: -10 },
|
|
1271
1273
|
animate: { opacity: 1, y: 0 },
|
|
1272
1274
|
transition: { duration: 0.3, delay: 0 },
|
|
1273
|
-
children: /* @__PURE__ */
|
|
1274
|
-
/* @__PURE__ */ i("span", { style: { color: "#666" }, children:
|
|
1275
|
-
d && !
|
|
1275
|
+
children: /* @__PURE__ */ g(I, { children: [
|
|
1276
|
+
/* @__PURE__ */ i("span", { style: { color: "#666" }, children: y }),
|
|
1277
|
+
d && !t && /* @__PURE__ */ g(I, { children: [
|
|
1276
1278
|
" ",
|
|
1277
1279
|
/* @__PURE__ */ i(
|
|
1278
1280
|
"button",
|
|
1279
1281
|
{
|
|
1280
1282
|
type: "button",
|
|
1281
|
-
onClick: () =>
|
|
1283
|
+
onClick: () => n(!0),
|
|
1282
1284
|
style: {
|
|
1283
1285
|
background: "none",
|
|
1284
1286
|
border: "none",
|
|
@@ -1290,19 +1292,19 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1290
1292
|
textDecoration: "underline",
|
|
1291
1293
|
fontFamily: "inherit"
|
|
1292
1294
|
},
|
|
1293
|
-
children:
|
|
1295
|
+
children: T(r.moreMemories, {
|
|
1294
1296
|
n: o
|
|
1295
1297
|
})
|
|
1296
1298
|
}
|
|
1297
1299
|
)
|
|
1298
1300
|
] }),
|
|
1299
|
-
d &&
|
|
1301
|
+
d && t && /* @__PURE__ */ g(I, { children: [
|
|
1300
1302
|
" ",
|
|
1301
1303
|
/* @__PURE__ */ i(
|
|
1302
1304
|
"button",
|
|
1303
1305
|
{
|
|
1304
1306
|
type: "button",
|
|
1305
|
-
onClick: () =>
|
|
1307
|
+
onClick: () => n(!1),
|
|
1306
1308
|
style: {
|
|
1307
1309
|
background: "none",
|
|
1308
1310
|
border: "none",
|
|
@@ -1321,11 +1323,11 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1321
1323
|
] })
|
|
1322
1324
|
}
|
|
1323
1325
|
) });
|
|
1324
|
-
},
|
|
1325
|
-
const
|
|
1326
|
-
return /* @__PURE__ */
|
|
1326
|
+
}, Qe = ({ isLatest: e = !1, durationSeconds: r, t }) => {
|
|
1327
|
+
const n = t.addingSources;
|
|
1328
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
1327
1329
|
/* @__PURE__ */ i(
|
|
1328
|
-
|
|
1330
|
+
b.div,
|
|
1329
1331
|
{
|
|
1330
1332
|
style: {
|
|
1331
1333
|
display: "flex",
|
|
@@ -1337,15 +1339,15 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1337
1339
|
animate: { opacity: 1, y: 0 },
|
|
1338
1340
|
transition: { duration: 0.3, delay: 0 },
|
|
1339
1341
|
children: e && !r ? /* @__PURE__ */ i(
|
|
1340
|
-
|
|
1342
|
+
w,
|
|
1341
1343
|
{
|
|
1342
|
-
text:
|
|
1344
|
+
text: n,
|
|
1343
1345
|
duration: 2.5,
|
|
1344
1346
|
repeat: !0,
|
|
1345
1347
|
color: "#999",
|
|
1346
1348
|
shimmerColor: "#000"
|
|
1347
1349
|
}
|
|
1348
|
-
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children:
|
|
1350
|
+
) : /* @__PURE__ */ i("span", { style: { color: "#666" }, children: n })
|
|
1349
1351
|
}
|
|
1350
1352
|
),
|
|
1351
1353
|
r !== void 0 && /* @__PURE__ */ i(
|
|
@@ -1357,28 +1359,28 @@ const W = 5, We = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1357
1359
|
marginTop: "4px",
|
|
1358
1360
|
fontStyle: "italic"
|
|
1359
1361
|
},
|
|
1360
|
-
children:
|
|
1362
|
+
children: T(t.tookSeconds, { n: r })
|
|
1361
1363
|
}
|
|
1362
1364
|
)
|
|
1363
1365
|
] });
|
|
1364
1366
|
};
|
|
1365
|
-
function
|
|
1367
|
+
function Ue(e, r) {
|
|
1366
1368
|
if (e.length === 0) return "";
|
|
1367
1369
|
if (e.length === 1)
|
|
1368
|
-
return
|
|
1370
|
+
return T(r.pageSingle, { n: e[0] });
|
|
1369
1371
|
if (e.length === 2)
|
|
1370
|
-
return
|
|
1372
|
+
return T(r.pageTwo, {
|
|
1371
1373
|
a: e[0],
|
|
1372
1374
|
b: e[1]
|
|
1373
1375
|
});
|
|
1374
|
-
const
|
|
1375
|
-
return
|
|
1376
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1377
|
+
return T(r.pageMultiple, { list: n, n: t });
|
|
1376
1378
|
}
|
|
1377
|
-
const
|
|
1378
|
-
const [
|
|
1379
|
-
return /* @__PURE__ */
|
|
1379
|
+
const je = ({ data: e, onSourceClick: r, t }) => {
|
|
1380
|
+
const [n, l] = v(null);
|
|
1381
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
1380
1382
|
/* @__PURE__ */ i(
|
|
1381
|
-
|
|
1383
|
+
b.div,
|
|
1382
1384
|
{
|
|
1383
1385
|
style: {
|
|
1384
1386
|
marginBottom: "10px",
|
|
@@ -1391,40 +1393,40 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1391
1393
|
initial: { opacity: 0, y: -10 },
|
|
1392
1394
|
animate: { opacity: 1, y: 0 },
|
|
1393
1395
|
transition: { duration: 0.3, delay: 0 },
|
|
1394
|
-
children:
|
|
1396
|
+
children: t.sources
|
|
1395
1397
|
}
|
|
1396
1398
|
),
|
|
1397
|
-
/* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children:
|
|
1398
|
-
|
|
1399
|
+
/* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: "8px" }, children: e.sources.length === 0 ? /* @__PURE__ */ i("span", { style: { fontSize: "13px", color: "#888" }, children: t.noSources }) : e.sources.map((c, s) => /* @__PURE__ */ i(
|
|
1400
|
+
qe,
|
|
1399
1401
|
{
|
|
1400
1402
|
source: c,
|
|
1401
1403
|
index: s,
|
|
1402
|
-
loadingMemoryId:
|
|
1404
|
+
loadingMemoryId: n,
|
|
1403
1405
|
setLoadingMemoryId: l,
|
|
1404
1406
|
onSourceClick: r,
|
|
1405
|
-
t
|
|
1407
|
+
t
|
|
1406
1408
|
},
|
|
1407
1409
|
c.memoryId
|
|
1408
1410
|
)) })
|
|
1409
1411
|
] });
|
|
1410
|
-
},
|
|
1412
|
+
}, qe = ({
|
|
1411
1413
|
source: e,
|
|
1412
1414
|
index: r,
|
|
1413
|
-
loadingMemoryId:
|
|
1414
|
-
setLoadingMemoryId:
|
|
1415
|
+
loadingMemoryId: t,
|
|
1416
|
+
setLoadingMemoryId: n,
|
|
1415
1417
|
onSourceClick: l,
|
|
1416
1418
|
t: c
|
|
1417
1419
|
}) => {
|
|
1418
|
-
const [s, d] =
|
|
1419
|
-
return /* @__PURE__ */
|
|
1420
|
-
|
|
1420
|
+
const [s, d] = v(!1), m = !!l, o = t === e.memoryId, a = e.pageNumbers ?? [], u = Ue(a, c);
|
|
1421
|
+
return /* @__PURE__ */ g(
|
|
1422
|
+
b.div,
|
|
1421
1423
|
{
|
|
1422
1424
|
"aria-busy": o,
|
|
1423
1425
|
initial: { opacity: 0, scale: 0.9 },
|
|
1424
1426
|
animate: { opacity: 1, scale: 1 },
|
|
1425
1427
|
transition: { duration: 0.25, delay: r * 0.05 },
|
|
1426
1428
|
onClick: m && !o ? async () => {
|
|
1427
|
-
|
|
1429
|
+
n(e.memoryId);
|
|
1428
1430
|
try {
|
|
1429
1431
|
await l({
|
|
1430
1432
|
memoryId: e.memoryId,
|
|
@@ -1434,7 +1436,7 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1434
1436
|
pageNumbers: [...a]
|
|
1435
1437
|
});
|
|
1436
1438
|
} finally {
|
|
1437
|
-
|
|
1439
|
+
n(null);
|
|
1438
1440
|
}
|
|
1439
1441
|
} : void 0,
|
|
1440
1442
|
onMouseEnter: m && !o ? () => d(!0) : void 0,
|
|
@@ -1453,7 +1455,7 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1453
1455
|
pointerEvents: o ? "none" : void 0
|
|
1454
1456
|
},
|
|
1455
1457
|
children: [
|
|
1456
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ g(
|
|
1457
1459
|
"span",
|
|
1458
1460
|
{
|
|
1459
1461
|
style: {
|
|
@@ -1483,9 +1485,9 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1483
1485
|
}, z = ({
|
|
1484
1486
|
color: e = "#78b13f",
|
|
1485
1487
|
size: r = 24,
|
|
1486
|
-
borderWidth:
|
|
1488
|
+
borderWidth: t = 7
|
|
1487
1489
|
}) => {
|
|
1488
|
-
const
|
|
1490
|
+
const n = r * 0.5;
|
|
1489
1491
|
return /* @__PURE__ */ i(
|
|
1490
1492
|
"span",
|
|
1491
1493
|
{
|
|
@@ -1493,26 +1495,26 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1493
1495
|
display: "inline-block",
|
|
1494
1496
|
transform: "rotate(45deg)",
|
|
1495
1497
|
height: r,
|
|
1496
|
-
width:
|
|
1497
|
-
borderBottom: `${
|
|
1498
|
-
borderRight: `${
|
|
1498
|
+
width: n,
|
|
1499
|
+
borderBottom: `${t}px solid ${e}`,
|
|
1500
|
+
borderRight: `${t}px solid ${e}`
|
|
1499
1501
|
}
|
|
1500
1502
|
}
|
|
1501
1503
|
);
|
|
1502
|
-
},
|
|
1504
|
+
}, U = ({
|
|
1503
1505
|
color: e = "#333",
|
|
1504
1506
|
size: r = 32,
|
|
1505
|
-
lineWidth:
|
|
1507
|
+
lineWidth: t = 2
|
|
1506
1508
|
}) => {
|
|
1507
|
-
const
|
|
1509
|
+
const n = r + 1, l = (r - t) / 2, c = (r - n) / 2, s = {
|
|
1508
1510
|
position: "absolute",
|
|
1509
1511
|
left: l,
|
|
1510
1512
|
top: c,
|
|
1511
|
-
width:
|
|
1512
|
-
height:
|
|
1513
|
+
width: t,
|
|
1514
|
+
height: n,
|
|
1513
1515
|
backgroundColor: e
|
|
1514
1516
|
};
|
|
1515
|
-
return /* @__PURE__ */
|
|
1517
|
+
return /* @__PURE__ */ g(
|
|
1516
1518
|
"span",
|
|
1517
1519
|
{
|
|
1518
1520
|
style: {
|
|
@@ -1544,21 +1546,21 @@ const Qe = ({ data: e, onSourceClick: r, t: n }) => {
|
|
|
1544
1546
|
}
|
|
1545
1547
|
);
|
|
1546
1548
|
};
|
|
1547
|
-
function
|
|
1549
|
+
function Ke({
|
|
1548
1550
|
memory: e,
|
|
1549
1551
|
completed: r
|
|
1550
1552
|
}) {
|
|
1551
|
-
return e.error != null ? /* @__PURE__ */ i(
|
|
1553
|
+
return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : r ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
|
|
1552
1554
|
}
|
|
1553
|
-
const
|
|
1554
|
-
function
|
|
1555
|
+
const X = 80;
|
|
1556
|
+
function Ve({
|
|
1555
1557
|
memory: e,
|
|
1556
1558
|
completed: r,
|
|
1557
|
-
t
|
|
1559
|
+
t
|
|
1558
1560
|
}) {
|
|
1559
|
-
const [
|
|
1560
|
-
return /* @__PURE__ */
|
|
1561
|
-
|
|
1561
|
+
const [n, l] = v(!1), c = e.result ?? e.error, s = c != null && c.length > X, d = c != null ? n || !s ? c : `${c.slice(0, X)}...` : void 0, m = s, o = e.error != null;
|
|
1562
|
+
return /* @__PURE__ */ g(
|
|
1563
|
+
b.div,
|
|
1562
1564
|
{
|
|
1563
1565
|
initial: { opacity: 0 },
|
|
1564
1566
|
animate: { opacity: 1 },
|
|
@@ -1586,10 +1588,10 @@ function Ue({
|
|
|
1586
1588
|
flexShrink: 0,
|
|
1587
1589
|
width: 32
|
|
1588
1590
|
},
|
|
1589
|
-
children: /* @__PURE__ */ i(
|
|
1591
|
+
children: /* @__PURE__ */ i(Ke, { memory: e, completed: r })
|
|
1590
1592
|
}
|
|
1591
1593
|
),
|
|
1592
|
-
/* @__PURE__ */
|
|
1594
|
+
/* @__PURE__ */ g(
|
|
1593
1595
|
"div",
|
|
1594
1596
|
{
|
|
1595
1597
|
style: {
|
|
@@ -1613,7 +1615,7 @@ function Ue({
|
|
|
1613
1615
|
fontSize: 12,
|
|
1614
1616
|
color: o ? "#c62828" : "#666",
|
|
1615
1617
|
lineHeight: 1.4,
|
|
1616
|
-
whiteSpace:
|
|
1618
|
+
whiteSpace: n ? "pre-wrap" : void 0
|
|
1617
1619
|
},
|
|
1618
1620
|
children: d
|
|
1619
1621
|
}
|
|
@@ -1626,7 +1628,7 @@ function Ue({
|
|
|
1626
1628
|
color: "#999",
|
|
1627
1629
|
marginTop: 2
|
|
1628
1630
|
},
|
|
1629
|
-
children:
|
|
1631
|
+
children: n ? t.clickToCollapse : t.clickToExpand
|
|
1630
1632
|
}
|
|
1631
1633
|
)
|
|
1632
1634
|
]
|
|
@@ -1636,43 +1638,43 @@ function Ue({
|
|
|
1636
1638
|
}
|
|
1637
1639
|
);
|
|
1638
1640
|
}
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1641
|
+
const Xe = ({ data: e, completed: r, t }) => /* @__PURE__ */ i("div", { style: { padding: "10px" }, children: e.memories.map((n) => /* @__PURE__ */ i(
|
|
1642
|
+
Ve,
|
|
1641
1643
|
{
|
|
1642
|
-
memory:
|
|
1644
|
+
memory: n,
|
|
1643
1645
|
completed: r,
|
|
1644
|
-
t
|
|
1646
|
+
t
|
|
1645
1647
|
},
|
|
1646
|
-
|
|
1648
|
+
n.memoryId
|
|
1647
1649
|
)) });
|
|
1648
|
-
function
|
|
1650
|
+
function Je(e, r) {
|
|
1649
1651
|
if (e.length === 0) return "";
|
|
1650
1652
|
if (e.length === 1)
|
|
1651
|
-
return
|
|
1653
|
+
return T(r.pageSingle, { n: e[0] });
|
|
1652
1654
|
if (e.length === 2)
|
|
1653
|
-
return
|
|
1655
|
+
return T(r.pageTwo, {
|
|
1654
1656
|
a: e[0],
|
|
1655
1657
|
b: e[1]
|
|
1656
1658
|
});
|
|
1657
|
-
const
|
|
1658
|
-
return
|
|
1659
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
1660
|
+
return T(r.pageMultiple, { list: n, n: t });
|
|
1659
1661
|
}
|
|
1660
|
-
function
|
|
1661
|
-
return e === 1 ? r.chunkFound :
|
|
1662
|
+
function Ye(e, r) {
|
|
1663
|
+
return e === 1 ? r.chunkFound : T(r.chunksFound, { n: e });
|
|
1662
1664
|
}
|
|
1663
|
-
const
|
|
1664
|
-
const [
|
|
1665
|
-
return /* @__PURE__ */
|
|
1666
|
-
/* @__PURE__ */
|
|
1667
|
-
|
|
1665
|
+
const Ze = ({ data: e, t: r }) => {
|
|
1666
|
+
const [t, n] = v(!1), l = e.chunks.length, c = l > 0;
|
|
1667
|
+
return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
1668
|
+
/* @__PURE__ */ g(
|
|
1669
|
+
b.div,
|
|
1668
1670
|
{
|
|
1669
1671
|
initial: { opacity: 0 },
|
|
1670
1672
|
animate: { opacity: 1 },
|
|
1671
1673
|
transition: { duration: 0.25 },
|
|
1672
|
-
onClick: c ? () =>
|
|
1674
|
+
onClick: c ? () => n((s) => !s) : void 0,
|
|
1673
1675
|
style: {
|
|
1674
|
-
paddingBottom:
|
|
1675
|
-
borderBottom:
|
|
1676
|
+
paddingBottom: t ? "12px" : 0,
|
|
1677
|
+
borderBottom: t ? "1px solid #eee" : void 0,
|
|
1676
1678
|
display: "flex",
|
|
1677
1679
|
flexDirection: "column",
|
|
1678
1680
|
gap: "4px",
|
|
@@ -1681,7 +1683,7 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1681
1683
|
},
|
|
1682
1684
|
children: [
|
|
1683
1685
|
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: e.memoryTitle }),
|
|
1684
|
-
/* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children:
|
|
1686
|
+
/* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: Ye(l, r) }),
|
|
1685
1687
|
c && /* @__PURE__ */ i(
|
|
1686
1688
|
"span",
|
|
1687
1689
|
{
|
|
@@ -1690,14 +1692,14 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1690
1692
|
color: "#999",
|
|
1691
1693
|
marginTop: 2
|
|
1692
1694
|
},
|
|
1693
|
-
children:
|
|
1695
|
+
children: t ? r.clickToCollapse : r.clickToExpand
|
|
1694
1696
|
}
|
|
1695
1697
|
)
|
|
1696
1698
|
]
|
|
1697
1699
|
}
|
|
1698
1700
|
),
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
+
t && c && /* @__PURE__ */ i(
|
|
1702
|
+
b.div,
|
|
1701
1703
|
{
|
|
1702
1704
|
initial: { opacity: 0, height: 0 },
|
|
1703
1705
|
animate: { opacity: 1, height: "auto" },
|
|
@@ -1711,8 +1713,8 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1711
1713
|
gap: 8
|
|
1712
1714
|
},
|
|
1713
1715
|
children: e.chunks.map((s, d) => {
|
|
1714
|
-
const m = s.pageNumbers ?? [], o =
|
|
1715
|
-
return /* @__PURE__ */
|
|
1716
|
+
const m = s.pageNumbers ?? [], o = Je(m, r);
|
|
1717
|
+
return /* @__PURE__ */ g(
|
|
1716
1718
|
"div",
|
|
1717
1719
|
{
|
|
1718
1720
|
style: {
|
|
@@ -1735,7 +1737,7 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1735
1737
|
children: s.content
|
|
1736
1738
|
}
|
|
1737
1739
|
),
|
|
1738
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ g(
|
|
1739
1741
|
"div",
|
|
1740
1742
|
{
|
|
1741
1743
|
style: {
|
|
@@ -1746,7 +1748,7 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1746
1748
|
},
|
|
1747
1749
|
children: [
|
|
1748
1750
|
o && /* @__PURE__ */ i("span", { children: o }),
|
|
1749
|
-
/* @__PURE__ */ i("span", { children:
|
|
1751
|
+
/* @__PURE__ */ i("span", { children: T(r.scoreLabel, {
|
|
1750
1752
|
n: s.score
|
|
1751
1753
|
}) })
|
|
1752
1754
|
]
|
|
@@ -1761,22 +1763,22 @@ const Je = ({ data: e, t: r }) => {
|
|
|
1761
1763
|
)
|
|
1762
1764
|
] });
|
|
1763
1765
|
};
|
|
1764
|
-
function
|
|
1765
|
-
return e.error != null ? /* @__PURE__ */ i(
|
|
1766
|
+
function er({ item: e }) {
|
|
1767
|
+
return e.error != null ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : e.result != null ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
|
|
1766
1768
|
}
|
|
1767
|
-
function
|
|
1768
|
-
return
|
|
1769
|
+
function rr(e, r) {
|
|
1770
|
+
return T(r.searchingInMemoriesOfType, {
|
|
1769
1771
|
name: e.memoryTypeName
|
|
1770
1772
|
});
|
|
1771
1773
|
}
|
|
1772
|
-
function
|
|
1774
|
+
function nr({
|
|
1773
1775
|
item: e,
|
|
1774
1776
|
t: r,
|
|
1775
|
-
showShimmerForPrimary:
|
|
1777
|
+
showShimmerForPrimary: t
|
|
1776
1778
|
}) {
|
|
1777
|
-
const
|
|
1778
|
-
return /* @__PURE__ */
|
|
1779
|
-
|
|
1779
|
+
const n = e.result != null, l = e.error != null, c = rr(e, r);
|
|
1780
|
+
return /* @__PURE__ */ g(
|
|
1781
|
+
b.div,
|
|
1780
1782
|
{
|
|
1781
1783
|
initial: { opacity: 0 },
|
|
1782
1784
|
animate: { opacity: 1 },
|
|
@@ -1802,10 +1804,10 @@ function er({
|
|
|
1802
1804
|
flexShrink: 0,
|
|
1803
1805
|
width: 32
|
|
1804
1806
|
},
|
|
1805
|
-
children: /* @__PURE__ */ i(
|
|
1807
|
+
children: /* @__PURE__ */ i(er, { item: e })
|
|
1806
1808
|
}
|
|
1807
1809
|
),
|
|
1808
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ g(
|
|
1809
1811
|
"div",
|
|
1810
1812
|
{
|
|
1811
1813
|
style: {
|
|
@@ -1816,8 +1818,8 @@ function er({
|
|
|
1816
1818
|
flex: 1
|
|
1817
1819
|
},
|
|
1818
1820
|
children: [
|
|
1819
|
-
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !
|
|
1820
|
-
|
|
1821
|
+
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: !n && !l && t ? /* @__PURE__ */ i(
|
|
1822
|
+
w,
|
|
1821
1823
|
{
|
|
1822
1824
|
text: c,
|
|
1823
1825
|
duration: 2.5,
|
|
@@ -1826,14 +1828,14 @@ function er({
|
|
|
1826
1828
|
shimmerColor: "#000"
|
|
1827
1829
|
}
|
|
1828
1830
|
) : c }),
|
|
1829
|
-
|
|
1831
|
+
n && /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#666" }, children: e.result.numberOfChunks === 1 ? T(
|
|
1830
1832
|
r.memorySearchTypeResultSummaryOne,
|
|
1831
1833
|
{
|
|
1832
1834
|
score: e.result.highestChunkScore.toFixed(
|
|
1833
1835
|
2
|
|
1834
1836
|
)
|
|
1835
1837
|
}
|
|
1836
|
-
) :
|
|
1838
|
+
) : T(
|
|
1837
1839
|
r.memorySearchTypeResultSummary,
|
|
1838
1840
|
{
|
|
1839
1841
|
count: e.result.numberOfChunks,
|
|
@@ -1850,33 +1852,33 @@ function er({
|
|
|
1850
1852
|
}
|
|
1851
1853
|
);
|
|
1852
1854
|
}
|
|
1853
|
-
const
|
|
1855
|
+
const tr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
1854
1856
|
const l = D(() => {
|
|
1855
1857
|
let c = -1;
|
|
1856
1858
|
return e.memoryTypes.forEach((s, d) => {
|
|
1857
1859
|
s.result == null && s.error == null && (c = d);
|
|
1858
1860
|
}), c;
|
|
1859
1861
|
}, [e.memoryTypes]);
|
|
1860
|
-
return /* @__PURE__ */
|
|
1861
|
-
r && !
|
|
1862
|
-
|
|
1862
|
+
return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
1863
|
+
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
|
|
1864
|
+
w,
|
|
1863
1865
|
{
|
|
1864
|
-
text:
|
|
1866
|
+
text: n.searchingMemoryTypes,
|
|
1865
1867
|
duration: 2.5,
|
|
1866
1868
|
repeat: !0,
|
|
1867
1869
|
color: "#999",
|
|
1868
1870
|
shimmerColor: "#000"
|
|
1869
1871
|
}
|
|
1870
1872
|
) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
|
|
1871
|
-
|
|
1873
|
+
nr,
|
|
1872
1874
|
{
|
|
1873
1875
|
item: c,
|
|
1874
|
-
t,
|
|
1876
|
+
t: n,
|
|
1875
1877
|
showShimmerForPrimary: s === l && r
|
|
1876
1878
|
},
|
|
1877
1879
|
c.memoryTypeId
|
|
1878
1880
|
)),
|
|
1879
|
-
|
|
1881
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
1880
1882
|
"div",
|
|
1881
1883
|
{
|
|
1882
1884
|
style: {
|
|
@@ -1885,45 +1887,45 @@ const rr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
1885
1887
|
marginTop: "4px",
|
|
1886
1888
|
fontStyle: "italic"
|
|
1887
1889
|
},
|
|
1888
|
-
children:
|
|
1890
|
+
children: T(n.tookSeconds, { n: t })
|
|
1889
1891
|
}
|
|
1890
1892
|
)
|
|
1891
1893
|
] });
|
|
1892
|
-
}, N = 12, B = 1.45,
|
|
1894
|
+
}, N = 12, B = 1.45, or = Math.ceil(
|
|
1893
1895
|
N * B
|
|
1894
|
-
),
|
|
1896
|
+
), ir = Math.ceil(
|
|
1895
1897
|
5 * N * B
|
|
1896
1898
|
);
|
|
1897
1899
|
function O(e) {
|
|
1898
1900
|
return e.queries != null && e.queries.length > 0;
|
|
1899
1901
|
}
|
|
1900
|
-
function
|
|
1902
|
+
function ar(e) {
|
|
1901
1903
|
const r = e.reasoning;
|
|
1902
1904
|
return (r == null || r === "") && !O(e);
|
|
1903
1905
|
}
|
|
1904
|
-
function
|
|
1906
|
+
function sr(e) {
|
|
1905
1907
|
if (O(e)) return 3;
|
|
1906
1908
|
const r = e.reasoning;
|
|
1907
1909
|
return r == null || r === "" ? 1 : e.reasoningCompleted === !0 ? 2 : 1;
|
|
1908
1910
|
}
|
|
1909
|
-
function
|
|
1911
|
+
function lr({ phase: e }) {
|
|
1910
1912
|
return e === 3 ? /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 }) : /* @__PURE__ */ i("span", { className: "explore-memory-loader" });
|
|
1911
1913
|
}
|
|
1912
|
-
function
|
|
1914
|
+
function cr({
|
|
1913
1915
|
item: e,
|
|
1914
1916
|
t: r,
|
|
1915
|
-
isActiveRow:
|
|
1917
|
+
isActiveRow: t
|
|
1916
1918
|
}) {
|
|
1917
|
-
const
|
|
1918
|
-
|
|
1919
|
-
const
|
|
1920
|
-
|
|
1919
|
+
const n = ar(e), l = sr(e), c = e.reasoning, s = c != null && c.length > 0, d = F(null), [m, o] = v(!1), a = n && t, u = l === 2 && t && !O(e);
|
|
1920
|
+
A(() => {
|
|
1921
|
+
const p = d.current;
|
|
1922
|
+
p != null && l === 1 && s && (p.scrollTop = p.scrollHeight);
|
|
1921
1923
|
}, [c, l, s]);
|
|
1922
|
-
const
|
|
1924
|
+
const y = T(r.searchingInMemoriesOfType, {
|
|
1923
1925
|
name: e.memoryTypeName
|
|
1924
|
-
}), f = !
|
|
1925
|
-
return /* @__PURE__ */
|
|
1926
|
-
|
|
1926
|
+
}), f = !n && l === 3;
|
|
1927
|
+
return /* @__PURE__ */ g(
|
|
1928
|
+
b.div,
|
|
1927
1929
|
{
|
|
1928
1930
|
initial: { opacity: 0 },
|
|
1929
1931
|
animate: { opacity: 1 },
|
|
@@ -1950,10 +1952,10 @@ function sr({
|
|
|
1950
1952
|
width: 32,
|
|
1951
1953
|
...f ? { paddingTop: 2 } : {}
|
|
1952
1954
|
},
|
|
1953
|
-
children: /* @__PURE__ */ i(
|
|
1955
|
+
children: /* @__PURE__ */ i(lr, { phase: n ? 1 : l })
|
|
1954
1956
|
}
|
|
1955
1957
|
),
|
|
1956
|
-
/* @__PURE__ */
|
|
1958
|
+
/* @__PURE__ */ g(
|
|
1957
1959
|
"div",
|
|
1958
1960
|
{
|
|
1959
1961
|
style: {
|
|
@@ -1965,16 +1967,16 @@ function sr({
|
|
|
1965
1967
|
},
|
|
1966
1968
|
children: [
|
|
1967
1969
|
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "#333" }, children: a ? /* @__PURE__ */ i(
|
|
1968
|
-
|
|
1970
|
+
w,
|
|
1969
1971
|
{
|
|
1970
|
-
text:
|
|
1972
|
+
text: y,
|
|
1971
1973
|
duration: 2.5,
|
|
1972
1974
|
repeat: !0,
|
|
1973
1975
|
color: "#999",
|
|
1974
1976
|
shimmerColor: "#000"
|
|
1975
1977
|
}
|
|
1976
1978
|
) : e.memoryTypeName }),
|
|
1977
|
-
l === 1 && s && !O(e) && /* @__PURE__ */
|
|
1979
|
+
l === 1 && s && !O(e) && /* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
|
|
1978
1980
|
/* @__PURE__ */ i(
|
|
1979
1981
|
"span",
|
|
1980
1982
|
{
|
|
@@ -2003,8 +2005,8 @@ function sr({
|
|
|
2003
2005
|
ref: d,
|
|
2004
2006
|
className: "memory-search-generating-reasoning-viewport",
|
|
2005
2007
|
style: {
|
|
2006
|
-
minHeight:
|
|
2007
|
-
maxHeight:
|
|
2008
|
+
minHeight: or,
|
|
2009
|
+
maxHeight: ir,
|
|
2008
2010
|
height: "auto",
|
|
2009
2011
|
overflowY: "auto",
|
|
2010
2012
|
overflowX: "hidden",
|
|
@@ -2021,7 +2023,7 @@ function sr({
|
|
|
2021
2023
|
)
|
|
2022
2024
|
] }),
|
|
2023
2025
|
l === 2 && u && /* @__PURE__ */ i("div", { style: { fontSize: 12 }, children: /* @__PURE__ */ i(
|
|
2024
|
-
|
|
2026
|
+
w,
|
|
2025
2027
|
{
|
|
2026
2028
|
text: r.memorySearchGeneratingQueriesPending,
|
|
2027
2029
|
duration: 2.5,
|
|
@@ -2030,8 +2032,8 @@ function sr({
|
|
|
2030
2032
|
shimmerColor: "#000"
|
|
2031
2033
|
}
|
|
2032
2034
|
) }),
|
|
2033
|
-
l === 3 && /* @__PURE__ */
|
|
2034
|
-
/* @__PURE__ */
|
|
2035
|
+
l === 3 && /* @__PURE__ */ g(I, { children: [
|
|
2036
|
+
/* @__PURE__ */ g("div", { style: { minWidth: 0 }, children: [
|
|
2035
2037
|
/* @__PURE__ */ i(
|
|
2036
2038
|
"span",
|
|
2037
2039
|
{
|
|
@@ -2053,7 +2055,7 @@ function sr({
|
|
|
2053
2055
|
flexDirection: "column",
|
|
2054
2056
|
gap: 6
|
|
2055
2057
|
},
|
|
2056
|
-
children: e.queries.map((
|
|
2058
|
+
children: e.queries.map((p, x) => /* @__PURE__ */ i(
|
|
2057
2059
|
"div",
|
|
2058
2060
|
{
|
|
2059
2061
|
style: {
|
|
@@ -2062,19 +2064,19 @@ function sr({
|
|
|
2062
2064
|
lineHeight: 1.5,
|
|
2063
2065
|
wordBreak: "break-word"
|
|
2064
2066
|
},
|
|
2065
|
-
children:
|
|
2067
|
+
children: p.query
|
|
2066
2068
|
},
|
|
2067
|
-
|
|
2069
|
+
x
|
|
2068
2070
|
))
|
|
2069
2071
|
}
|
|
2070
2072
|
)
|
|
2071
2073
|
] }),
|
|
2072
|
-
s && /* @__PURE__ */
|
|
2074
|
+
s && /* @__PURE__ */ g(I, { children: [
|
|
2073
2075
|
/* @__PURE__ */ i(
|
|
2074
2076
|
"button",
|
|
2075
2077
|
{
|
|
2076
2078
|
type: "button",
|
|
2077
|
-
onClick: () => o((
|
|
2079
|
+
onClick: () => o((p) => !p),
|
|
2078
2080
|
style: {
|
|
2079
2081
|
alignSelf: "flex-start",
|
|
2080
2082
|
border: "none",
|
|
@@ -2113,33 +2115,33 @@ function sr({
|
|
|
2113
2115
|
}
|
|
2114
2116
|
);
|
|
2115
2117
|
}
|
|
2116
|
-
const
|
|
2118
|
+
const dr = ({ data: e, isLatest: r = !1, durationSeconds: t, t: n }) => {
|
|
2117
2119
|
const l = D(() => {
|
|
2118
2120
|
let c = -1;
|
|
2119
2121
|
return e.memoryTypes.forEach((s, d) => {
|
|
2120
2122
|
O(s) || (c = d);
|
|
2121
2123
|
}), c;
|
|
2122
2124
|
}, [e.memoryTypes]);
|
|
2123
|
-
return /* @__PURE__ */
|
|
2124
|
-
r && !
|
|
2125
|
-
|
|
2125
|
+
return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
2126
|
+
r && !t && e.memoryTypes.length === 0 ? /* @__PURE__ */ i(
|
|
2127
|
+
w,
|
|
2126
2128
|
{
|
|
2127
|
-
text:
|
|
2129
|
+
text: n.memorySearchGeneratingQueries,
|
|
2128
2130
|
duration: 2.5,
|
|
2129
2131
|
repeat: !0,
|
|
2130
2132
|
color: "#999",
|
|
2131
2133
|
shimmerColor: "#000"
|
|
2132
2134
|
}
|
|
2133
2135
|
) : e.memoryTypes.map((c, s) => /* @__PURE__ */ i(
|
|
2134
|
-
|
|
2136
|
+
cr,
|
|
2135
2137
|
{
|
|
2136
2138
|
item: c,
|
|
2137
|
-
t,
|
|
2139
|
+
t: n,
|
|
2138
2140
|
isActiveRow: s === l && r
|
|
2139
2141
|
},
|
|
2140
2142
|
c.memoryTypeId
|
|
2141
2143
|
)),
|
|
2142
|
-
|
|
2144
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
2143
2145
|
"div",
|
|
2144
2146
|
{
|
|
2145
2147
|
style: {
|
|
@@ -2148,73 +2150,73 @@ const lr = ({ data: e, isLatest: r = !1, durationSeconds: n, t }) => {
|
|
|
2148
2150
|
marginTop: "4px",
|
|
2149
2151
|
fontStyle: "italic"
|
|
2150
2152
|
},
|
|
2151
|
-
children:
|
|
2153
|
+
children: T(n.tookSeconds, { n: t })
|
|
2152
2154
|
}
|
|
2153
2155
|
)
|
|
2154
2156
|
] });
|
|
2155
2157
|
};
|
|
2156
|
-
function
|
|
2157
|
-
const
|
|
2158
|
-
for (let
|
|
2159
|
-
if (e.slice(-
|
|
2158
|
+
function mr(e, r) {
|
|
2159
|
+
const t = Math.min(e.length, r.length);
|
|
2160
|
+
for (let n = t; n >= 0; n--)
|
|
2161
|
+
if (e.slice(-n) === r.slice(0, n)) return n;
|
|
2160
2162
|
return 0;
|
|
2161
2163
|
}
|
|
2162
|
-
const
|
|
2164
|
+
const ur = `
|
|
2163
2165
|
|
|
2164
2166
|
`;
|
|
2165
|
-
function
|
|
2166
|
-
var
|
|
2167
|
+
function ne(e) {
|
|
2168
|
+
var t, n;
|
|
2167
2169
|
if (e.length === 0) return "";
|
|
2168
|
-
let r = ((
|
|
2170
|
+
let r = ((t = e[0]) == null ? void 0 : t.content) ?? "";
|
|
2169
2171
|
for (let l = 1; l < e.length; l++) {
|
|
2170
|
-
const c = ((
|
|
2172
|
+
const c = ((n = e[l]) == null ? void 0 : n.content) ?? "";
|
|
2171
2173
|
if (c === "") continue;
|
|
2172
2174
|
if (r === "") {
|
|
2173
2175
|
r = c;
|
|
2174
2176
|
continue;
|
|
2175
2177
|
}
|
|
2176
|
-
const s =
|
|
2177
|
-
s === 0 ? r +=
|
|
2178
|
+
const s = mr(r, c);
|
|
2179
|
+
s === 0 ? r += ur + c : r += c.slice(s);
|
|
2178
2180
|
}
|
|
2179
2181
|
return r;
|
|
2180
2182
|
}
|
|
2181
|
-
function
|
|
2183
|
+
function te(e, r) {
|
|
2182
2184
|
if (e.length === 0) return "";
|
|
2183
2185
|
if (e.length === 1)
|
|
2184
|
-
return
|
|
2186
|
+
return T(r.memorySearchPagesSingle, {
|
|
2185
2187
|
n: e[0]
|
|
2186
2188
|
});
|
|
2187
2189
|
if (e.length === 2)
|
|
2188
|
-
return
|
|
2190
|
+
return T(r.memorySearchPagesTwo, {
|
|
2189
2191
|
a: e[0],
|
|
2190
2192
|
b: e[1]
|
|
2191
2193
|
});
|
|
2192
|
-
const
|
|
2193
|
-
return
|
|
2194
|
-
list:
|
|
2195
|
-
n
|
|
2194
|
+
const t = e[e.length - 1], n = e.slice(0, -1).join(", ");
|
|
2195
|
+
return T(r.memorySearchPagesMultiple, {
|
|
2196
|
+
list: n,
|
|
2197
|
+
n: t
|
|
2196
2198
|
});
|
|
2197
2199
|
}
|
|
2198
|
-
function
|
|
2200
|
+
function oe(e) {
|
|
2199
2201
|
const r = /* @__PURE__ */ new Set();
|
|
2200
|
-
for (const
|
|
2201
|
-
for (const
|
|
2202
|
-
return [...r].sort((
|
|
2202
|
+
for (const t of e)
|
|
2203
|
+
for (const n of t.pageNumbers) r.add(n);
|
|
2204
|
+
return [...r].sort((t, n) => t - n);
|
|
2203
2205
|
}
|
|
2204
|
-
function
|
|
2206
|
+
function ie(e) {
|
|
2205
2207
|
const r = e.memoryTypeName.trim();
|
|
2206
2208
|
if (r !== "") return r;
|
|
2207
2209
|
if (e.memoryTypeId !== "") return e.memoryTypeId;
|
|
2208
2210
|
}
|
|
2209
|
-
function
|
|
2210
|
-
return e.some((
|
|
2211
|
+
function yr(e) {
|
|
2212
|
+
return e.some((n) => n.result == null && n.error == null) ? /* @__PURE__ */ i("span", { className: "explore-memory-loader" }) : e.some((n) => n.error != null) ? /* @__PURE__ */ i(U, { color: "#c62828", size: 15, lineWidth: 2 }) : /* @__PURE__ */ i(z, { color: "#999", size: 15, borderWidth: 2 });
|
|
2211
2213
|
}
|
|
2212
|
-
function
|
|
2214
|
+
function gr(e, r) {
|
|
2213
2215
|
if (e.error != null)
|
|
2214
2216
|
return /* @__PURE__ */ i("span", { style: { fontSize: 12, color: "#c62828", whiteSpace: "nowrap" }, children: e.error });
|
|
2215
2217
|
if (e.result == null)
|
|
2216
2218
|
return /* @__PURE__ */ i("span", { style: { flexShrink: 0, fontSize: 12 }, children: /* @__PURE__ */ i(
|
|
2217
|
-
|
|
2219
|
+
w,
|
|
2218
2220
|
{
|
|
2219
2221
|
text: r.searching,
|
|
2220
2222
|
duration: 2.5,
|
|
@@ -2223,22 +2225,22 @@ function ur(e, r) {
|
|
|
2223
2225
|
shimmerColor: "#000"
|
|
2224
2226
|
}
|
|
2225
2227
|
) });
|
|
2226
|
-
const
|
|
2227
|
-
n:
|
|
2228
|
+
const t = e.result, n = t.numberOfChunks === 1 ? r.chunkFound : T(r.chunksFound, { n: t.numberOfChunks }), l = T(r.scoreLabel, {
|
|
2229
|
+
n: t.highestChunkScore.toFixed(2)
|
|
2228
2230
|
});
|
|
2229
|
-
return /* @__PURE__ */
|
|
2230
|
-
|
|
2231
|
+
return /* @__PURE__ */ g("span", { style: { fontSize: 12, color: "#666", whiteSpace: "nowrap" }, children: [
|
|
2232
|
+
n,
|
|
2231
2233
|
" · ",
|
|
2232
2234
|
l
|
|
2233
2235
|
] });
|
|
2234
2236
|
}
|
|
2235
|
-
function
|
|
2237
|
+
function pr({
|
|
2236
2238
|
items: e,
|
|
2237
2239
|
queryRow: r,
|
|
2238
|
-
onExploreQueryResultClick:
|
|
2239
|
-
t
|
|
2240
|
+
onExploreQueryResultClick: t,
|
|
2241
|
+
t: n
|
|
2240
2242
|
}) {
|
|
2241
|
-
const [l, c] =
|
|
2243
|
+
const [l, c] = v(null);
|
|
2242
2244
|
if (e.length === 0)
|
|
2243
2245
|
return /* @__PURE__ */ i(
|
|
2244
2246
|
"div",
|
|
@@ -2248,10 +2250,10 @@ function yr({
|
|
|
2248
2250
|
color: "#94a3b8",
|
|
2249
2251
|
paddingTop: 4
|
|
2250
2252
|
},
|
|
2251
|
-
children:
|
|
2253
|
+
children: n.memorySearchExploreNoResults
|
|
2252
2254
|
}
|
|
2253
2255
|
);
|
|
2254
|
-
const s = !!
|
|
2256
|
+
const s = !!t;
|
|
2255
2257
|
return /* @__PURE__ */ i(
|
|
2256
2258
|
"div",
|
|
2257
2259
|
{
|
|
@@ -2264,25 +2266,25 @@ function yr({
|
|
|
2264
2266
|
borderTop: "1px solid #f0f0f0"
|
|
2265
2267
|
},
|
|
2266
2268
|
children: e.map((d, m) => {
|
|
2267
|
-
const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a =
|
|
2269
|
+
const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
|
|
2268
2270
|
d.chunks
|
|
2269
2271
|
), u = [
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
+
ie(d),
|
|
2273
|
+
T(n.scoreLabel, {
|
|
2272
2274
|
n: d.matchingChunkScore.toFixed(2)
|
|
2273
2275
|
}),
|
|
2274
|
-
a.length > 0 ?
|
|
2276
|
+
a.length > 0 ? te(a, n) : n.pagesNotAvailable
|
|
2275
2277
|
].filter(
|
|
2276
|
-
(
|
|
2277
|
-
),
|
|
2278
|
+
(x) => x != null && x !== ""
|
|
2279
|
+
), y = {
|
|
2278
2280
|
memoryId: d.memoryId,
|
|
2279
2281
|
memoryTitle: d.memoryTitle,
|
|
2280
2282
|
pageNumbers: a,
|
|
2281
2283
|
memoryTypeId: r.memoryTypeId,
|
|
2282
2284
|
memoryTypeName: r.memoryTypeName,
|
|
2283
2285
|
query: r.query
|
|
2284
|
-
}, f = `${r.query}::${d.memoryId}::${m}`,
|
|
2285
|
-
return /* @__PURE__ */
|
|
2286
|
+
}, f = `${r.query}::${d.memoryId}::${m}`, p = l === f;
|
|
2287
|
+
return /* @__PURE__ */ g(
|
|
2286
2288
|
"div",
|
|
2287
2289
|
{
|
|
2288
2290
|
style: {
|
|
@@ -2296,7 +2298,7 @@ function yr({
|
|
|
2296
2298
|
minWidth: 0
|
|
2297
2299
|
},
|
|
2298
2300
|
children: [
|
|
2299
|
-
/* @__PURE__ */
|
|
2301
|
+
/* @__PURE__ */ g(
|
|
2300
2302
|
"div",
|
|
2301
2303
|
{
|
|
2302
2304
|
style: {
|
|
@@ -2328,7 +2330,7 @@ function yr({
|
|
|
2328
2330
|
whiteSpace: "pre-wrap",
|
|
2329
2331
|
wordBreak: "break-word"
|
|
2330
2332
|
},
|
|
2331
|
-
children:
|
|
2333
|
+
children: ne(
|
|
2332
2334
|
d.chunks
|
|
2333
2335
|
)
|
|
2334
2336
|
}
|
|
@@ -2348,17 +2350,17 @@ function yr({
|
|
|
2348
2350
|
]
|
|
2349
2351
|
}
|
|
2350
2352
|
),
|
|
2351
|
-
s && /* @__PURE__ */
|
|
2353
|
+
s && /* @__PURE__ */ g(
|
|
2352
2354
|
"button",
|
|
2353
2355
|
{
|
|
2354
2356
|
type: "button",
|
|
2355
|
-
"aria-busy":
|
|
2356
|
-
disabled:
|
|
2357
|
+
"aria-busy": p,
|
|
2358
|
+
disabled: p,
|
|
2357
2359
|
onClick: async () => {
|
|
2358
2360
|
c(f);
|
|
2359
2361
|
try {
|
|
2360
|
-
await
|
|
2361
|
-
|
|
2362
|
+
await t(
|
|
2363
|
+
y
|
|
2362
2364
|
);
|
|
2363
2365
|
} finally {
|
|
2364
2366
|
c(null);
|
|
@@ -2374,21 +2376,21 @@ function yr({
|
|
|
2374
2376
|
background: "#eff6ff",
|
|
2375
2377
|
border: "1px solid #bfdbfe",
|
|
2376
2378
|
borderRadius: 6,
|
|
2377
|
-
cursor:
|
|
2379
|
+
cursor: p ? "wait" : "pointer",
|
|
2378
2380
|
fontFamily: "inherit",
|
|
2379
2381
|
display: "inline-flex",
|
|
2380
2382
|
alignItems: "center",
|
|
2381
2383
|
gap: 8
|
|
2382
2384
|
},
|
|
2383
2385
|
children: [
|
|
2384
|
-
|
|
2386
|
+
p && /* @__PURE__ */ i(
|
|
2385
2387
|
"span",
|
|
2386
2388
|
{
|
|
2387
2389
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
2388
2390
|
"aria-hidden": !0
|
|
2389
2391
|
}
|
|
2390
2392
|
),
|
|
2391
|
-
|
|
2393
|
+
n.viewButton
|
|
2392
2394
|
]
|
|
2393
2395
|
}
|
|
2394
2396
|
)
|
|
@@ -2400,22 +2402,22 @@ function yr({
|
|
|
2400
2402
|
}
|
|
2401
2403
|
);
|
|
2402
2404
|
}
|
|
2403
|
-
function
|
|
2404
|
-
const r = [],
|
|
2405
|
-
return e.forEach((
|
|
2406
|
-
let c =
|
|
2407
|
-
c == null && (r.push(
|
|
2408
|
-
memoryTypeId:
|
|
2409
|
-
memoryTypeName:
|
|
2405
|
+
function hr(e) {
|
|
2406
|
+
const r = [], t = /* @__PURE__ */ new Map();
|
|
2407
|
+
return e.forEach((n, l) => {
|
|
2408
|
+
let c = t.get(n.memoryTypeId);
|
|
2409
|
+
c == null && (r.push(n.memoryTypeId), c = {
|
|
2410
|
+
memoryTypeId: n.memoryTypeId,
|
|
2411
|
+
memoryTypeName: n.memoryTypeName,
|
|
2410
2412
|
items: []
|
|
2411
|
-
},
|
|
2412
|
-
}), r.map((
|
|
2413
|
+
}, t.set(n.memoryTypeId, c)), c.items.push({ item: n, flatIndex: l });
|
|
2414
|
+
}), r.map((n) => t.get(n));
|
|
2413
2415
|
}
|
|
2414
|
-
function
|
|
2416
|
+
function fr({
|
|
2415
2417
|
group: e,
|
|
2416
2418
|
t: r,
|
|
2417
|
-
lastInFlightIndex:
|
|
2418
|
-
isLatest:
|
|
2419
|
+
lastInFlightIndex: t,
|
|
2420
|
+
isLatest: n,
|
|
2419
2421
|
expandedRows: l,
|
|
2420
2422
|
toggleExpanded: c,
|
|
2421
2423
|
onExploreQueryResultClick: s
|
|
@@ -2423,8 +2425,8 @@ function gr({
|
|
|
2423
2425
|
const d = e.items.map((o) => o.item), m = d.some(
|
|
2424
2426
|
(o) => o.result == null && o.error == null
|
|
2425
2427
|
);
|
|
2426
|
-
return /* @__PURE__ */
|
|
2427
|
-
|
|
2428
|
+
return /* @__PURE__ */ g(
|
|
2429
|
+
b.div,
|
|
2428
2430
|
{
|
|
2429
2431
|
initial: { opacity: 0 },
|
|
2430
2432
|
animate: { opacity: 1 },
|
|
@@ -2451,10 +2453,10 @@ function gr({
|
|
|
2451
2453
|
width: 32,
|
|
2452
2454
|
...m ? {} : { paddingTop: 2 }
|
|
2453
2455
|
},
|
|
2454
|
-
children:
|
|
2456
|
+
children: yr(d)
|
|
2455
2457
|
}
|
|
2456
2458
|
),
|
|
2457
|
-
/* @__PURE__ */
|
|
2459
|
+
/* @__PURE__ */ g(
|
|
2458
2460
|
"div",
|
|
2459
2461
|
{
|
|
2460
2462
|
style: {
|
|
@@ -2472,15 +2474,15 @@ function gr({
|
|
|
2472
2474
|
fontSize: 12,
|
|
2473
2475
|
color: "#888"
|
|
2474
2476
|
},
|
|
2475
|
-
children:
|
|
2477
|
+
children: T(r.memorySearchExploreQueryTypeLabel, {
|
|
2476
2478
|
name: e.memoryTypeName
|
|
2477
2479
|
})
|
|
2478
2480
|
}
|
|
2479
2481
|
),
|
|
2480
2482
|
e.items.map(({ item: o, flatIndex: a }) => {
|
|
2481
2483
|
var h;
|
|
2482
|
-
const u = o.result != null,
|
|
2483
|
-
return /* @__PURE__ */
|
|
2484
|
+
const u = o.result != null, y = o.error != null, f = a === t && n && !u && !y, p = l[a] === !0, x = ((h = o.result) == null ? void 0 : h.items) ?? [];
|
|
2485
|
+
return /* @__PURE__ */ g(
|
|
2484
2486
|
"div",
|
|
2485
2487
|
{
|
|
2486
2488
|
style: {
|
|
@@ -2490,7 +2492,7 @@ function gr({
|
|
|
2490
2492
|
minWidth: 0
|
|
2491
2493
|
},
|
|
2492
2494
|
children: [
|
|
2493
|
-
/* @__PURE__ */
|
|
2495
|
+
/* @__PURE__ */ g(
|
|
2494
2496
|
"div",
|
|
2495
2497
|
{
|
|
2496
2498
|
style: {
|
|
@@ -2514,7 +2516,7 @@ function gr({
|
|
|
2514
2516
|
minWidth: 0
|
|
2515
2517
|
},
|
|
2516
2518
|
children: f ? /* @__PURE__ */ i(
|
|
2517
|
-
|
|
2519
|
+
w,
|
|
2518
2520
|
{
|
|
2519
2521
|
text: o.query,
|
|
2520
2522
|
duration: 2.5,
|
|
@@ -2525,7 +2527,7 @@ function gr({
|
|
|
2525
2527
|
) : o.query
|
|
2526
2528
|
}
|
|
2527
2529
|
),
|
|
2528
|
-
/* @__PURE__ */
|
|
2530
|
+
/* @__PURE__ */ g(
|
|
2529
2531
|
"div",
|
|
2530
2532
|
{
|
|
2531
2533
|
style: {
|
|
@@ -2536,7 +2538,7 @@ function gr({
|
|
|
2536
2538
|
flexShrink: 0
|
|
2537
2539
|
},
|
|
2538
2540
|
children: [
|
|
2539
|
-
|
|
2541
|
+
gr(o, r),
|
|
2540
2542
|
u && /* @__PURE__ */ i(
|
|
2541
2543
|
"button",
|
|
2542
2544
|
{
|
|
@@ -2552,7 +2554,7 @@ function gr({
|
|
|
2552
2554
|
textDecoration: "underline",
|
|
2553
2555
|
fontFamily: "inherit"
|
|
2554
2556
|
},
|
|
2555
|
-
children:
|
|
2557
|
+
children: p ? r.memorySearchHideExploreResults : r.memorySearchViewExploreResults
|
|
2556
2558
|
}
|
|
2557
2559
|
)
|
|
2558
2560
|
]
|
|
@@ -2561,10 +2563,10 @@ function gr({
|
|
|
2561
2563
|
]
|
|
2562
2564
|
}
|
|
2563
2565
|
),
|
|
2564
|
-
u &&
|
|
2565
|
-
|
|
2566
|
+
u && p && /* @__PURE__ */ i(
|
|
2567
|
+
pr,
|
|
2566
2568
|
{
|
|
2567
|
-
items:
|
|
2569
|
+
items: x,
|
|
2568
2570
|
queryRow: o,
|
|
2569
2571
|
onExploreQueryResultClick: s,
|
|
2570
2572
|
t: r
|
|
@@ -2582,14 +2584,14 @@ function gr({
|
|
|
2582
2584
|
}
|
|
2583
2585
|
);
|
|
2584
2586
|
}
|
|
2585
|
-
const
|
|
2587
|
+
const Sr = ({
|
|
2586
2588
|
data: e,
|
|
2587
2589
|
isLatest: r = !1,
|
|
2588
|
-
durationSeconds:
|
|
2589
|
-
onExploreQueryResultClick:
|
|
2590
|
+
durationSeconds: t,
|
|
2591
|
+
onExploreQueryResultClick: n,
|
|
2590
2592
|
t: l
|
|
2591
2593
|
}) => {
|
|
2592
|
-
const [c, s] =
|
|
2594
|
+
const [c, s] = v(
|
|
2593
2595
|
{}
|
|
2594
2596
|
), d = G((a) => {
|
|
2595
2597
|
s((u) => ({
|
|
@@ -2598,16 +2600,16 @@ const hr = ({
|
|
|
2598
2600
|
}));
|
|
2599
2601
|
}, []), m = D(() => {
|
|
2600
2602
|
let a = -1;
|
|
2601
|
-
return e.queries.forEach((u,
|
|
2602
|
-
u.result == null && u.error == null && (a =
|
|
2603
|
+
return e.queries.forEach((u, y) => {
|
|
2604
|
+
u.result == null && u.error == null && (a = y);
|
|
2603
2605
|
}), a;
|
|
2604
2606
|
}, [e.queries]), o = D(
|
|
2605
|
-
() =>
|
|
2607
|
+
() => hr(e.queries),
|
|
2606
2608
|
[e.queries]
|
|
2607
2609
|
);
|
|
2608
|
-
return /* @__PURE__ */
|
|
2609
|
-
r && !
|
|
2610
|
-
|
|
2610
|
+
return /* @__PURE__ */ g("div", { style: { padding: "10px" }, children: [
|
|
2611
|
+
r && !t && e.queries.length === 0 ? /* @__PURE__ */ i(
|
|
2612
|
+
w,
|
|
2611
2613
|
{
|
|
2612
2614
|
text: l.memorySearchExploringQueries,
|
|
2613
2615
|
duration: 2.5,
|
|
@@ -2616,7 +2618,7 @@ const hr = ({
|
|
|
2616
2618
|
shimmerColor: "#000"
|
|
2617
2619
|
}
|
|
2618
2620
|
) : o.map((a) => /* @__PURE__ */ i(
|
|
2619
|
-
|
|
2621
|
+
fr,
|
|
2620
2622
|
{
|
|
2621
2623
|
group: a,
|
|
2622
2624
|
t: l,
|
|
@@ -2624,11 +2626,11 @@ const hr = ({
|
|
|
2624
2626
|
isLatest: r,
|
|
2625
2627
|
expandedRows: c,
|
|
2626
2628
|
toggleExpanded: d,
|
|
2627
|
-
onExploreQueryResultClick:
|
|
2629
|
+
onExploreQueryResultClick: n
|
|
2628
2630
|
},
|
|
2629
2631
|
a.memoryTypeId
|
|
2630
2632
|
)),
|
|
2631
|
-
|
|
2633
|
+
t !== void 0 && /* @__PURE__ */ i(
|
|
2632
2634
|
"div",
|
|
2633
2635
|
{
|
|
2634
2636
|
style: {
|
|
@@ -2637,15 +2639,15 @@ const hr = ({
|
|
|
2637
2639
|
marginTop: "4px",
|
|
2638
2640
|
fontStyle: "italic"
|
|
2639
2641
|
},
|
|
2640
|
-
children:
|
|
2642
|
+
children: T(l.tookSeconds, { n: t })
|
|
2641
2643
|
}
|
|
2642
2644
|
)
|
|
2643
2645
|
] });
|
|
2644
|
-
},
|
|
2645
|
-
const
|
|
2646
|
-
return /* @__PURE__ */
|
|
2646
|
+
}, xr = ({ data: e, onSearchResultClick: r, t }) => {
|
|
2647
|
+
const n = e.response.items, l = !!r, [c, s] = v(null);
|
|
2648
|
+
return /* @__PURE__ */ g("div", { style: { padding: "16px" }, children: [
|
|
2647
2649
|
/* @__PURE__ */ i(
|
|
2648
|
-
|
|
2650
|
+
b.div,
|
|
2649
2651
|
{
|
|
2650
2652
|
style: {
|
|
2651
2653
|
marginBottom: "12px",
|
|
@@ -2656,7 +2658,7 @@ const hr = ({
|
|
|
2656
2658
|
initial: { opacity: 0, y: -6 },
|
|
2657
2659
|
animate: { opacity: 1, y: 0 },
|
|
2658
2660
|
transition: { duration: 0.25 },
|
|
2659
|
-
children:
|
|
2661
|
+
children: t.resultsHeading
|
|
2660
2662
|
}
|
|
2661
2663
|
),
|
|
2662
2664
|
/* @__PURE__ */ i(
|
|
@@ -2667,26 +2669,26 @@ const hr = ({
|
|
|
2667
2669
|
flexDirection: "column",
|
|
2668
2670
|
gap: 0
|
|
2669
2671
|
},
|
|
2670
|
-
children:
|
|
2671
|
-
const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a =
|
|
2672
|
+
children: n.map((d, m) => {
|
|
2673
|
+
const o = d.memoryTitle !== "" ? d.memoryTitle : d.memoryId, a = oe(
|
|
2672
2674
|
d.chunks
|
|
2673
2675
|
), u = [
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
+
ie(d),
|
|
2677
|
+
T(t.scoreLabel, {
|
|
2676
2678
|
n: d.matchingChunkScore.toFixed(2)
|
|
2677
2679
|
}),
|
|
2678
|
-
a.length > 0 ?
|
|
2680
|
+
a.length > 0 ? te(a, t) : t.pagesNotAvailable
|
|
2679
2681
|
].filter(
|
|
2680
|
-
(
|
|
2681
|
-
),
|
|
2682
|
+
(x) => x != null && x !== ""
|
|
2683
|
+
), y = {
|
|
2682
2684
|
memoryId: d.memoryId,
|
|
2683
2685
|
memoryTitle: d.memoryTitle,
|
|
2684
2686
|
memoryTypeId: d.memoryTypeId,
|
|
2685
2687
|
memoryTypeName: d.memoryTypeName,
|
|
2686
2688
|
pageNumbers: a
|
|
2687
|
-
}, f = `${d.memoryId}-${m}`,
|
|
2688
|
-
return /* @__PURE__ */
|
|
2689
|
-
|
|
2689
|
+
}, f = `${d.memoryId}-${m}`, p = c === f;
|
|
2690
|
+
return /* @__PURE__ */ g(
|
|
2691
|
+
b.div,
|
|
2690
2692
|
{
|
|
2691
2693
|
initial: { opacity: 0 },
|
|
2692
2694
|
animate: { opacity: 1 },
|
|
@@ -2698,11 +2700,11 @@ const hr = ({
|
|
|
2698
2700
|
gap: "12px",
|
|
2699
2701
|
paddingTop: "12px",
|
|
2700
2702
|
paddingBottom: "12px",
|
|
2701
|
-
borderBottom: m <
|
|
2703
|
+
borderBottom: m < n.length - 1 ? "1px solid #eee" : void 0,
|
|
2702
2704
|
minWidth: 0
|
|
2703
2705
|
},
|
|
2704
2706
|
children: [
|
|
2705
|
-
/* @__PURE__ */
|
|
2707
|
+
/* @__PURE__ */ g(
|
|
2706
2708
|
"div",
|
|
2707
2709
|
{
|
|
2708
2710
|
style: {
|
|
@@ -2734,7 +2736,7 @@ const hr = ({
|
|
|
2734
2736
|
whiteSpace: "pre-wrap",
|
|
2735
2737
|
wordBreak: "break-word"
|
|
2736
2738
|
},
|
|
2737
|
-
children:
|
|
2739
|
+
children: ne(d.chunks)
|
|
2738
2740
|
}
|
|
2739
2741
|
),
|
|
2740
2742
|
/* @__PURE__ */ i(
|
|
@@ -2752,16 +2754,16 @@ const hr = ({
|
|
|
2752
2754
|
]
|
|
2753
2755
|
}
|
|
2754
2756
|
),
|
|
2755
|
-
l && /* @__PURE__ */
|
|
2757
|
+
l && /* @__PURE__ */ g(
|
|
2756
2758
|
"button",
|
|
2757
2759
|
{
|
|
2758
2760
|
type: "button",
|
|
2759
|
-
"aria-busy":
|
|
2760
|
-
disabled:
|
|
2761
|
+
"aria-busy": p,
|
|
2762
|
+
disabled: p,
|
|
2761
2763
|
onClick: async () => {
|
|
2762
2764
|
s(f);
|
|
2763
2765
|
try {
|
|
2764
|
-
await r(
|
|
2766
|
+
await r(y);
|
|
2765
2767
|
} finally {
|
|
2766
2768
|
s(null);
|
|
2767
2769
|
}
|
|
@@ -2776,21 +2778,21 @@ const hr = ({
|
|
|
2776
2778
|
background: "#eff6ff",
|
|
2777
2779
|
border: "1px solid #bfdbfe",
|
|
2778
2780
|
borderRadius: 6,
|
|
2779
|
-
cursor:
|
|
2781
|
+
cursor: p ? "wait" : "pointer",
|
|
2780
2782
|
fontFamily: "inherit",
|
|
2781
2783
|
display: "inline-flex",
|
|
2782
2784
|
alignItems: "center",
|
|
2783
2785
|
gap: 8
|
|
2784
2786
|
},
|
|
2785
2787
|
children: [
|
|
2786
|
-
|
|
2788
|
+
p && /* @__PURE__ */ i(
|
|
2787
2789
|
"span",
|
|
2788
2790
|
{
|
|
2789
2791
|
className: "explore-memory-loader explore-memory-loader--callback",
|
|
2790
2792
|
"aria-hidden": !0
|
|
2791
2793
|
}
|
|
2792
2794
|
),
|
|
2793
|
-
|
|
2795
|
+
t.viewButton
|
|
2794
2796
|
]
|
|
2795
2797
|
}
|
|
2796
2798
|
)
|
|
@@ -2802,8 +2804,8 @@ const hr = ({
|
|
|
2802
2804
|
}
|
|
2803
2805
|
)
|
|
2804
2806
|
] });
|
|
2805
|
-
},
|
|
2806
|
-
|
|
2807
|
+
}, Tr = ({ message: e }) => /* @__PURE__ */ i("div", { style: { padding: "16px" }, children: /* @__PURE__ */ i(
|
|
2808
|
+
b.div,
|
|
2807
2809
|
{
|
|
2808
2810
|
initial: { opacity: 0, y: -10 },
|
|
2809
2811
|
animate: { opacity: 1, y: 0 },
|
|
@@ -2825,87 +2827,87 @@ const hr = ({
|
|
|
2825
2827
|
}
|
|
2826
2828
|
)
|
|
2827
2829
|
}
|
|
2828
|
-
) }),
|
|
2830
|
+
) }), kr = ({
|
|
2829
2831
|
progressViewItems: e,
|
|
2830
2832
|
loadingText: r,
|
|
2831
|
-
t
|
|
2832
|
-
onSourceClick:
|
|
2833
|
+
t,
|
|
2834
|
+
onSourceClick: n,
|
|
2833
2835
|
onSearchResultClick: l,
|
|
2834
2836
|
onExploreQueryResultClick: c
|
|
2835
2837
|
}) => {
|
|
2836
|
-
const s =
|
|
2837
|
-
|
|
2838
|
+
const s = F(null);
|
|
2839
|
+
A(() => {
|
|
2838
2840
|
s.current && (s.current.scrollTop = s.current.scrollHeight);
|
|
2839
2841
|
}, [e.length]);
|
|
2840
2842
|
const d = (o) => {
|
|
2841
2843
|
const a = o.item.data;
|
|
2842
2844
|
if (a.taskType === "StreamingChatCompletion" && a.eventType === "Text")
|
|
2843
|
-
return /* @__PURE__ */ i(
|
|
2845
|
+
return /* @__PURE__ */ i(V, { text: a.text });
|
|
2844
2846
|
if (a.taskType === "StructuredChatCompletion" && a.eventType === "Completed")
|
|
2845
|
-
return /* @__PURE__ */ i(
|
|
2847
|
+
return /* @__PURE__ */ i(Be, { data: a });
|
|
2846
2848
|
if (a.taskType === "MemoryChat")
|
|
2847
2849
|
switch (a.eventType) {
|
|
2848
2850
|
case "Text":
|
|
2849
|
-
return /* @__PURE__ */ i(
|
|
2851
|
+
return /* @__PURE__ */ i(V, { text: a.text });
|
|
2850
2852
|
case "FindMemories":
|
|
2851
2853
|
return /* @__PURE__ */ i(
|
|
2852
|
-
|
|
2854
|
+
_e,
|
|
2853
2855
|
{
|
|
2854
2856
|
data: a,
|
|
2855
2857
|
isLatest: o.isLatest,
|
|
2856
2858
|
durationSeconds: o.durationSeconds,
|
|
2857
|
-
t
|
|
2859
|
+
t
|
|
2858
2860
|
}
|
|
2859
2861
|
);
|
|
2860
2862
|
case "FindMemoriesResult":
|
|
2861
2863
|
return /* @__PURE__ */ i(
|
|
2862
|
-
|
|
2864
|
+
Ge,
|
|
2863
2865
|
{
|
|
2864
2866
|
data: a,
|
|
2865
|
-
t
|
|
2867
|
+
t
|
|
2866
2868
|
}
|
|
2867
2869
|
);
|
|
2868
2870
|
case "Search":
|
|
2869
2871
|
return /* @__PURE__ */ i(
|
|
2870
|
-
|
|
2872
|
+
He,
|
|
2871
2873
|
{
|
|
2872
2874
|
data: a,
|
|
2873
2875
|
isLatest: o.isLatest,
|
|
2874
2876
|
durationSeconds: o.durationSeconds,
|
|
2875
|
-
t
|
|
2877
|
+
t
|
|
2876
2878
|
}
|
|
2877
2879
|
);
|
|
2878
2880
|
case "FindSources":
|
|
2879
2881
|
return /* @__PURE__ */ i(
|
|
2880
|
-
|
|
2882
|
+
Qe,
|
|
2881
2883
|
{
|
|
2882
2884
|
data: a,
|
|
2883
2885
|
isLatest: o.isLatest,
|
|
2884
2886
|
durationSeconds: o.durationSeconds,
|
|
2885
|
-
t
|
|
2887
|
+
t
|
|
2886
2888
|
}
|
|
2887
2889
|
);
|
|
2888
2890
|
case "SourcesResult":
|
|
2889
2891
|
return /* @__PURE__ */ i(
|
|
2890
|
-
|
|
2892
|
+
je,
|
|
2891
2893
|
{
|
|
2892
2894
|
data: a,
|
|
2893
|
-
onSourceClick:
|
|
2894
|
-
t
|
|
2895
|
+
onSourceClick: n,
|
|
2896
|
+
t
|
|
2895
2897
|
}
|
|
2896
2898
|
);
|
|
2897
2899
|
case "ExploreMemories":
|
|
2898
2900
|
return /* @__PURE__ */ i(
|
|
2899
|
-
|
|
2901
|
+
Xe,
|
|
2900
2902
|
{
|
|
2901
2903
|
data: a,
|
|
2902
2904
|
completed: o.completed,
|
|
2903
2905
|
isLatest: o.isLatest,
|
|
2904
|
-
t
|
|
2906
|
+
t
|
|
2905
2907
|
}
|
|
2906
2908
|
);
|
|
2907
2909
|
case "ChunkResult":
|
|
2908
|
-
return /* @__PURE__ */ i(
|
|
2910
|
+
return /* @__PURE__ */ i(Ze, { data: a, t });
|
|
2909
2911
|
case "Completed":
|
|
2910
2912
|
return null;
|
|
2911
2913
|
}
|
|
@@ -2913,52 +2915,52 @@ const hr = ({
|
|
|
2913
2915
|
switch (a.eventType) {
|
|
2914
2916
|
case "GeneratingQueries":
|
|
2915
2917
|
return /* @__PURE__ */ i(
|
|
2916
|
-
|
|
2918
|
+
dr,
|
|
2917
2919
|
{
|
|
2918
2920
|
data: a,
|
|
2919
2921
|
isLatest: o.isLatest,
|
|
2920
2922
|
durationSeconds: o.durationSeconds,
|
|
2921
|
-
t
|
|
2923
|
+
t
|
|
2922
2924
|
}
|
|
2923
2925
|
);
|
|
2924
2926
|
case "ExploreQueries":
|
|
2925
2927
|
return /* @__PURE__ */ i(
|
|
2926
|
-
|
|
2928
|
+
Sr,
|
|
2927
2929
|
{
|
|
2928
2930
|
data: a,
|
|
2929
2931
|
isLatest: o.isLatest,
|
|
2930
2932
|
durationSeconds: o.durationSeconds,
|
|
2931
2933
|
onExploreQueryResultClick: c,
|
|
2932
|
-
t
|
|
2934
|
+
t
|
|
2933
2935
|
}
|
|
2934
2936
|
);
|
|
2935
2937
|
case "SearchMemoryTypes":
|
|
2936
2938
|
return /* @__PURE__ */ i(
|
|
2937
|
-
|
|
2939
|
+
tr,
|
|
2938
2940
|
{
|
|
2939
2941
|
data: a,
|
|
2940
2942
|
isLatest: o.isLatest,
|
|
2941
2943
|
durationSeconds: o.durationSeconds,
|
|
2942
|
-
t
|
|
2944
|
+
t
|
|
2943
2945
|
}
|
|
2944
2946
|
);
|
|
2945
2947
|
case "Completed":
|
|
2946
2948
|
return /* @__PURE__ */ i(
|
|
2947
|
-
|
|
2949
|
+
xr,
|
|
2948
2950
|
{
|
|
2949
2951
|
data: a,
|
|
2950
2952
|
onSearchResultClick: l,
|
|
2951
|
-
t
|
|
2953
|
+
t
|
|
2952
2954
|
}
|
|
2953
2955
|
);
|
|
2954
2956
|
}
|
|
2955
|
-
return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(
|
|
2957
|
+
return a.taskType === "StreamingChatCompletion" && a.eventType === "Completed" ? null : a.eventType === "Error" && "message" in a ? /* @__PURE__ */ i(Tr, { message: a.message }) : null;
|
|
2956
2958
|
};
|
|
2957
2959
|
if (e.length === 0)
|
|
2958
2960
|
return /* @__PURE__ */ i("div", { style: { width: "fit-content" }, children: /* @__PURE__ */ i(
|
|
2959
|
-
|
|
2961
|
+
w,
|
|
2960
2962
|
{
|
|
2961
|
-
text: r ??
|
|
2963
|
+
text: r ?? t.processingYourTask,
|
|
2962
2964
|
duration: 1.5,
|
|
2963
2965
|
repeat: !0,
|
|
2964
2966
|
repeatDelay: 0,
|
|
@@ -2976,8 +2978,8 @@ const hr = ({
|
|
|
2976
2978
|
(h) => h.item.data.taskType === "MemorySearch" && h.item.data.eventType === "ExploreQueries"
|
|
2977
2979
|
) : !0;
|
|
2978
2980
|
});
|
|
2979
|
-
return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(
|
|
2980
|
-
|
|
2981
|
+
return /* @__PURE__ */ i("div", { id: "agent-task-progress-verbose", ref: s, children: /* @__PURE__ */ i(J, { children: m.map((o, a) => /* @__PURE__ */ i(
|
|
2982
|
+
b.div,
|
|
2981
2983
|
{
|
|
2982
2984
|
id: `agent-task-progress-item-${o.item.progressItemId}`,
|
|
2983
2985
|
initial: { opacity: 0, y: -20 },
|
|
@@ -2991,38 +2993,38 @@ const hr = ({
|
|
|
2991
2993
|
},
|
|
2992
2994
|
o.item.progressItemId
|
|
2993
2995
|
)) }) });
|
|
2994
|
-
},
|
|
2996
|
+
}, Rr = ({
|
|
2995
2997
|
agentTask: e,
|
|
2996
2998
|
mode: r = "verbose",
|
|
2997
|
-
language:
|
|
2998
|
-
onSourceClick:
|
|
2999
|
+
language: t,
|
|
3000
|
+
onSourceClick: n,
|
|
2999
3001
|
onSearchResultClick: l,
|
|
3000
3002
|
onExploreQueryResultClick: c
|
|
3001
3003
|
}) => {
|
|
3002
|
-
const s =
|
|
3004
|
+
const s = ze(e), d = (e.params.type === "MemoryChat" || e.params.type === "MemorySearch") && "language" in e.params ? e.params.language ?? "en" : t ?? "en", m = $e(d);
|
|
3003
3005
|
return r === "simple" ? /* @__PURE__ */ i(
|
|
3004
|
-
|
|
3006
|
+
Ne,
|
|
3005
3007
|
{
|
|
3006
3008
|
progressViewItems: s,
|
|
3007
3009
|
t: m
|
|
3008
3010
|
}
|
|
3009
3011
|
) : /* @__PURE__ */ i(
|
|
3010
|
-
|
|
3012
|
+
kr,
|
|
3011
3013
|
{
|
|
3012
3014
|
progressViewItems: s,
|
|
3013
3015
|
loadingText: e.loadingText,
|
|
3014
3016
|
t: m,
|
|
3015
|
-
onSourceClick:
|
|
3017
|
+
onSourceClick: n,
|
|
3016
3018
|
onSearchResultClick: l,
|
|
3017
3019
|
onExploreQueryResultClick: c
|
|
3018
3020
|
}
|
|
3019
3021
|
);
|
|
3020
3022
|
};
|
|
3021
3023
|
export {
|
|
3022
|
-
|
|
3024
|
+
Rr as AgentTaskProgress,
|
|
3023
3025
|
z as Checkmark,
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3026
|
+
Ar as FencyProvider,
|
|
3027
|
+
xr as MemorySearchCompletedResults,
|
|
3028
|
+
U as XMark,
|
|
3029
|
+
Fr as useAgentTasks
|
|
3028
3030
|
};
|