@gentiq/ui 1.0.0-alpha.5 → 1.0.0-alpha.7
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/{MessageEditor-CTATfUm3.js → MessageEditor-thFldVmz.js} +1 -1
- package/dist/{VoiceInput-CYuGXRYZ.js → VoiceInput-XbeKOMjo.js} +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +2 -2
- package/dist/internal.d.ts +1 -1
- package/dist/internal.es.js +2 -2
- package/dist/{shared-BPpDLW8N.js → shared-BtZa4J_w.js} +16 -34
- package/dist/{shared-Yglb7Id_.js → shared-CDBfvRf2.js} +862 -834
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as n, jsxs as
|
|
2
|
+
import { jsx as n, jsxs as d, Fragment as $ } from "react/jsx-runtime";
|
|
3
3
|
import { QuoteIcon as Qe, ChevronDownIcon as Ke, BrainIcon as er, ImagePlusIcon as tr, CodeIcon as nr, DownloadIcon as dt, 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 _e, CheckIcon as vt, RefreshCcwIcon as mr, ThumbsUpIcon as hr, ThumbsDownIcon as pr, PencilIcon as fr, SquareIcon as tn, AlertCircleIcon as gr, RotateCwIcon as br, CameraOffIcon as xr, Loader2Icon as yt, 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, Settings as Re, Globe as Ar, X as wt, AtSign as Dr, Mail as Or, Smartphone as Er, Lock as Lr, Save as qr, Zap as $r, LogOut as Rn, ChevronRight as jr, Check as An, PanelLeftIcon as Fr, PinOff as Ur, Pin as Dn, Share2 as Br, Link2Off as Hr, Pencil as Vr, Trash as Gr, MoreVertical as Wr, SquarePen as On, Search as En, ArrowLeft as Qr } from "lucide-react";
|
|
4
|
-
import * as
|
|
5
|
-
import { useRef as
|
|
6
|
-
import { withDefaults as ie, useServerConfig as Le, createOptionsStore as kt, useOptionsStore as jn, useGentiqOptions as
|
|
4
|
+
import * as ee from "react";
|
|
5
|
+
import { useRef as U, useState as C, useEffect as D, useContext as Se, useMemo as O, createContext as Oe, useSyncExternalStore as Ln, useLayoutEffect as qn, memo as Ee, useCallback as de, Component as Kr, Suspense as Ve, lazy as Nt, Children as Xr, forwardRef as $n, createElement as Yr, useId as Jr } from "react";
|
|
6
|
+
import { withDefaults as ie, useServerConfig as Le, createOptionsStore as kt, useOptionsStore as jn, useGentiqOptions as K, useGentiqTranslation as k, References as Ae, useMessage as W, useGentiqLanguage as V, useToolApproval as Zr, useFileUrl as ea, useChatReferencesActions as ta, useThreadView as ve, useThreadScope as Fn, Thread as De, localizeError as na, Message as le, ActionBar as be, getLocalizedErrorMessage as fe, Composer as pe, useComposer as _t, useGentiqUser as Un, useComposerVoice as Bn, useGentiqStatus as Hn, useGentiqFeature as sa, useComposerRoot as ra, useGentiqEntitlement as St, useTheme as Ce, useThreadSelection as Ct, ThreadSelectionProvider as Vn, useThread as aa, GentiqRuntimeProvider as oa, useLoginCodeExchange as ia, useAuthSession as la, useGentiqApi as Xe, useGentiqQueryClient as Gn, useGentiqKeys as ca, useThreadListItem as Wn, useThreads as da, ThreadList as se, ThreadRename as $e } from "@gentiq/react";
|
|
7
7
|
import { Slot as ua } from "@radix-ui/react-slot";
|
|
8
|
-
import { c as
|
|
9
|
-
import { toast as
|
|
8
|
+
import { c as x, u as X, C as zt, a as It, b as Tt, D as qe, d as Qn, B as E, e as Mt, f as Kn, g as Xn, h as ma, L as Ue, T as Ye, i as Je, j as Ze, k as Yn, l as Pt, m as Rt, n as At, o as we, p as ha, q as Jn, r as pa, s as Zn, t as Dt, v as fa, w as Ot, x as ut, y as Et, z as Lt, A as ga, S as ba, E as xa, P as va, 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 ya, Q as wa, R as Na, U as ka, V as _a, W as Sa, X as Ca, Y as za, Z as Ia, _ as Ta, $ as Ma, a0 as Pa } from "./shared-BtZa4J_w.js";
|
|
9
|
+
import { toast as B, Toaster as Ra } from "sonner";
|
|
10
10
|
import { getTextDirection as oe, resolveMessageId as Aa, writeStored as Da, readStored as Oa, isGentiqError as qt, HIDDEN_PART_TYPES as Ea, messageText as La, textOrKey as Ne, evaluateCondition as $t, getAvailableLanguages as qa, getLanguageNativeName as $a, withAttachmentUrls as ja, toGentiqMessages as Fa } from "@gentiq/core";
|
|
11
11
|
import Ua from "rehype-sanitize";
|
|
12
12
|
import { defaultRemarkPlugins as Ba, Streamdown as Ha, defaultRehypePlugins as jt } from "streamdown";
|
|
@@ -18,7 +18,7 @@ import * as ke from "@radix-ui/react-dialog";
|
|
|
18
18
|
import * as Me from "@radix-ui/react-scroll-area";
|
|
19
19
|
import * as We from "@radix-ui/react-hover-card";
|
|
20
20
|
function Qa() {
|
|
21
|
-
const e =
|
|
21
|
+
const e = U(null), [t, s] = C(0);
|
|
22
22
|
return D(() => {
|
|
23
23
|
const r = e.current;
|
|
24
24
|
if (!r) return;
|
|
@@ -140,14 +140,14 @@ function at(e, t, s) {
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
const mt = Oe(null);
|
|
143
|
-
function
|
|
143
|
+
function Y(e) {
|
|
144
144
|
const t = Se(mt), s = Le(), 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(
|
|
148
148
|
"div",
|
|
149
149
|
{
|
|
150
|
-
className:
|
|
150
|
+
className: x(
|
|
151
151
|
"group flex w-full items-end gap-3",
|
|
152
152
|
t === "user" ? "is-user justify-end" : "is-assistant",
|
|
153
153
|
e
|
|
@@ -157,7 +157,7 @@ const Ut = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
|
|
|
157
157
|
), Bt = ({ children: e, className: t, isPlain: s, ...r }) => /* @__PURE__ */ n(
|
|
158
158
|
"div",
|
|
159
159
|
{
|
|
160
|
-
className:
|
|
160
|
+
className: x(
|
|
161
161
|
"flex flex-col gap-2 overflow-hidden text-base group-[.is-assistant]:bg-transparent group-[.is-assistant]:px-0 group-[.is-assistant]:py-1 group-[.is-assistant]:w-full group-[.is-assistant]:leading-[1.7]",
|
|
162
162
|
!s && "group-[.is-user]:rounded-3xl group-[.is-user]:bg-bubble group-[.is-user]:text-bubble-foreground group-[.is-user]:px-5 group-[.is-user]:py-3.5 group-[.is-user]:max-w-[88%] md:group-[.is-user]:max-w-[75%]",
|
|
163
163
|
t
|
|
@@ -177,8 +177,8 @@ const Ut = ({ className: e, from: t, ...s }) => /* @__PURE__ */ n(
|
|
|
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
|
-
const
|
|
181
|
-
return !
|
|
180
|
+
const c = a ?? o ?? i ?? "";
|
|
181
|
+
return !c.trim() || Ya.test(c) || !Ja(e, l) ? s : `$$${no(c)}$$`;
|
|
182
182
|
};
|
|
183
183
|
return e.replace(Xa, t);
|
|
184
184
|
}, as = (e) => e.type === "element", os = (e) => {
|
|
@@ -406,9 +406,9 @@ const Ro = { linkMode: "text-only" }, Ao = { enabled: !1 }, Ht = (e) => {
|
|
|
406
406
|
wordFade: o = !1,
|
|
407
407
|
mode: i = "static",
|
|
408
408
|
preserveNewlines: l = !1,
|
|
409
|
-
...
|
|
409
|
+
...c
|
|
410
410
|
}) => {
|
|
411
|
-
const
|
|
411
|
+
const u = typeof t == "string" ? t : "", p = O(() => so(u), [u]), m = Po(p), g = O(
|
|
412
412
|
() => s?.length ? [...Object.values(Ba), ...s] : void 0,
|
|
413
413
|
[s]
|
|
414
414
|
), f = a?.join(",") ?? "", h = O(() => {
|
|
@@ -425,12 +425,12 @@ const Ro = { linkMode: "text-only" }, Ao = { enabled: !1 }, Ht = (e) => {
|
|
|
425
425
|
/* @__PURE__ */ n(
|
|
426
426
|
Ha,
|
|
427
427
|
{
|
|
428
|
-
className:
|
|
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
431
|
remend: Ro,
|
|
432
432
|
linkSafety: Ao,
|
|
433
|
-
...
|
|
433
|
+
...c,
|
|
434
434
|
remarkPlugins: g,
|
|
435
435
|
rehypePlugins: h,
|
|
436
436
|
children: typeof t == "string" ? p : t
|
|
@@ -451,36 +451,36 @@ function ps(e, t, s = {}) {
|
|
|
451
451
|
minCharsPerSecond: r = ms,
|
|
452
452
|
maxCharsPerSecond: a = hs,
|
|
453
453
|
enabled: o = !0
|
|
454
|
-
} = s, [i] = C(Ho), l = o && !i, [
|
|
454
|
+
} = s, [i] = C(Ho), l = o && !i, [c, u] = C(
|
|
455
455
|
() => t && e.length <= Bo ? Math.min(e.length, 1) : e.length
|
|
456
|
-
), p =
|
|
456
|
+
), p = U(c), m = U(0);
|
|
457
457
|
D(() => {
|
|
458
458
|
if (!l) {
|
|
459
459
|
p.current = e.length;
|
|
460
460
|
return;
|
|
461
461
|
}
|
|
462
462
|
if (e.length < p.current) {
|
|
463
|
-
p.current = e.length, m.current = 0,
|
|
463
|
+
p.current = e.length, m.current = 0, u(e.length);
|
|
464
464
|
return;
|
|
465
465
|
}
|
|
466
466
|
if (p.current >= e.length) {
|
|
467
|
-
|
|
467
|
+
u((b) => b >= e.length ? b : e.length);
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
470
|
let f = 0, h = performance.now();
|
|
471
471
|
const N = t ? 0 : Math.min(
|
|
472
472
|
Math.max((e.length - p.current) / $o * 1e3, r),
|
|
473
473
|
a
|
|
474
|
-
),
|
|
474
|
+
), v = Math.floor(a * Fo / 1e3), y = (b) => {
|
|
475
475
|
f = 0;
|
|
476
476
|
const I = Math.min(b - h, jo);
|
|
477
|
-
h = b, e.length - p.current >
|
|
478
|
-
const
|
|
479
|
-
if (
|
|
480
|
-
const T = (t ? Math.min(Math.max(
|
|
477
|
+
h = b, e.length - p.current > v && (p.current = e.length - v, m.current = 0);
|
|
478
|
+
const _ = e.length - p.current;
|
|
479
|
+
if (_ <= 0) return;
|
|
480
|
+
const T = (t ? Math.min(Math.max(_ / qo * 1e3, r), a) : N) * I / 1e3 + m.current, P = Math.floor(T);
|
|
481
481
|
if (m.current = T - P, P > 0) {
|
|
482
482
|
const A = Math.min(e.length, p.current + P);
|
|
483
|
-
if (p.current = A,
|
|
483
|
+
if (p.current = A, u(A), A >= e.length) return;
|
|
484
484
|
}
|
|
485
485
|
f = requestAnimationFrame(y);
|
|
486
486
|
};
|
|
@@ -488,11 +488,11 @@ function ps(e, t, s = {}) {
|
|
|
488
488
|
f && cancelAnimationFrame(f);
|
|
489
489
|
};
|
|
490
490
|
}, [e, t, l, r, a]);
|
|
491
|
-
const g = l &&
|
|
492
|
-
return [g ? e.slice(0, Uo(e,
|
|
491
|
+
const g = l && c < e.length;
|
|
492
|
+
return [g ? e.slice(0, Uo(e, c)) : e, g];
|
|
493
493
|
}
|
|
494
494
|
function fs() {
|
|
495
|
-
const t =
|
|
495
|
+
const t = K((s) => s.app)?.smoothStreaming;
|
|
496
496
|
return O(() => {
|
|
497
497
|
const s = typeof t == "object" ? t : {};
|
|
498
498
|
return {
|
|
@@ -508,8 +508,8 @@ function gs({
|
|
|
508
508
|
children: s,
|
|
509
509
|
...r
|
|
510
510
|
}) {
|
|
511
|
-
const { t: a } =
|
|
512
|
-
return /* @__PURE__ */
|
|
511
|
+
const { t: a } = k(["chat"]);
|
|
512
|
+
return /* @__PURE__ */ d(
|
|
513
513
|
Ae.Source,
|
|
514
514
|
{
|
|
515
515
|
className: `group/reference relative rounded-md transition-colors ${t ?? ""}`,
|
|
@@ -535,10 +535,10 @@ function bs({
|
|
|
535
535
|
streaming: s,
|
|
536
536
|
reference: r
|
|
537
537
|
}) {
|
|
538
|
-
const { textComponents: a, remarkPlugins: o, rehypePlugins: i, linkProtocols: l } =
|
|
538
|
+
const { textComponents: a, remarkPlugins: o, rehypePlugins: i, linkProtocols: l } = X(), c = Y((v) => v.composer), u = fs(), p = oe(e), m = s && t === "assistant", [g] = ps(e, m, u), f = U(!1);
|
|
539
539
|
m && (f.current = !0);
|
|
540
540
|
const h = f.current ? "streaming" : "static", N = t === "user" ? /* @__PURE__ */ n("div", { className: "whitespace-pre-wrap break-words", children: g.split(`
|
|
541
|
-
`).map((
|
|
541
|
+
`).map((v, y) => /* @__PURE__ */ n("div", { dir: "auto", children: v || /* @__PURE__ */ n("br", {}) }, y)) }) : /* @__PURE__ */ n(
|
|
542
542
|
nt,
|
|
543
543
|
{
|
|
544
544
|
components: a,
|
|
@@ -550,18 +550,18 @@ function bs({
|
|
|
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: p, children: /* @__PURE__ */ n(Vo, { lines: t === "user" ?
|
|
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: p, children: /* @__PURE__ */ n(Vo, { lines: t === "user" ? c?.collapseLines ?? 0 : 0, children: /* @__PURE__ */ n(gs, { showAction: !1, reference: r, children: N }) }) }) }) });
|
|
554
554
|
}
|
|
555
555
|
function Vo({ lines: e, children: t }) {
|
|
556
|
-
const { t: s } =
|
|
556
|
+
const { t: s } = k(["chat"]), r = U(null), [a, o] = C(!1), [i, l] = C(!1);
|
|
557
557
|
return qn(() => {
|
|
558
|
-
const
|
|
559
|
-
if (!
|
|
560
|
-
const p =
|
|
558
|
+
const u = r.current;
|
|
559
|
+
if (!u || !e || i) return;
|
|
560
|
+
const p = u.firstElementChild, m = () => o((p?.offsetHeight ?? u.scrollHeight) > u.clientHeight + 1);
|
|
561
561
|
m();
|
|
562
562
|
const g = typeof ResizeObserver > "u" ? null : new ResizeObserver(m);
|
|
563
|
-
return g?.observe(
|
|
564
|
-
}, [e, i]), e ? /* @__PURE__ */
|
|
563
|
+
return g?.observe(u), p && g?.observe(p), () => g?.disconnect();
|
|
564
|
+
}, [e, i]), e ? /* @__PURE__ */ d($, { children: [
|
|
565
565
|
/* @__PURE__ */ n(
|
|
566
566
|
"div",
|
|
567
567
|
{
|
|
@@ -581,7 +581,7 @@ function Vo({ lines: e, children: t }) {
|
|
|
581
581
|
"button",
|
|
582
582
|
{
|
|
583
583
|
type: "button",
|
|
584
|
-
onClick: () => l((
|
|
584
|
+
onClick: () => l((u) => !u),
|
|
585
585
|
"aria-expanded": i,
|
|
586
586
|
"aria-label": s(i ? "show_less" : "show_more"),
|
|
587
587
|
title: s(i ? "show_less" : "show_more"),
|
|
@@ -589,19 +589,19 @@ function Vo({ lines: e, children: t }) {
|
|
|
589
589
|
children: /* @__PURE__ */ n(
|
|
590
590
|
Ke,
|
|
591
591
|
{
|
|
592
|
-
className:
|
|
592
|
+
className: x("size-4 transition-transform duration-200", i && "rotate-180")
|
|
593
593
|
}
|
|
594
594
|
)
|
|
595
595
|
}
|
|
596
596
|
)
|
|
597
|
-
] }) : /* @__PURE__ */ n(
|
|
597
|
+
] }) : /* @__PURE__ */ n($, { children: t });
|
|
598
598
|
}
|
|
599
599
|
function Go({ part: e, index: t }) {
|
|
600
600
|
const s = e.text;
|
|
601
601
|
return s.trim() ? /* @__PURE__ */ n(Wo, { text: s, index: t, segment: "text" }) : null;
|
|
602
602
|
}
|
|
603
603
|
function Wo({ text: e, index: t, segment: s }) {
|
|
604
|
-
const { t: r } =
|
|
604
|
+
const { t: r } = k("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
|
{
|
|
@@ -636,52 +636,52 @@ const xs = Oe(null), Qo = () => {
|
|
|
636
636
|
children: i,
|
|
637
637
|
...l
|
|
638
638
|
}) => {
|
|
639
|
-
const [
|
|
639
|
+
const [c, u] = sn({
|
|
640
640
|
prop: s,
|
|
641
641
|
defaultProp: r,
|
|
642
642
|
onChange: a
|
|
643
643
|
}), [p, m] = sn({
|
|
644
644
|
prop: o,
|
|
645
645
|
defaultProp: 0
|
|
646
|
-
}), g =
|
|
646
|
+
}), g = U({ startTime: null, autoClosed: !1 });
|
|
647
647
|
D(() => {
|
|
648
648
|
const h = g.current;
|
|
649
|
-
if (t ? h.startTime ??= Date.now() : h.startTime !== null && (m(Math.ceil((Date.now() - h.startTime) / 1e3)), h.startTime = null), r && !t &&
|
|
649
|
+
if (t ? h.startTime ??= Date.now() : h.startTime !== null && (m(Math.ceil((Date.now() - h.startTime) / 1e3)), h.startTime = null), r && !t && c && !h.autoClosed) {
|
|
650
650
|
const N = setTimeout(() => {
|
|
651
|
-
|
|
651
|
+
u(!1), h.autoClosed = !0;
|
|
652
652
|
}, 1e3);
|
|
653
653
|
return () => clearTimeout(N);
|
|
654
654
|
}
|
|
655
|
-
}, [t,
|
|
655
|
+
}, [t, c, r, u, m]);
|
|
656
656
|
const f = O(
|
|
657
|
-
() => ({ isStreaming: t, isOpen:
|
|
658
|
-
[t,
|
|
657
|
+
() => ({ isStreaming: t, isOpen: c, setIsOpen: u, duration: p }),
|
|
658
|
+
[t, c, u, p]
|
|
659
659
|
);
|
|
660
660
|
return /* @__PURE__ */ n(xs.Provider, { value: f, children: /* @__PURE__ */ n(
|
|
661
661
|
zt,
|
|
662
662
|
{
|
|
663
|
-
className:
|
|
664
|
-
onOpenChange:
|
|
665
|
-
open:
|
|
663
|
+
className: x("not-prose mb-4", e),
|
|
664
|
+
onOpenChange: u,
|
|
665
|
+
open: c,
|
|
666
666
|
...l,
|
|
667
667
|
children: i
|
|
668
668
|
}
|
|
669
669
|
) });
|
|
670
670
|
}
|
|
671
671
|
), ys = Ee(({ className: e, children: t, ...s }) => {
|
|
672
|
-
const { isStreaming: r, isOpen: a, duration: o } = Qo(), { t: i } =
|
|
672
|
+
const { isStreaming: r, isOpen: a, duration: o } = Qo(), { t: i } = k(["chat"]);
|
|
673
673
|
return /* @__PURE__ */ n(
|
|
674
674
|
It,
|
|
675
675
|
{
|
|
676
|
-
className:
|
|
676
|
+
className: x("flex items-center gap-2 text-muted-foreground text-sm", e),
|
|
677
677
|
...s,
|
|
678
|
-
children: t ?? /* @__PURE__ */
|
|
678
|
+
children: t ?? /* @__PURE__ */ d($, { children: [
|
|
679
679
|
/* @__PURE__ */ n(er, { className: "size-4" }),
|
|
680
680
|
/* @__PURE__ */ n("p", { children: r ? i("thinking") : o > 0 ? i("thought_for", { count: o }) : i("thought") }),
|
|
681
681
|
/* @__PURE__ */ n(
|
|
682
682
|
Ke,
|
|
683
683
|
{
|
|
684
|
-
className:
|
|
684
|
+
className: x(
|
|
685
685
|
"size-4 text-muted-foreground transition-transform",
|
|
686
686
|
a ? "rotate-180" : "rotate-0"
|
|
687
687
|
)
|
|
@@ -694,7 +694,7 @@ const xs = Oe(null), Qo = () => {
|
|
|
694
694
|
({ className: e, children: t, wordFade: s, mode: r, ...a }) => /* @__PURE__ */ n(
|
|
695
695
|
Tt,
|
|
696
696
|
{
|
|
697
|
-
className:
|
|
697
|
+
className: x(
|
|
698
698
|
"mt-4 text-base",
|
|
699
699
|
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
700
700
|
e
|
|
@@ -708,18 +708,18 @@ vs.displayName = "Reasoning";
|
|
|
708
708
|
ys.displayName = "ReasoningTrigger";
|
|
709
709
|
ws.displayName = "ReasoningContent";
|
|
710
710
|
function Ko({ part: e }) {
|
|
711
|
-
const t =
|
|
711
|
+
const t = W((u) => u.isStreaming), { dir: s } = V(), r = fs(), a = oe(e.text), o = e.state === "streaming" && t, [i] = ps(e.text, o, r), l = U(!1);
|
|
712
712
|
o && (l.current = !0);
|
|
713
|
-
const
|
|
714
|
-
return e.text.trim() ? /* @__PURE__ */
|
|
713
|
+
const c = l.current ? "streaming" : "static";
|
|
714
|
+
return e.text.trim() ? /* @__PURE__ */ d(vs, { className: "w-full animate-in-bubble", dir: s, isStreaming: o, children: [
|
|
715
715
|
/* @__PURE__ */ n(ys, {}),
|
|
716
|
-
/* @__PURE__ */ n(ws, { dir: a, wordFade: l.current, mode:
|
|
716
|
+
/* @__PURE__ */ n(ws, { dir: a, wordFade: l.current, mode: c, children: i })
|
|
717
717
|
] }) : null;
|
|
718
718
|
}
|
|
719
719
|
function Vt(e) {
|
|
720
|
-
const [t, s] = C(!1), r =
|
|
720
|
+
const [t, s] = C(!1), r = U(void 0);
|
|
721
721
|
D(() => () => clearTimeout(r.current), []);
|
|
722
|
-
const a =
|
|
722
|
+
const a = de(() => {
|
|
723
723
|
clearTimeout(r.current), s(!0), r.current = setTimeout(() => s(!1), e);
|
|
724
724
|
}, [e]);
|
|
725
725
|
return [t, a];
|
|
@@ -730,10 +730,10 @@ const Ns = Ee(function({
|
|
|
730
730
|
children: r,
|
|
731
731
|
...a
|
|
732
732
|
}) {
|
|
733
|
-
return /* @__PURE__ */
|
|
733
|
+
return /* @__PURE__ */ d(
|
|
734
734
|
"div",
|
|
735
735
|
{
|
|
736
|
-
className:
|
|
736
|
+
className: x(
|
|
737
737
|
"relative w-full overflow-hidden rounded-md border bg-background text-foreground",
|
|
738
738
|
s
|
|
739
739
|
),
|
|
@@ -755,7 +755,7 @@ function Yo(e, t = "size-4") {
|
|
|
755
755
|
const s = Xo[e] ?? rr;
|
|
756
756
|
return /* @__PURE__ */ n(s, { className: t });
|
|
757
757
|
}
|
|
758
|
-
const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className:
|
|
758
|
+
const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not-prose mb-4 w-full rounded-md border", e), ...t }), Zo = {
|
|
759
759
|
"input-streaming": ["pending", lr],
|
|
760
760
|
"input-available": ["running", en, "animate-pulse"],
|
|
761
761
|
"approval-requested": ["awaiting_approval", ir, "text-warning"],
|
|
@@ -764,20 +764,20 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: v("not
|
|
|
764
764
|
"output-error": ["error", Cn, "text-destructive"],
|
|
765
765
|
"output-denied": ["denied", ar, "text-destructive"]
|
|
766
766
|
}, ei = ({ status: e }) => {
|
|
767
|
-
const { t } =
|
|
768
|
-
return /* @__PURE__ */
|
|
769
|
-
/* @__PURE__ */ n(r, { className:
|
|
767
|
+
const { t } = k(["tools_ui"]), [s, r, a] = Zo[e];
|
|
768
|
+
return /* @__PURE__ */ d(ma, { className: "gap-1.5 rounded-full text-xs", variant: "secondary", children: [
|
|
769
|
+
/* @__PURE__ */ n(r, { className: x("size-4", a) }),
|
|
770
770
|
t(s)
|
|
771
771
|
] });
|
|
772
772
|
}, ti = ({ className: e, type: t, state: s, toolName: r, ...a }) => {
|
|
773
773
|
const o = r || (t.startsWith("tool-") ? t.slice(5) : t), i = Yo(o, "size-4 text-muted-foreground");
|
|
774
|
-
return /* @__PURE__ */
|
|
774
|
+
return /* @__PURE__ */ d(
|
|
775
775
|
It,
|
|
776
776
|
{
|
|
777
|
-
className:
|
|
777
|
+
className: x("flex w-full items-center justify-between gap-4 p-3", e),
|
|
778
778
|
...a,
|
|
779
779
|
children: [
|
|
780
|
-
/* @__PURE__ */
|
|
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
783
|
/* @__PURE__ */ n(ei, { status: s })
|
|
@@ -789,7 +789,7 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: v("not
|
|
|
789
789
|
}, ni = ({ className: e, ...t }) => /* @__PURE__ */ n(
|
|
790
790
|
Tt,
|
|
791
791
|
{
|
|
792
|
-
className:
|
|
792
|
+
className: x(
|
|
793
793
|
"data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
794
794
|
e
|
|
795
795
|
),
|
|
@@ -804,13 +804,13 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: v("not
|
|
|
804
804
|
}
|
|
805
805
|
return JSON.stringify(e, null, 2);
|
|
806
806
|
}, si = ({ className: e, input: t, state: s, ...r }) => {
|
|
807
|
-
const { t: a } =
|
|
808
|
-
return /* @__PURE__ */
|
|
807
|
+
const { t: a } = k(["tools_ui"]), o = O(() => ks(t), [t]), i = s === "input-streaming";
|
|
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
812
|
}, ri = ({ className: e, output: t, errorText: s, ...r }) => {
|
|
813
|
-
const { t: a } =
|
|
813
|
+
const { t: a } = k(["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);
|
|
@@ -819,18 +819,18 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: v("not
|
|
|
819
819
|
}
|
|
820
820
|
return null;
|
|
821
821
|
}, [t]);
|
|
822
|
-
return t || s ? /* @__PURE__ */
|
|
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__ */
|
|
825
|
-
/* @__PURE__ */ n(Qn, { asChild: !0, children: /* @__PURE__ */
|
|
824
|
+
s && /* @__PURE__ */ d(qe, { children: [
|
|
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")
|
|
828
828
|
] }) }),
|
|
829
|
-
/* @__PURE__ */
|
|
829
|
+
/* @__PURE__ */ d(Mt, { className: "max-w-2xl", children: [
|
|
830
830
|
/* @__PURE__ */ n(Kn, { children: /* @__PURE__ */ n(Xn, { className: "text-destructive", children: a("tool_error") }) }),
|
|
831
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ d("div", { className: "space-y-4", children: [
|
|
832
832
|
/* @__PURE__ */ n("div", { className: "max-h-96 overflow-auto rounded-md bg-destructive/10 p-4 text-destructive text-sm", children: /* @__PURE__ */ n("pre", { className: "whitespace-pre-wrap break-words", children: ks(s) }) }),
|
|
833
|
-
/* @__PURE__ */
|
|
833
|
+
/* @__PURE__ */ d(
|
|
834
834
|
E,
|
|
835
835
|
{
|
|
836
836
|
variant: "outline",
|
|
@@ -851,10 +851,10 @@ const Jo = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: v("not
|
|
|
851
851
|
] }) : null;
|
|
852
852
|
};
|
|
853
853
|
function ai({ part: e }) {
|
|
854
|
-
const { t } =
|
|
854
|
+
const { t } = k(["tools_ui"]), s = Zr(e);
|
|
855
855
|
if (!s.isPending) return null;
|
|
856
856
|
const r = t("approval_prompt", { tool: et(e) });
|
|
857
|
-
return /* @__PURE__ */
|
|
857
|
+
return /* @__PURE__ */ d(
|
|
858
858
|
"div",
|
|
859
859
|
{
|
|
860
860
|
role: "group",
|
|
@@ -882,10 +882,10 @@ function ai({ part: e }) {
|
|
|
882
882
|
);
|
|
883
883
|
}
|
|
884
884
|
function oi({ part: e }) {
|
|
885
|
-
const t =
|
|
886
|
-
return !t && !s ? null : /* @__PURE__ */
|
|
885
|
+
const t = K((r) => r.app.showToolDetails ?? !0), s = e.state === "approval-requested";
|
|
886
|
+
return !t && !s ? null : /* @__PURE__ */ d(Jo, { className: "animate-in-bubble", defaultOpen: s, children: [
|
|
887
887
|
/* @__PURE__ */ n(ti, { type: e.type, state: e.state, toolName: et(e) }),
|
|
888
|
-
/* @__PURE__ */
|
|
888
|
+
/* @__PURE__ */ d(ni, { children: [
|
|
889
889
|
/* @__PURE__ */ n(si, { input: e.input, state: e.state }),
|
|
890
890
|
(e.state === "output-available" || e.state === "output-error") && /* @__PURE__ */ n(ri, { errorText: e.errorText, output: e.output })
|
|
891
891
|
] }),
|
|
@@ -893,12 +893,12 @@ function oi({ part: e }) {
|
|
|
893
893
|
] });
|
|
894
894
|
}
|
|
895
895
|
function ii({ part: e }) {
|
|
896
|
-
const t =
|
|
897
|
-
if (
|
|
898
|
-
const
|
|
899
|
-
document.body.appendChild(
|
|
896
|
+
const t = W((c) => c.message.role), { t: s } = k(["chat", "admin"]), r = ea(e), a = e.mediaType.startsWith("image/"), o = e.filename ?? "file", i = s("download", "Download"), l = (c) => {
|
|
897
|
+
if (c.preventDefault(), !r) return;
|
|
898
|
+
const u = Object.assign(document.createElement("a"), { href: r, download: o });
|
|
899
|
+
document.body.appendChild(u), u.click(), u.remove();
|
|
900
900
|
};
|
|
901
|
-
return /* @__PURE__ */ n("div", { className: "py-2 animate-in-bubble", children: /* @__PURE__ */ n(Ut, { from: t, children: /* @__PURE__ */ n(Bt, { isPlain: !0, children: a ? /* @__PURE__ */
|
|
901
|
+
return /* @__PURE__ */ n("div", { className: "py-2 animate-in-bubble", children: /* @__PURE__ */ n(Ut, { from: t, children: /* @__PURE__ */ n(Bt, { isPlain: !0, children: a ? /* @__PURE__ */ d("div", { className: "group relative max-w-[280px] rounded-xl overflow-hidden border border-border/5 transition-all duration-300 hover:border-primary/30", children: [
|
|
902
902
|
/* @__PURE__ */ n(
|
|
903
903
|
"img",
|
|
904
904
|
{
|
|
@@ -907,7 +907,7 @@ function ii({ part: e }) {
|
|
|
907
907
|
className: "max-h-[280px] w-full rounded-xl object-cover"
|
|
908
908
|
}
|
|
909
909
|
),
|
|
910
|
-
/* @__PURE__ */
|
|
910
|
+
/* @__PURE__ */ d("div", { className: "absolute inset-x-0 bottom-0 p-3 bg-black/60 md:opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity flex items-center justify-between", children: [
|
|
911
911
|
/* @__PURE__ */ n("span", { className: "text-xs text-white truncate max-w-[150px] font-medium", children: o }),
|
|
912
912
|
/* @__PURE__ */ n(
|
|
913
913
|
"button",
|
|
@@ -919,9 +919,9 @@ function ii({ part: e }) {
|
|
|
919
919
|
}
|
|
920
920
|
)
|
|
921
921
|
] })
|
|
922
|
-
] }) : /* @__PURE__ */
|
|
922
|
+
] }) : /* @__PURE__ */ d("div", { className: "group inline-flex items-center gap-3 rounded-xl p-3 text-sm transition-all duration-300 bg-secondary/10 border border-border/5 hover:border-primary/30 hover:bg-secondary/20", children: [
|
|
923
923
|
/* @__PURE__ */ n("div", { className: "p-2.5 rounded-lg bg-background/50 border border-border/10 group-hover:border-primary/20 group-hover:text-primary transition-colors", children: /* @__PURE__ */ n(In, { className: "size-4 shrink-0" }) }),
|
|
924
|
-
/* @__PURE__ */
|
|
924
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 me-4", children: [
|
|
925
925
|
/* @__PURE__ */ n("span", { className: "truncate max-w-[180px] font-semibold text-foreground/90 leading-none mb-1 group-hover:text-foreground transition-colors", children: o }),
|
|
926
926
|
e.mediaType && /* @__PURE__ */ n("span", { className: "text-xs text-muted-foreground uppercase font-bold tracking-widest opacity-60", children: e.mediaType.split("/").pop() })
|
|
927
927
|
] }),
|
|
@@ -937,19 +937,19 @@ function ii({ part: e }) {
|
|
|
937
937
|
] }) }) }) });
|
|
938
938
|
}
|
|
939
939
|
function li({ part: e }) {
|
|
940
|
-
const t =
|
|
941
|
-
return /* @__PURE__ */ n("div", { className:
|
|
940
|
+
const t = W((u) => u.message.role), { t: s } = k(["chat"]), { focusReference: r } = ta(), [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
|
+
return /* @__PURE__ */ n("div", { className: x("my-1.5 flex", t === "user" && "justify-end"), children: /* @__PURE__ */ d(
|
|
942
942
|
"button",
|
|
943
943
|
{
|
|
944
944
|
type: "button",
|
|
945
|
-
className:
|
|
945
|
+
className: x(
|
|
946
946
|
"inline-flex max-w-[min(100%,34rem)] items-start gap-2 rounded-lg border border-border/60 bg-muted/35 px-3 py-2 text-start text-xs text-foreground transition hover:border-primary/30 hover:bg-muted/55 focus-visible:ring-2 focus-visible:ring-primary/30",
|
|
947
947
|
a && "ring-2 ring-primary/35"
|
|
948
948
|
),
|
|
949
949
|
onClick: () => {
|
|
950
950
|
r(i) || o();
|
|
951
951
|
},
|
|
952
|
-
title:
|
|
952
|
+
title: c,
|
|
953
953
|
children: [
|
|
954
954
|
/* @__PURE__ */ n(Qe, { className: "mt-0.5 size-3.5 shrink-0 opacity-70" }),
|
|
955
955
|
/* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ n("span", { className: "line-clamp-2 opacity-85", dir: "auto", children: l }) })
|
|
@@ -992,14 +992,14 @@ function zs({
|
|
|
992
992
|
onSelect: a,
|
|
993
993
|
className: o
|
|
994
994
|
}) {
|
|
995
|
-
return /* @__PURE__ */ n("div", { className:
|
|
995
|
+
return /* @__PURE__ */ n("div", { className: x("flex flex-col gap-1", o), children: e.map((i) => /* @__PURE__ */ n(
|
|
996
996
|
"button",
|
|
997
997
|
{
|
|
998
998
|
type: "button",
|
|
999
999
|
disabled: s,
|
|
1000
1000
|
dir: oe(i.label, r),
|
|
1001
1001
|
onClick: () => a(i.label),
|
|
1002
|
-
className:
|
|
1002
|
+
className: x(
|
|
1003
1003
|
"w-full rounded-full px-3 py-2.5 text-start text-sm leading-snug transition-colors duration-150 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/40",
|
|
1004
1004
|
t === i.label ? "bg-primary/12 text-primary" : "text-foreground/85 hover:bg-foreground/[0.06] hover:text-foreground disabled:cursor-not-allowed disabled:opacity-55 disabled:hover:bg-transparent"
|
|
1005
1005
|
),
|
|
@@ -1016,31 +1016,31 @@ function mi({
|
|
|
1016
1016
|
onReopen: a,
|
|
1017
1017
|
onAnswer: o
|
|
1018
1018
|
}) {
|
|
1019
|
-
const { t: i } =
|
|
1019
|
+
const { t: i } = k(["chat"]), { dir: l } = V(), { textComponents: c, remarkPlugins: u, rehypePlugins: p, linkProtocols: m } = X(), g = O(() => Gt(e), [e]), [f, h] = C(""), [N, v] = C(null), [y, b] = C(!1);
|
|
1020
1020
|
if (!g) return null;
|
|
1021
|
-
const I = !s && !!o,
|
|
1022
|
-
if (!
|
|
1023
|
-
const P = async (
|
|
1024
|
-
const
|
|
1025
|
-
if (!(
|
|
1026
|
-
b(!0),
|
|
1021
|
+
const I = !s && !!o, _ = !I || y || N !== null, z = !Cs(t, g), T = oe(g.question, l);
|
|
1022
|
+
if (!z && !I && !r) return null;
|
|
1023
|
+
const P = async (M) => {
|
|
1024
|
+
const L = M.trim();
|
|
1025
|
+
if (!(!L || _)) {
|
|
1026
|
+
b(!0), v(L);
|
|
1027
1027
|
try {
|
|
1028
|
-
await o?.(
|
|
1028
|
+
await o?.(L);
|
|
1029
1029
|
} catch {
|
|
1030
|
-
|
|
1030
|
+
v(null), b(!1);
|
|
1031
1031
|
return;
|
|
1032
1032
|
}
|
|
1033
1033
|
b(!1);
|
|
1034
1034
|
}
|
|
1035
|
-
}, A = (
|
|
1036
|
-
|
|
1035
|
+
}, A = (M) => {
|
|
1036
|
+
M.preventDefault(), P(f);
|
|
1037
1037
|
};
|
|
1038
|
-
return /* @__PURE__ */
|
|
1039
|
-
|
|
1038
|
+
return /* @__PURE__ */ d("div", { className: "group py-2 first:pt-4 animate-in-bubble", children: [
|
|
1039
|
+
z && /* @__PURE__ */ n(Ut, { from: t.role, children: /* @__PURE__ */ n(Bt, { dir: T, children: /* @__PURE__ */ n(
|
|
1040
1040
|
nt,
|
|
1041
1041
|
{
|
|
1042
|
-
components:
|
|
1043
|
-
remarkPlugins:
|
|
1042
|
+
components: c,
|
|
1043
|
+
remarkPlugins: u,
|
|
1044
1044
|
rehypePlugins: p,
|
|
1045
1045
|
linkProtocols: m,
|
|
1046
1046
|
children: g.question
|
|
@@ -1049,9 +1049,9 @@ function mi({
|
|
|
1049
1049
|
r && /* @__PURE__ */ n(
|
|
1050
1050
|
"div",
|
|
1051
1051
|
{
|
|
1052
|
-
className:
|
|
1052
|
+
className: x("flex w-full justify-start", z && "mt-2.5"),
|
|
1053
1053
|
dir: T,
|
|
1054
|
-
children: /* @__PURE__ */
|
|
1054
|
+
children: /* @__PURE__ */ d(
|
|
1055
1055
|
"button",
|
|
1056
1056
|
{
|
|
1057
1057
|
type: "button",
|
|
@@ -1066,27 +1066,27 @@ function mi({
|
|
|
1066
1066
|
)
|
|
1067
1067
|
}
|
|
1068
1068
|
),
|
|
1069
|
-
I && !r && /* @__PURE__ */
|
|
1069
|
+
I && !r && /* @__PURE__ */ d("div", { className: x("max-w-xl", z && "mt-2.5"), dir: T, children: [
|
|
1070
1070
|
/* @__PURE__ */ n(
|
|
1071
1071
|
zs,
|
|
1072
1072
|
{
|
|
1073
1073
|
choices: g.choices,
|
|
1074
1074
|
selected: N,
|
|
1075
|
-
disabled:
|
|
1075
|
+
disabled: _,
|
|
1076
1076
|
dir: T,
|
|
1077
|
-
onSelect: (
|
|
1078
|
-
P(
|
|
1077
|
+
onSelect: (M) => {
|
|
1078
|
+
P(M);
|
|
1079
1079
|
}
|
|
1080
1080
|
}
|
|
1081
1081
|
),
|
|
1082
|
-
g.allowCustom && /* @__PURE__ */
|
|
1082
|
+
g.allowCustom && /* @__PURE__ */ d("form", { onSubmit: A, className: "mt-1.5 flex items-center gap-1.5", children: [
|
|
1083
1083
|
/* @__PURE__ */ n(
|
|
1084
1084
|
"input",
|
|
1085
1085
|
{
|
|
1086
1086
|
value: f,
|
|
1087
|
-
disabled:
|
|
1087
|
+
disabled: _,
|
|
1088
1088
|
dir: oe(f || i("choice_other_placeholder"), T),
|
|
1089
|
-
onChange: (
|
|
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"
|
|
1092
1092
|
}
|
|
@@ -1095,7 +1095,7 @@ function mi({
|
|
|
1095
1095
|
"button",
|
|
1096
1096
|
{
|
|
1097
1097
|
type: "submit",
|
|
1098
|
-
disabled:
|
|
1098
|
+
disabled: _ || !f.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"),
|
|
@@ -1138,13 +1138,13 @@ function fi({
|
|
|
1138
1138
|
onAnswer: a,
|
|
1139
1139
|
children: o
|
|
1140
1140
|
}) {
|
|
1141
|
-
const [i, l] = C(0),
|
|
1142
|
-
l((
|
|
1143
|
-
}, []), g =
|
|
1141
|
+
const [i, l] = C(0), c = s || e?.role !== "assistant" ? void 0 : _s(e, { streaming: t }), u = O(() => c ? Gt(c) : null, [c]), p = c?.toolCallId, m = de((I) => {
|
|
1142
|
+
l((_) => Math.abs(_ - I) < 1 ? _ : I);
|
|
1143
|
+
}, []), g = u ? e?.id ?? null : null, f = u && e ? Aa(e) : null, [h, N] = C(() => hi(r)), v = f !== null && h.includes(f), y = de(
|
|
1144
1144
|
(I) => {
|
|
1145
|
-
f && N((
|
|
1146
|
-
const
|
|
1147
|
-
return I ? [...
|
|
1145
|
+
f && N((_) => {
|
|
1146
|
+
const z = _.filter((T) => T !== f);
|
|
1147
|
+
return I ? [...z, f].slice(-50) : z.length === _.length ? _ : z;
|
|
1148
1148
|
});
|
|
1149
1149
|
},
|
|
1150
1150
|
[f]
|
|
@@ -1154,22 +1154,22 @@ function fi({
|
|
|
1154
1154
|
}, [r, h]);
|
|
1155
1155
|
const b = O(
|
|
1156
1156
|
() => ({
|
|
1157
|
-
question:
|
|
1157
|
+
question: u,
|
|
1158
1158
|
messageId: g,
|
|
1159
1159
|
disabled: t || !a,
|
|
1160
|
-
dismissed:
|
|
1160
|
+
dismissed: v,
|
|
1161
1161
|
setDismissed: y,
|
|
1162
1162
|
answer: (I) => {
|
|
1163
1163
|
p && a?.({ toolCallId: p, output: { answer: I } });
|
|
1164
1164
|
},
|
|
1165
|
-
dockHeight:
|
|
1165
|
+
dockHeight: u ? i : 0,
|
|
1166
1166
|
reportDockHeight: m
|
|
1167
1167
|
}),
|
|
1168
1168
|
[
|
|
1169
|
-
|
|
1169
|
+
u,
|
|
1170
1170
|
g,
|
|
1171
1171
|
t,
|
|
1172
|
-
|
|
1172
|
+
v,
|
|
1173
1173
|
y,
|
|
1174
1174
|
a,
|
|
1175
1175
|
p,
|
|
@@ -1183,14 +1183,14 @@ function st() {
|
|
|
1183
1183
|
return Se(Ts) ?? pi;
|
|
1184
1184
|
}
|
|
1185
1185
|
function Wt(e) {
|
|
1186
|
-
const t =
|
|
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(
|
|
1187
1187
|
(h) => {
|
|
1188
1188
|
e && i?.addToolOutput({ toolCallId: e, output: { answer: h } });
|
|
1189
1189
|
},
|
|
1190
1190
|
[i, e]
|
|
1191
|
-
),
|
|
1191
|
+
), c = de((h) => {
|
|
1192
1192
|
i?.send({ text: h });
|
|
1193
|
-
}, [i]), { messageId:
|
|
1193
|
+
}, [i]), { messageId: u, dismissed: p, setDismissed: m } = st(), g = u === t.id, f = s && !r && t.role === "assistant";
|
|
1194
1194
|
return {
|
|
1195
1195
|
message: t,
|
|
1196
1196
|
isLast: s,
|
|
@@ -1202,7 +1202,7 @@ function Wt(e) {
|
|
|
1202
1202
|
reopen: () => m(!1),
|
|
1203
1203
|
answerable: ui({ readonly: o, lastMessage: s, isFinished: f, status: a }),
|
|
1204
1204
|
answer: l,
|
|
1205
|
-
sendText:
|
|
1205
|
+
sendText: c
|
|
1206
1206
|
};
|
|
1207
1207
|
}
|
|
1208
1208
|
function gi({
|
|
@@ -1210,7 +1210,7 @@ function gi({
|
|
|
1210
1210
|
question: t,
|
|
1211
1211
|
index: s
|
|
1212
1212
|
}) {
|
|
1213
|
-
const { t: r } =
|
|
1213
|
+
const { t: r } = k("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")
|
|
@@ -1221,12 +1221,12 @@ function gi({
|
|
|
1221
1221
|
message: o,
|
|
1222
1222
|
disabled: !1,
|
|
1223
1223
|
dismissed: l,
|
|
1224
|
-
onReopen: l ?
|
|
1225
|
-
onAnswer:
|
|
1224
|
+
onReopen: l ? c : void 0,
|
|
1225
|
+
onAnswer: u
|
|
1226
1226
|
}
|
|
1227
1227
|
);
|
|
1228
1228
|
const p = e.state === "output-available" ? e.output?.answer : void 0;
|
|
1229
|
-
return /* @__PURE__ */ n(
|
|
1229
|
+
return /* @__PURE__ */ n($, { children: [
|
|
1230
1230
|
!Cs(o, t) && [
|
|
1231
1231
|
t.question,
|
|
1232
1232
|
o.role,
|
|
@@ -1261,33 +1261,6 @@ function bi({ part: e, index: t }) {
|
|
|
1261
1261
|
const r = Gt(e);
|
|
1262
1262
|
return r ? /* @__PURE__ */ n(gi, { part: e, question: r, index: t }) : null;
|
|
1263
1263
|
}
|
|
1264
|
-
function Be(e) {
|
|
1265
|
-
if (Array.isArray(e)) return Be(e[0]);
|
|
1266
|
-
if (typeof e == "string")
|
|
1267
|
-
try {
|
|
1268
|
-
return Be(JSON.parse(e));
|
|
1269
|
-
} catch {
|
|
1270
|
-
return null;
|
|
1271
|
-
}
|
|
1272
|
-
if (!e || typeof e != "object") return null;
|
|
1273
|
-
const t = e;
|
|
1274
|
-
if (!t.suggestions && t.data) return Be(t.data);
|
|
1275
|
-
if (!Array.isArray(t.suggestions)) return null;
|
|
1276
|
-
const s = /* @__PURE__ */ new Set(), r = t.suggestions.filter((a) => typeof a == "string").map((a) => a.trim()).filter((a) => {
|
|
1277
|
-
const o = a.toLocaleLowerCase();
|
|
1278
|
-
return !a || s.has(o) ? !1 : (s.add(o), !0);
|
|
1279
|
-
}).slice(0, 3);
|
|
1280
|
-
return r.length > 0 ? { suggestions: r } : null;
|
|
1281
|
-
}
|
|
1282
|
-
function xi({ part: e }) {
|
|
1283
|
-
const { FollowUpSuggestions: t } = Q(), s = G(
|
|
1284
|
-
(p) => p.message.parts.find((m) => m.type === "tool-suggest_follow_ups") === e
|
|
1285
|
-
), { message: r, isLast: a, isFinished: o, status: i, readonly: l, sendText: u } = Wt();
|
|
1286
|
-
if (!s || r.role !== "assistant" || !a || !o || i !== "ready" || l || _s(r) !== void 0)
|
|
1287
|
-
return null;
|
|
1288
|
-
const d = Be(e.input);
|
|
1289
|
-
return d ? /* @__PURE__ */ n(t, { suggestions: d.suggestions, onSelect: u }) : null;
|
|
1290
|
-
}
|
|
1291
1264
|
const Ms = {
|
|
1292
1265
|
text: Go,
|
|
1293
1266
|
reasoning: Ko,
|
|
@@ -1297,7 +1270,7 @@ const Ms = {
|
|
|
1297
1270
|
"source-document": null,
|
|
1298
1271
|
"data-reference": li,
|
|
1299
1272
|
"tool-ask_user": bi,
|
|
1300
|
-
"tool-suggest_follow_ups":
|
|
1273
|
+
"tool-suggest_follow_ups": null
|
|
1301
1274
|
};
|
|
1302
1275
|
class ge extends Kr {
|
|
1303
1276
|
state = { error: null };
|
|
@@ -1320,44 +1293,71 @@ class ge extends Kr {
|
|
|
1320
1293
|
const { error: t } = this.state;
|
|
1321
1294
|
if (!t) return this.props.children;
|
|
1322
1295
|
const { fallback: s } = this.props;
|
|
1323
|
-
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(xi, {}) });
|
|
1324
1297
|
}
|
|
1325
1298
|
}
|
|
1326
|
-
function
|
|
1327
|
-
const { t: e } =
|
|
1299
|
+
function xi() {
|
|
1300
|
+
const { t: e } = k("chat");
|
|
1328
1301
|
return e("render_error");
|
|
1329
1302
|
}
|
|
1330
|
-
const
|
|
1331
|
-
const { t: a } =
|
|
1303
|
+
const vi = ({ className: e, ...t }) => /* @__PURE__ */ n(zt, { className: x("not-prose mb-4 text-primary text-xs", e), ...t }), yi = ({ className: e, count: t, children: s, ...r }) => {
|
|
1304
|
+
const { t: a } = k(["chat"]);
|
|
1332
1305
|
return /* @__PURE__ */ n(
|
|
1333
1306
|
It,
|
|
1334
1307
|
{
|
|
1335
|
-
className:
|
|
1308
|
+
className: x(
|
|
1336
1309
|
"inline-flex items-center gap-1.5 rounded-full bg-secondary/70 px-3 py-1 text-xs font-medium text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",
|
|
1337
1310
|
e
|
|
1338
1311
|
),
|
|
1339
1312
|
...r,
|
|
1340
|
-
children: s ?? /* @__PURE__ */
|
|
1313
|
+
children: s ?? /* @__PURE__ */ d($, { children: [
|
|
1341
1314
|
/* @__PURE__ */ n("p", { className: "font-medium", children: a("used_sources", { count: t }) }),
|
|
1342
1315
|
/* @__PURE__ */ n(Ke, { className: "size-3.5" })
|
|
1343
1316
|
] })
|
|
1344
1317
|
}
|
|
1345
1318
|
);
|
|
1346
|
-
},
|
|
1319
|
+
}, wi = ({ className: e, ...t }) => /* @__PURE__ */ n(
|
|
1347
1320
|
Tt,
|
|
1348
1321
|
{
|
|
1349
|
-
className:
|
|
1322
|
+
className: x(
|
|
1350
1323
|
"mt-3 flex w-fit flex-col gap-2 data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
|
|
1351
1324
|
e
|
|
1352
1325
|
),
|
|
1353
1326
|
...t
|
|
1354
1327
|
}
|
|
1355
|
-
),
|
|
1328
|
+
), Ni = ({ 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: [
|
|
1356
1329
|
/* @__PURE__ */ n(dr, { className: "h-4 w-4" }),
|
|
1357
1330
|
/* @__PURE__ */ n("span", { className: "block font-medium", children: t })
|
|
1358
1331
|
] }) });
|
|
1332
|
+
function Be(e) {
|
|
1333
|
+
if (Array.isArray(e)) return Be(e[0]);
|
|
1334
|
+
if (typeof e == "string")
|
|
1335
|
+
try {
|
|
1336
|
+
return Be(JSON.parse(e));
|
|
1337
|
+
} catch {
|
|
1338
|
+
return null;
|
|
1339
|
+
}
|
|
1340
|
+
if (!e || typeof e != "object") return null;
|
|
1341
|
+
const t = e;
|
|
1342
|
+
if (!t.suggestions && t.data) return Be(t.data);
|
|
1343
|
+
if (!Array.isArray(t.suggestions)) return null;
|
|
1344
|
+
const s = /* @__PURE__ */ new Set(), r = t.suggestions.filter((a) => typeof a == "string").map((a) => a.trim()).filter((a) => {
|
|
1345
|
+
const o = a.toLocaleLowerCase();
|
|
1346
|
+
return !a || s.has(o) ? !1 : (s.add(o), !0);
|
|
1347
|
+
}).slice(0, 3);
|
|
1348
|
+
return r.length > 0 ? { suggestions: r } : null;
|
|
1349
|
+
}
|
|
1350
|
+
function ki() {
|
|
1351
|
+
const { FollowUpSuggestions: e } = X(), { message: t, isLast: s, isFinished: r, status: a, readonly: o, sendText: i } = Wt();
|
|
1352
|
+
if (t.role !== "assistant" || !s || !r || a !== "ready" || o || _s(t) !== void 0)
|
|
1353
|
+
return null;
|
|
1354
|
+
const l = t.parts.find((u) => u.type === "tool-suggest_follow_ups");
|
|
1355
|
+
if (!l || !("input" in l)) return null;
|
|
1356
|
+
const c = Be(l.input);
|
|
1357
|
+
return c ? /* @__PURE__ */ n(e, { suggestions: c.suggestions, onSelect: i }) : null;
|
|
1358
|
+
}
|
|
1359
1359
|
function _i() {
|
|
1360
|
-
const { t: e } =
|
|
1360
|
+
const { t: e } = k(["chat"]);
|
|
1361
1361
|
return /* @__PURE__ */ n(
|
|
1362
1362
|
De.ScrollToBottom,
|
|
1363
1363
|
{
|
|
@@ -1376,46 +1376,46 @@ 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
|
-
(
|
|
1379
|
+
(c) => c.type === "text" && c.text.trim().length > 0 || c.type === "tool-ask_user" || !o && tt(c)
|
|
1380
1380
|
))
|
|
1381
1381
|
return null;
|
|
1382
1382
|
const l = oe(a);
|
|
1383
1383
|
return /* @__PURE__ */ n(
|
|
1384
1384
|
"div",
|
|
1385
1385
|
{
|
|
1386
|
-
className:
|
|
1386
|
+
className: x(
|
|
1387
1387
|
"flex w-full py-3 mx-auto max-w-3xl px-4 md:px-0 animate-in-bubble",
|
|
1388
1388
|
l === "rtl" ? "justify-end" : "justify-start"
|
|
1389
1389
|
),
|
|
1390
|
-
children: /* @__PURE__ */
|
|
1390
|
+
children: /* @__PURE__ */ d(
|
|
1391
1391
|
"div",
|
|
1392
1392
|
{
|
|
1393
|
-
className:
|
|
1393
|
+
className: x(
|
|
1394
1394
|
"flex items-center gap-3 text-sm text-muted-foreground",
|
|
1395
1395
|
l === "rtl" && "flex-row-reverse"
|
|
1396
1396
|
),
|
|
1397
1397
|
dir: l,
|
|
1398
1398
|
children: [
|
|
1399
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(_e, { className: "size-4 text-destructive shrink-0" }) : /* @__PURE__ */ n(vt, { className: "size-4 text-success shrink-0" }),
|
|
1400
|
-
/* @__PURE__ */ n("span", { className:
|
|
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
|
}, zi = Nt(
|
|
1407
|
-
() => import("./MessageEditor-
|
|
1407
|
+
() => import("./MessageEditor-thFldVmz.js").then((e) => ({ default: e.MessageEditor }))
|
|
1408
1408
|
), Ii = { UserMessage: Ti, AssistantMessage: Pi };
|
|
1409
1409
|
function Ti() {
|
|
1410
|
-
const e =
|
|
1411
|
-
return /* @__PURE__ */
|
|
1410
|
+
const e = W((a) => a.message.id), t = W((a) => a.isEditing), { MessageActions: s } = X(), r = Y((a) => a.threadActions);
|
|
1411
|
+
return /* @__PURE__ */ d(
|
|
1412
1412
|
le.Root,
|
|
1413
1413
|
{
|
|
1414
1414
|
"data-gentiq-message-id": e,
|
|
1415
1415
|
"data-gentiq-message-role": "user",
|
|
1416
1416
|
className: "group/message",
|
|
1417
1417
|
children: [
|
|
1418
|
-
t ? /* @__PURE__ */
|
|
1418
|
+
t ? /* @__PURE__ */ d(Ve, { fallback: /* @__PURE__ */ n(le.Parts, {}), children: [
|
|
1419
1419
|
/* @__PURE__ */ n(le.Parts, { components: Mi }),
|
|
1420
1420
|
/* @__PURE__ */ n(zi, {})
|
|
1421
1421
|
] }) : /* @__PURE__ */ n(le.Parts, {}),
|
|
@@ -1426,23 +1426,23 @@ function Ti() {
|
|
|
1426
1426
|
}
|
|
1427
1427
|
const Mi = { text: null };
|
|
1428
1428
|
function Pi() {
|
|
1429
|
-
const e =
|
|
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
1432
|
hasText: La({ parts: t }).length > 0
|
|
1433
1433
|
}),
|
|
1434
1434
|
[t]
|
|
1435
1435
|
);
|
|
1436
|
-
return /* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ d(
|
|
1437
1437
|
le.Root,
|
|
1438
1438
|
{
|
|
1439
1439
|
"data-gentiq-message-id": e,
|
|
1440
1440
|
"data-gentiq-message-role": "assistant",
|
|
1441
1441
|
className: "group/message",
|
|
1442
1442
|
children: [
|
|
1443
|
-
a.length > 0 && /* @__PURE__ */
|
|
1444
|
-
/* @__PURE__ */ n(
|
|
1445
|
-
a.map((i, l) => /* @__PURE__ */ n(
|
|
1443
|
+
a.length > 0 && /* @__PURE__ */ d(vi, { children: [
|
|
1444
|
+
/* @__PURE__ */ n(yi, { count: a.length }),
|
|
1445
|
+
a.map((i, l) => /* @__PURE__ */ n(wi, { children: /* @__PURE__ */ n(Ni, { href: i, title: i }) }, `${e}-source-${l}`))
|
|
1446
1446
|
] }),
|
|
1447
1447
|
/* @__PURE__ */ n(le.Parts, {}),
|
|
1448
1448
|
o && /* @__PURE__ */ n(
|
|
@@ -1452,22 +1452,23 @@ function Pi() {
|
|
|
1452
1452
|
feedback: r.feedback,
|
|
1453
1453
|
edit: !1
|
|
1454
1454
|
}
|
|
1455
|
-
)
|
|
1455
|
+
),
|
|
1456
|
+
/* @__PURE__ */ n(ki, {})
|
|
1456
1457
|
]
|
|
1457
1458
|
}
|
|
1458
1459
|
);
|
|
1459
1460
|
}
|
|
1460
1461
|
function Ri({ className: e }) {
|
|
1461
|
-
const { t } =
|
|
1462
|
+
const { t } = k(["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(
|
|
1462
1463
|
() => l === void 0 ? null : na(l, t),
|
|
1463
1464
|
[l, t]
|
|
1464
|
-
), { dockHeight:
|
|
1465
|
+
), { dockHeight: u } = st(), p = `calc(var(--gentiq-composer-inset, calc(6.5rem + ${u}px)) + 1.5rem)`, m = i, g = ve((b) => b.earlier.status), f = 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(Si)));
|
|
1465
1466
|
let y;
|
|
1466
1467
|
if (h?.role === "assistant")
|
|
1467
1468
|
for (const b of h.parts)
|
|
1468
1469
|
b.type === "data-progress-update" && (y = b);
|
|
1469
|
-
return /* @__PURE__ */
|
|
1470
|
-
/* @__PURE__ */
|
|
1470
|
+
return /* @__PURE__ */ d("div", { className: x("relative min-h-0 flex-1 overflow-hidden", e), children: [
|
|
1471
|
+
/* @__PURE__ */ d(
|
|
1471
1472
|
De.Viewport,
|
|
1472
1473
|
{
|
|
1473
1474
|
scrollClassName: "custom-scrollbar",
|
|
@@ -1485,8 +1486,8 @@ function Ri({ className: e }) {
|
|
|
1485
1486
|
isFinished: N
|
|
1486
1487
|
}
|
|
1487
1488
|
),
|
|
1488
|
-
|
|
1489
|
-
o === "error" &&
|
|
1489
|
+
v && /* @__PURE__ */ n("div", { className: "animate-in-bubble", children: /* @__PURE__ */ n(Ue, {}) }),
|
|
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 }) })
|
|
1490
1491
|
]
|
|
1491
1492
|
}
|
|
1492
1493
|
),
|
|
@@ -1515,8 +1516,8 @@ function Ri({ className: e }) {
|
|
|
1515
1516
|
}
|
|
1516
1517
|
const Ai = "size-8 rounded-full p-1.5 text-muted-foreground hover:bg-accent/60 hover:text-foreground disabled:opacity-40";
|
|
1517
1518
|
function Di({ retry: e, feedback: t, edit: s }) {
|
|
1518
|
-
const { t: r } =
|
|
1519
|
-
return /* @__PURE__ */
|
|
1519
|
+
const { t: r } = k(["chat", "errors"]), a = W((c) => c.message.role === "user"), o = (c) => B.error(fe(c, r)), [i, l] = Vt(2e3);
|
|
1520
|
+
return /* @__PURE__ */ d(
|
|
1520
1521
|
be.Root,
|
|
1521
1522
|
{
|
|
1522
1523
|
"aria-label": r("message_actions"),
|
|
@@ -1542,14 +1543,14 @@ function Di({ retry: e, feedback: t, edit: s }) {
|
|
|
1542
1543
|
],
|
|
1543
1544
|
[s, "edit_message", be.Edit, fr, void 0, void 0]
|
|
1544
1545
|
].map(
|
|
1545
|
-
([
|
|
1546
|
+
([c, u, p, m, g, f]) => c && /* @__PURE__ */ n(mn, { label: r(u), children: /* @__PURE__ */ n(p, { "aria-label": r(u), onError: g, className: f, children: /* @__PURE__ */ n(m, { className: "size-4" }) }) }, u)
|
|
1546
1547
|
),
|
|
1547
|
-
/* @__PURE__ */ n(mn, { label: r("copy"), children: /* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ n(mn, { label: r("copy"), children: /* @__PURE__ */ d(
|
|
1548
1549
|
be.Copy,
|
|
1549
1550
|
{
|
|
1550
1551
|
"aria-label": r("copy"),
|
|
1551
1552
|
onCopied: l,
|
|
1552
|
-
onError: () =>
|
|
1553
|
+
onError: () => B.error(r("copy_failed")),
|
|
1553
1554
|
className: "group/copy",
|
|
1554
1555
|
children: [
|
|
1555
1556
|
/* @__PURE__ */ n(zn, { className: "size-4 group-data-[copied]/copy:hidden" }),
|
|
@@ -1563,15 +1564,15 @@ function Di({ retry: e, feedback: t, edit: s }) {
|
|
|
1563
1564
|
);
|
|
1564
1565
|
}
|
|
1565
1566
|
function mn({ label: e, children: t }) {
|
|
1566
|
-
return /* @__PURE__ */
|
|
1567
|
+
return /* @__PURE__ */ d(Ye, { children: [
|
|
1567
1568
|
/* @__PURE__ */ n(Je, { asChild: !0, children: /* @__PURE__ */ n(E, { variant: "ghost", size: "sm", className: Ai, asChild: !0, children: t }) }),
|
|
1568
1569
|
/* @__PURE__ */ n(Ze, { children: e })
|
|
1569
1570
|
] });
|
|
1570
1571
|
}
|
|
1571
1572
|
const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg-transparent w-full", children: /* @__PURE__ */ n(
|
|
1572
|
-
|
|
1573
|
+
pe.Root,
|
|
1573
1574
|
{
|
|
1574
|
-
className:
|
|
1575
|
+
className: x(
|
|
1575
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",
|
|
1576
1577
|
e
|
|
1577
1578
|
),
|
|
@@ -1579,25 +1580,25 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1579
1580
|
}
|
|
1580
1581
|
) }), Ei = $n(
|
|
1581
1582
|
function({ className: t, placeholder: s, ...r }, a) {
|
|
1582
|
-
const { dir: o } =
|
|
1583
|
-
return /* @__PURE__ */
|
|
1583
|
+
const { dir: o } = V(), i = _t().draft, l = oe(i, o), c = `${i || s || ""} `;
|
|
1584
|
+
return /* @__PURE__ */ d("div", { className: "grid min-w-0 flex-1", children: [
|
|
1584
1585
|
/* @__PURE__ */ n(
|
|
1585
1586
|
"div",
|
|
1586
1587
|
{
|
|
1587
1588
|
"aria-hidden": !0,
|
|
1588
1589
|
dir: l,
|
|
1589
1590
|
className: "invisible col-start-1 row-start-1 max-h-[6lh] overflow-hidden whitespace-pre-wrap break-words px-2 py-2.5 text-base",
|
|
1590
|
-
children:
|
|
1591
|
+
children: c
|
|
1591
1592
|
}
|
|
1592
1593
|
),
|
|
1593
1594
|
/* @__PURE__ */ n(
|
|
1594
|
-
|
|
1595
|
+
pe.Input,
|
|
1595
1596
|
{
|
|
1596
1597
|
ref: a,
|
|
1597
1598
|
dir: l,
|
|
1598
1599
|
rows: 1,
|
|
1599
1600
|
placeholder: s,
|
|
1600
|
-
className:
|
|
1601
|
+
className: x(
|
|
1601
1602
|
"col-start-1 row-start-1 w-full min-w-0 disabled:cursor-not-allowed disabled:opacity-50 resize-none rounded-none border-none shadow-none outline-none ring-0 px-2 py-2.5 field-sizing-content max-h-[6lh] bg-transparent dark:bg-transparent focus-visible:ring-0 min-h-[40px] md:min-h-[44px] text-base placeholder:text-muted-foreground/60 transition-all duration-200",
|
|
1602
1603
|
t
|
|
1603
1604
|
),
|
|
@@ -1606,7 +1607,7 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1606
1607
|
)
|
|
1607
1608
|
] });
|
|
1608
1609
|
}
|
|
1609
|
-
), Li = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className:
|
|
1610
|
+
), Li = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: x("flex shrink-0 items-center gap-1.5 pb-1", e), ...t }), qi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: x("flex items-center gap-0.5", e), ...t }), Ps = ({
|
|
1610
1611
|
variant: e = "ghost",
|
|
1611
1612
|
className: t,
|
|
1612
1613
|
size: s,
|
|
@@ -1616,7 +1617,7 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1616
1617
|
return /* @__PURE__ */ n(
|
|
1617
1618
|
E,
|
|
1618
1619
|
{
|
|
1619
|
-
className:
|
|
1620
|
+
className: x(
|
|
1620
1621
|
"shrink-0 gap-1.5 rounded-full text-muted-foreground hover:text-foreground hover:bg-accent/60 transition-all duration-200 active:scale-95",
|
|
1621
1622
|
a === "default" && "px-3",
|
|
1622
1623
|
t
|
|
@@ -1639,12 +1640,12 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1639
1640
|
children: a,
|
|
1640
1641
|
...o
|
|
1641
1642
|
}) => {
|
|
1642
|
-
const { t: i } =
|
|
1643
|
+
const { t: i } = k("chat"), l = r === "submitted" || r === "streaming", c = r && $i[r] || Tn, u = i(l ? "stop_generation" : r === "error" ? "send_failed" : "send_message");
|
|
1643
1644
|
return /* @__PURE__ */ n(
|
|
1644
1645
|
E,
|
|
1645
1646
|
{
|
|
1646
|
-
"aria-label":
|
|
1647
|
-
className:
|
|
1647
|
+
"aria-label": u,
|
|
1648
|
+
className: x(
|
|
1648
1649
|
"shrink-0 rounded-full size-9 bg-primary text-primary-foreground hover:bg-primary/90 transition-colors duration-200 disabled:opacity-40",
|
|
1649
1650
|
r === "submitted" && "bg-muted text-foreground hover:bg-muted",
|
|
1650
1651
|
e
|
|
@@ -1653,13 +1654,13 @@ const Oi = ({ className: e, ...t }) => /* @__PURE__ */ n("div", { className: "bg
|
|
|
1653
1654
|
type: l ? "button" : "submit",
|
|
1654
1655
|
variant: t,
|
|
1655
1656
|
...o,
|
|
1656
|
-
children: a ?? /* @__PURE__ */ n(
|
|
1657
|
+
children: a ?? /* @__PURE__ */ n(c, { className: l ? "size-3.5 fill-current" : "size-4" })
|
|
1657
1658
|
}
|
|
1658
1659
|
);
|
|
1659
1660
|
}, lt = 768;
|
|
1660
1661
|
function Qt() {
|
|
1661
|
-
const [e, t] =
|
|
1662
|
-
return
|
|
1662
|
+
const [e, t] = ee.useState(void 0);
|
|
1663
|
+
return ee.useEffect(() => {
|
|
1663
1664
|
const s = window.matchMedia(`(max-width: ${lt - 1}px)`), r = () => {
|
|
1664
1665
|
t(window.innerWidth < lt);
|
|
1665
1666
|
};
|
|
@@ -1674,22 +1675,22 @@ function ji({
|
|
|
1674
1675
|
remove: t,
|
|
1675
1676
|
retry: s
|
|
1676
1677
|
}) {
|
|
1677
|
-
const { t: r } =
|
|
1678
|
-
return /* @__PURE__ */
|
|
1678
|
+
const { t: r } = k(["chat", "errors"]), { file: a, status: o, progress: i, error: l, retryable: c } = e, u = Fi(a.type.startsWith("image/") ? a : null), p = o === "failed", m = p ? qt(l) ? fe(l, r) : r("upload_failed") : "";
|
|
1679
|
+
return /* @__PURE__ */ d(
|
|
1679
1680
|
"div",
|
|
1680
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 ${p ? "border-destructive/50" : "border-border/60"}`,
|
|
1682
1683
|
"data-status": o,
|
|
1683
1684
|
children: [
|
|
1684
|
-
|
|
1685
|
+
u ? /* @__PURE__ */ n(
|
|
1685
1686
|
"img",
|
|
1686
1687
|
{
|
|
1687
|
-
src:
|
|
1688
|
+
src: u,
|
|
1688
1689
|
alt: a.name,
|
|
1689
1690
|
className: "size-7 shrink-0 rounded-lg object-cover ring-1 ring-border/50"
|
|
1690
1691
|
}
|
|
1691
1692
|
) : /* @__PURE__ */ n(In, { className: "size-3.5 shrink-0 text-muted-foreground", "aria-hidden": !0 }),
|
|
1692
|
-
/* @__PURE__ */
|
|
1693
|
+
/* @__PURE__ */ d("span", { className: "flex min-w-0 flex-col", children: [
|
|
1693
1694
|
/* @__PURE__ */ n("span", { className: "max-w-[120px] truncate text-xs font-medium text-foreground/80", dir: "auto", children: a.name }),
|
|
1694
1695
|
o === "uploading" && /* @__PURE__ */ n(
|
|
1695
1696
|
"span",
|
|
@@ -1709,12 +1710,12 @@ function ji({
|
|
|
1709
1710
|
)
|
|
1710
1711
|
}
|
|
1711
1712
|
),
|
|
1712
|
-
p && /* @__PURE__ */
|
|
1713
|
+
p && /* @__PURE__ */ d("span", { className: "flex items-center gap-1 text-xs text-destructive", role: "alert", children: [
|
|
1713
1714
|
/* @__PURE__ */ n(gr, { className: "size-3 shrink-0", "aria-hidden": !0 }),
|
|
1714
1715
|
/* @__PURE__ */ n("span", { className: "max-w-[180px] truncate", title: m, children: m })
|
|
1715
1716
|
] })
|
|
1716
1717
|
] }),
|
|
1717
|
-
p &&
|
|
1718
|
+
p && c && /* @__PURE__ */ n(
|
|
1718
1719
|
"button",
|
|
1719
1720
|
{
|
|
1720
1721
|
type: "button",
|
|
@@ -1749,14 +1750,14 @@ function Fi(e) {
|
|
|
1749
1750
|
}, [e]), t;
|
|
1750
1751
|
}
|
|
1751
1752
|
function Ui({ reference: e, remove: t, focus: s }) {
|
|
1752
|
-
const { t: r } =
|
|
1753
|
-
return /* @__PURE__ */
|
|
1753
|
+
const { t: r } = k(["chat"]);
|
|
1754
|
+
return /* @__PURE__ */ d(
|
|
1754
1755
|
"div",
|
|
1755
1756
|
{
|
|
1756
1757
|
className: "group/reference-chip flex min-w-0 max-w-[min(100%,260px)] items-center gap-2 rounded-lg border border-primary/15 bg-primary/8 px-2.5 py-1.5 text-start text-xs shadow-sm transition hover:bg-primary/12",
|
|
1757
1758
|
title: e.excerpt,
|
|
1758
1759
|
children: [
|
|
1759
|
-
/* @__PURE__ */
|
|
1760
|
+
/* @__PURE__ */ d(
|
|
1760
1761
|
"button",
|
|
1761
1762
|
{
|
|
1762
1763
|
type: "button",
|
|
@@ -1799,7 +1800,7 @@ function Bi(e, t) {
|
|
|
1799
1800
|
}
|
|
1800
1801
|
function Hi(e, { t, language: s, maxSize: r }) {
|
|
1801
1802
|
for (const { file: a, reason: o } of e)
|
|
1802
|
-
o === "unsupported_type" ?
|
|
1803
|
+
o === "unsupported_type" ? B.error(t("chat:file_type_not_supported", { name: a.name })) : o === "too_large" && r !== void 0 && B.error(
|
|
1803
1804
|
t("chat:file_too_large", { name: a.name, size: Bi(r, s) })
|
|
1804
1805
|
);
|
|
1805
1806
|
}
|
|
@@ -1813,17 +1814,17 @@ const Vi = {
|
|
|
1813
1814
|
};
|
|
1814
1815
|
function Gi(e, t) {
|
|
1815
1816
|
const s = t(Vi[e.kind]);
|
|
1816
|
-
e.kind === "failed" ?
|
|
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);
|
|
1817
1818
|
}
|
|
1818
1819
|
function Rs({
|
|
1819
1820
|
enabled: e = !0
|
|
1820
1821
|
} = {}) {
|
|
1821
|
-
const { t, i18n: s } =
|
|
1822
|
+
const { t, i18n: s } = k(["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({
|
|
1822
1823
|
enabled: e && (o || i)
|
|
1823
|
-
}), p = a?.typingPrompts, m = typeof p == "function" ? p({ user: l, firstName:
|
|
1824
|
+
}), p = a?.typingPrompts, m = typeof p == "function" ? p({ user: l, firstName: c, isLoading: u, t }) : p, g = t("welcome.typing_prompts", { returnObjects: !0, defaultValue: [] }), f = (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;
|
|
1824
1825
|
return {
|
|
1825
1826
|
title: N,
|
|
1826
|
-
subtitle:
|
|
1827
|
+
subtitle: v,
|
|
1827
1828
|
typingMessages: f,
|
|
1828
1829
|
isRtl: r === "rtl",
|
|
1829
1830
|
icon: a?.icon
|
|
@@ -1831,38 +1832,38 @@ function Rs({
|
|
|
1831
1832
|
}
|
|
1832
1833
|
const Wi = () => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1833
1834
|
function Qi(e, t = {}) {
|
|
1834
|
-
const { typingSpeed: s = 20, deletingSpeed: r = 15, pauseMs: a = 2e3, startDelayMs: o = 250 } = t, i = e.join("\0"), [l,
|
|
1835
|
-
return
|
|
1836
|
-
const p =
|
|
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
|
+
return u.current = e, D(() => {
|
|
1837
|
+
const p = u.current;
|
|
1837
1838
|
if (p.length === 0) {
|
|
1838
|
-
|
|
1839
|
+
c("");
|
|
1839
1840
|
return;
|
|
1840
1841
|
}
|
|
1841
1842
|
let m, g = 0, f = "typing", h = 0;
|
|
1842
1843
|
if (Wi()) {
|
|
1843
|
-
|
|
1844
|
+
c(p[0]);
|
|
1844
1845
|
const y = setInterval(() => {
|
|
1845
|
-
g = (g + 1) % p.length,
|
|
1846
|
+
g = (g + 1) % p.length, c(p[g]);
|
|
1846
1847
|
}, a);
|
|
1847
1848
|
return () => clearInterval(y);
|
|
1848
1849
|
}
|
|
1849
|
-
const
|
|
1850
|
+
const v = () => {
|
|
1850
1851
|
const y = p[g];
|
|
1851
1852
|
if (f === "typing") {
|
|
1852
|
-
h++,
|
|
1853
|
+
h++, c(y.slice(0, h)), h >= y.length ? (f = "pausing", m = setTimeout(v, a)) : m = setTimeout(v, s);
|
|
1853
1854
|
return;
|
|
1854
1855
|
}
|
|
1855
1856
|
if (f === "pausing") {
|
|
1856
|
-
f = "deleting", m = setTimeout(
|
|
1857
|
+
f = "deleting", m = setTimeout(v, r);
|
|
1857
1858
|
return;
|
|
1858
1859
|
}
|
|
1859
|
-
h--,
|
|
1860
|
+
h--, c(y.slice(0, Math.max(h, 0))), h <= 0 ? (f = "typing", g = (g + 1) % p.length, m = setTimeout(v, s)) : m = setTimeout(v, r);
|
|
1860
1861
|
};
|
|
1861
|
-
return
|
|
1862
|
+
return c(""), m = setTimeout(v, o), () => clearTimeout(m);
|
|
1862
1863
|
}, [i, s, r, a, o]), l;
|
|
1863
1864
|
}
|
|
1864
1865
|
function Ki({ open: e, onOpenChange: t, onCapture: s }) {
|
|
1865
|
-
return /* @__PURE__ */ n(qe, { open: e, onOpenChange: t, children: /* @__PURE__ */
|
|
1866
|
+
return /* @__PURE__ */ n(qe, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Yn, { children: [
|
|
1866
1867
|
/* @__PURE__ */ n(ke.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" }),
|
|
1867
1868
|
/* @__PURE__ */ n(
|
|
1868
1869
|
ke.Content,
|
|
@@ -1886,9 +1887,9 @@ function Ki({ open: e, onOpenChange: t, onCapture: s }) {
|
|
|
1886
1887
|
}
|
|
1887
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";
|
|
1888
1889
|
function Xi({ onKeep: e }) {
|
|
1889
|
-
const { t } =
|
|
1890
|
+
const { t } = k("chat"), s = U(null), [r, a] = C(), [o, i] = C(null), [l, c] = C([]), [u, p] = C(!1), [m, g] = C(!1), [f, h] = C(null);
|
|
1890
1891
|
D(() => {
|
|
1891
|
-
let
|
|
1892
|
+
let _ = !1, z = null;
|
|
1892
1893
|
return navigator.mediaDevices.getUserMedia({
|
|
1893
1894
|
audio: !1,
|
|
1894
1895
|
video: {
|
|
@@ -1897,37 +1898,37 @@ function Xi({ onKeep: e }) {
|
|
|
1897
1898
|
height: { ideal: 1080 }
|
|
1898
1899
|
}
|
|
1899
1900
|
}).then(async (T) => {
|
|
1900
|
-
if (
|
|
1901
|
-
|
|
1901
|
+
if (_) return T.getTracks().forEach((A) => A.stop());
|
|
1902
|
+
z = T, s.current && (s.current.srcObject = T), i(T);
|
|
1902
1903
|
const P = await navigator.mediaDevices.enumerateDevices();
|
|
1903
|
-
|
|
1904
|
-
}).catch(() => !
|
|
1905
|
-
|
|
1904
|
+
_ || c(P.filter((A) => A.kind === "videoinput").map((A) => A.deviceId));
|
|
1905
|
+
}).catch(() => !_ && g(!0)), () => {
|
|
1906
|
+
_ = !0, z?.getTracks().forEach((T) => T.stop());
|
|
1906
1907
|
};
|
|
1907
1908
|
}, [r]), D(() => () => {
|
|
1908
1909
|
f && URL.revokeObjectURL(f.url);
|
|
1909
1910
|
}, [f]);
|
|
1910
|
-
const N = o?.getVideoTracks()[0]?.getSettings(),
|
|
1911
|
-
const
|
|
1912
|
-
!
|
|
1911
|
+
const N = o?.getVideoTracks()[0]?.getSettings(), v = N?.facingMode !== "environment", y = () => {
|
|
1912
|
+
const _ = l[(l.indexOf(N?.deviceId ?? "") + 1) % l.length];
|
|
1913
|
+
!_ || _ === N?.deviceId || (s.current && (s.current.srcObject = null), i(null), p(!1), a(_));
|
|
1913
1914
|
}, b = () => {
|
|
1914
|
-
const
|
|
1915
|
-
if (!
|
|
1916
|
-
const
|
|
1917
|
-
width:
|
|
1918
|
-
height:
|
|
1915
|
+
const _ = s.current;
|
|
1916
|
+
if (!_?.videoWidth) return;
|
|
1917
|
+
const z = Object.assign(document.createElement("canvas"), {
|
|
1918
|
+
width: _.videoWidth,
|
|
1919
|
+
height: _.videoHeight
|
|
1919
1920
|
});
|
|
1920
|
-
|
|
1921
|
+
z.getContext("2d")?.drawImage(_, 0, 0), z.toBlob(
|
|
1921
1922
|
(T) => T && h({ blob: T, url: URL.createObjectURL(T) }),
|
|
1922
1923
|
"image/jpeg",
|
|
1923
1924
|
0.92
|
|
1924
1925
|
);
|
|
1925
1926
|
}, I = () => {
|
|
1926
1927
|
if (!f) return;
|
|
1927
|
-
const
|
|
1928
|
-
e(new File([f.blob], `photo-${
|
|
1928
|
+
const _ = (/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/[-:]/g, "").replace("T", "-");
|
|
1929
|
+
e(new File([f.blob], `photo-${_}.jpg`, { type: "image/jpeg" }));
|
|
1929
1930
|
};
|
|
1930
|
-
return /* @__PURE__ */
|
|
1931
|
+
return /* @__PURE__ */ d("div", { className: "relative aspect-[3/4] max-h-[80dvh] w-full sm:aspect-video", children: [
|
|
1931
1932
|
/* @__PURE__ */ n(
|
|
1932
1933
|
"video",
|
|
1933
1934
|
{
|
|
@@ -1936,10 +1937,10 @@ function Xi({ onKeep: e }) {
|
|
|
1936
1937
|
playsInline: !0,
|
|
1937
1938
|
muted: !0,
|
|
1938
1939
|
onPlaying: () => p(!0),
|
|
1939
|
-
className:
|
|
1940
|
+
className: x(
|
|
1940
1941
|
"absolute inset-0 size-full object-cover transition-opacity duration-500",
|
|
1941
|
-
|
|
1942
|
-
|
|
1942
|
+
u ? "opacity-100" : "opacity-0",
|
|
1943
|
+
v && "-scale-x-100"
|
|
1943
1944
|
)
|
|
1944
1945
|
}
|
|
1945
1946
|
),
|
|
@@ -1951,21 +1952,21 @@ function Xi({ onKeep: e }) {
|
|
|
1951
1952
|
className: "absolute inset-0 size-full object-cover animate-in fade-in-0 zoom-in-[1.02] duration-200"
|
|
1952
1953
|
}
|
|
1953
1954
|
),
|
|
1954
|
-
m ? /* @__PURE__ */
|
|
1955
|
+
m ? /* @__PURE__ */ d("div", { className: "absolute inset-0 flex flex-col items-center justify-center gap-4 px-8 text-center", children: [
|
|
1955
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" }) }),
|
|
1956
1957
|
/* @__PURE__ */ n("p", { className: "max-w-xs text-sm leading-relaxed text-white/70", children: t("camera_error") })
|
|
1957
|
-
] }) : !
|
|
1958
|
-
/* @__PURE__ */
|
|
1958
|
+
] }) : !u && /* @__PURE__ */ n("div", { className: "absolute inset-0 grid place-items-center", children: /* @__PURE__ */ n(yt, { className: "size-6 animate-spin text-white/50" }) }),
|
|
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: [
|
|
1959
1960
|
/* @__PURE__ */ n(ke.Title, { className: "ps-1 text-sm font-medium text-white/90", children: t("camera_title") }),
|
|
1960
1961
|
/* @__PURE__ */ n(ke.Close, { className: gn, "aria-label": t("camera_close"), children: /* @__PURE__ */ n(_e, { className: "size-4.5" }) })
|
|
1961
1962
|
] }),
|
|
1962
|
-
!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: f ? /* @__PURE__ */
|
|
1963
|
-
/* @__PURE__ */
|
|
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: f ? /* @__PURE__ */ d($, { children: [
|
|
1964
|
+
/* @__PURE__ */ d(
|
|
1964
1965
|
"button",
|
|
1965
1966
|
{
|
|
1966
1967
|
type: "button",
|
|
1967
1968
|
onClick: () => h(null),
|
|
1968
|
-
className:
|
|
1969
|
+
className: x(
|
|
1969
1970
|
bn,
|
|
1970
1971
|
"justify-self-start bg-white/12 text-white backdrop-blur-md hover:bg-white/20"
|
|
1971
1972
|
),
|
|
@@ -1975,12 +1976,12 @@ function Xi({ onKeep: e }) {
|
|
|
1975
1976
|
]
|
|
1976
1977
|
}
|
|
1977
1978
|
),
|
|
1978
|
-
/* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ d(
|
|
1979
1980
|
"button",
|
|
1980
1981
|
{
|
|
1981
1982
|
type: "button",
|
|
1982
1983
|
onClick: I,
|
|
1983
|
-
className:
|
|
1984
|
+
className: x(
|
|
1984
1985
|
bn,
|
|
1985
1986
|
"col-start-3 justify-self-end bg-white text-black shadow-lg hover:bg-white/90"
|
|
1986
1987
|
),
|
|
@@ -1990,13 +1991,13 @@ function Xi({ onKeep: e }) {
|
|
|
1990
1991
|
]
|
|
1991
1992
|
}
|
|
1992
1993
|
)
|
|
1993
|
-
] }) : /* @__PURE__ */
|
|
1994
|
+
] }) : /* @__PURE__ */ d($, { children: [
|
|
1994
1995
|
/* @__PURE__ */ n(
|
|
1995
1996
|
"button",
|
|
1996
1997
|
{
|
|
1997
1998
|
type: "button",
|
|
1998
1999
|
onClick: b,
|
|
1999
|
-
disabled: !
|
|
2000
|
+
disabled: !u,
|
|
2000
2001
|
"aria-label": t("camera_capture"),
|
|
2001
2002
|
className: "group col-start-2 grid size-[4.25rem] place-items-center rounded-full border-[3px] border-white/90 transition-opacity focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-white/40 disabled:opacity-40",
|
|
2002
2003
|
children: /* @__PURE__ */ n("span", { className: "size-[3.375rem] rounded-full bg-white transition-transform duration-150 ease-out group-hover:scale-[0.94] group-active:scale-[0.82]" })
|
|
@@ -2007,9 +2008,9 @@ function Xi({ onKeep: e }) {
|
|
|
2007
2008
|
{
|
|
2008
2009
|
type: "button",
|
|
2009
2010
|
onClick: y,
|
|
2010
|
-
disabled: !
|
|
2011
|
+
disabled: !u,
|
|
2011
2012
|
"aria-label": t("camera_switch"),
|
|
2012
|
-
className:
|
|
2013
|
+
className: x(
|
|
2013
2014
|
gn,
|
|
2014
2015
|
"col-start-3 size-11 justify-self-end disabled:opacity-40"
|
|
2015
2016
|
),
|
|
@@ -2037,26 +2038,26 @@ function Yi() {
|
|
|
2037
2038
|
return window.matchMedia("(pointer: coarse)").matches ? "native" : "mediaDevices" in navigator ? "webcam" : null;
|
|
2038
2039
|
}
|
|
2039
2040
|
function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
2040
|
-
const { t: r } =
|
|
2041
|
-
camera:
|
|
2042
|
-
gallery:
|
|
2043
|
-
files:
|
|
2044
|
-
}, m = Le()?.attachments.types ?? [], g = m.filter((b) => b.startsWith("image/")), f = g.length ? [...
|
|
2045
|
-
b === "camera" &&
|
|
2041
|
+
const { t: r } = k("chat"), { dir: a } = V(), [o, i] = C(!1), [l, c] = C(!1), [u] = C(Yi), p = {
|
|
2042
|
+
camera: U(null),
|
|
2043
|
+
gallery: U(null),
|
|
2044
|
+
files: U(null)
|
|
2045
|
+
}, m = Le()?.attachments.types ?? [], g = m.filter((b) => b.startsWith("image/")), f = g.length ? [...u ? ["camera"] : [], "gallery", "files"] : ["files"], h = (b) => {
|
|
2046
|
+
b === "camera" && u === "webcam" ? c(!0) : p[b].current?.click();
|
|
2046
2047
|
}, N = (b) => {
|
|
2047
2048
|
b.target.files && t(Array.from(b.target.files)), b.target.value = "";
|
|
2048
|
-
},
|
|
2049
|
+
}, v = r("attach"), y = /* @__PURE__ */ n(
|
|
2049
2050
|
Ps,
|
|
2050
2051
|
{
|
|
2051
2052
|
variant: "ghost",
|
|
2052
2053
|
disabled: e,
|
|
2053
|
-
"aria-label":
|
|
2054
|
+
"aria-label": v,
|
|
2054
2055
|
onClick: f.length === 1 ? () => h("files") : s ? () => i(!0) : void 0,
|
|
2055
|
-
className:
|
|
2056
|
+
className: x(o && "bg-accent/60 text-foreground transition-colors active:scale-100"),
|
|
2056
2057
|
children: /* @__PURE__ */ n(
|
|
2057
2058
|
wr,
|
|
2058
2059
|
{
|
|
2059
|
-
className:
|
|
2060
|
+
className: x(
|
|
2060
2061
|
"size-6 transition-transform duration-300 ease-[cubic-bezier(0.34,1.56,0.64,1)]",
|
|
2061
2062
|
o && "rotate-45"
|
|
2062
2063
|
)
|
|
@@ -2064,7 +2065,7 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2064
2065
|
)
|
|
2065
2066
|
}
|
|
2066
2067
|
);
|
|
2067
|
-
return /* @__PURE__ */
|
|
2068
|
+
return /* @__PURE__ */ d($, { children: [
|
|
2068
2069
|
["camera", "gallery", "files"].map((b) => /* @__PURE__ */ n(
|
|
2069
2070
|
"input",
|
|
2070
2071
|
{
|
|
@@ -2078,17 +2079,17 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2078
2079
|
},
|
|
2079
2080
|
b
|
|
2080
2081
|
)),
|
|
2081
|
-
f.length === 1 ? /* @__PURE__ */
|
|
2082
|
+
f.length === 1 ? /* @__PURE__ */ d(Ye, { children: [
|
|
2082
2083
|
/* @__PURE__ */ n(Je, { asChild: !0, children: y }),
|
|
2083
|
-
/* @__PURE__ */ n(Ze, { children:
|
|
2084
|
-
] }) : s ? /* @__PURE__ */
|
|
2084
|
+
/* @__PURE__ */ n(Ze, { children: v })
|
|
2085
|
+
] }) : s ? /* @__PURE__ */ d($, { children: [
|
|
2085
2086
|
y,
|
|
2086
2087
|
/* @__PURE__ */ n(
|
|
2087
2088
|
Zi,
|
|
2088
2089
|
{
|
|
2089
2090
|
open: o,
|
|
2090
2091
|
onOpenChange: i,
|
|
2091
|
-
title:
|
|
2092
|
+
title: v,
|
|
2092
2093
|
sources: f,
|
|
2093
2094
|
onPick: (b) => {
|
|
2094
2095
|
h(b), i(!1);
|
|
@@ -2100,7 +2101,7 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2100
2101
|
// page unclickable once both have closed. Given the language's direction
|
|
2101
2102
|
// because Radix doesn't read the document's: it would lay the menu out
|
|
2102
2103
|
// left-to-right, and `align="start"` would hug the left edge in RTL too.
|
|
2103
|
-
/* @__PURE__ */
|
|
2104
|
+
/* @__PURE__ */ d(Pt, { dir: a, modal: !1, open: o, onOpenChange: i, children: [
|
|
2104
2105
|
/* @__PURE__ */ n(Rt, { asChild: !0, children: y }),
|
|
2105
2106
|
/* @__PURE__ */ n(
|
|
2106
2107
|
At,
|
|
@@ -2111,15 +2112,15 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2111
2112
|
className: "min-w-0 rounded-2xl border-border/60 bg-popover p-1.5 shadow-xl",
|
|
2112
2113
|
onCloseAutoFocus: (b) => l && b.preventDefault(),
|
|
2113
2114
|
children: f.map((b) => {
|
|
2114
|
-
const { icon: I, label:
|
|
2115
|
-
return /* @__PURE__ */
|
|
2115
|
+
const { icon: I, label: _ } = As[b];
|
|
2116
|
+
return /* @__PURE__ */ d(
|
|
2116
2117
|
we,
|
|
2117
2118
|
{
|
|
2118
2119
|
onSelect: () => h(b),
|
|
2119
2120
|
className: "cursor-pointer gap-3 rounded-xl py-1.5 ps-1.5 pe-4 font-medium",
|
|
2120
2121
|
children: [
|
|
2121
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" }) }),
|
|
2122
|
-
r(
|
|
2123
|
+
r(_)
|
|
2123
2124
|
]
|
|
2124
2125
|
},
|
|
2125
2126
|
b
|
|
@@ -2129,18 +2130,18 @@ function Ji({ disabled: e, addFiles: t, isMobile: s }) {
|
|
|
2129
2130
|
)
|
|
2130
2131
|
] })
|
|
2131
2132
|
),
|
|
2132
|
-
|
|
2133
|
+
u === "webcam" && /* @__PURE__ */ n(
|
|
2133
2134
|
Ki,
|
|
2134
2135
|
{
|
|
2135
2136
|
open: l,
|
|
2136
|
-
onOpenChange:
|
|
2137
|
+
onOpenChange: c,
|
|
2137
2138
|
onCapture: (b) => t([b])
|
|
2138
2139
|
}
|
|
2139
2140
|
)
|
|
2140
2141
|
] });
|
|
2141
2142
|
}
|
|
2142
2143
|
function Zi({ open: e, onOpenChange: t, title: s, sources: r, onPick: a }) {
|
|
2143
|
-
return /* @__PURE__ */ n(qe, { open: e, onOpenChange: t, children: /* @__PURE__ */
|
|
2144
|
+
return /* @__PURE__ */ n(qe, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Yn, { children: [
|
|
2144
2145
|
/* @__PURE__ */ n(ha, {}),
|
|
2145
2146
|
/* @__PURE__ */ n(
|
|
2146
2147
|
ke.Content,
|
|
@@ -2167,10 +2168,10 @@ function el({
|
|
|
2167
2168
|
onPick: s,
|
|
2168
2169
|
onDismiss: r
|
|
2169
2170
|
}) {
|
|
2170
|
-
const { t: a } =
|
|
2171
|
-
|
|
2171
|
+
const { t: a } = k("chat"), [o, i] = C(0), [l, c] = C(!1), u = U(0), p = () => {
|
|
2172
|
+
c(!1), o > 72 ? r() : i(0);
|
|
2172
2173
|
};
|
|
2173
|
-
return /* @__PURE__ */
|
|
2174
|
+
return /* @__PURE__ */ d(
|
|
2174
2175
|
"div",
|
|
2175
2176
|
{
|
|
2176
2177
|
className: "mx-auto w-full max-w-lg rounded-t-[1.75rem] border border-b-0 border-border/60 bg-popover px-4 pb-[max(1.25rem,env(safe-area-inset-bottom))] shadow-[0_-12px_48px_-16px_rgb(0_0_0/0.3)]",
|
|
@@ -2179,16 +2180,16 @@ function el({
|
|
|
2179
2180
|
transition: l ? "none" : "transform 250ms cubic-bezier(0.32,0.72,0,1)"
|
|
2180
2181
|
},
|
|
2181
2182
|
children: [
|
|
2182
|
-
/* @__PURE__ */
|
|
2183
|
+
/* @__PURE__ */ d(
|
|
2183
2184
|
"div",
|
|
2184
2185
|
{
|
|
2185
2186
|
className: "cursor-grab touch-none pt-2.5 pb-5 select-none active:cursor-grabbing",
|
|
2186
2187
|
onPointerDown: (m) => {
|
|
2187
|
-
|
|
2188
|
+
u.current = m.clientY, c(!0), m.currentTarget.setPointerCapture(m.pointerId);
|
|
2188
2189
|
},
|
|
2189
2190
|
onPointerMove: (m) => {
|
|
2190
2191
|
if (!l) return;
|
|
2191
|
-
const g = m.clientY -
|
|
2192
|
+
const g = m.clientY - u.current;
|
|
2192
2193
|
i(g > 0 ? g : -Math.sqrt(-g) * 2);
|
|
2193
2194
|
},
|
|
2194
2195
|
onPointerUp: p,
|
|
@@ -2199,9 +2200,9 @@ function el({
|
|
|
2199
2200
|
]
|
|
2200
2201
|
}
|
|
2201
2202
|
),
|
|
2202
|
-
/* @__PURE__ */ n("div", { className:
|
|
2203
|
+
/* @__PURE__ */ n("div", { className: x("grid gap-3", t.length === 3 ? "grid-cols-3" : "grid-cols-2"), children: t.map((m, g) => {
|
|
2203
2204
|
const { icon: f, label: h } = As[m];
|
|
2204
|
-
return /* @__PURE__ */
|
|
2205
|
+
return /* @__PURE__ */ d(
|
|
2205
2206
|
"button",
|
|
2206
2207
|
{
|
|
2207
2208
|
type: "button",
|
|
@@ -2225,16 +2226,16 @@ function el({
|
|
|
2225
2226
|
);
|
|
2226
2227
|
}
|
|
2227
2228
|
function tl() {
|
|
2228
|
-
const { t: e } =
|
|
2229
|
-
return /* @__PURE__ */
|
|
2230
|
-
/* @__PURE__ */ n(Je, { asChild: !0, children: /* @__PURE__ */ n(
|
|
2229
|
+
const { t: e } = k("chat"), t = Bn().status === "starting", s = e("voice_dictate");
|
|
2230
|
+
return /* @__PURE__ */ d(Ye, { children: [
|
|
2231
|
+
/* @__PURE__ */ n(Je, { asChild: !0, children: /* @__PURE__ */ n(pe.Voice, { asChild: !0, children: /* @__PURE__ */ n(Ps, { "aria-label": s, children: t ? /* @__PURE__ */ n(yt, { className: "size-5 animate-spin" }) : /* @__PURE__ */ n(Sr, { className: "size-5" }) }) }) }),
|
|
2231
2232
|
/* @__PURE__ */ n(Ze, { children: s })
|
|
2232
2233
|
] });
|
|
2233
2234
|
}
|
|
2234
2235
|
const nl = Nt(
|
|
2235
|
-
() => import("./VoiceInput-
|
|
2236
|
+
() => import("./VoiceInput-XbeKOMjo.js").then((e) => ({ default: e.VoiceRecordingBar }))
|
|
2236
2237
|
), sl = Nt(
|
|
2237
|
-
() => import("./VoiceInput-
|
|
2238
|
+
() => import("./VoiceInput-XbeKOMjo.js").then((e) => ({ default: e.VoiceRecordingControls }))
|
|
2238
2239
|
);
|
|
2239
2240
|
function rl({
|
|
2240
2241
|
onSend: e,
|
|
@@ -2244,36 +2245,36 @@ function rl({
|
|
|
2244
2245
|
newChat: a,
|
|
2245
2246
|
className: o
|
|
2246
2247
|
}) {
|
|
2247
|
-
const { t: i, i18n: l } =
|
|
2248
|
+
const { t: i, i18n: l } = k(["chat", "maintenance"]), c = Y((w) => w.composer), u = Le(), { ChoiceQuestionDock: p, ComposerFooter: m, composerTools: g } = X(), { blocksChat: f } = Hn(), {
|
|
2248
2249
|
question: h,
|
|
2249
2250
|
disabled: N,
|
|
2250
|
-
dismissed:
|
|
2251
|
+
dismissed: v,
|
|
2251
2252
|
setDismissed: y,
|
|
2252
2253
|
answer: b
|
|
2253
|
-
} = st(), I =
|
|
2254
|
+
} = st(), I = v ? null : h, { typingMessages: _ } = Rs({ enabled: !!a }), z = Qi(a ? _ : []), T = !!a && _.length > 0, P = c?.placeholder ? i(c.placeholder) : i("input_placeholder"), A = f ? i("maintenance:composer_placeholder") : I?.allowCustom !== !1 && I ? i("choice_custom_placeholder") : T ? z : P, M = Qt(), L = t === "streaming" || t === "submitted", j = sa("voice_input", { enabled: !!c?.voice?.enabled }), H = !!c?.voice?.enabled && j === !0, q = u?.attachments, Q = (c?.attachments?.enabled ?? !1) && !!q, Z = O(
|
|
2254
2255
|
() => [...g ?? []].sort((w, R) => (w.order ?? 0) - (R.order ?? 0)),
|
|
2255
2256
|
[g]
|
|
2256
|
-
), { draft:
|
|
2257
|
+
), { draft: J, setDraft: me, isClosed: re } = _t(), he = U(null), F = {
|
|
2257
2258
|
newChat: !!a,
|
|
2258
2259
|
threadId: r,
|
|
2259
2260
|
status: t,
|
|
2260
|
-
disabled:
|
|
2261
|
-
draft:
|
|
2261
|
+
disabled: L || re,
|
|
2262
|
+
draft: J,
|
|
2262
2263
|
send: (w) => {
|
|
2263
|
-
|
|
2264
|
+
L || re || !w.trim() || e({ text: w });
|
|
2264
2265
|
},
|
|
2265
2266
|
setDraft: (w) => {
|
|
2266
|
-
Ga(() =>
|
|
2267
|
-
const R =
|
|
2267
|
+
Ga(() => me(w));
|
|
2268
|
+
const R = he.current;
|
|
2268
2269
|
R && (R.focus(), R.setSelectionRange(w.length, w.length));
|
|
2269
2270
|
}
|
|
2270
2271
|
};
|
|
2271
|
-
return /* @__PURE__ */ n("div", { className:
|
|
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: [
|
|
2272
2273
|
I && /* @__PURE__ */ n(
|
|
2273
2274
|
p,
|
|
2274
2275
|
{
|
|
2275
2276
|
question: I,
|
|
2276
|
-
disabled: N ||
|
|
2277
|
+
disabled: N || L || f,
|
|
2277
2278
|
onDismiss: () => y(!0),
|
|
2278
2279
|
onAnswer: b
|
|
2279
2280
|
}
|
|
@@ -2283,30 +2284,30 @@ function rl({
|
|
|
2283
2284
|
{
|
|
2284
2285
|
className: "relative",
|
|
2285
2286
|
onSend: e,
|
|
2286
|
-
allowFiles:
|
|
2287
|
-
maxVoiceDuration:
|
|
2287
|
+
allowFiles: Q,
|
|
2288
|
+
maxVoiceDuration: c?.voice?.maxDuration,
|
|
2288
2289
|
onFilesRejected: (w) => Hi(w, {
|
|
2289
2290
|
t: i,
|
|
2290
2291
|
language: l.language,
|
|
2291
|
-
maxSize:
|
|
2292
|
+
maxSize: q?.max_size
|
|
2292
2293
|
}),
|
|
2293
2294
|
onVoiceNotice: (w) => Gi(w, i),
|
|
2294
2295
|
children: /* @__PURE__ */ n(
|
|
2295
2296
|
al,
|
|
2296
2297
|
{
|
|
2297
|
-
textareaRef:
|
|
2298
|
-
slotProps:
|
|
2298
|
+
textareaRef: he,
|
|
2299
|
+
slotProps: F,
|
|
2299
2300
|
isErrorVisible: s,
|
|
2300
2301
|
placeholder: A,
|
|
2301
|
-
isMobile:
|
|
2302
|
-
attachEnabled:
|
|
2302
|
+
isMobile: M,
|
|
2303
|
+
attachEnabled: Q,
|
|
2303
2304
|
voiceEnabled: H,
|
|
2304
|
-
tools:
|
|
2305
|
+
tools: Z
|
|
2305
2306
|
}
|
|
2306
2307
|
)
|
|
2307
2308
|
}
|
|
2308
2309
|
) }),
|
|
2309
|
-
m && /* @__PURE__ */ n(ge, { fallback: null, resetKeys: [r], children: /* @__PURE__ */ n(m, { ...
|
|
2310
|
+
m && /* @__PURE__ */ n(ge, { fallback: null, resetKeys: [r], children: /* @__PURE__ */ n(m, { ...F }) })
|
|
2310
2311
|
] }) });
|
|
2311
2312
|
}
|
|
2312
2313
|
function al({
|
|
@@ -2319,29 +2320,29 @@ function al({
|
|
|
2319
2320
|
voiceEnabled: i,
|
|
2320
2321
|
tools: l
|
|
2321
2322
|
}) {
|
|
2322
|
-
const { t:
|
|
2323
|
+
const { t: c, i18n: u } = k(["chat"]), p = Y((A) => A.composer?.maxLength), { draft: m, files: g, references: f, isBusy: h } = _t(), { addFiles: N, dragging: v } = ra(), y = Bn(), { threadId: b, status: I } = t, _ = !!p && m.length >= p * 0.9;
|
|
2323
2324
|
D(() => {
|
|
2324
2325
|
a || e.current?.focus();
|
|
2325
2326
|
}, [b, a, e]);
|
|
2326
|
-
const
|
|
2327
|
+
const z = f.length, T = U(z);
|
|
2327
2328
|
D(() => {
|
|
2328
|
-
|
|
2329
|
-
}, [
|
|
2329
|
+
z > T.current && !a && e.current?.focus(), T.current = z;
|
|
2330
|
+
}, [z, a, e]);
|
|
2330
2331
|
const P = { ...t, isMobile: a, addFiles: N };
|
|
2331
|
-
return /* @__PURE__ */
|
|
2332
|
-
|
|
2332
|
+
return /* @__PURE__ */ d($, { children: [
|
|
2333
|
+
v && /* @__PURE__ */ n(
|
|
2333
2334
|
"div",
|
|
2334
2335
|
{
|
|
2335
2336
|
className: "pointer-events-none absolute inset-0 z-20 flex items-center justify-center rounded-lg border-2 border-dashed border-primary bg-background/90 text-sm font-medium text-foreground",
|
|
2336
2337
|
"aria-hidden": !0,
|
|
2337
|
-
children:
|
|
2338
|
+
children: c("drop_files")
|
|
2338
2339
|
}
|
|
2339
2340
|
),
|
|
2340
2341
|
o && !y.active && // Matches the toolbar's bottom padding, so the + lines up with the send button.
|
|
2341
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(Ji, { ...P }) }) }),
|
|
2342
|
-
/* @__PURE__ */
|
|
2343
|
-
f.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 px-2 pt-2", children: /* @__PURE__ */ n(
|
|
2344
|
-
g.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 px-2 pt-2", children: /* @__PURE__ */ n(
|
|
2343
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col flex-1 gap-2", children: [
|
|
2344
|
+
f.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 px-2 pt-2", children: /* @__PURE__ */ n(pe.References, { component: Ui }) }),
|
|
2345
|
+
g.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 px-2 pt-2", children: /* @__PURE__ */ n(pe.Attachments, { component: ji }) }),
|
|
2345
2346
|
y.active ? /* @__PURE__ */ n(Ve, { fallback: null, children: /* @__PURE__ */ n(nl, {}) }) : /* @__PURE__ */ n(
|
|
2346
2347
|
Ei,
|
|
2347
2348
|
{
|
|
@@ -2349,47 +2350,47 @@ function al({
|
|
|
2349
2350
|
autoFocus: !a,
|
|
2350
2351
|
placeholder: r,
|
|
2351
2352
|
maxLength: p,
|
|
2352
|
-
"aria-label":
|
|
2353
|
+
"aria-label": c("input_placeholder")
|
|
2353
2354
|
}
|
|
2354
2355
|
)
|
|
2355
2356
|
] }),
|
|
2356
|
-
/* @__PURE__ */ n(Li, { children: y.active ? /* @__PURE__ */ n(Ve, { fallback: null, children: /* @__PURE__ */ n(sl, {}) }) : /* @__PURE__ */
|
|
2357
|
-
|
|
2357
|
+
/* @__PURE__ */ n(Li, { children: y.active ? /* @__PURE__ */ n(Ve, { fallback: null, children: /* @__PURE__ */ n(sl, {}) }) : /* @__PURE__ */ d($, { children: [
|
|
2358
|
+
_ && /* @__PURE__ */ d(
|
|
2358
2359
|
"span",
|
|
2359
2360
|
{
|
|
2360
|
-
className:
|
|
2361
|
+
className: x(
|
|
2361
2362
|
"px-1 text-xs tabular-nums text-muted-foreground",
|
|
2362
2363
|
m.length >= p && "text-destructive"
|
|
2363
2364
|
),
|
|
2364
2365
|
"aria-live": "polite",
|
|
2365
2366
|
children: [
|
|
2366
|
-
m.length.toLocaleString(
|
|
2367
|
+
m.length.toLocaleString(u.language),
|
|
2367
2368
|
"/",
|
|
2368
|
-
p.toLocaleString(
|
|
2369
|
+
p.toLocaleString(u.language)
|
|
2369
2370
|
]
|
|
2370
2371
|
}
|
|
2371
2372
|
),
|
|
2372
|
-
/* @__PURE__ */
|
|
2373
|
-
l.map(({ id: A, component:
|
|
2373
|
+
/* @__PURE__ */ d(qi, { children: [
|
|
2374
|
+
l.map(({ id: A, component: M }) => (
|
|
2374
2375
|
// Contained so a throwing tool can't take the composer or the other tools with it.
|
|
2375
|
-
/* @__PURE__ */ n(ge, { fallback: null, resetKeys: [b], children: /* @__PURE__ */ n(
|
|
2376
|
+
/* @__PURE__ */ n(ge, { fallback: null, resetKeys: [b], children: /* @__PURE__ */ n(M, { ...P }) }, A)
|
|
2376
2377
|
)),
|
|
2377
2378
|
i && /* @__PURE__ */ n(tl, {})
|
|
2378
2379
|
] }),
|
|
2379
|
-
h ? /* @__PURE__ */ n(
|
|
2380
|
+
h ? /* @__PURE__ */ n(pe.Stop, { asChild: !0, children: /* @__PURE__ */ n(hn, { status: I === "submitted" ? "submitted" : "streaming" }) }) : /* @__PURE__ */ n(pe.Send, { asChild: !0, children: /* @__PURE__ */ n(hn, { status: s ? "error" : "ready" }) })
|
|
2380
2381
|
] }) })
|
|
2381
2382
|
] });
|
|
2382
2383
|
}
|
|
2383
2384
|
const ol = (e) => {
|
|
2384
2385
|
const { title: t, subtitle: s, isRtl: r, icon: a } = Rs();
|
|
2385
|
-
return /* @__PURE__ */
|
|
2386
|
+
return /* @__PURE__ */ d(
|
|
2386
2387
|
"div",
|
|
2387
2388
|
{
|
|
2388
2389
|
dir: r ? "rtl" : "ltr",
|
|
2389
2390
|
className: "flex flex-col items-center text-center px-6 animate-in fade-in duration-700 ease-out",
|
|
2390
2391
|
children: [
|
|
2391
2392
|
a && /* @__PURE__ */ n("div", { className: "mb-8 flex items-center justify-center", children: /* @__PURE__ */ n("div", { className: "size-12 md:size-16 rounded-2xl bg-secondary flex items-center justify-center border border-border/60", children: typeof a == "function" ? /* @__PURE__ */ n(a, { className: "size-6 md:size-8 text-primary opacity-80" }) : a }) }),
|
|
2392
|
-
(t || s) && /* @__PURE__ */
|
|
2393
|
+
(t || s) && /* @__PURE__ */ d("div", { className: "space-y-3 max-w-xl mx-auto", children: [
|
|
2393
2394
|
t && /* @__PURE__ */ n("h1", { className: "text-3xl md:text-4xl font-normal tracking-tight leading-tight text-foreground", children: t }),
|
|
2394
2395
|
s && /* @__PURE__ */ n("p", { className: "text-muted-foreground text-base md:text-lg font-normal max-w-md mx-auto leading-relaxed opacity-85 dark:opacity-70", children: s })
|
|
2395
2396
|
] })
|
|
@@ -2404,18 +2405,18 @@ function il({
|
|
|
2404
2405
|
onAnswer: r,
|
|
2405
2406
|
className: a
|
|
2406
2407
|
}) {
|
|
2407
|
-
const { t: o } =
|
|
2408
|
+
const { t: o } = k(["chat"]), { dir: i } = V(), { reportDockHeight: l } = st(), c = U(null), [u, p] = C(null);
|
|
2408
2409
|
D(() => {
|
|
2409
|
-
const h =
|
|
2410
|
+
const h = c.current;
|
|
2410
2411
|
if (!h) return;
|
|
2411
2412
|
const N = () => l(h.offsetHeight);
|
|
2412
2413
|
N();
|
|
2413
|
-
const
|
|
2414
|
-
return
|
|
2415
|
-
|
|
2414
|
+
const v = typeof ResizeObserver > "u" ? null : new ResizeObserver(N);
|
|
2415
|
+
return v?.observe(h), () => {
|
|
2416
|
+
v?.disconnect(), l(0);
|
|
2416
2417
|
};
|
|
2417
2418
|
}, [l]);
|
|
2418
|
-
const m = oe(e.question, i), g = t || !r ||
|
|
2419
|
+
const m = oe(e.question, i), g = t || !r || u !== null, f = async (h) => {
|
|
2419
2420
|
if (!g) {
|
|
2420
2421
|
p(h);
|
|
2421
2422
|
try {
|
|
@@ -2425,19 +2426,19 @@ function il({
|
|
|
2425
2426
|
}
|
|
2426
2427
|
}
|
|
2427
2428
|
};
|
|
2428
|
-
return /* @__PURE__ */
|
|
2429
|
+
return /* @__PURE__ */ d(
|
|
2429
2430
|
"div",
|
|
2430
2431
|
{
|
|
2431
|
-
ref:
|
|
2432
|
+
ref: c,
|
|
2432
2433
|
dir: m,
|
|
2433
|
-
className:
|
|
2434
|
+
className: x(
|
|
2434
2435
|
// `-mb-3` slides the bottom edge under the composer, which paints over
|
|
2435
2436
|
// it (see the `z-10` wrapper there) so the joint reads as one surface.
|
|
2436
2437
|
"animate-choice-dock relative z-0 -mb-3 rounded-t-lg bg-surface px-2 pb-6 pt-4",
|
|
2437
2438
|
a
|
|
2438
2439
|
),
|
|
2439
2440
|
children: [
|
|
2440
|
-
/* @__PURE__ */
|
|
2441
|
+
/* @__PURE__ */ d("div", { className: "flex items-start gap-2 px-3", children: [
|
|
2441
2442
|
/* @__PURE__ */ n("p", { className: "min-w-0 flex-1 text-base leading-snug text-foreground", children: e.question }),
|
|
2442
2443
|
s && /* @__PURE__ */ n(
|
|
2443
2444
|
"button",
|
|
@@ -2455,7 +2456,7 @@ function il({
|
|
|
2455
2456
|
zs,
|
|
2456
2457
|
{
|
|
2457
2458
|
choices: e.choices,
|
|
2458
|
-
selected:
|
|
2459
|
+
selected: u,
|
|
2459
2460
|
disabled: g,
|
|
2460
2461
|
dir: m,
|
|
2461
2462
|
onSelect: (h) => {
|
|
@@ -2469,7 +2470,7 @@ function il({
|
|
|
2469
2470
|
);
|
|
2470
2471
|
}
|
|
2471
2472
|
function ll({ className: e, children: t, ...s }) {
|
|
2472
|
-
return /* @__PURE__ */
|
|
2473
|
+
return /* @__PURE__ */ d(Me.Root, { "data-slot": "scroll-area", className: x("relative", e), ...s, children: [
|
|
2473
2474
|
/* @__PURE__ */ n(
|
|
2474
2475
|
Me.Viewport,
|
|
2475
2476
|
{
|
|
@@ -2492,7 +2493,7 @@ function Ds({
|
|
|
2492
2493
|
{
|
|
2493
2494
|
"data-slot": "scroll-area-scrollbar",
|
|
2494
2495
|
orientation: t,
|
|
2495
|
-
className:
|
|
2496
|
+
className: x(
|
|
2496
2497
|
"flex touch-none p-px transition-colors select-none",
|
|
2497
2498
|
t === "vertical" && "h-full w-2.5 border-s border-s-transparent",
|
|
2498
2499
|
t === "horizontal" && "h-2.5 flex-col border-t border-t-transparent",
|
|
@@ -2510,9 +2511,9 @@ function Ds({
|
|
|
2510
2511
|
);
|
|
2511
2512
|
}
|
|
2512
2513
|
const cl = ({ className: e, children: t, ...s }) => {
|
|
2513
|
-
const { dir: r } =
|
|
2514
|
-
return /* @__PURE__ */
|
|
2515
|
-
/* @__PURE__ */ n("div", { className:
|
|
2514
|
+
const { dir: r } = V();
|
|
2515
|
+
return /* @__PURE__ */ d(ll, { className: "w-full overflow-x-auto whitespace-nowrap", dir: r, ...s, children: [
|
|
2516
|
+
/* @__PURE__ */ n("div", { className: x("flex w-max flex-nowrap items-center gap-2", e), children: t }),
|
|
2516
2517
|
/* @__PURE__ */ n(Ds, { className: "hidden", orientation: "horizontal" })
|
|
2517
2518
|
] });
|
|
2518
2519
|
}, dl = ({
|
|
@@ -2530,7 +2531,7 @@ const cl = ({ className: e, children: t, ...s }) => {
|
|
|
2530
2531
|
return /* @__PURE__ */ n(
|
|
2531
2532
|
E,
|
|
2532
2533
|
{
|
|
2533
|
-
className:
|
|
2534
|
+
className: x("cursor-pointer rounded-full px-4", s),
|
|
2534
2535
|
onClick: l,
|
|
2535
2536
|
size: a,
|
|
2536
2537
|
type: "button",
|
|
@@ -2546,47 +2547,47 @@ function ul({
|
|
|
2546
2547
|
onSelect: s,
|
|
2547
2548
|
className: r
|
|
2548
2549
|
}) {
|
|
2549
|
-
const { t: a } =
|
|
2550
|
+
const { t: a } = k("chat"), [o, i] = C(!1), l = async (c) => {
|
|
2550
2551
|
if (!(t || o || !s)) {
|
|
2551
2552
|
i(!0);
|
|
2552
2553
|
try {
|
|
2553
|
-
await s(
|
|
2554
|
+
await s(c);
|
|
2554
2555
|
} catch {
|
|
2555
2556
|
i(!1);
|
|
2556
2557
|
}
|
|
2557
2558
|
}
|
|
2558
2559
|
};
|
|
2559
|
-
return /* @__PURE__ */ n("div", { className:
|
|
2560
|
+
return /* @__PURE__ */ n("div", { className: x("mx-auto w-full max-w-4xl py-2", r), children: /* @__PURE__ */ n(cl, { className: "pb-1", "aria-label": a("follow_up_suggestions"), children: e.map((c) => /* @__PURE__ */ n(
|
|
2560
2561
|
dl,
|
|
2561
2562
|
{
|
|
2562
|
-
suggestion:
|
|
2563
|
-
onClick: (
|
|
2564
|
-
l(
|
|
2563
|
+
suggestion: c,
|
|
2564
|
+
onClick: (u) => {
|
|
2565
|
+
l(u);
|
|
2565
2566
|
},
|
|
2566
2567
|
disabled: t || o || !s,
|
|
2567
|
-
dir: oe(
|
|
2568
|
+
dir: oe(c),
|
|
2568
2569
|
className: "max-w-[min(32rem,80vw)] shrink-0"
|
|
2569
2570
|
},
|
|
2570
|
-
|
|
2571
|
+
c
|
|
2571
2572
|
)) }) });
|
|
2572
2573
|
}
|
|
2573
2574
|
function ml({ error: e, code: t }) {
|
|
2574
|
-
const { t: s, i18n: r } =
|
|
2575
|
-
return /* @__PURE__ */
|
|
2575
|
+
const { t: s, i18n: r } = k(["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
|
+
return /* @__PURE__ */ d(
|
|
2576
2577
|
"div",
|
|
2577
2578
|
{
|
|
2578
2579
|
className: "flex flex-col w-full gap-2 px-4 py-3.5 rounded-xl bg-destructive/8 border border-destructive/15 border-s-2 border-s-destructive/60",
|
|
2579
2580
|
dir: o ? "rtl" : "ltr",
|
|
2580
2581
|
children: [
|
|
2581
|
-
/* @__PURE__ */
|
|
2582
|
+
/* @__PURE__ */ d("div", { className: "flex w-full items-start gap-3", children: [
|
|
2582
2583
|
/* @__PURE__ */ n("div", { className: "size-1.5 rounded-full bg-destructive mt-2 shrink-0" }),
|
|
2583
|
-
/* @__PURE__ */
|
|
2584
|
+
/* @__PURE__ */ d("div", { className: "text-sm text-destructive/90 leading-relaxed flex-1 text-start", children: [
|
|
2584
2585
|
/* @__PURE__ */ n("span", { className: "font-semibold", children: s("error") }),
|
|
2585
2586
|
" ",
|
|
2586
2587
|
e.message
|
|
2587
2588
|
] })
|
|
2588
2589
|
] }),
|
|
2589
|
-
l && /* @__PURE__ */
|
|
2590
|
+
l && /* @__PURE__ */ d("div", { className: "mt-1 ps-4.5 pt-2 border-t border-destructive/10 text-xs text-muted-foreground flex flex-wrap gap-x-4 gap-y-1", children: [
|
|
2590
2591
|
typeof i.limit == "number" && /* @__PURE__ */ n("span", { children: s("quota:left", {
|
|
2591
2592
|
amount: Math.max(0, i.limit - (i.used ?? i.limit)),
|
|
2592
2593
|
total: i.limit
|
|
@@ -2621,7 +2622,7 @@ function fl({
|
|
|
2621
2622
|
"data-slot": "hover-card-content",
|
|
2622
2623
|
align: t,
|
|
2623
2624
|
sideOffset: s,
|
|
2624
|
-
className:
|
|
2625
|
+
className: x(
|
|
2625
2626
|
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-64 origin-(--radix-hover-card-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
|
|
2626
2627
|
e
|
|
2627
2628
|
),
|
|
@@ -2630,23 +2631,23 @@ function fl({
|
|
|
2630
2631
|
) });
|
|
2631
2632
|
}
|
|
2632
2633
|
function xn({ label: e, remaining: t, amount: s }) {
|
|
2633
|
-
const { t: r, i18n: a } =
|
|
2634
|
-
return /* @__PURE__ */
|
|
2635
|
-
/* @__PURE__ */
|
|
2634
|
+
const { t: r, i18n: a } = k(["quota"]), o = Lt(t, s);
|
|
2635
|
+
return /* @__PURE__ */ d("div", { className: "space-y-1", children: [
|
|
2636
|
+
/* @__PURE__ */ d("div", { className: "flex items-baseline justify-between gap-3", children: [
|
|
2636
2637
|
/* @__PURE__ */ n("span", { className: "truncate text-foreground/80", children: e }),
|
|
2637
2638
|
/* @__PURE__ */ n("span", { className: "shrink-0 tabular-nums font-medium text-foreground", children: r("quota:percent_left", { percent: Zn(o, a.language) }) })
|
|
2638
2639
|
] }),
|
|
2639
2640
|
/* @__PURE__ */ n("div", { className: "h-1 w-full rounded-full bg-muted overflow-hidden", children: /* @__PURE__ */ n(
|
|
2640
2641
|
"div",
|
|
2641
2642
|
{
|
|
2642
|
-
className:
|
|
2643
|
+
className: x("h-full rounded-full transition-all duration-700", Dt(o)),
|
|
2643
2644
|
style: { width: `${o}%` }
|
|
2644
2645
|
}
|
|
2645
2646
|
) })
|
|
2646
2647
|
] });
|
|
2647
2648
|
}
|
|
2648
2649
|
function gl({ className: e, details: t = !0 }) {
|
|
2649
|
-
const { t: s, i18n: r } =
|
|
2650
|
+
const { t: s, i18n: r } = k(["quota"]), { data: a } = St(), [o, i] = C(!1), l = a?.kind === "plan" ? pa(a.windows) : null, c = l ? {
|
|
2650
2651
|
remaining: l.remaining,
|
|
2651
2652
|
amount: l.amount,
|
|
2652
2653
|
label: `${Et(s, l.meter)} ${ut(s, l)}`
|
|
@@ -2655,16 +2656,16 @@ function gl({ className: e, details: t = !0 }) {
|
|
|
2655
2656
|
amount: a.credits.granted,
|
|
2656
2657
|
label: s("quota:credits")
|
|
2657
2658
|
} : null;
|
|
2658
|
-
if (!a || !
|
|
2659
|
-
const { remaining:
|
|
2659
|
+
if (!a || !c) return null;
|
|
2660
|
+
const { remaining: u, amount: p, label: m } = c, g = Lt(u, p), f = a.kind === "credits" ? s("quota:credits") : a.plan?.name ?? s("quota:plan"), h = Zn(g, r.language), N = u <= 0, v = x(
|
|
2660
2661
|
"flex items-center gap-2 h-8 ps-2.5 pe-3 rounded-full border text-xs font-medium tabular-nums transition-colors",
|
|
2661
2662
|
N ? "border-destructive/40 bg-destructive/10 text-destructive" : "border-border/60 bg-background/40 text-muted-foreground",
|
|
2662
2663
|
e
|
|
2663
|
-
), y = /* @__PURE__ */
|
|
2664
|
+
), y = /* @__PURE__ */ d($, { children: [
|
|
2664
2665
|
/* @__PURE__ */ n(
|
|
2665
2666
|
"span",
|
|
2666
2667
|
{
|
|
2667
|
-
className:
|
|
2668
|
+
className: x(
|
|
2668
2669
|
"block h-2 w-8 md:w-12 rounded-full border overflow-hidden bg-muted/40 transition-colors duration-700",
|
|
2669
2670
|
fa(g)
|
|
2670
2671
|
),
|
|
@@ -2672,11 +2673,11 @@ function gl({ className: e, details: t = !0 }) {
|
|
|
2672
2673
|
"aria-label": s("quota:usage_label", { label: m, percent: h }),
|
|
2673
2674
|
"aria-valuemin": 0,
|
|
2674
2675
|
"aria-valuemax": p,
|
|
2675
|
-
"aria-valuenow":
|
|
2676
|
+
"aria-valuenow": u,
|
|
2676
2677
|
children: /* @__PURE__ */ n(
|
|
2677
2678
|
"span",
|
|
2678
2679
|
{
|
|
2679
|
-
className:
|
|
2680
|
+
className: x("block h-full transition-all duration-700", Dt(g)),
|
|
2680
2681
|
style: { width: `${g}%` }
|
|
2681
2682
|
}
|
|
2682
2683
|
)
|
|
@@ -2684,21 +2685,21 @@ function gl({ className: e, details: t = !0 }) {
|
|
|
2684
2685
|
),
|
|
2685
2686
|
/* @__PURE__ */ n("span", { "aria-hidden": !0, children: h })
|
|
2686
2687
|
] });
|
|
2687
|
-
return t ? /* @__PURE__ */
|
|
2688
|
+
return t ? /* @__PURE__ */ d(hl, { open: o, onOpenChange: i, openDelay: 150, closeDelay: 100, children: [
|
|
2688
2689
|
/* @__PURE__ */ n(pl, { asChild: !0, children: /* @__PURE__ */ n(
|
|
2689
2690
|
"button",
|
|
2690
2691
|
{
|
|
2691
2692
|
type: "button",
|
|
2692
2693
|
onClick: () => i((b) => !b),
|
|
2693
|
-
className:
|
|
2694
|
-
|
|
2694
|
+
className: x(
|
|
2695
|
+
v,
|
|
2695
2696
|
N ? "hover:bg-destructive/15" : "hover:bg-accent/60 hover:text-foreground"
|
|
2696
2697
|
),
|
|
2697
2698
|
children: y
|
|
2698
2699
|
}
|
|
2699
2700
|
) }),
|
|
2700
|
-
/* @__PURE__ */
|
|
2701
|
-
/* @__PURE__ */
|
|
2701
|
+
/* @__PURE__ */ d(fl, { align: "end", sideOffset: 6, className: "w-64 p-3 text-xs space-y-3", children: [
|
|
2702
|
+
/* @__PURE__ */ d("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
2702
2703
|
/* @__PURE__ */ n("span", { className: "font-semibold text-foreground truncate", children: f }),
|
|
2703
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) }) })
|
|
2704
2705
|
] }),
|
|
@@ -2712,24 +2713,24 @@ function gl({ className: e, details: t = !0 }) {
|
|
|
2712
2713
|
b.key
|
|
2713
2714
|
)) : a.credits && /* @__PURE__ */ n(xn, { amount: a.credits.granted, remaining: a.credits.remaining })
|
|
2714
2715
|
] })
|
|
2715
|
-
] }) : /* @__PURE__ */ n("div", { className:
|
|
2716
|
+
] }) : /* @__PURE__ */ n("div", { className: v, children: y });
|
|
2716
2717
|
}
|
|
2717
2718
|
function bl({ title: e, message: t, endsAt: s }) {
|
|
2718
|
-
const { t: r } =
|
|
2719
|
+
const { t: r } = k(["maintenance"]);
|
|
2719
2720
|
return /* @__PURE__ */ n(
|
|
2720
2721
|
"div",
|
|
2721
2722
|
{
|
|
2722
2723
|
role: "status",
|
|
2723
2724
|
"aria-live": "polite",
|
|
2724
|
-
dir:
|
|
2725
|
+
dir: V().dir,
|
|
2725
2726
|
className: "shrink-0 border-b border-warning/30 bg-warning/10 px-4 py-2.5",
|
|
2726
|
-
children: /* @__PURE__ */
|
|
2727
|
+
children: /* @__PURE__ */ d("div", { className: "mx-auto flex max-w-[50rem] items-start gap-2.5", children: [
|
|
2727
2728
|
/* @__PURE__ */ n(Mn, { className: "mt-0.5 size-4 shrink-0 text-warning" }),
|
|
2728
|
-
/* @__PURE__ */
|
|
2729
|
+
/* @__PURE__ */ d("p", { className: "min-w-0 flex-1 text-sm leading-relaxed text-warning", children: [
|
|
2729
2730
|
/* @__PURE__ */ n("span", { className: "font-semibold", children: e }),
|
|
2730
2731
|
/* @__PURE__ */ n("span", { "aria-hidden": !0, className: "mx-1.5 opacity-50", children: "·" }),
|
|
2731
2732
|
/* @__PURE__ */ n("span", { children: t }),
|
|
2732
|
-
s && /* @__PURE__ */
|
|
2733
|
+
s && /* @__PURE__ */ d("span", { className: "text-warning/80", children: [
|
|
2733
2734
|
" ",
|
|
2734
2735
|
r("maintenance:until", { datetime: s })
|
|
2735
2736
|
] })
|
|
@@ -2739,20 +2740,20 @@ function bl({ title: e, message: t, endsAt: s }) {
|
|
|
2739
2740
|
);
|
|
2740
2741
|
}
|
|
2741
2742
|
function xl({ title: e, message: t, endsAt: s, refresh: r }) {
|
|
2742
|
-
const { t: a } =
|
|
2743
|
+
const { t: a } = k(["maintenance"]);
|
|
2743
2744
|
return /* @__PURE__ */ n(
|
|
2744
2745
|
"div",
|
|
2745
2746
|
{
|
|
2746
2747
|
role: "status",
|
|
2747
2748
|
"aria-live": "polite",
|
|
2748
|
-
dir:
|
|
2749
|
+
dir: V().dir,
|
|
2749
2750
|
className: "flex min-h-dvh w-full flex-1 items-center justify-center bg-background px-6",
|
|
2750
|
-
children: /* @__PURE__ */
|
|
2751
|
+
children: /* @__PURE__ */ d("div", { className: "flex max-w-md flex-col items-center gap-4 text-center", children: [
|
|
2751
2752
|
/* @__PURE__ */ n("div", { className: "flex size-14 items-center justify-center rounded-2xl border border-warning/30 bg-warning/10", children: /* @__PURE__ */ n(Mn, { className: "size-6 text-warning" }) }),
|
|
2752
2753
|
/* @__PURE__ */ n("h1", { className: "text-xl font-semibold text-foreground", children: e }),
|
|
2753
2754
|
/* @__PURE__ */ n("p", { className: "text-sm leading-relaxed text-muted-foreground", children: t }),
|
|
2754
2755
|
s && /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground/80", children: a("maintenance:until", { datetime: s }) }),
|
|
2755
|
-
/* @__PURE__ */
|
|
2756
|
+
/* @__PURE__ */ d(E, { variant: "outline", size: "sm", onClick: r, className: "mt-2 gap-2", children: [
|
|
2756
2757
|
/* @__PURE__ */ n(Cr, { className: "size-3.5" }),
|
|
2757
2758
|
a("maintenance:retry")
|
|
2758
2759
|
] })
|
|
@@ -2785,24 +2786,24 @@ function wl({
|
|
|
2785
2786
|
index: t,
|
|
2786
2787
|
children: s
|
|
2787
2788
|
}) {
|
|
2788
|
-
const r =
|
|
2789
|
+
const r = W((l) => l.message), { referenceAdapters: a } = X(), o = { messageId: r.id, partIndex: t, role: r.role, data: e };
|
|
2789
2790
|
let i;
|
|
2790
2791
|
if (tt(e)) {
|
|
2791
|
-
const l = et(e),
|
|
2792
|
+
const l = et(e), c = {
|
|
2792
2793
|
...o,
|
|
2793
2794
|
kind: "tool",
|
|
2794
2795
|
sourceId: `${r.id}-${t}-tool`,
|
|
2795
2796
|
label: l,
|
|
2796
2797
|
excerpt: vl(e)
|
|
2797
|
-
},
|
|
2798
|
+
}, u = a?.[l]?.({ part: e, message: r, toolName: l }) || {};
|
|
2798
2799
|
i = {
|
|
2800
|
+
...c,
|
|
2799
2801
|
...u,
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
kind: d.kind || u.kind
|
|
2802
|
+
sourceId: u.sourceId || c.sourceId,
|
|
2803
|
+
messageId: u.messageId || c.messageId,
|
|
2804
|
+
partIndex: u.partIndex ?? c.partIndex,
|
|
2805
|
+
role: u.role || c.role,
|
|
2806
|
+
kind: u.kind || c.kind
|
|
2806
2807
|
};
|
|
2807
2808
|
} else if (e.type === "file")
|
|
2808
2809
|
i = {
|
|
@@ -2856,9 +2857,9 @@ function Kt({
|
|
|
2856
2857
|
disclaimer: i,
|
|
2857
2858
|
settings: l
|
|
2858
2859
|
}) {
|
|
2859
|
-
const
|
|
2860
|
+
const c = Se(mt) ?? kl, u = jn(c, (v) => v.configured), p = X(), m = Le(), g = O(
|
|
2860
2861
|
() => Ft(
|
|
2861
|
-
Ka(
|
|
2862
|
+
Ka(u, {
|
|
2862
2863
|
history: s,
|
|
2863
2864
|
welcome: r,
|
|
2864
2865
|
threadActions: a,
|
|
@@ -2868,7 +2869,7 @@ function Kt({
|
|
|
2868
2869
|
}),
|
|
2869
2870
|
m
|
|
2870
2871
|
),
|
|
2871
|
-
[
|
|
2872
|
+
[u, m, s, r, a, o, i, l]
|
|
2872
2873
|
), [f] = C(() => kt(g));
|
|
2873
2874
|
qn(() => f.setState(g), [f, g]);
|
|
2874
2875
|
const h = O(() => ga(p, e), [p, e]), N = O(() => Os(h.parts), [h.parts]);
|
|
@@ -2879,7 +2880,7 @@ const _l = {
|
|
|
2879
2880
|
left: "calc(var(--gentiq-selection-left) + var(--gentiq-selection-width) / 2)"
|
|
2880
2881
|
};
|
|
2881
2882
|
function Sl() {
|
|
2882
|
-
const { t: e } =
|
|
2883
|
+
const { t: e } = k(["chat"]), t = Jn();
|
|
2883
2884
|
return t ? Wa(
|
|
2884
2885
|
/* @__PURE__ */ n(
|
|
2885
2886
|
Ae.SelectionQuote,
|
|
@@ -2912,21 +2913,21 @@ function zl({
|
|
|
2912
2913
|
}
|
|
2913
2914
|
return a;
|
|
2914
2915
|
}
|
|
2915
|
-
const
|
|
2916
|
-
const { resolvedTheme: i, accent: l, radius:
|
|
2917
|
-
return /* @__PURE__ */
|
|
2916
|
+
const ue = $n(function({ className: t, style: s, children: r, ...a }, o) {
|
|
2917
|
+
const { resolvedTheme: i, accent: l, radius: c } = Ce(), { language: u, dir: p } = V(), m = K((N) => N.theme.typography?.fontFamily), g = K((N) => N.theme.userBubbleAccent), [f, h] = C(null);
|
|
2918
|
+
return /* @__PURE__ */ d(
|
|
2918
2919
|
"div",
|
|
2919
2920
|
{
|
|
2920
2921
|
ref: o,
|
|
2921
2922
|
...a,
|
|
2922
|
-
className:
|
|
2923
|
-
lang:
|
|
2923
|
+
className: x("gentiq", i, t),
|
|
2924
|
+
lang: u,
|
|
2924
2925
|
dir: p,
|
|
2925
2926
|
style: {
|
|
2926
2927
|
...zl({
|
|
2927
2928
|
accent: l,
|
|
2928
|
-
radius:
|
|
2929
|
-
fontFamily: Cl(m,
|
|
2929
|
+
radius: c,
|
|
2930
|
+
fontFamily: Cl(m, u),
|
|
2930
2931
|
userBubbleAccent: g
|
|
2931
2932
|
}),
|
|
2932
2933
|
...s
|
|
@@ -2939,79 +2940,106 @@ const de = $n(function({ className: t, style: s, children: r, ...a }, o) {
|
|
|
2939
2940
|
);
|
|
2940
2941
|
});
|
|
2941
2942
|
function Il({ classNames: e = {} }) {
|
|
2942
|
-
const { t, i18n: s } =
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2943
|
+
const { t, i18n: s } = k(["chat"]), { threadId: r, messages: a, status: o, send: i, addToolOutput: l } = aa(), c = r === null && a.length === 0 && o !== "submitted", [u, p] = C({
|
|
2944
|
+
wasNew: c,
|
|
2945
|
+
threadId: r,
|
|
2946
|
+
reveal: !1,
|
|
2947
|
+
sent: !1
|
|
2948
|
+
}), m = de(
|
|
2949
|
+
(q) => (c && p((Q) => Q.sent ? Q : { ...Q, sent: !0 }), i(q)),
|
|
2950
|
+
[c, i]
|
|
2951
|
+
), g = de((q) => {
|
|
2952
|
+
m({ text: q });
|
|
2953
|
+
}, [m]), { MessageList: f, 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, _ = 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 ? p({
|
|
2955
|
+
wasNew: c,
|
|
2956
|
+
threadId: r,
|
|
2957
|
+
reveal: u.wasNew && !c && !u.sent && o !== "submitted",
|
|
2958
|
+
sent: !1
|
|
2959
|
+
}) : u.reveal && o === "submitted" && p((q) => ({ ...q, reveal: !1 }));
|
|
2960
|
+
const A = u.reveal, M = O(() => Ee(h), [h]), [L, j] = Qa(), H = O(
|
|
2961
|
+
() => j ? { "--gentiq-composer-inset": `${j}px` } : void 0,
|
|
2962
|
+
[j]
|
|
2947
2963
|
);
|
|
2948
|
-
return /* @__PURE__ */
|
|
2964
|
+
return /* @__PURE__ */ d(
|
|
2949
2965
|
Ae.Root,
|
|
2950
2966
|
{
|
|
2951
|
-
enabled:
|
|
2952
|
-
maxItems:
|
|
2953
|
-
maxExcerptLength:
|
|
2967
|
+
enabled: v?.references?.enabled ?? !0,
|
|
2968
|
+
maxItems: v?.references?.maxItems,
|
|
2969
|
+
maxExcerptLength: v?.references?.maxExcerptLength,
|
|
2954
2970
|
children: [
|
|
2955
2971
|
/* @__PURE__ */ n(
|
|
2956
2972
|
fi,
|
|
2957
2973
|
{
|
|
2958
|
-
message:
|
|
2959
|
-
disabled: !
|
|
2960
|
-
cacheNamespace:
|
|
2974
|
+
message: z,
|
|
2975
|
+
disabled: !T || o !== "ready",
|
|
2976
|
+
cacheNamespace: b.cacheNamespace,
|
|
2961
2977
|
onAnswer: l,
|
|
2962
|
-
children: /* @__PURE__ */
|
|
2978
|
+
children: /* @__PURE__ */ d(
|
|
2963
2979
|
De.Root,
|
|
2964
2980
|
{
|
|
2965
|
-
className:
|
|
2981
|
+
className: x(
|
|
2966
2982
|
"relative flex flex-col h-full overflow-hidden bg-background",
|
|
2967
2983
|
e.container
|
|
2968
2984
|
),
|
|
2969
|
-
style:
|
|
2985
|
+
style: H,
|
|
2970
2986
|
children: [
|
|
2971
2987
|
/* @__PURE__ */ n(
|
|
2972
2988
|
"div",
|
|
2973
2989
|
{
|
|
2974
2990
|
"aria-hidden": !0,
|
|
2975
|
-
className:
|
|
2991
|
+
className: x(
|
|
2976
2992
|
"gentiq-welcome-glow pointer-events-none absolute inset-0 transition-opacity duration-500",
|
|
2977
|
-
|
|
2993
|
+
b.showWelcomeGlow !== !1 && c ? "opacity-100" : "opacity-0"
|
|
2978
2994
|
)
|
|
2979
2995
|
}
|
|
2980
2996
|
),
|
|
2981
|
-
!
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2997
|
+
!c && /* @__PURE__ */ n(
|
|
2998
|
+
"div",
|
|
2999
|
+
{
|
|
3000
|
+
className: x(
|
|
3001
|
+
"flex-1 min-h-0 flex flex-col",
|
|
3002
|
+
A && "animate-thread-reveal"
|
|
3003
|
+
),
|
|
3004
|
+
children: /* @__PURE__ */ n(ge, { children: /* @__PURE__ */ n(f, { className: x("flex-1", e.messageList) }) })
|
|
3005
|
+
}
|
|
3006
|
+
),
|
|
3007
|
+
/* @__PURE__ */ d("div", { className: "absolute inset-0 z-10 pointer-events-none flex flex-col", children: [
|
|
3008
|
+
/* @__PURE__ */ n("div", { className: "grow basis-0 shrink-0 min-h-0 flex flex-col items-center justify-end px-4 pb-6 md:pb-8", children: c && /* @__PURE__ */ n(N, { onSuggestionClick: g }) }),
|
|
3009
|
+
/* @__PURE__ */ d("div", { ref: L, className: "relative shrink-0 flex flex-col items-stretch", children: [
|
|
3010
|
+
/* @__PURE__ */ n(
|
|
2986
3011
|
"div",
|
|
2987
3012
|
{
|
|
2988
3013
|
"aria-hidden": !0,
|
|
2989
|
-
className:
|
|
3014
|
+
className: x(
|
|
3015
|
+
"pointer-events-none absolute inset-0 bg-gradient-to-t from-background/95 via-background/75 to-transparent backdrop-blur-sm [mask-image:linear-gradient(to_top,black_55%,transparent)] transition-opacity",
|
|
3016
|
+
c ? "opacity-0 duration-200" : "opacity-100 duration-300 delay-200"
|
|
3017
|
+
)
|
|
2990
3018
|
}
|
|
2991
3019
|
),
|
|
2992
3020
|
/* @__PURE__ */ n(
|
|
2993
3021
|
M,
|
|
2994
3022
|
{
|
|
2995
|
-
onSend:
|
|
3023
|
+
onSend: m,
|
|
2996
3024
|
status: o,
|
|
2997
|
-
isErrorVisible:
|
|
3025
|
+
isErrorVisible: P,
|
|
2998
3026
|
threadId: r,
|
|
2999
|
-
newChat:
|
|
3000
|
-
className:
|
|
3027
|
+
newChat: c,
|
|
3028
|
+
className: x(
|
|
3001
3029
|
"relative z-10 pointer-events-auto",
|
|
3002
3030
|
e.inputArea,
|
|
3003
|
-
|
|
3031
|
+
_ && "pb-0 md:pb-0"
|
|
3004
3032
|
)
|
|
3005
3033
|
}
|
|
3006
3034
|
),
|
|
3007
|
-
|
|
3035
|
+
_ && /* @__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: _ }) })
|
|
3008
3036
|
] }),
|
|
3009
3037
|
/* @__PURE__ */ n(
|
|
3010
3038
|
"div",
|
|
3011
3039
|
{
|
|
3012
|
-
className:
|
|
3013
|
-
"basis-0 shrink-0 transition-[flex-grow] duration-500 ease-in-out",
|
|
3014
|
-
|
|
3040
|
+
className: x(
|
|
3041
|
+
"basis-0 shrink-0 transition-[flex-grow] duration-500 ease-in-out motion-reduce:transition-none",
|
|
3042
|
+
c ? "grow" : "grow-0"
|
|
3015
3043
|
)
|
|
3016
3044
|
}
|
|
3017
3045
|
)
|
|
@@ -3036,7 +3064,7 @@ const Tl = ({
|
|
|
3036
3064
|
disclaimer: i,
|
|
3037
3065
|
...l
|
|
3038
3066
|
}) => {
|
|
3039
|
-
const
|
|
3067
|
+
const c = Ct(), u = /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(
|
|
3040
3068
|
Kt,
|
|
3041
3069
|
{
|
|
3042
3070
|
components: s,
|
|
@@ -3047,18 +3075,18 @@ const Tl = ({
|
|
|
3047
3075
|
children: /* @__PURE__ */ n(Il, { ...l })
|
|
3048
3076
|
}
|
|
3049
3077
|
) });
|
|
3050
|
-
return
|
|
3078
|
+
return c && e === void 0 && t === void 0 ? u : /* @__PURE__ */ n(
|
|
3051
3079
|
Vn,
|
|
3052
3080
|
{
|
|
3053
3081
|
threadId: e,
|
|
3054
3082
|
onThreadChange: t,
|
|
3055
|
-
getThreadHref:
|
|
3056
|
-
children:
|
|
3083
|
+
getThreadHref: c?.getThreadHref,
|
|
3084
|
+
children: u
|
|
3057
3085
|
}
|
|
3058
3086
|
);
|
|
3059
3087
|
};
|
|
3060
3088
|
function Ml() {
|
|
3061
|
-
return /* @__PURE__ */ n(
|
|
3089
|
+
return /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n("div", { className: "min-h-dvh bg-background" }) });
|
|
3062
3090
|
}
|
|
3063
3091
|
const Pl = ({ theme: e = "system", ...t }) => /* @__PURE__ */ n(
|
|
3064
3092
|
Ra,
|
|
@@ -3087,7 +3115,7 @@ function Rl() {
|
|
|
3087
3115
|
return /* @__PURE__ */ n(Pl, { richColors: !0, theme: e });
|
|
3088
3116
|
}
|
|
3089
3117
|
const Al = Os(Ms), Dl = ({ message: e }) => {
|
|
3090
|
-
|
|
3118
|
+
B.error(e);
|
|
3091
3119
|
};
|
|
3092
3120
|
function Ol({
|
|
3093
3121
|
toaster: e = !0,
|
|
@@ -3102,13 +3130,13 @@ function Ol({
|
|
|
3102
3130
|
...a,
|
|
3103
3131
|
fallback: t ?? /* @__PURE__ */ n(Ml, {}),
|
|
3104
3132
|
onConfigUnavailable: s,
|
|
3105
|
-
overlay: e && /* @__PURE__ */ n(
|
|
3133
|
+
overlay: e && /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(Rl, {}) }),
|
|
3106
3134
|
children: /* @__PURE__ */ n(le.PartsProvider, { components: Al, children: r })
|
|
3107
3135
|
}
|
|
3108
3136
|
);
|
|
3109
3137
|
}
|
|
3110
3138
|
function El() {
|
|
3111
|
-
const { language: e, dir: t } =
|
|
3139
|
+
const { language: e, dir: t } = V(), { resolvedTheme: s } = Ce(), r = K((o) => o.app.name), a = K((o) => o.app.favicon);
|
|
3112
3140
|
return D(() => {
|
|
3113
3141
|
const o = document.documentElement, i = { lang: o.lang, dir: o.dir };
|
|
3114
3142
|
return o.lang = e, o.dir = t, () => {
|
|
@@ -3139,22 +3167,22 @@ function Ll({ children: e, fallback: t, loginCode: s, onLoginCodeUsed: r }) {
|
|
|
3139
3167
|
);
|
|
3140
3168
|
D(() => {
|
|
3141
3169
|
if (!s) return;
|
|
3142
|
-
let
|
|
3170
|
+
let u = !1;
|
|
3143
3171
|
return i("pending"), (async () => {
|
|
3144
3172
|
try {
|
|
3145
3173
|
await a(s);
|
|
3146
3174
|
} catch (p) {
|
|
3147
|
-
if (
|
|
3175
|
+
if (u) return;
|
|
3148
3176
|
console.error("Could not sign in with the login code:", p), i("failed");
|
|
3149
3177
|
return;
|
|
3150
3178
|
}
|
|
3151
|
-
|
|
3179
|
+
u || (r?.(), i("idle"));
|
|
3152
3180
|
})(), () => {
|
|
3153
|
-
|
|
3181
|
+
u = !0;
|
|
3154
3182
|
};
|
|
3155
3183
|
}, [s]);
|
|
3156
|
-
const l = la({ enabled: o === "idle" }),
|
|
3157
|
-
return
|
|
3184
|
+
const l = la({ enabled: o === "idle" }), c = o === "failed" ? "handoff_failed" : o === "idle" && (l === "signed_out" || l === "session_expired") ? l : null;
|
|
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 });
|
|
3158
3186
|
}
|
|
3159
3187
|
function Es({
|
|
3160
3188
|
label: e,
|
|
@@ -3165,20 +3193,20 @@ function Es({
|
|
|
3165
3193
|
resetsAt: o,
|
|
3166
3194
|
action: i
|
|
3167
3195
|
}) {
|
|
3168
|
-
const { t: l, i18n:
|
|
3169
|
-
return /* @__PURE__ */
|
|
3170
|
-
/* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
3196
|
+
const { t: l, i18n: c } = k(["quota"]), u = Lt(r, a);
|
|
3197
|
+
return /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
|
|
3198
|
+
/* @__PURE__ */ d("div", { className: "flex items-baseline justify-between gap-3 text-sm", children: [
|
|
3199
|
+
/* @__PURE__ */ d("span", { className: "font-medium text-foreground/80", children: [
|
|
3172
3200
|
e,
|
|
3173
3201
|
" ",
|
|
3174
3202
|
t && /* @__PURE__ */ n("span", { className: "text-xs font-normal text-muted-foreground", children: t })
|
|
3175
3203
|
] }),
|
|
3176
|
-
/* @__PURE__ */
|
|
3177
|
-
/* @__PURE__ */
|
|
3178
|
-
nn(s, r,
|
|
3179
|
-
/* @__PURE__ */
|
|
3204
|
+
/* @__PURE__ */ d("span", { className: "flex items-center gap-2", children: [
|
|
3205
|
+
/* @__PURE__ */ d("span", { className: "font-semibold tabular-nums text-foreground", children: [
|
|
3206
|
+
nn(s, r, c.language),
|
|
3207
|
+
/* @__PURE__ */ d("span", { className: "text-muted-foreground font-normal", children: [
|
|
3180
3208
|
" / ",
|
|
3181
|
-
nn(s, a,
|
|
3209
|
+
nn(s, a, c.language)
|
|
3182
3210
|
] })
|
|
3183
3211
|
] }),
|
|
3184
3212
|
i
|
|
@@ -3196,18 +3224,18 @@ function Es({
|
|
|
3196
3224
|
children: /* @__PURE__ */ n(
|
|
3197
3225
|
"div",
|
|
3198
3226
|
{
|
|
3199
|
-
className:
|
|
3200
|
-
style: { width: `${
|
|
3227
|
+
className: x("h-full rounded-full transition-all duration-700", Dt(u)),
|
|
3228
|
+
style: { width: `${u}%` }
|
|
3201
3229
|
}
|
|
3202
3230
|
)
|
|
3203
3231
|
}
|
|
3204
3232
|
),
|
|
3205
|
-
o && /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground", children: l("quota:resets_at", { datetime: Ot(o,
|
|
3233
|
+
o && /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground", children: l("quota:resets_at", { datetime: Ot(o, c.language) }) })
|
|
3206
3234
|
] });
|
|
3207
3235
|
}
|
|
3208
3236
|
function ql({ windows: e, className: t, renderAction: s }) {
|
|
3209
|
-
const { t: r } =
|
|
3210
|
-
return /* @__PURE__ */ n("div", { className:
|
|
3237
|
+
const { t: r } = k(["quota"]);
|
|
3238
|
+
return /* @__PURE__ */ n("div", { className: x("space-y-4", t), children: e.map((a) => /* @__PURE__ */ n(
|
|
3211
3239
|
Es,
|
|
3212
3240
|
{
|
|
3213
3241
|
label: Et(r, a.meter),
|
|
@@ -3222,7 +3250,7 @@ function ql({ windows: e, className: t, renderAction: s }) {
|
|
|
3222
3250
|
)) });
|
|
3223
3251
|
}
|
|
3224
3252
|
function $l({ credits: e, action: t }) {
|
|
3225
|
-
const { t: s } =
|
|
3253
|
+
const { t: s } = k(["quota"]);
|
|
3226
3254
|
return /* @__PURE__ */ n(
|
|
3227
3255
|
Es,
|
|
3228
3256
|
{
|
|
@@ -3243,23 +3271,23 @@ function Pe(e, t) {
|
|
|
3243
3271
|
const s = e?.sections?.[t];
|
|
3244
3272
|
return s?.mode ?? (s?.enabled === !1 ? "hidden" : "editable");
|
|
3245
3273
|
}
|
|
3246
|
-
function
|
|
3274
|
+
function te(e, t, s, r = "editable") {
|
|
3247
3275
|
return e?.sections?.[t]?.fields?.[s] || r;
|
|
3248
3276
|
}
|
|
3249
3277
|
function qs() {
|
|
3250
|
-
const { t: e } =
|
|
3278
|
+
const { t: e } = k("settings"), { data: t } = Un(), s = Le(), { data: r } = St({
|
|
3251
3279
|
enabled: !!s?.plugins?.includes("billing")
|
|
3252
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 || "");
|
|
3253
3281
|
return { displayName: a, initial: o, planLabel: i, handleOrPlan: l };
|
|
3254
3282
|
}
|
|
3255
3283
|
function Xt() {
|
|
3256
|
-
const { t: e, i18n: t } =
|
|
3284
|
+
const { t: e, i18n: t } = k("settings"), s = Y((o) => o.settings), { locked: r } = Ce(), { locked: a } = V();
|
|
3257
3285
|
return O(() => {
|
|
3258
3286
|
const o = e("sections.account"), i = e("sections.general"), l = [
|
|
3259
3287
|
["profile", o, Pr],
|
|
3260
3288
|
["general", i, Pn],
|
|
3261
3289
|
["account", o, Rr]
|
|
3262
|
-
].filter(([m]) => Pe(s, m) === "hidden" ? !1 : m !== "general" || !r &&
|
|
3290
|
+
].filter(([m]) => Pe(s, m) === "hidden" ? !1 : m !== "general" || !r && te(s, "general", "theme") !== "hidden" || !a && te(s, "general", "language") !== "hidden").map(([m, g, f]) => ({
|
|
3263
3291
|
id: m,
|
|
3264
3292
|
label: e(`sections.${m}`),
|
|
3265
3293
|
title: e(`${m}.title`),
|
|
@@ -3267,7 +3295,7 @@ function Xt() {
|
|
|
3267
3295
|
group: g,
|
|
3268
3296
|
icon: f,
|
|
3269
3297
|
faded: m !== "general" && Pe(s, m) === "faded"
|
|
3270
|
-
})),
|
|
3298
|
+
})), c = (s?.customSections ?? []).map((m) => {
|
|
3271
3299
|
const g = Ne(m.label, e, t, ["settings"]), f = m.group === "account" ? o : !m.group || m.group === "general" ? i : Ne(m.group, e, t, ["settings"]);
|
|
3272
3300
|
return {
|
|
3273
3301
|
id: m.id,
|
|
@@ -3279,10 +3307,10 @@ function Xt() {
|
|
|
3279
3307
|
showInMenu: m.showInMenu,
|
|
3280
3308
|
component: m.component
|
|
3281
3309
|
};
|
|
3282
|
-
}),
|
|
3283
|
-
for (const m of
|
|
3310
|
+
}), u = [...l, ...c], p = /* @__PURE__ */ new Map();
|
|
3311
|
+
for (const m of u)
|
|
3284
3312
|
p.set(m.group, [...p.get(m.group) ?? [], m]);
|
|
3285
|
-
return { sections:
|
|
3313
|
+
return { sections: u, groups: Array.from(p, ([m, g]) => ({ title: m, items: g })) };
|
|
3286
3314
|
}, [e, t, s, r, a]);
|
|
3287
3315
|
}
|
|
3288
3316
|
function $s(e, t) {
|
|
@@ -3293,18 +3321,18 @@ function $s(e, t) {
|
|
|
3293
3321
|
return r ? s : null;
|
|
3294
3322
|
}
|
|
3295
3323
|
function js(e = "editable", t = "editable", s = "editable") {
|
|
3296
|
-
const { t: r, i18n: a } =
|
|
3324
|
+
const { t: r, i18n: a } = k("settings"), o = K((v) => v.app), { theme: i, setTheme: l, locked: c } = Ce(), { language: u, setLanguage: p, locked: m, dir: g } = V(), f = qa(a, o?.languages), h = f.find((v) => v === u) ?? u.split("-")[0];
|
|
3297
3325
|
return { rows: [
|
|
3298
|
-
!
|
|
3326
|
+
!c && t !== "hidden" && {
|
|
3299
3327
|
key: "theme",
|
|
3300
3328
|
icon: Pn,
|
|
3301
3329
|
label: r("general.theme"),
|
|
3302
3330
|
value: i,
|
|
3303
3331
|
disabled: e === "faded" || t === "faded",
|
|
3304
|
-
onChange: (
|
|
3305
|
-
options: jl.map((
|
|
3306
|
-
value:
|
|
3307
|
-
label: r(`general.themes.${
|
|
3332
|
+
onChange: (v) => l(v),
|
|
3333
|
+
options: jl.map((v) => ({
|
|
3334
|
+
value: v,
|
|
3335
|
+
label: r(`general.themes.${v}`),
|
|
3308
3336
|
lang: void 0
|
|
3309
3337
|
}))
|
|
3310
3338
|
},
|
|
@@ -3315,13 +3343,13 @@ function js(e = "editable", t = "editable", s = "editable") {
|
|
|
3315
3343
|
value: h,
|
|
3316
3344
|
disabled: e === "faded" || s === "faded",
|
|
3317
3345
|
onChange: p,
|
|
3318
|
-
options: f.map((
|
|
3319
|
-
value:
|
|
3320
|
-
label: $a(
|
|
3321
|
-
lang:
|
|
3346
|
+
options: f.map((v) => ({
|
|
3347
|
+
value: v,
|
|
3348
|
+
label: $a(v),
|
|
3349
|
+
lang: v
|
|
3322
3350
|
}))
|
|
3323
3351
|
}
|
|
3324
|
-
].filter((
|
|
3352
|
+
].filter((v) => e !== "hidden" && !!v), dir: g };
|
|
3325
3353
|
}
|
|
3326
3354
|
function Fl({
|
|
3327
3355
|
sectionMode: e = "editable",
|
|
@@ -3329,25 +3357,25 @@ function Fl({
|
|
|
3329
3357
|
languageMode: s = "editable"
|
|
3330
3358
|
} = {}) {
|
|
3331
3359
|
const r = Jr(), { rows: a, dir: o } = js(e, t, s);
|
|
3332
|
-
return /* @__PURE__ */ n("div", { className: "divide-y divide-border/50", children: a.map(({ key: i, icon: l, label:
|
|
3360
|
+
return /* @__PURE__ */ n("div", { className: "divide-y divide-border/50", children: a.map(({ key: i, icon: l, label: c, value: u, disabled: p, onChange: m, options: g }) => {
|
|
3333
3361
|
const f = `${r}-${i}`;
|
|
3334
|
-
return /* @__PURE__ */
|
|
3362
|
+
return /* @__PURE__ */ d(
|
|
3335
3363
|
"div",
|
|
3336
3364
|
{
|
|
3337
3365
|
className: `flex items-center justify-between gap-4 py-4 first:pt-1 ${p ? "opacity-60 pointer-events-none" : ""}`,
|
|
3338
3366
|
children: [
|
|
3339
|
-
/* @__PURE__ */
|
|
3367
|
+
/* @__PURE__ */ d(
|
|
3340
3368
|
ce,
|
|
3341
3369
|
{
|
|
3342
3370
|
htmlFor: f,
|
|
3343
3371
|
className: "flex items-center gap-2.5 text-sm font-medium text-foreground cursor-pointer",
|
|
3344
3372
|
children: [
|
|
3345
3373
|
/* @__PURE__ */ n(l, { className: "size-4 text-muted-foreground shrink-0" }),
|
|
3346
|
-
/* @__PURE__ */ n("span", { children:
|
|
3374
|
+
/* @__PURE__ */ n("span", { children: c })
|
|
3347
3375
|
]
|
|
3348
3376
|
}
|
|
3349
3377
|
),
|
|
3350
|
-
/* @__PURE__ */
|
|
3378
|
+
/* @__PURE__ */ d(es, { value: u, onValueChange: m, dir: o, disabled: p, children: [
|
|
3351
3379
|
/* @__PURE__ */ n(
|
|
3352
3380
|
ts,
|
|
3353
3381
|
{
|
|
@@ -3391,19 +3419,19 @@ function Fs({
|
|
|
3391
3419
|
required: o,
|
|
3392
3420
|
dir: i,
|
|
3393
3421
|
t: l,
|
|
3394
|
-
selectPlaceholderKey:
|
|
3422
|
+
selectPlaceholderKey: c
|
|
3395
3423
|
}) {
|
|
3396
|
-
const
|
|
3397
|
-
return t.type === "select" ? /* @__PURE__ */
|
|
3424
|
+
const u = typeof s == "string" || typeof s == "number" ? String(s) : "";
|
|
3425
|
+
return t.type === "select" ? /* @__PURE__ */ d(
|
|
3398
3426
|
es,
|
|
3399
3427
|
{
|
|
3400
|
-
value:
|
|
3428
|
+
value: u,
|
|
3401
3429
|
onValueChange: r,
|
|
3402
3430
|
disabled: a,
|
|
3403
3431
|
required: o,
|
|
3404
3432
|
dir: i,
|
|
3405
3433
|
children: [
|
|
3406
|
-
/* @__PURE__ */ n(ts, { className: ft, children: /* @__PURE__ */ n(ns, { placeholder: l(t.placeholder ||
|
|
3434
|
+
/* @__PURE__ */ n(ts, { className: ft, children: /* @__PURE__ */ n(ns, { placeholder: l(t.placeholder || c) }) }),
|
|
3407
3435
|
/* @__PURE__ */ n(ss, { className: "rounded-xl border-border/40 shadow-xl bg-background", children: t.options?.map((p) => /* @__PURE__ */ n(
|
|
3408
3436
|
rs,
|
|
3409
3437
|
{
|
|
@@ -3415,7 +3443,7 @@ function Fs({
|
|
|
3415
3443
|
)) })
|
|
3416
3444
|
]
|
|
3417
3445
|
}
|
|
3418
|
-
) : t.type === "checkbox" ? /* @__PURE__ */
|
|
3446
|
+
) : t.type === "checkbox" ? /* @__PURE__ */ d("div", { className: "flex items-center gap-3 px-1 py-1", children: [
|
|
3419
3447
|
/* @__PURE__ */ n(
|
|
3420
3448
|
"input",
|
|
3421
3449
|
{
|
|
@@ -3434,7 +3462,7 @@ function Fs({
|
|
|
3434
3462
|
{
|
|
3435
3463
|
id: e,
|
|
3436
3464
|
type: t.type,
|
|
3437
|
-
value:
|
|
3465
|
+
value: u,
|
|
3438
3466
|
disabled: a,
|
|
3439
3467
|
required: o,
|
|
3440
3468
|
onChange: (p) => r(p.target.value),
|
|
@@ -3448,7 +3476,7 @@ async function Us(e, t) {
|
|
|
3448
3476
|
try {
|
|
3449
3477
|
await e.logout(), window.location.reload();
|
|
3450
3478
|
} catch (s) {
|
|
3451
|
-
|
|
3479
|
+
B.error(fe(s, t));
|
|
3452
3480
|
}
|
|
3453
3481
|
}
|
|
3454
3482
|
function Bs({
|
|
@@ -3456,7 +3484,7 @@ function Bs({
|
|
|
3456
3484
|
name: t,
|
|
3457
3485
|
subtitle: s
|
|
3458
3486
|
}) {
|
|
3459
|
-
return /* @__PURE__ */
|
|
3487
|
+
return /* @__PURE__ */ d("div", { className: "flex items-center gap-2.5 min-w-0 flex-1", children: [
|
|
3460
3488
|
/* @__PURE__ */ n(
|
|
3461
3489
|
"div",
|
|
3462
3490
|
{
|
|
@@ -3465,7 +3493,7 @@ function Bs({
|
|
|
3465
3493
|
children: e
|
|
3466
3494
|
}
|
|
3467
3495
|
),
|
|
3468
|
-
/* @__PURE__ */
|
|
3496
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col min-w-0 leading-tight", children: [
|
|
3469
3497
|
/* @__PURE__ */ n("span", { className: "truncate text-sm font-medium", children: t }),
|
|
3470
3498
|
s && /* @__PURE__ */ n("span", { className: "truncate text-xs text-muted-foreground", children: s })
|
|
3471
3499
|
] })
|
|
@@ -3476,26 +3504,26 @@ function Hs({
|
|
|
3476
3504
|
side: t = "top",
|
|
3477
3505
|
align: s = "start"
|
|
3478
3506
|
}) {
|
|
3479
|
-
const { t: r } =
|
|
3507
|
+
const { t: r } = k(["settings", "errors"]), a = Y((M) => M.settings), o = a?.menu, i = Xe(), l = ze(), { sections: c } = Xt(), { displayName: u, initial: p, handleOrPlan: m } = qs(), g = Pe(a, "profile"), f = Pe(a, "account"), h = te(a, "account", "logout"), { rows: N, dir: v } = js(
|
|
3480
3508
|
Pe(a, "general"),
|
|
3481
|
-
|
|
3482
|
-
|
|
3509
|
+
te(a, "general", "theme"),
|
|
3510
|
+
te(a, "general", "language")
|
|
3483
3511
|
), y = N.filter(
|
|
3484
|
-
(
|
|
3485
|
-
), b = o?.showUserHeader !== !1 && !!
|
|
3486
|
-
o?.showAccount !== !1 &&
|
|
3487
|
-
o?.showProfile === !0 &&
|
|
3488
|
-
o?.showSettings !== !1 &&
|
|
3512
|
+
(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", _ = (M) => c.find((L) => L.id === M), z = [
|
|
3514
|
+
o?.showAccount !== !1 && _("account"),
|
|
3515
|
+
o?.showProfile === !0 && _("profile"),
|
|
3516
|
+
o?.showSettings !== !1 && c.length > 0 && {
|
|
3489
3517
|
id: I,
|
|
3490
3518
|
icon: Re,
|
|
3491
3519
|
label: r("title"),
|
|
3492
3520
|
faded: !1
|
|
3493
3521
|
},
|
|
3494
|
-
...
|
|
3495
|
-
].filter((
|
|
3522
|
+
...c.filter((M) => M.showInMenu)
|
|
3523
|
+
].filter((M) => !!M), T = o?.showLogout !== !1 && f !== "hidden" && h !== "hidden", P = z.length > 0 || y.length > 0;
|
|
3496
3524
|
if (!b && !P && !T) return null;
|
|
3497
3525
|
const A = /* @__PURE__ */ n("div", { role: "separator", className: "my-1 h-px bg-border/50" });
|
|
3498
|
-
return /* @__PURE__ */
|
|
3526
|
+
return /* @__PURE__ */ d(Pt, { dir: v, children: [
|
|
3499
3527
|
/* @__PURE__ */ n(Rt, { asChild: !0, children: /* @__PURE__ */ n(
|
|
3500
3528
|
E,
|
|
3501
3529
|
{
|
|
@@ -3504,81 +3532,81 @@ function Hs({
|
|
|
3504
3532
|
variant: "ghost",
|
|
3505
3533
|
size: "icon",
|
|
3506
3534
|
"aria-label": r("title"),
|
|
3507
|
-
className:
|
|
3535
|
+
className: x(
|
|
3508
3536
|
"size-9 shrink-0 rounded-full text-muted-foreground hover:bg-sidebar-accent hover:text-foreground transition-colors",
|
|
3509
3537
|
e
|
|
3510
3538
|
),
|
|
3511
3539
|
children: /* @__PURE__ */ n(Re, { className: "size-4" })
|
|
3512
3540
|
}
|
|
3513
3541
|
) }),
|
|
3514
|
-
/* @__PURE__ */
|
|
3542
|
+
/* @__PURE__ */ d(
|
|
3515
3543
|
At,
|
|
3516
3544
|
{
|
|
3517
3545
|
side: t,
|
|
3518
3546
|
align: s,
|
|
3519
3547
|
sideOffset: 8,
|
|
3520
|
-
className:
|
|
3548
|
+
className: x("w-64", wn),
|
|
3521
3549
|
children: [
|
|
3522
|
-
b && /* @__PURE__ */
|
|
3523
|
-
/* @__PURE__ */
|
|
3550
|
+
b && /* @__PURE__ */ d($, { children: [
|
|
3551
|
+
/* @__PURE__ */ d(
|
|
3524
3552
|
we,
|
|
3525
3553
|
{
|
|
3526
3554
|
disabled: g === "hidden" || g === "faded",
|
|
3527
3555
|
onSelect: () => l?.openSection("profile"),
|
|
3528
3556
|
className: "cursor-pointer flex items-center justify-between gap-2.5 rounded-xl px-2.5 py-2",
|
|
3529
3557
|
children: [
|
|
3530
|
-
/* @__PURE__ */ n(Bs, { initial: p, name:
|
|
3558
|
+
/* @__PURE__ */ n(Bs, { initial: p, name: u, subtitle: m }),
|
|
3531
3559
|
g !== "hidden" && /* @__PURE__ */ n(jr, { className: "size-4 shrink-0 text-muted-foreground rtl:rotate-180" })
|
|
3532
3560
|
]
|
|
3533
3561
|
}
|
|
3534
3562
|
),
|
|
3535
3563
|
(P || T) && A
|
|
3536
3564
|
] }),
|
|
3537
|
-
|
|
3565
|
+
z.map(({ id: M, icon: L, label: j, faded: H }) => /* @__PURE__ */ d(
|
|
3538
3566
|
we,
|
|
3539
3567
|
{
|
|
3540
3568
|
disabled: !!H,
|
|
3541
|
-
onSelect: () => l?.openSection(
|
|
3569
|
+
onSelect: () => l?.openSection(M),
|
|
3542
3570
|
className: je,
|
|
3543
3571
|
children: [
|
|
3544
|
-
/* @__PURE__ */ n(
|
|
3545
|
-
/* @__PURE__ */ n("span", { children:
|
|
3572
|
+
/* @__PURE__ */ n(L, { className: "size-4 text-muted-foreground" }),
|
|
3573
|
+
/* @__PURE__ */ n("span", { children: j })
|
|
3546
3574
|
]
|
|
3547
3575
|
},
|
|
3548
|
-
`${
|
|
3576
|
+
`${M}-${j}`
|
|
3549
3577
|
)),
|
|
3550
|
-
|
|
3551
|
-
y.map(({ key:
|
|
3552
|
-
/* @__PURE__ */
|
|
3553
|
-
/* @__PURE__ */ n(
|
|
3554
|
-
/* @__PURE__ */ n("span", { children:
|
|
3578
|
+
z.length > 0 && y.length > 0 && A,
|
|
3579
|
+
y.map(({ key: M, icon: L, label: j, disabled: H, value: q, options: Q, onChange: Z }) => /* @__PURE__ */ d(ya, { children: [
|
|
3580
|
+
/* @__PURE__ */ d(wa, { disabled: H, className: je, children: [
|
|
3581
|
+
/* @__PURE__ */ n(L, { className: "size-4 text-muted-foreground" }),
|
|
3582
|
+
/* @__PURE__ */ n("span", { children: j })
|
|
3555
3583
|
] }),
|
|
3556
3584
|
/* @__PURE__ */ n(
|
|
3557
3585
|
Na,
|
|
3558
3586
|
{
|
|
3559
3587
|
sideOffset: 6,
|
|
3560
|
-
className:
|
|
3561
|
-
children:
|
|
3588
|
+
className: x("min-w-44 max-h-72 overflow-y-auto custom-scrollbar", wn),
|
|
3589
|
+
children: Q.map((J) => /* @__PURE__ */ d(
|
|
3562
3590
|
we,
|
|
3563
3591
|
{
|
|
3564
3592
|
role: "menuitemradio",
|
|
3565
|
-
"aria-checked":
|
|
3566
|
-
lang:
|
|
3567
|
-
onSelect: () =>
|
|
3568
|
-
className:
|
|
3593
|
+
"aria-checked": q === J.value,
|
|
3594
|
+
lang: J.lang,
|
|
3595
|
+
onSelect: () => Z(J.value),
|
|
3596
|
+
className: x(je, "justify-between"),
|
|
3569
3597
|
children: [
|
|
3570
|
-
/* @__PURE__ */ n("span", { children:
|
|
3571
|
-
|
|
3598
|
+
/* @__PURE__ */ n("span", { children: J.label }),
|
|
3599
|
+
q === J.value && /* @__PURE__ */ n(An, { className: "size-4 text-foreground" })
|
|
3572
3600
|
]
|
|
3573
3601
|
},
|
|
3574
|
-
|
|
3602
|
+
J.value
|
|
3575
3603
|
))
|
|
3576
3604
|
}
|
|
3577
3605
|
)
|
|
3578
|
-
] },
|
|
3579
|
-
T && /* @__PURE__ */
|
|
3606
|
+
] }, M)),
|
|
3607
|
+
T && /* @__PURE__ */ d($, { children: [
|
|
3580
3608
|
P && A,
|
|
3581
|
-
/* @__PURE__ */
|
|
3609
|
+
/* @__PURE__ */ d(
|
|
3582
3610
|
we,
|
|
3583
3611
|
{
|
|
3584
3612
|
variant: "destructive",
|
|
@@ -3608,19 +3636,19 @@ const Ul = [
|
|
|
3608
3636
|
["pass", "password", Lr, "password"]
|
|
3609
3637
|
];
|
|
3610
3638
|
function Bl({ trigger: e }) {
|
|
3611
|
-
const { t, i18n: s } =
|
|
3639
|
+
const { t, i18n: s } = k(["settings", "common"]), r = K((S) => S.app), a = Y((S) => S.settings), o = Xe(), i = Gn(), l = ca(), c = ze(), u = !e && c !== null && c.activeSection !== null, [p, m] = C(!1), g = u || p, { data: f, refetch: h } = St({
|
|
3612
3640
|
enabled: g
|
|
3613
|
-
}), N =
|
|
3641
|
+
}), N = U(null), { dir: v } = V(), { sections: y } = Xt(), [b, I] = C(y[0]?.id || "profile"), _ = (u ? c.activeSection : b) || y[0]?.id || "profile", z = y.find((S) => S.id === _) ?? y[0], T = z?.component, [P, A] = C({
|
|
3614
3642
|
name: "",
|
|
3615
3643
|
surname: "",
|
|
3616
3644
|
username: "",
|
|
3617
3645
|
email: "",
|
|
3618
3646
|
phone: "",
|
|
3619
3647
|
password: ""
|
|
3620
|
-
}),
|
|
3648
|
+
}), M = (S, F) => A((w) => ({ ...w, [S]: F })), L = O(
|
|
3621
3649
|
() => r?.userMetadataFields?.filter((S) => S.showInProfile) || [],
|
|
3622
3650
|
[r?.userMetadataFields]
|
|
3623
|
-
), [
|
|
3651
|
+
), [j, H] = C({}), [q, Q] = C(!1), Z = de(async () => {
|
|
3624
3652
|
try {
|
|
3625
3653
|
h();
|
|
3626
3654
|
const S = await o.getMe();
|
|
@@ -3633,25 +3661,25 @@ function Bl({ trigger: e }) {
|
|
|
3633
3661
|
password: ""
|
|
3634
3662
|
}), H(
|
|
3635
3663
|
Object.fromEntries(
|
|
3636
|
-
|
|
3664
|
+
L.map((F) => [F.key, S.metadata?.[F.key] ?? F.defaultValue ?? ""])
|
|
3637
3665
|
)
|
|
3638
3666
|
);
|
|
3639
3667
|
} catch (S) {
|
|
3640
|
-
|
|
3668
|
+
B.error(fe(S, t));
|
|
3641
3669
|
}
|
|
3642
|
-
}, [t,
|
|
3670
|
+
}, [t, L, o, h]);
|
|
3643
3671
|
D(() => {
|
|
3644
3672
|
if (!g) {
|
|
3645
3673
|
N.current = null;
|
|
3646
3674
|
return;
|
|
3647
3675
|
}
|
|
3648
|
-
(N.current === null ||
|
|
3649
|
-
}, [g,
|
|
3650
|
-
const S = $s(
|
|
3676
|
+
(N.current === null || _ === "account") && Z(), N.current = _;
|
|
3677
|
+
}, [g, _, Z]), D(() => {
|
|
3678
|
+
const S = $s(L, j);
|
|
3651
3679
|
S && H(S);
|
|
3652
|
-
}, [
|
|
3653
|
-
const
|
|
3654
|
-
|
|
3680
|
+
}, [j, L]);
|
|
3681
|
+
const J = async () => {
|
|
3682
|
+
Q(!0);
|
|
3655
3683
|
try {
|
|
3656
3684
|
const S = await o.updateMe({
|
|
3657
3685
|
name: P.name,
|
|
@@ -3659,39 +3687,39 @@ function Bl({ trigger: e }) {
|
|
|
3659
3687
|
username: P.username || void 0,
|
|
3660
3688
|
email: P.email || void 0,
|
|
3661
3689
|
phone: P.phone || void 0,
|
|
3662
|
-
metadata:
|
|
3690
|
+
metadata: j,
|
|
3663
3691
|
...P.password && { password: P.password }
|
|
3664
3692
|
});
|
|
3665
|
-
i.setQueryData(l.currentUser(), S),
|
|
3693
|
+
i.setQueryData(l.currentUser(), S), B.success(t("profile.success")), M("password", ""), Z();
|
|
3666
3694
|
} catch (S) {
|
|
3667
|
-
|
|
3695
|
+
B.error(fe(S, t));
|
|
3668
3696
|
} finally {
|
|
3669
|
-
|
|
3697
|
+
Q(!1);
|
|
3670
3698
|
}
|
|
3671
|
-
},
|
|
3672
|
-
|
|
3673
|
-
}, Ie = /* @__PURE__ */
|
|
3699
|
+
}, me = te(a, "account", "usage"), re = te(a, "account", "logout"), he = () => {
|
|
3700
|
+
c?.close(), requestAnimationFrame(() => c?.triggerRef.current?.focus());
|
|
3701
|
+
}, Ie = /* @__PURE__ */ d(
|
|
3674
3702
|
"div",
|
|
3675
3703
|
{
|
|
3676
|
-
dir:
|
|
3677
|
-
onKeyDown:
|
|
3678
|
-
S.key === "Escape" && (S.stopPropagation(),
|
|
3704
|
+
dir: v,
|
|
3705
|
+
onKeyDown: u ? (S) => {
|
|
3706
|
+
S.key === "Escape" && (S.stopPropagation(), he());
|
|
3679
3707
|
} : void 0,
|
|
3680
3708
|
className: "flex flex-col h-full w-full min-h-0 overflow-hidden",
|
|
3681
3709
|
children: [
|
|
3682
|
-
!
|
|
3683
|
-
/* @__PURE__ */
|
|
3710
|
+
!u && /* @__PURE__ */ d("div", { className: "w-full border-b border-border/40 flex flex-col shrink-0 bg-muted/30 pt-10 sm:pt-6", children: [
|
|
3711
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-2.5 px-4 sm:px-6 mb-2 sm:mb-4 font-bold text-lg", children: [
|
|
3684
3712
|
/* @__PURE__ */ n(Re, { className: "size-5 text-primary" }),
|
|
3685
3713
|
/* @__PURE__ */ n("span", { children: t("title") })
|
|
3686
3714
|
] }),
|
|
3687
|
-
/* @__PURE__ */ n("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ n("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: y.map((S) => /* @__PURE__ */
|
|
3715
|
+
/* @__PURE__ */ n("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ n("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: y.map((S) => /* @__PURE__ */ d(
|
|
3688
3716
|
"button",
|
|
3689
3717
|
{
|
|
3690
3718
|
type: "button",
|
|
3691
3719
|
onClick: () => I(S.id),
|
|
3692
|
-
className:
|
|
3720
|
+
className: x(
|
|
3693
3721
|
"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",
|
|
3694
|
-
|
|
3722
|
+
_ === S.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
|
|
3695
3723
|
S.faded && Fe
|
|
3696
3724
|
),
|
|
3697
3725
|
children: [
|
|
@@ -3702,79 +3730,79 @@ function Bl({ trigger: e }) {
|
|
|
3702
3730
|
S.id
|
|
3703
3731
|
)) }) })
|
|
3704
3732
|
] }),
|
|
3705
|
-
/* @__PURE__ */ n("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ n("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-6 sm:pt-10 custom-scrollbar", children: /* @__PURE__ */
|
|
3733
|
+
/* @__PURE__ */ n("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ n("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-6 sm:pt-10 custom-scrollbar", children: /* @__PURE__ */ d(
|
|
3706
3734
|
"div",
|
|
3707
3735
|
{
|
|
3708
|
-
className:
|
|
3736
|
+
className: x(
|
|
3709
3737
|
"space-y-6 animate-in fade-in slide-in-from-bottom-2 duration-200",
|
|
3710
|
-
|
|
3738
|
+
u && "max-w-2xl mx-auto w-full"
|
|
3711
3739
|
),
|
|
3712
3740
|
children: [
|
|
3713
|
-
/* @__PURE__ */
|
|
3714
|
-
/* @__PURE__ */
|
|
3715
|
-
/* @__PURE__ */ n("h2", { className: "text-xl sm:text-2xl font-semibold tracking-tight", children:
|
|
3716
|
-
|
|
3741
|
+
/* @__PURE__ */ d("div", { className: "flex items-start justify-between gap-4 border-b border-border/50 pb-4", children: [
|
|
3742
|
+
/* @__PURE__ */ d("div", { children: [
|
|
3743
|
+
/* @__PURE__ */ n("h2", { className: "text-xl sm:text-2xl font-semibold tracking-tight", children: z?.title ?? t("title") }),
|
|
3744
|
+
z?.subtitle && /* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground mt-1", children: z.subtitle })
|
|
3717
3745
|
] }),
|
|
3718
|
-
|
|
3746
|
+
u && /* @__PURE__ */ n(
|
|
3719
3747
|
E,
|
|
3720
3748
|
{
|
|
3721
3749
|
type: "button",
|
|
3722
3750
|
variant: "ghost",
|
|
3723
3751
|
size: "icon",
|
|
3724
3752
|
autoFocus: !0,
|
|
3725
|
-
onClick:
|
|
3753
|
+
onClick: he,
|
|
3726
3754
|
"aria-label": t("common:close"),
|
|
3727
3755
|
className: "size-9 shrink-0 rounded-full text-muted-foreground hover:text-foreground",
|
|
3728
3756
|
children: /* @__PURE__ */ n(wt, { className: "size-4" })
|
|
3729
3757
|
}
|
|
3730
3758
|
)
|
|
3731
3759
|
] }),
|
|
3732
|
-
|
|
3733
|
-
/* @__PURE__ */ n("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: Ul.map(([S,
|
|
3734
|
-
const
|
|
3735
|
-
return
|
|
3760
|
+
_ === "profile" && /* @__PURE__ */ d("div", { className: "grid gap-6", children: [
|
|
3761
|
+
/* @__PURE__ */ n("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: Ul.map(([S, F, w, R]) => {
|
|
3762
|
+
const G = te(a, "profile", F);
|
|
3763
|
+
return G === "hidden" ? null : /* @__PURE__ */ d(
|
|
3736
3764
|
"div",
|
|
3737
3765
|
{
|
|
3738
|
-
className:
|
|
3766
|
+
className: x(
|
|
3739
3767
|
"flex flex-col gap-2.5",
|
|
3740
3768
|
w && "sm:col-span-2",
|
|
3741
|
-
|
|
3769
|
+
G === "faded" && Fe
|
|
3742
3770
|
),
|
|
3743
3771
|
children: [
|
|
3744
|
-
/* @__PURE__ */ n(ce, { htmlFor: S, className: "px-1 text-start", children: t(`profile.${
|
|
3745
|
-
/* @__PURE__ */
|
|
3772
|
+
/* @__PURE__ */ n(ce, { htmlFor: S, className: "px-1 text-start", children: t(`profile.${F}`) }),
|
|
3773
|
+
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
3746
3774
|
w && /* @__PURE__ */ n(w, { className: "absolute top-1/2 -translate-y-1/2 size-4 text-muted-foreground start-3" }),
|
|
3747
3775
|
/* @__PURE__ */ n(
|
|
3748
3776
|
Ge,
|
|
3749
3777
|
{
|
|
3750
3778
|
id: S,
|
|
3751
3779
|
type: R,
|
|
3752
|
-
value: P[
|
|
3753
|
-
onChange: (ae) =>
|
|
3754
|
-
|
|
3755
|
-
|
|
3780
|
+
value: P[F],
|
|
3781
|
+
onChange: (ae) => M(
|
|
3782
|
+
F,
|
|
3783
|
+
F === "phone" ? ae.target.value.replace(/[^0-9]/g, "") : ae.target.value
|
|
3756
3784
|
),
|
|
3757
|
-
disabled:
|
|
3758
|
-
placeholder:
|
|
3759
|
-
className:
|
|
3785
|
+
disabled: G === "faded",
|
|
3786
|
+
placeholder: F === "password" ? t("profile.password_placeholder") : void 0,
|
|
3787
|
+
className: x(ft, w && "ps-10 pe-3"),
|
|
3760
3788
|
dir: w ? "ltr" : void 0
|
|
3761
3789
|
}
|
|
3762
3790
|
)
|
|
3763
3791
|
] })
|
|
3764
3792
|
]
|
|
3765
3793
|
},
|
|
3766
|
-
|
|
3794
|
+
F
|
|
3767
3795
|
);
|
|
3768
3796
|
}) }),
|
|
3769
|
-
|
|
3770
|
-
const
|
|
3771
|
-
if (
|
|
3797
|
+
L.map((S) => {
|
|
3798
|
+
const F = te(a, "profile", S.key, S.mode || "editable");
|
|
3799
|
+
if (F === "hidden" || !$t(S.condition, j))
|
|
3772
3800
|
return null;
|
|
3773
3801
|
const w = `profile-${S.key}`;
|
|
3774
|
-
return /* @__PURE__ */
|
|
3802
|
+
return /* @__PURE__ */ d(
|
|
3775
3803
|
"div",
|
|
3776
3804
|
{
|
|
3777
|
-
className:
|
|
3805
|
+
className: x("flex flex-col gap-2.5", F === "faded" && Fe),
|
|
3778
3806
|
children: [
|
|
3779
3807
|
/* @__PURE__ */ n(ce, { htmlFor: w, className: "px-1", children: t(S.label) }),
|
|
3780
3808
|
/* @__PURE__ */ n(
|
|
@@ -3782,10 +3810,10 @@ function Bl({ trigger: e }) {
|
|
|
3782
3810
|
{
|
|
3783
3811
|
id: w,
|
|
3784
3812
|
field: S,
|
|
3785
|
-
value:
|
|
3786
|
-
onChange: (R) => H({ ...
|
|
3787
|
-
disabled:
|
|
3788
|
-
dir:
|
|
3813
|
+
value: j[S.key],
|
|
3814
|
+
onChange: (R) => H({ ...j, [S.key]: R }),
|
|
3815
|
+
disabled: F === "faded",
|
|
3816
|
+
dir: v,
|
|
3789
3817
|
t,
|
|
3790
3818
|
selectPlaceholderKey: "profile.select_placeholder"
|
|
3791
3819
|
}
|
|
@@ -3795,44 +3823,44 @@ function Bl({ trigger: e }) {
|
|
|
3795
3823
|
S.key
|
|
3796
3824
|
);
|
|
3797
3825
|
}),
|
|
3798
|
-
/* @__PURE__ */ n("div", { className: "pt-2 flex justify-end", children: /* @__PURE__ */
|
|
3826
|
+
/* @__PURE__ */ n("div", { className: "pt-2 flex justify-end", children: /* @__PURE__ */ d(
|
|
3799
3827
|
E,
|
|
3800
3828
|
{
|
|
3801
3829
|
onClick: () => {
|
|
3802
|
-
|
|
3830
|
+
J();
|
|
3803
3831
|
},
|
|
3804
|
-
disabled:
|
|
3832
|
+
disabled: q,
|
|
3805
3833
|
className: "w-full sm:w-auto px-6 rounded-full gap-2 font-medium h-10",
|
|
3806
3834
|
children: [
|
|
3807
3835
|
/* @__PURE__ */ n(qr, { className: "size-4" }),
|
|
3808
|
-
t(
|
|
3836
|
+
t(q ? "profile.saving" : "profile.save")
|
|
3809
3837
|
]
|
|
3810
3838
|
}
|
|
3811
3839
|
) })
|
|
3812
3840
|
] }),
|
|
3813
|
-
|
|
3841
|
+
_ === "general" && /* @__PURE__ */ n(
|
|
3814
3842
|
Fl,
|
|
3815
3843
|
{
|
|
3816
3844
|
sectionMode: a?.sections?.general?.mode ?? "editable",
|
|
3817
|
-
themeMode:
|
|
3818
|
-
languageMode:
|
|
3845
|
+
themeMode: te(a, "general", "theme"),
|
|
3846
|
+
languageMode: te(a, "general", "language")
|
|
3819
3847
|
}
|
|
3820
3848
|
),
|
|
3821
|
-
|
|
3822
|
-
|
|
3849
|
+
_ === "account" && /* @__PURE__ */ d("div", { className: "space-y-6", children: [
|
|
3850
|
+
me !== "hidden" && f && /* @__PURE__ */ d(
|
|
3823
3851
|
"div",
|
|
3824
3852
|
{
|
|
3825
|
-
className:
|
|
3853
|
+
className: x(
|
|
3826
3854
|
"p-6 bg-muted/30 rounded-3xl border border-border/40 space-y-5",
|
|
3827
|
-
|
|
3855
|
+
me === "faded" && "opacity-50"
|
|
3828
3856
|
),
|
|
3829
3857
|
children: [
|
|
3830
|
-
/* @__PURE__ */
|
|
3831
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ d("div", { className: "flex items-start justify-between gap-3", children: [
|
|
3859
|
+
/* @__PURE__ */ d(ce, { className: "text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2", children: [
|
|
3832
3860
|
/* @__PURE__ */ n($r, { className: "size-4" }),
|
|
3833
3861
|
t("account.usage")
|
|
3834
3862
|
] }),
|
|
3835
|
-
/* @__PURE__ */
|
|
3863
|
+
/* @__PURE__ */ d("div", { className: "text-end", children: [
|
|
3836
3864
|
/* @__PURE__ */ n("p", { className: "text-sm font-semibold text-foreground", children: f.kind === "credits" ? t("account.on_credits") : f.kind === "unlimited" ? t("account.unlimited") : f.plan?.name ?? t("account.custom_plan") }),
|
|
3837
3865
|
f.ends_at && /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground", children: t("account.plan_until", {
|
|
3838
3866
|
datetime: Ot(f.ends_at, s.language)
|
|
@@ -3845,9 +3873,9 @@ function Bl({ trigger: e }) {
|
|
|
3845
3873
|
]
|
|
3846
3874
|
}
|
|
3847
3875
|
),
|
|
3848
|
-
re !== "hidden" && /* @__PURE__ */
|
|
3876
|
+
re !== "hidden" && /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-4 py-3 border-t border-border/40", children: [
|
|
3849
3877
|
/* @__PURE__ */ n("span", { className: "text-sm font-medium text-foreground", children: t("account.logout") }),
|
|
3850
|
-
/* @__PURE__ */
|
|
3878
|
+
/* @__PURE__ */ d(
|
|
3851
3879
|
E,
|
|
3852
3880
|
{
|
|
3853
3881
|
variant: "destructive",
|
|
@@ -3855,7 +3883,7 @@ function Bl({ trigger: e }) {
|
|
|
3855
3883
|
Us(o, t);
|
|
3856
3884
|
},
|
|
3857
3885
|
disabled: re === "faded",
|
|
3858
|
-
className:
|
|
3886
|
+
className: x(
|
|
3859
3887
|
"rounded-full px-5 gap-2 font-medium h-9",
|
|
3860
3888
|
re === "faded" && Fe
|
|
3861
3889
|
),
|
|
@@ -3871,7 +3899,7 @@ function Bl({ trigger: e }) {
|
|
|
3871
3899
|
]
|
|
3872
3900
|
}
|
|
3873
3901
|
) }) }),
|
|
3874
|
-
r?.showVersionInSettings !== !1 && r?.version && /* @__PURE__ */
|
|
3902
|
+
r?.showVersionInSettings !== !1 && r?.version && /* @__PURE__ */ d(
|
|
3875
3903
|
"div",
|
|
3876
3904
|
{
|
|
3877
3905
|
dir: "ltr",
|
|
@@ -3885,12 +3913,12 @@ function Bl({ trigger: e }) {
|
|
|
3885
3913
|
]
|
|
3886
3914
|
}
|
|
3887
3915
|
);
|
|
3888
|
-
return
|
|
3916
|
+
return u ? /* @__PURE__ */ n("section", { "aria-label": t("title"), className: "flex flex-1 min-h-0 h-full w-full bg-background", children: Ie }) : /* @__PURE__ */ d(qe, { open: p, onOpenChange: m, children: [
|
|
3889
3917
|
/* @__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" }) }) }),
|
|
3890
3918
|
/* @__PURE__ */ n(
|
|
3891
3919
|
Mt,
|
|
3892
3920
|
{
|
|
3893
|
-
dir:
|
|
3921
|
+
dir: v,
|
|
3894
3922
|
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)]",
|
|
3895
3923
|
children: Ie
|
|
3896
3924
|
}
|
|
@@ -3903,53 +3931,53 @@ const Nn = (e) => e.replace(/[^0-9]/g, ""), kn = {
|
|
|
3903
3931
|
phone: "tel"
|
|
3904
3932
|
};
|
|
3905
3933
|
function Hl(e) {
|
|
3906
|
-
return /* @__PURE__ */ n(
|
|
3934
|
+
return /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(Vl, { ...e }) });
|
|
3907
3935
|
}
|
|
3908
3936
|
function Vl({ onSignedIn: e, reason: t }) {
|
|
3909
|
-
const { t: s } =
|
|
3937
|
+
const { t: s } = k(["login"]), r = K((w) => w.app), a = Xe(), o = V().dir, i = Gn(), [l, c] = C("login"), u = !!r?.disableSignup, p = !!r?.disableAuthPage, m = O(
|
|
3910
3938
|
() => r?.loginFields ?? ["username"],
|
|
3911
3939
|
[r?.loginFields]
|
|
3912
|
-
), g = m.map((w) => s(w)).join(" / "), f = m.length === 1 ? kn[m[0]] : "text", h = m.length === 1 && m[0] === "phone", [N,
|
|
3940
|
+
), g = m.map((w) => s(w)).join(" / "), f = m.length === 1 ? kn[m[0]] : "text", h = m.length === 1 && m[0] === "phone", [N, v] = C(""), [y, b] = C(""), [I, _] = C({}), [z, T] = C(""), [P, A] = C(""), [M, L] = C(""), j = O(
|
|
3913
3941
|
() => r?.userMetadataFields?.filter((w) => w.showInSignup) || [],
|
|
3914
3942
|
[r?.userMetadataFields]
|
|
3915
|
-
), [H,
|
|
3943
|
+
), [H, q] = C(() => {
|
|
3916
3944
|
const w = {};
|
|
3917
|
-
return
|
|
3945
|
+
return j.forEach((R) => {
|
|
3918
3946
|
R.defaultValue !== void 0 && (w[R.key] = R.defaultValue);
|
|
3919
3947
|
}), w;
|
|
3920
3948
|
});
|
|
3921
3949
|
D(() => {
|
|
3922
|
-
const w = $s(
|
|
3923
|
-
w &&
|
|
3924
|
-
}, [H,
|
|
3925
|
-
const [
|
|
3950
|
+
const w = $s(j, H);
|
|
3951
|
+
w && q(w);
|
|
3952
|
+
}, [H, j]);
|
|
3953
|
+
const [Q, Z] = C(""), [J, me] = C(!1);
|
|
3926
3954
|
D(() => {
|
|
3927
|
-
|
|
3928
|
-
}, [
|
|
3955
|
+
u && l === "register" && c("login");
|
|
3956
|
+
}, [u, l]);
|
|
3929
3957
|
const re = async (w, R) => {
|
|
3930
|
-
w.preventDefault(),
|
|
3958
|
+
w.preventDefault(), Z(""), me(!0);
|
|
3931
3959
|
try {
|
|
3932
3960
|
await R(), i.clear(), e();
|
|
3933
|
-
} catch (
|
|
3934
|
-
|
|
3961
|
+
} catch (G) {
|
|
3962
|
+
Z(fe(G, s));
|
|
3935
3963
|
} finally {
|
|
3936
|
-
|
|
3964
|
+
me(!1);
|
|
3937
3965
|
}
|
|
3938
|
-
},
|
|
3966
|
+
}, he = (w) => {
|
|
3939
3967
|
const R = {};
|
|
3940
|
-
for (const
|
|
3941
|
-
const ae = I[
|
|
3942
|
-
ae && (R[
|
|
3968
|
+
for (const G of m) {
|
|
3969
|
+
const ae = I[G]?.trim();
|
|
3970
|
+
ae && (R[G] = ae);
|
|
3943
3971
|
}
|
|
3944
3972
|
if (Object.keys(R).length === 0) {
|
|
3945
|
-
w.preventDefault(),
|
|
3973
|
+
w.preventDefault(), Z(s("at_least_one_login_field"));
|
|
3946
3974
|
return;
|
|
3947
3975
|
}
|
|
3948
|
-
re(w, () => a.register(R,
|
|
3976
|
+
re(w, () => a.register(R, z, P, M, H));
|
|
3949
3977
|
};
|
|
3950
3978
|
if (p) {
|
|
3951
3979
|
const w = t === "handoff_failed" ? "handoff_failed" : "auth_page_disabled";
|
|
3952
|
-
return /* @__PURE__ */ n("div", { className: "min-h-screen bg-background flex items-center justify-center p-4", dir: o, children: /* @__PURE__ */
|
|
3980
|
+
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: [
|
|
3953
3981
|
/* @__PURE__ */ n("h1", { className: "text-2xl font-bold", children: r?.name }),
|
|
3954
3982
|
/* @__PURE__ */ n("p", { className: "text-muted-foreground", children: s(`${w}_title`) }),
|
|
3955
3983
|
/* @__PURE__ */ n("p", { className: "text-sm text-muted-foreground/80", children: s(`${w}_description`) })
|
|
@@ -3957,14 +3985,14 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
3957
3985
|
}
|
|
3958
3986
|
const Ie = [
|
|
3959
3987
|
["login", "login_tab"],
|
|
3960
|
-
...
|
|
3961
|
-
], S = l === "login" ||
|
|
3988
|
+
...u ? [] : [["register", "signup_tab"]]
|
|
3989
|
+
], S = l === "login" || u, F = S ? [
|
|
3962
3990
|
[
|
|
3963
3991
|
"login-identity",
|
|
3964
3992
|
g,
|
|
3965
3993
|
f,
|
|
3966
3994
|
N,
|
|
3967
|
-
(w) =>
|
|
3995
|
+
(w) => v(h ? Nn(w) : w),
|
|
3968
3996
|
g,
|
|
3969
3997
|
!0
|
|
3970
3998
|
],
|
|
@@ -3984,8 +4012,8 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
3984
4012
|
s(w),
|
|
3985
4013
|
kn[w],
|
|
3986
4014
|
I[w] ?? "",
|
|
3987
|
-
(R) =>
|
|
3988
|
-
...
|
|
4015
|
+
(R) => _((G) => ({
|
|
4016
|
+
...G,
|
|
3989
4017
|
[w]: w === "phone" ? Nn(R) : R
|
|
3990
4018
|
})),
|
|
3991
4019
|
s(`${w}_placeholder`),
|
|
@@ -3996,7 +4024,7 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
3996
4024
|
"reg-pass",
|
|
3997
4025
|
s("password"),
|
|
3998
4026
|
"password",
|
|
3999
|
-
|
|
4027
|
+
z,
|
|
4000
4028
|
T,
|
|
4001
4029
|
"••••••••",
|
|
4002
4030
|
!0
|
|
@@ -4007,35 +4035,35 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
4007
4035
|
{
|
|
4008
4036
|
className: "min-h-screen bg-background flex flex-col items-center justify-center p-4",
|
|
4009
4037
|
dir: o,
|
|
4010
|
-
children: /* @__PURE__ */
|
|
4038
|
+
children: /* @__PURE__ */ d("div", { className: "w-full max-w-md bg-card border border-border rounded-xl shadow-lg p-6", children: [
|
|
4011
4039
|
/* @__PURE__ */ n("div", { className: "text-center mb-6", children: /* @__PURE__ */ n("h1", { className: "text-2xl font-bold text-foreground", children: r?.name }) }),
|
|
4012
4040
|
/* @__PURE__ */ n("div", { className: "flex bg-muted p-1 rounded-lg mb-6", children: Ie.map(([w, R]) => /* @__PURE__ */ n(
|
|
4013
4041
|
"button",
|
|
4014
4042
|
{
|
|
4015
4043
|
type: "button",
|
|
4016
4044
|
onClick: () => {
|
|
4017
|
-
|
|
4045
|
+
c(w), Z("");
|
|
4018
4046
|
},
|
|
4019
4047
|
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"}`,
|
|
4020
4048
|
children: s(R)
|
|
4021
4049
|
},
|
|
4022
4050
|
w
|
|
4023
4051
|
)) }),
|
|
4024
|
-
/* @__PURE__ */
|
|
4052
|
+
/* @__PURE__ */ d(
|
|
4025
4053
|
"form",
|
|
4026
4054
|
{
|
|
4027
4055
|
onSubmit: S ? (w) => {
|
|
4028
4056
|
re(w, () => a.login(N, y));
|
|
4029
|
-
} :
|
|
4057
|
+
} : he,
|
|
4030
4058
|
className: "space-y-4",
|
|
4031
4059
|
children: [
|
|
4032
|
-
|
|
4060
|
+
F.map(([w, R, G, ae, Xs, Ys, Js]) => /* @__PURE__ */ d("div", { className: "space-y-3", children: [
|
|
4033
4061
|
/* @__PURE__ */ n(ce, { htmlFor: w, children: R }),
|
|
4034
4062
|
/* @__PURE__ */ n(
|
|
4035
4063
|
Ge,
|
|
4036
4064
|
{
|
|
4037
4065
|
id: w,
|
|
4038
|
-
type:
|
|
4066
|
+
type: G,
|
|
4039
4067
|
value: ae,
|
|
4040
4068
|
onChange: (Zs) => Xs(Zs.target.value),
|
|
4041
4069
|
required: Js,
|
|
@@ -4045,11 +4073,11 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
4045
4073
|
}
|
|
4046
4074
|
)
|
|
4047
4075
|
] }, w)),
|
|
4048
|
-
!S && /* @__PURE__ */
|
|
4076
|
+
!S && /* @__PURE__ */ d($, { children: [
|
|
4049
4077
|
/* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
4050
4078
|
["name", P, A],
|
|
4051
|
-
["surname",
|
|
4052
|
-
].map(([w, R,
|
|
4079
|
+
["surname", M, L]
|
|
4080
|
+
].map(([w, R, G]) => /* @__PURE__ */ d("div", { className: "space-y-3", children: [
|
|
4053
4081
|
/* @__PURE__ */ n(ce, { htmlFor: `reg-${w}`, children: s(w) }),
|
|
4054
4082
|
/* @__PURE__ */ n(
|
|
4055
4083
|
Ge,
|
|
@@ -4057,17 +4085,17 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
4057
4085
|
id: `reg-${w}`,
|
|
4058
4086
|
type: "text",
|
|
4059
4087
|
value: R,
|
|
4060
|
-
onChange: (ae) =>
|
|
4088
|
+
onChange: (ae) => G(ae.target.value),
|
|
4061
4089
|
required: !0,
|
|
4062
4090
|
className: "text-start",
|
|
4063
4091
|
placeholder: s(`${w}_placeholder`)
|
|
4064
4092
|
}
|
|
4065
4093
|
)
|
|
4066
4094
|
] }, w)) }),
|
|
4067
|
-
|
|
4095
|
+
j.map((w) => {
|
|
4068
4096
|
if (!$t(w.condition, H)) return null;
|
|
4069
4097
|
const R = `signup-${w.key}`;
|
|
4070
|
-
return /* @__PURE__ */
|
|
4098
|
+
return /* @__PURE__ */ d(
|
|
4071
4099
|
"div",
|
|
4072
4100
|
{
|
|
4073
4101
|
className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200",
|
|
@@ -4079,7 +4107,7 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
4079
4107
|
id: R,
|
|
4080
4108
|
field: w,
|
|
4081
4109
|
value: H[w.key],
|
|
4082
|
-
onChange: (
|
|
4110
|
+
onChange: (G) => q({ ...H, [w.key]: G }),
|
|
4083
4111
|
required: w.required,
|
|
4084
4112
|
dir: o,
|
|
4085
4113
|
t: s,
|
|
@@ -4092,9 +4120,9 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
4092
4120
|
);
|
|
4093
4121
|
})
|
|
4094
4122
|
] }),
|
|
4095
|
-
|
|
4096
|
-
/* @__PURE__ */ n(E, { type: "submit", disabled:
|
|
4097
|
-
|
|
4123
|
+
Q && /* @__PURE__ */ n("div", { role: "alert", className: "text-sm text-destructive", children: Q }),
|
|
4124
|
+
/* @__PURE__ */ n(E, { type: "submit", disabled: J, className: "w-full font-semibold", children: s(
|
|
4125
|
+
J ? S ? "logging_in" : "signing_up" : S ? "login_button" : "signup_button"
|
|
4098
4126
|
) })
|
|
4099
4127
|
]
|
|
4100
4128
|
}
|
|
@@ -4103,12 +4131,12 @@ function Vl({ onSignedIn: e, reason: t }) {
|
|
|
4103
4131
|
}
|
|
4104
4132
|
);
|
|
4105
4133
|
}
|
|
4106
|
-
const Yt =
|
|
4134
|
+
const Yt = ee.createContext(null);
|
|
4107
4135
|
function Vs() {
|
|
4108
|
-
return
|
|
4136
|
+
return ee.useContext(Yt);
|
|
4109
4137
|
}
|
|
4110
4138
|
function rt() {
|
|
4111
|
-
const e =
|
|
4139
|
+
const e = ee.useContext(Yt);
|
|
4112
4140
|
if (!e) throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
4113
4141
|
return e;
|
|
4114
4142
|
}
|
|
@@ -4121,31 +4149,31 @@ function Gl({
|
|
|
4121
4149
|
children: o,
|
|
4122
4150
|
...i
|
|
4123
4151
|
}) {
|
|
4124
|
-
const l = Qt(), [
|
|
4152
|
+
const l = Qt(), [c, u] = ee.useState(!1), [p, m] = ee.useState(e), g = t ?? p, f = ee.useCallback(
|
|
4125
4153
|
(y) => {
|
|
4126
4154
|
const b = typeof y == "function" ? y(g) : y;
|
|
4127
4155
|
s ? s(b) : m(b), document.cookie = `sidebar_state=${b}; path=/; max-age=604800`;
|
|
4128
4156
|
},
|
|
4129
4157
|
[s, g]
|
|
4130
|
-
), h =
|
|
4131
|
-
l ?
|
|
4158
|
+
), h = ee.useCallback(() => {
|
|
4159
|
+
l ? u((y) => !y) : f((y) => !y);
|
|
4132
4160
|
}, [l, f]);
|
|
4133
|
-
|
|
4161
|
+
ee.useEffect(() => {
|
|
4134
4162
|
const y = (b) => {
|
|
4135
4163
|
b.key === "b" && (b.metaKey || b.ctrlKey) && (b.preventDefault(), h());
|
|
4136
4164
|
};
|
|
4137
4165
|
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
4138
4166
|
}, [h]);
|
|
4139
|
-
const N = g ? "expanded" : "collapsed",
|
|
4140
|
-
() => ({ state: N, open: g, setOpen: f, isMobile: l, openMobile:
|
|
4141
|
-
[N, g, f, l,
|
|
4167
|
+
const N = g ? "expanded" : "collapsed", v = ee.useMemo(
|
|
4168
|
+
() => ({ state: N, open: g, setOpen: f, isMobile: l, openMobile: c, setOpenMobile: u, toggleSidebar: h }),
|
|
4169
|
+
[N, g, f, l, c, h]
|
|
4142
4170
|
);
|
|
4143
|
-
return /* @__PURE__ */ n(Yt.Provider, { value:
|
|
4171
|
+
return /* @__PURE__ */ n(Yt.Provider, { value: v, children: /* @__PURE__ */ n(ka, { delayDuration: 0, children: /* @__PURE__ */ n(
|
|
4144
4172
|
"div",
|
|
4145
4173
|
{
|
|
4146
4174
|
"data-slot": "sidebar-wrapper",
|
|
4147
4175
|
style: { "--gentiq-sidebar-width": "17.5rem", ...a },
|
|
4148
|
-
className:
|
|
4176
|
+
className: x("group/sidebar-wrapper flex min-h-svh w-full", r),
|
|
4149
4177
|
...i,
|
|
4150
4178
|
children: o
|
|
4151
4179
|
}
|
|
@@ -4159,8 +4187,8 @@ function Wl({
|
|
|
4159
4187
|
children: a,
|
|
4160
4188
|
...o
|
|
4161
4189
|
}) {
|
|
4162
|
-
const { isMobile: i, state: l, openMobile:
|
|
4163
|
-
return i ? /* @__PURE__ */ n(_a, { open:
|
|
4190
|
+
const { isMobile: i, state: l, openMobile: c, setOpenMobile: u } = rt(), { t: p } = k("sidebar");
|
|
4191
|
+
return i ? /* @__PURE__ */ n(_a, { open: c, onOpenChange: u, ...o, children: /* @__PURE__ */ d(
|
|
4164
4192
|
Sa,
|
|
4165
4193
|
{
|
|
4166
4194
|
onOpenAutoFocus: (m) => m.preventDefault(),
|
|
@@ -4171,14 +4199,14 @@ function Wl({
|
|
|
4171
4199
|
style: { "--gentiq-sidebar-width": "18rem" },
|
|
4172
4200
|
side: e,
|
|
4173
4201
|
children: [
|
|
4174
|
-
/* @__PURE__ */
|
|
4202
|
+
/* @__PURE__ */ d(Ca, { className: "sr-only", children: [
|
|
4175
4203
|
/* @__PURE__ */ n(za, { children: p("title") }),
|
|
4176
4204
|
/* @__PURE__ */ n(Ia, { children: p("mobile_description") })
|
|
4177
4205
|
] }),
|
|
4178
4206
|
/* @__PURE__ */ n("div", { className: "flex h-full w-full flex-col", children: a })
|
|
4179
4207
|
]
|
|
4180
4208
|
}
|
|
4181
|
-
) }) : /* @__PURE__ */
|
|
4209
|
+
) }) : /* @__PURE__ */ d(
|
|
4182
4210
|
"div",
|
|
4183
4211
|
{
|
|
4184
4212
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
@@ -4199,7 +4227,7 @@ function Wl({
|
|
|
4199
4227
|
"div",
|
|
4200
4228
|
{
|
|
4201
4229
|
"data-slot": "sidebar-container",
|
|
4202
|
-
className:
|
|
4230
|
+
className: x(
|
|
4203
4231
|
"fixed inset-y-0 z-10 hidden h-svh w-(--gentiq-sidebar-width) transition-[inset-inline-start,inset-inline-end,width] duration-200 ease-linear md:flex group-data-[collapsible=icon]:w-14",
|
|
4204
4232
|
e === "start" ? "start-0 group-data-[collapsible=offcanvas]:start-[calc(var(--gentiq-sidebar-width)*-1)]" : "end-0 group-data-[collapsible=offcanvas]:end-[calc(var(--gentiq-sidebar-width)*-1)]",
|
|
4205
4233
|
r
|
|
@@ -4221,15 +4249,15 @@ function Wl({
|
|
|
4221
4249
|
);
|
|
4222
4250
|
}
|
|
4223
4251
|
function Gs({ className: e, onClick: t, ...s }) {
|
|
4224
|
-
const { toggleSidebar: r } = rt(), { t: a } =
|
|
4225
|
-
return /* @__PURE__ */
|
|
4252
|
+
const { toggleSidebar: r } = rt(), { t: a } = k("sidebar");
|
|
4253
|
+
return /* @__PURE__ */ d(
|
|
4226
4254
|
E,
|
|
4227
4255
|
{
|
|
4228
4256
|
"data-sidebar": "trigger",
|
|
4229
4257
|
"data-slot": "sidebar-trigger",
|
|
4230
4258
|
variant: "ghost",
|
|
4231
4259
|
size: "icon",
|
|
4232
|
-
className:
|
|
4260
|
+
className: x("size-7", e),
|
|
4233
4261
|
onClick: (o) => {
|
|
4234
4262
|
t?.(o), r();
|
|
4235
4263
|
},
|
|
@@ -4242,10 +4270,10 @@ function Gs({ className: e, onClick: t, ...s }) {
|
|
|
4242
4270
|
);
|
|
4243
4271
|
}
|
|
4244
4272
|
function Ql({ className: e, ...t }) {
|
|
4245
|
-
return /* @__PURE__ */ n("div", { "data-slot": "sidebar-header", "data-sidebar": "header", className:
|
|
4273
|
+
return /* @__PURE__ */ n("div", { "data-slot": "sidebar-header", "data-sidebar": "header", className: x("flex flex-col gap-2 p-2", e), ...t });
|
|
4246
4274
|
}
|
|
4247
4275
|
function Kl({ className: e, ...t }) {
|
|
4248
|
-
return /* @__PURE__ */ n("div", { "data-slot": "sidebar-footer", "data-sidebar": "footer", className:
|
|
4276
|
+
return /* @__PURE__ */ n("div", { "data-slot": "sidebar-footer", "data-sidebar": "footer", className: x("flex flex-col gap-2 p-2", e), ...t });
|
|
4249
4277
|
}
|
|
4250
4278
|
function Xl({ className: e, ...t }) {
|
|
4251
4279
|
return /* @__PURE__ */ n(
|
|
@@ -4253,16 +4281,16 @@ function Xl({ className: e, ...t }) {
|
|
|
4253
4281
|
{
|
|
4254
4282
|
"data-slot": "sidebar-content",
|
|
4255
4283
|
"data-sidebar": "content",
|
|
4256
|
-
className:
|
|
4284
|
+
className: x("flex min-h-0 flex-1 flex-col gap-2 overflow-auto", e),
|
|
4257
4285
|
...t
|
|
4258
4286
|
}
|
|
4259
4287
|
);
|
|
4260
4288
|
}
|
|
4261
4289
|
function gt({ className: e, ...t }) {
|
|
4262
|
-
return /* @__PURE__ */ n("ul", { "data-slot": "sidebar-menu", "data-sidebar": "menu", className:
|
|
4290
|
+
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 });
|
|
4263
4291
|
}
|
|
4264
4292
|
function Jt({ className: e, ...t }) {
|
|
4265
|
-
return /* @__PURE__ */ n("li", { "data-slot": "sidebar-menu-item", "data-sidebar": "menu-item", className:
|
|
4293
|
+
return /* @__PURE__ */ n("li", { "data-slot": "sidebar-menu-item", "data-sidebar": "menu-item", className: x("group/menu-item relative", e), ...t });
|
|
4266
4294
|
}
|
|
4267
4295
|
function Zt({
|
|
4268
4296
|
asChild: e = !1,
|
|
@@ -4274,7 +4302,7 @@ function Zt({
|
|
|
4274
4302
|
{
|
|
4275
4303
|
"data-slot": "sidebar-menu-button",
|
|
4276
4304
|
"data-sidebar": "menu-button",
|
|
4277
|
-
className:
|
|
4305
|
+
className: x(
|
|
4278
4306
|
"peer/menu-button flex h-8 w-full items-center gap-2 overflow-hidden rounded-md p-2 text-start text-sm outline-hidden ring-sidebar-ring transition-colors hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
|
|
4279
4307
|
t
|
|
4280
4308
|
),
|
|
@@ -4283,22 +4311,22 @@ function Zt({
|
|
|
4283
4311
|
);
|
|
4284
4312
|
}
|
|
4285
4313
|
function Yl({ open: e, onOpenChange: t, onRemove: s }) {
|
|
4286
|
-
const { t: r } =
|
|
4314
|
+
const { t: r } = k(["sidebar", "errors"]), a = async () => {
|
|
4287
4315
|
t(!1);
|
|
4288
4316
|
try {
|
|
4289
4317
|
await s();
|
|
4290
4318
|
} catch {
|
|
4291
|
-
|
|
4319
|
+
B.error(r("errors:thread_delete_failed"));
|
|
4292
4320
|
return;
|
|
4293
4321
|
}
|
|
4294
|
-
|
|
4322
|
+
B.success(r("chat_deleted_success"));
|
|
4295
4323
|
};
|
|
4296
|
-
return /* @__PURE__ */ n(qe, { open: e, onOpenChange: t, children: /* @__PURE__ */
|
|
4297
|
-
/* @__PURE__ */
|
|
4324
|
+
return /* @__PURE__ */ n(qe, { open: e, onOpenChange: t, children: /* @__PURE__ */ d(Mt, { children: [
|
|
4325
|
+
/* @__PURE__ */ d(Kn, { children: [
|
|
4298
4326
|
/* @__PURE__ */ n(Xn, { children: r("delete_confirm_title") }),
|
|
4299
4327
|
/* @__PURE__ */ n(Ta, { children: r("delete_confirm_description") })
|
|
4300
4328
|
] }),
|
|
4301
|
-
/* @__PURE__ */
|
|
4329
|
+
/* @__PURE__ */ d(Ma, { children: [
|
|
4302
4330
|
/* @__PURE__ */ n(E, { variant: "outline", onClick: () => t(!1), children: r("cancel") }),
|
|
4303
4331
|
/* @__PURE__ */ n(E, { variant: "destructive", onClick: () => {
|
|
4304
4332
|
a();
|
|
@@ -4321,14 +4349,14 @@ function Qs({
|
|
|
4321
4349
|
onShare: o,
|
|
4322
4350
|
onUnshare: i,
|
|
4323
4351
|
onRename: l,
|
|
4324
|
-
onRemove:
|
|
4325
|
-
triggerClassName:
|
|
4352
|
+
onRemove: c,
|
|
4353
|
+
triggerClassName: u
|
|
4326
4354
|
}) {
|
|
4327
|
-
const { t: p } =
|
|
4355
|
+
const { t: p } = k("sidebar"), { dir: m } = V(), [g, f] = C(!1), h = async (v, y, b, I) => {
|
|
4328
4356
|
try {
|
|
4329
|
-
await
|
|
4357
|
+
await v(), B.success(y, I ? { description: I } : void 0);
|
|
4330
4358
|
} catch {
|
|
4331
|
-
|
|
4359
|
+
B.error(b);
|
|
4332
4360
|
}
|
|
4333
4361
|
}, N = [
|
|
4334
4362
|
r.pin && {
|
|
@@ -4377,16 +4405,16 @@ function Qs({
|
|
|
4377
4405
|
onSelect: () => f(!0),
|
|
4378
4406
|
destructive: !0
|
|
4379
4407
|
}
|
|
4380
|
-
].filter((
|
|
4381
|
-
return N.length ? /* @__PURE__ */
|
|
4382
|
-
/* @__PURE__ */
|
|
4408
|
+
].filter((v) => !!v);
|
|
4409
|
+
return N.length ? /* @__PURE__ */ d($, { children: [
|
|
4410
|
+
/* @__PURE__ */ d(Pt, { dir: m, children: [
|
|
4383
4411
|
/* @__PURE__ */ n(Rt, { asChild: !0, children: /* @__PURE__ */ n(
|
|
4384
4412
|
E,
|
|
4385
4413
|
{
|
|
4386
4414
|
variant: "ghost",
|
|
4387
4415
|
size: "icon",
|
|
4388
4416
|
"aria-label": p("thread_actions", { title: e ?? p("new_conversation") }),
|
|
4389
|
-
className:
|
|
4417
|
+
className: u,
|
|
4390
4418
|
children: /* @__PURE__ */ n(Wr, { "aria-hidden": !0, className: "size-4" })
|
|
4391
4419
|
}
|
|
4392
4420
|
) }),
|
|
@@ -4395,10 +4423,10 @@ function Qs({
|
|
|
4395
4423
|
{
|
|
4396
4424
|
align: "end",
|
|
4397
4425
|
className: "min-w-44 rounded-2xl border-border/60 bg-popover p-1.5 shadow-xl",
|
|
4398
|
-
children: N.map(({ key:
|
|
4426
|
+
children: N.map(({ key: v, icon: y, label: b, onSelect: I, destructive: _ }) => /* @__PURE__ */ d(
|
|
4399
4427
|
we,
|
|
4400
4428
|
{
|
|
4401
|
-
variant:
|
|
4429
|
+
variant: _ ? "destructive" : "default",
|
|
4402
4430
|
onSelect: I,
|
|
4403
4431
|
className: Jl,
|
|
4404
4432
|
children: [
|
|
@@ -4406,12 +4434,12 @@ function Qs({
|
|
|
4406
4434
|
/* @__PURE__ */ n("span", { children: b })
|
|
4407
4435
|
]
|
|
4408
4436
|
},
|
|
4409
|
-
|
|
4437
|
+
v
|
|
4410
4438
|
))
|
|
4411
4439
|
}
|
|
4412
4440
|
)
|
|
4413
4441
|
] }),
|
|
4414
|
-
r.delete && /* @__PURE__ */ n(Yl, { open: g, onOpenChange: f, onRemove:
|
|
4442
|
+
r.delete && /* @__PURE__ */ n(Yl, { open: g, onOpenChange: f, onRemove: c })
|
|
4415
4443
|
] }) : null;
|
|
4416
4444
|
}
|
|
4417
4445
|
function Zl() {
|
|
@@ -4433,12 +4461,12 @@ function Zl() {
|
|
|
4433
4461
|
);
|
|
4434
4462
|
}
|
|
4435
4463
|
function ec() {
|
|
4436
|
-
const { t: e } =
|
|
4464
|
+
const { t: e } = k("sidebar"), t = Ct(), s = Y((h) => h.history), r = t?.threadId ?? null, a = {
|
|
4437
4465
|
pin: !!(s.enabled && s.showPin),
|
|
4438
4466
|
share: !!(s.enabled && s.showShare),
|
|
4439
4467
|
rename: !!(s.enabled && s.showRename),
|
|
4440
4468
|
delete: !!(s.enabled && s.showDelete)
|
|
4441
|
-
}, o = Object.values(a).some(Boolean), { threads: i, setPinned: l, share:
|
|
4469
|
+
}, o = Object.values(a).some(Boolean), { threads: i, setPinned: l, share: c, unshare: u, rename: p, remove: m } = da({
|
|
4442
4470
|
enabled: o
|
|
4443
4471
|
});
|
|
4444
4472
|
if (!r || !o) return null;
|
|
@@ -4446,9 +4474,9 @@ function ec() {
|
|
|
4446
4474
|
const h = window.prompt(e("rename_label"), g?.title ?? "")?.trim();
|
|
4447
4475
|
if (!(!h || h === g?.title))
|
|
4448
4476
|
try {
|
|
4449
|
-
await p(r, h),
|
|
4477
|
+
await p(r, h), B.success(e("rename_success"));
|
|
4450
4478
|
} catch {
|
|
4451
|
-
|
|
4479
|
+
B.error(e("rename_failed"));
|
|
4452
4480
|
}
|
|
4453
4481
|
};
|
|
4454
4482
|
return /* @__PURE__ */ n(
|
|
@@ -4459,8 +4487,8 @@ function ec() {
|
|
|
4459
4487
|
shared: !!g?.shared,
|
|
4460
4488
|
offered: a,
|
|
4461
4489
|
onPin: (h) => l(r, h),
|
|
4462
|
-
onShare: () =>
|
|
4463
|
-
onUnshare: () =>
|
|
4490
|
+
onShare: () => c(r),
|
|
4491
|
+
onUnshare: () => u(r),
|
|
4464
4492
|
onRename: () => {
|
|
4465
4493
|
f();
|
|
4466
4494
|
},
|
|
@@ -4470,23 +4498,23 @@ function ec() {
|
|
|
4470
4498
|
);
|
|
4471
4499
|
}
|
|
4472
4500
|
function bt({ iconOnly: e = !1 }) {
|
|
4473
|
-
const t =
|
|
4474
|
-
return /* @__PURE__ */
|
|
4501
|
+
const t = K((o) => o.app), { resolvedTheme: s } = Ce(), r = t?.logo ? typeof t.logo == "string" ? t.logo : s === "dark" ? t.logo.dark : t.logo.light : Pa, a = t?.name || "Gentiq";
|
|
4502
|
+
return /* @__PURE__ */ d("div", { className: x("flex items-center gap-2 select-none min-w-0", !e && "ps-1"), children: [
|
|
4475
4503
|
/* @__PURE__ */ n("img", { src: r, alt: a, className: "size-6 shrink-0 object-contain" }),
|
|
4476
4504
|
!e && /* @__PURE__ */ n("span", { className: "truncate text-base font-medium tracking-tight text-foreground", children: a })
|
|
4477
4505
|
] });
|
|
4478
4506
|
}
|
|
4479
4507
|
function Ks({ hideActions: e = !1 }) {
|
|
4480
|
-
const t = Ct(), s = ze(), r = Vs(), { t: a } =
|
|
4481
|
-
() => (
|
|
4482
|
-
(
|
|
4508
|
+
const t = Ct(), s = ze(), r = Vs(), { t: a } = k(["sidebar"]), o = K((v) => v.app), { history: i, headerActionsEnabled: l } = Y((v) => v), { HeaderActions: c, headerActions: u, UsageMeter: p } = X(), m = O(
|
|
4509
|
+
() => (u ?? []).filter(
|
|
4510
|
+
(v) => l?.[v.id] ?? v.defaultEnabled ?? !0
|
|
4483
4511
|
),
|
|
4484
|
-
[
|
|
4512
|
+
[u, l]
|
|
4485
4513
|
), g = Qt(), f = !e && (i?.enabled ?? !0), h = f && r !== null;
|
|
4486
|
-
return /* @__PURE__ */
|
|
4487
|
-
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 min-w-9", children: (e || g || !h) && /* @__PURE__ */
|
|
4514
|
+
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
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 min-w-9", children: (e || g || !h) && /* @__PURE__ */ d($, { children: [
|
|
4488
4516
|
h && /* @__PURE__ */ n(Gs, { className: "hover:bg-accent/60 transition-colors rounded-full size-9 text-muted-foreground hover:text-foreground" }),
|
|
4489
|
-
!e && /* @__PURE__ */
|
|
4517
|
+
!e && /* @__PURE__ */ d(Ye, { children: [
|
|
4490
4518
|
/* @__PURE__ */ n(Je, { asChild: !0, children: /* @__PURE__ */ n(
|
|
4491
4519
|
"button",
|
|
4492
4520
|
{
|
|
@@ -4503,9 +4531,9 @@ function Ks({ hideActions: e = !1 }) {
|
|
|
4503
4531
|
] }),
|
|
4504
4532
|
!h && /* @__PURE__ */ n(bt, {})
|
|
4505
4533
|
] }) }),
|
|
4506
|
-
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 min-w-9 justify-end", children: !e && /* @__PURE__ */
|
|
4507
|
-
|
|
4508
|
-
m.map(({ id:
|
|
4534
|
+
/* @__PURE__ */ n("div", { className: "flex items-center gap-1.5 min-w-9 justify-end", children: !e && /* @__PURE__ */ d($, { children: [
|
|
4535
|
+
c && /* @__PURE__ */ n(c, { isMobile: g }),
|
|
4536
|
+
m.map(({ id: v, component: y }) => /* @__PURE__ */ n(y, { isMobile: g }, v)),
|
|
4509
4537
|
o?.showUsageBar && /* @__PURE__ */ n(p, { details: o.showUsageDetails ?? !0, isMobile: g }),
|
|
4510
4538
|
f && /* @__PURE__ */ n(ec, {}),
|
|
4511
4539
|
!f && o?.showSettings !== !1 && /* @__PURE__ */ n(Hs, { side: "bottom", align: "end" })
|
|
@@ -4513,12 +4541,12 @@ function Ks({ hideActions: e = !1 }) {
|
|
|
4513
4541
|
] });
|
|
4514
4542
|
}
|
|
4515
4543
|
function tc(e) {
|
|
4516
|
-
return /* @__PURE__ */ n(
|
|
4544
|
+
return /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(nc, { ...e }) });
|
|
4517
4545
|
}
|
|
4518
4546
|
function nc({ shareId: e }) {
|
|
4519
4547
|
const [t, s] = C(
|
|
4520
4548
|
null
|
|
4521
|
-
), [r, a] = C(!0), [o, i] = C(null), { t: l } =
|
|
4549
|
+
), [r, a] = C(!0), [o, i] = C(null), { t: l } = k(["chat", "errors"]), { MessageList: c } = X(), u = Xe(), p = U(/* @__PURE__ */ new Set());
|
|
4522
4550
|
return D(() => {
|
|
4523
4551
|
if (!e) return;
|
|
4524
4552
|
let m = !1;
|
|
@@ -4526,12 +4554,12 @@ function nc({ shareId: e }) {
|
|
|
4526
4554
|
return (async () => {
|
|
4527
4555
|
try {
|
|
4528
4556
|
a(!0);
|
|
4529
|
-
const f = await
|
|
4557
|
+
const f = await u.getSharedThread(e), h = await ja(
|
|
4530
4558
|
Fa(f.items),
|
|
4531
4559
|
async (N) => {
|
|
4532
4560
|
try {
|
|
4533
|
-
const
|
|
4534
|
-
return g.add(
|
|
4561
|
+
const v = await u.getPublicAttachmentBlobUrl(e, N);
|
|
4562
|
+
return g.add(v), v;
|
|
4535
4563
|
} catch {
|
|
4536
4564
|
return "";
|
|
4537
4565
|
}
|
|
@@ -4546,25 +4574,25 @@ function nc({ shareId: e }) {
|
|
|
4546
4574
|
})(), () => {
|
|
4547
4575
|
m = !0, g.forEach((f) => URL.revokeObjectURL(f)), g.clear();
|
|
4548
4576
|
};
|
|
4549
|
-
}, [e,
|
|
4577
|
+
}, [e, u]), r ? /* @__PURE__ */ n("div", { className: "flex h-dvh items-center justify-center bg-background", children: /* @__PURE__ */ n(Ue, {}) }) : t ? /* @__PURE__ */ d("div", { className: "relative flex flex-col h-dvh overflow-hidden bg-background", children: [
|
|
4550
4578
|
/* @__PURE__ */ n(Ks, { hideActions: !0 }),
|
|
4551
|
-
/* @__PURE__ */ n("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ n(Ae.Root, { readonly: !0, children: /* @__PURE__ */ n(De.Root, { messages: t.messages, className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ n(
|
|
4552
|
-
] }) : /* @__PURE__ */
|
|
4579
|
+
/* @__PURE__ */ n("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ n(Ae.Root, { readonly: !0, children: /* @__PURE__ */ n(De.Root, { messages: t.messages, className: "flex min-h-0 flex-1 flex-col", children: /* @__PURE__ */ n(c, { className: "pb-8" }) }) }) })
|
|
4580
|
+
] }) : /* @__PURE__ */ d("div", { className: "flex h-dvh flex-col items-center justify-center p-4 text-center bg-background", children: [
|
|
4553
4581
|
/* @__PURE__ */ n("h1", { className: "text-2xl font-bold text-destructive mb-2 font-display", children: l("shared_not_found_title") }),
|
|
4554
4582
|
/* @__PURE__ */ n("p", { className: "text-muted-foreground max-w-md", children: qt(o) ? fe(o, l) : l("shared_not_found_description") })
|
|
4555
4583
|
] });
|
|
4556
4584
|
}
|
|
4557
4585
|
function sc() {
|
|
4558
|
-
const { t: e } =
|
|
4586
|
+
const { t: e } = k("sidebar"), { state: t, isMobile: s, setOpenMobile: r } = rt(), a = ze(), o = !s && t === "collapsed";
|
|
4559
4587
|
return /* @__PURE__ */ n(gt, { className: o ? "mt-1 flex items-center" : "mt-1 mb-4 px-2", children: /* @__PURE__ */ n(Jt, { children: /* @__PURE__ */ n(
|
|
4560
4588
|
Zt,
|
|
4561
4589
|
{
|
|
4562
4590
|
asChild: !0,
|
|
4563
|
-
className:
|
|
4591
|
+
className: x(
|
|
4564
4592
|
"rounded-full transition-colors duration-200 group/new-chat",
|
|
4565
4593
|
o ? "size-9 justify-center p-0 bg-sidebar-accent/60 text-sidebar-foreground hover:bg-sidebar-accent" : "h-10 bg-transparent text-sidebar-foreground/85 hover:bg-sidebar-accent/70 hover:text-sidebar-foreground active:bg-sidebar-accent aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-semibold aria-[current=page]:text-sidebar-accent-foreground"
|
|
4566
4594
|
),
|
|
4567
|
-
children: /* @__PURE__ */
|
|
4595
|
+
children: /* @__PURE__ */ d(
|
|
4568
4596
|
se.New,
|
|
4569
4597
|
{
|
|
4570
4598
|
"aria-label": o ? e("new_conversation") : void 0,
|
|
@@ -4588,8 +4616,8 @@ function sc() {
|
|
|
4588
4616
|
) }) });
|
|
4589
4617
|
}
|
|
4590
4618
|
function rc() {
|
|
4591
|
-
const { t: e } =
|
|
4592
|
-
return /* @__PURE__ */ n(se.LoadMore, { className: "group/more min-h-4 w-full", children: /* @__PURE__ */
|
|
4619
|
+
const { t: e } = k("sidebar");
|
|
4620
|
+
return /* @__PURE__ */ n(se.LoadMore, { className: "group/more min-h-4 w-full", children: /* @__PURE__ */ d(
|
|
4593
4621
|
"div",
|
|
4594
4622
|
{
|
|
4595
4623
|
role: "status",
|
|
@@ -4608,12 +4636,12 @@ function rc() {
|
|
|
4608
4636
|
) });
|
|
4609
4637
|
}
|
|
4610
4638
|
function ac() {
|
|
4611
|
-
const { t: e } =
|
|
4612
|
-
return /* @__PURE__ */
|
|
4639
|
+
const { t: e } = k("sidebar");
|
|
4640
|
+
return /* @__PURE__ */ d(
|
|
4613
4641
|
$e.Root,
|
|
4614
4642
|
{
|
|
4615
|
-
onRenamed: () =>
|
|
4616
|
-
onRenameFailed: () =>
|
|
4643
|
+
onRenamed: () => B.success(e("rename_success")),
|
|
4644
|
+
onRenameFailed: () => B.error(e("rename_failed")),
|
|
4617
4645
|
className: "flex items-center gap-1 px-2 py-1.5 w-full",
|
|
4618
4646
|
children: [
|
|
4619
4647
|
/* @__PURE__ */ n(
|
|
@@ -4650,14 +4678,14 @@ function ac() {
|
|
|
4650
4678
|
);
|
|
4651
4679
|
}
|
|
4652
4680
|
function oc() {
|
|
4653
|
-
const { t: e } =
|
|
4654
|
-
return /* @__PURE__ */ n(se.Item, { asChild: !0, children: /* @__PURE__ */ n(Jt, { className: "group/sidebar-menu-item relative", children: a ? /* @__PURE__ */ n(ac, {}) : /* @__PURE__ */
|
|
4681
|
+
const { t: e } = k("sidebar"), { isMobile: t, setOpenMobile: s } = rt(), { thread: r, isRenaming: a } = Wn(), o = ze();
|
|
4682
|
+
return /* @__PURE__ */ n(se.Item, { asChild: !0, children: /* @__PURE__ */ n(Jt, { className: "group/sidebar-menu-item relative", children: a ? /* @__PURE__ */ n(ac, {}) : /* @__PURE__ */ d($, { children: [
|
|
4655
4683
|
/* @__PURE__ */ n(
|
|
4656
4684
|
Zt,
|
|
4657
4685
|
{
|
|
4658
4686
|
asChild: !0,
|
|
4659
4687
|
className: "h-auto rounded-full py-2 px-3.5 text-sidebar-foreground/80 hover:bg-sidebar-accent/60 hover:text-sidebar-foreground aria-[current=page]:bg-sidebar-accent aria-[current=page]:font-semibold aria-[current=page]:text-sidebar-accent-foreground aria-busy:thread-streaming transition-colors",
|
|
4660
|
-
children: /* @__PURE__ */
|
|
4688
|
+
children: /* @__PURE__ */ d(
|
|
4661
4689
|
se.ItemTrigger,
|
|
4662
4690
|
{
|
|
4663
4691
|
onOpen: () => {
|
|
@@ -4678,8 +4706,8 @@ function oc() {
|
|
|
4678
4706
|
)
|
|
4679
4707
|
}
|
|
4680
4708
|
),
|
|
4681
|
-
/* @__PURE__ */
|
|
4682
|
-
r.pinned && /* @__PURE__ */
|
|
4709
|
+
/* @__PURE__ */ d("div", { className: "absolute top-1/2 -translate-y-1/2 end-1.5 flex items-center gap-1 z-10", children: [
|
|
4710
|
+
r.pinned && /* @__PURE__ */ d("span", { className: "md:absolute md:inset-0 md:m-auto md:size-3.5 md:group-hover/sidebar-menu-item:opacity-0 md:group-focus-within/sidebar-menu-item:opacity-0 transition-opacity pointer-events-none", children: [
|
|
4683
4711
|
/* @__PURE__ */ n(Dn, { "aria-hidden": !0, className: "size-3.5 text-primary opacity-70" }),
|
|
4684
4712
|
/* @__PURE__ */ n("span", { className: "sr-only", children: e("pinned") })
|
|
4685
4713
|
] }),
|
|
@@ -4688,8 +4716,8 @@ function oc() {
|
|
|
4688
4716
|
] }) }) });
|
|
4689
4717
|
}
|
|
4690
4718
|
function ic({ autoFocus: e, onClose: t } = {}) {
|
|
4691
|
-
const { t: s } =
|
|
4692
|
-
return /* @__PURE__ */
|
|
4719
|
+
const { t: s } = k(["sidebar", "common"]);
|
|
4720
|
+
return /* @__PURE__ */ d("div", { className: "relative group/search", children: [
|
|
4693
4721
|
/* @__PURE__ */ n(
|
|
4694
4722
|
En,
|
|
4695
4723
|
{
|
|
@@ -4723,10 +4751,10 @@ function ic({ autoFocus: e, onClose: t } = {}) {
|
|
|
4723
4751
|
}
|
|
4724
4752
|
const _n = "rounded-full text-muted-foreground hover:bg-sidebar-accent hover:text-sidebar-foreground transition-colors";
|
|
4725
4753
|
function lc({ side: e = "start" }) {
|
|
4726
|
-
const { t } =
|
|
4727
|
-
() => ({ pin:
|
|
4728
|
-
[
|
|
4729
|
-
), f = r?.activeSection != null, h = !a?.isMobile && a?.state === "collapsed", N = () => a?.isMobile && a.setOpenMobile(!1),
|
|
4754
|
+
const { t } = k(["sidebar", "settings"]), s = Y((y) => y.history), r = ze(), a = Vs(), { groups: o } = Xt(), [i, l] = C(!1), { showPin: c, showShare: u, showRename: p, showDelete: m } = s, g = O(
|
|
4755
|
+
() => ({ pin: c, share: u, rename: p, delete: m }),
|
|
4756
|
+
[c, u, p, m]
|
|
4757
|
+
), f = r?.activeSection != null, h = !a?.isMobile && a?.state === "collapsed", N = () => a?.isMobile && a.setOpenMobile(!1), v = !f && s.enabled && /* @__PURE__ */ n(
|
|
4730
4758
|
E,
|
|
4731
4759
|
{
|
|
4732
4760
|
type: "button",
|
|
@@ -4737,7 +4765,7 @@ function lc({ side: e = "start" }) {
|
|
|
4737
4765
|
onClick: () => {
|
|
4738
4766
|
h ? (a?.setOpen(!0), l(!0)) : l((y) => !y);
|
|
4739
4767
|
},
|
|
4740
|
-
className:
|
|
4768
|
+
className: x(
|
|
4741
4769
|
h ? "size-9" : "size-8",
|
|
4742
4770
|
_n,
|
|
4743
4771
|
!h && i && "bg-sidebar-accent text-sidebar-foreground"
|
|
@@ -4751,11 +4779,11 @@ function lc({ side: e = "start" }) {
|
|
|
4751
4779
|
collapsible: "icon",
|
|
4752
4780
|
side: e,
|
|
4753
4781
|
className: "bg-sidebar text-sidebar-foreground border-none select-none",
|
|
4754
|
-
children: /* @__PURE__ */
|
|
4755
|
-
/* @__PURE__ */
|
|
4782
|
+
children: /* @__PURE__ */ d(se.Root, { enabled: s.enabled, className: "flex flex-1 min-h-0 flex-col", children: [
|
|
4783
|
+
/* @__PURE__ */ d(
|
|
4756
4784
|
Ql,
|
|
4757
4785
|
{
|
|
4758
|
-
className:
|
|
4786
|
+
className: x("pt-3 pb-1 gap-2.5", h ? "px-2 items-center" : "px-3"),
|
|
4759
4787
|
children: [
|
|
4760
4788
|
h ? /* @__PURE__ */ n(
|
|
4761
4789
|
E,
|
|
@@ -4768,14 +4796,14 @@ function lc({ side: e = "start" }) {
|
|
|
4768
4796
|
className: "size-9 rounded-full hover:bg-sidebar-accent",
|
|
4769
4797
|
children: /* @__PURE__ */ n(bt, { iconOnly: !0 })
|
|
4770
4798
|
}
|
|
4771
|
-
) : /* @__PURE__ */
|
|
4799
|
+
) : /* @__PURE__ */ d("div", { className: "flex items-center justify-between gap-2 px-1", children: [
|
|
4772
4800
|
/* @__PURE__ */ n(bt, {}),
|
|
4773
|
-
/* @__PURE__ */
|
|
4774
|
-
|
|
4775
|
-
/* @__PURE__ */ n(Gs, { className:
|
|
4801
|
+
/* @__PURE__ */ d("div", { className: "flex items-center gap-0.5 shrink-0", children: [
|
|
4802
|
+
v,
|
|
4803
|
+
/* @__PURE__ */ n(Gs, { className: x("size-8", _n) })
|
|
4776
4804
|
] })
|
|
4777
4805
|
] }),
|
|
4778
|
-
f ? /* @__PURE__ */
|
|
4806
|
+
f ? /* @__PURE__ */ d(
|
|
4779
4807
|
E,
|
|
4780
4808
|
{
|
|
4781
4809
|
type: "button",
|
|
@@ -4785,7 +4813,7 @@ function lc({ side: e = "start" }) {
|
|
|
4785
4813
|
onClick: () => {
|
|
4786
4814
|
r.close(), N();
|
|
4787
4815
|
},
|
|
4788
|
-
className:
|
|
4816
|
+
className: x(
|
|
4789
4817
|
"rounded-full text-sm font-medium text-sidebar-foreground hover:bg-sidebar-accent transition-colors",
|
|
4790
4818
|
h ? "size-9 justify-center" : "w-full justify-start gap-2.5 px-3 h-10"
|
|
4791
4819
|
),
|
|
@@ -4794,9 +4822,9 @@ function lc({ side: e = "start" }) {
|
|
|
4794
4822
|
!h && /* @__PURE__ */ n("span", { className: "truncate", children: t("settings:back_to_chat") })
|
|
4795
4823
|
]
|
|
4796
4824
|
}
|
|
4797
|
-
) : /* @__PURE__ */
|
|
4825
|
+
) : /* @__PURE__ */ d($, { children: [
|
|
4798
4826
|
/* @__PURE__ */ n(sc, {}),
|
|
4799
|
-
h &&
|
|
4827
|
+
h && v,
|
|
4800
4828
|
!h && s.enabled && i && /* @__PURE__ */ n(ic, { autoFocus: !0, onClose: () => l(!1) })
|
|
4801
4829
|
] })
|
|
4802
4830
|
]
|
|
@@ -4805,10 +4833,10 @@ function lc({ side: e = "start" }) {
|
|
|
4805
4833
|
/* @__PURE__ */ n(
|
|
4806
4834
|
Xl,
|
|
4807
4835
|
{
|
|
4808
|
-
className:
|
|
4809
|
-
children: f ? o.map((y) => /* @__PURE__ */
|
|
4836
|
+
className: x("py-2 custom-scrollbar", h ? "px-2 items-center" : "px-3"),
|
|
4837
|
+
children: f ? o.map((y) => /* @__PURE__ */ d("div", { className: "mb-3 last:mb-0", children: [
|
|
4810
4838
|
!h && /* @__PURE__ */ n("div", { className: "px-3 pb-1 pt-2 text-xs font-medium text-muted-foreground", children: y.title }),
|
|
4811
|
-
/* @__PURE__ */ n(gt, { className:
|
|
4839
|
+
/* @__PURE__ */ n(gt, { className: x("gap-0.5", h && "items-center"), children: y.items.map((b) => /* @__PURE__ */ n(Jt, { children: /* @__PURE__ */ d(
|
|
4812
4840
|
Zt,
|
|
4813
4841
|
{
|
|
4814
4842
|
type: "button",
|
|
@@ -4818,7 +4846,7 @@ function lc({ side: e = "start" }) {
|
|
|
4818
4846
|
onClick: () => {
|
|
4819
4847
|
r.openSection(b.id), N();
|
|
4820
4848
|
},
|
|
4821
|
-
className:
|
|
4849
|
+
className: x(
|
|
4822
4850
|
"rounded-full font-medium text-sidebar-foreground/85 hover:bg-sidebar-accent/60 data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
4823
4851
|
h ? "size-9 justify-center p-0" : "h-auto gap-2.5 px-3 py-2"
|
|
4824
4852
|
),
|
|
@@ -4828,7 +4856,7 @@ function lc({ side: e = "start" }) {
|
|
|
4828
4856
|
]
|
|
4829
4857
|
}
|
|
4830
4858
|
) }, b.id)) })
|
|
4831
|
-
] }, y.title)) : !h && s.enabled && /* @__PURE__ */
|
|
4859
|
+
] }, y.title)) : !h && s.enabled && /* @__PURE__ */ d(Ws.Provider, { value: g, children: [
|
|
4832
4860
|
/* @__PURE__ */ n(gt, { className: "gap-0.5", children: /* @__PURE__ */ n(se.Items, { component: oc }) }),
|
|
4833
4861
|
/* @__PURE__ */ n(se.Empty, { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: t("no_conversations") }),
|
|
4834
4862
|
/* @__PURE__ */ n(rc, {})
|
|
@@ -4841,11 +4869,11 @@ function lc({ side: e = "start" }) {
|
|
|
4841
4869
|
);
|
|
4842
4870
|
}
|
|
4843
4871
|
function cc({ collapsed: e }) {
|
|
4844
|
-
const t =
|
|
4845
|
-
return (!s || e) && !o ? null : /* @__PURE__ */
|
|
4872
|
+
const t = K((i) => i.app), { displayName: s, initial: r, planLabel: a } = qs(), o = t?.showSettings !== !1;
|
|
4873
|
+
return (!s || e) && !o ? null : /* @__PURE__ */ d(
|
|
4846
4874
|
"div",
|
|
4847
4875
|
{
|
|
4848
|
-
className:
|
|
4876
|
+
className: x(
|
|
4849
4877
|
"flex items-center py-2.5 mt-auto",
|
|
4850
4878
|
e ? "justify-center" : "justify-between gap-2 px-3"
|
|
4851
4879
|
),
|
|
@@ -4868,7 +4896,7 @@ function uc({
|
|
|
4868
4896
|
header: o,
|
|
4869
4897
|
classNames: i
|
|
4870
4898
|
}) {
|
|
4871
|
-
const l =
|
|
4899
|
+
const l = Y((v) => v.history.enabled), { MaintenanceBanner: c, MaintenanceScreen: u } = X(), [p, m] = C(null), g = U(null), f = O(
|
|
4872
4900
|
() => ({
|
|
4873
4901
|
activeSection: p,
|
|
4874
4902
|
openSection: m,
|
|
@@ -4884,18 +4912,18 @@ function uc({
|
|
|
4884
4912
|
blocksChat: h.blocksChat,
|
|
4885
4913
|
refresh: h.refresh
|
|
4886
4914
|
} : null;
|
|
4887
|
-
return N && h.display === "fullscreen" &&
|
|
4915
|
+
return N && h.display === "fullscreen" && u ? /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(u, { ...N }) }) : /* @__PURE__ */ n(ue, { children: /* @__PURE__ */ n(
|
|
4888
4916
|
Vn,
|
|
4889
4917
|
{
|
|
4890
4918
|
threadId: e,
|
|
4891
4919
|
onThreadChange: t,
|
|
4892
4920
|
getThreadHref: s,
|
|
4893
4921
|
getShareHref: r,
|
|
4894
|
-
children: /* @__PURE__ */ n(Ls.Provider, { value: f, children: /* @__PURE__ */
|
|
4922
|
+
children: /* @__PURE__ */ n(Ls.Provider, { value: f, children: /* @__PURE__ */ d(Gl, { defaultOpen: l, className: "bg-background", children: [
|
|
4895
4923
|
a !== void 0 ? a : l || p !== null ? /* @__PURE__ */ n(lc, {}) : null,
|
|
4896
|
-
/* @__PURE__ */
|
|
4924
|
+
/* @__PURE__ */ d("div", { className: "flex flex-col flex-1 h-dvh overflow-hidden relative bg-background", children: [
|
|
4897
4925
|
o !== void 0 ? o : /* @__PURE__ */ n(Ks, {}),
|
|
4898
|
-
N &&
|
|
4926
|
+
N && c && /* @__PURE__ */ n(c, { ...N }),
|
|
4899
4927
|
/* @__PURE__ */ n("div", { className: "flex flex-col relative w-full flex-1 min-h-0 overflow-hidden", children: p !== null ? /* @__PURE__ */ n(Bl, {}) : /* @__PURE__ */ n(Tl, { classNames: i }) })
|
|
4900
4928
|
] })
|
|
4901
4929
|
] }) })
|
|
@@ -4972,14 +5000,14 @@ function qc({
|
|
|
4972
5000
|
components: o,
|
|
4973
5001
|
history: i,
|
|
4974
5002
|
welcome: l,
|
|
4975
|
-
threadActions:
|
|
4976
|
-
composer:
|
|
5003
|
+
threadActions: c,
|
|
5004
|
+
composer: u,
|
|
4977
5005
|
disclaimer: p,
|
|
4978
5006
|
settings: m,
|
|
4979
5007
|
...g
|
|
4980
5008
|
}) {
|
|
4981
5009
|
const f = fc();
|
|
4982
|
-
return f ? /* @__PURE__ */
|
|
5010
|
+
return f ? /* @__PURE__ */ d(Ol, { ...g, api: { ...t, basePath: e }, children: [
|
|
4983
5011
|
/* @__PURE__ */ n(El, {}),
|
|
4984
5012
|
/* @__PURE__ */ n(
|
|
4985
5013
|
Kt,
|
|
@@ -4987,8 +5015,8 @@ function qc({
|
|
|
4987
5015
|
components: o,
|
|
4988
5016
|
history: i,
|
|
4989
5017
|
welcome: l,
|
|
4990
|
-
threadActions:
|
|
4991
|
-
composer:
|
|
5018
|
+
threadActions: c,
|
|
5019
|
+
composer: u,
|
|
4992
5020
|
disclaimer: p,
|
|
4993
5021
|
settings: m,
|
|
4994
5022
|
children: /* @__PURE__ */ n(vc, { location: f, paths: bc(s, r), admin: a })
|
|
@@ -5000,8 +5028,8 @@ function vc({ location: e, paths: t, admin: s }) {
|
|
|
5000
5028
|
const r = xc(e.pathname, t), a = ct(null, t);
|
|
5001
5029
|
if (r.name === "admin" && s) return /* @__PURE__ */ n(Ve, { fallback: null, children: s });
|
|
5002
5030
|
if (r.name === "login") {
|
|
5003
|
-
const { reason:
|
|
5004
|
-
return /* @__PURE__ */ n(Hl, { reason:
|
|
5031
|
+
const { reason: u, from: p } = Nc(e.state);
|
|
5032
|
+
return /* @__PURE__ */ n(Hl, { reason: u, onSignedIn: () => He(p ?? a, { replace: !0 }) });
|
|
5005
5033
|
}
|
|
5006
5034
|
if (r.name === "shared") return /* @__PURE__ */ n(tc, { shareId: r.shareId });
|
|
5007
5035
|
const o = r.name === "chat" ? r.threadId : null, i = new URLSearchParams(e.search), l = i.get("code");
|
|
@@ -5011,17 +5039,17 @@ function vc({ location: e, paths: t, admin: s }) {
|
|
|
5011
5039
|
loginCode: l,
|
|
5012
5040
|
onLoginCodeUsed: () => {
|
|
5013
5041
|
i.delete("code");
|
|
5014
|
-
const
|
|
5015
|
-
He(e.pathname + (
|
|
5042
|
+
const u = i.toString();
|
|
5043
|
+
He(e.pathname + (u ? `?${u}` : "") + e.hash, { replace: !0 });
|
|
5016
5044
|
},
|
|
5017
|
-
fallback: (
|
|
5045
|
+
fallback: (u) => /* @__PURE__ */ n(kc, { to: t.login, reason: u, from: e.pathname + e.search }),
|
|
5018
5046
|
children: /* @__PURE__ */ n(
|
|
5019
5047
|
dc,
|
|
5020
5048
|
{
|
|
5021
5049
|
threadId: o,
|
|
5022
|
-
onThreadChange: (
|
|
5023
|
-
getThreadHref: (
|
|
5024
|
-
getShareHref: (
|
|
5050
|
+
onThreadChange: (u) => He(ct(u, t)),
|
|
5051
|
+
getThreadHref: (u) => ct(u, t),
|
|
5052
|
+
getShareHref: (u) => `${t.shared}/${encodeURIComponent(u)}`
|
|
5025
5053
|
}
|
|
5026
5054
|
)
|
|
5027
5055
|
}
|
|
@@ -5051,7 +5079,7 @@ function kc({ to: e, reason: t, from: s }) {
|
|
|
5051
5079
|
}
|
|
5052
5080
|
export {
|
|
5053
5081
|
lc as A,
|
|
5054
|
-
|
|
5082
|
+
Y as B,
|
|
5055
5083
|
Tl as C,
|
|
5056
5084
|
El as D,
|
|
5057
5085
|
fs as E,
|
|
@@ -5075,7 +5103,7 @@ export {
|
|
|
5075
5103
|
$l as g,
|
|
5076
5104
|
ul as h,
|
|
5077
5105
|
Ol as i,
|
|
5078
|
-
|
|
5106
|
+
ue as j,
|
|
5079
5107
|
Kt as k,
|
|
5080
5108
|
xl as l,
|
|
5081
5109
|
Di as m,
|