teodor-new-chat-ui 3.0.49 → 3.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +588 -575
- package/dist/index.umd.js +13 -13
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as f from "react";
|
|
2
|
-
import Y, { useState as
|
|
2
|
+
import Y, { useState as he, useRef as wt, useCallback as Ze, useEffect as Xe, useReducer as kp, useMemo as bn, createContext as mc, useContext as gc, createElement as to, useLayoutEffect as Pp } from "react";
|
|
3
3
|
import * as Fo from "react-dom";
|
|
4
4
|
import vc from "react-dom";
|
|
5
5
|
import { Square as xc, Send as _p, X as Un, ExternalLink as Op, Download as Mp, Image as bc, FileText as Ba, Loader as wc, ChevronUp as fr, ChevronDown as zn, Copy as Ha, Edit as $a, RotateCcw as Xs, Bot as za, Wrench as Dp, User as Lp, ChevronRight as Fp, Check as _i, Circle as Bp, Edit3 as yc, Paperclip as Ua, Loader2 as Hp, Plus as $p, FileSpreadsheet as zp, MessageSquarePlus as Up, MessageSquare as Wp, Calendar as Vp, Trash2 as Gp, PanelLeft as Kp, Settings as Yp, Server as Xp, EyeOff as qp, Eye as Jp, Layout as Zp, MessageCircle as Qp, Save as em } from "lucide-react";
|
|
@@ -54,15 +54,15 @@ function sm() {
|
|
|
54
54
|
var b = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
55
55
|
function w(T) {
|
|
56
56
|
{
|
|
57
|
-
for (var U = arguments.length, oe = new Array(U > 1 ? U - 1 : 0),
|
|
58
|
-
oe[
|
|
57
|
+
for (var U = arguments.length, oe = new Array(U > 1 ? U - 1 : 0), xe = 1; xe < U; xe++)
|
|
58
|
+
oe[xe - 1] = arguments[xe];
|
|
59
59
|
y("error", T, oe);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
function y(T, U, oe) {
|
|
63
63
|
{
|
|
64
|
-
var
|
|
65
|
-
|
|
64
|
+
var xe = b.ReactDebugCurrentFrame, Me = xe.getStackAddendum();
|
|
65
|
+
Me !== "" && (U += "%s", oe = oe.concat([Me]));
|
|
66
66
|
var Be = oe.map(function(Ie) {
|
|
67
67
|
return String(Ie);
|
|
68
68
|
});
|
|
@@ -79,11 +79,11 @@ function sm() {
|
|
|
79
79
|
T.$$typeof === A || T.getModuleId !== void 0));
|
|
80
80
|
}
|
|
81
81
|
function O(T, U, oe) {
|
|
82
|
-
var
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
85
|
-
var
|
|
86
|
-
return
|
|
82
|
+
var xe = T.displayName;
|
|
83
|
+
if (xe)
|
|
84
|
+
return xe;
|
|
85
|
+
var Me = U.displayName || U.name || "";
|
|
86
|
+
return Me !== "" ? oe + "(" + Me + ")" : oe;
|
|
87
87
|
}
|
|
88
88
|
function W(T) {
|
|
89
89
|
return T.displayName || "Context";
|
|
@@ -120,10 +120,10 @@ function sm() {
|
|
|
120
120
|
case c:
|
|
121
121
|
return O(T, T.render, "ForwardRef");
|
|
122
122
|
case h:
|
|
123
|
-
var
|
|
124
|
-
return
|
|
123
|
+
var xe = T.displayName || null;
|
|
124
|
+
return xe !== null ? xe : G(T.type) || "Memo";
|
|
125
125
|
case p: {
|
|
126
|
-
var
|
|
126
|
+
var Me = T, Be = Me._payload, Ie = Me._init;
|
|
127
127
|
try {
|
|
128
128
|
return G(Ie(Be));
|
|
129
129
|
} catch {
|
|
@@ -133,18 +133,18 @@ function sm() {
|
|
|
133
133
|
}
|
|
134
134
|
return null;
|
|
135
135
|
}
|
|
136
|
-
var N = Object.assign,
|
|
137
|
-
function
|
|
136
|
+
var N = Object.assign, H = 0, D, q, z, k, $, J, te;
|
|
137
|
+
function B() {
|
|
138
138
|
}
|
|
139
|
-
|
|
139
|
+
B.__reactDisabledLog = !0;
|
|
140
140
|
function Z() {
|
|
141
141
|
{
|
|
142
|
-
if (
|
|
143
|
-
D = console.log, q = console.info, z = console.warn, k = console.error,
|
|
142
|
+
if (H === 0) {
|
|
143
|
+
D = console.log, q = console.info, z = console.warn, k = console.error, $ = console.group, J = console.groupCollapsed, te = console.groupEnd;
|
|
144
144
|
var T = {
|
|
145
145
|
configurable: !0,
|
|
146
146
|
enumerable: !0,
|
|
147
|
-
value:
|
|
147
|
+
value: B,
|
|
148
148
|
writable: !0
|
|
149
149
|
};
|
|
150
150
|
Object.defineProperties(console, {
|
|
@@ -157,12 +157,12 @@ function sm() {
|
|
|
157
157
|
groupEnd: T
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
-
|
|
160
|
+
H++;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function fe() {
|
|
164
164
|
{
|
|
165
|
-
if (
|
|
165
|
+
if (H--, H === 0) {
|
|
166
166
|
var T = {
|
|
167
167
|
configurable: !0,
|
|
168
168
|
enumerable: !0,
|
|
@@ -182,7 +182,7 @@ function sm() {
|
|
|
182
182
|
value: k
|
|
183
183
|
}),
|
|
184
184
|
group: N({}, T, {
|
|
185
|
-
value:
|
|
185
|
+
value: $
|
|
186
186
|
}),
|
|
187
187
|
groupCollapsed: N({}, T, {
|
|
188
188
|
value: J
|
|
@@ -192,18 +192,18 @@ function sm() {
|
|
|
192
192
|
})
|
|
193
193
|
});
|
|
194
194
|
}
|
|
195
|
-
|
|
195
|
+
H < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
-
var
|
|
198
|
+
var ve = b.ReactCurrentDispatcher, X;
|
|
199
199
|
function _(T, U, oe) {
|
|
200
200
|
{
|
|
201
201
|
if (X === void 0)
|
|
202
202
|
try {
|
|
203
203
|
throw Error();
|
|
204
|
-
} catch (
|
|
205
|
-
var
|
|
206
|
-
X =
|
|
204
|
+
} catch (Me) {
|
|
205
|
+
var xe = Me.stack.trim().match(/\n( *(at )?)/);
|
|
206
|
+
X = xe && xe[1] || "";
|
|
207
207
|
}
|
|
208
208
|
return `
|
|
209
209
|
` + X + T;
|
|
@@ -222,12 +222,12 @@ function sm() {
|
|
|
222
222
|
if (oe !== void 0)
|
|
223
223
|
return oe;
|
|
224
224
|
}
|
|
225
|
-
var
|
|
225
|
+
var xe;
|
|
226
226
|
ee = !0;
|
|
227
|
-
var
|
|
227
|
+
var Me = Error.prepareStackTrace;
|
|
228
228
|
Error.prepareStackTrace = void 0;
|
|
229
229
|
var Be;
|
|
230
|
-
Be =
|
|
230
|
+
Be = ve.current, ve.current = null, Z();
|
|
231
231
|
try {
|
|
232
232
|
if (U) {
|
|
233
233
|
var Ie = function() {
|
|
@@ -241,14 +241,14 @@ function sm() {
|
|
|
241
241
|
try {
|
|
242
242
|
Reflect.construct(Ie, []);
|
|
243
243
|
} catch (tn) {
|
|
244
|
-
|
|
244
|
+
xe = tn;
|
|
245
245
|
}
|
|
246
246
|
Reflect.construct(T, [], Ie);
|
|
247
247
|
} else {
|
|
248
248
|
try {
|
|
249
249
|
Ie.call();
|
|
250
250
|
} catch (tn) {
|
|
251
|
-
|
|
251
|
+
xe = tn;
|
|
252
252
|
}
|
|
253
253
|
T.call(Ie.prototype);
|
|
254
254
|
}
|
|
@@ -256,36 +256,36 @@ function sm() {
|
|
|
256
256
|
try {
|
|
257
257
|
throw Error();
|
|
258
258
|
} catch (tn) {
|
|
259
|
-
|
|
259
|
+
xe = tn;
|
|
260
260
|
}
|
|
261
261
|
T();
|
|
262
262
|
}
|
|
263
263
|
} catch (tn) {
|
|
264
|
-
if (tn &&
|
|
264
|
+
if (tn && xe && typeof tn.stack == "string") {
|
|
265
265
|
for (var Ee = tn.stack.split(`
|
|
266
|
-
`), ft =
|
|
267
|
-
`),
|
|
266
|
+
`), ft = xe.stack.split(`
|
|
267
|
+
`), Je = Ee.length - 1, tt = ft.length - 1; Je >= 1 && tt >= 0 && Ee[Je] !== ft[tt]; )
|
|
268
268
|
tt--;
|
|
269
|
-
for (;
|
|
270
|
-
if (Ee[
|
|
271
|
-
if (
|
|
269
|
+
for (; Je >= 1 && tt >= 0; Je--, tt--)
|
|
270
|
+
if (Ee[Je] !== ft[tt]) {
|
|
271
|
+
if (Je !== 1 || tt !== 1)
|
|
272
272
|
do
|
|
273
|
-
if (
|
|
273
|
+
if (Je--, tt--, tt < 0 || Ee[Je] !== ft[tt]) {
|
|
274
274
|
var Et = `
|
|
275
|
-
` + Ee[
|
|
275
|
+
` + Ee[Je].replace(" at new ", " at ");
|
|
276
276
|
return T.displayName && Et.includes("<anonymous>") && (Et = Et.replace("<anonymous>", T.displayName)), typeof T == "function" && re.set(T, Et), Et;
|
|
277
277
|
}
|
|
278
|
-
while (
|
|
278
|
+
while (Je >= 1 && tt >= 0);
|
|
279
279
|
break;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
} finally {
|
|
283
|
-
ee = !1,
|
|
283
|
+
ee = !1, ve.current = Be, fe(), Error.prepareStackTrace = Me;
|
|
284
284
|
}
|
|
285
285
|
var Ln = T ? T.displayName || T.name : "", Fa = Ln ? _(Ln) : "";
|
|
286
286
|
return typeof T == "function" && re.set(T, Fa), Fa;
|
|
287
287
|
}
|
|
288
|
-
function
|
|
288
|
+
function Oe(T, U, oe) {
|
|
289
289
|
return ae(T, !1);
|
|
290
290
|
}
|
|
291
291
|
function $e(T) {
|
|
@@ -308,13 +308,13 @@ function sm() {
|
|
|
308
308
|
if (typeof T == "object")
|
|
309
309
|
switch (T.$$typeof) {
|
|
310
310
|
case c:
|
|
311
|
-
return
|
|
311
|
+
return Oe(T.render);
|
|
312
312
|
case h:
|
|
313
313
|
return ze(T.type, U, oe);
|
|
314
314
|
case p: {
|
|
315
|
-
var
|
|
315
|
+
var xe = T, Me = xe._payload, Be = xe._init;
|
|
316
316
|
try {
|
|
317
|
-
return ze(Be(
|
|
317
|
+
return ze(Be(Me), U, oe);
|
|
318
318
|
} catch {
|
|
319
319
|
}
|
|
320
320
|
}
|
|
@@ -322,14 +322,14 @@ function sm() {
|
|
|
322
322
|
return "";
|
|
323
323
|
}
|
|
324
324
|
var Ve = Object.prototype.hasOwnProperty, Fe = {}, ue = b.ReactDebugCurrentFrame;
|
|
325
|
-
function
|
|
325
|
+
function F(T) {
|
|
326
326
|
if (T) {
|
|
327
327
|
var U = T._owner, oe = ze(T.type, T._source, U ? U.type : null);
|
|
328
328
|
ue.setExtraStackFrame(oe);
|
|
329
329
|
} else
|
|
330
330
|
ue.setExtraStackFrame(null);
|
|
331
331
|
}
|
|
332
|
-
function V(T, U, oe,
|
|
332
|
+
function V(T, U, oe, xe, Me) {
|
|
333
333
|
{
|
|
334
334
|
var Be = Function.call.bind(Ve);
|
|
335
335
|
for (var Ie in T)
|
|
@@ -337,14 +337,14 @@ function sm() {
|
|
|
337
337
|
var Ee = void 0;
|
|
338
338
|
try {
|
|
339
339
|
if (typeof T[Ie] != "function") {
|
|
340
|
-
var ft = Error((
|
|
340
|
+
var ft = Error((xe || "React class") + ": " + oe + " type `" + Ie + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof T[Ie] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
341
341
|
throw ft.name = "Invariant Violation", ft;
|
|
342
342
|
}
|
|
343
|
-
Ee = T[Ie](U, Ie,
|
|
344
|
-
} catch (
|
|
345
|
-
Ee =
|
|
343
|
+
Ee = T[Ie](U, Ie, xe, oe, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
344
|
+
} catch (Je) {
|
|
345
|
+
Ee = Je;
|
|
346
346
|
}
|
|
347
|
-
Ee && !(Ee instanceof Error) && (
|
|
347
|
+
Ee && !(Ee instanceof Error) && (F(Me), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", xe || "React class", oe, Ie, typeof Ee), F(null)), Ee instanceof Error && !(Ee.message in Fe) && (Fe[Ee.message] = !0, F(Me), w("Failed %s type: %s", oe, Ee.message), F(null));
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
}
|
|
@@ -352,32 +352,32 @@ function sm() {
|
|
|
352
352
|
function Le(T) {
|
|
353
353
|
return de(T);
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function ke(T) {
|
|
356
356
|
{
|
|
357
357
|
var U = typeof Symbol == "function" && Symbol.toStringTag, oe = U && T[Symbol.toStringTag] || T.constructor.name || "Object";
|
|
358
358
|
return oe;
|
|
359
359
|
}
|
|
360
360
|
}
|
|
361
|
-
function
|
|
361
|
+
function Pe(T) {
|
|
362
362
|
try {
|
|
363
|
-
return
|
|
363
|
+
return _e(T), !1;
|
|
364
364
|
} catch {
|
|
365
365
|
return !0;
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
function
|
|
368
|
+
function _e(T) {
|
|
369
369
|
return "" + T;
|
|
370
370
|
}
|
|
371
371
|
function ot(T) {
|
|
372
|
-
if (
|
|
373
|
-
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
372
|
+
if (Pe(T))
|
|
373
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ke(T)), _e(T);
|
|
374
374
|
}
|
|
375
375
|
var Ke = b.ReactCurrentOwner, at = {
|
|
376
376
|
key: !0,
|
|
377
377
|
ref: !0,
|
|
378
378
|
__self: !0,
|
|
379
379
|
__source: !0
|
|
380
|
-
},
|
|
380
|
+
}, qe, lt;
|
|
381
381
|
function _t(T) {
|
|
382
382
|
if (Ve.call(T, "ref")) {
|
|
383
383
|
var U = Object.getOwnPropertyDescriptor(T, "ref").get;
|
|
@@ -400,7 +400,7 @@ function sm() {
|
|
|
400
400
|
function Ye(T, U) {
|
|
401
401
|
{
|
|
402
402
|
var oe = function() {
|
|
403
|
-
|
|
403
|
+
qe || (qe = !0, w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", U));
|
|
404
404
|
};
|
|
405
405
|
oe.isReactWarning = !0, Object.defineProperty(T, "key", {
|
|
406
406
|
get: oe,
|
|
@@ -419,7 +419,7 @@ function sm() {
|
|
|
419
419
|
});
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
var Ss = function(T, U, oe,
|
|
422
|
+
var Ss = function(T, U, oe, xe, Me, Be, Ie) {
|
|
423
423
|
var Ee = {
|
|
424
424
|
// This tag allows us to uniquely identify this as a React Element
|
|
425
425
|
$$typeof: t,
|
|
@@ -440,30 +440,30 @@ function sm() {
|
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
|
-
value:
|
|
443
|
+
value: xe
|
|
444
444
|
}), Object.defineProperty(Ee, "_source", {
|
|
445
445
|
configurable: !1,
|
|
446
446
|
enumerable: !1,
|
|
447
447
|
writable: !1,
|
|
448
|
-
value:
|
|
448
|
+
value: Me
|
|
449
449
|
}), Object.freeze && (Object.freeze(Ee.props), Object.freeze(Ee)), Ee;
|
|
450
450
|
};
|
|
451
|
-
function Cs(T, U, oe,
|
|
451
|
+
function Cs(T, U, oe, xe, Me) {
|
|
452
452
|
{
|
|
453
453
|
var Be, Ie = {}, Ee = null, ft = null;
|
|
454
|
-
oe !== void 0 && (ot(oe), Ee = "" + oe), vn(U) && (ot(U.key), Ee = "" + U.key), _t(U) && (ft = U.ref, Mn(U,
|
|
454
|
+
oe !== void 0 && (ot(oe), Ee = "" + oe), vn(U) && (ot(U.key), Ee = "" + U.key), _t(U) && (ft = U.ref, Mn(U, Me));
|
|
455
455
|
for (Be in U)
|
|
456
456
|
Ve.call(U, Be) && !at.hasOwnProperty(Be) && (Ie[Be] = U[Be]);
|
|
457
457
|
if (T && T.defaultProps) {
|
|
458
|
-
var
|
|
459
|
-
for (Be in
|
|
460
|
-
Ie[Be] === void 0 && (Ie[Be] =
|
|
458
|
+
var Je = T.defaultProps;
|
|
459
|
+
for (Be in Je)
|
|
460
|
+
Ie[Be] === void 0 && (Ie[Be] = Je[Be]);
|
|
461
461
|
}
|
|
462
462
|
if (Ee || ft) {
|
|
463
463
|
var tt = typeof T == "function" ? T.displayName || T.name || "Unknown" : T;
|
|
464
464
|
Ee && Ye(Ie, tt), ft && ar(Ie, tt);
|
|
465
465
|
}
|
|
466
|
-
return Ss(T, Ee, ft,
|
|
466
|
+
return Ss(T, Ee, ft, Me, xe, Ke.current, Ie);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
var Q = b.ReactCurrentOwner, ie = b.ReactDebugCurrentFrame;
|
|
@@ -516,8 +516,8 @@ Check the top-level render call using <` + oe + ">.");
|
|
|
516
516
|
if (Oa[oe])
|
|
517
517
|
return;
|
|
518
518
|
Oa[oe] = !0;
|
|
519
|
-
var
|
|
520
|
-
T && T._owner && T._owner !== Q.current && (
|
|
519
|
+
var xe = "";
|
|
520
|
+
T && T._owner && T._owner !== Q.current && (xe = " It was passed a child from " + G(T._owner.type) + "."), Ce(T), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', oe, xe), Ce(null);
|
|
521
521
|
}
|
|
522
522
|
}
|
|
523
523
|
function Da(T, U) {
|
|
@@ -526,15 +526,15 @@ Check the top-level render call using <` + oe + ">.");
|
|
|
526
526
|
return;
|
|
527
527
|
if (Le(T))
|
|
528
528
|
for (var oe = 0; oe < T.length; oe++) {
|
|
529
|
-
var
|
|
530
|
-
Ot(
|
|
529
|
+
var xe = T[oe];
|
|
530
|
+
Ot(xe) && Ma(xe, U);
|
|
531
531
|
}
|
|
532
532
|
else if (Ot(T))
|
|
533
533
|
T._store && (T._store.validated = !0);
|
|
534
534
|
else if (T) {
|
|
535
|
-
var
|
|
536
|
-
if (typeof
|
|
537
|
-
for (var Be =
|
|
535
|
+
var Me = g(T);
|
|
536
|
+
if (typeof Me == "function" && Me !== T.entries)
|
|
537
|
+
for (var Be = Me.call(T), Ie; !(Ie = Be.next()).done; )
|
|
538
538
|
Ot(Ie.value) && Ma(Ie.value, U);
|
|
539
539
|
}
|
|
540
540
|
}
|
|
@@ -554,12 +554,12 @@ Check the top-level render call using <` + oe + ">.");
|
|
|
554
554
|
else
|
|
555
555
|
return;
|
|
556
556
|
if (oe) {
|
|
557
|
-
var
|
|
558
|
-
V(oe, T.props, "prop",
|
|
557
|
+
var xe = G(U);
|
|
558
|
+
V(oe, T.props, "prop", xe, T);
|
|
559
559
|
} else if (U.PropTypes !== void 0 && !Ne) {
|
|
560
560
|
Ne = !0;
|
|
561
|
-
var
|
|
562
|
-
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
561
|
+
var Me = G(U);
|
|
562
|
+
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", Me || "Unknown");
|
|
563
563
|
}
|
|
564
564
|
typeof U.getDefaultProps == "function" && !U.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
565
565
|
}
|
|
@@ -567,16 +567,16 @@ Check the top-level render call using <` + oe + ">.");
|
|
|
567
567
|
function Rp(T) {
|
|
568
568
|
{
|
|
569
569
|
for (var U = Object.keys(T.props), oe = 0; oe < U.length; oe++) {
|
|
570
|
-
var
|
|
571
|
-
if (
|
|
572
|
-
Ce(T), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",
|
|
570
|
+
var xe = U[oe];
|
|
571
|
+
if (xe !== "children" && xe !== "key") {
|
|
572
|
+
Ce(T), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", xe), Ce(null);
|
|
573
573
|
break;
|
|
574
574
|
}
|
|
575
575
|
}
|
|
576
576
|
T.ref !== null && (Ce(T), w("Invalid attribute `ref` supplied to `React.Fragment`."), Ce(null));
|
|
577
577
|
}
|
|
578
578
|
}
|
|
579
|
-
function La(T, U, oe,
|
|
579
|
+
function La(T, U, oe, xe, Me, Be) {
|
|
580
580
|
{
|
|
581
581
|
var Ie = P(T);
|
|
582
582
|
if (!Ie) {
|
|
@@ -584,16 +584,16 @@ Check the top-level render call using <` + oe + ">.");
|
|
|
584
584
|
(T === void 0 || typeof T == "object" && T !== null && Object.keys(T).length === 0) && (Ee += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
585
585
|
var ft = Dn();
|
|
586
586
|
ft ? Ee += ft : Ee += Mt();
|
|
587
|
-
var
|
|
588
|
-
T === null ?
|
|
587
|
+
var Je;
|
|
588
|
+
T === null ? Je = "null" : Le(T) ? Je = "array" : T !== void 0 && T.$$typeof === t ? (Je = "<" + (G(T.type) || "Unknown") + " />", Ee = " Did you accidentally export a JSX literal instead of a component?") : Je = typeof T, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", Je, Ee);
|
|
589
589
|
}
|
|
590
|
-
var tt = Cs(T, U, oe,
|
|
590
|
+
var tt = Cs(T, U, oe, Me, Be);
|
|
591
591
|
if (tt == null)
|
|
592
592
|
return tt;
|
|
593
593
|
if (Ie) {
|
|
594
594
|
var Et = U.children;
|
|
595
595
|
if (Et !== void 0)
|
|
596
|
-
if (
|
|
596
|
+
if (xe)
|
|
597
597
|
if (Le(Et)) {
|
|
598
598
|
for (var Ln = 0; Ln < Et.length; Ln++)
|
|
599
599
|
Da(Et[Ln], T);
|
|
@@ -1855,20 +1855,20 @@ const Hc = (e) => {
|
|
|
1855
1855
|
const N = W && W.unsubscribe && (() => {
|
|
1856
1856
|
W.unsubscribe();
|
|
1857
1857
|
});
|
|
1858
|
-
let
|
|
1858
|
+
let H;
|
|
1859
1859
|
try {
|
|
1860
|
-
if (C && u && g !== "get" && g !== "head" && (
|
|
1860
|
+
if (C && u && g !== "get" && g !== "head" && (H = await x(I, b)) !== 0) {
|
|
1861
1861
|
let J = new n(v, {
|
|
1862
1862
|
method: "POST",
|
|
1863
1863
|
body: b,
|
|
1864
1864
|
duplex: "half"
|
|
1865
1865
|
}), te;
|
|
1866
1866
|
if (j.isFormData(b) && (te = J.headers.get("content-type")) && I.setContentType(te), J.body) {
|
|
1867
|
-
const [
|
|
1868
|
-
|
|
1867
|
+
const [B, Z] = Ja(
|
|
1868
|
+
H,
|
|
1869
1869
|
yo(Za(C))
|
|
1870
1870
|
);
|
|
1871
|
-
b = el(J.body, tl,
|
|
1871
|
+
b = el(J.body, tl, B, Z);
|
|
1872
1872
|
}
|
|
1873
1873
|
}
|
|
1874
1874
|
j.isString(A) || (A = A ? "include" : "omit");
|
|
@@ -1886,25 +1886,25 @@ const Hc = (e) => {
|
|
|
1886
1886
|
const k = d && (E === "stream" || E === "response");
|
|
1887
1887
|
if (d && (S || k && N)) {
|
|
1888
1888
|
const J = {};
|
|
1889
|
-
["status", "statusText", "headers"].forEach((
|
|
1890
|
-
J[
|
|
1889
|
+
["status", "statusText", "headers"].forEach((fe) => {
|
|
1890
|
+
J[fe] = z[fe];
|
|
1891
1891
|
});
|
|
1892
|
-
const te = j.toFiniteNumber(z.headers.get("content-length")), [
|
|
1892
|
+
const te = j.toFiniteNumber(z.headers.get("content-length")), [B, Z] = S && Ja(
|
|
1893
1893
|
te,
|
|
1894
1894
|
yo(Za(S), !0)
|
|
1895
1895
|
) || [];
|
|
1896
1896
|
z = new r(
|
|
1897
|
-
el(z.body, tl,
|
|
1897
|
+
el(z.body, tl, B, () => {
|
|
1898
1898
|
Z && Z(), N && N();
|
|
1899
1899
|
}),
|
|
1900
1900
|
J
|
|
1901
1901
|
);
|
|
1902
1902
|
}
|
|
1903
1903
|
E = E || "text";
|
|
1904
|
-
let
|
|
1904
|
+
let $ = await h[j.findKey(h, E) || "text"](z, m);
|
|
1905
1905
|
return !k && N && N(), await new Promise((J, te) => {
|
|
1906
1906
|
Fc(J, te, {
|
|
1907
|
-
data:
|
|
1907
|
+
data: $,
|
|
1908
1908
|
headers: gt.from(z.headers),
|
|
1909
1909
|
status: z.status,
|
|
1910
1910
|
statusText: z.statusText,
|
|
@@ -2523,14 +2523,14 @@ class Hg {
|
|
|
2523
2523
|
}
|
|
2524
2524
|
const En = new Hg();
|
|
2525
2525
|
function $g(e = {}) {
|
|
2526
|
-
const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] =
|
|
2526
|
+
const t = e.baseUrl ?? "/api/chat", n = e.streamPath ?? "/runs/stream", [r, o] = he(e.token ?? null), s = wt(e.headers ?? {}), [i, a] = he(!1), [c, u] = he(null), [d, h] = he(""), [p, x] = he(null), m = wt(null), v = Ze((y) => {
|
|
2527
2527
|
o(y);
|
|
2528
|
-
}, []), g =
|
|
2528
|
+
}, []), g = Ze(() => {
|
|
2529
2529
|
var y;
|
|
2530
2530
|
(y = m.current) == null || y.abort(), m.current = null, a(!1);
|
|
2531
|
-
}, []), b =
|
|
2531
|
+
}, []), b = Ze(() => {
|
|
2532
2532
|
h(""), x(null), u(null);
|
|
2533
|
-
}, []), w =
|
|
2533
|
+
}, []), w = Ze(
|
|
2534
2534
|
(y, R, S) => {
|
|
2535
2535
|
m.current && (m.current.abort(), m.current = null), a(!0), u(null), e.autoAppendAssistant !== !1 && h("");
|
|
2536
2536
|
const C = new AbortController();
|
|
@@ -2544,10 +2544,10 @@ function $g(e = {}) {
|
|
|
2544
2544
|
return !1;
|
|
2545
2545
|
}
|
|
2546
2546
|
})(), I = (N) => {
|
|
2547
|
-
var
|
|
2547
|
+
var H;
|
|
2548
2548
|
try {
|
|
2549
2549
|
const D = JSON.parse(JSON.stringify(N));
|
|
2550
|
-
return (
|
|
2550
|
+
return (H = D == null ? void 0 : D.payload) != null && H.files_info && Array.isArray(D.payload.files_info) && (D.payload.files_info = D.payload.files_info.map((q) => ({
|
|
2551
2551
|
...q,
|
|
2552
2552
|
data: q != null && q.data ? `<base64 ${String(q.data).length} chars>` : q == null ? void 0 : q.data
|
|
2553
2553
|
}))), D;
|
|
@@ -2561,20 +2561,20 @@ function $g(e = {}) {
|
|
|
2561
2561
|
if (r)
|
|
2562
2562
|
N = { Authorization: `Bearer ${r}` };
|
|
2563
2563
|
else if (typeof window < "u") {
|
|
2564
|
-
const
|
|
2564
|
+
const $ = window.__AUTH_TOKEN__, J = ((A = window.localStorage) == null ? void 0 : A.getItem("authToken")) || null;
|
|
2565
2565
|
let te = null;
|
|
2566
2566
|
try {
|
|
2567
2567
|
const Z = (P = window.localStorage) == null ? void 0 : P.getItem("chat-settings");
|
|
2568
2568
|
Z && (te = ((O = JSON.parse(Z)) == null ? void 0 : O.apiKey) || null);
|
|
2569
2569
|
} catch {
|
|
2570
2570
|
}
|
|
2571
|
-
const
|
|
2572
|
-
|
|
2571
|
+
const B = $ || J || te || null;
|
|
2572
|
+
B && (N = { Authorization: `Bearer ${B}` });
|
|
2573
2573
|
}
|
|
2574
2574
|
} catch {
|
|
2575
2575
|
}
|
|
2576
2576
|
E && console.debug("[use-chat] POST", t + n, I(y));
|
|
2577
|
-
const
|
|
2577
|
+
const H = await fetch(t + n, {
|
|
2578
2578
|
method: "POST",
|
|
2579
2579
|
headers: {
|
|
2580
2580
|
"Content-Type": "application/json",
|
|
@@ -2585,25 +2585,25 @@ function $g(e = {}) {
|
|
|
2585
2585
|
body: JSON.stringify(y),
|
|
2586
2586
|
signal: C.signal
|
|
2587
2587
|
});
|
|
2588
|
-
if (!
|
|
2589
|
-
const k = await
|
|
2590
|
-
throw E && console.debug("[use-chat] non-OK response",
|
|
2588
|
+
if (!H.ok || !H.body) {
|
|
2589
|
+
const k = await H.text().catch(() => "");
|
|
2590
|
+
throw E && console.debug("[use-chat] non-OK response", H.status, k == null ? void 0 : k.slice(0, 500)), new Error(`stream ${H.status}${k ? ": " + k : ""}`);
|
|
2591
2591
|
}
|
|
2592
2592
|
try {
|
|
2593
|
-
const k =
|
|
2593
|
+
const k = H.headers.get("X-Thread-Id") || H.headers.get("x-thread-id"), $ = H.headers.get("X-Thread-Created") || H.headers.get("x-thread-created"), J = k ?? null, te = String($ ?? "").toLowerCase() === "true";
|
|
2594
2594
|
try {
|
|
2595
2595
|
(W = S == null ? void 0 : S.onOpen) == null || W.call(S, { threadId: J, created: te });
|
|
2596
|
-
} catch (
|
|
2597
|
-
E && console.debug("[use-chat] onOpen handler threw:",
|
|
2596
|
+
} catch (B) {
|
|
2597
|
+
E && console.debug("[use-chat] onOpen handler threw:", B);
|
|
2598
2598
|
}
|
|
2599
2599
|
} catch (k) {
|
|
2600
2600
|
E && console.debug("[use-chat] failed to read headers:", k);
|
|
2601
2601
|
}
|
|
2602
|
-
const D =
|
|
2602
|
+
const D = H.body.getReader(), q = new TextDecoder();
|
|
2603
2603
|
let z = "";
|
|
2604
2604
|
for (; ; ) {
|
|
2605
|
-
const { value: k, done:
|
|
2606
|
-
if (
|
|
2605
|
+
const { value: k, done: $ } = await D.read();
|
|
2606
|
+
if ($) break;
|
|
2607
2607
|
z += q.decode(k, { stream: !0 });
|
|
2608
2608
|
let J;
|
|
2609
2609
|
for (; (J = z.indexOf(`
|
|
@@ -2611,28 +2611,28 @@ function $g(e = {}) {
|
|
|
2611
2611
|
`)) >= 0; ) {
|
|
2612
2612
|
const te = z.slice(0, J);
|
|
2613
2613
|
z = z.slice(J + 2);
|
|
2614
|
-
const
|
|
2615
|
-
if (!
|
|
2614
|
+
const B = Ug(te);
|
|
2615
|
+
if (!B) continue;
|
|
2616
2616
|
let Z;
|
|
2617
2617
|
try {
|
|
2618
|
-
Z = JSON.parse(
|
|
2618
|
+
Z = JSON.parse(B);
|
|
2619
2619
|
} catch {
|
|
2620
|
-
E && console.debug("[use-chat] skip malformed SSE data:",
|
|
2620
|
+
E && console.debug("[use-chat] skip malformed SSE data:", B == null ? void 0 : B.slice(0, 200));
|
|
2621
2621
|
continue;
|
|
2622
2622
|
}
|
|
2623
|
-
const
|
|
2624
|
-
if (E && console.debug("[use-chat] event:",
|
|
2625
|
-
e.autoAppendAssistant !== !1 && h((
|
|
2626
|
-
else if (
|
|
2627
|
-
const
|
|
2628
|
-
|
|
2629
|
-
} else
|
|
2623
|
+
const fe = zg(Z) ? Z.data : Z;
|
|
2624
|
+
if (E && console.debug("[use-chat] event:", fe == null ? void 0 : fe.type, fe), R == null || R(fe), fe.type === "token")
|
|
2625
|
+
e.autoAppendAssistant !== !1 && h((ve) => ve + fe.content);
|
|
2626
|
+
else if (fe.type === "message_delta") {
|
|
2627
|
+
const ve = fe.delta.filter((X) => X.type === "text").map((X) => X.text).join("");
|
|
2628
|
+
ve && e.autoAppendAssistant !== !1 && h((X) => X + ve);
|
|
2629
|
+
} else fe.type === "checkpoint" ? x(fe.checkpointId) : fe.type === "error" && u(fe.message);
|
|
2630
2630
|
}
|
|
2631
2631
|
}
|
|
2632
2632
|
} catch (N) {
|
|
2633
2633
|
if ((N == null ? void 0 : N.name) === "AbortError") return;
|
|
2634
|
-
const
|
|
2635
|
-
E && console.debug("[use-chat] error:",
|
|
2634
|
+
const H = (N == null ? void 0 : N.message) || String(N);
|
|
2635
|
+
E && console.debug("[use-chat] error:", H), u(H), (G = S == null ? void 0 : S.onError) == null || G.call(S, H);
|
|
2636
2636
|
} finally {
|
|
2637
2637
|
a(!1), m.current = null;
|
|
2638
2638
|
}
|
|
@@ -2640,7 +2640,7 @@ function $g(e = {}) {
|
|
|
2640
2640
|
},
|
|
2641
2641
|
[t, r, e.autoAppendAssistant]
|
|
2642
2642
|
);
|
|
2643
|
-
return
|
|
2643
|
+
return Xe(() => () => {
|
|
2644
2644
|
var y;
|
|
2645
2645
|
return (y = m.current) == null ? void 0 : y.abort();
|
|
2646
2646
|
}, []), {
|
|
@@ -2780,7 +2780,7 @@ function Vg(e, t) {
|
|
|
2780
2780
|
}
|
|
2781
2781
|
}
|
|
2782
2782
|
function Gg(e = []) {
|
|
2783
|
-
const [t, n] = kp(Vg, { ...Wg, messages: e }), r =
|
|
2783
|
+
const [t, n] = kp(Vg, { ...Wg, messages: e }), r = Ze((s) => {
|
|
2784
2784
|
n({ type: "event", payload: { ev: s } });
|
|
2785
2785
|
}, []), o = bn(() => ({
|
|
2786
2786
|
reset: (s) => n({ type: "reset", payload: { messages: s } }),
|
|
@@ -2926,7 +2926,7 @@ async function ev(e, t = [], n, r, o, s) {
|
|
|
2926
2926
|
const Gc = mc(null);
|
|
2927
2927
|
function so({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialThreadId: o = null, historyPageSize: s, autoLoadInitial: i = !0, enableFileAgentRouting: a = !1, fileAgentId: c = "invoice_reader" }) {
|
|
2928
2928
|
const u = En;
|
|
2929
|
-
|
|
2929
|
+
Xe(() => {
|
|
2930
2930
|
t && u.updateConfig({
|
|
2931
2931
|
baseUrl: t.baseUrl,
|
|
2932
2932
|
authToken: t.apiKey
|
|
@@ -2940,151 +2940,151 @@ function so({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
|
|
|
2940
2940
|
// any extra headers caller wants
|
|
2941
2941
|
// Ensure the path matches the chat endpoint
|
|
2942
2942
|
streamPath: "/chat/runs/stream"
|
|
2943
|
-
}), [v, g] =
|
|
2944
|
-
|
|
2943
|
+
}), [v, g] = he(() => typeof u.getAuthToken == "function" ? u.getAuthToken() : null);
|
|
2944
|
+
Xe(() => {
|
|
2945
2945
|
m(typeof u.getAuthToken == "function" ? u.getAuthToken() : null);
|
|
2946
|
-
const
|
|
2946
|
+
const F = u.onTokenChange((V) => {
|
|
2947
2947
|
g(V), m(V);
|
|
2948
2948
|
});
|
|
2949
2949
|
return () => {
|
|
2950
|
-
|
|
2950
|
+
F();
|
|
2951
2951
|
};
|
|
2952
2952
|
}, [u, m]);
|
|
2953
|
-
const b =
|
|
2954
|
-
u.setAuthToken(
|
|
2955
|
-
}, [u]), { state: w, seed: y, prepend: R, pushUser: S, onEvent: C, reset: E } = Gg(), I = s && s > 0 ? s : 6, [A, P] =
|
|
2956
|
-
(
|
|
2957
|
-
const de = Array.isArray(
|
|
2958
|
-
V === "replace" ? y(de) : V === "prepend" && de.length && R(de), N((
|
|
2953
|
+
const b = Ze((F) => {
|
|
2954
|
+
u.setAuthToken(F);
|
|
2955
|
+
}, [u]), { state: w, seed: y, prepend: R, pushUser: S, onEvent: C, reset: E } = Gg(), I = s && s > 0 ? s : 6, [A, P] = he(!1), [O, W] = he(!1), [G, N] = he(null), [H, D] = he(void 0), q = Ze(
|
|
2956
|
+
(F, V) => {
|
|
2957
|
+
const de = Array.isArray(F == null ? void 0 : F.messages) ? F.messages : [];
|
|
2958
|
+
V === "replace" ? y(de) : V === "prepend" && de.length && R(de), N((F == null ? void 0 : F.nextCursor) ?? null), P(!!(F != null && F.hasMore)), D((Le) => (F == null ? void 0 : F.checkpointId) ?? Le ?? void 0);
|
|
2959
2959
|
},
|
|
2960
2960
|
[y, R]
|
|
2961
|
-
), [z, k] =
|
|
2962
|
-
const
|
|
2963
|
-
k(
|
|
2964
|
-
}, [u]), [
|
|
2965
|
-
async (
|
|
2966
|
-
const V = (
|
|
2961
|
+
), [z, k] = he([]), [$, J] = he(null), te = Ze(async () => {
|
|
2962
|
+
const F = await u.listThreads();
|
|
2963
|
+
k(F);
|
|
2964
|
+
}, [u]), [B, Z] = he(!1), fe = Ze(
|
|
2965
|
+
async (F) => {
|
|
2966
|
+
const V = (F == null ? void 0 : F.maxAttempts) ?? 5, de = (F == null ? void 0 : F.baseDelayMs) ?? 500, Le = (F == null ? void 0 : F.timeoutMs) ?? 2e3;
|
|
2967
2967
|
if (!u.baseUrl) return !1;
|
|
2968
|
-
const
|
|
2968
|
+
const ke = u.baseUrl.replace(/\/+$/, ""), Pe = [
|
|
2969
2969
|
"/health",
|
|
2970
2970
|
"/api/health",
|
|
2971
2971
|
"/",
|
|
2972
2972
|
// root
|
|
2973
2973
|
"/api/v2/health",
|
|
2974
2974
|
"/api/v2/chat/health"
|
|
2975
|
-
],
|
|
2975
|
+
], _e = async (Ke) => {
|
|
2976
2976
|
try {
|
|
2977
|
-
const at = new AbortController(),
|
|
2978
|
-
return clearTimeout(
|
|
2977
|
+
const at = new AbortController(), qe = setTimeout(() => at.abort(), Le), lt = await fetch(Ke, { method: "GET", signal: at.signal });
|
|
2978
|
+
return clearTimeout(qe), lt.ok;
|
|
2979
2979
|
} catch {
|
|
2980
2980
|
return !1;
|
|
2981
2981
|
}
|
|
2982
2982
|
}, ot = async (Ke) => {
|
|
2983
2983
|
try {
|
|
2984
|
-
const at = new AbortController(),
|
|
2985
|
-
return clearTimeout(
|
|
2984
|
+
const at = new AbortController(), qe = setTimeout(() => at.abort(), Le), lt = await fetch(Ke, { method: "HEAD", signal: at.signal });
|
|
2985
|
+
return clearTimeout(qe), lt.ok;
|
|
2986
2986
|
} catch {
|
|
2987
2987
|
return !1;
|
|
2988
2988
|
}
|
|
2989
2989
|
};
|
|
2990
2990
|
for (let Ke = 0; Ke < V; Ke++) {
|
|
2991
2991
|
console.debug(`[ChatProvider] health-check attempt ${Ke + 1}/${V}`);
|
|
2992
|
-
for (const
|
|
2993
|
-
let lt =
|
|
2994
|
-
|
|
2995
|
-
const _t = lt === "/" ?
|
|
2996
|
-
if (console.debug(`[ChatProvider] checking ${_t}`), await
|
|
2992
|
+
for (const qe of Pe) {
|
|
2993
|
+
let lt = qe;
|
|
2994
|
+
ke.endsWith("/api") && qe.startsWith("/api") && (lt = qe.replace(/^\/api/, "") || "/");
|
|
2995
|
+
const _t = lt === "/" ? ke + "/" : ke + lt;
|
|
2996
|
+
if (console.debug(`[ChatProvider] checking ${_t}`), await _e(_t) || qe === "/" && await ot(ke + "/"))
|
|
2997
2997
|
return Z(!0), !0;
|
|
2998
2998
|
}
|
|
2999
2999
|
const at = de * Math.pow(2, Ke);
|
|
3000
|
-
await new Promise((
|
|
3000
|
+
await new Promise((qe) => setTimeout(qe, at));
|
|
3001
3001
|
}
|
|
3002
3002
|
return Z(!1), !1;
|
|
3003
3003
|
},
|
|
3004
3004
|
[u.baseUrl]
|
|
3005
3005
|
);
|
|
3006
|
-
|
|
3007
|
-
let
|
|
3006
|
+
Xe(() => {
|
|
3007
|
+
let F = !0;
|
|
3008
3008
|
if (!u.baseUrl) {
|
|
3009
3009
|
console.debug("[ChatProvider] skipping initial refreshThreads: api.baseUrl not configured");
|
|
3010
3010
|
return;
|
|
3011
3011
|
}
|
|
3012
3012
|
return (async () => {
|
|
3013
3013
|
try {
|
|
3014
|
-
const V = await
|
|
3015
|
-
if (
|
|
3014
|
+
const V = await fe();
|
|
3015
|
+
if (!F) return;
|
|
3016
3016
|
V ? te().catch(() => {
|
|
3017
3017
|
}) : console.warn("[ChatProvider] backend health-check failed — skipping initial loads");
|
|
3018
3018
|
} catch {
|
|
3019
3019
|
}
|
|
3020
3020
|
})(), () => {
|
|
3021
|
-
|
|
3021
|
+
F = !1;
|
|
3022
3022
|
};
|
|
3023
|
-
}, [te, u.baseUrl,
|
|
3024
|
-
r == null || r(
|
|
3025
|
-
}, [
|
|
3026
|
-
const
|
|
3027
|
-
|
|
3023
|
+
}, [te, u.baseUrl, fe]), Xe(() => {
|
|
3024
|
+
r == null || r($);
|
|
3025
|
+
}, [$, r]);
|
|
3026
|
+
const ve = wt(null);
|
|
3027
|
+
Xe(() => {
|
|
3028
3028
|
if (o && i) {
|
|
3029
3029
|
if (!u.baseUrl) {
|
|
3030
3030
|
console.debug("[ChatProvider] skipping initial load: api.baseUrl not configured");
|
|
3031
3031
|
return;
|
|
3032
3032
|
}
|
|
3033
|
-
if (!
|
|
3033
|
+
if (!B) {
|
|
3034
3034
|
console.debug("[ChatProvider] deferring initial load until backend health-check passes");
|
|
3035
3035
|
return;
|
|
3036
3036
|
}
|
|
3037
|
-
|
|
3037
|
+
ve.current !== o && (ve.current = o, _(o).catch(() => {
|
|
3038
3038
|
}));
|
|
3039
3039
|
}
|
|
3040
|
-
}, [o, i, u.baseUrl,
|
|
3041
|
-
const X = wt(null), _ =
|
|
3042
|
-
async (
|
|
3040
|
+
}, [o, i, u.baseUrl, B]);
|
|
3041
|
+
const X = wt(null), _ = Ze(
|
|
3042
|
+
async (F, V, de) => {
|
|
3043
3043
|
if (!u.baseUrl) {
|
|
3044
3044
|
console.debug("[ChatProvider] skipping loadThread: api.baseUrl not configured");
|
|
3045
3045
|
return;
|
|
3046
3046
|
}
|
|
3047
|
-
if (X.current !==
|
|
3048
|
-
X.current =
|
|
3047
|
+
if (X.current !== F) {
|
|
3048
|
+
X.current = F;
|
|
3049
3049
|
try {
|
|
3050
3050
|
P(!1), N(null), D(void 0);
|
|
3051
3051
|
const Le = await u.getMessages({
|
|
3052
|
-
threadId:
|
|
3052
|
+
threadId: F,
|
|
3053
3053
|
checkpointId: V,
|
|
3054
3054
|
checkpointNs: de,
|
|
3055
3055
|
limit: I
|
|
3056
3056
|
});
|
|
3057
|
-
J(
|
|
3057
|
+
J(F), q(Le, "replace");
|
|
3058
3058
|
} finally {
|
|
3059
3059
|
X.current = null;
|
|
3060
3060
|
}
|
|
3061
3061
|
}
|
|
3062
3062
|
},
|
|
3063
3063
|
[u, q]
|
|
3064
|
-
), ee =
|
|
3065
|
-
const V = await u.listCheckpoints(
|
|
3066
|
-
return Jg(V,
|
|
3067
|
-
}, [u]), re =
|
|
3068
|
-
if (
|
|
3064
|
+
), ee = Ze(async (F) => {
|
|
3065
|
+
const V = await u.listCheckpoints(F);
|
|
3066
|
+
return Jg(V, F);
|
|
3067
|
+
}, [u]), re = Ze(async (F) => {
|
|
3068
|
+
if (!$) throw new Error("No active thread");
|
|
3069
3069
|
P(!1), N(null), D(void 0);
|
|
3070
3070
|
const V = await u.getMessages({
|
|
3071
|
-
threadId:
|
|
3072
|
-
checkpointId:
|
|
3071
|
+
threadId: $,
|
|
3072
|
+
checkpointId: F,
|
|
3073
3073
|
limit: I
|
|
3074
3074
|
});
|
|
3075
3075
|
q(V, "replace");
|
|
3076
|
-
}, [u,
|
|
3077
|
-
if (
|
|
3078
|
-
await _(
|
|
3079
|
-
}, [
|
|
3080
|
-
|
|
3081
|
-
const
|
|
3082
|
-
if (ae.current = d,
|
|
3076
|
+
}, [u, $, q, I]), le = Ze(async () => {
|
|
3077
|
+
if (!$) throw new Error("No active thread");
|
|
3078
|
+
await _($);
|
|
3079
|
+
}, [$, _]), ae = wt(!1);
|
|
3080
|
+
Xe(() => {
|
|
3081
|
+
const F = ae.current;
|
|
3082
|
+
if (ae.current = d, F && !d && $) {
|
|
3083
3083
|
const V = w.lastCheckpointId ?? void 0;
|
|
3084
3084
|
(async () => {
|
|
3085
3085
|
try {
|
|
3086
3086
|
const de = await u.getMessages({
|
|
3087
|
-
threadId:
|
|
3087
|
+
threadId: $,
|
|
3088
3088
|
checkpointId: V,
|
|
3089
3089
|
limit: I
|
|
3090
3090
|
});
|
|
@@ -3097,43 +3097,43 @@ function so({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
|
|
|
3097
3097
|
}
|
|
3098
3098
|
})();
|
|
3099
3099
|
}
|
|
3100
|
-
}, [d,
|
|
3101
|
-
const
|
|
3102
|
-
const V = await u.createThread(
|
|
3100
|
+
}, [d, $, w.lastCheckpointId, u, q, te]);
|
|
3101
|
+
const Oe = Ze(async (F) => {
|
|
3102
|
+
const V = await u.createThread(F);
|
|
3103
3103
|
return await te(), await _(V.threadId), V.threadId;
|
|
3104
|
-
}, [u, te, _]), $e =
|
|
3105
|
-
await u.deleteThread(
|
|
3106
|
-
}, [u, te,
|
|
3107
|
-
await u.updateThread(
|
|
3108
|
-
}, [u, te]), Ve =
|
|
3104
|
+
}, [u, te, _]), $e = Ze(async (F) => {
|
|
3105
|
+
await u.deleteThread(F), await te(), $ === F && (J(null), E([]), P(!1), N(null), D(void 0));
|
|
3106
|
+
}, [u, te, $, E]), ze = Ze(async (F, V) => {
|
|
3107
|
+
await u.updateThread(F, V), await te();
|
|
3108
|
+
}, [u, te]), Ve = Ze(async (F, V) => {
|
|
3109
3109
|
var Mn;
|
|
3110
|
-
const de = (V == null ? void 0 : V.attachments) || [], { contentParts: Le, filesInfo:
|
|
3110
|
+
const de = (V == null ? void 0 : V.attachments) || [], { contentParts: Le, filesInfo: ke } = await ev(
|
|
3111
3111
|
u,
|
|
3112
3112
|
de,
|
|
3113
3113
|
t == null ? void 0 : t.uploadPath,
|
|
3114
3114
|
a,
|
|
3115
3115
|
c,
|
|
3116
|
-
|
|
3117
|
-
),
|
|
3118
|
-
|
|
3119
|
-
for (const Ye of Le)
|
|
3120
|
-
const
|
|
3116
|
+
$
|
|
3117
|
+
), Pe = [];
|
|
3118
|
+
F && Pe.push({ type: "text", text: F });
|
|
3119
|
+
for (const Ye of Le) Pe.push(Ye);
|
|
3120
|
+
const _e = {
|
|
3121
3121
|
id: ((Mn = crypto.randomUUID) == null ? void 0 : Mn.call(crypto)) || `user-${Date.now()}`,
|
|
3122
3122
|
role: "user",
|
|
3123
|
-
content:
|
|
3123
|
+
content: Pe,
|
|
3124
3124
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3125
3125
|
checkpointId: (V == null ? void 0 : V.checkpointId) ?? w.lastCheckpointId ?? void 0
|
|
3126
3126
|
};
|
|
3127
|
-
S(
|
|
3127
|
+
S(_e);
|
|
3128
3128
|
const ot = {
|
|
3129
|
-
...
|
|
3130
|
-
content:
|
|
3131
|
-
}, Ke = { ...(V == null ? void 0 : V.payloadExtras) ?? {} }, at = !!Ke.edit,
|
|
3132
|
-
|
|
3129
|
+
..._e,
|
|
3130
|
+
content: _e.content.filter((Ye) => Ye.type === "text" || Ye.type === "image_url")
|
|
3131
|
+
}, Ke = { ...(V == null ? void 0 : V.payloadExtras) ?? {} }, at = !!Ke.edit, qe = Ke.originalMessageId, lt = typeof qe == "string" ? qe : void 0, _t = de && de.length > 0, vn = {
|
|
3132
|
+
...$ ? { threadId: $ } : {},
|
|
3133
3133
|
payload: {
|
|
3134
3134
|
messages: [ot],
|
|
3135
|
-
attachments:
|
|
3136
|
-
files_info:
|
|
3135
|
+
attachments: _e.content.filter((Ye) => Ye.type === "file").map((Ye) => ({ type: "file", url: Ye.url, mimeType: Ye.mimeType, name: Ye.name, size: Ye.size })),
|
|
3136
|
+
files_info: ke,
|
|
3137
3137
|
...a && _t && c ? { active_agent: c } : {},
|
|
3138
3138
|
...Ke
|
|
3139
3139
|
},
|
|
@@ -3150,23 +3150,23 @@ function so({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
|
|
|
3150
3150
|
{
|
|
3151
3151
|
onError: (Ye) => console.warn("stream error", Ye),
|
|
3152
3152
|
onOpen: ({ threadId: Ye, created: ar }) => {
|
|
3153
|
-
|
|
3153
|
+
!$ && Ye && (J(Ye), ar && te().catch(() => {
|
|
3154
3154
|
}));
|
|
3155
3155
|
}
|
|
3156
3156
|
}
|
|
3157
3157
|
);
|
|
3158
|
-
}, [
|
|
3159
|
-
async (
|
|
3160
|
-
if (
|
|
3158
|
+
}, [$, S, p, C, w.lastCheckpointId, u, t == null ? void 0 : t.uploadPath, te, J, a, c]), Fe = Ze(
|
|
3159
|
+
async (F) => {
|
|
3160
|
+
if (!$) throw new Error("No active thread");
|
|
3161
3161
|
if (O || !A) return;
|
|
3162
3162
|
const V = G;
|
|
3163
3163
|
if (V) {
|
|
3164
3164
|
W(!0);
|
|
3165
3165
|
try {
|
|
3166
3166
|
const de = await u.getMessages({
|
|
3167
|
-
threadId:
|
|
3168
|
-
checkpointId:
|
|
3169
|
-
limit: (
|
|
3167
|
+
threadId: $,
|
|
3168
|
+
checkpointId: H,
|
|
3169
|
+
limit: (F == null ? void 0 : F.limit) ?? I,
|
|
3170
3170
|
beforeId: V
|
|
3171
3171
|
});
|
|
3172
3172
|
q(de, "prepend");
|
|
@@ -3175,14 +3175,14 @@ function so({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
|
|
|
3175
3175
|
}
|
|
3176
3176
|
}
|
|
3177
3177
|
},
|
|
3178
|
-
[u, H,
|
|
3178
|
+
[u, $, H, G, A, O, q]
|
|
3179
3179
|
), ue = {
|
|
3180
3180
|
baseUrl: u.baseUrl,
|
|
3181
3181
|
token: v,
|
|
3182
3182
|
setToken: b,
|
|
3183
3183
|
api: u,
|
|
3184
3184
|
threads: z,
|
|
3185
|
-
currentThreadId:
|
|
3185
|
+
currentThreadId: $,
|
|
3186
3186
|
setCurrentThreadId: J,
|
|
3187
3187
|
messages: w.messages,
|
|
3188
3188
|
isStreaming: d,
|
|
@@ -3197,7 +3197,7 @@ function so({ children: e, apiConfig: t, onError: n, onThreadChange: r, initialT
|
|
|
3197
3197
|
navigateToCheckpoint: re,
|
|
3198
3198
|
returnToLatest: le,
|
|
3199
3199
|
refreshThreads: te,
|
|
3200
|
-
createThread:
|
|
3200
|
+
createThread: Oe,
|
|
3201
3201
|
deleteThread: $e,
|
|
3202
3202
|
renameThread: ze,
|
|
3203
3203
|
loadThread: _,
|
|
@@ -3246,7 +3246,7 @@ function ov(e, t) {
|
|
|
3246
3246
|
function We(...e) {
|
|
3247
3247
|
return e;
|
|
3248
3248
|
}
|
|
3249
|
-
function
|
|
3249
|
+
function De(e, t) {
|
|
3250
3250
|
return e(fn, t);
|
|
3251
3251
|
}
|
|
3252
3252
|
function ye(e, t) {
|
|
@@ -3255,11 +3255,11 @@ function ye(e, t) {
|
|
|
3255
3255
|
function Bi(e) {
|
|
3256
3256
|
e(tr);
|
|
3257
3257
|
}
|
|
3258
|
-
function
|
|
3258
|
+
function Qe(e) {
|
|
3259
3259
|
return e(Kc);
|
|
3260
3260
|
}
|
|
3261
3261
|
function ce(e, t) {
|
|
3262
|
-
return
|
|
3262
|
+
return De(e, nv(t, Wo));
|
|
3263
3263
|
}
|
|
3264
3264
|
function Lt(e, t) {
|
|
3265
3265
|
const n = e(fn, (r) => {
|
|
@@ -3305,7 +3305,7 @@ function L(e, ...t) {
|
|
|
3305
3305
|
Bi(e);
|
|
3306
3306
|
return;
|
|
3307
3307
|
case fn:
|
|
3308
|
-
return
|
|
3308
|
+
return De(e, n(o));
|
|
3309
3309
|
}
|
|
3310
3310
|
};
|
|
3311
3311
|
}
|
|
@@ -3333,7 +3333,7 @@ function Se(...e) {
|
|
|
3333
3333
|
const o = Math.pow(2, e.length) - 1;
|
|
3334
3334
|
return e.forEach((s, i) => {
|
|
3335
3335
|
const a = Math.pow(2, i);
|
|
3336
|
-
|
|
3336
|
+
De(s, (c) => {
|
|
3337
3337
|
const u = n;
|
|
3338
3338
|
n = n | a, t[i] = c, u !== o && n === o && r && (r(), r = null);
|
|
3339
3339
|
});
|
|
@@ -3353,7 +3353,7 @@ function iv(e) {
|
|
|
3353
3353
|
return function(o, s) {
|
|
3354
3354
|
switch (o) {
|
|
3355
3355
|
case fn:
|
|
3356
|
-
return s ? n === s ? void 0 : (r(), n = s, t =
|
|
3356
|
+
return s ? n === s ? void 0 : (r(), n = s, t = De(e, s), t) : (r(), nr);
|
|
3357
3357
|
case tr:
|
|
3358
3358
|
r(), n = null;
|
|
3359
3359
|
return;
|
|
@@ -3428,7 +3428,7 @@ function nt(...e) {
|
|
|
3428
3428
|
const o = Math.pow(2, e.length) - 1;
|
|
3429
3429
|
return e.forEach((s, i) => {
|
|
3430
3430
|
const a = Math.pow(2, i);
|
|
3431
|
-
|
|
3431
|
+
De(s, (c) => {
|
|
3432
3432
|
n[i] = c, r = r | a, r === o && ye(t, n);
|
|
3433
3433
|
});
|
|
3434
3434
|
}), function(s, i) {
|
|
@@ -3438,7 +3438,7 @@ function nt(...e) {
|
|
|
3438
3438
|
return;
|
|
3439
3439
|
}
|
|
3440
3440
|
case fn:
|
|
3441
|
-
return r === o && i(n),
|
|
3441
|
+
return r === o && i(n), De(t, i);
|
|
3442
3442
|
}
|
|
3443
3443
|
};
|
|
3444
3444
|
}
|
|
@@ -3451,7 +3451,7 @@ function si(...e) {
|
|
|
3451
3451
|
case tr:
|
|
3452
3452
|
return;
|
|
3453
3453
|
case fn:
|
|
3454
|
-
return rv(...e.map((r) =>
|
|
3454
|
+
return rv(...e.map((r) => De(r, n)));
|
|
3455
3455
|
}
|
|
3456
3456
|
};
|
|
3457
3457
|
}
|
|
@@ -3470,7 +3470,7 @@ const cv = {
|
|
|
3470
3470
|
return {
|
|
3471
3471
|
log: K((t, n, r = 1) => {
|
|
3472
3472
|
var o;
|
|
3473
|
-
const s = (o = uv().VIRTUOSO_LOG_LEVEL) != null ? o :
|
|
3473
|
+
const s = (o = uv().VIRTUOSO_LOG_LEVEL) != null ? o : Qe(e);
|
|
3474
3474
|
r >= s && console[cv[r]](
|
|
3475
3475
|
"%creact-virtuoso: %c%s %o",
|
|
3476
3476
|
"color: #0253b3; font-weight: bold",
|
|
@@ -3994,7 +3994,7 @@ const Tv = {
|
|
|
3994
3994
|
ce(
|
|
3995
3995
|
L(
|
|
3996
3996
|
d,
|
|
3997
|
-
me((S) => S !== void 0 && He(
|
|
3997
|
+
me((S) => S !== void 0 && He(Qe(v).sizeTree)),
|
|
3998
3998
|
se((S) => [{ endIndex: 0, size: S, startIndex: 0 }])
|
|
3999
3999
|
),
|
|
4000
4000
|
n
|
|
@@ -4013,7 +4013,7 @@ const Tv = {
|
|
|
4013
4013
|
se((S) => S.changed)
|
|
4014
4014
|
)
|
|
4015
4015
|
);
|
|
4016
|
-
|
|
4016
|
+
De(
|
|
4017
4017
|
L(
|
|
4018
4018
|
a,
|
|
4019
4019
|
Yt(
|
|
@@ -4023,15 +4023,15 @@ const Tv = {
|
|
|
4023
4023
|
se((S) => S.diff)
|
|
4024
4024
|
),
|
|
4025
4025
|
(S) => {
|
|
4026
|
-
const { groupIndices: C } =
|
|
4026
|
+
const { groupIndices: C } = Qe(v);
|
|
4027
4027
|
if (S > 0)
|
|
4028
4028
|
ye(t, !0), ye(s, S + xl(S, C));
|
|
4029
4029
|
else if (S < 0) {
|
|
4030
|
-
const E =
|
|
4030
|
+
const E = Qe(g);
|
|
4031
4031
|
E.length > 0 && (S -= xl(-S, E)), ye(i, S);
|
|
4032
4032
|
}
|
|
4033
4033
|
}
|
|
4034
|
-
),
|
|
4034
|
+
), De(L(a, Se(e)), ([S, C]) => {
|
|
4035
4035
|
S < 0 && C(
|
|
4036
4036
|
"`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",
|
|
4037
4037
|
{ firstItemIndex: a },
|
|
@@ -4049,30 +4049,30 @@ const Tv = {
|
|
|
4049
4049
|
const P = Sr(C.sizeTree, 0);
|
|
4050
4050
|
let O = 0, W = 0;
|
|
4051
4051
|
for (; O < S; ) {
|
|
4052
|
-
const N = C.groupIndices[W],
|
|
4052
|
+
const N = C.groupIndices[W], H = C.groupIndices.length === W + 1 ? 1 / 0 : C.groupIndices[W + 1] - N - 1;
|
|
4053
4053
|
I.push({
|
|
4054
4054
|
endIndex: N,
|
|
4055
4055
|
size: P,
|
|
4056
4056
|
startIndex: N
|
|
4057
4057
|
}), I.push({
|
|
4058
|
-
endIndex: N + 1 +
|
|
4058
|
+
endIndex: N + 1 + H - 1,
|
|
4059
4059
|
size: A,
|
|
4060
4060
|
startIndex: N + 1
|
|
4061
|
-
}), W++, O +=
|
|
4061
|
+
}), W++, O += H + 1;
|
|
4062
4062
|
}
|
|
4063
4063
|
const G = yn(C.sizeTree);
|
|
4064
4064
|
return O !== S && G.shift(), G.reduce(
|
|
4065
|
-
(N, { k:
|
|
4065
|
+
(N, { k: H, v: D }) => {
|
|
4066
4066
|
let q = N.ranges;
|
|
4067
4067
|
return N.prevSize !== 0 && (q = [
|
|
4068
4068
|
...N.ranges,
|
|
4069
4069
|
{
|
|
4070
|
-
endIndex:
|
|
4070
|
+
endIndex: H + S - 1,
|
|
4071
4071
|
size: N.prevSize,
|
|
4072
4072
|
startIndex: N.prevIndex
|
|
4073
4073
|
}
|
|
4074
4074
|
]), {
|
|
4075
|
-
prevIndex:
|
|
4075
|
+
prevIndex: H + S,
|
|
4076
4076
|
prevSize: D,
|
|
4077
4077
|
ranges: q
|
|
4078
4078
|
};
|
|
@@ -4119,14 +4119,14 @@ const Tv = {
|
|
|
4119
4119
|
if (He(C.sizeTree))
|
|
4120
4120
|
return C;
|
|
4121
4121
|
let I = Wn();
|
|
4122
|
-
const A =
|
|
4122
|
+
const A = Qe(g);
|
|
4123
4123
|
let P = 0, O = 0, W = 0;
|
|
4124
4124
|
for (; P < -S; ) {
|
|
4125
4125
|
W = A[O];
|
|
4126
4126
|
const G = A[O + 1] - W - 1;
|
|
4127
4127
|
O++, P += G + 1;
|
|
4128
4128
|
}
|
|
4129
|
-
if (I = yn(C.sizeTree).reduce((G, { k: N, v:
|
|
4129
|
+
if (I = yn(C.sizeTree).reduce((G, { k: N, v: H }) => St(G, Math.max(0, N + S), H), I), P !== -S) {
|
|
4130
4130
|
const G = Sr(C.sizeTree, W);
|
|
4131
4131
|
I = St(I, 0, G);
|
|
4132
4132
|
const N = Bt(C.sizeTree, -S + 1)[1];
|
|
@@ -4218,8 +4218,8 @@ const iu = Ae(
|
|
|
4218
4218
|
Ue()
|
|
4219
4219
|
)
|
|
4220
4220
|
);
|
|
4221
|
-
return
|
|
4222
|
-
r &&
|
|
4221
|
+
return De(t, (r) => {
|
|
4222
|
+
r && Qe(e)("props updated", {}, vt.DEBUG);
|
|
4223
4223
|
}), { didMount: n, propsReady: t };
|
|
4224
4224
|
},
|
|
4225
4225
|
We(hn),
|
|
@@ -4261,24 +4261,24 @@ const Lr = Ae(
|
|
|
4261
4261
|
G,
|
|
4262
4262
|
N
|
|
4263
4263
|
]) => {
|
|
4264
|
-
const
|
|
4265
|
-
let J = Tr(
|
|
4266
|
-
D === "end" ? (J += G + Bt(S.sizeTree,
|
|
4267
|
-
const te = (
|
|
4268
|
-
y(),
|
|
4264
|
+
const H = au(R), { align: D, behavior: q, offset: z } = H, k = E - 1, $ = su(H, S, k);
|
|
4265
|
+
let J = Tr($, S.offsetTree, W) + A;
|
|
4266
|
+
D === "end" ? (J += G + Bt(S.sizeTree, $)[1] - C + N, $ === k && (J += P)) : D === "center" ? J += (G + Bt(S.sizeTree, $)[1] - C + N) / 2 : J -= I, z && (J += z);
|
|
4267
|
+
const te = (B) => {
|
|
4268
|
+
y(), B ? (O("retrying to scroll to", { location: R }, vt.DEBUG), ye(x, R)) : (ye(m, !0), O("list did not change, scroll successful", {}, vt.DEBUG));
|
|
4269
4269
|
};
|
|
4270
4270
|
if (y(), q === "smooth") {
|
|
4271
|
-
let
|
|
4272
|
-
w =
|
|
4273
|
-
|
|
4271
|
+
let B = !1;
|
|
4272
|
+
w = De(t, (Z) => {
|
|
4273
|
+
B = B || Z;
|
|
4274
4274
|
}), g = Lt(d, () => {
|
|
4275
|
-
te(
|
|
4275
|
+
te(B);
|
|
4276
4276
|
});
|
|
4277
4277
|
} else
|
|
4278
4278
|
g = Lt(L(t, Iv(150)), te);
|
|
4279
4279
|
return b = setTimeout(() => {
|
|
4280
4280
|
y();
|
|
4281
|
-
}, 1200), ye(c, !0), O("scrolling from index to", { behavior: q, index:
|
|
4281
|
+
}, 1200), ye(c, !0), O("scrolling from index to", { behavior: q, index: $, top: J }, vt.DEBUG), { behavior: q, top: J };
|
|
4282
4282
|
}
|
|
4283
4283
|
)
|
|
4284
4284
|
),
|
|
@@ -4330,7 +4330,7 @@ const Fr = Ae(
|
|
|
4330
4330
|
Gt(!1)
|
|
4331
4331
|
),
|
|
4332
4332
|
u
|
|
4333
|
-
),
|
|
4333
|
+
), De(
|
|
4334
4334
|
L(
|
|
4335
4335
|
nt(t, i),
|
|
4336
4336
|
Se(a, n, e, u),
|
|
@@ -4461,7 +4461,7 @@ const Er = "up", mr = "down", Nv = "none", jv = {
|
|
|
4461
4461
|
se(({ scrollTop: w }) => w),
|
|
4462
4462
|
Ue(),
|
|
4463
4463
|
Yt(
|
|
4464
|
-
(w, y) =>
|
|
4464
|
+
(w, y) => Qe(x) ? { direction: w.direction, prevScrollTop: y } : { direction: y < w.prevScrollTop ? Er : mr, prevScrollTop: y },
|
|
4465
4465
|
{ direction: mr, prevScrollTop: 0 }
|
|
4466
4466
|
),
|
|
4467
4467
|
se((w) => w.direction)
|
|
@@ -4689,54 +4689,54 @@ const Pn = Ae(
|
|
|
4689
4689
|
W,
|
|
4690
4690
|
G,
|
|
4691
4691
|
N,
|
|
4692
|
-
|
|
4692
|
+
H
|
|
4693
4693
|
]) => {
|
|
4694
|
-
const D = A, { offsetTree: q, sizeTree: z } = D, k =
|
|
4694
|
+
const D = A, { offsetTree: q, sizeTree: z } = D, k = Qe(g);
|
|
4695
4695
|
if (I === 0)
|
|
4696
4696
|
return { ...ks, totalCount: I };
|
|
4697
4697
|
if (C === 0 && E === 0)
|
|
4698
|
-
return k === 0 ? { ...ks, totalCount: I } : cu(k, P, A, G, N,
|
|
4698
|
+
return k === 0 ? { ...ks, totalCount: I } : cu(k, P, A, G, N, H || []);
|
|
4699
4699
|
if (He(z))
|
|
4700
4700
|
return k > 0 ? null : ao(
|
|
4701
|
-
kv(Wi(P, I), D,
|
|
4701
|
+
kv(Wi(P, I), D, H),
|
|
4702
4702
|
[],
|
|
4703
4703
|
I,
|
|
4704
4704
|
N,
|
|
4705
4705
|
D,
|
|
4706
4706
|
G
|
|
4707
4707
|
);
|
|
4708
|
-
const
|
|
4708
|
+
const $ = [];
|
|
4709
4709
|
if (W.length > 0) {
|
|
4710
|
-
const
|
|
4710
|
+
const fe = W[0], ve = W[W.length - 1];
|
|
4711
4711
|
let X = 0;
|
|
4712
|
-
for (const _ of Go(z,
|
|
4713
|
-
const ee = _.value, re = Math.max(_.start,
|
|
4712
|
+
for (const _ of Go(z, fe, ve)) {
|
|
4713
|
+
const ee = _.value, re = Math.max(_.start, fe), le = Math.min(_.end, ve);
|
|
4714
4714
|
for (let ae = re; ae <= le; ae++)
|
|
4715
|
-
|
|
4715
|
+
$.push({ data: H == null ? void 0 : H[ae], index: ae, offset: X, size: ee }), X += ee;
|
|
4716
4716
|
}
|
|
4717
4717
|
}
|
|
4718
4718
|
if (!O)
|
|
4719
|
-
return ao([],
|
|
4719
|
+
return ao([], $, I, N, D, G);
|
|
4720
4720
|
const J = W.length > 0 ? W[W.length - 1] + 1 : 0, te = bv(q, C, E, J);
|
|
4721
4721
|
if (te.length === 0)
|
|
4722
4722
|
return null;
|
|
4723
|
-
const
|
|
4724
|
-
for (const
|
|
4725
|
-
const X =
|
|
4726
|
-
let _ = X.offset, ee =
|
|
4723
|
+
const B = I - 1, Z = Vo([], (fe) => {
|
|
4724
|
+
for (const ve of te) {
|
|
4725
|
+
const X = ve.value;
|
|
4726
|
+
let _ = X.offset, ee = ve.start;
|
|
4727
4727
|
const re = X.size;
|
|
4728
4728
|
if (X.offset < C) {
|
|
4729
4729
|
ee += Math.floor((C - X.offset + N) / (re + N));
|
|
4730
|
-
const ae = ee -
|
|
4730
|
+
const ae = ee - ve.start;
|
|
4731
4731
|
_ += ae * re + ae * N;
|
|
4732
4732
|
}
|
|
4733
4733
|
ee < J && (_ += (J - ee) * re, ee = J);
|
|
4734
|
-
const le = Math.min(
|
|
4734
|
+
const le = Math.min(ve.end, B);
|
|
4735
4735
|
for (let ae = ee; ae <= le && !(_ >= E); ae++)
|
|
4736
|
-
|
|
4736
|
+
fe.push({ data: H == null ? void 0 : H[ae], index: ae, offset: _, size: re }), _ += re + N;
|
|
4737
4737
|
}
|
|
4738
4738
|
});
|
|
4739
|
-
return ao(Z,
|
|
4739
|
+
return ao(Z, $, I, N, D, G);
|
|
4740
4740
|
}
|
|
4741
4741
|
),
|
|
4742
4742
|
//@ts-expect-error filter needs to be fixed
|
|
@@ -4880,10 +4880,10 @@ const Pn = Ae(
|
|
|
4880
4880
|
return N ? E && Lt(
|
|
4881
4881
|
L(
|
|
4882
4882
|
i,
|
|
4883
|
-
me((
|
|
4883
|
+
me((H) => !H),
|
|
4884
4884
|
// skips the initial publish of false, and the cleanup call.
|
|
4885
4885
|
// but if scrollingInProgress is true, we skip the initial publish.
|
|
4886
|
-
Rn(
|
|
4886
|
+
Rn(Qe(i) ? 1 : 2)
|
|
4887
4887
|
),
|
|
4888
4888
|
E
|
|
4889
4889
|
) : E && E(), N;
|
|
@@ -4922,7 +4922,7 @@ const Ov = (e, t) => typeof e == "function" ? Cl(e(t)) : t && Cl(e), Mv = Ae(
|
|
|
4922
4922
|
index: "LAST"
|
|
4923
4923
|
});
|
|
4924
4924
|
}
|
|
4925
|
-
|
|
4925
|
+
De(
|
|
4926
4926
|
L(
|
|
4927
4927
|
nt(L(pe(t), Rn(1)), c),
|
|
4928
4928
|
Se(pe(m), s, a, h),
|
|
@@ -4933,20 +4933,20 @@ const Ov = (e, t) => typeof e == "function" ? Cl(e(t)) : t && Cl(e), Mv = Ae(
|
|
|
4933
4933
|
me(({ shouldFollow: S }) => S)
|
|
4934
4934
|
),
|
|
4935
4935
|
({ followOutputBehavior: S, totalCount: C }) => {
|
|
4936
|
-
g && (g(), g = null),
|
|
4937
|
-
|
|
4936
|
+
g && (g(), g = null), Qe(n) ? requestAnimationFrame(() => {
|
|
4937
|
+
Qe(d)("following output to ", { totalCount: C }, vt.DEBUG), b(S);
|
|
4938
4938
|
}) : g = Lt(e, () => {
|
|
4939
|
-
|
|
4939
|
+
Qe(d)("following output to ", { totalCount: C }, vt.DEBUG), b(S), g = null;
|
|
4940
4940
|
});
|
|
4941
4941
|
}
|
|
4942
4942
|
);
|
|
4943
4943
|
function w(S) {
|
|
4944
4944
|
const C = Lt(o, (E) => {
|
|
4945
|
-
S && !E.atBottom && E.notAtBottomBecause === "SIZE_INCREASED" && !g && (
|
|
4945
|
+
S && !E.atBottom && E.notAtBottomBecause === "SIZE_INCREASED" && !g && (Qe(d)("scrolling to bottom due to increased size", {}, vt.DEBUG), b("auto"));
|
|
4946
4946
|
});
|
|
4947
4947
|
setTimeout(C, 100);
|
|
4948
4948
|
}
|
|
4949
|
-
|
|
4949
|
+
De(
|
|
4950
4950
|
L(
|
|
4951
4951
|
nt(pe(m), t, u),
|
|
4952
4952
|
me(([S, , C]) => S && C),
|
|
@@ -4958,11 +4958,11 @@ const Ov = (e, t) => typeof e == "function" ? Cl(e(t)) : t && Cl(e), Mv = Ae(
|
|
|
4958
4958
|
Se(m, t)
|
|
4959
4959
|
),
|
|
4960
4960
|
([, S]) => {
|
|
4961
|
-
|
|
4961
|
+
Qe(a) && w(S !== !1);
|
|
4962
4962
|
}
|
|
4963
|
-
),
|
|
4964
|
-
w(
|
|
4965
|
-
}),
|
|
4963
|
+
), De(v, () => {
|
|
4964
|
+
w(Qe(m) !== !1);
|
|
4965
|
+
}), De(nt(pe(m), o), ([S, C]) => {
|
|
4966
4966
|
S && !C.atBottom && C.notAtBottomBecause === "VIEWPORT_HEIGHT_DECREASING" && b("auto");
|
|
4967
4967
|
});
|
|
4968
4968
|
const y = K(null), R = Re();
|
|
@@ -4978,7 +4978,7 @@ const Ov = (e, t) => typeof e == "function" ? Cl(e(t)) : t && Cl(e), Mv = Ae(
|
|
|
4978
4978
|
L(pe(t))
|
|
4979
4979
|
),
|
|
4980
4980
|
R
|
|
4981
|
-
),
|
|
4981
|
+
), De(
|
|
4982
4982
|
L(
|
|
4983
4983
|
nt(L(R, Rn(1)), c),
|
|
4984
4984
|
Se(pe(y), a, h, p),
|
|
@@ -4987,10 +4987,10 @@ const Ov = (e, t) => typeof e == "function" ? Cl(e(t)) : t && Cl(e), Mv = Ae(
|
|
|
4987
4987
|
nn(0)
|
|
4988
4988
|
),
|
|
4989
4989
|
(S) => {
|
|
4990
|
-
g && (g(), g = null),
|
|
4991
|
-
|
|
4990
|
+
g && (g(), g = null), Qe(n) ? requestAnimationFrame(() => {
|
|
4991
|
+
Qe(d)("scrolling into view", {}), ye(x, S);
|
|
4992
4992
|
}) : g = Lt(e, () => {
|
|
4993
|
-
|
|
4993
|
+
Qe(d)("scrolling into view", {}), ye(x, S), g = null;
|
|
4994
4994
|
});
|
|
4995
4995
|
}
|
|
4996
4996
|
), { autoscrollToBottom: v, followOutput: m, scrollIntoViewOnChange: y };
|
|
@@ -5022,7 +5022,7 @@ const Ov = (e, t) => typeof e == "function" ? Cl(e(t)) : t && Cl(e), Mv = Ae(
|
|
|
5022
5022
|
), Lv = Ae(
|
|
5023
5023
|
([{ didMount: e }, { scrollTo: t }, { listState: n }]) => {
|
|
5024
5024
|
const r = K(0);
|
|
5025
|
-
return
|
|
5025
|
+
return De(
|
|
5026
5026
|
L(
|
|
5027
5027
|
e,
|
|
5028
5028
|
Se(r),
|
|
@@ -5069,7 +5069,7 @@ const Ov = (e, t) => typeof e == "function" ? Cl(e(t)) : t && Cl(e), Mv = Ae(
|
|
|
5069
5069
|
Ue()
|
|
5070
5070
|
),
|
|
5071
5071
|
t
|
|
5072
|
-
),
|
|
5072
|
+
), De(
|
|
5073
5073
|
L(nt(t, e, n), Se(r)),
|
|
5074
5074
|
([[o, s, i], a]) => {
|
|
5075
5075
|
o && a && a.change && a.change(s, i);
|
|
@@ -5119,7 +5119,7 @@ const Ov = (e, t) => typeof e == "function" ? Cl(e(t)) : t && Cl(e), Mv = Ae(
|
|
|
5119
5119
|
{ useWindowScroll: i, windowScrollContainerState: a, windowViewportRect: c }
|
|
5120
5120
|
]) => {
|
|
5121
5121
|
const u = Re(), d = K(void 0), h = K(null), p = K(null);
|
|
5122
|
-
return ce(a, h), ce(c, p),
|
|
5122
|
+
return ce(a, h), ce(c, p), De(
|
|
5123
5123
|
L(
|
|
5124
5124
|
u,
|
|
5125
5125
|
Se(t, r, i, h, p, n)
|
|
@@ -5192,9 +5192,9 @@ const $v = pu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
5192
5192
|
function g(b) {
|
|
5193
5193
|
b > 0 ? (ye(t, { behavior: "auto", top: -b }), ye(e, 0)) : (ye(e, 0), ye(t, { behavior: "auto", top: -b }));
|
|
5194
5194
|
}
|
|
5195
|
-
return
|
|
5195
|
+
return De(L(v, Se(e, s)), ([b, w, y]) => {
|
|
5196
5196
|
y && $v() ? ye(e, w - b) : g(-b);
|
|
5197
|
-
}),
|
|
5197
|
+
}), De(
|
|
5198
5198
|
L(
|
|
5199
5199
|
nt(dt(s, !1), e, m),
|
|
5200
5200
|
me(([b, w, y]) => !b && !y && w !== 0),
|
|
@@ -5208,7 +5208,7 @@ const $v = pu(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
5208
5208
|
se((b) => ({ top: -b }))
|
|
5209
5209
|
),
|
|
5210
5210
|
t
|
|
5211
|
-
),
|
|
5211
|
+
), De(
|
|
5212
5212
|
L(
|
|
5213
5213
|
u,
|
|
5214
5214
|
Se(p, d),
|
|
@@ -5398,7 +5398,7 @@ function gu(e, t, n) {
|
|
|
5398
5398
|
})), [S] = Y.useState(pl(d, R));
|
|
5399
5399
|
Gr(() => {
|
|
5400
5400
|
for (const E of i)
|
|
5401
|
-
E in y &&
|
|
5401
|
+
E in y && De(S[E], y[E]);
|
|
5402
5402
|
return () => {
|
|
5403
5403
|
Object.values(S).map(Bi);
|
|
5404
5404
|
};
|
|
@@ -5417,18 +5417,18 @@ function gu(e, t, n) {
|
|
|
5417
5417
|
);
|
|
5418
5418
|
}, x = (g) => {
|
|
5419
5419
|
const b = Y.useContext(a)[g], w = Y.useCallback(
|
|
5420
|
-
(y) =>
|
|
5420
|
+
(y) => De(b, y),
|
|
5421
5421
|
[b]
|
|
5422
5422
|
);
|
|
5423
5423
|
return Y.useSyncExternalStore(
|
|
5424
5424
|
w,
|
|
5425
|
-
() =>
|
|
5426
|
-
() =>
|
|
5425
|
+
() => Qe(b),
|
|
5426
|
+
() => Qe(b)
|
|
5427
5427
|
);
|
|
5428
5428
|
}, m = (g) => {
|
|
5429
|
-
const b = Y.useContext(a)[g], [w, y] = Y.useState(pl(
|
|
5429
|
+
const b = Y.useContext(a)[g], [w, y] = Y.useState(pl(Qe, b));
|
|
5430
5430
|
return Gr(
|
|
5431
|
-
() =>
|
|
5431
|
+
() => De(b, (R) => {
|
|
5432
5432
|
R !== w && y(hl(R));
|
|
5433
5433
|
}),
|
|
5434
5434
|
[b, w]
|
|
@@ -5438,7 +5438,7 @@ function gu(e, t, n) {
|
|
|
5438
5438
|
Component: h,
|
|
5439
5439
|
useEmitter: (g, b) => {
|
|
5440
5440
|
const w = Y.useContext(a)[g];
|
|
5441
|
-
Gr(() =>
|
|
5441
|
+
Gr(() => De(w, b), [b, w]);
|
|
5442
5442
|
},
|
|
5443
5443
|
useEmitterValue: v,
|
|
5444
5444
|
usePublisher: p
|
|
@@ -5541,7 +5541,7 @@ const Gv = /* @__PURE__ */ Ae(() => {
|
|
|
5541
5541
|
([e, t]) => ({ ...e, ...t }),
|
|
5542
5542
|
We(mu, Gv)
|
|
5543
5543
|
), Yv = ({ height: e }) => /* @__PURE__ */ l.jsx("div", { style: { height: e } }), Xv = { overflowAnchor: "none", position: Ki(), zIndex: 1 }, yu = { overflowAnchor: "none" }, qv = { ...yu, display: "inline-block", height: "100%" }, El = /* @__PURE__ */ Y.memo(function({ showTopList: e = !1 }) {
|
|
5544
|
-
const t =
|
|
5544
|
+
const t = be("listState"), n = Nt("sizeRanges"), r = be("useWindowScroll"), o = be("customScrollParent"), s = Nt("windowScrollContainerState"), i = Nt("scrollContainerState"), a = o || r ? s : i, c = be("itemContent"), u = be("context"), d = be("groupContent"), h = be("trackItemSizes"), p = be("itemSize"), x = be("log"), m = Nt("gap"), v = be("horizontalDirection"), { callbackRef: g } = dv(
|
|
5545
5545
|
n,
|
|
5546
5546
|
p,
|
|
5547
5547
|
h,
|
|
@@ -5550,12 +5550,12 @@ const Gv = /* @__PURE__ */ Ae(() => {
|
|
|
5550
5550
|
m,
|
|
5551
5551
|
o,
|
|
5552
5552
|
v,
|
|
5553
|
-
|
|
5553
|
+
be("skipAnimationFrameInResizeObserver")
|
|
5554
5554
|
), [b, w] = Y.useState(0);
|
|
5555
5555
|
Xi("deviation", (N) => {
|
|
5556
5556
|
b !== N && w(N);
|
|
5557
5557
|
});
|
|
5558
|
-
const y =
|
|
5558
|
+
const y = be("EmptyPlaceholder"), R = be("ScrollSeekPlaceholder") || Yv, S = be("ListComponent"), C = be("ItemComponent"), E = be("GroupComponent"), I = be("computeItemKey"), A = be("isSeeking"), P = be("groupIndices").length > 0, O = be("alignToBottom"), W = be("initialItemFinalLocationReached"), G = e ? {} : {
|
|
5559
5559
|
boxSizing: "border-box",
|
|
5560
5560
|
...v ? {
|
|
5561
5561
|
display: "inline-block",
|
|
@@ -5579,7 +5579,7 @@ const Gv = /* @__PURE__ */ Ae(() => {
|
|
|
5579
5579
|
ref: g,
|
|
5580
5580
|
style: G,
|
|
5581
5581
|
children: (e ? t.topItems : t.items).map((N) => {
|
|
5582
|
-
const
|
|
5582
|
+
const H = N.originalIndex, D = I(H + t.firstItemIndex, N.data, u);
|
|
5583
5583
|
return A ? /* @__PURE__ */ to(
|
|
5584
5584
|
R,
|
|
5585
5585
|
{
|
|
@@ -5594,7 +5594,7 @@ const Gv = /* @__PURE__ */ Ae(() => {
|
|
|
5594
5594
|
E,
|
|
5595
5595
|
{
|
|
5596
5596
|
...ut(E, u),
|
|
5597
|
-
"data-index":
|
|
5597
|
+
"data-index": H,
|
|
5598
5598
|
"data-item-index": N.index,
|
|
5599
5599
|
"data-known-size": N.size,
|
|
5600
5600
|
key: D,
|
|
@@ -5606,7 +5606,7 @@ const Gv = /* @__PURE__ */ Ae(() => {
|
|
|
5606
5606
|
{
|
|
5607
5607
|
...ut(C, u),
|
|
5608
5608
|
...ex(C, N.data),
|
|
5609
|
-
"data-index":
|
|
5609
|
+
"data-index": H,
|
|
5610
5610
|
"data-item-group-index": N.groupIndex,
|
|
5611
5611
|
"data-item-index": N.index,
|
|
5612
5612
|
"data-known-size": N.size,
|
|
@@ -5648,7 +5648,7 @@ function ex(e, t) {
|
|
|
5648
5648
|
return { item: typeof e == "string" ? void 0 : t };
|
|
5649
5649
|
}
|
|
5650
5650
|
const tx = /* @__PURE__ */ Y.memo(function() {
|
|
5651
|
-
const e =
|
|
5651
|
+
const e = be("HeaderComponent"), t = Nt("headerHeight"), n = be("HeaderFooterTag"), r = kn(
|
|
5652
5652
|
Y.useMemo(
|
|
5653
5653
|
() => (s) => {
|
|
5654
5654
|
t(ln(s, "height"));
|
|
@@ -5656,11 +5656,11 @@ const tx = /* @__PURE__ */ Y.memo(function() {
|
|
|
5656
5656
|
[t]
|
|
5657
5657
|
),
|
|
5658
5658
|
!0,
|
|
5659
|
-
|
|
5660
|
-
), o =
|
|
5659
|
+
be("skipAnimationFrameInResizeObserver")
|
|
5660
|
+
), o = be("context");
|
|
5661
5661
|
return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...ut(e, o) }) }) : null;
|
|
5662
5662
|
}), nx = /* @__PURE__ */ Y.memo(function() {
|
|
5663
|
-
const e =
|
|
5663
|
+
const e = be("FooterComponent"), t = Nt("footerHeight"), n = be("HeaderFooterTag"), r = kn(
|
|
5664
5664
|
Y.useMemo(
|
|
5665
5665
|
() => (s) => {
|
|
5666
5666
|
t(ln(s, "height"));
|
|
@@ -5668,8 +5668,8 @@ const tx = /* @__PURE__ */ Y.memo(function() {
|
|
|
5668
5668
|
[t]
|
|
5669
5669
|
),
|
|
5670
5670
|
!0,
|
|
5671
|
-
|
|
5672
|
-
), o =
|
|
5671
|
+
be("skipAnimationFrameInResizeObserver")
|
|
5672
|
+
), o = be("context");
|
|
5673
5673
|
return e ? /* @__PURE__ */ l.jsx(n, { ref: r, children: /* @__PURE__ */ l.jsx(e, { ...ut(e, o) }) }) : null;
|
|
5674
5674
|
});
|
|
5675
5675
|
function Su({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
|
|
@@ -5725,27 +5725,27 @@ function Cu({ useEmitter: e, useEmitterValue: t, usePublisher: n }) {
|
|
|
5725
5725
|
});
|
|
5726
5726
|
}
|
|
5727
5727
|
const rx = ({ children: e }) => {
|
|
5728
|
-
const t = Y.useContext(vu), n = Nt("viewportHeight"), r = Nt("fixedItemHeight"), o =
|
|
5728
|
+
const t = Y.useContext(vu), n = Nt("viewportHeight"), r = Nt("fixedItemHeight"), o = be("alignToBottom"), s = be("horizontalDirection"), i = Y.useMemo(
|
|
5729
5729
|
() => Yc(n, (c) => ln(c, s ? "width" : "height")),
|
|
5730
5730
|
[n, s]
|
|
5731
|
-
), a = kn(i, !0,
|
|
5731
|
+
), a = kn(i, !0, be("skipAnimationFrameInResizeObserver"));
|
|
5732
5732
|
return Y.useEffect(() => {
|
|
5733
5733
|
t && (n(t.viewportHeight), r(t.itemHeight));
|
|
5734
5734
|
}, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "element", ref: a, style: Yo(o), children: e });
|
|
5735
5735
|
}, ox = ({ children: e }) => {
|
|
5736
|
-
const t = Y.useContext(vu), n = Nt("windowViewportRect"), r = Nt("fixedItemHeight"), o =
|
|
5736
|
+
const t = Y.useContext(vu), n = Nt("windowViewportRect"), r = Nt("fixedItemHeight"), o = be("customScrollParent"), s = qc(
|
|
5737
5737
|
n,
|
|
5738
5738
|
o,
|
|
5739
|
-
|
|
5740
|
-
), i =
|
|
5739
|
+
be("skipAnimationFrameInResizeObserver")
|
|
5740
|
+
), i = be("alignToBottom");
|
|
5741
5741
|
return Y.useEffect(() => {
|
|
5742
5742
|
t && (r(t.itemHeight), n({ offsetTop: 0, visibleHeight: t.viewportHeight, visibleWidth: 100 }));
|
|
5743
5743
|
}, [t, n, r]), /* @__PURE__ */ l.jsx("div", { "data-viewport-type": "window", ref: s, style: Yo(i), children: e });
|
|
5744
5744
|
}, sx = ({ children: e }) => {
|
|
5745
|
-
const t =
|
|
5745
|
+
const t = be("TopItemListComponent") || "div", n = be("headerHeight"), r = { ...Qv, marginTop: `${n}px` }, o = be("context");
|
|
5746
5746
|
return /* @__PURE__ */ l.jsx(t, { style: r, ...ut(t, o), children: e });
|
|
5747
5747
|
}, ix = /* @__PURE__ */ Y.memo(function(e) {
|
|
5748
|
-
const t =
|
|
5748
|
+
const t = be("useWindowScroll"), n = be("topItemsIndexes").length > 0, r = be("customScrollParent"), o = be("context");
|
|
5749
5749
|
return /* @__PURE__ */ l.jsxs(r || t ? cx : lx, { ...e, context: o, children: [
|
|
5750
5750
|
n && /* @__PURE__ */ l.jsx(sx, { children: /* @__PURE__ */ l.jsx(El, { showTopList: !0 }) }),
|
|
5751
5751
|
/* @__PURE__ */ l.jsxs(r || t ? ox : rx, { children: [
|
|
@@ -5757,7 +5757,7 @@ const rx = ({ children: e }) => {
|
|
|
5757
5757
|
}), {
|
|
5758
5758
|
Component: ax,
|
|
5759
5759
|
useEmitter: Xi,
|
|
5760
|
-
useEmitterValue:
|
|
5760
|
+
useEmitterValue: be,
|
|
5761
5761
|
usePublisher: Nt
|
|
5762
5762
|
} = /* @__PURE__ */ gu(
|
|
5763
5763
|
Kv,
|
|
@@ -5818,7 +5818,7 @@ const rx = ({ children: e }) => {
|
|
|
5818
5818
|
}
|
|
5819
5819
|
},
|
|
5820
5820
|
ix
|
|
5821
|
-
), lx = /* @__PURE__ */ Su({ useEmitter: Xi, useEmitterValue:
|
|
5821
|
+
), lx = /* @__PURE__ */ Su({ useEmitter: Xi, useEmitterValue: be, usePublisher: Nt }), cx = /* @__PURE__ */ Cu({ useEmitter: Xi, useEmitterValue: be, usePublisher: Nt }), ux = ax, dx = /* @__PURE__ */ Ae(() => {
|
|
5822
5822
|
const e = K((u) => /* @__PURE__ */ l.jsxs("td", { children: [
|
|
5823
5823
|
"Item $",
|
|
5824
5824
|
u
|
|
@@ -5898,26 +5898,26 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
5898
5898
|
{ customScrollParent: g, useWindowScroll: b, windowScrollContainerState: w, windowScrollTo: y, windowViewportRect: R },
|
|
5899
5899
|
S
|
|
5900
5900
|
]) => {
|
|
5901
|
-
const C = K(0), E = K(0), I = K(Rl), A = K({ height: 0, width: 0 }), P = K({ height: 0, width: 0 }), O = Re(), W = Re(), G = K(0), N = K(null),
|
|
5902
|
-
|
|
5901
|
+
const C = K(0), E = K(0), I = K(Rl), A = K({ height: 0, width: 0 }), P = K({ height: 0, width: 0 }), O = Re(), W = Re(), G = K(0), N = K(null), H = K({ column: 0, row: 0 }), D = Re(), q = Re(), z = K(!1), k = K(0), $ = K(!0), J = K(!1), te = K(!1);
|
|
5902
|
+
De(
|
|
5903
5903
|
L(
|
|
5904
5904
|
m,
|
|
5905
5905
|
Se(k),
|
|
5906
5906
|
me(([_, ee]) => !!ee)
|
|
5907
5907
|
),
|
|
5908
5908
|
() => {
|
|
5909
|
-
ye(
|
|
5909
|
+
ye($, !1);
|
|
5910
5910
|
}
|
|
5911
|
-
),
|
|
5911
|
+
), De(
|
|
5912
5912
|
L(
|
|
5913
|
-
nt(m,
|
|
5913
|
+
nt(m, $, P, A, k, J),
|
|
5914
5914
|
me(([_, ee, re, le, , ae]) => _ && !ee && re.height !== 0 && le.height !== 0 && !ae)
|
|
5915
5915
|
),
|
|
5916
5916
|
([, , , , _]) => {
|
|
5917
5917
|
ye(J, !0), Ui(1, () => {
|
|
5918
5918
|
ye(O, _);
|
|
5919
5919
|
}), Lt(L(u), () => {
|
|
5920
|
-
ye(t, [0, 0]), ye(
|
|
5920
|
+
ye(t, [0, 0]), ye($, !0);
|
|
5921
5921
|
});
|
|
5922
5922
|
}
|
|
5923
5923
|
), ce(
|
|
@@ -5927,14 +5927,14 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
5927
5927
|
Gt(0)
|
|
5928
5928
|
),
|
|
5929
5929
|
E
|
|
5930
|
-
),
|
|
5930
|
+
), De(
|
|
5931
5931
|
L(
|
|
5932
5932
|
m,
|
|
5933
5933
|
Se(q),
|
|
5934
5934
|
me(([, _]) => _ != null)
|
|
5935
5935
|
),
|
|
5936
5936
|
([, _]) => {
|
|
5937
|
-
_ && (ye(A, _.viewport), ye(P, _.item), ye(
|
|
5937
|
+
_ && (ye(A, _.viewport), ye(P, _.item), ye(H, _.gap), _.scrollTop > 0 && (ye(z, !0), Lt(L(u, Rn(1)), (ee) => {
|
|
5938
5938
|
ye(z, !1);
|
|
5939
5939
|
}), ye(c, { top: _.scrollTop })));
|
|
5940
5940
|
}
|
|
@@ -5949,7 +5949,7 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
5949
5949
|
nt(
|
|
5950
5950
|
pe(A, Kr),
|
|
5951
5951
|
pe(P, Kr),
|
|
5952
|
-
pe(
|
|
5952
|
+
pe(H, (_, ee) => _ && _.column === ee.column && _.row === ee.row),
|
|
5953
5953
|
pe(u)
|
|
5954
5954
|
),
|
|
5955
5955
|
se(([_, ee, re, le]) => ({
|
|
@@ -5965,13 +5965,13 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
5965
5965
|
nt(
|
|
5966
5966
|
pe(C),
|
|
5967
5967
|
r,
|
|
5968
|
-
pe(
|
|
5968
|
+
pe(H, px),
|
|
5969
5969
|
pe(P, Kr),
|
|
5970
5970
|
pe(A, Kr),
|
|
5971
5971
|
pe(N),
|
|
5972
5972
|
pe(E),
|
|
5973
5973
|
pe(z),
|
|
5974
|
-
pe(
|
|
5974
|
+
pe($),
|
|
5975
5975
|
pe(k)
|
|
5976
5976
|
),
|
|
5977
5977
|
me(([, , , , , , , _]) => !_),
|
|
@@ -5981,24 +5981,24 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
5981
5981
|
[ee, re],
|
|
5982
5982
|
le,
|
|
5983
5983
|
ae,
|
|
5984
|
-
|
|
5984
|
+
Oe,
|
|
5985
5985
|
$e,
|
|
5986
5986
|
ze,
|
|
5987
5987
|
,
|
|
5988
5988
|
Ve,
|
|
5989
5989
|
Fe
|
|
5990
5990
|
]) => {
|
|
5991
|
-
const { column: ue, row:
|
|
5991
|
+
const { column: ue, row: F } = le, { height: V, width: de } = ae, { width: Le } = Oe;
|
|
5992
5992
|
if (ze === 0 && (_ === 0 || Le === 0))
|
|
5993
5993
|
return Rl;
|
|
5994
5994
|
if (de === 0) {
|
|
5995
5995
|
const _t = Wi(Fe, _), vn = _t + Math.max(ze - 1, 0);
|
|
5996
5996
|
return hx(jl(_t, vn, $e));
|
|
5997
5997
|
}
|
|
5998
|
-
const
|
|
5999
|
-
let
|
|
6000
|
-
Ve ? ee === 0 && re === 0 && ze > 0 ? (
|
|
6001
|
-
const ot = jl(
|
|
5998
|
+
const ke = Tu(Le, de, ue);
|
|
5999
|
+
let Pe, _e;
|
|
6000
|
+
Ve ? ee === 0 && re === 0 && ze > 0 ? (Pe = 0, _e = ze - 1) : (Pe = ke * Ro((ee + F) / (V + F)), _e = ke * Il((re + F) / (V + F)) - 1, _e = Os(_ - 1, gr(_e, ke - 1)), Pe = Os(_e, gr(0, Pe))) : (Pe = 0, _e = -1);
|
|
6001
|
+
const ot = jl(Pe, _e, $e), { bottom: Ke, top: at } = Al(Oe, le, ae, ot), qe = Il(_ / ke), lt = qe * V + (qe - 1) * F - Ke;
|
|
6002
6002
|
return { bottom: Ke, itemHeight: V, items: ot, itemWidth: de, offsetBottom: lt, offsetTop: at, top: at };
|
|
6003
6003
|
}
|
|
6004
6004
|
)
|
|
@@ -6013,30 +6013,30 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
6013
6013
|
C
|
|
6014
6014
|
), ce(
|
|
6015
6015
|
L(
|
|
6016
|
-
nt(A, P, I,
|
|
6016
|
+
nt(A, P, I, H),
|
|
6017
6017
|
me(([_, ee, { items: re }]) => re.length > 0 && ee.height !== 0 && _.height !== 0),
|
|
6018
6018
|
se(([_, ee, { items: re }, le]) => {
|
|
6019
|
-
const { bottom: ae, top:
|
|
6020
|
-
return [
|
|
6019
|
+
const { bottom: ae, top: Oe } = Al(_, le, ee, re);
|
|
6020
|
+
return [Oe, ae];
|
|
6021
6021
|
}),
|
|
6022
6022
|
Ue(Cr)
|
|
6023
6023
|
),
|
|
6024
6024
|
t
|
|
6025
6025
|
);
|
|
6026
|
-
const
|
|
6026
|
+
const B = K(!1);
|
|
6027
6027
|
ce(
|
|
6028
6028
|
L(
|
|
6029
6029
|
u,
|
|
6030
|
-
Se(
|
|
6030
|
+
Se(B),
|
|
6031
6031
|
se(([_, ee]) => ee || _ !== 0)
|
|
6032
6032
|
),
|
|
6033
|
-
|
|
6033
|
+
B
|
|
6034
6034
|
);
|
|
6035
6035
|
const Z = Ct(
|
|
6036
6036
|
L(
|
|
6037
6037
|
nt(I, C),
|
|
6038
6038
|
me(([{ items: _ }]) => _.length > 0),
|
|
6039
|
-
Se(
|
|
6039
|
+
Se(B),
|
|
6040
6040
|
me(([[_, ee], re]) => {
|
|
6041
6041
|
const le = _.items[_.items.length - 1].index === ee - 1;
|
|
6042
6042
|
return (re || _.bottom > 0 && _.itemHeight > 0 && _.offsetBottom === 0 && _.items.length === ee) && le;
|
|
@@ -6044,14 +6044,14 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
6044
6044
|
se(([[, _]]) => _ - 1),
|
|
6045
6045
|
Ue()
|
|
6046
6046
|
)
|
|
6047
|
-
),
|
|
6047
|
+
), fe = Ct(
|
|
6048
6048
|
L(
|
|
6049
6049
|
pe(I),
|
|
6050
6050
|
me(({ items: _ }) => _.length > 0 && _[0].index === 0),
|
|
6051
6051
|
Gt(0),
|
|
6052
6052
|
Ue()
|
|
6053
6053
|
)
|
|
6054
|
-
),
|
|
6054
|
+
), ve = Ct(
|
|
6055
6055
|
L(
|
|
6056
6056
|
pe(I),
|
|
6057
6057
|
Se(z),
|
|
@@ -6064,13 +6064,13 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
6064
6064
|
nn(0)
|
|
6065
6065
|
)
|
|
6066
6066
|
);
|
|
6067
|
-
ce(
|
|
6067
|
+
ce(ve, x.scrollSeekRangeChanged), ce(
|
|
6068
6068
|
L(
|
|
6069
6069
|
O,
|
|
6070
|
-
Se(A, P, C,
|
|
6070
|
+
Se(A, P, C, H),
|
|
6071
6071
|
se(([_, ee, re, le, ae]) => {
|
|
6072
|
-
const
|
|
6073
|
-
let Fe =
|
|
6072
|
+
const Oe = au(_), { align: $e, behavior: ze, offset: Ve } = Oe;
|
|
6073
|
+
let Fe = Oe.index;
|
|
6074
6074
|
Fe === "LAST" && (Fe = le - 1), Fe = gr(0, Fe, Os(le - 1, Fe));
|
|
6075
6075
|
let ue = ui(ee, ae, re, Fe);
|
|
6076
6076
|
return $e === "end" ? ue = Nl(ue - ee.height + re.height) : $e === "center" && (ue = Nl(ue - ee.height / 2 + re.height / 2)), Ve && (ue += Ve), { behavior: ze, top: ue };
|
|
@@ -6097,7 +6097,7 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
6097
6097
|
data: N,
|
|
6098
6098
|
deviation: G,
|
|
6099
6099
|
footerHeight: o,
|
|
6100
|
-
gap:
|
|
6100
|
+
gap: H,
|
|
6101
6101
|
headerHeight: s,
|
|
6102
6102
|
increaseViewportBy: e,
|
|
6103
6103
|
initialItemCount: E,
|
|
@@ -6126,8 +6126,8 @@ const mx = /* @__PURE__ */ Ae(
|
|
|
6126
6126
|
...p,
|
|
6127
6127
|
endReached: Z,
|
|
6128
6128
|
propsReady: v,
|
|
6129
|
-
rangeChanged:
|
|
6130
|
-
startReached:
|
|
6129
|
+
rangeChanged: ve,
|
|
6130
|
+
startReached: fe,
|
|
6131
6131
|
stateChanged: D,
|
|
6132
6132
|
stateRestoreInProgress: z,
|
|
6133
6133
|
...S
|
|
@@ -6920,8 +6920,8 @@ function Kx(e) {
|
|
|
6920
6920
|
return `${e.length}:${t}:${n}`;
|
|
6921
6921
|
}
|
|
6922
6922
|
function Xr({ content: e, className: t = "", fallback: n = /* @__PURE__ */ l.jsx("div", { "aria-busy": !0, children: "Rendering…" }) }) {
|
|
6923
|
-
const r = Kx(e), [o, s] =
|
|
6924
|
-
|
|
6923
|
+
const r = Kx(e), [o, s] = he(() => dr.get(r) ?? null);
|
|
6924
|
+
Xe(() => {
|
|
6925
6925
|
if (dr.has(r)) {
|
|
6926
6926
|
const m = dr.get(r) ?? null;
|
|
6927
6927
|
s(m);
|
|
@@ -7430,7 +7430,7 @@ function Hs(e, t) {
|
|
|
7430
7430
|
return typeof e == "function" ? e(t) : e && (e.current = t), e;
|
|
7431
7431
|
}
|
|
7432
7432
|
function wb(e, t) {
|
|
7433
|
-
var n =
|
|
7433
|
+
var n = he(function() {
|
|
7434
7434
|
return {
|
|
7435
7435
|
// value
|
|
7436
7436
|
value: e,
|
|
@@ -8237,8 +8237,8 @@ const pw = f.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ l.jsx(
|
|
|
8237
8237
|
));
|
|
8238
8238
|
pw.displayName = rs.displayName;
|
|
8239
8239
|
function mw({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
|
|
8240
|
-
const [s, i] =
|
|
8241
|
-
|
|
8240
|
+
const [s, i] = he(!1), [a, c] = he(null), [u, d] = he(null), { toast: h } = ea();
|
|
8241
|
+
Xe(() => {
|
|
8242
8242
|
e && n && p();
|
|
8243
8243
|
}, [e, n]);
|
|
8244
8244
|
const p = async () => {
|
|
@@ -8346,8 +8346,8 @@ function mw({ isOpen: e, onClose: t, fileId: n, fileName: r, mimeType: o }) {
|
|
|
8346
8346
|
}
|
|
8347
8347
|
const ho = "prose prose-sm max-w-none break-words dark:prose-invert prose-headings:break-words prose-p:break-words prose-li:break-words prose-td:break-words prose-th:break-words prose-a:break-all prose-code:break-words prose-blockquote:break-words";
|
|
8348
8348
|
function gw({ className: e }) {
|
|
8349
|
-
const [t, n] =
|
|
8350
|
-
return
|
|
8349
|
+
const [t, n] = he(0);
|
|
8350
|
+
return Xe(() => {
|
|
8351
8351
|
const r = setInterval(() => n((o) => (o + 1) % 4), 500);
|
|
8352
8352
|
return () => clearInterval(r);
|
|
8353
8353
|
}, []), /* @__PURE__ */ l.jsxs(
|
|
@@ -8382,8 +8382,8 @@ const vw = Y.memo(function({
|
|
|
8382
8382
|
onCancelEdit: b,
|
|
8383
8383
|
onCopy: w
|
|
8384
8384
|
}) {
|
|
8385
|
-
const [y, R] =
|
|
8386
|
-
switch (
|
|
8385
|
+
const [y, R] = he(!1), [S, C] = he(!1), [E, I] = he(!1), [A, P] = he(!1), { currentThreadId: O } = Li(), { toast: W } = ea(), [G, N] = he({}), [H, D] = he(!1), [q, z] = he(null), k = u === "phone" || u === "half-screen", $ = t.role, J = $ === "tool", te = Y.useMemo(() => {
|
|
8386
|
+
switch ($) {
|
|
8387
8387
|
case "user":
|
|
8388
8388
|
return "text-[hsl(var(--chat-bubble-user-text))]";
|
|
8389
8389
|
case "assistant":
|
|
@@ -8395,63 +8395,76 @@ const vw = Y.memo(function({
|
|
|
8395
8395
|
default:
|
|
8396
8396
|
return "text-[hsl(var(--chat-bubble-ai-text))]";
|
|
8397
8397
|
}
|
|
8398
|
-
}, [
|
|
8398
|
+
}, [$]), B = bn(() => xw(t.content), [t.content]), Z = bn(() => Cw(t.content), [t.content]), fe = bn(() => t.content.filter((ue) => ue.type === "image_url"), [t.content]), ve = bn(() => t.content.filter((ue) => ue.type === "file"), [t.content]);
|
|
8399
|
+
Xe(() => {
|
|
8400
|
+
console.log("[DEBUG] MessageComponent render:", {
|
|
8401
|
+
messageId: t.id,
|
|
8402
|
+
role: t.role,
|
|
8403
|
+
contentLength: t.content.length,
|
|
8404
|
+
filePartsCount: ve.length,
|
|
8405
|
+
imagePartsCount: fe.length,
|
|
8406
|
+
fileParts: ve.map((ue) => ({ type: ue.type, name: ue.name, url: ue.url }))
|
|
8407
|
+
});
|
|
8408
|
+
}, [t.id, t.content, ve, fe]);
|
|
8409
|
+
const X = Ew(B, r ? o : 0), _ = async () => {
|
|
8399
8410
|
try {
|
|
8400
|
-
const ue = J ? $n(t.content) :
|
|
8411
|
+
const ue = J ? $n(t.content) : B;
|
|
8401
8412
|
await navigator.clipboard.writeText(ue), R(!0), setTimeout(() => R(!1), 2e3), w == null || w(ue);
|
|
8402
8413
|
} catch (ue) {
|
|
8403
8414
|
console.error("Failed to copy:", ue);
|
|
8404
8415
|
}
|
|
8405
8416
|
}, ee = () => {
|
|
8406
8417
|
if (!v) return;
|
|
8407
|
-
const ue = J ? $n(t.content) :
|
|
8418
|
+
const ue = J ? $n(t.content) : B;
|
|
8408
8419
|
v(t.id, ue);
|
|
8409
|
-
}, re = () => g == null ? void 0 : g(n), le = async (ue,
|
|
8420
|
+
}, re = () => g == null ? void 0 : g(n), le = async (ue, F, V) => {
|
|
8410
8421
|
try {
|
|
8411
|
-
const de = String(
|
|
8422
|
+
const de = String(F.url ?? "");
|
|
8423
|
+
console.log("[DEBUG] File clicked:", { url: de, name: F.name, mimeType: F.mimeType });
|
|
8424
|
+
const Le = de.match(/\/chat\/files\/(\d+)(?:\/(view|download))?/);
|
|
8412
8425
|
if (Le) {
|
|
8413
8426
|
ue.preventDefault();
|
|
8414
|
-
const
|
|
8415
|
-
|
|
8427
|
+
const ke = Le[1], Pe = F.name || `file_${ke}`, _e = F.mimeType || "application/octet-stream";
|
|
8428
|
+
console.log("[DEBUG] Opening modal for server file:", { id: ke, fileName: Pe, mimeType: _e }), z({ id: ke, name: Pe, mimeType: _e }), D(!0);
|
|
8416
8429
|
return;
|
|
8417
8430
|
}
|
|
8418
8431
|
if (de.startsWith("data:")) {
|
|
8419
8432
|
if (ue.preventDefault(), G[V]) return;
|
|
8420
|
-
N((
|
|
8421
|
-
const
|
|
8433
|
+
N((Pe) => ({ ...Pe, [V]: !0 }));
|
|
8434
|
+
const ke = W({ title: "Fetching file...", description: "", open: !0 });
|
|
8422
8435
|
try {
|
|
8423
|
-
const
|
|
8424
|
-
if (!(
|
|
8436
|
+
const _e = (await Xx(O ?? void 0)).find((ot) => !ot || typeof ot != "object" || !((ot.filename ?? "") === (F.name ?? "")) ? !1 : typeof F.size == "number" && typeof ot.size == "number" ? ot.size === F.size : !0);
|
|
8437
|
+
if (!(_e != null && _e.id))
|
|
8425
8438
|
throw new Error("File is not yet available on the server");
|
|
8426
|
-
z({
|
|
8427
|
-
id:
|
|
8428
|
-
name:
|
|
8429
|
-
mimeType:
|
|
8430
|
-
}), D(!0),
|
|
8431
|
-
} catch (
|
|
8432
|
-
console.error("Failed to fetch server file:",
|
|
8439
|
+
console.log("[DEBUG] Opening modal for data URL file:", { matchId: _e.id, fileName: F.name }), z({
|
|
8440
|
+
id: _e.id,
|
|
8441
|
+
name: F.name || _e.filename || `file_${_e.id}`,
|
|
8442
|
+
mimeType: F.mimeType || _e.mime_type || "application/octet-stream"
|
|
8443
|
+
}), D(!0), ke.update({ id: ke.id, title: "Done", description: void 0 });
|
|
8444
|
+
} catch (Pe) {
|
|
8445
|
+
console.error("Failed to fetch server file:", Pe), ke.update({ id: ke.id, title: "Failed", description: String(Pe) }), W({ title: "Failed to fetch file", description: String(Pe), open: !0 });
|
|
8433
8446
|
} finally {
|
|
8434
|
-
N((
|
|
8447
|
+
N((Pe) => ({ ...Pe, [V]: !1 }));
|
|
8435
8448
|
}
|
|
8436
8449
|
}
|
|
8437
8450
|
} catch (de) {
|
|
8438
8451
|
console.error("File click error:", de);
|
|
8439
8452
|
}
|
|
8440
8453
|
}, ae = () => {
|
|
8441
|
-
const
|
|
8442
|
-
switch (
|
|
8454
|
+
const F = M(k ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", te);
|
|
8455
|
+
switch ($) {
|
|
8443
8456
|
case "user":
|
|
8444
|
-
return /* @__PURE__ */ l.jsx(Lp, { className:
|
|
8457
|
+
return /* @__PURE__ */ l.jsx(Lp, { className: F });
|
|
8445
8458
|
case "assistant":
|
|
8446
|
-
return /* @__PURE__ */ l.jsx(za, { className:
|
|
8459
|
+
return /* @__PURE__ */ l.jsx(za, { className: F });
|
|
8447
8460
|
case "tool":
|
|
8448
|
-
return /* @__PURE__ */ l.jsx(Dp, { className:
|
|
8461
|
+
return /* @__PURE__ */ l.jsx(Dp, { className: F });
|
|
8449
8462
|
default:
|
|
8450
|
-
return /* @__PURE__ */ l.jsx(za, { className:
|
|
8463
|
+
return /* @__PURE__ */ l.jsx(za, { className: F });
|
|
8451
8464
|
}
|
|
8452
|
-
},
|
|
8465
|
+
}, Oe = () => {
|
|
8453
8466
|
const ue = "group relative mb-4 flex w-full";
|
|
8454
|
-
switch (
|
|
8467
|
+
switch ($) {
|
|
8455
8468
|
case "user":
|
|
8456
8469
|
return M(ue, "justify-end");
|
|
8457
8470
|
case "assistant":
|
|
@@ -8466,7 +8479,7 @@ const vw = Y.memo(function({
|
|
|
8466
8479
|
"rounded-lg px-4 py-3 relative transition-all duration-200 min-w-0 max-w-full break-words",
|
|
8467
8480
|
k && "px-3 py-2 text-sm"
|
|
8468
8481
|
);
|
|
8469
|
-
switch (
|
|
8482
|
+
switch ($) {
|
|
8470
8483
|
case "user":
|
|
8471
8484
|
return M(
|
|
8472
8485
|
ue,
|
|
@@ -8502,12 +8515,12 @@ const vw = Y.memo(function({
|
|
|
8502
8515
|
}
|
|
8503
8516
|
}, Ve = () => {
|
|
8504
8517
|
if (t.model === "reflection") {
|
|
8505
|
-
const V =
|
|
8518
|
+
const V = B.trim(), de = Ws(V);
|
|
8506
8519
|
if (de && typeof de == "object")
|
|
8507
8520
|
return /* @__PURE__ */ l.jsx(Rw, { data: de });
|
|
8508
8521
|
}
|
|
8509
8522
|
if (J && Z.name === "get_issues") {
|
|
8510
|
-
const V = t.content.find((
|
|
8523
|
+
const V = t.content.find((ke) => ke.type === "tool_result"), de = (V == null ? void 0 : V.output) ?? $n(t.content), Le = pd(de);
|
|
8511
8524
|
if (Le) return /* @__PURE__ */ l.jsx(Iw, { issues: Le });
|
|
8512
8525
|
}
|
|
8513
8526
|
if (J && !E) {
|
|
@@ -8539,7 +8552,7 @@ const vw = Y.memo(function({
|
|
|
8539
8552
|
const de = $n(t.content);
|
|
8540
8553
|
return /* @__PURE__ */ l.jsx("div", { className: "font-mono text-sm text-current", children: /* @__PURE__ */ l.jsx("pre", { className: M("whitespace-pre-wrap break-words text-current", k && "text-xs"), children: de }) });
|
|
8541
8554
|
}
|
|
8542
|
-
const ue =
|
|
8555
|
+
const ue = fe.length > 0 && $ !== "tool", F = ve.length > 0 && $ !== "tool";
|
|
8543
8556
|
return /* @__PURE__ */ l.jsxs("div", { children: [
|
|
8544
8557
|
r ? /* @__PURE__ */ l.jsxs("div", { className: "relative", children: [
|
|
8545
8558
|
(() => {
|
|
@@ -8548,10 +8561,10 @@ const vw = Y.memo(function({
|
|
|
8548
8561
|
})(),
|
|
8549
8562
|
/* @__PURE__ */ l.jsx(gw, { className: M(te, k ? "text-xs" : "text-sm") })
|
|
8550
8563
|
] }) : (() => {
|
|
8551
|
-
const V = Ws(
|
|
8564
|
+
const V = Ws(B.trim());
|
|
8552
8565
|
if (V !== null) return /* @__PURE__ */ l.jsx(ql, { data: V });
|
|
8553
|
-
if (
|
|
8554
|
-
const de =
|
|
8566
|
+
if ($ === "user" && p) {
|
|
8567
|
+
const de = B.trim();
|
|
8555
8568
|
if (de.length > x)
|
|
8556
8569
|
return /* @__PURE__ */ l.jsxs(_l, { open: A, onOpenChange: P, children: [
|
|
8557
8570
|
/* @__PURE__ */ l.jsx("div", { className: M("text-sm text-[hsl(var(--chat-bubble-user-text))]", k && "text-xs"), children: A ? /* @__PURE__ */ l.jsx(Xr, { content: de }) : /* @__PURE__ */ l.jsxs("pre", { className: M("font-sans whitespace-pre-wrap break-words bg-transparent p-0 m-0 text-[hsl(var(--chat-bubble-user-text))]", k && "text-xs"), children: [
|
|
@@ -8577,23 +8590,23 @@ const vw = Y.memo(function({
|
|
|
8577
8590
|
) })
|
|
8578
8591
|
] });
|
|
8579
8592
|
}
|
|
8580
|
-
return /* @__PURE__ */ l.jsx(Xr, { content:
|
|
8593
|
+
return /* @__PURE__ */ l.jsx(Xr, { content: B.trim() });
|
|
8581
8594
|
})(),
|
|
8582
|
-
ue && /* @__PURE__ */ l.jsx("div", { className: "mt-2 grid grid-cols-2 gap-2", children:
|
|
8595
|
+
ue && /* @__PURE__ */ l.jsx("div", { className: "mt-2 grid grid-cols-2 gap-2", children: fe.map((V, de) => /* @__PURE__ */ l.jsxs("div", { className: "relative border rounded overflow-hidden", children: [
|
|
8583
8596
|
/* @__PURE__ */ l.jsx("img", { src: V.url, alt: V.alt ?? "image", className: "w-full h-auto" }),
|
|
8584
8597
|
/* @__PURE__ */ l.jsxs("div", { className: "absolute top-1 right-1 bg-background/70 rounded px-1 py-0.5 text-[10px] flex items-center gap-1", children: [
|
|
8585
8598
|
/* @__PURE__ */ l.jsx(bc, { className: "h-3 w-3" }),
|
|
8586
8599
|
/* @__PURE__ */ l.jsx("span", { children: "image" })
|
|
8587
8600
|
] })
|
|
8588
8601
|
] }, de)) }),
|
|
8589
|
-
|
|
8590
|
-
const Le = V,
|
|
8602
|
+
F && /* @__PURE__ */ l.jsx("div", { className: "mt-2 flex flex-wrap gap-2", children: ve.map((V, de) => {
|
|
8603
|
+
const Le = V, ke = Le.name || "file";
|
|
8591
8604
|
return /* @__PURE__ */ l.jsxs(
|
|
8592
8605
|
"a",
|
|
8593
8606
|
{
|
|
8594
8607
|
href: Le.url,
|
|
8595
|
-
download:
|
|
8596
|
-
onClick: (
|
|
8608
|
+
download: ke,
|
|
8609
|
+
onClick: (Pe) => le(Pe, Le, de),
|
|
8597
8610
|
target: "_blank",
|
|
8598
8611
|
rel: "noreferrer",
|
|
8599
8612
|
className: M(
|
|
@@ -8602,16 +8615,16 @@ const vw = Y.memo(function({
|
|
|
8602
8615
|
"dark:bg-background/10 dark:border-border/30 dark:hover:bg-background/20",
|
|
8603
8616
|
"text-current"
|
|
8604
8617
|
),
|
|
8605
|
-
title:
|
|
8618
|
+
title: ke,
|
|
8606
8619
|
children: [
|
|
8607
8620
|
/* @__PURE__ */ l.jsx("span", { className: "inline-block w-1.5 h-1.5 rounded-full bg-gray-400 dark:bg-gray-500" }),
|
|
8608
8621
|
G[de] ? /* @__PURE__ */ l.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
8609
8622
|
/* @__PURE__ */ l.jsx(wc, { className: "h-4 w-4 animate-spin" }),
|
|
8610
8623
|
/* @__PURE__ */ l.jsxs("span", { className: "truncate max-w-[140px]", children: [
|
|
8611
|
-
|
|
8624
|
+
ke,
|
|
8612
8625
|
" (processing)"
|
|
8613
8626
|
] })
|
|
8614
|
-
] }) : /* @__PURE__ */ l.jsx("span", { className: "truncate max-w-[180px]", children:
|
|
8627
|
+
] }) : /* @__PURE__ */ l.jsx("span", { className: "truncate max-w-[180px]", children: ke })
|
|
8615
8628
|
]
|
|
8616
8629
|
},
|
|
8617
8630
|
de
|
|
@@ -8620,7 +8633,7 @@ const vw = Y.memo(function({
|
|
|
8620
8633
|
] });
|
|
8621
8634
|
}, Fe = bn(() => Tw(t), [t]);
|
|
8622
8635
|
return /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
8623
|
-
/* @__PURE__ */ l.jsx("div", { className: M(
|
|
8636
|
+
/* @__PURE__ */ l.jsx("div", { className: M(Oe(), m.container), children: /* @__PURE__ */ l.jsxs("div", { className: M($e(), m.content), children: [
|
|
8624
8637
|
(a || c || J) && /* @__PURE__ */ l.jsxs(
|
|
8625
8638
|
"div",
|
|
8626
8639
|
{
|
|
@@ -8694,7 +8707,7 @@ const vw = Y.memo(function({
|
|
|
8694
8707
|
)
|
|
8695
8708
|
}
|
|
8696
8709
|
),
|
|
8697
|
-
|
|
8710
|
+
$ === "user" && v && /* @__PURE__ */ l.jsx(
|
|
8698
8711
|
je,
|
|
8699
8712
|
{
|
|
8700
8713
|
variant: "ghost",
|
|
@@ -8704,7 +8717,7 @@ const vw = Y.memo(function({
|
|
|
8704
8717
|
children: /* @__PURE__ */ l.jsx($a, { className: M(te, k ? "h-3 w-3" : "h-4 w-4") })
|
|
8705
8718
|
}
|
|
8706
8719
|
),
|
|
8707
|
-
|
|
8720
|
+
$ === "assistant" && g && /* @__PURE__ */ l.jsx(
|
|
8708
8721
|
je,
|
|
8709
8722
|
{
|
|
8710
8723
|
variant: "ghost",
|
|
@@ -8751,7 +8764,7 @@ const vw = Y.memo(function({
|
|
|
8751
8764
|
children: /* @__PURE__ */ l.jsx(Ha, { className: M(y ? "text-success" : "text-current", k ? "h-3 w-3" : "h-4 w-4") })
|
|
8752
8765
|
}
|
|
8753
8766
|
),
|
|
8754
|
-
|
|
8767
|
+
$ === "user" && v && /* @__PURE__ */ l.jsx(
|
|
8755
8768
|
je,
|
|
8756
8769
|
{
|
|
8757
8770
|
variant: "ghost",
|
|
@@ -8761,7 +8774,7 @@ const vw = Y.memo(function({
|
|
|
8761
8774
|
children: /* @__PURE__ */ l.jsx($a, { className: M("text-current", k ? "h-3 w-3" : "h-4 w-4") })
|
|
8762
8775
|
}
|
|
8763
8776
|
),
|
|
8764
|
-
|
|
8777
|
+
$ === "assistant" && g && /* @__PURE__ */ l.jsx(
|
|
8765
8778
|
je,
|
|
8766
8779
|
{
|
|
8767
8780
|
variant: "ghost",
|
|
@@ -8778,7 +8791,7 @@ const vw = Y.memo(function({
|
|
|
8778
8791
|
q && /* @__PURE__ */ l.jsx(
|
|
8779
8792
|
mw,
|
|
8780
8793
|
{
|
|
8781
|
-
isOpen:
|
|
8794
|
+
isOpen: H,
|
|
8782
8795
|
onClose: () => {
|
|
8783
8796
|
D(!1), z(null);
|
|
8784
8797
|
},
|
|
@@ -8915,8 +8928,8 @@ function Tw(e) {
|
|
|
8915
8928
|
return e.name && e.name.trim() ? e.name : e.model && e.model.includes("/") ? e.model.split("/").pop() || null : e.model || null;
|
|
8916
8929
|
}
|
|
8917
8930
|
function Ew(e, t) {
|
|
8918
|
-
const [n, r] =
|
|
8919
|
-
return
|
|
8931
|
+
const [n, r] = he(e);
|
|
8932
|
+
return Xe(() => {
|
|
8920
8933
|
if (!t) {
|
|
8921
8934
|
r(e);
|
|
8922
8935
|
return;
|
|
@@ -9384,12 +9397,12 @@ const Vw = (e) => ({
|
|
|
9384
9397
|
}, x = ca(o), m = la(x), v = await i.getDimensions(u), g = x === "y", b = g ? "top" : "left", w = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", R = s.reference[m] + s.reference[x] - p[x] - s.floating[m], S = p[x] - s.reference[x], C = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(u));
|
|
9385
9398
|
let E = C ? C[y] : 0;
|
|
9386
9399
|
(!E || !await (i.isElement == null ? void 0 : i.isElement(C))) && (E = a.floating[y] || s.floating[m]);
|
|
9387
|
-
const I = R / 2 - S / 2, A = E / 2 - v[m] / 2 - 1, P = un(h[b], A), O = un(h[w], A), W = P, G = E - v[m] - O, N = E / 2 - v[m] / 2 + I,
|
|
9400
|
+
const I = R / 2 - S / 2, A = E / 2 - v[m] / 2 - 1, P = un(h[b], A), O = un(h[w], A), W = P, G = E - v[m] - O, N = E / 2 - v[m] / 2 + I, H = gi(W, N, G), D = !c.arrow && rr(o) != null && N !== H && s.reference[m] / 2 - (N < W ? P : O) - v[m] / 2 < 0, q = D ? N < W ? N - W : N - G : 0;
|
|
9388
9401
|
return {
|
|
9389
9402
|
[x]: p[x] + q,
|
|
9390
9403
|
data: {
|
|
9391
|
-
[x]:
|
|
9392
|
-
centerOffset: N -
|
|
9404
|
+
[x]: H,
|
|
9405
|
+
centerOffset: N - H - q,
|
|
9393
9406
|
...D && {
|
|
9394
9407
|
alignmentOffset: q
|
|
9395
9408
|
}
|
|
@@ -9434,8 +9447,8 @@ const Vw = (e) => ({
|
|
|
9434
9447
|
overflows: A
|
|
9435
9448
|
}], !A.every((N) => N <= 0)) {
|
|
9436
9449
|
var O, W;
|
|
9437
|
-
const N = (((O = s.flip) == null ? void 0 : O.index) || 0) + 1,
|
|
9438
|
-
if (
|
|
9450
|
+
const N = (((O = s.flip) == null ? void 0 : O.index) || 0) + 1, H = E[N];
|
|
9451
|
+
if (H && (!(h === "alignment" ? w !== Xt(H) : !1) || // We leave the current main axis only if every placement on that axis
|
|
9439
9452
|
// overflows the main axis.
|
|
9440
9453
|
P.every((z) => Xt(z.placement) === w ? z.overflows[0] > 0 : !0)))
|
|
9441
9454
|
return {
|
|
@@ -9444,7 +9457,7 @@ const Vw = (e) => ({
|
|
|
9444
9457
|
overflows: P
|
|
9445
9458
|
},
|
|
9446
9459
|
reset: {
|
|
9447
|
-
placement:
|
|
9460
|
+
placement: H
|
|
9448
9461
|
}
|
|
9449
9462
|
};
|
|
9450
9463
|
let D = (W = P.filter((q) => q.overflows[0] <= 0).sort((q, z) => q.overflows[1] - z.overflows[1])[0]) == null ? void 0 : W.placement;
|
|
@@ -9460,7 +9473,7 @@ const Vw = (e) => ({
|
|
|
9460
9473
|
k === "y";
|
|
9461
9474
|
}
|
|
9462
9475
|
return !0;
|
|
9463
|
-
}).map((z) => [z.placement, z.overflows.filter((k) => k > 0).reduce((k,
|
|
9476
|
+
}).map((z) => [z.placement, z.overflows.filter((k) => k > 0).reduce((k, $) => k + $, 0)]).sort((z, k) => z[1] - k[1])[0]) == null ? void 0 : G[0];
|
|
9464
9477
|
q && (D = q);
|
|
9465
9478
|
break;
|
|
9466
9479
|
}
|
|
@@ -10301,7 +10314,7 @@ function Oy(e) {
|
|
|
10301
10314
|
middleware: p
|
|
10302
10315
|
};
|
|
10303
10316
|
O.current && (z.platform = O.current), ky(C.current, E.current, z).then((k) => {
|
|
10304
|
-
const
|
|
10317
|
+
const $ = {
|
|
10305
10318
|
...k,
|
|
10306
10319
|
// The floating element's position may be recomputed while it's closed
|
|
10307
10320
|
// but still mounted (such as when transitioning out). To ensure
|
|
@@ -10309,8 +10322,8 @@ function Oy(e) {
|
|
|
10309
10322
|
// setting it to `true` when `open === false` (must be specified).
|
|
10310
10323
|
isPositioned: W.current !== !1
|
|
10311
10324
|
};
|
|
10312
|
-
N.current && !Po(I.current,
|
|
10313
|
-
h(
|
|
10325
|
+
N.current && !Po(I.current, $) && (I.current = $, Fo.flushSync(() => {
|
|
10326
|
+
h($);
|
|
10314
10327
|
}));
|
|
10315
10328
|
});
|
|
10316
10329
|
}, [p, t, n, O, W]);
|
|
@@ -10330,7 +10343,7 @@ function Oy(e) {
|
|
|
10330
10343
|
G();
|
|
10331
10344
|
}
|
|
10332
10345
|
}, [R, S, G, P, A]);
|
|
10333
|
-
const
|
|
10346
|
+
const H = f.useMemo(() => ({
|
|
10334
10347
|
reference: C,
|
|
10335
10348
|
floating: E,
|
|
10336
10349
|
setReference: w,
|
|
@@ -10346,26 +10359,26 @@ function Oy(e) {
|
|
|
10346
10359
|
};
|
|
10347
10360
|
if (!D.floating)
|
|
10348
10361
|
return z;
|
|
10349
|
-
const k = ac(D.floating, d.x),
|
|
10362
|
+
const k = ac(D.floating, d.x), $ = ac(D.floating, d.y);
|
|
10350
10363
|
return a ? {
|
|
10351
10364
|
...z,
|
|
10352
|
-
transform: "translate(" + k + "px, " +
|
|
10365
|
+
transform: "translate(" + k + "px, " + $ + "px)",
|
|
10353
10366
|
...Ed(D.floating) >= 1.5 && {
|
|
10354
10367
|
willChange: "transform"
|
|
10355
10368
|
}
|
|
10356
10369
|
} : {
|
|
10357
10370
|
position: n,
|
|
10358
10371
|
left: k,
|
|
10359
|
-
top:
|
|
10372
|
+
top: $
|
|
10360
10373
|
};
|
|
10361
10374
|
}, [n, a, D.floating, d.x, d.y]);
|
|
10362
10375
|
return f.useMemo(() => ({
|
|
10363
10376
|
...d,
|
|
10364
10377
|
update: G,
|
|
10365
|
-
refs:
|
|
10378
|
+
refs: H,
|
|
10366
10379
|
elements: D,
|
|
10367
10380
|
floatingStyles: q
|
|
10368
|
-
}), [d, G,
|
|
10381
|
+
}), [d, G, H, D, q]);
|
|
10369
10382
|
}
|
|
10370
10383
|
const My = (e) => {
|
|
10371
10384
|
function t(n) {
|
|
@@ -10482,16 +10495,16 @@ var pa = "PopperContent", [Gy, Ky] = Nd(pa), _d = f.forwardRef(
|
|
|
10482
10495
|
updatePositionStrategy: x = "optimized",
|
|
10483
10496
|
onPlaced: m,
|
|
10484
10497
|
...v
|
|
10485
|
-
} = e, g = jd(pa, n), [b, w] = f.useState(null), y = Te(t, (
|
|
10498
|
+
} = e, g = jd(pa, n), [b, w] = f.useState(null), y = Te(t, (Oe) => w(Oe)), [R, S] = f.useState(null), C = Id(R), E = (C == null ? void 0 : C.width) ?? 0, I = (C == null ? void 0 : C.height) ?? 0, A = r + (s !== "center" ? "-" + s : ""), P = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, O = Array.isArray(u) ? u : [u], W = O.length > 0, G = {
|
|
10486
10499
|
padding: P,
|
|
10487
10500
|
boundary: O.filter(Xy),
|
|
10488
10501
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
10489
10502
|
altBoundary: W
|
|
10490
|
-
}, { refs: N, floatingStyles:
|
|
10503
|
+
}, { refs: N, floatingStyles: H, placement: D, isPositioned: q, middlewareData: z } = Oy({
|
|
10491
10504
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
10492
10505
|
strategy: "fixed",
|
|
10493
10506
|
placement: A,
|
|
10494
|
-
whileElementsMounted: (...
|
|
10507
|
+
whileElementsMounted: (...Oe) => Ty(...Oe, {
|
|
10495
10508
|
animationFrame: x === "always"
|
|
10496
10509
|
}),
|
|
10497
10510
|
elements: {
|
|
@@ -10508,33 +10521,33 @@ var pa = "PopperContent", [Gy, Ky] = Nd(pa), _d = f.forwardRef(
|
|
|
10508
10521
|
c && By({ ...G }),
|
|
10509
10522
|
Hy({
|
|
10510
10523
|
...G,
|
|
10511
|
-
apply: ({ elements:
|
|
10512
|
-
const { width: Fe, height: ue } = $e.reference,
|
|
10513
|
-
|
|
10524
|
+
apply: ({ elements: Oe, rects: $e, availableWidth: ze, availableHeight: Ve }) => {
|
|
10525
|
+
const { width: Fe, height: ue } = $e.reference, F = Oe.floating.style;
|
|
10526
|
+
F.setProperty("--radix-popper-available-width", `${ze}px`), F.setProperty("--radix-popper-available-height", `${Ve}px`), F.setProperty("--radix-popper-anchor-width", `${Fe}px`), F.setProperty("--radix-popper-anchor-height", `${ue}px`);
|
|
10514
10527
|
}
|
|
10515
10528
|
}),
|
|
10516
10529
|
R && zy({ element: R, padding: a }),
|
|
10517
10530
|
qy({ arrowWidth: E, arrowHeight: I }),
|
|
10518
10531
|
p && $y({ strategy: "referenceHidden", ...G })
|
|
10519
10532
|
]
|
|
10520
|
-
}), [k,
|
|
10533
|
+
}), [k, $] = Dd(D), J = it(m);
|
|
10521
10534
|
st(() => {
|
|
10522
10535
|
q && (J == null || J());
|
|
10523
10536
|
}, [q, J]);
|
|
10524
|
-
const te = (X = z.arrow) == null ? void 0 : X.x,
|
|
10537
|
+
const te = (X = z.arrow) == null ? void 0 : X.x, B = (_ = z.arrow) == null ? void 0 : _.y, Z = ((ee = z.arrow) == null ? void 0 : ee.centerOffset) !== 0, [fe, ve] = f.useState();
|
|
10525
10538
|
return st(() => {
|
|
10526
|
-
b &&
|
|
10539
|
+
b && ve(window.getComputedStyle(b).zIndex);
|
|
10527
10540
|
}, [b]), /* @__PURE__ */ l.jsx(
|
|
10528
10541
|
"div",
|
|
10529
10542
|
{
|
|
10530
10543
|
ref: N.setFloating,
|
|
10531
10544
|
"data-radix-popper-content-wrapper": "",
|
|
10532
10545
|
style: {
|
|
10533
|
-
...
|
|
10534
|
-
transform: q ?
|
|
10546
|
+
...H,
|
|
10547
|
+
transform: q ? H.transform : "translate(0, -200%)",
|
|
10535
10548
|
// keep off the page when measuring
|
|
10536
10549
|
minWidth: "max-content",
|
|
10537
|
-
zIndex:
|
|
10550
|
+
zIndex: fe,
|
|
10538
10551
|
"--radix-popper-transform-origin": [
|
|
10539
10552
|
(re = z.transformOrigin) == null ? void 0 : re.x,
|
|
10540
10553
|
(le = z.transformOrigin) == null ? void 0 : le.y
|
|
@@ -10555,13 +10568,13 @@ var pa = "PopperContent", [Gy, Ky] = Nd(pa), _d = f.forwardRef(
|
|
|
10555
10568
|
placedSide: k,
|
|
10556
10569
|
onArrowChange: S,
|
|
10557
10570
|
arrowX: te,
|
|
10558
|
-
arrowY:
|
|
10571
|
+
arrowY: B,
|
|
10559
10572
|
shouldHideArrow: Z,
|
|
10560
10573
|
children: /* @__PURE__ */ l.jsx(
|
|
10561
10574
|
ge.div,
|
|
10562
10575
|
{
|
|
10563
10576
|
"data-side": k,
|
|
10564
|
-
"data-align":
|
|
10577
|
+
"data-align": $,
|
|
10565
10578
|
...v,
|
|
10566
10579
|
ref: y,
|
|
10567
10580
|
style: {
|
|
@@ -10713,10 +10726,10 @@ var nS = f.forwardRef((e, t) => {
|
|
|
10713
10726
|
if (I.target === I.currentTarget && A && !b) {
|
|
10714
10727
|
const P = new CustomEvent(Ks, Jy);
|
|
10715
10728
|
if (I.currentTarget.dispatchEvent(P), !P.defaultPrevented) {
|
|
10716
|
-
const O = R().filter((D) => D.focusable), W = O.find((D) => D.active), G = O.find((D) => D.id === v),
|
|
10729
|
+
const O = R().filter((D) => D.focusable), W = O.find((D) => D.active), G = O.find((D) => D.id === v), H = [W, G, ...O].filter(
|
|
10717
10730
|
Boolean
|
|
10718
10731
|
).map((D) => D.ref.current);
|
|
10719
|
-
zd(
|
|
10732
|
+
zd(H, d);
|
|
10720
10733
|
}
|
|
10721
10734
|
}
|
|
10722
10735
|
S.current = !1;
|
|
@@ -10925,12 +10938,12 @@ var At = "MenuContent", [bS, ya] = _n(At), Xd = f.forwardRef(
|
|
|
10925
10938
|
onDismiss: x,
|
|
10926
10939
|
disableOutsideScroll: m,
|
|
10927
10940
|
...v
|
|
10928
|
-
} = e, g = On(At, n), b = Wr(At, n), w = cs(n), y = Vd(n), R = hS(n), [S, C] = f.useState(null), E = f.useRef(null), I = Te(t, E, g.onContentChange), A = f.useRef(0), P = f.useRef(""), O = f.useRef(0), W = f.useRef(null), G = f.useRef("right"), N = f.useRef(0),
|
|
10941
|
+
} = e, g = On(At, n), b = Wr(At, n), w = cs(n), y = Vd(n), R = hS(n), [S, C] = f.useState(null), E = f.useRef(null), I = Te(t, E, g.onContentChange), A = f.useRef(0), P = f.useRef(""), O = f.useRef(0), W = f.useRef(null), G = f.useRef("right"), N = f.useRef(0), H = m ? Qo : f.Fragment, D = m ? { as: SS, allowPinchZoom: !0 } : void 0, q = (k) => {
|
|
10929
10942
|
var X, _;
|
|
10930
|
-
const
|
|
10943
|
+
const $ = P.current + k, J = R().filter((ee) => !ee.disabled), te = document.activeElement, B = (X = J.find((ee) => ee.ref.current === te)) == null ? void 0 : X.textValue, Z = J.map((ee) => ee.textValue), fe = OS(Z, $, B), ve = (_ = J.find((ee) => ee.textValue === fe)) == null ? void 0 : _.ref.current;
|
|
10931
10944
|
(function ee(re) {
|
|
10932
10945
|
P.current = re, window.clearTimeout(A.current), re !== "" && (A.current = window.setTimeout(() => ee(""), 1e3));
|
|
10933
|
-
})(
|
|
10946
|
+
})($), ve && setTimeout(() => ve.focus());
|
|
10934
10947
|
};
|
|
10935
10948
|
f.useEffect(() => () => window.clearTimeout(A.current), []), ta();
|
|
10936
10949
|
const z = f.useCallback((k) => {
|
|
@@ -10950,8 +10963,8 @@ var At = "MenuContent", [bS, ya] = _n(At), Xd = f.forwardRef(
|
|
|
10950
10963
|
),
|
|
10951
10964
|
onItemLeave: f.useCallback(
|
|
10952
10965
|
(k) => {
|
|
10953
|
-
var
|
|
10954
|
-
z(k) || ((
|
|
10966
|
+
var $;
|
|
10967
|
+
z(k) || (($ = E.current) == null || $.focus(), C(null));
|
|
10955
10968
|
},
|
|
10956
10969
|
[z]
|
|
10957
10970
|
),
|
|
@@ -10965,14 +10978,14 @@ var At = "MenuContent", [bS, ya] = _n(At), Xd = f.forwardRef(
|
|
|
10965
10978
|
onPointerGraceIntentChange: f.useCallback((k) => {
|
|
10966
10979
|
W.current = k;
|
|
10967
10980
|
}, []),
|
|
10968
|
-
children: /* @__PURE__ */ l.jsx(
|
|
10981
|
+
children: /* @__PURE__ */ l.jsx(H, { ...D, children: /* @__PURE__ */ l.jsx(
|
|
10969
10982
|
qo,
|
|
10970
10983
|
{
|
|
10971
10984
|
asChild: !0,
|
|
10972
10985
|
trapped: o,
|
|
10973
10986
|
onMountAutoFocus: ne(s, (k) => {
|
|
10974
|
-
var
|
|
10975
|
-
k.preventDefault(), (
|
|
10987
|
+
var $;
|
|
10988
|
+
k.preventDefault(), ($ = E.current) == null || $.focus({ preventScroll: !0 });
|
|
10976
10989
|
}),
|
|
10977
10990
|
onUnmountAutoFocus: i,
|
|
10978
10991
|
children: /* @__PURE__ */ l.jsx(
|
|
@@ -11012,13 +11025,13 @@ var At = "MenuContent", [bS, ya] = _n(At), Xd = f.forwardRef(
|
|
|
11012
11025
|
ref: I,
|
|
11013
11026
|
style: { outline: "none", ...v.style },
|
|
11014
11027
|
onKeyDown: ne(v.onKeyDown, (k) => {
|
|
11015
|
-
const J = k.target.closest("[data-radix-menu-content]") === k.currentTarget, te = k.ctrlKey || k.altKey || k.metaKey,
|
|
11016
|
-
J && (k.key === "Tab" && k.preventDefault(), !te &&
|
|
11028
|
+
const J = k.target.closest("[data-radix-menu-content]") === k.currentTarget, te = k.ctrlKey || k.altKey || k.metaKey, B = k.key.length === 1;
|
|
11029
|
+
J && (k.key === "Tab" && k.preventDefault(), !te && B && q(k.key));
|
|
11017
11030
|
const Z = E.current;
|
|
11018
11031
|
if (k.target !== Z || !uS.includes(k.key)) return;
|
|
11019
11032
|
k.preventDefault();
|
|
11020
|
-
const
|
|
11021
|
-
Ud.includes(k.key) &&
|
|
11033
|
+
const ve = R().filter((X) => !X.disabled).map((X) => X.ref.current);
|
|
11034
|
+
Ud.includes(k.key) && ve.reverse(), PS(ve);
|
|
11022
11035
|
}),
|
|
11023
11036
|
onBlur: ne(e.onBlur, (k) => {
|
|
11024
11037
|
k.currentTarget.contains(k.target) || (window.clearTimeout(A.current), P.current = "");
|
|
@@ -11026,8 +11039,8 @@ var At = "MenuContent", [bS, ya] = _n(At), Xd = f.forwardRef(
|
|
|
11026
11039
|
onPointerMove: ne(
|
|
11027
11040
|
e.onPointerMove,
|
|
11028
11041
|
jr((k) => {
|
|
11029
|
-
const
|
|
11030
|
-
if (k.currentTarget.contains(
|
|
11042
|
+
const $ = k.target, J = N.current !== k.clientX;
|
|
11043
|
+
if (k.currentTarget.contains($) && J) {
|
|
11031
11044
|
const te = k.clientX > N.current ? "right" : "left";
|
|
11032
11045
|
G.current = te, N.current = k.clientX;
|
|
11033
11046
|
}
|
|
@@ -11699,25 +11712,25 @@ function go({
|
|
|
11699
11712
|
isLoadingHistory: I,
|
|
11700
11713
|
loadOlderMessages: A,
|
|
11701
11714
|
api: P
|
|
11702
|
-
} = Li(), [O, W] =
|
|
11715
|
+
} = Li(), [O, W] = he(null), [G, N] = he(""), [H, D] = he(null), [q, z] = he([]), [k, $] = he(!1), [J, te] = he(null), [B, Z] = he(null), [fe, ve] = he(!1), [X, _] = he(null), [ee, re] = he([]), [le, ae] = he(null);
|
|
11703
11716
|
wt(null);
|
|
11704
|
-
const
|
|
11705
|
-
|
|
11717
|
+
const Oe = wt(null), $e = wt(null), ze = wt(null), Ve = wt(!1), Fe = wt(!0), ue = wt(0), F = wt(null), [V, de] = he("desktop");
|
|
11718
|
+
Xe(() => {
|
|
11706
11719
|
const Q = () => {
|
|
11707
11720
|
const ie = window.innerWidth;
|
|
11708
11721
|
de(ie < 640 ? "phone" : ie < 1024 ? "tablet" : "desktop");
|
|
11709
11722
|
};
|
|
11710
11723
|
return Q(), window.addEventListener("resize", Q), () => window.removeEventListener("resize", Q);
|
|
11711
|
-
}, []),
|
|
11724
|
+
}, []), Xe(() => {
|
|
11712
11725
|
let Q = !1;
|
|
11713
11726
|
if (!p) {
|
|
11714
|
-
re([]), ae(null),
|
|
11727
|
+
re([]), ae(null), F.current = null;
|
|
11715
11728
|
return;
|
|
11716
11729
|
}
|
|
11717
11730
|
const ie = {
|
|
11718
11731
|
threadId: p,
|
|
11719
11732
|
checkpointId: y ?? null
|
|
11720
|
-
}, Ce =
|
|
11733
|
+
}, Ce = F.current;
|
|
11721
11734
|
if (!(Ce && Ce.threadId === ie.threadId && Ce.checkpointId === ie.checkpointId))
|
|
11722
11735
|
return R(p).then((Ne) => {
|
|
11723
11736
|
if (Q) return;
|
|
@@ -11725,16 +11738,16 @@ function go({
|
|
|
11725
11738
|
re(Ot), ae((Mt) => {
|
|
11726
11739
|
var Dn;
|
|
11727
11740
|
return Mt ?? ((Dn = Ot[0]) == null ? void 0 : Dn.checkpointId) ?? null;
|
|
11728
|
-
}),
|
|
11741
|
+
}), F.current = ie;
|
|
11729
11742
|
}).catch((Ne) => {
|
|
11730
|
-
console.error("ChatInterface - listCheckpoints error:", Ne), Q || (re([]),
|
|
11743
|
+
console.error("ChatInterface - listCheckpoints error:", Ne), Q || (re([]), F.current = null);
|
|
11731
11744
|
}), () => {
|
|
11732
11745
|
Q = !0;
|
|
11733
11746
|
};
|
|
11734
|
-
}, [p, y, R]),
|
|
11747
|
+
}, [p, y, R]), Xe(() => {
|
|
11735
11748
|
y && ae(y);
|
|
11736
11749
|
}, [y]);
|
|
11737
|
-
const Le =
|
|
11750
|
+
const Le = Ze(async () => {
|
|
11738
11751
|
if (!E || I) return;
|
|
11739
11752
|
const Q = ze.current;
|
|
11740
11753
|
if (!Q) return;
|
|
@@ -11758,12 +11771,12 @@ function go({
|
|
|
11758
11771
|
});
|
|
11759
11772
|
}
|
|
11760
11773
|
}, [E, I, A]);
|
|
11761
|
-
|
|
11774
|
+
Xe(() => {
|
|
11762
11775
|
x.length < ue.current && (Fe.current = !0), ue.current = x.length;
|
|
11763
|
-
}, [x.length]),
|
|
11776
|
+
}, [x.length]), Xe(() => {
|
|
11764
11777
|
const Q = ze.current;
|
|
11765
11778
|
Q && (Ve.current || Fe.current && (Q.scrollTop = Q.scrollHeight, Fe.current = !0));
|
|
11766
|
-
}, [x]),
|
|
11779
|
+
}, [x]), Xe(() => {
|
|
11767
11780
|
(async () => {
|
|
11768
11781
|
try {
|
|
11769
11782
|
const ie = await P.getAgent("default");
|
|
@@ -11772,10 +11785,10 @@ function go({
|
|
|
11772
11785
|
console.warn("Failed to fetch default message:", ie), _(null);
|
|
11773
11786
|
}
|
|
11774
11787
|
})();
|
|
11775
|
-
}, [P]),
|
|
11776
|
-
g && !
|
|
11777
|
-
}, [g,
|
|
11778
|
-
const
|
|
11788
|
+
}, [P]), Xe(() => {
|
|
11789
|
+
g && !fe && (h == null || h(g));
|
|
11790
|
+
}, [g, fe, h]);
|
|
11791
|
+
const ke = (Q) => {
|
|
11779
11792
|
if (Q.length > po)
|
|
11780
11793
|
return `Message too long (${Q.length}/${po} characters)`;
|
|
11781
11794
|
try {
|
|
@@ -11783,7 +11796,7 @@ function go({
|
|
|
11783
11796
|
} catch (ie) {
|
|
11784
11797
|
return (ie == null ? void 0 : ie.message) || "Invalid message";
|
|
11785
11798
|
}
|
|
11786
|
-
},
|
|
11799
|
+
}, Pe = (Q) => {
|
|
11787
11800
|
const ie = Q.content || [], Ce = ie.filter((Ne) => Ne.type === "text").map((Ne) => Ne.text).join("");
|
|
11788
11801
|
if (Ce) return Ce;
|
|
11789
11802
|
try {
|
|
@@ -11791,11 +11804,11 @@ function go({
|
|
|
11791
11804
|
} catch {
|
|
11792
11805
|
return String(ie);
|
|
11793
11806
|
}
|
|
11794
|
-
},
|
|
11807
|
+
}, _e = async (Q) => {
|
|
11795
11808
|
const ie = Q.trim();
|
|
11796
11809
|
if (!(!ie && q.length === 0)) {
|
|
11797
11810
|
if (ie) {
|
|
11798
|
-
const Ce =
|
|
11811
|
+
const Ce = ke(ie);
|
|
11799
11812
|
if (Ce) {
|
|
11800
11813
|
D(Ce);
|
|
11801
11814
|
return;
|
|
@@ -11812,22 +11825,22 @@ function go({
|
|
|
11812
11825
|
a && (W(Q), N(ie), D(null));
|
|
11813
11826
|
}, [a]), Ke = Y.useCallback(() => {
|
|
11814
11827
|
W(null), N(""), D(null);
|
|
11815
|
-
}, []), at =
|
|
11828
|
+
}, []), at = Ze((Q, ie) => {
|
|
11816
11829
|
ot(Q, ie);
|
|
11817
|
-
}, [ot]),
|
|
11830
|
+
}, [ot]), qe = Ze((Q) => {
|
|
11818
11831
|
for (let ie = Q - 1; ie >= 0; ie--)
|
|
11819
11832
|
if (x[ie].role === "user") {
|
|
11820
|
-
const Ce =
|
|
11833
|
+
const Ce = Pe(x[ie]);
|
|
11821
11834
|
Ce && b(Ce, { checkpointId: le || y || void 0 });
|
|
11822
11835
|
break;
|
|
11823
11836
|
}
|
|
11824
|
-
}, [x, b, le, y,
|
|
11837
|
+
}, [x, b, le, y, Pe]), lt = (Q) => {
|
|
11825
11838
|
const ie = Array.from(Q.target.files || []);
|
|
11826
11839
|
z((Ce) => [...Ce, ...ie]);
|
|
11827
11840
|
}, _t = (Q) => z((ie) => ie.filter((Ce, Ne) => Q !== Ne)), vn = async (Q) => {
|
|
11828
11841
|
const ie = (Q.target.files || [])[0];
|
|
11829
11842
|
if (ie) {
|
|
11830
|
-
te(null), Z(null),
|
|
11843
|
+
te(null), Z(null), $(!0);
|
|
11831
11844
|
try {
|
|
11832
11845
|
const Ce = await P.uploadExcel(ie), Ne = Ce.sheets.map((Mt) => `${Mt.sheetName} -> ${Mt.tableName}`).join(", "), Ot = Ne ? `Uploaded ${ie.name} (${Ce.sheets.length} sheet${Ce.sheets.length === 1 ? "" : "s"}: ${Ne})` : `Uploaded ${ie.name}`;
|
|
11833
11846
|
Z(Ot), d == null || d({ file: ie, response: Ce });
|
|
@@ -11835,7 +11848,7 @@ function go({
|
|
|
11835
11848
|
const Ne = Ce instanceof Error ? Ce.message : "Failed to upload Excel file";
|
|
11836
11849
|
console.error("Excel upload failed", Ce), te(Ne), h == null || h(Ne);
|
|
11837
11850
|
} finally {
|
|
11838
|
-
|
|
11851
|
+
$(!1), Q.target.value = "";
|
|
11839
11852
|
}
|
|
11840
11853
|
}
|
|
11841
11854
|
}, Mn = (Q) => {
|
|
@@ -11852,14 +11865,14 @@ function go({
|
|
|
11852
11865
|
}
|
|
11853
11866
|
}, ar = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${c.container || ""}`, Ss = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-y-auto overflow-x-auto overscroll-contain break-words break-anywhere p-4 space-y-4 bg-transparent ${c.messagesArea || ""}`, Cs = `flex-shrink-0 w-full border-t p-4 bg-transparent ${c.inputArea || ""}`;
|
|
11854
11867
|
return /* @__PURE__ */ l.jsxs("div", { className: ar, children: [
|
|
11855
|
-
!!g && !
|
|
11868
|
+
!!g && !fe && /* @__PURE__ */ l.jsxs("div", { className: "flex-shrink-0 bg-red-50 border border-red-200 text-red-800 px-4 py-2 text-sm flex items-center justify-between", children: [
|
|
11856
11869
|
/* @__PURE__ */ l.jsx("span", { children: g }),
|
|
11857
11870
|
/* @__PURE__ */ l.jsx(
|
|
11858
11871
|
je,
|
|
11859
11872
|
{
|
|
11860
11873
|
variant: "ghost",
|
|
11861
11874
|
size: "sm",
|
|
11862
|
-
onClick: () =>
|
|
11875
|
+
onClick: () => ve(!0),
|
|
11863
11876
|
className: "text-red-800 hover:bg-red-100",
|
|
11864
11877
|
"aria-label": "Dismiss error",
|
|
11865
11878
|
children: /* @__PURE__ */ l.jsx(Un, { size: 16 })
|
|
@@ -11932,7 +11945,7 @@ function go({
|
|
|
11932
11945
|
truncateToolMessages: !1,
|
|
11933
11946
|
toolMessagePreviewLength: 200,
|
|
11934
11947
|
onEdit: at,
|
|
11935
|
-
onRegenerate: () =>
|
|
11948
|
+
onRegenerate: () => qe(Q),
|
|
11936
11949
|
onCancelEdit: Ke
|
|
11937
11950
|
},
|
|
11938
11951
|
ie.id ?? `msg-${ie.role}-${Q}-${ie.createdAt ?? ""}`
|
|
@@ -11963,7 +11976,7 @@ function go({
|
|
|
11963
11976
|
/* @__PURE__ */ l.jsx(
|
|
11964
11977
|
"input",
|
|
11965
11978
|
{
|
|
11966
|
-
ref:
|
|
11979
|
+
ref: Oe,
|
|
11967
11980
|
type: "file",
|
|
11968
11981
|
multiple: !0,
|
|
11969
11982
|
onChange: (Q) => lt(Q),
|
|
@@ -12001,11 +12014,11 @@ function go({
|
|
|
12001
12014
|
/* @__PURE__ */ l.jsx(Hp, { className: "h-4 w-4 animate-spin" }),
|
|
12002
12015
|
" Uploading Excel file..."
|
|
12003
12016
|
] }),
|
|
12004
|
-
|
|
12017
|
+
B && !k && /* @__PURE__ */ l.jsx("div", { className: "text-sm rounded border border-emerald-200 bg-emerald-50 px-3 py-2 text-emerald-700", children: B }),
|
|
12005
12018
|
J && !k && /* @__PURE__ */ l.jsx("div", { className: "text-sm rounded border border-red-200 bg-red-50 px-3 py-2 text-red-600", children: J })
|
|
12006
12019
|
] })
|
|
12007
12020
|
] }),
|
|
12008
|
-
|
|
12021
|
+
H && /* @__PURE__ */ l.jsx("div", { className: "mb-3 text-sm text-red-600 bg-red-50 border border-red-200 rounded px-3 py-2", children: H }),
|
|
12009
12022
|
/* @__PURE__ */ l.jsxs("div", { className: "flex items-end gap-2", children: [
|
|
12010
12023
|
(s || i) && /* @__PURE__ */ l.jsxs(x0, { children: [
|
|
12011
12024
|
/* @__PURE__ */ l.jsx(b0, { asChild: !0, children: /* @__PURE__ */ l.jsx(
|
|
@@ -12023,7 +12036,7 @@ function go({
|
|
|
12023
12036
|
/* @__PURE__ */ l.jsxs(Lf, { align: "start", sideOffset: 6, className: "w-52", children: [
|
|
12024
12037
|
s && /* @__PURE__ */ l.jsxs(yi, { onClick: () => {
|
|
12025
12038
|
var Q;
|
|
12026
|
-
return (Q =
|
|
12039
|
+
return (Q = Oe.current) == null ? void 0 : Q.click();
|
|
12027
12040
|
}, className: "cursor-pointer", children: [
|
|
12028
12041
|
/* @__PURE__ */ l.jsx(Ua, { className: "h-4 w-4 mr-2" }),
|
|
12029
12042
|
" Attach files or images"
|
|
@@ -12053,9 +12066,9 @@ function go({
|
|
|
12053
12066
|
isStreaming: m,
|
|
12054
12067
|
disabled: !1,
|
|
12055
12068
|
maxLength: po,
|
|
12056
|
-
onSend:
|
|
12069
|
+
onSend: _e,
|
|
12057
12070
|
onCancelEdit: Ke,
|
|
12058
|
-
textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${O ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${
|
|
12071
|
+
textareaClassName: `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${O ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${H ? "border-red-400" : ""} ${c.textarea || ""}`
|
|
12059
12072
|
}
|
|
12060
12073
|
) }),
|
|
12061
12074
|
/* @__PURE__ */ l.jsx("div", { children: m ? /* @__PURE__ */ l.jsx(
|
|
@@ -12654,60 +12667,60 @@ function Ci({
|
|
|
12654
12667
|
createThread: v,
|
|
12655
12668
|
deleteThread: g,
|
|
12656
12669
|
renameThread: b
|
|
12657
|
-
} = Li(), [w, y] =
|
|
12658
|
-
|
|
12670
|
+
} = Li(), [w, y] = he(p ?? []), [R, S] = he(!1), [C, E] = he(null), [I, A] = he(null), [P, O] = he(""), [W, G] = he(!1);
|
|
12671
|
+
Xe(() => {
|
|
12659
12672
|
y(p ?? []);
|
|
12660
12673
|
}, [p]);
|
|
12661
|
-
const N = async (
|
|
12674
|
+
const N = async (B) => {
|
|
12662
12675
|
try {
|
|
12663
|
-
await h(
|
|
12676
|
+
await h(B), a == null || a(B), c == null || c(B);
|
|
12664
12677
|
} catch (Z) {
|
|
12665
12678
|
console.error("Failed to select thread:", Z);
|
|
12666
12679
|
}
|
|
12667
|
-
},
|
|
12680
|
+
}, H = async () => {
|
|
12668
12681
|
try {
|
|
12669
12682
|
G(!0);
|
|
12670
|
-
const
|
|
12671
|
-
u == null || u(
|
|
12672
|
-
} catch (
|
|
12673
|
-
console.error("Failed to create thread:",
|
|
12683
|
+
const B = await v();
|
|
12684
|
+
u == null || u(B), a == null || a(B);
|
|
12685
|
+
} catch (B) {
|
|
12686
|
+
console.error("Failed to create thread:", B);
|
|
12674
12687
|
} finally {
|
|
12675
12688
|
G(!1);
|
|
12676
12689
|
}
|
|
12677
|
-
}, D = async (
|
|
12690
|
+
}, D = async (B, Z) => {
|
|
12678
12691
|
if (Z.stopPropagation(), !!confirm("Delete this thread?"))
|
|
12679
12692
|
try {
|
|
12680
|
-
await g(
|
|
12681
|
-
} catch (
|
|
12682
|
-
console.error("Failed to delete thread:",
|
|
12693
|
+
await g(B), d == null || d(B);
|
|
12694
|
+
} catch (fe) {
|
|
12695
|
+
console.error("Failed to delete thread:", fe);
|
|
12683
12696
|
}
|
|
12684
|
-
}, q = (
|
|
12685
|
-
Z.stopPropagation(), A(
|
|
12686
|
-
}, z = async (
|
|
12697
|
+
}, q = (B, Z) => {
|
|
12698
|
+
Z.stopPropagation(), A(B.threadId), O(B.title || `Thread ${B.threadId.slice(0, 8)}`);
|
|
12699
|
+
}, z = async (B) => {
|
|
12687
12700
|
if (P.trim())
|
|
12688
12701
|
try {
|
|
12689
|
-
await b(
|
|
12702
|
+
await b(B, P.trim()), A(null), O("");
|
|
12690
12703
|
} catch (Z) {
|
|
12691
12704
|
console.error("Failed to update title:", Z);
|
|
12692
12705
|
}
|
|
12693
12706
|
}, k = () => {
|
|
12694
12707
|
A(null), O("");
|
|
12695
|
-
},
|
|
12696
|
-
|
|
12697
|
-
}, J = (
|
|
12698
|
-
if (!
|
|
12708
|
+
}, $ = (B, Z) => {
|
|
12709
|
+
B.key === "Enter" ? z(Z) : B.key === "Escape" && k();
|
|
12710
|
+
}, J = (B) => {
|
|
12711
|
+
if (!B) return "";
|
|
12699
12712
|
try {
|
|
12700
|
-
const Z = new Date(
|
|
12713
|
+
const Z = new Date(B), ve = (/* @__PURE__ */ new Date()).getTime() - Z.getTime(), X = Math.floor(ve / (1e3 * 60 * 60 * 24));
|
|
12701
12714
|
return X === 0 ? Z.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) : X === 1 ? "Yesterday" : X < 7 ? `${X} days ago` : Z.toLocaleDateString();
|
|
12702
12715
|
} catch {
|
|
12703
12716
|
return "";
|
|
12704
12717
|
}
|
|
12705
|
-
}, te = (
|
|
12718
|
+
}, te = (B) => B.title || `Thread ${B.threadId.slice(0, 8)}`;
|
|
12706
12719
|
return /* @__PURE__ */ l.jsxs("div", { className: `flex flex-col h-full ${e} ${s.container || ""}`, children: [
|
|
12707
12720
|
t && /* @__PURE__ */ l.jsx("div", { className: s.header || "flex-shrink-0 p-2 border-b bg-slate-800 border-slate-700 text-slate-100 flex justify-end", children: /* @__PURE__ */ l.jsx(
|
|
12708
12721
|
je,
|
|
12709
12722
|
{
|
|
12710
|
-
onClick:
|
|
12723
|
+
onClick: H,
|
|
12711
12724
|
disabled: W || R,
|
|
12712
12725
|
className: s.createButton || "p-2",
|
|
12713
12726
|
size: "sm",
|
|
@@ -12724,32 +12737,32 @@ function Ci({
|
|
|
12724
12737
|
children: /* @__PURE__ */ l.jsx("div", { className: "p-2 space-y-1 pb-4", children: R ? /* @__PURE__ */ l.jsx("div", { className: "text-center py-8 text-slate-400", children: "Loading…" }) : w.length === 0 ? /* @__PURE__ */ l.jsxs("div", { className: "text-center py-8 text-slate-400", children: [
|
|
12725
12738
|
/* @__PURE__ */ l.jsx(Wp, { className: "w-8 h-8 mx-auto mb-2 opacity-40 text-slate-500" }),
|
|
12726
12739
|
/* @__PURE__ */ l.jsx("p", { className: "text-sm text-slate-500", children: "No conversations yet" })
|
|
12727
|
-
] }) : w.slice().sort((
|
|
12740
|
+
] }) : w.slice().sort((B, Z) => new Date(Z.updatedAt || Z.createdAt || "").getTime() - new Date(B.updatedAt || B.createdAt || "").getTime()).map((B) => /* @__PURE__ */ l.jsxs(
|
|
12728
12741
|
"div",
|
|
12729
12742
|
{
|
|
12730
|
-
onClick: () => N(
|
|
12731
|
-
className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? m) ===
|
|
12743
|
+
onClick: () => N(B.threadId),
|
|
12744
|
+
className: `group relative p-3 rounded-lg cursor-pointer transition-colors border ${(i ?? m) === B.threadId ? `${s.activeThread || "bg-slate-600 border-slate-500"} ` : `${s.threadItem || "bg-slate-700 border-slate-600 hover:bg-slate-600 text-gray-900 dark:text-slate-100"}`} ${s.threadItem || ""} text-gray-900 dark:text-slate-100`,
|
|
12732
12745
|
children: [
|
|
12733
12746
|
/* @__PURE__ */ l.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
12734
|
-
/* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: I ===
|
|
12735
|
-
/* @__PURE__ */ l.jsx(Ar, { value: P, onChange: (Z) => O(Z.target.value), onKeyDown: (Z) =>
|
|
12736
|
-
/* @__PURE__ */ l.jsx(je, { variant: "ghost", size: "sm", onClick: () => z(
|
|
12747
|
+
/* @__PURE__ */ l.jsx("div", { className: "flex-1 min-w-0", children: I === B.threadId ? /* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2", onClick: (Z) => Z.stopPropagation(), children: [
|
|
12748
|
+
/* @__PURE__ */ l.jsx(Ar, { value: P, onChange: (Z) => O(Z.target.value), onKeyDown: (Z) => $(Z, B.threadId), className: "h-6 text-sm", autoFocus: !0 }),
|
|
12749
|
+
/* @__PURE__ */ l.jsx(je, { variant: "ghost", size: "sm", onClick: () => z(B.threadId), className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(_i, { size: 12 }) }),
|
|
12737
12750
|
/* @__PURE__ */ l.jsx(je, { variant: "ghost", size: "sm", onClick: k, className: "h-6 w-6 p-0", children: /* @__PURE__ */ l.jsx(Un, { size: 12 }) })
|
|
12738
12751
|
] }) : /* @__PURE__ */ l.jsxs(l.Fragment, { children: [
|
|
12739
|
-
/* @__PURE__ */ l.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: te(
|
|
12752
|
+
/* @__PURE__ */ l.jsx("div", { className: "font-medium text-sm truncate text-gray-900 dark:text-slate-100", children: te(B) }),
|
|
12740
12753
|
/* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-500 dark:text-slate-400 mt-1", children: [
|
|
12741
12754
|
/* @__PURE__ */ l.jsx(Vp, { size: 10 }),
|
|
12742
|
-
/* @__PURE__ */ l.jsx("span", { children: J(
|
|
12755
|
+
/* @__PURE__ */ l.jsx("span", { children: J(B.updatedAt || B.createdAt) })
|
|
12743
12756
|
] })
|
|
12744
12757
|
] }) }),
|
|
12745
12758
|
/* @__PURE__ */ l.jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity ml-2", children: [
|
|
12746
|
-
r && I !==
|
|
12759
|
+
r && I !== B.threadId && /* @__PURE__ */ l.jsx(je, { variant: "ghost", size: "sm", onClick: (Z) => q(B, Z), className: "h-6 w-6 p-0", title: "Edit title", children: /* @__PURE__ */ l.jsx(yc, { size: 12 }) }),
|
|
12747
12760
|
n && /* @__PURE__ */ l.jsx(
|
|
12748
12761
|
je,
|
|
12749
12762
|
{
|
|
12750
12763
|
variant: "ghost",
|
|
12751
12764
|
size: "sm",
|
|
12752
|
-
onClick: (Z) => D(
|
|
12765
|
+
onClick: (Z) => D(B.threadId, Z),
|
|
12753
12766
|
className: "h-6 w-6 p-0 text-red-400 hover:text-red-300 hover:bg-red-900/20",
|
|
12754
12767
|
title: "Delete thread",
|
|
12755
12768
|
children: /* @__PURE__ */ l.jsx(Gp, { size: 12 })
|
|
@@ -12757,10 +12770,10 @@ function Ci({
|
|
|
12757
12770
|
)
|
|
12758
12771
|
] })
|
|
12759
12772
|
] }),
|
|
12760
|
-
i ===
|
|
12773
|
+
i === B.threadId && /* @__PURE__ */ l.jsx("div", { className: "absolute left-0 top-1/2 -translate-y-1/2 w-1 h-8 bg-blue-400 rounded-r" })
|
|
12761
12774
|
]
|
|
12762
12775
|
},
|
|
12763
|
-
|
|
12776
|
+
B.threadId
|
|
12764
12777
|
)) })
|
|
12765
12778
|
}
|
|
12766
12779
|
)
|
|
@@ -14055,7 +14068,7 @@ var KC = [" ", "Enter", "ArrowUp", "ArrowDown"], YC = [" ", "Enter"], jn = "Sele
|
|
|
14055
14068
|
defaultProp: a,
|
|
14056
14069
|
onChange: c,
|
|
14057
14070
|
caller: jn
|
|
14058
|
-
}), O = f.useRef(null), W = g ? m || !!g.closest("form") : !0, [G, N] = f.useState(/* @__PURE__ */ new Set()),
|
|
14071
|
+
}), O = f.useRef(null), W = g ? m || !!g.closest("form") : !0, [G, N] = f.useState(/* @__PURE__ */ new Set()), H = Array.from(G).map((D) => D.props.value).join(";");
|
|
14059
14072
|
return /* @__PURE__ */ l.jsx(ma, { ...v, children: /* @__PURE__ */ l.jsxs(
|
|
14060
14073
|
qC,
|
|
14061
14074
|
{
|
|
@@ -14109,7 +14122,7 @@ var KC = [" ", "Enter", "ArrowUp", "ArrowDown"], YC = [" ", "Enter"], jn = "Sele
|
|
|
14109
14122
|
Array.from(G)
|
|
14110
14123
|
]
|
|
14111
14124
|
},
|
|
14112
|
-
|
|
14125
|
+
H
|
|
14113
14126
|
) : null
|
|
14114
14127
|
]
|
|
14115
14128
|
}
|
|
@@ -14226,7 +14239,7 @@ var Dt = 10, [Xh, gn] = ir(An), tT = "SelectContentImpl", nT = Kn("SelectContent
|
|
|
14226
14239
|
...b
|
|
14227
14240
|
} = e, w = mn(An, n), [y, R] = f.useState(null), [S, C] = f.useState(null), E = Te(t, (X) => R(X)), [I, A] = f.useState(null), [P, O] = f.useState(
|
|
14228
14241
|
null
|
|
14229
|
-
), W = ws(n), [G, N] = f.useState(!1),
|
|
14242
|
+
), W = ws(n), [G, N] = f.useState(!1), H = f.useRef(!1);
|
|
14230
14243
|
f.useEffect(() => {
|
|
14231
14244
|
if (y) return na(y);
|
|
14232
14245
|
}, [y]), ta();
|
|
@@ -14267,22 +14280,22 @@ var Dt = 10, [Xh, gn] = ir(An), tT = "SelectContentImpl", nT = Kn("SelectContent
|
|
|
14267
14280
|
window.removeEventListener("blur", X), window.removeEventListener("resize", X);
|
|
14268
14281
|
};
|
|
14269
14282
|
}, [z]);
|
|
14270
|
-
const [
|
|
14283
|
+
const [$, J] = hp((X) => {
|
|
14271
14284
|
const _ = W().filter((le) => !le.disabled), ee = _.find((le) => le.ref.current === document.activeElement), re = pp(_, X, ee);
|
|
14272
14285
|
re && setTimeout(() => re.ref.current.focus());
|
|
14273
14286
|
}), te = f.useCallback(
|
|
14274
14287
|
(X, _, ee) => {
|
|
14275
|
-
const re = !
|
|
14276
|
-
(w.value !== void 0 && w.value === _ || re) && (A(X), re && (
|
|
14288
|
+
const re = !H.current && !ee;
|
|
14289
|
+
(w.value !== void 0 && w.value === _ || re) && (A(X), re && (H.current = !0));
|
|
14277
14290
|
},
|
|
14278
14291
|
[w.value]
|
|
14279
|
-
),
|
|
14292
|
+
), B = f.useCallback(() => y == null ? void 0 : y.focus(), [y]), Z = f.useCallback(
|
|
14280
14293
|
(X, _, ee) => {
|
|
14281
|
-
const re = !
|
|
14294
|
+
const re = !H.current && !ee;
|
|
14282
14295
|
(w.value !== void 0 && w.value === _ || re) && O(X);
|
|
14283
14296
|
},
|
|
14284
14297
|
[w.value]
|
|
14285
|
-
),
|
|
14298
|
+
), fe = r === "popper" ? Ri : Jh, ve = fe === Ri ? {
|
|
14286
14299
|
side: a,
|
|
14287
14300
|
sideOffset: c,
|
|
14288
14301
|
align: u,
|
|
@@ -14303,13 +14316,13 @@ var Dt = 10, [Xh, gn] = ir(An), tT = "SelectContentImpl", nT = Kn("SelectContent
|
|
|
14303
14316
|
onViewportChange: C,
|
|
14304
14317
|
itemRefCallback: te,
|
|
14305
14318
|
selectedItem: I,
|
|
14306
|
-
onItemLeave:
|
|
14319
|
+
onItemLeave: B,
|
|
14307
14320
|
itemTextRefCallback: Z,
|
|
14308
14321
|
focusSelectedItem: q,
|
|
14309
14322
|
selectedItemText: P,
|
|
14310
14323
|
position: r,
|
|
14311
14324
|
isPositioned: G,
|
|
14312
|
-
searchRef:
|
|
14325
|
+
searchRef: $,
|
|
14313
14326
|
children: /* @__PURE__ */ l.jsx(Qo, { as: nT, allowPinchZoom: !0, children: /* @__PURE__ */ l.jsx(
|
|
14314
14327
|
qo,
|
|
14315
14328
|
{
|
|
@@ -14332,7 +14345,7 @@ var Dt = 10, [Xh, gn] = ir(An), tT = "SelectContentImpl", nT = Kn("SelectContent
|
|
|
14332
14345
|
onFocusOutside: (X) => X.preventDefault(),
|
|
14333
14346
|
onDismiss: () => w.onOpenChange(!1),
|
|
14334
14347
|
children: /* @__PURE__ */ l.jsx(
|
|
14335
|
-
|
|
14348
|
+
fe,
|
|
14336
14349
|
{
|
|
14337
14350
|
role: "listbox",
|
|
14338
14351
|
id: w.contentId,
|
|
@@ -14340,7 +14353,7 @@ var Dt = 10, [Xh, gn] = ir(An), tT = "SelectContentImpl", nT = Kn("SelectContent
|
|
|
14340
14353
|
dir: w.dir,
|
|
14341
14354
|
onContextMenu: (X) => X.preventDefault(),
|
|
14342
14355
|
...b,
|
|
14343
|
-
...
|
|
14356
|
+
...ve,
|
|
14344
14357
|
onPlaced: () => N(!0),
|
|
14345
14358
|
ref: E,
|
|
14346
14359
|
style: {
|
|
@@ -14378,7 +14391,7 @@ var rT = "SelectItemAlignedPosition", Jh = f.forwardRef((e, t) => {
|
|
|
14378
14391
|
if (s.trigger && s.valueNode && a && u && v && g && b) {
|
|
14379
14392
|
const E = s.trigger.getBoundingClientRect(), I = u.getBoundingClientRect(), A = s.valueNode.getBoundingClientRect(), P = b.getBoundingClientRect();
|
|
14380
14393
|
if (s.dir !== "rtl") {
|
|
14381
|
-
const le = P.left - I.left, ae = A.left - le,
|
|
14394
|
+
const le = P.left - I.left, ae = A.left - le, Oe = E.left - ae, $e = E.width + Oe, ze = Math.max($e, I.width), Ve = window.innerWidth - Dt, Fe = Si(ae, [
|
|
14382
14395
|
Dt,
|
|
14383
14396
|
// Prevents the content from going off the starting edge of the
|
|
14384
14397
|
// viewport. It may still go off the ending edge, but this can be
|
|
@@ -14389,33 +14402,33 @@ var rT = "SelectItemAlignedPosition", Jh = f.forwardRef((e, t) => {
|
|
|
14389
14402
|
]);
|
|
14390
14403
|
a.style.minWidth = $e + "px", a.style.left = Fe + "px";
|
|
14391
14404
|
} else {
|
|
14392
|
-
const le = I.right - P.right, ae = window.innerWidth - A.right - le,
|
|
14405
|
+
const le = I.right - P.right, ae = window.innerWidth - A.right - le, Oe = window.innerWidth - E.right - ae, $e = E.width + Oe, ze = Math.max($e, I.width), Ve = window.innerWidth - Dt, Fe = Si(ae, [
|
|
14393
14406
|
Dt,
|
|
14394
14407
|
Math.max(Dt, Ve - ze)
|
|
14395
14408
|
]);
|
|
14396
14409
|
a.style.minWidth = $e + "px", a.style.right = Fe + "px";
|
|
14397
14410
|
}
|
|
14398
|
-
const O = p(), W = window.innerHeight - Dt * 2, G = v.scrollHeight, N = window.getComputedStyle(u),
|
|
14411
|
+
const O = p(), W = window.innerHeight - Dt * 2, G = v.scrollHeight, N = window.getComputedStyle(u), H = parseInt(N.borderTopWidth, 10), D = parseInt(N.paddingTop, 10), q = parseInt(N.borderBottomWidth, 10), z = parseInt(N.paddingBottom, 10), k = H + D + G + z + q, $ = Math.min(g.offsetHeight * 5, k), J = window.getComputedStyle(v), te = parseInt(J.paddingTop, 10), B = parseInt(J.paddingBottom, 10), Z = E.top + E.height / 2 - Dt, fe = W - Z, ve = g.offsetHeight / 2, X = g.offsetTop + ve, _ = H + D + X, ee = k - _;
|
|
14399
14412
|
if (_ <= Z) {
|
|
14400
14413
|
const le = O.length > 0 && g === O[O.length - 1].ref.current;
|
|
14401
14414
|
a.style.bottom = "0px";
|
|
14402
|
-
const ae = u.clientHeight - v.offsetTop - v.offsetHeight,
|
|
14403
|
-
|
|
14404
|
-
|
|
14405
|
-
(le ?
|
|
14406
|
-
), $e = _ +
|
|
14415
|
+
const ae = u.clientHeight - v.offsetTop - v.offsetHeight, Oe = Math.max(
|
|
14416
|
+
fe,
|
|
14417
|
+
ve + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
14418
|
+
(le ? B : 0) + ae + q
|
|
14419
|
+
), $e = _ + Oe;
|
|
14407
14420
|
a.style.height = $e + "px";
|
|
14408
14421
|
} else {
|
|
14409
14422
|
const le = O.length > 0 && g === O[0].ref.current;
|
|
14410
14423
|
a.style.top = "0px";
|
|
14411
|
-
const
|
|
14424
|
+
const Oe = Math.max(
|
|
14412
14425
|
Z,
|
|
14413
|
-
|
|
14414
|
-
(le ? te : 0) +
|
|
14426
|
+
H + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
14427
|
+
(le ? te : 0) + ve
|
|
14415
14428
|
) + ee;
|
|
14416
|
-
a.style.height =
|
|
14429
|
+
a.style.height = Oe + "px", v.scrollTop = _ - Z + v.offsetTop;
|
|
14417
14430
|
}
|
|
14418
|
-
a.style.margin = `${Dt}px 0`, a.style.minHeight =
|
|
14431
|
+
a.style.margin = `${Dt}px 0`, a.style.minHeight = $ + "px", a.style.maxHeight = W + "px", r == null || r(), requestAnimationFrame(() => x.current = !0);
|
|
14419
14432
|
}
|
|
14420
14433
|
}, [
|
|
14421
14434
|
p,
|
|
@@ -15008,11 +15021,11 @@ const ET = {
|
|
|
15008
15021
|
}
|
|
15009
15022
|
};
|
|
15010
15023
|
function fE({ settings: e, onSettingsChange: t, className: n = "" }) {
|
|
15011
|
-
const [r, o] =
|
|
15012
|
-
|
|
15024
|
+
const [r, o] = he(!1), [s, i] = he(!1), [a, c] = he(e), [u, d] = he(!1), { toast: h } = ea();
|
|
15025
|
+
Xe(() => {
|
|
15013
15026
|
const g = JSON.stringify(a) !== JSON.stringify(e);
|
|
15014
15027
|
d(g);
|
|
15015
|
-
}, [a, e]),
|
|
15028
|
+
}, [a, e]), Xe(() => {
|
|
15016
15029
|
c(e);
|
|
15017
15030
|
}, [e]);
|
|
15018
15031
|
const p = () => {
|