gentiq 0.10.0 → 0.10.2
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/README.md +42 -0
- package/dist/{checkbox-BuMyz6YI.js → checkbox-Bk6TjhJn.js} +1562 -1569
- package/dist/gentiq-admin.es.js +1016 -1010
- package/dist/gentiq-index.es.js +307 -286
- package/dist/gentiq.css +1 -1
- package/dist/src/admin/lib/recharge.d.ts +10 -0
- package/dist/src/components/MessageList.d.ts +1 -1
- package/dist/src/components/PromptInputArea.d.ts +3 -1
- package/dist/src/components/WelcomeScreen.d.ts +9 -2
- package/dist/src/hooks/useTypewriter.d.ts +20 -0
- package/dist/src/hooks/useWelcomeContent.d.ts +28 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/parts/ChoiceQuestionPart.d.ts +13 -0
- package/dist/src/types.d.ts +9 -11
- package/package.json +1 -1
package/dist/gentiq-index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as e, jsxs as s, Fragment as _e } from "react/jsx-runtime";
|
|
2
2
|
import * as se from "react";
|
|
3
|
-
import { useState as
|
|
3
|
+
import { useState as T, useMemo as W, useEffect as K, useRef as re, useCallback as ee, useLayoutEffect as et } from "react";
|
|
4
4
|
import { QueryClient as tt, QueryClientProvider as at, useQueryClient as he, useQuery as rt, useInfiniteQuery as nt } from "@tanstack/react-query";
|
|
5
5
|
import { I18nextProvider as st, useTranslation as ue } from "react-i18next";
|
|
6
6
|
import { Trans as or, Translation as ir, useTranslation as lr, withTranslation as cr } from "react-i18next";
|
|
7
|
-
import { G as be, g as ot, d as it, a as lt, C as je, T as ct, u as ne, b as Oe, c as oe, j as xe, e as ge, f as de, h as He, i as v, k as dt, l as Ue, m as Be, n as Ke, o as Qe, B as ae, p as Ve, q as ye, D as Ge, r as ut, s as We, L as X, I as Y, S as we, t as Ne, v as ke, w as Se, x as fe, y as ht, z as pt, A as Me, E as mt, F as gt, H as ft, J as pe, K as bt, M as yt, N as vt, O as xt, P as wt, Q as Nt } from "./checkbox-
|
|
8
|
-
import { R as ur, U as hr, V as pr, W as mr, X as gr, Y as fr, Z as br, _ as yr, $ as vr, a0 as xr, a1 as wr, a2 as Nr, a3 as kr, a4 as Sr, a5 as Cr, a6 as _r, a7 as Tr, a8 as Pr } from "./checkbox-
|
|
7
|
+
import { G as be, g as ot, d as it, a as lt, C as je, T as ct, u as ne, b as Oe, c as oe, j as xe, e as ge, f as de, h as He, i as v, k as dt, l as Ue, m as Be, n as Ke, o as Qe, B as ae, p as Ve, q as ye, D as Ge, r as ut, s as We, L as X, I as Y, S as we, t as Ne, v as ke, w as Se, x as fe, y as ht, z as pt, A as Me, E as mt, F as gt, H as ft, J as pe, K as bt, M as yt, N as vt, O as xt, P as wt, Q as Nt } from "./checkbox-Bk6TjhJn.js";
|
|
8
|
+
import { R as ur, U as hr, V as pr, W as mr, X as gr, Y as fr, Z as br, _ as yr, $ as vr, a0 as xr, a1 as wr, a2 as Nr, a3 as kr, a4 as Sr, a5 as Cr, a6 as _r, a7 as Tr, a8 as Pr, a9 as Er } from "./checkbox-Bk6TjhJn.js";
|
|
9
9
|
import { Loader2Icon as kt, OctagonXIcon as St, TriangleAlertIcon as Ct, InfoIcon as _t, CircleCheckIcon as Tt, XIcon as Pt, PanelLeftIcon as Et, Layers as Ae, User as Mt, ShieldCheck as At, Settings as Ce, Smartphone as It, Lock as Rt, Save as Dt, Sun as $t, Moon as Lt, Monitor as Ft, Zap as Ie, Globe as qt, Coins as zt, LogOut as jt, CirclePlus as Ot, Plus as Ht, Search as Ut, Check as Bt, X as Kt, Pin as Re, MoreVertical as Qt, PinOff as Vt, Share2 as Gt, Pencil as Wt, Trash as Jt } from "lucide-react";
|
|
10
10
|
import { useTheme as Xt } from "next-themes";
|
|
11
11
|
import { Toaster as Yt, toast as te } from "sonner";
|
|
@@ -321,13 +321,13 @@ function Za({
|
|
|
321
321
|
disclaimer: k,
|
|
322
322
|
settings: g
|
|
323
323
|
}) {
|
|
324
|
-
const [p, A] =
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
}, [
|
|
324
|
+
const [p, A] = T(null), P = W(() => o?.instance ?? ot, [o?.instance]), I = t || {}, [R] = T(() => la({ api: I }));
|
|
325
|
+
K(() => {
|
|
326
|
+
R.getAppConfig().then((w) => A(w)).catch((w) => console.debug("Gentiq: No dynamic settings available or fetch failed", w));
|
|
327
|
+
}, [R]), K(() => {
|
|
328
328
|
p?.app_name && (document.title = P.t(p.app_name));
|
|
329
329
|
}, [p, P]);
|
|
330
|
-
const
|
|
330
|
+
const E = W(() => {
|
|
331
331
|
const w = {
|
|
332
332
|
basePath: "/",
|
|
333
333
|
cacheNamespace: "gentiq",
|
|
@@ -347,7 +347,7 @@ function Za({
|
|
|
347
347
|
settingsProfileMode: p.settings_profile_mode || w.settingsProfileMode,
|
|
348
348
|
settingsAccountMode: p.settings_account_mode || w.settingsAccountMode
|
|
349
349
|
} : w;
|
|
350
|
-
}, [d, p, P]),
|
|
350
|
+
}, [d, p, P]), L = W(() => {
|
|
351
351
|
if (!p) return r;
|
|
352
352
|
const w = typeof r?.greeting == "function" ? r.greeting : p.welcome_greeting || r?.greeting;
|
|
353
353
|
return {
|
|
@@ -355,34 +355,34 @@ function Za({
|
|
|
355
355
|
greeting: w,
|
|
356
356
|
subtitle: p.welcome_subtitle || r?.subtitle
|
|
357
357
|
};
|
|
358
|
-
}, [r, p]),
|
|
358
|
+
}, [r, p]), _ = W(() => {
|
|
359
359
|
const w = p?.disclaimer || k;
|
|
360
360
|
return typeof w == "string" ? P.t(w) : w;
|
|
361
|
-
}, [k, p, P]),
|
|
361
|
+
}, [k, p, P]), Q = W(() => p ? {
|
|
362
362
|
...i,
|
|
363
363
|
enabled: p.history_enabled ?? i?.enabled,
|
|
364
364
|
showDelete: p.history_show_delete ?? i?.showDelete,
|
|
365
365
|
showRename: p.history_show_rename ?? i?.showRename,
|
|
366
366
|
showShare: p.history_show_share ?? i?.showShare,
|
|
367
367
|
showPin: p.history_show_pin ?? i?.showPin
|
|
368
|
-
} : i, [i, p]), x =
|
|
368
|
+
} : i, [i, p]), x = W(() => p ? {
|
|
369
369
|
...u,
|
|
370
370
|
feedback: p.thread_actions_feedback ?? u?.feedback,
|
|
371
371
|
retry: p.thread_actions_retry ?? u?.retry
|
|
372
|
-
} : u, [u, p]), V =
|
|
372
|
+
} : u, [u, p]), V = W(() => p ? {
|
|
373
373
|
...c,
|
|
374
374
|
attachments: {
|
|
375
375
|
...c?.attachments,
|
|
376
376
|
enabled: p.composer_attachments ?? c?.attachments?.enabled
|
|
377
377
|
}
|
|
378
|
-
} : c, [c, p]),
|
|
378
|
+
} : c, [c, p]), G = W(
|
|
379
379
|
() => ({
|
|
380
380
|
...y,
|
|
381
381
|
defaultTheme: p?.default_theme ?? y?.defaultTheme,
|
|
382
382
|
accent: p?.default_accent ?? y?.accent
|
|
383
383
|
}),
|
|
384
384
|
[y, p]
|
|
385
|
-
), M =
|
|
385
|
+
), M = W(() => p ? {
|
|
386
386
|
...g,
|
|
387
387
|
sections: {
|
|
388
388
|
...g?.sections,
|
|
@@ -414,7 +414,7 @@ function Za({
|
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
} : g, [g, p]),
|
|
417
|
+
} : g, [g, p]), D = W(
|
|
418
418
|
() => new tt({
|
|
419
419
|
defaultOptions: {
|
|
420
420
|
queries: {
|
|
@@ -425,46 +425,46 @@ function Za({
|
|
|
425
425
|
}),
|
|
426
426
|
[]
|
|
427
427
|
);
|
|
428
|
-
|
|
429
|
-
|
|
428
|
+
K(() => {
|
|
429
|
+
R.configure({
|
|
430
430
|
api: I,
|
|
431
|
-
app:
|
|
431
|
+
app: E
|
|
432
432
|
});
|
|
433
|
-
}, [
|
|
434
|
-
const
|
|
435
|
-
|
|
433
|
+
}, [R, E]);
|
|
434
|
+
const J = re(null), j = o?.resources;
|
|
435
|
+
j !== J.current && (J.current = j, j && Object.entries(j).forEach(([w, m]) => {
|
|
436
436
|
Object.entries(m).forEach(([C, f]) => {
|
|
437
437
|
P.addResourceBundle(w, C, f, !0, !0);
|
|
438
438
|
});
|
|
439
439
|
}));
|
|
440
|
-
const
|
|
441
|
-
|
|
440
|
+
const q = re(null), F = p?.translations;
|
|
441
|
+
F && F !== q.current && (q.current = F, Object.entries(F).forEach(([w, m]) => {
|
|
442
442
|
Object.entries(m).forEach(([C, f]) => {
|
|
443
443
|
P.addResourceBundle(w, C, f, !0, !0);
|
|
444
444
|
});
|
|
445
445
|
}));
|
|
446
|
-
const
|
|
447
|
-
return
|
|
446
|
+
const O = re(null), $ = o?.instance;
|
|
447
|
+
return $ && $ !== O.current && (O.current = $, Object.entries(it).forEach(([w, m]) => {
|
|
448
448
|
Object.entries(m).forEach(([C, f]) => {
|
|
449
|
-
|
|
449
|
+
$.hasResourceBundle(w, C) || $.addResourceBundle(w, C, f, !0, !1);
|
|
450
450
|
});
|
|
451
|
-
})), /* @__PURE__ */ e(st, { i18n: P, children: /* @__PURE__ */ s(at, { client:
|
|
452
|
-
/* @__PURE__ */ e(lt, { api:
|
|
451
|
+
})), /* @__PURE__ */ e(st, { i18n: P, children: /* @__PURE__ */ s(at, { client: D, children: [
|
|
452
|
+
/* @__PURE__ */ e(lt, { api: R, children: /* @__PURE__ */ s(
|
|
453
453
|
je,
|
|
454
454
|
{
|
|
455
455
|
components: n,
|
|
456
|
-
history:
|
|
457
|
-
welcome:
|
|
456
|
+
history: Q,
|
|
457
|
+
welcome: L,
|
|
458
458
|
threadActions: x,
|
|
459
459
|
composer: V,
|
|
460
|
-
theme:
|
|
461
|
-
disclaimer:
|
|
462
|
-
app:
|
|
460
|
+
theme: G,
|
|
461
|
+
disclaimer: _,
|
|
462
|
+
app: E,
|
|
463
463
|
i18n: o,
|
|
464
464
|
settings: M,
|
|
465
465
|
children: [
|
|
466
466
|
/* @__PURE__ */ e(ca, {}),
|
|
467
|
-
/* @__PURE__ */ e(ct, { defaultTheme: "system", storageKey: "chatbot-theme", config:
|
|
467
|
+
/* @__PURE__ */ e(ct, { defaultTheme: "system", storageKey: "chatbot-theme", config: G, children: a })
|
|
468
468
|
]
|
|
469
469
|
}
|
|
470
470
|
) }),
|
|
@@ -473,16 +473,16 @@ function Za({
|
|
|
473
473
|
}
|
|
474
474
|
function ca() {
|
|
475
475
|
const { app: a } = ne();
|
|
476
|
-
return Oe(),
|
|
476
|
+
return Oe(), K(() => {
|
|
477
477
|
a?.name && (document.title = a.name);
|
|
478
|
-
}, [a?.name]),
|
|
478
|
+
}, [a?.name]), K(() => {
|
|
479
479
|
if (!a?.favicon) return;
|
|
480
480
|
let t = document.querySelector("link[rel~='icon']");
|
|
481
481
|
t || (t = document.createElement("link"), t.rel = "icon", document.head.appendChild(t)), t.href = a.favicon;
|
|
482
482
|
}, [a?.favicon]), null;
|
|
483
483
|
}
|
|
484
484
|
function Pe() {
|
|
485
|
-
const a = Je(), t = Te(), n = oe().getConfig().app?.basePath || "/", i =
|
|
485
|
+
const a = Je(), t = Te(), n = oe().getConfig().app?.basePath || "/", i = W(() => {
|
|
486
486
|
const u = a.pathname, c = u.endsWith("/") && u !== "/" ? u.slice(0, -1) : u, y = n.endsWith("/") && n !== "/" ? n.slice(0, -1) : n;
|
|
487
487
|
if (c === (y || "/")) return "/";
|
|
488
488
|
if (u.startsWith(y) && y !== "/") {
|
|
@@ -499,18 +499,18 @@ function Pe() {
|
|
|
499
499
|
return [i, r];
|
|
500
500
|
}
|
|
501
501
|
function da({ onFinish: a } = {}) {
|
|
502
|
-
const { t } = ue(["chat", "errors"]), d = he(), o = oe(), n = o.getConfig(), i = n.app?.cacheNamespace || "gentiq", [r, u] = Pe(), [c, y] =
|
|
503
|
-
|
|
502
|
+
const { t } = ue(["chat", "errors"]), d = he(), o = oe(), n = o.getConfig(), i = n.app?.cacheNamespace || "gentiq", [r, u] = Pe(), [c, y] = T(() => me()), k = re(/* @__PURE__ */ new Set());
|
|
503
|
+
K(() => {
|
|
504
504
|
y((f) => r === "/" ? me() : f && r !== `/${f}` ? me() : f);
|
|
505
505
|
}, [r]);
|
|
506
|
-
const g =
|
|
506
|
+
const g = W(() => r === "/" ? c : r.replace(/^\//, ""), [r, c]), p = ee((f) => (k.current.add(f), f), []), A = ee(() => {
|
|
507
507
|
k.current.forEach((f) => URL.revokeObjectURL(f)), k.current.clear();
|
|
508
508
|
}, []);
|
|
509
|
-
|
|
509
|
+
K(() => () => A(), [A]);
|
|
510
510
|
const {
|
|
511
511
|
data: P,
|
|
512
512
|
isLoading: I,
|
|
513
|
-
isError:
|
|
513
|
+
isError: R
|
|
514
514
|
} = rt({
|
|
515
515
|
queryKey: [i, "threadMessages", g],
|
|
516
516
|
queryFn: async () => {
|
|
@@ -519,7 +519,7 @@ function da({ onFinish: a } = {}) {
|
|
|
519
519
|
const f = await o.getThreadMessages(g);
|
|
520
520
|
return !f.items || !Array.isArray(f.items) ? [] : await Promise.all(
|
|
521
521
|
f.items.map(async (S) => {
|
|
522
|
-
const Z = typeof S.content == "string" ? S.content : S.content?.text || JSON.stringify(S.content), z = [...Array.isArray(S.parts) && S.parts.length > 0 ? S.parts : [{ type: "text", text: Z }]].sort((b, l) => b.type === "file" && l.type !== "file" ? -1 : b.type !== "file" && l.type === "file" ? 1 : 0),
|
|
522
|
+
const Z = typeof S.content == "string" ? S.content : S.content?.text || JSON.stringify(S.content), z = [...Array.isArray(S.parts) && S.parts.length > 0 ? S.parts : [{ type: "text", text: Z }]].sort((b, l) => b.type === "file" && l.type !== "file" ? -1 : b.type !== "file" && l.type === "file" ? 1 : 0), B = await Promise.all(
|
|
523
523
|
z.map(async (b) => {
|
|
524
524
|
if (b.type === "file" && b.object_name && !b.url)
|
|
525
525
|
try {
|
|
@@ -538,7 +538,7 @@ function da({ onFinish: a } = {}) {
|
|
|
538
538
|
return {
|
|
539
539
|
id: S.id || me(),
|
|
540
540
|
role: S.role,
|
|
541
|
-
parts:
|
|
541
|
+
parts: B,
|
|
542
542
|
metadata: { feedback: S.feedback }
|
|
543
543
|
};
|
|
544
544
|
})
|
|
@@ -547,20 +547,20 @@ function da({ onFinish: a } = {}) {
|
|
|
547
547
|
enabled: r !== "/",
|
|
548
548
|
staleTime: 5e3
|
|
549
549
|
// Keep history fresh for 5 seconds
|
|
550
|
-
}),
|
|
550
|
+
}), E = W(
|
|
551
551
|
() => new ea({
|
|
552
552
|
api: o.getEndpoint("chat", "/chat"),
|
|
553
|
-
fetch: async (f,
|
|
554
|
-
const S = new Headers(
|
|
553
|
+
fetch: async (f, H) => {
|
|
554
|
+
const S = new Headers(H?.headers), Z = o.getHeaders();
|
|
555
555
|
Object.entries(Z).forEach(([b, l]) => {
|
|
556
556
|
S.set(b, l);
|
|
557
557
|
}), S.set("X-Thread-Id", g);
|
|
558
|
-
const
|
|
559
|
-
if (!
|
|
560
|
-
const b = await
|
|
558
|
+
const U = n.api?.basePath || "/api", z = typeof f == "string" && !f.startsWith("http") ? `${U}${f.startsWith("/") ? f : "/" + f}` : f, B = await fetch(z, { ...H, headers: S });
|
|
559
|
+
if (!B.ok) {
|
|
560
|
+
const b = await B.json().catch(() => ({}));
|
|
561
561
|
if (b.error && (typeof b.error.code == "string" || typeof b.error.message == "string"))
|
|
562
|
-
throw new be(b,
|
|
563
|
-
let l =
|
|
562
|
+
throw new be(b, B.status);
|
|
563
|
+
let l = B.statusText || `HTTP ${B.status}`, h = "error", N = null;
|
|
564
564
|
throw typeof b.detail == "string" ? l = b.detail : typeof b.message == "string" ? l = b.message : typeof b.error == "string" ? l = b.error : Array.isArray(b.detail) ? (l = "Validation failed", N = b.detail, h = "validation_error") : b.error && typeof b.error.message == "string" && (l = b.error.message), new be(
|
|
565
565
|
{
|
|
566
566
|
error: {
|
|
@@ -569,65 +569,65 @@ function da({ onFinish: a } = {}) {
|
|
|
569
569
|
details: N
|
|
570
570
|
}
|
|
571
571
|
},
|
|
572
|
-
|
|
572
|
+
B.status
|
|
573
573
|
);
|
|
574
574
|
}
|
|
575
|
-
return
|
|
575
|
+
return B;
|
|
576
576
|
}
|
|
577
577
|
}),
|
|
578
578
|
[g, n.api?.basePath, o]
|
|
579
|
-
),
|
|
579
|
+
), L = ee(() => {
|
|
580
580
|
M("ready"), d.invalidateQueries({ queryKey: [i, "conversations"] }), a?.();
|
|
581
|
-
}, [d, a, i]),
|
|
581
|
+
}, [d, a, i]), _ = Zt({
|
|
582
582
|
id: g,
|
|
583
|
-
onFinish:
|
|
584
|
-
transport:
|
|
585
|
-
}), { setMessages:
|
|
586
|
-
|
|
583
|
+
onFinish: L,
|
|
584
|
+
transport: E
|
|
585
|
+
}), { setMessages: Q, sendMessage: x, stop: V } = _, [G, M] = T("idle"), [D, J] = T(null), j = ee(() => {
|
|
586
|
+
J(null);
|
|
587
587
|
}, []);
|
|
588
|
-
|
|
589
|
-
P && (r === `/${c}` || (
|
|
590
|
-
}, [P,
|
|
591
|
-
r === "/" && (
|
|
592
|
-
}, [r,
|
|
588
|
+
K(() => {
|
|
589
|
+
P && (r === `/${c}` || (Q(P), M("ready")));
|
|
590
|
+
}, [P, Q, r, c]), K(() => {
|
|
591
|
+
r === "/" && (Q([]), M("idle"));
|
|
592
|
+
}, [r, Q]), K(() => {
|
|
593
593
|
if (r === "/") {
|
|
594
594
|
M("idle");
|
|
595
595
|
return;
|
|
596
596
|
}
|
|
597
597
|
const f = r === `/${c}`;
|
|
598
|
-
I && !f ? M("loading-history") :
|
|
598
|
+
I && !f ? M("loading-history") : R || D || _.error ? M("error") : _.status === "streaming" || _.status === "submitted" ? M(_.status) : M("ready");
|
|
599
599
|
}, [
|
|
600
600
|
I,
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
601
|
+
R,
|
|
602
|
+
_.status,
|
|
603
|
+
D,
|
|
604
|
+
_.error,
|
|
605
605
|
r,
|
|
606
606
|
c
|
|
607
|
-
]),
|
|
607
|
+
]), K(() => () => {
|
|
608
608
|
V();
|
|
609
609
|
}, [g, V]);
|
|
610
|
-
const
|
|
611
|
-
() =>
|
|
612
|
-
[
|
|
610
|
+
const q = re(/* @__PURE__ */ new Set()), F = W(
|
|
611
|
+
() => _.messages.filter((f) => f.role === "assistant"),
|
|
612
|
+
[_.messages]
|
|
613
613
|
);
|
|
614
|
-
|
|
614
|
+
K(() => {
|
|
615
615
|
let f = !1;
|
|
616
|
-
for (const
|
|
617
|
-
if (
|
|
618
|
-
const S =
|
|
619
|
-
(S ? ge(S) : void 0)?.data?.[0]?.title && (
|
|
616
|
+
for (const H of F) {
|
|
617
|
+
if (q.current.has(H.id)) continue;
|
|
618
|
+
const S = H.parts.find((U) => U.type === "data-title");
|
|
619
|
+
(S ? ge(S) : void 0)?.data?.[0]?.title && (q.current.add(H.id), f = !0);
|
|
620
620
|
}
|
|
621
621
|
f && d.invalidateQueries({ queryKey: [i, "conversations"] });
|
|
622
|
-
}, [
|
|
623
|
-
const
|
|
622
|
+
}, [F, d, i]);
|
|
623
|
+
const O = re(null), $ = ee(
|
|
624
624
|
(f) => {
|
|
625
625
|
if (f.length === 0) return;
|
|
626
|
-
const
|
|
626
|
+
const H = f.map((S) => ({
|
|
627
627
|
type: "data-reference",
|
|
628
628
|
data: S
|
|
629
629
|
}));
|
|
630
|
-
|
|
630
|
+
Q((S) => {
|
|
631
631
|
const Z = new Set(f.map((b) => b.id));
|
|
632
632
|
if (S.some(
|
|
633
633
|
(b) => b.parts.some(
|
|
@@ -638,46 +638,46 @@ function da({ onFinish: a } = {}) {
|
|
|
638
638
|
(b) => b.role === "user" && !b.parts.some((l) => l.type === "data-reference")
|
|
639
639
|
);
|
|
640
640
|
if (z === -1) return S;
|
|
641
|
-
const
|
|
642
|
-
return S.map((b, l) => l !==
|
|
641
|
+
const B = S.length - 1 - z;
|
|
642
|
+
return S.map((b, l) => l !== B ? b : {
|
|
643
643
|
...b,
|
|
644
644
|
metadata: {
|
|
645
645
|
...b.metadata || {},
|
|
646
646
|
references: f
|
|
647
647
|
},
|
|
648
|
-
parts: [...
|
|
648
|
+
parts: [...H, ...b.parts]
|
|
649
649
|
});
|
|
650
650
|
});
|
|
651
651
|
},
|
|
652
|
-
[
|
|
652
|
+
[Q]
|
|
653
653
|
);
|
|
654
|
-
|
|
655
|
-
const f =
|
|
654
|
+
K(() => {
|
|
655
|
+
const f = O.current;
|
|
656
656
|
if (!f) return;
|
|
657
|
-
const
|
|
658
|
-
if (
|
|
659
|
-
(
|
|
660
|
-
(z) => z.type === "data-reference" &&
|
|
657
|
+
const H = new Set(f.map((U) => U.id));
|
|
658
|
+
if (_.messages.some(
|
|
659
|
+
(U) => U.parts.some(
|
|
660
|
+
(z) => z.type === "data-reference" && H.has(ge(z).data?.id)
|
|
661
661
|
)
|
|
662
662
|
)) {
|
|
663
|
-
|
|
663
|
+
O.current = null;
|
|
664
664
|
return;
|
|
665
665
|
}
|
|
666
|
-
|
|
667
|
-
(
|
|
668
|
-
) && (
|
|
669
|
-
}, [
|
|
666
|
+
_.messages.some(
|
|
667
|
+
(U) => U.role === "user" && !U.parts.some((z) => z.type === "data-reference")
|
|
668
|
+
) && ($(f), O.current = null);
|
|
669
|
+
}, [_.messages, $]);
|
|
670
670
|
const w = ee(
|
|
671
|
-
async (f,
|
|
672
|
-
const Z = r === "/",
|
|
673
|
-
if (!(!
|
|
671
|
+
async (f, H, S = []) => {
|
|
672
|
+
const Z = r === "/", U = f.trim();
|
|
673
|
+
if (!(!U && (!H || H.length === 0) && S.length === 0) && !(G === "loading-history" || G === "streaming" || G === "submitted")) {
|
|
674
674
|
if (V(), Z) {
|
|
675
675
|
u(`/${g}`);
|
|
676
|
-
const z =
|
|
676
|
+
const z = U || (S[0]?.excerpt ? `↳ ${S[0].excerpt}` : t("attach_file")), B = z.length > 30 ? z.slice(0, 30) + "..." : z;
|
|
677
677
|
d.setQueryData([i, "conversations"], (b) => {
|
|
678
678
|
const l = {
|
|
679
679
|
id: `/${g}`,
|
|
680
|
-
firstMessage:
|
|
680
|
+
firstMessage: B,
|
|
681
681
|
timestamp: Date.now()
|
|
682
682
|
};
|
|
683
683
|
return !b || !Array.isArray(b.pages) ? {
|
|
@@ -691,13 +691,13 @@ function da({ onFinish: a } = {}) {
|
|
|
691
691
|
};
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
|
-
M("submitted"),
|
|
694
|
+
M("submitted"), J(null), O.current = S.length > 0 ? S : null;
|
|
695
695
|
try {
|
|
696
|
-
S.length > 0 ? await x({ text:
|
|
696
|
+
S.length > 0 ? await x({ text: U, files: H }, { body: { references: S } }) : await x({ text: U, files: H });
|
|
697
697
|
} catch (z) {
|
|
698
698
|
console.error("Failed to send message:", z);
|
|
699
|
-
const
|
|
700
|
-
|
|
699
|
+
const B = de(z, t);
|
|
700
|
+
J(new Error(B)), M("error");
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
},
|
|
@@ -709,33 +709,33 @@ function da({ onFinish: a } = {}) {
|
|
|
709
709
|
g,
|
|
710
710
|
t,
|
|
711
711
|
d,
|
|
712
|
-
|
|
712
|
+
G,
|
|
713
713
|
i
|
|
714
714
|
]
|
|
715
715
|
), m = ee(() => {
|
|
716
716
|
V(), M("ready"), d.invalidateQueries({ queryKey: [i, "conversations"] });
|
|
717
|
-
}, [V, d, i]), C =
|
|
718
|
-
if (
|
|
719
|
-
if (
|
|
720
|
-
const f = de(
|
|
717
|
+
}, [V, d, i]), C = W(() => {
|
|
718
|
+
if (D) return D;
|
|
719
|
+
if (_.error) {
|
|
720
|
+
const f = de(_.error, t);
|
|
721
721
|
return new Error(f);
|
|
722
722
|
}
|
|
723
723
|
return null;
|
|
724
|
-
}, [
|
|
725
|
-
return
|
|
724
|
+
}, [D, _.error, t]);
|
|
725
|
+
return W(
|
|
726
726
|
() => ({
|
|
727
|
-
...
|
|
727
|
+
..._,
|
|
728
728
|
sendMessage: w,
|
|
729
729
|
stop: m,
|
|
730
|
-
clearError:
|
|
730
|
+
clearError: j,
|
|
731
731
|
error: C,
|
|
732
732
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ChatStatus is a superset of the AI SDK status union expected downstream
|
|
733
|
-
status:
|
|
734
|
-
isLoadingHistory:
|
|
735
|
-
isErrorHistory:
|
|
733
|
+
status: G,
|
|
734
|
+
isLoadingHistory: G === "loading-history",
|
|
735
|
+
isErrorHistory: G === "error" || !!C || R,
|
|
736
736
|
conversationId: r
|
|
737
737
|
}),
|
|
738
|
-
[
|
|
738
|
+
[_, w, m, j, C, G, R, r]
|
|
739
739
|
);
|
|
740
740
|
}
|
|
741
741
|
function ua({ classNames: a = {}, disclaimer: t }) {
|
|
@@ -749,15 +749,21 @@ function ua({ classNames: a = {}, disclaimer: t }) {
|
|
|
749
749
|
isLoadingHistory: g,
|
|
750
750
|
conversationId: p,
|
|
751
751
|
sendMessage: A
|
|
752
|
-
} = n, {
|
|
752
|
+
} = n, {
|
|
753
|
+
MessageList: P,
|
|
754
|
+
PromptInput: I,
|
|
755
|
+
WelcomeScreen: R,
|
|
756
|
+
composer: E,
|
|
757
|
+
disclaimer: L
|
|
758
|
+
} = ne(), _ = t ?? L, Q = o.exists("chat:disclaimer") ? d("chat:disclaimer") : null, x = typeof _ == "string" ? d(_) : _ ?? Q, [V, G] = T(null), M = re(r);
|
|
753
759
|
et(() => {
|
|
754
760
|
c && y();
|
|
755
761
|
}, [p, y, c]);
|
|
756
|
-
const
|
|
757
|
-
|
|
758
|
-
r === "error" &&
|
|
762
|
+
const D = i[i.length - 1], J = D?.role === "assistant" && (r === "ready" || D.parts.some((F) => F.type === "data-chat-finished"));
|
|
763
|
+
K(() => {
|
|
764
|
+
r === "error" && M.current !== "error" && V !== p ? G(p) : r === "submitted" && V !== null && G(null), M.current = r;
|
|
759
765
|
}, [r, p]);
|
|
760
|
-
const
|
|
766
|
+
const j = r === "error" && (p === "/" || V === p), q = i.length === 0 && !g;
|
|
761
767
|
return /* @__PURE__ */ e(
|
|
762
768
|
He,
|
|
763
769
|
{
|
|
@@ -765,13 +771,13 @@ function ua({ classNames: a = {}, disclaimer: t }) {
|
|
|
765
771
|
maxItems: E?.references?.maxItems,
|
|
766
772
|
maxExcerptLength: E?.references?.maxExcerptLength,
|
|
767
773
|
children: /* @__PURE__ */ s("div", { className: v("relative flex flex-col h-full overflow-hidden", a.container), children: [
|
|
768
|
-
/* @__PURE__ */ e(
|
|
774
|
+
!q && /* @__PURE__ */ e(
|
|
769
775
|
P,
|
|
770
776
|
{
|
|
771
777
|
messages: i,
|
|
772
778
|
status: r,
|
|
773
779
|
isLoadingHistory: g,
|
|
774
|
-
error:
|
|
780
|
+
error: j ? c : null,
|
|
775
781
|
conversationId: p,
|
|
776
782
|
regen: (F) => u({ messageId: F }),
|
|
777
783
|
onSuggestionClick: (F) => A(F),
|
|
@@ -779,27 +785,41 @@ function ua({ classNames: a = {}, disclaimer: t }) {
|
|
|
779
785
|
className: v("flex-1", a.messageList)
|
|
780
786
|
}
|
|
781
787
|
),
|
|
782
|
-
/* @__PURE__ */ s("div", { className: "absolute
|
|
788
|
+
/* @__PURE__ */ s("div", { className: "absolute inset-0 z-10 pointer-events-none flex flex-col", children: [
|
|
789
|
+
/* @__PURE__ */ e("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: q && /* @__PURE__ */ e(R, { onSuggestionClick: () => {
|
|
790
|
+
} }) }),
|
|
791
|
+
/* @__PURE__ */ s("div", { className: "shrink-0 flex flex-col items-stretch", children: [
|
|
792
|
+
/* @__PURE__ */ e(
|
|
793
|
+
I,
|
|
794
|
+
{
|
|
795
|
+
onSend: A,
|
|
796
|
+
status: r,
|
|
797
|
+
isLastMessageFinished: J,
|
|
798
|
+
stop: k,
|
|
799
|
+
isErrorVisible: j,
|
|
800
|
+
conversationId: p,
|
|
801
|
+
newChat: q,
|
|
802
|
+
className: v(
|
|
803
|
+
"pointer-events-auto",
|
|
804
|
+
a.inputArea,
|
|
805
|
+
x && "pb-0 md:pb-0"
|
|
806
|
+
)
|
|
807
|
+
}
|
|
808
|
+
),
|
|
809
|
+
x && /* @__PURE__ */ s("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
|
|
810
|
+
/* @__PURE__ */ e("div", { className: "absolute inset-x-0 bottom-0 top-[-20px] bg-background/80 backdrop-blur-sm [mask-image:linear-gradient(to_top,black_60%,transparent)] pointer-events-none -z-10" }),
|
|
811
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children: x })
|
|
812
|
+
] })
|
|
813
|
+
] }),
|
|
783
814
|
/* @__PURE__ */ e(
|
|
784
|
-
|
|
815
|
+
"div",
|
|
785
816
|
{
|
|
786
|
-
onSend: A,
|
|
787
|
-
status: r,
|
|
788
|
-
isLastMessageFinished: $,
|
|
789
|
-
stop: k,
|
|
790
|
-
isErrorVisible: G,
|
|
791
|
-
conversationId: p,
|
|
792
817
|
className: v(
|
|
793
|
-
"
|
|
794
|
-
|
|
795
|
-
q && "pb-0 md:pb-0"
|
|
818
|
+
"basis-0 shrink-0 transition-[flex-grow] duration-500 ease-in-out",
|
|
819
|
+
q ? "grow" : "grow-0"
|
|
796
820
|
)
|
|
797
821
|
}
|
|
798
|
-
)
|
|
799
|
-
q && /* @__PURE__ */ s("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
|
|
800
|
-
/* @__PURE__ */ e("div", { className: "absolute inset-x-0 bottom-0 top-[-20px] bg-background/80 backdrop-blur-sm [mask-image:linear-gradient(to_top,black_60%,transparent)] pointer-events-none -z-10" }),
|
|
801
|
-
/* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children: q })
|
|
802
|
-
] })
|
|
822
|
+
)
|
|
803
823
|
] })
|
|
804
824
|
] })
|
|
805
825
|
}
|
|
@@ -815,7 +835,7 @@ const ha = ({
|
|
|
815
835
|
disclaimer: r,
|
|
816
836
|
...u
|
|
817
837
|
}) => {
|
|
818
|
-
const c = ne(), y =
|
|
838
|
+
const c = ne(), y = W(
|
|
819
839
|
() => ({
|
|
820
840
|
...c,
|
|
821
841
|
...a,
|
|
@@ -938,23 +958,23 @@ function _a({
|
|
|
938
958
|
...r
|
|
939
959
|
}) {
|
|
940
960
|
const u = dt(), [c, y] = se.useState(!1), [k, g] = se.useState(a), p = t ?? k, A = se.useCallback(
|
|
941
|
-
(
|
|
942
|
-
const
|
|
943
|
-
d ? d(
|
|
961
|
+
(E) => {
|
|
962
|
+
const L = typeof E == "function" ? E(p) : E;
|
|
963
|
+
d ? d(L) : g(L), document.cookie = `${xa}=${L}; path=/; max-age=${wa}`;
|
|
944
964
|
},
|
|
945
965
|
[d, p]
|
|
946
966
|
), P = se.useCallback(() => {
|
|
947
|
-
u ? y((
|
|
967
|
+
u ? y((E) => !E) : A((E) => !E);
|
|
948
968
|
}, [u, A, y]);
|
|
949
969
|
se.useEffect(() => {
|
|
950
|
-
const
|
|
951
|
-
|
|
970
|
+
const E = (L) => {
|
|
971
|
+
L.key === Ca && (L.metaKey || L.ctrlKey) && (L.preventDefault(), P());
|
|
952
972
|
};
|
|
953
|
-
return window.addEventListener("keydown",
|
|
954
|
-
window.removeEventListener("keydown",
|
|
973
|
+
return window.addEventListener("keydown", E), () => {
|
|
974
|
+
window.removeEventListener("keydown", E);
|
|
955
975
|
};
|
|
956
976
|
}, [P]);
|
|
957
|
-
const I = p ? "expanded" : "collapsed",
|
|
977
|
+
const I = p ? "expanded" : "collapsed", R = se.useMemo(
|
|
958
978
|
() => ({
|
|
959
979
|
state: I,
|
|
960
980
|
open: p,
|
|
@@ -966,7 +986,7 @@ function _a({
|
|
|
966
986
|
}),
|
|
967
987
|
[I, p, A, u, c, y, P]
|
|
968
988
|
);
|
|
969
|
-
return /* @__PURE__ */ e(Xe.Provider, { value:
|
|
989
|
+
return /* @__PURE__ */ e(Xe.Provider, { value: R, children: /* @__PURE__ */ e(Ue, { delayDuration: 0, children: /* @__PURE__ */ e(
|
|
970
990
|
"div",
|
|
971
991
|
{
|
|
972
992
|
"data-slot": "sidebar-wrapper",
|
|
@@ -1205,65 +1225,65 @@ function Fe({
|
|
|
1205
1225
|
] })) : k;
|
|
1206
1226
|
}
|
|
1207
1227
|
function Ra({ trigger: a }) {
|
|
1208
|
-
const { t, i18n: d } = ue(["settings", "translation"]), { app: o, settings: n } = ne(), i = oe(), r = he(), { theme: u, setTheme: c, accent: y, setAccent: k, radius: g, setRadius: p } = Ve(), [A, P] =
|
|
1228
|
+
const { t, i18n: d } = ue(["settings", "translation"]), { app: o, settings: n } = ne(), i = oe(), r = he(), { theme: u, setTheme: c, accent: y, setAccent: k, radius: g, setRadius: p } = Ve(), [A, P] = T(null), [I, R] = T(!1), E = re(null), L = W(() => [
|
|
1209
1229
|
{ id: "general", label: t("sections.general", "General"), icon: Ae },
|
|
1210
1230
|
{ id: "profile", label: t("sections.profile", "Profile"), icon: Mt },
|
|
1211
1231
|
{ id: "account", label: t("sections.account", "Account"), icon: At }
|
|
1212
1232
|
].filter((h) => {
|
|
1213
1233
|
const N = n?.sections?.[h.id];
|
|
1214
1234
|
return (N?.mode ?? (N?.enabled === !1 ? "hidden" : "editable")) !== "hidden";
|
|
1215
|
-
}), [t, n]), [
|
|
1235
|
+
}), [t, n]), [_, Q] = T(L[0]?.id || "general"), x = ee(
|
|
1216
1236
|
(l, h, N = "editable") => {
|
|
1217
1237
|
const ie = n?.sections?.[l]?.fields;
|
|
1218
1238
|
return ie && ie[h] || N;
|
|
1219
1239
|
},
|
|
1220
1240
|
[n]
|
|
1221
|
-
), [V,
|
|
1241
|
+
), [V, G] = T(""), [M, D] = T(""), [J, j] = T(""), [q, F] = T(""), O = W(
|
|
1222
1242
|
() => o?.userMetadataFields?.filter((l) => l.showInProfile) || [],
|
|
1223
1243
|
[o?.userMetadataFields]
|
|
1224
|
-
), [
|
|
1244
|
+
), [$, w] = T({}), [m, C] = T(!1), f = d.language === "fa", H = f ? "text-right" : "text-left", S = ee(async () => {
|
|
1225
1245
|
try {
|
|
1226
1246
|
const l = await i.getMe();
|
|
1227
|
-
P(l),
|
|
1247
|
+
P(l), G(l.name || ""), D(l.surname || ""), j(l.phone || "");
|
|
1228
1248
|
const h = {};
|
|
1229
|
-
|
|
1249
|
+
O.forEach((N) => {
|
|
1230
1250
|
h[N.key] = l.metadata?.[N.key] ?? N.defaultValue ?? "";
|
|
1231
1251
|
}), w(h);
|
|
1232
1252
|
} catch (l) {
|
|
1233
1253
|
console.error("Failed to fetch user:", l), te.error(de(l, t));
|
|
1234
1254
|
}
|
|
1235
|
-
}, [t,
|
|
1236
|
-
|
|
1255
|
+
}, [t, O, i]);
|
|
1256
|
+
K(() => {
|
|
1237
1257
|
if (!I) {
|
|
1238
|
-
|
|
1258
|
+
E.current = null;
|
|
1239
1259
|
return;
|
|
1240
1260
|
}
|
|
1241
|
-
(
|
|
1242
|
-
}, [I,
|
|
1243
|
-
const l = {
|
|
1261
|
+
(E.current === null || _ === "account") && S(), E.current = _;
|
|
1262
|
+
}, [I, _, S]), K(() => {
|
|
1263
|
+
const l = { ...$ };
|
|
1244
1264
|
let h = !1;
|
|
1245
|
-
|
|
1246
|
-
N.condition && !ye(N.condition,
|
|
1265
|
+
O.forEach((N) => {
|
|
1266
|
+
N.condition && !ye(N.condition, $) && l[N.key] !== void 0 && (delete l[N.key], h = !0);
|
|
1247
1267
|
}), h && w(l);
|
|
1248
|
-
}, [
|
|
1268
|
+
}, [$, O]);
|
|
1249
1269
|
const Z = async () => {
|
|
1250
1270
|
C(!0);
|
|
1251
1271
|
try {
|
|
1252
|
-
const l = { name: V, surname: M, phone:
|
|
1253
|
-
|
|
1272
|
+
const l = { name: V, surname: M, phone: J, metadata: $ };
|
|
1273
|
+
q && (l.password = q);
|
|
1254
1274
|
const h = await i.updateMe(l);
|
|
1255
|
-
r.setQueryData(ht(o?.cacheNamespace || "gentiq"), h), te.success(t("profile.success", "Profile updated successfully")),
|
|
1275
|
+
r.setQueryData(ht(o?.cacheNamespace || "gentiq"), h), te.success(t("profile.success", "Profile updated successfully")), F(""), S();
|
|
1256
1276
|
} catch (l) {
|
|
1257
1277
|
te.error(de(l, t));
|
|
1258
1278
|
} finally {
|
|
1259
1279
|
C(!1);
|
|
1260
1280
|
}
|
|
1261
|
-
},
|
|
1281
|
+
}, U = () => {
|
|
1262
1282
|
window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (i.clearToken(), window.location.reload());
|
|
1263
1283
|
}, z = (l) => {
|
|
1264
1284
|
d.changeLanguage(l);
|
|
1265
|
-
},
|
|
1266
|
-
return /* @__PURE__ */ s(Ge, { open: I, onOpenChange:
|
|
1285
|
+
}, B = A?.balance ? Math.max(0, Math.min(100, A.balance.tokens / (A.balance.token_limit || 1) * 100)) : 0, b = A?.balance ? Math.max(0, Math.min(100, A.balance.requests / (A.balance.request_limit || 1) * 100)) : 0;
|
|
1286
|
+
return /* @__PURE__ */ s(Ge, { open: I, onOpenChange: R, children: [
|
|
1267
1287
|
/* @__PURE__ */ e(ut, { asChild: !0, children: a || /* @__PURE__ */ e(ae, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ e(Ce, { className: "h-5 w-5" }) }) }),
|
|
1268
1288
|
/* @__PURE__ */ e(
|
|
1269
1289
|
We,
|
|
@@ -1279,13 +1299,13 @@ function Ra({ trigger: a }) {
|
|
|
1279
1299
|
/* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(Ce, { className: "h-5 w-5 text-primary" }) }),
|
|
1280
1300
|
/* @__PURE__ */ e("span", { className: "font-bold text-lg", children: t("title", "Settings") })
|
|
1281
1301
|
] }) }),
|
|
1282
|
-
/* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children:
|
|
1302
|
+
/* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: L.map((l) => /* @__PURE__ */ s(
|
|
1283
1303
|
"button",
|
|
1284
1304
|
{
|
|
1285
|
-
onClick: () =>
|
|
1305
|
+
onClick: () => Q(l.id),
|
|
1286
1306
|
className: v(
|
|
1287
1307
|
"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",
|
|
1288
|
-
|
|
1308
|
+
_ === l.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
|
|
1289
1309
|
n?.sections?.[l.id]?.mode === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1290
1310
|
),
|
|
1291
1311
|
children: [
|
|
@@ -1294,7 +1314,7 @@ function Ra({ trigger: a }) {
|
|
|
1294
1314
|
{
|
|
1295
1315
|
className: v(
|
|
1296
1316
|
"h-3.5 w-3.5 sm:h-4 sm:w-4 transition-transform",
|
|
1297
|
-
|
|
1317
|
+
_ === l.id && "scale-110"
|
|
1298
1318
|
)
|
|
1299
1319
|
}
|
|
1300
1320
|
),
|
|
@@ -1305,7 +1325,7 @@ function Ra({ trigger: a }) {
|
|
|
1305
1325
|
)) }) })
|
|
1306
1326
|
] }),
|
|
1307
1327
|
/* @__PURE__ */ e("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ s("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-12 sm:pt-12 custom-scrollbar", children: [
|
|
1308
|
-
|
|
1328
|
+
_ === "profile" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1309
1329
|
/* @__PURE__ */ s("div", { children: [
|
|
1310
1330
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("profile.title", "Profile Information") }),
|
|
1311
1331
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("profile.subtitle", "Update your personal details below.") })
|
|
@@ -1326,11 +1346,11 @@ function Ra({ trigger: a }) {
|
|
|
1326
1346
|
{
|
|
1327
1347
|
id: "name",
|
|
1328
1348
|
value: V,
|
|
1329
|
-
onChange: (l) =>
|
|
1349
|
+
onChange: (l) => G(l.target.value),
|
|
1330
1350
|
disabled: x("profile", "name") === "faded",
|
|
1331
1351
|
className: v(
|
|
1332
1352
|
"bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
|
|
1333
|
-
|
|
1353
|
+
H
|
|
1334
1354
|
)
|
|
1335
1355
|
}
|
|
1336
1356
|
)
|
|
@@ -1351,11 +1371,11 @@ function Ra({ trigger: a }) {
|
|
|
1351
1371
|
{
|
|
1352
1372
|
id: "surname",
|
|
1353
1373
|
value: M,
|
|
1354
|
-
onChange: (l) =>
|
|
1374
|
+
onChange: (l) => D(l.target.value),
|
|
1355
1375
|
disabled: x("profile", "surname") === "faded",
|
|
1356
1376
|
className: v(
|
|
1357
1377
|
"bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
|
|
1358
|
-
|
|
1378
|
+
H
|
|
1359
1379
|
)
|
|
1360
1380
|
}
|
|
1361
1381
|
)
|
|
@@ -1378,8 +1398,8 @@ function Ra({ trigger: a }) {
|
|
|
1378
1398
|
Y,
|
|
1379
1399
|
{
|
|
1380
1400
|
id: "phone",
|
|
1381
|
-
value:
|
|
1382
|
-
onChange: (l) =>
|
|
1401
|
+
value: J,
|
|
1402
|
+
onChange: (l) => j(l.target.value),
|
|
1383
1403
|
disabled: x("profile", "phone") === "faded",
|
|
1384
1404
|
className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary pl-10 pr-3 text-left",
|
|
1385
1405
|
dir: "ltr"
|
|
@@ -1405,8 +1425,8 @@ function Ra({ trigger: a }) {
|
|
|
1405
1425
|
{
|
|
1406
1426
|
id: "pass",
|
|
1407
1427
|
type: "password",
|
|
1408
|
-
value:
|
|
1409
|
-
onChange: (l) =>
|
|
1428
|
+
value: q,
|
|
1429
|
+
onChange: (l) => F(l.target.value),
|
|
1410
1430
|
disabled: x("profile", "password") === "faded",
|
|
1411
1431
|
placeholder: t(
|
|
1412
1432
|
"profile.password_placeholder",
|
|
@@ -1420,9 +1440,9 @@ function Ra({ trigger: a }) {
|
|
|
1420
1440
|
]
|
|
1421
1441
|
}
|
|
1422
1442
|
),
|
|
1423
|
-
|
|
1443
|
+
O.map((l) => {
|
|
1424
1444
|
const h = x("profile", l.key, l.mode || "editable");
|
|
1425
|
-
return h === "hidden" || !ye(l.condition,
|
|
1445
|
+
return h === "hidden" || !ye(l.condition, $) ? null : /* @__PURE__ */ s(
|
|
1426
1446
|
"div",
|
|
1427
1447
|
{
|
|
1428
1448
|
className: v(
|
|
@@ -1434,8 +1454,8 @@ function Ra({ trigger: a }) {
|
|
|
1434
1454
|
l.type === "select" ? /* @__PURE__ */ s(
|
|
1435
1455
|
we,
|
|
1436
1456
|
{
|
|
1437
|
-
value: String(
|
|
1438
|
-
onValueChange: (N) => w({
|
|
1457
|
+
value: String($[l.key] || ""),
|
|
1458
|
+
onValueChange: (N) => w({ ...$, [l.key]: N }),
|
|
1439
1459
|
disabled: h === "faded",
|
|
1440
1460
|
dir: f ? "rtl" : "ltr",
|
|
1441
1461
|
children: [
|
|
@@ -1462,9 +1482,9 @@ function Ra({ trigger: a }) {
|
|
|
1462
1482
|
{
|
|
1463
1483
|
id: `profile-${l.key}`,
|
|
1464
1484
|
type: "checkbox",
|
|
1465
|
-
checked:
|
|
1485
|
+
checked: !!$[l.key],
|
|
1466
1486
|
disabled: h === "faded",
|
|
1467
|
-
onChange: (N) => w({
|
|
1487
|
+
onChange: (N) => w({ ...$, [l.key]: N.target.checked }),
|
|
1468
1488
|
className: "h-5 w-5 rounded-md border-border/50 bg-muted/30 text-primary focus:ring-primary transition-all cursor-pointer"
|
|
1469
1489
|
}
|
|
1470
1490
|
),
|
|
@@ -1481,13 +1501,13 @@ function Ra({ trigger: a }) {
|
|
|
1481
1501
|
{
|
|
1482
1502
|
id: `profile-${l.key}`,
|
|
1483
1503
|
type: l.type,
|
|
1484
|
-
value:
|
|
1504
|
+
value: $[l.key] || "",
|
|
1485
1505
|
disabled: h === "faded",
|
|
1486
|
-
onChange: (N) => w({
|
|
1506
|
+
onChange: (N) => w({ ...$, [l.key]: N.target.value }),
|
|
1487
1507
|
placeholder: t(l.placeholder || ""),
|
|
1488
1508
|
className: v(
|
|
1489
1509
|
"bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
|
|
1490
|
-
|
|
1510
|
+
H
|
|
1491
1511
|
)
|
|
1492
1512
|
}
|
|
1493
1513
|
)
|
|
@@ -1510,7 +1530,7 @@ function Ra({ trigger: a }) {
|
|
|
1510
1530
|
) })
|
|
1511
1531
|
] })
|
|
1512
1532
|
] }),
|
|
1513
|
-
|
|
1533
|
+
_ === "general" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1514
1534
|
/* @__PURE__ */ s("div", { children: [
|
|
1515
1535
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("general.title", "General Settings") }),
|
|
1516
1536
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("general.subtitle", "Configure look and feel and language.") })
|
|
@@ -1704,7 +1724,7 @@ function Ra({ trigger: a }) {
|
|
|
1704
1724
|
)
|
|
1705
1725
|
] })
|
|
1706
1726
|
] }),
|
|
1707
|
-
|
|
1727
|
+
_ === "account" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1708
1728
|
/* @__PURE__ */ s("div", { children: [
|
|
1709
1729
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("account.title", "Account & Usage") }),
|
|
1710
1730
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("account.subtitle", "Monitor your quotas and manage your session.") })
|
|
@@ -1727,7 +1747,7 @@ function Ra({ trigger: a }) {
|
|
|
1727
1747
|
/* @__PURE__ */ s("div", { className: "flex justify-between text-sm mb-1", children: [
|
|
1728
1748
|
/* @__PURE__ */ e("span", { className: "font-medium text-muted-foreground", children: t("account.tokens", "Tokens") }),
|
|
1729
1749
|
/* @__PURE__ */ s("span", { className: "font-bold text-primary", children: [
|
|
1730
|
-
|
|
1750
|
+
B.toLocaleString(d.language, {
|
|
1731
1751
|
maximumFractionDigits: 0
|
|
1732
1752
|
}),
|
|
1733
1753
|
"%"
|
|
@@ -1743,9 +1763,9 @@ function Ra({ trigger: a }) {
|
|
|
1743
1763
|
{
|
|
1744
1764
|
className: v(
|
|
1745
1765
|
"h-full rounded-full transition-all duration-1000 shadow-sm",
|
|
1746
|
-
|
|
1766
|
+
B > 60 ? "bg-emerald-500 shadow-emerald-500/20" : B > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
|
|
1747
1767
|
),
|
|
1748
|
-
style: { width: `${
|
|
1768
|
+
style: { width: `${B}%` }
|
|
1749
1769
|
}
|
|
1750
1770
|
)
|
|
1751
1771
|
}
|
|
@@ -1799,7 +1819,7 @@ function Ra({ trigger: a }) {
|
|
|
1799
1819
|
ae,
|
|
1800
1820
|
{
|
|
1801
1821
|
variant: "destructive",
|
|
1802
|
-
onClick:
|
|
1822
|
+
onClick: U,
|
|
1803
1823
|
disabled: x("account", "logout") === "faded",
|
|
1804
1824
|
className: v(
|
|
1805
1825
|
"rounded-2xl gap-2 font-bold h-12 shadow-lg shadow-destructive/10 transition-all active:scale-[0.98]",
|
|
@@ -1834,15 +1854,15 @@ function Ra({ trigger: a }) {
|
|
|
1834
1854
|
] });
|
|
1835
1855
|
}
|
|
1836
1856
|
function Ye({ hideActions: a = !1 }) {
|
|
1837
|
-
const [, t] = Pe(), { t: d } = ue(["sidebar", "chat"]), { history: o, app: n } = ne(), { theme: i } = Ve(), r = !a && (o?.enabled ?? !0), [u, c] =
|
|
1838
|
-
|
|
1857
|
+
const [, t] = Pe(), { t: d } = ue(["sidebar", "chat"]), { history: o, app: n } = ne(), { theme: i } = Ve(), r = !a && (o?.enabled ?? !0), [u, c] = T("light");
|
|
1858
|
+
K(() => {
|
|
1839
1859
|
if (i === "system") {
|
|
1840
1860
|
const g = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
1841
1861
|
c(g ? "dark" : "light");
|
|
1842
1862
|
} else
|
|
1843
1863
|
c(i);
|
|
1844
1864
|
}, [i]);
|
|
1845
|
-
const y =
|
|
1865
|
+
const y = W(() => n?.logo ? typeof n.logo == "string" ? n.logo : u === "dark" ? n.logo.dark : n.logo.light : pt, [n?.logo, u]), k = n?.name || "Gentiq";
|
|
1846
1866
|
return /* @__PURE__ */ s("header", { className: "relative flex items-center justify-between px-3 md:px-4 h-14 sticky top-0 z-40 w-full glass border-b border-border/30 transition-all duration-300", children: [
|
|
1847
1867
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children: r && /* @__PURE__ */ e(Pa, { className: "hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 rounded-lg size-9" }) }),
|
|
1848
1868
|
/* @__PURE__ */ e("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2.5 select-none animate-in fade-in zoom-in-95 duration-500", children: /* @__PURE__ */ e("img", { src: y, alt: k, className: "size-8 object-contain" }) }) }),
|
|
@@ -1913,9 +1933,9 @@ async function $a(a, t, d, o, n) {
|
|
|
1913
1933
|
}
|
|
1914
1934
|
}
|
|
1915
1935
|
function La({ side: a = "left" }) {
|
|
1916
|
-
const { t, i18n: d } = ue(["sidebar", "translation"]), { setOpenMobile: o, isMobile: n } = ve(), { data: i, fetchNextPage: r, hasNextPage: u, isFetchingNextPage: c, isLoading: y } = Da(), { history: k, app: g } = ne(), p = g?.basePath || "/", A = k?.enabled ?? !1, P = i?.pages.flatMap((h) => h.threads) ?? [], [I,
|
|
1936
|
+
const { t, i18n: d } = ue(["sidebar", "translation"]), { setOpenMobile: o, isMobile: n } = ve(), { data: i, fetchNextPage: r, hasNextPage: u, isFetchingNextPage: c, isLoading: y } = Da(), { history: k, app: g } = ne(), p = g?.basePath || "/", A = k?.enabled ?? !1, P = i?.pages.flatMap((h) => h.threads) ?? [], [I, R] = Pe(), E = he(), L = re(null), _ = ee(
|
|
1917
1937
|
(h) => {
|
|
1918
|
-
|
|
1938
|
+
L.current && (L.current.disconnect(), L.current = null), h && u && !c && (L.current = new IntersectionObserver(
|
|
1919
1939
|
(N) => {
|
|
1920
1940
|
N[0].isIntersecting && r();
|
|
1921
1941
|
},
|
|
@@ -1923,23 +1943,23 @@ function La({ side: a = "left" }) {
|
|
|
1923
1943
|
threshold: 0,
|
|
1924
1944
|
rootMargin: "100px"
|
|
1925
1945
|
}
|
|
1926
|
-
),
|
|
1946
|
+
), L.current.observe(h));
|
|
1927
1947
|
},
|
|
1928
1948
|
[u, r, c]
|
|
1929
|
-
),
|
|
1949
|
+
), Q = oe(), V = Q.getConfig().app?.cacheNamespace || "gentiq", [G, M] = T(!1), [D, J] = T(null), [j, q] = T(""), [F, O] = T(null), [$, w] = T(""), m = re(null), C = ee(
|
|
1930
1950
|
(h, N) => {
|
|
1931
|
-
h.button !== 0 || h.metaKey || h.ctrlKey || (h.preventDefault(),
|
|
1951
|
+
h.button !== 0 || h.metaKey || h.ctrlKey || (h.preventDefault(), R(N), n && o(!1));
|
|
1932
1952
|
},
|
|
1933
|
-
[
|
|
1934
|
-
), f = P.filter((h) => h.firstMessage?.toLowerCase().includes(
|
|
1953
|
+
[R, n, o]
|
|
1954
|
+
), f = P.filter((h) => h.firstMessage?.toLowerCase().includes(j.toLowerCase())).sort((h, N) => h.pinned && !N.pinned ? -1 : !h.pinned && N.pinned ? 1 : N.timestamp - h.timestamp), H = async (h) => {
|
|
1935
1955
|
try {
|
|
1936
|
-
await
|
|
1956
|
+
await Q.pinThread(h.id.replace(/^\//, ""), !h.pinned), E.invalidateQueries({ queryKey: [V, "conversations"] }), te.success(h.pinned ? t("unpinned_success") : t("pinned_success"));
|
|
1937
1957
|
} catch {
|
|
1938
1958
|
te.error(t("pin_failed"));
|
|
1939
1959
|
}
|
|
1940
1960
|
}, S = async (h) => {
|
|
1941
1961
|
try {
|
|
1942
|
-
const N = await
|
|
1962
|
+
const N = await Q.shareThread(h.id.replace(/^\//, "")), ie = `${window.location.origin}${N.url}`;
|
|
1943
1963
|
navigator.clipboard.writeText(ie), te.success(t("share_success"), {
|
|
1944
1964
|
description: t("share_description")
|
|
1945
1965
|
});
|
|
@@ -1947,26 +1967,26 @@ function La({ side: a = "left" }) {
|
|
|
1947
1967
|
te.error(t("share_failed"));
|
|
1948
1968
|
}
|
|
1949
1969
|
}, Z = (h) => {
|
|
1950
|
-
|
|
1951
|
-
},
|
|
1952
|
-
h?.preventDefault(), h?.stopPropagation(),
|
|
1970
|
+
O(h.id), w(h.firstMessage ?? ""), setTimeout(() => m.current?.focus(), 0);
|
|
1971
|
+
}, U = (h) => {
|
|
1972
|
+
h?.preventDefault(), h?.stopPropagation(), O(null), w("");
|
|
1953
1973
|
}, z = async (h) => {
|
|
1954
|
-
if (h?.preventDefault(), h && "stopPropagation" in h && h.stopPropagation(), !(!
|
|
1974
|
+
if (h?.preventDefault(), h && "stopPropagation" in h && h.stopPropagation(), !(!F || !$.trim()))
|
|
1955
1975
|
try {
|
|
1956
|
-
await
|
|
1976
|
+
await Q.updateThreadTitle(F, $), E.invalidateQueries({ queryKey: [V, "conversations"] }), O(null), te.success(t("rename_success"));
|
|
1957
1977
|
} catch {
|
|
1958
1978
|
te.error(t("rename_failed"));
|
|
1959
1979
|
}
|
|
1960
|
-
},
|
|
1961
|
-
|
|
1980
|
+
}, B = (h) => {
|
|
1981
|
+
J(h), M(!0);
|
|
1962
1982
|
}, b = () => {
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
R,
|
|
1983
|
+
D && ($a(
|
|
1984
|
+
Q,
|
|
1985
|
+
D.id,
|
|
1967
1986
|
E,
|
|
1987
|
+
R,
|
|
1968
1988
|
I
|
|
1969
|
-
), M(!1),
|
|
1989
|
+
), M(!1), J(null), te.success(t("chat_deleted_success")));
|
|
1970
1990
|
}, l = (h) => new Intl.DateTimeFormat(d.language, {
|
|
1971
1991
|
year: "numeric",
|
|
1972
1992
|
month: "short",
|
|
@@ -2004,8 +2024,8 @@ function La({ side: a = "left" }) {
|
|
|
2004
2024
|
Y,
|
|
2005
2025
|
{
|
|
2006
2026
|
placeholder: t("search_conversations"),
|
|
2007
|
-
value:
|
|
2008
|
-
onChange: (h) =>
|
|
2027
|
+
value: j,
|
|
2028
|
+
onChange: (h) => q(h.target.value),
|
|
2009
2029
|
className: "pl-9 h-10 bg-accent/15 border border-border/40 focus-visible:ring-primary/20 rounded-xl transition-all"
|
|
2010
2030
|
}
|
|
2011
2031
|
)
|
|
@@ -2013,19 +2033,19 @@ function La({ side: a = "left" }) {
|
|
|
2013
2033
|
A && /* @__PURE__ */ s(De, { className: "group-data-[collapsible=icon]:hidden", children: [
|
|
2014
2034
|
/* @__PURE__ */ s($e, { children: [
|
|
2015
2035
|
f.map((h, N) => {
|
|
2016
|
-
const ie =
|
|
2036
|
+
const ie = F === h.id, Ee = Me(h.firstMessage ?? ""), Ze = Ee === "rtl";
|
|
2017
2037
|
return /* @__PURE__ */ e(Le, { className: "group/sidebar-menu-item relative", children: ie ? /* @__PURE__ */ s("div", { className: "flex items-center gap-1 px-2 py-1.5 w-full", children: [
|
|
2018
2038
|
/* @__PURE__ */ e(
|
|
2019
2039
|
Y,
|
|
2020
2040
|
{
|
|
2021
2041
|
ref: m,
|
|
2022
|
-
value:
|
|
2042
|
+
value: $,
|
|
2023
2043
|
onChange: (ce) => w(ce.target.value),
|
|
2024
2044
|
onKeyDown: (ce) => {
|
|
2025
|
-
ce.key === "Enter" && z(), ce.key === "Escape" &&
|
|
2045
|
+
ce.key === "Enter" && z(), ce.key === "Escape" && U();
|
|
2026
2046
|
},
|
|
2027
2047
|
className: "h-8 py-0 px-2 text-sm",
|
|
2028
|
-
dir: Me(
|
|
2048
|
+
dir: Me($)
|
|
2029
2049
|
}
|
|
2030
2050
|
),
|
|
2031
2051
|
/* @__PURE__ */ e(
|
|
@@ -2044,7 +2064,7 @@ function La({ side: a = "left" }) {
|
|
|
2044
2064
|
size: "icon",
|
|
2045
2065
|
variant: "ghost",
|
|
2046
2066
|
className: "size-8 shrink-0 text-destructive hover:bg-destructive/10",
|
|
2047
|
-
onClick:
|
|
2067
|
+
onClick: U,
|
|
2048
2068
|
children: /* @__PURE__ */ e(Kt, { className: "size-4" })
|
|
2049
2069
|
}
|
|
2050
2070
|
)
|
|
@@ -2116,7 +2136,7 @@ function La({ side: a = "left" }) {
|
|
|
2116
2136
|
k?.showPin !== !1 && /* @__PURE__ */ s(
|
|
2117
2137
|
pe,
|
|
2118
2138
|
{
|
|
2119
|
-
onSelect: () =>
|
|
2139
|
+
onSelect: () => H(h),
|
|
2120
2140
|
className: "cursor-pointer flex items-center gap-2",
|
|
2121
2141
|
children: [
|
|
2122
2142
|
h.pinned ? /* @__PURE__ */ e(Vt, { className: "size-4" }) : /* @__PURE__ */ e(Re, { className: "size-4" }),
|
|
@@ -2150,7 +2170,7 @@ function La({ side: a = "left" }) {
|
|
|
2150
2170
|
pe,
|
|
2151
2171
|
{
|
|
2152
2172
|
className: "text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer flex items-center gap-2",
|
|
2153
|
-
onSelect: () =>
|
|
2173
|
+
onSelect: () => B(h),
|
|
2154
2174
|
children: [
|
|
2155
2175
|
/* @__PURE__ */ e(Jt, { className: "size-4" }),
|
|
2156
2176
|
/* @__PURE__ */ e("span", { children: t("delete_conversation") })
|
|
@@ -2164,9 +2184,9 @@ function La({ side: a = "left" }) {
|
|
|
2164
2184
|
)
|
|
2165
2185
|
] }) }, N);
|
|
2166
2186
|
}),
|
|
2167
|
-
!y && P.length === 0 && !
|
|
2187
|
+
!y && P.length === 0 && !j && /* @__PURE__ */ e("div", { className: "px-4 py-8 text-center text-sm opacity-40", children: t("no_conversations") })
|
|
2168
2188
|
] }),
|
|
2169
|
-
/* @__PURE__ */ e("div", { ref:
|
|
2189
|
+
/* @__PURE__ */ e("div", { ref: _, className: "h-4 w-full" }),
|
|
2170
2190
|
c && /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-2 p-4 pt-0 opacity-60", children: [
|
|
2171
2191
|
/* @__PURE__ */ e("div", { className: "size-4 border-2 border-primary border-t-transparent rounded-full animate-spin" }),
|
|
2172
2192
|
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wider font-medium", children: t("loading_more") })
|
|
@@ -2174,7 +2194,7 @@ function La({ side: a = "left" }) {
|
|
|
2174
2194
|
] })
|
|
2175
2195
|
] }) }),
|
|
2176
2196
|
/* @__PURE__ */ e(Ea, {}),
|
|
2177
|
-
/* @__PURE__ */ e(Ge, { open:
|
|
2197
|
+
/* @__PURE__ */ e(Ge, { open: G, onOpenChange: M, children: /* @__PURE__ */ s(
|
|
2178
2198
|
We,
|
|
2179
2199
|
{
|
|
2180
2200
|
onKeyDown: (h) => {
|
|
@@ -2238,8 +2258,8 @@ function er({
|
|
|
2238
2258
|
] });
|
|
2239
2259
|
}
|
|
2240
2260
|
function tr({ children: a }) {
|
|
2241
|
-
const [t, d] =
|
|
2242
|
-
return
|
|
2261
|
+
const [t, d] = T(null), o = Je(), n = Te(), i = he(), r = oe();
|
|
2262
|
+
return K(() => {
|
|
2243
2263
|
(async () => {
|
|
2244
2264
|
const c = new URLSearchParams(o.search), y = c.get("token");
|
|
2245
2265
|
if (y)
|
|
@@ -2266,43 +2286,43 @@ function tr({ children: a }) {
|
|
|
2266
2286
|
}
|
|
2267
2287
|
const ze = (a) => a.replace(/[^0-9]/g, "");
|
|
2268
2288
|
function ar() {
|
|
2269
|
-
const { t: a, i18n: t } = ue(["login", "translation"]), { app: d } = ne(), o = oe(), n = t.dir() === "rtl", i = n ? "text-right" : "text-left", r = Te(), u = he(), [c, y] =
|
|
2289
|
+
const { t: a, i18n: t } = ue(["login", "translation"]), { app: d } = ne(), o = oe(), n = t.dir() === "rtl", i = n ? "text-right" : "text-left", r = Te(), u = he(), [c, y] = T("login"), k = !!d?.disableSignup, g = !!d?.disableAuthPage, [p, A] = T(""), [P, I] = T(""), [R, E] = T(""), [L, _] = T(""), [Q, x] = T(""), [V, G] = T(""), M = W(
|
|
2270
2290
|
() => d?.userMetadataFields?.filter((m) => m.showInSignup) || [],
|
|
2271
2291
|
[d?.userMetadataFields]
|
|
2272
|
-
), [
|
|
2292
|
+
), [D, J] = T(() => {
|
|
2273
2293
|
const m = {};
|
|
2274
2294
|
return M.forEach((C) => {
|
|
2275
2295
|
C.defaultValue !== void 0 && (m[C.key] = C.defaultValue);
|
|
2276
2296
|
}), m;
|
|
2277
2297
|
});
|
|
2278
|
-
|
|
2279
|
-
const m = {
|
|
2298
|
+
K(() => {
|
|
2299
|
+
const m = { ...D };
|
|
2280
2300
|
let C = !1;
|
|
2281
2301
|
M.forEach((f) => {
|
|
2282
|
-
f.condition && !ye(f.condition,
|
|
2283
|
-
}), C &&
|
|
2284
|
-
}, [
|
|
2285
|
-
const [
|
|
2286
|
-
|
|
2302
|
+
f.condition && !ye(f.condition, D) && m[f.key] !== void 0 && (delete m[f.key], C = !0);
|
|
2303
|
+
}), C && J(m);
|
|
2304
|
+
}, [D, M]);
|
|
2305
|
+
const [j, q] = T(""), [F, O] = T(!1);
|
|
2306
|
+
K(() => {
|
|
2287
2307
|
k && c === "register" && y("login");
|
|
2288
2308
|
}, [k, c]);
|
|
2289
|
-
const
|
|
2290
|
-
m.preventDefault(),
|
|
2309
|
+
const $ = async (m) => {
|
|
2310
|
+
m.preventDefault(), q(""), O(!0);
|
|
2291
2311
|
try {
|
|
2292
2312
|
await o.login(p, P), u.clear(), r("/");
|
|
2293
2313
|
} catch (C) {
|
|
2294
|
-
|
|
2314
|
+
q(de(C, a));
|
|
2295
2315
|
} finally {
|
|
2296
|
-
|
|
2316
|
+
O(!1);
|
|
2297
2317
|
}
|
|
2298
2318
|
}, w = async (m) => {
|
|
2299
|
-
m.preventDefault(),
|
|
2319
|
+
m.preventDefault(), q(""), O(!0);
|
|
2300
2320
|
try {
|
|
2301
|
-
await o.register(
|
|
2321
|
+
await o.register(R, L, Q, V, D), u.clear(), r("/");
|
|
2302
2322
|
} catch (C) {
|
|
2303
|
-
|
|
2323
|
+
q(de(C, a));
|
|
2304
2324
|
} finally {
|
|
2305
|
-
|
|
2325
|
+
O(!1);
|
|
2306
2326
|
}
|
|
2307
2327
|
};
|
|
2308
2328
|
return g ? /* @__PURE__ */ e(
|
|
@@ -2329,7 +2349,7 @@ function ar() {
|
|
|
2329
2349
|
{
|
|
2330
2350
|
type: "button",
|
|
2331
2351
|
onClick: () => {
|
|
2332
|
-
y("login"),
|
|
2352
|
+
y("login"), q("");
|
|
2333
2353
|
},
|
|
2334
2354
|
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${c === "login" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
2335
2355
|
children: a("login_tab", "Login")
|
|
@@ -2340,14 +2360,14 @@ function ar() {
|
|
|
2340
2360
|
{
|
|
2341
2361
|
type: "button",
|
|
2342
2362
|
onClick: () => {
|
|
2343
|
-
y("register"),
|
|
2363
|
+
y("register"), q("");
|
|
2344
2364
|
},
|
|
2345
2365
|
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${c === "register" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
2346
2366
|
children: a("signup_tab", "Sign Up")
|
|
2347
2367
|
}
|
|
2348
2368
|
)
|
|
2349
2369
|
] }),
|
|
2350
|
-
c === "login" && /* @__PURE__ */ s("form", { onSubmit:
|
|
2370
|
+
c === "login" && /* @__PURE__ */ s("form", { onSubmit: $, className: "space-y-4", children: [
|
|
2351
2371
|
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
2352
2372
|
/* @__PURE__ */ e(X, { htmlFor: "login-phone", children: a("phone", "Phone") }),
|
|
2353
2373
|
/* @__PURE__ */ e(
|
|
@@ -2380,8 +2400,8 @@ function ar() {
|
|
|
2380
2400
|
}
|
|
2381
2401
|
)
|
|
2382
2402
|
] }),
|
|
2383
|
-
|
|
2384
|
-
/* @__PURE__ */ e(ae, { type: "submit", disabled:
|
|
2403
|
+
j && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: j }),
|
|
2404
|
+
/* @__PURE__ */ e(ae, { type: "submit", disabled: F, className: "w-full font-semibold", children: F ? a("logging_in", "Logging in...") : a("login_button", "Login") })
|
|
2385
2405
|
] }),
|
|
2386
2406
|
!k && c === "register" && /* @__PURE__ */ s("form", { onSubmit: w, className: "space-y-4", children: [
|
|
2387
2407
|
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
@@ -2391,8 +2411,8 @@ function ar() {
|
|
|
2391
2411
|
{
|
|
2392
2412
|
id: "reg-phone",
|
|
2393
2413
|
type: "tel",
|
|
2394
|
-
value:
|
|
2395
|
-
onChange: (m) =>
|
|
2414
|
+
value: R,
|
|
2415
|
+
onChange: (m) => E(ze(m.target.value)),
|
|
2396
2416
|
required: !0,
|
|
2397
2417
|
className: "text-left",
|
|
2398
2418
|
placeholder: a("phone_placeholder", "Phone number"),
|
|
@@ -2407,8 +2427,8 @@ function ar() {
|
|
|
2407
2427
|
{
|
|
2408
2428
|
id: "reg-pass",
|
|
2409
2429
|
type: "password",
|
|
2410
|
-
value:
|
|
2411
|
-
onChange: (m) =>
|
|
2430
|
+
value: L,
|
|
2431
|
+
onChange: (m) => _(m.target.value),
|
|
2412
2432
|
required: !0,
|
|
2413
2433
|
className: "text-left",
|
|
2414
2434
|
placeholder: "••••••••",
|
|
@@ -2424,7 +2444,7 @@ function ar() {
|
|
|
2424
2444
|
{
|
|
2425
2445
|
id: "reg-name",
|
|
2426
2446
|
type: "text",
|
|
2427
|
-
value:
|
|
2447
|
+
value: Q,
|
|
2428
2448
|
onChange: (m) => x(m.target.value),
|
|
2429
2449
|
required: !0,
|
|
2430
2450
|
className: i,
|
|
@@ -2440,7 +2460,7 @@ function ar() {
|
|
|
2440
2460
|
id: "reg-surname",
|
|
2441
2461
|
type: "text",
|
|
2442
2462
|
value: V,
|
|
2443
|
-
onChange: (m) =>
|
|
2463
|
+
onChange: (m) => G(m.target.value),
|
|
2444
2464
|
required: !0,
|
|
2445
2465
|
className: i,
|
|
2446
2466
|
placeholder: a("surname_placeholder", "Last Name")
|
|
@@ -2448,7 +2468,7 @@ function ar() {
|
|
|
2448
2468
|
)
|
|
2449
2469
|
] })
|
|
2450
2470
|
] }),
|
|
2451
|
-
M.map((m) => ye(m.condition,
|
|
2471
|
+
M.map((m) => ye(m.condition, D) ? /* @__PURE__ */ s(
|
|
2452
2472
|
"div",
|
|
2453
2473
|
{
|
|
2454
2474
|
className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200",
|
|
@@ -2457,8 +2477,8 @@ function ar() {
|
|
|
2457
2477
|
m.type === "select" ? /* @__PURE__ */ s(
|
|
2458
2478
|
we,
|
|
2459
2479
|
{
|
|
2460
|
-
value: String(
|
|
2461
|
-
onValueChange: (C) =>
|
|
2480
|
+
value: String(D[m.key] || ""),
|
|
2481
|
+
onValueChange: (C) => J({ ...D, [m.key]: C }),
|
|
2462
2482
|
required: m.required,
|
|
2463
2483
|
dir: n ? "rtl" : "ltr",
|
|
2464
2484
|
children: [
|
|
@@ -2471,8 +2491,8 @@ function ar() {
|
|
|
2471
2491
|
wt,
|
|
2472
2492
|
{
|
|
2473
2493
|
id: `signup-${m.key}`,
|
|
2474
|
-
checked:
|
|
2475
|
-
onCheckedChange: (C) =>
|
|
2494
|
+
checked: !!D[m.key],
|
|
2495
|
+
onCheckedChange: (C) => J({ ...D, [m.key]: !!C }),
|
|
2476
2496
|
required: m.required
|
|
2477
2497
|
}
|
|
2478
2498
|
),
|
|
@@ -2489,8 +2509,8 @@ function ar() {
|
|
|
2489
2509
|
{
|
|
2490
2510
|
id: `signup-${m.key}`,
|
|
2491
2511
|
type: m.type,
|
|
2492
|
-
value:
|
|
2493
|
-
onChange: (C) =>
|
|
2512
|
+
value: D[m.key] || "",
|
|
2513
|
+
onChange: (C) => J({ ...D, [m.key]: C.target.value }),
|
|
2494
2514
|
required: m.required,
|
|
2495
2515
|
className: i,
|
|
2496
2516
|
placeholder: a(m.placeholder || "")
|
|
@@ -2500,18 +2520,18 @@ function ar() {
|
|
|
2500
2520
|
},
|
|
2501
2521
|
m.key
|
|
2502
2522
|
) : null),
|
|
2503
|
-
|
|
2504
|
-
/* @__PURE__ */ e(ae, { type: "submit", disabled:
|
|
2523
|
+
j && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: j }),
|
|
2524
|
+
/* @__PURE__ */ e(ae, { type: "submit", disabled: F, className: "w-full font-semibold", children: F ? a("signing_up", "Signing up...") : a("signup_button", "Sign Up") })
|
|
2505
2525
|
] })
|
|
2506
2526
|
] })
|
|
2507
2527
|
}
|
|
2508
2528
|
);
|
|
2509
2529
|
}
|
|
2510
2530
|
function Fa() {
|
|
2511
|
-
const { shareId: a } = aa(), [t, d] =
|
|
2512
|
-
return
|
|
2531
|
+
const { shareId: a } = aa(), [t, d] = T(null), [o, n] = T(!0), [i, r] = T(null), { MessageList: u } = ne(), c = oe(), y = re(/* @__PURE__ */ new Set());
|
|
2532
|
+
return K(() => () => {
|
|
2513
2533
|
y.current.forEach((k) => URL.revokeObjectURL(k)), y.current.clear();
|
|
2514
|
-
}, []),
|
|
2534
|
+
}, []), K(() => {
|
|
2515
2535
|
if (!a) return;
|
|
2516
2536
|
(async () => {
|
|
2517
2537
|
try {
|
|
@@ -2525,10 +2545,10 @@ function Fa() {
|
|
|
2525
2545
|
const I = ge(P);
|
|
2526
2546
|
if (I.type === "file" && I.object_name && !I.url)
|
|
2527
2547
|
try {
|
|
2528
|
-
const
|
|
2529
|
-
return y.current.add(
|
|
2530
|
-
} catch (
|
|
2531
|
-
console.error("Failed to resolve shared attachment:", I.object_name,
|
|
2548
|
+
const R = await c.getPublicAttachmentBlobUrl(I.object_name);
|
|
2549
|
+
return y.current.add(R), { ...I, url: R };
|
|
2550
|
+
} catch (R) {
|
|
2551
|
+
console.error("Failed to resolve shared attachment:", I.object_name, R);
|
|
2532
2552
|
}
|
|
2533
2553
|
return I;
|
|
2534
2554
|
})
|
|
@@ -2608,5 +2628,6 @@ export {
|
|
|
2608
2628
|
da as useGentiqChat,
|
|
2609
2629
|
Pr as useGentiqUser,
|
|
2610
2630
|
lr as useTranslation,
|
|
2631
|
+
Er as useTypewriter,
|
|
2611
2632
|
cr as withTranslation
|
|
2612
2633
|
};
|