gentiq 0.10.1 → 0.10.3
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/gentiq-admin.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsx as e, jsxs as r, Fragment as
|
|
2
|
-
import { useState as y, useEffect as H, useMemo as
|
|
3
|
-
import
|
|
4
|
-
import { useTranslation as F, initReactI18next as
|
|
5
|
-
import { G as Ke, u as
|
|
6
|
-
import { useNavigate as
|
|
7
|
-
import { Share2 as
|
|
8
|
-
import { toast as
|
|
9
|
-
import { useQuery as oe, useQueryClient as
|
|
10
|
-
import * as
|
|
11
|
-
const
|
|
12
|
-
class
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as et } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useEffect as H, useMemo as he, useRef as tt } from "react";
|
|
3
|
+
import ct from "i18next";
|
|
4
|
+
import { useTranslation as F, initReactI18next as ut, I18nextProvider as mt } from "react-i18next";
|
|
5
|
+
import { G as Ke, u as be, p as Pe, z as rt, S as X, t as Y, v as ee, w as te, x as E, i as ke, q as Qe, P as we, D as Ce, s as Le, K as qe, M as je, N as Te, L as U, I as se, aa as Ae, ab as Se, B as ne, O as Je, ac as Ue, r as ht, m as $e, n as Oe, o as Ee, E as pt, F as gt, H as ft, J as bt, ad as xt, d as vt, T as yt } from "./checkbox-Bk6TjhJn.js";
|
|
6
|
+
import { useNavigate as _t, useLocation as Nt, Routes as wt, Route as ue, Navigate as Ge } from "react-router-dom";
|
|
7
|
+
import { Share2 as kt, Info as Ct, ArrowUpDown as St, ArrowUp as Lt, ArrowDown as qt, UsersRound as jt, Globe as Fe, RefreshCcw as at, Palette as Tt, Keyboard as At, Wrench as Dt, Play as ze, History as It, Terminal as Rt, ChevronDown as nt, Loader2 as Be, AlertTriangle as Mt, Ban as $t, Plus as Ot, Hash as Et, Wallet as Ft, Languages as Pt, ShieldAlert as Jt, Monitor as Ze, Moon as Ut, Sun as zt, LogOut as Bt } from "lucide-react";
|
|
8
|
+
import { toast as fe } from "sonner";
|
|
9
|
+
import { useQuery as oe, useQueryClient as _e, useMutation as ae, keepPreviousData as Vt } from "@tanstack/react-query";
|
|
10
|
+
import * as Xe from "@radix-ui/react-switch";
|
|
11
|
+
const Ye = "/api";
|
|
12
|
+
class Ht {
|
|
13
13
|
token = null;
|
|
14
14
|
constructor() {
|
|
15
15
|
this.token = localStorage.getItem("admin_token");
|
|
@@ -26,7 +26,7 @@ class Qt {
|
|
|
26
26
|
async request(a, s = {}) {
|
|
27
27
|
const d = new Headers(s.headers);
|
|
28
28
|
d.has("Content-Type") || d.set("Content-Type", "application/json"), this.token && d.set("Authorization", `Bearer ${this.token}`);
|
|
29
|
-
const o = await fetch(`${
|
|
29
|
+
const o = await fetch(`${Ye}${a}`, {
|
|
30
30
|
...s,
|
|
31
31
|
headers: d
|
|
32
32
|
});
|
|
@@ -230,7 +230,7 @@ class Qt {
|
|
|
230
230
|
async getAttachmentBlob(a) {
|
|
231
231
|
const s = {};
|
|
232
232
|
this.token && (s.Authorization = `Bearer ${this.token}`);
|
|
233
|
-
const d = await fetch(`${
|
|
233
|
+
const d = await fetch(`${Ye}/admin/chat-history/attachments/${a}`, {
|
|
234
234
|
method: "GET",
|
|
235
235
|
headers: s
|
|
236
236
|
});
|
|
@@ -241,9 +241,9 @@ class Qt {
|
|
|
241
241
|
return d.blob();
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
const T = new
|
|
245
|
-
function
|
|
246
|
-
const { t: a, i18n: s } = F(["admin", "translation"]), { app: d } =
|
|
244
|
+
const T = new Ht();
|
|
245
|
+
function Wt({ onLoginSuccess: t }) {
|
|
246
|
+
const { t: a, i18n: s } = F(["admin", "translation"]), { app: d } = be(), { theme: o } = Pe(), [n, l] = y(""), [g, _] = y(""), [S, w] = y(""), [x, i] = y(""), [b, h] = y(!1), [N, D] = y(null), [p, R] = y("light");
|
|
247
247
|
H(() => {
|
|
248
248
|
if (o === "system") {
|
|
249
249
|
const v = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -251,7 +251,7 @@ function Kt({ onLoginSuccess: t }) {
|
|
|
251
251
|
} else
|
|
252
252
|
R(o);
|
|
253
253
|
}, [o]);
|
|
254
|
-
const
|
|
254
|
+
const c = he(() => d?.logo ? typeof d.logo == "string" ? d.logo : p === "dark" ? d.logo.dark : d.logo.light : rt, [d?.logo, p]), f = d?.adminTitle || d?.name, C = s.language === "fa";
|
|
255
255
|
H(() => {
|
|
256
256
|
T.checkSetupStatus().then((v) => D(v.needs_setup)).catch(() => D(!1));
|
|
257
257
|
}, []);
|
|
@@ -299,7 +299,7 @@ function Kt({ onLoginSuccess: t }) {
|
|
|
299
299
|
/* @__PURE__ */ r("div", { className: "glass rounded-3xl p-10 shadow-2xl", children: [
|
|
300
300
|
/* @__PURE__ */ r("div", { className: "text-center mb-10", children: [
|
|
301
301
|
/* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-4 mb-6", children: [
|
|
302
|
-
/* @__PURE__ */ e("img", { src:
|
|
302
|
+
/* @__PURE__ */ e("img", { src: c, alt: f, className: "size-16 object-contain" }),
|
|
303
303
|
/* @__PURE__ */ e("h1", { className: "text-3xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: N ? a("login.setup_title") : f })
|
|
304
304
|
] }),
|
|
305
305
|
N && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-3", children: a("login.setup_description") })
|
|
@@ -451,18 +451,18 @@ function Kt({ onLoginSuccess: t }) {
|
|
|
451
451
|
);
|
|
452
452
|
}
|
|
453
453
|
const re = "gentiq_admin";
|
|
454
|
-
function
|
|
454
|
+
function Kt(t = 0, a = 100, s = "", d = "name", o = "asc", n = "human") {
|
|
455
455
|
return oe({
|
|
456
456
|
queryKey: [re, "users", t, a, s, d, o, n],
|
|
457
457
|
queryFn: () => T.listUsers(t, a, s, d, o, n),
|
|
458
458
|
// Infinite scroll grows `limit`, which changes the query key. Keep the previous
|
|
459
459
|
// (smaller) page mounted while the larger one loads so the list never collapses to
|
|
460
460
|
// empty — otherwise the scroll container resets to the top on every "load more".
|
|
461
|
-
placeholderData:
|
|
461
|
+
placeholderData: Vt
|
|
462
462
|
});
|
|
463
463
|
}
|
|
464
|
-
function
|
|
465
|
-
const t =
|
|
464
|
+
function Qt() {
|
|
465
|
+
const t = _e(), a = () => {
|
|
466
466
|
t.invalidateQueries({ queryKey: [re, "users"] });
|
|
467
467
|
}, s = ae({
|
|
468
468
|
mutationFn: (g) => T.createUser(
|
|
@@ -499,20 +499,20 @@ function Zt() {
|
|
|
499
499
|
});
|
|
500
500
|
return { createUser: s, updateUser: d, deleteUser: o, updateBalance: n, refreshToken: l };
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function Gt(t = 30, a = "human") {
|
|
503
503
|
return oe({
|
|
504
504
|
queryKey: [re, "analytics", t, a],
|
|
505
505
|
queryFn: () => T.getAnalytics(t, a)
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
|
-
function
|
|
508
|
+
function Zt() {
|
|
509
509
|
return oe({
|
|
510
510
|
queryKey: [re, "admins"],
|
|
511
511
|
queryFn: () => T.listAdmins()
|
|
512
512
|
});
|
|
513
513
|
}
|
|
514
|
-
function
|
|
515
|
-
const t =
|
|
514
|
+
function Xt() {
|
|
515
|
+
const t = _e(), a = () => {
|
|
516
516
|
t.invalidateQueries({ queryKey: [re, "admins"] });
|
|
517
517
|
}, s = ae({
|
|
518
518
|
mutationFn: (n) => T.register(n.username, n.password, n.name, n.permissions),
|
|
@@ -529,20 +529,20 @@ function er() {
|
|
|
529
529
|
});
|
|
530
530
|
return { createAdmin: s, updateAdmin: d, deleteAdmin: o };
|
|
531
531
|
}
|
|
532
|
-
function
|
|
532
|
+
function Yt(t = 0, a = 50, s, d, o = "human") {
|
|
533
533
|
return oe({
|
|
534
534
|
queryKey: [re, "threads", t, a, s, d, o],
|
|
535
535
|
queryFn: () => T.listThreads(t, a, s, d, o)
|
|
536
536
|
});
|
|
537
537
|
}
|
|
538
|
-
function
|
|
538
|
+
function er(t) {
|
|
539
539
|
return oe({
|
|
540
540
|
queryKey: [re, "threadItems", t],
|
|
541
541
|
queryFn: () => T.getThreadItems(t),
|
|
542
542
|
enabled: !!t
|
|
543
543
|
});
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function Pr(t = 20, a) {
|
|
546
546
|
return oe({
|
|
547
547
|
queryKey: [re, "jobs", t, a],
|
|
548
548
|
queryFn: () => T.listJobs(t, a),
|
|
@@ -550,8 +550,8 @@ function Ur(t = 20, a) {
|
|
|
550
550
|
// Auto-refresh jobs every 5 seconds
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
|
-
function
|
|
554
|
-
const t =
|
|
553
|
+
function Jr() {
|
|
554
|
+
const t = _e();
|
|
555
555
|
return { cancelJob: ae({
|
|
556
556
|
mutationFn: (d) => T.cancelJob(d),
|
|
557
557
|
onSuccess: () => {
|
|
@@ -559,14 +559,14 @@ function zr() {
|
|
|
559
559
|
}
|
|
560
560
|
}) };
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function tr(t = !0) {
|
|
563
563
|
return oe({
|
|
564
564
|
queryKey: [re, "registeredJobs"],
|
|
565
565
|
queryFn: () => T.listRegisteredJobs(),
|
|
566
566
|
enabled: t
|
|
567
567
|
});
|
|
568
568
|
}
|
|
569
|
-
function
|
|
569
|
+
function rr(t = {}, a = !0) {
|
|
570
570
|
return oe({
|
|
571
571
|
queryKey: [re, "jobRuns", t],
|
|
572
572
|
queryFn: () => T.listJobRuns(t),
|
|
@@ -575,7 +575,7 @@ function nr(t = {}, a = !0) {
|
|
|
575
575
|
enabled: a
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function ar(t, a = !1) {
|
|
579
579
|
return oe({
|
|
580
580
|
queryKey: [re, "jobRun", t],
|
|
581
581
|
queryFn: () => T.getJobRun(t),
|
|
@@ -583,8 +583,8 @@ function sr(t, a = !1) {
|
|
|
583
583
|
refetchInterval: a ? 2e3 : !1
|
|
584
584
|
});
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
const t =
|
|
586
|
+
function Ve() {
|
|
587
|
+
const t = _e(), a = () => t.invalidateQueries({ queryKey: [re, "jobRuns"] }), s = ae({
|
|
588
588
|
mutationFn: (n) => T.runRegisteredJob(n.jobId, {
|
|
589
589
|
params: n.params,
|
|
590
590
|
dry_run: n.dry_run,
|
|
@@ -600,7 +600,7 @@ function He() {
|
|
|
600
600
|
});
|
|
601
601
|
return { runRegisteredJob: s, runRawJob: d, cancelJobRun: o };
|
|
602
602
|
}
|
|
603
|
-
function
|
|
603
|
+
function Ur() {
|
|
604
604
|
return {
|
|
605
605
|
login: async (t, a) => T.login(t, a),
|
|
606
606
|
logout: () => T.clearToken(),
|
|
@@ -608,7 +608,7 @@ function Br() {
|
|
|
608
608
|
isAuthenticated: !!T.getToken()
|
|
609
609
|
};
|
|
610
610
|
}
|
|
611
|
-
function
|
|
611
|
+
function st(t, a, s) {
|
|
612
612
|
const d = (t || 0) / 1e6;
|
|
613
613
|
try {
|
|
614
614
|
return new Intl.NumberFormat(s, {
|
|
@@ -621,7 +621,7 @@ function it(t, a, s) {
|
|
|
621
621
|
return `${a} ${d.toLocaleString(s, { maximumFractionDigits: 6 })}`;
|
|
622
622
|
}
|
|
623
623
|
}
|
|
624
|
-
function
|
|
624
|
+
function me(t, a, s) {
|
|
625
625
|
const d = (t || 0) / 1e6;
|
|
626
626
|
try {
|
|
627
627
|
return new Intl.NumberFormat(s, {
|
|
@@ -637,58 +637,58 @@ function pe(t, a, s) {
|
|
|
637
637
|
})}`;
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
|
-
function
|
|
641
|
-
const { t, i18n: a } = F(["admin", "translation"]), { app: s } =
|
|
640
|
+
function nr() {
|
|
641
|
+
const { t, i18n: a } = F(["admin", "translation"]), { app: s } = be(), d = s?.userMetadataFields || [], [o, n] = y(null), [l, g] = y(""), [_, S] = y(""), [w, x] = y(""), [i, b] = y("human"), [h, N] = y(0), [D, p] = y([]), [R, c] = y(!0), [f, C] = y(""), L = a.language === "fa", $ = L ? "fa-IR" : "en-US";
|
|
642
642
|
H(() => {
|
|
643
|
-
const
|
|
644
|
-
return () => clearTimeout(
|
|
643
|
+
const u = setTimeout(() => S(l), 500);
|
|
644
|
+
return () => clearTimeout(u);
|
|
645
645
|
}, [l]);
|
|
646
|
-
const v =
|
|
646
|
+
const v = Yt(
|
|
647
647
|
h,
|
|
648
648
|
50,
|
|
649
649
|
_ || void 0,
|
|
650
650
|
w || void 0,
|
|
651
651
|
i
|
|
652
|
-
), O =
|
|
652
|
+
), O = er(o?.id ?? "");
|
|
653
653
|
H(() => {
|
|
654
|
-
N(0), p([]),
|
|
654
|
+
N(0), p([]), c(!0);
|
|
655
655
|
}, [_, w, i]), H(() => {
|
|
656
|
-
const
|
|
657
|
-
|
|
656
|
+
const u = v.data?.threads;
|
|
657
|
+
u && (p((j) => h === 0 ? u : [...j, ...u]), c(u.length === 50));
|
|
658
658
|
}, [v.data, h]);
|
|
659
|
-
const P = O.data?.items ?? [], Z = v.isLoading, k = v.isFetching && h > 0, m = O.isLoading,
|
|
660
|
-
n(
|
|
661
|
-
},
|
|
662
|
-
N((
|
|
663
|
-
}, M = async (
|
|
664
|
-
|
|
659
|
+
const P = O.data?.items ?? [], Z = v.isLoading, k = v.isFetching && h > 0, m = O.isLoading, q = f || (v.error instanceof Error ? v.error.message : "") || (O.error instanceof Error ? O.error.message : "") || (v.error || O.error ? t("error_loading") : ""), A = (u) => {
|
|
660
|
+
n(u);
|
|
661
|
+
}, K = () => {
|
|
662
|
+
N((u) => u + 50);
|
|
663
|
+
}, M = async (u, j) => {
|
|
664
|
+
u.stopPropagation();
|
|
665
665
|
try {
|
|
666
|
-
const I = await T.shareThread(
|
|
667
|
-
navigator.clipboard.writeText(
|
|
666
|
+
const I = await T.shareThread(j.id), V = `${window.location.origin}${I.url}`;
|
|
667
|
+
navigator.clipboard.writeText(V), fe.success(t("sidebar:share_success"), {
|
|
668
668
|
description: t("sidebar:share_description")
|
|
669
669
|
});
|
|
670
670
|
} catch {
|
|
671
|
-
|
|
671
|
+
fe.error(t("sidebar:share_failed"));
|
|
672
672
|
}
|
|
673
|
-
}, z = (
|
|
674
|
-
const
|
|
673
|
+
}, z = (u) => {
|
|
674
|
+
const j = new Date(u);
|
|
675
675
|
return new Intl.DateTimeFormat(L ? "fa-IR" : "en-US", {
|
|
676
676
|
year: "numeric",
|
|
677
677
|
month: "long",
|
|
678
678
|
day: "numeric",
|
|
679
679
|
hour: "2-digit",
|
|
680
680
|
minute: "2-digit"
|
|
681
|
-
}).format(
|
|
682
|
-
},
|
|
683
|
-
if (typeof
|
|
681
|
+
}).format(j);
|
|
682
|
+
}, Q = (u) => {
|
|
683
|
+
if (typeof u == "string")
|
|
684
684
|
try {
|
|
685
|
-
return JSON.stringify(JSON.parse(
|
|
685
|
+
return JSON.stringify(JSON.parse(u), null, 2);
|
|
686
686
|
} catch {
|
|
687
|
-
return
|
|
687
|
+
return u;
|
|
688
688
|
}
|
|
689
|
-
return JSON.stringify(
|
|
690
|
-
}, W = ({ part:
|
|
691
|
-
const [I,
|
|
689
|
+
return JSON.stringify(u, null, 2);
|
|
690
|
+
}, W = ({ part: u, idx: j }) => {
|
|
691
|
+
const [I, V] = y(!1), G = u.tool_name || (u.type && u.type.startsWith("tool-") ? u.type.slice(5) : "tool");
|
|
692
692
|
return /* @__PURE__ */ r(
|
|
693
693
|
"div",
|
|
694
694
|
{
|
|
@@ -698,7 +698,7 @@ function or() {
|
|
|
698
698
|
/* @__PURE__ */ r(
|
|
699
699
|
"div",
|
|
700
700
|
{
|
|
701
|
-
onClick: () =>
|
|
701
|
+
onClick: () => V(!I),
|
|
702
702
|
className: "px-2.5 py-1.5 bg-muted/50 border-b border-border/50 flex items-center justify-between cursor-pointer hover:bg-accent transition-colors",
|
|
703
703
|
children: [
|
|
704
704
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
@@ -726,8 +726,8 @@ function or() {
|
|
|
726
726
|
/* @__PURE__ */ e(
|
|
727
727
|
"span",
|
|
728
728
|
{
|
|
729
|
-
className: `text-[10px] px-2 py-0.5 rounded-full ${
|
|
730
|
-
children:
|
|
729
|
+
className: `text-[10px] px-2 py-0.5 rounded-full ${u.state === "output-available" ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"}`,
|
|
730
|
+
children: u.state === "output-available" ? t("chat_history.output_available") : t("chat_history.running")
|
|
731
731
|
}
|
|
732
732
|
)
|
|
733
733
|
]
|
|
@@ -736,52 +736,35 @@ function or() {
|
|
|
736
736
|
I && /* @__PURE__ */ r("div", { className: "p-2.5 space-y-2.5 animate-in fade-in slide-in-from-top-1 duration-200", children: [
|
|
737
737
|
/* @__PURE__ */ r("div", { children: [
|
|
738
738
|
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: "Input" }),
|
|
739
|
-
/* @__PURE__ */ e("pre", { className: "text-xs bg-black/5 dark:bg-black/20 p-2 rounded-lg overflow-x-auto", children:
|
|
739
|
+
/* @__PURE__ */ e("pre", { className: "text-xs bg-black/5 dark:bg-black/20 p-2 rounded-lg overflow-x-auto", children: Q(u.input) })
|
|
740
740
|
] }),
|
|
741
|
-
(
|
|
742
|
-
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children:
|
|
741
|
+
(u.output || u.error_text || u.errorText) && /* @__PURE__ */ r("div", { children: [
|
|
742
|
+
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: u.error_text || u.errorText ? "Error" : "Output" }),
|
|
743
743
|
/* @__PURE__ */ e(
|
|
744
744
|
"pre",
|
|
745
745
|
{
|
|
746
|
-
className: `text-xs p-2 rounded-lg overflow-x-auto ${
|
|
747
|
-
children:
|
|
746
|
+
className: `text-xs p-2 rounded-lg overflow-x-auto ${u.error_text || u.errorText ? "bg-destructive/10 text-destructive" : "bg-primary/5 text-foreground/80"}`,
|
|
747
|
+
children: Q(u.output || u.error_text || u.errorText)
|
|
748
748
|
}
|
|
749
749
|
)
|
|
750
750
|
] })
|
|
751
751
|
] })
|
|
752
752
|
]
|
|
753
753
|
},
|
|
754
|
-
|
|
754
|
+
j
|
|
755
755
|
);
|
|
756
|
-
},
|
|
756
|
+
}, B = async (u, j) => {
|
|
757
757
|
try {
|
|
758
|
-
const I = await T.getAttachmentBlob(
|
|
759
|
-
G.href =
|
|
758
|
+
const I = await T.getAttachmentBlob(u), V = window.URL.createObjectURL(I), G = document.createElement("a");
|
|
759
|
+
G.href = V, G.download = j || u.split("/").pop() || "download", document.body.appendChild(G), G.click(), window.URL.revokeObjectURL(V), document.body.removeChild(G);
|
|
760
760
|
} catch (I) {
|
|
761
761
|
console.error("Download failed:", I), C(I instanceof Error ? I.message : "Download failed");
|
|
762
762
|
}
|
|
763
|
-
},
|
|
764
|
-
if (typeof
|
|
765
|
-
if (
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
Ge,
|
|
769
|
-
{
|
|
770
|
-
part: {
|
|
771
|
-
type: "data-choice-question",
|
|
772
|
-
data: I
|
|
773
|
-
},
|
|
774
|
-
message: {
|
|
775
|
-
id: `admin-choice-${q}`,
|
|
776
|
-
role: "assistant",
|
|
777
|
-
parts: [c]
|
|
778
|
-
},
|
|
779
|
-
disabled: !0
|
|
780
|
-
},
|
|
781
|
-
q
|
|
782
|
-
) : /* @__PURE__ */ e("div", { className: "whitespace-pre-wrap", dir: "auto", children: c.text }, q);
|
|
783
|
-
}
|
|
784
|
-
if (c.type === "reasoning")
|
|
763
|
+
}, de = (u, j) => {
|
|
764
|
+
if (typeof u == "string") return /* @__PURE__ */ e("div", { children: u }, j);
|
|
765
|
+
if (u.type === "text")
|
|
766
|
+
return /* @__PURE__ */ e("div", { className: "whitespace-pre-wrap", dir: "auto", children: u.text }, j);
|
|
767
|
+
if (u.type === "reasoning")
|
|
785
768
|
return /* @__PURE__ */ r(
|
|
786
769
|
"div",
|
|
787
770
|
{
|
|
@@ -789,13 +772,13 @@ function or() {
|
|
|
789
772
|
dir: "auto",
|
|
790
773
|
children: [
|
|
791
774
|
/* @__PURE__ */ e("div", { className: "font-bold mb-1 uppercase tracking-tighter opacity-70", children: "Reasoning" }),
|
|
792
|
-
|
|
775
|
+
u.text
|
|
793
776
|
]
|
|
794
777
|
},
|
|
795
|
-
|
|
778
|
+
j
|
|
796
779
|
);
|
|
797
|
-
if (
|
|
798
|
-
const I =
|
|
780
|
+
if (u.type === "data-reference") {
|
|
781
|
+
const I = u.data || u.reference;
|
|
799
782
|
return /* @__PURE__ */ r(
|
|
800
783
|
"div",
|
|
801
784
|
{
|
|
@@ -806,18 +789,10 @@ function or() {
|
|
|
806
789
|
/* @__PURE__ */ e("div", { className: "text-muted-foreground line-clamp-3", children: I?.excerpt || t("chat.source_unavailable", "Source unavailable") })
|
|
807
790
|
]
|
|
808
791
|
},
|
|
809
|
-
|
|
792
|
+
j
|
|
810
793
|
);
|
|
811
794
|
}
|
|
812
|
-
return
|
|
813
|
-
Ge,
|
|
814
|
-
{
|
|
815
|
-
part: c,
|
|
816
|
-
message: { id: `admin-choice-${q}`, role: "assistant", parts: [c] },
|
|
817
|
-
disabled: !0
|
|
818
|
-
},
|
|
819
|
-
q
|
|
820
|
-
) : c.type === "dynamic-tool" || c.type && c.type.startsWith("tool-") || c.tool_call_id ? /* @__PURE__ */ e(W, { part: c, idx: q }, q) : c.type === "file" ? /* @__PURE__ */ r(
|
|
795
|
+
return u.type === "data-choice-question" ? /* @__PURE__ */ e("pre", { className: "text-xs font-mono bg-muted/40 p-2.5 rounded-xl", dir: "ltr", children: JSON.stringify(u.data ?? u, null, 2) }, j) : u.type === "dynamic-tool" || u.type && u.type.startsWith("tool-") || u.tool_call_id ? /* @__PURE__ */ e(W, { part: u, idx: j }, j) : u.type === "file" ? /* @__PURE__ */ r(
|
|
821
796
|
"div",
|
|
822
797
|
{
|
|
823
798
|
className: "my-2 flex items-center justify-between p-2.5 bg-muted/40 rounded-xl border border-border group hover:border-primary/30 transition-all",
|
|
@@ -829,17 +804,17 @@ function or() {
|
|
|
829
804
|
"span",
|
|
830
805
|
{
|
|
831
806
|
className: "text-sm text-foreground font-medium truncate",
|
|
832
|
-
title:
|
|
833
|
-
children:
|
|
807
|
+
title: u.filename || "File",
|
|
808
|
+
children: u.filename || t("chat_history.unnamed_file")
|
|
834
809
|
}
|
|
835
810
|
),
|
|
836
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground uppercase tracking-wider font-bold", children:
|
|
811
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground uppercase tracking-wider font-bold", children: u.media_type || u.mime_type || u.mediaType || "file" })
|
|
837
812
|
] })
|
|
838
813
|
] }),
|
|
839
|
-
|
|
814
|
+
u.object_name && /* @__PURE__ */ e(
|
|
840
815
|
"button",
|
|
841
816
|
{
|
|
842
|
-
onClick: () =>
|
|
817
|
+
onClick: () => B(u.object_name, u.filename),
|
|
843
818
|
className: "flex-shrink-0 p-2 hover:bg-card rounded-lg border border-transparent hover:border-border transition-all text-muted-foreground hover:text-primary",
|
|
844
819
|
title: t("chat_history.download_file", "Download File"),
|
|
845
820
|
children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
@@ -855,18 +830,18 @@ function or() {
|
|
|
855
830
|
)
|
|
856
831
|
]
|
|
857
832
|
},
|
|
858
|
-
|
|
833
|
+
j
|
|
859
834
|
) : /* @__PURE__ */ e(
|
|
860
835
|
"div",
|
|
861
836
|
{
|
|
862
837
|
className: "my-2 p-2 bg-muted/40 rounded-lg border border-border text-xs font-mono opacity-60",
|
|
863
|
-
children: JSON.stringify(
|
|
838
|
+
children: JSON.stringify(u)
|
|
864
839
|
},
|
|
865
|
-
|
|
840
|
+
j
|
|
866
841
|
);
|
|
867
|
-
},
|
|
868
|
-
const { scrollTop:
|
|
869
|
-
I -
|
|
842
|
+
}, xe = (u) => {
|
|
843
|
+
const { scrollTop: j, scrollHeight: I, clientHeight: V } = u.currentTarget;
|
|
844
|
+
I - j <= V + 50 && !k && R && K();
|
|
870
845
|
};
|
|
871
846
|
return /* @__PURE__ */ r("div", { className: "p-5 h-full flex flex-col gap-4 overflow-hidden", dir: L ? "rtl" : "ltr", children: [
|
|
872
847
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -876,8 +851,8 @@ function or() {
|
|
|
876
851
|
/* @__PURE__ */ r(
|
|
877
852
|
"form",
|
|
878
853
|
{
|
|
879
|
-
onSubmit: (
|
|
880
|
-
|
|
854
|
+
onSubmit: (u) => {
|
|
855
|
+
u.preventDefault(), S(l);
|
|
881
856
|
},
|
|
882
857
|
className: "flex-1 min-w-[16rem] flex gap-2",
|
|
883
858
|
children: [
|
|
@@ -886,7 +861,7 @@ function or() {
|
|
|
886
861
|
{
|
|
887
862
|
type: "text",
|
|
888
863
|
value: l,
|
|
889
|
-
onChange: (
|
|
864
|
+
onChange: (u) => g(u.target.value),
|
|
890
865
|
placeholder: t("chat_history.search_placeholder"),
|
|
891
866
|
className: "flex-1 px-4 py-2.5 border-0 rounded-xl glass-surface text-foreground placeholder-muted-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm"
|
|
892
867
|
}
|
|
@@ -906,7 +881,7 @@ function or() {
|
|
|
906
881
|
X,
|
|
907
882
|
{
|
|
908
883
|
value: w || "all",
|
|
909
|
-
onValueChange: (
|
|
884
|
+
onValueChange: (u) => x(u === "all" ? "" : u),
|
|
910
885
|
dir: L ? "rtl" : "ltr",
|
|
911
886
|
children: [
|
|
912
887
|
/* @__PURE__ */ e(Y, { className: "min-w-[160px] px-4 py-2 h-auto text-sm font-medium rounded-xl glass-surface border-0 text-foreground shadow-sm", children: /* @__PURE__ */ e(ee, {}) }),
|
|
@@ -923,17 +898,17 @@ function or() {
|
|
|
923
898
|
X,
|
|
924
899
|
{
|
|
925
900
|
value: i,
|
|
926
|
-
onValueChange: (
|
|
901
|
+
onValueChange: (u) => b(u),
|
|
927
902
|
dir: L ? "rtl" : "ltr",
|
|
928
903
|
children: [
|
|
929
904
|
/* @__PURE__ */ e(Y, { className: "min-w-[140px] px-4 py-2 h-auto text-sm font-medium rounded-xl glass-surface border-0 text-foreground shadow-sm", children: /* @__PURE__ */ e(ee, {}) }),
|
|
930
|
-
/* @__PURE__ */ e(te, { className: "rounded-xl border-border bg-card", children: ["human", "service", "all"].map((
|
|
905
|
+
/* @__PURE__ */ e(te, { className: "rounded-xl border-border bg-card", children: ["human", "service", "all"].map((u) => /* @__PURE__ */ e(E, { value: u, children: t(`chat_history.source_${u}`) }, u)) })
|
|
931
906
|
]
|
|
932
907
|
}
|
|
933
908
|
)
|
|
934
909
|
] })
|
|
935
910
|
] }),
|
|
936
|
-
|
|
911
|
+
q && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm", children: q })
|
|
937
912
|
] }),
|
|
938
913
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-[380px_1fr] gap-4 flex-1 min-h-0", children: [
|
|
939
914
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col min-w-0", children: [
|
|
@@ -943,97 +918,97 @@ function or() {
|
|
|
943
918
|
(D.length || 0).toLocaleString($),
|
|
944
919
|
")"
|
|
945
920
|
] }) }),
|
|
946
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-2 custom-scrollbar", onScroll:
|
|
947
|
-
D.map((
|
|
921
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-2 custom-scrollbar", onScroll: xe, children: Z && D.length === 0 ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-muted-foreground text-sm", children: t("chat_history.no_threads") }) : /* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
922
|
+
D.map((u) => /* @__PURE__ */ r(
|
|
948
923
|
"div",
|
|
949
924
|
{
|
|
950
|
-
onClick: () => A(
|
|
951
|
-
className: `p-2.5 cursor-pointer transition-all rounded-xl border ${o?.id ===
|
|
925
|
+
onClick: () => A(u),
|
|
926
|
+
className: `p-2.5 cursor-pointer transition-all rounded-xl border ${o?.id === u.id ? "bg-card border-border shadow-sm" : "border-transparent hover:bg-muted/50"}`,
|
|
952
927
|
children: [
|
|
953
928
|
/* @__PURE__ */ r("div", { className: "flex justify-between items-start mb-1.5 gap-4", children: [
|
|
954
929
|
/* @__PURE__ */ e(
|
|
955
930
|
"h3",
|
|
956
931
|
{
|
|
957
|
-
className: `font-medium text-sm truncate flex-1 ${o?.id ===
|
|
958
|
-
title:
|
|
959
|
-
children:
|
|
932
|
+
className: `font-medium text-sm truncate flex-1 ${o?.id === u.id ? "text-primary" : "text-foreground"}`,
|
|
933
|
+
title: u.title || t("chat_history.no_thread_title"),
|
|
934
|
+
children: u.title || t("chat_history.no_thread_title")
|
|
960
935
|
}
|
|
961
936
|
),
|
|
962
937
|
/* @__PURE__ */ r("div", { className: "flex gap-1 items-center", children: [
|
|
963
|
-
|
|
938
|
+
u.metadata?.external_user_id && /* @__PURE__ */ e(
|
|
964
939
|
"span",
|
|
965
940
|
{
|
|
966
941
|
className: "text-[10px] px-1.5 py-0.5 rounded-md bg-primary/10 text-primary font-medium truncate max-w-[120px]",
|
|
967
|
-
title: `${t("chat_history.external_user_id")}: ${
|
|
968
|
-
children:
|
|
942
|
+
title: `${t("chat_history.external_user_id")}: ${u.metadata.external_user_id}`,
|
|
943
|
+
children: u.metadata.external_user_id
|
|
969
944
|
}
|
|
970
945
|
),
|
|
971
|
-
|
|
972
|
-
|
|
946
|
+
u.feedback_info && u.feedback_info.like > 0 && /* @__PURE__ */ e("span", { className: "text-xs", children: "👍" }),
|
|
947
|
+
u.feedback_info && u.feedback_info.dislike > 0 && /* @__PURE__ */ e("span", { className: "text-xs", children: "👎" })
|
|
973
948
|
] })
|
|
974
949
|
] }),
|
|
975
950
|
/* @__PURE__ */ r("div", { className: "text-xs space-y-1.5 text-muted-foreground", children: [
|
|
976
|
-
|
|
951
|
+
u.user_info && /* @__PURE__ */ r(
|
|
977
952
|
"div",
|
|
978
953
|
{
|
|
979
954
|
className: "flex flex-col gap-0.5 min-w-0",
|
|
980
|
-
title: `${[
|
|
981
|
-
(
|
|
982
|
-
).map((
|
|
983
|
-
const I =
|
|
984
|
-
if (
|
|
985
|
-
const
|
|
955
|
+
title: `${[u.user_info.name, u.user_info.surname].filter(Boolean).join(" ")}${u.user_info.phone ? ` • ${u.user_info.phone}` : ""}${d.filter(
|
|
956
|
+
(j) => u.user_info?.metadata?.[j.key] !== void 0 && u.user_info?.metadata?.[j.key] !== ""
|
|
957
|
+
).map((j) => {
|
|
958
|
+
const I = u.user_info?.metadata?.[j.key];
|
|
959
|
+
if (j.type === "select") {
|
|
960
|
+
const V = j.options?.find(
|
|
986
961
|
(G) => String(G.value) === String(I)
|
|
987
962
|
);
|
|
988
|
-
return ` • ${
|
|
963
|
+
return ` • ${V ? t(V.label) : I}`;
|
|
989
964
|
}
|
|
990
965
|
return ` • ${I}`;
|
|
991
966
|
}).join(
|
|
992
967
|
""
|
|
993
|
-
)}${
|
|
968
|
+
)}${u.user_info.metadata?.values !== void 0 && !d.some((j) => j.key === "values") ? ` • ${u.user_info.metadata.values}` : ""}`,
|
|
994
969
|
children: [
|
|
995
970
|
/* @__PURE__ */ r("div", { className: "font-medium text-foreground truncate flex items-center gap-1.5", children: [
|
|
996
|
-
/* @__PURE__ */ e("span", { children: [
|
|
997
|
-
|
|
971
|
+
/* @__PURE__ */ e("span", { children: [u.user_info.name, u.user_info.surname].filter(Boolean).join(" ") }),
|
|
972
|
+
u.user_info.phone && /* @__PURE__ */ r("span", { className: "text-[11px] text-foreground/70 font-normal", children: [
|
|
998
973
|
"•",
|
|
999
974
|
" ",
|
|
1000
|
-
|
|
975
|
+
u.user_info.phone
|
|
1001
976
|
] })
|
|
1002
977
|
] }),
|
|
1003
978
|
/* @__PURE__ */ r("div", { className: "text-[10px] text-muted-foreground/70 truncate flex items-center gap-1", children: [
|
|
1004
|
-
d.filter((
|
|
1005
|
-
const I =
|
|
979
|
+
d.filter((j) => {
|
|
980
|
+
const I = u.user_info?.metadata?.[j.key];
|
|
1006
981
|
return I != null && I !== "";
|
|
1007
|
-
}).map((
|
|
1008
|
-
const
|
|
1009
|
-
let G = String(
|
|
1010
|
-
if (
|
|
1011
|
-
const
|
|
1012
|
-
(
|
|
982
|
+
}).map((j, I) => {
|
|
983
|
+
const V = u.user_info?.metadata?.[j.key];
|
|
984
|
+
let G = String(V);
|
|
985
|
+
if (j.type === "select") {
|
|
986
|
+
const pe = j.options?.find(
|
|
987
|
+
(De) => String(De.value) === String(V)
|
|
1013
988
|
);
|
|
1014
|
-
|
|
1015
|
-
} else
|
|
989
|
+
pe && (G = t(pe.label));
|
|
990
|
+
} else j.type === "checkbox" && (G = V ? "✓" : "✗");
|
|
1016
991
|
return /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
1017
992
|
I > 0 && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
1018
993
|
G
|
|
1019
|
-
] },
|
|
994
|
+
] }, j.key);
|
|
1020
995
|
}),
|
|
1021
|
-
|
|
996
|
+
u.user_info.metadata?.values !== void 0 && !d.some((j) => j.key === "values") && /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
1022
997
|
d.some(
|
|
1023
|
-
(
|
|
998
|
+
(j) => u.user_info?.metadata?.[j.key] !== void 0
|
|
1024
999
|
) && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
1025
|
-
String(
|
|
1000
|
+
String(u.user_info.metadata.values)
|
|
1026
1001
|
] })
|
|
1027
1002
|
] })
|
|
1028
1003
|
]
|
|
1029
1004
|
}
|
|
1030
1005
|
),
|
|
1031
|
-
|
|
1006
|
+
u.metadata?.usage && /* @__PURE__ */ r("div", { className: "flex gap-2 mt-2 pt-2 border-border/30", children: [
|
|
1032
1007
|
/* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground", children: t("chat_history.input_tokens", {
|
|
1033
|
-
value: (
|
|
1008
|
+
value: (u.metadata.usage.cumulative_input_tokens ?? u.metadata.usage.input_tokens ?? 0).toLocaleString($)
|
|
1034
1009
|
}) }),
|
|
1035
1010
|
/* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground", children: t("chat_history.output_tokens", {
|
|
1036
|
-
value: (
|
|
1011
|
+
value: (u.metadata.usage.output_tokens || 0).toLocaleString(
|
|
1037
1012
|
$
|
|
1038
1013
|
)
|
|
1039
1014
|
}) }),
|
|
@@ -1041,26 +1016,26 @@ function or() {
|
|
|
1041
1016
|
"span",
|
|
1042
1017
|
{
|
|
1043
1018
|
className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground",
|
|
1044
|
-
title:
|
|
1045
|
-
|
|
1046
|
-
|
|
1019
|
+
title: u.metadata.usage.cost_incomplete || u.metadata.usage.total_cost_microunits === void 0 ? void 0 : st(
|
|
1020
|
+
u.metadata.usage.total_cost_microunits || 0,
|
|
1021
|
+
u.metadata.usage.currency || "USD",
|
|
1047
1022
|
$
|
|
1048
1023
|
),
|
|
1049
|
-
children:
|
|
1050
|
-
value:
|
|
1051
|
-
|
|
1052
|
-
|
|
1024
|
+
children: u.metadata.usage.cost_incomplete || u.metadata.usage.total_cost_microunits === void 0 ? t("chat_history.unpriced") : t("chat_history.cost", {
|
|
1025
|
+
value: me(
|
|
1026
|
+
u.metadata.usage.total_cost_microunits || 0,
|
|
1027
|
+
u.metadata.usage.currency || "USD",
|
|
1053
1028
|
$
|
|
1054
1029
|
)
|
|
1055
1030
|
})
|
|
1056
1031
|
}
|
|
1057
1032
|
)
|
|
1058
1033
|
] }),
|
|
1059
|
-
/* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: z(
|
|
1034
|
+
/* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: z(u.created_at) })
|
|
1060
1035
|
] })
|
|
1061
1036
|
]
|
|
1062
1037
|
},
|
|
1063
|
-
|
|
1038
|
+
u.id
|
|
1064
1039
|
)),
|
|
1065
1040
|
k && /* @__PURE__ */ e("div", { className: "p-4 text-center text-muted-foreground text-xs", children: t("loading_more") })
|
|
1066
1041
|
] }) })
|
|
@@ -1073,37 +1048,35 @@ function or() {
|
|
|
1073
1048
|
o && /* @__PURE__ */ e(
|
|
1074
1049
|
"button",
|
|
1075
1050
|
{
|
|
1076
|
-
onClick: (
|
|
1051
|
+
onClick: (u) => M(u, o),
|
|
1077
1052
|
className: "flex-shrink-0 w-8 h-8 rounded-full bg-primary/10 text-primary flex items-center justify-center hover:bg-primary/20 transition-all shadow-sm",
|
|
1078
1053
|
title: t("sidebar:share_conversation"),
|
|
1079
|
-
children: /* @__PURE__ */ e(
|
|
1054
|
+
children: /* @__PURE__ */ e(kt, { className: "w-4 h-4" })
|
|
1080
1055
|
}
|
|
1081
1056
|
)
|
|
1082
1057
|
] }),
|
|
1083
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children: o ? m ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: t("chat_history.loading_messages") }) : P.length === 0 ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: t("chat_history.empty_thread") }) : /* @__PURE__ */ e("div", { className: "space-y-6", children: P.map((
|
|
1084
|
-
const
|
|
1085
|
-
(ie) => ie?.type === "data-choice-question"
|
|
1086
|
-
) ? B.filter((ie) => ie?.type !== "text") : B;
|
|
1058
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children: o ? m ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: t("chat_history.loading_messages") }) : P.length === 0 ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: t("chat_history.empty_thread") }) : /* @__PURE__ */ e("div", { className: "space-y-6", children: P.map((u) => {
|
|
1059
|
+
const j = u.role === "user", I = u.role === "assistant", V = u.parts || [];
|
|
1087
1060
|
return /* @__PURE__ */ r(
|
|
1088
1061
|
"div",
|
|
1089
1062
|
{
|
|
1090
|
-
className: `p-3.5 rounded-2xl transition-all relative ${
|
|
1063
|
+
className: `p-3.5 rounded-2xl transition-all relative ${j ? "bg-primary/10 ms-12 rounded-te-sm" : I ? "glass shadow-sm me-12 rounded-ts-sm" : "bg-muted/30 border border-border/50"}`,
|
|
1091
1064
|
children: [
|
|
1092
|
-
|
|
1065
|
+
u.feedback && /* @__PURE__ */ e("div", { className: "absolute -bottom-2 -left-2 flex items-center justify-center w-8 h-8 rounded-full shadow-md bg-card border border-border animate-in fade-in zoom-in duration-300 z-10", children: /* @__PURE__ */ e("span", { className: "text-base", children: u.feedback === "like" ? "👍" : "👎" }) }),
|
|
1093
1066
|
/* @__PURE__ */ r("div", { className: "flex justify-between items-center mb-1.5", children: [
|
|
1094
1067
|
/* @__PURE__ */ e(
|
|
1095
1068
|
"span",
|
|
1096
1069
|
{
|
|
1097
|
-
className: `text-[10px] font-bold uppercase tracking-wider ${
|
|
1098
|
-
children:
|
|
1070
|
+
className: `text-[10px] font-bold uppercase tracking-wider ${j || I ? "text-primary" : "text-muted-foreground"}`,
|
|
1071
|
+
children: j ? o?.user_info?.name ? `${o.user_info.name} ${o.user_info.surname || ""}`.trim() : t("chat_history.user_label") : I ? t("chat_history.assistant_label") : `${u.role}`
|
|
1099
1072
|
}
|
|
1100
1073
|
),
|
|
1101
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children: z(
|
|
1074
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children: z(u.created_at) })
|
|
1102
1075
|
] }),
|
|
1103
|
-
/* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children:
|
|
1076
|
+
/* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children: V.length > 0 ? V.map((G, pe) => de(G, pe)) : typeof u.content == "object" ? /* @__PURE__ */ e("pre", { className: "text-xs font-mono bg-muted/40 p-2.5 rounded-xl", dir: "ltr", children: JSON.stringify(u.content, null, 2) }) : u.content })
|
|
1104
1077
|
]
|
|
1105
1078
|
},
|
|
1106
|
-
|
|
1079
|
+
u.id
|
|
1107
1080
|
);
|
|
1108
1081
|
}) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col items-center justify-center text-muted-foreground", children: [
|
|
1109
1082
|
/* @__PURE__ */ e(
|
|
@@ -1130,11 +1103,11 @@ function or() {
|
|
|
1130
1103
|
] })
|
|
1131
1104
|
] });
|
|
1132
1105
|
}
|
|
1133
|
-
function
|
|
1134
|
-
const { t, i18n: a } = F(["admin", "translation"]), [s, d] = y(""), [o, n] = y(!1), [l, g] = y(null), [_, S] = y(null), w = a.language === "fa", x =
|
|
1106
|
+
function sr() {
|
|
1107
|
+
const { t, i18n: a } = F(["admin", "translation"]), [s, d] = y(""), [o, n] = y(!1), [l, g] = y(null), [_, S] = y(null), w = a.language === "fa", x = Zt(), i = x.data?.admins || [], b = x.isLoading, { createAdmin: h, updateAdmin: N, deleteAdmin: D } = Xt(), R = oe({
|
|
1135
1108
|
queryKey: ["gentiq_admin", "permissions"],
|
|
1136
1109
|
queryFn: () => T.listPermissions()
|
|
1137
|
-
}).data?.permissions || [],
|
|
1110
|
+
}).data?.permissions || [], c = s || (x.error ? x.error instanceof Error ? x.error.message : t("error_loading") : ""), [f, C] = y({
|
|
1138
1111
|
username: "",
|
|
1139
1112
|
password: "",
|
|
1140
1113
|
name: "",
|
|
@@ -1165,9 +1138,9 @@ function ir() {
|
|
|
1165
1138
|
permissions: f.permissions
|
|
1166
1139
|
};
|
|
1167
1140
|
if (f.password && (m.password = f.password), await N.mutateAsync({ adminId: l.id, data: m }), l.id === _) {
|
|
1168
|
-
const
|
|
1169
|
-
if (
|
|
1170
|
-
const A = JSON.parse(
|
|
1141
|
+
const q = localStorage.getItem("admin_info");
|
|
1142
|
+
if (q) {
|
|
1143
|
+
const A = JSON.parse(q);
|
|
1171
1144
|
A.name = f.name, A.permissions = f.permissions, localStorage.setItem("admin_info", JSON.stringify(A)), window.location.reload();
|
|
1172
1145
|
return;
|
|
1173
1146
|
}
|
|
@@ -1196,12 +1169,12 @@ function ir() {
|
|
|
1196
1169
|
}, P = (k) => {
|
|
1197
1170
|
C((m) => ({
|
|
1198
1171
|
...m,
|
|
1199
|
-
permissions: m.permissions.includes(k) ? m.permissions.filter((
|
|
1172
|
+
permissions: m.permissions.includes(k) ? m.permissions.filter((q) => q !== k) : [...m.permissions, k]
|
|
1200
1173
|
}));
|
|
1201
1174
|
}, Z = (k) => {
|
|
1202
|
-
const m = `admins.perm_${k}`,
|
|
1203
|
-
if (
|
|
1204
|
-
return
|
|
1175
|
+
const m = `admins.perm_${k}`, q = t(m);
|
|
1176
|
+
if (q !== m)
|
|
1177
|
+
return q;
|
|
1205
1178
|
switch (k) {
|
|
1206
1179
|
case "chat_history":
|
|
1207
1180
|
return t("admins.perm_chat_history");
|
|
@@ -1234,7 +1207,7 @@ function ir() {
|
|
|
1234
1207
|
)
|
|
1235
1208
|
] })
|
|
1236
1209
|
] }),
|
|
1237
|
-
|
|
1210
|
+
c && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm flex-shrink-0", children: c }),
|
|
1238
1211
|
o && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ r("div", { className: "bg-card rounded-2xl border border-border w-full max-w-md shadow-2xl overflow-hidden", children: [
|
|
1239
1212
|
/* @__PURE__ */ e("div", { className: "px-6 py-5 border-b border-border bg-muted/20", children: /* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground", children: t(l ? "admins.edit_admin" : "admins.add_admin") }) }),
|
|
1240
1213
|
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r(
|
|
@@ -1438,7 +1411,7 @@ function ir() {
|
|
|
1438
1411
|
] }) })
|
|
1439
1412
|
] });
|
|
1440
1413
|
}
|
|
1441
|
-
function
|
|
1414
|
+
function or({ message: t, onDismiss: a }) {
|
|
1442
1415
|
return /* @__PURE__ */ r("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm flex-shrink-0 flex justify-between items-center group", children: [
|
|
1443
1416
|
/* @__PURE__ */ e("span", { children: t }),
|
|
1444
1417
|
/* @__PURE__ */ e("button", { onClick: a, className: "opacity-50 hover:opacity-100 transition-opacity p-1", children: /* @__PURE__ */ e(
|
|
@@ -1455,7 +1428,7 @@ function lr({ message: t, onDismiss: a }) {
|
|
|
1455
1428
|
) })
|
|
1456
1429
|
] });
|
|
1457
1430
|
}
|
|
1458
|
-
function
|
|
1431
|
+
function ir({
|
|
1459
1432
|
users: t,
|
|
1460
1433
|
loading: a,
|
|
1461
1434
|
totalCount: s,
|
|
@@ -1470,7 +1443,7 @@ function dr({
|
|
|
1470
1443
|
onCopyToken: x,
|
|
1471
1444
|
onDelete: i
|
|
1472
1445
|
}) {
|
|
1473
|
-
const { t: b, i18n: h } = F(["admin", "translation"]), N = h.language === "fa", D = (p) => o !== p ? /* @__PURE__ */ e(
|
|
1446
|
+
const { t: b, i18n: h } = F(["admin", "translation"]), N = h.language === "fa", D = (p) => o !== p ? /* @__PURE__ */ e(St, { className: "w-3.5 h-3.5 opacity-50" }) : n === "asc" ? /* @__PURE__ */ e(Lt, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ e(qt, { className: "w-3.5 h-3.5" });
|
|
1474
1447
|
return /* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ r(
|
|
1475
1448
|
"div",
|
|
1476
1449
|
{
|
|
@@ -1528,13 +1501,13 @@ function dr({
|
|
|
1528
1501
|
] }) }),
|
|
1529
1502
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: p.surname || /* @__PURE__ */ e("span", { className: "text-muted-foreground/50", children: "—" }) }),
|
|
1530
1503
|
d.map((R) => {
|
|
1531
|
-
const
|
|
1532
|
-
let f = String(
|
|
1533
|
-
if (R.type === "select" &&
|
|
1534
|
-
const C = R.options?.find((L) => String(L.value) === String(
|
|
1504
|
+
const c = p.metadata?.[R.key];
|
|
1505
|
+
let f = String(c ?? "");
|
|
1506
|
+
if (R.type === "select" && c !== void 0) {
|
|
1507
|
+
const C = R.options?.find((L) => String(L.value) === String(c));
|
|
1535
1508
|
C && (f = b(C.label));
|
|
1536
1509
|
}
|
|
1537
|
-
return /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: R.type === "checkbox" ?
|
|
1510
|
+
return /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: R.type === "checkbox" ? c ? /* @__PURE__ */ e("span", { className: "text-emerald-500 font-bold", children: "✓" }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground opacity-30", children: "✗" }) : f }, R.key);
|
|
1538
1511
|
}),
|
|
1539
1512
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground w-[120px]", children: p.balance ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 min-w-0 py-1", children: [
|
|
1540
1513
|
/* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
@@ -1583,7 +1556,7 @@ function dr({
|
|
|
1583
1556
|
onClick: () => _(p),
|
|
1584
1557
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1585
1558
|
title: b("users.usage_summary"),
|
|
1586
|
-
children: /* @__PURE__ */ e(
|
|
1559
|
+
children: /* @__PURE__ */ e(Ct, { className: "w-4 h-4" })
|
|
1587
1560
|
}
|
|
1588
1561
|
),
|
|
1589
1562
|
/* @__PURE__ */ e(
|
|
@@ -1736,7 +1709,7 @@ function dr({
|
|
|
1736
1709
|
}
|
|
1737
1710
|
) });
|
|
1738
1711
|
}
|
|
1739
|
-
function
|
|
1712
|
+
function ot(t, a = /* @__PURE__ */ new Date()) {
|
|
1740
1713
|
const s = new Date(a);
|
|
1741
1714
|
switch (s.setMilliseconds(0), t) {
|
|
1742
1715
|
case "minute":
|
|
@@ -1760,22 +1733,22 @@ function lt(t, a = /* @__PURE__ */ new Date()) {
|
|
|
1760
1733
|
}
|
|
1761
1734
|
return s.toISOString();
|
|
1762
1735
|
}
|
|
1763
|
-
function
|
|
1736
|
+
function le({ className: t, ...a }) {
|
|
1764
1737
|
return /* @__PURE__ */ e(
|
|
1765
|
-
|
|
1738
|
+
Xe.Root,
|
|
1766
1739
|
{
|
|
1767
1740
|
"data-slot": "switch",
|
|
1768
1741
|
dir: "ltr",
|
|
1769
|
-
className:
|
|
1742
|
+
className: ke(
|
|
1770
1743
|
"peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
|
|
1771
1744
|
t
|
|
1772
1745
|
),
|
|
1773
1746
|
...a,
|
|
1774
1747
|
children: /* @__PURE__ */ e(
|
|
1775
|
-
|
|
1748
|
+
Xe.Thumb,
|
|
1776
1749
|
{
|
|
1777
1750
|
"data-slot": "switch-thumb",
|
|
1778
|
-
className:
|
|
1751
|
+
className: ke(
|
|
1779
1752
|
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
|
1780
1753
|
)
|
|
1781
1754
|
}
|
|
@@ -1783,8 +1756,8 @@ function de({ className: t, ...a }) {
|
|
|
1783
1756
|
}
|
|
1784
1757
|
);
|
|
1785
1758
|
}
|
|
1786
|
-
const
|
|
1787
|
-
function
|
|
1759
|
+
const lr = (t) => t.replace(/[^0-9]/g, "");
|
|
1760
|
+
function dr({
|
|
1788
1761
|
editingUser: t,
|
|
1789
1762
|
appSettings: a,
|
|
1790
1763
|
userMetadataFields: s,
|
|
@@ -1824,10 +1797,10 @@ function ur({
|
|
|
1824
1797
|
}
|
|
1825
1798
|
), [h, N] = y(() => {
|
|
1826
1799
|
if (!t?.metadata) return {};
|
|
1827
|
-
const
|
|
1800
|
+
const c = {};
|
|
1828
1801
|
return s.forEach((f) => {
|
|
1829
|
-
t.metadata?.[f.key] !== void 0 ?
|
|
1830
|
-
}),
|
|
1802
|
+
t.metadata?.[f.key] !== void 0 ? c[f.key] = t.metadata[f.key] : f.defaultValue !== void 0 && (c[f.key] = f.defaultValue);
|
|
1803
|
+
}), c;
|
|
1831
1804
|
});
|
|
1832
1805
|
H(() => {
|
|
1833
1806
|
try {
|
|
@@ -1836,26 +1809,26 @@ function ur({
|
|
|
1836
1809
|
} catch {
|
|
1837
1810
|
}
|
|
1838
1811
|
}, [h]), H(() => {
|
|
1839
|
-
const
|
|
1812
|
+
const c = { ...h };
|
|
1840
1813
|
let f = !1;
|
|
1841
1814
|
s.forEach((C) => {
|
|
1842
|
-
C.condition && !
|
|
1843
|
-
}), f && N(
|
|
1815
|
+
C.condition && !Qe(C.condition, h) && c[C.key] !== void 0 && (delete c[C.key], f = !0);
|
|
1816
|
+
}), f && N(c);
|
|
1844
1817
|
}, [h, s]);
|
|
1845
1818
|
const D = () => {
|
|
1846
1819
|
if (!i.rechargeEnabled)
|
|
1847
1820
|
return { enabled: !1 };
|
|
1848
|
-
const
|
|
1849
|
-
return !Number.isInteger(
|
|
1821
|
+
const c = Number(i.rechargeIntervalValue);
|
|
1822
|
+
return !Number.isInteger(c) || c <= 0 ? (n(l("users.recharge_interval_invalid")), null) : {
|
|
1850
1823
|
enabled: !0,
|
|
1851
|
-
interval_value:
|
|
1824
|
+
interval_value: c,
|
|
1852
1825
|
interval_unit: i.rechargeIntervalUnit,
|
|
1853
1826
|
// When blank, default to the next round boundary of the interval in the admin's
|
|
1854
1827
|
// local time (e.g. next local midnight for daily) rather than the request time.
|
|
1855
|
-
anchor_at: i.rechargeAnchorAt ? new Date(i.rechargeAnchorAt).toISOString() :
|
|
1828
|
+
anchor_at: i.rechargeAnchorAt ? new Date(i.rechargeAnchorAt).toISOString() : ot(i.rechargeIntervalUnit)
|
|
1856
1829
|
};
|
|
1857
|
-
}, p = async (
|
|
1858
|
-
|
|
1830
|
+
}, p = async (c) => {
|
|
1831
|
+
c.preventDefault();
|
|
1859
1832
|
const f = i.tokens ? parseInt(i.tokens) : 0, C = i.requests ? parseInt(i.requests) : 0, L = i.tokensLimit ? parseInt(i.tokensLimit) : f, $ = i.requestsLimit ? parseInt(i.requestsLimit) : C;
|
|
1860
1833
|
if (f > L) {
|
|
1861
1834
|
n(l("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
@@ -1895,8 +1868,8 @@ function ur({
|
|
|
1895
1868
|
x(!1);
|
|
1896
1869
|
}
|
|
1897
1870
|
}
|
|
1898
|
-
}, R = async (
|
|
1899
|
-
if (
|
|
1871
|
+
}, R = async (c) => {
|
|
1872
|
+
if (c.preventDefault(), !t) return;
|
|
1900
1873
|
let f = {};
|
|
1901
1874
|
if (i.metadata)
|
|
1902
1875
|
try {
|
|
@@ -1944,7 +1917,7 @@ function ur({
|
|
|
1944
1917
|
X,
|
|
1945
1918
|
{
|
|
1946
1919
|
value: i.accountType,
|
|
1947
|
-
onValueChange: (
|
|
1920
|
+
onValueChange: (c) => b({ ...i, accountType: c }),
|
|
1948
1921
|
dir: _ ? "rtl" : "ltr",
|
|
1949
1922
|
children: [
|
|
1950
1923
|
/* @__PURE__ */ e(Y, { className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]", children: /* @__PURE__ */ e(ee, {}) }),
|
|
@@ -1971,7 +1944,7 @@ function ur({
|
|
|
1971
1944
|
{
|
|
1972
1945
|
type: "text",
|
|
1973
1946
|
value: i.phone,
|
|
1974
|
-
onChange: (
|
|
1947
|
+
onChange: (c) => b({ ...i, phone: lr(c.target.value) }),
|
|
1975
1948
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
1976
1949
|
placeholder: l("users.phone_placeholder"),
|
|
1977
1950
|
required: i.accountType === "human",
|
|
@@ -1988,7 +1961,7 @@ function ur({
|
|
|
1988
1961
|
{
|
|
1989
1962
|
type: "text",
|
|
1990
1963
|
value: i.name,
|
|
1991
|
-
onChange: (
|
|
1964
|
+
onChange: (c) => b({ ...i, name: c.target.value }),
|
|
1992
1965
|
className: `w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm ${S}`,
|
|
1993
1966
|
placeholder: l("users.service_name_placeholder"),
|
|
1994
1967
|
required: !0
|
|
@@ -2003,7 +1976,7 @@ function ur({
|
|
|
2003
1976
|
{
|
|
2004
1977
|
type: "text",
|
|
2005
1978
|
value: i.name,
|
|
2006
|
-
onChange: (
|
|
1979
|
+
onChange: (c) => b({ ...i, name: c.target.value }),
|
|
2007
1980
|
className: `w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm ${S}`,
|
|
2008
1981
|
required: !0
|
|
2009
1982
|
}
|
|
@@ -2016,7 +1989,7 @@ function ur({
|
|
|
2016
1989
|
{
|
|
2017
1990
|
type: "text",
|
|
2018
1991
|
value: i.surname ?? "",
|
|
2019
|
-
onChange: (
|
|
1992
|
+
onChange: (c) => b({ ...i, surname: c.target.value }),
|
|
2020
1993
|
className: `w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm ${S}`,
|
|
2021
1994
|
required: !0
|
|
2022
1995
|
}
|
|
@@ -2034,7 +2007,7 @@ function ur({
|
|
|
2034
2007
|
{
|
|
2035
2008
|
type: "number",
|
|
2036
2009
|
value: i.tokens,
|
|
2037
|
-
onChange: (
|
|
2010
|
+
onChange: (c) => b({ ...i, tokens: c.target.value }),
|
|
2038
2011
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2039
2012
|
dir: "ltr",
|
|
2040
2013
|
placeholder: "0"
|
|
@@ -2048,7 +2021,7 @@ function ur({
|
|
|
2048
2021
|
{
|
|
2049
2022
|
type: "number",
|
|
2050
2023
|
value: i.tokensLimit,
|
|
2051
|
-
onChange: (
|
|
2024
|
+
onChange: (c) => b({ ...i, tokensLimit: c.target.value }),
|
|
2052
2025
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2053
2026
|
dir: "ltr",
|
|
2054
2027
|
placeholder: i.tokens || String(a?.initial_balance_tokens ?? "250000")
|
|
@@ -2064,7 +2037,7 @@ function ur({
|
|
|
2064
2037
|
{
|
|
2065
2038
|
type: "number",
|
|
2066
2039
|
value: i.requests,
|
|
2067
|
-
onChange: (
|
|
2040
|
+
onChange: (c) => b({ ...i, requests: c.target.value }),
|
|
2068
2041
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2069
2042
|
dir: "ltr",
|
|
2070
2043
|
placeholder: i.requests || String(a?.initial_balance_requests ?? "0")
|
|
@@ -2078,7 +2051,7 @@ function ur({
|
|
|
2078
2051
|
{
|
|
2079
2052
|
type: "number",
|
|
2080
2053
|
value: i.requestsLimit,
|
|
2081
|
-
onChange: (
|
|
2054
|
+
onChange: (c) => b({ ...i, requestsLimit: c.target.value }),
|
|
2082
2055
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2083
2056
|
dir: "ltr",
|
|
2084
2057
|
placeholder: i.requests || String(a?.initial_balance_requests ?? "100")
|
|
@@ -2095,13 +2068,13 @@ function ur({
|
|
|
2095
2068
|
] }),
|
|
2096
2069
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 shrink-0 pt-0.5", children: [
|
|
2097
2070
|
/* @__PURE__ */ e(
|
|
2098
|
-
|
|
2071
|
+
le,
|
|
2099
2072
|
{
|
|
2100
2073
|
id: "admin-recharge-enabled",
|
|
2101
2074
|
checked: i.rechargeEnabled,
|
|
2102
|
-
onCheckedChange: (
|
|
2075
|
+
onCheckedChange: (c) => b({
|
|
2103
2076
|
...i,
|
|
2104
|
-
rechargeEnabled:
|
|
2077
|
+
rechargeEnabled: c
|
|
2105
2078
|
}),
|
|
2106
2079
|
"aria-label": l("users.auto_recharge")
|
|
2107
2080
|
}
|
|
@@ -2127,7 +2100,7 @@ function ur({
|
|
|
2127
2100
|
min: "1",
|
|
2128
2101
|
step: "1",
|
|
2129
2102
|
value: i.rechargeIntervalValue,
|
|
2130
|
-
onChange: (
|
|
2103
|
+
onChange: (c) => b({ ...i, rechargeIntervalValue: c.target.value }),
|
|
2131
2104
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2132
2105
|
required: !0,
|
|
2133
2106
|
dir: "ltr"
|
|
@@ -2140,14 +2113,14 @@ function ur({
|
|
|
2140
2113
|
X,
|
|
2141
2114
|
{
|
|
2142
2115
|
value: i.rechargeIntervalUnit,
|
|
2143
|
-
onValueChange: (
|
|
2116
|
+
onValueChange: (c) => b({
|
|
2144
2117
|
...i,
|
|
2145
|
-
rechargeIntervalUnit:
|
|
2118
|
+
rechargeIntervalUnit: c
|
|
2146
2119
|
}),
|
|
2147
2120
|
dir: _ ? "rtl" : "ltr",
|
|
2148
2121
|
children: [
|
|
2149
2122
|
/* @__PURE__ */ e(Y, { className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]", children: /* @__PURE__ */ e(ee, {}) }),
|
|
2150
|
-
/* @__PURE__ */ e(te, { className: "rounded-xl border-border bg-card", children: ["minute", "hour", "day", "week", "month"].map((
|
|
2123
|
+
/* @__PURE__ */ e(te, { className: "rounded-xl border-border bg-card", children: ["minute", "hour", "day", "week", "month"].map((c) => /* @__PURE__ */ e(E, { value: c, children: l(`users.recharge_unit_${c}`) }, c)) })
|
|
2151
2124
|
]
|
|
2152
2125
|
}
|
|
2153
2126
|
)
|
|
@@ -2172,83 +2145,83 @@ function ur({
|
|
|
2172
2145
|
] }),
|
|
2173
2146
|
s.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
|
|
2174
2147
|
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: l("users.custom_fields") }),
|
|
2175
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: s.map((
|
|
2148
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: s.map((c) => Qe(c.condition, h) ? /* @__PURE__ */ r(
|
|
2176
2149
|
"div",
|
|
2177
2150
|
{
|
|
2178
2151
|
className: "animate-in fade-in slide-in-from-top-1 duration-200",
|
|
2179
2152
|
children: [
|
|
2180
2153
|
/* @__PURE__ */ r("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: [
|
|
2181
|
-
l(
|
|
2154
|
+
l(c.label),
|
|
2182
2155
|
" ",
|
|
2183
|
-
|
|
2156
|
+
c.required && /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
2184
2157
|
] }),
|
|
2185
|
-
|
|
2158
|
+
c.type === "select" ? /* @__PURE__ */ r(
|
|
2186
2159
|
X,
|
|
2187
2160
|
{
|
|
2188
|
-
value: String(h[
|
|
2161
|
+
value: String(h[c.key] || ""),
|
|
2189
2162
|
onValueChange: (f) => N({
|
|
2190
2163
|
...h,
|
|
2191
|
-
[
|
|
2164
|
+
[c.key]: f
|
|
2192
2165
|
}),
|
|
2193
|
-
required:
|
|
2166
|
+
required: c.required,
|
|
2194
2167
|
dir: _ ? "rtl" : "ltr",
|
|
2195
2168
|
children: [
|
|
2196
2169
|
/* @__PURE__ */ e(
|
|
2197
2170
|
Y,
|
|
2198
2171
|
{
|
|
2199
|
-
className:
|
|
2172
|
+
className: ke(
|
|
2200
2173
|
"w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]",
|
|
2201
2174
|
S
|
|
2202
2175
|
),
|
|
2203
2176
|
children: /* @__PURE__ */ e(
|
|
2204
2177
|
ee,
|
|
2205
2178
|
{
|
|
2206
|
-
placeholder: l(
|
|
2179
|
+
placeholder: l(c.placeholder || "select_placeholder")
|
|
2207
2180
|
}
|
|
2208
2181
|
)
|
|
2209
2182
|
}
|
|
2210
2183
|
),
|
|
2211
|
-
/* @__PURE__ */ e(te, { className: "rounded-xl border-border bg-card", children:
|
|
2184
|
+
/* @__PURE__ */ e(te, { className: "rounded-xl border-border bg-card", children: c.options?.map((f) => /* @__PURE__ */ e(E, { value: String(f.value), children: l(f.label) }, String(f.value))) })
|
|
2212
2185
|
]
|
|
2213
2186
|
}
|
|
2214
|
-
) :
|
|
2187
|
+
) : c.type === "checkbox" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-3 h-[46px] px-1", children: [
|
|
2215
2188
|
/* @__PURE__ */ e(
|
|
2216
|
-
|
|
2189
|
+
we,
|
|
2217
2190
|
{
|
|
2218
|
-
id: `admin-md-${
|
|
2219
|
-
checked: !!h[
|
|
2191
|
+
id: `admin-md-${c.key}`,
|
|
2192
|
+
checked: !!h[c.key],
|
|
2220
2193
|
onCheckedChange: (f) => N({
|
|
2221
2194
|
...h,
|
|
2222
|
-
[
|
|
2195
|
+
[c.key]: !!f
|
|
2223
2196
|
}),
|
|
2224
|
-
required:
|
|
2197
|
+
required: c.required
|
|
2225
2198
|
}
|
|
2226
2199
|
),
|
|
2227
2200
|
/* @__PURE__ */ e(
|
|
2228
2201
|
"label",
|
|
2229
2202
|
{
|
|
2230
|
-
htmlFor: `admin-md-${
|
|
2203
|
+
htmlFor: `admin-md-${c.key}`,
|
|
2231
2204
|
className: "text-sm text-foreground/80 cursor-pointer select-none",
|
|
2232
|
-
children: l(
|
|
2205
|
+
children: l(c.placeholder || c.label)
|
|
2233
2206
|
}
|
|
2234
2207
|
)
|
|
2235
2208
|
] }) : /* @__PURE__ */ e(
|
|
2236
2209
|
"input",
|
|
2237
2210
|
{
|
|
2238
|
-
type:
|
|
2239
|
-
value: h[
|
|
2211
|
+
type: c.type,
|
|
2212
|
+
value: h[c.key] || "",
|
|
2240
2213
|
onChange: (f) => N({
|
|
2241
2214
|
...h,
|
|
2242
|
-
[
|
|
2215
|
+
[c.key]: f.target.value
|
|
2243
2216
|
}),
|
|
2244
2217
|
className: `w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm ${S}`,
|
|
2245
|
-
placeholder: l(
|
|
2246
|
-
required:
|
|
2218
|
+
placeholder: l(c.placeholder || ""),
|
|
2219
|
+
required: c.required
|
|
2247
2220
|
}
|
|
2248
2221
|
)
|
|
2249
2222
|
]
|
|
2250
2223
|
},
|
|
2251
|
-
|
|
2224
|
+
c.key
|
|
2252
2225
|
) : null) })
|
|
2253
2226
|
] }),
|
|
2254
2227
|
/* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4", children: [
|
|
@@ -2260,7 +2233,7 @@ function ur({
|
|
|
2260
2233
|
"textarea",
|
|
2261
2234
|
{
|
|
2262
2235
|
value: i.metadata,
|
|
2263
|
-
onChange: (
|
|
2236
|
+
onChange: (c) => b({ ...i, metadata: c.target.value }),
|
|
2264
2237
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-xs font-mono min-h-[100px] custom-scrollbar",
|
|
2265
2238
|
placeholder: '{ "key": "value" }',
|
|
2266
2239
|
dir: "ltr"
|
|
@@ -2293,7 +2266,7 @@ function ur({
|
|
|
2293
2266
|
}
|
|
2294
2267
|
);
|
|
2295
2268
|
}
|
|
2296
|
-
function
|
|
2269
|
+
function it({ onClick: t, label: a = "Close" }) {
|
|
2297
2270
|
return /* @__PURE__ */ e(
|
|
2298
2271
|
"button",
|
|
2299
2272
|
{
|
|
@@ -2316,17 +2289,17 @@ function dt({ onClick: t, label: a = "Close" }) {
|
|
|
2316
2289
|
}
|
|
2317
2290
|
);
|
|
2318
2291
|
}
|
|
2319
|
-
function
|
|
2292
|
+
function cr({ user: t, onClose: a, onSaved: s, onError: d }) {
|
|
2320
2293
|
const { t: o } = F(["admin", "translation"]), [n, l] = y(!1), [g, _] = y(String(t.balance?.tokens || 0)), [S, w] = y(String(t.balance?.requests || 0)), [x, i] = y(String(t.balance?.token_limit || 0)), [b, h] = y(String(t.balance?.request_limit || 0)), N = () => {
|
|
2321
2294
|
_(x || String(t.balance?.token_limit || 0)), w(b || String(t.balance?.request_limit || 0));
|
|
2322
2295
|
}, D = async (p) => {
|
|
2323
2296
|
p.preventDefault();
|
|
2324
|
-
const R = parseInt(g) || 0,
|
|
2297
|
+
const R = parseInt(g) || 0, c = parseInt(S) || 0, f = x ? parseInt(x) : t.balance?.token_limit || 0, C = b ? parseInt(b) : t.balance?.request_limit || 0;
|
|
2325
2298
|
if (R > f) {
|
|
2326
2299
|
d(o("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
2327
2300
|
return;
|
|
2328
2301
|
}
|
|
2329
|
-
if (
|
|
2302
|
+
if (c > C) {
|
|
2330
2303
|
d(o("users.requests_exceed_limit", "Requests cannot exceed limit"));
|
|
2331
2304
|
return;
|
|
2332
2305
|
}
|
|
@@ -2335,7 +2308,7 @@ function mr({ user: t, onClose: a, onSaved: s, onError: d }) {
|
|
|
2335
2308
|
await T.updateUserBalance(
|
|
2336
2309
|
t.id,
|
|
2337
2310
|
R,
|
|
2338
|
-
|
|
2311
|
+
c,
|
|
2339
2312
|
x ? parseInt(x) : void 0,
|
|
2340
2313
|
b ? parseInt(b) : void 0
|
|
2341
2314
|
), s();
|
|
@@ -2359,7 +2332,7 @@ function mr({ user: t, onClose: a, onSaved: s, onError: d }) {
|
|
|
2359
2332
|
" ",
|
|
2360
2333
|
t.name
|
|
2361
2334
|
] }),
|
|
2362
|
-
/* @__PURE__ */ e(
|
|
2335
|
+
/* @__PURE__ */ e(it, { onClick: a })
|
|
2363
2336
|
] }),
|
|
2364
2337
|
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: D, children: [
|
|
2365
2338
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
@@ -2449,7 +2422,7 @@ function mr({ user: t, onClose: a, onSaved: s, onError: d }) {
|
|
|
2449
2422
|
}
|
|
2450
2423
|
);
|
|
2451
2424
|
}
|
|
2452
|
-
const
|
|
2425
|
+
const ur = {
|
|
2453
2426
|
applyBalance: !0,
|
|
2454
2427
|
operation: "add",
|
|
2455
2428
|
tokens: "",
|
|
@@ -2465,23 +2438,23 @@ const hr = {
|
|
|
2465
2438
|
userIds: "",
|
|
2466
2439
|
metadata: "{}"
|
|
2467
2440
|
};
|
|
2468
|
-
function
|
|
2441
|
+
function mr({
|
|
2469
2442
|
searchQuery: t,
|
|
2470
2443
|
userMetadataFields: a,
|
|
2471
2444
|
onClose: s,
|
|
2472
2445
|
onApplied: d,
|
|
2473
2446
|
onError: o
|
|
2474
2447
|
}) {
|
|
2475
|
-
const { t: n, i18n: l } = F(["admin", "translation"]), g = l.language === "fa", [_, S] = y(!1), [w, x] = y(null), [i, b] = y(
|
|
2476
|
-
let
|
|
2448
|
+
const { t: n, i18n: l } = F(["admin", "translation"]), g = l.language === "fa", [_, S] = y(!1), [w, x] = y(null), [i, b] = y(ur), h = () => {
|
|
2449
|
+
let c = {};
|
|
2477
2450
|
if (i.metadata.trim())
|
|
2478
2451
|
try {
|
|
2479
|
-
|
|
2452
|
+
c = JSON.parse(i.metadata);
|
|
2480
2453
|
} catch {
|
|
2481
2454
|
return o(n("users.invalid_json", "Invalid JSON format")), null;
|
|
2482
2455
|
}
|
|
2483
2456
|
const f = {};
|
|
2484
|
-
Object.entries(
|
|
2457
|
+
Object.entries(c).forEach(([L, $]) => {
|
|
2485
2458
|
Array.isArray($) ? f[L] = $ : $ !== "" && $ !== void 0 && $ !== null && (f[L] = [$]);
|
|
2486
2459
|
});
|
|
2487
2460
|
const C = i.userIds.split(/[\s,]+/).map((L) => L.trim()).filter(Boolean);
|
|
@@ -2490,7 +2463,7 @@ function pr({
|
|
|
2490
2463
|
user_ids: C.length > 0 ? C : void 0,
|
|
2491
2464
|
metadata_in: Object.keys(f).length > 0 ? f : void 0
|
|
2492
2465
|
};
|
|
2493
|
-
}, N = (
|
|
2466
|
+
}, N = (c) => {
|
|
2494
2467
|
const f = h();
|
|
2495
2468
|
return f ? {
|
|
2496
2469
|
operation: i.operation,
|
|
@@ -2499,16 +2472,16 @@ function pr({
|
|
|
2499
2472
|
token_limit: i.tokenLimit === "" ? void 0 : Number(i.tokenLimit),
|
|
2500
2473
|
request_limit: i.requestLimit === "" ? void 0 : Number(i.requestLimit),
|
|
2501
2474
|
filters: f,
|
|
2502
|
-
dry_run:
|
|
2475
|
+
dry_run: c
|
|
2503
2476
|
} : null;
|
|
2504
|
-
}, D = (
|
|
2477
|
+
}, D = (c) => {
|
|
2505
2478
|
const f = h();
|
|
2506
2479
|
if (!f) return null;
|
|
2507
2480
|
if (!i.renewalEnabled)
|
|
2508
2481
|
return {
|
|
2509
2482
|
recharge_policy: { enabled: !1 },
|
|
2510
2483
|
filters: f,
|
|
2511
|
-
dry_run:
|
|
2484
|
+
dry_run: c
|
|
2512
2485
|
};
|
|
2513
2486
|
const C = Number(i.renewalIntervalValue);
|
|
2514
2487
|
return !Number.isInteger(C) || C <= 0 ? (o(n("users.recharge_interval_invalid")), null) : {
|
|
@@ -2518,20 +2491,20 @@ function pr({
|
|
|
2518
2491
|
interval_unit: i.renewalIntervalUnit,
|
|
2519
2492
|
// When blank, default to the next round boundary of the interval in the admin's
|
|
2520
2493
|
// local time (e.g. next local midnight for daily) rather than the request time.
|
|
2521
|
-
anchor_at: i.renewalAnchorAt ? new Date(i.renewalAnchorAt).toISOString() :
|
|
2494
|
+
anchor_at: i.renewalAnchorAt ? new Date(i.renewalAnchorAt).toISOString() : ot(i.renewalIntervalUnit)
|
|
2522
2495
|
},
|
|
2523
2496
|
filters: f,
|
|
2524
|
-
dry_run:
|
|
2497
|
+
dry_run: c
|
|
2525
2498
|
};
|
|
2526
2499
|
}, p = async () => {
|
|
2527
2500
|
if (i.applyRenewal && !i.applyBalance) {
|
|
2528
2501
|
const C = D(!0);
|
|
2529
2502
|
return C ? (await T.bulkUpdateUserRenewal(C)).matched : null;
|
|
2530
2503
|
}
|
|
2531
|
-
const
|
|
2532
|
-
return
|
|
2533
|
-
}, R = async (
|
|
2534
|
-
if (
|
|
2504
|
+
const c = N(!0);
|
|
2505
|
+
return c ? (await T.bulkUpdateUserBalance(c)).matched : null;
|
|
2506
|
+
}, R = async (c) => {
|
|
2507
|
+
if (c.preventDefault(), !i.applyBalance && !i.applyRenewal) {
|
|
2535
2508
|
o(n("users.bulk_select_change"));
|
|
2536
2509
|
return;
|
|
2537
2510
|
}
|
|
@@ -2563,18 +2536,18 @@ function pr({
|
|
|
2563
2536
|
/* @__PURE__ */ e("h3", { id: "bulk-balance-modal-title", className: "text-lg font-bold text-foreground", children: n("users.bulk_balance") }),
|
|
2564
2537
|
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground mt-1", children: n("users.bulk_balance_help") })
|
|
2565
2538
|
] }),
|
|
2566
|
-
/* @__PURE__ */ e(
|
|
2539
|
+
/* @__PURE__ */ e(it, { onClick: s })
|
|
2567
2540
|
] }),
|
|
2568
2541
|
/* @__PURE__ */ r("form", { onSubmit: R, className: "flex min-h-0 flex-1 flex-col", children: [
|
|
2569
2542
|
/* @__PURE__ */ r("div", { className: "min-h-0 flex-1 overflow-y-auto px-5 py-4 space-y-4 custom-scrollbar", children: [
|
|
2570
2543
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
2571
2544
|
/* @__PURE__ */ r("label", { className: "flex items-center gap-3 rounded-lg border border-border bg-muted/10 px-3 py-2.5 text-sm text-foreground cursor-pointer", children: [
|
|
2572
2545
|
/* @__PURE__ */ e(
|
|
2573
|
-
|
|
2546
|
+
we,
|
|
2574
2547
|
{
|
|
2575
2548
|
checked: i.applyBalance,
|
|
2576
|
-
onCheckedChange: (
|
|
2577
|
-
b({ ...i, applyBalance: !!
|
|
2549
|
+
onCheckedChange: (c) => {
|
|
2550
|
+
b({ ...i, applyBalance: !!c }), x(null);
|
|
2578
2551
|
}
|
|
2579
2552
|
}
|
|
2580
2553
|
),
|
|
@@ -2582,11 +2555,11 @@ function pr({
|
|
|
2582
2555
|
] }),
|
|
2583
2556
|
/* @__PURE__ */ r("label", { className: "flex items-center gap-3 rounded-lg border border-border bg-muted/10 px-3 py-2.5 text-sm text-foreground cursor-pointer", children: [
|
|
2584
2557
|
/* @__PURE__ */ e(
|
|
2585
|
-
|
|
2558
|
+
we,
|
|
2586
2559
|
{
|
|
2587
2560
|
checked: i.applyRenewal,
|
|
2588
|
-
onCheckedChange: (
|
|
2589
|
-
b({ ...i, applyRenewal: !!
|
|
2561
|
+
onCheckedChange: (c) => {
|
|
2562
|
+
b({ ...i, applyRenewal: !!c }), x(null);
|
|
2590
2563
|
}
|
|
2591
2564
|
}
|
|
2592
2565
|
),
|
|
@@ -2600,10 +2573,10 @@ function pr({
|
|
|
2600
2573
|
X,
|
|
2601
2574
|
{
|
|
2602
2575
|
value: i.operation,
|
|
2603
|
-
onValueChange: (
|
|
2576
|
+
onValueChange: (c) => {
|
|
2604
2577
|
b({
|
|
2605
2578
|
...i,
|
|
2606
|
-
operation:
|
|
2579
|
+
operation: c
|
|
2607
2580
|
}), x(null);
|
|
2608
2581
|
},
|
|
2609
2582
|
dir: g ? "rtl" : "ltr",
|
|
@@ -2620,12 +2593,12 @@ function pr({
|
|
|
2620
2593
|
] }),
|
|
2621
2594
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3 md:pt-6", children: [
|
|
2622
2595
|
/* @__PURE__ */ e(
|
|
2623
|
-
|
|
2596
|
+
we,
|
|
2624
2597
|
{
|
|
2625
2598
|
id: "bulk-use-search",
|
|
2626
2599
|
checked: i.useCurrentSearch,
|
|
2627
|
-
onCheckedChange: (
|
|
2628
|
-
b({ ...i, useCurrentSearch: !!
|
|
2600
|
+
onCheckedChange: (c) => {
|
|
2601
|
+
b({ ...i, useCurrentSearch: !!c }), x(null);
|
|
2629
2602
|
}
|
|
2630
2603
|
}
|
|
2631
2604
|
),
|
|
@@ -2640,8 +2613,8 @@ function pr({
|
|
|
2640
2613
|
{
|
|
2641
2614
|
type: "number",
|
|
2642
2615
|
value: i.tokens,
|
|
2643
|
-
onChange: (
|
|
2644
|
-
b({ ...i, tokens:
|
|
2616
|
+
onChange: (c) => {
|
|
2617
|
+
b({ ...i, tokens: c.target.value }), x(null);
|
|
2645
2618
|
},
|
|
2646
2619
|
className: "w-full h-10 px-3 bg-input/50 border border-border rounded-lg text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2647
2620
|
disabled: i.operation === "full_charge",
|
|
@@ -2657,8 +2630,8 @@ function pr({
|
|
|
2657
2630
|
{
|
|
2658
2631
|
type: "number",
|
|
2659
2632
|
value: i.requests,
|
|
2660
|
-
onChange: (
|
|
2661
|
-
b({ ...i, requests:
|
|
2633
|
+
onChange: (c) => {
|
|
2634
|
+
b({ ...i, requests: c.target.value }), x(null);
|
|
2662
2635
|
},
|
|
2663
2636
|
className: "w-full h-10 px-3 bg-input/50 border border-border rounded-lg text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2664
2637
|
disabled: i.operation === "full_charge",
|
|
@@ -2674,8 +2647,8 @@ function pr({
|
|
|
2674
2647
|
{
|
|
2675
2648
|
type: "number",
|
|
2676
2649
|
value: i.tokenLimit,
|
|
2677
|
-
onChange: (
|
|
2678
|
-
b({ ...i, tokenLimit:
|
|
2650
|
+
onChange: (c) => {
|
|
2651
|
+
b({ ...i, tokenLimit: c.target.value }), x(null);
|
|
2679
2652
|
},
|
|
2680
2653
|
className: "w-full h-10 px-3 bg-input/50 border border-border rounded-lg text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2681
2654
|
dir: "ltr"
|
|
@@ -2689,8 +2662,8 @@ function pr({
|
|
|
2689
2662
|
{
|
|
2690
2663
|
type: "number",
|
|
2691
2664
|
value: i.requestLimit,
|
|
2692
|
-
onChange: (
|
|
2693
|
-
b({ ...i, requestLimit:
|
|
2665
|
+
onChange: (c) => {
|
|
2666
|
+
b({ ...i, requestLimit: c.target.value }), x(null);
|
|
2694
2667
|
},
|
|
2695
2668
|
className: "w-full h-10 px-3 bg-input/50 border border-border rounded-lg text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2696
2669
|
dir: "ltr"
|
|
@@ -2706,11 +2679,11 @@ function pr({
|
|
|
2706
2679
|
] }),
|
|
2707
2680
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
2708
2681
|
/* @__PURE__ */ e(
|
|
2709
|
-
|
|
2682
|
+
le,
|
|
2710
2683
|
{
|
|
2711
2684
|
checked: i.renewalEnabled,
|
|
2712
|
-
onCheckedChange: (
|
|
2713
|
-
b({ ...i, renewalEnabled:
|
|
2685
|
+
onCheckedChange: (c) => {
|
|
2686
|
+
b({ ...i, renewalEnabled: c }), x(null);
|
|
2714
2687
|
}
|
|
2715
2688
|
}
|
|
2716
2689
|
),
|
|
@@ -2727,8 +2700,8 @@ function pr({
|
|
|
2727
2700
|
min: "1",
|
|
2728
2701
|
step: "1",
|
|
2729
2702
|
value: i.renewalIntervalValue,
|
|
2730
|
-
onChange: (
|
|
2731
|
-
b({ ...i, renewalIntervalValue:
|
|
2703
|
+
onChange: (c) => {
|
|
2704
|
+
b({ ...i, renewalIntervalValue: c.target.value }), x(null);
|
|
2732
2705
|
},
|
|
2733
2706
|
className: "w-full h-10 px-3 bg-input/50 border border-border rounded-lg text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2734
2707
|
required: !0,
|
|
@@ -2742,16 +2715,16 @@ function pr({
|
|
|
2742
2715
|
X,
|
|
2743
2716
|
{
|
|
2744
2717
|
value: i.renewalIntervalUnit,
|
|
2745
|
-
onValueChange: (
|
|
2718
|
+
onValueChange: (c) => {
|
|
2746
2719
|
b({
|
|
2747
2720
|
...i,
|
|
2748
|
-
renewalIntervalUnit:
|
|
2721
|
+
renewalIntervalUnit: c
|
|
2749
2722
|
}), x(null);
|
|
2750
2723
|
},
|
|
2751
2724
|
dir: g ? "rtl" : "ltr",
|
|
2752
2725
|
children: [
|
|
2753
2726
|
/* @__PURE__ */ e(Y, { className: "w-full px-3 bg-input/50 border border-border rounded-lg text-foreground transition-all text-sm h-10", children: /* @__PURE__ */ e(ee, {}) }),
|
|
2754
|
-
/* @__PURE__ */ e(te, { className: "rounded-lg border-border bg-card", children: ["minute", "hour", "day", "week", "month"].map((
|
|
2727
|
+
/* @__PURE__ */ e(te, { className: "rounded-lg border-border bg-card", children: ["minute", "hour", "day", "week", "month"].map((c) => /* @__PURE__ */ e(E, { value: c, children: n(`users.recharge_unit_${c}`) }, c)) })
|
|
2755
2728
|
]
|
|
2756
2729
|
}
|
|
2757
2730
|
)
|
|
@@ -2763,8 +2736,8 @@ function pr({
|
|
|
2763
2736
|
{
|
|
2764
2737
|
type: "datetime-local",
|
|
2765
2738
|
value: i.renewalAnchorAt,
|
|
2766
|
-
onChange: (
|
|
2767
|
-
b({ ...i, renewalAnchorAt:
|
|
2739
|
+
onChange: (c) => {
|
|
2740
|
+
b({ ...i, renewalAnchorAt: c.target.value }), x(null);
|
|
2768
2741
|
},
|
|
2769
2742
|
className: "w-full h-10 px-3 bg-input/50 border border-border rounded-lg text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
|
|
2770
2743
|
dir: "ltr"
|
|
@@ -2780,8 +2753,8 @@ function pr({
|
|
|
2780
2753
|
"textarea",
|
|
2781
2754
|
{
|
|
2782
2755
|
value: i.userIds,
|
|
2783
|
-
onChange: (
|
|
2784
|
-
b({ ...i, userIds:
|
|
2756
|
+
onChange: (c) => {
|
|
2757
|
+
b({ ...i, userIds: c.target.value }), x(null);
|
|
2785
2758
|
},
|
|
2786
2759
|
className: "w-full px-3 py-2 bg-input/50 border border-border rounded-lg text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-xs font-mono min-h-[58px]",
|
|
2787
2760
|
placeholder: "user_abc, user_xyz",
|
|
@@ -2795,8 +2768,8 @@ function pr({
|
|
|
2795
2768
|
"textarea",
|
|
2796
2769
|
{
|
|
2797
2770
|
value: i.metadata,
|
|
2798
|
-
onChange: (
|
|
2799
|
-
b({ ...i, metadata:
|
|
2771
|
+
onChange: (c) => {
|
|
2772
|
+
b({ ...i, metadata: c.target.value }), x(null);
|
|
2800
2773
|
},
|
|
2801
2774
|
className: "w-full px-3 py-2 bg-input/50 border border-border rounded-lg text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-xs font-mono min-h-[58px]",
|
|
2802
2775
|
placeholder: '{ "grade": ["10", "11"], "major": ["math", "science"] }',
|
|
@@ -2807,7 +2780,7 @@ function pr({
|
|
|
2807
2780
|
n("users.bulk_available_metadata"),
|
|
2808
2781
|
":",
|
|
2809
2782
|
" ",
|
|
2810
|
-
a.map((
|
|
2783
|
+
a.map((c) => c.key).join(", ")
|
|
2811
2784
|
] })
|
|
2812
2785
|
] })
|
|
2813
2786
|
] })
|
|
@@ -2829,7 +2802,7 @@ function pr({
|
|
|
2829
2802
|
}
|
|
2830
2803
|
);
|
|
2831
2804
|
}
|
|
2832
|
-
function
|
|
2805
|
+
function hr({ user: t, onClose: a, onError: s }) {
|
|
2833
2806
|
const { t: d, i18n: o } = F(["admin", "translation"]), n = o.language === "fa" ? "fa-IR" : "en-US", [l, g] = y(null), [_, S] = y(!1);
|
|
2834
2807
|
return H(() => {
|
|
2835
2808
|
if (!t) return;
|
|
@@ -2843,10 +2816,10 @@ function gr({ user: t, onClose: a, onError: s }) {
|
|
|
2843
2816
|
}), () => {
|
|
2844
2817
|
w = !0;
|
|
2845
2818
|
};
|
|
2846
|
-
}, [t]), /* @__PURE__ */ e(
|
|
2847
|
-
/* @__PURE__ */ r(
|
|
2848
|
-
/* @__PURE__ */ e(
|
|
2849
|
-
/* @__PURE__ */ e(
|
|
2819
|
+
}, [t]), /* @__PURE__ */ e(Ce, { open: !!t, onOpenChange: (w) => !w && a(), children: /* @__PURE__ */ r(Le, { children: [
|
|
2820
|
+
/* @__PURE__ */ r(qe, { children: [
|
|
2821
|
+
/* @__PURE__ */ e(je, { children: d("users.usage_summary") }),
|
|
2822
|
+
/* @__PURE__ */ e(Te, { children: t ? `${t.name} ${t.surname}` : "" })
|
|
2850
2823
|
] }),
|
|
2851
2824
|
_ ? /* @__PURE__ */ e("div", { className: "py-10 flex justify-center", children: /* @__PURE__ */ e("div", { className: "w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin" }) }) : l ? /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
2852
2825
|
[d("users.input_tokens"), l.input_tokens.toLocaleString(n)],
|
|
@@ -2855,7 +2828,7 @@ function gr({ user: t, onClose: a, onError: s }) {
|
|
|
2855
2828
|
[d("users.requests_made"), l.requests.toLocaleString(n)],
|
|
2856
2829
|
[
|
|
2857
2830
|
d("users.total_cost"),
|
|
2858
|
-
|
|
2831
|
+
st(l.total_cost_microunits, l.currency, n)
|
|
2859
2832
|
],
|
|
2860
2833
|
[d("users.renewals"), l.renewal_count.toLocaleString(n)],
|
|
2861
2834
|
[d("users.unpriced_requests"), l.unpriced_requests.toLocaleString(n)]
|
|
@@ -2865,14 +2838,14 @@ function gr({ user: t, onClose: a, onError: s }) {
|
|
|
2865
2838
|
] }, w)) }) : null
|
|
2866
2839
|
] }) });
|
|
2867
2840
|
}
|
|
2868
|
-
const
|
|
2869
|
-
function
|
|
2870
|
-
const { t, i18n: a } = F(["admin", "translation"]), { app: s } =
|
|
2841
|
+
const Ie = 25;
|
|
2842
|
+
function pr() {
|
|
2843
|
+
const { t, i18n: a } = F(["admin", "translation"]), { app: s } = be(), d = _e(), o = a.language === "fa", [n, l] = y(""), [g, _] = y(""), [S, w] = y(""), [x, i] = y("name"), [b, h] = y("asc"), [N, D] = y("human"), [p, R] = y(null), [c, f] = y(Ie), [C, L] = y(!1), [$, v] = y(null), [O, P] = y(null), [Z, k] = y(null), [m, q] = y(!1), A = Qt(), K = () => d.invalidateQueries({ queryKey: ["gentiq_admin", "users"] }), {
|
|
2871
2844
|
data: M,
|
|
2872
2845
|
isLoading: z,
|
|
2873
|
-
isFetching:
|
|
2846
|
+
isFetching: Q,
|
|
2874
2847
|
error: W
|
|
2875
|
-
} =
|
|
2848
|
+
} = Kt(0, c, S, x, b, N), B = M?.users ?? [], de = M?.count ?? 0, xe = z || Q, u = W ? W instanceof Error ? W.message : t("error_loading") : "", j = n || u, I = he(() => s?.userMetadataFields || [], [s?.userMetadataFields]);
|
|
2876
2849
|
H(() => {
|
|
2877
2850
|
T.getSettings().then(R).catch((J) => console.error("Failed to load app settings", J));
|
|
2878
2851
|
}, []), H(() => {
|
|
@@ -2881,33 +2854,33 @@ function fr() {
|
|
|
2881
2854
|
}, 500);
|
|
2882
2855
|
return () => clearTimeout(J);
|
|
2883
2856
|
}, [g]), H(() => {
|
|
2884
|
-
f(
|
|
2857
|
+
f(Ie);
|
|
2885
2858
|
}, [S, x, b, N]);
|
|
2886
|
-
const
|
|
2887
|
-
x === J ? h((
|
|
2859
|
+
const V = (J) => {
|
|
2860
|
+
x === J ? h((ce) => ce === "asc" ? "desc" : "asc") : (i(J), h("asc"));
|
|
2888
2861
|
}, G = async (J) => {
|
|
2889
2862
|
if (confirm(t("users.confirm_delete_user")))
|
|
2890
2863
|
try {
|
|
2891
2864
|
await A.deleteUser.mutateAsync(J);
|
|
2892
|
-
} catch (
|
|
2893
|
-
l(
|
|
2865
|
+
} catch (ce) {
|
|
2866
|
+
l(ce instanceof Error ? ce.message : t("error_loading"));
|
|
2894
2867
|
}
|
|
2895
|
-
},
|
|
2868
|
+
}, pe = async (J) => {
|
|
2896
2869
|
try {
|
|
2897
|
-
const
|
|
2898
|
-
if (!
|
|
2870
|
+
const We = (await T.refreshUserToken(J.id))?.user?.token;
|
|
2871
|
+
if (!We) {
|
|
2899
2872
|
l(t("users.no_token"));
|
|
2900
2873
|
return;
|
|
2901
2874
|
}
|
|
2902
|
-
await navigator.clipboard.writeText(
|
|
2903
|
-
} catch (
|
|
2904
|
-
l(
|
|
2875
|
+
await navigator.clipboard.writeText(We), alert(t("users.token_copied"));
|
|
2876
|
+
} catch (ce) {
|
|
2877
|
+
l(ce instanceof Error ? ce.message : t("error_loading"));
|
|
2905
2878
|
}
|
|
2906
|
-
},
|
|
2879
|
+
}, De = () => {
|
|
2907
2880
|
v(null), L(!0);
|
|
2908
|
-
},
|
|
2881
|
+
}, dt = (J) => {
|
|
2909
2882
|
v(J), L(!0);
|
|
2910
|
-
},
|
|
2883
|
+
}, He = () => {
|
|
2911
2884
|
L(!1), v(null);
|
|
2912
2885
|
};
|
|
2913
2886
|
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: o ? "rtl" : "ltr", children: [
|
|
@@ -2937,14 +2910,14 @@ function fr() {
|
|
|
2937
2910
|
]
|
|
2938
2911
|
}
|
|
2939
2912
|
),
|
|
2940
|
-
/* @__PURE__ */ e("div", { className: "glass-surface px-4 py-2.5 rounded-xl text-xs font-medium text-muted-foreground border border-border shadow-sm", children: t("users.user_count", { count:
|
|
2913
|
+
/* @__PURE__ */ e("div", { className: "glass-surface px-4 py-2.5 rounded-xl text-xs font-medium text-muted-foreground border border-border shadow-sm", children: t("users.user_count", { count: de }) }),
|
|
2941
2914
|
/* @__PURE__ */ r(
|
|
2942
2915
|
"button",
|
|
2943
2916
|
{
|
|
2944
|
-
onClick: () =>
|
|
2917
|
+
onClick: () => q(!0),
|
|
2945
2918
|
className: "px-4 py-2.5 bg-secondary text-secondary-foreground border border-border rounded-xl text-sm font-semibold hover:bg-secondary/80 transition-all shadow-sm whitespace-nowrap inline-flex items-center gap-2",
|
|
2946
2919
|
children: [
|
|
2947
|
-
/* @__PURE__ */ e(
|
|
2920
|
+
/* @__PURE__ */ e(jt, { className: "w-4 h-4" }),
|
|
2948
2921
|
t("users.bulk_balance")
|
|
2949
2922
|
]
|
|
2950
2923
|
}
|
|
@@ -2952,7 +2925,7 @@ function fr() {
|
|
|
2952
2925
|
/* @__PURE__ */ e(
|
|
2953
2926
|
"button",
|
|
2954
2927
|
{
|
|
2955
|
-
onClick:
|
|
2928
|
+
onClick: De,
|
|
2956
2929
|
className: "px-4 py-2.5 bg-primary text-primary-foreground rounded-xl text-sm font-semibold hover:opacity-90 transition-all shadow-sm hover:shadow-md whitespace-nowrap",
|
|
2957
2930
|
children: t("users.add_user")
|
|
2958
2931
|
}
|
|
@@ -2960,71 +2933,71 @@ function fr() {
|
|
|
2960
2933
|
] })
|
|
2961
2934
|
] })
|
|
2962
2935
|
] }),
|
|
2963
|
-
/* @__PURE__ */ e(
|
|
2964
|
-
|
|
2936
|
+
/* @__PURE__ */ e(hr, { user: Z, onClose: () => k(null), onError: l }),
|
|
2937
|
+
j && /* @__PURE__ */ e(or, { message: j, onDismiss: () => l("") }),
|
|
2965
2938
|
m && /* @__PURE__ */ e(
|
|
2966
|
-
|
|
2939
|
+
mr,
|
|
2967
2940
|
{
|
|
2968
2941
|
searchQuery: g,
|
|
2969
2942
|
userMetadataFields: I,
|
|
2970
2943
|
onClose: () => {
|
|
2971
|
-
|
|
2944
|
+
q(!1), l("");
|
|
2972
2945
|
},
|
|
2973
2946
|
onApplied: () => {
|
|
2974
|
-
|
|
2947
|
+
q(!1), K();
|
|
2975
2948
|
},
|
|
2976
2949
|
onError: l
|
|
2977
2950
|
}
|
|
2978
2951
|
),
|
|
2979
2952
|
C && /* @__PURE__ */ e(
|
|
2980
|
-
|
|
2953
|
+
dr,
|
|
2981
2954
|
{
|
|
2982
2955
|
editingUser: $,
|
|
2983
2956
|
appSettings: p,
|
|
2984
2957
|
userMetadataFields: I,
|
|
2985
|
-
onClose:
|
|
2958
|
+
onClose: He,
|
|
2986
2959
|
onSaved: () => {
|
|
2987
|
-
|
|
2960
|
+
K(), He();
|
|
2988
2961
|
},
|
|
2989
2962
|
onError: l
|
|
2990
2963
|
}
|
|
2991
2964
|
),
|
|
2992
2965
|
O && /* @__PURE__ */ e(
|
|
2993
|
-
|
|
2966
|
+
cr,
|
|
2994
2967
|
{
|
|
2995
2968
|
user: O,
|
|
2996
2969
|
onClose: () => {
|
|
2997
2970
|
P(null), l("");
|
|
2998
2971
|
},
|
|
2999
2972
|
onSaved: () => {
|
|
3000
|
-
|
|
2973
|
+
K(), P(null);
|
|
3001
2974
|
},
|
|
3002
2975
|
onError: l
|
|
3003
2976
|
}
|
|
3004
2977
|
),
|
|
3005
2978
|
/* @__PURE__ */ e(
|
|
3006
|
-
|
|
2979
|
+
ir,
|
|
3007
2980
|
{
|
|
3008
|
-
users:
|
|
3009
|
-
loading:
|
|
3010
|
-
totalCount:
|
|
2981
|
+
users: B,
|
|
2982
|
+
loading: xe,
|
|
2983
|
+
totalCount: de,
|
|
3011
2984
|
userMetadataFields: I,
|
|
3012
2985
|
sortBy: x,
|
|
3013
2986
|
sortOrder: b,
|
|
3014
|
-
onSort:
|
|
3015
|
-
onLoadMore: () => f((J) => J +
|
|
2987
|
+
onSort: V,
|
|
2988
|
+
onLoadMore: () => f((J) => J + Ie),
|
|
3016
2989
|
onUsage: k,
|
|
3017
|
-
onEdit:
|
|
2990
|
+
onEdit: dt,
|
|
3018
2991
|
onRecharge: (J) => {
|
|
3019
2992
|
P(J), l("");
|
|
3020
2993
|
},
|
|
3021
|
-
onCopyToken:
|
|
2994
|
+
onCopyToken: pe,
|
|
3022
2995
|
onDelete: G
|
|
3023
2996
|
}
|
|
3024
2997
|
)
|
|
3025
2998
|
] });
|
|
3026
2999
|
}
|
|
3027
|
-
function
|
|
3000
|
+
function Ne(t, a, s) {
|
|
3028
3001
|
const d = [], o = /* @__PURE__ */ new Date(), n = t || [], l = new Map(n.map((g) => [g.date, g]));
|
|
3029
3002
|
for (let g = a - 1; g >= 0; g--) {
|
|
3030
3003
|
const S = new Date(o.getTime() - g * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
|
@@ -3037,13 +3010,13 @@ function we(t, a, s) {
|
|
|
3037
3010
|
}
|
|
3038
3011
|
return d;
|
|
3039
3012
|
}
|
|
3040
|
-
function
|
|
3013
|
+
function gr() {
|
|
3041
3014
|
const { t, i18n: a } = F(["admin", "translation"]), [s, d] = y(30), [o, n] = y("human"), {
|
|
3042
3015
|
data: l,
|
|
3043
3016
|
isLoading: g,
|
|
3044
3017
|
error: _,
|
|
3045
3018
|
refetch: S
|
|
3046
|
-
} =
|
|
3019
|
+
} = Gt(s, o), [w, x] = y({}), i = tt({}), b = a.language === "fa", h = b ? "fa-IR" : "en-US", N = b ? "fa-IR-u-ca-persian" : "en-US", D = _ ? _ instanceof Error ? _.message : t("analytics.error_loading") : "", p = he(() => {
|
|
3047
3020
|
if (!l) return null;
|
|
3048
3021
|
const m = l;
|
|
3049
3022
|
return {
|
|
@@ -3060,10 +3033,10 @@ function br() {
|
|
|
3060
3033
|
},
|
|
3061
3034
|
trends: {
|
|
3062
3035
|
...m.trends || {},
|
|
3063
|
-
users:
|
|
3064
|
-
threads:
|
|
3065
|
-
messages:
|
|
3066
|
-
token_usage:
|
|
3036
|
+
users: Ne(m.trends?.users, s, ["count"]),
|
|
3037
|
+
threads: Ne(m.trends?.threads, s, ["count"]),
|
|
3038
|
+
messages: Ne(m.trends?.messages, s, ["count"]),
|
|
3039
|
+
token_usage: Ne(m.trends?.token_usage, s, [
|
|
3067
3040
|
"input_tokens",
|
|
3068
3041
|
"output_tokens",
|
|
3069
3042
|
"requests",
|
|
@@ -3083,43 +3056,43 @@ function br() {
|
|
|
3083
3056
|
(A) => !!A[1]
|
|
3084
3057
|
);
|
|
3085
3058
|
if (m.length === 0) return;
|
|
3086
|
-
const
|
|
3087
|
-
for (const
|
|
3088
|
-
const M =
|
|
3059
|
+
const q = new ResizeObserver((A) => {
|
|
3060
|
+
for (const K of A) {
|
|
3061
|
+
const M = K.target.dataset.chartId;
|
|
3089
3062
|
M && x((z) => ({
|
|
3090
3063
|
...z,
|
|
3091
|
-
[M]:
|
|
3064
|
+
[M]: K.contentRect.width
|
|
3092
3065
|
}));
|
|
3093
3066
|
}
|
|
3094
3067
|
});
|
|
3095
|
-
return m.forEach(([, A]) =>
|
|
3068
|
+
return m.forEach(([, A]) => q.observe(A)), () => q.disconnect();
|
|
3096
3069
|
}, [p]);
|
|
3097
|
-
const R = (m) => (
|
|
3098
|
-
i.current[m] =
|
|
3099
|
-
},
|
|
3070
|
+
const R = (m) => (q) => {
|
|
3071
|
+
i.current[m] = q;
|
|
3072
|
+
}, c = (m, q = 0) => {
|
|
3100
3073
|
if (!m || m.length === 0) return null;
|
|
3101
|
-
const A = m.length,
|
|
3074
|
+
const A = m.length, K = new Intl.DateTimeFormat(N, { month: "short" });
|
|
3102
3075
|
let M = [];
|
|
3103
3076
|
if (s <= 14)
|
|
3104
|
-
M = Array.from({ length: A }, (z,
|
|
3077
|
+
M = Array.from({ length: A }, (z, Q) => Q);
|
|
3105
3078
|
else {
|
|
3106
|
-
const z = b ? 45 : 35,
|
|
3107
|
-
for (let
|
|
3108
|
-
M.push(
|
|
3079
|
+
const z = b ? 45 : 35, Q = q > 0 ? Math.floor(q / z) : 6, W = Math.max(1, Math.ceil(A / Math.max(1, Q)));
|
|
3080
|
+
for (let B = 0; B < A; B += W)
|
|
3081
|
+
M.push(B);
|
|
3109
3082
|
M.length > 0 && M[M.length - 1] !== A - 1 && (A - 1 - M[M.length - 1] > W / 2 ? M.push(A - 1) : M[M.length - 1] = A - 1);
|
|
3110
3083
|
}
|
|
3111
3084
|
return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: b ? "rtl" : "ltr", children: M.map((z) => {
|
|
3112
|
-
const
|
|
3113
|
-
if (!
|
|
3114
|
-
const W = new Date(
|
|
3085
|
+
const Q = m[z];
|
|
3086
|
+
if (!Q) return null;
|
|
3087
|
+
const W = new Date(Q.date), B = W.toLocaleDateString(N, { day: "numeric" }), de = K.format(W), xe = A > 1 ? z / (A - 1) * 100 : 50;
|
|
3115
3088
|
return /* @__PURE__ */ r(
|
|
3116
3089
|
"div",
|
|
3117
3090
|
{
|
|
3118
3091
|
className: "absolute top-0 transform -translate-x-1/2 flex flex-col items-center",
|
|
3119
|
-
style: { left: `${
|
|
3092
|
+
style: { left: `${xe}%` },
|
|
3120
3093
|
children: [
|
|
3121
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-gray-600 dark:text-gray-400 font-medium leading-none", children:
|
|
3122
|
-
/* @__PURE__ */ e("span", { className: "text-[9px] text-gray-400 dark:text-gray-500 mt-1 leading-none whitespace-nowrap", children:
|
|
3094
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-gray-600 dark:text-gray-400 font-medium leading-none", children: B }),
|
|
3095
|
+
/* @__PURE__ */ e("span", { className: "text-[9px] text-gray-400 dark:text-gray-500 mt-1 leading-none whitespace-nowrap", children: de })
|
|
3123
3096
|
]
|
|
3124
3097
|
},
|
|
3125
3098
|
z
|
|
@@ -3143,9 +3116,9 @@ function br() {
|
|
|
3143
3116
|
if (!p) return null;
|
|
3144
3117
|
const f = (m) => {
|
|
3145
3118
|
if (m <= 0) return 10;
|
|
3146
|
-
const
|
|
3119
|
+
const q = m * 1.15, A = Math.pow(10, Math.floor(Math.log10(q))), K = q / A;
|
|
3147
3120
|
let M;
|
|
3148
|
-
return
|
|
3121
|
+
return K <= 1.2 ? M = 0.2 : K <= 2.5 ? M = 0.5 : K <= 5 ? M = 1 : M = 2, Math.ceil(q / (M * A)) * (M * A);
|
|
3149
3122
|
}, C = Math.max(...p.trends.threads.map((m) => m.count) || [1]), L = Math.max(...p.trends.messages.map((m) => m.count) || [1]), $ = Math.max(
|
|
3150
3123
|
...p.trends.token_usage.map((m) => (m.input_tokens || 0) + (m.output_tokens || 0)) || [1]
|
|
3151
3124
|
), v = Math.max(
|
|
@@ -3278,12 +3251,12 @@ function br() {
|
|
|
3278
3251
|
"p",
|
|
3279
3252
|
{
|
|
3280
3253
|
className: "text-sm font-medium text-foreground",
|
|
3281
|
-
title:
|
|
3254
|
+
title: me(
|
|
3282
3255
|
p.overview.total_cost_microunits,
|
|
3283
3256
|
p.overview.currency,
|
|
3284
3257
|
h
|
|
3285
3258
|
),
|
|
3286
|
-
children:
|
|
3259
|
+
children: me(
|
|
3287
3260
|
p.overview.total_cost_microunits,
|
|
3288
3261
|
p.overview.currency,
|
|
3289
3262
|
h
|
|
@@ -3334,7 +3307,7 @@ function br() {
|
|
|
3334
3307
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
3335
3308
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
3336
3309
|
] }),
|
|
3337
|
-
p.trends.threads.length > 0 ? p.trends.threads.map((m,
|
|
3310
|
+
p.trends.threads.length > 0 ? p.trends.threads.map((m, q) => /* @__PURE__ */ e(
|
|
3338
3311
|
"div",
|
|
3339
3312
|
{
|
|
3340
3313
|
className: "w-1.5 group relative flex flex-col justify-end h-full",
|
|
@@ -3353,13 +3326,13 @@ function br() {
|
|
|
3353
3326
|
}
|
|
3354
3327
|
)
|
|
3355
3328
|
},
|
|
3356
|
-
|
|
3329
|
+
q
|
|
3357
3330
|
)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
3358
3331
|
] })
|
|
3359
3332
|
] }),
|
|
3360
3333
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
3361
3334
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
3362
|
-
|
|
3335
|
+
c(p.trends.threads, w.threads)
|
|
3363
3336
|
] })
|
|
3364
3337
|
]
|
|
3365
3338
|
}
|
|
@@ -3385,7 +3358,7 @@ function br() {
|
|
|
3385
3358
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
3386
3359
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
3387
3360
|
] }),
|
|
3388
|
-
p.trends.messages.length > 0 ? p.trends.messages.map((m,
|
|
3361
|
+
p.trends.messages.length > 0 ? p.trends.messages.map((m, q) => /* @__PURE__ */ e(
|
|
3389
3362
|
"div",
|
|
3390
3363
|
{
|
|
3391
3364
|
className: "w-1.5 group relative flex flex-col justify-end h-full",
|
|
@@ -3404,13 +3377,13 @@ function br() {
|
|
|
3404
3377
|
}
|
|
3405
3378
|
)
|
|
3406
3379
|
},
|
|
3407
|
-
|
|
3380
|
+
q
|
|
3408
3381
|
)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
3409
3382
|
] })
|
|
3410
3383
|
] }),
|
|
3411
3384
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
3412
3385
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
3413
|
-
|
|
3386
|
+
c(p.trends.messages, w.messages)
|
|
3414
3387
|
] })
|
|
3415
3388
|
]
|
|
3416
3389
|
}
|
|
@@ -3436,7 +3409,7 @@ function br() {
|
|
|
3436
3409
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
3437
3410
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
3438
3411
|
] }),
|
|
3439
|
-
p.trends.token_usage.length > 0 ? p.trends.token_usage.map((m,
|
|
3412
|
+
p.trends.token_usage.length > 0 ? p.trends.token_usage.map((m, q) => {
|
|
3440
3413
|
const A = (m.input_tokens || 0) + (m.output_tokens || 0);
|
|
3441
3414
|
return /* @__PURE__ */ e(
|
|
3442
3415
|
"div",
|
|
@@ -3457,14 +3430,14 @@ function br() {
|
|
|
3457
3430
|
}
|
|
3458
3431
|
)
|
|
3459
3432
|
},
|
|
3460
|
-
|
|
3433
|
+
q
|
|
3461
3434
|
);
|
|
3462
3435
|
}) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
3463
3436
|
] })
|
|
3464
3437
|
] }),
|
|
3465
3438
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
3466
3439
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
3467
|
-
|
|
3440
|
+
c(p.trends.token_usage, w["token-usage"])
|
|
3468
3441
|
] })
|
|
3469
3442
|
]
|
|
3470
3443
|
}
|
|
@@ -3481,24 +3454,24 @@ function br() {
|
|
|
3481
3454
|
children: [
|
|
3482
3455
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
3483
3456
|
/* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[70px]", children: [
|
|
3484
|
-
/* @__PURE__ */ e("span", { children:
|
|
3457
|
+
/* @__PURE__ */ e("span", { children: me(
|
|
3485
3458
|
k || 0,
|
|
3486
3459
|
p.overview.currency,
|
|
3487
3460
|
h
|
|
3488
3461
|
) }),
|
|
3489
|
-
/* @__PURE__ */ e("span", { children:
|
|
3462
|
+
/* @__PURE__ */ e("span", { children: me(
|
|
3490
3463
|
Math.floor((k || 0) / 2),
|
|
3491
3464
|
p.overview.currency,
|
|
3492
3465
|
h
|
|
3493
3466
|
) }),
|
|
3494
|
-
/* @__PURE__ */ e("span", { children:
|
|
3467
|
+
/* @__PURE__ */ e("span", { children: me(0, p.overview.currency, h) })
|
|
3495
3468
|
] }),
|
|
3496
3469
|
/* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
3497
3470
|
/* @__PURE__ */ r("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
|
|
3498
3471
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
3499
3472
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
3500
3473
|
] }),
|
|
3501
|
-
p.trends.token_usage.length > 0 ? p.trends.token_usage.map((m,
|
|
3474
|
+
p.trends.token_usage.length > 0 ? p.trends.token_usage.map((m, q) => /* @__PURE__ */ e(
|
|
3502
3475
|
"div",
|
|
3503
3476
|
{
|
|
3504
3477
|
className: "w-1.5 group relative flex flex-col justify-end h-full",
|
|
@@ -3510,7 +3483,7 @@ function br() {
|
|
|
3510
3483
|
height: `${(m.cost_microunits || 0) / k * 100}%`
|
|
3511
3484
|
},
|
|
3512
3485
|
children: /* @__PURE__ */ r("div", { className: "absolute bottom-full mb-1 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity bg-card px-2 py-1 rounded border border-border shadow-sm z-20 pointer-events-none flex flex-col items-center", children: [
|
|
3513
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-emerald-500 leading-none mb-0.5", children:
|
|
3486
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-emerald-500 leading-none mb-0.5", children: me(
|
|
3514
3487
|
m.cost_microunits || 0,
|
|
3515
3488
|
p.overview.currency,
|
|
3516
3489
|
h
|
|
@@ -3523,13 +3496,13 @@ function br() {
|
|
|
3523
3496
|
}
|
|
3524
3497
|
)
|
|
3525
3498
|
},
|
|
3526
|
-
|
|
3499
|
+
q
|
|
3527
3500
|
)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
3528
3501
|
] })
|
|
3529
3502
|
] }),
|
|
3530
3503
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
3531
3504
|
/* @__PURE__ */ e("div", { className: "min-w-[70px] invisible" }),
|
|
3532
|
-
|
|
3505
|
+
c(p.trends.token_usage, w.cost)
|
|
3533
3506
|
] })
|
|
3534
3507
|
]
|
|
3535
3508
|
}
|
|
@@ -3543,11 +3516,11 @@ function br() {
|
|
|
3543
3516
|
/* @__PURE__ */ r("div", { className: "relative w-56 h-56 lg:w-60 lg:h-60", children: [
|
|
3544
3517
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 100", className: "w-full h-full -rotate-90 drop-shadow-md", children: (() => {
|
|
3545
3518
|
const m = p.distributions.feedback_sentiment.filter(
|
|
3546
|
-
(
|
|
3547
|
-
),
|
|
3548
|
-
if (
|
|
3549
|
-
const A = m.find((
|
|
3550
|
-
return /* @__PURE__ */ r(
|
|
3519
|
+
(B) => B.sentiment === "positive" || B.sentiment === "negative"
|
|
3520
|
+
), q = m.reduce((B, de) => B + de.count, 0);
|
|
3521
|
+
if (q === 0) return null;
|
|
3522
|
+
const A = m.find((B) => B.sentiment === "positive")?.count || 0, K = m.find((B) => B.sentiment === "negative")?.count || 0, M = 40, z = 2 * Math.PI * M, Q = A / q * 100, W = K / q * 100;
|
|
3523
|
+
return /* @__PURE__ */ r(et, { children: [
|
|
3551
3524
|
/* @__PURE__ */ e(
|
|
3552
3525
|
"circle",
|
|
3553
3526
|
{
|
|
@@ -3579,8 +3552,8 @@ function br() {
|
|
|
3579
3552
|
fill: "transparent",
|
|
3580
3553
|
stroke: "url(#posGradient)",
|
|
3581
3554
|
strokeWidth: "10",
|
|
3582
|
-
strokeDasharray: `${
|
|
3583
|
-
strokeLinecap:
|
|
3555
|
+
strokeDasharray: `${Q / 100 * z} ${z}`,
|
|
3556
|
+
strokeLinecap: Q > 0 ? "round" : "butt",
|
|
3584
3557
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
3585
3558
|
}
|
|
3586
3559
|
),
|
|
@@ -3594,7 +3567,7 @@ function br() {
|
|
|
3594
3567
|
stroke: "url(#negGradient)",
|
|
3595
3568
|
strokeWidth: "10",
|
|
3596
3569
|
strokeDasharray: `${W / 100 * z} ${z}`,
|
|
3597
|
-
strokeDashoffset: -(
|
|
3570
|
+
strokeDashoffset: -(Q / 100 * z),
|
|
3598
3571
|
strokeLinecap: W > 0 ? "round" : "butt",
|
|
3599
3572
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
3600
3573
|
}
|
|
@@ -3602,16 +3575,16 @@ function br() {
|
|
|
3602
3575
|
] });
|
|
3603
3576
|
})() }),
|
|
3604
3577
|
/* @__PURE__ */ r("div", { className: "absolute inset-0 flex flex-col items-center justify-center pointer-events-none", children: [
|
|
3605
|
-
/* @__PURE__ */ e("span", { className: "text-3xl lg:text-4xl font-light text-foreground", children: p.distributions.feedback_sentiment.filter((m) => m.sentiment === "positive" || m.sentiment === "negative").reduce((m,
|
|
3578
|
+
/* @__PURE__ */ e("span", { className: "text-3xl lg:text-4xl font-light text-foreground", children: p.distributions.feedback_sentiment.filter((m) => m.sentiment === "positive" || m.sentiment === "negative").reduce((m, q) => m + (q.count || 0), 0).toLocaleString(h) }),
|
|
3606
3579
|
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground uppercase tracking-widest mt-1", children: t("analytics.total_feedback") })
|
|
3607
3580
|
] })
|
|
3608
3581
|
] }),
|
|
3609
3582
|
/* @__PURE__ */ e("div", { className: "flex flex-col gap-4 min-w-[140px]", children: [...p.distributions.feedback_sentiment].filter(
|
|
3610
3583
|
(m) => m.sentiment === "positive" || m.sentiment === "negative"
|
|
3611
|
-
).sort((m,
|
|
3584
|
+
).sort((m, q) => m.sentiment === "positive" ? -1 : 1).map((m) => {
|
|
3612
3585
|
const A = p.distributions.feedback_sentiment.filter(
|
|
3613
3586
|
(W) => W.sentiment === "positive" || W.sentiment === "negative"
|
|
3614
|
-
).reduce((W,
|
|
3587
|
+
).reduce((W, B) => W + B.count, 0), K = A > 0 ? m.count / A * 100 : 0, M = m.sentiment === "positive" ? t("analytics.positive") : t("analytics.negative"), z = m.sentiment === "positive" ? "bg-primary" : "bg-destructive", Q = m.sentiment === "positive" ? "👍" : "👎";
|
|
3615
3588
|
return /* @__PURE__ */ r(
|
|
3616
3589
|
"div",
|
|
3617
3590
|
{
|
|
@@ -3627,12 +3600,12 @@ function br() {
|
|
|
3627
3600
|
/* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground font-medium", children: [
|
|
3628
3601
|
M,
|
|
3629
3602
|
" ",
|
|
3630
|
-
|
|
3603
|
+
Q
|
|
3631
3604
|
] })
|
|
3632
3605
|
] }),
|
|
3633
3606
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
3634
3607
|
/* @__PURE__ */ r("span", { className: "text-sm font-semibold text-foreground bg-muted/50 px-2.5 py-1 rounded-lg min-w-[50px] text-center", children: [
|
|
3635
|
-
(
|
|
3608
|
+
(K || 0).toLocaleString(h, {
|
|
3636
3609
|
maximumFractionDigits: 0
|
|
3637
3610
|
}),
|
|
3638
3611
|
"%"
|
|
@@ -3674,7 +3647,7 @@ function br() {
|
|
|
3674
3647
|
] })
|
|
3675
3648
|
] });
|
|
3676
3649
|
}
|
|
3677
|
-
function
|
|
3650
|
+
function ye({ title: t, icon: a }) {
|
|
3678
3651
|
return /* @__PURE__ */ r("div", { className: "relative py-12", children: [
|
|
3679
3652
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center", "aria-hidden": "true", children: /* @__PURE__ */ e("div", { className: "w-full border-t border-border/60" }) }),
|
|
3680
3653
|
/* @__PURE__ */ e("div", { className: "relative flex justify-center", children: /* @__PURE__ */ r("span", { className: "bg-background px-6 text-sm font-bold text-muted-foreground uppercase tracking-[0.2em] flex items-center gap-3", children: [
|
|
@@ -3683,7 +3656,7 @@ function _e({ title: t, icon: a }) {
|
|
|
3683
3656
|
] }) })
|
|
3684
3657
|
] });
|
|
3685
3658
|
}
|
|
3686
|
-
function
|
|
3659
|
+
function ve({ value: t }) {
|
|
3687
3660
|
const { t: a } = F(["admin", "translation", "settings"]);
|
|
3688
3661
|
if (!t || !t.includes(":") && !t.includes(".")) return null;
|
|
3689
3662
|
const s = a(t);
|
|
@@ -3695,7 +3668,7 @@ function ye({ value: t }) {
|
|
|
3695
3668
|
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children: s })
|
|
3696
3669
|
] });
|
|
3697
3670
|
}
|
|
3698
|
-
function
|
|
3671
|
+
function fr({
|
|
3699
3672
|
settings: t,
|
|
3700
3673
|
setSettings: a,
|
|
3701
3674
|
accentValue: s,
|
|
@@ -3703,7 +3676,7 @@ function xr({
|
|
|
3703
3676
|
}) {
|
|
3704
3677
|
const { t: o } = F(["admin", "translation", "settings"]);
|
|
3705
3678
|
return /* @__PURE__ */ r("section", { children: [
|
|
3706
|
-
/* @__PURE__ */ e(
|
|
3679
|
+
/* @__PURE__ */ e(ye, { title: o("app_settings.sections.general"), icon: Fe }),
|
|
3707
3680
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
3708
3681
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
3709
3682
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
@@ -3719,7 +3692,7 @@ function xr({
|
|
|
3719
3692
|
dir: "auto"
|
|
3720
3693
|
}
|
|
3721
3694
|
),
|
|
3722
|
-
/* @__PURE__ */ e(
|
|
3695
|
+
/* @__PURE__ */ e(ve, { value: t.app_name })
|
|
3723
3696
|
] }),
|
|
3724
3697
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3725
3698
|
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: o("app_settings.general.admin_title") }),
|
|
@@ -3734,7 +3707,7 @@ function xr({
|
|
|
3734
3707
|
dir: "auto"
|
|
3735
3708
|
}
|
|
3736
3709
|
),
|
|
3737
|
-
/* @__PURE__ */ e(
|
|
3710
|
+
/* @__PURE__ */ e(ve, { value: t.admin_title || "" })
|
|
3738
3711
|
] })
|
|
3739
3712
|
] }),
|
|
3740
3713
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
@@ -3754,13 +3727,13 @@ function xr({
|
|
|
3754
3727
|
}
|
|
3755
3728
|
),
|
|
3756
3729
|
/* @__PURE__ */ r("p", { className: "mt-3 text-[10px] text-muted-foreground/50 italic flex items-center gap-1.5 ml-1", children: [
|
|
3757
|
-
/* @__PURE__ */ e(
|
|
3730
|
+
/* @__PURE__ */ e(at, { className: "size-3" }),
|
|
3758
3731
|
o("app_settings.general.language_help")
|
|
3759
3732
|
] })
|
|
3760
3733
|
] }),
|
|
3761
3734
|
/* @__PURE__ */ r("div", { className: "space-y-5 rounded-2xl border border-border/50 bg-muted/10 p-5", children: [
|
|
3762
3735
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
3763
|
-
/* @__PURE__ */ e(
|
|
3736
|
+
/* @__PURE__ */ e(Tt, { className: "size-4 text-primary" }),
|
|
3764
3737
|
/* @__PURE__ */ r("div", { children: [
|
|
3765
3738
|
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children: o("app_settings.general.appearance") }),
|
|
3766
3739
|
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: o("app_settings.general.appearance_help") })
|
|
@@ -3827,7 +3800,7 @@ function xr({
|
|
|
3827
3800
|
] })
|
|
3828
3801
|
] });
|
|
3829
3802
|
}
|
|
3830
|
-
function
|
|
3803
|
+
function ie({
|
|
3831
3804
|
title: t,
|
|
3832
3805
|
help: a,
|
|
3833
3806
|
checked: s,
|
|
@@ -3837,7 +3810,7 @@ function le({
|
|
|
3837
3810
|
return /* @__PURE__ */ r(
|
|
3838
3811
|
"div",
|
|
3839
3812
|
{
|
|
3840
|
-
className:
|
|
3813
|
+
className: ke(
|
|
3841
3814
|
"p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors",
|
|
3842
3815
|
o
|
|
3843
3816
|
),
|
|
@@ -3846,12 +3819,12 @@ function le({
|
|
|
3846
3819
|
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: t }),
|
|
3847
3820
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: a })
|
|
3848
3821
|
] }),
|
|
3849
|
-
/* @__PURE__ */ e(
|
|
3822
|
+
/* @__PURE__ */ e(le, { checked: s, onCheckedChange: d })
|
|
3850
3823
|
]
|
|
3851
3824
|
}
|
|
3852
3825
|
);
|
|
3853
3826
|
}
|
|
3854
|
-
function
|
|
3827
|
+
function Re({
|
|
3855
3828
|
title: t,
|
|
3856
3829
|
fields: a,
|
|
3857
3830
|
values: s,
|
|
@@ -3898,7 +3871,7 @@ function Me({
|
|
|
3898
3871
|
)
|
|
3899
3872
|
] });
|
|
3900
3873
|
}
|
|
3901
|
-
function
|
|
3874
|
+
function br({
|
|
3902
3875
|
settings: t,
|
|
3903
3876
|
setSettings: a,
|
|
3904
3877
|
userMetadataFields: s,
|
|
@@ -3906,7 +3879,7 @@ function vr({
|
|
|
3906
3879
|
}) {
|
|
3907
3880
|
const { t: o } = F(["admin", "translation", "settings"]);
|
|
3908
3881
|
return /* @__PURE__ */ r("section", { children: [
|
|
3909
|
-
/* @__PURE__ */ e(
|
|
3882
|
+
/* @__PURE__ */ e(ye, { title: o("app_settings.sections.chat"), icon: At }),
|
|
3910
3883
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
3911
3884
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
3912
3885
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
@@ -3922,7 +3895,7 @@ function vr({
|
|
|
3922
3895
|
dir: "auto"
|
|
3923
3896
|
}
|
|
3924
3897
|
),
|
|
3925
|
-
/* @__PURE__ */ e(
|
|
3898
|
+
/* @__PURE__ */ e(ve, { value: t.welcome_greeting || "" })
|
|
3926
3899
|
] }),
|
|
3927
3900
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3928
3901
|
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: o("app_settings.chat.welcome_subtitle") }),
|
|
@@ -3936,13 +3909,13 @@ function vr({
|
|
|
3936
3909
|
dir: "auto"
|
|
3937
3910
|
}
|
|
3938
3911
|
),
|
|
3939
|
-
/* @__PURE__ */ e(
|
|
3912
|
+
/* @__PURE__ */ e(ve, { value: t.welcome_subtitle || "" })
|
|
3940
3913
|
] })
|
|
3941
3914
|
] }),
|
|
3942
3915
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3943
3916
|
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: o("app_settings.chat.disclaimer") }),
|
|
3944
3917
|
/* @__PURE__ */ e(
|
|
3945
|
-
|
|
3918
|
+
Ae,
|
|
3946
3919
|
{
|
|
3947
3920
|
value: t.disclaimer || "",
|
|
3948
3921
|
onChange: (n) => a({ ...t, disclaimer: n.target.value }),
|
|
@@ -3950,11 +3923,11 @@ function vr({
|
|
|
3950
3923
|
dir: "auto"
|
|
3951
3924
|
}
|
|
3952
3925
|
),
|
|
3953
|
-
/* @__PURE__ */ e(
|
|
3926
|
+
/* @__PURE__ */ e(ve, { value: t.disclaimer || "" })
|
|
3954
3927
|
] }),
|
|
3955
3928
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-6 pt-2", children: [
|
|
3956
3929
|
/* @__PURE__ */ e(
|
|
3957
|
-
|
|
3930
|
+
ie,
|
|
3958
3931
|
{
|
|
3959
3932
|
title: o("app_settings.chat.show_tool_details"),
|
|
3960
3933
|
help: o("app_settings.chat.show_tool_details_help"),
|
|
@@ -3963,7 +3936,7 @@ function vr({
|
|
|
3963
3936
|
}
|
|
3964
3937
|
),
|
|
3965
3938
|
/* @__PURE__ */ e(
|
|
3966
|
-
|
|
3939
|
+
ie,
|
|
3967
3940
|
{
|
|
3968
3941
|
title: o("app_settings.chat.show_settings"),
|
|
3969
3942
|
help: o("app_settings.chat.show_settings_help"),
|
|
@@ -3972,7 +3945,7 @@ function vr({
|
|
|
3972
3945
|
}
|
|
3973
3946
|
),
|
|
3974
3947
|
/* @__PURE__ */ e(
|
|
3975
|
-
|
|
3948
|
+
ie,
|
|
3976
3949
|
{
|
|
3977
3950
|
title: o("app_settings.chat.show_version_in_settings"),
|
|
3978
3951
|
help: o("app_settings.chat.show_version_in_settings_help"),
|
|
@@ -3981,7 +3954,7 @@ function vr({
|
|
|
3981
3954
|
}
|
|
3982
3955
|
),
|
|
3983
3956
|
/* @__PURE__ */ e(
|
|
3984
|
-
|
|
3957
|
+
ie,
|
|
3985
3958
|
{
|
|
3986
3959
|
title: o("app_settings.chat.disable_signup"),
|
|
3987
3960
|
help: o("app_settings.chat.disable_signup_help"),
|
|
@@ -3990,7 +3963,7 @@ function vr({
|
|
|
3990
3963
|
}
|
|
3991
3964
|
),
|
|
3992
3965
|
/* @__PURE__ */ e(
|
|
3993
|
-
|
|
3966
|
+
ie,
|
|
3994
3967
|
{
|
|
3995
3968
|
title: o("app_settings.chat.disable_auth_page"),
|
|
3996
3969
|
help: o("app_settings.chat.disable_auth_page_help"),
|
|
@@ -4000,7 +3973,7 @@ function vr({
|
|
|
4000
3973
|
}
|
|
4001
3974
|
),
|
|
4002
3975
|
/* @__PURE__ */ e(
|
|
4003
|
-
|
|
3976
|
+
ie,
|
|
4004
3977
|
{
|
|
4005
3978
|
title: o("app_settings.chat.composer_attachments"),
|
|
4006
3979
|
help: o("app_settings.chat.composer_attachments_help"),
|
|
@@ -4009,7 +3982,7 @@ function vr({
|
|
|
4009
3982
|
}
|
|
4010
3983
|
),
|
|
4011
3984
|
/* @__PURE__ */ e(
|
|
4012
|
-
|
|
3985
|
+
ie,
|
|
4013
3986
|
{
|
|
4014
3987
|
title: o("app_settings.chat.thread_actions_feedback"),
|
|
4015
3988
|
help: o("app_settings.chat.thread_actions_feedback_help"),
|
|
@@ -4018,7 +3991,7 @@ function vr({
|
|
|
4018
3991
|
}
|
|
4019
3992
|
),
|
|
4020
3993
|
/* @__PURE__ */ e(
|
|
4021
|
-
|
|
3994
|
+
ie,
|
|
4022
3995
|
{
|
|
4023
3996
|
title: o("app_settings.chat.thread_actions_retry"),
|
|
4024
3997
|
help: o("app_settings.chat.thread_actions_retry_help"),
|
|
@@ -4027,7 +4000,7 @@ function vr({
|
|
|
4027
4000
|
}
|
|
4028
4001
|
),
|
|
4029
4002
|
/* @__PURE__ */ e(
|
|
4030
|
-
|
|
4003
|
+
ie,
|
|
4031
4004
|
{
|
|
4032
4005
|
title: o("app_settings.chat.history_enabled"),
|
|
4033
4006
|
help: o("app_settings.chat.history_enabled_help"),
|
|
@@ -4040,7 +4013,7 @@ function vr({
|
|
|
4040
4013
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
4041
4014
|
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children: o("app_settings.chat.history_show_delete") }),
|
|
4042
4015
|
/* @__PURE__ */ e(
|
|
4043
|
-
|
|
4016
|
+
le,
|
|
4044
4017
|
{
|
|
4045
4018
|
checked: t.history_show_delete,
|
|
4046
4019
|
onCheckedChange: (n) => a({ ...t, history_show_delete: n })
|
|
@@ -4050,7 +4023,7 @@ function vr({
|
|
|
4050
4023
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
4051
4024
|
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children: o("app_settings.chat.history_show_rename") }),
|
|
4052
4025
|
/* @__PURE__ */ e(
|
|
4053
|
-
|
|
4026
|
+
le,
|
|
4054
4027
|
{
|
|
4055
4028
|
checked: t.history_show_rename,
|
|
4056
4029
|
onCheckedChange: (n) => a({ ...t, history_show_rename: n })
|
|
@@ -4060,7 +4033,7 @@ function vr({
|
|
|
4060
4033
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
4061
4034
|
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children: o("app_settings.chat.history_show_share") }),
|
|
4062
4035
|
/* @__PURE__ */ e(
|
|
4063
|
-
|
|
4036
|
+
le,
|
|
4064
4037
|
{
|
|
4065
4038
|
checked: t.history_show_share,
|
|
4066
4039
|
onCheckedChange: (n) => a({ ...t, history_show_share: n })
|
|
@@ -4070,7 +4043,7 @@ function vr({
|
|
|
4070
4043
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
4071
4044
|
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children: o("app_settings.chat.history_show_pin") }),
|
|
4072
4045
|
/* @__PURE__ */ e(
|
|
4073
|
-
|
|
4046
|
+
le,
|
|
4074
4047
|
{
|
|
4075
4048
|
checked: t.history_show_pin,
|
|
4076
4049
|
onCheckedChange: (n) => a({ ...t, history_show_pin: n })
|
|
@@ -4122,7 +4095,7 @@ function vr({
|
|
|
4122
4095
|
] }),
|
|
4123
4096
|
/* @__PURE__ */ r("div", { className: "space-y-10", children: [
|
|
4124
4097
|
/* @__PURE__ */ e(
|
|
4125
|
-
|
|
4098
|
+
Re,
|
|
4126
4099
|
{
|
|
4127
4100
|
title: o("app_settings.chat.general_tab"),
|
|
4128
4101
|
fields: [
|
|
@@ -4139,7 +4112,7 @@ function vr({
|
|
|
4139
4112
|
}
|
|
4140
4113
|
),
|
|
4141
4114
|
/* @__PURE__ */ e(
|
|
4142
|
-
|
|
4115
|
+
Re,
|
|
4143
4116
|
{
|
|
4144
4117
|
title: o("app_settings.chat.profile_tab"),
|
|
4145
4118
|
fields: [
|
|
@@ -4160,7 +4133,7 @@ function vr({
|
|
|
4160
4133
|
}
|
|
4161
4134
|
),
|
|
4162
4135
|
/* @__PURE__ */ e(
|
|
4163
|
-
|
|
4136
|
+
Re,
|
|
4164
4137
|
{
|
|
4165
4138
|
title: o("app_settings.chat.account_tab"),
|
|
4166
4139
|
fields: [
|
|
@@ -4180,8 +4153,8 @@ function vr({
|
|
|
4180
4153
|
] })
|
|
4181
4154
|
] });
|
|
4182
4155
|
}
|
|
4183
|
-
const
|
|
4184
|
-
function
|
|
4156
|
+
const Me = "I understand this runs arbitrary code";
|
|
4157
|
+
function xr() {
|
|
4185
4158
|
try {
|
|
4186
4159
|
const t = localStorage.getItem("admin_info");
|
|
4187
4160
|
return t ? JSON.parse(t).permissions || [] : [];
|
|
@@ -4189,10 +4162,10 @@ function yr() {
|
|
|
4189
4162
|
return [];
|
|
4190
4163
|
}
|
|
4191
4164
|
}
|
|
4192
|
-
function
|
|
4165
|
+
function lt(t) {
|
|
4193
4166
|
return t === "destructive" ? "bg-destructive/10 text-destructive border-destructive/20" : t === "caution" ? "bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20" : "bg-muted/40 text-muted-foreground border-border/50";
|
|
4194
4167
|
}
|
|
4195
|
-
function
|
|
4168
|
+
function vr(t) {
|
|
4196
4169
|
switch (t) {
|
|
4197
4170
|
case "completed":
|
|
4198
4171
|
return "bg-green-500/10 text-green-600 dark:text-green-400 border-green-500/20";
|
|
@@ -4204,8 +4177,8 @@ function _r(t) {
|
|
|
4204
4177
|
return "bg-primary/10 text-primary border-primary/20";
|
|
4205
4178
|
}
|
|
4206
4179
|
}
|
|
4207
|
-
function
|
|
4208
|
-
const { t: s } = F(["admin"]), { runRegisteredJob: d } =
|
|
4180
|
+
function yr({ job: t, onClose: a }) {
|
|
4181
|
+
const { t: s } = F(["admin"]), { runRegisteredJob: d } = Ve(), [o, n] = y(() => {
|
|
4209
4182
|
const h = {};
|
|
4210
4183
|
for (const N of t.params) {
|
|
4211
4184
|
const D = N.default, p = typeof D == "string" || typeof D == "number" || typeof D == "boolean";
|
|
@@ -4224,9 +4197,9 @@ function Nr({ job: t, onClose: a }) {
|
|
|
4224
4197
|
params: h,
|
|
4225
4198
|
dry_run: l,
|
|
4226
4199
|
confirm: w ? _ : void 0
|
|
4227
|
-
}),
|
|
4200
|
+
}), fe.success(s("jobs.run_started", { name: t.name })), a();
|
|
4228
4201
|
} catch (N) {
|
|
4229
|
-
|
|
4202
|
+
fe.error(N instanceof Error ? N.message : s("jobs.run_failed"));
|
|
4230
4203
|
}
|
|
4231
4204
|
};
|
|
4232
4205
|
return (
|
|
@@ -4235,17 +4208,17 @@ function Nr({ job: t, onClose: a }) {
|
|
|
4235
4208
|
// close button positions itself with `rtl:` utilities that key off the RTL <body>
|
|
4236
4209
|
// ancestor, so force it back to the right edge for this LTR island.
|
|
4237
4210
|
/* @__PURE__ */ r(
|
|
4238
|
-
|
|
4211
|
+
Le,
|
|
4239
4212
|
{
|
|
4240
4213
|
dir: "ltr",
|
|
4241
4214
|
className: "max-w-lg text-left [&_[data-slot=dialog-close]]:!right-4 [&_[data-slot=dialog-close]]:!left-auto",
|
|
4242
4215
|
children: [
|
|
4243
|
-
/* @__PURE__ */ r(
|
|
4244
|
-
/* @__PURE__ */ r(
|
|
4216
|
+
/* @__PURE__ */ r(qe, { className: "text-left", children: [
|
|
4217
|
+
/* @__PURE__ */ r(je, { className: "flex items-center gap-2", children: [
|
|
4245
4218
|
t.name,
|
|
4246
|
-
/* @__PURE__ */ e(
|
|
4219
|
+
/* @__PURE__ */ e(Se, { variant: "outline", className: lt(t.danger), children: s(`jobs.danger.${t.danger}`) })
|
|
4247
4220
|
] }),
|
|
4248
|
-
t.description && /* @__PURE__ */ e(
|
|
4221
|
+
t.description && /* @__PURE__ */ e(Te, { children: t.description })
|
|
4249
4222
|
] }),
|
|
4250
4223
|
/* @__PURE__ */ r("div", { className: "space-y-4 py-2", children: [
|
|
4251
4224
|
t.params.map((h) => /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
@@ -4254,7 +4227,7 @@ function Nr({ job: t, onClose: a }) {
|
|
|
4254
4227
|
h.required && /* @__PURE__ */ e("span", { className: "text-destructive ml-1", children: "*" })
|
|
4255
4228
|
] }),
|
|
4256
4229
|
h.type === "bool" ? /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(
|
|
4257
|
-
|
|
4230
|
+
le,
|
|
4258
4231
|
{
|
|
4259
4232
|
checked: o[h.name] === "true",
|
|
4260
4233
|
onCheckedChange: (N) => i(h.name, N ? "true" : "false")
|
|
@@ -4271,7 +4244,7 @@ function Nr({ job: t, onClose: a }) {
|
|
|
4271
4244
|
]
|
|
4272
4245
|
}
|
|
4273
4246
|
) : h.type === "text" ? /* @__PURE__ */ e(
|
|
4274
|
-
|
|
4247
|
+
Ae,
|
|
4275
4248
|
{
|
|
4276
4249
|
value: o[h.name],
|
|
4277
4250
|
onChange: (N) => i(h.name, N.target.value),
|
|
@@ -4294,11 +4267,11 @@ function Nr({ job: t, onClose: a }) {
|
|
|
4294
4267
|
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: s("jobs.dry_run") }),
|
|
4295
4268
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/70", children: s("jobs.dry_run_help") })
|
|
4296
4269
|
] }),
|
|
4297
|
-
/* @__PURE__ */ e(
|
|
4270
|
+
/* @__PURE__ */ e(le, { checked: l, onCheckedChange: g })
|
|
4298
4271
|
] }),
|
|
4299
4272
|
w && /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
4300
4273
|
/* @__PURE__ */ r(U, { className: "text-xs font-bold text-destructive flex items-center gap-1.5", children: [
|
|
4301
|
-
/* @__PURE__ */ e(
|
|
4274
|
+
/* @__PURE__ */ e(Mt, { className: "size-3.5" }),
|
|
4302
4275
|
s("jobs.confirm_destructive", { name: t.name })
|
|
4303
4276
|
] }),
|
|
4304
4277
|
/* @__PURE__ */ e(
|
|
@@ -4312,8 +4285,8 @@ function Nr({ job: t, onClose: a }) {
|
|
|
4312
4285
|
)
|
|
4313
4286
|
] })
|
|
4314
4287
|
] }),
|
|
4315
|
-
/* @__PURE__ */ r(
|
|
4316
|
-
/* @__PURE__ */ e(
|
|
4288
|
+
/* @__PURE__ */ r(Je, { children: [
|
|
4289
|
+
/* @__PURE__ */ e(Ue, { asChild: !0, children: /* @__PURE__ */ e(ne, { variant: "ghost", children: s("cancel") }) }),
|
|
4317
4290
|
/* @__PURE__ */ r(
|
|
4318
4291
|
ne,
|
|
4319
4292
|
{
|
|
@@ -4321,7 +4294,7 @@ function Nr({ job: t, onClose: a }) {
|
|
|
4321
4294
|
onClick: b,
|
|
4322
4295
|
disabled: !x || d.isPending,
|
|
4323
4296
|
children: [
|
|
4324
|
-
d.isPending ? /* @__PURE__ */ e(
|
|
4297
|
+
d.isPending ? /* @__PURE__ */ e(Be, { className: "size-4 animate-spin" }) : /* @__PURE__ */ e(ze, { className: "size-4" }),
|
|
4325
4298
|
s(l ? "jobs.run_dry" : "jobs.run")
|
|
4326
4299
|
]
|
|
4327
4300
|
}
|
|
@@ -4332,7 +4305,7 @@ function Nr({ job: t, onClose: a }) {
|
|
|
4332
4305
|
)
|
|
4333
4306
|
);
|
|
4334
4307
|
}
|
|
4335
|
-
function
|
|
4308
|
+
function _r({ run: t }) {
|
|
4336
4309
|
const { t: a } = F(["admin"]), s = t.params && Object.keys(t.params).length > 0;
|
|
4337
4310
|
return /* @__PURE__ */ r("div", { className: "space-y-3 pt-3", dir: "ltr", children: [
|
|
4338
4311
|
(s || t.code) && /* @__PURE__ */ r("div", { children: [
|
|
@@ -4354,8 +4327,8 @@ ${a("jobs.output_truncated")}` : ""
|
|
|
4354
4327
|
] })
|
|
4355
4328
|
] });
|
|
4356
4329
|
}
|
|
4357
|
-
function
|
|
4358
|
-
const { t: a, i18n: s } = F(["admin"]), [d, o] = y(!1), n = t.status === "queued" || t.status === "processing", { data: l } =
|
|
4330
|
+
function Nr({ summary: t }) {
|
|
4331
|
+
const { t: a, i18n: s } = F(["admin"]), [d, o] = y(!1), n = t.status === "queued" || t.status === "processing", { data: l } = ar(d ? t.id : null, n), { cancelJobRun: g } = Ve(), _ = l ?? t, S = new Intl.DateTimeFormat(s.language === "fa" ? "fa-IR" : void 0, {
|
|
4359
4332
|
dateStyle: "short",
|
|
4360
4333
|
timeStyle: "short"
|
|
4361
4334
|
});
|
|
@@ -4369,12 +4342,12 @@ function kr({ summary: t }) {
|
|
|
4369
4342
|
children: [
|
|
4370
4343
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
4371
4344
|
/* @__PURE__ */ e(
|
|
4372
|
-
|
|
4345
|
+
nt,
|
|
4373
4346
|
{
|
|
4374
4347
|
className: `size-3.5 text-muted-foreground/60 shrink-0 transition-transform ${d ? "" : "-rotate-90"}`
|
|
4375
4348
|
}
|
|
4376
4349
|
),
|
|
4377
|
-
/* @__PURE__ */ e(
|
|
4350
|
+
/* @__PURE__ */ e(Se, { variant: "outline", className: vr(_.status), children: a(`jobs.status.${_.status}`) }),
|
|
4378
4351
|
/* @__PURE__ */ e("span", { className: "text-sm truncate", children: _.name }),
|
|
4379
4352
|
_.dry_run && /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground/60", children: [
|
|
4380
4353
|
"(",
|
|
@@ -4389,8 +4362,8 @@ function kr({ summary: t }) {
|
|
|
4389
4362
|
]
|
|
4390
4363
|
}
|
|
4391
4364
|
),
|
|
4392
|
-
d && /* @__PURE__ */ e("div", { className: "px-3 pb-3", children: l ? /* @__PURE__ */ r(
|
|
4393
|
-
/* @__PURE__ */ e(
|
|
4365
|
+
d && /* @__PURE__ */ e("div", { className: "px-3 pb-3", children: l ? /* @__PURE__ */ r(et, { children: [
|
|
4366
|
+
/* @__PURE__ */ e(_r, { run: _ }),
|
|
4394
4367
|
n && /* @__PURE__ */ r(
|
|
4395
4368
|
ne,
|
|
4396
4369
|
{
|
|
@@ -4400,34 +4373,34 @@ function kr({ summary: t }) {
|
|
|
4400
4373
|
onClick: () => g.mutate(_.id),
|
|
4401
4374
|
disabled: g.isPending,
|
|
4402
4375
|
children: [
|
|
4403
|
-
/* @__PURE__ */ e(
|
|
4376
|
+
/* @__PURE__ */ e($t, { className: "size-3.5" }),
|
|
4404
4377
|
a("jobs.cancel_run")
|
|
4405
4378
|
]
|
|
4406
4379
|
}
|
|
4407
4380
|
)
|
|
4408
4381
|
] }) : /* @__PURE__ */ r("div", { className: "flex items-center gap-2 py-4 text-xs text-muted-foreground/60", children: [
|
|
4409
|
-
/* @__PURE__ */ e(
|
|
4382
|
+
/* @__PURE__ */ e(Be, { className: "size-3.5 animate-spin" }),
|
|
4410
4383
|
a("loading")
|
|
4411
4384
|
] }) })
|
|
4412
4385
|
] });
|
|
4413
4386
|
}
|
|
4414
|
-
function
|
|
4387
|
+
function wr({ runs: t }) {
|
|
4415
4388
|
const { t: a } = F(["admin"]);
|
|
4416
|
-
return /* @__PURE__ */ r(
|
|
4417
|
-
/* @__PURE__ */ r(
|
|
4418
|
-
/* @__PURE__ */ e(
|
|
4419
|
-
/* @__PURE__ */ e(
|
|
4389
|
+
return /* @__PURE__ */ r(Le, { className: "max-w-2xl", children: [
|
|
4390
|
+
/* @__PURE__ */ r(qe, { children: [
|
|
4391
|
+
/* @__PURE__ */ e(je, { children: a("jobs.history") }),
|
|
4392
|
+
/* @__PURE__ */ e(Te, { children: a("jobs.history_help") })
|
|
4420
4393
|
] }),
|
|
4421
|
-
t.length === 0 ? /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground/70 italic py-6 text-center", children: a("jobs.no_runs") }) : /* @__PURE__ */ e("div", { className: "max-h-[60vh] overflow-y-auto rounded-2xl border border-border/40 divide-y divide-border/40", children: t.map((s) => /* @__PURE__ */ e(
|
|
4422
|
-
/* @__PURE__ */ e(
|
|
4394
|
+
t.length === 0 ? /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground/70 italic py-6 text-center", children: a("jobs.no_runs") }) : /* @__PURE__ */ e("div", { className: "max-h-[60vh] overflow-y-auto rounded-2xl border border-border/40 divide-y divide-border/40", children: t.map((s) => /* @__PURE__ */ e(Nr, { summary: s }, s.id)) }),
|
|
4395
|
+
/* @__PURE__ */ e(Je, { children: /* @__PURE__ */ e(Ue, { asChild: !0, children: /* @__PURE__ */ e(ne, { variant: "ghost", children: a("close") }) }) })
|
|
4423
4396
|
] });
|
|
4424
4397
|
}
|
|
4425
|
-
function
|
|
4426
|
-
const { t } = F(["admin"]), { runRawJob: a } =
|
|
4398
|
+
function kr() {
|
|
4399
|
+
const { t } = F(["admin"]), { runRawJob: a } = Ve(), [s, d] = y(!1), [o, n] = y(""), [l, g] = y(""), _ = o.trim() !== "" && l.trim() === Me, S = async () => {
|
|
4427
4400
|
try {
|
|
4428
|
-
await a.mutateAsync({ code: o, confirm_phrase: l }),
|
|
4401
|
+
await a.mutateAsync({ code: o, confirm_phrase: l }), fe.success(t("jobs.run_started", { name: "Raw Python" })), n(""), g("");
|
|
4429
4402
|
} catch (w) {
|
|
4430
|
-
|
|
4403
|
+
fe.error(w instanceof Error ? w.message : t("jobs.run_failed"));
|
|
4431
4404
|
}
|
|
4432
4405
|
};
|
|
4433
4406
|
return /* @__PURE__ */ r("div", { className: "rounded-2xl border border-destructive/30 bg-destructive/5 overflow-hidden", children: [
|
|
@@ -4439,11 +4412,11 @@ function Sr() {
|
|
|
4439
4412
|
className: "w-full flex items-center justify-between gap-2 p-4 text-start",
|
|
4440
4413
|
children: [
|
|
4441
4414
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
4442
|
-
/* @__PURE__ */ e(
|
|
4415
|
+
/* @__PURE__ */ e(Rt, { className: "size-4 text-destructive" }),
|
|
4443
4416
|
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-destructive", children: t("jobs.raw.title") })
|
|
4444
4417
|
] }),
|
|
4445
4418
|
/* @__PURE__ */ e(
|
|
4446
|
-
|
|
4419
|
+
nt,
|
|
4447
4420
|
{
|
|
4448
4421
|
className: `size-4 text-destructive/70 transition-transform ${s ? "" : "-rotate-90"}`
|
|
4449
4422
|
}
|
|
@@ -4454,7 +4427,7 @@ function Sr() {
|
|
|
4454
4427
|
s && /* @__PURE__ */ r("div", { className: "px-4 pb-4 space-y-4", children: [
|
|
4455
4428
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/80", children: t("jobs.raw.warning") }),
|
|
4456
4429
|
/* @__PURE__ */ e(
|
|
4457
|
-
|
|
4430
|
+
Ae,
|
|
4458
4431
|
{
|
|
4459
4432
|
dir: "ltr",
|
|
4460
4433
|
value: o,
|
|
@@ -4467,14 +4440,14 @@ result = {"ok": True}`,
|
|
|
4467
4440
|
}
|
|
4468
4441
|
),
|
|
4469
4442
|
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
4470
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-bold text-destructive", children: t("jobs.raw.confirm_label", { phrase:
|
|
4443
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-bold text-destructive", children: t("jobs.raw.confirm_label", { phrase: Me }) }),
|
|
4471
4444
|
/* @__PURE__ */ e(
|
|
4472
4445
|
se,
|
|
4473
4446
|
{
|
|
4474
4447
|
dir: "ltr",
|
|
4475
4448
|
value: l,
|
|
4476
4449
|
onChange: (w) => g(w.target.value),
|
|
4477
|
-
placeholder:
|
|
4450
|
+
placeholder: Me,
|
|
4478
4451
|
className: "border-destructive/30 text-left"
|
|
4479
4452
|
}
|
|
4480
4453
|
)
|
|
@@ -4486,7 +4459,7 @@ result = {"ok": True}`,
|
|
|
4486
4459
|
onClick: S,
|
|
4487
4460
|
disabled: !_ || a.isPending,
|
|
4488
4461
|
children: [
|
|
4489
|
-
a.isPending ? /* @__PURE__ */ e(
|
|
4462
|
+
a.isPending ? /* @__PURE__ */ e(Be, { className: "size-4 animate-spin" }) : /* @__PURE__ */ e(ze, { className: "size-4" }),
|
|
4490
4463
|
t("jobs.raw.run")
|
|
4491
4464
|
]
|
|
4492
4465
|
}
|
|
@@ -4494,12 +4467,12 @@ result = {"ok": True}`,
|
|
|
4494
4467
|
] })
|
|
4495
4468
|
] });
|
|
4496
4469
|
}
|
|
4497
|
-
function
|
|
4498
|
-
const { t } = F(["admin"]), a =
|
|
4470
|
+
function Cr() {
|
|
4471
|
+
const { t } = F(["admin"]), a = he(() => xr(), []), s = a.includes("jobs"), d = a.includes("dangerous_jobs"), { data: o } = tr(s), { data: n } = rr({ limit: 50 }, s), [l, g] = y(null), [_, S] = y(!1);
|
|
4499
4472
|
if (!s) return null;
|
|
4500
4473
|
const w = o?.jobs || [], x = n?.runs || [];
|
|
4501
4474
|
return /* @__PURE__ */ r("section", { children: [
|
|
4502
|
-
/* @__PURE__ */ e(
|
|
4475
|
+
/* @__PURE__ */ e(ye, { title: t("jobs.section_title"), icon: Dt }),
|
|
4503
4476
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-8", children: [
|
|
4504
4477
|
/* @__PURE__ */ r("div", { className: "space-y-3 text-left", dir: "ltr", children: [
|
|
4505
4478
|
w.length === 0 && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground/70 italic", children: t("jobs.no_jobs") }),
|
|
@@ -4511,12 +4484,12 @@ function Lr() {
|
|
|
4511
4484
|
/* @__PURE__ */ r("div", { className: "min-w-0", children: [
|
|
4512
4485
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
4513
4486
|
/* @__PURE__ */ e("p", { className: "text-sm font-bold truncate", children: i.name }),
|
|
4514
|
-
/* @__PURE__ */ e(
|
|
4487
|
+
/* @__PURE__ */ e(Se, { variant: "outline", className: lt(i.danger), children: t(`jobs.danger.${i.danger}`) })
|
|
4515
4488
|
] }),
|
|
4516
4489
|
i.description && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground/70 mt-0.5 line-clamp-2", children: i.description })
|
|
4517
4490
|
] }),
|
|
4518
4491
|
/* @__PURE__ */ r(ne, { variant: "outline", size: "sm", onClick: () => g(i), children: [
|
|
4519
|
-
/* @__PURE__ */ e(
|
|
4492
|
+
/* @__PURE__ */ e(ze, { className: "size-3.5" }),
|
|
4520
4493
|
t("jobs.run")
|
|
4521
4494
|
] })
|
|
4522
4495
|
]
|
|
@@ -4525,17 +4498,17 @@ function Lr() {
|
|
|
4525
4498
|
))
|
|
4526
4499
|
] }),
|
|
4527
4500
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ r(ne, { variant: "outline", size: "sm", onClick: () => S(!0), children: [
|
|
4528
|
-
/* @__PURE__ */ e(
|
|
4501
|
+
/* @__PURE__ */ e(It, { className: "size-3.5" }),
|
|
4529
4502
|
t("jobs.view_history"),
|
|
4530
|
-
x.length > 0 && /* @__PURE__ */ e(
|
|
4503
|
+
x.length > 0 && /* @__PURE__ */ e(Se, { variant: "secondary", className: "ml-1", children: x.length })
|
|
4531
4504
|
] }) }),
|
|
4532
|
-
d && /* @__PURE__ */ e(
|
|
4505
|
+
d && /* @__PURE__ */ e(kr, {})
|
|
4533
4506
|
] }),
|
|
4534
|
-
/* @__PURE__ */ e(
|
|
4535
|
-
/* @__PURE__ */ e(
|
|
4507
|
+
/* @__PURE__ */ e(Ce, { open: !!l, onOpenChange: (i) => !i && g(null), children: l && /* @__PURE__ */ e(yr, { job: l, onClose: () => g(null) }) }),
|
|
4508
|
+
/* @__PURE__ */ e(Ce, { open: _, onOpenChange: S, children: _ && /* @__PURE__ */ e(wr, { runs: x }) })
|
|
4536
4509
|
] });
|
|
4537
4510
|
}
|
|
4538
|
-
function
|
|
4511
|
+
function Sr({ translations: t, onChange: a }) {
|
|
4539
4512
|
const { t: s } = F(["admin"]), [d, o] = y("fa"), [n, l] = y("translation"), [g, _] = y("{}"), [S, w] = y("");
|
|
4540
4513
|
H(() => {
|
|
4541
4514
|
const h = t?.[d]?.[n] || {};
|
|
@@ -4571,7 +4544,7 @@ function qr({ translations: t, onChange: a }) {
|
|
|
4571
4544
|
return /* @__PURE__ */ r("div", { className: "border border-border/60 rounded-2xl overflow-hidden bg-background", children: [
|
|
4572
4545
|
/* @__PURE__ */ r("div", { className: "p-6 border-b border-border/50 bg-muted/5 flex flex-col sm:flex-row items-center gap-4", children: [
|
|
4573
4546
|
/* @__PURE__ */ r("div", { className: "flex-1 flex items-center gap-4 p-1.5 bg-background border border-border/60 rounded-xl w-full", children: [
|
|
4574
|
-
/* @__PURE__ */ e("div", { className: "p-2 px-3 bg-muted/20 rounded-lg border border-border/40 ml-1", children: /* @__PURE__ */ e(
|
|
4547
|
+
/* @__PURE__ */ e("div", { className: "p-2 px-3 bg-muted/20 rounded-lg border border-border/40 ml-1", children: /* @__PURE__ */ e(Fe, { className: "size-4 text-muted-foreground" }) }),
|
|
4575
4548
|
/* @__PURE__ */ r(X, { value: d, onValueChange: o, children: [
|
|
4576
4549
|
/* @__PURE__ */ e(
|
|
4577
4550
|
Y,
|
|
@@ -4604,7 +4577,7 @@ function qr({ translations: t, onChange: a }) {
|
|
|
4604
4577
|
onClick: i,
|
|
4605
4578
|
title: "Add Language",
|
|
4606
4579
|
className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40",
|
|
4607
|
-
children: /* @__PURE__ */ e(
|
|
4580
|
+
children: /* @__PURE__ */ e(Ot, { className: "size-4" })
|
|
4608
4581
|
}
|
|
4609
4582
|
),
|
|
4610
4583
|
/* @__PURE__ */ e(
|
|
@@ -4614,7 +4587,7 @@ function qr({ translations: t, onChange: a }) {
|
|
|
4614
4587
|
onClick: b,
|
|
4615
4588
|
title: "Add Namespace",
|
|
4616
4589
|
className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40",
|
|
4617
|
-
children: /* @__PURE__ */ e(
|
|
4590
|
+
children: /* @__PURE__ */ e(Fe, { className: "size-4" })
|
|
4618
4591
|
}
|
|
4619
4592
|
)
|
|
4620
4593
|
] })
|
|
@@ -4622,10 +4595,10 @@ function qr({ translations: t, onChange: a }) {
|
|
|
4622
4595
|
/* @__PURE__ */ r("div", { className: "relative p-6", children: [
|
|
4623
4596
|
/* @__PURE__ */ r("div", { className: "absolute top-8 right-10 flex items-center gap-2", children: [
|
|
4624
4597
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted-foreground/40 uppercase tracking-widest", children: "JSON EDITOR" }),
|
|
4625
|
-
/* @__PURE__ */ e(
|
|
4598
|
+
/* @__PURE__ */ e(Et, { className: "size-3 text-muted-foreground/30" })
|
|
4626
4599
|
] }),
|
|
4627
4600
|
/* @__PURE__ */ e(
|
|
4628
|
-
|
|
4601
|
+
Ae,
|
|
4629
4602
|
{
|
|
4630
4603
|
value: g,
|
|
4631
4604
|
onChange: (h) => x(h.target.value),
|
|
@@ -4645,7 +4618,7 @@ function qr({ translations: t, onChange: a }) {
|
|
|
4645
4618
|
] }) })
|
|
4646
4619
|
] });
|
|
4647
4620
|
}
|
|
4648
|
-
function
|
|
4621
|
+
function Lr() {
|
|
4649
4622
|
const { t, i18n: a } = F(["admin", "translation", "settings"]), {
|
|
4650
4623
|
app: s,
|
|
4651
4624
|
welcome: d,
|
|
@@ -4655,7 +4628,7 @@ function jr() {
|
|
|
4655
4628
|
composer: g,
|
|
4656
4629
|
theme: _,
|
|
4657
4630
|
settings: S
|
|
4658
|
-
} =
|
|
4631
|
+
} = be(), [w, x] = y(!1), [i, b] = y(!1), [h, N] = y(""), [D, p] = y(""), [R, c] = y(!1), f = he(
|
|
4659
4632
|
() => ({
|
|
4660
4633
|
app_name: s?.name || "Gentiq",
|
|
4661
4634
|
admin_title: s?.adminTitle || "",
|
|
@@ -4706,9 +4679,9 @@ function jr() {
|
|
|
4706
4679
|
try {
|
|
4707
4680
|
const m = await T.getSettings();
|
|
4708
4681
|
if (m && Object.keys(m).length > 0) {
|
|
4709
|
-
const
|
|
4682
|
+
const q = JSON.parse(JSON.stringify(a.store.data));
|
|
4710
4683
|
m.translations && Object.keys(m.translations).forEach((A) => {
|
|
4711
|
-
|
|
4684
|
+
q[A] || (q[A] = {}), Object.assign(q[A], m.translations[A]);
|
|
4712
4685
|
}), L((A) => ({
|
|
4713
4686
|
...A,
|
|
4714
4687
|
...m,
|
|
@@ -4717,14 +4690,14 @@ function jr() {
|
|
|
4717
4690
|
settings_general_fields: m.settings_general_fields ?? A.settings_general_fields,
|
|
4718
4691
|
settings_profile_fields: m.settings_profile_fields ?? A.settings_profile_fields,
|
|
4719
4692
|
settings_account_fields: m.settings_account_fields ?? A.settings_account_fields,
|
|
4720
|
-
translations:
|
|
4693
|
+
translations: q
|
|
4721
4694
|
}));
|
|
4722
4695
|
} else {
|
|
4723
|
-
const
|
|
4696
|
+
const q = {
|
|
4724
4697
|
...f,
|
|
4725
4698
|
translations: a.store.data
|
|
4726
4699
|
};
|
|
4727
|
-
L(
|
|
4700
|
+
L(q), m || T.updateSettings(q).catch(console.error);
|
|
4728
4701
|
}
|
|
4729
4702
|
} catch (m) {
|
|
4730
4703
|
console.error("Failed to fetch settings", m), N(t("app_settings.save_error"));
|
|
@@ -4752,7 +4725,7 @@ function jr() {
|
|
|
4752
4725
|
}, Z = async () => {
|
|
4753
4726
|
x(!0), N("");
|
|
4754
4727
|
try {
|
|
4755
|
-
await T.resetSettings(),
|
|
4728
|
+
await T.resetSettings(), c(!1), window.location.reload();
|
|
4756
4729
|
} catch (k) {
|
|
4757
4730
|
N(k instanceof Error ? k.message : t("app_settings.save_error"));
|
|
4758
4731
|
} finally {
|
|
@@ -4775,25 +4748,25 @@ function jr() {
|
|
|
4775
4748
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("app_settings.subtitle") })
|
|
4776
4749
|
] }),
|
|
4777
4750
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: [
|
|
4778
|
-
/* @__PURE__ */ r(
|
|
4779
|
-
/* @__PURE__ */ e(
|
|
4751
|
+
/* @__PURE__ */ r(Ce, { open: R, onOpenChange: c, children: [
|
|
4752
|
+
/* @__PURE__ */ e(ht, { asChild: !0, children: /* @__PURE__ */ r(
|
|
4780
4753
|
"button",
|
|
4781
4754
|
{
|
|
4782
4755
|
type: "button",
|
|
4783
4756
|
className: "px-4 py-2 bg-muted/20 text-muted-foreground hover:bg-muted/40 rounded-xl text-xs font-bold transition-all flex items-center gap-2 border border-border/50",
|
|
4784
4757
|
children: [
|
|
4785
|
-
/* @__PURE__ */ e(
|
|
4758
|
+
/* @__PURE__ */ e(at, { className: "size-3.5" }),
|
|
4786
4759
|
t("app_settings.reset_button", { defaultValue: "Reset to Defaults" })
|
|
4787
4760
|
]
|
|
4788
4761
|
}
|
|
4789
4762
|
) }),
|
|
4790
|
-
/* @__PURE__ */ r(
|
|
4791
|
-
/* @__PURE__ */ r(
|
|
4792
|
-
/* @__PURE__ */ e(
|
|
4793
|
-
/* @__PURE__ */ e(
|
|
4763
|
+
/* @__PURE__ */ r(Le, { children: [
|
|
4764
|
+
/* @__PURE__ */ r(qe, { children: [
|
|
4765
|
+
/* @__PURE__ */ e(je, { children: t("app_settings.reset_confirm_title") }),
|
|
4766
|
+
/* @__PURE__ */ e(Te, { children: t("app_settings.reset_confirm_description") })
|
|
4794
4767
|
] }),
|
|
4795
|
-
/* @__PURE__ */ r(
|
|
4796
|
-
/* @__PURE__ */ e(
|
|
4768
|
+
/* @__PURE__ */ r(Je, { children: [
|
|
4769
|
+
/* @__PURE__ */ e(Ue, { asChild: !0, children: /* @__PURE__ */ e(ne, { variant: "ghost", children: t("cancel") }) }),
|
|
4797
4770
|
/* @__PURE__ */ e(ne, { variant: "destructive", onClick: Z, children: t("app_settings.reset_button") })
|
|
4798
4771
|
] })
|
|
4799
4772
|
] })
|
|
@@ -4829,7 +4802,7 @@ function jr() {
|
|
|
4829
4802
|
className: "space-y-16 animate-in fade-in slide-in-from-bottom-2 duration-500",
|
|
4830
4803
|
children: [
|
|
4831
4804
|
/* @__PURE__ */ e(
|
|
4832
|
-
|
|
4805
|
+
fr,
|
|
4833
4806
|
{
|
|
4834
4807
|
settings: C,
|
|
4835
4808
|
setSettings: L,
|
|
@@ -4838,7 +4811,7 @@ function jr() {
|
|
|
4838
4811
|
}
|
|
4839
4812
|
),
|
|
4840
4813
|
/* @__PURE__ */ e(
|
|
4841
|
-
|
|
4814
|
+
br,
|
|
4842
4815
|
{
|
|
4843
4816
|
settings: C,
|
|
4844
4817
|
setSettings: L,
|
|
@@ -4847,7 +4820,7 @@ function jr() {
|
|
|
4847
4820
|
}
|
|
4848
4821
|
),
|
|
4849
4822
|
/* @__PURE__ */ r("section", { children: [
|
|
4850
|
-
/* @__PURE__ */ e(
|
|
4823
|
+
/* @__PURE__ */ e(ye, { title: t("app_settings.sections.user_billing"), icon: Ft }),
|
|
4851
4824
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
4852
4825
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
4853
4826
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
@@ -4887,9 +4860,9 @@ function jr() {
|
|
|
4887
4860
|
] })
|
|
4888
4861
|
] }),
|
|
4889
4862
|
/* @__PURE__ */ r("section", { children: [
|
|
4890
|
-
/* @__PURE__ */ e(
|
|
4863
|
+
/* @__PURE__ */ e(ye, { title: t("app_settings.translations_management"), icon: Pt }),
|
|
4891
4864
|
/* @__PURE__ */ e(
|
|
4892
|
-
|
|
4865
|
+
Sr,
|
|
4893
4866
|
{
|
|
4894
4867
|
translations: C.translations,
|
|
4895
4868
|
onChange: (k) => L((m) => ({ ...m, translations: k }))
|
|
@@ -4899,11 +4872,11 @@ function jr() {
|
|
|
4899
4872
|
]
|
|
4900
4873
|
}
|
|
4901
4874
|
),
|
|
4902
|
-
/* @__PURE__ */ e("div", { className: "mt-16", children: /* @__PURE__ */ e(
|
|
4875
|
+
/* @__PURE__ */ e("div", { className: "mt-16", children: /* @__PURE__ */ e(Cr, {}) })
|
|
4903
4876
|
] }) })
|
|
4904
4877
|
] });
|
|
4905
4878
|
}
|
|
4906
|
-
function
|
|
4879
|
+
function ge() {
|
|
4907
4880
|
const { t, i18n: a } = F(["admin"]), s = a.language === "fa";
|
|
4908
4881
|
return /* @__PURE__ */ r(
|
|
4909
4882
|
"div",
|
|
@@ -4911,7 +4884,7 @@ function fe() {
|
|
|
4911
4884
|
className: "h-full flex flex-col items-center justify-center p-6 text-center gap-4 animate-in fade-in duration-500",
|
|
4912
4885
|
dir: s ? "rtl" : "ltr",
|
|
4913
4886
|
children: [
|
|
4914
|
-
/* @__PURE__ */ e("div", { className: "bg-destructive/10 p-4 rounded-2xl border border-destructive/20 relative", children: /* @__PURE__ */ e(
|
|
4887
|
+
/* @__PURE__ */ e("div", { className: "bg-destructive/10 p-4 rounded-2xl border border-destructive/20 relative", children: /* @__PURE__ */ e(Jt, { className: "size-10 text-destructive/70" }) }),
|
|
4915
4888
|
/* @__PURE__ */ r("div", { className: "space-y-1 max-w-sm", children: [
|
|
4916
4889
|
/* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground tracking-tight", children: t("errors.access_denied_title", "Access Denied") }),
|
|
4917
4890
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground leading-relaxed", children: t("errors.access_denied_message", "You don't have permission to access this page.") })
|
|
@@ -4920,19 +4893,19 @@ function fe() {
|
|
|
4920
4893
|
}
|
|
4921
4894
|
);
|
|
4922
4895
|
}
|
|
4923
|
-
const
|
|
4924
|
-
const { t: a } = F(["theme"]), { theme: s, setTheme: d } =
|
|
4896
|
+
const qr = ({ className: t }) => {
|
|
4897
|
+
const { t: a } = F(["theme"]), { theme: s, setTheme: d } = Pe(), o = () => {
|
|
4925
4898
|
d(s === "system" ? "light" : s === "light" ? "dark" : "system");
|
|
4926
4899
|
}, n = () => {
|
|
4927
4900
|
switch (s) {
|
|
4928
4901
|
case "light":
|
|
4929
|
-
return /* @__PURE__ */ e(
|
|
4902
|
+
return /* @__PURE__ */ e(zt, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
4930
4903
|
case "dark":
|
|
4931
|
-
return /* @__PURE__ */ e(
|
|
4904
|
+
return /* @__PURE__ */ e(Ut, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
4932
4905
|
case "system":
|
|
4933
|
-
return /* @__PURE__ */ e(
|
|
4906
|
+
return /* @__PURE__ */ e(Ze, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
4934
4907
|
default:
|
|
4935
|
-
return /* @__PURE__ */ e(
|
|
4908
|
+
return /* @__PURE__ */ e(Ze, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
4936
4909
|
}
|
|
4937
4910
|
}, l = () => {
|
|
4938
4911
|
switch (s) {
|
|
@@ -4946,16 +4919,16 @@ const Tr = ({ className: t }) => {
|
|
|
4946
4919
|
return a("toggle");
|
|
4947
4920
|
}
|
|
4948
4921
|
};
|
|
4949
|
-
return /* @__PURE__ */ r(
|
|
4950
|
-
/* @__PURE__ */ e(
|
|
4922
|
+
return /* @__PURE__ */ r($e, { children: [
|
|
4923
|
+
/* @__PURE__ */ e(Oe, { asChild: !0, children: /* @__PURE__ */ r(ne, { variant: "ghost", size: "icon", onClick: o, className: t, children: [
|
|
4951
4924
|
n(),
|
|
4952
4925
|
/* @__PURE__ */ e("span", { className: "sr-only", children: a("toggle") })
|
|
4953
4926
|
] }) }),
|
|
4954
|
-
/* @__PURE__ */ e(
|
|
4927
|
+
/* @__PURE__ */ e(Ee, { children: l() })
|
|
4955
4928
|
] });
|
|
4956
4929
|
};
|
|
4957
|
-
function
|
|
4958
|
-
const s =
|
|
4930
|
+
function jr({ extraPages: t = [], disabledPages: a = [] }) {
|
|
4931
|
+
const s = _t(), d = Nt(), { t: o, i18n: n } = F(["admin", "settings", "translation"]), { app: l } = be(), { theme: g } = Pe(), [_, S] = y([]), [w, x] = y(!1), i = tt(!1), [b, h] = y("light");
|
|
4959
4932
|
H(() => {
|
|
4960
4933
|
if (g === "system") {
|
|
4961
4934
|
const v = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -4963,7 +4936,7 @@ function Ar({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
4963
4936
|
} else
|
|
4964
4937
|
h(g);
|
|
4965
4938
|
}, [g]);
|
|
4966
|
-
const N =
|
|
4939
|
+
const N = he(() => l?.logo ? typeof l.logo == "string" ? l.logo : b === "dark" ? l.logo.dark : l.logo.light : rt, [l?.logo, b]), D = l?.adminTitle || l?.name, p = n.language === "fa";
|
|
4967
4940
|
H(() => {
|
|
4968
4941
|
const v = localStorage.getItem("admin_info");
|
|
4969
4942
|
if (v)
|
|
@@ -4994,7 +4967,7 @@ function Ar({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
4994
4967
|
}, [s, d.pathname]);
|
|
4995
4968
|
const R = () => {
|
|
4996
4969
|
T.clearToken(), window.location.reload();
|
|
4997
|
-
},
|
|
4970
|
+
}, c = (v) => _.includes(v), f = (v) => _.includes(v) && !a.includes(v), C = Object.keys(n.services?.resourceStore?.data || {}).filter(
|
|
4998
4971
|
(v) => v !== "dev"
|
|
4999
4972
|
), L = C.length > 0 ? C : ["en", "fa"], $ = (v) => {
|
|
5000
4973
|
localStorage.setItem("gentiq-admin-language", v), n.changeLanguage(v), x(!1), document.activeElement instanceof HTMLElement && document.activeElement.blur();
|
|
@@ -5065,7 +5038,7 @@ function Ar({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
5065
5038
|
] }),
|
|
5066
5039
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 py-4 md:py-0", children: [
|
|
5067
5040
|
/* @__PURE__ */ r(
|
|
5068
|
-
|
|
5041
|
+
pt,
|
|
5069
5042
|
{
|
|
5070
5043
|
onOpenChange: (v) => {
|
|
5071
5044
|
v ? x(!1) : (i.current = !0, setTimeout(() => {
|
|
@@ -5074,14 +5047,14 @@ function Ar({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
5074
5047
|
},
|
|
5075
5048
|
children: [
|
|
5076
5049
|
/* @__PURE__ */ r(
|
|
5077
|
-
|
|
5050
|
+
$e,
|
|
5078
5051
|
{
|
|
5079
5052
|
open: w,
|
|
5080
5053
|
onOpenChange: (v) => {
|
|
5081
5054
|
v && i.current || x(v);
|
|
5082
5055
|
},
|
|
5083
5056
|
children: [
|
|
5084
|
-
/* @__PURE__ */ e(
|
|
5057
|
+
/* @__PURE__ */ e(Oe, { asChild: !0, children: /* @__PURE__ */ e(gt, { asChild: !0, children: /* @__PURE__ */ e(
|
|
5085
5058
|
ne,
|
|
5086
5059
|
{
|
|
5087
5060
|
variant: "ghost",
|
|
@@ -5091,12 +5064,12 @@ function Ar({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
5091
5064
|
children: (n.language?.split("-")[0] || "").toUpperCase()
|
|
5092
5065
|
}
|
|
5093
5066
|
) }) }),
|
|
5094
|
-
/* @__PURE__ */ e(
|
|
5067
|
+
/* @__PURE__ */ e(Ee, { side: "bottom", className: "text-xs", children: o("dashboard.language", "Change Language") })
|
|
5095
5068
|
]
|
|
5096
5069
|
}
|
|
5097
5070
|
),
|
|
5098
|
-
/* @__PURE__ */ e(
|
|
5099
|
-
|
|
5071
|
+
/* @__PURE__ */ e(ft, { align: "center", className: "min-w-[8rem]", children: L.map((v) => /* @__PURE__ */ e(
|
|
5072
|
+
bt,
|
|
5100
5073
|
{
|
|
5101
5074
|
onClick: () => $(v),
|
|
5102
5075
|
className: v === n.language ? "bg-primary/10" : "",
|
|
@@ -5107,79 +5080,79 @@ function Ar({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
5107
5080
|
]
|
|
5108
5081
|
}
|
|
5109
5082
|
),
|
|
5110
|
-
/* @__PURE__ */ e(
|
|
5083
|
+
/* @__PURE__ */ e(qr, { className: "size-9 !bg-transparent hover:bg-muted text-muted-foreground" }),
|
|
5111
5084
|
/* @__PURE__ */ e("div", { className: "w-px h-5 bg-border mx-1" }),
|
|
5112
|
-
/* @__PURE__ */ r(
|
|
5113
|
-
/* @__PURE__ */ e(
|
|
5085
|
+
/* @__PURE__ */ r($e, { children: [
|
|
5086
|
+
/* @__PURE__ */ e(Oe, { asChild: !0, children: /* @__PURE__ */ e(
|
|
5114
5087
|
ne,
|
|
5115
5088
|
{
|
|
5116
5089
|
variant: "ghost",
|
|
5117
5090
|
size: "icon",
|
|
5118
5091
|
className: "hover:bg-destructive/10 hover:scale-105 active:scale-95 text-muted-foreground hover:text-destructive",
|
|
5119
5092
|
onClick: R,
|
|
5120
|
-
children: /* @__PURE__ */ e(
|
|
5093
|
+
children: /* @__PURE__ */ e(Bt, { className: "size-5" })
|
|
5121
5094
|
}
|
|
5122
5095
|
) }),
|
|
5123
|
-
/* @__PURE__ */ e(
|
|
5096
|
+
/* @__PURE__ */ e(Ee, { side: "bottom", className: "text-xs", children: o("dashboard.logout") })
|
|
5124
5097
|
] })
|
|
5125
5098
|
] })
|
|
5126
5099
|
] }) }) }),
|
|
5127
|
-
/* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ r(
|
|
5128
|
-
/* @__PURE__ */ e(
|
|
5100
|
+
/* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ r(wt, { children: [
|
|
5101
|
+
/* @__PURE__ */ e(ue, { path: "/", element: /* @__PURE__ */ e(Ge, { to: "/admin/analytics", replace: !0 }) }),
|
|
5129
5102
|
/* @__PURE__ */ e(
|
|
5130
|
-
|
|
5103
|
+
ue,
|
|
5131
5104
|
{
|
|
5132
5105
|
path: "/analytics",
|
|
5133
|
-
element: f("analytics") ? /* @__PURE__ */ e(
|
|
5106
|
+
element: f("analytics") ? /* @__PURE__ */ e(gr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5134
5107
|
}
|
|
5135
5108
|
),
|
|
5136
5109
|
/* @__PURE__ */ e(
|
|
5137
|
-
|
|
5110
|
+
ue,
|
|
5138
5111
|
{
|
|
5139
5112
|
path: "/chat-history",
|
|
5140
|
-
element: f("chat_history") ? /* @__PURE__ */ e(
|
|
5113
|
+
element: f("chat_history") ? /* @__PURE__ */ e(nr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5141
5114
|
}
|
|
5142
5115
|
),
|
|
5143
5116
|
/* @__PURE__ */ e(
|
|
5144
|
-
|
|
5117
|
+
ue,
|
|
5145
5118
|
{
|
|
5146
5119
|
path: "/admins",
|
|
5147
|
-
element: f("admin_management") ? /* @__PURE__ */ e(
|
|
5120
|
+
element: f("admin_management") ? /* @__PURE__ */ e(sr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5148
5121
|
}
|
|
5149
5122
|
),
|
|
5150
5123
|
/* @__PURE__ */ e(
|
|
5151
|
-
|
|
5124
|
+
ue,
|
|
5152
5125
|
{
|
|
5153
5126
|
path: "/settings",
|
|
5154
|
-
element: f("settings") ? /* @__PURE__ */ e(
|
|
5127
|
+
element: f("settings") ? /* @__PURE__ */ e(Lr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5155
5128
|
}
|
|
5156
5129
|
),
|
|
5157
5130
|
/* @__PURE__ */ e(
|
|
5158
|
-
|
|
5131
|
+
ue,
|
|
5159
5132
|
{
|
|
5160
5133
|
path: "/users",
|
|
5161
|
-
element: f("user_management") ? /* @__PURE__ */ e(
|
|
5134
|
+
element: f("user_management") ? /* @__PURE__ */ e(pr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5162
5135
|
}
|
|
5163
5136
|
),
|
|
5164
5137
|
t.map((v) => /* @__PURE__ */ e(
|
|
5165
|
-
|
|
5138
|
+
ue,
|
|
5166
5139
|
{
|
|
5167
5140
|
path: `/${v.path}`,
|
|
5168
|
-
element: v.permission && !
|
|
5141
|
+
element: v.permission && !c(v.permission) ? /* @__PURE__ */ e(ge, {}) : v.element
|
|
5169
5142
|
},
|
|
5170
5143
|
`route-${v.path}`
|
|
5171
5144
|
)),
|
|
5172
|
-
/* @__PURE__ */ e(
|
|
5145
|
+
/* @__PURE__ */ e(ue, { path: "*", element: /* @__PURE__ */ e(Ge, { to: "/admin/analytics", replace: !0 }) })
|
|
5173
5146
|
] }) }) })
|
|
5174
5147
|
]
|
|
5175
5148
|
}
|
|
5176
5149
|
);
|
|
5177
5150
|
}
|
|
5178
|
-
function
|
|
5179
|
-
const a =
|
|
5180
|
-
const s =
|
|
5181
|
-
return s.use(
|
|
5182
|
-
resources:
|
|
5151
|
+
function zr(t) {
|
|
5152
|
+
const a = he(() => {
|
|
5153
|
+
const s = ct.createInstance();
|
|
5154
|
+
return s.use(xt).use(ut).init({
|
|
5155
|
+
resources: vt,
|
|
5183
5156
|
fallbackLng: "en",
|
|
5184
5157
|
interpolation: { escapeValue: !1 },
|
|
5185
5158
|
detection: {
|
|
@@ -5189,10 +5162,10 @@ function Vr(t) {
|
|
|
5189
5162
|
}
|
|
5190
5163
|
}), s;
|
|
5191
5164
|
}, []);
|
|
5192
|
-
return /* @__PURE__ */ e(
|
|
5165
|
+
return /* @__PURE__ */ e(mt, { i18n: a, children: /* @__PURE__ */ e(Tr, { ...t }) });
|
|
5193
5166
|
}
|
|
5194
|
-
function
|
|
5195
|
-
const { app: s, i18n: d } =
|
|
5167
|
+
function Tr({ extraPages: t, disabledPages: a = [] }) {
|
|
5168
|
+
const { app: s, i18n: d } = be(), { t: o, i18n: n } = F(["admin", "translation"]), [l, g] = y(!1), [_, S] = y(!0), [w, x] = y(!1);
|
|
5196
5169
|
H(() => {
|
|
5197
5170
|
d?.resources && Object.entries(d.resources).forEach(([h, N]) => {
|
|
5198
5171
|
Object.entries(N).forEach(([D, p]) => {
|
|
@@ -5210,22 +5183,22 @@ function Dr({ extraPages: t, disabledPages: a = [] }) {
|
|
|
5210
5183
|
const i = () => {
|
|
5211
5184
|
g(!0);
|
|
5212
5185
|
};
|
|
5213
|
-
return _ || !w ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: o("loading") }) }) : /* @__PURE__ */ e(
|
|
5186
|
+
return _ || !w ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: o("loading") }) }) : /* @__PURE__ */ e(yt, { storageKey: "gentiq-admin-theme", children: l ? /* @__PURE__ */ e(jr, { extraPages: t, disabledPages: a }) : /* @__PURE__ */ e(Wt, { onLoginSuccess: i }) });
|
|
5214
5187
|
}
|
|
5215
5188
|
export {
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5189
|
+
zr as AdminPanel,
|
|
5190
|
+
Zt as useAdminAdmins,
|
|
5191
|
+
Xt as useAdminAdminsMutations,
|
|
5192
|
+
Gt as useAdminAnalytics,
|
|
5193
|
+
Ur as useAdminAuth,
|
|
5194
|
+
Pr as useAdminJobs,
|
|
5195
|
+
Jr as useAdminJobsMutations,
|
|
5196
|
+
er as useAdminThreadItems,
|
|
5197
|
+
Yt as useAdminThreads,
|
|
5198
|
+
Kt as useAdminUsers,
|
|
5199
|
+
Qt as useAdminUsersMutations,
|
|
5200
|
+
Ve as useJobMutations,
|
|
5201
|
+
ar as useJobRun,
|
|
5202
|
+
rr as useJobRuns,
|
|
5203
|
+
tr as useRegisteredJobs
|
|
5231
5204
|
};
|