teodor-new-chat-ui 4.3.575 → 4.3.576
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 +799 -799
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +14 -14
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -170,53 +170,53 @@ function Tr(e) {
|
|
|
170
170
|
};
|
|
171
171
|
}
|
|
172
172
|
function dx(e, t) {
|
|
173
|
-
var
|
|
173
|
+
var y, C, I, A;
|
|
174
174
|
if (!e) return null;
|
|
175
|
-
const
|
|
176
|
-
...
|
|
177
|
-
step: ux(
|
|
178
|
-
source: qn(
|
|
179
|
-
},
|
|
180
|
-
...
|
|
181
|
-
checkpointId:
|
|
182
|
-
})),
|
|
175
|
+
const n = ((y = e.values) == null ? void 0 : y.active_agent) ?? ((C = e.values) == null ? void 0 : C.activeAgent) ?? null, o = (Array.isArray((I = e.values) == null ? void 0 : I.messages) ? e.values.messages : []).map((D) => fx(D, n)).filter((D) => !!D), s = Jn(e.metadata) ?? {}, a = Gl(e.config), i = Jn(e.parent_config ?? e.parentConfig), l = Gl(i), c = qn(a, ["checkpoint_id", "checkpointId"]), d = qn(a, ["checkpoint_ns", "checkpointNs"]), p = qn(l, ["checkpoint_id", "checkpointId"]), m = qn(l, ["checkpoint_id", "checkpointId"]) ?? null, f = qn(l, ["checkpoint_ns", "checkpointNs"]) ?? null, v = Jn(e.config), g = Array.isArray(e.tasks) ? e.tasks.map((D) => ({ ...D })) : e.tasks ?? null, x = Array.isArray(e.next) ? [...e.next] : e.next ?? null, b = typeof e.created_at == "string" && e.created_at.trim() ? e.created_at : typeof e.createdAt == "string" && e.createdAt.trim() ? e.createdAt : new Date(Date.now() - t).toISOString(), w = {
|
|
176
|
+
...s,
|
|
177
|
+
step: ux(s, ["step"]) ?? 0,
|
|
178
|
+
source: qn(s, ["source"]) ?? null
|
|
179
|
+
}, S = o.map((D) => ({
|
|
180
|
+
...D,
|
|
181
|
+
checkpointId: c ?? null
|
|
182
|
+
})), E = (A = e.values) == null ? void 0 : A.interrupts, T = Array.isArray(e.interrupts) ? e.interrupts : Array.isArray(E) ? E : [];
|
|
183
183
|
return {
|
|
184
|
-
checkpointId:
|
|
185
|
-
checkpointNs:
|
|
186
|
-
createdAt:
|
|
187
|
-
parentId:
|
|
188
|
-
messages:
|
|
189
|
-
nextCursor:
|
|
190
|
-
nextCursorNs:
|
|
184
|
+
checkpointId: c ?? null,
|
|
185
|
+
checkpointNs: d ?? null,
|
|
186
|
+
createdAt: b,
|
|
187
|
+
parentId: p ?? null,
|
|
188
|
+
messages: S,
|
|
189
|
+
nextCursor: m,
|
|
190
|
+
nextCursorNs: f,
|
|
191
191
|
interrupt: gx(
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
o,
|
|
193
|
+
T,
|
|
194
194
|
t,
|
|
195
|
-
|
|
195
|
+
c ?? null
|
|
196
196
|
),
|
|
197
|
-
metadata:
|
|
198
|
-
config:
|
|
199
|
-
parentConfig:
|
|
200
|
-
next:
|
|
201
|
-
tasks:
|
|
197
|
+
metadata: w,
|
|
198
|
+
config: v ?? null,
|
|
199
|
+
parentConfig: i ?? null,
|
|
200
|
+
next: x,
|
|
201
|
+
tasks: g,
|
|
202
202
|
values: e.values ?? {}
|
|
203
203
|
};
|
|
204
204
|
}
|
|
205
|
-
function fx(e) {
|
|
206
|
-
var
|
|
205
|
+
function fx(e, t) {
|
|
206
|
+
var c, d, p;
|
|
207
207
|
if (!e || typeof e != "object") return null;
|
|
208
|
-
const
|
|
209
|
-
if (!
|
|
210
|
-
const
|
|
211
|
-
if (!
|
|
212
|
-
const
|
|
208
|
+
const n = px(e);
|
|
209
|
+
if (!n) return null;
|
|
210
|
+
const r = mx(e == null ? void 0 : e.content);
|
|
211
|
+
if (!r.length) return null;
|
|
212
|
+
const o = typeof e.createdAt == "string" ? e.createdAt : typeof ((c = e.additional_kwargs) == null ? void 0 : c.created_at) == "string" ? (d = e.additional_kwargs) == null ? void 0 : d.created_at : (/* @__PURE__ */ new Date()).toISOString(), s = typeof e.id == "string" && e.id.trim() ? e.id : `msg-${Date.now().toString(16)}-${Math.random().toString(16).slice(2)}`, a = typeof e.name == "string" ? e.name : void 0, i = typeof e.model == "string" ? e.model : ((p = e.additional_kwargs) == null ? void 0 : p.model) ?? void 0;
|
|
213
213
|
return {
|
|
214
|
-
id:
|
|
215
|
-
role:
|
|
216
|
-
name:
|
|
217
|
-
model:
|
|
218
|
-
createdAt:
|
|
219
|
-
content:
|
|
214
|
+
id: s,
|
|
215
|
+
role: n,
|
|
216
|
+
name: a ?? i ?? (n === "assistant" ? t ?? void 0 : void 0),
|
|
217
|
+
model: i,
|
|
218
|
+
createdAt: o,
|
|
219
|
+
content: r,
|
|
220
220
|
additionalKwargs: e.additional_kwargs ?? void 0,
|
|
221
221
|
responseMetadata: e.response_metadata ?? void 0,
|
|
222
222
|
artifact: e.artifact ?? void 0,
|
|
@@ -352,10 +352,10 @@ function wx() {
|
|
|
352
352
|
Ce.unshift("Warning: " + te), Function.prototype.apply.call(console[R], console, Ce);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
var E = !1, T = !1, y = !1, C = !1,
|
|
355
|
+
var E = !1, T = !1, y = !1, C = !1, I = !1, A;
|
|
356
356
|
A = Symbol.for("react.module.reference");
|
|
357
|
-
function
|
|
358
|
-
return !!(typeof R == "string" || typeof R == "function" || R === r || R === s ||
|
|
357
|
+
function D(R) {
|
|
358
|
+
return !!(typeof R == "string" || typeof R == "function" || R === r || R === s || I || R === o || R === c || R === d || C || R === f || E || T || y || typeof R == "object" && R !== null && (R.$$typeof === m || R.$$typeof === p || R.$$typeof === a || R.$$typeof === i || R.$$typeof === l || // This needs to include all possible module reference object
|
|
359
359
|
// types supported by any Flight configuration anywhere since
|
|
360
360
|
// we don't know which Flight build this will end up being used
|
|
361
361
|
// with.
|
|
@@ -416,18 +416,18 @@ function wx() {
|
|
|
416
416
|
}
|
|
417
417
|
return null;
|
|
418
418
|
}
|
|
419
|
-
var P = Object.assign, V = 0, X, Z,
|
|
420
|
-
function
|
|
419
|
+
var P = Object.assign, V = 0, X, Z, $, k, z, q, N;
|
|
420
|
+
function F() {
|
|
421
421
|
}
|
|
422
|
-
|
|
422
|
+
F.__reactDisabledLog = !0;
|
|
423
423
|
function O() {
|
|
424
424
|
{
|
|
425
425
|
if (V === 0) {
|
|
426
|
-
X = console.log, Z = console.info,
|
|
426
|
+
X = console.log, Z = console.info, $ = console.warn, k = console.error, z = console.group, q = console.groupCollapsed, N = console.groupEnd;
|
|
427
427
|
var R = {
|
|
428
428
|
configurable: !0,
|
|
429
429
|
enumerable: !0,
|
|
430
|
-
value:
|
|
430
|
+
value: F,
|
|
431
431
|
writable: !0
|
|
432
432
|
};
|
|
433
433
|
Object.defineProperties(console, {
|
|
@@ -459,7 +459,7 @@ function wx() {
|
|
|
459
459
|
value: Z
|
|
460
460
|
}),
|
|
461
461
|
warn: P({}, R, {
|
|
462
|
-
value:
|
|
462
|
+
value: $
|
|
463
463
|
}),
|
|
464
464
|
error: P({}, R, {
|
|
465
465
|
value: k
|
|
@@ -471,25 +471,25 @@ function wx() {
|
|
|
471
471
|
value: q
|
|
472
472
|
}),
|
|
473
473
|
groupEnd: P({}, R, {
|
|
474
|
-
value:
|
|
474
|
+
value: N
|
|
475
475
|
})
|
|
476
476
|
});
|
|
477
477
|
}
|
|
478
478
|
V < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
|
-
var K = b.ReactCurrentDispatcher,
|
|
481
|
+
var K = b.ReactCurrentDispatcher, L;
|
|
482
482
|
function j(R, te, ee) {
|
|
483
483
|
{
|
|
484
|
-
if (
|
|
484
|
+
if (L === void 0)
|
|
485
485
|
try {
|
|
486
486
|
throw Error();
|
|
487
487
|
} catch (ge) {
|
|
488
488
|
var ue = ge.stack.trim().match(/\n( *(at )?)/);
|
|
489
|
-
|
|
489
|
+
L = ue && ue[1] || "";
|
|
490
490
|
}
|
|
491
491
|
return `
|
|
492
|
-
` +
|
|
492
|
+
` + L + R;
|
|
493
493
|
}
|
|
494
494
|
}
|
|
495
495
|
var U = !1, Q;
|
|
@@ -862,7 +862,7 @@ Check the top-level render call using <` + ee + ">.");
|
|
|
862
862
|
var yt = {};
|
|
863
863
|
function W(R, te, ee, ue, ge, Ce) {
|
|
864
864
|
{
|
|
865
|
-
var Pe =
|
|
865
|
+
var Pe = D(R);
|
|
866
866
|
if (!Pe) {
|
|
867
867
|
var Ee = "";
|
|
868
868
|
(R === void 0 || typeof R == "object" && R !== null && Object.keys(R).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.");
|
|
@@ -2218,9 +2218,9 @@ const ed = (e) => {
|
|
|
2218
2218
|
onDownloadProgress: T,
|
|
2219
2219
|
onUploadProgress: y,
|
|
2220
2220
|
responseType: C,
|
|
2221
|
-
headers:
|
|
2221
|
+
headers: I,
|
|
2222
2222
|
withCredentials: A = "same-origin",
|
|
2223
|
-
fetchOptions:
|
|
2223
|
+
fetchOptions: D
|
|
2224
2224
|
} = ed(v), M = t || fetch;
|
|
2225
2225
|
C = C ? (C + "").toLowerCase() : "text";
|
|
2226
2226
|
let H = Dv([w, S && S.toAbortSignal()], E), Y = null;
|
|
@@ -2229,57 +2229,57 @@ const ed = (e) => {
|
|
|
2229
2229
|
});
|
|
2230
2230
|
let V;
|
|
2231
2231
|
try {
|
|
2232
|
-
if (y && c && x !== "get" && x !== "head" && (V = await f(
|
|
2232
|
+
if (y && c && x !== "get" && x !== "head" && (V = await f(I, b)) !== 0) {
|
|
2233
2233
|
let q = new n(g, {
|
|
2234
2234
|
method: "POST",
|
|
2235
2235
|
body: b,
|
|
2236
2236
|
duplex: "half"
|
|
2237
|
-
}),
|
|
2238
|
-
if (G.isFormData(b) && (
|
|
2239
|
-
const [
|
|
2237
|
+
}), N;
|
|
2238
|
+
if (G.isFormData(b) && (N = q.headers.get("content-type")) && I.setContentType(N), q.body) {
|
|
2239
|
+
const [F, O] = rc(
|
|
2240
2240
|
V,
|
|
2241
2241
|
hs(oc(y))
|
|
2242
2242
|
);
|
|
2243
|
-
b = ac(q.body, ic,
|
|
2243
|
+
b = ac(q.body, ic, F, O);
|
|
2244
2244
|
}
|
|
2245
2245
|
}
|
|
2246
2246
|
G.isString(A) || (A = A ? "include" : "omit");
|
|
2247
2247
|
const X = s && "credentials" in n.prototype, Z = {
|
|
2248
|
-
...
|
|
2248
|
+
...D,
|
|
2249
2249
|
signal: H,
|
|
2250
2250
|
method: x.toUpperCase(),
|
|
2251
|
-
headers:
|
|
2251
|
+
headers: I.normalize().toJSON(),
|
|
2252
2252
|
body: b,
|
|
2253
2253
|
duplex: "half",
|
|
2254
2254
|
credentials: X ? A : void 0
|
|
2255
2255
|
};
|
|
2256
2256
|
Y = s && new n(g, Z);
|
|
2257
|
-
let
|
|
2257
|
+
let $ = await (s ? M(Y, D) : M(g, Z));
|
|
2258
2258
|
const k = d && (C === "stream" || C === "response");
|
|
2259
2259
|
if (d && (T || k && P)) {
|
|
2260
2260
|
const q = {};
|
|
2261
2261
|
["status", "statusText", "headers"].forEach((_) => {
|
|
2262
|
-
q[_] =
|
|
2262
|
+
q[_] = $[_];
|
|
2263
2263
|
});
|
|
2264
|
-
const
|
|
2265
|
-
|
|
2264
|
+
const N = G.toFiniteNumber($.headers.get("content-length")), [F, O] = T && rc(
|
|
2265
|
+
N,
|
|
2266
2266
|
hs(oc(T), !0)
|
|
2267
2267
|
) || [];
|
|
2268
|
-
|
|
2269
|
-
ac(
|
|
2268
|
+
$ = new r(
|
|
2269
|
+
ac($.body, ic, F, () => {
|
|
2270
2270
|
O && O(), P && P();
|
|
2271
2271
|
}),
|
|
2272
2272
|
q
|
|
2273
2273
|
);
|
|
2274
2274
|
}
|
|
2275
2275
|
C = C || "text";
|
|
2276
|
-
let z = await p[G.findKey(p, C) || "text"](
|
|
2277
|
-
return !k && P && P(), await new Promise((q,
|
|
2278
|
-
Zu(q,
|
|
2276
|
+
let z = await p[G.findKey(p, C) || "text"]($, v);
|
|
2277
|
+
return !k && P && P(), await new Promise((q, N) => {
|
|
2278
|
+
Zu(q, N, {
|
|
2279
2279
|
data: z,
|
|
2280
|
-
headers: Xt.from(
|
|
2281
|
-
status:
|
|
2282
|
-
statusText:
|
|
2280
|
+
headers: Xt.from($.headers),
|
|
2281
|
+
status: $.status,
|
|
2282
|
+
statusText: $.statusText,
|
|
2283
2283
|
config: v,
|
|
2284
2284
|
request: Y
|
|
2285
2285
|
});
|
|
@@ -3062,14 +3062,14 @@ function ow(e) {
|
|
|
3062
3062
|
return !!e && typeof e == "object" && "data" in e;
|
|
3063
3063
|
}
|
|
3064
3064
|
function sw(e = {}) {
|
|
3065
|
-
const t = e.baseUrl || "", n = e.streamPath ?? "/runs/stream", [r, o] = fe(e.token ?? null), s = Re(e.headers ?? {}), a = e.credentials ?? "include", [i, l] = fe(!1), [c, d] = fe(null), [p, m] = fe(""), [f, v] = fe(null), [g, x] = fe(0), [b, w] = fe(!1), [S, E] = fe(null), T = Re(null), y = Re(!0), C = Re(0),
|
|
3065
|
+
const t = e.baseUrl || "", n = e.streamPath ?? "/runs/stream", [r, o] = fe(e.token ?? null), s = Re(e.headers ?? {}), a = e.credentials ?? "include", [i, l] = fe(!1), [c, d] = fe(null), [p, m] = fe(""), [f, v] = fe(null), [g, x] = fe(0), [b, w] = fe(!1), [S, E] = fe(null), T = Re(null), y = Re(!0), C = Re(0), I = Re(null), A = Re(null), D = Re(null), M = Re(null), H = Re({
|
|
3066
3066
|
messageId: null,
|
|
3067
3067
|
lastSeq: null,
|
|
3068
3068
|
lastText: ""
|
|
3069
3069
|
}), Y = le((Z) => {
|
|
3070
3070
|
o(Z);
|
|
3071
3071
|
}, []), P = le(() => {
|
|
3072
|
-
m(""), v(null), d(null), A.current = null,
|
|
3072
|
+
m(""), v(null), d(null), A.current = null, D.current = null, M.current = null, E(null), H.current = {
|
|
3073
3073
|
messageId: null,
|
|
3074
3074
|
lastSeq: null,
|
|
3075
3075
|
lastText: ""
|
|
@@ -3077,28 +3077,28 @@ function sw(e = {}) {
|
|
|
3077
3077
|
}, []), V = le(() => {
|
|
3078
3078
|
var z;
|
|
3079
3079
|
console.debug("[use-chat] stop() invoked - aborting stream");
|
|
3080
|
-
const Z = (z =
|
|
3080
|
+
const Z = (z = I.current) == null ? void 0 : z.threadId, $ = () => {
|
|
3081
3081
|
var q;
|
|
3082
|
-
(q = T.current) == null || q.abort(), T.current = null,
|
|
3082
|
+
(q = T.current) == null || q.abort(), T.current = null, I.current = null, l(!1), w(!1), C.current = 0, x(0);
|
|
3083
3083
|
};
|
|
3084
3084
|
(Z ? or.cancelRun(Z).catch((q) => {
|
|
3085
3085
|
console.warn("[use-chat] cancel run failed:", q);
|
|
3086
|
-
}) : Promise.resolve()).finally(
|
|
3086
|
+
}) : Promise.resolve()).finally($);
|
|
3087
3087
|
}, []), X = le(
|
|
3088
|
-
(Z,
|
|
3089
|
-
T.current && (T.current.abort(), T.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && m(""), v(null), A.current = null,
|
|
3088
|
+
(Z, $, k) => {
|
|
3089
|
+
T.current && (T.current.abort(), T.current = null), l(!0), d(null), e.autoAppendAssistant !== !1 && m(""), v(null), A.current = null, D.current = null, M.current = null, E(null), H.current = {
|
|
3090
3090
|
messageId: null,
|
|
3091
3091
|
lastSeq: null,
|
|
3092
3092
|
lastText: ""
|
|
3093
3093
|
};
|
|
3094
3094
|
const z = new AbortController();
|
|
3095
3095
|
T.current = z;
|
|
3096
|
-
let q = null,
|
|
3097
|
-
return
|
|
3096
|
+
let q = null, N = null, F = !1;
|
|
3097
|
+
return I.current = {
|
|
3098
3098
|
threadId: Z.threadId ?? null,
|
|
3099
3099
|
headers: {}
|
|
3100
3100
|
}, (async () => {
|
|
3101
|
-
var O, _, K,
|
|
3101
|
+
var O, _, K, L, j, U, Q, ne, J, de, ve, Ae, qe, Me, Ye, $e, mt, gt;
|
|
3102
3102
|
try {
|
|
3103
3103
|
let Ke = {};
|
|
3104
3104
|
try {
|
|
@@ -3121,7 +3121,7 @@ function sw(e = {}) {
|
|
|
3121
3121
|
let Be = {};
|
|
3122
3122
|
if (typeof window < "u")
|
|
3123
3123
|
try {
|
|
3124
|
-
const Ve = (
|
|
3124
|
+
const Ve = (L = window.localStorage) == null ? void 0 : L.getItem("authSessionId");
|
|
3125
3125
|
Ve && (Be = { "X-Session-Id": Ve });
|
|
3126
3126
|
} catch {
|
|
3127
3127
|
}
|
|
@@ -3140,7 +3140,7 @@ function sw(e = {}) {
|
|
|
3140
3140
|
signal: z.signal,
|
|
3141
3141
|
credentials: a
|
|
3142
3142
|
});
|
|
3143
|
-
if (
|
|
3143
|
+
if (I.current && (I.current.headers = Ue), !Ne.ok || !Ne.body) {
|
|
3144
3144
|
const Ve = await Ne.text().catch(() => "");
|
|
3145
3145
|
console.debug(
|
|
3146
3146
|
"[use-chat] non-OK response",
|
|
@@ -3148,7 +3148,7 @@ function sw(e = {}) {
|
|
|
3148
3148
|
Ve == null ? void 0 : Ve.slice(0, 500)
|
|
3149
3149
|
);
|
|
3150
3150
|
const Xe = `stream ${Ne.status}${Ve ? ": " + Ve : ""}`;
|
|
3151
|
-
throw (j = k == null ? void 0 : k.onConnectionError) == null || j.call(k, Xe),
|
|
3151
|
+
throw (j = k == null ? void 0 : k.onConnectionError) == null || j.call(k, Xe), F = !0, q = "error", N = Xe, new Error(Xe);
|
|
3152
3152
|
}
|
|
3153
3153
|
w(!0);
|
|
3154
3154
|
const Qe = Ne.body.getReader(), lt = new TextDecoder();
|
|
@@ -3169,13 +3169,13 @@ function sw(e = {}) {
|
|
|
3169
3169
|
var Ve;
|
|
3170
3170
|
if (Date.now() - jt > 18e5) {
|
|
3171
3171
|
const Xe = "Stream idle timeout";
|
|
3172
|
-
d(Xe), q = "error",
|
|
3172
|
+
d(Xe), q = "error", N = Xe, z.abort(), (Ve = k == null ? void 0 : k.onError) == null || Ve.call(k, Xe);
|
|
3173
3173
|
}
|
|
3174
3174
|
}, 5e3), bt = 1024 * 1024;
|
|
3175
3175
|
try {
|
|
3176
3176
|
const Ve = Ne.headers.get("X-Thread-Id") || Ne.headers.get("x-thread-id"), Xe = Ne.headers.get("X-Thread-Created") || Ne.headers.get("x-thread-created"), ct = Ve ?? null, vt = String(Xe ?? "").toLowerCase() === "true";
|
|
3177
|
-
for (
|
|
3178
|
-
...
|
|
3177
|
+
for (I.current && !I.current.threadId && (I.current = {
|
|
3178
|
+
...I.current,
|
|
3179
3179
|
threadId: ct
|
|
3180
3180
|
}), (U = k == null ? void 0 : k.onOpen) == null || U.call(k, { threadId: ct, created: vt }); ; ) {
|
|
3181
3181
|
const { value: Rt, done: pt } = await Qe.read();
|
|
@@ -3233,18 +3233,18 @@ function sw(e = {}) {
|
|
|
3233
3233
|
wt > 0 && se > wt + 1 && ((Q = k == null ? void 0 : k.onGap) == null || Q.call(k, { from: wt, to: se })), wt = se, C.current = se, x(se);
|
|
3234
3234
|
}
|
|
3235
3235
|
if (W.type === "checkpoint")
|
|
3236
|
-
A.current = W.checkpointId ?? null,
|
|
3236
|
+
A.current = W.checkpointId ?? null, D.current = W.checkpointNs ?? null, v(W.checkpointId ?? null);
|
|
3237
3237
|
else if (W.type === "state_history") {
|
|
3238
3238
|
M.current = W;
|
|
3239
3239
|
try {
|
|
3240
3240
|
const pe = Tr(W).latest;
|
|
3241
|
-
pe && (A.current = pe.checkpointId ?? null,
|
|
3241
|
+
pe && (A.current = pe.checkpointId ?? null, D.current = pe.checkpointNs ?? null, v(pe.checkpointId ?? null));
|
|
3242
3242
|
} catch (ae) {
|
|
3243
3243
|
console.warn("[use-chat] Failed to hydrate state_history payload", ae);
|
|
3244
3244
|
}
|
|
3245
3245
|
}
|
|
3246
3246
|
try {
|
|
3247
|
-
|
|
3247
|
+
$ == null || $(W);
|
|
3248
3248
|
} catch (ae) {
|
|
3249
3249
|
console.error("[use-chat] Error in onEvent callback:", ae, "for event:", W.type);
|
|
3250
3250
|
}
|
|
@@ -3298,7 +3298,7 @@ function sw(e = {}) {
|
|
|
3298
3298
|
call_id: pe.id
|
|
3299
3299
|
};
|
|
3300
3300
|
try {
|
|
3301
|
-
|
|
3301
|
+
$ == null || $(tt);
|
|
3302
3302
|
} catch (R) {
|
|
3303
3303
|
console.error("[use-chat] Error in onEvent (tool.start polyfill):", R);
|
|
3304
3304
|
}
|
|
@@ -3313,7 +3313,7 @@ function sw(e = {}) {
|
|
|
3313
3313
|
call_id: pe.id
|
|
3314
3314
|
};
|
|
3315
3315
|
try {
|
|
3316
|
-
|
|
3316
|
+
$ == null || $(tt);
|
|
3317
3317
|
} catch (R) {
|
|
3318
3318
|
console.error("[use-chat] Error in onEvent (tool.end polyfill):", R);
|
|
3319
3319
|
}
|
|
@@ -3331,7 +3331,7 @@ function sw(e = {}) {
|
|
|
3331
3331
|
v(W.checkpointId);
|
|
3332
3332
|
else if (W.type === "error") {
|
|
3333
3333
|
const ae = W;
|
|
3334
|
-
if (d(ae.message), q = "error",
|
|
3334
|
+
if (d(ae.message), q = "error", N = ae.message, ae.error_type === "auth_error" || ae.code === "TOKEN_EXPIRED" || ((J = ae.message) == null ? void 0 : J.includes("token")) || ((de = ae.message) == null ? void 0 : de.includes("401")) || ((ve = ae.message) == null ? void 0 : ve.includes("unauthorized")) || ((Ae = ae.message) == null ? void 0 : Ae.includes("Unauthorized"))) {
|
|
3335
3335
|
console.error("[use-chat] Auth error detected:", ae.message);
|
|
3336
3336
|
try {
|
|
3337
3337
|
(qe = k == null ? void 0 : k.onAuthError) == null || qe.call(k, ae.message);
|
|
@@ -3349,7 +3349,7 @@ function sw(e = {}) {
|
|
|
3349
3349
|
q = q ?? "aborted";
|
|
3350
3350
|
else {
|
|
3351
3351
|
const Xe = Ve.message || String(Ve);
|
|
3352
|
-
q = "error",
|
|
3352
|
+
q = "error", N = Xe, d(Xe), (Me = k == null ? void 0 : k.onError) == null || Me.call(k, Xe);
|
|
3353
3353
|
}
|
|
3354
3354
|
} finally {
|
|
3355
3355
|
try {
|
|
@@ -3365,10 +3365,10 @@ function sw(e = {}) {
|
|
|
3365
3365
|
q = q ?? "aborted";
|
|
3366
3366
|
else {
|
|
3367
3367
|
const Be = Ke.message || String(Ke);
|
|
3368
|
-
q = "error",
|
|
3368
|
+
q = "error", N = Be, d(Be), ($e = k == null ? void 0 : k.onError) == null || $e.call(k, Be), F || ((mt = k == null ? void 0 : k.onConnectionError) == null || mt.call(k, Be), F = !0);
|
|
3369
3369
|
}
|
|
3370
3370
|
} finally {
|
|
3371
|
-
const Ke = C.current, Be = A.current, Ue =
|
|
3371
|
+
const Ke = C.current, Be = A.current, Ue = D.current, ft = M.current, Ne = q ?? (z.signal.aborted ? "aborted" : N ? "error" : "complete");
|
|
3372
3372
|
try {
|
|
3373
3373
|
(gt = k == null ? void 0 : k.onClosed) == null || gt.call(k, {
|
|
3374
3374
|
reason: Ne,
|
|
@@ -3376,12 +3376,12 @@ function sw(e = {}) {
|
|
|
3376
3376
|
lastCheckpointId: Be,
|
|
3377
3377
|
lastCheckpointNs: Ue,
|
|
3378
3378
|
lastStateHistory: ft,
|
|
3379
|
-
error:
|
|
3379
|
+
error: N
|
|
3380
3380
|
});
|
|
3381
3381
|
} catch (Qe) {
|
|
3382
3382
|
console.warn("[use-chat] onClosed callback failed", Qe);
|
|
3383
3383
|
}
|
|
3384
|
-
l(!1), w(!1), T.current = null, C.current = 0, x(0),
|
|
3384
|
+
l(!1), w(!1), T.current = null, C.current = 0, x(0), I.current = null;
|
|
3385
3385
|
}
|
|
3386
3386
|
})(), { close: () => z.abort() };
|
|
3387
3387
|
},
|
|
@@ -3460,13 +3460,13 @@ function lw({
|
|
|
3460
3460
|
}, [i]), Fe(() => {
|
|
3461
3461
|
t !== void 0 && t !== y.current && l(t);
|
|
3462
3462
|
}, [t]);
|
|
3463
|
-
const
|
|
3463
|
+
const I = le(async () => {
|
|
3464
3464
|
d(!0), m(null);
|
|
3465
3465
|
try {
|
|
3466
|
-
const
|
|
3467
|
-
a(
|
|
3468
|
-
} catch (
|
|
3469
|
-
const k = String(
|
|
3466
|
+
const $ = await e.listThreads();
|
|
3467
|
+
a($ ?? []);
|
|
3468
|
+
} catch ($) {
|
|
3469
|
+
const k = String($);
|
|
3470
3470
|
m(k), n == null || n(k);
|
|
3471
3471
|
} finally {
|
|
3472
3472
|
d(!1);
|
|
@@ -3474,64 +3474,64 @@ function lw({
|
|
|
3474
3474
|
}, [e, n]), A = le(async () => {
|
|
3475
3475
|
x(!0), b(null);
|
|
3476
3476
|
try {
|
|
3477
|
-
const
|
|
3478
|
-
v(
|
|
3479
|
-
} catch (
|
|
3480
|
-
const k = String(
|
|
3477
|
+
const $ = await e.listSharedThreads();
|
|
3478
|
+
v($ ?? []);
|
|
3479
|
+
} catch ($) {
|
|
3480
|
+
const k = String($);
|
|
3481
3481
|
b(k), n == null || n(k);
|
|
3482
3482
|
} finally {
|
|
3483
3483
|
x(!1);
|
|
3484
3484
|
}
|
|
3485
3485
|
}, [e, n]);
|
|
3486
3486
|
Fe(() => {
|
|
3487
|
-
|
|
3488
|
-
}, [
|
|
3487
|
+
I();
|
|
3488
|
+
}, [I]), Fe(() => {
|
|
3489
3489
|
A();
|
|
3490
3490
|
}, [A]), Fe(() => {
|
|
3491
3491
|
r == null || r(i);
|
|
3492
3492
|
}, [i, r]);
|
|
3493
|
-
const
|
|
3494
|
-
async (
|
|
3493
|
+
const D = le(
|
|
3494
|
+
async ($, k) => {
|
|
3495
3495
|
try {
|
|
3496
|
-
const z = await e.createThread(
|
|
3497
|
-
return l(z.threadId), await
|
|
3496
|
+
const z = await e.createThread($, k);
|
|
3497
|
+
return l(z.threadId), await I(), z.threadId;
|
|
3498
3498
|
} catch (z) {
|
|
3499
3499
|
const q = String(z);
|
|
3500
3500
|
return n == null || n(q), null;
|
|
3501
3501
|
}
|
|
3502
3502
|
},
|
|
3503
|
-
[e, n,
|
|
3503
|
+
[e, n, I]
|
|
3504
3504
|
), M = le(
|
|
3505
|
-
async (
|
|
3505
|
+
async ($) => {
|
|
3506
3506
|
const k = s;
|
|
3507
|
-
a((q) => q.filter((
|
|
3507
|
+
a((q) => q.filter((N) => N.threadId !== $));
|
|
3508
3508
|
const z = new AbortController();
|
|
3509
|
-
C.current.set(
|
|
3509
|
+
C.current.set($, z);
|
|
3510
3510
|
try {
|
|
3511
|
-
await e.deleteThread(
|
|
3511
|
+
await e.deleteThread($), y.current === $ && (l(null), o == null || o());
|
|
3512
3512
|
} catch (q) {
|
|
3513
3513
|
a(k);
|
|
3514
|
-
const
|
|
3515
|
-
n == null || n(
|
|
3514
|
+
const N = String(q);
|
|
3515
|
+
n == null || n(N);
|
|
3516
3516
|
} finally {
|
|
3517
|
-
C.current.delete(
|
|
3517
|
+
C.current.delete($);
|
|
3518
3518
|
}
|
|
3519
3519
|
},
|
|
3520
3520
|
[e, o, n, s]
|
|
3521
3521
|
), H = le(
|
|
3522
|
-
async (
|
|
3522
|
+
async ($, k) => {
|
|
3523
3523
|
try {
|
|
3524
|
-
await e.updateThread(
|
|
3524
|
+
await e.updateThread($, k), await I();
|
|
3525
3525
|
} catch (z) {
|
|
3526
3526
|
n == null || n(String(z));
|
|
3527
3527
|
}
|
|
3528
3528
|
},
|
|
3529
|
-
[e, n,
|
|
3529
|
+
[e, n, I]
|
|
3530
3530
|
), Y = le(
|
|
3531
|
-
async (
|
|
3531
|
+
async ($, k) => {
|
|
3532
3532
|
T(!0), S("Sharing thread…");
|
|
3533
3533
|
try {
|
|
3534
|
-
await e.shareThread(
|
|
3534
|
+
await e.shareThread($, k), await A(), S("Shared successfully");
|
|
3535
3535
|
} catch (z) {
|
|
3536
3536
|
const q = iw(z);
|
|
3537
3537
|
throw n == null || n(q), S(`Failed to share: ${q}`), new Error(q);
|
|
@@ -3541,9 +3541,9 @@ function lw({
|
|
|
3541
3541
|
},
|
|
3542
3542
|
[e, n, A]
|
|
3543
3543
|
), P = le(
|
|
3544
|
-
async (
|
|
3544
|
+
async ($, k) => {
|
|
3545
3545
|
try {
|
|
3546
|
-
await e.unshareThread(
|
|
3546
|
+
await e.unshareThread($, k), await A();
|
|
3547
3547
|
} catch (z) {
|
|
3548
3548
|
const q = String(z);
|
|
3549
3549
|
throw n == null || n(q), z;
|
|
@@ -3552,35 +3552,35 @@ function lw({
|
|
|
3552
3552
|
[e, n, A]
|
|
3553
3553
|
), V = He(
|
|
3554
3554
|
() => ({
|
|
3555
|
-
createThread:
|
|
3555
|
+
createThread: D,
|
|
3556
3556
|
deleteThread: M,
|
|
3557
3557
|
renameThread: H,
|
|
3558
|
-
refreshThreads:
|
|
3558
|
+
refreshThreads: I,
|
|
3559
3559
|
refreshSharedThreads: A,
|
|
3560
3560
|
shareThread: Y,
|
|
3561
3561
|
unshareThread: P
|
|
3562
3562
|
}),
|
|
3563
|
-
[
|
|
3564
|
-
), X = le((
|
|
3565
|
-
if (!(
|
|
3563
|
+
[D, M, H, I, A, Y, P]
|
|
3564
|
+
), X = le(($) => {
|
|
3565
|
+
if (!($ != null && $.threadId)) return;
|
|
3566
3566
|
const k = {
|
|
3567
|
-
threadId:
|
|
3568
|
-
title:
|
|
3569
|
-
project:
|
|
3570
|
-
createdAt:
|
|
3571
|
-
updatedAt:
|
|
3572
|
-
messageCount:
|
|
3567
|
+
threadId: $.threadId,
|
|
3568
|
+
title: $.title || `Thread ${$.threadId.slice(0, 8)}`,
|
|
3569
|
+
project: $.project,
|
|
3570
|
+
createdAt: $.createdAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3571
|
+
updatedAt: $.updatedAt || (/* @__PURE__ */ new Date()).toISOString(),
|
|
3572
|
+
messageCount: $.messageCount ?? 1
|
|
3573
3573
|
};
|
|
3574
3574
|
a((z) => {
|
|
3575
3575
|
let q = !1;
|
|
3576
|
-
const
|
|
3577
|
-
|
|
3578
|
-
title: k.title ??
|
|
3579
|
-
project: k.project ??
|
|
3580
|
-
updatedAt: k.updatedAt ??
|
|
3581
|
-
messageCount: k.messageCount ??
|
|
3582
|
-
}) :
|
|
3583
|
-
return q ?
|
|
3576
|
+
const N = z.map((F) => F.threadId === k.threadId ? (q = !0, console.debug("[useThreadsState] thread_info: updating existing thread", k.threadId), {
|
|
3577
|
+
...F,
|
|
3578
|
+
title: k.title ?? F.title,
|
|
3579
|
+
project: k.project ?? F.project,
|
|
3580
|
+
updatedAt: k.updatedAt ?? F.updatedAt,
|
|
3581
|
+
messageCount: k.messageCount ?? F.messageCount
|
|
3582
|
+
}) : F);
|
|
3583
|
+
return q ? N : (console.debug("[useThreadsState] thread_info: adding thread to list", k.threadId), [k, ...z]);
|
|
3584
3584
|
});
|
|
3585
3585
|
}, []), Z = le(() => S(null), []);
|
|
3586
3586
|
return {
|
|
@@ -4179,13 +4179,13 @@ function Aw({
|
|
|
4179
4179
|
const [d, p] = fe(null), f = He(
|
|
4180
4180
|
() => Tr(d),
|
|
4181
4181
|
[d]
|
|
4182
|
-
).checkpoints, v = cx(f), g = v.timeline, [x, b] = fe(!1), [w, S] = fe(!1), [E, T] = fe(null), y = Re(r), C = Re(null),
|
|
4182
|
+
).checkpoints, v = cx(f), g = v.timeline, [x, b] = fe(!1), [w, S] = fe(!1), [E, T] = fe(null), y = Re(r), C = Re(null), I = Re(null), A = Re(null), D = Re(null), M = Re(null), H = Re(/* @__PURE__ */ new Map()), Y = Re(null);
|
|
4183
4183
|
Fe(() => {
|
|
4184
4184
|
y.current = r;
|
|
4185
4185
|
}, [r]);
|
|
4186
4186
|
const P = le(
|
|
4187
4187
|
async (O) => {
|
|
4188
|
-
var K,
|
|
4188
|
+
var K, L;
|
|
4189
4189
|
if (!O.threadId) return;
|
|
4190
4190
|
const _ = O.threadId;
|
|
4191
4191
|
(K = O.onStart) == null || K.call(O), O.setLoading(!0);
|
|
@@ -4194,7 +4194,7 @@ function Aw({
|
|
|
4194
4194
|
} catch (j) {
|
|
4195
4195
|
if (!hc(j) && y.current === _) {
|
|
4196
4196
|
const Q = String(j);
|
|
4197
|
-
(
|
|
4197
|
+
(L = O.handleError) == null || L.call(O, Q), n == null || n(Q);
|
|
4198
4198
|
}
|
|
4199
4199
|
throw j;
|
|
4200
4200
|
} finally {
|
|
@@ -4206,9 +4206,9 @@ function Aw({
|
|
|
4206
4206
|
async (O, _) => {
|
|
4207
4207
|
var Q;
|
|
4208
4208
|
if (!O) return;
|
|
4209
|
-
const K = `${O}:${_ ?? "latest"}`,
|
|
4210
|
-
if (
|
|
4211
|
-
return
|
|
4209
|
+
const K = `${O}:${_ ?? "latest"}`, L = H.current.get(K);
|
|
4210
|
+
if (L)
|
|
4211
|
+
return L;
|
|
4212
4212
|
(Q = Y.current) == null || Q.abort();
|
|
4213
4213
|
const j = new AbortController();
|
|
4214
4214
|
Y.current = j;
|
|
@@ -4248,20 +4248,20 @@ function Aw({
|
|
|
4248
4248
|
[e, t, P]
|
|
4249
4249
|
), X = le(
|
|
4250
4250
|
async (O, _) => {
|
|
4251
|
-
|
|
4251
|
+
D.current = O;
|
|
4252
4252
|
try {
|
|
4253
4253
|
await V(O, _);
|
|
4254
4254
|
} catch (K) {
|
|
4255
4255
|
if (!hc(K))
|
|
4256
4256
|
throw K;
|
|
4257
4257
|
} finally {
|
|
4258
|
-
|
|
4258
|
+
D.current === O && (D.current = null);
|
|
4259
4259
|
}
|
|
4260
4260
|
},
|
|
4261
4261
|
[V]
|
|
4262
4262
|
), Z = le((O) => {
|
|
4263
|
-
|
|
4264
|
-
}, []),
|
|
4263
|
+
I.current = O;
|
|
4264
|
+
}, []), $ = le((O) => {
|
|
4265
4265
|
A.current = O;
|
|
4266
4266
|
}, []), k = le(
|
|
4267
4267
|
(O) => {
|
|
@@ -4271,12 +4271,12 @@ function Aw({
|
|
|
4271
4271
|
const { checkpoints: K } = Tr(O);
|
|
4272
4272
|
if (!K.length)
|
|
4273
4273
|
return;
|
|
4274
|
-
const
|
|
4275
|
-
!l && !j && t((
|
|
4276
|
-
checkpointId: (
|
|
4277
|
-
checkpointNs: (
|
|
4278
|
-
pendingInterrupt: (
|
|
4279
|
-
}), p(O), M.current = `${_}:latest`,
|
|
4274
|
+
const L = K.find((U) => U.messages && U.messages.length > 0) ?? K.find((U) => !!U.checkpointId) ?? K[0], j = A.current === _;
|
|
4275
|
+
!l && !j && t((L == null ? void 0 : L.messages) ?? [], {
|
|
4276
|
+
checkpointId: (L == null ? void 0 : L.checkpointId) ?? null,
|
|
4277
|
+
checkpointNs: (L == null ? void 0 : L.checkpointNs) ?? null,
|
|
4278
|
+
pendingInterrupt: (L == null ? void 0 : L.interrupt) ?? null
|
|
4279
|
+
}), p(O), M.current = `${_}:latest`, I.current = null, A.current === _ && (A.current = null);
|
|
4280
4280
|
},
|
|
4281
4281
|
[t, l]
|
|
4282
4282
|
), z = le(
|
|
@@ -4285,13 +4285,13 @@ function Aw({
|
|
|
4285
4285
|
await P({
|
|
4286
4286
|
threadId: K,
|
|
4287
4287
|
setLoading: S,
|
|
4288
|
-
action: async (
|
|
4288
|
+
action: async (L) => {
|
|
4289
4289
|
const j = await e.getStateHistory({
|
|
4290
|
-
threadId:
|
|
4290
|
+
threadId: L,
|
|
4291
4291
|
checkpointId: O,
|
|
4292
4292
|
checkpointNs: _ ?? void 0
|
|
4293
4293
|
});
|
|
4294
|
-
if (y.current !==
|
|
4294
|
+
if (y.current !== L)
|
|
4295
4295
|
return;
|
|
4296
4296
|
const { checkpoints: U } = Tr(j), Q = U.find(
|
|
4297
4297
|
(ne) => ne.checkpointId === O && (_ ? ne.checkpointNs === _ : !0)
|
|
@@ -4317,22 +4317,22 @@ function Aw({
|
|
|
4317
4317
|
});
|
|
4318
4318
|
},
|
|
4319
4319
|
[c, t]
|
|
4320
|
-
),
|
|
4320
|
+
), N = le(async () => {
|
|
4321
4321
|
y.current && await X(y.current);
|
|
4322
4322
|
}, [X]);
|
|
4323
4323
|
Fe(() => {
|
|
4324
4324
|
if (!i || !r || x || l)
|
|
4325
4325
|
return;
|
|
4326
|
-
if (
|
|
4327
|
-
|
|
4326
|
+
if (I.current === r) {
|
|
4327
|
+
I.current = null, C.current = r;
|
|
4328
4328
|
return;
|
|
4329
4329
|
}
|
|
4330
4330
|
if (A.current === r) {
|
|
4331
4331
|
C.current = r;
|
|
4332
4332
|
return;
|
|
4333
4333
|
}
|
|
4334
|
-
if (
|
|
4335
|
-
|
|
4334
|
+
if (D.current === r) {
|
|
4335
|
+
D.current = null, C.current = r;
|
|
4336
4336
|
return;
|
|
4337
4337
|
}
|
|
4338
4338
|
if (C.current === r)
|
|
@@ -4351,8 +4351,8 @@ function Aw({
|
|
|
4351
4351
|
l,
|
|
4352
4352
|
X
|
|
4353
4353
|
]);
|
|
4354
|
-
const
|
|
4355
|
-
p(null), b(!1), S(!1), T(null),
|
|
4354
|
+
const F = le(() => {
|
|
4355
|
+
p(null), b(!1), S(!1), T(null), I.current = null, A.current = null, C.current = null, M.current = null, D.current = null;
|
|
4356
4356
|
}, []);
|
|
4357
4357
|
return {
|
|
4358
4358
|
threadCheckpoints: f,
|
|
@@ -4364,11 +4364,11 @@ function Aw({
|
|
|
4364
4364
|
loadThread: X,
|
|
4365
4365
|
navigateToCheckpoint: z,
|
|
4366
4366
|
setCurrentCheckpointId: q,
|
|
4367
|
-
returnToLatest:
|
|
4367
|
+
returnToLatest: N,
|
|
4368
4368
|
handleStateHistoryEvent: k,
|
|
4369
4369
|
markSkipNextLoad: Z,
|
|
4370
|
-
markStreamPendingThread:
|
|
4371
|
-
resetHistoryState:
|
|
4370
|
+
markStreamPendingThread: $,
|
|
4371
|
+
resetHistoryState: F
|
|
4372
4372
|
};
|
|
4373
4373
|
}
|
|
4374
4374
|
const gd = Dr(null), xd = Dr(null);
|
|
@@ -4404,9 +4404,9 @@ function jw({
|
|
|
4404
4404
|
setCurrentCheckpointId: T,
|
|
4405
4405
|
returnToLatest: y,
|
|
4406
4406
|
handleStateHistoryEvent: C,
|
|
4407
|
-
markSkipNextLoad:
|
|
4407
|
+
markSkipNextLoad: I,
|
|
4408
4408
|
markStreamPendingThread: A,
|
|
4409
|
-
resetHistoryState:
|
|
4409
|
+
resetHistoryState: D
|
|
4410
4410
|
} = Aw({
|
|
4411
4411
|
api: i,
|
|
4412
4412
|
seed: d,
|
|
@@ -4428,15 +4428,15 @@ function jw({
|
|
|
4428
4428
|
}
|
|
4429
4429
|
);
|
|
4430
4430
|
Fe(() => {
|
|
4431
|
-
l || (d([], {}),
|
|
4432
|
-
}, [l, d,
|
|
4431
|
+
l || (d([], {}), D());
|
|
4432
|
+
}, [l, d, D]);
|
|
4433
4433
|
const V = le(
|
|
4434
4434
|
(z) => H(() => z),
|
|
4435
4435
|
[]
|
|
4436
4436
|
), X = le(
|
|
4437
4437
|
(z) => P(() => z),
|
|
4438
4438
|
[]
|
|
4439
|
-
), Z = He(() => ({ assemblingMessageId: c.assemblingId ?? null }), [c.assemblingId]),
|
|
4439
|
+
), Z = He(() => ({ assemblingMessageId: c.assemblingId ?? null }), [c.assemblingId]), $ = He(
|
|
4440
4440
|
() => ({
|
|
4441
4441
|
threadId: l,
|
|
4442
4442
|
messages: c.messages,
|
|
@@ -4461,9 +4461,9 @@ function jw({
|
|
|
4461
4461
|
respondToInterrupt: Y,
|
|
4462
4462
|
messagePreviews: g.messagePreviews,
|
|
4463
4463
|
handleStateHistoryEvent: C,
|
|
4464
|
-
markSkipNextLoad:
|
|
4464
|
+
markSkipNextLoad: I,
|
|
4465
4465
|
markStreamPendingThread: A,
|
|
4466
|
-
resetHistoryState:
|
|
4466
|
+
resetHistoryState: D,
|
|
4467
4467
|
pushUser: p,
|
|
4468
4468
|
onEvent: m
|
|
4469
4469
|
}),
|
|
@@ -4485,9 +4485,9 @@ function jw({
|
|
|
4485
4485
|
Y,
|
|
4486
4486
|
g.messagePreviews,
|
|
4487
4487
|
C,
|
|
4488
|
-
|
|
4488
|
+
I,
|
|
4489
4489
|
A,
|
|
4490
|
-
|
|
4490
|
+
D,
|
|
4491
4491
|
p,
|
|
4492
4492
|
m
|
|
4493
4493
|
]
|
|
@@ -4498,7 +4498,7 @@ function jw({
|
|
|
4498
4498
|
}),
|
|
4499
4499
|
[V, X]
|
|
4500
4500
|
);
|
|
4501
|
-
return /* @__PURE__ */ u.jsx(xd.Provider, { value: k, children: /* @__PURE__ */ u.jsx(gd.Provider, { value:
|
|
4501
|
+
return /* @__PURE__ */ u.jsx(xd.Provider, { value: k, children: /* @__PURE__ */ u.jsx(gd.Provider, { value: $, children: e }) });
|
|
4502
4502
|
}
|
|
4503
4503
|
function wc(e, t) {
|
|
4504
4504
|
if (!e) return null;
|
|
@@ -4598,9 +4598,9 @@ function Lw({
|
|
|
4598
4598
|
markSkipNextLoad: T,
|
|
4599
4599
|
markStreamPendingThread: y,
|
|
4600
4600
|
resetHistoryState: C,
|
|
4601
|
-
pushUser:
|
|
4601
|
+
pushUser: I,
|
|
4602
4602
|
onEvent: A
|
|
4603
|
-
} = Bs(), { registerClearThread:
|
|
4603
|
+
} = Bs(), { registerClearThread: D, registerRespondToInterrupt: M } = Pw(), H = le(
|
|
4604
4604
|
(z) => {
|
|
4605
4605
|
x(z), g.current !== z.threadId && ((z.created ?? !g.current) && T(z.threadId), y(z.threadId), v(z.threadId));
|
|
4606
4606
|
},
|
|
@@ -4612,17 +4612,17 @@ function Lw({
|
|
|
4612
4612
|
[H, E, A, a]
|
|
4613
4613
|
), P = le(
|
|
4614
4614
|
(z, q) => {
|
|
4615
|
-
i(z, (
|
|
4616
|
-
Y(
|
|
4615
|
+
i(z, (N) => {
|
|
4616
|
+
Y(N), q == null || q(N);
|
|
4617
4617
|
}, {
|
|
4618
|
-
onError: (
|
|
4619
|
-
console.error("[StreamingProvider] Stream error:",
|
|
4618
|
+
onError: (N) => {
|
|
4619
|
+
console.error("[StreamingProvider] Stream error:", N), r == null || r(N);
|
|
4620
4620
|
},
|
|
4621
|
-
onAuthError: (
|
|
4622
|
-
console.error("[StreamingProvider] Auth error:",
|
|
4621
|
+
onAuthError: (N) => {
|
|
4622
|
+
console.error("[StreamingProvider] Auth error:", N), o == null || o(N);
|
|
4623
4623
|
},
|
|
4624
|
-
onConnectionError: (
|
|
4625
|
-
console.error("[StreamingProvider] Connection error:",
|
|
4624
|
+
onConnectionError: (N) => {
|
|
4625
|
+
console.error("[StreamingProvider] Connection error:", N), s == null || s(N);
|
|
4626
4626
|
}
|
|
4627
4627
|
});
|
|
4628
4628
|
},
|
|
@@ -4632,20 +4632,20 @@ function Lw({
|
|
|
4632
4632
|
V.current = w;
|
|
4633
4633
|
}, [w]);
|
|
4634
4634
|
const X = le(
|
|
4635
|
-
async (z, q,
|
|
4636
|
-
const
|
|
4637
|
-
if (
|
|
4635
|
+
async (z, q, N) => {
|
|
4636
|
+
const F = g.current;
|
|
4637
|
+
if (!F)
|
|
4638
4638
|
throw new Error("No active thread to handle interrupt");
|
|
4639
4639
|
const O = z ? q ?? !0 : !1, _ = V.current, K = {
|
|
4640
|
-
threadId:
|
|
4640
|
+
threadId: F,
|
|
4641
4641
|
checkpointId: _.id ?? void 0,
|
|
4642
4642
|
checkpointNs: _.namespace ?? void 0,
|
|
4643
4643
|
command: { kind: "resume", value: O },
|
|
4644
|
-
payload:
|
|
4645
|
-
config:
|
|
4646
|
-
nodeFilter:
|
|
4647
|
-
branchLabel:
|
|
4648
|
-
timelineCheckpoints:
|
|
4644
|
+
payload: N == null ? void 0 : N.payload,
|
|
4645
|
+
config: N == null ? void 0 : N.config,
|
|
4646
|
+
nodeFilter: N == null ? void 0 : N.nodeFilter,
|
|
4647
|
+
branchLabel: N == null ? void 0 : N.branchLabel,
|
|
4648
|
+
timelineCheckpoints: N == null ? void 0 : N.timelineCheckpoints
|
|
4649
4649
|
};
|
|
4650
4650
|
P(K);
|
|
4651
4651
|
},
|
|
@@ -4658,24 +4658,24 @@ function Lw({
|
|
|
4658
4658
|
l(), c(), C(), v(null);
|
|
4659
4659
|
}, [c, C, v, l]);
|
|
4660
4660
|
Fe(() => {
|
|
4661
|
-
|
|
4662
|
-
}, [Z,
|
|
4663
|
-
const
|
|
4661
|
+
D(Z);
|
|
4662
|
+
}, [Z, D]);
|
|
4663
|
+
const $ = le(
|
|
4664
4664
|
async (z, q) => {
|
|
4665
4665
|
d && l();
|
|
4666
|
-
let
|
|
4667
|
-
const
|
|
4668
|
-
|
|
4669
|
-
const j = !!(
|
|
4670
|
-
if (!
|
|
4671
|
-
if (!
|
|
4666
|
+
let N = g.current;
|
|
4667
|
+
const F = (z == null ? void 0 : z.text) ?? "", O = (z == null ? void 0 : z.attachments) ?? [], _ = (F == null ? void 0 : F.trim()) ?? "", K = { ...(z == null ? void 0 : z.payload) ?? {} }, L = Array.isArray(K.messages) ? K.messages : void 0;
|
|
4668
|
+
L && delete K.messages;
|
|
4669
|
+
const j = !!(L && L.length), U = !!(z.contentParts && z.contentParts.length > 0);
|
|
4670
|
+
if (!N && !_ && O.length === 0 && !j && !U) return;
|
|
4671
|
+
if (!N) {
|
|
4672
4672
|
const Be = Math.floor(Date.now() / 1e3).toString(16).padStart(8, "0"), Ue = Array.from({ length: 4 }, () => Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")).join("").slice(0, 16);
|
|
4673
|
-
|
|
4673
|
+
N = `${Be}${Ue}`, T(N), v(N);
|
|
4674
4674
|
}
|
|
4675
4675
|
let Q = null;
|
|
4676
4676
|
z.contentParts && z.contentParts.length > 0 && (Q = z.contentParts);
|
|
4677
4677
|
const { contentParts: ne, filesInfo: J } = Q ? { contentParts: Q, filesInfo: [] } : await rw(O), de = [...ne];
|
|
4678
|
-
_ && de.push({ type: "text", text:
|
|
4678
|
+
_ && de.push({ type: "text", text: F });
|
|
4679
4679
|
const ve = q == null ? void 0 : q.originalMessageId, Ae = !!(q != null && q.edit && ve), qe = !j && de.length > 0;
|
|
4680
4680
|
let Me = null;
|
|
4681
4681
|
qe && (Me = {
|
|
@@ -4683,8 +4683,8 @@ function Lw({
|
|
|
4683
4683
|
role: "user",
|
|
4684
4684
|
content: de,
|
|
4685
4685
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4686
|
-
}, Ae ?
|
|
4687
|
-
const Ye = j ?
|
|
4686
|
+
}, Ae ? I(Me, ve) : I(Me));
|
|
4687
|
+
const Ye = j ? L : Me ? [Me] : [], $e = {
|
|
4688
4688
|
...K,
|
|
4689
4689
|
...J.length ? { files_info: J } : {}
|
|
4690
4690
|
};
|
|
@@ -4695,7 +4695,7 @@ function Lw({
|
|
|
4695
4695
|
mt = Be.checkpointId, gt = Be.checkpointNs ?? void 0;
|
|
4696
4696
|
}
|
|
4697
4697
|
const Ke = {
|
|
4698
|
-
threadId:
|
|
4698
|
+
threadId: N,
|
|
4699
4699
|
payload: $e,
|
|
4700
4700
|
checkpointId: mt,
|
|
4701
4701
|
checkpointNs: gt,
|
|
@@ -4704,20 +4704,20 @@ function Lw({
|
|
|
4704
4704
|
};
|
|
4705
4705
|
P(Ke, q == null ? void 0 : q.onEvent);
|
|
4706
4706
|
},
|
|
4707
|
-
[w, g, d, T,
|
|
4707
|
+
[w, g, d, T, I, P, l, S]
|
|
4708
4708
|
), k = He(
|
|
4709
4709
|
() => ({
|
|
4710
4710
|
isStreaming: d,
|
|
4711
4711
|
error: m,
|
|
4712
4712
|
connectionState: d ? "connected" : "idle",
|
|
4713
|
-
submit:
|
|
4714
|
-
send:
|
|
4713
|
+
submit: $,
|
|
4714
|
+
send: $,
|
|
4715
4715
|
stop: l,
|
|
4716
4716
|
clear: c,
|
|
4717
4717
|
setAuthToken: f,
|
|
4718
4718
|
assistantMessage: p
|
|
4719
4719
|
}),
|
|
4720
|
-
[d, p, m,
|
|
4720
|
+
[d, p, m, $, l, c, f]
|
|
4721
4721
|
);
|
|
4722
4722
|
return /* @__PURE__ */ u.jsx(vd.Provider, { value: k, children: e });
|
|
4723
4723
|
}
|
|
@@ -5144,11 +5144,11 @@ var tb = "DismissableLayer", ti = "dismissableLayer.update", nb = "dismissableLa
|
|
|
5144
5144
|
onDismiss: i,
|
|
5145
5145
|
...l
|
|
5146
5146
|
} = e, c = h.useContext(Cd), [d, p] = h.useState(null), m = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, f] = h.useState({}), v = Oe(t, (C) => p(C)), g = Array.from(c.layers), [x] = [...c.layersWithOutsidePointerEventsDisabled].slice(-1), b = g.indexOf(x), w = d ? g.indexOf(d) : -1, S = c.layersWithOutsidePointerEventsDisabled.size > 0, E = w >= b, T = sb((C) => {
|
|
5147
|
-
const
|
|
5147
|
+
const I = C.target, A = [...c.branches].some((D) => D.contains(I));
|
|
5148
5148
|
!E || A || (o == null || o(C), a == null || a(C), C.defaultPrevented || i == null || i());
|
|
5149
5149
|
}, m), y = ab((C) => {
|
|
5150
|
-
const
|
|
5151
|
-
[...c.branches].some((
|
|
5150
|
+
const I = C.target;
|
|
5151
|
+
[...c.branches].some((D) => D.contains(I)) || (s == null || s(C), a == null || a(C), C.defaultPrevented || i == null || i());
|
|
5152
5152
|
}, m);
|
|
5153
5153
|
return eb((C) => {
|
|
5154
5154
|
w === c.layers.size - 1 && (r == null || r(C), !C.defaultPrevented && i && (C.preventDefault(), i()));
|
|
@@ -5863,10 +5863,10 @@ function Qb(e) {
|
|
|
5863
5863
|
var b = Wo(g), w = n.current, S = "deltaX" in g ? g.deltaX : w[0] - b[0], E = "deltaY" in g ? g.deltaY : w[1] - b[1], T, y = g.target, C = Math.abs(S) > Math.abs(E) ? "h" : "v";
|
|
5864
5864
|
if ("touches" in g && C === "h" && y.type === "range")
|
|
5865
5865
|
return !1;
|
|
5866
|
-
var
|
|
5867
|
-
if (!
|
|
5866
|
+
var I = Pc(C, y);
|
|
5867
|
+
if (!I)
|
|
5868
5868
|
return !0;
|
|
5869
|
-
if (
|
|
5869
|
+
if (I ? T = C : (T = C === "v" ? "h" : "v", I = Pc(C, y)), !I)
|
|
5870
5870
|
return !1;
|
|
5871
5871
|
if (!r.current && "changedTouches" in g && (S || E) && (r.current = T), !T)
|
|
5872
5872
|
return !0;
|
|
@@ -7579,12 +7579,12 @@ class Dn {
|
|
|
7579
7579
|
continue;
|
|
7580
7580
|
}
|
|
7581
7581
|
default: {
|
|
7582
|
-
const
|
|
7582
|
+
const I = 'Token with "' + f.type + '" type was not found.';
|
|
7583
7583
|
if (this.options.silent) {
|
|
7584
|
-
console.error(
|
|
7584
|
+
console.error(I);
|
|
7585
7585
|
return;
|
|
7586
7586
|
} else
|
|
7587
|
-
throw new Error(
|
|
7587
|
+
throw new Error(I);
|
|
7588
7588
|
}
|
|
7589
7589
|
}
|
|
7590
7590
|
}
|
|
@@ -8247,9 +8247,9 @@ function Wy({
|
|
|
8247
8247
|
isUserExpanded: T,
|
|
8248
8248
|
setIsUserExpanded: y,
|
|
8249
8249
|
isCompactLayout: C,
|
|
8250
|
-
iconForeground:
|
|
8250
|
+
iconForeground: I,
|
|
8251
8251
|
toolConfig: A,
|
|
8252
|
-
handleInterruptApprove:
|
|
8252
|
+
handleInterruptApprove: D,
|
|
8253
8253
|
handleInterruptReject: M,
|
|
8254
8254
|
handleInterruptAlternative: H,
|
|
8255
8255
|
disableInterruptActions: Y,
|
|
@@ -8262,12 +8262,12 @@ function Wy({
|
|
|
8262
8262
|
a,
|
|
8263
8263
|
(f ?? !0) && p,
|
|
8264
8264
|
m ?? 0
|
|
8265
|
-
),
|
|
8265
|
+
), $ = He(
|
|
8266
8266
|
() => Z.filter((j) => j.type === "text"),
|
|
8267
8267
|
[Z]
|
|
8268
8268
|
), k = He(
|
|
8269
|
-
() =>
|
|
8270
|
-
[
|
|
8269
|
+
() => $.map((j) => j.text ?? "").join(""),
|
|
8270
|
+
[$]
|
|
8271
8271
|
), z = He(() => {
|
|
8272
8272
|
if (!v)
|
|
8273
8273
|
return null;
|
|
@@ -8283,7 +8283,7 @@ function Wy({
|
|
|
8283
8283
|
j ? /* @__PURE__ */ u.jsx(kr, { content: j, allowHtml: !1 }) : null,
|
|
8284
8284
|
U ? /* @__PURE__ */ u.jsx(kr, { content: U, allowHtml: !1 }) : null
|
|
8285
8285
|
] });
|
|
8286
|
-
}, [z]),
|
|
8286
|
+
}, [z]), N = He(() => {
|
|
8287
8287
|
if (!v)
|
|
8288
8288
|
return Z;
|
|
8289
8289
|
const j = [];
|
|
@@ -8300,7 +8300,7 @@ function Wy({
|
|
|
8300
8300
|
j.push(Q);
|
|
8301
8301
|
}
|
|
8302
8302
|
return j;
|
|
8303
|
-
}, [Z, v]), O = (v ?
|
|
8303
|
+
}, [Z, v]), O = (v ? N : Z).filter((j) => j.type !== "interrupt" && j.type !== "image_url"), _ = () => !l || l.length === 0 ? null : /* @__PURE__ */ u.jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: l.map((j, U) => {
|
|
8304
8304
|
const Q = j;
|
|
8305
8305
|
return /* @__PURE__ */ u.jsx("div", { className: "relative group", children: /* @__PURE__ */ u.jsx(
|
|
8306
8306
|
"img",
|
|
@@ -8362,16 +8362,16 @@ function Wy({
|
|
|
8362
8362
|
E,
|
|
8363
8363
|
v,
|
|
8364
8364
|
y
|
|
8365
|
-
]),
|
|
8365
|
+
]), L = i.trim().length > 0 || l.length > 0 || c.length > 0 || O.length > 0;
|
|
8366
8366
|
if (!t && c.length > 0 && !p && !i && l.length === 0)
|
|
8367
8367
|
return V();
|
|
8368
|
-
if (!t && !
|
|
8368
|
+
if (!t && !L && !p)
|
|
8369
8369
|
return null;
|
|
8370
8370
|
if (t) {
|
|
8371
8371
|
if (!n)
|
|
8372
8372
|
return null;
|
|
8373
8373
|
if (P && d) {
|
|
8374
|
-
const j = d.value, U = !Y, Q =
|
|
8374
|
+
const j = d.value, U = !Y, Q = D ?? (() => {
|
|
8375
8375
|
}), ne = M ?? (() => {
|
|
8376
8376
|
});
|
|
8377
8377
|
return /* @__PURE__ */ u.jsx(
|
|
@@ -8406,7 +8406,7 @@ function Wy({
|
|
|
8406
8406
|
] });
|
|
8407
8407
|
return p ? /* @__PURE__ */ u.jsxs("div", { "aria-busy": "true", role: "status", children: [
|
|
8408
8408
|
j,
|
|
8409
|
-
/* @__PURE__ */ u.jsx(zy, { className:
|
|
8409
|
+
/* @__PURE__ */ u.jsx(zy, { className: I })
|
|
8410
8410
|
] }) : j;
|
|
8411
8411
|
}
|
|
8412
8412
|
return null;
|
|
@@ -8472,9 +8472,9 @@ function Xy({
|
|
|
8472
8472
|
attemptCount: T,
|
|
8473
8473
|
attemptIndex: y,
|
|
8474
8474
|
handleOlderAttemptSelect: C,
|
|
8475
|
-
handleNewerAttemptSelect:
|
|
8475
|
+
handleNewerAttemptSelect: I,
|
|
8476
8476
|
messageCreatedAt: A,
|
|
8477
|
-
copied:
|
|
8477
|
+
copied: D
|
|
8478
8478
|
}) {
|
|
8479
8479
|
return !e && !t && !n && !r ? null : /* @__PURE__ */ u.jsxs(
|
|
8480
8480
|
"div",
|
|
@@ -8548,7 +8548,7 @@ function Xy({
|
|
|
8548
8548
|
y > 0 ? "border-border text-foreground hover:bg-muted/60" : "border-border text-muted-foreground cursor-not-allowed"
|
|
8549
8549
|
),
|
|
8550
8550
|
onClick: () => {
|
|
8551
|
-
y <= 0 ||
|
|
8551
|
+
y <= 0 || I();
|
|
8552
8552
|
},
|
|
8553
8553
|
"aria-label": "Newer attempt (forward in time)",
|
|
8554
8554
|
disabled: y <= 0,
|
|
@@ -8583,7 +8583,7 @@ function Xy({
|
|
|
8583
8583
|
className: oe("h-6 w-6 p-0 hover:bg-foreground/10", o, c && "h-5 w-5"),
|
|
8584
8584
|
"aria-label": "Copy message",
|
|
8585
8585
|
title: "Copy message",
|
|
8586
|
-
children: /* @__PURE__ */ u.jsx(Au, { className: oe(
|
|
8586
|
+
children: /* @__PURE__ */ u.jsx(Au, { className: oe(D ? "text-success" : o, c ? "h-3 w-3" : "h-4 w-4") })
|
|
8587
8587
|
}
|
|
8588
8588
|
) }),
|
|
8589
8589
|
m === "user" && w && /* @__PURE__ */ u.jsx(
|
|
@@ -8738,7 +8738,7 @@ function n0(e) {
|
|
|
8738
8738
|
const y = await r.listFiles(n ?? void 0);
|
|
8739
8739
|
if (!y || !Array.isArray(y))
|
|
8740
8740
|
throw new Error("Invalid file list response");
|
|
8741
|
-
const C = y.find((
|
|
8741
|
+
const C = y.find((I) => !I || typeof I != "object" || !((I.filename ?? "") === (g.name ?? "")) ? !1 : typeof g.size == "number" && typeof I.size == "number" ? I.size === g.size : !0);
|
|
8742
8742
|
if (!(C != null && C.id))
|
|
8743
8743
|
throw new Error(`File "${g.name}" is not yet available on the server`);
|
|
8744
8744
|
if (!C.id || !C.filename)
|
|
@@ -8886,20 +8886,20 @@ const Zi = Lg(function({
|
|
|
8886
8886
|
attemptCount: T = 1,
|
|
8887
8887
|
attemptIndex: y = 0,
|
|
8888
8888
|
onSelectCheckpoint: C,
|
|
8889
|
-
attemptMetas:
|
|
8889
|
+
attemptMetas: I = []
|
|
8890
8890
|
}) {
|
|
8891
|
-
const [A,
|
|
8891
|
+
const [A, D] = fe(!1), [M, H] = fe(!1), { currentThreadId: Y } = Ro(), { respondToInterrupt: P } = Bs(), [V, X] = fe(!1), Z = l === "phone" || l === "half-screen", $ = t.role, k = $ === "interrupt", z = $ === "tool" || k, N = !(t.role === "default_message") && t.expandable !== void 0 ? t.expandable !== !1 : !0, { toolRenderers: F, toolArtifactRenderers: O, getToolExpandable: _ } = m ?? {}, K = He(() => !_ || t.role !== "tool" ? !1 : _(t), [_, t.id, t.role]), [L, j] = fe(K ? "preview" : "expanded");
|
|
8892
8892
|
Fe(() => {
|
|
8893
8893
|
j(K ? "preview" : "expanded");
|
|
8894
8894
|
}, [K, t.id]);
|
|
8895
|
-
const U = He(() => t.role === "default_message" ? t : null, [t]), Q = !!U, ne = !(r &&
|
|
8895
|
+
const U = He(() => t.role === "default_message" ? t : null, [t]), Q = !!U, ne = !(r && $ !== "user"), {
|
|
8896
8896
|
uploadingFiles: J,
|
|
8897
8897
|
handleFileClick: de,
|
|
8898
8898
|
fileViewerOpen: ve,
|
|
8899
8899
|
currentFileInfo: Ae,
|
|
8900
8900
|
closeFileViewer: qe
|
|
8901
8901
|
} = n0({ allowFileOpen: ne, currentThreadId: Y }), Me = He(() => {
|
|
8902
|
-
switch (
|
|
8902
|
+
switch ($) {
|
|
8903
8903
|
case "user":
|
|
8904
8904
|
return "text-[hsl(var(--chat-bubble-user-text))]";
|
|
8905
8905
|
case "assistant":
|
|
@@ -8913,7 +8913,7 @@ const Zi = Lg(function({
|
|
|
8913
8913
|
default:
|
|
8914
8914
|
return "text-[hsl(var(--chat-bubble-ai-text))]";
|
|
8915
8915
|
}
|
|
8916
|
-
}, [
|
|
8916
|
+
}, [$]), Ye = r0(t, U), {
|
|
8917
8917
|
contentParts: $e,
|
|
8918
8918
|
imageParts: mt,
|
|
8919
8919
|
fileParts: gt,
|
|
@@ -8941,7 +8941,7 @@ const Zi = Lg(function({
|
|
|
8941
8941
|
throw new Error("Clipboard API not supported in this context.");
|
|
8942
8942
|
}
|
|
8943
8943
|
try {
|
|
8944
|
-
await ae(se),
|
|
8944
|
+
await ae(se), D(!0), setTimeout(() => D(!1), 2e3), S == null || S(se);
|
|
8945
8945
|
} catch (pe) {
|
|
8946
8946
|
console.error("Failed to copy:", pe);
|
|
8947
8947
|
}
|
|
@@ -8992,7 +8992,7 @@ const Zi = Lg(function({
|
|
|
8992
8992
|
w == null || w(n);
|
|
8993
8993
|
}, [w, n]), St = le(() => {
|
|
8994
8994
|
const ae = oe(Z ? "h-3 w-3" : "h-4 w-4", "opacity-60 flex-shrink-0", Me);
|
|
8995
|
-
switch (
|
|
8995
|
+
switch ($) {
|
|
8996
8996
|
case "user":
|
|
8997
8997
|
return /* @__PURE__ */ u.jsx(qg, { className: ae });
|
|
8998
8998
|
case "assistant":
|
|
@@ -9004,9 +9004,9 @@ const Zi = Lg(function({
|
|
|
9004
9004
|
default:
|
|
9005
9005
|
return /* @__PURE__ */ u.jsx(Bo, { className: ae });
|
|
9006
9006
|
}
|
|
9007
|
-
}, [Z, Me,
|
|
9007
|
+
}, [Z, Me, $]), bt = le(() => {
|
|
9008
9008
|
const se = "group relative mb-4 flex w-full";
|
|
9009
|
-
switch (
|
|
9009
|
+
switch ($) {
|
|
9010
9010
|
case "user":
|
|
9011
9011
|
return oe(se, "justify-end");
|
|
9012
9012
|
case "assistant":
|
|
@@ -9017,7 +9017,7 @@ const Zi = Lg(function({
|
|
|
9017
9017
|
default:
|
|
9018
9018
|
return se;
|
|
9019
9019
|
}
|
|
9020
|
-
}, [
|
|
9020
|
+
}, [$]), Ve = le(() => {
|
|
9021
9021
|
const se = oe(
|
|
9022
9022
|
"rounded-lg px-4 py-3 relative min-w-0 max-w-full break-words",
|
|
9023
9023
|
Z && "px-3 py-2 text-sm"
|
|
@@ -9029,7 +9029,7 @@ const Zi = Lg(function({
|
|
|
9029
9029
|
"bg-[hsl(var(--chat-bubble-ai))] text-[hsl(var(--chat-bubble-ai-text))]",
|
|
9030
9030
|
"border border-border/60 dark:border-border/40 shadow-sm"
|
|
9031
9031
|
);
|
|
9032
|
-
switch (
|
|
9032
|
+
switch ($) {
|
|
9033
9033
|
case "user":
|
|
9034
9034
|
return oe(
|
|
9035
9035
|
se,
|
|
@@ -9057,9 +9057,9 @@ const Zi = Lg(function({
|
|
|
9057
9057
|
"border border-border/60 dark:border-border/40"
|
|
9058
9058
|
);
|
|
9059
9059
|
}
|
|
9060
|
-
}, [Z, Q,
|
|
9060
|
+
}, [Z, Q, $]), Xe = K && !k && N, ct = le(() => {
|
|
9061
9061
|
Xe && j((se) => se === "expanded" ? "preview" : "expanded");
|
|
9062
|
-
}, [Xe]), Rt = k ? "expanded" :
|
|
9062
|
+
}, [Xe]), Rt = k ? "expanded" : L, pt = (p || k) && N, Dt = /* @__PURE__ */ u.jsx(
|
|
9063
9063
|
Wy,
|
|
9064
9064
|
{
|
|
9065
9065
|
message: t,
|
|
@@ -9068,7 +9068,7 @@ const Zi = Lg(function({
|
|
|
9068
9068
|
toolViewMode: Rt,
|
|
9069
9069
|
toolExpandable: K,
|
|
9070
9070
|
toolConfig: {
|
|
9071
|
-
toolRenderers:
|
|
9071
|
+
toolRenderers: F,
|
|
9072
9072
|
toolArtifactRenderers: O,
|
|
9073
9073
|
getToolExpandable: _
|
|
9074
9074
|
},
|
|
@@ -9084,7 +9084,7 @@ const Zi = Lg(function({
|
|
|
9084
9084
|
streamingDebounceMs: v,
|
|
9085
9085
|
handleFileClick: de,
|
|
9086
9086
|
uploadingFiles: J,
|
|
9087
|
-
messageRole:
|
|
9087
|
+
messageRole: $,
|
|
9088
9088
|
truncateUserMessages: c,
|
|
9089
9089
|
userMessagePreviewLength: d,
|
|
9090
9090
|
isUserExpanded: M,
|
|
@@ -9098,7 +9098,7 @@ const Zi = Lg(function({
|
|
|
9098
9098
|
disableInterruptActions: V,
|
|
9099
9099
|
isInterruptMessage: k
|
|
9100
9100
|
}
|
|
9101
|
-
), ye = He(() => U ? "Assistant" : mw(t), [U, t]), De = St(), ze =
|
|
9101
|
+
), ye = He(() => U ? "Assistant" : mw(t), [U, t]), De = St(), ze = $ === "user" && (T ?? 1) > 1 && typeof C == "function", rt = (I == null ? void 0 : I.length) ?? 0, et = rt > 0 && y < rt - 1 ? I[y + 1] : void 0, Je = rt > 0 && y > 0 ? I[y - 1] : void 0, yt = le(() => {
|
|
9102
9102
|
!et || !C || C(et.id, void 0, !!et.isLatestAttempt);
|
|
9103
9103
|
}, [et, C]), W = le(() => {
|
|
9104
9104
|
!Je || !C || C(Je.id, void 0, !!Je.isLatestAttempt);
|
|
@@ -9131,7 +9131,7 @@ const Zi = Lg(function({
|
|
|
9131
9131
|
isCompactLayout: Z,
|
|
9132
9132
|
showActions: s,
|
|
9133
9133
|
isEditing: o,
|
|
9134
|
-
messageRole:
|
|
9134
|
+
messageRole: $,
|
|
9135
9135
|
toolViewMode: Rt,
|
|
9136
9136
|
toolExpandable: K,
|
|
9137
9137
|
isInterruptMessage: k,
|
|
@@ -9169,7 +9169,7 @@ const Zi = Lg(function({
|
|
|
9169
9169
|
children: /* @__PURE__ */ u.jsx(Au, { className: oe(A ? "text-success" : "text-current", Z ? "h-3 w-3" : "h-4 w-4") })
|
|
9170
9170
|
}
|
|
9171
9171
|
),
|
|
9172
|
-
|
|
9172
|
+
$ === "user" && b && /* @__PURE__ */ u.jsx(
|
|
9173
9173
|
it,
|
|
9174
9174
|
{
|
|
9175
9175
|
variant: "ghost",
|
|
@@ -9179,7 +9179,7 @@ const Zi = Lg(function({
|
|
|
9179
9179
|
children: /* @__PURE__ */ u.jsx(Pu, { className: oe("text-current", Z ? "h-3 w-3" : "h-4 w-4") })
|
|
9180
9180
|
}
|
|
9181
9181
|
),
|
|
9182
|
-
|
|
9182
|
+
$ === "assistant" && w && /* @__PURE__ */ u.jsx(
|
|
9183
9183
|
it,
|
|
9184
9184
|
{
|
|
9185
9185
|
variant: "ghost",
|
|
@@ -9973,11 +9973,11 @@ const A0 = {
|
|
|
9973
9973
|
ke((T) => T.length > 0),
|
|
9974
9974
|
Le(g, f),
|
|
9975
9975
|
he(([T, y, C]) => {
|
|
9976
|
-
const
|
|
9976
|
+
const I = T.reduce((A, D, M) => tn(A, D, po(D, y.offsetTree, C) || M), Rr());
|
|
9977
9977
|
return {
|
|
9978
9978
|
...y,
|
|
9979
9979
|
groupIndices: T,
|
|
9980
|
-
groupOffsetTree:
|
|
9980
|
+
groupOffsetTree: I
|
|
9981
9981
|
};
|
|
9982
9982
|
})
|
|
9983
9983
|
),
|
|
@@ -10057,17 +10057,17 @@ const A0 = {
|
|
|
10057
10057
|
s,
|
|
10058
10058
|
Le(g),
|
|
10059
10059
|
he(([T, y]) => {
|
|
10060
|
-
const C = y.groupIndices.length > 0,
|
|
10060
|
+
const C = y.groupIndices.length > 0, I = [], A = y.lastSize;
|
|
10061
10061
|
if (C) {
|
|
10062
|
-
const
|
|
10062
|
+
const D = uo(y.sizeTree, 0);
|
|
10063
10063
|
let M = 0, H = 0;
|
|
10064
10064
|
for (; M < T; ) {
|
|
10065
10065
|
const P = y.groupIndices[H], V = y.groupIndices.length === H + 1 ? 1 / 0 : y.groupIndices[H + 1] - P - 1;
|
|
10066
|
-
|
|
10066
|
+
I.push({
|
|
10067
10067
|
endIndex: P,
|
|
10068
|
-
size:
|
|
10068
|
+
size: D,
|
|
10069
10069
|
startIndex: P
|
|
10070
|
-
}),
|
|
10070
|
+
}), I.push({
|
|
10071
10071
|
endIndex: P + 1 + V - 1,
|
|
10072
10072
|
size: A,
|
|
10073
10073
|
startIndex: P + 1
|
|
@@ -10093,15 +10093,15 @@ const A0 = {
|
|
|
10093
10093
|
{
|
|
10094
10094
|
prevIndex: T,
|
|
10095
10095
|
prevSize: 0,
|
|
10096
|
-
ranges:
|
|
10096
|
+
ranges: I
|
|
10097
10097
|
}
|
|
10098
10098
|
).ranges;
|
|
10099
10099
|
}
|
|
10100
10100
|
return Yn(y.sizeTree).reduce(
|
|
10101
|
-
(
|
|
10101
|
+
(D, { k: M, v: H }) => ({
|
|
10102
10102
|
prevIndex: M + T,
|
|
10103
10103
|
prevSize: H,
|
|
10104
|
-
ranges: [...
|
|
10104
|
+
ranges: [...D.ranges, { endIndex: M + T - 1, size: D.prevSize, startIndex: D.prevIndex }]
|
|
10105
10105
|
}),
|
|
10106
10106
|
{
|
|
10107
10107
|
prevIndex: 0,
|
|
@@ -10118,8 +10118,8 @@ const A0 = {
|
|
|
10118
10118
|
a,
|
|
10119
10119
|
Le(g, f),
|
|
10120
10120
|
he(([T, { offsetTree: y }, C]) => {
|
|
10121
|
-
const
|
|
10122
|
-
return po(
|
|
10121
|
+
const I = -T;
|
|
10122
|
+
return po(I, y, C);
|
|
10123
10123
|
})
|
|
10124
10124
|
)
|
|
10125
10125
|
);
|
|
@@ -10131,31 +10131,31 @@ const A0 = {
|
|
|
10131
10131
|
if (y.groupIndices.length > 0) {
|
|
10132
10132
|
if (ot(y.sizeTree))
|
|
10133
10133
|
return y;
|
|
10134
|
-
let
|
|
10134
|
+
let I = Rr();
|
|
10135
10135
|
const A = Ct(x);
|
|
10136
|
-
let
|
|
10137
|
-
for (;
|
|
10136
|
+
let D = 0, M = 0, H = 0;
|
|
10137
|
+
for (; D < -T; ) {
|
|
10138
10138
|
H = A[M];
|
|
10139
10139
|
const Y = A[M + 1] - H - 1;
|
|
10140
|
-
M++,
|
|
10140
|
+
M++, D += Y + 1;
|
|
10141
10141
|
}
|
|
10142
|
-
if (
|
|
10142
|
+
if (I = Yn(y.sizeTree).reduce((Y, { k: P, v: V }) => tn(Y, Math.max(0, P + T), V), I), D !== -T) {
|
|
10143
10143
|
const Y = uo(y.sizeTree, H);
|
|
10144
|
-
|
|
10144
|
+
I = tn(I, 0, Y);
|
|
10145
10145
|
const P = hn(y.sizeTree, -T + 1)[1];
|
|
10146
|
-
|
|
10146
|
+
I = tn(I, 1, P);
|
|
10147
10147
|
}
|
|
10148
10148
|
return {
|
|
10149
10149
|
...y,
|
|
10150
|
-
sizeTree:
|
|
10151
|
-
...ci(y.offsetTree, 0,
|
|
10150
|
+
sizeTree: I,
|
|
10151
|
+
...ci(y.offsetTree, 0, I, C)
|
|
10152
10152
|
};
|
|
10153
10153
|
} else {
|
|
10154
|
-
const
|
|
10154
|
+
const I = Yn(y.sizeTree).reduce((A, { k: D, v: M }) => tn(A, Math.max(0, D + T), M), Rr());
|
|
10155
10155
|
return {
|
|
10156
10156
|
...y,
|
|
10157
|
-
sizeTree:
|
|
10158
|
-
...ci(y.offsetTree, 0,
|
|
10157
|
+
sizeTree: I,
|
|
10158
|
+
...ci(y.offsetTree, 0, I, C)
|
|
10159
10159
|
};
|
|
10160
10160
|
}
|
|
10161
10161
|
})
|
|
@@ -10269,26 +10269,26 @@ const Po = Ge(
|
|
|
10269
10269
|
Le(e, s, o),
|
|
10270
10270
|
he(
|
|
10271
10271
|
([
|
|
10272
|
-
[E, T, y, C,
|
|
10272
|
+
[E, T, y, C, I, A, D, M],
|
|
10273
10273
|
H,
|
|
10274
10274
|
Y,
|
|
10275
10275
|
P
|
|
10276
10276
|
]) => {
|
|
10277
|
-
const V = jf(E), { align: X, behavior: Z, offset:
|
|
10277
|
+
const V = jf(E), { align: X, behavior: Z, offset: $ } = V, k = C - 1, z = Af(V, T, k);
|
|
10278
10278
|
let q = po(z, T.offsetTree, H) + A;
|
|
10279
|
-
X === "end" ? (q += Y + hn(T.sizeTree, z)[1] - y + P, z === k && (q +=
|
|
10280
|
-
const
|
|
10281
|
-
S(),
|
|
10279
|
+
X === "end" ? (q += Y + hn(T.sizeTree, z)[1] - y + P, z === k && (q += D)) : X === "center" ? q += (Y + hn(T.sizeTree, z)[1] - y + P) / 2 : q -= I, $ && (q += $);
|
|
10280
|
+
const N = (F) => {
|
|
10281
|
+
S(), F ? (M("retrying to scroll to", { location: E }, Jt.DEBUG), _e(f, E)) : (_e(v, !0), M("list did not change, scroll successful", {}, Jt.DEBUG));
|
|
10282
10282
|
};
|
|
10283
10283
|
if (S(), Z === "smooth") {
|
|
10284
|
-
let
|
|
10284
|
+
let F = !1;
|
|
10285
10285
|
w = Ze(t, (O) => {
|
|
10286
|
-
|
|
10286
|
+
F = F || O;
|
|
10287
10287
|
}), x = pn(d, () => {
|
|
10288
|
-
|
|
10288
|
+
N(F);
|
|
10289
10289
|
});
|
|
10290
10290
|
} else
|
|
10291
|
-
x = pn(re(t, _0(150)),
|
|
10291
|
+
x = pn(re(t, _0(150)), N);
|
|
10292
10292
|
return b = setTimeout(() => {
|
|
10293
10293
|
S();
|
|
10294
10294
|
}, 1200), _e(l, !0), M("scrolling from index to", { behavior: Z, index: z, top: q }, Jt.DEBUG), { behavior: Z, top: q };
|
|
@@ -10402,8 +10402,8 @@ const ho = "up", so = "down", O0 = "none", M0 = {
|
|
|
10402
10402
|
const v = nn(
|
|
10403
10403
|
re(
|
|
10404
10404
|
Nt(r, Te(s), Te(t), Te(e), Te(d)),
|
|
10405
|
-
Sn((w, [{ scrollHeight: S, scrollTop: E }, T, y, C,
|
|
10406
|
-
const A = E + T - S > -
|
|
10405
|
+
Sn((w, [{ scrollHeight: S, scrollTop: E }, T, y, C, I]) => {
|
|
10406
|
+
const A = E + T - S > -I, D = {
|
|
10407
10407
|
scrollHeight: S,
|
|
10408
10408
|
scrollTop: E,
|
|
10409
10409
|
viewportHeight: T
|
|
@@ -10414,14 +10414,14 @@ const ho = "up", so = "down", O0 = "none", M0 = {
|
|
|
10414
10414
|
atBottom: !0,
|
|
10415
10415
|
atBottomBecause: H,
|
|
10416
10416
|
scrollTopDelta: Y,
|
|
10417
|
-
state:
|
|
10417
|
+
state: D
|
|
10418
10418
|
};
|
|
10419
10419
|
}
|
|
10420
10420
|
let M;
|
|
10421
|
-
return
|
|
10421
|
+
return D.scrollHeight > w.state.scrollHeight ? M = "SIZE_INCREASED" : T < w.state.viewportHeight ? M = "VIEWPORT_HEIGHT_DECREASING" : E < w.state.scrollTop ? M = "SCROLLING_UPWARDS" : M = "NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM", {
|
|
10422
10422
|
atBottom: !1,
|
|
10423
10423
|
notAtBottomBecause: M,
|
|
10424
|
-
state:
|
|
10424
|
+
state: D
|
|
10425
10425
|
};
|
|
10426
10426
|
}, M0),
|
|
10427
10427
|
ut((w, S) => w && w.atBottom === S.atBottom)
|
|
@@ -10549,9 +10549,9 @@ const al = Ge(
|
|
|
10549
10549
|
]) => {
|
|
10550
10550
|
const E = d - w, T = x + b, y = Math.max(m - E, 0);
|
|
10551
10551
|
let C = Gc;
|
|
10552
|
-
const
|
|
10553
|
-
return f -= w, f += m + b, v += m + b, v -= w, f > d + T -
|
|
10554
|
-
Math.max(E - m - Yc(g, bs, C) -
|
|
10552
|
+
const I = Xc(S, bs), A = Xc(S, ys);
|
|
10553
|
+
return f -= w, f += m + b, v += m + b, v -= w, f > d + T - I && (C = ho), v < d - y + p + A && (C = so), C !== Gc ? [
|
|
10554
|
+
Math.max(E - m - Yc(g, bs, C) - I, 0),
|
|
10555
10555
|
E - y - b + p + Yc(g, ys, C) + A
|
|
10556
10556
|
] : null;
|
|
10557
10557
|
}
|
|
@@ -10686,34 +10686,34 @@ const hr = Ge(
|
|
|
10686
10686
|
Te(n),
|
|
10687
10687
|
e
|
|
10688
10688
|
),
|
|
10689
|
-
ke(([y, C, ,
|
|
10690
|
-
const
|
|
10691
|
-
return y && !C && !
|
|
10689
|
+
ke(([y, C, , I, , , , , , , A]) => {
|
|
10690
|
+
const D = A && A.length !== I;
|
|
10691
|
+
return y && !C && !D;
|
|
10692
10692
|
}),
|
|
10693
10693
|
he(
|
|
10694
10694
|
([
|
|
10695
10695
|
,
|
|
10696
10696
|
,
|
|
10697
10697
|
[y, C],
|
|
10698
|
-
|
|
10698
|
+
I,
|
|
10699
10699
|
A,
|
|
10700
|
-
|
|
10700
|
+
D,
|
|
10701
10701
|
M,
|
|
10702
10702
|
H,
|
|
10703
10703
|
Y,
|
|
10704
10704
|
P,
|
|
10705
10705
|
V
|
|
10706
10706
|
]) => {
|
|
10707
|
-
const X = A, { offsetTree: Z, sizeTree:
|
|
10708
|
-
if (
|
|
10709
|
-
return { ...Da, totalCount:
|
|
10707
|
+
const X = A, { offsetTree: Z, sizeTree: $ } = X, k = Ct(x);
|
|
10708
|
+
if (I === 0)
|
|
10709
|
+
return { ...Da, totalCount: I };
|
|
10710
10710
|
if (y === 0 && C === 0)
|
|
10711
|
-
return k === 0 ? { ...Da, totalCount:
|
|
10712
|
-
if (ot(
|
|
10711
|
+
return k === 0 ? { ...Da, totalCount: I } : Of(k, D, A, Y, P, V || []);
|
|
10712
|
+
if (ot($))
|
|
10713
10713
|
return k > 0 ? null : fs(
|
|
10714
|
-
L0(sl(
|
|
10714
|
+
L0(sl(D, I), X, V),
|
|
10715
10715
|
[],
|
|
10716
|
-
|
|
10716
|
+
I,
|
|
10717
10717
|
P,
|
|
10718
10718
|
X,
|
|
10719
10719
|
Y
|
|
@@ -10721,35 +10721,35 @@ const hr = Ge(
|
|
|
10721
10721
|
const z = [];
|
|
10722
10722
|
if (H.length > 0) {
|
|
10723
10723
|
const _ = H[0], K = H[H.length - 1];
|
|
10724
|
-
let
|
|
10725
|
-
for (const j of Gs(
|
|
10724
|
+
let L = 0;
|
|
10725
|
+
for (const j of Gs($, _, K)) {
|
|
10726
10726
|
const U = j.value, Q = Math.max(j.start, _), ne = Math.min(j.end, K);
|
|
10727
10727
|
for (let J = Q; J <= ne; J++)
|
|
10728
|
-
z.push({ data: V == null ? void 0 : V[J], index: J, offset:
|
|
10728
|
+
z.push({ data: V == null ? void 0 : V[J], index: J, offset: L, size: U }), L += U;
|
|
10729
10729
|
}
|
|
10730
10730
|
}
|
|
10731
10731
|
if (!M)
|
|
10732
|
-
return fs([], z,
|
|
10733
|
-
const q = H.length > 0 ? H[H.length - 1] + 1 : 0,
|
|
10734
|
-
if (
|
|
10732
|
+
return fs([], z, I, P, X, Y);
|
|
10733
|
+
const q = H.length > 0 ? H[H.length - 1] + 1 : 0, N = E0(Z, y, C, q);
|
|
10734
|
+
if (N.length === 0)
|
|
10735
10735
|
return null;
|
|
10736
|
-
const
|
|
10737
|
-
for (const K of
|
|
10738
|
-
const
|
|
10739
|
-
let j =
|
|
10740
|
-
const Q =
|
|
10741
|
-
if (
|
|
10742
|
-
U += Math.floor((y -
|
|
10736
|
+
const F = I - 1, O = qs([], (_) => {
|
|
10737
|
+
for (const K of N) {
|
|
10738
|
+
const L = K.value;
|
|
10739
|
+
let j = L.offset, U = K.start;
|
|
10740
|
+
const Q = L.size;
|
|
10741
|
+
if (L.offset < y) {
|
|
10742
|
+
U += Math.floor((y - L.offset + P) / (Q + P));
|
|
10743
10743
|
const J = U - K.start;
|
|
10744
10744
|
j += J * Q + J * P;
|
|
10745
10745
|
}
|
|
10746
10746
|
U < q && (j += (q - U) * Q, U = q);
|
|
10747
|
-
const ne = Math.min(K.end,
|
|
10747
|
+
const ne = Math.min(K.end, F);
|
|
10748
10748
|
for (let J = U; J <= ne && !(j >= C); J++)
|
|
10749
10749
|
_.push({ data: V == null ? void 0 : V[J], index: J, offset: j, size: Q }), j += Q + P;
|
|
10750
10750
|
}
|
|
10751
10751
|
});
|
|
10752
|
-
return fs(O, z,
|
|
10752
|
+
return fs(O, z, I, P, X, Y);
|
|
10753
10753
|
}
|
|
10754
10754
|
),
|
|
10755
10755
|
//@ts-expect-error filter needs to be fixed
|
|
@@ -10807,13 +10807,13 @@ const hr = Ge(
|
|
|
10807
10807
|
w,
|
|
10808
10808
|
ke(({ items: y }) => y.length > 0),
|
|
10809
10809
|
he(({ items: y }) => {
|
|
10810
|
-
let C = 0,
|
|
10811
|
-
for (; y[C].type === "group" && C <
|
|
10810
|
+
let C = 0, I = y.length - 1;
|
|
10811
|
+
for (; y[C].type === "group" && C < I; )
|
|
10812
10812
|
C++;
|
|
10813
|
-
for (; y[
|
|
10814
|
-
|
|
10813
|
+
for (; y[I].type === "group" && I > C; )
|
|
10814
|
+
I--;
|
|
10815
10815
|
return {
|
|
10816
|
-
endIndex: y[
|
|
10816
|
+
endIndex: y[I].index,
|
|
10817
10817
|
startIndex: y[C].index
|
|
10818
10818
|
};
|
|
10819
10819
|
}),
|
|
@@ -10883,10 +10883,10 @@ const hr = Ge(
|
|
|
10883
10883
|
Le(t, l, n, s, o, r, i),
|
|
10884
10884
|
Le(e),
|
|
10885
10885
|
he(([[p, m, f, v, g, x, b, w], S]) => {
|
|
10886
|
-
const { align: E, behavior: T, calculateViewLocation: y = F0, done: C, ...
|
|
10886
|
+
const { align: E, behavior: T, calculateViewLocation: y = F0, done: C, ...I } = p, A = Af(p, m, v - 1), D = po(A, m.offsetTree, S) + g + x, M = D + hn(m.sizeTree, A)[1], H = w + x, Y = w + f - b, P = y({
|
|
10887
10887
|
itemBottom: M,
|
|
10888
|
-
itemTop:
|
|
10889
|
-
locationParams: { align: E, behavior: T, ...
|
|
10888
|
+
itemTop: D,
|
|
10889
|
+
locationParams: { align: E, behavior: T, ...I },
|
|
10890
10890
|
viewportBottom: Y,
|
|
10891
10891
|
viewportTop: H
|
|
10892
10892
|
});
|
|
@@ -10939,9 +10939,9 @@ const B0 = (e, t) => typeof e == "function" ? Zc(e(t)) : t && Zc(e), z0 = Ge(
|
|
|
10939
10939
|
re(
|
|
10940
10940
|
Nt(re(Te(t), ar(1)), l),
|
|
10941
10941
|
Le(Te(v), s, i, p),
|
|
10942
|
-
he(([[T, y], C,
|
|
10942
|
+
he(([[T, y], C, I, A, D]) => {
|
|
10943
10943
|
let M = y && A, H = "auto";
|
|
10944
|
-
return M && (H = B0(C,
|
|
10944
|
+
return M && (H = B0(C, I || D), M = M && !!H), { followOutputBehavior: H, shouldFollow: M, totalCount: T };
|
|
10945
10945
|
}),
|
|
10946
10946
|
ke(({ shouldFollow: T }) => T)
|
|
10947
10947
|
),
|
|
@@ -10995,7 +10995,7 @@ const B0 = (e, t) => typeof e == "function" ? Zc(e(t)) : t && Zc(e), z0 = Ge(
|
|
|
10995
10995
|
re(
|
|
10996
10996
|
Nt(re(E, ar(1)), l),
|
|
10997
10997
|
Le(Te(S), i, p, m),
|
|
10998
|
-
he(([[T, y], C,
|
|
10998
|
+
he(([[T, y], C, I, A, D]) => y && I && (C == null ? void 0 : C({ context: D, totalCount: T, scrollingInProgress: A }))),
|
|
10999
10999
|
ke((T) => !!T),
|
|
11000
11000
|
Nn(0)
|
|
11001
11001
|
),
|
|
@@ -11189,10 +11189,10 @@ const q0 = Ff(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
11189
11189
|
l,
|
|
11190
11190
|
Le(a),
|
|
11191
11191
|
Sn(
|
|
11192
|
-
([, b, w, S], [{ bottom: E, items: T, offsetBottom: y, totalCount: C },
|
|
11192
|
+
([, b, w, S], [{ bottom: E, items: T, offsetBottom: y, totalCount: C }, I]) => {
|
|
11193
11193
|
const A = E + y;
|
|
11194
|
-
let
|
|
11195
|
-
return w === C && b.length > 0 && T.length > 0 && (T[0].originalIndex === 0 && b[0].originalIndex === 0 || (
|
|
11194
|
+
let D = 0;
|
|
11195
|
+
return w === C && b.length > 0 && T.length > 0 && (T[0].originalIndex === 0 && b[0].originalIndex === 0 || (D = A - S, D !== 0 && (D += I))), [D, T, C, A];
|
|
11196
11196
|
},
|
|
11197
11197
|
[0, [], 0, 0]
|
|
11198
11198
|
),
|
|
@@ -11233,12 +11233,12 @@ const q0 = Ff(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
11233
11233
|
return y(b);
|
|
11234
11234
|
{
|
|
11235
11235
|
let C = 0;
|
|
11236
|
-
const
|
|
11237
|
-
let A = 0,
|
|
11236
|
+
const I = uo(E, 0);
|
|
11237
|
+
let A = 0, D = 0;
|
|
11238
11238
|
for (; A < b; ) {
|
|
11239
|
-
A++, C +=
|
|
11240
|
-
let M = w.length ===
|
|
11241
|
-
A + M > b && (C -=
|
|
11239
|
+
A++, C += I;
|
|
11240
|
+
let M = w.length === D + 1 ? 1 / 0 : w[D + 1] - w[D] - 1;
|
|
11241
|
+
A + M > b && (C -= I, M = b - A + 1), A += M, C += y(M), D++;
|
|
11242
11242
|
}
|
|
11243
11243
|
return C;
|
|
11244
11244
|
}
|
|
@@ -11317,12 +11317,12 @@ const q0 = Ff(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
11317
11317
|
{ scrollToIndex: T },
|
|
11318
11318
|
y,
|
|
11319
11319
|
{ topItemCount: C },
|
|
11320
|
-
{ groupCounts:
|
|
11320
|
+
{ groupCounts: I },
|
|
11321
11321
|
A
|
|
11322
11322
|
]) => (we(E.rangeChanged, A.scrollSeekRangeChanged), we(
|
|
11323
11323
|
re(
|
|
11324
11324
|
A.windowViewportRect,
|
|
11325
|
-
he((
|
|
11325
|
+
he((D) => D.visibleHeight)
|
|
11326
11326
|
),
|
|
11327
11327
|
g.viewportHeight
|
|
11328
11328
|
), {
|
|
@@ -11331,7 +11331,7 @@ const q0 = Ff(() => /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.tes
|
|
|
11331
11331
|
firstItemIndex: n,
|
|
11332
11332
|
fixedItemHeight: r,
|
|
11333
11333
|
gap: o,
|
|
11334
|
-
groupCounts:
|
|
11334
|
+
groupCounts: I,
|
|
11335
11335
|
initialItemFinalLocationReached: m,
|
|
11336
11336
|
initialTopMostItemIndex: f,
|
|
11337
11337
|
scrolledToInitialItem: v,
|
|
@@ -11568,7 +11568,7 @@ const Z0 = /* @__PURE__ */ Ge(() => {
|
|
|
11568
11568
|
ul("deviation", (P) => {
|
|
11569
11569
|
b !== P && w(P);
|
|
11570
11570
|
});
|
|
11571
|
-
const S = Ie("EmptyPlaceholder"), E = Ie("ScrollSeekPlaceholder") || eS, T = Ie("ListComponent"), y = Ie("ItemComponent"), C = Ie("GroupComponent"),
|
|
11571
|
+
const S = Ie("EmptyPlaceholder"), E = Ie("ScrollSeekPlaceholder") || eS, T = Ie("ListComponent"), y = Ie("ItemComponent"), C = Ie("GroupComponent"), I = Ie("computeItemKey"), A = Ie("isSeeking"), D = Ie("groupIndices").length > 0, M = Ie("alignToBottom"), H = Ie("initialItemFinalLocationReached"), Y = e ? {} : {
|
|
11572
11572
|
boxSizing: "border-box",
|
|
11573
11573
|
...g ? {
|
|
11574
11574
|
display: "inline-block",
|
|
@@ -11592,7 +11592,7 @@ const Z0 = /* @__PURE__ */ Ge(() => {
|
|
|
11592
11592
|
ref: x,
|
|
11593
11593
|
style: Y,
|
|
11594
11594
|
children: (e ? t.topItems : t.items).map((P) => {
|
|
11595
|
-
const V = P.originalIndex, X =
|
|
11595
|
+
const V = P.originalIndex, X = I(V + t.firstItemIndex, P.data, c);
|
|
11596
11596
|
return A ? /* @__PURE__ */ Qo(
|
|
11597
11597
|
E,
|
|
11598
11598
|
{
|
|
@@ -11626,7 +11626,7 @@ const Z0 = /* @__PURE__ */ Ge(() => {
|
|
|
11626
11626
|
key: X,
|
|
11627
11627
|
style: g ? nS : Kf
|
|
11628
11628
|
},
|
|
11629
|
-
|
|
11629
|
+
D ? l(P.index, P.groupIndex, P.data, c) : l(P.index, P.data, c)
|
|
11630
11630
|
);
|
|
11631
11631
|
})
|
|
11632
11632
|
}
|
|
@@ -11911,7 +11911,7 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
11911
11911
|
{ customScrollParent: x, useWindowScroll: b, windowScrollContainerState: w, windowScrollTo: S, windowViewportRect: E },
|
|
11912
11912
|
T
|
|
11913
11913
|
]) => {
|
|
11914
|
-
const y = ie(0), C = ie(0),
|
|
11914
|
+
const y = ie(0), C = ie(0), I = ie(tu), A = ie({ height: 0, width: 0 }), D = ie({ height: 0, width: 0 }), M = We(), H = We(), Y = ie(0), P = ie(null), V = ie({ column: 0, row: 0 }), X = We(), Z = We(), $ = ie(!1), k = ie(0), z = ie(!0), q = ie(!1), N = ie(!1);
|
|
11915
11915
|
Ze(
|
|
11916
11916
|
re(
|
|
11917
11917
|
v,
|
|
@@ -11923,7 +11923,7 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
11923
11923
|
}
|
|
11924
11924
|
), Ze(
|
|
11925
11925
|
re(
|
|
11926
|
-
Nt(v, z,
|
|
11926
|
+
Nt(v, z, D, A, k, q),
|
|
11927
11927
|
ke(([j, U, Q, ne, , J]) => j && !U && Q.height !== 0 && ne.height !== 0 && !J)
|
|
11928
11928
|
),
|
|
11929
11929
|
([, , , , j]) => {
|
|
@@ -11947,8 +11947,8 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
11947
11947
|
ke(([, j]) => j != null)
|
|
11948
11948
|
),
|
|
11949
11949
|
([, j]) => {
|
|
11950
|
-
j && (_e(A, j.viewport), _e(
|
|
11951
|
-
_e(
|
|
11950
|
+
j && (_e(A, j.viewport), _e(D, j.item), _e(V, j.gap), j.scrollTop > 0 && (_e($, !0), pn(re(c, ar(1)), (U) => {
|
|
11951
|
+
_e($, !1);
|
|
11952
11952
|
}), _e(l, { top: j.scrollTop })));
|
|
11953
11953
|
}
|
|
11954
11954
|
), we(
|
|
@@ -11961,7 +11961,7 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
11961
11961
|
re(
|
|
11962
11962
|
Nt(
|
|
11963
11963
|
Te(A, Yo),
|
|
11964
|
-
Te(
|
|
11964
|
+
Te(D, Yo),
|
|
11965
11965
|
Te(V, (j, U) => j && j.column === U.column && j.row === U.row),
|
|
11966
11966
|
Te(c)
|
|
11967
11967
|
),
|
|
@@ -11979,11 +11979,11 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
11979
11979
|
Te(y),
|
|
11980
11980
|
r,
|
|
11981
11981
|
Te(V, bS),
|
|
11982
|
-
Te(
|
|
11982
|
+
Te(D, Yo),
|
|
11983
11983
|
Te(A, Yo),
|
|
11984
11984
|
Te(P),
|
|
11985
11985
|
Te(C),
|
|
11986
|
-
Te(
|
|
11986
|
+
Te($),
|
|
11987
11987
|
Te(z),
|
|
11988
11988
|
Te(k)
|
|
11989
11989
|
),
|
|
@@ -12016,7 +12016,7 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
12016
12016
|
}
|
|
12017
12017
|
)
|
|
12018
12018
|
),
|
|
12019
|
-
|
|
12019
|
+
I
|
|
12020
12020
|
), we(
|
|
12021
12021
|
re(
|
|
12022
12022
|
P,
|
|
@@ -12026,7 +12026,7 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
12026
12026
|
y
|
|
12027
12027
|
), we(
|
|
12028
12028
|
re(
|
|
12029
|
-
Nt(A,
|
|
12029
|
+
Nt(A, D, I, V),
|
|
12030
12030
|
ke(([j, U, { items: Q }]) => Q.length > 0 && U.height !== 0 && j.height !== 0),
|
|
12031
12031
|
he(([j, U, { items: Q }, ne]) => {
|
|
12032
12032
|
const { bottom: J, top: de } = su(j, ne, U, Q);
|
|
@@ -12036,20 +12036,20 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
12036
12036
|
),
|
|
12037
12037
|
t
|
|
12038
12038
|
);
|
|
12039
|
-
const
|
|
12039
|
+
const F = ie(!1);
|
|
12040
12040
|
we(
|
|
12041
12041
|
re(
|
|
12042
12042
|
c,
|
|
12043
|
-
Le(
|
|
12043
|
+
Le(F),
|
|
12044
12044
|
he(([j, U]) => U || j !== 0)
|
|
12045
12045
|
),
|
|
12046
|
-
|
|
12046
|
+
F
|
|
12047
12047
|
);
|
|
12048
12048
|
const O = nn(
|
|
12049
12049
|
re(
|
|
12050
|
-
Nt(
|
|
12050
|
+
Nt(I, y),
|
|
12051
12051
|
ke(([{ items: j }]) => j.length > 0),
|
|
12052
|
-
Le(
|
|
12052
|
+
Le(F),
|
|
12053
12053
|
ke(([[j, U], Q]) => {
|
|
12054
12054
|
const ne = j.items[j.items.length - 1].index === U - 1;
|
|
12055
12055
|
return (Q || j.bottom > 0 && j.itemHeight > 0 && j.offsetBottom === 0 && j.items.length === U) && ne;
|
|
@@ -12059,15 +12059,15 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
12059
12059
|
)
|
|
12060
12060
|
), _ = nn(
|
|
12061
12061
|
re(
|
|
12062
|
-
Te(
|
|
12062
|
+
Te(I),
|
|
12063
12063
|
ke(({ items: j }) => j.length > 0 && j[0].index === 0),
|
|
12064
12064
|
bn(0),
|
|
12065
12065
|
ut()
|
|
12066
12066
|
)
|
|
12067
12067
|
), K = nn(
|
|
12068
12068
|
re(
|
|
12069
|
-
Te(
|
|
12070
|
-
Le(
|
|
12069
|
+
Te(I),
|
|
12070
|
+
Le($),
|
|
12071
12071
|
ke(([{ items: j }, U]) => j.length > 0 && !U),
|
|
12072
12072
|
he(([{ items: j }]) => ({
|
|
12073
12073
|
endIndex: j[j.length - 1].index,
|
|
@@ -12080,7 +12080,7 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
12080
12080
|
we(K, f.scrollSeekRangeChanged), we(
|
|
12081
12081
|
re(
|
|
12082
12082
|
M,
|
|
12083
|
-
Le(A,
|
|
12083
|
+
Le(A, D, y, V),
|
|
12084
12084
|
he(([j, U, Q, ne, J]) => {
|
|
12085
12085
|
const de = jf(j), { align: ve, behavior: Ae, offset: qe } = de;
|
|
12086
12086
|
let Me = de.index;
|
|
@@ -12091,9 +12091,9 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
12091
12091
|
),
|
|
12092
12092
|
l
|
|
12093
12093
|
);
|
|
12094
|
-
const
|
|
12094
|
+
const L = Bt(
|
|
12095
12095
|
re(
|
|
12096
|
-
|
|
12096
|
+
I,
|
|
12097
12097
|
he((j) => j.offsetBottom + j.bottom)
|
|
12098
12098
|
),
|
|
12099
12099
|
0
|
|
@@ -12114,7 +12114,7 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
12114
12114
|
headerHeight: s,
|
|
12115
12115
|
increaseViewportBy: e,
|
|
12116
12116
|
initialItemCount: C,
|
|
12117
|
-
itemDimensions:
|
|
12117
|
+
itemDimensions: D,
|
|
12118
12118
|
overscan: n,
|
|
12119
12119
|
restoreStateFrom: Z,
|
|
12120
12120
|
scrollBy: a,
|
|
@@ -12132,17 +12132,17 @@ const yS = /* @__PURE__ */ Ge(
|
|
|
12132
12132
|
windowViewportRect: E,
|
|
12133
12133
|
...f,
|
|
12134
12134
|
// output
|
|
12135
|
-
gridState:
|
|
12136
|
-
horizontalDirection:
|
|
12135
|
+
gridState: I,
|
|
12136
|
+
horizontalDirection: N,
|
|
12137
12137
|
initialTopMostItemIndex: k,
|
|
12138
|
-
totalListHeight:
|
|
12138
|
+
totalListHeight: L,
|
|
12139
12139
|
...m,
|
|
12140
12140
|
endReached: O,
|
|
12141
12141
|
propsReady: g,
|
|
12142
12142
|
rangeChanged: K,
|
|
12143
12143
|
startReached: _,
|
|
12144
12144
|
stateChanged: X,
|
|
12145
|
-
stateRestoreInProgress:
|
|
12145
|
+
stateRestoreInProgress: $,
|
|
12146
12146
|
...T
|
|
12147
12147
|
};
|
|
12148
12148
|
},
|
|
@@ -12375,9 +12375,9 @@ const jS = {
|
|
|
12375
12375
|
getInterruptOptions: x,
|
|
12376
12376
|
toolConfig: b
|
|
12377
12377
|
}) {
|
|
12378
|
-
const w = Jf(t, n), S = t.role === "default_message", y = !!t.__syntheticStreaming || o === t.id && t.role === "assistant", C = f ?? jS,
|
|
12379
|
-
() => lx(t.id,
|
|
12380
|
-
[t.id,
|
|
12378
|
+
const w = Jf(t, n), S = t.role === "default_message", y = !!t.__syntheticStreaming || o === t.id && t.role === "assistant", C = f ?? jS, I = !S && "checkpointId" in t ? t.checkpointId ?? null : null, { attemptCount: A, attemptIndex: D, attempts: M } = He(
|
|
12379
|
+
() => lx(t.id, I, C),
|
|
12380
|
+
[t.id, I, C]
|
|
12381
12381
|
), H = g == null ? void 0 : g(t);
|
|
12382
12382
|
return /* @__PURE__ */ u.jsx(
|
|
12383
12383
|
"div",
|
|
@@ -12407,7 +12407,7 @@ const jS = {
|
|
|
12407
12407
|
getInterruptOptions: x,
|
|
12408
12408
|
showToolMessages: m,
|
|
12409
12409
|
attemptCount: A,
|
|
12410
|
-
attemptIndex:
|
|
12410
|
+
attemptIndex: D,
|
|
12411
12411
|
attemptMetas: M,
|
|
12412
12412
|
onSelectCheckpoint: v,
|
|
12413
12413
|
customStyles: H,
|
|
@@ -12443,20 +12443,20 @@ const Qf = B.forwardRef(({
|
|
|
12443
12443
|
activeCheckpointId: T,
|
|
12444
12444
|
onSelectCheckpoint: y,
|
|
12445
12445
|
createSyntheticThinkingMessage: C = !0,
|
|
12446
|
-
forceSyntheticThinking:
|
|
12446
|
+
forceSyntheticThinking: I = !1,
|
|
12447
12447
|
getMessageCustomStyles: A,
|
|
12448
|
-
getInterruptOptions:
|
|
12448
|
+
getInterruptOptions: D,
|
|
12449
12449
|
pendingInterrupt: M
|
|
12450
12450
|
}, H) => {
|
|
12451
|
-
const Y = Re(null), P = Re(null), V = Re(!1), X = Re(!1), [Z,
|
|
12451
|
+
const Y = Re(null), P = Re(null), V = Re(!1), X = Re(!1), [Z, $] = B.useState(!1), k = Re(null);
|
|
12452
12452
|
Fe(() => {
|
|
12453
12453
|
if (!M) {
|
|
12454
12454
|
k.current = null;
|
|
12455
12455
|
return;
|
|
12456
12456
|
}
|
|
12457
|
-
k.current !== M.id && (
|
|
12457
|
+
k.current !== M.id && ($(!1), k.current = M.id);
|
|
12458
12458
|
}, [M]), Fe(() => {
|
|
12459
|
-
t &&
|
|
12459
|
+
t && $(!0);
|
|
12460
12460
|
}, [t]);
|
|
12461
12461
|
const z = B.useMemo(() => {
|
|
12462
12462
|
if (!M) return null;
|
|
@@ -12483,9 +12483,9 @@ const Qf = B.forwardRef(({
|
|
|
12483
12483
|
// We don't have ns handy here unless passed, but display usually ignores it or uses activeCheckpointId
|
|
12484
12484
|
expandable: !0
|
|
12485
12485
|
};
|
|
12486
|
-
}, [M, T]), q = B.useMemo(() => !z || Z || e.some((J) => J.id === z.id) ? e : [...e, z], [e, z, Z]),
|
|
12486
|
+
}, [M, T]), q = B.useMemo(() => !z || Z || e.some((J) => J.id === z.id) ? e : [...e, z], [e, z, Z]), N = He(() => {
|
|
12487
12487
|
const J = n && q.some((ve) => ve.id === n);
|
|
12488
|
-
return C && (t ||
|
|
12488
|
+
return C && (t || I) && !J && q.length > 0 ? [
|
|
12489
12489
|
...q,
|
|
12490
12490
|
{
|
|
12491
12491
|
id: "thinking-assistant",
|
|
@@ -12495,7 +12495,7 @@ const Qf = B.forwardRef(({
|
|
|
12495
12495
|
__syntheticStreaming: !0
|
|
12496
12496
|
}
|
|
12497
12497
|
] : q;
|
|
12498
|
-
}, [q, t, n, C,
|
|
12498
|
+
}, [q, t, n, C, I]), F = He(() => w ? N : N.filter((J) => (J == null ? void 0 : J.role) !== "tool"), [N, w]), O = le((J) => {
|
|
12499
12499
|
x && x(!J), b && b(J);
|
|
12500
12500
|
}, [x, b]), _ = He(() => {
|
|
12501
12501
|
if (i)
|
|
@@ -12509,22 +12509,22 @@ const Qf = B.forwardRef(({
|
|
|
12509
12509
|
}
|
|
12510
12510
|
}
|
|
12511
12511
|
};
|
|
12512
|
-
}, [i]), K = He(() => !v || g ? !1 : "auto", [v, g]),
|
|
12512
|
+
}, [i]), K = He(() => !v || g ? !1 : "auto", [v, g]), L = He(() => {
|
|
12513
12513
|
if (typeof f != "string") return null;
|
|
12514
12514
|
const J = f.trim();
|
|
12515
|
-
return !J ||
|
|
12515
|
+
return !J || F && F.length > 0 ? null : {
|
|
12516
12516
|
id: "default-message",
|
|
12517
12517
|
role: "default_message",
|
|
12518
12518
|
content: J,
|
|
12519
12519
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
12520
12520
|
};
|
|
12521
|
-
}, [f,
|
|
12522
|
-
if (
|
|
12523
|
-
const J = A == null ? void 0 : A(
|
|
12521
|
+
}, [f, F]), j = ["flex h-full flex-col md:flex-row", p].filter(Boolean).join(" "), U = () => {
|
|
12522
|
+
if (L) {
|
|
12523
|
+
const J = A == null ? void 0 : A(L);
|
|
12524
12524
|
return /* @__PURE__ */ u.jsx("div", { className: "p-6 h-full overflow-y-auto", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-full", children: /* @__PURE__ */ u.jsx(
|
|
12525
12525
|
Zi,
|
|
12526
12526
|
{
|
|
12527
|
-
message:
|
|
12527
|
+
message: L,
|
|
12528
12528
|
messageIndex: 0,
|
|
12529
12529
|
isStreamingMessage: !1,
|
|
12530
12530
|
showActions: !1,
|
|
@@ -12538,12 +12538,12 @@ const Qf = B.forwardRef(({
|
|
|
12538
12538
|
onCancelEdit: () => {
|
|
12539
12539
|
},
|
|
12540
12540
|
customStyles: J,
|
|
12541
|
-
getInterruptOptions:
|
|
12541
|
+
getInterruptOptions: D
|
|
12542
12542
|
}
|
|
12543
12543
|
) }) });
|
|
12544
12544
|
}
|
|
12545
12545
|
return /* @__PURE__ */ u.jsx("div", { className: "flex h-full items-center justify-center py-8 text-center text-muted-foreground", children: f ?? "No messages yet. Start a conversation!" });
|
|
12546
|
-
}, Q =
|
|
12546
|
+
}, Q = F.length, ne = Q > 0;
|
|
12547
12547
|
return Fe(() => {
|
|
12548
12548
|
var J, de;
|
|
12549
12549
|
if (Q === 0) {
|
|
@@ -12551,17 +12551,17 @@ const Qf = B.forwardRef(({
|
|
|
12551
12551
|
return;
|
|
12552
12552
|
}
|
|
12553
12553
|
if (!X.current)
|
|
12554
|
-
if (X.current = !0, Y.current &&
|
|
12555
|
-
const ve =
|
|
12554
|
+
if (X.current = !0, Y.current && F.length > 0) {
|
|
12555
|
+
const ve = F.length - 1;
|
|
12556
12556
|
(de = (J = Y.current).scrollToIndex) == null || de.call(J, { index: ve, align: "end", behavior: "auto" });
|
|
12557
12557
|
} else P.current && (P.current.scrollTop = P.current.scrollHeight);
|
|
12558
|
-
}, [Q,
|
|
12558
|
+
}, [Q, F.length]), $g(
|
|
12559
12559
|
H,
|
|
12560
12560
|
() => ({
|
|
12561
12561
|
scrollToLatest: () => {
|
|
12562
12562
|
var J, de;
|
|
12563
|
-
if (Y.current &&
|
|
12564
|
-
const ve =
|
|
12563
|
+
if (Y.current && F.length > 0) {
|
|
12564
|
+
const ve = F.length - 1;
|
|
12565
12565
|
(de = (J = Y.current).scrollToIndex) == null || de.call(J, {
|
|
12566
12566
|
index: ve,
|
|
12567
12567
|
align: "end",
|
|
@@ -12571,14 +12571,14 @@ const Qf = B.forwardRef(({
|
|
|
12571
12571
|
},
|
|
12572
12572
|
scrollToTop: () => {
|
|
12573
12573
|
var J, de;
|
|
12574
|
-
Y.current &&
|
|
12574
|
+
Y.current && F.length > 0 ? (de = (J = Y.current).scrollToIndex) == null || de.call(J, {
|
|
12575
12575
|
index: 0,
|
|
12576
12576
|
align: "start",
|
|
12577
12577
|
behavior: "auto"
|
|
12578
12578
|
}) : P.current && (P.current.scrollTop = 0);
|
|
12579
12579
|
}
|
|
12580
12580
|
}),
|
|
12581
|
-
[
|
|
12581
|
+
[F]
|
|
12582
12582
|
), /* @__PURE__ */ u.jsx("div", { className: j, style: m, children: /* @__PURE__ */ u.jsx("div", { className: "relative flex-1 min-h-0 min-w-0", children: ne ? /* @__PURE__ */ u.jsx(
|
|
12583
12583
|
gS,
|
|
12584
12584
|
{
|
|
@@ -12588,7 +12588,7 @@ const Qf = B.forwardRef(({
|
|
|
12588
12588
|
scrollerRef: (J) => {
|
|
12589
12589
|
P.current = J instanceof HTMLDivElement ? J : null;
|
|
12590
12590
|
},
|
|
12591
|
-
data:
|
|
12591
|
+
data: F,
|
|
12592
12592
|
followOutput: K,
|
|
12593
12593
|
overscan: 200,
|
|
12594
12594
|
increaseViewportBy: { top: 100, bottom: 200 },
|
|
@@ -12620,7 +12620,7 @@ const Qf = B.forwardRef(({
|
|
|
12620
12620
|
activeCheckpointId: T,
|
|
12621
12621
|
onSelectCheckpoint: y,
|
|
12622
12622
|
getMessageCustomStyles: A,
|
|
12623
|
-
getInterruptOptions:
|
|
12623
|
+
getInterruptOptions: D
|
|
12624
12624
|
}
|
|
12625
12625
|
)
|
|
12626
12626
|
}
|
|
@@ -12634,7 +12634,7 @@ function _S({
|
|
|
12634
12634
|
toolConfig: r,
|
|
12635
12635
|
expandable: o = !1
|
|
12636
12636
|
}) {
|
|
12637
|
-
var
|
|
12637
|
+
var D;
|
|
12638
12638
|
const s = $i(e), a = e.artifact ?? null, i = a0(e), c = (i ? bw(i) : null) ?? i, d = e.content.find((M) => M.type !== "tool_call"), p = (M) => {
|
|
12639
12639
|
if (M == null) return null;
|
|
12640
12640
|
const H = typeof M == "string" ? Br(M) ?? M : M;
|
|
@@ -12690,7 +12690,7 @@ function _S({
|
|
|
12690
12690
|
toolPayload: c,
|
|
12691
12691
|
viewMode: t,
|
|
12692
12692
|
isStreaming: n
|
|
12693
|
-
}) : null) ?? null,
|
|
12693
|
+
}) : null) ?? null, I = ((D = (() => {
|
|
12694
12694
|
if (!w)
|
|
12695
12695
|
return;
|
|
12696
12696
|
const M = a == null ? void 0 : a.type;
|
|
@@ -12700,14 +12700,14 @@ function _S({
|
|
|
12700
12700
|
return H;
|
|
12701
12701
|
}
|
|
12702
12702
|
return w.default;
|
|
12703
|
-
})()) == null ? void 0 :
|
|
12703
|
+
})()) == null ? void 0 : D({
|
|
12704
12704
|
artifact: a,
|
|
12705
12705
|
message: e,
|
|
12706
12706
|
toolPayload: c,
|
|
12707
12707
|
isStreaming: n
|
|
12708
12708
|
})) ?? null, A = y ?? E;
|
|
12709
12709
|
return /* @__PURE__ */ u.jsxs("div", { className: "space-y-2", children: [
|
|
12710
|
-
a && (
|
|
12710
|
+
a && (I ?? /* @__PURE__ */ u.jsx(Ly, { artifact: a, idx: 0 })),
|
|
12711
12711
|
/* @__PURE__ */ u.jsx(Fy, { message: e, isStreaming: n }),
|
|
12712
12712
|
T ? A : null
|
|
12713
12713
|
] });
|
|
@@ -13041,7 +13041,7 @@ const qS = (e) => ({
|
|
|
13041
13041
|
}, f = pl(o), v = fl(f), g = await a.getDimensions(c), x = f === "y", b = x ? "top" : "left", w = x ? "bottom" : "right", S = x ? "clientHeight" : "clientWidth", E = s.reference[v] + s.reference[f] - m[f] - s.floating[v], T = m[f] - s.reference[f], y = await (a.getOffsetParent == null ? void 0 : a.getOffsetParent(c));
|
|
13042
13042
|
let C = y ? y[S] : 0;
|
|
13043
13043
|
(!C || !await (a.isElement == null ? void 0 : a.isElement(y))) && (C = i.floating[S] || s.floating[v]);
|
|
13044
|
-
const
|
|
13044
|
+
const I = E / 2 - T / 2, A = C / 2 - g[v] / 2 - 1, D = $n(p[b], A), M = $n(p[w], A), H = D, Y = C - g[v] - M, P = C / 2 - g[v] / 2 + I, V = di(H, P, Y), X = !l.arrow && Wr(o) != null && P !== V && s.reference[v] / 2 - (P < H ? D : M) - g[v] / 2 < 0, Z = X ? P < H ? P - H : P - Y : 0;
|
|
13045
13045
|
return {
|
|
13046
13046
|
[f]: m[f] + Z,
|
|
13047
13047
|
data: {
|
|
@@ -13080,13 +13080,13 @@ const qS = (e) => ({
|
|
|
13080
13080
|
return {};
|
|
13081
13081
|
const b = jn(o), w = Tn(i), S = jn(i) === i, E = await (l.isRTL == null ? void 0 : l.isRTL(c.floating)), T = m || (S || !g ? [Cs(i)] : BS(i)), y = v !== "none";
|
|
13082
13082
|
!m && y && T.push(...WS(i, g, v, E));
|
|
13083
|
-
const C = [i, ...T],
|
|
13084
|
-
let
|
|
13085
|
-
if (d && A.push(
|
|
13083
|
+
const C = [i, ...T], I = await mo(t, x), A = [];
|
|
13084
|
+
let D = ((r = s.flip) == null ? void 0 : r.overflows) || [];
|
|
13085
|
+
if (d && A.push(I[b]), p) {
|
|
13086
13086
|
const P = FS(o, a, E);
|
|
13087
|
-
A.push(
|
|
13087
|
+
A.push(I[P[0]], I[P[1]]);
|
|
13088
13088
|
}
|
|
13089
|
-
if (
|
|
13089
|
+
if (D = [...D, {
|
|
13090
13090
|
placement: o,
|
|
13091
13091
|
overflows: A
|
|
13092
13092
|
}], !A.every((P) => P <= 0)) {
|
|
@@ -13094,30 +13094,30 @@ const qS = (e) => ({
|
|
|
13094
13094
|
const P = (((M = s.flip) == null ? void 0 : M.index) || 0) + 1, V = C[P];
|
|
13095
13095
|
if (V && (!(p === "alignment" ? w !== Tn(V) : !1) || // We leave the current main axis only if every placement on that axis
|
|
13096
13096
|
// overflows the main axis.
|
|
13097
|
-
|
|
13097
|
+
D.every(($) => Tn($.placement) === w ? $.overflows[0] > 0 : !0)))
|
|
13098
13098
|
return {
|
|
13099
13099
|
data: {
|
|
13100
13100
|
index: P,
|
|
13101
|
-
overflows:
|
|
13101
|
+
overflows: D
|
|
13102
13102
|
},
|
|
13103
13103
|
reset: {
|
|
13104
13104
|
placement: V
|
|
13105
13105
|
}
|
|
13106
13106
|
};
|
|
13107
|
-
let X = (H =
|
|
13107
|
+
let X = (H = D.filter((Z) => Z.overflows[0] <= 0).sort((Z, $) => Z.overflows[1] - $.overflows[1])[0]) == null ? void 0 : H.placement;
|
|
13108
13108
|
if (!X)
|
|
13109
13109
|
switch (f) {
|
|
13110
13110
|
case "bestFit": {
|
|
13111
13111
|
var Y;
|
|
13112
|
-
const Z = (Y =
|
|
13112
|
+
const Z = (Y = D.filter(($) => {
|
|
13113
13113
|
if (y) {
|
|
13114
|
-
const k = Tn(
|
|
13114
|
+
const k = Tn($.placement);
|
|
13115
13115
|
return k === w || // Create a bias to the `y` side axis due to horizontal
|
|
13116
13116
|
// reading directions favoring greater width.
|
|
13117
13117
|
k === "y";
|
|
13118
13118
|
}
|
|
13119
13119
|
return !0;
|
|
13120
|
-
}).map((
|
|
13120
|
+
}).map(($) => [$.placement, $.overflows.filter((k) => k > 0).reduce((k, z) => k + z, 0)]).sort(($, k) => $[1] - k[1])[0]) == null ? void 0 : Y[0];
|
|
13121
13121
|
Z && (X = Z);
|
|
13122
13122
|
break;
|
|
13123
13123
|
}
|
|
@@ -13358,14 +13358,14 @@ const JS = function(e) {
|
|
|
13358
13358
|
let x, b;
|
|
13359
13359
|
p === "top" || p === "bottom" ? (x = p, b = m === (await (a.isRTL == null ? void 0 : a.isRTL(i.floating)) ? "start" : "end") ? "left" : "right") : (b = p, x = m === "end" ? "top" : "bottom");
|
|
13360
13360
|
const w = g - d.top - d.bottom, S = v - d.left - d.right, E = $n(g - d[x], w), T = $n(v - d[b], S), y = !t.middlewareData.shift;
|
|
13361
|
-
let C = E,
|
|
13362
|
-
if ((n = t.middlewareData.shift) != null && n.enabled.x && (
|
|
13363
|
-
const
|
|
13364
|
-
f ?
|
|
13361
|
+
let C = E, I = T;
|
|
13362
|
+
if ((n = t.middlewareData.shift) != null && n.enabled.x && (I = S), (r = t.middlewareData.shift) != null && r.enabled.y && (C = w), y && !m) {
|
|
13363
|
+
const D = en(d.left, 0), M = en(d.right, 0), H = en(d.top, 0), Y = en(d.bottom, 0);
|
|
13364
|
+
f ? I = v - 2 * (D !== 0 || M !== 0 ? D + M : en(d.left, d.right)) : C = g - 2 * (H !== 0 || Y !== 0 ? H + Y : en(d.top, d.bottom));
|
|
13365
13365
|
}
|
|
13366
13366
|
await l({
|
|
13367
13367
|
...t,
|
|
13368
|
-
availableWidth:
|
|
13368
|
+
availableWidth: I,
|
|
13369
13369
|
availableHeight: C
|
|
13370
13370
|
});
|
|
13371
13371
|
const A = await a.getDimensions(i.floating);
|
|
@@ -13945,19 +13945,19 @@ function DT(e) {
|
|
|
13945
13945
|
isPositioned: !1
|
|
13946
13946
|
}), [m, f] = h.useState(r);
|
|
13947
13947
|
ks(m, r) || f(r);
|
|
13948
|
-
const [v, g] = h.useState(null), [x, b] = h.useState(null), w = h.useCallback((
|
|
13949
|
-
|
|
13950
|
-
}, []), S = h.useCallback((
|
|
13951
|
-
|
|
13952
|
-
}, []), E = s || v, T = a || x, y = h.useRef(null), C = h.useRef(null),
|
|
13948
|
+
const [v, g] = h.useState(null), [x, b] = h.useState(null), w = h.useCallback(($) => {
|
|
13949
|
+
$ !== y.current && (y.current = $, g($));
|
|
13950
|
+
}, []), S = h.useCallback(($) => {
|
|
13951
|
+
$ !== C.current && (C.current = $, b($));
|
|
13952
|
+
}, []), E = s || v, T = a || x, y = h.useRef(null), C = h.useRef(null), I = h.useRef(d), A = l != null, D = za(l), M = za(o), H = za(c), Y = h.useCallback(() => {
|
|
13953
13953
|
if (!y.current || !C.current)
|
|
13954
13954
|
return;
|
|
13955
|
-
const
|
|
13955
|
+
const $ = {
|
|
13956
13956
|
placement: t,
|
|
13957
13957
|
strategy: n,
|
|
13958
13958
|
middleware: m
|
|
13959
13959
|
};
|
|
13960
|
-
M.current && (
|
|
13960
|
+
M.current && ($.platform = M.current), _T(y.current, C.current, $).then((k) => {
|
|
13961
13961
|
const z = {
|
|
13962
13962
|
...k,
|
|
13963
13963
|
// The floating element's position may be recomputed while it's closed
|
|
@@ -13966,14 +13966,14 @@ function DT(e) {
|
|
|
13966
13966
|
// setting it to `true` when `open === false` (must be specified).
|
|
13967
13967
|
isPositioned: H.current !== !1
|
|
13968
13968
|
};
|
|
13969
|
-
P.current && !ks(
|
|
13969
|
+
P.current && !ks(I.current, z) && (I.current = z, So.flushSync(() => {
|
|
13970
13970
|
p(z);
|
|
13971
13971
|
}));
|
|
13972
13972
|
});
|
|
13973
13973
|
}, [m, t, n, M, H]);
|
|
13974
13974
|
ps(() => {
|
|
13975
|
-
c === !1 &&
|
|
13976
|
-
|
|
13975
|
+
c === !1 && I.current.isPositioned && (I.current.isPositioned = !1, p(($) => ({
|
|
13976
|
+
...$,
|
|
13977
13977
|
isPositioned: !1
|
|
13978
13978
|
})));
|
|
13979
13979
|
}, [c]);
|
|
@@ -13982,11 +13982,11 @@ function DT(e) {
|
|
|
13982
13982
|
P.current = !1;
|
|
13983
13983
|
}), []), ps(() => {
|
|
13984
13984
|
if (E && (y.current = E), T && (C.current = T), E && T) {
|
|
13985
|
-
if (
|
|
13986
|
-
return
|
|
13985
|
+
if (D.current)
|
|
13986
|
+
return D.current(E, T, Y);
|
|
13987
13987
|
Y();
|
|
13988
13988
|
}
|
|
13989
|
-
}, [E, T, Y,
|
|
13989
|
+
}, [E, T, Y, D, A]);
|
|
13990
13990
|
const V = h.useMemo(() => ({
|
|
13991
13991
|
reference: y,
|
|
13992
13992
|
floating: C,
|
|
@@ -13996,16 +13996,16 @@ function DT(e) {
|
|
|
13996
13996
|
reference: E,
|
|
13997
13997
|
floating: T
|
|
13998
13998
|
}), [E, T]), Z = h.useMemo(() => {
|
|
13999
|
-
const
|
|
13999
|
+
const $ = {
|
|
14000
14000
|
position: n,
|
|
14001
14001
|
left: 0,
|
|
14002
14002
|
top: 0
|
|
14003
14003
|
};
|
|
14004
14004
|
if (!X.floating)
|
|
14005
|
-
return
|
|
14005
|
+
return $;
|
|
14006
14006
|
const k = xu(X.floating, d.x), z = xu(X.floating, d.y);
|
|
14007
14007
|
return i ? {
|
|
14008
|
-
|
|
14008
|
+
...$,
|
|
14009
14009
|
transform: "translate(" + k + "px, " + z + "px)",
|
|
14010
14010
|
...up(X.floating) >= 1.5 && {
|
|
14011
14011
|
willChange: "transform"
|
|
@@ -14123,7 +14123,7 @@ var gp = "PopperAnchor", xp = h.forwardRef(
|
|
|
14123
14123
|
xp.displayName = gp;
|
|
14124
14124
|
var vl = "PopperContent", [GT, YT] = pp(vl), vp = h.forwardRef(
|
|
14125
14125
|
(e, t) => {
|
|
14126
|
-
var
|
|
14126
|
+
var L, j, U, Q, ne, J;
|
|
14127
14127
|
const {
|
|
14128
14128
|
__scopePopper: n,
|
|
14129
14129
|
side: r = "bottom",
|
|
@@ -14139,12 +14139,12 @@ var vl = "PopperContent", [GT, YT] = pp(vl), vp = h.forwardRef(
|
|
|
14139
14139
|
updatePositionStrategy: f = "optimized",
|
|
14140
14140
|
onPlaced: v,
|
|
14141
14141
|
...g
|
|
14142
|
-
} = e, x = hp(vl, n), [b, w] = h.useState(null), S = Oe(t, (de) => w(de)), [E, T] = h.useState(null), y = fp(E), C = (y == null ? void 0 : y.width) ?? 0,
|
|
14143
|
-
padding:
|
|
14142
|
+
} = e, x = hp(vl, n), [b, w] = h.useState(null), S = Oe(t, (de) => w(de)), [E, T] = h.useState(null), y = fp(E), C = (y == null ? void 0 : y.width) ?? 0, I = (y == null ? void 0 : y.height) ?? 0, A = r + (s !== "center" ? "-" + s : ""), D = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, M = Array.isArray(c) ? c : [c], H = M.length > 0, Y = {
|
|
14143
|
+
padding: D,
|
|
14144
14144
|
boundary: M.filter(JT),
|
|
14145
14145
|
// with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
|
|
14146
14146
|
altBoundary: H
|
|
14147
|
-
}, { refs: P, floatingStyles: V, placement: X, isPositioned: Z, middlewareData:
|
|
14147
|
+
}, { refs: P, floatingStyles: V, placement: X, isPositioned: Z, middlewareData: $ } = DT({
|
|
14148
14148
|
// default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
|
|
14149
14149
|
strategy: "fixed",
|
|
14150
14150
|
placement: A,
|
|
@@ -14155,7 +14155,7 @@ var vl = "PopperContent", [GT, YT] = pp(vl), vp = h.forwardRef(
|
|
|
14155
14155
|
reference: x.anchor
|
|
14156
14156
|
},
|
|
14157
14157
|
middleware: [
|
|
14158
|
-
$T({ mainAxis: o +
|
|
14158
|
+
$T({ mainAxis: o + I, alignmentAxis: a }),
|
|
14159
14159
|
l && FT({
|
|
14160
14160
|
mainAxis: !0,
|
|
14161
14161
|
crossAxis: !1,
|
|
@@ -14171,14 +14171,14 @@ var vl = "PopperContent", [GT, YT] = pp(vl), vp = h.forwardRef(
|
|
|
14171
14171
|
}
|
|
14172
14172
|
}),
|
|
14173
14173
|
E && WT({ element: E, padding: i }),
|
|
14174
|
-
ZT({ arrowWidth: C, arrowHeight:
|
|
14174
|
+
ZT({ arrowWidth: C, arrowHeight: I }),
|
|
14175
14175
|
m && UT({ strategy: "referenceHidden", ...Y })
|
|
14176
14176
|
]
|
|
14177
14177
|
}), [k, z] = yp(X), q = Et(v);
|
|
14178
14178
|
Pt(() => {
|
|
14179
14179
|
Z && (q == null || q());
|
|
14180
14180
|
}, [Z, q]);
|
|
14181
|
-
const
|
|
14181
|
+
const N = (L = $.arrow) == null ? void 0 : L.x, F = (j = $.arrow) == null ? void 0 : j.y, O = ((U = $.arrow) == null ? void 0 : U.centerOffset) !== 0, [_, K] = h.useState();
|
|
14182
14182
|
return Pt(() => {
|
|
14183
14183
|
b && K(window.getComputedStyle(b).zIndex);
|
|
14184
14184
|
}, [b]), /* @__PURE__ */ u.jsx(
|
|
@@ -14193,13 +14193,13 @@ var vl = "PopperContent", [GT, YT] = pp(vl), vp = h.forwardRef(
|
|
|
14193
14193
|
minWidth: "max-content",
|
|
14194
14194
|
zIndex: _,
|
|
14195
14195
|
"--radix-popper-transform-origin": [
|
|
14196
|
-
(Q =
|
|
14197
|
-
(ne =
|
|
14196
|
+
(Q = $.transformOrigin) == null ? void 0 : Q.x,
|
|
14197
|
+
(ne = $.transformOrigin) == null ? void 0 : ne.y
|
|
14198
14198
|
].join(" "),
|
|
14199
14199
|
// hide the content if using the hide middleware and should be hidden
|
|
14200
14200
|
// set visibility to hidden and disable pointer events so the UI behaves
|
|
14201
14201
|
// as if the PopperContent isn't there at all
|
|
14202
|
-
...((J =
|
|
14202
|
+
...((J = $.hide) == null ? void 0 : J.referenceHidden) && {
|
|
14203
14203
|
visibility: "hidden",
|
|
14204
14204
|
pointerEvents: "none"
|
|
14205
14205
|
}
|
|
@@ -14211,8 +14211,8 @@ var vl = "PopperContent", [GT, YT] = pp(vl), vp = h.forwardRef(
|
|
|
14211
14211
|
scope: n,
|
|
14212
14212
|
placedSide: k,
|
|
14213
14213
|
onArrowChange: T,
|
|
14214
|
-
arrowX:
|
|
14215
|
-
arrowY:
|
|
14214
|
+
arrowX: N,
|
|
14215
|
+
arrowY: F,
|
|
14216
14216
|
shouldHideArrow: O,
|
|
14217
14217
|
children: /* @__PURE__ */ u.jsx(
|
|
14218
14218
|
xe.div,
|
|
@@ -14330,9 +14330,9 @@ var oC = h.forwardRef((e, t) => {
|
|
|
14330
14330
|
caller: Mo
|
|
14331
14331
|
}), [b, w] = h.useState(!1), S = Et(c), E = Sp(n), T = h.useRef(!1), [y, C] = h.useState(0);
|
|
14332
14332
|
return h.useEffect(() => {
|
|
14333
|
-
const
|
|
14334
|
-
if (
|
|
14335
|
-
return
|
|
14333
|
+
const I = m.current;
|
|
14334
|
+
if (I)
|
|
14335
|
+
return I.addEventListener(Ha, S), () => I.removeEventListener(Ha, S);
|
|
14336
14336
|
}, [S]), /* @__PURE__ */ u.jsx(
|
|
14337
14337
|
nC,
|
|
14338
14338
|
{
|
|
@@ -14342,16 +14342,16 @@ var oC = h.forwardRef((e, t) => {
|
|
|
14342
14342
|
loop: o,
|
|
14343
14343
|
currentTabStopId: g,
|
|
14344
14344
|
onItemFocus: h.useCallback(
|
|
14345
|
-
(
|
|
14345
|
+
(I) => x(I),
|
|
14346
14346
|
[x]
|
|
14347
14347
|
),
|
|
14348
14348
|
onItemShiftTab: h.useCallback(() => w(!0), []),
|
|
14349
14349
|
onFocusableItemAdd: h.useCallback(
|
|
14350
|
-
() => C((
|
|
14350
|
+
() => C((I) => I + 1),
|
|
14351
14351
|
[]
|
|
14352
14352
|
),
|
|
14353
14353
|
onFocusableItemRemove: h.useCallback(
|
|
14354
|
-
() => C((
|
|
14354
|
+
() => C((I) => I - 1),
|
|
14355
14355
|
[]
|
|
14356
14356
|
),
|
|
14357
14357
|
children: /* @__PURE__ */ u.jsx(
|
|
@@ -14365,11 +14365,11 @@ var oC = h.forwardRef((e, t) => {
|
|
|
14365
14365
|
onMouseDown: ce(e.onMouseDown, () => {
|
|
14366
14366
|
T.current = !0;
|
|
14367
14367
|
}),
|
|
14368
|
-
onFocus: ce(e.onFocus, (
|
|
14368
|
+
onFocus: ce(e.onFocus, (I) => {
|
|
14369
14369
|
const A = !T.current;
|
|
14370
|
-
if (
|
|
14371
|
-
const
|
|
14372
|
-
if (
|
|
14370
|
+
if (I.target === I.currentTarget && A && !b) {
|
|
14371
|
+
const D = new CustomEvent(Ha, QT);
|
|
14372
|
+
if (I.currentTarget.dispatchEvent(D), !D.defaultPrevented) {
|
|
14373
14373
|
const M = E().filter((X) => X.focusable), H = M.find((X) => X.active), Y = M.find((X) => X.id === g), V = [H, Y, ...M].filter(
|
|
14374
14374
|
Boolean
|
|
14375
14375
|
).map((X) => X.ref.current);
|
|
@@ -14582,41 +14582,41 @@ var ln = "MenuContent", [yC, El] = mr(ln), Op = h.forwardRef(
|
|
|
14582
14582
|
onDismiss: f,
|
|
14583
14583
|
disableOutsideScroll: v,
|
|
14584
14584
|
...g
|
|
14585
|
-
} = e, x = gr(ln, n), b = Lo(ln, n), w = ra(n), S = Ap(n), E = mC(n), [T, y] = h.useState(null), C = h.useRef(null),
|
|
14586
|
-
var
|
|
14587
|
-
const z =
|
|
14585
|
+
} = e, x = gr(ln, n), b = Lo(ln, n), w = ra(n), S = Ap(n), E = mC(n), [T, y] = h.useState(null), C = h.useRef(null), I = Oe(t, C, x.onContentChange), A = h.useRef(0), D = h.useRef(""), M = h.useRef(0), H = h.useRef(null), Y = h.useRef("right"), P = h.useRef(0), V = v ? Us : h.Fragment, X = v ? { as: CC, allowPinchZoom: !0 } : void 0, Z = (k) => {
|
|
14586
|
+
var L, j;
|
|
14587
|
+
const z = D.current + k, q = E().filter((U) => !U.disabled), N = document.activeElement, F = (L = q.find((U) => U.ref.current === N)) == null ? void 0 : L.textValue, O = q.map((U) => U.textValue), _ = DC(O, z, F), K = (j = q.find((U) => U.textValue === _)) == null ? void 0 : j.ref.current;
|
|
14588
14588
|
(function U(Q) {
|
|
14589
|
-
|
|
14589
|
+
D.current = Q, window.clearTimeout(A.current), Q !== "" && (A.current = window.setTimeout(() => U(""), 1e3));
|
|
14590
14590
|
})(z), K && setTimeout(() => K.focus());
|
|
14591
14591
|
};
|
|
14592
14592
|
h.useEffect(() => () => window.clearTimeout(A.current), []), Hi();
|
|
14593
|
-
const
|
|
14594
|
-
var q,
|
|
14595
|
-
return Y.current === ((q = H.current) == null ? void 0 : q.side) && $C(k, (
|
|
14593
|
+
const $ = h.useCallback((k) => {
|
|
14594
|
+
var q, N;
|
|
14595
|
+
return Y.current === ((q = H.current) == null ? void 0 : q.side) && $C(k, (N = H.current) == null ? void 0 : N.area);
|
|
14596
14596
|
}, []);
|
|
14597
14597
|
return /* @__PURE__ */ u.jsx(
|
|
14598
14598
|
yC,
|
|
14599
14599
|
{
|
|
14600
14600
|
scope: n,
|
|
14601
|
-
searchRef:
|
|
14601
|
+
searchRef: D,
|
|
14602
14602
|
onItemEnter: h.useCallback(
|
|
14603
14603
|
(k) => {
|
|
14604
|
-
|
|
14604
|
+
$(k) && k.preventDefault();
|
|
14605
14605
|
},
|
|
14606
|
-
[
|
|
14606
|
+
[$]
|
|
14607
14607
|
),
|
|
14608
14608
|
onItemLeave: h.useCallback(
|
|
14609
14609
|
(k) => {
|
|
14610
14610
|
var z;
|
|
14611
|
-
|
|
14611
|
+
$(k) || ((z = C.current) == null || z.focus(), y(null));
|
|
14612
14612
|
},
|
|
14613
|
-
[
|
|
14613
|
+
[$]
|
|
14614
14614
|
),
|
|
14615
14615
|
onTriggerLeave: h.useCallback(
|
|
14616
14616
|
(k) => {
|
|
14617
|
-
|
|
14617
|
+
$(k) && k.preventDefault();
|
|
14618
14618
|
},
|
|
14619
|
-
[
|
|
14619
|
+
[$]
|
|
14620
14620
|
),
|
|
14621
14621
|
pointerGraceTimerRef: M,
|
|
14622
14622
|
onPointerGraceIntentChange: h.useCallback((k) => {
|
|
@@ -14666,27 +14666,27 @@ var ln = "MenuContent", [yC, El] = mr(ln), Op = h.forwardRef(
|
|
|
14666
14666
|
dir: b.dir,
|
|
14667
14667
|
...w,
|
|
14668
14668
|
...g,
|
|
14669
|
-
ref:
|
|
14669
|
+
ref: I,
|
|
14670
14670
|
style: { outline: "none", ...g.style },
|
|
14671
14671
|
onKeyDown: ce(g.onKeyDown, (k) => {
|
|
14672
|
-
const q = k.target.closest("[data-radix-menu-content]") === k.currentTarget,
|
|
14673
|
-
q && (k.key === "Tab" && k.preventDefault(), !
|
|
14672
|
+
const q = k.target.closest("[data-radix-menu-content]") === k.currentTarget, N = k.ctrlKey || k.altKey || k.metaKey, F = k.key.length === 1;
|
|
14673
|
+
q && (k.key === "Tab" && k.preventDefault(), !N && F && Z(k.key));
|
|
14674
14674
|
const O = C.current;
|
|
14675
14675
|
if (k.target !== O || !fC.includes(k.key)) return;
|
|
14676
14676
|
k.preventDefault();
|
|
14677
|
-
const K = E().filter((
|
|
14677
|
+
const K = E().filter((L) => !L.disabled).map((L) => L.ref.current);
|
|
14678
14678
|
Ip.includes(k.key) && K.reverse(), OC(K);
|
|
14679
14679
|
}),
|
|
14680
14680
|
onBlur: ce(e.onBlur, (k) => {
|
|
14681
|
-
k.currentTarget.contains(k.target) || (window.clearTimeout(A.current),
|
|
14681
|
+
k.currentTarget.contains(k.target) || (window.clearTimeout(A.current), D.current = "");
|
|
14682
14682
|
}),
|
|
14683
14683
|
onPointerMove: ce(
|
|
14684
14684
|
e.onPointerMove,
|
|
14685
14685
|
vo((k) => {
|
|
14686
14686
|
const z = k.target, q = P.current !== k.clientX;
|
|
14687
14687
|
if (k.currentTarget.contains(z) && q) {
|
|
14688
|
-
const
|
|
14689
|
-
Y.current =
|
|
14688
|
+
const N = k.clientX > P.current ? "right" : "left";
|
|
14689
|
+
Y.current = N, P.current = k.clientX;
|
|
14690
14690
|
}
|
|
14691
14691
|
})
|
|
14692
14692
|
)
|
|
@@ -15360,7 +15360,7 @@ function RE({
|
|
|
15360
15360
|
validate: g,
|
|
15361
15361
|
onValidationError: x
|
|
15362
15362
|
}) {
|
|
15363
|
-
const b = a !== void 0, [w, S] = B.useState(e), E = (b ? a : w) ?? "", [T, y] = B.useTransition(), C = B.useRef(null),
|
|
15363
|
+
const b = a !== void 0, [w, S] = B.useState(e), E = (b ? a : w) ?? "", [T, y] = B.useTransition(), C = B.useRef(null), I = B.useRef(0), A = B.useRef(null), D = B.useRef("");
|
|
15364
15364
|
B.useEffect(() => {
|
|
15365
15365
|
if (!b && (S(e ?? ""), A.current = null, C.current)) {
|
|
15366
15366
|
const O = !e || e.trim() === "", _ = 44;
|
|
@@ -15373,7 +15373,7 @@ function RE({
|
|
|
15373
15373
|
), P = B.useMemo(() => g ?? Y, [g, Y]), V = B.useCallback(
|
|
15374
15374
|
(O) => {
|
|
15375
15375
|
const _ = P(O);
|
|
15376
|
-
return H(_), x == null || x(_),
|
|
15376
|
+
return H(_), x == null || x(_), D.current = O, _;
|
|
15377
15377
|
},
|
|
15378
15378
|
[P, x]
|
|
15379
15379
|
), X = B.useCallback(() => {
|
|
@@ -15385,8 +15385,8 @@ function RE({
|
|
|
15385
15385
|
return;
|
|
15386
15386
|
}
|
|
15387
15387
|
O.style.height = "auto";
|
|
15388
|
-
const
|
|
15389
|
-
O.style.height = `${
|
|
15388
|
+
const L = Math.max(O.scrollHeight, K);
|
|
15389
|
+
O.style.height = `${L}px`;
|
|
15390
15390
|
}, []);
|
|
15391
15391
|
B.useEffect(() => {
|
|
15392
15392
|
X();
|
|
@@ -15394,25 +15394,25 @@ function RE({
|
|
|
15394
15394
|
if (!M)
|
|
15395
15395
|
return;
|
|
15396
15396
|
const O = (E ?? "").trim();
|
|
15397
|
-
|
|
15397
|
+
D.current !== O && V(O);
|
|
15398
15398
|
}, [E, M, V]);
|
|
15399
15399
|
const Z = B.useCallback(
|
|
15400
15400
|
(O, { fromUser: _ }) => {
|
|
15401
15401
|
b || S(O), _ && (i == null || i(O));
|
|
15402
15402
|
},
|
|
15403
15403
|
[b, i]
|
|
15404
|
-
),
|
|
15404
|
+
), $ = B.useCallback(
|
|
15405
15405
|
async (O) => {
|
|
15406
15406
|
O && O.preventDefault();
|
|
15407
15407
|
const _ = (E ?? "").trim();
|
|
15408
15408
|
if (!_ && !f || V(_))
|
|
15409
15409
|
return;
|
|
15410
|
-
const K = ++
|
|
15410
|
+
const K = ++I.current;
|
|
15411
15411
|
A.current = {
|
|
15412
15412
|
id: K,
|
|
15413
15413
|
shouldClear: !0
|
|
15414
15414
|
}, y(() => {
|
|
15415
|
-
var
|
|
15415
|
+
var L, j, U;
|
|
15416
15416
|
try {
|
|
15417
15417
|
const Q = l(_);
|
|
15418
15418
|
Q && typeof Q.then == "function" ? Q.then(() => {
|
|
@@ -15421,7 +15421,7 @@ function RE({
|
|
|
15421
15421
|
}).catch(() => {
|
|
15422
15422
|
var ne;
|
|
15423
15423
|
((ne = A.current) == null ? void 0 : ne.id) === K && (A.current = null);
|
|
15424
|
-
}) : (((
|
|
15424
|
+
}) : (((L = A.current) == null ? void 0 : L.id) === K && A.current.shouldClear && (b || (S(""), C.current && (C.current.style.height = "auto"), i == null || i(""))), ((j = A.current) == null ? void 0 : j.id) === K && (A.current = null));
|
|
15425
15425
|
} catch {
|
|
15426
15426
|
((U = A.current) == null ? void 0 : U.id) === K && (A.current = null);
|
|
15427
15427
|
}
|
|
@@ -15433,10 +15433,10 @@ function RE({
|
|
|
15433
15433
|
Z(_, { fromUser: !0 }), A.current && (A.current.shouldClear = !1), C.current && (C.current.style.height = "auto", C.current.style.height = `${C.current.scrollHeight}px`), M && V(_.trim());
|
|
15434
15434
|
}, [Z, V, M]), z = B.useCallback(
|
|
15435
15435
|
(O) => {
|
|
15436
|
-
O.key === "Enter" && !O.shiftKey ? (O.preventDefault(),
|
|
15436
|
+
O.key === "Enter" && !O.shiftKey ? (O.preventDefault(), $()) : O.key === "Escape" && t && (O.preventDefault(), c == null || c());
|
|
15437
15437
|
},
|
|
15438
|
-
[
|
|
15439
|
-
),
|
|
15438
|
+
[$, t, c]
|
|
15439
|
+
), F = `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${t ? "border-[hsl(var(--ring))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))] dark:bg-[hsl(var(--card))] dark:text-[hsl(var(--card-foreground))]" : ""} ${m}`;
|
|
15440
15440
|
return /* @__PURE__ */ u.jsx("div", { className: `w-full ${p}`, children: /* @__PURE__ */ u.jsxs("div", { className: "flex items-end gap-2", children: [
|
|
15441
15441
|
/* @__PURE__ */ u.jsxs("div", { className: "flex-1", children: [
|
|
15442
15442
|
/* @__PURE__ */ u.jsx(
|
|
@@ -15447,7 +15447,7 @@ function RE({
|
|
|
15447
15447
|
onChange: k,
|
|
15448
15448
|
onKeyDown: z,
|
|
15449
15449
|
placeholder: t ? "Edit your message..." : n,
|
|
15450
|
-
className:
|
|
15450
|
+
className: F,
|
|
15451
15451
|
disabled: o,
|
|
15452
15452
|
maxLength: s,
|
|
15453
15453
|
rows: 1,
|
|
@@ -15475,7 +15475,7 @@ function RE({
|
|
|
15475
15475
|
it,
|
|
15476
15476
|
{
|
|
15477
15477
|
type: "button",
|
|
15478
|
-
onClick: (O) => void
|
|
15478
|
+
onClick: (O) => void $(O),
|
|
15479
15479
|
size: "icon",
|
|
15480
15480
|
className: `shrink-0 ${v ?? ""}`,
|
|
15481
15481
|
title: t ? "Save changes" : "Send message",
|
|
@@ -15507,23 +15507,23 @@ function Sh({
|
|
|
15507
15507
|
allowEmptySend: b = !1,
|
|
15508
15508
|
inputError: w = null
|
|
15509
15509
|
}) {
|
|
15510
|
-
const [S, E] = fe([]), T = Re(null), y = Re(null), [C,
|
|
15511
|
-
T.current && (T.current.value = ""), y.current && (y.current.value = ""),
|
|
15512
|
-
}, []),
|
|
15510
|
+
const [S, E] = fe([]), T = Re(null), y = Re(null), [C, I] = fe(0), [A, D] = fe(0), [M, H] = fe(!1), [Y, P] = fe(null), [V, X] = fe(null), Z = le(() => {
|
|
15511
|
+
T.current && (T.current.value = ""), y.current && (y.current.value = ""), I((_) => _ + 1), D((_) => _ + 1);
|
|
15512
|
+
}, []), $ = le((_) => {
|
|
15513
15513
|
E((K) => {
|
|
15514
|
-
const
|
|
15515
|
-
return g == null || g(
|
|
15514
|
+
const L = [...K, ..._];
|
|
15515
|
+
return g == null || g(L), L;
|
|
15516
15516
|
});
|
|
15517
15517
|
}, [g]), k = le(
|
|
15518
15518
|
(_) => {
|
|
15519
15519
|
const K = Array.from(_.target.files || []);
|
|
15520
|
-
|
|
15520
|
+
$(K), _.target.value = "";
|
|
15521
15521
|
},
|
|
15522
|
-
[
|
|
15522
|
+
[$]
|
|
15523
15523
|
), z = le((_) => {
|
|
15524
15524
|
E((K) => {
|
|
15525
|
-
const
|
|
15526
|
-
return
|
|
15525
|
+
const L = K.filter((j, U) => U !== _);
|
|
15526
|
+
return L.length === 0 && Z(), g == null || g(L), L;
|
|
15527
15527
|
});
|
|
15528
15528
|
}, [g, Z]), q = le(
|
|
15529
15529
|
async (_) => {
|
|
@@ -15532,8 +15532,8 @@ function Sh({
|
|
|
15532
15532
|
H(!0);
|
|
15533
15533
|
try {
|
|
15534
15534
|
await v(K), P(`Uploaded ${K.name} - processing through chat stream`);
|
|
15535
|
-
} catch (
|
|
15536
|
-
const j =
|
|
15535
|
+
} catch (L) {
|
|
15536
|
+
const j = L instanceof Error ? L.message : "Failed to upload Excel file";
|
|
15537
15537
|
X(j), x == null || x(j);
|
|
15538
15538
|
} finally {
|
|
15539
15539
|
H(!1), _.target.value = "", Z();
|
|
@@ -15541,10 +15541,10 @@ function Sh({
|
|
|
15541
15541
|
}
|
|
15542
15542
|
},
|
|
15543
15543
|
[v, x, Z]
|
|
15544
|
-
),
|
|
15544
|
+
), N = He(() => b || S.length > 0, [b, S]), F = le(
|
|
15545
15545
|
async (_) => {
|
|
15546
|
-
const
|
|
15547
|
-
return S.length > 0 && (E([]), g == null || g([]), Z()),
|
|
15546
|
+
const L = await n(_, S);
|
|
15547
|
+
return S.length > 0 && (E([]), g == null || g([]), Z()), L;
|
|
15548
15548
|
},
|
|
15549
15549
|
[n, Z, S]
|
|
15550
15550
|
), O = `resize-none min-h-[44px] max-h-[20rem] w-full transition-colors ${s ? "border-blue-400 bg-blue-50 text-blue-900 dark:border-blue-500 dark:bg-blue-950/60 dark:text-blue-50" : ""} ${w ? "border-red-400" : ""} ${p.textarea || ""} ${d}`;
|
|
@@ -15660,10 +15660,10 @@ function Sh({
|
|
|
15660
15660
|
placeholder: s ? "Edit your message..." : i,
|
|
15661
15661
|
isStreaming: l,
|
|
15662
15662
|
disabled: c,
|
|
15663
|
-
onSend:
|
|
15663
|
+
onSend: F,
|
|
15664
15664
|
onCancelEdit: r,
|
|
15665
15665
|
onStop: o,
|
|
15666
|
-
allowEmptySend:
|
|
15666
|
+
allowEmptySend: N,
|
|
15667
15667
|
textareaClassName: O,
|
|
15668
15668
|
sendButtonClassName: p.sendButton
|
|
15669
15669
|
}
|
|
@@ -15698,9 +15698,9 @@ function io({
|
|
|
15698
15698
|
}) {
|
|
15699
15699
|
const { chatApi: E } = dr(), T = E.baseUrl, { currentThreadId: y } = Ro(), {
|
|
15700
15700
|
threadId: C,
|
|
15701
|
-
messages:
|
|
15701
|
+
messages: I,
|
|
15702
15702
|
isLoading: A,
|
|
15703
|
-
navigateToCheckpoint:
|
|
15703
|
+
navigateToCheckpoint: D,
|
|
15704
15704
|
returnToLatest: M,
|
|
15705
15705
|
checkpoint: H,
|
|
15706
15706
|
checkpoints: Y,
|
|
@@ -15708,14 +15708,14 @@ function io({
|
|
|
15708
15708
|
metadata: V,
|
|
15709
15709
|
checkpointIndex: X,
|
|
15710
15710
|
respondToInterrupt: Z
|
|
15711
|
-
} = Bs(), { isStreaming:
|
|
15711
|
+
} = Bs(), { isStreaming: $, error: k, connectionState: z, submit: q, stop: N } = $w(), F = C ?? y ?? null, O = (H == null ? void 0 : H.id) ?? null, _ = (H == null ? void 0 : H.namespace) ?? null, K = (V == null ? void 0 : V.assemblingMessageId) ?? null;
|
|
15712
15712
|
B.useEffect(() => {
|
|
15713
|
-
console.log("[ChatInterface] streamingAssistantId changed:", { streamingAssistantId: K, isStreaming:
|
|
15714
|
-
}, [K,
|
|
15715
|
-
const
|
|
15713
|
+
console.log("[ChatInterface] streamingAssistantId changed:", { streamingAssistantId: K, isStreaming: $, assemblingMessageId: V == null ? void 0 : V.assemblingMessageId });
|
|
15714
|
+
}, [K, $, V == null ? void 0 : V.assemblingMessageId]);
|
|
15715
|
+
const L = P, j = L ? fd(L.id) : null, U = j !== null ? { type: "interrupt", id: j } : null, [Q, ne] = fe(!1), [J, de] = fe(!1);
|
|
15716
15716
|
Fe(() => {
|
|
15717
|
-
|
|
15718
|
-
}, [
|
|
15717
|
+
L || ne(!1);
|
|
15718
|
+
}, [L]);
|
|
15719
15719
|
const ve = le(() => {
|
|
15720
15720
|
ne(!0);
|
|
15721
15721
|
}, []), Ae = le(() => {
|
|
@@ -15751,7 +15751,7 @@ function io({
|
|
|
15751
15751
|
), Ke = le(
|
|
15752
15752
|
(ee, ue) => $e(!0, ue),
|
|
15753
15753
|
[$e]
|
|
15754
|
-
), Be = !!
|
|
15754
|
+
), Be = !!L || Q, [Ue, ft] = fe(null), [Ne, Qe] = fe(""), [lt, at] = fe(null), [nt, wt] = fe(null), [xt, _t] = fe(!1), [Ot, jt] = fe(null), St = Re(!1), [bt, Ve] = fe(() => wu.value), Xe = Re(bt), ct = Re(null), vt = le((ee) => {
|
|
15755
15755
|
wu.value = ee, Ve(ee);
|
|
15756
15756
|
}, []), [Rt, pt] = fe(!1), Dt = Re(null), ye = le(
|
|
15757
15757
|
(ee) => {
|
|
@@ -15760,8 +15760,8 @@ function io({
|
|
|
15760
15760
|
[vt]
|
|
15761
15761
|
);
|
|
15762
15762
|
Fe(() => {
|
|
15763
|
-
|
|
15764
|
-
}, [
|
|
15763
|
+
$ || de(!1);
|
|
15764
|
+
}, [$]), Fe(() => {
|
|
15765
15765
|
V != null && V.assemblingMessageId && de(!1);
|
|
15766
15766
|
}, [V == null ? void 0 : V.assemblingMessageId]);
|
|
15767
15767
|
const [De, ze] = fe("desktop");
|
|
@@ -15773,7 +15773,7 @@ function io({
|
|
|
15773
15773
|
return ee(), window.addEventListener("resize", ee), () => window.removeEventListener("resize", ee);
|
|
15774
15774
|
}, []), Fe(() => {
|
|
15775
15775
|
St.current = !1;
|
|
15776
|
-
}, [
|
|
15776
|
+
}, [F]), Fe(() => {
|
|
15777
15777
|
Xe.current = bt;
|
|
15778
15778
|
}, [bt]), Fe(() => {
|
|
15779
15779
|
if (!Ue) {
|
|
@@ -15852,8 +15852,8 @@ function io({
|
|
|
15852
15852
|
), se = le((ee) => {
|
|
15853
15853
|
let ue = null;
|
|
15854
15854
|
for (let Ee = ee - 1; Ee >= 0; Ee--)
|
|
15855
|
-
if (
|
|
15856
|
-
ue =
|
|
15855
|
+
if (I[Ee].role === "user") {
|
|
15856
|
+
ue = I[Ee];
|
|
15857
15857
|
break;
|
|
15858
15858
|
}
|
|
15859
15859
|
if (!ue) return;
|
|
@@ -15873,7 +15873,7 @@ function io({
|
|
|
15873
15873
|
originalMessageId: ue.id
|
|
15874
15874
|
}
|
|
15875
15875
|
);
|
|
15876
|
-
}, [
|
|
15876
|
+
}, [I, q, O, _, f]), ae = le(
|
|
15877
15877
|
async (ee) => {
|
|
15878
15878
|
if (y) {
|
|
15879
15879
|
pt(!0);
|
|
@@ -15886,7 +15886,7 @@ function io({
|
|
|
15886
15886
|
return;
|
|
15887
15887
|
}
|
|
15888
15888
|
const ue = Y.find((Ce) => Ce.checkpointId === ee), ge = (ue == null ? void 0 : ue.checkpointNs) ?? null;
|
|
15889
|
-
await
|
|
15889
|
+
await D(ee, ge), requestAnimationFrame(() => {
|
|
15890
15890
|
var Ce;
|
|
15891
15891
|
(Ce = Dt.current) == null || Ce.scrollToTop();
|
|
15892
15892
|
});
|
|
@@ -15899,7 +15899,7 @@ function io({
|
|
|
15899
15899
|
Y,
|
|
15900
15900
|
y,
|
|
15901
15901
|
Dt,
|
|
15902
|
-
|
|
15902
|
+
D,
|
|
15903
15903
|
M
|
|
15904
15904
|
]
|
|
15905
15905
|
), pe = le(
|
|
@@ -15907,7 +15907,7 @@ function io({
|
|
|
15907
15907
|
await ae(ge ? null : ee);
|
|
15908
15908
|
},
|
|
15909
15909
|
[ae]
|
|
15910
|
-
), tt = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${v.container || ""}`, R = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 ${
|
|
15910
|
+
), tt = `flex flex-1 w-full flex-col min-h-0 min-w-0 max-h-full overflow-hidden bg-transparent ${e} ${v.container || ""}`, R = `flex-1 min-h-0 min-w-0 max-h-full w-full overflow-hidden overscroll-contain break-words break-anywhere p-4 ${L ? "pb-32" : ""} bg-transparent ${v.messagesArea || ""}`, te = `relative flex-shrink-0 w-full border-t p-4 bg-transparent ${v.inputArea || ""}`;
|
|
15911
15911
|
return /* @__PURE__ */ u.jsxs("div", { className: tt, children: [
|
|
15912
15912
|
!!k && !xt && /* @__PURE__ */ u.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: [
|
|
15913
15913
|
/* @__PURE__ */ u.jsx("span", { children: k }),
|
|
@@ -15935,8 +15935,8 @@ function io({
|
|
|
15935
15935
|
ref: Dt,
|
|
15936
15936
|
className: "h-full",
|
|
15937
15937
|
style: { height: "100%" },
|
|
15938
|
-
messages:
|
|
15939
|
-
isStreaming:
|
|
15938
|
+
messages: I,
|
|
15939
|
+
isStreaming: $,
|
|
15940
15940
|
streamingAssistantId: K,
|
|
15941
15941
|
streamingDebounceMs: o,
|
|
15942
15942
|
followNewMessages: s,
|
|
@@ -15972,7 +15972,7 @@ function io({
|
|
|
15972
15972
|
/* @__PURE__ */ u.jsx(Xn, { className: "h-6 w-6 animate-spin" }),
|
|
15973
15973
|
/* @__PURE__ */ u.jsx("span", { className: "text-xs font-semibold uppercase tracking-wide", children: "Loading checkpoint…" })
|
|
15974
15974
|
] }),
|
|
15975
|
-
|
|
15975
|
+
L && U && /* @__PURE__ */ u.jsx("div", { className: "pointer-events-auto absolute inset-x-0 bottom-6 z-30 flex justify-center px-4", children: /* @__PURE__ */ u.jsx("div", { className: "w-full max-w-3xl", children: /* @__PURE__ */ u.jsx(
|
|
15976
15976
|
gf,
|
|
15977
15977
|
{
|
|
15978
15978
|
interruptPart: U,
|
|
@@ -15981,7 +15981,7 @@ function io({
|
|
|
15981
15981
|
onSelectAlternative: Ke,
|
|
15982
15982
|
disabled: Q,
|
|
15983
15983
|
isActive: !0,
|
|
15984
|
-
payload:
|
|
15984
|
+
payload: L.value
|
|
15985
15985
|
}
|
|
15986
15986
|
) }) })
|
|
15987
15987
|
]
|
|
@@ -16012,11 +16012,11 @@ function io({
|
|
|
16012
16012
|
onComposerChange: ye,
|
|
16013
16013
|
onSend: rt,
|
|
16014
16014
|
onCancelEdit: yt,
|
|
16015
|
-
onStop:
|
|
16015
|
+
onStop: N,
|
|
16016
16016
|
editingMessageId: Ue,
|
|
16017
16017
|
editingInitialValue: Ne,
|
|
16018
16018
|
placeholder: Ue ? "Edit your message..." : t,
|
|
16019
|
-
isStreaming:
|
|
16019
|
+
isStreaming: $,
|
|
16020
16020
|
disabled: Be,
|
|
16021
16021
|
enableFileUpload: a,
|
|
16022
16022
|
enableExcelUpload: i,
|
|
@@ -16047,22 +16047,22 @@ function $E(e, t, n) {
|
|
|
16047
16047
|
}
|
|
16048
16048
|
var Qr = '[cmdk-group=""]', Va = '[cmdk-group-items=""]', FE = '[cmdk-group-heading=""]', Ch = '[cmdk-item=""]', Su = `${Ch}:not([aria-disabled="true"])`, xi = "cmdk-item-select", yr = "data-value", BE = (e, t, n) => $E(e, t, n), Eh = h.createContext(void 0), $o = () => h.useContext(Eh), kh = h.createContext(void 0), jl = () => h.useContext(kh), Rh = h.createContext(void 0), Ih = h.forwardRef((e, t) => {
|
|
16049
16049
|
let n = Sr(() => {
|
|
16050
|
-
var
|
|
16051
|
-
return { search: "", value: (
|
|
16050
|
+
var N, F;
|
|
16051
|
+
return { search: "", value: (F = (N = e.value) != null ? N : e.defaultValue) != null ? F : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
|
|
16052
16052
|
}), r = Sr(() => /* @__PURE__ */ new Set()), o = Sr(() => /* @__PURE__ */ new Map()), s = Sr(() => /* @__PURE__ */ new Map()), a = Sr(() => /* @__PURE__ */ new Set()), i = Nh(e), { label: l, children: c, value: d, onValueChange: p, filter: m, shouldFilter: f, loop: v, disablePointerSelection: g = !1, vimBindings: x = !0, ...b } = e, w = Mt(), S = Mt(), E = Mt(), T = h.useRef(null), y = JE();
|
|
16053
16053
|
lr(() => {
|
|
16054
16054
|
if (d !== void 0) {
|
|
16055
|
-
let
|
|
16056
|
-
n.current.value =
|
|
16055
|
+
let N = d.trim();
|
|
16056
|
+
n.current.value = N, C.emit();
|
|
16057
16057
|
}
|
|
16058
16058
|
}, [d]), lr(() => {
|
|
16059
16059
|
y(6, Y);
|
|
16060
16060
|
}, []);
|
|
16061
|
-
let C = h.useMemo(() => ({ subscribe: (
|
|
16062
|
-
var _, K,
|
|
16063
|
-
if (!Object.is(n.current[
|
|
16064
|
-
if (n.current[
|
|
16065
|
-
else if (
|
|
16061
|
+
let C = h.useMemo(() => ({ subscribe: (N) => (a.current.add(N), () => a.current.delete(N)), snapshot: () => n.current, setState: (N, F, O) => {
|
|
16062
|
+
var _, K, L, j;
|
|
16063
|
+
if (!Object.is(n.current[N], F)) {
|
|
16064
|
+
if (n.current[N] = F, N === "search") H(), D(), y(1, M);
|
|
16065
|
+
else if (N === "value") {
|
|
16066
16066
|
if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
|
|
16067
16067
|
let U = document.getElementById(E);
|
|
16068
16068
|
U ? U.focus() : (_ = document.getElementById(w)) == null || _.focus();
|
|
@@ -16071,147 +16071,147 @@ var Qr = '[cmdk-group=""]', Va = '[cmdk-group-items=""]', FE = '[cmdk-group-head
|
|
|
16071
16071
|
var U;
|
|
16072
16072
|
n.current.selectedItemId = (U = P()) == null ? void 0 : U.id, C.emit();
|
|
16073
16073
|
}), O || y(5, Y), ((K = i.current) == null ? void 0 : K.value) !== void 0) {
|
|
16074
|
-
let U =
|
|
16075
|
-
(j = (
|
|
16074
|
+
let U = F ?? "";
|
|
16075
|
+
(j = (L = i.current).onValueChange) == null || j.call(L, U);
|
|
16076
16076
|
return;
|
|
16077
16077
|
}
|
|
16078
16078
|
}
|
|
16079
16079
|
C.emit();
|
|
16080
16080
|
}
|
|
16081
16081
|
}, emit: () => {
|
|
16082
|
-
a.current.forEach((
|
|
16083
|
-
} }), []),
|
|
16082
|
+
a.current.forEach((N) => N());
|
|
16083
|
+
} }), []), I = h.useMemo(() => ({ value: (N, F, O) => {
|
|
16084
16084
|
var _;
|
|
16085
|
-
|
|
16086
|
-
|
|
16085
|
+
F !== ((_ = s.current.get(N)) == null ? void 0 : _.value) && (s.current.set(N, { value: F, keywords: O }), n.current.filtered.items.set(N, A(F, O)), y(2, () => {
|
|
16086
|
+
D(), C.emit();
|
|
16087
16087
|
}));
|
|
16088
|
-
}, item: (
|
|
16089
|
-
H(),
|
|
16088
|
+
}, item: (N, F) => (r.current.add(N), F && (o.current.has(F) ? o.current.get(F).add(N) : o.current.set(F, /* @__PURE__ */ new Set([N]))), y(3, () => {
|
|
16089
|
+
H(), D(), n.current.value || M(), C.emit();
|
|
16090
16090
|
}), () => {
|
|
16091
|
-
s.current.delete(
|
|
16091
|
+
s.current.delete(N), r.current.delete(N), n.current.filtered.items.delete(N);
|
|
16092
16092
|
let O = P();
|
|
16093
16093
|
y(4, () => {
|
|
16094
|
-
H(), (O == null ? void 0 : O.getAttribute("id")) ===
|
|
16094
|
+
H(), (O == null ? void 0 : O.getAttribute("id")) === N && M(), C.emit();
|
|
16095
16095
|
});
|
|
16096
|
-
}), group: (
|
|
16097
|
-
s.current.delete(
|
|
16096
|
+
}), group: (N) => (o.current.has(N) || o.current.set(N, /* @__PURE__ */ new Set()), () => {
|
|
16097
|
+
s.current.delete(N), o.current.delete(N);
|
|
16098
16098
|
}), filter: () => i.current.shouldFilter, label: l || e["aria-label"], getDisablePointerSelection: () => i.current.disablePointerSelection, listId: w, inputId: E, labelId: S, listInnerRef: T }), []);
|
|
16099
|
-
function A(
|
|
16099
|
+
function A(N, F) {
|
|
16100
16100
|
var O, _;
|
|
16101
16101
|
let K = (_ = (O = i.current) == null ? void 0 : O.filter) != null ? _ : BE;
|
|
16102
|
-
return
|
|
16102
|
+
return N ? K(N, n.current.search, F) : 0;
|
|
16103
16103
|
}
|
|
16104
|
-
function
|
|
16104
|
+
function D() {
|
|
16105
16105
|
if (!n.current.search || i.current.shouldFilter === !1) return;
|
|
16106
|
-
let
|
|
16106
|
+
let N = n.current.filtered.items, F = [];
|
|
16107
16107
|
n.current.filtered.groups.forEach((_) => {
|
|
16108
|
-
let K = o.current.get(_),
|
|
16108
|
+
let K = o.current.get(_), L = 0;
|
|
16109
16109
|
K.forEach((j) => {
|
|
16110
|
-
let U =
|
|
16111
|
-
|
|
16112
|
-
}),
|
|
16110
|
+
let U = N.get(j);
|
|
16111
|
+
L = Math.max(U, L);
|
|
16112
|
+
}), F.push([_, L]);
|
|
16113
16113
|
});
|
|
16114
16114
|
let O = T.current;
|
|
16115
16115
|
V().sort((_, K) => {
|
|
16116
|
-
var
|
|
16116
|
+
var L, j;
|
|
16117
16117
|
let U = _.getAttribute("id"), Q = K.getAttribute("id");
|
|
16118
|
-
return ((
|
|
16118
|
+
return ((L = N.get(Q)) != null ? L : 0) - ((j = N.get(U)) != null ? j : 0);
|
|
16119
16119
|
}).forEach((_) => {
|
|
16120
16120
|
let K = _.closest(Va);
|
|
16121
16121
|
K ? K.appendChild(_.parentElement === K ? _ : _.closest(`${Va} > *`)) : O.appendChild(_.parentElement === O ? _ : _.closest(`${Va} > *`));
|
|
16122
|
-
}),
|
|
16122
|
+
}), F.sort((_, K) => K[1] - _[1]).forEach((_) => {
|
|
16123
16123
|
var K;
|
|
16124
|
-
let
|
|
16125
|
-
|
|
16124
|
+
let L = (K = T.current) == null ? void 0 : K.querySelector(`${Qr}[${yr}="${encodeURIComponent(_[0])}"]`);
|
|
16125
|
+
L == null || L.parentElement.appendChild(L);
|
|
16126
16126
|
});
|
|
16127
16127
|
}
|
|
16128
16128
|
function M() {
|
|
16129
|
-
let
|
|
16130
|
-
C.setState("value",
|
|
16129
|
+
let N = V().find((O) => O.getAttribute("aria-disabled") !== "true"), F = N == null ? void 0 : N.getAttribute(yr);
|
|
16130
|
+
C.setState("value", F || void 0);
|
|
16131
16131
|
}
|
|
16132
16132
|
function H() {
|
|
16133
|
-
var
|
|
16133
|
+
var N, F, O, _;
|
|
16134
16134
|
if (!n.current.search || i.current.shouldFilter === !1) {
|
|
16135
16135
|
n.current.filtered.count = r.current.size;
|
|
16136
16136
|
return;
|
|
16137
16137
|
}
|
|
16138
16138
|
n.current.filtered.groups = /* @__PURE__ */ new Set();
|
|
16139
16139
|
let K = 0;
|
|
16140
|
-
for (let
|
|
16141
|
-
let j = (
|
|
16142
|
-
n.current.filtered.items.set(
|
|
16140
|
+
for (let L of r.current) {
|
|
16141
|
+
let j = (F = (N = s.current.get(L)) == null ? void 0 : N.value) != null ? F : "", U = (_ = (O = s.current.get(L)) == null ? void 0 : O.keywords) != null ? _ : [], Q = A(j, U);
|
|
16142
|
+
n.current.filtered.items.set(L, Q), Q > 0 && K++;
|
|
16143
16143
|
}
|
|
16144
|
-
for (let [
|
|
16145
|
-
n.current.filtered.groups.add(
|
|
16144
|
+
for (let [L, j] of o.current) for (let U of j) if (n.current.filtered.items.get(U) > 0) {
|
|
16145
|
+
n.current.filtered.groups.add(L);
|
|
16146
16146
|
break;
|
|
16147
16147
|
}
|
|
16148
16148
|
n.current.filtered.count = K;
|
|
16149
16149
|
}
|
|
16150
16150
|
function Y() {
|
|
16151
|
-
var
|
|
16151
|
+
var N, F, O;
|
|
16152
16152
|
let _ = P();
|
|
16153
|
-
_ && (((
|
|
16153
|
+
_ && (((N = _.parentElement) == null ? void 0 : N.firstChild) === _ && ((O = (F = _.closest(Qr)) == null ? void 0 : F.querySelector(FE)) == null || O.scrollIntoView({ block: "nearest" })), _.scrollIntoView({ block: "nearest" }));
|
|
16154
16154
|
}
|
|
16155
16155
|
function P() {
|
|
16156
|
-
var
|
|
16157
|
-
return (
|
|
16156
|
+
var N;
|
|
16157
|
+
return (N = T.current) == null ? void 0 : N.querySelector(`${Ch}[aria-selected="true"]`);
|
|
16158
16158
|
}
|
|
16159
16159
|
function V() {
|
|
16160
|
-
var
|
|
16161
|
-
return Array.from(((
|
|
16162
|
-
}
|
|
16163
|
-
function X(
|
|
16164
|
-
let
|
|
16165
|
-
|
|
16166
|
-
}
|
|
16167
|
-
function Z(
|
|
16168
|
-
var
|
|
16169
|
-
let O = P(), _ = V(), K = _.findIndex((j) => j === O),
|
|
16170
|
-
(
|
|
16171
|
-
}
|
|
16172
|
-
function
|
|
16173
|
-
let
|
|
16174
|
-
for (; O && !_; ) O =
|
|
16175
|
-
_ ? C.setState("value", _.getAttribute(yr)) : Z(
|
|
16176
|
-
}
|
|
16177
|
-
let k = () => X(V().length - 1), z = (
|
|
16178
|
-
|
|
16179
|
-
}, q = (
|
|
16180
|
-
|
|
16160
|
+
var N;
|
|
16161
|
+
return Array.from(((N = T.current) == null ? void 0 : N.querySelectorAll(Su)) || []);
|
|
16162
|
+
}
|
|
16163
|
+
function X(N) {
|
|
16164
|
+
let F = V()[N];
|
|
16165
|
+
F && C.setState("value", F.getAttribute(yr));
|
|
16166
|
+
}
|
|
16167
|
+
function Z(N) {
|
|
16168
|
+
var F;
|
|
16169
|
+
let O = P(), _ = V(), K = _.findIndex((j) => j === O), L = _[K + N];
|
|
16170
|
+
(F = i.current) != null && F.loop && (L = K + N < 0 ? _[_.length - 1] : K + N === _.length ? _[0] : _[K + N]), L && C.setState("value", L.getAttribute(yr));
|
|
16171
|
+
}
|
|
16172
|
+
function $(N) {
|
|
16173
|
+
let F = P(), O = F == null ? void 0 : F.closest(Qr), _;
|
|
16174
|
+
for (; O && !_; ) O = N > 0 ? YE(O, Qr) : XE(O, Qr), _ = O == null ? void 0 : O.querySelector(Su);
|
|
16175
|
+
_ ? C.setState("value", _.getAttribute(yr)) : Z(N);
|
|
16176
|
+
}
|
|
16177
|
+
let k = () => X(V().length - 1), z = (N) => {
|
|
16178
|
+
N.preventDefault(), N.metaKey ? k() : N.altKey ? $(1) : Z(1);
|
|
16179
|
+
}, q = (N) => {
|
|
16180
|
+
N.preventDefault(), N.metaKey ? X(0) : N.altKey ? $(-1) : Z(-1);
|
|
16181
16181
|
};
|
|
16182
|
-
return h.createElement(xe.div, { ref: t, tabIndex: -1, ...b, "cmdk-root": "", onKeyDown: (
|
|
16183
|
-
var
|
|
16184
|
-
(
|
|
16185
|
-
let O =
|
|
16186
|
-
if (!(
|
|
16182
|
+
return h.createElement(xe.div, { ref: t, tabIndex: -1, ...b, "cmdk-root": "", onKeyDown: (N) => {
|
|
16183
|
+
var F;
|
|
16184
|
+
(F = b.onKeyDown) == null || F.call(b, N);
|
|
16185
|
+
let O = N.nativeEvent.isComposing || N.keyCode === 229;
|
|
16186
|
+
if (!(N.defaultPrevented || O)) switch (N.key) {
|
|
16187
16187
|
case "n":
|
|
16188
16188
|
case "j": {
|
|
16189
|
-
x &&
|
|
16189
|
+
x && N.ctrlKey && z(N);
|
|
16190
16190
|
break;
|
|
16191
16191
|
}
|
|
16192
16192
|
case "ArrowDown": {
|
|
16193
|
-
z(
|
|
16193
|
+
z(N);
|
|
16194
16194
|
break;
|
|
16195
16195
|
}
|
|
16196
16196
|
case "p":
|
|
16197
16197
|
case "k": {
|
|
16198
|
-
x &&
|
|
16198
|
+
x && N.ctrlKey && q(N);
|
|
16199
16199
|
break;
|
|
16200
16200
|
}
|
|
16201
16201
|
case "ArrowUp": {
|
|
16202
|
-
q(
|
|
16202
|
+
q(N);
|
|
16203
16203
|
break;
|
|
16204
16204
|
}
|
|
16205
16205
|
case "Home": {
|
|
16206
|
-
|
|
16206
|
+
N.preventDefault(), X(0);
|
|
16207
16207
|
break;
|
|
16208
16208
|
}
|
|
16209
16209
|
case "End": {
|
|
16210
|
-
|
|
16210
|
+
N.preventDefault(), k();
|
|
16211
16211
|
break;
|
|
16212
16212
|
}
|
|
16213
16213
|
case "Enter": {
|
|
16214
|
-
|
|
16214
|
+
N.preventDefault();
|
|
16215
16215
|
let _ = P();
|
|
16216
16216
|
if (_) {
|
|
16217
16217
|
let K = new Event(xi);
|
|
@@ -16219,7 +16219,7 @@ var Qr = '[cmdk-group=""]', Va = '[cmdk-group-items=""]', FE = '[cmdk-group-head
|
|
|
16219
16219
|
}
|
|
16220
16220
|
}
|
|
16221
16221
|
}
|
|
16222
|
-
} }, h.createElement("label", { "cmdk-label": "", htmlFor:
|
|
16222
|
+
} }, h.createElement("label", { "cmdk-label": "", htmlFor: I.inputId, id: I.labelId, style: QE }, l), ia(e, (N) => h.createElement(kh.Provider, { value: C }, h.createElement(Eh.Provider, { value: I }, N))));
|
|
16223
16223
|
}), zE = h.forwardRef((e, t) => {
|
|
16224
16224
|
var n, r;
|
|
16225
16225
|
let o = Mt(), s = h.useRef(null), a = h.useContext(Rh), i = $o(), l = Nh(e), c = (r = (n = l.current) == null ? void 0 : n.forceMount) != null ? r : a == null ? void 0 : a.forceMount;
|
|
@@ -16429,13 +16429,13 @@ var _l = "ScrollArea", [Lh, I1] = cn(_l), [nk, un] = Lh(_l), $h = h.forwardRef(
|
|
|
16429
16429
|
dir: o,
|
|
16430
16430
|
scrollHideDelay: s = 600,
|
|
16431
16431
|
...a
|
|
16432
|
-
} = e, [i, l] = h.useState(null), [c, d] = h.useState(null), [p, m] = h.useState(null), [f, v] = h.useState(null), [g, x] = h.useState(null), [b, w] = h.useState(0), [S, E] = h.useState(0), [T, y] = h.useState(!1), [C,
|
|
16432
|
+
} = e, [i, l] = h.useState(null), [c, d] = h.useState(null), [p, m] = h.useState(null), [f, v] = h.useState(null), [g, x] = h.useState(null), [b, w] = h.useState(0), [S, E] = h.useState(0), [T, y] = h.useState(!1), [C, I] = h.useState(!1), A = Oe(t, (M) => l(M)), D = Zs(o);
|
|
16433
16433
|
return /* @__PURE__ */ u.jsx(
|
|
16434
16434
|
nk,
|
|
16435
16435
|
{
|
|
16436
16436
|
scope: n,
|
|
16437
16437
|
type: r,
|
|
16438
|
-
dir:
|
|
16438
|
+
dir: D,
|
|
16439
16439
|
scrollHideDelay: s,
|
|
16440
16440
|
scrollArea: i,
|
|
16441
16441
|
viewport: c,
|
|
@@ -16449,13 +16449,13 @@ var _l = "ScrollArea", [Lh, I1] = cn(_l), [nk, un] = Lh(_l), $h = h.forwardRef(
|
|
|
16449
16449
|
scrollbarY: g,
|
|
16450
16450
|
onScrollbarYChange: x,
|
|
16451
16451
|
scrollbarYEnabled: C,
|
|
16452
|
-
onScrollbarYEnabledChange:
|
|
16452
|
+
onScrollbarYEnabledChange: I,
|
|
16453
16453
|
onCornerWidthChange: w,
|
|
16454
16454
|
onCornerHeightChange: E,
|
|
16455
16455
|
children: /* @__PURE__ */ u.jsx(
|
|
16456
16456
|
xe.div,
|
|
16457
16457
|
{
|
|
16458
|
-
dir:
|
|
16458
|
+
dir: D,
|
|
16459
16459
|
...a,
|
|
16460
16460
|
ref: A,
|
|
16461
16461
|
style: {
|
|
@@ -16752,16 +16752,16 @@ var rk = h.forwardRef((e, t) => {
|
|
|
16752
16752
|
onResize: p,
|
|
16753
16753
|
...m
|
|
16754
16754
|
} = e, f = un(In, n), [v, g] = h.useState(null), x = Oe(t, (A) => g(A)), b = h.useRef(null), w = h.useRef(""), S = f.viewport, E = r.content - r.viewport, T = Et(d), y = Et(l), C = ca(p, 10);
|
|
16755
|
-
function
|
|
16755
|
+
function I(A) {
|
|
16756
16756
|
if (b.current) {
|
|
16757
|
-
const
|
|
16758
|
-
c({ x:
|
|
16757
|
+
const D = A.clientX - b.current.left, M = A.clientY - b.current.top;
|
|
16758
|
+
c({ x: D, y: M });
|
|
16759
16759
|
}
|
|
16760
16760
|
}
|
|
16761
16761
|
return h.useEffect(() => {
|
|
16762
|
-
const A = (
|
|
16763
|
-
const M =
|
|
16764
|
-
(v == null ? void 0 : v.contains(M)) && T(
|
|
16762
|
+
const A = (D) => {
|
|
16763
|
+
const M = D.target;
|
|
16764
|
+
(v == null ? void 0 : v.contains(M)) && T(D, E);
|
|
16765
16765
|
};
|
|
16766
16766
|
return document.addEventListener("wheel", A, { passive: !1 }), () => document.removeEventListener("wheel", A, { passive: !1 });
|
|
16767
16767
|
}, [S, v, E, T]), h.useEffect(y, [r, y]), Or(v, C), Or(f.content, C), /* @__PURE__ */ u.jsx(
|
|
@@ -16781,12 +16781,12 @@ var rk = h.forwardRef((e, t) => {
|
|
|
16781
16781
|
ref: x,
|
|
16782
16782
|
style: { position: "absolute", ...m.style },
|
|
16783
16783
|
onPointerDown: ce(e.onPointerDown, (A) => {
|
|
16784
|
-
A.button === 0 && (A.target.setPointerCapture(A.pointerId), b.current = v.getBoundingClientRect(), w.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", f.viewport && (f.viewport.style.scrollBehavior = "auto"),
|
|
16784
|
+
A.button === 0 && (A.target.setPointerCapture(A.pointerId), b.current = v.getBoundingClientRect(), w.current = document.body.style.webkitUserSelect, document.body.style.webkitUserSelect = "none", f.viewport && (f.viewport.style.scrollBehavior = "auto"), I(A));
|
|
16785
16785
|
}),
|
|
16786
|
-
onPointerMove: ce(e.onPointerMove,
|
|
16786
|
+
onPointerMove: ce(e.onPointerMove, I),
|
|
16787
16787
|
onPointerUp: ce(e.onPointerUp, (A) => {
|
|
16788
|
-
const
|
|
16789
|
-
|
|
16788
|
+
const D = A.target;
|
|
16789
|
+
D.hasPointerCapture(A.pointerId) && D.releasePointerCapture(A.pointerId), document.body.style.webkitUserSelect = w.current, f.viewport && (f.viewport.style.scrollBehavior = ""), b.current = null;
|
|
16790
16790
|
})
|
|
16791
16791
|
}
|
|
16792
16792
|
)
|
|
@@ -17253,16 +17253,16 @@ function wi({
|
|
|
17253
17253
|
}) {
|
|
17254
17254
|
const { chatApi: T, authApi: y } = dr(), {
|
|
17255
17255
|
threads: C,
|
|
17256
|
-
sharedThreads:
|
|
17256
|
+
sharedThreads: I,
|
|
17257
17257
|
currentThreadId: A,
|
|
17258
|
-
setCurrentThreadId:
|
|
17258
|
+
setCurrentThreadId: D,
|
|
17259
17259
|
isLoading: M,
|
|
17260
17260
|
isLoadingSharedThreads: H,
|
|
17261
17261
|
actions: Y,
|
|
17262
17262
|
shareInFlight: P,
|
|
17263
17263
|
shareStatus: V,
|
|
17264
17264
|
clearShareStatus: X
|
|
17265
|
-
} = Ro(), { createThread: Z, deleteThread:
|
|
17265
|
+
} = Ro(), { createThread: Z, deleteThread: $, renameThread: k, shareThread: z } = Y, { loadThread: q } = Bs(), N = a ?? A, [F, O] = fe(Array.isArray(C) ? C : []), _ = Re(F.length > 0), K = Re(null), L = Re(0), [j, U] = fe(null), [Q, ne] = fe(""), [J, de] = fe(!1), [ve, Ae] = fe(!1), [qe, Me] = fe(null), [Ye, $e] = fe(""), [mt, gt] = fe([]), [Ke, Be] = fe(!1);
|
|
17266
17266
|
Fe(() => {
|
|
17267
17267
|
ve && !b && mt.length === 0 && !Ke && (async () => {
|
|
17268
17268
|
Be(!0);
|
|
@@ -17304,7 +17304,7 @@ function wi({
|
|
|
17304
17304
|
), jt = He(() => {
|
|
17305
17305
|
const W = Ue, se = Ye.trim().toLowerCase();
|
|
17306
17306
|
return se ? S ? W.filter((ae) => S(ae, se)) : W.filter((ae) => `${ae.label} ${ae.secondaryLabel ?? ""}`.toLowerCase().includes(se)) : W;
|
|
17307
|
-
}, [b, Ye, S]), St = at === "shared", bt = St ?
|
|
17307
|
+
}, [b, Ye, S]), St = at === "shared", bt = St ? I : F, Ve = He(() => {
|
|
17308
17308
|
if (!E || St) return null;
|
|
17309
17309
|
const W = {}, se = "Default";
|
|
17310
17310
|
return bt.forEach((ae) => {
|
|
@@ -17336,15 +17336,15 @@ function wi({
|
|
|
17336
17336
|
let se = null, ae = null;
|
|
17337
17337
|
return se = requestAnimationFrame(() => {
|
|
17338
17338
|
ae = requestAnimationFrame(() => {
|
|
17339
|
-
W.scrollTop =
|
|
17339
|
+
W.scrollTop = L.current;
|
|
17340
17340
|
});
|
|
17341
17341
|
}), () => {
|
|
17342
17342
|
se !== null && cancelAnimationFrame(se), ae !== null && cancelAnimationFrame(ae);
|
|
17343
17343
|
};
|
|
17344
|
-
}, [
|
|
17344
|
+
}, [F]);
|
|
17345
17345
|
const pt = async (W) => {
|
|
17346
17346
|
try {
|
|
17347
|
-
|
|
17347
|
+
D(W), await q(W), i == null || i(W), l == null || l(W);
|
|
17348
17348
|
} catch (se) {
|
|
17349
17349
|
console.error("Failed to select thread:", se);
|
|
17350
17350
|
}
|
|
@@ -17362,10 +17362,10 @@ function wi({
|
|
|
17362
17362
|
if (se.stopPropagation(), !!confirm("Delete this thread?")) {
|
|
17363
17363
|
if (K.current) {
|
|
17364
17364
|
const ae = K.current.querySelector("[data-radix-scroll-area-viewport]");
|
|
17365
|
-
ae && (
|
|
17365
|
+
ae && (L.current = ae.scrollTop);
|
|
17366
17366
|
}
|
|
17367
17367
|
try {
|
|
17368
|
-
await
|
|
17368
|
+
await $(W), d == null || d(W);
|
|
17369
17369
|
} catch (ae) {
|
|
17370
17370
|
console.error("Failed to delete thread:", ae);
|
|
17371
17371
|
}
|
|
@@ -17470,7 +17470,7 @@ function wi({
|
|
|
17470
17470
|
Cu,
|
|
17471
17471
|
{
|
|
17472
17472
|
thread: ae,
|
|
17473
|
-
isActive:
|
|
17473
|
+
isActive: N === ae.threadId,
|
|
17474
17474
|
editingThreadId: j,
|
|
17475
17475
|
editingTitle: Q,
|
|
17476
17476
|
onSelect: pt,
|
|
@@ -17493,7 +17493,7 @@ function wi({
|
|
|
17493
17493
|
Cu,
|
|
17494
17494
|
{
|
|
17495
17495
|
thread: W,
|
|
17496
|
-
isActive:
|
|
17496
|
+
isActive: N === W.threadId,
|
|
17497
17497
|
editingThreadId: j,
|
|
17498
17498
|
editingTitle: Q,
|
|
17499
17499
|
onSelect: pt,
|
|
@@ -17818,21 +17818,21 @@ function $1({
|
|
|
17818
17818
|
assistantMessage: v,
|
|
17819
17819
|
isStreaming: g
|
|
17820
17820
|
}) {
|
|
17821
|
-
const [x, b] = fe(null), [w, S] = fe(""), [E, T] = fe(null), [y, C] = fe(null), [
|
|
17821
|
+
const [x, b] = fe(null), [w, S] = fe(""), [E, T] = fe(null), [y, C] = fe(null), [I, A] = fe(!1), [D, M] = fe(""), H = Re(D), Y = Re(null);
|
|
17822
17822
|
Fe(() => {
|
|
17823
17823
|
if (!x)
|
|
17824
17824
|
if (m) {
|
|
17825
|
-
const
|
|
17826
|
-
M(
|
|
17825
|
+
const F = localStorage.getItem(`draft-${m}`);
|
|
17826
|
+
M(F || "");
|
|
17827
17827
|
} else
|
|
17828
17828
|
M("");
|
|
17829
17829
|
}, [m, x]);
|
|
17830
|
-
const P = le((
|
|
17831
|
-
M(
|
|
17830
|
+
const P = le((F) => {
|
|
17831
|
+
M(F), !x && m && localStorage.setItem(`draft-${m}`, F);
|
|
17832
17832
|
}, [m, x]);
|
|
17833
17833
|
Fe(() => {
|
|
17834
|
-
H.current =
|
|
17835
|
-
}, [
|
|
17834
|
+
H.current = D;
|
|
17835
|
+
}, [D]), Fe(() => {
|
|
17836
17836
|
if (!x) {
|
|
17837
17837
|
Y.current = null;
|
|
17838
17838
|
return;
|
|
@@ -17840,12 +17840,12 @@ function $1({
|
|
|
17840
17840
|
Y.current === null && (Y.current = H.current), P(w ?? "");
|
|
17841
17841
|
}, [w, x, P]);
|
|
17842
17842
|
const V = le(
|
|
17843
|
-
(
|
|
17844
|
-
P(
|
|
17843
|
+
(F) => {
|
|
17844
|
+
P(F);
|
|
17845
17845
|
},
|
|
17846
17846
|
[P]
|
|
17847
|
-
), X = async (
|
|
17848
|
-
const _ =
|
|
17847
|
+
), X = async (F, O) => {
|
|
17848
|
+
const _ = F.trim();
|
|
17849
17849
|
if (!(!_ && O.length === 0))
|
|
17850
17850
|
try {
|
|
17851
17851
|
f && await f();
|
|
@@ -17892,16 +17892,16 @@ function $1({
|
|
|
17892
17892
|
}
|
|
17893
17893
|
), o == null || o(_), c(!0), m && localStorage.removeItem(`draft-${m}`), P(""), C(null), b(null), S(""), T(null);
|
|
17894
17894
|
} catch (K) {
|
|
17895
|
-
const
|
|
17896
|
-
C(
|
|
17895
|
+
const L = (K == null ? void 0 : K.message) || "Failed to send message";
|
|
17896
|
+
C(L), a == null || a(L), c(!1);
|
|
17897
17897
|
}
|
|
17898
|
-
}, Z = (
|
|
17899
|
-
O || X(
|
|
17900
|
-
},
|
|
17901
|
-
async (
|
|
17898
|
+
}, Z = (F, O) => {
|
|
17899
|
+
O || X(F, []);
|
|
17900
|
+
}, $ = le(
|
|
17901
|
+
async (F) => {
|
|
17902
17902
|
await e(
|
|
17903
17903
|
{
|
|
17904
|
-
attachments: [
|
|
17904
|
+
attachments: [F],
|
|
17905
17905
|
payload: t.payload
|
|
17906
17906
|
},
|
|
17907
17907
|
{
|
|
@@ -17911,38 +17911,38 @@ function $1({
|
|
|
17911
17911
|
config: t.config,
|
|
17912
17912
|
onEvent: p
|
|
17913
17913
|
}
|
|
17914
|
-
), s == null || s({ file:
|
|
17914
|
+
), s == null || s({ file: F });
|
|
17915
17915
|
},
|
|
17916
17916
|
[n, r, t, s, e]
|
|
17917
17917
|
), k = le(
|
|
17918
|
-
(
|
|
17919
|
-
i && (Y.current =
|
|
17918
|
+
(F, O, _) => {
|
|
17919
|
+
i && (Y.current = D, b(F), S(O), T({
|
|
17920
17920
|
checkpointId: (_ == null ? void 0 : _.checkpointId) ?? null,
|
|
17921
17921
|
checkpointNs: (_ == null ? void 0 : _.checkpointNs) ?? null
|
|
17922
17922
|
}), C(null));
|
|
17923
17923
|
},
|
|
17924
|
-
[
|
|
17924
|
+
[D, i]
|
|
17925
17925
|
), z = le(() => {
|
|
17926
17926
|
b(null), S(""), T(null), C(null);
|
|
17927
|
-
const
|
|
17928
|
-
|
|
17929
|
-
}, []), q = le((
|
|
17927
|
+
const F = Y.current;
|
|
17928
|
+
F !== null && M(F), Y.current = null;
|
|
17929
|
+
}, []), q = le((F) => {
|
|
17930
17930
|
let O = null;
|
|
17931
|
-
for (let j =
|
|
17931
|
+
for (let j = F - 1; j >= 0; j--)
|
|
17932
17932
|
if (l[j].role === "user") {
|
|
17933
17933
|
O = l[j];
|
|
17934
17934
|
break;
|
|
17935
17935
|
}
|
|
17936
17936
|
if (!O) return;
|
|
17937
|
-
const _ = Array.isArray(O.content) ? O.content : [],
|
|
17937
|
+
const _ = Array.isArray(O.content) ? O.content : [], L = _.filter((j) => (j == null ? void 0 : j.type) === "text").map((j) => j.text).join("") || (() => {
|
|
17938
17938
|
try {
|
|
17939
17939
|
return JSON.stringify(_, null, 2);
|
|
17940
17940
|
} catch {
|
|
17941
17941
|
return String(_);
|
|
17942
17942
|
}
|
|
17943
17943
|
})();
|
|
17944
|
-
|
|
17945
|
-
{ text:
|
|
17944
|
+
L && e(
|
|
17945
|
+
{ text: L, payload: t.payload },
|
|
17946
17946
|
{
|
|
17947
17947
|
checkpointId: n ?? void 0,
|
|
17948
17948
|
checkpointNs: r ?? void 0,
|
|
@@ -17952,38 +17952,38 @@ function $1({
|
|
|
17952
17952
|
onEvent: p
|
|
17953
17953
|
}
|
|
17954
17954
|
);
|
|
17955
|
-
}, [l, e, n, r, t]),
|
|
17956
|
-
let
|
|
17955
|
+
}, [l, e, n, r, t]), N = He(() => {
|
|
17956
|
+
let F = l;
|
|
17957
17957
|
if (v) {
|
|
17958
|
-
const O =
|
|
17958
|
+
const O = F.findIndex((_) => _.id === v.id);
|
|
17959
17959
|
if (O !== -1) {
|
|
17960
17960
|
if (g) {
|
|
17961
|
-
const _ = [
|
|
17962
|
-
_[O] = v,
|
|
17961
|
+
const _ = [...F];
|
|
17962
|
+
_[O] = v, F = _;
|
|
17963
17963
|
}
|
|
17964
17964
|
} else {
|
|
17965
|
-
const _ =
|
|
17966
|
-
!g && _ && _.role === "assistant" || (
|
|
17965
|
+
const _ = F[F.length - 1];
|
|
17966
|
+
!g && _ && _.role === "assistant" || (F = [...F, v]);
|
|
17967
17967
|
}
|
|
17968
17968
|
}
|
|
17969
|
-
return
|
|
17969
|
+
return F;
|
|
17970
17970
|
}, [l, v, g]);
|
|
17971
17971
|
return {
|
|
17972
17972
|
editingMessageId: x,
|
|
17973
17973
|
editingInitialValue: w,
|
|
17974
17974
|
inputError: y,
|
|
17975
17975
|
setInputError: C,
|
|
17976
|
-
dismissError:
|
|
17976
|
+
dismissError: I,
|
|
17977
17977
|
setDismissError: A,
|
|
17978
|
-
composerValue:
|
|
17978
|
+
composerValue: D,
|
|
17979
17979
|
handleComposerChange: V,
|
|
17980
17980
|
handleSendMessage: X,
|
|
17981
17981
|
handleQuickPrompt: Z,
|
|
17982
|
-
handleExcelUpload:
|
|
17982
|
+
handleExcelUpload: $,
|
|
17983
17983
|
startEditing: k,
|
|
17984
17984
|
cancelEditing: z,
|
|
17985
17985
|
handleRegenerateCb: q,
|
|
17986
|
-
displayMessages:
|
|
17986
|
+
displayMessages: N
|
|
17987
17987
|
};
|
|
17988
17988
|
}
|
|
17989
17989
|
var Nk = "Label", om = h.forwardRef((e, t) => /* @__PURE__ */ u.jsx(
|
|
@@ -18056,12 +18056,12 @@ var _k = da, Ok = [" ", "Enter", "ArrowUp", "ArrowDown"], Mk = [" ", "Enter"], c
|
|
|
18056
18056
|
disabled: m,
|
|
18057
18057
|
required: f,
|
|
18058
18058
|
form: v
|
|
18059
|
-
} = e, g = ha(t), [x, b] = h.useState(null), [w, S] = h.useState(null), [E, T] = h.useState(!1), y = Zs(c), [C,
|
|
18059
|
+
} = e, g = ha(t), [x, b] = h.useState(null), [w, S] = h.useState(null), [E, T] = h.useState(!1), y = Zs(c), [C, I] = An({
|
|
18060
18060
|
prop: r,
|
|
18061
18061
|
defaultProp: o ?? !1,
|
|
18062
18062
|
onChange: s,
|
|
18063
18063
|
caller: cr
|
|
18064
|
-
}), [A,
|
|
18064
|
+
}), [A, D] = An({
|
|
18065
18065
|
prop: a,
|
|
18066
18066
|
defaultProp: i,
|
|
18067
18067
|
onChange: l,
|
|
@@ -18080,9 +18080,9 @@ var _k = da, Ok = [" ", "Enter", "ArrowUp", "ArrowDown"], Mk = [" ", "Enter"], c
|
|
|
18080
18080
|
onValueNodeHasChildrenChange: T,
|
|
18081
18081
|
contentId: Mt(),
|
|
18082
18082
|
value: A,
|
|
18083
|
-
onValueChange:
|
|
18083
|
+
onValueChange: D,
|
|
18084
18084
|
open: C,
|
|
18085
|
-
onOpenChange:
|
|
18085
|
+
onOpenChange: I,
|
|
18086
18086
|
dir: y,
|
|
18087
18087
|
triggerPointerDownPosRef: M,
|
|
18088
18088
|
disabled: m,
|
|
@@ -18096,8 +18096,8 @@ var _k = da, Ok = [" ", "Enter", "ArrowUp", "ArrowDown"], Mk = [" ", "Enter"], c
|
|
|
18096
18096
|
}, []),
|
|
18097
18097
|
onNativeOptionRemove: h.useCallback((X) => {
|
|
18098
18098
|
P((Z) => {
|
|
18099
|
-
const
|
|
18100
|
-
return
|
|
18099
|
+
const $ = new Set(Z);
|
|
18100
|
+
return $.delete(X), $;
|
|
18101
18101
|
});
|
|
18102
18102
|
}, []),
|
|
18103
18103
|
children: n
|
|
@@ -18112,7 +18112,7 @@ var _k = da, Ok = [" ", "Enter", "ArrowUp", "ArrowDown"], Mk = [" ", "Enter"], c
|
|
|
18112
18112
|
name: d,
|
|
18113
18113
|
autoComplete: p,
|
|
18114
18114
|
value: A,
|
|
18115
|
-
onChange: (X) =>
|
|
18115
|
+
onChange: (X) => D(X.target.value),
|
|
18116
18116
|
disabled: m,
|
|
18117
18117
|
form: v,
|
|
18118
18118
|
children: [
|
|
@@ -18235,62 +18235,62 @@ var fn = 10, [gm, Vn] = qr(ur), Hk = "SelectContentImpl", Uk = Nr("SelectContent
|
|
|
18235
18235
|
avoidCollisions: x,
|
|
18236
18236
|
//
|
|
18237
18237
|
...b
|
|
18238
|
-
} = e, w = Wn(ur, n), [S, E] = h.useState(null), [T, y] = h.useState(null), C = Oe(t, (
|
|
18238
|
+
} = e, w = Wn(ur, n), [S, E] = h.useState(null), [T, y] = h.useState(null), C = Oe(t, (L) => E(L)), [I, A] = h.useState(null), [D, M] = h.useState(
|
|
18239
18239
|
null
|
|
18240
18240
|
), H = pa(n), [Y, P] = h.useState(!1), V = h.useRef(!1);
|
|
18241
18241
|
h.useEffect(() => {
|
|
18242
18242
|
if (S) return Ui(S);
|
|
18243
18243
|
}, [S]), Hi();
|
|
18244
18244
|
const X = h.useCallback(
|
|
18245
|
-
(
|
|
18245
|
+
(L) => {
|
|
18246
18246
|
const [j, ...U] = H().map((J) => J.ref.current), [Q] = U.slice(-1), ne = document.activeElement;
|
|
18247
|
-
for (const J of
|
|
18247
|
+
for (const J of L)
|
|
18248
18248
|
if (J === ne || (J == null || J.scrollIntoView({ block: "nearest" }), J === j && T && (T.scrollTop = 0), J === Q && T && (T.scrollTop = T.scrollHeight), J == null || J.focus(), document.activeElement !== ne)) return;
|
|
18249
18249
|
},
|
|
18250
18250
|
[H, T]
|
|
18251
18251
|
), Z = h.useCallback(
|
|
18252
|
-
() => X([
|
|
18253
|
-
[X,
|
|
18252
|
+
() => X([I, S]),
|
|
18253
|
+
[X, I, S]
|
|
18254
18254
|
);
|
|
18255
18255
|
h.useEffect(() => {
|
|
18256
18256
|
Y && Z();
|
|
18257
18257
|
}, [Y, Z]);
|
|
18258
|
-
const { onOpenChange:
|
|
18258
|
+
const { onOpenChange: $, triggerPointerDownPosRef: k } = w;
|
|
18259
18259
|
h.useEffect(() => {
|
|
18260
18260
|
if (S) {
|
|
18261
|
-
let
|
|
18261
|
+
let L = { x: 0, y: 0 };
|
|
18262
18262
|
const j = (Q) => {
|
|
18263
18263
|
var ne, J;
|
|
18264
|
-
|
|
18264
|
+
L = {
|
|
18265
18265
|
x: Math.abs(Math.round(Q.pageX) - (((ne = k.current) == null ? void 0 : ne.x) ?? 0)),
|
|
18266
18266
|
y: Math.abs(Math.round(Q.pageY) - (((J = k.current) == null ? void 0 : J.y) ?? 0))
|
|
18267
18267
|
};
|
|
18268
18268
|
}, U = (Q) => {
|
|
18269
|
-
|
|
18269
|
+
L.x <= 10 && L.y <= 10 ? Q.preventDefault() : S.contains(Q.target) || $(!1), document.removeEventListener("pointermove", j), k.current = null;
|
|
18270
18270
|
};
|
|
18271
18271
|
return k.current !== null && (document.addEventListener("pointermove", j), document.addEventListener("pointerup", U, { capture: !0, once: !0 })), () => {
|
|
18272
18272
|
document.removeEventListener("pointermove", j), document.removeEventListener("pointerup", U, { capture: !0 });
|
|
18273
18273
|
};
|
|
18274
18274
|
}
|
|
18275
|
-
}, [S,
|
|
18276
|
-
const
|
|
18277
|
-
return window.addEventListener("blur",
|
|
18278
|
-
window.removeEventListener("blur",
|
|
18275
|
+
}, [S, $, k]), h.useEffect(() => {
|
|
18276
|
+
const L = () => $(!1);
|
|
18277
|
+
return window.addEventListener("blur", L), window.addEventListener("resize", L), () => {
|
|
18278
|
+
window.removeEventListener("blur", L), window.removeEventListener("resize", L);
|
|
18279
18279
|
};
|
|
18280
|
-
}, [
|
|
18281
|
-
const [z, q] = Om((
|
|
18282
|
-
const j = H().filter((ne) => !ne.disabled), U = j.find((ne) => ne.ref.current === document.activeElement), Q = Mm(j,
|
|
18280
|
+
}, [$]);
|
|
18281
|
+
const [z, q] = Om((L) => {
|
|
18282
|
+
const j = H().filter((ne) => !ne.disabled), U = j.find((ne) => ne.ref.current === document.activeElement), Q = Mm(j, L, U);
|
|
18283
18283
|
Q && setTimeout(() => Q.ref.current.focus());
|
|
18284
|
-
}),
|
|
18285
|
-
(
|
|
18284
|
+
}), N = h.useCallback(
|
|
18285
|
+
(L, j, U) => {
|
|
18286
18286
|
const Q = !V.current && !U;
|
|
18287
|
-
(w.value !== void 0 && w.value === j || Q) && (A(
|
|
18287
|
+
(w.value !== void 0 && w.value === j || Q) && (A(L), Q && (V.current = !0));
|
|
18288
18288
|
},
|
|
18289
18289
|
[w.value]
|
|
18290
|
-
),
|
|
18291
|
-
(
|
|
18290
|
+
), F = h.useCallback(() => S == null ? void 0 : S.focus(), [S]), O = h.useCallback(
|
|
18291
|
+
(L, j, U) => {
|
|
18292
18292
|
const Q = !V.current && !U;
|
|
18293
|
-
(w.value !== void 0 && w.value === j || Q) && M(
|
|
18293
|
+
(w.value !== void 0 && w.value === j || Q) && M(L);
|
|
18294
18294
|
},
|
|
18295
18295
|
[w.value]
|
|
18296
18296
|
), _ = r === "popper" ? bi : vm, K = _ === bi ? {
|
|
@@ -18312,12 +18312,12 @@ var fn = 10, [gm, Vn] = qr(ur), Hk = "SelectContentImpl", Uk = Nr("SelectContent
|
|
|
18312
18312
|
content: S,
|
|
18313
18313
|
viewport: T,
|
|
18314
18314
|
onViewportChange: y,
|
|
18315
|
-
itemRefCallback:
|
|
18316
|
-
selectedItem:
|
|
18317
|
-
onItemLeave:
|
|
18315
|
+
itemRefCallback: N,
|
|
18316
|
+
selectedItem: I,
|
|
18317
|
+
onItemLeave: F,
|
|
18318
18318
|
itemTextRefCallback: O,
|
|
18319
18319
|
focusSelectedItem: Z,
|
|
18320
|
-
selectedItemText:
|
|
18320
|
+
selectedItemText: D,
|
|
18321
18321
|
position: r,
|
|
18322
18322
|
isPositioned: Y,
|
|
18323
18323
|
searchRef: z,
|
|
@@ -18326,12 +18326,12 @@ var fn = 10, [gm, Vn] = qr(ur), Hk = "SelectContentImpl", Uk = Nr("SelectContent
|
|
|
18326
18326
|
{
|
|
18327
18327
|
asChild: !0,
|
|
18328
18328
|
trapped: w.open,
|
|
18329
|
-
onMountAutoFocus: (
|
|
18330
|
-
|
|
18329
|
+
onMountAutoFocus: (L) => {
|
|
18330
|
+
L.preventDefault();
|
|
18331
18331
|
},
|
|
18332
|
-
onUnmountAutoFocus: ce(o, (
|
|
18332
|
+
onUnmountAutoFocus: ce(o, (L) => {
|
|
18333
18333
|
var j;
|
|
18334
|
-
(j = w.trigger) == null || j.focus({ preventScroll: !0 }),
|
|
18334
|
+
(j = w.trigger) == null || j.focus({ preventScroll: !0 }), L.preventDefault();
|
|
18335
18335
|
}),
|
|
18336
18336
|
children: /* @__PURE__ */ u.jsx(
|
|
18337
18337
|
zr,
|
|
@@ -18340,7 +18340,7 @@ var fn = 10, [gm, Vn] = qr(ur), Hk = "SelectContentImpl", Uk = Nr("SelectContent
|
|
|
18340
18340
|
disableOutsidePointerEvents: !0,
|
|
18341
18341
|
onEscapeKeyDown: s,
|
|
18342
18342
|
onPointerDownOutside: a,
|
|
18343
|
-
onFocusOutside: (
|
|
18343
|
+
onFocusOutside: (L) => L.preventDefault(),
|
|
18344
18344
|
onDismiss: () => w.onOpenChange(!1),
|
|
18345
18345
|
children: /* @__PURE__ */ u.jsx(
|
|
18346
18346
|
_,
|
|
@@ -18349,7 +18349,7 @@ var fn = 10, [gm, Vn] = qr(ur), Hk = "SelectContentImpl", Uk = Nr("SelectContent
|
|
|
18349
18349
|
id: w.contentId,
|
|
18350
18350
|
"data-state": w.open ? "open" : "closed",
|
|
18351
18351
|
dir: w.dir,
|
|
18352
|
-
onContextMenu: (
|
|
18352
|
+
onContextMenu: (L) => L.preventDefault(),
|
|
18353
18353
|
...b,
|
|
18354
18354
|
...K,
|
|
18355
18355
|
onPlaced: () => P(!0),
|
|
@@ -18362,15 +18362,15 @@ var fn = 10, [gm, Vn] = qr(ur), Hk = "SelectContentImpl", Uk = Nr("SelectContent
|
|
|
18362
18362
|
outline: "none",
|
|
18363
18363
|
...b.style
|
|
18364
18364
|
},
|
|
18365
|
-
onKeyDown: ce(b.onKeyDown, (
|
|
18366
|
-
const j =
|
|
18367
|
-
if (
|
|
18365
|
+
onKeyDown: ce(b.onKeyDown, (L) => {
|
|
18366
|
+
const j = L.ctrlKey || L.altKey || L.metaKey;
|
|
18367
|
+
if (L.key === "Tab" && L.preventDefault(), !j && L.key.length === 1 && q(L.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(L.key)) {
|
|
18368
18368
|
let Q = H().filter((ne) => !ne.disabled).map((ne) => ne.ref.current);
|
|
18369
|
-
if (["ArrowUp", "End"].includes(
|
|
18370
|
-
const ne =
|
|
18369
|
+
if (["ArrowUp", "End"].includes(L.key) && (Q = Q.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(L.key)) {
|
|
18370
|
+
const ne = L.target, J = Q.indexOf(ne);
|
|
18371
18371
|
Q = Q.slice(J + 1);
|
|
18372
18372
|
}
|
|
18373
|
-
setTimeout(() => X(Q)),
|
|
18373
|
+
setTimeout(() => X(Q)), L.preventDefault();
|
|
18374
18374
|
}
|
|
18375
18375
|
})
|
|
18376
18376
|
}
|
|
@@ -18387,9 +18387,9 @@ xm.displayName = Hk;
|
|
|
18387
18387
|
var Wk = "SelectItemAlignedPosition", vm = h.forwardRef((e, t) => {
|
|
18388
18388
|
const { __scopeSelect: n, onPlaced: r, ...o } = e, s = Wn(ur, n), a = Vn(ur, n), [i, l] = h.useState(null), [c, d] = h.useState(null), p = Oe(t, (C) => d(C)), m = pa(n), f = h.useRef(!1), v = h.useRef(!0), { viewport: g, selectedItem: x, selectedItemText: b, focusSelectedItem: w } = a, S = h.useCallback(() => {
|
|
18389
18389
|
if (s.trigger && s.valueNode && i && c && g && x && b) {
|
|
18390
|
-
const C = s.trigger.getBoundingClientRect(),
|
|
18390
|
+
const C = s.trigger.getBoundingClientRect(), I = c.getBoundingClientRect(), A = s.valueNode.getBoundingClientRect(), D = b.getBoundingClientRect();
|
|
18391
18391
|
if (s.dir !== "rtl") {
|
|
18392
|
-
const ne =
|
|
18392
|
+
const ne = D.left - I.left, J = A.left - ne, de = C.left - J, ve = C.width + de, Ae = Math.max(ve, I.width), qe = window.innerWidth - fn, Me = vi(J, [
|
|
18393
18393
|
fn,
|
|
18394
18394
|
// Prevents the content from going off the starting edge of the
|
|
18395
18395
|
// viewport. It may still go off the ending edge, but this can be
|
|
@@ -18400,20 +18400,20 @@ var Wk = "SelectItemAlignedPosition", vm = h.forwardRef((e, t) => {
|
|
|
18400
18400
|
]);
|
|
18401
18401
|
i.style.minWidth = ve + "px", i.style.left = Me + "px";
|
|
18402
18402
|
} else {
|
|
18403
|
-
const ne =
|
|
18403
|
+
const ne = I.right - D.right, J = window.innerWidth - A.right - ne, de = window.innerWidth - C.right - J, ve = C.width + de, Ae = Math.max(ve, I.width), qe = window.innerWidth - fn, Me = vi(J, [
|
|
18404
18404
|
fn,
|
|
18405
18405
|
Math.max(fn, qe - Ae)
|
|
18406
18406
|
]);
|
|
18407
18407
|
i.style.minWidth = ve + "px", i.style.right = Me + "px";
|
|
18408
18408
|
}
|
|
18409
|
-
const M = m(), H = window.innerHeight - fn * 2, Y = g.scrollHeight, P = window.getComputedStyle(c), V = parseInt(P.borderTopWidth, 10), X = parseInt(P.paddingTop, 10), Z = parseInt(P.borderBottomWidth, 10),
|
|
18409
|
+
const M = m(), H = window.innerHeight - fn * 2, Y = g.scrollHeight, P = window.getComputedStyle(c), V = parseInt(P.borderTopWidth, 10), X = parseInt(P.paddingTop, 10), Z = parseInt(P.borderBottomWidth, 10), $ = parseInt(P.paddingBottom, 10), k = V + X + Y + $ + Z, z = Math.min(x.offsetHeight * 5, k), q = window.getComputedStyle(g), N = parseInt(q.paddingTop, 10), F = parseInt(q.paddingBottom, 10), O = C.top + C.height / 2 - fn, _ = H - O, K = x.offsetHeight / 2, L = x.offsetTop + K, j = V + X + L, U = k - j;
|
|
18410
18410
|
if (j <= O) {
|
|
18411
18411
|
const ne = M.length > 0 && x === M[M.length - 1].ref.current;
|
|
18412
18412
|
i.style.bottom = "0px";
|
|
18413
18413
|
const J = c.clientHeight - g.offsetTop - g.offsetHeight, de = Math.max(
|
|
18414
18414
|
_,
|
|
18415
18415
|
K + // viewport might have padding bottom, include it to avoid a scrollable viewport
|
|
18416
|
-
(ne ?
|
|
18416
|
+
(ne ? F : 0) + J + Z
|
|
18417
18417
|
), ve = j + de;
|
|
18418
18418
|
i.style.height = ve + "px";
|
|
18419
18419
|
} else {
|
|
@@ -18422,7 +18422,7 @@ var Wk = "SelectItemAlignedPosition", vm = h.forwardRef((e, t) => {
|
|
|
18422
18422
|
const de = Math.max(
|
|
18423
18423
|
O,
|
|
18424
18424
|
V + g.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
|
|
18425
|
-
(ne ?
|
|
18425
|
+
(ne ? N : 0) + K
|
|
18426
18426
|
) + U;
|
|
18427
18427
|
i.style.height = de + "px", g.scrollTop = j - O + g.offsetTop;
|
|
18428
18428
|
}
|
|
@@ -19599,12 +19599,12 @@ var ug = "ToastViewport", ZR = ["F8"], Ri = "toast.viewportPause", Ii = "toast.v
|
|
|
19599
19599
|
var T, y, C;
|
|
19600
19600
|
const S = w.altKey || w.ctrlKey || w.metaKey;
|
|
19601
19601
|
if (w.key === "Tab" && !S) {
|
|
19602
|
-
const
|
|
19602
|
+
const I = document.activeElement, A = w.shiftKey;
|
|
19603
19603
|
if (w.target === x && A) {
|
|
19604
19604
|
(T = c.current) == null || T.focus();
|
|
19605
19605
|
return;
|
|
19606
19606
|
}
|
|
19607
|
-
const H = g({ tabbingDirection: A ? "backwards" : "forwards" }), Y = H.findIndex((P) => P ===
|
|
19607
|
+
const H = g({ tabbingDirection: A ? "backwards" : "forwards" }), Y = H.findIndex((P) => P === I);
|
|
19608
19608
|
Ka(H.slice(Y + 1)) ? w.preventDefault() : A ? (y = c.current) == null || y.focus() : (C = d.current) == null || C.focus();
|
|
19609
19609
|
}
|
|
19610
19610
|
};
|
|
@@ -19725,12 +19725,12 @@ var [rI, oI] = lg(Fo, {
|
|
|
19725
19725
|
onSwipeCancel: m,
|
|
19726
19726
|
onSwipeEnd: f,
|
|
19727
19727
|
...v
|
|
19728
|
-
} = e, g = wa(Fo, n), [x, b] = h.useState(null), w = Oe(t, (P) => b(P)), S = h.useRef(null), E = h.useRef(null), T = o || g.duration, y = h.useRef(0), C = h.useRef(T),
|
|
19728
|
+
} = e, g = wa(Fo, n), [x, b] = h.useState(null), w = Oe(t, (P) => b(P)), S = h.useRef(null), E = h.useRef(null), T = o || g.duration, y = h.useRef(0), C = h.useRef(T), I = h.useRef(0), { onToastAdd: A, onToastRemove: D } = g, M = Et(() => {
|
|
19729
19729
|
var V;
|
|
19730
19730
|
(x == null ? void 0 : x.contains(document.activeElement)) && ((V = g.viewport) == null || V.focus()), a();
|
|
19731
19731
|
}), H = h.useCallback(
|
|
19732
19732
|
(P) => {
|
|
19733
|
-
!P || P === 1 / 0 || (window.clearTimeout(
|
|
19733
|
+
!P || P === 1 / 0 || (window.clearTimeout(I.current), y.current = (/* @__PURE__ */ new Date()).getTime(), I.current = window.setTimeout(M, P));
|
|
19734
19734
|
},
|
|
19735
19735
|
[M]
|
|
19736
19736
|
);
|
|
@@ -19741,7 +19741,7 @@ var [rI, oI] = lg(Fo, {
|
|
|
19741
19741
|
H(C.current), c == null || c();
|
|
19742
19742
|
}, X = () => {
|
|
19743
19743
|
const Z = (/* @__PURE__ */ new Date()).getTime() - y.current;
|
|
19744
|
-
C.current = C.current - Z, window.clearTimeout(
|
|
19744
|
+
C.current = C.current - Z, window.clearTimeout(I.current), l == null || l();
|
|
19745
19745
|
};
|
|
19746
19746
|
return P.addEventListener(Ri, X), P.addEventListener(Ii, V), () => {
|
|
19747
19747
|
P.removeEventListener(Ri, X), P.removeEventListener(Ii, V);
|
|
@@ -19749,7 +19749,7 @@ var [rI, oI] = lg(Fo, {
|
|
|
19749
19749
|
}
|
|
19750
19750
|
}, [g.viewport, T, l, c, H]), h.useEffect(() => {
|
|
19751
19751
|
s && !g.isClosePausedRef.current && H(T);
|
|
19752
|
-
}, [s, T, g.isClosePausedRef, H]), h.useEffect(() => (A(), () =>
|
|
19752
|
+
}, [s, T, g.isClosePausedRef, H]), h.useEffect(() => (A(), () => D()), [A, D]);
|
|
19753
19753
|
const Y = h.useMemo(() => x ? bg(x) : null, [x]);
|
|
19754
19754
|
return g.viewport ? /* @__PURE__ */ u.jsxs(u.Fragment, { children: [
|
|
19755
19755
|
Y && /* @__PURE__ */ u.jsx(
|
|
@@ -19786,23 +19786,23 @@ var [rI, oI] = lg(Fo, {
|
|
|
19786
19786
|
}),
|
|
19787
19787
|
onPointerMove: ce(e.onPointerMove, (P) => {
|
|
19788
19788
|
if (!S.current) return;
|
|
19789
|
-
const V = P.clientX - S.current.x, X = P.clientY - S.current.y, Z = !!E.current,
|
|
19790
|
-
Z ? (E.current =
|
|
19789
|
+
const V = P.clientX - S.current.x, X = P.clientY - S.current.y, Z = !!E.current, $ = ["left", "right"].includes(g.swipeDirection), k = ["left", "up"].includes(g.swipeDirection) ? Math.min : Math.max, z = $ ? k(0, V) : 0, q = $ ? 0 : k(0, X), N = P.pointerType === "touch" ? 10 : 2, F = { x: z, y: q }, O = { originalEvent: P, delta: F };
|
|
19790
|
+
Z ? (E.current = F, Jo(eI, p, O, {
|
|
19791
19791
|
discrete: !1
|
|
19792
|
-
})) : Ru(
|
|
19792
|
+
})) : Ru(F, g.swipeDirection, N) ? (E.current = F, Jo(QR, d, O, {
|
|
19793
19793
|
discrete: !1
|
|
19794
|
-
}), P.target.setPointerCapture(P.pointerId)) : (Math.abs(V) >
|
|
19794
|
+
}), P.target.setPointerCapture(P.pointerId)) : (Math.abs(V) > N || Math.abs(X) > N) && (S.current = null);
|
|
19795
19795
|
}),
|
|
19796
19796
|
onPointerUp: ce(e.onPointerUp, (P) => {
|
|
19797
19797
|
const V = E.current, X = P.target;
|
|
19798
19798
|
if (X.hasPointerCapture(P.pointerId) && X.releasePointerCapture(P.pointerId), E.current = null, S.current = null, V) {
|
|
19799
|
-
const Z = P.currentTarget,
|
|
19800
|
-
Ru(V, g.swipeDirection, g.swipeThreshold) ? Jo(nI, f,
|
|
19799
|
+
const Z = P.currentTarget, $ = { originalEvent: P, delta: V };
|
|
19800
|
+
Ru(V, g.swipeDirection, g.swipeThreshold) ? Jo(nI, f, $, {
|
|
19801
19801
|
discrete: !0
|
|
19802
19802
|
}) : Jo(
|
|
19803
19803
|
tI,
|
|
19804
19804
|
m,
|
|
19805
|
-
|
|
19805
|
+
$,
|
|
19806
19806
|
{
|
|
19807
19807
|
discrete: !0
|
|
19808
19808
|
}
|
|
@@ -20144,10 +20144,10 @@ function UI(e) {
|
|
|
20144
20144
|
}
|
|
20145
20145
|
var WI = (e) => {
|
|
20146
20146
|
var t, n, r, o, s, a, i, l, c, d, p;
|
|
20147
|
-
let { invert: m, toast: f, unstyled: v, interacting: g, setHeights: x, visibleToasts: b, heights: w, index: S, toasts: E, expanded: T, removeToast: y, defaultRichColors: C, closeButton:
|
|
20147
|
+
let { invert: m, toast: f, unstyled: v, interacting: g, setHeights: x, visibleToasts: b, heights: w, index: S, toasts: E, expanded: T, removeToast: y, defaultRichColors: C, closeButton: I, style: A, cancelButtonStyle: D, actionButtonStyle: M, className: H = "", descriptionClassName: Y = "", duration: P, position: V, gap: X, loadingIcon: Z, expandByDefault: $, classNames: k, icons: z, closeButtonAriaLabel: q = "Close toast", pauseWhenPageIsHidden: N } = e, [F, O] = B.useState(null), [_, K] = B.useState(null), [L, j] = B.useState(!1), [U, Q] = B.useState(!1), [ne, J] = B.useState(!1), [de, ve] = B.useState(!1), [Ae, qe] = B.useState(!1), [Me, Ye] = B.useState(0), [$e, mt] = B.useState(0), gt = B.useRef(f.duration || P || Iu), Ke = B.useRef(null), Be = B.useRef(null), Ue = S === 0, ft = S + 1 <= b, Ne = f.type, Qe = f.dismissible !== !1, lt = f.className || "", at = f.descriptionClassName || "", nt = B.useMemo(() => w.findIndex((ye) => ye.toastId === f.id) || 0, [w, f.id]), wt = B.useMemo(() => {
|
|
20148
20148
|
var ye;
|
|
20149
|
-
return (ye = f.closeButton) != null ? ye :
|
|
20150
|
-
}, [f.closeButton,
|
|
20149
|
+
return (ye = f.closeButton) != null ? ye : I;
|
|
20150
|
+
}, [f.closeButton, I]), xt = B.useMemo(() => f.duration || P || Iu, [f.duration, P]), _t = B.useRef(0), Ot = B.useRef(0), jt = B.useRef(0), St = B.useRef(null), [bt, Ve] = V.split("-"), Xe = B.useMemo(() => w.reduce((ye, De, ze) => ze >= nt ? ye : ye + De.height, 0), [w, nt]), ct = II(), vt = f.invert || m, Rt = Ne === "loading";
|
|
20151
20151
|
Ot.current = B.useMemo(() => nt * X + Xe, [nt, Xe]), B.useEffect(() => {
|
|
20152
20152
|
gt.current = xt;
|
|
20153
20153
|
}, [xt]), B.useEffect(() => {
|
|
@@ -20159,12 +20159,12 @@ var WI = (e) => {
|
|
|
20159
20159
|
return mt(De), x((ze) => [{ toastId: f.id, height: De, position: f.position }, ...ze]), () => x((ze) => ze.filter((rt) => rt.toastId !== f.id));
|
|
20160
20160
|
}
|
|
20161
20161
|
}, [x, f.id]), B.useLayoutEffect(() => {
|
|
20162
|
-
if (!
|
|
20162
|
+
if (!L) return;
|
|
20163
20163
|
let ye = Be.current, De = ye.style.height;
|
|
20164
20164
|
ye.style.height = "auto";
|
|
20165
20165
|
let ze = ye.getBoundingClientRect().height;
|
|
20166
20166
|
ye.style.height = De, mt(ze), x((rt) => rt.find((et) => et.toastId === f.id) ? rt.map((et) => et.toastId === f.id ? { ...et, height: ze } : et) : [{ toastId: f.id, height: ze, position: f.position }, ...rt]);
|
|
20167
|
-
}, [
|
|
20167
|
+
}, [L, f.title, f.description, x, f.id]);
|
|
20168
20168
|
let pt = B.useCallback(() => {
|
|
20169
20169
|
Q(!0), Ye(Ot.current), x((ye) => ye.filter((De) => De.toastId !== f.id)), setTimeout(() => {
|
|
20170
20170
|
y(f);
|
|
@@ -20173,7 +20173,7 @@ var WI = (e) => {
|
|
|
20173
20173
|
B.useEffect(() => {
|
|
20174
20174
|
if (f.promise && Ne === "loading" || f.duration === 1 / 0 || f.type === "loading") return;
|
|
20175
20175
|
let ye;
|
|
20176
|
-
return T || g ||
|
|
20176
|
+
return T || g || N && ct ? (() => {
|
|
20177
20177
|
if (jt.current < _t.current) {
|
|
20178
20178
|
let De = (/* @__PURE__ */ new Date()).getTime() - _t.current;
|
|
20179
20179
|
gt.current = gt.current - De;
|
|
@@ -20183,14 +20183,14 @@ var WI = (e) => {
|
|
|
20183
20183
|
var De;
|
|
20184
20184
|
(De = f.onAutoClose) == null || De.call(f, f), pt();
|
|
20185
20185
|
}, gt.current)), () => clearTimeout(ye);
|
|
20186
|
-
}, [T, g, f, Ne,
|
|
20186
|
+
}, [T, g, f, Ne, N, ct, pt]), B.useEffect(() => {
|
|
20187
20187
|
f.delete && pt();
|
|
20188
20188
|
}, [pt, f.delete]);
|
|
20189
20189
|
function Dt() {
|
|
20190
20190
|
var ye, De, ze;
|
|
20191
20191
|
return z != null && z.loading ? B.createElement("div", { className: dn(k == null ? void 0 : k.loader, (ye = f == null ? void 0 : f.classNames) == null ? void 0 : ye.loader, "sonner-loader"), "data-visible": Ne === "loading" }, z.loading) : Z ? B.createElement("div", { className: dn(k == null ? void 0 : k.loader, (De = f == null ? void 0 : f.classNames) == null ? void 0 : De.loader, "sonner-loader"), "data-visible": Ne === "loading" }, Z) : B.createElement(SI, { className: dn(k == null ? void 0 : k.loader, (ze = f == null ? void 0 : f.classNames) == null ? void 0 : ze.loader), visible: Ne === "loading" });
|
|
20192
20192
|
}
|
|
20193
|
-
return B.createElement("li", { tabIndex: 0, ref: Be, className: dn(H, lt, k == null ? void 0 : k.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, k == null ? void 0 : k.default, k == null ? void 0 : k[Ne], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[Ne]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : C, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted":
|
|
20193
|
+
return B.createElement("li", { tabIndex: 0, ref: Be, className: dn(H, lt, k == null ? void 0 : k.toast, (t = f == null ? void 0 : f.classNames) == null ? void 0 : t.toast, k == null ? void 0 : k.default, k == null ? void 0 : k[Ne], (n = f == null ? void 0 : f.classNames) == null ? void 0 : n[Ne]), "data-sonner-toast": "", "data-rich-colors": (r = f.richColors) != null ? r : C, "data-styled": !(f.jsx || f.unstyled || v), "data-mounted": L, "data-promise": !!f.promise, "data-swiped": Ae, "data-removed": U, "data-visible": ft, "data-y-position": bt, "data-x-position": Ve, "data-index": S, "data-front": Ue, "data-swiping": ne, "data-dismissible": Qe, "data-type": Ne, "data-invert": vt, "data-swipe-out": de, "data-swipe-direction": _, "data-expanded": !!(T || $ && L), style: { "--index": S, "--toasts-before": S, "--z-index": E.length - S, "--offset": `${U ? Me : Ot.current}px`, "--initial-height": $ ? "auto" : `${$e}px`, ...A, ...f.style }, onDragEnd: () => {
|
|
20194
20194
|
J(!1), O(null), St.current = null;
|
|
20195
20195
|
}, onPointerDown: (ye) => {
|
|
20196
20196
|
Rt || !Qe || (Ke.current = /* @__PURE__ */ new Date(), Ye(Ot.current), ye.target.setPointerCapture(ye.pointerId), ye.target.tagName !== "BUTTON" && (J(!0), St.current = { x: ye.clientX, y: ye.clientY }));
|
|
@@ -20198,9 +20198,9 @@ var WI = (e) => {
|
|
|
20198
20198
|
var ye, De, ze, rt;
|
|
20199
20199
|
if (de || !Qe) return;
|
|
20200
20200
|
St.current = null;
|
|
20201
|
-
let et = Number(((ye = Be.current) == null ? void 0 : ye.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), Je = Number(((De = Be.current) == null ? void 0 : De.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), yt = (/* @__PURE__ */ new Date()).getTime() - ((ze = Ke.current) == null ? void 0 : ze.getTime()), W =
|
|
20201
|
+
let et = Number(((ye = Be.current) == null ? void 0 : ye.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0), Je = Number(((De = Be.current) == null ? void 0 : De.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0), yt = (/* @__PURE__ */ new Date()).getTime() - ((ze = Ke.current) == null ? void 0 : ze.getTime()), W = F === "x" ? et : Je, se = Math.abs(W) / yt;
|
|
20202
20202
|
if (Math.abs(W) >= zI || se > 0.11) {
|
|
20203
|
-
Ye(Ot.current), (rt = f.onDismiss) == null || rt.call(f, f), K(
|
|
20203
|
+
Ye(Ot.current), (rt = f.onDismiss) == null || rt.call(f, f), K(F === "x" ? et > 0 ? "right" : "left" : Je > 0 ? "down" : "up"), pt(), ve(!0), qe(!1);
|
|
20204
20204
|
return;
|
|
20205
20205
|
}
|
|
20206
20206
|
J(!1), O(null);
|
|
@@ -20208,14 +20208,14 @@ var WI = (e) => {
|
|
|
20208
20208
|
var De, ze, rt, et;
|
|
20209
20209
|
if (!St.current || !Qe || ((De = window.getSelection()) == null ? void 0 : De.toString().length) > 0) return;
|
|
20210
20210
|
let Je = ye.clientY - St.current.y, yt = ye.clientX - St.current.x, W = (ze = e.swipeDirections) != null ? ze : UI(V);
|
|
20211
|
-
|
|
20211
|
+
!F && (Math.abs(yt) > 1 || Math.abs(Je) > 1) && O(Math.abs(yt) > Math.abs(Je) ? "x" : "y");
|
|
20212
20212
|
let se = { x: 0, y: 0 };
|
|
20213
|
-
|
|
20213
|
+
F === "y" ? (W.includes("top") || W.includes("bottom")) && (W.includes("top") && Je < 0 || W.includes("bottom") && Je > 0) && (se.y = Je) : F === "x" && (W.includes("left") || W.includes("right")) && (W.includes("left") && yt < 0 || W.includes("right") && yt > 0) && (se.x = yt), (Math.abs(se.x) > 0 || Math.abs(se.y) > 0) && qe(!0), (rt = Be.current) == null || rt.style.setProperty("--swipe-amount-x", `${se.x}px`), (et = Be.current) == null || et.style.setProperty("--swipe-amount-y", `${se.y}px`);
|
|
20214
20214
|
} }, wt && !f.jsx ? B.createElement("button", { "aria-label": q, "data-disabled": Rt, "data-close-button": !0, onClick: Rt || !Qe ? () => {
|
|
20215
20215
|
} : () => {
|
|
20216
20216
|
var ye;
|
|
20217
20217
|
pt(), (ye = f.onDismiss) == null || ye.call(f, f);
|
|
20218
|
-
}, className: dn(k == null ? void 0 : k.closeButton, (o = f == null ? void 0 : f.classNames) == null ? void 0 : o.closeButton) }, (s = z == null ? void 0 : z.close) != null ? s : RI) : null, f.jsx || Sa(f.title) ? f.jsx ? f.jsx : typeof f.title == "function" ? f.title() : f.title : B.createElement(B.Fragment, null, Ne || f.icon || f.promise ? B.createElement("div", { "data-icon": "", className: dn(k == null ? void 0 : k.icon, (a = f == null ? void 0 : f.classNames) == null ? void 0 : a.icon) }, f.promise || f.type === "loading" && !f.icon ? f.icon || Dt() : null, f.type !== "loading" ? f.icon || (z == null ? void 0 : z[Ne]) || bI(Ne) : null) : null, B.createElement("div", { "data-content": "", className: dn(k == null ? void 0 : k.content, (i = f == null ? void 0 : f.classNames) == null ? void 0 : i.content) }, B.createElement("div", { "data-title": "", className: dn(k == null ? void 0 : k.title, (l = f == null ? void 0 : f.classNames) == null ? void 0 : l.title) }, typeof f.title == "function" ? f.title() : f.title), f.description ? B.createElement("div", { "data-description": "", className: dn(Y, at, k == null ? void 0 : k.description, (c = f == null ? void 0 : f.classNames) == null ? void 0 : c.description) }, typeof f.description == "function" ? f.description() : f.description) : null), Sa(f.cancel) ? f.cancel : f.cancel && Zo(f.cancel) ? B.createElement("button", { "data-button": !0, "data-cancel": !0, style: f.cancelButtonStyle ||
|
|
20218
|
+
}, className: dn(k == null ? void 0 : k.closeButton, (o = f == null ? void 0 : f.classNames) == null ? void 0 : o.closeButton) }, (s = z == null ? void 0 : z.close) != null ? s : RI) : null, f.jsx || Sa(f.title) ? f.jsx ? f.jsx : typeof f.title == "function" ? f.title() : f.title : B.createElement(B.Fragment, null, Ne || f.icon || f.promise ? B.createElement("div", { "data-icon": "", className: dn(k == null ? void 0 : k.icon, (a = f == null ? void 0 : f.classNames) == null ? void 0 : a.icon) }, f.promise || f.type === "loading" && !f.icon ? f.icon || Dt() : null, f.type !== "loading" ? f.icon || (z == null ? void 0 : z[Ne]) || bI(Ne) : null) : null, B.createElement("div", { "data-content": "", className: dn(k == null ? void 0 : k.content, (i = f == null ? void 0 : f.classNames) == null ? void 0 : i.content) }, B.createElement("div", { "data-title": "", className: dn(k == null ? void 0 : k.title, (l = f == null ? void 0 : f.classNames) == null ? void 0 : l.title) }, typeof f.title == "function" ? f.title() : f.title), f.description ? B.createElement("div", { "data-description": "", className: dn(Y, at, k == null ? void 0 : k.description, (c = f == null ? void 0 : f.classNames) == null ? void 0 : c.description) }, typeof f.description == "function" ? f.description() : f.description) : null), Sa(f.cancel) ? f.cancel : f.cancel && Zo(f.cancel) ? B.createElement("button", { "data-button": !0, "data-cancel": !0, style: f.cancelButtonStyle || D, onClick: (ye) => {
|
|
20219
20219
|
var De, ze;
|
|
20220
20220
|
Zo(f.cancel) && Qe && ((ze = (De = f.cancel).onClick) == null || ze.call(De, ye), pt());
|
|
20221
20221
|
}, className: dn(k == null ? void 0 : k.cancelButton, (d = f == null ? void 0 : f.classNames) == null ? void 0 : d.cancelButton) }, f.cancel.label) : null, Sa(f.action) ? f.action : f.action && Zo(f.action) ? B.createElement("button", { "data-button": !0, "data-action": !0, style: f.actionButtonStyle || M, onClick: (ye) => {
|
|
@@ -20243,22 +20243,22 @@ function VI(e, t) {
|
|
|
20243
20243
|
}), n;
|
|
20244
20244
|
}
|
|
20245
20245
|
var KI = Bg(function(e, t) {
|
|
20246
|
-
let { invert: n, position: r = "bottom-right", hotkey: o = ["altKey", "KeyT"], expand: s, closeButton: a, className: i, offset: l, mobileOffset: c, theme: d = "light", richColors: p, duration: m, style: f, visibleToasts: v = DI, toastOptions: g, dir: x = Nu(), gap: b = BI, loadingIcon: w, icons: S, containerAriaLabel: E = "Notifications", pauseWhenPageIsHidden: T } = e, [y, C] = B.useState([]),
|
|
20247
|
-
C((
|
|
20246
|
+
let { invert: n, position: r = "bottom-right", hotkey: o = ["altKey", "KeyT"], expand: s, closeButton: a, className: i, offset: l, mobileOffset: c, theme: d = "light", richColors: p, duration: m, style: f, visibleToasts: v = DI, toastOptions: g, dir: x = Nu(), gap: b = BI, loadingIcon: w, icons: S, containerAriaLabel: E = "Notifications", pauseWhenPageIsHidden: T } = e, [y, C] = B.useState([]), I = B.useMemo(() => Array.from(new Set([r].concat(y.filter((N) => N.position).map((N) => N.position)))), [y, r]), [A, D] = B.useState([]), [M, H] = B.useState(!1), [Y, P] = B.useState(!1), [V, X] = B.useState(d !== "system" ? d : typeof window < "u" && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"), Z = B.useRef(null), $ = o.join("+").replace(/Key/g, "").replace(/Digit/g, ""), k = B.useRef(null), z = B.useRef(!1), q = B.useCallback((N) => {
|
|
20247
|
+
C((F) => {
|
|
20248
20248
|
var O;
|
|
20249
|
-
return (O =
|
|
20249
|
+
return (O = F.find((_) => _.id === N.id)) != null && O.delete || qt.dismiss(N.id), F.filter(({ id: _ }) => _ !== N.id);
|
|
20250
20250
|
});
|
|
20251
20251
|
}, []);
|
|
20252
|
-
return B.useEffect(() => qt.subscribe((
|
|
20253
|
-
if (
|
|
20254
|
-
C((
|
|
20252
|
+
return B.useEffect(() => qt.subscribe((N) => {
|
|
20253
|
+
if (N.dismiss) {
|
|
20254
|
+
C((F) => F.map((O) => O.id === N.id ? { ...O, delete: !0 } : O));
|
|
20255
20255
|
return;
|
|
20256
20256
|
}
|
|
20257
20257
|
setTimeout(() => {
|
|
20258
20258
|
Oi.flushSync(() => {
|
|
20259
|
-
C((
|
|
20260
|
-
let O =
|
|
20261
|
-
return O !== -1 ? [
|
|
20259
|
+
C((F) => {
|
|
20260
|
+
let O = F.findIndex((_) => _.id === N.id);
|
|
20261
|
+
return O !== -1 ? [...F.slice(0, O), { ...F[O], ...N }, ...F.slice(O + 1)] : [N, ...F];
|
|
20262
20262
|
});
|
|
20263
20263
|
});
|
|
20264
20264
|
});
|
|
@@ -20268,13 +20268,13 @@ var KI = Bg(function(e, t) {
|
|
|
20268
20268
|
return;
|
|
20269
20269
|
}
|
|
20270
20270
|
if (d === "system" && (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? X("dark") : X("light")), typeof window > "u") return;
|
|
20271
|
-
let
|
|
20271
|
+
let N = window.matchMedia("(prefers-color-scheme: dark)");
|
|
20272
20272
|
try {
|
|
20273
|
-
|
|
20274
|
-
X(
|
|
20273
|
+
N.addEventListener("change", ({ matches: F }) => {
|
|
20274
|
+
X(F ? "dark" : "light");
|
|
20275
20275
|
});
|
|
20276
20276
|
} catch {
|
|
20277
|
-
|
|
20277
|
+
N.addListener(({ matches: O }) => {
|
|
20278
20278
|
try {
|
|
20279
20279
|
X(O ? "dark" : "light");
|
|
20280
20280
|
} catch (_) {
|
|
@@ -20285,29 +20285,29 @@ var KI = Bg(function(e, t) {
|
|
|
20285
20285
|
}, [d]), B.useEffect(() => {
|
|
20286
20286
|
y.length <= 1 && H(!1);
|
|
20287
20287
|
}, [y]), B.useEffect(() => {
|
|
20288
|
-
let
|
|
20288
|
+
let N = (F) => {
|
|
20289
20289
|
var O, _;
|
|
20290
|
-
o.every((K) =>
|
|
20290
|
+
o.every((K) => F[K] || F.code === K) && (H(!0), (O = Z.current) == null || O.focus()), F.code === "Escape" && (document.activeElement === Z.current || (_ = Z.current) != null && _.contains(document.activeElement)) && H(!1);
|
|
20291
20291
|
};
|
|
20292
|
-
return document.addEventListener("keydown",
|
|
20292
|
+
return document.addEventListener("keydown", N), () => document.removeEventListener("keydown", N);
|
|
20293
20293
|
}, [o]), B.useEffect(() => {
|
|
20294
20294
|
if (Z.current) return () => {
|
|
20295
20295
|
k.current && (k.current.focus({ preventScroll: !0 }), k.current = null, z.current = !1);
|
|
20296
20296
|
};
|
|
20297
|
-
}, [Z.current]), B.createElement("section", { ref: t, "aria-label": `${E} ${
|
|
20297
|
+
}, [Z.current]), B.createElement("section", { ref: t, "aria-label": `${E} ${$}`, tabIndex: -1, "aria-live": "polite", "aria-relevant": "additions text", "aria-atomic": "false", suppressHydrationWarning: !0 }, I.map((N, F) => {
|
|
20298
20298
|
var O;
|
|
20299
|
-
let [_, K] =
|
|
20300
|
-
return y.length ? B.createElement("ol", { key:
|
|
20301
|
-
z.current && !
|
|
20302
|
-
}, onFocus: (
|
|
20303
|
-
|
|
20299
|
+
let [_, K] = N.split("-");
|
|
20300
|
+
return y.length ? B.createElement("ol", { key: N, dir: x === "auto" ? Nu() : x, tabIndex: -1, ref: Z, className: i, "data-sonner-toaster": !0, "data-theme": V, "data-y-position": _, "data-lifted": M && y.length > 1 && !s, "data-x-position": K, style: { "--front-toast-height": `${((O = A[0]) == null ? void 0 : O.height) || 0}px`, "--width": `${FI}px`, "--gap": `${b}px`, ...f, ...VI(l, c) }, onBlur: (L) => {
|
|
20301
|
+
z.current && !L.currentTarget.contains(L.relatedTarget) && (z.current = !1, k.current && (k.current.focus({ preventScroll: !0 }), k.current = null));
|
|
20302
|
+
}, onFocus: (L) => {
|
|
20303
|
+
L.target instanceof HTMLElement && L.target.dataset.dismissible === "false" || z.current || (z.current = !0, k.current = L.relatedTarget);
|
|
20304
20304
|
}, onMouseEnter: () => H(!0), onMouseMove: () => H(!0), onMouseLeave: () => {
|
|
20305
20305
|
Y || H(!1);
|
|
20306
|
-
}, onDragEnd: () => H(!1), onPointerDown: (
|
|
20307
|
-
|
|
20308
|
-
}, onPointerUp: () => P(!1) }, y.filter((
|
|
20306
|
+
}, onDragEnd: () => H(!1), onPointerDown: (L) => {
|
|
20307
|
+
L.target instanceof HTMLElement && L.target.dataset.dismissible === "false" || P(!0);
|
|
20308
|
+
}, onPointerUp: () => P(!1) }, y.filter((L) => !L.position && F === 0 || L.position === N).map((L, j) => {
|
|
20309
20309
|
var U, Q;
|
|
20310
|
-
return B.createElement(WI, { key:
|
|
20310
|
+
return B.createElement(WI, { key: L.id, icons: S, index: j, toast: L, defaultRichColors: p, duration: (U = g == null ? void 0 : g.duration) != null ? U : m, className: g == null ? void 0 : g.className, descriptionClassName: g == null ? void 0 : g.descriptionClassName, invert: n, visibleToasts: v, closeButton: (Q = g == null ? void 0 : g.closeButton) != null ? Q : a, interacting: Y, position: N, style: g == null ? void 0 : g.style, unstyled: g == null ? void 0 : g.unstyled, classNames: g == null ? void 0 : g.classNames, cancelButtonStyle: g == null ? void 0 : g.cancelButtonStyle, actionButtonStyle: g == null ? void 0 : g.actionButtonStyle, removeToast: q, toasts: y.filter((ne) => ne.position == L.position), heights: A.filter((ne) => ne.position == L.position), setHeights: D, expandByDefault: s, gap: b, loadingIcon: w, expanded: M, pauseWhenPageIsHidden: T, swipeDirections: e.swipeDirections });
|
|
20311
20311
|
})) : null;
|
|
20312
20312
|
}));
|
|
20313
20313
|
});
|