@gentiq/ui 1.0.0-alpha.8 → 1.0.0-alpha.9
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/FeedbackSettings-oq019el1.js +199 -0
- package/dist/{VoiceInput-XbeKOMjo.js → VoiceInput-sKSP-X3z.js} +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.es.js +12 -12
- package/dist/internal.es.js +52 -64
- package/dist/shared-BKh4GbRI.js +20 -0
- package/dist/{shared-CDBfvRf2.js → shared-DO5kF-Zj.js} +916 -903
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as n, jsxs as d, Fragment as $ } from "react/jsx-runtime";
|
|
3
|
-
import { QuoteIcon as Qe, ChevronDownIcon as Ke, BrainIcon as er, ImagePlusIcon as tr, CodeIcon as nr, DownloadIcon as
|
|
4
|
-
import * as
|
|
5
|
-
import { useRef as U, useState as C, useEffect as D, useContext as
|
|
6
|
-
import { withDefaults as ie, useServerConfig as
|
|
7
|
-
import { Slot as
|
|
8
|
-
import { c as x, u as X, C as zt, a as It, b as Tt, D as
|
|
9
|
-
import { toast as B, Toaster as
|
|
10
|
-
import { getTextDirection as oe, resolveMessageId as
|
|
11
|
-
import
|
|
12
|
-
import { defaultRemarkPlugins as
|
|
13
|
-
import { cjk as
|
|
3
|
+
import { QuoteIcon as Qe, ChevronDownIcon as Ke, BrainIcon as er, ImagePlusIcon as tr, CodeIcon as nr, DownloadIcon as ut, GlobeIcon as sr, WrenchIcon as rr, XCircleIcon as Cn, CopyIcon as zn, BanIcon as ar, CheckCircleIcon as or, ClockIcon as en, ShieldQuestionIcon as ir, CircleIcon as lr, FileIcon as In, ListChecksIcon as cr, ArrowUpIcon as Tn, BookIcon as dr, ArrowDownIcon as ur, XIcon as Se, CheckIcon as yt, RefreshCcwIcon as mr, ThumbsUpIcon as hr, ThumbsDownIcon as fr, PencilIcon as pr, SquareIcon as tn, AlertCircleIcon as gr, RotateCwIcon as br, CameraOffIcon as xr, Loader2Icon as wt, RotateCcwIcon as vr, SwitchCameraIcon as yr, PlusIcon as wr, FileTextIcon as Nr, ImagesIcon as kr, CameraIcon as _r, MicIcon as Sr, Wrench as Mn, RefreshCw as Cr, OctagonXIcon as zr, TriangleAlertIcon as Ir, InfoIcon as Tr, CircleCheckIcon as Mr, User as Pr, Palette as Pn, ShieldCheck as Rr, MessageSquarePlus as Ar, Settings as Re, Globe as Dr, X as Nt, AtSign as Or, Mail as Er, Smartphone as Lr, Lock as qr, Save as $r, Zap as jr, LogOut as Rn, ChevronRight as Fr, Check as An, PanelLeftIcon as Ur, PinOff as Br, Pin as Dn, Share2 as Hr, Link2Off as Vr, Pencil as Gr, Trash as Wr, MoreVertical as Qr, SquarePen as On, Search as En, ArrowLeft as Kr } from "lucide-react";
|
|
4
|
+
import * as te from "react";
|
|
5
|
+
import { useRef as U, useState as C, useEffect as D, useContext as Ce, useMemo as O, createContext as Ee, useSyncExternalStore as Ln, useLayoutEffect as qn, memo as Le, useCallback as de, Component as Xr, Suspense as Ae, lazy as Xe, Children as Yr, forwardRef as $n, createElement as Jr, useId as Zr } from "react";
|
|
6
|
+
import { withDefaults as ie, useServerConfig as qe, createOptionsStore as kt, useOptionsStore as jn, useGentiqOptions as K, useGentiqTranslation as _, References as De, useMessage as W, useGentiqLanguage as V, useToolApproval as ea, useFileUrl as ta, useChatReferencesActions as na, useThreadView as ve, useThreadScope as Fn, Thread as Oe, localizeError as sa, Message as le, ActionBar as be, getLocalizedErrorMessage as pe, Composer as fe, useComposer as _t, useGentiqUser as Un, useComposerVoice as Bn, useGentiqStatus as Hn, useGentiqFeature as ra, useComposerRoot as aa, useGentiqEntitlement as St, useTheme as ze, useThreadSelection as Ct, ThreadSelectionProvider as Vn, useThread as oa, GentiqRuntimeProvider as ia, useLoginCodeExchange as la, useAuthSession as ca, useGentiqApi as Ye, useGentiqQueryClient as Gn, useGentiqKeys as da, useThreadListItem as Wn, useThreads as ua, ThreadList as se, ThreadRename as je } from "@gentiq/react";
|
|
7
|
+
import { Slot as ma } from "@radix-ui/react-slot";
|
|
8
|
+
import { c as x, u as X, C as zt, a as It, b as Tt, D as $e, d as Qn, B as E, e as Mt, f as Kn, g as Xn, h as ha, L as Be, T as Je, i as Ze, j as et, k as Yn, l as Pt, m as Rt, n as At, o as we, p as fa, q as Jn, r as pa, s as Zn, t as Dt, v as ga, w as Ot, x as mt, y as Et, z as Lt, A as ba, S as xa, E as va, P as ya, F as nn, G as ce, H as es, I as ts, J as ns, K as ss, M as rs, N as Ge, O as wa, Q as Na, R as ka, U as _a, V as Sa, W as Ca, X as za, Y as Ia, Z as Ta, _ as Ma, $ as Pa, a0 as Ra } from "./shared-BtZa4J_w.js";
|
|
9
|
+
import { toast as B, Toaster as Aa } from "sonner";
|
|
10
|
+
import { getTextDirection as oe, resolveMessageId as Da, writeStored as Oa, readStored as Ea, isGentiqError as qt, HIDDEN_PART_TYPES as La, messageText as qa, textOrKey as Ne, evaluateCondition as $t, getAvailableLanguages as $a, getLanguageNativeName as ja, withAttachmentUrls as Fa, toGentiqMessages as Ua } from "@gentiq/core";
|
|
11
|
+
import Ba from "rehype-sanitize";
|
|
12
|
+
import { defaultRemarkPlugins as Ha, Streamdown as Va, defaultRehypePlugins as jt } from "streamdown";
|
|
13
|
+
import { cjk as Ga } from "@streamdown/cjk";
|
|
14
14
|
import { useControllableState as sn } from "@radix-ui/react-use-controllable-state";
|
|
15
|
-
import { getToolName as
|
|
16
|
-
import { flushSync as
|
|
17
|
-
import * as
|
|
18
|
-
import * as
|
|
15
|
+
import { getToolName as tt, isToolUIPart as nt } from "ai";
|
|
16
|
+
import { flushSync as Wa, createPortal as Qa } from "react-dom";
|
|
17
|
+
import * as _e from "@radix-ui/react-dialog";
|
|
18
|
+
import * as Pe from "@radix-ui/react-scroll-area";
|
|
19
19
|
import * as We from "@radix-ui/react-hover-card";
|
|
20
|
-
function
|
|
20
|
+
function Ka() {
|
|
21
21
|
const e = U(null), [t, s] = C(0);
|
|
22
22
|
return D(() => {
|
|
23
23
|
const r = e.current;
|
|
@@ -31,7 +31,7 @@ function Qa() {
|
|
|
31
31
|
return o?.observe(r), () => o?.disconnect();
|
|
32
32
|
}, []), [e, t];
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function Xa(e, t) {
|
|
35
35
|
const s = e.composer, r = t.composer, a = e.settings, o = t.settings;
|
|
36
36
|
return {
|
|
37
37
|
history: ne(e.history, t.history),
|
|
@@ -108,17 +108,17 @@ function Ft(e, t) {
|
|
|
108
108
|
disclaimer: t?.disclaimer || i,
|
|
109
109
|
settings: {
|
|
110
110
|
sections: {
|
|
111
|
-
general:
|
|
111
|
+
general: ot(
|
|
112
112
|
l?.sections?.general,
|
|
113
113
|
t?.settings_general_mode,
|
|
114
114
|
t?.settings_general_fields
|
|
115
115
|
),
|
|
116
|
-
profile:
|
|
116
|
+
profile: ot(
|
|
117
117
|
l?.sections?.profile,
|
|
118
118
|
t?.settings_profile_mode,
|
|
119
119
|
t?.settings_profile_fields
|
|
120
120
|
),
|
|
121
|
-
account:
|
|
121
|
+
account: ot(
|
|
122
122
|
l?.sections?.account,
|
|
123
123
|
t?.settings_account_mode,
|
|
124
124
|
t?.settings_account_fields
|
|
@@ -131,7 +131,7 @@ function Ft(e, t) {
|
|
|
131
131
|
configured: e
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function ot(e, t, s) {
|
|
135
135
|
return {
|
|
136
136
|
...e,
|
|
137
137
|
mode: t || e?.mode,
|
|
@@ -139,9 +139,9 @@ function at(e, t, s) {
|
|
|
139
139
|
fields: { ...e?.fields, ...s }
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
const
|
|
142
|
+
const ht = Ee(null);
|
|
143
143
|
function Y(e) {
|
|
144
|
-
const t =
|
|
144
|
+
const t = Ce(ht), s = qe(), r = O(() => kt(Ft({}, s)), [s]);
|
|
145
145
|
return jn(t ?? r, e);
|
|
146
146
|
}
|
|
147
147
|
const Ut = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
|
|
@@ -165,48 +165,48 @@ const Ut = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
|
|
|
165
165
|
...r,
|
|
166
166
|
children: e
|
|
167
167
|
}
|
|
168
|
-
),
|
|
168
|
+
), Ya = /(```[\s\S]*?(?:```|$)|~~~[\s\S]*?(?:~~~|$)|`+[^`\n]*`+)|\\\[([\s\S]+?)\\\]|\\\(([\s\S]+?)\\\)|\$\$([^$]+?)\$\$/g, Ja = /\n[ \t]*\n/, Za = (e, t) => {
|
|
169
169
|
let s = 0;
|
|
170
170
|
for (; t - s > 0 && e[t - s - 1] === "\\"; ) s += 1;
|
|
171
171
|
return s % 2 === 0;
|
|
172
|
-
},
|
|
172
|
+
}, eo = /^[ \t]*\n[\s\S]*\n[ \t>]*$/, to = /(?:^|[^\\])%/, rn = String.raw`(?:(?=\p{Script=Arabic})[\p{L}\p{M}])`, no = new RegExp(
|
|
173
173
|
`${rn}(?:[\\p{Script=Arabic}\\p{M}\\s\\u200c]*${rn})?`,
|
|
174
174
|
"gu"
|
|
175
|
-
),
|
|
176
|
-
`) && !
|
|
175
|
+
), so = (e) => (e.includes(`
|
|
176
|
+
`) && !eo.test(e) && !to.test(e) ? e.replace(/[ \t]*\n[ \t]*/g, " ") : e).replace(no, (s) => `\\text{${s}}`), ro = (e) => {
|
|
177
177
|
if (!e.includes("\\") && !e.includes("$$")) return e;
|
|
178
178
|
const t = (s, r, a, o, i, l) => {
|
|
179
179
|
if (r !== void 0) return s;
|
|
180
180
|
const c = a ?? o ?? i ?? "";
|
|
181
|
-
return !c.trim() ||
|
|
181
|
+
return !c.trim() || Ja.test(c) || !Za(e, l) ? s : `$$${so(c)}$$`;
|
|
182
182
|
};
|
|
183
|
-
return e.replace(
|
|
183
|
+
return e.replace(Ya, t);
|
|
184
184
|
}, as = (e) => e.type === "element", os = (e) => {
|
|
185
185
|
const t = e.properties?.className;
|
|
186
186
|
return Array.isArray(t) ? t.filter((s) => typeof s == "string") : typeof t == "string" ? t.split(/\s+/) : [];
|
|
187
|
-
},
|
|
187
|
+
}, ao = (e) => as(e) && e.tagName === "code" && os(e).includes("language-math"), oo = (e) => e.type === "text" && !e.value.trim(), io = (e) => {
|
|
188
188
|
if (!as(e) || e.tagName !== "p") return null;
|
|
189
|
-
const t = e.children.filter((r) => !
|
|
190
|
-
return t.length === 1 &&
|
|
191
|
-
},
|
|
189
|
+
const t = e.children.filter((r) => !oo(r)), [s] = t;
|
|
190
|
+
return t.length === 1 && ao(s) ? s : null;
|
|
191
|
+
}, lo = (e) => {
|
|
192
192
|
e.properties = { ...e.properties, className: [...os(e), "math-display"] };
|
|
193
193
|
}, is = (e) => {
|
|
194
194
|
for (const t of e.children ?? []) {
|
|
195
|
-
const s =
|
|
195
|
+
const s = io(t);
|
|
196
196
|
if (s) {
|
|
197
|
-
|
|
197
|
+
lo(s);
|
|
198
198
|
continue;
|
|
199
199
|
}
|
|
200
200
|
is(t);
|
|
201
201
|
}
|
|
202
|
-
},
|
|
202
|
+
}, co = () => (e) => {
|
|
203
203
|
is(e);
|
|
204
|
-
},
|
|
204
|
+
}, uo = /* @__PURE__ */ new Set(["a", "code", "pre", "math", "svg", "style", "script", "textarea"]), mo = (e) => e.type === "element", ho = /* @__PURE__ */ new Set(["math", "math-inline", "math-display"]), fo = (e) => {
|
|
205
205
|
const t = e.properties?.className;
|
|
206
206
|
return (Array.isArray(t) ? t : typeof t == "string" ? [t] : []).some(
|
|
207
|
-
(r) => typeof r == "string" && (r.startsWith("katex") ||
|
|
207
|
+
(r) => typeof r == "string" && (r.startsWith("katex") || ho.has(r))
|
|
208
208
|
);
|
|
209
|
-
}, po = /(\s+)/,
|
|
209
|
+
}, po = /(\s+)/, go = (e) => {
|
|
210
210
|
if (!e.trim()) return null;
|
|
211
211
|
const t = [];
|
|
212
212
|
for (const s of e.split(po))
|
|
@@ -230,7 +230,7 @@ const Ut = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
|
|
|
230
230
|
let r = !1;
|
|
231
231
|
for (const a of t) {
|
|
232
232
|
if (a.type === "text") {
|
|
233
|
-
const o =
|
|
233
|
+
const o = go(a.value);
|
|
234
234
|
if (o) {
|
|
235
235
|
s.push(...o), r = !0;
|
|
236
236
|
continue;
|
|
@@ -238,16 +238,16 @@ const Ut = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
|
|
|
238
238
|
s.push(a);
|
|
239
239
|
continue;
|
|
240
240
|
}
|
|
241
|
-
if (
|
|
241
|
+
if (mo(a) && (uo.has(a.tagName) || fo(a))) {
|
|
242
242
|
s.push(a);
|
|
243
243
|
continue;
|
|
244
244
|
}
|
|
245
245
|
ls(a), s.push(a);
|
|
246
246
|
}
|
|
247
247
|
r && (e.children = s);
|
|
248
|
-
},
|
|
248
|
+
}, bo = () => (e) => {
|
|
249
249
|
ls(e);
|
|
250
|
-
}, cs = (e) => e.type === "element",
|
|
250
|
+
}, cs = (e) => e.type === "element", xo = /* @__PURE__ */ new Set([
|
|
251
251
|
"p",
|
|
252
252
|
"h1",
|
|
253
253
|
"h2",
|
|
@@ -263,7 +263,7 @@ const Ut = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
|
|
|
263
263
|
"th",
|
|
264
264
|
"figcaption",
|
|
265
265
|
"summary"
|
|
266
|
-
]),
|
|
266
|
+
]), vo = /* @__PURE__ */ new Set(["pre", "code", "kbd", "samp", "var"]), yo = /* @__PURE__ */ new Set(["math", "svg", "style", "script", "textarea"]), an = (e) => e.type === "text" ? !!e.value.trim() : e.type === "element", ds = (e) => cs(e) && e.tagName === "br", wo = (e, t) => {
|
|
267
267
|
const s = [[]], r = (a) => s[s.length - 1].push(a);
|
|
268
268
|
for (const a of e) {
|
|
269
269
|
if (ds(a)) {
|
|
@@ -281,12 +281,12 @@ const Ut = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
|
|
|
281
281
|
r(a);
|
|
282
282
|
}
|
|
283
283
|
return s;
|
|
284
|
-
},
|
|
284
|
+
}, No = (e) => {
|
|
285
285
|
const [t] = e;
|
|
286
286
|
if (t?.type !== "text") return e;
|
|
287
287
|
const s = t.value.replace(/^[^\S\n]*\n[^\S\n]*/, "");
|
|
288
288
|
return s === t.value ? e : s ? [{ type: "text", value: s }, ...e.slice(1)] : e.slice(1);
|
|
289
|
-
},
|
|
289
|
+
}, ko = (e) => ({
|
|
290
290
|
type: "element",
|
|
291
291
|
tagName: "span",
|
|
292
292
|
properties: { className: ["gentiq-line"], dir: "auto" },
|
|
@@ -296,67 +296,67 @@ const Ut = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
|
|
|
296
296
|
tagName: "br",
|
|
297
297
|
properties: {},
|
|
298
298
|
children: []
|
|
299
|
-
}),
|
|
300
|
-
const [s, ...r] =
|
|
299
|
+
}), _o = (e, t) => {
|
|
300
|
+
const [s, ...r] = wo(e.children, t).map(No);
|
|
301
301
|
e.children = [
|
|
302
302
|
// An empty run is a blank line the author asked for; it keeps its break
|
|
303
303
|
// rather than collapsing into a zero-height box.
|
|
304
304
|
...s.some(an) ? s : [on()],
|
|
305
|
-
...r.map((a) => a.some(an) ?
|
|
305
|
+
...r.map((a) => a.some(an) ? ko(a) : on())
|
|
306
306
|
];
|
|
307
|
-
},
|
|
307
|
+
}, So = (e, t) => e.some(
|
|
308
308
|
(s) => ds(s) || t && s.type === "text" && s.value.includes(`
|
|
309
309
|
`)
|
|
310
310
|
), us = (e, t) => {
|
|
311
311
|
for (const s of e.children ?? [])
|
|
312
|
-
if (cs(s) && !
|
|
313
|
-
if (
|
|
312
|
+
if (cs(s) && !yo.has(s.tagName)) {
|
|
313
|
+
if (vo.has(s.tagName)) {
|
|
314
314
|
s.properties = { ...s.properties, dir: "ltr" };
|
|
315
315
|
continue;
|
|
316
316
|
}
|
|
317
|
-
us(s, t),
|
|
317
|
+
us(s, t), xo.has(s.tagName) && (So(s.children, t) && _o(s, t), s.properties = { ...s.properties, dir: "auto" });
|
|
318
318
|
}
|
|
319
|
-
},
|
|
319
|
+
}, Co = (e = {}) => (t) => {
|
|
320
320
|
us(t, e.preserveNewlines ?? !1);
|
|
321
|
-
},
|
|
322
|
-
let
|
|
323
|
-
const pt = /* @__PURE__ */ new Set(),
|
|
321
|
+
}, zo = { cjk: Ga };
|
|
322
|
+
let ft = zo;
|
|
323
|
+
const pt = /* @__PURE__ */ new Set(), Io = (e) => (pt.add(e), () => {
|
|
324
324
|
pt.delete(e);
|
|
325
|
-
}), ln = () =>
|
|
326
|
-
if (
|
|
325
|
+
}), ln = () => ft, it = /* @__PURE__ */ new Map(), lt = (e) => {
|
|
326
|
+
if (it.has(e)) return;
|
|
327
327
|
const t = e === "code" ? import("@streamdown/code").then(({ code: s }) => ({ code: s })) : e === "math" ? import("@streamdown/math").then(({ math: s }) => ({ math: s })) : import("@streamdown/mermaid").then(({ mermaid: s }) => ({ mermaid: s }));
|
|
328
|
-
|
|
328
|
+
it.set(
|
|
329
329
|
e,
|
|
330
330
|
t.then((s) => {
|
|
331
|
-
|
|
331
|
+
ft = { ...ft, ...s };
|
|
332
332
|
for (const r of pt) r();
|
|
333
333
|
}).catch(() => {
|
|
334
|
-
|
|
334
|
+
it.delete(e);
|
|
335
335
|
})
|
|
336
336
|
);
|
|
337
|
-
},
|
|
338
|
-
let
|
|
339
|
-
function
|
|
340
|
-
const t = Ln(
|
|
337
|
+
}, To = "```", Mo = /```[ \t]*mermaid\b/;
|
|
338
|
+
let Po = null;
|
|
339
|
+
function Ro(e) {
|
|
340
|
+
const t = Ln(Io, ln, ln), s = e.includes(To), r = s && Mo.test(e), a = e.includes("$$");
|
|
341
341
|
return D(() => {
|
|
342
|
-
s &&
|
|
342
|
+
s && lt("code");
|
|
343
343
|
}, [s]), D(() => {
|
|
344
|
-
r &&
|
|
344
|
+
r && lt("mermaid");
|
|
345
345
|
}, [r]), D(() => {
|
|
346
|
-
a && (
|
|
346
|
+
a && (lt("math"), Po ??= import("katex/dist/katex.min.css").catch(() => {
|
|
347
347
|
}));
|
|
348
348
|
}, [a]), t;
|
|
349
349
|
}
|
|
350
|
-
const
|
|
350
|
+
const Ao = { linkMode: "text-only" }, Do = { enabled: !1 }, Ht = (e) => {
|
|
351
351
|
const t = jt[e];
|
|
352
352
|
return Array.isArray(t) ? t[1] ?? {} : {};
|
|
353
|
-
},
|
|
353
|
+
}, Oo = (e, t) => {
|
|
354
354
|
const s = jt[e];
|
|
355
355
|
return [Array.isArray(s) ? s[0] : s, { ...Ht(e), ...t }];
|
|
356
|
-
},
|
|
356
|
+
}, Eo = (e) => {
|
|
357
357
|
const t = Ht("sanitize");
|
|
358
358
|
return [
|
|
359
|
-
|
|
359
|
+
Ba,
|
|
360
360
|
{
|
|
361
361
|
...t,
|
|
362
362
|
protocols: {
|
|
@@ -365,15 +365,15 @@ const Ro = { linkMode: "text-only" }, Ao = { enabled: !1 }, Ht = (e) => {
|
|
|
365
365
|
}
|
|
366
366
|
}
|
|
367
367
|
];
|
|
368
|
-
},
|
|
368
|
+
}, Lo = (e, t, s) => {
|
|
369
369
|
const r = e.length ? {
|
|
370
370
|
// Sanitizing is what drops the href: its schema is an allow-list of
|
|
371
371
|
// schemes, and an unknown one leaves the link href-less.
|
|
372
|
-
sanitize:
|
|
372
|
+
sanitize: Eo(e),
|
|
373
373
|
// Hardening runs a second, independent scheme check. Streamdown happens
|
|
374
374
|
// to configure it wide open today, but riding on that would mean a
|
|
375
375
|
// stricter upstream default silently blocking these links again.
|
|
376
|
-
harden:
|
|
376
|
+
harden: Oo("harden", {
|
|
377
377
|
allowedProtocols: [
|
|
378
378
|
...Ht("harden").allowedProtocols ?? [],
|
|
379
379
|
...e.map((a) => `${a}:`)
|
|
@@ -384,20 +384,20 @@ const Ro = { linkMode: "text-only" }, Ao = { enabled: !1 }, Ht = (e) => {
|
|
|
384
384
|
...Object.entries(jt).map(([a, o]) => r[a] ?? o),
|
|
385
385
|
// After sanitizing, which is what strips the marker it has to put back, and
|
|
386
386
|
// before KaTeX, which Streamdown appends after everything supplied here.
|
|
387
|
-
|
|
387
|
+
co,
|
|
388
388
|
// After sanitizing and hardening, which both strip a `dir` they were not
|
|
389
389
|
// configured to expect, and before the word spans, which are not blocks and
|
|
390
390
|
// would only be walked for nothing.
|
|
391
|
-
[
|
|
391
|
+
[Co, { preserveNewlines: s }],
|
|
392
392
|
// Dead last, after sanitizing and hardening: the spans it adds are ours,
|
|
393
393
|
// not the model's, and neither pass should have an opinion about them.
|
|
394
|
-
...t ? [
|
|
394
|
+
...t ? [bo] : []
|
|
395
395
|
];
|
|
396
|
-
}, cn = /* @__PURE__ */ new Map(),
|
|
396
|
+
}, cn = /* @__PURE__ */ new Map(), qo = (e, t, s) => {
|
|
397
397
|
const r = `${t ? "w" : "-"}|${s ? "n" : "-"}|${e.join(",")}`;
|
|
398
398
|
let a = cn.get(r);
|
|
399
|
-
return a || (a =
|
|
400
|
-
},
|
|
399
|
+
return a || (a = Lo(e, t, s), cn.set(r, a)), a;
|
|
400
|
+
}, st = ({
|
|
401
401
|
className: e,
|
|
402
402
|
children: t,
|
|
403
403
|
remarkPlugins: s,
|
|
@@ -408,90 +408,90 @@ const Ro = { linkMode: "text-only" }, Ao = { enabled: !1 }, Ht = (e) => {
|
|
|
408
408
|
preserveNewlines: l = !1,
|
|
409
409
|
...c
|
|
410
410
|
}) => {
|
|
411
|
-
const u = typeof t == "string" ? t : "",
|
|
412
|
-
() => s?.length ? [...Object.values(
|
|
411
|
+
const u = typeof t == "string" ? t : "", f = O(() => ro(u), [u]), m = Ro(f), g = O(
|
|
412
|
+
() => s?.length ? [...Object.values(Ha), ...s] : void 0,
|
|
413
413
|
[s]
|
|
414
|
-
),
|
|
415
|
-
const N =
|
|
416
|
-
|
|
414
|
+
), p = a?.join(",") ?? "", h = O(() => {
|
|
415
|
+
const N = qo(
|
|
416
|
+
p ? p.split(",") : [],
|
|
417
417
|
o,
|
|
418
418
|
l
|
|
419
419
|
);
|
|
420
420
|
return r?.length ? [...N, ...r] : N;
|
|
421
|
-
}, [r,
|
|
421
|
+
}, [r, p, o, l]);
|
|
422
422
|
return (
|
|
423
423
|
// `Streamdown` is itself memoized on `children`, so a settled message never
|
|
424
424
|
// re-renders this subtree — no outer `memo` needed here.
|
|
425
425
|
/* @__PURE__ */ n(
|
|
426
|
-
|
|
426
|
+
Va,
|
|
427
427
|
{
|
|
428
428
|
className: x("size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0 code-bg ", e),
|
|
429
429
|
mode: i,
|
|
430
430
|
plugins: m,
|
|
431
|
-
remend:
|
|
432
|
-
linkSafety:
|
|
431
|
+
remend: Ao,
|
|
432
|
+
linkSafety: Do,
|
|
433
433
|
...c,
|
|
434
434
|
remarkPlugins: g,
|
|
435
435
|
rehypePlugins: h,
|
|
436
|
-
children: typeof t == "string" ?
|
|
436
|
+
children: typeof t == "string" ? f : t
|
|
437
437
|
}
|
|
438
438
|
)
|
|
439
439
|
);
|
|
440
440
|
};
|
|
441
|
-
|
|
442
|
-
const ms = 40, hs = 900,
|
|
441
|
+
st.displayName = "Response";
|
|
442
|
+
const ms = 40, hs = 900, $o = 220, jo = 120, Fo = 250, Uo = 1e3, dn = 48, Bo = (e, t) => {
|
|
443
443
|
if (t >= e.length) return e.length;
|
|
444
444
|
const s = Math.max(0, t - dn);
|
|
445
445
|
for (let r = t; r > s; r--)
|
|
446
446
|
if (/\s/.test(e[r])) return r;
|
|
447
447
|
return t < dn ? 0 : t;
|
|
448
|
-
},
|
|
449
|
-
function
|
|
448
|
+
}, Ho = 120, Vo = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
449
|
+
function fs(e, t, s = {}) {
|
|
450
450
|
const {
|
|
451
451
|
minCharsPerSecond: r = ms,
|
|
452
452
|
maxCharsPerSecond: a = hs,
|
|
453
453
|
enabled: o = !0
|
|
454
|
-
} = s, [i] = C(
|
|
455
|
-
() => t && e.length <=
|
|
456
|
-
),
|
|
454
|
+
} = s, [i] = C(Vo), l = o && !i, [c, u] = C(
|
|
455
|
+
() => t && e.length <= Ho ? Math.min(e.length, 1) : e.length
|
|
456
|
+
), f = U(c), m = U(0);
|
|
457
457
|
D(() => {
|
|
458
458
|
if (!l) {
|
|
459
|
-
|
|
459
|
+
f.current = e.length;
|
|
460
460
|
return;
|
|
461
461
|
}
|
|
462
|
-
if (e.length <
|
|
463
|
-
|
|
462
|
+
if (e.length < f.current) {
|
|
463
|
+
f.current = e.length, m.current = 0, u(e.length);
|
|
464
464
|
return;
|
|
465
465
|
}
|
|
466
|
-
if (
|
|
466
|
+
if (f.current >= e.length) {
|
|
467
467
|
u((b) => b >= e.length ? b : e.length);
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
|
-
let
|
|
470
|
+
let p = 0, h = performance.now();
|
|
471
471
|
const N = t ? 0 : Math.min(
|
|
472
|
-
Math.max((e.length -
|
|
472
|
+
Math.max((e.length - f.current) / jo * 1e3, r),
|
|
473
473
|
a
|
|
474
|
-
), v = Math.floor(a *
|
|
475
|
-
|
|
476
|
-
const I = Math.min(b - h,
|
|
477
|
-
h = b, e.length -
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
480
|
-
const T = (t ? Math.min(Math.max(
|
|
474
|
+
), v = Math.floor(a * Uo / 1e3), y = (b) => {
|
|
475
|
+
p = 0;
|
|
476
|
+
const I = Math.min(b - h, Fo);
|
|
477
|
+
h = b, e.length - f.current > v && (f.current = e.length - v, m.current = 0);
|
|
478
|
+
const k = e.length - f.current;
|
|
479
|
+
if (k <= 0) return;
|
|
480
|
+
const T = (t ? Math.min(Math.max(k / $o * 1e3, r), a) : N) * I / 1e3 + m.current, P = Math.floor(T);
|
|
481
481
|
if (m.current = T - P, P > 0) {
|
|
482
|
-
const A = Math.min(e.length,
|
|
483
|
-
if (
|
|
482
|
+
const A = Math.min(e.length, f.current + P);
|
|
483
|
+
if (f.current = A, u(A), A >= e.length) return;
|
|
484
484
|
}
|
|
485
|
-
|
|
485
|
+
p = requestAnimationFrame(y);
|
|
486
486
|
};
|
|
487
|
-
return
|
|
488
|
-
|
|
487
|
+
return p = requestAnimationFrame(y), () => {
|
|
488
|
+
p && cancelAnimationFrame(p);
|
|
489
489
|
};
|
|
490
490
|
}, [e, t, l, r, a]);
|
|
491
491
|
const g = l && c < e.length;
|
|
492
|
-
return [g ? e.slice(0,
|
|
492
|
+
return [g ? e.slice(0, Bo(e, c)) : e, g];
|
|
493
493
|
}
|
|
494
|
-
function
|
|
494
|
+
function ps() {
|
|
495
495
|
const t = K((s) => s.app)?.smoothStreaming;
|
|
496
496
|
return O(() => {
|
|
497
497
|
const s = typeof t == "object" ? t : {};
|
|
@@ -508,16 +508,16 @@ function gs({
|
|
|
508
508
|
children: s,
|
|
509
509
|
...r
|
|
510
510
|
}) {
|
|
511
|
-
const { t: a } =
|
|
511
|
+
const { t: a } = _(["chat"]);
|
|
512
512
|
return /* @__PURE__ */ d(
|
|
513
|
-
|
|
513
|
+
De.Source,
|
|
514
514
|
{
|
|
515
515
|
className: `group/reference relative rounded-md transition-colors ${t ?? ""}`,
|
|
516
516
|
...r,
|
|
517
517
|
children: [
|
|
518
518
|
s,
|
|
519
519
|
e && /* @__PURE__ */ n(
|
|
520
|
-
|
|
520
|
+
De.Quote,
|
|
521
521
|
{
|
|
522
522
|
className: "absolute end-1.5 top-1.5 z-10 flex size-7 items-center justify-center rounded-lg bg-background text-muted-foreground opacity-0 shadow-sm ring-1 ring-border/60 transition hover:text-foreground group-hover/reference:opacity-100 focus-visible:opacity-100",
|
|
523
523
|
"aria-label": a("reference"),
|
|
@@ -535,32 +535,32 @@ function bs({
|
|
|
535
535
|
streaming: s,
|
|
536
536
|
reference: r
|
|
537
537
|
}) {
|
|
538
|
-
const { textComponents: a, remarkPlugins: o, rehypePlugins: i, linkProtocols: l } = X(), c = Y((v) => v.composer), u =
|
|
539
|
-
m && (
|
|
540
|
-
const h =
|
|
538
|
+
const { textComponents: a, remarkPlugins: o, rehypePlugins: i, linkProtocols: l } = X(), c = Y((v) => v.composer), u = ps(), f = oe(e), m = s && t === "assistant", [g] = fs(e, m, u), p = U(!1);
|
|
539
|
+
m && (p.current = !0);
|
|
540
|
+
const h = p.current ? "streaming" : "static", N = t === "user" ? /* @__PURE__ */ n("div", { className: "whitespace-pre-wrap break-words", children: g.split(`
|
|
541
541
|
`).map((v, y) => /* @__PURE__ */ n("div", { dir: "auto", children: v || /* @__PURE__ */ n("br", {}) }, y)) }) : /* @__PURE__ */ n(
|
|
542
|
-
|
|
542
|
+
st,
|
|
543
543
|
{
|
|
544
544
|
components: a,
|
|
545
545
|
remarkPlugins: o,
|
|
546
546
|
rehypePlugins: i,
|
|
547
547
|
linkProtocols: l,
|
|
548
|
-
wordFade:
|
|
548
|
+
wordFade: p.current,
|
|
549
549
|
mode: h,
|
|
550
550
|
children: g
|
|
551
551
|
}
|
|
552
552
|
);
|
|
553
|
-
return /* @__PURE__ */ n("div", { className: "group py-2 first:pt-4 animate-in-bubble", children: /* @__PURE__ */ n(Ut, { from: t, children: /* @__PURE__ */ n(Bt, { dir:
|
|
553
|
+
return /* @__PURE__ */ n("div", { className: "group py-2 first:pt-4 animate-in-bubble", children: /* @__PURE__ */ n(Ut, { from: t, children: /* @__PURE__ */ n(Bt, { dir: f, children: /* @__PURE__ */ n(Go, { lines: t === "user" ? c?.collapseLines ?? 0 : 0, children: /* @__PURE__ */ n(gs, { showAction: !1, reference: r, children: N }) }) }) }) });
|
|
554
554
|
}
|
|
555
|
-
function
|
|
556
|
-
const { t: s } =
|
|
555
|
+
function Go({ lines: e, children: t }) {
|
|
556
|
+
const { t: s } = _(["chat"]), r = U(null), [a, o] = C(!1), [i, l] = C(!1);
|
|
557
557
|
return qn(() => {
|
|
558
558
|
const u = r.current;
|
|
559
559
|
if (!u || !e || i) return;
|
|
560
|
-
const
|
|
560
|
+
const f = u.firstElementChild, m = () => o((f?.offsetHeight ?? u.scrollHeight) > u.clientHeight + 1);
|
|
561
561
|
m();
|
|
562
562
|
const g = typeof ResizeObserver > "u" ? null : new ResizeObserver(m);
|
|
563
|
-
return g?.observe(u),
|
|
563
|
+
return g?.observe(u), f && g?.observe(f), () => g?.disconnect();
|
|
564
564
|
}, [e, i]), e ? /* @__PURE__ */ d($, { children: [
|
|
565
565
|
/* @__PURE__ */ n(
|
|
566
566
|
"div",
|
|
@@ -596,12 +596,12 @@ function Vo({ lines: e, children: t }) {
|
|
|
596
596
|
)
|
|
597
597
|
] }) : /* @__PURE__ */ n($, { children: t });
|
|
598
598
|
}
|
|
599
|
-
function
|
|
599
|
+
function Wo({ part: e, index: t }) {
|
|
600
600
|
const s = e.text;
|
|
601
|
-
return s.trim() ? /* @__PURE__ */ n(
|
|
601
|
+
return s.trim() ? /* @__PURE__ */ n(Qo, { text: s, index: t, segment: "text" }) : null;
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
const { t: r } =
|
|
603
|
+
function Qo({ text: e, index: t, segment: s }) {
|
|
604
|
+
const { t: r } = _("chat"), a = W((l) => l.message.id), o = W((l) => l.message.role), i = W((l) => l.isStreaming);
|
|
605
605
|
return /* @__PURE__ */ n(
|
|
606
606
|
bs,
|
|
607
607
|
{
|
|
@@ -620,11 +620,11 @@ function Wo({ text: e, index: t, segment: s }) {
|
|
|
620
620
|
}
|
|
621
621
|
);
|
|
622
622
|
}
|
|
623
|
-
const xs =
|
|
624
|
-
const e =
|
|
623
|
+
const xs = Ee(null), Ko = () => {
|
|
624
|
+
const e = Ce(xs);
|
|
625
625
|
if (!e) throw new Error("Reasoning components must be used within Reasoning");
|
|
626
626
|
return e;
|
|
627
|
-
}, vs =
|
|
627
|
+
}, vs = Le(
|
|
628
628
|
({
|
|
629
629
|
className: e,
|
|
630
630
|
isStreaming: t = !1,
|
|
@@ -640,7 +640,7 @@ const xs = Oe(null), Qo = () => {
|
|
|
640
640
|
prop: s,
|
|
641
641
|
defaultProp: r,
|
|
642
642
|
onChange: a
|
|
643
|
-
}), [
|
|
643
|
+
}), [f, m] = sn({
|
|
644
644
|
prop: o,
|
|
645
645
|
defaultProp: 0
|
|
646
646
|
}), g = U({ startTime: null, autoClosed: !1 });
|
|
@@ -653,11 +653,11 @@ const xs = Oe(null), Qo = () => {
|
|
|
653
653
|
return () => clearTimeout(N);
|
|
654
654
|
}
|
|
655
655
|
}, [t, c, r, u, m]);
|
|
656
|
-
const
|
|
657
|
-
() => ({ isStreaming: t, isOpen: c, setIsOpen: u, duration:
|
|
658
|
-
[t, c, u,
|
|
656
|
+
const p = O(
|
|
657
|
+
() => ({ isStreaming: t, isOpen: c, setIsOpen: u, duration: f }),
|
|
658
|
+
[t, c, u, f]
|
|
659
659
|
);
|
|
660
|
-
return /* @__PURE__ */ n(xs.Provider, { value:
|
|
660
|
+
return /* @__PURE__ */ n(xs.Provider, { value: p, children: /* @__PURE__ */ n(
|
|
661
661
|
zt,
|
|
662
662
|
{
|
|
663
663
|
className: x("not-prose mb-4", e),
|
|
@@ -668,8 +668,8 @@ const xs = Oe(null), Qo = () => {
|
|
|
668
668
|
}
|
|
669
669
|
) });
|
|
670
670
|
}
|
|
671
|
-
), ys =
|
|
672
|
-
const { isStreaming: r, isOpen: a, duration: o } =
|
|
671
|
+
), ys = Le(({ className: e, children: t, ...s }) => {
|
|
672
|
+
const { isStreaming: r, isOpen: a, duration: o } = Ko(), { t: i } = _(["chat"]);
|
|
673
673
|
return /* @__PURE__ */ n(
|
|
674
674
|
It,
|
|
675
675
|
{
|
|
@@ -690,7 +690,7 @@ const xs = Oe(null), Qo = () => {
|
|
|
690
690
|
] })
|
|
691
691
|
}
|
|
692
692
|
);
|
|
693
|
-
}), ws =
|
|
693
|
+
}), ws = Le(
|
|
694
694
|
({ className: e, children: t, wordFade: s, mode: r, ...a }) => /* @__PURE__ */ n(
|
|
695
695
|
Tt,
|
|
696
696
|
{
|
|
@@ -700,15 +700,15 @@ const xs = Oe(null), Qo = () => {
|
|
|
700
700
|
e
|
|
701
701
|
),
|
|
702
702
|
...a,
|
|
703
|
-
children: /* @__PURE__ */ n(
|
|
703
|
+
children: /* @__PURE__ */ n(st, { className: "grid gap-2", wordFade: s, mode: r, children: t })
|
|
704
704
|
}
|
|
705
705
|
)
|
|
706
706
|
);
|
|
707
707
|
vs.displayName = "Reasoning";
|
|
708
708
|
ys.displayName = "ReasoningTrigger";
|
|
709
709
|
ws.displayName = "ReasoningContent";
|
|
710
|
-
function
|
|
711
|
-
const t = W((u) => u.isStreaming), { dir: s } = V(), r =
|
|
710
|
+
function Xo({ part: e }) {
|
|
711
|
+
const t = W((u) => u.isStreaming), { dir: s } = V(), r = ps(), a = oe(e.text), o = e.state === "streaming" && t, [i] = fs(e.text, o, r), l = U(!1);
|
|
712
712
|
o && (l.current = !0);
|
|
713
713
|
const c = l.current ? "streaming" : "static";
|
|
714
714
|
return e.text.trim() ? /* @__PURE__ */ d(vs, { className: "w-full animate-in-bubble", dir: s, isStreaming: o, children: [
|
|
@@ -724,7 +724,7 @@ function Vt(e) {
|
|
|
724
724
|
}, [e]);
|
|
725
725
|
return [t, a];
|
|
726
726
|
}
|
|
727
|
-
const Ns =
|
|
727
|
+
const Ns = Le(function({
|
|
728
728
|
code: t,
|
|
729
729
|
className: s,
|
|
730
730
|
children: r,
|
|
@@ -745,17 +745,17 @@ const Ns = Ee(function({
|
|
|
745
745
|
]
|
|
746
746
|
}
|
|
747
747
|
);
|
|
748
|
-
}),
|
|
748
|
+
}), Yo = {
|
|
749
749
|
web_search: sr,
|
|
750
|
-
web_fetch:
|
|
750
|
+
web_fetch: ut,
|
|
751
751
|
code_execution: nr,
|
|
752
752
|
image_generation: tr
|
|
753
753
|
};
|
|
754
|
-
function
|
|
755
|
-
const s =
|
|
754
|
+
function Jo(e, t = "size-4") {
|
|
755
|
+
const s = Yo[e] ?? rr;
|
|
756
756
|
return /* @__PURE__ */ n(s, { className: t });
|
|
757
757
|
}
|
|
758
|
-
const
|
|
758
|
+
const Zo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not-prose mb-4 w-full rounded-md border", e), ...t }), ei = {
|
|
759
759
|
"input-streaming": ["pending", lr],
|
|
760
760
|
"input-available": ["running", en, "animate-pulse"],
|
|
761
761
|
"approval-requested": ["awaiting_approval", ir, "text-warning"],
|
|
@@ -763,14 +763,14 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not
|
|
|
763
763
|
"output-available": ["completed", or, "text-success"],
|
|
764
764
|
"output-error": ["error", Cn, "text-destructive"],
|
|
765
765
|
"output-denied": ["denied", ar, "text-destructive"]
|
|
766
|
-
},
|
|
767
|
-
const { t } =
|
|
768
|
-
return /* @__PURE__ */ d(
|
|
766
|
+
}, ti = ({ status: e }) => {
|
|
767
|
+
const { t } = _(["tools_ui"]), [s, r, a] = ei[e];
|
|
768
|
+
return /* @__PURE__ */ d(ha, { className: "gap-1.5 rounded-full text-xs", variant: "secondary", children: [
|
|
769
769
|
/* @__PURE__ */ n(r, { className: x("size-4", a) }),
|
|
770
770
|
t(s)
|
|
771
771
|
] });
|
|
772
|
-
},
|
|
773
|
-
const o = r || (t.startsWith("tool-") ? t.slice(5) : t), i =
|
|
772
|
+
}, ni = ({ className: e, type: t, state: s, toolName: r, ...a }) => {
|
|
773
|
+
const o = r || (t.startsWith("tool-") ? t.slice(5) : t), i = Jo(o, "size-4 text-muted-foreground");
|
|
774
774
|
return /* @__PURE__ */ d(
|
|
775
775
|
It,
|
|
776
776
|
{
|
|
@@ -780,13 +780,13 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not
|
|
|
780
780
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-2", children: [
|
|
781
781
|
i,
|
|
782
782
|
/* @__PURE__ */ n("span", { className: "font-medium text-sm", children: o }),
|
|
783
|
-
/* @__PURE__ */ n(
|
|
783
|
+
/* @__PURE__ */ n(ti, { status: s })
|
|
784
784
|
] }),
|
|
785
785
|
/* @__PURE__ */ n(Ke, { className: "size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
|
|
786
786
|
]
|
|
787
787
|
}
|
|
788
788
|
);
|
|
789
|
-
},
|
|
789
|
+
}, si = ({ className: e, ...t }) => /* @__PURE__ */ n(
|
|
790
790
|
Tt,
|
|
791
791
|
{
|
|
792
792
|
className: x(
|
|
@@ -803,14 +803,14 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not
|
|
|
803
803
|
return e;
|
|
804
804
|
}
|
|
805
805
|
return JSON.stringify(e, null, 2);
|
|
806
|
-
},
|
|
807
|
-
const { t: a } =
|
|
806
|
+
}, ri = ({ className: e, input: t, state: s, ...r }) => {
|
|
807
|
+
const { t: a } = _(["tools_ui"]), o = O(() => ks(t), [t]), i = s === "input-streaming";
|
|
808
808
|
return /* @__PURE__ */ d("div", { className: x("space-y-2 overflow-hidden p-4", e), ...r, children: [
|
|
809
809
|
/* @__PURE__ */ n("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: a("parameters") }),
|
|
810
810
|
/* @__PURE__ */ n("div", { className: "rounded-md bg-muted/50", children: i ? /* @__PURE__ */ n("pre", { className: "overflow-x-auto p-4 font-mono text-sm whitespace-pre-wrap", dir: "ltr", children: o }) : /* @__PURE__ */ n(Ns, { code: o }) })
|
|
811
811
|
] });
|
|
812
|
-
},
|
|
813
|
-
const { t: a } =
|
|
812
|
+
}, ai = ({ className: e, output: t, errorText: s, ...r }) => {
|
|
813
|
+
const { t: a } = _(["tools_ui"]), [o, i] = Vt(2e3), l = O(() => {
|
|
814
814
|
if (typeof t == "string" || typeof t == "object" && t !== null && !("$$typeof" in t))
|
|
815
815
|
try {
|
|
816
816
|
return JSON.stringify(typeof t == "string" ? JSON.parse(t) : t, null, 2);
|
|
@@ -821,7 +821,7 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not
|
|
|
821
821
|
}, [t]);
|
|
822
822
|
return t || s ? /* @__PURE__ */ d("div", { className: x("space-y-2 p-4", e), ...r, children: [
|
|
823
823
|
/* @__PURE__ */ n("h4", { className: "font-medium text-muted-foreground text-xs uppercase tracking-wide", children: a(s ? "error" : "result") }),
|
|
824
|
-
s && /* @__PURE__ */ d(
|
|
824
|
+
s && /* @__PURE__ */ d($e, { children: [
|
|
825
825
|
/* @__PURE__ */ n(Qn, { asChild: !0, children: /* @__PURE__ */ d(E, { variant: "destructive", size: "sm", children: [
|
|
826
826
|
/* @__PURE__ */ n(Cn, { className: "me-1.5 size-4" }),
|
|
827
827
|
a("view_error")
|
|
@@ -850,10 +850,10 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not
|
|
|
850
850
|
t && !s && /* @__PURE__ */ n("div", { className: "overflow-x-auto rounded-md bg-muted/50 text-foreground text-xs [&_table]:w-full line-clamp-[20]", children: /* @__PURE__ */ n("div", { children: l !== null ? /* @__PURE__ */ n(Ns, { code: l }) : typeof t == "string" ? /* @__PURE__ */ n("div", { className: "p-4 text-sm whitespace-pre-wrap", dir: "ltr", children: t }) : t }) })
|
|
851
851
|
] }) : null;
|
|
852
852
|
};
|
|
853
|
-
function
|
|
854
|
-
const { t } =
|
|
853
|
+
function oi({ part: e }) {
|
|
854
|
+
const { t } = _(["tools_ui"]), s = ea(e);
|
|
855
855
|
if (!s.isPending) return null;
|
|
856
|
-
const r = t("approval_prompt", { tool:
|
|
856
|
+
const r = t("approval_prompt", { tool: tt(e) });
|
|
857
857
|
return /* @__PURE__ */ d(
|
|
858
858
|
"div",
|
|
859
859
|
{
|
|
@@ -881,19 +881,19 @@ function ai({ part: e }) {
|
|
|
881
881
|
}
|
|
882
882
|
);
|
|
883
883
|
}
|
|
884
|
-
function
|
|
884
|
+
function ii({ part: e }) {
|
|
885
885
|
const t = K((r) => r.app.showToolDetails ?? !0), s = e.state === "approval-requested";
|
|
886
|
-
return !t && !s ? null : /* @__PURE__ */ d(
|
|
887
|
-
/* @__PURE__ */ n(
|
|
888
|
-
/* @__PURE__ */ d(
|
|
889
|
-
/* @__PURE__ */ n(
|
|
890
|
-
(e.state === "output-available" || e.state === "output-error") && /* @__PURE__ */ n(
|
|
886
|
+
return !t && !s ? null : /* @__PURE__ */ d(Zo, { className: "animate-in-bubble", defaultOpen: s, children: [
|
|
887
|
+
/* @__PURE__ */ n(ni, { type: e.type, state: e.state, toolName: tt(e) }),
|
|
888
|
+
/* @__PURE__ */ d(si, { children: [
|
|
889
|
+
/* @__PURE__ */ n(ri, { input: e.input, state: e.state }),
|
|
890
|
+
(e.state === "output-available" || e.state === "output-error") && /* @__PURE__ */ n(ai, { errorText: e.errorText, output: e.output })
|
|
891
891
|
] }),
|
|
892
|
-
/* @__PURE__ */ n(
|
|
892
|
+
/* @__PURE__ */ n(oi, { part: e })
|
|
893
893
|
] });
|
|
894
894
|
}
|
|
895
|
-
function
|
|
896
|
-
const t = W((c) => c.message.role), { t: s } =
|
|
895
|
+
function li({ part: e }) {
|
|
896
|
+
const t = W((c) => c.message.role), { t: s } = _(["chat", "admin"]), r = ta(e), a = e.mediaType.startsWith("image/"), o = e.filename ?? "file", i = s("download", "Download"), l = (c) => {
|
|
897
897
|
if (c.preventDefault(), !r) return;
|
|
898
898
|
const u = Object.assign(document.createElement("a"), { href: r, download: o });
|
|
899
899
|
document.body.appendChild(u), u.click(), u.remove();
|
|
@@ -915,7 +915,7 @@ function ii({ part: e }) {
|
|
|
915
915
|
onClick: l,
|
|
916
916
|
className: "p-1.5 bg-white/20 hover:bg-white/30 rounded-full text-white transition-all",
|
|
917
917
|
title: i,
|
|
918
|
-
children: /* @__PURE__ */ n(
|
|
918
|
+
children: /* @__PURE__ */ n(ut, { className: "size-4" })
|
|
919
919
|
}
|
|
920
920
|
)
|
|
921
921
|
] })
|
|
@@ -931,13 +931,13 @@ function ii({ part: e }) {
|
|
|
931
931
|
onClick: l,
|
|
932
932
|
className: "ms-auto p-2 hover:bg-primary hover:text-primary-foreground rounded-lg text-muted-foreground transition-all",
|
|
933
933
|
title: i,
|
|
934
|
-
children: /* @__PURE__ */ n(
|
|
934
|
+
children: /* @__PURE__ */ n(ut, { className: "size-4" })
|
|
935
935
|
}
|
|
936
936
|
)
|
|
937
937
|
] }) }) }) });
|
|
938
938
|
}
|
|
939
|
-
function
|
|
940
|
-
const t = W((u) => u.message.role), { t: s } =
|
|
939
|
+
function ci({ part: e }) {
|
|
940
|
+
const t = W((u) => u.message.role), { t: s } = _(["chat"]), { focusReference: r } = na(), [a, o] = Vt(1200), i = e.data, l = i.excerpt || i.label || s("source_unavailable"), c = i.label && i.label !== l ? i.label : s("referenced_context");
|
|
941
941
|
return /* @__PURE__ */ n("div", { className: x("my-1.5 flex", t === "user" && "justify-end"), children: /* @__PURE__ */ d(
|
|
942
942
|
"button",
|
|
943
943
|
{
|
|
@@ -961,16 +961,16 @@ function Gt(e) {
|
|
|
961
961
|
const { input: t } = e, s = typeof t?.question == "string" ? t.question.trim() : "", r = (Array.isArray(t?.choices) ? t.choices : []).filter((a) => typeof a == "string").map((a) => a.trim()).filter(Boolean).map((a) => ({ label: a }));
|
|
962
962
|
return !s || r.length === 0 && e.state !== "input-streaming" ? null : { question: s, choices: r, allowCustom: t?.allow_custom !== !1 };
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function di(e) {
|
|
965
965
|
return e.type === "tool-ask_user";
|
|
966
966
|
}
|
|
967
967
|
function _s(e, { streaming: t = !1 } = {}) {
|
|
968
968
|
return e?.parts.find(
|
|
969
|
-
(s) =>
|
|
969
|
+
(s) => di(s) && (s.state === "input-available" || t && s.state === "input-streaming")
|
|
970
970
|
);
|
|
971
971
|
}
|
|
972
972
|
const Ss = (e) => e.replace(/\s+/g, " ").trim().toLowerCase().replace(/[?!.:؟،]+$/, ""), un = /* @__PURE__ */ new WeakMap();
|
|
973
|
-
function
|
|
973
|
+
function ui(e) {
|
|
974
974
|
const t = un.get(e);
|
|
975
975
|
if (t !== void 0) return t;
|
|
976
976
|
const s = e.parts.flatMap((a) => a.type === "text" ? [a.text] : []).join(" "), r = Ss(s);
|
|
@@ -978,9 +978,9 @@ function di(e) {
|
|
|
978
978
|
}
|
|
979
979
|
function Cs(e, t) {
|
|
980
980
|
const s = Ss(t.question);
|
|
981
|
-
return s ? e ?
|
|
981
|
+
return s ? e ? ui(e).includes(s) : !1 : !0;
|
|
982
982
|
}
|
|
983
|
-
function
|
|
983
|
+
function mi(e) {
|
|
984
984
|
const { readonly: t, lastMessage: s, isFinished: r, status: a } = e;
|
|
985
985
|
return !t && !!s && !!r && a === "ready";
|
|
986
986
|
}
|
|
@@ -1008,7 +1008,7 @@ function zs({
|
|
|
1008
1008
|
i.label
|
|
1009
1009
|
)) });
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1011
|
+
function hi({
|
|
1012
1012
|
part: e,
|
|
1013
1013
|
message: t,
|
|
1014
1014
|
disabled: s,
|
|
@@ -1016,13 +1016,13 @@ function mi({
|
|
|
1016
1016
|
onReopen: a,
|
|
1017
1017
|
onAnswer: o
|
|
1018
1018
|
}) {
|
|
1019
|
-
const { t: i } =
|
|
1019
|
+
const { t: i } = _(["chat"]), { dir: l } = V(), { textComponents: c, remarkPlugins: u, rehypePlugins: f, linkProtocols: m } = X(), g = O(() => Gt(e), [e]), [p, h] = C(""), [N, v] = C(null), [y, b] = C(!1);
|
|
1020
1020
|
if (!g) return null;
|
|
1021
|
-
const I = !s && !!o,
|
|
1021
|
+
const I = !s && !!o, k = !I || y || N !== null, z = !Cs(t, g), T = oe(g.question, l);
|
|
1022
1022
|
if (!z && !I && !r) return null;
|
|
1023
1023
|
const P = async (M) => {
|
|
1024
1024
|
const L = M.trim();
|
|
1025
|
-
if (!(!L ||
|
|
1025
|
+
if (!(!L || k)) {
|
|
1026
1026
|
b(!0), v(L);
|
|
1027
1027
|
try {
|
|
1028
1028
|
await o?.(L);
|
|
@@ -1033,15 +1033,15 @@ function mi({
|
|
|
1033
1033
|
b(!1);
|
|
1034
1034
|
}
|
|
1035
1035
|
}, A = (M) => {
|
|
1036
|
-
M.preventDefault(), P(
|
|
1036
|
+
M.preventDefault(), P(p);
|
|
1037
1037
|
};
|
|
1038
1038
|
return /* @__PURE__ */ d("div", { className: "group py-2 first:pt-4 animate-in-bubble", children: [
|
|
1039
1039
|
z && /* @__PURE__ */ n(Ut, { from: t.role, children: /* @__PURE__ */ n(Bt, { dir: T, children: /* @__PURE__ */ n(
|
|
1040
|
-
|
|
1040
|
+
st,
|
|
1041
1041
|
{
|
|
1042
1042
|
components: c,
|
|
1043
1043
|
remarkPlugins: u,
|
|
1044
|
-
rehypePlugins:
|
|
1044
|
+
rehypePlugins: f,
|
|
1045
1045
|
linkProtocols: m,
|
|
1046
1046
|
children: g.question
|
|
1047
1047
|
}
|
|
@@ -1072,7 +1072,7 @@ function mi({
|
|
|
1072
1072
|
{
|
|
1073
1073
|
choices: g.choices,
|
|
1074
1074
|
selected: N,
|
|
1075
|
-
disabled:
|
|
1075
|
+
disabled: k,
|
|
1076
1076
|
dir: T,
|
|
1077
1077
|
onSelect: (M) => {
|
|
1078
1078
|
P(M);
|
|
@@ -1083,9 +1083,9 @@ function mi({
|
|
|
1083
1083
|
/* @__PURE__ */ n(
|
|
1084
1084
|
"input",
|
|
1085
1085
|
{
|
|
1086
|
-
value:
|
|
1087
|
-
disabled:
|
|
1088
|
-
dir: oe(
|
|
1086
|
+
value: p,
|
|
1087
|
+
disabled: k,
|
|
1088
|
+
dir: oe(p || i("choice_other_placeholder"), T),
|
|
1089
1089
|
onChange: (M) => h(M.target.value),
|
|
1090
1090
|
placeholder: i("choice_other_placeholder"),
|
|
1091
1091
|
className: "h-11 min-w-0 flex-1 rounded-full bg-transparent px-3 text-start text-sm outline-none transition-colors placeholder:text-muted-foreground/60 hover:bg-foreground/[0.04] focus-visible:bg-foreground/[0.06] disabled:cursor-not-allowed disabled:opacity-55"
|
|
@@ -1095,7 +1095,7 @@ function mi({
|
|
|
1095
1095
|
"button",
|
|
1096
1096
|
{
|
|
1097
1097
|
type: "submit",
|
|
1098
|
-
disabled:
|
|
1098
|
+
disabled: k || !p.trim(),
|
|
1099
1099
|
className: "flex size-11 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground transition hover:bg-primary/90 focus-visible:ring-2 focus-visible:ring-ring/40 disabled:opacity-35",
|
|
1100
1100
|
"aria-label": i("choice_send_answer"),
|
|
1101
1101
|
title: i("choice_send_answer"),
|
|
@@ -1107,8 +1107,8 @@ function mi({
|
|
|
1107
1107
|
] });
|
|
1108
1108
|
}
|
|
1109
1109
|
const Is = "dismissed-choice-questions";
|
|
1110
|
-
function
|
|
1111
|
-
const t =
|
|
1110
|
+
function fi(e) {
|
|
1111
|
+
const t = Ea(e, Is);
|
|
1112
1112
|
if (!t) return [];
|
|
1113
1113
|
try {
|
|
1114
1114
|
const s = JSON.parse(t);
|
|
@@ -1129,8 +1129,8 @@ const pi = {
|
|
|
1129
1129
|
dockHeight: 0,
|
|
1130
1130
|
reportDockHeight: () => {
|
|
1131
1131
|
}
|
|
1132
|
-
}, Ts =
|
|
1133
|
-
function
|
|
1132
|
+
}, Ts = Ee(null);
|
|
1133
|
+
function gi({
|
|
1134
1134
|
message: e,
|
|
1135
1135
|
disabled: t = !1,
|
|
1136
1136
|
readonly: s = !1,
|
|
@@ -1138,19 +1138,19 @@ function fi({
|
|
|
1138
1138
|
onAnswer: a,
|
|
1139
1139
|
children: o
|
|
1140
1140
|
}) {
|
|
1141
|
-
const [i, l] = C(0), c = s || e?.role !== "assistant" ? void 0 : _s(e, { streaming: t }), u = O(() => c ? Gt(c) : null, [c]),
|
|
1142
|
-
l((
|
|
1143
|
-
}, []), g = u ? e?.id ?? null : null,
|
|
1141
|
+
const [i, l] = C(0), c = s || e?.role !== "assistant" ? void 0 : _s(e, { streaming: t }), u = O(() => c ? Gt(c) : null, [c]), f = c?.toolCallId, m = de((I) => {
|
|
1142
|
+
l((k) => Math.abs(k - I) < 1 ? k : I);
|
|
1143
|
+
}, []), g = u ? e?.id ?? null : null, p = u && e ? Da(e) : null, [h, N] = C(() => fi(r)), v = p !== null && h.includes(p), y = de(
|
|
1144
1144
|
(I) => {
|
|
1145
|
-
|
|
1146
|
-
const z =
|
|
1147
|
-
return I ? [...z,
|
|
1145
|
+
p && N((k) => {
|
|
1146
|
+
const z = k.filter((T) => T !== p);
|
|
1147
|
+
return I ? [...z, p].slice(-50) : z.length === k.length ? k : z;
|
|
1148
1148
|
});
|
|
1149
1149
|
},
|
|
1150
|
-
[
|
|
1150
|
+
[p]
|
|
1151
1151
|
);
|
|
1152
1152
|
D(() => {
|
|
1153
|
-
|
|
1153
|
+
Oa(r, Is, JSON.stringify(h));
|
|
1154
1154
|
}, [r, h]);
|
|
1155
1155
|
const b = O(
|
|
1156
1156
|
() => ({
|
|
@@ -1160,7 +1160,7 @@ function fi({
|
|
|
1160
1160
|
dismissed: v,
|
|
1161
1161
|
setDismissed: y,
|
|
1162
1162
|
answer: (I) => {
|
|
1163
|
-
|
|
1163
|
+
f && a?.({ toolCallId: f, output: { answer: I } });
|
|
1164
1164
|
},
|
|
1165
1165
|
dockHeight: u ? i : 0,
|
|
1166
1166
|
reportDockHeight: m
|
|
@@ -1172,15 +1172,15 @@ function fi({
|
|
|
1172
1172
|
v,
|
|
1173
1173
|
y,
|
|
1174
1174
|
a,
|
|
1175
|
-
|
|
1175
|
+
f,
|
|
1176
1176
|
i,
|
|
1177
1177
|
m
|
|
1178
1178
|
]
|
|
1179
1179
|
);
|
|
1180
1180
|
return /* @__PURE__ */ n(Ts.Provider, { value: b, children: o });
|
|
1181
1181
|
}
|
|
1182
|
-
function
|
|
1183
|
-
return
|
|
1182
|
+
function rt() {
|
|
1183
|
+
return Ce(Ts) ?? pi;
|
|
1184
1184
|
}
|
|
1185
1185
|
function Wt(e) {
|
|
1186
1186
|
const t = W((h) => h.message), s = W((h) => h.isLast), r = W((h) => h.isStreaming), a = ve((h) => h.status), { readonly: o, actions: i } = Fn(), l = de(
|
|
@@ -1190,27 +1190,27 @@ function Wt(e) {
|
|
|
1190
1190
|
[i, e]
|
|
1191
1191
|
), c = de((h) => {
|
|
1192
1192
|
i?.send({ text: h });
|
|
1193
|
-
}, [i]), { messageId: u, dismissed:
|
|
1193
|
+
}, [i]), { messageId: u, dismissed: f, setDismissed: m } = rt(), g = u === t.id, p = s && !r && t.role === "assistant";
|
|
1194
1194
|
return {
|
|
1195
1195
|
message: t,
|
|
1196
1196
|
isLast: s,
|
|
1197
|
-
isFinished:
|
|
1197
|
+
isFinished: p,
|
|
1198
1198
|
status: a,
|
|
1199
1199
|
readonly: o,
|
|
1200
|
-
docked: g && !
|
|
1201
|
-
dismissedHere: g &&
|
|
1200
|
+
docked: g && !f,
|
|
1201
|
+
dismissedHere: g && f,
|
|
1202
1202
|
reopen: () => m(!1),
|
|
1203
|
-
answerable:
|
|
1203
|
+
answerable: mi({ readonly: o, lastMessage: s, isFinished: p, status: a }),
|
|
1204
1204
|
answer: l,
|
|
1205
1205
|
sendText: c
|
|
1206
1206
|
};
|
|
1207
1207
|
}
|
|
1208
|
-
function
|
|
1208
|
+
function bi({
|
|
1209
1209
|
part: e,
|
|
1210
1210
|
question: t,
|
|
1211
1211
|
index: s
|
|
1212
1212
|
}) {
|
|
1213
|
-
const { t: r } =
|
|
1213
|
+
const { t: r } = _("chat"), { ChoiceQuestionPart: a } = X(), { message: o, answerable: i, dismissedHere: l, reopen: c, answer: u } = Wt(
|
|
1214
1214
|
e.toolCallId
|
|
1215
1215
|
);
|
|
1216
1216
|
if (i && e.state === "input-available")
|
|
@@ -1225,7 +1225,7 @@ function gi({
|
|
|
1225
1225
|
onAnswer: u
|
|
1226
1226
|
}
|
|
1227
1227
|
);
|
|
1228
|
-
const
|
|
1228
|
+
const f = e.state === "output-available" ? e.output?.answer : void 0;
|
|
1229
1229
|
return /* @__PURE__ */ n($, { children: [
|
|
1230
1230
|
!Cs(o, t) && [
|
|
1231
1231
|
t.question,
|
|
@@ -1233,7 +1233,7 @@ function gi({
|
|
|
1233
1233
|
"choice-question",
|
|
1234
1234
|
"reference_assistant_response"
|
|
1235
1235
|
],
|
|
1236
|
-
|
|
1236
|
+
f && [f, "user", "choice-answer", "reference_user_message"]
|
|
1237
1237
|
].map(
|
|
1238
1238
|
(m) => m && /* @__PURE__ */ n(
|
|
1239
1239
|
bs,
|
|
@@ -1255,24 +1255,24 @@ function gi({
|
|
|
1255
1255
|
)
|
|
1256
1256
|
) });
|
|
1257
1257
|
}
|
|
1258
|
-
function
|
|
1258
|
+
function xi({ part: e, index: t }) {
|
|
1259
1259
|
const { docked: s } = Wt(e.toolCallId);
|
|
1260
1260
|
if (s && (e.state === "input-available" || e.state === "input-streaming")) return null;
|
|
1261
1261
|
const r = Gt(e);
|
|
1262
|
-
return r ? /* @__PURE__ */ n(
|
|
1262
|
+
return r ? /* @__PURE__ */ n(bi, { part: e, question: r, index: t }) : null;
|
|
1263
1263
|
}
|
|
1264
1264
|
const Ms = {
|
|
1265
|
-
text:
|
|
1266
|
-
reasoning:
|
|
1267
|
-
file:
|
|
1268
|
-
tool:
|
|
1265
|
+
text: Wo,
|
|
1266
|
+
reasoning: Xo,
|
|
1267
|
+
file: li,
|
|
1268
|
+
tool: ii,
|
|
1269
1269
|
"source-url": null,
|
|
1270
1270
|
"source-document": null,
|
|
1271
|
-
"data-reference":
|
|
1272
|
-
"tool-ask_user":
|
|
1271
|
+
"data-reference": ci,
|
|
1272
|
+
"tool-ask_user": xi,
|
|
1273
1273
|
"tool-suggest_follow_ups": null
|
|
1274
1274
|
};
|
|
1275
|
-
class ge extends
|
|
1275
|
+
class ge extends Xr {
|
|
1276
1276
|
state = { error: null };
|
|
1277
1277
|
static getDerivedStateFromError(t) {
|
|
1278
1278
|
return { error: t };
|
|
@@ -1293,15 +1293,15 @@ class ge extends Kr {
|
|
|
1293
1293
|
const { error: t } = this.state;
|
|
1294
1294
|
if (!t) return this.props.children;
|
|
1295
1295
|
const { fallback: s } = this.props;
|
|
1296
|
-
return s !== void 0 ? typeof s == "function" ? s(t, this.reset) : s : /* @__PURE__ */ n("div", { className: "my-2 rounded-lg border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive/80", children: t.message || /* @__PURE__ */ n(
|
|
1296
|
+
return s !== void 0 ? typeof s == "function" ? s(t, this.reset) : s : /* @__PURE__ */ n("div", { className: "my-2 rounded-lg border border-destructive/20 bg-destructive/5 px-3 py-2 text-xs text-destructive/80", children: t.message || /* @__PURE__ */ n(vi, {}) });
|
|
1297
1297
|
}
|
|
1298
1298
|
}
|
|
1299
|
-
function
|
|
1300
|
-
const { t: e } =
|
|
1299
|
+
function vi() {
|
|
1300
|
+
const { t: e } = _("chat");
|
|
1301
1301
|
return e("render_error");
|
|
1302
1302
|
}
|
|
1303
|
-
const
|
|
1304
|
-
const { t: a } =
|
|
1303
|
+
const yi = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not-prose mb-4 text-primary text-xs", e), ...t }), wi = ({ className: e, count: t, children: s, ...r }) => {
|
|
1304
|
+
const { t: a } = _(["chat"]);
|
|
1305
1305
|
return /* @__PURE__ */ n(
|
|
1306
1306
|
It,
|
|
1307
1307
|
{
|
|
@@ -1316,7 +1316,7 @@ const vi = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not
|
|
|
1316
1316
|
] })
|
|
1317
1317
|
}
|
|
1318
1318
|
);
|
|
1319
|
-
},
|
|
1319
|
+
}, Ni = ({ className: e, ...t }) => /* @__PURE__ */ n(
|
|
1320
1320
|
Tt,
|
|
1321
1321
|
{
|
|
1322
1322
|
className: x(
|
|
@@ -1325,21 +1325,21 @@ const vi = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not
|
|
|
1325
1325
|
),
|
|
1326
1326
|
...t
|
|
1327
1327
|
}
|
|
1328
|
-
),
|
|
1328
|
+
), ki = ({ href: e, title: t, children: s, ...r }) => /* @__PURE__ */ n("a", { className: "flex items-center gap-2", href: e, rel: "noreferrer", target: "_blank", ...r, children: s ?? /* @__PURE__ */ d($, { children: [
|
|
1329
1329
|
/* @__PURE__ */ n(dr, { className: "h-4 w-4" }),
|
|
1330
1330
|
/* @__PURE__ */ n("span", { className: "block font-medium", children: t })
|
|
1331
1331
|
] }) });
|
|
1332
|
-
function
|
|
1333
|
-
if (Array.isArray(e)) return
|
|
1332
|
+
function He(e) {
|
|
1333
|
+
if (Array.isArray(e)) return He(e[0]);
|
|
1334
1334
|
if (typeof e == "string")
|
|
1335
1335
|
try {
|
|
1336
|
-
return
|
|
1336
|
+
return He(JSON.parse(e));
|
|
1337
1337
|
} catch {
|
|
1338
1338
|
return null;
|
|
1339
1339
|
}
|
|
1340
1340
|
if (!e || typeof e != "object") return null;
|
|
1341
1341
|
const t = e;
|
|
1342
|
-
if (!t.suggestions && t.data) return
|
|
1342
|
+
if (!t.suggestions && t.data) return He(t.data);
|
|
1343
1343
|
if (!Array.isArray(t.suggestions)) return null;
|
|
1344
1344
|
const s = /* @__PURE__ */ new Set(), r = t.suggestions.filter((a) => typeof a == "string").map((a) => a.trim()).filter((a) => {
|
|
1345
1345
|
const o = a.toLocaleLowerCase();
|
|
@@ -1347,19 +1347,19 @@ function Be(e) {
|
|
|
1347
1347
|
}).slice(0, 3);
|
|
1348
1348
|
return r.length > 0 ? { suggestions: r } : null;
|
|
1349
1349
|
}
|
|
1350
|
-
function
|
|
1350
|
+
function _i() {
|
|
1351
1351
|
const { FollowUpSuggestions: e } = X(), { message: t, isLast: s, isFinished: r, status: a, readonly: o, sendText: i } = Wt();
|
|
1352
1352
|
if (t.role !== "assistant" || !s || !r || a !== "ready" || o || _s(t) !== void 0)
|
|
1353
1353
|
return null;
|
|
1354
1354
|
const l = t.parts.find((u) => u.type === "tool-suggest_follow_ups");
|
|
1355
1355
|
if (!l || !("input" in l)) return null;
|
|
1356
|
-
const c =
|
|
1356
|
+
const c = He(l.input);
|
|
1357
1357
|
return c ? /* @__PURE__ */ n(e, { suggestions: c.suggestions, onSelect: i }) : null;
|
|
1358
1358
|
}
|
|
1359
|
-
function
|
|
1360
|
-
const { t: e } =
|
|
1359
|
+
function Si() {
|
|
1360
|
+
const { t: e } = _(["chat"]);
|
|
1361
1361
|
return /* @__PURE__ */ n(
|
|
1362
|
-
|
|
1362
|
+
Oe.ScrollToBottom,
|
|
1363
1363
|
{
|
|
1364
1364
|
"aria-label": e("scroll_to_bottom"),
|
|
1365
1365
|
className: "absolute inset-x-0 bottom-32 z-10 mx-auto flex size-9 items-center justify-center rounded-full border border-border/60 bg-card p-0 text-muted-foreground shadow-md transition-colors hover:bg-accent/50 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none",
|
|
@@ -1367,7 +1367,7 @@ function _i() {
|
|
|
1367
1367
|
}
|
|
1368
1368
|
);
|
|
1369
1369
|
}
|
|
1370
|
-
const
|
|
1370
|
+
const Ci = (e) => La.includes(e.type) ? !1 : e.type === "text" || e.type === "reasoning" ? e.text.trim().length > 0 : e.type === "file" ? !0 : nt(e), zi = ({
|
|
1371
1371
|
latestProgress: e,
|
|
1372
1372
|
parts: t,
|
|
1373
1373
|
isFinished: s
|
|
@@ -1376,7 +1376,7 @@ const Si = (e) => Ea.includes(e.type) ? !1 : e.type === "text" || e.type === "re
|
|
|
1376
1376
|
if (!a) return null;
|
|
1377
1377
|
const o = r === "running", i = t.slice(t.lastIndexOf(e) + 1);
|
|
1378
1378
|
if (o && s || i.some(
|
|
1379
|
-
(c) => c.type === "text" && c.text.trim().length > 0 || c.type === "tool-ask_user" || !o &&
|
|
1379
|
+
(c) => c.type === "text" && c.text.trim().length > 0 || c.type === "tool-ask_user" || !o && nt(c)
|
|
1380
1380
|
))
|
|
1381
1381
|
return null;
|
|
1382
1382
|
const l = oe(a);
|
|
@@ -1396,17 +1396,17 @@ const Si = (e) => Ea.includes(e.type) ? !1 : e.type === "text" || e.type === "re
|
|
|
1396
1396
|
),
|
|
1397
1397
|
dir: l,
|
|
1398
1398
|
children: [
|
|
1399
|
-
o ? /* @__PURE__ */ n("div", { className: "size-4 animate-spin rounded-full border-2 border-primary border-e-transparent shrink-0" }) : r === "error" ? /* @__PURE__ */ n(
|
|
1399
|
+
o ? /* @__PURE__ */ n("div", { className: "size-4 animate-spin rounded-full border-2 border-primary border-e-transparent shrink-0" }) : r === "error" ? /* @__PURE__ */ n(Se, { className: "size-4 text-destructive shrink-0" }) : /* @__PURE__ */ n(yt, { className: "size-4 text-success shrink-0" }),
|
|
1400
1400
|
/* @__PURE__ */ n("span", { className: x("font-medium", o && "animate-pulse"), children: a })
|
|
1401
1401
|
]
|
|
1402
1402
|
}
|
|
1403
1403
|
)
|
|
1404
1404
|
}
|
|
1405
1405
|
);
|
|
1406
|
-
},
|
|
1406
|
+
}, Ii = Xe(
|
|
1407
1407
|
() => import("./MessageEditor-thFldVmz.js").then((e) => ({ default: e.MessageEditor }))
|
|
1408
|
-
),
|
|
1409
|
-
function
|
|
1408
|
+
), Ti = { UserMessage: Mi, AssistantMessage: Ri };
|
|
1409
|
+
function Mi() {
|
|
1410
1410
|
const e = W((a) => a.message.id), t = W((a) => a.isEditing), { MessageActions: s } = X(), r = Y((a) => a.threadActions);
|
|
1411
1411
|
return /* @__PURE__ */ d(
|
|
1412
1412
|
le.Root,
|
|
@@ -1415,21 +1415,21 @@ function Ti() {
|
|
|
1415
1415
|
"data-gentiq-message-role": "user",
|
|
1416
1416
|
className: "group/message",
|
|
1417
1417
|
children: [
|
|
1418
|
-
t ? /* @__PURE__ */ d(
|
|
1419
|
-
/* @__PURE__ */ n(le.Parts, { components:
|
|
1420
|
-
/* @__PURE__ */ n(
|
|
1418
|
+
t ? /* @__PURE__ */ d(Ae, { fallback: /* @__PURE__ */ n(le.Parts, {}), children: [
|
|
1419
|
+
/* @__PURE__ */ n(le.Parts, { components: Pi }),
|
|
1420
|
+
/* @__PURE__ */ n(Ii, {})
|
|
1421
1421
|
] }) : /* @__PURE__ */ n(le.Parts, {}),
|
|
1422
1422
|
/* @__PURE__ */ n(s, { retry: !1, feedback: !1, edit: r.edit })
|
|
1423
1423
|
]
|
|
1424
1424
|
}
|
|
1425
1425
|
);
|
|
1426
1426
|
}
|
|
1427
|
-
const
|
|
1428
|
-
function
|
|
1427
|
+
const Pi = { text: null };
|
|
1428
|
+
function Ri() {
|
|
1429
1429
|
const e = W((i) => i.message.id), t = W((i) => i.message.parts), { MessageActions: s } = X(), r = Y((i) => i.threadActions), { sourceUrls: a, hasText: o } = O(
|
|
1430
1430
|
() => ({
|
|
1431
1431
|
sourceUrls: t.flatMap((i) => i.type === "source-url" ? [i.url] : []),
|
|
1432
|
-
hasText:
|
|
1432
|
+
hasText: qa({ parts: t }).length > 0
|
|
1433
1433
|
}),
|
|
1434
1434
|
[t]
|
|
1435
1435
|
);
|
|
@@ -1440,9 +1440,9 @@ function Pi() {
|
|
|
1440
1440
|
"data-gentiq-message-role": "assistant",
|
|
1441
1441
|
className: "group/message",
|
|
1442
1442
|
children: [
|
|
1443
|
-
a.length > 0 && /* @__PURE__ */ d(
|
|
1444
|
-
/* @__PURE__ */ n(
|
|
1445
|
-
a.map((i, l) => /* @__PURE__ */ n(
|
|
1443
|
+
a.length > 0 && /* @__PURE__ */ d(yi, { children: [
|
|
1444
|
+
/* @__PURE__ */ n(wi, { count: a.length }),
|
|
1445
|
+
a.map((i, l) => /* @__PURE__ */ n(Ni, { children: /* @__PURE__ */ n(ki, { href: i, title: i }) }, `${e}-source-${l}`))
|
|
1446
1446
|
] }),
|
|
1447
1447
|
/* @__PURE__ */ n(le.Parts, {}),
|
|
1448
1448
|
o && /* @__PURE__ */ n(
|
|
@@ -1453,50 +1453,50 @@ function Pi() {
|
|
|
1453
1453
|
edit: !1
|
|
1454
1454
|
}
|
|
1455
1455
|
),
|
|
1456
|
-
/* @__PURE__ */ n(
|
|
1456
|
+
/* @__PURE__ */ n(_i, {})
|
|
1457
1457
|
]
|
|
1458
1458
|
}
|
|
1459
1459
|
);
|
|
1460
1460
|
}
|
|
1461
|
-
function
|
|
1462
|
-
const { t } =
|
|
1463
|
-
() => l === void 0 ? null :
|
|
1461
|
+
function Ai({ className: e }) {
|
|
1462
|
+
const { t } = _(["chat", "errors"]), { ChatError: s } = X(), { actions: r } = Fn(), a = ve((b) => b.messages), o = ve((b) => b.status), i = ve((b) => b.isLoadingHistory), l = ve((b) => b.error), c = O(
|
|
1463
|
+
() => l === void 0 ? null : sa(l, t),
|
|
1464
1464
|
[l, t]
|
|
1465
|
-
), { dockHeight: u } =
|
|
1465
|
+
), { dockHeight: u } = rt(), f = `calc(var(--gentiq-composer-inset, calc(6.5rem + ${u}px)) + 1.5rem)`, m = i, g = ve((b) => b.earlier.status), p = r?.loadEarlier, h = a[a.length - 1], N = h?.role === "assistant" && (o === "ready" || h.parts.some((b) => b.type === "data-chat-finished")), v = !m && (o === "submitted" || o === "streaming" && !(h?.role === "assistant" && h.parts.some(Ci)));
|
|
1466
1466
|
let y;
|
|
1467
1467
|
if (h?.role === "assistant")
|
|
1468
1468
|
for (const b of h.parts)
|
|
1469
1469
|
b.type === "data-progress-update" && (y = b);
|
|
1470
1470
|
return /* @__PURE__ */ d("div", { className: x("relative min-h-0 flex-1 overflow-hidden", e), children: [
|
|
1471
1471
|
/* @__PURE__ */ d(
|
|
1472
|
-
|
|
1472
|
+
Oe.Viewport,
|
|
1473
1473
|
{
|
|
1474
1474
|
scrollClassName: "custom-scrollbar",
|
|
1475
1475
|
className: "stick-to-bottom max-w-3xl mx-auto w-full p-4 pb-6 md:px-0",
|
|
1476
|
-
style: { paddingBottom:
|
|
1476
|
+
style: { paddingBottom: f },
|
|
1477
1477
|
"aria-busy": m,
|
|
1478
1478
|
dir: "ltr",
|
|
1479
1479
|
children: [
|
|
1480
|
-
/* @__PURE__ */ n(ge, { children: /* @__PURE__ */ n(
|
|
1480
|
+
/* @__PURE__ */ n(ge, { children: /* @__PURE__ */ n(Oe.Messages, { components: Ti }) }),
|
|
1481
1481
|
y && /* @__PURE__ */ n(
|
|
1482
|
-
|
|
1482
|
+
zi,
|
|
1483
1483
|
{
|
|
1484
1484
|
latestProgress: y,
|
|
1485
1485
|
parts: h.parts,
|
|
1486
1486
|
isFinished: N
|
|
1487
1487
|
}
|
|
1488
1488
|
),
|
|
1489
|
-
v && /* @__PURE__ */ n("div", { className: "animate-in-bubble", children: /* @__PURE__ */ n(
|
|
1489
|
+
v && /* @__PURE__ */ n("div", { className: "animate-in-bubble", children: /* @__PURE__ */ n(Be, {}) }),
|
|
1490
1490
|
o === "error" && c && /* @__PURE__ */ n("div", { className: "mx-auto max-w-3xl w-full px-4 my-3 animate-in-bubble", children: /* @__PURE__ */ n(s, { error: c, code: qt(c) ? c.code : void 0 }) })
|
|
1491
1491
|
]
|
|
1492
1492
|
}
|
|
1493
1493
|
),
|
|
1494
|
-
g !== "idle" && /* @__PURE__ */ n("div", { className: "absolute inset-x-0 top-2 flex justify-center pointer-events-none", children: g === "loading" ? /* @__PURE__ */ n("div", { role: "status", "aria-label": t("loading_earlier"), children: /* @__PURE__ */ n(
|
|
1494
|
+
g !== "idle" && /* @__PURE__ */ n("div", { className: "absolute inset-x-0 top-2 flex justify-center pointer-events-none", children: g === "loading" ? /* @__PURE__ */ n("div", { role: "status", "aria-label": t("loading_earlier"), children: /* @__PURE__ */ n(Be, {}) }) : /* @__PURE__ */ n(
|
|
1495
1495
|
"button",
|
|
1496
1496
|
{
|
|
1497
1497
|
type: "button",
|
|
1498
1498
|
onClick: () => {
|
|
1499
|
-
|
|
1499
|
+
p?.();
|
|
1500
1500
|
},
|
|
1501
1501
|
className: "pointer-events-auto rounded-full border border-border bg-background px-3 py-1.5 text-sm text-muted-foreground shadow-sm hover:text-foreground",
|
|
1502
1502
|
children: t("load_earlier_failed")
|
|
@@ -1508,15 +1508,15 @@ function Ri({ className: e }) {
|
|
|
1508
1508
|
className: "absolute inset-0 flex items-center justify-center pointer-events-none",
|
|
1509
1509
|
role: "status",
|
|
1510
1510
|
"aria-label": t("loading_chat"),
|
|
1511
|
-
children: /* @__PURE__ */ n(
|
|
1511
|
+
children: /* @__PURE__ */ n(Be, { className: "animate-in fade-in duration-300" })
|
|
1512
1512
|
}
|
|
1513
1513
|
),
|
|
1514
|
-
!m && /* @__PURE__ */ n(
|
|
1514
|
+
!m && /* @__PURE__ */ n(Si, {})
|
|
1515
1515
|
] });
|
|
1516
1516
|
}
|
|
1517
|
-
const
|
|
1518
|
-
function
|
|
1519
|
-
const { t: r } =
|
|
1517
|
+
const Di = "size-8 rounded-full p-1.5 text-muted-foreground hover:bg-accent/60 hover:text-foreground disabled:opacity-40";
|
|
1518
|
+
function Oi({ retry: e, feedback: t, edit: s }) {
|
|
1519
|
+
const { t: r } = _(["chat", "errors"]), a = W((c) => c.message.role === "user"), o = (c) => B.error(pe(c, r)), [i, l] = Vt(2e3);
|
|
1520
1520
|
return /* @__PURE__ */ d(
|
|
1521
1521
|
be.Root,
|
|
1522
1522
|
{
|
|
@@ -1537,13 +1537,13 @@ function Di({ retry: e, feedback: t, edit: s }) {
|
|
|
1537
1537
|
t,
|
|
1538
1538
|
"dislike",
|
|
1539
1539
|
be.FeedbackNegative,
|
|
1540
|
-
|
|
1540
|
+
fr,
|
|
1541
1541
|
o,
|
|
1542
1542
|
"data-[active]:text-destructive"
|
|
1543
1543
|
],
|
|
1544
|
-
[s, "edit_message", be.Edit,
|
|
1544
|
+
[s, "edit_message", be.Edit, pr, void 0, void 0]
|
|
1545
1545
|
].map(
|
|
1546
|
-
([c, u,
|
|
1546
|
+
([c, u, f, m, g, p]) => c && /* @__PURE__ */ n(mn, { label: r(u), children: /* @__PURE__ */ n(f, { "aria-label": r(u), onError: g, className: p, children: /* @__PURE__ */ n(m, { className: "size-4" }) }) }, u)
|
|
1547
1547
|
),
|
|
1548
1548
|
/* @__PURE__ */ n(mn, { label: r("copy"), children: /* @__PURE__ */ d(
|
|
1549
1549
|
be.Copy,
|
|
@@ -1554,7 +1554,7 @@ function Di({ retry: e, feedback: t, edit: s }) {
|
|
|
1554
1554
|
className: "group/copy",
|
|
1555
1555
|
children: [
|
|
1556
1556
|
/* @__PURE__ */ n(zn, { className: "size-4 group-data-[copied]/copy:hidden" }),
|
|
1557
|
-
/* @__PURE__ */ n(
|
|
1557
|
+
/* @__PURE__ */ n(yt, { className: "hidden size-4 group-data-[copied]/copy:block" })
|
|
1558
1558
|
]
|
|
1559
1559
|
}
|
|
1560
1560
|
) }),
|
|
@@ -1564,13 +1564,13 @@ function Di({ retry: e, feedback: t, edit: s }) {
|
|
|
1564
1564
|
);
|
|
1565
1565
|
}
|
|
1566
1566
|
function mn({ label: e, children: t }) {
|
|
1567
|
-
return /* @__PURE__ */ d(
|
|
1568
|
-
/* @__PURE__ */ n(
|
|
1569
|
-
/* @__PURE__ */ n(
|
|
1567
|
+
return /* @__PURE__ */ d(Je, { children: [
|
|
1568
|
+
/* @__PURE__ */ n(Ze, { asChild: !0, children: /* @__PURE__ */ n(E, { variant: "ghost", size: "sm", className: Di, asChild: !0, children: t }) }),
|
|
1569
|
+
/* @__PURE__ */ n(et, { children: e })
|
|
1570
1570
|
] });
|
|
1571
1571
|
}
|
|
1572
|
-
const
|
|
1573
|
-
|
|
1572
|
+
const Ei = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg-transparent w-full", children: /* @__PURE__ */ n(
|
|
1573
|
+
fe.Root,
|
|
1574
1574
|
{
|
|
1575
1575
|
className: x(
|
|
1576
1576
|
"w-full flex items-end gap-2 overflow-hidden rounded-[32px] bg-card/85 dark:bg-surface/85 backdrop-blur-md px-4 py-2 transition-[border-color,box-shadow] duration-200 ease-out border border-border/60 shadow-[0_2px_12px_rgb(0_0_0/0.05)] dark:shadow-[0_4px_20px_rgb(0_0_0/0.25)] hover:border-border has-focus-visible:border-foreground/20 has-focus-visible:shadow-md",
|
|
@@ -1578,7 +1578,7 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1578
1578
|
),
|
|
1579
1579
|
...t
|
|
1580
1580
|
}
|
|
1581
|
-
) }),
|
|
1581
|
+
) }), Li = $n(
|
|
1582
1582
|
function({ className: t, placeholder: s, ...r }, a) {
|
|
1583
1583
|
const { dir: o } = V(), i = _t().draft, l = oe(i, o), c = `${i || s || ""} `;
|
|
1584
1584
|
return /* @__PURE__ */ d("div", { className: "grid min-w-0 flex-1", children: [
|
|
@@ -1592,7 +1592,7 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1592
1592
|
}
|
|
1593
1593
|
),
|
|
1594
1594
|
/* @__PURE__ */ n(
|
|
1595
|
-
|
|
1595
|
+
fe.Input,
|
|
1596
1596
|
{
|
|
1597
1597
|
ref: a,
|
|
1598
1598
|
dir: l,
|
|
@@ -1607,13 +1607,13 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1607
1607
|
)
|
|
1608
1608
|
] });
|
|
1609
1609
|
}
|
|
1610
|
-
),
|
|
1610
|
+
), qi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: x("flex shrink-0 items-center gap-1.5 pb-1", e), ...t }), $i = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: x("flex items-center gap-0.5", e), ...t }), Ps = ({
|
|
1611
1611
|
variant: e = "ghost",
|
|
1612
1612
|
className: t,
|
|
1613
1613
|
size: s,
|
|
1614
1614
|
...r
|
|
1615
1615
|
}) => {
|
|
1616
|
-
const a = s ??
|
|
1616
|
+
const a = s ?? Yr.count(r.children) > 1 ? "default" : "icon";
|
|
1617
1617
|
return /* @__PURE__ */ n(
|
|
1618
1618
|
E,
|
|
1619
1619
|
{
|
|
@@ -1628,10 +1628,10 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1628
1628
|
...r
|
|
1629
1629
|
}
|
|
1630
1630
|
);
|
|
1631
|
-
},
|
|
1631
|
+
}, ji = {
|
|
1632
1632
|
submitted: tn,
|
|
1633
1633
|
streaming: tn,
|
|
1634
|
-
error:
|
|
1634
|
+
error: Se
|
|
1635
1635
|
}, hn = ({
|
|
1636
1636
|
className: e,
|
|
1637
1637
|
variant: t = "default",
|
|
@@ -1640,7 +1640,7 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1640
1640
|
children: a,
|
|
1641
1641
|
...o
|
|
1642
1642
|
}) => {
|
|
1643
|
-
const { t: i } =
|
|
1643
|
+
const { t: i } = _("chat"), l = r === "submitted" || r === "streaming", c = r && ji[r] || Tn, u = i(l ? "stop_generation" : r === "error" ? "send_failed" : "send_message");
|
|
1644
1644
|
return /* @__PURE__ */ n(
|
|
1645
1645
|
E,
|
|
1646
1646
|
{
|
|
@@ -1657,29 +1657,29 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1657
1657
|
children: a ?? /* @__PURE__ */ n(c, { className: l ? "size-3.5 fill-current" : "size-4" })
|
|
1658
1658
|
}
|
|
1659
1659
|
);
|
|
1660
|
-
},
|
|
1660
|
+
}, ct = 768;
|
|
1661
1661
|
function Qt() {
|
|
1662
|
-
const [e, t] =
|
|
1663
|
-
return
|
|
1664
|
-
const s = window.matchMedia(`(max-width: ${
|
|
1665
|
-
t(window.innerWidth <
|
|
1662
|
+
const [e, t] = te.useState(void 0);
|
|
1663
|
+
return te.useEffect(() => {
|
|
1664
|
+
const s = window.matchMedia(`(max-width: ${ct - 1}px)`), r = () => {
|
|
1665
|
+
t(window.innerWidth < ct);
|
|
1666
1666
|
};
|
|
1667
|
-
return s.addEventListener("change", r), t(window.innerWidth <
|
|
1667
|
+
return s.addEventListener("change", r), t(window.innerWidth < ct), () => {
|
|
1668
1668
|
s.removeEventListener("change", r);
|
|
1669
1669
|
};
|
|
1670
1670
|
}, []), !!e;
|
|
1671
1671
|
}
|
|
1672
|
-
const
|
|
1673
|
-
function
|
|
1672
|
+
const fn = "flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
1673
|
+
function Fi({
|
|
1674
1674
|
file: e,
|
|
1675
1675
|
remove: t,
|
|
1676
1676
|
retry: s
|
|
1677
1677
|
}) {
|
|
1678
|
-
const { t: r } =
|
|
1678
|
+
const { t: r } = _(["chat", "errors"]), { file: a, status: o, progress: i, error: l, retryable: c } = e, u = Ui(a.type.startsWith("image/") ? a : null), f = o === "failed", m = f ? qt(l) ? pe(l, r) : r("upload_failed") : "";
|
|
1679
1679
|
return /* @__PURE__ */ d(
|
|
1680
1680
|
"div",
|
|
1681
1681
|
{
|
|
1682
|
-
className: `flex max-w-full items-center gap-2 rounded-xl border bg-muted/60 py-1.5 ps-2.5 pe-1.5 text-sm ${
|
|
1682
|
+
className: `flex max-w-full items-center gap-2 rounded-xl border bg-muted/60 py-1.5 ps-2.5 pe-1.5 text-sm ${f ? "border-destructive/50" : "border-border/60"}`,
|
|
1683
1683
|
"data-status": o,
|
|
1684
1684
|
children: [
|
|
1685
1685
|
u ? /* @__PURE__ */ n(
|
|
@@ -1710,17 +1710,17 @@ function ji({
|
|
|
1710
1710
|
)
|
|
1711
1711
|
}
|
|
1712
1712
|
),
|
|
1713
|
-
|
|
1713
|
+
f && /* @__PURE__ */ d("span", { className: "flex items-center gap-1 text-xs text-destructive", role: "alert", children: [
|
|
1714
1714
|
/* @__PURE__ */ n(gr, { className: "size-3 shrink-0", "aria-hidden": !0 }),
|
|
1715
1715
|
/* @__PURE__ */ n("span", { className: "max-w-[180px] truncate", title: m, children: m })
|
|
1716
1716
|
] })
|
|
1717
1717
|
] }),
|
|
1718
|
-
|
|
1718
|
+
f && c && /* @__PURE__ */ n(
|
|
1719
1719
|
"button",
|
|
1720
1720
|
{
|
|
1721
1721
|
type: "button",
|
|
1722
1722
|
onClick: s,
|
|
1723
|
-
className: `${
|
|
1723
|
+
className: `${fn} hover:bg-accent hover:text-foreground`,
|
|
1724
1724
|
"aria-label": r("retry_upload", { name: a.name }),
|
|
1725
1725
|
children: /* @__PURE__ */ n(br, { className: "size-3.5", "aria-hidden": !0 })
|
|
1726
1726
|
}
|
|
@@ -1730,16 +1730,16 @@ function ji({
|
|
|
1730
1730
|
{
|
|
1731
1731
|
type: "button",
|
|
1732
1732
|
onClick: t,
|
|
1733
|
-
className: `${
|
|
1733
|
+
className: `${fn} hover:bg-destructive/15 hover:text-destructive`,
|
|
1734
1734
|
"aria-label": `${r("remove_file")}: ${a.name}`,
|
|
1735
|
-
children: /* @__PURE__ */ n(
|
|
1735
|
+
children: /* @__PURE__ */ n(Se, { className: "size-3", "aria-hidden": !0 })
|
|
1736
1736
|
}
|
|
1737
1737
|
)
|
|
1738
1738
|
]
|
|
1739
1739
|
}
|
|
1740
1740
|
);
|
|
1741
1741
|
}
|
|
1742
|
-
function
|
|
1742
|
+
function Ui(e) {
|
|
1743
1743
|
const [t, s] = C();
|
|
1744
1744
|
return D(() => {
|
|
1745
1745
|
if (!e) return;
|
|
@@ -1749,8 +1749,8 @@ function Fi(e) {
|
|
|
1749
1749
|
};
|
|
1750
1750
|
}, [e]), t;
|
|
1751
1751
|
}
|
|
1752
|
-
function
|
|
1753
|
-
const { t: r } =
|
|
1752
|
+
function Bi({ reference: e, remove: t, focus: s }) {
|
|
1753
|
+
const { t: r } = _(["chat"]);
|
|
1754
1754
|
return /* @__PURE__ */ d(
|
|
1755
1755
|
"div",
|
|
1756
1756
|
{
|
|
@@ -1779,32 +1779,32 @@ function Ui({ reference: e, remove: t, focus: s }) {
|
|
|
1779
1779
|
className: "ms-0.5 flex size-4 shrink-0 items-center justify-center rounded-full text-muted-foreground/60 transition hover:bg-destructive/15 hover:text-destructive",
|
|
1780
1780
|
"aria-label": `${r("remove_reference")}: ${e.excerpt}`,
|
|
1781
1781
|
title: r("remove_reference"),
|
|
1782
|
-
children: /* @__PURE__ */ n(
|
|
1782
|
+
children: /* @__PURE__ */ n(Se, { className: "size-2.5" })
|
|
1783
1783
|
}
|
|
1784
1784
|
)
|
|
1785
1785
|
]
|
|
1786
1786
|
}
|
|
1787
1787
|
);
|
|
1788
1788
|
}
|
|
1789
|
-
const
|
|
1790
|
-
function
|
|
1789
|
+
const pn = ["byte", "kilobyte", "megabyte", "gigabyte"];
|
|
1790
|
+
function Hi(e, t) {
|
|
1791
1791
|
let s = e, r = 0;
|
|
1792
|
-
for (; s >= 1024 && r <
|
|
1792
|
+
for (; s >= 1024 && r < pn.length - 1; )
|
|
1793
1793
|
s /= 1024, r += 1;
|
|
1794
1794
|
return new Intl.NumberFormat(t, {
|
|
1795
1795
|
style: "unit",
|
|
1796
|
-
unit:
|
|
1796
|
+
unit: pn[r],
|
|
1797
1797
|
unitDisplay: "short",
|
|
1798
1798
|
maximumFractionDigits: r === 0 ? 0 : 1
|
|
1799
1799
|
}).format(s);
|
|
1800
1800
|
}
|
|
1801
|
-
function
|
|
1801
|
+
function Vi(e, { t, language: s, maxSize: r }) {
|
|
1802
1802
|
for (const { file: a, reason: o } of e)
|
|
1803
1803
|
o === "unsupported_type" ? B.error(t("chat:file_type_not_supported", { name: a.name })) : o === "too_large" && r !== void 0 && B.error(
|
|
1804
|
-
t("chat:file_too_large", { name: a.name, size:
|
|
1804
|
+
t("chat:file_too_large", { name: a.name, size: Hi(r, s) })
|
|
1805
1805
|
);
|
|
1806
1806
|
}
|
|
1807
|
-
const
|
|
1807
|
+
const Gi = {
|
|
1808
1808
|
mic_denied: "chat:voice_mic_denied",
|
|
1809
1809
|
mic_missing: "chat:voice_mic_missing",
|
|
1810
1810
|
mic_error: "chat:voice_mic_error",
|
|
@@ -1812,61 +1812,61 @@ const Vi = {
|
|
|
1812
1812
|
time_limit: "chat:voice_time_limit",
|
|
1813
1813
|
failed: "chat:voice_failed"
|
|
1814
1814
|
};
|
|
1815
|
-
function
|
|
1816
|
-
const s = t(
|
|
1815
|
+
function Wi(e, t) {
|
|
1816
|
+
const s = t(Gi[e.kind]);
|
|
1817
1817
|
e.kind === "failed" ? B.error(s, { action: { label: t("chat:voice_retry"), onClick: e.retry } }) : e.kind === "no_speech" || e.kind === "time_limit" ? B(s) : B.error(s);
|
|
1818
1818
|
}
|
|
1819
1819
|
function Rs({
|
|
1820
1820
|
enabled: e = !0
|
|
1821
1821
|
} = {}) {
|
|
1822
|
-
const { t, i18n: s } =
|
|
1822
|
+
const { t, i18n: s } = _(["chat"]), { dir: r } = V(), a = Y((y) => y.welcome), o = typeof a?.greeting == "function", i = typeof a?.typingPrompts == "function", { user: l, firstName: c, isLoading: u } = Un({
|
|
1823
1823
|
enabled: e && (o || i)
|
|
1824
|
-
}),
|
|
1824
|
+
}), f = a?.typingPrompts, m = typeof f == "function" ? f({ user: l, firstName: c, isLoading: u, t }) : f, g = t("welcome.typing_prompts", { returnObjects: !0, defaultValue: [] }), p = (m ? m.map((y) => t(y)) : Array.isArray(g) ? g : []).filter((y) => typeof y == "string" && y !== ""), h = a?.greeting, N = typeof h == "function" ? h({ user: l, firstName: c, isLoading: u, t }) : h ? Ne(h, t, s, ["chat"]) : t("welcome.title"), v = a?.subtitle ? Ne(a.subtitle, t, s, ["chat"]) : null;
|
|
1825
1825
|
return {
|
|
1826
1826
|
title: N,
|
|
1827
1827
|
subtitle: v,
|
|
1828
|
-
typingMessages:
|
|
1828
|
+
typingMessages: p,
|
|
1829
1829
|
isRtl: r === "rtl",
|
|
1830
1830
|
icon: a?.icon
|
|
1831
1831
|
};
|
|
1832
1832
|
}
|
|
1833
|
-
const
|
|
1834
|
-
function
|
|
1833
|
+
const Qi = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1834
|
+
function Ki(e, t = {}) {
|
|
1835
1835
|
const { typingSpeed: s = 20, deletingSpeed: r = 15, pauseMs: a = 2e3, startDelayMs: o = 250 } = t, i = e.join("\0"), [l, c] = C(""), u = U(e);
|
|
1836
1836
|
return u.current = e, D(() => {
|
|
1837
|
-
const
|
|
1838
|
-
if (
|
|
1837
|
+
const f = u.current;
|
|
1838
|
+
if (f.length === 0) {
|
|
1839
1839
|
c("");
|
|
1840
1840
|
return;
|
|
1841
1841
|
}
|
|
1842
|
-
let m, g = 0,
|
|
1843
|
-
if (
|
|
1844
|
-
c(
|
|
1842
|
+
let m, g = 0, p = "typing", h = 0;
|
|
1843
|
+
if (Qi()) {
|
|
1844
|
+
c(f[0]);
|
|
1845
1845
|
const y = setInterval(() => {
|
|
1846
|
-
g = (g + 1) %
|
|
1846
|
+
g = (g + 1) % f.length, c(f[g]);
|
|
1847
1847
|
}, a);
|
|
1848
1848
|
return () => clearInterval(y);
|
|
1849
1849
|
}
|
|
1850
1850
|
const v = () => {
|
|
1851
|
-
const y =
|
|
1852
|
-
if (
|
|
1853
|
-
h++, c(y.slice(0, h)), h >= y.length ? (
|
|
1851
|
+
const y = f[g];
|
|
1852
|
+
if (p === "typing") {
|
|
1853
|
+
h++, c(y.slice(0, h)), h >= y.length ? (p = "pausing", m = setTimeout(v, a)) : m = setTimeout(v, s);
|
|
1854
1854
|
return;
|
|
1855
1855
|
}
|
|
1856
|
-
if (
|
|
1857
|
-
|
|
1856
|
+
if (p === "pausing") {
|
|
1857
|
+
p = "deleting", m = setTimeout(v, r);
|
|
1858
1858
|
return;
|
|
1859
1859
|
}
|
|
1860
|
-
h--, c(y.slice(0, Math.max(h, 0))), h <= 0 ? (
|
|
1860
|
+
h--, c(y.slice(0, Math.max(h, 0))), h <= 0 ? (p = "typing", g = (g + 1) % f.length, m = setTimeout(v, s)) : m = setTimeout(v, r);
|
|
1861
1861
|
};
|
|
1862
1862
|
return c(""), m = setTimeout(v, o), () => clearTimeout(m);
|
|
1863
1863
|
}, [i, s, r, a, o]), l;
|
|
1864
1864
|
}
|
|
1865
|
-
function
|
|
1866
|
-
return /* @__PURE__ */ n(
|
|
1867
|
-
/* @__PURE__ */ n(
|
|
1865
|
+
function Xi({ open: e, onOpenChange: t, onCapture: s }) {
|
|
1866
|
+
return /* @__PURE__ */ n($e, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Yn, { children: [
|
|
1867
|
+
/* @__PURE__ */ n(_e.Overlay, { className: "fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0" }),
|
|
1868
1868
|
/* @__PURE__ */ n(
|
|
1869
|
-
|
|
1869
|
+
_e.Content,
|
|
1870
1870
|
{
|
|
1871
1871
|
"aria-describedby": void 0,
|
|
1872
1872
|
onOpenAutoFocus: (r) => {
|
|
@@ -1874,7 +1874,7 @@ function Ki({ open: e, onOpenChange: t, onCapture: s }) {
|
|
|
1874
1874
|
},
|
|
1875
1875
|
className: "fixed inset-0 z-50 m-auto h-fit w-[calc(100%-2rem)] max-w-2xl overflow-hidden rounded-3xl bg-black shadow-2xl ring-1 ring-white/10 outline-none duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
|
|
1876
1876
|
children: /* @__PURE__ */ n(
|
|
1877
|
-
|
|
1877
|
+
Yi,
|
|
1878
1878
|
{
|
|
1879
1879
|
onKeep: (r) => {
|
|
1880
1880
|
s(r), t(!1);
|
|
@@ -1886,10 +1886,10 @@ function Ki({ open: e, onOpenChange: t, onCapture: s }) {
|
|
|
1886
1886
|
] }) });
|
|
1887
1887
|
}
|
|
1888
1888
|
const gn = "grid size-10 place-items-center rounded-full bg-white/12 text-white backdrop-blur-md transition hover:bg-white/20 active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60", bn = "flex h-10 items-center gap-2 rounded-full px-4 text-sm font-medium transition active:scale-95 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/60";
|
|
1889
|
-
function
|
|
1890
|
-
const { t } =
|
|
1889
|
+
function Yi({ onKeep: e }) {
|
|
1890
|
+
const { t } = _("chat"), s = U(null), [r, a] = C(), [o, i] = C(null), [l, c] = C([]), [u, f] = C(!1), [m, g] = C(!1), [p, h] = C(null);
|
|
1891
1891
|
D(() => {
|
|
1892
|
-
let
|
|
1892
|
+
let k = !1, z = null;
|
|
1893
1893
|
return navigator.mediaDevices.getUserMedia({
|
|
1894
1894
|
audio: !1,
|
|
1895
1895
|
video: {
|
|
@@ -1898,35 +1898,35 @@ function Xi({ onKeep: e }) {
|
|
|
1898
1898
|
height: { ideal: 1080 }
|
|
1899
1899
|
}
|
|
1900
1900
|
}).then(async (T) => {
|
|
1901
|
-
if (
|
|
1901
|
+
if (k) return T.getTracks().forEach((A) => A.stop());
|
|
1902
1902
|
z = T, s.current && (s.current.srcObject = T), i(T);
|
|
1903
1903
|
const P = await navigator.mediaDevices.enumerateDevices();
|
|
1904
|
-
|
|
1905
|
-
}).catch(() => !
|
|
1906
|
-
|
|
1904
|
+
k || c(P.filter((A) => A.kind === "videoinput").map((A) => A.deviceId));
|
|
1905
|
+
}).catch(() => !k && g(!0)), () => {
|
|
1906
|
+
k = !0, z?.getTracks().forEach((T) => T.stop());
|
|
1907
1907
|
};
|
|
1908
1908
|
}, [r]), D(() => () => {
|
|
1909
|
-
|
|
1910
|
-
}, [
|
|
1909
|
+
p && URL.revokeObjectURL(p.url);
|
|
1910
|
+
}, [p]);
|
|
1911
1911
|
const N = o?.getVideoTracks()[0]?.getSettings(), v = N?.facingMode !== "environment", y = () => {
|
|
1912
|
-
const
|
|
1913
|
-
!
|
|
1912
|
+
const k = l[(l.indexOf(N?.deviceId ?? "") + 1) % l.length];
|
|
1913
|
+
!k || k === N?.deviceId || (s.current && (s.current.srcObject = null), i(null), f(!1), a(k));
|
|
1914
1914
|
}, b = () => {
|
|
1915
|
-
const
|
|
1916
|
-
if (!
|
|
1915
|
+
const k = s.current;
|
|
1916
|
+
if (!k?.videoWidth) return;
|
|
1917
1917
|
const z = Object.assign(document.createElement("canvas"), {
|
|
1918
|
-
width:
|
|
1919
|
-
height:
|
|
1918
|
+
width: k.videoWidth,
|
|
1919
|
+
height: k.videoHeight
|
|
1920
1920
|
});
|
|
1921
|
-
z.getContext("2d")?.drawImage(
|
|
1921
|
+
z.getContext("2d")?.drawImage(k, 0, 0), z.toBlob(
|
|
1922
1922
|
(T) => T && h({ blob: T, url: URL.createObjectURL(T) }),
|
|
1923
1923
|
"image/jpeg",
|
|
1924
1924
|
0.92
|
|
1925
1925
|
);
|
|
1926
1926
|
}, I = () => {
|
|
1927
|
-
if (!
|
|
1928
|
-
const
|
|
1929
|
-
e(new File([
|
|
1927
|
+
if (!p) return;
|
|
1928
|
+
const k = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/[-:]/g, "").replace("T", "-");
|
|
1929
|
+
e(new File([p.blob], `photo-${k}.jpg`, { type: "image/jpeg" }));
|
|
1930
1930
|
};
|
|
1931
1931
|
return /* @__PURE__ */ d("div", { className: "relative aspect-[3/4] max-h-[80dvh] w-full sm:aspect-video", children: [
|
|
1932
1932
|
/* @__PURE__ */ n(
|
|
@@ -1936,7 +1936,7 @@ function Xi({ onKeep: e }) {
|
|
|
1936
1936
|
autoPlay: !0,
|
|
1937
1937
|
playsInline: !0,
|
|
1938
1938
|
muted: !0,
|
|
1939
|
-
onPlaying: () =>
|
|
1939
|
+
onPlaying: () => f(!0),
|
|
1940
1940
|
className: x(
|
|
1941
1941
|
"absolute inset-0 size-full object-cover transition-opacity duration-500",
|
|
1942
1942
|
u ? "opacity-100" : "opacity-0",
|
|
@@ -1944,10 +1944,10 @@ function Xi({ onKeep: e }) {
|
|
|
1944
1944
|
)
|
|
1945
1945
|
}
|
|
1946
1946
|
),
|
|
1947
|
-
|
|
1947
|
+
p && /* @__PURE__ */ n(
|
|
1948
1948
|
"img",
|
|
1949
1949
|
{
|
|
1950
|
-
src:
|
|
1950
|
+
src: p.url,
|
|
1951
1951
|
alt: "",
|
|
1952
1952
|
className: "absolute inset-0 size-full object-cover animate-in fade-in-0 zoom-in-[1.02] duration-200"
|
|
1953
1953
|
}
|
|
@@ -1955,12 +1955,12 @@ function Xi({ onKeep: e }) {
|
|
|
1955
1955
|
m ? /* @__PURE__ */ d("div", { className: "absolute inset-0 flex flex-col items-center justify-center gap-4 px-8 text-center", children: [
|
|
1956
1956
|
/* @__PURE__ */ n("span", { className: "grid size-14 place-items-center rounded-full bg-white/10", children: /* @__PURE__ */ n(xr, { className: "size-6 text-white/80" }) }),
|
|
1957
1957
|
/* @__PURE__ */ n("p", { className: "max-w-xs text-sm leading-relaxed text-white/70", children: t("camera_error") })
|
|
1958
|
-
] }) : !u && /* @__PURE__ */ n("div", { className: "absolute inset-0 grid place-items-center", children: /* @__PURE__ */ n(
|
|
1958
|
+
] }) : !u && /* @__PURE__ */ n("div", { className: "absolute inset-0 grid place-items-center", children: /* @__PURE__ */ n(wt, { className: "size-6 animate-spin text-white/50" }) }),
|
|
1959
1959
|
/* @__PURE__ */ d("div", { className: "absolute inset-x-0 top-0 flex items-center justify-between gap-4 bg-gradient-to-b from-black/55 to-transparent px-4 pt-4 pb-10", children: [
|
|
1960
|
-
/* @__PURE__ */ n(
|
|
1961
|
-
/* @__PURE__ */ n(
|
|
1960
|
+
/* @__PURE__ */ n(_e.Title, { className: "ps-1 text-sm font-medium text-white/90", children: t("camera_title") }),
|
|
1961
|
+
/* @__PURE__ */ n(_e.Close, { className: gn, "aria-label": t("camera_close"), children: /* @__PURE__ */ n(Se, { className: "size-4.5" }) })
|
|
1962
1962
|
] }),
|
|
1963
|
-
!m && /* @__PURE__ */ n("div", { className: "absolute inset-x-0 bottom-0 grid grid-cols-[1fr_auto_1fr] items-center gap-4 bg-gradient-to-t from-black/65 to-transparent px-5 pt-14 pb-5", children:
|
|
1963
|
+
!m && /* @__PURE__ */ n("div", { className: "absolute inset-x-0 bottom-0 grid grid-cols-[1fr_auto_1fr] items-center gap-4 bg-gradient-to-t from-black/65 to-transparent px-5 pt-14 pb-5", children: p ? /* @__PURE__ */ d($, { children: [
|
|
1964
1964
|
/* @__PURE__ */ d(
|
|
1965
1965
|
"button",
|
|
1966
1966
|
{
|
|
@@ -1986,7 +1986,7 @@ function Xi({ onKeep: e }) {
|
|
|
1986
1986
|
"col-start-3 justify-self-end bg-white text-black shadow-lg hover:bg-white/90"
|
|
1987
1987
|
),
|
|
1988
1988
|
children: [
|
|
1989
|
-
/* @__PURE__ */ n(
|
|
1989
|
+
/* @__PURE__ */ n(yt, { className: "size-4" }),
|
|
1990
1990
|
t("camera_use")
|
|
1991
1991
|
]
|
|
1992
1992
|
}
|
|
@@ -2034,16 +2034,16 @@ const As = {
|
|
|
2034
2034
|
label: "attach_files"
|
|
2035
2035
|
}
|
|
2036
2036
|
};
|
|
2037
|
-
function
|
|
2037
|
+
function Ji() {
|
|
2038
2038
|
return window.matchMedia("(pointer: coarse)").matches ? "native" : "mediaDevices" in navigator ? "webcam" : null;
|
|
2039
2039
|
}
|
|
2040
|
-
function
|
|
2041
|
-
const { t: r } =
|
|
2040
|
+
function Zi({ disabled: e, addFiles: t, isMobile: s }) {
|
|
2041
|
+
const { t: r } = _("chat"), { dir: a } = V(), [o, i] = C(!1), [l, c] = C(!1), [u] = C(Ji), f = {
|
|
2042
2042
|
camera: U(null),
|
|
2043
2043
|
gallery: U(null),
|
|
2044
2044
|
files: U(null)
|
|
2045
|
-
}, m =
|
|
2046
|
-
b === "camera" && u === "webcam" ? c(!0) :
|
|
2045
|
+
}, m = qe()?.attachments.types ?? [], g = m.filter((b) => b.startsWith("image/")), p = g.length ? [...u ? ["camera"] : [], "gallery", "files"] : ["files"], h = (b) => {
|
|
2046
|
+
b === "camera" && u === "webcam" ? c(!0) : f[b].current?.click();
|
|
2047
2047
|
}, N = (b) => {
|
|
2048
2048
|
b.target.files && t(Array.from(b.target.files)), b.target.value = "";
|
|
2049
2049
|
}, v = r("attach"), y = /* @__PURE__ */ n(
|
|
@@ -2052,7 +2052,7 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2052
2052
|
variant: "ghost",
|
|
2053
2053
|
disabled: e,
|
|
2054
2054
|
"aria-label": v,
|
|
2055
|
-
onClick:
|
|
2055
|
+
onClick: p.length === 1 ? () => h("files") : s ? () => i(!0) : void 0,
|
|
2056
2056
|
className: x(o && "bg-accent/60 text-foreground transition-colors active:scale-100"),
|
|
2057
2057
|
children: /* @__PURE__ */ n(
|
|
2058
2058
|
wr,
|
|
@@ -2070,7 +2070,7 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2070
2070
|
"input",
|
|
2071
2071
|
{
|
|
2072
2072
|
type: "file",
|
|
2073
|
-
ref:
|
|
2073
|
+
ref: f[b],
|
|
2074
2074
|
onChange: N,
|
|
2075
2075
|
accept: (b === "files" ? m : g).join(","),
|
|
2076
2076
|
capture: b === "camera" ? "environment" : void 0,
|
|
@@ -2079,18 +2079,18 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2079
2079
|
},
|
|
2080
2080
|
b
|
|
2081
2081
|
)),
|
|
2082
|
-
|
|
2083
|
-
/* @__PURE__ */ n(
|
|
2084
|
-
/* @__PURE__ */ n(
|
|
2082
|
+
p.length === 1 ? /* @__PURE__ */ d(Je, { children: [
|
|
2083
|
+
/* @__PURE__ */ n(Ze, { asChild: !0, children: y }),
|
|
2084
|
+
/* @__PURE__ */ n(et, { children: v })
|
|
2085
2085
|
] }) : s ? /* @__PURE__ */ d($, { children: [
|
|
2086
2086
|
y,
|
|
2087
2087
|
/* @__PURE__ */ n(
|
|
2088
|
-
|
|
2088
|
+
el,
|
|
2089
2089
|
{
|
|
2090
2090
|
open: o,
|
|
2091
2091
|
onOpenChange: i,
|
|
2092
2092
|
title: v,
|
|
2093
|
-
sources:
|
|
2093
|
+
sources: p,
|
|
2094
2094
|
onPick: (b) => {
|
|
2095
2095
|
h(b), i(!1);
|
|
2096
2096
|
}
|
|
@@ -2111,8 +2111,8 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2111
2111
|
sideOffset: 10,
|
|
2112
2112
|
className: "min-w-0 rounded-2xl border-border/60 bg-popover p-1.5 shadow-xl",
|
|
2113
2113
|
onCloseAutoFocus: (b) => l && b.preventDefault(),
|
|
2114
|
-
children:
|
|
2115
|
-
const { icon: I, label:
|
|
2114
|
+
children: p.map((b) => {
|
|
2115
|
+
const { icon: I, label: k } = As[b];
|
|
2116
2116
|
return /* @__PURE__ */ d(
|
|
2117
2117
|
we,
|
|
2118
2118
|
{
|
|
@@ -2120,7 +2120,7 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2120
2120
|
className: "cursor-pointer gap-3 rounded-xl py-1.5 ps-1.5 pe-4 font-medium",
|
|
2121
2121
|
children: [
|
|
2122
2122
|
/* @__PURE__ */ n("span", { className: "grid size-8 place-items-center rounded-lg bg-foreground/[0.06] text-foreground/75", children: /* @__PURE__ */ n(I, { className: "size-4 text-current" }) }),
|
|
2123
|
-
r(
|
|
2123
|
+
r(k)
|
|
2124
2124
|
]
|
|
2125
2125
|
},
|
|
2126
2126
|
b
|
|
@@ -2131,7 +2131,7 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2131
2131
|
] })
|
|
2132
2132
|
),
|
|
2133
2133
|
u === "webcam" && /* @__PURE__ */ n(
|
|
2134
|
-
|
|
2134
|
+
Xi,
|
|
2135
2135
|
{
|
|
2136
2136
|
open: l,
|
|
2137
2137
|
onOpenChange: c,
|
|
@@ -2140,17 +2140,17 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2140
2140
|
)
|
|
2141
2141
|
] });
|
|
2142
2142
|
}
|
|
2143
|
-
function
|
|
2144
|
-
return /* @__PURE__ */ n(
|
|
2145
|
-
/* @__PURE__ */ n(
|
|
2143
|
+
function el({ open: e, onOpenChange: t, title: s, sources: r, onPick: a }) {
|
|
2144
|
+
return /* @__PURE__ */ n($e, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Yn, { children: [
|
|
2145
|
+
/* @__PURE__ */ n(fa, {}),
|
|
2146
2146
|
/* @__PURE__ */ n(
|
|
2147
|
-
|
|
2147
|
+
_e.Content,
|
|
2148
2148
|
{
|
|
2149
2149
|
"aria-describedby": void 0,
|
|
2150
2150
|
onOpenAutoFocus: (o) => o.preventDefault(),
|
|
2151
2151
|
className: "fixed inset-x-0 bottom-0 z-50 outline-none duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] data-[state=open]:animate-in data-[state=open]:slide-in-from-bottom data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom",
|
|
2152
2152
|
children: /* @__PURE__ */ n(
|
|
2153
|
-
|
|
2153
|
+
tl,
|
|
2154
2154
|
{
|
|
2155
2155
|
title: s,
|
|
2156
2156
|
sources: r,
|
|
@@ -2162,13 +2162,13 @@ function Zi({ open: e, onOpenChange: t, title: s, sources: r, onPick: a }) {
|
|
|
2162
2162
|
)
|
|
2163
2163
|
] }) });
|
|
2164
2164
|
}
|
|
2165
|
-
function
|
|
2165
|
+
function tl({
|
|
2166
2166
|
title: e,
|
|
2167
2167
|
sources: t,
|
|
2168
2168
|
onPick: s,
|
|
2169
2169
|
onDismiss: r
|
|
2170
2170
|
}) {
|
|
2171
|
-
const { t: a } =
|
|
2171
|
+
const { t: a } = _("chat"), [o, i] = C(0), [l, c] = C(!1), u = U(0), f = () => {
|
|
2172
2172
|
c(!1), o > 72 ? r() : i(0);
|
|
2173
2173
|
};
|
|
2174
2174
|
return /* @__PURE__ */ d(
|
|
@@ -2192,16 +2192,16 @@ function el({
|
|
|
2192
2192
|
const g = m.clientY - u.current;
|
|
2193
2193
|
i(g > 0 ? g : -Math.sqrt(-g) * 2);
|
|
2194
2194
|
},
|
|
2195
|
-
onPointerUp:
|
|
2196
|
-
onPointerCancel:
|
|
2195
|
+
onPointerUp: f,
|
|
2196
|
+
onPointerCancel: f,
|
|
2197
2197
|
children: [
|
|
2198
2198
|
/* @__PURE__ */ n("div", { className: "mx-auto h-1.5 w-10 rounded-full bg-muted-foreground/25" }),
|
|
2199
|
-
/* @__PURE__ */ n(
|
|
2199
|
+
/* @__PURE__ */ n(_e.Title, { className: "mt-4 text-center text-base font-semibold text-foreground", children: e })
|
|
2200
2200
|
]
|
|
2201
2201
|
}
|
|
2202
2202
|
),
|
|
2203
2203
|
/* @__PURE__ */ n("div", { className: x("grid gap-3", t.length === 3 ? "grid-cols-3" : "grid-cols-2"), children: t.map((m, g) => {
|
|
2204
|
-
const { icon:
|
|
2204
|
+
const { icon: p, label: h } = As[m];
|
|
2205
2205
|
return /* @__PURE__ */ d(
|
|
2206
2206
|
"button",
|
|
2207
2207
|
{
|
|
@@ -2214,7 +2214,7 @@ function el({
|
|
|
2214
2214
|
animationFillMode: "both"
|
|
2215
2215
|
},
|
|
2216
2216
|
children: [
|
|
2217
|
-
/* @__PURE__ */ n("span", { className: "grid size-14 place-items-center rounded-full bg-background text-foreground/80 shadow-sm ring-1 ring-border/60", children: /* @__PURE__ */ n(
|
|
2217
|
+
/* @__PURE__ */ n("span", { className: "grid size-14 place-items-center rounded-full bg-background text-foreground/80 shadow-sm ring-1 ring-border/60", children: /* @__PURE__ */ n(p, { className: "size-6", strokeWidth: 1.75 }) }),
|
|
2218
2218
|
/* @__PURE__ */ n("span", { className: "text-sm font-medium text-foreground/85", children: a(h) })
|
|
2219
2219
|
]
|
|
2220
2220
|
},
|
|
@@ -2225,19 +2225,19 @@ function el({
|
|
|
2225
2225
|
}
|
|
2226
2226
|
);
|
|
2227
2227
|
}
|
|
2228
|
-
function
|
|
2229
|
-
const { t: e } =
|
|
2230
|
-
return /* @__PURE__ */ d(
|
|
2231
|
-
/* @__PURE__ */ n(
|
|
2232
|
-
/* @__PURE__ */ n(
|
|
2228
|
+
function nl() {
|
|
2229
|
+
const { t: e } = _("chat"), t = Bn().status === "starting", s = e("voice_dictate");
|
|
2230
|
+
return /* @__PURE__ */ d(Je, { children: [
|
|
2231
|
+
/* @__PURE__ */ n(Ze, { asChild: !0, children: /* @__PURE__ */ n(fe.Voice, { asChild: !0, children: /* @__PURE__ */ n(Ps, { "aria-label": s, children: t ? /* @__PURE__ */ n(wt, { className: "size-5 animate-spin" }) : /* @__PURE__ */ n(Sr, { className: "size-5" }) }) }) }),
|
|
2232
|
+
/* @__PURE__ */ n(et, { children: s })
|
|
2233
2233
|
] });
|
|
2234
2234
|
}
|
|
2235
|
-
const
|
|
2236
|
-
() => import("./VoiceInput-
|
|
2237
|
-
),
|
|
2238
|
-
() => import("./VoiceInput-
|
|
2235
|
+
const sl = Xe(
|
|
2236
|
+
() => import("./VoiceInput-sKSP-X3z.js").then((e) => ({ default: e.VoiceRecordingBar }))
|
|
2237
|
+
), rl = Xe(
|
|
2238
|
+
() => import("./VoiceInput-sKSP-X3z.js").then((e) => ({ default: e.VoiceRecordingControls }))
|
|
2239
2239
|
);
|
|
2240
|
-
function
|
|
2240
|
+
function al({
|
|
2241
2241
|
onSend: e,
|
|
2242
2242
|
status: t,
|
|
2243
2243
|
isErrorVisible: s,
|
|
@@ -2245,13 +2245,13 @@ function rl({
|
|
|
2245
2245
|
newChat: a,
|
|
2246
2246
|
className: o
|
|
2247
2247
|
}) {
|
|
2248
|
-
const { t: i, i18n: l } =
|
|
2248
|
+
const { t: i, i18n: l } = _(["chat", "maintenance"]), c = Y((w) => w.composer), u = qe(), { ChoiceQuestionDock: f, ComposerFooter: m, composerTools: g } = X(), { blocksChat: p } = Hn(), {
|
|
2249
2249
|
question: h,
|
|
2250
2250
|
disabled: N,
|
|
2251
2251
|
dismissed: v,
|
|
2252
2252
|
setDismissed: y,
|
|
2253
2253
|
answer: b
|
|
2254
|
-
} =
|
|
2254
|
+
} = rt(), I = v ? null : h, { typingMessages: k } = Rs({ enabled: !!a }), z = Ki(a ? k : []), T = !!a && k.length > 0, P = c?.placeholder ? i(c.placeholder) : i("input_placeholder"), A = p ? i("maintenance:composer_placeholder") : I?.allowCustom !== !1 && I ? i("choice_custom_placeholder") : T ? z : P, M = Qt(), L = t === "streaming" || t === "submitted", j = ra("voice_input", { enabled: !!c?.voice?.enabled }), H = !!c?.voice?.enabled && j === !0, q = u?.attachments, Q = (c?.attachments?.enabled ?? !1) && !!q, ee = O(
|
|
2255
2255
|
() => [...g ?? []].sort((w, R) => (w.order ?? 0) - (R.order ?? 0)),
|
|
2256
2256
|
[g]
|
|
2257
2257
|
), { draft: J, setDraft: me, isClosed: re } = _t(), he = U(null), F = {
|
|
@@ -2264,36 +2264,36 @@ function rl({
|
|
|
2264
2264
|
L || re || !w.trim() || e({ text: w });
|
|
2265
2265
|
},
|
|
2266
2266
|
setDraft: (w) => {
|
|
2267
|
-
|
|
2267
|
+
Wa(() => me(w));
|
|
2268
2268
|
const R = he.current;
|
|
2269
2269
|
R && (R.focus(), R.setSelectionRange(w.length, w.length));
|
|
2270
2270
|
}
|
|
2271
2271
|
};
|
|
2272
2272
|
return /* @__PURE__ */ n("div", { className: x("shrink-0 px-4 pb-5 pt-2 md:px-6 md:pb-6 w-full", o), children: /* @__PURE__ */ d("div", { className: "max-w-3xl mx-auto w-full", children: [
|
|
2273
2273
|
I && /* @__PURE__ */ n(
|
|
2274
|
-
|
|
2274
|
+
f,
|
|
2275
2275
|
{
|
|
2276
2276
|
question: I,
|
|
2277
|
-
disabled: N || L ||
|
|
2277
|
+
disabled: N || L || p,
|
|
2278
2278
|
onDismiss: () => y(!0),
|
|
2279
2279
|
onAnswer: b
|
|
2280
2280
|
}
|
|
2281
2281
|
),
|
|
2282
2282
|
/* @__PURE__ */ n("div", { className: "relative z-10", children: /* @__PURE__ */ n(
|
|
2283
|
-
|
|
2283
|
+
Ei,
|
|
2284
2284
|
{
|
|
2285
2285
|
className: "relative",
|
|
2286
2286
|
onSend: e,
|
|
2287
2287
|
allowFiles: Q,
|
|
2288
2288
|
maxVoiceDuration: c?.voice?.maxDuration,
|
|
2289
|
-
onFilesRejected: (w) =>
|
|
2289
|
+
onFilesRejected: (w) => Vi(w, {
|
|
2290
2290
|
t: i,
|
|
2291
2291
|
language: l.language,
|
|
2292
2292
|
maxSize: q?.max_size
|
|
2293
2293
|
}),
|
|
2294
|
-
onVoiceNotice: (w) =>
|
|
2294
|
+
onVoiceNotice: (w) => Wi(w, i),
|
|
2295
2295
|
children: /* @__PURE__ */ n(
|
|
2296
|
-
|
|
2296
|
+
ol,
|
|
2297
2297
|
{
|
|
2298
2298
|
textareaRef: he,
|
|
2299
2299
|
slotProps: F,
|
|
@@ -2302,7 +2302,7 @@ function rl({
|
|
|
2302
2302
|
isMobile: M,
|
|
2303
2303
|
attachEnabled: Q,
|
|
2304
2304
|
voiceEnabled: H,
|
|
2305
|
-
tools:
|
|
2305
|
+
tools: ee
|
|
2306
2306
|
}
|
|
2307
2307
|
)
|
|
2308
2308
|
}
|
|
@@ -2310,7 +2310,7 @@ function rl({
|
|
|
2310
2310
|
m && /* @__PURE__ */ n(ge, { fallback: null, resetKeys: [r], children: /* @__PURE__ */ n(m, { ...F }) })
|
|
2311
2311
|
] }) });
|
|
2312
2312
|
}
|
|
2313
|
-
function
|
|
2313
|
+
function ol({
|
|
2314
2314
|
textareaRef: e,
|
|
2315
2315
|
slotProps: t,
|
|
2316
2316
|
isErrorVisible: s,
|
|
@@ -2320,11 +2320,11 @@ function al({
|
|
|
2320
2320
|
voiceEnabled: i,
|
|
2321
2321
|
tools: l
|
|
2322
2322
|
}) {
|
|
2323
|
-
const { t: c, i18n: u } =
|
|
2323
|
+
const { t: c, i18n: u } = _(["chat"]), f = Y((A) => A.composer?.maxLength), { draft: m, files: g, references: p, isBusy: h } = _t(), { addFiles: N, dragging: v } = aa(), y = Bn(), { threadId: b, status: I } = t, k = !!f && m.length >= f * 0.9;
|
|
2324
2324
|
D(() => {
|
|
2325
2325
|
a || e.current?.focus();
|
|
2326
2326
|
}, [b, a, e]);
|
|
2327
|
-
const z =
|
|
2327
|
+
const z = p.length, T = U(z);
|
|
2328
2328
|
D(() => {
|
|
2329
2329
|
z > T.current && !a && e.current?.focus(), T.current = z;
|
|
2330
2330
|
}, [z, a, e]);
|
|
@@ -2339,49 +2339,49 @@ function al({
|
|
|
2339
2339
|
}
|
|
2340
2340
|
),
|
|
2341
2341
|
o && !y.active && // Matches the toolbar's bottom padding, so the + lines up with the send button.
|
|
2342
|
-
/* @__PURE__ */ n("div", { className: "-ms-1 -me-1 flex shrink-0 items-center pb-1", children: /* @__PURE__ */ n(ge, { fallback: null, resetKeys: [b], children: /* @__PURE__ */ n(
|
|
2342
|
+
/* @__PURE__ */ n("div", { className: "-ms-1 -me-1 flex shrink-0 items-center pb-1", children: /* @__PURE__ */ n(ge, { fallback: null, resetKeys: [b], children: /* @__PURE__ */ n(Zi, { ...P }) }) }),
|
|
2343
2343
|
/* @__PURE__ */ d("div", { className: "flex flex-col flex-1 gap-2", children: [
|
|
2344
|
-
|
|
2345
|
-
g.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 px-2 pt-2", children: /* @__PURE__ */ n(
|
|
2346
|
-
y.active ? /* @__PURE__ */ n(
|
|
2347
|
-
|
|
2344
|
+
p.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 px-2 pt-2", children: /* @__PURE__ */ n(fe.References, { component: Bi }) }),
|
|
2345
|
+
g.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 px-2 pt-2", children: /* @__PURE__ */ n(fe.Attachments, { component: Fi }) }),
|
|
2346
|
+
y.active ? /* @__PURE__ */ n(Ae, { fallback: null, children: /* @__PURE__ */ n(sl, {}) }) : /* @__PURE__ */ n(
|
|
2347
|
+
Li,
|
|
2348
2348
|
{
|
|
2349
2349
|
ref: e,
|
|
2350
2350
|
autoFocus: !a,
|
|
2351
2351
|
placeholder: r,
|
|
2352
|
-
maxLength:
|
|
2352
|
+
maxLength: f,
|
|
2353
2353
|
"aria-label": c("input_placeholder")
|
|
2354
2354
|
}
|
|
2355
2355
|
)
|
|
2356
2356
|
] }),
|
|
2357
|
-
/* @__PURE__ */ n(
|
|
2358
|
-
|
|
2357
|
+
/* @__PURE__ */ n(qi, { children: y.active ? /* @__PURE__ */ n(Ae, { fallback: null, children: /* @__PURE__ */ n(rl, {}) }) : /* @__PURE__ */ d($, { children: [
|
|
2358
|
+
k && /* @__PURE__ */ d(
|
|
2359
2359
|
"span",
|
|
2360
2360
|
{
|
|
2361
2361
|
className: x(
|
|
2362
2362
|
"px-1 text-xs tabular-nums text-muted-foreground",
|
|
2363
|
-
m.length >=
|
|
2363
|
+
m.length >= f && "text-destructive"
|
|
2364
2364
|
),
|
|
2365
2365
|
"aria-live": "polite",
|
|
2366
2366
|
children: [
|
|
2367
2367
|
m.length.toLocaleString(u.language),
|
|
2368
2368
|
"/",
|
|
2369
|
-
|
|
2369
|
+
f.toLocaleString(u.language)
|
|
2370
2370
|
]
|
|
2371
2371
|
}
|
|
2372
2372
|
),
|
|
2373
|
-
/* @__PURE__ */ d(
|
|
2373
|
+
/* @__PURE__ */ d($i, { children: [
|
|
2374
2374
|
l.map(({ id: A, component: M }) => (
|
|
2375
2375
|
// Contained so a throwing tool can't take the composer or the other tools with it.
|
|
2376
2376
|
/* @__PURE__ */ n(ge, { fallback: null, resetKeys: [b], children: /* @__PURE__ */ n(M, { ...P }) }, A)
|
|
2377
2377
|
)),
|
|
2378
|
-
i && /* @__PURE__ */ n(
|
|
2378
|
+
i && /* @__PURE__ */ n(nl, {})
|
|
2379
2379
|
] }),
|
|
2380
|
-
h ? /* @__PURE__ */ n(
|
|
2380
|
+
h ? /* @__PURE__ */ n(fe.Stop, { asChild: !0, children: /* @__PURE__ */ n(hn, { status: I === "submitted" ? "submitted" : "streaming" }) }) : /* @__PURE__ */ n(fe.Send, { asChild: !0, children: /* @__PURE__ */ n(hn, { status: s ? "error" : "ready" }) })
|
|
2381
2381
|
] }) })
|
|
2382
2382
|
] });
|
|
2383
2383
|
}
|
|
2384
|
-
const
|
|
2384
|
+
const il = (e) => {
|
|
2385
2385
|
const { title: t, subtitle: s, isRtl: r, icon: a } = Rs();
|
|
2386
2386
|
return /* @__PURE__ */ d(
|
|
2387
2387
|
"div",
|
|
@@ -2398,14 +2398,14 @@ const ol = (e) => {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
);
|
|
2400
2400
|
};
|
|
2401
|
-
function
|
|
2401
|
+
function ll({
|
|
2402
2402
|
question: e,
|
|
2403
2403
|
disabled: t,
|
|
2404
2404
|
onDismiss: s,
|
|
2405
2405
|
onAnswer: r,
|
|
2406
2406
|
className: a
|
|
2407
2407
|
}) {
|
|
2408
|
-
const { t: o } =
|
|
2408
|
+
const { t: o } = _(["chat"]), { dir: i } = V(), { reportDockHeight: l } = rt(), c = U(null), [u, f] = C(null);
|
|
2409
2409
|
D(() => {
|
|
2410
2410
|
const h = c.current;
|
|
2411
2411
|
if (!h) return;
|
|
@@ -2416,13 +2416,13 @@ function il({
|
|
|
2416
2416
|
v?.disconnect(), l(0);
|
|
2417
2417
|
};
|
|
2418
2418
|
}, [l]);
|
|
2419
|
-
const m = oe(e.question, i), g = t || !r || u !== null,
|
|
2419
|
+
const m = oe(e.question, i), g = t || !r || u !== null, p = async (h) => {
|
|
2420
2420
|
if (!g) {
|
|
2421
|
-
|
|
2421
|
+
f(h);
|
|
2422
2422
|
try {
|
|
2423
2423
|
await r?.(h);
|
|
2424
2424
|
} catch {
|
|
2425
|
-
|
|
2425
|
+
f(null);
|
|
2426
2426
|
}
|
|
2427
2427
|
}
|
|
2428
2428
|
};
|
|
@@ -2448,7 +2448,7 @@ function il({
|
|
|
2448
2448
|
"aria-label": o("choice_dismiss"),
|
|
2449
2449
|
title: o("choice_dismiss"),
|
|
2450
2450
|
className: "-me-1 -mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full text-muted-foreground/70 outline-none transition-colors hover:bg-foreground/[0.06] hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
|
|
2451
|
-
children: /* @__PURE__ */ n(
|
|
2451
|
+
children: /* @__PURE__ */ n(Se, { className: "size-4" })
|
|
2452
2452
|
}
|
|
2453
2453
|
)
|
|
2454
2454
|
] }),
|
|
@@ -2460,7 +2460,7 @@ function il({
|
|
|
2460
2460
|
disabled: g,
|
|
2461
2461
|
dir: m,
|
|
2462
2462
|
onSelect: (h) => {
|
|
2463
|
-
|
|
2463
|
+
p(h);
|
|
2464
2464
|
},
|
|
2465
2465
|
className: "custom-scrollbar mt-3 max-h-[40vh] overflow-y-auto"
|
|
2466
2466
|
}
|
|
@@ -2469,10 +2469,10 @@ function il({
|
|
|
2469
2469
|
}
|
|
2470
2470
|
);
|
|
2471
2471
|
}
|
|
2472
|
-
function
|
|
2473
|
-
return /* @__PURE__ */ d(
|
|
2472
|
+
function cl({ className: e, children: t, ...s }) {
|
|
2473
|
+
return /* @__PURE__ */ d(Pe.Root, { "data-slot": "scroll-area", className: x("relative", e), ...s, children: [
|
|
2474
2474
|
/* @__PURE__ */ n(
|
|
2475
|
-
|
|
2475
|
+
Pe.Viewport,
|
|
2476
2476
|
{
|
|
2477
2477
|
"data-slot": "scroll-area-viewport",
|
|
2478
2478
|
className: "focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",
|
|
@@ -2480,7 +2480,7 @@ function ll({ className: e, children: t, ...s }) {
|
|
|
2480
2480
|
}
|
|
2481
2481
|
),
|
|
2482
2482
|
/* @__PURE__ */ n(Ds, {}),
|
|
2483
|
-
/* @__PURE__ */ n(
|
|
2483
|
+
/* @__PURE__ */ n(Pe.Corner, {})
|
|
2484
2484
|
] });
|
|
2485
2485
|
}
|
|
2486
2486
|
function Ds({
|
|
@@ -2489,7 +2489,7 @@ function Ds({
|
|
|
2489
2489
|
...s
|
|
2490
2490
|
}) {
|
|
2491
2491
|
return /* @__PURE__ */ n(
|
|
2492
|
-
|
|
2492
|
+
Pe.ScrollAreaScrollbar,
|
|
2493
2493
|
{
|
|
2494
2494
|
"data-slot": "scroll-area-scrollbar",
|
|
2495
2495
|
orientation: t,
|
|
@@ -2501,7 +2501,7 @@ function Ds({
|
|
|
2501
2501
|
),
|
|
2502
2502
|
...s,
|
|
2503
2503
|
children: /* @__PURE__ */ n(
|
|
2504
|
-
|
|
2504
|
+
Pe.ScrollAreaThumb,
|
|
2505
2505
|
{
|
|
2506
2506
|
"data-slot": "scroll-area-thumb",
|
|
2507
2507
|
className: "bg-border relative flex-1 rounded-full"
|
|
@@ -2510,13 +2510,13 @@ function Ds({
|
|
|
2510
2510
|
}
|
|
2511
2511
|
);
|
|
2512
2512
|
}
|
|
2513
|
-
const
|
|
2513
|
+
const dl = ({ className: e, children: t, ...s }) => {
|
|
2514
2514
|
const { dir: r } = V();
|
|
2515
|
-
return /* @__PURE__ */ d(
|
|
2515
|
+
return /* @__PURE__ */ d(cl, { className: "w-full overflow-x-auto whitespace-nowrap", dir: r, ...s, children: [
|
|
2516
2516
|
/* @__PURE__ */ n("div", { className: x("flex w-max flex-nowrap items-center gap-2", e), children: t }),
|
|
2517
2517
|
/* @__PURE__ */ n(Ds, { className: "hidden", orientation: "horizontal" })
|
|
2518
2518
|
] });
|
|
2519
|
-
},
|
|
2519
|
+
}, ul = ({
|
|
2520
2520
|
suggestion: e,
|
|
2521
2521
|
onClick: t,
|
|
2522
2522
|
className: s,
|
|
@@ -2541,13 +2541,13 @@ const cl = ({ className: e, children: t, ...s }) => {
|
|
|
2541
2541
|
}
|
|
2542
2542
|
);
|
|
2543
2543
|
};
|
|
2544
|
-
function
|
|
2544
|
+
function ml({
|
|
2545
2545
|
suggestions: e,
|
|
2546
2546
|
disabled: t = !1,
|
|
2547
2547
|
onSelect: s,
|
|
2548
2548
|
className: r
|
|
2549
2549
|
}) {
|
|
2550
|
-
const { t: a } =
|
|
2550
|
+
const { t: a } = _("chat"), [o, i] = C(!1), l = async (c) => {
|
|
2551
2551
|
if (!(t || o || !s)) {
|
|
2552
2552
|
i(!0);
|
|
2553
2553
|
try {
|
|
@@ -2557,8 +2557,8 @@ function ul({
|
|
|
2557
2557
|
}
|
|
2558
2558
|
}
|
|
2559
2559
|
};
|
|
2560
|
-
return /* @__PURE__ */ n("div", { className: x("mx-auto w-full max-w-4xl py-2", r), children: /* @__PURE__ */ n(
|
|
2561
|
-
|
|
2560
|
+
return /* @__PURE__ */ n("div", { className: x("mx-auto w-full max-w-4xl py-2", r), children: /* @__PURE__ */ n(dl, { className: "pb-1", "aria-label": a("follow_up_suggestions"), children: e.map((c) => /* @__PURE__ */ n(
|
|
2561
|
+
ul,
|
|
2562
2562
|
{
|
|
2563
2563
|
suggestion: c,
|
|
2564
2564
|
onClick: (u) => {
|
|
@@ -2571,8 +2571,8 @@ function ul({
|
|
|
2571
2571
|
c
|
|
2572
2572
|
)) }) });
|
|
2573
2573
|
}
|
|
2574
|
-
function
|
|
2575
|
-
const { t: s, i18n: r } =
|
|
2574
|
+
function hl({ error: e, code: t }) {
|
|
2575
|
+
const { t: s, i18n: r } = _(["chat", "quota"]), a = K((c) => c.app.showToolDetails ?? !0), o = V().dir === "rtl", i = e.details, l = a && i && (t === "quota_exceeded" || i.limit !== void 0 || i.resets_at !== void 0);
|
|
2576
2576
|
return /* @__PURE__ */ d(
|
|
2577
2577
|
"div",
|
|
2578
2578
|
{
|
|
@@ -2603,13 +2603,13 @@ function ml({ error: e, code: t }) {
|
|
|
2603
2603
|
}
|
|
2604
2604
|
);
|
|
2605
2605
|
}
|
|
2606
|
-
function
|
|
2606
|
+
function fl({ ...e }) {
|
|
2607
2607
|
return /* @__PURE__ */ n(We.Root, { "data-slot": "hover-card", ...e });
|
|
2608
2608
|
}
|
|
2609
2609
|
function pl({ ...e }) {
|
|
2610
2610
|
return /* @__PURE__ */ n(We.Trigger, { "data-slot": "hover-card-trigger", ...e });
|
|
2611
2611
|
}
|
|
2612
|
-
function
|
|
2612
|
+
function gl({
|
|
2613
2613
|
className: e,
|
|
2614
2614
|
align: t = "center",
|
|
2615
2615
|
sideOffset: s = 4,
|
|
@@ -2631,7 +2631,7 @@ function fl({
|
|
|
2631
2631
|
) });
|
|
2632
2632
|
}
|
|
2633
2633
|
function xn({ label: e, remaining: t, amount: s }) {
|
|
2634
|
-
const { t: r, i18n: a } =
|
|
2634
|
+
const { t: r, i18n: a } = _(["quota"]), o = Lt(t, s);
|
|
2635
2635
|
return /* @__PURE__ */ d("div", { className: "space-y-1", children: [
|
|
2636
2636
|
/* @__PURE__ */ d("div", { className: "flex items-baseline justify-between gap-3", children: [
|
|
2637
2637
|
/* @__PURE__ */ n("span", { className: "truncate text-foreground/80", children: e }),
|
|
@@ -2646,18 +2646,18 @@ function xn({ label: e, remaining: t, amount: s }) {
|
|
|
2646
2646
|
) })
|
|
2647
2647
|
] });
|
|
2648
2648
|
}
|
|
2649
|
-
function
|
|
2650
|
-
const { t: s, i18n: r } =
|
|
2649
|
+
function bl({ className: e, details: t = !0 }) {
|
|
2650
|
+
const { t: s, i18n: r } = _(["quota"]), { data: a } = St(), [o, i] = C(!1), l = a?.kind === "plan" ? pa(a.windows) : null, c = l ? {
|
|
2651
2651
|
remaining: l.remaining,
|
|
2652
2652
|
amount: l.amount,
|
|
2653
|
-
label: `${Et(s, l.meter)} ${
|
|
2653
|
+
label: `${Et(s, l.meter)} ${mt(s, l)}`
|
|
2654
2654
|
} : a?.kind === "credits" && a.credits ? {
|
|
2655
2655
|
remaining: a.credits.remaining,
|
|
2656
2656
|
amount: a.credits.granted,
|
|
2657
2657
|
label: s("quota:credits")
|
|
2658
2658
|
} : null;
|
|
2659
2659
|
if (!a || !c) return null;
|
|
2660
|
-
const { remaining: u, amount:
|
|
2660
|
+
const { remaining: u, amount: f, label: m } = c, g = Lt(u, f), p = a.kind === "credits" ? s("quota:credits") : a.plan?.name ?? s("quota:plan"), h = Zn(g, r.language), N = u <= 0, v = x(
|
|
2661
2661
|
"flex items-center gap-2 h-8 ps-2.5 pe-3 rounded-full border text-xs font-medium tabular-nums transition-colors",
|
|
2662
2662
|
N ? "border-destructive/40 bg-destructive/10 text-destructive" : "border-border/60 bg-background/40 text-muted-foreground",
|
|
2663
2663
|
e
|
|
@@ -2667,12 +2667,12 @@ function gl({ className: e, details: t = !0 }) {
|
|
|
2667
2667
|
{
|
|
2668
2668
|
className: x(
|
|
2669
2669
|
"block h-2 w-8 md:w-12 rounded-full border overflow-hidden bg-muted/40 transition-colors duration-700",
|
|
2670
|
-
|
|
2670
|
+
ga(g)
|
|
2671
2671
|
),
|
|
2672
2672
|
role: "meter",
|
|
2673
2673
|
"aria-label": s("quota:usage_label", { label: m, percent: h }),
|
|
2674
2674
|
"aria-valuemin": 0,
|
|
2675
|
-
"aria-valuemax":
|
|
2675
|
+
"aria-valuemax": f,
|
|
2676
2676
|
"aria-valuenow": u,
|
|
2677
2677
|
children: /* @__PURE__ */ n(
|
|
2678
2678
|
"span",
|
|
@@ -2685,7 +2685,7 @@ function gl({ className: e, details: t = !0 }) {
|
|
|
2685
2685
|
),
|
|
2686
2686
|
/* @__PURE__ */ n("span", { "aria-hidden": !0, children: h })
|
|
2687
2687
|
] });
|
|
2688
|
-
return t ? /* @__PURE__ */ d(
|
|
2688
|
+
return t ? /* @__PURE__ */ d(fl, { open: o, onOpenChange: i, openDelay: 150, closeDelay: 100, children: [
|
|
2689
2689
|
/* @__PURE__ */ n(pl, { asChild: !0, children: /* @__PURE__ */ n(
|
|
2690
2690
|
"button",
|
|
2691
2691
|
{
|
|
@@ -2698,15 +2698,15 @@ function gl({ className: e, details: t = !0 }) {
|
|
|
2698
2698
|
children: y
|
|
2699
2699
|
}
|
|
2700
2700
|
) }),
|
|
2701
|
-
/* @__PURE__ */ d(
|
|
2701
|
+
/* @__PURE__ */ d(gl, { align: "end", sideOffset: 6, className: "w-64 p-3 text-xs space-y-3", children: [
|
|
2702
2702
|
/* @__PURE__ */ d("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
2703
|
-
/* @__PURE__ */ n("span", { className: "font-semibold text-foreground truncate", children:
|
|
2703
|
+
/* @__PURE__ */ n("span", { className: "font-semibold text-foreground truncate", children: p }),
|
|
2704
2704
|
a.ends_at && /* @__PURE__ */ n("span", { className: "shrink-0 text-xs text-muted-foreground", children: s("quota:ends_at", { datetime: Ot(a.ends_at, r.language) }) })
|
|
2705
2705
|
] }),
|
|
2706
2706
|
a.kind === "plan" ? a.windows.map((b) => /* @__PURE__ */ n(
|
|
2707
2707
|
xn,
|
|
2708
2708
|
{
|
|
2709
|
-
label:
|
|
2709
|
+
label: mt(s, b),
|
|
2710
2710
|
amount: b.amount,
|
|
2711
2711
|
remaining: b.remaining
|
|
2712
2712
|
},
|
|
@@ -2715,8 +2715,8 @@ function gl({ className: e, details: t = !0 }) {
|
|
|
2715
2715
|
] })
|
|
2716
2716
|
] }) : /* @__PURE__ */ n("div", { className: v, children: y });
|
|
2717
2717
|
}
|
|
2718
|
-
function
|
|
2719
|
-
const { t: r } =
|
|
2718
|
+
function xl({ title: e, message: t, endsAt: s }) {
|
|
2719
|
+
const { t: r } = _(["maintenance"]);
|
|
2720
2720
|
return /* @__PURE__ */ n(
|
|
2721
2721
|
"div",
|
|
2722
2722
|
{
|
|
@@ -2739,8 +2739,8 @@ function bl({ title: e, message: t, endsAt: s }) {
|
|
|
2739
2739
|
}
|
|
2740
2740
|
);
|
|
2741
2741
|
}
|
|
2742
|
-
function
|
|
2743
|
-
const { t: a } =
|
|
2742
|
+
function vl({ title: e, message: t, endsAt: s, refresh: r }) {
|
|
2743
|
+
const { t: a } = _(["maintenance"]);
|
|
2744
2744
|
return /* @__PURE__ */ n(
|
|
2745
2745
|
"div",
|
|
2746
2746
|
{
|
|
@@ -2766,10 +2766,10 @@ const vn = (e) => {
|
|
|
2766
2766
|
const t = Object.values(e).filter((s) => ["string", "number", "boolean"].includes(typeof s)).slice(0, 3).map(String);
|
|
2767
2767
|
return t.length > 0 ? t.join(" · ") : null;
|
|
2768
2768
|
};
|
|
2769
|
-
function
|
|
2770
|
-
return typeof e.output == "string" ? e.output : vn(e.output) ?? vn(e.input) ??
|
|
2769
|
+
function yl(e) {
|
|
2770
|
+
return typeof e.output == "string" ? e.output : vn(e.output) ?? vn(e.input) ?? tt(e);
|
|
2771
2771
|
}
|
|
2772
|
-
function
|
|
2772
|
+
function wl({
|
|
2773
2773
|
part: e,
|
|
2774
2774
|
index: t,
|
|
2775
2775
|
component: s
|
|
@@ -2778,23 +2778,23 @@ function yl({
|
|
|
2778
2778
|
return (
|
|
2779
2779
|
// resetKeys: a streamed part can be malformed for a token and valid on the next. Without it
|
|
2780
2780
|
// the boundary would latch for good, since the part's key never changes.
|
|
2781
|
-
/* @__PURE__ */ n(ge, { resetKeys: [e], children:
|
|
2781
|
+
/* @__PURE__ */ n(ge, { resetKeys: [e], children: nt(e) || e.type === "file" ? /* @__PURE__ */ n(Nl, { part: e, index: t, children: r }) : r })
|
|
2782
2782
|
);
|
|
2783
2783
|
}
|
|
2784
|
-
function
|
|
2784
|
+
function Nl({
|
|
2785
2785
|
part: e,
|
|
2786
2786
|
index: t,
|
|
2787
2787
|
children: s
|
|
2788
2788
|
}) {
|
|
2789
2789
|
const r = W((l) => l.message), { referenceAdapters: a } = X(), o = { messageId: r.id, partIndex: t, role: r.role, data: e };
|
|
2790
2790
|
let i;
|
|
2791
|
-
if (
|
|
2792
|
-
const l =
|
|
2791
|
+
if (nt(e)) {
|
|
2792
|
+
const l = tt(e), c = {
|
|
2793
2793
|
...o,
|
|
2794
2794
|
kind: "tool",
|
|
2795
2795
|
sourceId: `${r.id}-${t}-tool`,
|
|
2796
2796
|
label: l,
|
|
2797
|
-
excerpt:
|
|
2797
|
+
excerpt: yl(e)
|
|
2798
2798
|
}, u = a?.[l]?.({ part: e, message: r, toolName: l }) || {};
|
|
2799
2799
|
i = {
|
|
2800
2800
|
...c,
|
|
@@ -2818,35 +2818,35 @@ function wl({
|
|
|
2818
2818
|
return /* @__PURE__ */ n(gs, { reference: i, children: s });
|
|
2819
2819
|
}
|
|
2820
2820
|
const yn = /* @__PURE__ */ new WeakMap();
|
|
2821
|
-
function
|
|
2821
|
+
function kl(e) {
|
|
2822
2822
|
let t = yn.get(e);
|
|
2823
2823
|
if (!t) {
|
|
2824
2824
|
const s = e;
|
|
2825
|
-
t = ({ part: a, index: o }) =>
|
|
2825
|
+
t = ({ part: a, index: o }) => Jr(wl, { part: a, index: o, component: s }), yn.set(e, t);
|
|
2826
2826
|
}
|
|
2827
2827
|
return t;
|
|
2828
2828
|
}
|
|
2829
2829
|
function Os(e) {
|
|
2830
2830
|
const t = {};
|
|
2831
2831
|
for (const [s, r] of Object.entries(e))
|
|
2832
|
-
t[s] = r &&
|
|
2832
|
+
t[s] = r && kl(r);
|
|
2833
2833
|
return t;
|
|
2834
2834
|
}
|
|
2835
|
-
Object.assign(
|
|
2836
|
-
MessageList:
|
|
2837
|
-
MessageActions:
|
|
2838
|
-
PromptInput:
|
|
2839
|
-
WelcomeScreen:
|
|
2835
|
+
Object.assign(va, {
|
|
2836
|
+
MessageList: Ai,
|
|
2837
|
+
MessageActions: Oi,
|
|
2838
|
+
PromptInput: al,
|
|
2839
|
+
WelcomeScreen: il,
|
|
2840
2840
|
parts: Ms,
|
|
2841
|
-
ChoiceQuestionPart:
|
|
2842
|
-
ChoiceQuestionDock:
|
|
2843
|
-
FollowUpSuggestions:
|
|
2844
|
-
ChatError:
|
|
2845
|
-
UsageMeter:
|
|
2846
|
-
MaintenanceBanner:
|
|
2847
|
-
MaintenanceScreen:
|
|
2841
|
+
ChoiceQuestionPart: hi,
|
|
2842
|
+
ChoiceQuestionDock: ll,
|
|
2843
|
+
FollowUpSuggestions: ml,
|
|
2844
|
+
ChatError: hl,
|
|
2845
|
+
UsageMeter: bl,
|
|
2846
|
+
MaintenanceBanner: xl,
|
|
2847
|
+
MaintenanceScreen: vl
|
|
2848
2848
|
});
|
|
2849
|
-
const
|
|
2849
|
+
const _l = kt(Ft({}, null));
|
|
2850
2850
|
function Kt({
|
|
2851
2851
|
components: e,
|
|
2852
2852
|
children: t,
|
|
@@ -2857,9 +2857,9 @@ function Kt({
|
|
|
2857
2857
|
disclaimer: i,
|
|
2858
2858
|
settings: l
|
|
2859
2859
|
}) {
|
|
2860
|
-
const c =
|
|
2860
|
+
const c = Ce(ht) ?? _l, u = jn(c, (v) => v.configured), f = X(), m = qe(), g = O(
|
|
2861
2861
|
() => Ft(
|
|
2862
|
-
|
|
2862
|
+
Xa(u, {
|
|
2863
2863
|
history: s,
|
|
2864
2864
|
welcome: r,
|
|
2865
2865
|
threadActions: a,
|
|
@@ -2870,22 +2870,22 @@ function Kt({
|
|
|
2870
2870
|
m
|
|
2871
2871
|
),
|
|
2872
2872
|
[u, m, s, r, a, o, i, l]
|
|
2873
|
-
), [
|
|
2874
|
-
qn(() =>
|
|
2875
|
-
const h = O(() =>
|
|
2876
|
-
return /* @__PURE__ */ n(
|
|
2873
|
+
), [p] = C(() => kt(g));
|
|
2874
|
+
qn(() => p.setState(g), [p, g]);
|
|
2875
|
+
const h = O(() => ba(f, e), [f, e]), N = O(() => Os(h.parts), [h.parts]);
|
|
2876
|
+
return /* @__PURE__ */ n(xa.Provider, { value: h, children: /* @__PURE__ */ n(ht.Provider, { value: p, children: /* @__PURE__ */ n(le.PartsProvider, { components: N, children: t }) }) });
|
|
2877
2877
|
}
|
|
2878
|
-
const
|
|
2878
|
+
const Sl = {
|
|
2879
2879
|
top: "max(0.5rem, calc(var(--gentiq-selection-top) - 2.625rem))",
|
|
2880
2880
|
left: "calc(var(--gentiq-selection-left) + var(--gentiq-selection-width) / 2)"
|
|
2881
2881
|
};
|
|
2882
|
-
function
|
|
2883
|
-
const { t: e } =
|
|
2884
|
-
return t ?
|
|
2882
|
+
function Cl() {
|
|
2883
|
+
const { t: e } = _(["chat"]), t = Jn();
|
|
2884
|
+
return t ? Qa(
|
|
2885
2885
|
/* @__PURE__ */ n(
|
|
2886
|
-
|
|
2886
|
+
De.SelectionQuote,
|
|
2887
2887
|
{
|
|
2888
|
-
style:
|
|
2888
|
+
style: Sl,
|
|
2889
2889
|
className: "fixed z-50 flex size-9 -translate-x-1/2 items-center justify-center rounded-lg bg-background text-foreground shadow-lg ring-1 ring-border/60 transition hover:bg-muted",
|
|
2890
2890
|
"aria-label": e("reference_selection"),
|
|
2891
2891
|
title: e("reference_selection"),
|
|
@@ -2895,12 +2895,12 @@ function Sl() {
|
|
|
2895
2895
|
t
|
|
2896
2896
|
) : null;
|
|
2897
2897
|
}
|
|
2898
|
-
function
|
|
2898
|
+
function zl(e, t) {
|
|
2899
2899
|
if (typeof e != "object" || e === null) return e || void 0;
|
|
2900
2900
|
const s = t.split("-")[0];
|
|
2901
2901
|
return e[t] || e[s] || e.en || Object.values(e)[0];
|
|
2902
2902
|
}
|
|
2903
|
-
function
|
|
2903
|
+
function Il({
|
|
2904
2904
|
accent: e,
|
|
2905
2905
|
radius: t,
|
|
2906
2906
|
fontFamily: s,
|
|
@@ -2914,7 +2914,7 @@ function zl({
|
|
|
2914
2914
|
return a;
|
|
2915
2915
|
}
|
|
2916
2916
|
const ue = $n(function({ className: t, style: s, children: r, ...a }, o) {
|
|
2917
|
-
const { resolvedTheme: i, accent: l, radius: c } =
|
|
2917
|
+
const { resolvedTheme: i, accent: l, radius: c } = ze(), { language: u, dir: f } = V(), m = K((N) => N.theme.typography?.fontFamily), g = K((N) => N.theme.userBubbleAccent), [p, h] = C(null);
|
|
2918
2918
|
return /* @__PURE__ */ d(
|
|
2919
2919
|
"div",
|
|
2920
2920
|
{
|
|
@@ -2922,61 +2922,61 @@ const ue = $n(function({ className: t, style: s, children: r, ...a }, o) {
|
|
|
2922
2922
|
...a,
|
|
2923
2923
|
className: x("gentiq", i, t),
|
|
2924
2924
|
lang: u,
|
|
2925
|
-
dir:
|
|
2925
|
+
dir: f,
|
|
2926
2926
|
style: {
|
|
2927
|
-
...
|
|
2927
|
+
...Il({
|
|
2928
2928
|
accent: l,
|
|
2929
2929
|
radius: c,
|
|
2930
|
-
fontFamily:
|
|
2930
|
+
fontFamily: zl(m, u),
|
|
2931
2931
|
userBubbleAccent: g
|
|
2932
2932
|
}),
|
|
2933
2933
|
...s
|
|
2934
2934
|
},
|
|
2935
2935
|
children: [
|
|
2936
|
-
/* @__PURE__ */ n(
|
|
2936
|
+
/* @__PURE__ */ n(ya.Provider, { value: p, children: r }),
|
|
2937
2937
|
/* @__PURE__ */ n("div", { ref: h, "data-gentiq-portal": "", className: "contents" })
|
|
2938
2938
|
]
|
|
2939
2939
|
}
|
|
2940
2940
|
);
|
|
2941
2941
|
});
|
|
2942
|
-
function
|
|
2943
|
-
const { t, i18n: s } =
|
|
2942
|
+
function Tl({ classNames: e = {} }) {
|
|
2943
|
+
const { t, i18n: s } = _(["chat"]), { threadId: r, messages: a, status: o, send: i, addToolOutput: l } = oa(), c = r === null && a.length === 0 && o !== "submitted", [u, f] = C({
|
|
2944
2944
|
wasNew: c,
|
|
2945
2945
|
threadId: r,
|
|
2946
2946
|
reveal: !1,
|
|
2947
2947
|
sent: !1
|
|
2948
2948
|
}), m = de(
|
|
2949
|
-
(q) => (c &&
|
|
2949
|
+
(q) => (c && f((Q) => Q.sent ? Q : { ...Q, sent: !0 }), i(q)),
|
|
2950
2950
|
[c, i]
|
|
2951
2951
|
), g = de((q) => {
|
|
2952
2952
|
m({ text: q });
|
|
2953
|
-
}, [m]), { MessageList:
|
|
2954
|
-
u.wasNew !== c || u.threadId !== r ?
|
|
2953
|
+
}, [m]), { MessageList: p, PromptInput: h, WelcomeScreen: N } = X(), { composer: v, disclaimer: y } = Y((q) => q), b = K((q) => q.app), I = s.exists("chat:disclaimer") ? t("chat:disclaimer") : null, k = typeof y == "string" ? Ne(y, t, s, ["chat"]) : y ?? I, z = a[a.length - 1], T = z?.role === "assistant" && (o === "ready" || z.parts.some((q) => q.type === "data-chat-finished")), P = o === "error";
|
|
2954
|
+
u.wasNew !== c || u.threadId !== r ? f({
|
|
2955
2955
|
wasNew: c,
|
|
2956
2956
|
threadId: r,
|
|
2957
2957
|
reveal: u.wasNew && !c && !u.sent && o !== "submitted",
|
|
2958
2958
|
sent: !1
|
|
2959
|
-
}) : u.reveal && o === "submitted" &&
|
|
2960
|
-
const A = u.reveal, M = O(() =>
|
|
2959
|
+
}) : u.reveal && o === "submitted" && f((q) => ({ ...q, reveal: !1 }));
|
|
2960
|
+
const A = u.reveal, M = O(() => Le(h), [h]), [L, j] = Ka(), H = O(
|
|
2961
2961
|
() => j ? { "--gentiq-composer-inset": `${j}px` } : void 0,
|
|
2962
2962
|
[j]
|
|
2963
2963
|
);
|
|
2964
2964
|
return /* @__PURE__ */ d(
|
|
2965
|
-
|
|
2965
|
+
De.Root,
|
|
2966
2966
|
{
|
|
2967
2967
|
enabled: v?.references?.enabled ?? !0,
|
|
2968
2968
|
maxItems: v?.references?.maxItems,
|
|
2969
2969
|
maxExcerptLength: v?.references?.maxExcerptLength,
|
|
2970
2970
|
children: [
|
|
2971
2971
|
/* @__PURE__ */ n(
|
|
2972
|
-
|
|
2972
|
+
gi,
|
|
2973
2973
|
{
|
|
2974
2974
|
message: z,
|
|
2975
2975
|
disabled: !T || o !== "ready",
|
|
2976
2976
|
cacheNamespace: b.cacheNamespace,
|
|
2977
2977
|
onAnswer: l,
|
|
2978
2978
|
children: /* @__PURE__ */ d(
|
|
2979
|
-
|
|
2979
|
+
Oe.Root,
|
|
2980
2980
|
{
|
|
2981
2981
|
className: x(
|
|
2982
2982
|
"relative flex flex-col h-full overflow-hidden bg-background",
|
|
@@ -3001,7 +3001,7 @@ function Il({ classNames: e = {} }) {
|
|
|
3001
3001
|
"flex-1 min-h-0 flex flex-col",
|
|
3002
3002
|
A && "animate-thread-reveal"
|
|
3003
3003
|
),
|
|
3004
|
-
children: /* @__PURE__ */ n(ge, { children: /* @__PURE__ */ n(
|
|
3004
|
+
children: /* @__PURE__ */ n(ge, { children: /* @__PURE__ */ n(p, { className: x("flex-1", e.messageList) }) })
|
|
3005
3005
|
}
|
|
3006
3006
|
),
|
|
3007
3007
|
/* @__PURE__ */ d("div", { className: "absolute inset-0 z-10 pointer-events-none flex flex-col", children: [
|
|
@@ -3028,11 +3028,11 @@ function Il({ classNames: e = {} }) {
|
|
|
3028
3028
|
className: x(
|
|
3029
3029
|
"relative z-10 pointer-events-auto",
|
|
3030
3030
|
e.inputArea,
|
|
3031
|
-
|
|
3031
|
+
k && "pb-0 md:pb-0"
|
|
3032
3032
|
)
|
|
3033
3033
|
}
|
|
3034
3034
|
),
|
|
3035
|
-
|
|
3035
|
+
k && /* @__PURE__ */ n("div", { className: "relative z-10 py-1.5 px-4 flex justify-center items-center pointer-events-auto", children: /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground select-none text-center leading-tight", children: k }) })
|
|
3036
3036
|
] }),
|
|
3037
3037
|
/* @__PURE__ */ n(
|
|
3038
3038
|
"div",
|
|
@@ -3049,12 +3049,12 @@ function Il({ classNames: e = {} }) {
|
|
|
3049
3049
|
)
|
|
3050
3050
|
}
|
|
3051
3051
|
),
|
|
3052
|
-
/* @__PURE__ */ n(
|
|
3052
|
+
/* @__PURE__ */ n(Cl, {})
|
|
3053
3053
|
]
|
|
3054
3054
|
}
|
|
3055
3055
|
);
|
|
3056
3056
|
}
|
|
3057
|
-
const
|
|
3057
|
+
const Ml = ({
|
|
3058
3058
|
threadId: e,
|
|
3059
3059
|
onThreadChange: t,
|
|
3060
3060
|
components: s,
|
|
@@ -3072,7 +3072,7 @@ const Tl = ({
|
|
|
3072
3072
|
threadActions: a,
|
|
3073
3073
|
composer: o,
|
|
3074
3074
|
disclaimer: i,
|
|
3075
|
-
children: /* @__PURE__ */ n(
|
|
3075
|
+
children: /* @__PURE__ */ n(Tl, { ...l })
|
|
3076
3076
|
}
|
|
3077
3077
|
) });
|
|
3078
3078
|
return c && e === void 0 && t === void 0 ? u : /* @__PURE__ */ n(
|
|
@@ -3085,11 +3085,11 @@ const Tl = ({
|
|
|
3085
3085
|
}
|
|
3086
3086
|
);
|
|
3087
3087
|
};
|
|
3088
|
-
function
|
|
3088
|
+
function Pl() {
|
|
3089
3089
|
return /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n("div", { className: "min-h-dvh bg-background" }) });
|
|
3090
3090
|
}
|
|
3091
|
-
const
|
|
3092
|
-
|
|
3091
|
+
const Rl = ({ theme: e = "system", ...t }) => /* @__PURE__ */ n(
|
|
3092
|
+
Aa,
|
|
3093
3093
|
{
|
|
3094
3094
|
theme: e,
|
|
3095
3095
|
className: "toaster group",
|
|
@@ -3098,7 +3098,7 @@ const Pl = ({ theme: e = "system", ...t }) => /* @__PURE__ */ n(
|
|
|
3098
3098
|
info: /* @__PURE__ */ n(Tr, { className: "size-4" }),
|
|
3099
3099
|
warning: /* @__PURE__ */ n(Ir, { className: "size-4" }),
|
|
3100
3100
|
error: /* @__PURE__ */ n(zr, { className: "size-4" }),
|
|
3101
|
-
loading: /* @__PURE__ */ n(
|
|
3101
|
+
loading: /* @__PURE__ */ n(wt, { className: "size-4 animate-spin" })
|
|
3102
3102
|
},
|
|
3103
3103
|
style: {
|
|
3104
3104
|
"--normal-bg": "var(--gentiq-popover)",
|
|
@@ -3110,33 +3110,33 @@ const Pl = ({ theme: e = "system", ...t }) => /* @__PURE__ */ n(
|
|
|
3110
3110
|
...t
|
|
3111
3111
|
}
|
|
3112
3112
|
);
|
|
3113
|
-
function
|
|
3114
|
-
const { resolvedTheme: e } =
|
|
3115
|
-
return /* @__PURE__ */ n(
|
|
3113
|
+
function Al() {
|
|
3114
|
+
const { resolvedTheme: e } = ze();
|
|
3115
|
+
return /* @__PURE__ */ n(Rl, { richColors: !0, theme: e });
|
|
3116
3116
|
}
|
|
3117
|
-
const
|
|
3117
|
+
const Dl = Os(Ms), Ol = ({ message: e }) => {
|
|
3118
3118
|
B.error(e);
|
|
3119
3119
|
};
|
|
3120
|
-
function
|
|
3120
|
+
function El({
|
|
3121
3121
|
toaster: e = !0,
|
|
3122
3122
|
fallback: t,
|
|
3123
|
-
onConfigUnavailable: s =
|
|
3123
|
+
onConfigUnavailable: s = Ol,
|
|
3124
3124
|
children: r,
|
|
3125
3125
|
...a
|
|
3126
3126
|
}) {
|
|
3127
3127
|
return /* @__PURE__ */ n(
|
|
3128
|
-
|
|
3128
|
+
ia,
|
|
3129
3129
|
{
|
|
3130
3130
|
...a,
|
|
3131
|
-
fallback: t ?? /* @__PURE__ */ n(
|
|
3131
|
+
fallback: t ?? /* @__PURE__ */ n(Pl, {}),
|
|
3132
3132
|
onConfigUnavailable: s,
|
|
3133
|
-
overlay: e && /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(
|
|
3134
|
-
children: /* @__PURE__ */ n(le.PartsProvider, { components:
|
|
3133
|
+
overlay: e && /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(Al, {}) }),
|
|
3134
|
+
children: /* @__PURE__ */ n(le.PartsProvider, { components: Dl, children: r })
|
|
3135
3135
|
}
|
|
3136
3136
|
);
|
|
3137
3137
|
}
|
|
3138
|
-
function
|
|
3139
|
-
const { language: e, dir: t } = V(), { resolvedTheme: s } =
|
|
3138
|
+
function Ll() {
|
|
3139
|
+
const { language: e, dir: t } = V(), { resolvedTheme: s } = ze(), r = K((o) => o.app.name), a = K((o) => o.app.favicon);
|
|
3140
3140
|
return D(() => {
|
|
3141
3141
|
const o = document.documentElement, i = { lang: o.lang, dir: o.dir };
|
|
3142
3142
|
return o.lang = e, o.dir = t, () => {
|
|
@@ -3161,8 +3161,8 @@ function El() {
|
|
|
3161
3161
|
};
|
|
3162
3162
|
}, [a]), null;
|
|
3163
3163
|
}
|
|
3164
|
-
function
|
|
3165
|
-
const a =
|
|
3164
|
+
function ql({ children: e, fallback: t, loginCode: s, onLoginCodeUsed: r }) {
|
|
3165
|
+
const a = la(), [o, i] = C(
|
|
3166
3166
|
() => s ? "pending" : "idle"
|
|
3167
3167
|
);
|
|
3168
3168
|
D(() => {
|
|
@@ -3171,9 +3171,9 @@ function Ll({ children: e, fallback: t, loginCode: s, onLoginCodeUsed: r }) {
|
|
|
3171
3171
|
return i("pending"), (async () => {
|
|
3172
3172
|
try {
|
|
3173
3173
|
await a(s);
|
|
3174
|
-
} catch (
|
|
3174
|
+
} catch (f) {
|
|
3175
3175
|
if (u) return;
|
|
3176
|
-
console.error("Could not sign in with the login code:",
|
|
3176
|
+
console.error("Could not sign in with the login code:", f), i("failed");
|
|
3177
3177
|
return;
|
|
3178
3178
|
}
|
|
3179
3179
|
u || (r?.(), i("idle"));
|
|
@@ -3181,7 +3181,7 @@ function Ll({ children: e, fallback: t, loginCode: s, onLoginCodeUsed: r }) {
|
|
|
3181
3181
|
u = !0;
|
|
3182
3182
|
};
|
|
3183
3183
|
}, [s]);
|
|
3184
|
-
const l =
|
|
3184
|
+
const l = ca({ enabled: o === "idle" }), c = o === "failed" ? "handoff_failed" : o === "idle" && (l === "signed_out" || l === "session_expired") ? l : null;
|
|
3185
3185
|
return c ? /* @__PURE__ */ n($, { children: typeof t == "function" ? t(c) : t }) : o === "pending" || l === "checking" ? /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n("div", { className: "flex h-screen w-full items-center justify-center bg-background", children: /* @__PURE__ */ n("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) }) : /* @__PURE__ */ n($, { children: e });
|
|
3186
3186
|
}
|
|
3187
3187
|
function Es({
|
|
@@ -3193,7 +3193,7 @@ function Es({
|
|
|
3193
3193
|
resetsAt: o,
|
|
3194
3194
|
action: i
|
|
3195
3195
|
}) {
|
|
3196
|
-
const { t: l, i18n: c } =
|
|
3196
|
+
const { t: l, i18n: c } = _(["quota"]), u = Lt(r, a);
|
|
3197
3197
|
return /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
|
|
3198
3198
|
/* @__PURE__ */ d("div", { className: "flex items-baseline justify-between gap-3 text-sm", children: [
|
|
3199
3199
|
/* @__PURE__ */ d("span", { className: "font-medium text-foreground/80", children: [
|
|
@@ -3233,13 +3233,13 @@ function Es({
|
|
|
3233
3233
|
o && /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground", children: l("quota:resets_at", { datetime: Ot(o, c.language) }) })
|
|
3234
3234
|
] });
|
|
3235
3235
|
}
|
|
3236
|
-
function
|
|
3237
|
-
const { t: r } =
|
|
3236
|
+
function $l({ windows: e, className: t, renderAction: s }) {
|
|
3237
|
+
const { t: r } = _(["quota"]);
|
|
3238
3238
|
return /* @__PURE__ */ n("div", { className: x("space-y-4", t), children: e.map((a) => /* @__PURE__ */ n(
|
|
3239
3239
|
Es,
|
|
3240
3240
|
{
|
|
3241
3241
|
label: Et(r, a.meter),
|
|
3242
|
-
detail:
|
|
3242
|
+
detail: mt(r, a),
|
|
3243
3243
|
meter: a.meter,
|
|
3244
3244
|
remaining: a.remaining,
|
|
3245
3245
|
amount: a.amount,
|
|
@@ -3249,8 +3249,8 @@ function ql({ windows: e, className: t, renderAction: s }) {
|
|
|
3249
3249
|
a.key
|
|
3250
3250
|
)) });
|
|
3251
3251
|
}
|
|
3252
|
-
function
|
|
3253
|
-
const { t: s } =
|
|
3252
|
+
function jl({ credits: e, action: t }) {
|
|
3253
|
+
const { t: s } = _(["quota"]);
|
|
3254
3254
|
return /* @__PURE__ */ n(
|
|
3255
3255
|
Es,
|
|
3256
3256
|
{
|
|
@@ -3263,54 +3263,55 @@ function $l({ credits: e, action: t }) {
|
|
|
3263
3263
|
}
|
|
3264
3264
|
);
|
|
3265
3265
|
}
|
|
3266
|
-
const
|
|
3267
|
-
function
|
|
3268
|
-
return
|
|
3266
|
+
const Fl = ["system", "light", "dark"], Ls = Ee(null);
|
|
3267
|
+
function Ie() {
|
|
3268
|
+
return Ce(Ls);
|
|
3269
3269
|
}
|
|
3270
|
-
function
|
|
3270
|
+
function ke(e, t) {
|
|
3271
3271
|
const s = e?.sections?.[t];
|
|
3272
3272
|
return s?.mode ?? (s?.enabled === !1 ? "hidden" : "editable");
|
|
3273
3273
|
}
|
|
3274
|
-
function
|
|
3274
|
+
function Z(e, t, s, r = "editable") {
|
|
3275
3275
|
return e?.sections?.[t]?.fields?.[s] || r;
|
|
3276
3276
|
}
|
|
3277
3277
|
function qs() {
|
|
3278
|
-
const { t: e } =
|
|
3278
|
+
const { t: e } = _("settings"), { data: t } = Un(), s = qe(), { data: r } = St({
|
|
3279
3279
|
enabled: !!s?.plugins?.includes("billing")
|
|
3280
3280
|
}), a = [t?.name, t?.surname].filter(Boolean).join(" ").trim() || t?.username || t?.email || t?.phone || "", o = (a[0] ?? "U").toUpperCase(), i = r?.kind === "plan" ? r.plan?.name ?? e("account.custom_plan") : r?.kind === "credits" ? e("account.on_credits") : null, l = i ?? (t?.username ? `@${t.username}` : t?.email || "");
|
|
3281
3281
|
return { displayName: a, initial: o, planLabel: i, handleOrPlan: l };
|
|
3282
3282
|
}
|
|
3283
3283
|
function Xt() {
|
|
3284
|
-
const { t: e, i18n: t } =
|
|
3284
|
+
const { t: e, i18n: t } = _("settings"), s = Y((o) => o.settings), { locked: r } = ze(), { locked: a } = V();
|
|
3285
3285
|
return O(() => {
|
|
3286
3286
|
const o = e("sections.account"), i = e("sections.general"), l = [
|
|
3287
3287
|
["profile", o, Pr],
|
|
3288
3288
|
["general", i, Pn],
|
|
3289
|
-
["account", o, Rr]
|
|
3290
|
-
|
|
3289
|
+
["account", o, Rr],
|
|
3290
|
+
["feedback", i, Ar]
|
|
3291
|
+
].filter(([m]) => ke(s, m) === "hidden" ? !1 : m !== "general" || !r && Z(s, "general", "theme") !== "hidden" || !a && Z(s, "general", "language") !== "hidden").map(([m, g, p]) => ({
|
|
3291
3292
|
id: m,
|
|
3292
3293
|
label: e(`sections.${m}`),
|
|
3293
3294
|
title: e(`${m}.title`),
|
|
3294
3295
|
subtitle: e(`${m}.subtitle`),
|
|
3295
3296
|
group: g,
|
|
3296
|
-
icon:
|
|
3297
|
-
faded: m !== "general" &&
|
|
3297
|
+
icon: p,
|
|
3298
|
+
faded: m !== "general" && ke(s, m) === "faded"
|
|
3298
3299
|
})), c = (s?.customSections ?? []).map((m) => {
|
|
3299
|
-
const g = Ne(m.label, e, t, ["settings"]),
|
|
3300
|
+
const g = Ne(m.label, e, t, ["settings"]), p = m.group === "account" ? o : !m.group || m.group === "general" ? i : Ne(m.group, e, t, ["settings"]);
|
|
3300
3301
|
return {
|
|
3301
3302
|
id: m.id,
|
|
3302
3303
|
label: g,
|
|
3303
3304
|
title: g,
|
|
3304
3305
|
subtitle: m.subtitle ? Ne(m.subtitle, e, t, ["settings"]) : void 0,
|
|
3305
|
-
group:
|
|
3306
|
+
group: p,
|
|
3306
3307
|
icon: m.icon ?? Re,
|
|
3307
3308
|
showInMenu: m.showInMenu,
|
|
3308
3309
|
component: m.component
|
|
3309
3310
|
};
|
|
3310
|
-
}), u = [...l, ...c],
|
|
3311
|
+
}), u = [...l, ...c], f = /* @__PURE__ */ new Map();
|
|
3311
3312
|
for (const m of u)
|
|
3312
|
-
|
|
3313
|
-
return { sections: u, groups: Array.from(
|
|
3313
|
+
f.set(m.group, [...f.get(m.group) ?? [], m]);
|
|
3314
|
+
return { sections: u, groups: Array.from(f, ([m, g]) => ({ title: m, items: g })) };
|
|
3314
3315
|
}, [e, t, s, r, a]);
|
|
3315
3316
|
}
|
|
3316
3317
|
function $s(e, t) {
|
|
@@ -3321,7 +3322,7 @@ function $s(e, t) {
|
|
|
3321
3322
|
return r ? s : null;
|
|
3322
3323
|
}
|
|
3323
3324
|
function js(e = "editable", t = "editable", s = "editable") {
|
|
3324
|
-
const { t: r, i18n: a } =
|
|
3325
|
+
const { t: r, i18n: a } = _("settings"), o = K((v) => v.app), { theme: i, setTheme: l, locked: c } = ze(), { language: u, setLanguage: f, locked: m, dir: g } = V(), p = $a(a, o?.languages), h = p.find((v) => v === u) ?? u.split("-")[0];
|
|
3325
3326
|
return { rows: [
|
|
3326
3327
|
!c && t !== "hidden" && {
|
|
3327
3328
|
key: "theme",
|
|
@@ -3330,7 +3331,7 @@ function js(e = "editable", t = "editable", s = "editable") {
|
|
|
3330
3331
|
value: i,
|
|
3331
3332
|
disabled: e === "faded" || t === "faded",
|
|
3332
3333
|
onChange: (v) => l(v),
|
|
3333
|
-
options:
|
|
3334
|
+
options: Fl.map((v) => ({
|
|
3334
3335
|
value: v,
|
|
3335
3336
|
label: r(`general.themes.${v}`),
|
|
3336
3337
|
lang: void 0
|
|
@@ -3338,36 +3339,36 @@ function js(e = "editable", t = "editable", s = "editable") {
|
|
|
3338
3339
|
},
|
|
3339
3340
|
!m && s !== "hidden" && {
|
|
3340
3341
|
key: "lang",
|
|
3341
|
-
icon:
|
|
3342
|
+
icon: Dr,
|
|
3342
3343
|
label: r("general.language"),
|
|
3343
3344
|
value: h,
|
|
3344
3345
|
disabled: e === "faded" || s === "faded",
|
|
3345
|
-
onChange:
|
|
3346
|
-
options:
|
|
3346
|
+
onChange: f,
|
|
3347
|
+
options: p.map((v) => ({
|
|
3347
3348
|
value: v,
|
|
3348
|
-
label:
|
|
3349
|
+
label: ja(v),
|
|
3349
3350
|
lang: v
|
|
3350
3351
|
}))
|
|
3351
3352
|
}
|
|
3352
3353
|
].filter((v) => e !== "hidden" && !!v), dir: g };
|
|
3353
3354
|
}
|
|
3354
|
-
function
|
|
3355
|
+
function Ul({
|
|
3355
3356
|
sectionMode: e = "editable",
|
|
3356
3357
|
themeMode: t = "editable",
|
|
3357
3358
|
languageMode: s = "editable"
|
|
3358
3359
|
} = {}) {
|
|
3359
|
-
const r =
|
|
3360
|
-
return /* @__PURE__ */ n("div", { className: "divide-y divide-border/50", children: a.map(({ key: i, icon: l, label: c, value: u, disabled:
|
|
3361
|
-
const
|
|
3360
|
+
const r = Zr(), { rows: a, dir: o } = js(e, t, s);
|
|
3361
|
+
return /* @__PURE__ */ n("div", { className: "divide-y divide-border/50", children: a.map(({ key: i, icon: l, label: c, value: u, disabled: f, onChange: m, options: g }) => {
|
|
3362
|
+
const p = `${r}-${i}`;
|
|
3362
3363
|
return /* @__PURE__ */ d(
|
|
3363
3364
|
"div",
|
|
3364
3365
|
{
|
|
3365
|
-
className: `flex items-center justify-between gap-4 py-4 first:pt-1 ${
|
|
3366
|
+
className: `flex items-center justify-between gap-4 py-4 first:pt-1 ${f ? "opacity-60 pointer-events-none" : ""}`,
|
|
3366
3367
|
children: [
|
|
3367
3368
|
/* @__PURE__ */ d(
|
|
3368
3369
|
ce,
|
|
3369
3370
|
{
|
|
3370
|
-
htmlFor:
|
|
3371
|
+
htmlFor: p,
|
|
3371
3372
|
className: "flex items-center gap-2.5 text-sm font-medium text-foreground cursor-pointer",
|
|
3372
3373
|
children: [
|
|
3373
3374
|
/* @__PURE__ */ n(l, { className: "size-4 text-muted-foreground shrink-0" }),
|
|
@@ -3375,11 +3376,11 @@ function Fl({
|
|
|
3375
3376
|
]
|
|
3376
3377
|
}
|
|
3377
3378
|
),
|
|
3378
|
-
/* @__PURE__ */ d(es, { value: u, onValueChange: m, dir: o, disabled:
|
|
3379
|
+
/* @__PURE__ */ d(es, { value: u, onValueChange: m, dir: o, disabled: f, children: [
|
|
3379
3380
|
/* @__PURE__ */ n(
|
|
3380
3381
|
ts,
|
|
3381
3382
|
{
|
|
3382
|
-
id:
|
|
3383
|
+
id: p,
|
|
3383
3384
|
className: "h-9 w-auto min-w-36 rounded-full border-border/60 bg-muted/40 px-3.5 text-sm font-medium hover:bg-accent/60 transition-colors",
|
|
3384
3385
|
children: /* @__PURE__ */ n(ns, {})
|
|
3385
3386
|
}
|
|
@@ -3409,7 +3410,9 @@ function Fl({
|
|
|
3409
3410
|
);
|
|
3410
3411
|
}) });
|
|
3411
3412
|
}
|
|
3412
|
-
const
|
|
3413
|
+
const Bl = Xe(
|
|
3414
|
+
() => import("./FeedbackSettings-oq019el1.js").then((e) => ({ default: e.FeedbackSettings }))
|
|
3415
|
+
), Fe = "cursor-pointer flex items-center gap-3 rounded-xl px-3 py-2 text-sm font-medium", wn = "rounded-2xl border-border/60 bg-popover p-1.5 shadow-xl", gt = "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11 text-start", Ue = "opacity-50 pointer-events-none select-none";
|
|
3413
3416
|
function Fs({
|
|
3414
3417
|
id: e,
|
|
3415
3418
|
field: t,
|
|
@@ -3431,15 +3434,15 @@ function Fs({
|
|
|
3431
3434
|
required: o,
|
|
3432
3435
|
dir: i,
|
|
3433
3436
|
children: [
|
|
3434
|
-
/* @__PURE__ */ n(ts, { className:
|
|
3435
|
-
/* @__PURE__ */ n(ss, { className: "rounded-xl border-border/40 shadow-xl bg-background", children: t.options?.map((
|
|
3437
|
+
/* @__PURE__ */ n(ts, { className: gt, children: /* @__PURE__ */ n(ns, { placeholder: l(t.placeholder || c) }) }),
|
|
3438
|
+
/* @__PURE__ */ n(ss, { className: "rounded-xl border-border/40 shadow-xl bg-background", children: t.options?.map((f) => /* @__PURE__ */ n(
|
|
3436
3439
|
rs,
|
|
3437
3440
|
{
|
|
3438
|
-
value: String(
|
|
3441
|
+
value: String(f.value),
|
|
3439
3442
|
className: "rounded-lg focus:bg-primary/10",
|
|
3440
|
-
children: l(
|
|
3443
|
+
children: l(f.label)
|
|
3441
3444
|
},
|
|
3442
|
-
String(
|
|
3445
|
+
String(f.value)
|
|
3443
3446
|
)) })
|
|
3444
3447
|
]
|
|
3445
3448
|
}
|
|
@@ -3452,7 +3455,7 @@ function Fs({
|
|
|
3452
3455
|
checked: !!s,
|
|
3453
3456
|
disabled: a,
|
|
3454
3457
|
required: o,
|
|
3455
|
-
onChange: (
|
|
3458
|
+
onChange: (f) => r(f.target.checked),
|
|
3456
3459
|
className: "h-5 w-5 rounded-md border-border/50 bg-muted/30 text-primary focus:ring-primary transition-all cursor-pointer"
|
|
3457
3460
|
}
|
|
3458
3461
|
),
|
|
@@ -3465,9 +3468,9 @@ function Fs({
|
|
|
3465
3468
|
value: u,
|
|
3466
3469
|
disabled: a,
|
|
3467
3470
|
required: o,
|
|
3468
|
-
onChange: (
|
|
3471
|
+
onChange: (f) => r(f.target.value),
|
|
3469
3472
|
placeholder: l(t.placeholder || ""),
|
|
3470
|
-
className:
|
|
3473
|
+
className: gt
|
|
3471
3474
|
}
|
|
3472
3475
|
);
|
|
3473
3476
|
}
|
|
@@ -3476,7 +3479,7 @@ async function Us(e, t) {
|
|
|
3476
3479
|
try {
|
|
3477
3480
|
await e.logout(), window.location.reload();
|
|
3478
3481
|
} catch (s) {
|
|
3479
|
-
B.error(
|
|
3482
|
+
B.error(pe(s, t));
|
|
3480
3483
|
}
|
|
3481
3484
|
}
|
|
3482
3485
|
function Bs({
|
|
@@ -3504,23 +3507,24 @@ function Hs({
|
|
|
3504
3507
|
side: t = "top",
|
|
3505
3508
|
align: s = "start"
|
|
3506
3509
|
}) {
|
|
3507
|
-
const { t: r } =
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3510
|
+
const { t: r } = _(["settings", "errors"]), a = Y((M) => M.settings), o = a?.menu, i = Ye(), l = Ie(), { sections: c } = Xt(), { displayName: u, initial: f, handleOrPlan: m } = qs(), g = ke(a, "profile"), p = ke(a, "account"), h = Z(a, "account", "logout"), { rows: N, dir: v } = js(
|
|
3511
|
+
ke(a, "general"),
|
|
3512
|
+
Z(a, "general", "theme"),
|
|
3513
|
+
Z(a, "general", "language")
|
|
3511
3514
|
), y = N.filter(
|
|
3512
3515
|
(M) => M.key === "theme" && o?.showTheme === !0 || M.key === "lang" && o?.showLanguage === !0
|
|
3513
|
-
), b = o?.showUserHeader !== !1 && !!u, I = c.find((M) => M.id === "general")?.id ?? c[0]?.id ?? "profile",
|
|
3514
|
-
o?.showAccount !== !1 &&
|
|
3515
|
-
o?.showProfile === !0 &&
|
|
3516
|
+
), b = o?.showUserHeader !== !1 && !!u, I = c.find((M) => M.id === "general")?.id ?? c[0]?.id ?? "profile", k = (M) => c.find((L) => L.id === M), z = [
|
|
3517
|
+
o?.showAccount !== !1 && k("account"),
|
|
3518
|
+
o?.showProfile === !0 && k("profile"),
|
|
3516
3519
|
o?.showSettings !== !1 && c.length > 0 && {
|
|
3517
3520
|
id: I,
|
|
3518
3521
|
icon: Re,
|
|
3519
3522
|
label: r("title"),
|
|
3520
3523
|
faded: !1
|
|
3521
3524
|
},
|
|
3525
|
+
o?.showFeedback !== !1 && k("feedback"),
|
|
3522
3526
|
...c.filter((M) => M.showInMenu)
|
|
3523
|
-
].filter((M) => !!M), T = o?.showLogout !== !1 &&
|
|
3527
|
+
].filter((M) => !!M), T = o?.showLogout !== !1 && p !== "hidden" && h !== "hidden", P = z.length > 0 || y.length > 0;
|
|
3524
3528
|
if (!b && !P && !T) return null;
|
|
3525
3529
|
const A = /* @__PURE__ */ n("div", { role: "separator", className: "my-1 h-px bg-border/50" });
|
|
3526
3530
|
return /* @__PURE__ */ d(Pt, { dir: v, children: [
|
|
@@ -3555,8 +3559,8 @@ function Hs({
|
|
|
3555
3559
|
onSelect: () => l?.openSection("profile"),
|
|
3556
3560
|
className: "cursor-pointer flex items-center justify-between gap-2.5 rounded-xl px-2.5 py-2",
|
|
3557
3561
|
children: [
|
|
3558
|
-
/* @__PURE__ */ n(Bs, { initial:
|
|
3559
|
-
g !== "hidden" && /* @__PURE__ */ n(
|
|
3562
|
+
/* @__PURE__ */ n(Bs, { initial: f, name: u, subtitle: m }),
|
|
3563
|
+
g !== "hidden" && /* @__PURE__ */ n(Fr, { className: "size-4 shrink-0 text-muted-foreground rtl:rotate-180" })
|
|
3560
3564
|
]
|
|
3561
3565
|
}
|
|
3562
3566
|
),
|
|
@@ -3567,7 +3571,7 @@ function Hs({
|
|
|
3567
3571
|
{
|
|
3568
3572
|
disabled: !!H,
|
|
3569
3573
|
onSelect: () => l?.openSection(M),
|
|
3570
|
-
className:
|
|
3574
|
+
className: Fe,
|
|
3571
3575
|
children: [
|
|
3572
3576
|
/* @__PURE__ */ n(L, { className: "size-4 text-muted-foreground" }),
|
|
3573
3577
|
/* @__PURE__ */ n("span", { children: j })
|
|
@@ -3576,13 +3580,13 @@ function Hs({
|
|
|
3576
3580
|
`${M}-${j}`
|
|
3577
3581
|
)),
|
|
3578
3582
|
z.length > 0 && y.length > 0 && A,
|
|
3579
|
-
y.map(({ key: M, icon: L, label: j, disabled: H, value: q, options: Q, onChange:
|
|
3580
|
-
/* @__PURE__ */ d(
|
|
3583
|
+
y.map(({ key: M, icon: L, label: j, disabled: H, value: q, options: Q, onChange: ee }) => /* @__PURE__ */ d(wa, { children: [
|
|
3584
|
+
/* @__PURE__ */ d(Na, { disabled: H, className: Fe, children: [
|
|
3581
3585
|
/* @__PURE__ */ n(L, { className: "size-4 text-muted-foreground" }),
|
|
3582
3586
|
/* @__PURE__ */ n("span", { children: j })
|
|
3583
3587
|
] }),
|
|
3584
3588
|
/* @__PURE__ */ n(
|
|
3585
|
-
|
|
3589
|
+
ka,
|
|
3586
3590
|
{
|
|
3587
3591
|
sideOffset: 6,
|
|
3588
3592
|
className: x("min-w-44 max-h-72 overflow-y-auto custom-scrollbar", wn),
|
|
@@ -3592,8 +3596,8 @@ function Hs({
|
|
|
3592
3596
|
role: "menuitemradio",
|
|
3593
3597
|
"aria-checked": q === J.value,
|
|
3594
3598
|
lang: J.lang,
|
|
3595
|
-
onSelect: () =>
|
|
3596
|
-
className: x(
|
|
3599
|
+
onSelect: () => ee(J.value),
|
|
3600
|
+
className: x(Fe, "justify-between"),
|
|
3597
3601
|
children: [
|
|
3598
3602
|
/* @__PURE__ */ n("span", { children: J.label }),
|
|
3599
3603
|
q === J.value && /* @__PURE__ */ n(An, { className: "size-4 text-foreground" })
|
|
@@ -3610,11 +3614,11 @@ function Hs({
|
|
|
3610
3614
|
we,
|
|
3611
3615
|
{
|
|
3612
3616
|
variant: "destructive",
|
|
3613
|
-
disabled:
|
|
3617
|
+
disabled: p === "faded" || h === "faded",
|
|
3614
3618
|
onSelect: () => {
|
|
3615
3619
|
Us(i, r);
|
|
3616
3620
|
},
|
|
3617
|
-
className:
|
|
3621
|
+
className: Fe,
|
|
3618
3622
|
children: [
|
|
3619
3623
|
/* @__PURE__ */ n(Rn, { className: "size-4" }),
|
|
3620
3624
|
/* @__PURE__ */ n("span", { children: r("account.logout") })
|
|
@@ -3627,18 +3631,18 @@ function Hs({
|
|
|
3627
3631
|
)
|
|
3628
3632
|
] });
|
|
3629
3633
|
}
|
|
3630
|
-
const
|
|
3634
|
+
const Hl = [
|
|
3631
3635
|
["name", "name"],
|
|
3632
3636
|
["surname", "surname"],
|
|
3633
|
-
["username", "username",
|
|
3634
|
-
["email", "email",
|
|
3635
|
-
["phone", "phone",
|
|
3636
|
-
["pass", "password",
|
|
3637
|
+
["username", "username", Or],
|
|
3638
|
+
["email", "email", Er, "email"],
|
|
3639
|
+
["phone", "phone", Lr],
|
|
3640
|
+
["pass", "password", qr, "password"]
|
|
3637
3641
|
];
|
|
3638
|
-
function
|
|
3639
|
-
const { t, i18n: s } =
|
|
3642
|
+
function Vl({ trigger: e }) {
|
|
3643
|
+
const { t, i18n: s } = _(["settings", "common"]), r = K((S) => S.app), a = Y((S) => S.settings), o = Ye(), i = Gn(), l = da(), c = Ie(), u = !e && c !== null && c.activeSection !== null, [f, m] = C(!1), g = u || f, { data: p, refetch: h } = St({
|
|
3640
3644
|
enabled: g
|
|
3641
|
-
}), N = U(null), { dir: v } = V(), { sections: y } = Xt(), [b, I] = C(y[0]?.id || "profile"),
|
|
3645
|
+
}), N = U(null), { dir: v } = V(), { sections: y } = Xt(), [b, I] = C(y[0]?.id || "profile"), k = (u ? c.activeSection : b) || y[0]?.id || "profile", z = y.find((S) => S.id === k) ?? y[0], T = z?.component, [P, A] = C({
|
|
3642
3646
|
name: "",
|
|
3643
3647
|
surname: "",
|
|
3644
3648
|
username: "",
|
|
@@ -3648,7 +3652,7 @@ function Bl({ trigger: e }) {
|
|
|
3648
3652
|
}), M = (S, F) => A((w) => ({ ...w, [S]: F })), L = O(
|
|
3649
3653
|
() => r?.userMetadataFields?.filter((S) => S.showInProfile) || [],
|
|
3650
3654
|
[r?.userMetadataFields]
|
|
3651
|
-
), [j, H] = C({}), [q, Q] = C(!1),
|
|
3655
|
+
), [j, H] = C({}), [q, Q] = C(!1), ee = de(async () => {
|
|
3652
3656
|
try {
|
|
3653
3657
|
h();
|
|
3654
3658
|
const S = await o.getMe();
|
|
@@ -3665,7 +3669,7 @@ function Bl({ trigger: e }) {
|
|
|
3665
3669
|
)
|
|
3666
3670
|
);
|
|
3667
3671
|
} catch (S) {
|
|
3668
|
-
B.error(
|
|
3672
|
+
B.error(pe(S, t));
|
|
3669
3673
|
}
|
|
3670
3674
|
}, [t, L, o, h]);
|
|
3671
3675
|
D(() => {
|
|
@@ -3673,8 +3677,8 @@ function Bl({ trigger: e }) {
|
|
|
3673
3677
|
N.current = null;
|
|
3674
3678
|
return;
|
|
3675
3679
|
}
|
|
3676
|
-
(N.current === null ||
|
|
3677
|
-
}, [g,
|
|
3680
|
+
(N.current === null || k === "account") && ee(), N.current = k;
|
|
3681
|
+
}, [g, k, ee]), D(() => {
|
|
3678
3682
|
const S = $s(L, j);
|
|
3679
3683
|
S && H(S);
|
|
3680
3684
|
}, [j, L]);
|
|
@@ -3690,15 +3694,15 @@ function Bl({ trigger: e }) {
|
|
|
3690
3694
|
metadata: j,
|
|
3691
3695
|
...P.password && { password: P.password }
|
|
3692
3696
|
});
|
|
3693
|
-
i.setQueryData(l.currentUser(), S), B.success(t("profile.success")), M("password", ""),
|
|
3697
|
+
i.setQueryData(l.currentUser(), S), B.success(t("profile.success")), M("password", ""), ee();
|
|
3694
3698
|
} catch (S) {
|
|
3695
|
-
B.error(
|
|
3699
|
+
B.error(pe(S, t));
|
|
3696
3700
|
} finally {
|
|
3697
3701
|
Q(!1);
|
|
3698
3702
|
}
|
|
3699
|
-
}, me =
|
|
3703
|
+
}, me = Z(a, "account", "usage"), re = Z(a, "account", "logout"), he = () => {
|
|
3700
3704
|
c?.close(), requestAnimationFrame(() => c?.triggerRef.current?.focus());
|
|
3701
|
-
},
|
|
3705
|
+
}, Te = /* @__PURE__ */ d(
|
|
3702
3706
|
"div",
|
|
3703
3707
|
{
|
|
3704
3708
|
dir: v,
|
|
@@ -3719,8 +3723,8 @@ function Bl({ trigger: e }) {
|
|
|
3719
3723
|
onClick: () => I(S.id),
|
|
3720
3724
|
className: x(
|
|
3721
3725
|
"flex items-center gap-1.5 sm:gap-2 pb-2 sm:pb-3 pt-1 px-2 sm:px-1 text-sm sm:text-base font-medium transition-all border-b-2 whitespace-nowrap shrink-0",
|
|
3722
|
-
|
|
3723
|
-
S.faded &&
|
|
3726
|
+
k === S.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
|
|
3727
|
+
S.faded && Ue
|
|
3724
3728
|
),
|
|
3725
3729
|
children: [
|
|
3726
3730
|
/* @__PURE__ */ n(S.icon, { className: "size-4" }),
|
|
@@ -3753,20 +3757,20 @@ function Bl({ trigger: e }) {
|
|
|
3753
3757
|
onClick: he,
|
|
3754
3758
|
"aria-label": t("common:close"),
|
|
3755
3759
|
className: "size-9 shrink-0 rounded-full text-muted-foreground hover:text-foreground",
|
|
3756
|
-
children: /* @__PURE__ */ n(
|
|
3760
|
+
children: /* @__PURE__ */ n(Nt, { className: "size-4" })
|
|
3757
3761
|
}
|
|
3758
3762
|
)
|
|
3759
3763
|
] }),
|
|
3760
|
-
|
|
3761
|
-
/* @__PURE__ */ n("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children:
|
|
3762
|
-
const G =
|
|
3764
|
+
k === "profile" && /* @__PURE__ */ d("div", { className: "grid gap-6", children: [
|
|
3765
|
+
/* @__PURE__ */ n("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: Hl.map(([S, F, w, R]) => {
|
|
3766
|
+
const G = Z(a, "profile", F);
|
|
3763
3767
|
return G === "hidden" ? null : /* @__PURE__ */ d(
|
|
3764
3768
|
"div",
|
|
3765
3769
|
{
|
|
3766
3770
|
className: x(
|
|
3767
3771
|
"flex flex-col gap-2.5",
|
|
3768
3772
|
w && "sm:col-span-2",
|
|
3769
|
-
G === "faded" &&
|
|
3773
|
+
G === "faded" && Ue
|
|
3770
3774
|
),
|
|
3771
3775
|
children: [
|
|
3772
3776
|
/* @__PURE__ */ n(ce, { htmlFor: S, className: "px-1 text-start", children: t(`profile.${F}`) }),
|
|
@@ -3784,7 +3788,7 @@ function Bl({ trigger: e }) {
|
|
|
3784
3788
|
),
|
|
3785
3789
|
disabled: G === "faded",
|
|
3786
3790
|
placeholder: F === "password" ? t("profile.password_placeholder") : void 0,
|
|
3787
|
-
className: x(
|
|
3791
|
+
className: x(gt, w && "ps-10 pe-3"),
|
|
3788
3792
|
dir: w ? "ltr" : void 0
|
|
3789
3793
|
}
|
|
3790
3794
|
)
|
|
@@ -3795,14 +3799,14 @@ function Bl({ trigger: e }) {
|
|
|
3795
3799
|
);
|
|
3796
3800
|
}) }),
|
|
3797
3801
|
L.map((S) => {
|
|
3798
|
-
const F =
|
|
3802
|
+
const F = Z(a, "profile", S.key, S.mode || "editable");
|
|
3799
3803
|
if (F === "hidden" || !$t(S.condition, j))
|
|
3800
3804
|
return null;
|
|
3801
3805
|
const w = `profile-${S.key}`;
|
|
3802
3806
|
return /* @__PURE__ */ d(
|
|
3803
3807
|
"div",
|
|
3804
3808
|
{
|
|
3805
|
-
className: x("flex flex-col gap-2.5", F === "faded" &&
|
|
3809
|
+
className: x("flex flex-col gap-2.5", F === "faded" && Ue),
|
|
3806
3810
|
children: [
|
|
3807
3811
|
/* @__PURE__ */ n(ce, { htmlFor: w, className: "px-1", children: t(S.label) }),
|
|
3808
3812
|
/* @__PURE__ */ n(
|
|
@@ -3832,22 +3836,30 @@ function Bl({ trigger: e }) {
|
|
|
3832
3836
|
disabled: q,
|
|
3833
3837
|
className: "w-full sm:w-auto px-6 rounded-full gap-2 font-medium h-10",
|
|
3834
3838
|
children: [
|
|
3835
|
-
/* @__PURE__ */ n(
|
|
3839
|
+
/* @__PURE__ */ n($r, { className: "size-4" }),
|
|
3836
3840
|
t(q ? "profile.saving" : "profile.save")
|
|
3837
3841
|
]
|
|
3838
3842
|
}
|
|
3839
3843
|
) })
|
|
3840
3844
|
] }),
|
|
3841
|
-
|
|
3842
|
-
|
|
3845
|
+
k === "general" && /* @__PURE__ */ n(
|
|
3846
|
+
Ul,
|
|
3843
3847
|
{
|
|
3844
3848
|
sectionMode: a?.sections?.general?.mode ?? "editable",
|
|
3845
|
-
themeMode:
|
|
3846
|
-
languageMode:
|
|
3849
|
+
themeMode: Z(a, "general", "theme"),
|
|
3850
|
+
languageMode: Z(a, "general", "language")
|
|
3847
3851
|
}
|
|
3848
3852
|
),
|
|
3849
|
-
|
|
3850
|
-
|
|
3853
|
+
k === "feedback" && /* @__PURE__ */ n(Ae, { fallback: null, children: /* @__PURE__ */ n(
|
|
3854
|
+
Bl,
|
|
3855
|
+
{
|
|
3856
|
+
sectionMode: ke(a, "feedback"),
|
|
3857
|
+
categoryMode: Z(a, "feedback", "category"),
|
|
3858
|
+
attachmentMode: Z(a, "feedback", "attachment")
|
|
3859
|
+
}
|
|
3860
|
+
) }),
|
|
3861
|
+
k === "account" && /* @__PURE__ */ d("div", { className: "space-y-6", children: [
|
|
3862
|
+
me !== "hidden" && p && /* @__PURE__ */ d(
|
|
3851
3863
|
"div",
|
|
3852
3864
|
{
|
|
3853
3865
|
className: x(
|
|
@@ -3857,19 +3869,19 @@ function Bl({ trigger: e }) {
|
|
|
3857
3869
|
children: [
|
|
3858
3870
|
/* @__PURE__ */ d("div", { className: "flex items-start justify-between gap-3", children: [
|
|
3859
3871
|
/* @__PURE__ */ d(ce, { className: "text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2", children: [
|
|
3860
|
-
/* @__PURE__ */ n(
|
|
3872
|
+
/* @__PURE__ */ n(jr, { className: "size-4" }),
|
|
3861
3873
|
t("account.usage")
|
|
3862
3874
|
] }),
|
|
3863
3875
|
/* @__PURE__ */ d("div", { className: "text-end", children: [
|
|
3864
|
-
/* @__PURE__ */ n("p", { className: "text-sm font-semibold text-foreground", children:
|
|
3865
|
-
|
|
3866
|
-
datetime: Ot(
|
|
3876
|
+
/* @__PURE__ */ n("p", { className: "text-sm font-semibold text-foreground", children: p.kind === "credits" ? t("account.on_credits") : p.kind === "unlimited" ? t("account.unlimited") : p.plan?.name ?? t("account.custom_plan") }),
|
|
3877
|
+
p.ends_at && /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground", children: t("account.plan_until", {
|
|
3878
|
+
datetime: Ot(p.ends_at, s.language)
|
|
3867
3879
|
}) })
|
|
3868
3880
|
] })
|
|
3869
3881
|
] }),
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3882
|
+
p.kind === "plan" && (p.windows.length > 0 ? /* @__PURE__ */ n($l, { windows: p.windows }) : /* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground", children: t("account.unlimited") })),
|
|
3883
|
+
p.kind === "credits" && p.credits && /* @__PURE__ */ n(jl, { credits: p.credits }),
|
|
3884
|
+
p.kind === "unlimited" && /* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground", children: t("account.unlimited_help") })
|
|
3873
3885
|
]
|
|
3874
3886
|
}
|
|
3875
3887
|
),
|
|
@@ -3885,7 +3897,7 @@ function Bl({ trigger: e }) {
|
|
|
3885
3897
|
disabled: re === "faded",
|
|
3886
3898
|
className: x(
|
|
3887
3899
|
"rounded-full px-5 gap-2 font-medium h-9",
|
|
3888
|
-
re === "faded" &&
|
|
3900
|
+
re === "faded" && Ue
|
|
3889
3901
|
),
|
|
3890
3902
|
children: [
|
|
3891
3903
|
/* @__PURE__ */ n(Rn, { className: "size-4" }),
|
|
@@ -3913,14 +3925,14 @@ function Bl({ trigger: e }) {
|
|
|
3913
3925
|
]
|
|
3914
3926
|
}
|
|
3915
3927
|
);
|
|
3916
|
-
return u ? /* @__PURE__ */ n("section", { "aria-label": t("title"), className: "flex flex-1 min-h-0 h-full w-full bg-background", children:
|
|
3928
|
+
return u ? /* @__PURE__ */ n("section", { "aria-label": t("title"), className: "flex flex-1 min-h-0 h-full w-full bg-background", children: Te }) : /* @__PURE__ */ d($e, { open: f, onOpenChange: m, children: [
|
|
3917
3929
|
/* @__PURE__ */ n(Qn, { asChild: !0, children: e || /* @__PURE__ */ n(E, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ n(Re, { className: "h-5 w-5" }) }) }),
|
|
3918
3930
|
/* @__PURE__ */ n(
|
|
3919
3931
|
Mt,
|
|
3920
3932
|
{
|
|
3921
3933
|
dir: v,
|
|
3922
3934
|
className: "w-full sm:w-[95vw] sm:max-w-[700px] p-0 gap-0 overflow-hidden rounded-t-2xl sm:rounded-3xl border-none shadow-lg bg-background h-[90vh] sm:h-[min(750px,90vh)]",
|
|
3923
|
-
children:
|
|
3935
|
+
children: Te
|
|
3924
3936
|
}
|
|
3925
3937
|
)
|
|
3926
3938
|
] });
|
|
@@ -3930,14 +3942,14 @@ const Nn = (e) => e.replace(/[^0-9]/g, ""), kn = {
|
|
|
3930
3942
|
email: "email",
|
|
3931
3943
|
phone: "tel"
|
|
3932
3944
|
};
|
|
3933
|
-
function
|
|
3934
|
-
return /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(
|
|
3945
|
+
function Gl(e) {
|
|
3946
|
+
return /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(Wl, { ...e }) });
|
|
3935
3947
|
}
|
|
3936
|
-
function
|
|
3937
|
-
const { t: s } =
|
|
3948
|
+
function Wl({ onSignedIn: e, reason: t }) {
|
|
3949
|
+
const { t: s } = _(["login"]), r = K((w) => w.app), a = Ye(), o = V().dir, i = Gn(), [l, c] = C("login"), u = !!r?.disableSignup, f = !!r?.disableAuthPage, m = O(
|
|
3938
3950
|
() => r?.loginFields ?? ["username"],
|
|
3939
3951
|
[r?.loginFields]
|
|
3940
|
-
), g = m.map((w) => s(w)).join(" / "),
|
|
3952
|
+
), g = m.map((w) => s(w)).join(" / "), p = m.length === 1 ? kn[m[0]] : "text", h = m.length === 1 && m[0] === "phone", [N, v] = C(""), [y, b] = C(""), [I, k] = C({}), [z, T] = C(""), [P, A] = C(""), [M, L] = C(""), j = O(
|
|
3941
3953
|
() => r?.userMetadataFields?.filter((w) => w.showInSignup) || [],
|
|
3942
3954
|
[r?.userMetadataFields]
|
|
3943
3955
|
), [H, q] = C(() => {
|
|
@@ -3950,16 +3962,16 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
3950
3962
|
const w = $s(j, H);
|
|
3951
3963
|
w && q(w);
|
|
3952
3964
|
}, [H, j]);
|
|
3953
|
-
const [Q,
|
|
3965
|
+
const [Q, ee] = C(""), [J, me] = C(!1);
|
|
3954
3966
|
D(() => {
|
|
3955
3967
|
u && l === "register" && c("login");
|
|
3956
3968
|
}, [u, l]);
|
|
3957
3969
|
const re = async (w, R) => {
|
|
3958
|
-
w.preventDefault(),
|
|
3970
|
+
w.preventDefault(), ee(""), me(!0);
|
|
3959
3971
|
try {
|
|
3960
3972
|
await R(), i.clear(), e();
|
|
3961
3973
|
} catch (G) {
|
|
3962
|
-
|
|
3974
|
+
ee(pe(G, s));
|
|
3963
3975
|
} finally {
|
|
3964
3976
|
me(!1);
|
|
3965
3977
|
}
|
|
@@ -3970,12 +3982,12 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
3970
3982
|
ae && (R[G] = ae);
|
|
3971
3983
|
}
|
|
3972
3984
|
if (Object.keys(R).length === 0) {
|
|
3973
|
-
w.preventDefault(),
|
|
3985
|
+
w.preventDefault(), ee(s("at_least_one_login_field"));
|
|
3974
3986
|
return;
|
|
3975
3987
|
}
|
|
3976
3988
|
re(w, () => a.register(R, z, P, M, H));
|
|
3977
3989
|
};
|
|
3978
|
-
if (
|
|
3990
|
+
if (f) {
|
|
3979
3991
|
const w = t === "handoff_failed" ? "handoff_failed" : "auth_page_disabled";
|
|
3980
3992
|
return /* @__PURE__ */ n("div", { className: "min-h-screen bg-background flex items-center justify-center p-4", dir: o, children: /* @__PURE__ */ d("div", { className: "w-full max-w-lg bg-card border border-border rounded-xl shadow-lg p-8 text-center space-y-4", children: [
|
|
3981
3993
|
/* @__PURE__ */ n("h1", { className: "text-2xl font-bold", children: r?.name }),
|
|
@@ -3983,14 +3995,14 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
3983
3995
|
/* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground/80", children: s(`${w}_description`) })
|
|
3984
3996
|
] }) });
|
|
3985
3997
|
}
|
|
3986
|
-
const
|
|
3998
|
+
const Te = [
|
|
3987
3999
|
["login", "login_tab"],
|
|
3988
4000
|
...u ? [] : [["register", "signup_tab"]]
|
|
3989
4001
|
], S = l === "login" || u, F = S ? [
|
|
3990
4002
|
[
|
|
3991
4003
|
"login-identity",
|
|
3992
4004
|
g,
|
|
3993
|
-
|
|
4005
|
+
p,
|
|
3994
4006
|
N,
|
|
3995
4007
|
(w) => v(h ? Nn(w) : w),
|
|
3996
4008
|
g,
|
|
@@ -4012,7 +4024,7 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
4012
4024
|
s(w),
|
|
4013
4025
|
kn[w],
|
|
4014
4026
|
I[w] ?? "",
|
|
4015
|
-
(R) =>
|
|
4027
|
+
(R) => k((G) => ({
|
|
4016
4028
|
...G,
|
|
4017
4029
|
[w]: w === "phone" ? Nn(R) : R
|
|
4018
4030
|
})),
|
|
@@ -4037,12 +4049,12 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
4037
4049
|
dir: o,
|
|
4038
4050
|
children: /* @__PURE__ */ d("div", { className: "w-full max-w-md bg-card border border-border rounded-xl shadow-lg p-6", children: [
|
|
4039
4051
|
/* @__PURE__ */ n("div", { className: "text-center mb-6", children: /* @__PURE__ */ n("h1", { className: "text-2xl font-bold text-foreground", children: r?.name }) }),
|
|
4040
|
-
/* @__PURE__ */ n("div", { className: "flex bg-muted p-1 rounded-lg mb-6", children:
|
|
4052
|
+
/* @__PURE__ */ n("div", { className: "flex bg-muted p-1 rounded-lg mb-6", children: Te.map(([w, R]) => /* @__PURE__ */ n(
|
|
4041
4053
|
"button",
|
|
4042
4054
|
{
|
|
4043
4055
|
type: "button",
|
|
4044
4056
|
onClick: () => {
|
|
4045
|
-
c(w),
|
|
4057
|
+
c(w), ee("");
|
|
4046
4058
|
},
|
|
4047
4059
|
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${l === w ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
4048
4060
|
children: s(R)
|
|
@@ -4131,16 +4143,16 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
4131
4143
|
}
|
|
4132
4144
|
);
|
|
4133
4145
|
}
|
|
4134
|
-
const Yt =
|
|
4146
|
+
const Yt = te.createContext(null);
|
|
4135
4147
|
function Vs() {
|
|
4136
|
-
return
|
|
4148
|
+
return te.useContext(Yt);
|
|
4137
4149
|
}
|
|
4138
|
-
function
|
|
4139
|
-
const e =
|
|
4150
|
+
function at() {
|
|
4151
|
+
const e = te.useContext(Yt);
|
|
4140
4152
|
if (!e) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
4141
4153
|
return e;
|
|
4142
4154
|
}
|
|
4143
|
-
function
|
|
4155
|
+
function Ql({
|
|
4144
4156
|
defaultOpen: e = !0,
|
|
4145
4157
|
open: t,
|
|
4146
4158
|
onOpenChange: s,
|
|
@@ -4149,26 +4161,26 @@ function Gl({
|
|
|
4149
4161
|
children: o,
|
|
4150
4162
|
...i
|
|
4151
4163
|
}) {
|
|
4152
|
-
const l = Qt(), [c, u] =
|
|
4164
|
+
const l = Qt(), [c, u] = te.useState(!1), [f, m] = te.useState(e), g = t ?? f, p = te.useCallback(
|
|
4153
4165
|
(y) => {
|
|
4154
4166
|
const b = typeof y == "function" ? y(g) : y;
|
|
4155
4167
|
s ? s(b) : m(b), document.cookie = `sidebar_state=${b}; path=/; max-age=604800`;
|
|
4156
4168
|
},
|
|
4157
4169
|
[s, g]
|
|
4158
|
-
), h =
|
|
4159
|
-
l ? u((y) => !y) :
|
|
4160
|
-
}, [l,
|
|
4161
|
-
|
|
4170
|
+
), h = te.useCallback(() => {
|
|
4171
|
+
l ? u((y) => !y) : p((y) => !y);
|
|
4172
|
+
}, [l, p]);
|
|
4173
|
+
te.useEffect(() => {
|
|
4162
4174
|
const y = (b) => {
|
|
4163
4175
|
b.key === "b" && (b.metaKey || b.ctrlKey) && (b.preventDefault(), h());
|
|
4164
4176
|
};
|
|
4165
4177
|
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
4166
4178
|
}, [h]);
|
|
4167
|
-
const N = g ? "expanded" : "collapsed", v =
|
|
4168
|
-
() => ({ state: N, open: g, setOpen:
|
|
4169
|
-
[N, g,
|
|
4179
|
+
const N = g ? "expanded" : "collapsed", v = te.useMemo(
|
|
4180
|
+
() => ({ state: N, open: g, setOpen: p, isMobile: l, openMobile: c, setOpenMobile: u, toggleSidebar: h }),
|
|
4181
|
+
[N, g, p, l, c, h]
|
|
4170
4182
|
);
|
|
4171
|
-
return /* @__PURE__ */ n(Yt.Provider, { value: v, children: /* @__PURE__ */ n(
|
|
4183
|
+
return /* @__PURE__ */ n(Yt.Provider, { value: v, children: /* @__PURE__ */ n(_a, { delayDuration: 0, children: /* @__PURE__ */ n(
|
|
4172
4184
|
"div",
|
|
4173
4185
|
{
|
|
4174
4186
|
"data-slot": "sidebar-wrapper",
|
|
@@ -4179,7 +4191,7 @@ function Gl({
|
|
|
4179
4191
|
}
|
|
4180
4192
|
) }) });
|
|
4181
4193
|
}
|
|
4182
|
-
function
|
|
4194
|
+
function Kl({
|
|
4183
4195
|
side: e = "start",
|
|
4184
4196
|
variant: t = "sidebar",
|
|
4185
4197
|
collapsible: s = "offcanvas",
|
|
@@ -4187,9 +4199,9 @@ function Wl({
|
|
|
4187
4199
|
children: a,
|
|
4188
4200
|
...o
|
|
4189
4201
|
}) {
|
|
4190
|
-
const { isMobile: i, state: l, openMobile: c, setOpenMobile: u } =
|
|
4191
|
-
return i ? /* @__PURE__ */ n(
|
|
4192
|
-
|
|
4202
|
+
const { isMobile: i, state: l, openMobile: c, setOpenMobile: u } = at(), { t: f } = _("sidebar");
|
|
4203
|
+
return i ? /* @__PURE__ */ n(Sa, { open: c, onOpenChange: u, ...o, children: /* @__PURE__ */ d(
|
|
4204
|
+
Ca,
|
|
4193
4205
|
{
|
|
4194
4206
|
onOpenAutoFocus: (m) => m.preventDefault(),
|
|
4195
4207
|
"data-sidebar": "sidebar",
|
|
@@ -4199,9 +4211,9 @@ function Wl({
|
|
|
4199
4211
|
style: { "--gentiq-sidebar-width": "18rem" },
|
|
4200
4212
|
side: e,
|
|
4201
4213
|
children: [
|
|
4202
|
-
/* @__PURE__ */ d(
|
|
4203
|
-
/* @__PURE__ */ n(
|
|
4204
|
-
/* @__PURE__ */ n(
|
|
4214
|
+
/* @__PURE__ */ d(za, { className: "sr-only", children: [
|
|
4215
|
+
/* @__PURE__ */ n(Ia, { children: f("title") }),
|
|
4216
|
+
/* @__PURE__ */ n(Ta, { children: f("mobile_description") })
|
|
4205
4217
|
] }),
|
|
4206
4218
|
/* @__PURE__ */ n("div", { className: "flex h-full w-full flex-col", children: a })
|
|
4207
4219
|
]
|
|
@@ -4249,7 +4261,7 @@ function Wl({
|
|
|
4249
4261
|
);
|
|
4250
4262
|
}
|
|
4251
4263
|
function Gs({ className: e, onClick: t, ...s }) {
|
|
4252
|
-
const { toggleSidebar: r } =
|
|
4264
|
+
const { toggleSidebar: r } = at(), { t: a } = _("sidebar");
|
|
4253
4265
|
return /* @__PURE__ */ d(
|
|
4254
4266
|
E,
|
|
4255
4267
|
{
|
|
@@ -4263,19 +4275,19 @@ function Gs({ className: e, onClick: t, ...s }) {
|
|
|
4263
4275
|
},
|
|
4264
4276
|
...s,
|
|
4265
4277
|
children: [
|
|
4266
|
-
/* @__PURE__ */ n(
|
|
4278
|
+
/* @__PURE__ */ n(Ur, {}),
|
|
4267
4279
|
/* @__PURE__ */ n("span", { className: "sr-only", children: a("toggle") })
|
|
4268
4280
|
]
|
|
4269
4281
|
}
|
|
4270
4282
|
);
|
|
4271
4283
|
}
|
|
4272
|
-
function
|
|
4284
|
+
function Xl({ className: e, ...t }) {
|
|
4273
4285
|
return /* @__PURE__ */ n("div", { "data-slot": "sidebar-header", "data-sidebar": "header", className: x("flex flex-col gap-2 p-2", e), ...t });
|
|
4274
4286
|
}
|
|
4275
|
-
function
|
|
4287
|
+
function Yl({ className: e, ...t }) {
|
|
4276
4288
|
return /* @__PURE__ */ n("div", { "data-slot": "sidebar-footer", "data-sidebar": "footer", className: x("flex flex-col gap-2 p-2", e), ...t });
|
|
4277
4289
|
}
|
|
4278
|
-
function
|
|
4290
|
+
function Jl({ className: e, ...t }) {
|
|
4279
4291
|
return /* @__PURE__ */ n(
|
|
4280
4292
|
"div",
|
|
4281
4293
|
{
|
|
@@ -4286,7 +4298,7 @@ function Xl({ className: e, ...t }) {
|
|
|
4286
4298
|
}
|
|
4287
4299
|
);
|
|
4288
4300
|
}
|
|
4289
|
-
function
|
|
4301
|
+
function bt({ className: e, ...t }) {
|
|
4290
4302
|
return /* @__PURE__ */ n("ul", { "data-slot": "sidebar-menu", "data-sidebar": "menu", className: x("flex w-full min-w-0 flex-col gap-1", e), ...t });
|
|
4291
4303
|
}
|
|
4292
4304
|
function Jt({ className: e, ...t }) {
|
|
@@ -4298,7 +4310,7 @@ function Zt({
|
|
|
4298
4310
|
...s
|
|
4299
4311
|
}) {
|
|
4300
4312
|
return /* @__PURE__ */ n(
|
|
4301
|
-
e ?
|
|
4313
|
+
e ? ma : "button",
|
|
4302
4314
|
{
|
|
4303
4315
|
"data-slot": "sidebar-menu-button",
|
|
4304
4316
|
"data-sidebar": "menu-button",
|
|
@@ -4310,8 +4322,8 @@ function Zt({
|
|
|
4310
4322
|
}
|
|
4311
4323
|
);
|
|
4312
4324
|
}
|
|
4313
|
-
function
|
|
4314
|
-
const { t: r } =
|
|
4325
|
+
function Zl({ open: e, onOpenChange: t, onRemove: s }) {
|
|
4326
|
+
const { t: r } = _(["sidebar", "errors"]), a = async () => {
|
|
4315
4327
|
t(!1);
|
|
4316
4328
|
try {
|
|
4317
4329
|
await s();
|
|
@@ -4321,12 +4333,12 @@ function Yl({ open: e, onOpenChange: t, onRemove: s }) {
|
|
|
4321
4333
|
}
|
|
4322
4334
|
B.success(r("chat_deleted_success"));
|
|
4323
4335
|
};
|
|
4324
|
-
return /* @__PURE__ */ n(
|
|
4336
|
+
return /* @__PURE__ */ n($e, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Mt, { children: [
|
|
4325
4337
|
/* @__PURE__ */ d(Kn, { children: [
|
|
4326
4338
|
/* @__PURE__ */ n(Xn, { children: r("delete_confirm_title") }),
|
|
4327
|
-
/* @__PURE__ */ n(
|
|
4339
|
+
/* @__PURE__ */ n(Ma, { children: r("delete_confirm_description") })
|
|
4328
4340
|
] }),
|
|
4329
|
-
/* @__PURE__ */ d(
|
|
4341
|
+
/* @__PURE__ */ d(Pa, { children: [
|
|
4330
4342
|
/* @__PURE__ */ n(E, { variant: "outline", onClick: () => t(!1), children: r("cancel") }),
|
|
4331
4343
|
/* @__PURE__ */ n(E, { variant: "destructive", onClick: () => {
|
|
4332
4344
|
a();
|
|
@@ -4334,12 +4346,12 @@ function Yl({ open: e, onOpenChange: t, onRemove: s }) {
|
|
|
4334
4346
|
] })
|
|
4335
4347
|
] }) });
|
|
4336
4348
|
}
|
|
4337
|
-
const Ws =
|
|
4349
|
+
const Ws = Ee({
|
|
4338
4350
|
pin: !0,
|
|
4339
4351
|
share: !0,
|
|
4340
4352
|
rename: !0,
|
|
4341
4353
|
delete: !0
|
|
4342
|
-
}),
|
|
4354
|
+
}), ec = "cursor-pointer flex items-center gap-2.5 rounded-xl px-2.5 py-2 text-sm font-medium";
|
|
4343
4355
|
function Qs({
|
|
4344
4356
|
title: e,
|
|
4345
4357
|
pinned: t,
|
|
@@ -4352,7 +4364,7 @@ function Qs({
|
|
|
4352
4364
|
onRemove: c,
|
|
4353
4365
|
triggerClassName: u
|
|
4354
4366
|
}) {
|
|
4355
|
-
const { t:
|
|
4367
|
+
const { t: f } = _("sidebar"), { dir: m } = V(), [g, p] = C(!1), h = async (v, y, b, I) => {
|
|
4356
4368
|
try {
|
|
4357
4369
|
await v(), B.success(y, I ? { description: I } : void 0);
|
|
4358
4370
|
} catch {
|
|
@@ -4361,48 +4373,48 @@ function Qs({
|
|
|
4361
4373
|
}, N = [
|
|
4362
4374
|
r.pin && {
|
|
4363
4375
|
key: "pin",
|
|
4364
|
-
icon: t ?
|
|
4365
|
-
label:
|
|
4376
|
+
icon: t ? Br : Dn,
|
|
4377
|
+
label: f(t ? "unpin_conversation" : "pin_conversation"),
|
|
4366
4378
|
onSelect: () => {
|
|
4367
4379
|
h(
|
|
4368
4380
|
() => a(!t),
|
|
4369
|
-
|
|
4370
|
-
|
|
4381
|
+
f(t ? "unpinned_success" : "pinned_success"),
|
|
4382
|
+
f("pin_failed")
|
|
4371
4383
|
);
|
|
4372
4384
|
}
|
|
4373
4385
|
},
|
|
4374
4386
|
r.share && {
|
|
4375
4387
|
key: "share",
|
|
4376
|
-
icon:
|
|
4377
|
-
label:
|
|
4388
|
+
icon: Hr,
|
|
4389
|
+
label: f("share_conversation"),
|
|
4378
4390
|
onSelect: () => {
|
|
4379
4391
|
h(
|
|
4380
4392
|
async () => navigator.clipboard.writeText(`${window.location.origin}${await o()}`),
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4393
|
+
f("share_success"),
|
|
4394
|
+
f("share_failed"),
|
|
4395
|
+
f("share_description")
|
|
4384
4396
|
);
|
|
4385
4397
|
}
|
|
4386
4398
|
},
|
|
4387
4399
|
r.share && s && {
|
|
4388
4400
|
key: "unshare",
|
|
4389
|
-
icon:
|
|
4390
|
-
label:
|
|
4401
|
+
icon: Vr,
|
|
4402
|
+
label: f("stop_sharing"),
|
|
4391
4403
|
onSelect: () => {
|
|
4392
|
-
h(i,
|
|
4404
|
+
h(i, f("unshare_success"), f("unshare_failed"));
|
|
4393
4405
|
}
|
|
4394
4406
|
},
|
|
4395
4407
|
r.rename && {
|
|
4396
4408
|
key: "rename",
|
|
4397
|
-
icon:
|
|
4398
|
-
label:
|
|
4409
|
+
icon: Gr,
|
|
4410
|
+
label: f("rename_conversation"),
|
|
4399
4411
|
onSelect: l
|
|
4400
4412
|
},
|
|
4401
4413
|
r.delete && {
|
|
4402
4414
|
key: "delete",
|
|
4403
|
-
icon:
|
|
4404
|
-
label:
|
|
4405
|
-
onSelect: () =>
|
|
4415
|
+
icon: Wr,
|
|
4416
|
+
label: f("delete_conversation"),
|
|
4417
|
+
onSelect: () => p(!0),
|
|
4406
4418
|
destructive: !0
|
|
4407
4419
|
}
|
|
4408
4420
|
].filter((v) => !!v);
|
|
@@ -4413,9 +4425,9 @@ function Qs({
|
|
|
4413
4425
|
{
|
|
4414
4426
|
variant: "ghost",
|
|
4415
4427
|
size: "icon",
|
|
4416
|
-
"aria-label":
|
|
4428
|
+
"aria-label": f("thread_actions", { title: e ?? f("new_conversation") }),
|
|
4417
4429
|
className: u,
|
|
4418
|
-
children: /* @__PURE__ */ n(
|
|
4430
|
+
children: /* @__PURE__ */ n(Qr, { "aria-hidden": !0, className: "size-4" })
|
|
4419
4431
|
}
|
|
4420
4432
|
) }),
|
|
4421
4433
|
/* @__PURE__ */ n(
|
|
@@ -4423,12 +4435,12 @@ function Qs({
|
|
|
4423
4435
|
{
|
|
4424
4436
|
align: "end",
|
|
4425
4437
|
className: "min-w-44 rounded-2xl border-border/60 bg-popover p-1.5 shadow-xl",
|
|
4426
|
-
children: N.map(({ key: v, icon: y, label: b, onSelect: I, destructive:
|
|
4438
|
+
children: N.map(({ key: v, icon: y, label: b, onSelect: I, destructive: k }) => /* @__PURE__ */ d(
|
|
4427
4439
|
we,
|
|
4428
4440
|
{
|
|
4429
|
-
variant:
|
|
4441
|
+
variant: k ? "destructive" : "default",
|
|
4430
4442
|
onSelect: I,
|
|
4431
|
-
className:
|
|
4443
|
+
className: ec,
|
|
4432
4444
|
children: [
|
|
4433
4445
|
/* @__PURE__ */ n(y, { "aria-hidden": !0, className: "size-4" }),
|
|
4434
4446
|
/* @__PURE__ */ n("span", { children: b })
|
|
@@ -4439,11 +4451,11 @@ function Qs({
|
|
|
4439
4451
|
}
|
|
4440
4452
|
)
|
|
4441
4453
|
] }),
|
|
4442
|
-
r.delete && /* @__PURE__ */ n(
|
|
4454
|
+
r.delete && /* @__PURE__ */ n(Zl, { open: g, onOpenChange: p, onRemove: c })
|
|
4443
4455
|
] }) : null;
|
|
4444
4456
|
}
|
|
4445
|
-
function
|
|
4446
|
-
const e =
|
|
4457
|
+
function tc() {
|
|
4458
|
+
const e = Ce(Ws), { thread: t, setPinned: s, share: r, unshare: a, startRenaming: o, remove: i } = Wn();
|
|
4447
4459
|
return /* @__PURE__ */ n(
|
|
4448
4460
|
Qs,
|
|
4449
4461
|
{
|
|
@@ -4460,21 +4472,21 @@ function Zl() {
|
|
|
4460
4472
|
}
|
|
4461
4473
|
);
|
|
4462
4474
|
}
|
|
4463
|
-
function
|
|
4464
|
-
const { t: e } =
|
|
4475
|
+
function nc() {
|
|
4476
|
+
const { t: e } = _("sidebar"), t = Ct(), s = Y((h) => h.history), r = t?.threadId ?? null, a = {
|
|
4465
4477
|
pin: !!(s.enabled && s.showPin),
|
|
4466
4478
|
share: !!(s.enabled && s.showShare),
|
|
4467
4479
|
rename: !!(s.enabled && s.showRename),
|
|
4468
4480
|
delete: !!(s.enabled && s.showDelete)
|
|
4469
|
-
}, o = Object.values(a).some(Boolean), { threads: i, setPinned: l, share: c, unshare: u, rename:
|
|
4481
|
+
}, o = Object.values(a).some(Boolean), { threads: i, setPinned: l, share: c, unshare: u, rename: f, remove: m } = ua({
|
|
4470
4482
|
enabled: o
|
|
4471
4483
|
});
|
|
4472
4484
|
if (!r || !o) return null;
|
|
4473
|
-
const g = i.find((h) => h.id === r),
|
|
4485
|
+
const g = i.find((h) => h.id === r), p = async () => {
|
|
4474
4486
|
const h = window.prompt(e("rename_label"), g?.title ?? "")?.trim();
|
|
4475
4487
|
if (!(!h || h === g?.title))
|
|
4476
4488
|
try {
|
|
4477
|
-
await
|
|
4489
|
+
await f(r, h), B.success(e("rename_success"));
|
|
4478
4490
|
} catch {
|
|
4479
4491
|
B.error(e("rename_failed"));
|
|
4480
4492
|
}
|
|
@@ -4490,32 +4502,32 @@ function ec() {
|
|
|
4490
4502
|
onShare: () => c(r),
|
|
4491
4503
|
onUnshare: () => u(r),
|
|
4492
4504
|
onRename: () => {
|
|
4493
|
-
|
|
4505
|
+
p();
|
|
4494
4506
|
},
|
|
4495
4507
|
onRemove: () => m(r),
|
|
4496
4508
|
triggerClassName: "size-9 rounded-full text-muted-foreground hover:bg-accent/60 hover:text-foreground transition-colors"
|
|
4497
4509
|
}
|
|
4498
4510
|
);
|
|
4499
4511
|
}
|
|
4500
|
-
function
|
|
4501
|
-
const t = K((o) => o.app), { resolvedTheme: s } =
|
|
4512
|
+
function xt({ iconOnly: e = !1 }) {
|
|
4513
|
+
const t = K((o) => o.app), { resolvedTheme: s } = ze(), r = t?.logo ? typeof t.logo == "string" ? t.logo : s === "dark" ? t.logo.dark : t.logo.light : Ra, a = t?.name || "Gentiq";
|
|
4502
4514
|
return /* @__PURE__ */ d("div", { className: x("flex items-center gap-2 select-none min-w-0", !e && "ps-1"), children: [
|
|
4503
4515
|
/* @__PURE__ */ n("img", { src: r, alt: a, className: "size-6 shrink-0 object-contain" }),
|
|
4504
4516
|
!e && /* @__PURE__ */ n("span", { className: "truncate text-base font-medium tracking-tight text-foreground", children: a })
|
|
4505
4517
|
] });
|
|
4506
4518
|
}
|
|
4507
4519
|
function Ks({ hideActions: e = !1 }) {
|
|
4508
|
-
const t = Ct(), s =
|
|
4520
|
+
const t = Ct(), s = Ie(), r = Vs(), { t: a } = _(["sidebar"]), o = K((v) => v.app), { history: i, headerActionsEnabled: l } = Y((v) => v), { HeaderActions: c, headerActions: u, UsageMeter: f } = X(), m = O(
|
|
4509
4521
|
() => (u ?? []).filter(
|
|
4510
4522
|
(v) => l?.[v.id] ?? v.defaultEnabled ?? !0
|
|
4511
4523
|
),
|
|
4512
4524
|
[u, l]
|
|
4513
|
-
), g = Qt(),
|
|
4525
|
+
), g = Qt(), p = !e && (i?.enabled ?? !0), h = p && r !== null;
|
|
4514
4526
|
return /* @__PURE__ */ d("header", { className: "flex items-center justify-between px-3 md:px-5 h-14 sticky top-0 z-40 w-full bg-transparent", children: [
|
|
4515
4527
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 min-w-9", children: (e || g || !h) && /* @__PURE__ */ d($, { children: [
|
|
4516
4528
|
h && /* @__PURE__ */ n(Gs, { className: "hover:bg-accent/60 transition-colors rounded-full size-9 text-muted-foreground hover:text-foreground" }),
|
|
4517
|
-
!e && /* @__PURE__ */ d(
|
|
4518
|
-
/* @__PURE__ */ n(
|
|
4529
|
+
!e && /* @__PURE__ */ d(Je, { children: [
|
|
4530
|
+
/* @__PURE__ */ n(Ze, { asChild: !0, children: /* @__PURE__ */ n(
|
|
4519
4531
|
"button",
|
|
4520
4532
|
{
|
|
4521
4533
|
type: "button",
|
|
@@ -4527,35 +4539,35 @@ function Ks({ hideActions: e = !1 }) {
|
|
|
4527
4539
|
children: /* @__PURE__ */ n(On, { className: "size-4" })
|
|
4528
4540
|
}
|
|
4529
4541
|
) }),
|
|
4530
|
-
/* @__PURE__ */ n(
|
|
4542
|
+
/* @__PURE__ */ n(et, { side: "bottom", className: "text-xs", children: a("new_chat") })
|
|
4531
4543
|
] }),
|
|
4532
|
-
!h && /* @__PURE__ */ n(
|
|
4544
|
+
!h && /* @__PURE__ */ n(xt, {})
|
|
4533
4545
|
] }) }),
|
|
4534
4546
|
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 min-w-9 justify-end", children: !e && /* @__PURE__ */ d($, { children: [
|
|
4535
4547
|
c && /* @__PURE__ */ n(c, { isMobile: g }),
|
|
4536
4548
|
m.map(({ id: v, component: y }) => /* @__PURE__ */ n(y, { isMobile: g }, v)),
|
|
4537
|
-
o?.showUsageBar && /* @__PURE__ */ n(
|
|
4538
|
-
|
|
4539
|
-
!
|
|
4549
|
+
o?.showUsageBar && /* @__PURE__ */ n(f, { details: o.showUsageDetails ?? !0, isMobile: g }),
|
|
4550
|
+
p && /* @__PURE__ */ n(nc, {}),
|
|
4551
|
+
!p && o?.showSettings !== !1 && /* @__PURE__ */ n(Hs, { side: "bottom", align: "end" })
|
|
4540
4552
|
] }) })
|
|
4541
4553
|
] });
|
|
4542
4554
|
}
|
|
4543
|
-
function
|
|
4544
|
-
return /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(
|
|
4555
|
+
function sc(e) {
|
|
4556
|
+
return /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(rc, { ...e }) });
|
|
4545
4557
|
}
|
|
4546
|
-
function
|
|
4558
|
+
function rc({ shareId: e }) {
|
|
4547
4559
|
const [t, s] = C(
|
|
4548
4560
|
null
|
|
4549
|
-
), [r, a] = C(!0), [o, i] = C(null), { t: l } =
|
|
4561
|
+
), [r, a] = C(!0), [o, i] = C(null), { t: l } = _(["chat", "errors"]), { MessageList: c } = X(), u = Ye(), f = U(/* @__PURE__ */ new Set());
|
|
4550
4562
|
return D(() => {
|
|
4551
4563
|
if (!e) return;
|
|
4552
4564
|
let m = !1;
|
|
4553
|
-
const g =
|
|
4565
|
+
const g = f.current;
|
|
4554
4566
|
return (async () => {
|
|
4555
4567
|
try {
|
|
4556
4568
|
a(!0);
|
|
4557
|
-
const
|
|
4558
|
-
|
|
4569
|
+
const p = await u.getSharedThread(e), h = await Fa(
|
|
4570
|
+
Ua(p.items),
|
|
4559
4571
|
async (N) => {
|
|
4560
4572
|
try {
|
|
4561
4573
|
const v = await u.getPublicAttachmentBlobUrl(e, N);
|
|
@@ -4565,26 +4577,26 @@ function nc({ shareId: e }) {
|
|
|
4565
4577
|
}
|
|
4566
4578
|
}
|
|
4567
4579
|
);
|
|
4568
|
-
m || s({ id:
|
|
4569
|
-
} catch (
|
|
4570
|
-
m || i(
|
|
4580
|
+
m || s({ id: p.id, messages: h });
|
|
4581
|
+
} catch (p) {
|
|
4582
|
+
m || i(p);
|
|
4571
4583
|
} finally {
|
|
4572
4584
|
m || a(!1);
|
|
4573
4585
|
}
|
|
4574
4586
|
})(), () => {
|
|
4575
|
-
m = !0, g.forEach((
|
|
4587
|
+
m = !0, g.forEach((p) => URL.revokeObjectURL(p)), g.clear();
|
|
4576
4588
|
};
|
|
4577
|
-
}, [e, u]), r ? /* @__PURE__ */ n("div", { className: "flex h-dvh items-center justify-center bg-background", children: /* @__PURE__ */ n(
|
|
4589
|
+
}, [e, u]), r ? /* @__PURE__ */ n("div", { className: "flex h-dvh items-center justify-center bg-background", children: /* @__PURE__ */ n(Be, {}) }) : t ? /* @__PURE__ */ d("div", { className: "relative flex flex-col h-dvh overflow-hidden bg-background", children: [
|
|
4578
4590
|
/* @__PURE__ */ n(Ks, { hideActions: !0 }),
|
|
4579
|
-
/* @__PURE__ */ n("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ n(
|
|
4591
|
+
/* @__PURE__ */ n("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ n(De.Root, { readonly: !0, children: /* @__PURE__ */ n(Oe.Root, { messages: t.messages, className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ n(c, { className: "pb-8" }) }) }) })
|
|
4580
4592
|
] }) : /* @__PURE__ */ d("div", { className: "flex h-dvh flex-col items-center justify-center p-4 text-center bg-background", children: [
|
|
4581
4593
|
/* @__PURE__ */ n("h1", { className: "text-2xl font-bold text-destructive mb-2 font-display", children: l("shared_not_found_title") }),
|
|
4582
|
-
/* @__PURE__ */ n("p", { className: "text-muted-foreground max-w-md", children: qt(o) ?
|
|
4594
|
+
/* @__PURE__ */ n("p", { className: "text-muted-foreground max-w-md", children: qt(o) ? pe(o, l) : l("shared_not_found_description") })
|
|
4583
4595
|
] });
|
|
4584
4596
|
}
|
|
4585
|
-
function
|
|
4586
|
-
const { t: e } =
|
|
4587
|
-
return /* @__PURE__ */ n(
|
|
4597
|
+
function ac() {
|
|
4598
|
+
const { t: e } = _("sidebar"), { state: t, isMobile: s, setOpenMobile: r } = at(), a = Ie(), o = !s && t === "collapsed";
|
|
4599
|
+
return /* @__PURE__ */ n(bt, { className: o ? "mt-1 flex items-center" : "mt-1 mb-4 px-2", children: /* @__PURE__ */ n(Jt, { children: /* @__PURE__ */ n(
|
|
4588
4600
|
Zt,
|
|
4589
4601
|
{
|
|
4590
4602
|
asChild: !0,
|
|
@@ -4615,8 +4627,8 @@ function sc() {
|
|
|
4615
4627
|
}
|
|
4616
4628
|
) }) });
|
|
4617
4629
|
}
|
|
4618
|
-
function
|
|
4619
|
-
const { t: e } =
|
|
4630
|
+
function oc() {
|
|
4631
|
+
const { t: e } = _("sidebar");
|
|
4620
4632
|
return /* @__PURE__ */ n(se.LoadMore, { className: "group/more min-h-4 w-full", children: /* @__PURE__ */ d(
|
|
4621
4633
|
"div",
|
|
4622
4634
|
{
|
|
@@ -4635,23 +4647,23 @@ function rc() {
|
|
|
4635
4647
|
}
|
|
4636
4648
|
) });
|
|
4637
4649
|
}
|
|
4638
|
-
function
|
|
4639
|
-
const { t: e } =
|
|
4650
|
+
function ic() {
|
|
4651
|
+
const { t: e } = _("sidebar");
|
|
4640
4652
|
return /* @__PURE__ */ d(
|
|
4641
|
-
|
|
4653
|
+
je.Root,
|
|
4642
4654
|
{
|
|
4643
4655
|
onRenamed: () => B.success(e("rename_success")),
|
|
4644
4656
|
onRenameFailed: () => B.error(e("rename_failed")),
|
|
4645
4657
|
className: "flex items-center gap-1 px-2 py-1.5 w-full",
|
|
4646
4658
|
children: [
|
|
4647
4659
|
/* @__PURE__ */ n(
|
|
4648
|
-
|
|
4660
|
+
je.Input,
|
|
4649
4661
|
{
|
|
4650
4662
|
"aria-label": e("rename_label"),
|
|
4651
4663
|
className: "h-8 min-w-0 flex-1 rounded-md border border-input bg-transparent px-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50"
|
|
4652
4664
|
}
|
|
4653
4665
|
),
|
|
4654
|
-
/* @__PURE__ */ n(
|
|
4666
|
+
/* @__PURE__ */ n(je.Save, { asChild: !0, children: /* @__PURE__ */ n(
|
|
4655
4667
|
E,
|
|
4656
4668
|
{
|
|
4657
4669
|
type: "submit",
|
|
@@ -4662,7 +4674,7 @@ function ac() {
|
|
|
4662
4674
|
children: /* @__PURE__ */ n(An, { "aria-hidden": !0, className: "size-4" })
|
|
4663
4675
|
}
|
|
4664
4676
|
) }),
|
|
4665
|
-
/* @__PURE__ */ n(
|
|
4677
|
+
/* @__PURE__ */ n(je.Cancel, { asChild: !0, children: /* @__PURE__ */ n(
|
|
4666
4678
|
E,
|
|
4667
4679
|
{
|
|
4668
4680
|
type: "button",
|
|
@@ -4670,16 +4682,16 @@ function ac() {
|
|
|
4670
4682
|
variant: "ghost",
|
|
4671
4683
|
"aria-label": e("cancel"),
|
|
4672
4684
|
className: "size-8 shrink-0 text-destructive hover:bg-destructive/10",
|
|
4673
|
-
children: /* @__PURE__ */ n(
|
|
4685
|
+
children: /* @__PURE__ */ n(Nt, { "aria-hidden": !0, className: "size-4" })
|
|
4674
4686
|
}
|
|
4675
4687
|
) })
|
|
4676
4688
|
]
|
|
4677
4689
|
}
|
|
4678
4690
|
);
|
|
4679
4691
|
}
|
|
4680
|
-
function
|
|
4681
|
-
const { t: e } =
|
|
4682
|
-
return /* @__PURE__ */ n(se.Item, { asChild: !0, children: /* @__PURE__ */ n(Jt, { className: "group/sidebar-menu-item relative", children: a ? /* @__PURE__ */ n(
|
|
4692
|
+
function lc() {
|
|
4693
|
+
const { t: e } = _("sidebar"), { isMobile: t, setOpenMobile: s } = at(), { thread: r, isRenaming: a } = Wn(), o = Ie();
|
|
4694
|
+
return /* @__PURE__ */ n(se.Item, { asChild: !0, children: /* @__PURE__ */ n(Jt, { className: "group/sidebar-menu-item relative", children: a ? /* @__PURE__ */ n(ic, {}) : /* @__PURE__ */ d($, { children: [
|
|
4683
4695
|
/* @__PURE__ */ n(
|
|
4684
4696
|
Zt,
|
|
4685
4697
|
{
|
|
@@ -4711,12 +4723,12 @@ function oc() {
|
|
|
4711
4723
|
/* @__PURE__ */ n(Dn, { "aria-hidden": !0, className: "size-3.5 text-primary opacity-70" }),
|
|
4712
4724
|
/* @__PURE__ */ n("span", { className: "sr-only", children: e("pinned") })
|
|
4713
4725
|
] }),
|
|
4714
|
-
/* @__PURE__ */ n(
|
|
4726
|
+
/* @__PURE__ */ n(tc, {})
|
|
4715
4727
|
] })
|
|
4716
4728
|
] }) }) });
|
|
4717
4729
|
}
|
|
4718
|
-
function
|
|
4719
|
-
const { t: s } =
|
|
4730
|
+
function cc({ autoFocus: e, onClose: t } = {}) {
|
|
4731
|
+
const { t: s } = _(["sidebar", "common"]);
|
|
4720
4732
|
return /* @__PURE__ */ d("div", { className: "relative group/search", children: [
|
|
4721
4733
|
/* @__PURE__ */ n(
|
|
4722
4734
|
En,
|
|
@@ -4744,17 +4756,17 @@ function ic({ autoFocus: e, onClose: t } = {}) {
|
|
|
4744
4756
|
onClick: t,
|
|
4745
4757
|
"aria-label": s("common:close"),
|
|
4746
4758
|
className: "absolute end-1.5 top-1/2 -translate-y-1/2 flex size-6 items-center justify-center rounded-full text-muted-foreground hover:bg-sidebar-accent hover:text-foreground transition-colors",
|
|
4747
|
-
children: /* @__PURE__ */ n(
|
|
4759
|
+
children: /* @__PURE__ */ n(Nt, { "aria-hidden": !0, className: "size-3.5" })
|
|
4748
4760
|
}
|
|
4749
4761
|
)
|
|
4750
4762
|
] });
|
|
4751
4763
|
}
|
|
4752
4764
|
const _n = "rounded-full text-muted-foreground hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors";
|
|
4753
|
-
function
|
|
4754
|
-
const { t } =
|
|
4755
|
-
() => ({ pin: c, share: u, rename:
|
|
4756
|
-
[c, u,
|
|
4757
|
-
),
|
|
4765
|
+
function dc({ side: e = "start" }) {
|
|
4766
|
+
const { t } = _(["sidebar", "settings"]), s = Y((y) => y.history), r = Ie(), a = Vs(), { groups: o } = Xt(), [i, l] = C(!1), { showPin: c, showShare: u, showRename: f, showDelete: m } = s, g = O(
|
|
4767
|
+
() => ({ pin: c, share: u, rename: f, delete: m }),
|
|
4768
|
+
[c, u, f, m]
|
|
4769
|
+
), p = r?.activeSection != null, h = !a?.isMobile && a?.state === "collapsed", N = () => a?.isMobile && a.setOpenMobile(!1), v = !p && s.enabled && /* @__PURE__ */ n(
|
|
4758
4770
|
E,
|
|
4759
4771
|
{
|
|
4760
4772
|
type: "button",
|
|
@@ -4774,14 +4786,14 @@ function lc({ side: e = "start" }) {
|
|
|
4774
4786
|
}
|
|
4775
4787
|
);
|
|
4776
4788
|
return /* @__PURE__ */ n(
|
|
4777
|
-
|
|
4789
|
+
Kl,
|
|
4778
4790
|
{
|
|
4779
4791
|
collapsible: "icon",
|
|
4780
4792
|
side: e,
|
|
4781
4793
|
className: "bg-sidebar text-sidebar-foreground border-none select-none",
|
|
4782
4794
|
children: /* @__PURE__ */ d(se.Root, { enabled: s.enabled, className: "flex flex-1 min-h-0 flex-col", children: [
|
|
4783
4795
|
/* @__PURE__ */ d(
|
|
4784
|
-
|
|
4796
|
+
Xl,
|
|
4785
4797
|
{
|
|
4786
4798
|
className: x("pt-3 pb-1 gap-2.5", h ? "px-2 items-center" : "px-3"),
|
|
4787
4799
|
children: [
|
|
@@ -4794,16 +4806,16 @@ function lc({ side: e = "start" }) {
|
|
|
4794
4806
|
"aria-label": t("toggle"),
|
|
4795
4807
|
onClick: () => a?.setOpen(!0),
|
|
4796
4808
|
className: "size-9 rounded-full hover:bg-sidebar-accent",
|
|
4797
|
-
children: /* @__PURE__ */ n(
|
|
4809
|
+
children: /* @__PURE__ */ n(xt, { iconOnly: !0 })
|
|
4798
4810
|
}
|
|
4799
4811
|
) : /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 px-1", children: [
|
|
4800
|
-
/* @__PURE__ */ n(
|
|
4812
|
+
/* @__PURE__ */ n(xt, {}),
|
|
4801
4813
|
/* @__PURE__ */ d("div", { className: "flex items-center gap-0.5 shrink-0", children: [
|
|
4802
4814
|
v,
|
|
4803
4815
|
/* @__PURE__ */ n(Gs, { className: x("size-8", _n) })
|
|
4804
4816
|
] })
|
|
4805
4817
|
] }),
|
|
4806
|
-
|
|
4818
|
+
p ? /* @__PURE__ */ d(
|
|
4807
4819
|
E,
|
|
4808
4820
|
{
|
|
4809
4821
|
type: "button",
|
|
@@ -4818,25 +4830,25 @@ function lc({ side: e = "start" }) {
|
|
|
4818
4830
|
h ? "size-9 justify-center" : "w-full justify-start gap-2.5 px-3 h-10"
|
|
4819
4831
|
),
|
|
4820
4832
|
children: [
|
|
4821
|
-
/* @__PURE__ */ n(
|
|
4833
|
+
/* @__PURE__ */ n(Kr, { className: "size-4 shrink-0 rtl:rotate-180" }),
|
|
4822
4834
|
!h && /* @__PURE__ */ n("span", { className: "truncate", children: t("settings:back_to_chat") })
|
|
4823
4835
|
]
|
|
4824
4836
|
}
|
|
4825
4837
|
) : /* @__PURE__ */ d($, { children: [
|
|
4826
|
-
/* @__PURE__ */ n(
|
|
4838
|
+
/* @__PURE__ */ n(ac, {}),
|
|
4827
4839
|
h && v,
|
|
4828
|
-
!h && s.enabled && i && /* @__PURE__ */ n(
|
|
4840
|
+
!h && s.enabled && i && /* @__PURE__ */ n(cc, { autoFocus: !0, onClose: () => l(!1) })
|
|
4829
4841
|
] })
|
|
4830
4842
|
]
|
|
4831
4843
|
}
|
|
4832
4844
|
),
|
|
4833
4845
|
/* @__PURE__ */ n(
|
|
4834
|
-
|
|
4846
|
+
Jl,
|
|
4835
4847
|
{
|
|
4836
4848
|
className: x("py-2 custom-scrollbar", h ? "px-2 items-center" : "px-3"),
|
|
4837
|
-
children:
|
|
4849
|
+
children: p ? o.map((y) => /* @__PURE__ */ d("div", { className: "mb-3 last:mb-0", children: [
|
|
4838
4850
|
!h && /* @__PURE__ */ n("div", { className: "px-3 pb-1 pt-2 text-xs font-medium text-muted-foreground", children: y.title }),
|
|
4839
|
-
/* @__PURE__ */ n(
|
|
4851
|
+
/* @__PURE__ */ n(bt, { className: x("gap-0.5", h && "items-center"), children: y.items.map((b) => /* @__PURE__ */ n(Jt, { children: /* @__PURE__ */ d(
|
|
4840
4852
|
Zt,
|
|
4841
4853
|
{
|
|
4842
4854
|
type: "button",
|
|
@@ -4857,18 +4869,18 @@ function lc({ side: e = "start" }) {
|
|
|
4857
4869
|
}
|
|
4858
4870
|
) }, b.id)) })
|
|
4859
4871
|
] }, y.title)) : !h && s.enabled && /* @__PURE__ */ d(Ws.Provider, { value: g, children: [
|
|
4860
|
-
/* @__PURE__ */ n(
|
|
4872
|
+
/* @__PURE__ */ n(bt, { className: "gap-0.5", children: /* @__PURE__ */ n(se.Items, { component: lc }) }),
|
|
4861
4873
|
/* @__PURE__ */ n(se.Empty, { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: t("no_conversations") }),
|
|
4862
|
-
/* @__PURE__ */ n(
|
|
4874
|
+
/* @__PURE__ */ n(oc, {})
|
|
4863
4875
|
] })
|
|
4864
4876
|
}
|
|
4865
4877
|
),
|
|
4866
|
-
/* @__PURE__ */ n(
|
|
4878
|
+
/* @__PURE__ */ n(Yl, { className: "p-0", children: /* @__PURE__ */ n(uc, { collapsed: h }) })
|
|
4867
4879
|
] })
|
|
4868
4880
|
}
|
|
4869
4881
|
);
|
|
4870
4882
|
}
|
|
4871
|
-
function
|
|
4883
|
+
function uc({ collapsed: e }) {
|
|
4872
4884
|
const t = K((i) => i.app), { displayName: s, initial: r, planLabel: a } = qs(), o = t?.showSettings !== !1;
|
|
4873
4885
|
return (!s || e) && !o ? null : /* @__PURE__ */ d(
|
|
4874
4886
|
"div",
|
|
@@ -4884,10 +4896,10 @@ function cc({ collapsed: e }) {
|
|
|
4884
4896
|
}
|
|
4885
4897
|
);
|
|
4886
4898
|
}
|
|
4887
|
-
function
|
|
4888
|
-
return /* @__PURE__ */ n(Kt, { components: e, disclaimer: t, welcome: s, children: /* @__PURE__ */ n(
|
|
4899
|
+
function mc({ components: e, disclaimer: t, welcome: s, ...r }) {
|
|
4900
|
+
return /* @__PURE__ */ n(Kt, { components: e, disclaimer: t, welcome: s, children: /* @__PURE__ */ n(hc, { ...r }) });
|
|
4889
4901
|
}
|
|
4890
|
-
function
|
|
4902
|
+
function hc({
|
|
4891
4903
|
threadId: e,
|
|
4892
4904
|
onThreadChange: t,
|
|
4893
4905
|
getThreadHref: s,
|
|
@@ -4896,14 +4908,14 @@ function uc({
|
|
|
4896
4908
|
header: o,
|
|
4897
4909
|
classNames: i
|
|
4898
4910
|
}) {
|
|
4899
|
-
const l = Y((v) => v.history.enabled), { MaintenanceBanner: c, MaintenanceScreen: u } = X(), [
|
|
4911
|
+
const l = Y((v) => v.history.enabled), { MaintenanceBanner: c, MaintenanceScreen: u } = X(), [f, m] = C(null), g = U(null), p = O(
|
|
4900
4912
|
() => ({
|
|
4901
|
-
activeSection:
|
|
4913
|
+
activeSection: f,
|
|
4902
4914
|
openSection: m,
|
|
4903
4915
|
close: () => m(null),
|
|
4904
4916
|
triggerRef: g
|
|
4905
4917
|
}),
|
|
4906
|
-
[
|
|
4918
|
+
[f]
|
|
4907
4919
|
), h = Hn(), N = h.isUnderMaintenance && h.status ? {
|
|
4908
4920
|
status: h.status,
|
|
4909
4921
|
title: h.title,
|
|
@@ -4919,39 +4931,39 @@ function uc({
|
|
|
4919
4931
|
onThreadChange: t,
|
|
4920
4932
|
getThreadHref: s,
|
|
4921
4933
|
getShareHref: r,
|
|
4922
|
-
children: /* @__PURE__ */ n(Ls.Provider, { value:
|
|
4923
|
-
a !== void 0 ? a : l ||
|
|
4934
|
+
children: /* @__PURE__ */ n(Ls.Provider, { value: p, children: /* @__PURE__ */ d(Ql, { defaultOpen: l, className: "bg-background", children: [
|
|
4935
|
+
a !== void 0 ? a : l || f !== null ? /* @__PURE__ */ n(dc, {}) : null,
|
|
4924
4936
|
/* @__PURE__ */ d("div", { className: "flex flex-col flex-1 h-dvh overflow-hidden relative bg-background", children: [
|
|
4925
4937
|
o !== void 0 ? o : /* @__PURE__ */ n(Ks, {}),
|
|
4926
4938
|
N && c && /* @__PURE__ */ n(c, { ...N }),
|
|
4927
|
-
/* @__PURE__ */ n("div", { className: "flex flex-col relative w-full flex-1 min-h-0 overflow-hidden", children:
|
|
4939
|
+
/* @__PURE__ */ n("div", { className: "flex flex-col relative w-full flex-1 min-h-0 overflow-hidden", children: f !== null ? /* @__PURE__ */ n(Vl, {}) : /* @__PURE__ */ n(Ml, { classNames: i }) })
|
|
4928
4940
|
] })
|
|
4929
4941
|
] }) })
|
|
4930
4942
|
}
|
|
4931
4943
|
) });
|
|
4932
4944
|
}
|
|
4933
|
-
const
|
|
4945
|
+
const Me = /* @__PURE__ */ new Set();
|
|
4934
4946
|
let xe = null;
|
|
4935
|
-
function
|
|
4936
|
-
for (const e of
|
|
4947
|
+
function vt() {
|
|
4948
|
+
for (const e of Me) e();
|
|
4937
4949
|
}
|
|
4938
|
-
function
|
|
4939
|
-
return
|
|
4940
|
-
|
|
4950
|
+
function fc(e) {
|
|
4951
|
+
return Me.size === 0 && window.addEventListener("popstate", vt), Me.add(e), () => {
|
|
4952
|
+
Me.delete(e), Me.size === 0 && window.removeEventListener("popstate", vt);
|
|
4941
4953
|
};
|
|
4942
4954
|
}
|
|
4943
|
-
function
|
|
4955
|
+
function pc() {
|
|
4944
4956
|
const { pathname: e, search: t, hash: s } = window.location, r = window.history.state;
|
|
4945
4957
|
return (xe?.pathname !== e || xe.search !== t || xe.hash !== s || xe.state !== r) && (xe = { pathname: e, search: t, hash: s, state: r }), xe;
|
|
4946
4958
|
}
|
|
4947
|
-
const
|
|
4948
|
-
function
|
|
4949
|
-
return Ln(
|
|
4959
|
+
const gc = () => null;
|
|
4960
|
+
function bc() {
|
|
4961
|
+
return Ln(fc, pc, gc);
|
|
4950
4962
|
}
|
|
4951
|
-
function
|
|
4952
|
-
t ? window.history.replaceState(s, "", e) : window.history.pushState(s, "", e),
|
|
4963
|
+
function Ve(e, { replace: t = !1, state: s = null } = {}) {
|
|
4964
|
+
t ? window.history.replaceState(s, "", e) : window.history.pushState(s, "", e), vt();
|
|
4953
4965
|
}
|
|
4954
|
-
const
|
|
4966
|
+
const xc = {
|
|
4955
4967
|
chat: "/chat",
|
|
4956
4968
|
login: "/login",
|
|
4957
4969
|
shared: "/shared",
|
|
@@ -4961,8 +4973,8 @@ function ye(e) {
|
|
|
4961
4973
|
const t = e.replace(/^\/+|\/+$/g, "");
|
|
4962
4974
|
return t ? `/${t}` : "";
|
|
4963
4975
|
}
|
|
4964
|
-
function
|
|
4965
|
-
const s = ye(e), r = { ...
|
|
4976
|
+
function vc(e, t = {}) {
|
|
4977
|
+
const s = ye(e), r = { ...xc, ...t };
|
|
4966
4978
|
return {
|
|
4967
4979
|
chat: s + ye(r.chat),
|
|
4968
4980
|
login: s + ye(r.login),
|
|
@@ -4981,17 +4993,17 @@ function Sn(e, t) {
|
|
|
4981
4993
|
return;
|
|
4982
4994
|
}
|
|
4983
4995
|
}
|
|
4984
|
-
function
|
|
4996
|
+
function yc(e, t) {
|
|
4985
4997
|
const s = ye(e);
|
|
4986
4998
|
if (s === t.admin || s.startsWith(`${t.admin}/`)) return { name: "admin" };
|
|
4987
4999
|
if (s === t.login) return { name: "login" };
|
|
4988
5000
|
const r = Sn(s, t.shared);
|
|
4989
5001
|
return r ? { name: "shared", shareId: r } : { name: "chat", threadId: Sn(s, t.chat) ?? null };
|
|
4990
5002
|
}
|
|
4991
|
-
function
|
|
5003
|
+
function dt(e, t) {
|
|
4992
5004
|
return e === null ? t.chat || "/" : `${t.chat}/${encodeURIComponent(e)}`;
|
|
4993
5005
|
}
|
|
4994
|
-
function
|
|
5006
|
+
function jc({
|
|
4995
5007
|
url: e,
|
|
4996
5008
|
api: t,
|
|
4997
5009
|
basePath: s = "/",
|
|
@@ -5002,13 +5014,13 @@ function qc({
|
|
|
5002
5014
|
welcome: l,
|
|
5003
5015
|
threadActions: c,
|
|
5004
5016
|
composer: u,
|
|
5005
|
-
disclaimer:
|
|
5017
|
+
disclaimer: f,
|
|
5006
5018
|
settings: m,
|
|
5007
5019
|
...g
|
|
5008
5020
|
}) {
|
|
5009
|
-
const
|
|
5010
|
-
return
|
|
5011
|
-
/* @__PURE__ */ n(
|
|
5021
|
+
const p = bc();
|
|
5022
|
+
return p ? /* @__PURE__ */ d(El, { ...g, api: { ...t, basePath: e }, children: [
|
|
5023
|
+
/* @__PURE__ */ n(Ll, {}),
|
|
5012
5024
|
/* @__PURE__ */ n(
|
|
5013
5025
|
Kt,
|
|
5014
5026
|
{
|
|
@@ -5017,107 +5029,108 @@ function qc({
|
|
|
5017
5029
|
welcome: l,
|
|
5018
5030
|
threadActions: c,
|
|
5019
5031
|
composer: u,
|
|
5020
|
-
disclaimer:
|
|
5032
|
+
disclaimer: f,
|
|
5021
5033
|
settings: m,
|
|
5022
|
-
children: /* @__PURE__ */ n(
|
|
5034
|
+
children: /* @__PURE__ */ n(wc, { location: p, paths: vc(s, r), admin: a })
|
|
5023
5035
|
}
|
|
5024
5036
|
)
|
|
5025
5037
|
] }) : null;
|
|
5026
5038
|
}
|
|
5027
|
-
function
|
|
5028
|
-
const r =
|
|
5029
|
-
if (r.name === "admin" && s) return /* @__PURE__ */ n(
|
|
5039
|
+
function wc({ location: e, paths: t, admin: s }) {
|
|
5040
|
+
const r = yc(e.pathname, t), a = dt(null, t);
|
|
5041
|
+
if (r.name === "admin" && s) return /* @__PURE__ */ n(Ae, { fallback: null, children: s });
|
|
5030
5042
|
if (r.name === "login") {
|
|
5031
|
-
const { reason: u, from:
|
|
5032
|
-
return /* @__PURE__ */ n(
|
|
5043
|
+
const { reason: u, from: f } = _c(e.state);
|
|
5044
|
+
return /* @__PURE__ */ n(Gl, { reason: u, onSignedIn: () => Ve(f ?? a, { replace: !0 }) });
|
|
5033
5045
|
}
|
|
5034
|
-
if (r.name === "shared") return /* @__PURE__ */ n(
|
|
5046
|
+
if (r.name === "shared") return /* @__PURE__ */ n(sc, { shareId: r.shareId });
|
|
5035
5047
|
const o = r.name === "chat" ? r.threadId : null, i = new URLSearchParams(e.search), l = i.get("code");
|
|
5036
5048
|
return /* @__PURE__ */ n(
|
|
5037
|
-
|
|
5049
|
+
ql,
|
|
5038
5050
|
{
|
|
5039
5051
|
loginCode: l,
|
|
5040
5052
|
onLoginCodeUsed: () => {
|
|
5041
5053
|
i.delete("code");
|
|
5042
5054
|
const u = i.toString();
|
|
5043
|
-
|
|
5055
|
+
Ve(e.pathname + (u ? `?${u}` : "") + e.hash, { replace: !0 });
|
|
5044
5056
|
},
|
|
5045
|
-
fallback: (u) => /* @__PURE__ */ n(
|
|
5057
|
+
fallback: (u) => /* @__PURE__ */ n(Sc, { to: t.login, reason: u, from: e.pathname + e.search }),
|
|
5046
5058
|
children: /* @__PURE__ */ n(
|
|
5047
|
-
|
|
5059
|
+
mc,
|
|
5048
5060
|
{
|
|
5049
5061
|
threadId: o,
|
|
5050
|
-
onThreadChange: (u) =>
|
|
5051
|
-
getThreadHref: (u) =>
|
|
5062
|
+
onThreadChange: (u) => Ve(dt(u, t)),
|
|
5063
|
+
getThreadHref: (u) => dt(u, t),
|
|
5052
5064
|
getShareHref: (u) => `${t.shared}/${encodeURIComponent(u)}`
|
|
5053
5065
|
}
|
|
5054
5066
|
)
|
|
5055
5067
|
}
|
|
5056
5068
|
);
|
|
5057
5069
|
}
|
|
5058
|
-
const
|
|
5070
|
+
const Nc = [
|
|
5059
5071
|
"signed_out",
|
|
5060
5072
|
"session_expired",
|
|
5061
5073
|
"handoff_failed"
|
|
5062
5074
|
];
|
|
5063
|
-
function
|
|
5064
|
-
return typeof e == "string" &&
|
|
5075
|
+
function kc(e) {
|
|
5076
|
+
return typeof e == "string" && Nc.includes(e);
|
|
5065
5077
|
}
|
|
5066
|
-
function
|
|
5078
|
+
function _c(e) {
|
|
5067
5079
|
if (typeof e != "object" || e === null) return {};
|
|
5068
5080
|
const { reason: t, from: s } = e;
|
|
5069
5081
|
return {
|
|
5070
|
-
reason:
|
|
5082
|
+
reason: kc(t) ? t : void 0,
|
|
5071
5083
|
// Only a path on this site: a full URL here would make the sign-in page an open redirect.
|
|
5072
5084
|
from: typeof s == "string" && s.startsWith("/") && !s.startsWith("//") ? s : void 0
|
|
5073
5085
|
};
|
|
5074
5086
|
}
|
|
5075
|
-
function
|
|
5087
|
+
function Sc({ to: e, reason: t, from: s }) {
|
|
5076
5088
|
return D(() => {
|
|
5077
|
-
|
|
5089
|
+
Ve(e, { replace: !0, state: { reason: t, from: s } });
|
|
5078
5090
|
}, [e, t, s]), null;
|
|
5079
5091
|
}
|
|
5080
5092
|
export {
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5093
|
+
dc as A,
|
|
5094
|
+
rt as B,
|
|
5095
|
+
Ml as C,
|
|
5096
|
+
Ll as D,
|
|
5097
|
+
Y as E,
|
|
5098
|
+
li as F,
|
|
5099
|
+
jc as G,
|
|
5088
5100
|
ps as H,
|
|
5089
|
-
|
|
5101
|
+
fs as I,
|
|
5102
|
+
xl as M,
|
|
5090
5103
|
Ps as P,
|
|
5091
5104
|
Es as Q,
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5105
|
+
Xo as R,
|
|
5106
|
+
Vl as S,
|
|
5107
|
+
Wo as T,
|
|
5108
|
+
bl as U,
|
|
5109
|
+
il as W,
|
|
5097
5110
|
hn as a,
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5111
|
+
hl as b,
|
|
5112
|
+
mc as c,
|
|
5113
|
+
ll as d,
|
|
5114
|
+
hi as e,
|
|
5115
|
+
Hi as f,
|
|
5116
|
+
gi as g,
|
|
5117
|
+
jl as h,
|
|
5118
|
+
ml as i,
|
|
5119
|
+
El as j,
|
|
5120
|
+
ue as k,
|
|
5121
|
+
Kt as l,
|
|
5122
|
+
vl as m,
|
|
5123
|
+
Oi as n,
|
|
5124
|
+
Ai as o,
|
|
5125
|
+
al as p,
|
|
5126
|
+
$l as q,
|
|
5127
|
+
ci as r,
|
|
5128
|
+
gs as s,
|
|
5129
|
+
ql as t,
|
|
5130
|
+
sc as u,
|
|
5131
|
+
Ql as v,
|
|
5132
|
+
ul as w,
|
|
5133
|
+
dl as x,
|
|
5134
|
+
ii as y,
|
|
5135
|
+
Gl as z
|
|
5123
5136
|
};
|