gentiq 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -0
- package/dist/{checkbox-BuMyz6YI.js → checkbox-Bk6TjhJn.js} +1562 -1569
- package/dist/gentiq-admin.es.js +1016 -1010
- package/dist/gentiq-index.es.js +307 -286
- package/dist/gentiq.css +1 -1
- package/dist/src/admin/lib/recharge.d.ts +10 -0
- package/dist/src/components/MessageList.d.ts +1 -1
- package/dist/src/components/PromptInputArea.d.ts +3 -1
- package/dist/src/components/WelcomeScreen.d.ts +9 -2
- package/dist/src/hooks/useTypewriter.d.ts +20 -0
- package/dist/src/hooks/useWelcomeContent.d.ts +28 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/parts/ChoiceQuestionPart.d.ts +13 -0
- package/dist/src/types.d.ts +9 -11
- package/package.json +1 -1
package/dist/gentiq-admin.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as e, jsxs as r, Fragment as
|
|
2
|
-
import { useState as y, useEffect as H, useMemo as
|
|
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
3
|
import ct from "i18next";
|
|
4
4
|
import { useTranslation as F, initReactI18next as ut, I18nextProvider as mt } from "react-i18next";
|
|
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
|
|
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
12
|
class Ht {
|
|
13
13
|
token = null;
|
|
14
14
|
constructor() {
|
|
@@ -23,18 +23,18 @@ class Ht {
|
|
|
23
23
|
getToken() {
|
|
24
24
|
return this.token;
|
|
25
25
|
}
|
|
26
|
-
async request(a,
|
|
27
|
-
const d = new Headers(
|
|
26
|
+
async request(a, s = {}) {
|
|
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
|
|
30
|
-
...
|
|
29
|
+
const o = await fetch(`${Ye}${a}`, {
|
|
30
|
+
...s,
|
|
31
31
|
headers: d
|
|
32
32
|
});
|
|
33
|
-
if (!
|
|
34
|
-
const n = await
|
|
33
|
+
if (!o.ok) {
|
|
34
|
+
const n = await o.json().catch(() => ({}));
|
|
35
35
|
if (n.error && (typeof n.error.code == "string" || typeof n.error.message == "string"))
|
|
36
|
-
throw new Ke(n,
|
|
37
|
-
let l = `HTTP ${
|
|
36
|
+
throw new Ke(n, o.status);
|
|
37
|
+
let l = `HTTP ${o.status}`, g = "error", _ = null;
|
|
38
38
|
throw typeof n.detail == "string" ? l = n.detail : typeof n.message == "string" ? l = n.message : typeof n.error == "string" ? l = n.error : Array.isArray(n.detail) ? (l = "Validation failed", _ = n.detail, g = "validation_error") : n.error && typeof n.error.message == "string" && (l = n.error.message), new Ke(
|
|
39
39
|
{
|
|
40
40
|
error: {
|
|
@@ -43,41 +43,41 @@ class Ht {
|
|
|
43
43
|
details: _
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
|
-
|
|
46
|
+
o.status
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
return
|
|
49
|
+
return o.json();
|
|
50
50
|
}
|
|
51
|
-
async login(a,
|
|
51
|
+
async login(a, s) {
|
|
52
52
|
const d = await this.request("/admin/login", {
|
|
53
53
|
method: "POST",
|
|
54
|
-
body: JSON.stringify({ username: a, password:
|
|
54
|
+
body: JSON.stringify({ username: a, password: s })
|
|
55
55
|
});
|
|
56
56
|
this.setToken(d.token);
|
|
57
|
-
const
|
|
57
|
+
const o = {
|
|
58
58
|
admin_id: d.admin_id,
|
|
59
59
|
username: d.username,
|
|
60
60
|
name: d.name,
|
|
61
61
|
permissions: d.permissions
|
|
62
62
|
};
|
|
63
|
-
return localStorage.setItem("admin_info", JSON.stringify(
|
|
63
|
+
return localStorage.setItem("admin_info", JSON.stringify(o)), d;
|
|
64
64
|
}
|
|
65
65
|
async checkSetupStatus() {
|
|
66
66
|
return this.request("/admin/setup-status");
|
|
67
67
|
}
|
|
68
|
-
async register(a,
|
|
68
|
+
async register(a, s, d, o) {
|
|
69
69
|
return this.request("/admin/admins", {
|
|
70
70
|
method: "POST",
|
|
71
|
-
body: JSON.stringify({ username: a, password:
|
|
71
|
+
body: JSON.stringify({ username: a, password: s, name: d, permissions: o })
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
async listAdmins() {
|
|
75
75
|
return this.request("/admin/admins");
|
|
76
76
|
}
|
|
77
|
-
async updateAdmin(a,
|
|
77
|
+
async updateAdmin(a, s) {
|
|
78
78
|
return this.request(`/admin/admins/${a}`, {
|
|
79
79
|
method: "PATCH",
|
|
80
|
-
body: JSON.stringify(
|
|
80
|
+
body: JSON.stringify(s)
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
async deleteAdmin(a) {
|
|
@@ -88,13 +88,13 @@ class Ht {
|
|
|
88
88
|
async listPermissions() {
|
|
89
89
|
return this.request("/admin/permissions");
|
|
90
90
|
}
|
|
91
|
-
async listThreads(a = 0,
|
|
91
|
+
async listThreads(a = 0, s = 50, d, o, n = "human") {
|
|
92
92
|
const l = new URLSearchParams({
|
|
93
93
|
skip: a.toString(),
|
|
94
|
-
limit:
|
|
94
|
+
limit: s.toString(),
|
|
95
95
|
source: n
|
|
96
96
|
});
|
|
97
|
-
return d && l.append("query", d),
|
|
97
|
+
return d && l.append("query", d), o && l.append("feedback", o), this.request(`/admin/chat-history/threads?${l}`);
|
|
98
98
|
}
|
|
99
99
|
async getThreadItems(a) {
|
|
100
100
|
return this.request(`/admin/chat-history/threads/${a}/items`);
|
|
@@ -104,28 +104,28 @@ class Ht {
|
|
|
104
104
|
method: "POST"
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
async listUsers(a = 0,
|
|
107
|
+
async listUsers(a = 0, s = 100, d = "", o = "name", n = "asc", l = "human") {
|
|
108
108
|
const g = new URLSearchParams({
|
|
109
109
|
skip: a.toString(),
|
|
110
|
-
limit:
|
|
111
|
-
sort_by:
|
|
110
|
+
limit: s.toString(),
|
|
111
|
+
sort_by: o,
|
|
112
112
|
sort_order: n,
|
|
113
113
|
source: l
|
|
114
114
|
});
|
|
115
115
|
return d && g.append("query", d), this.request(`/admin/users?${g.toString()}`);
|
|
116
116
|
}
|
|
117
|
-
async createUser(a,
|
|
118
|
-
const x =
|
|
119
|
-
tokens:
|
|
117
|
+
async createUser(a, s, d, o, n, l, g, _, S, w = "human") {
|
|
118
|
+
const x = o !== void 0 || n !== void 0 || l !== void 0 || g !== void 0 ? {
|
|
119
|
+
tokens: o || 0,
|
|
120
120
|
requests: n || 0,
|
|
121
|
-
token_limit: l ||
|
|
121
|
+
token_limit: l || o || 0,
|
|
122
122
|
request_limit: g || n || 0
|
|
123
123
|
} : void 0;
|
|
124
124
|
return this.request("/admin/users", {
|
|
125
125
|
method: "POST",
|
|
126
126
|
body: JSON.stringify({
|
|
127
127
|
phone: a || void 0,
|
|
128
|
-
name:
|
|
128
|
+
name: s,
|
|
129
129
|
surname: d || void 0,
|
|
130
130
|
balance: x,
|
|
131
131
|
metadata: _,
|
|
@@ -134,10 +134,10 @@ class Ht {
|
|
|
134
134
|
})
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
|
-
async updateUser(a,
|
|
137
|
+
async updateUser(a, s) {
|
|
138
138
|
return this.request(`/admin/users/${a}`, {
|
|
139
139
|
method: "PATCH",
|
|
140
|
-
body: JSON.stringify(
|
|
140
|
+
body: JSON.stringify(s)
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
async deleteUser(a) {
|
|
@@ -145,10 +145,10 @@ class Ht {
|
|
|
145
145
|
method: "DELETE"
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
async updateUserBalance(a,
|
|
148
|
+
async updateUserBalance(a, s, d, o, n) {
|
|
149
149
|
return this.request(`/admin/users/${a}/balance`, {
|
|
150
150
|
method: "POST",
|
|
151
|
-
body: JSON.stringify({ tokens:
|
|
151
|
+
body: JSON.stringify({ tokens: s, requests: d, token_limit: o, request_limit: n })
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
async bulkUpdateUserBalance(a) {
|
|
@@ -171,12 +171,12 @@ class Ht {
|
|
|
171
171
|
async getUserUsageSummary(a) {
|
|
172
172
|
return this.request(`/admin/users/${a}/usage-summary`);
|
|
173
173
|
}
|
|
174
|
-
async getAnalytics(a = 30,
|
|
175
|
-
return this.request(`/admin/analytics?days=${a}&source=${
|
|
174
|
+
async getAnalytics(a = 30, s = "human") {
|
|
175
|
+
return this.request(`/admin/analytics?days=${a}&source=${s}`);
|
|
176
176
|
}
|
|
177
|
-
async listJobs(a = 20,
|
|
177
|
+
async listJobs(a = 20, s) {
|
|
178
178
|
const d = new URLSearchParams({ limit: a.toString() });
|
|
179
|
-
return
|
|
179
|
+
return s && d.append("type", s), this.request(`/admin/jobs?${d}`);
|
|
180
180
|
}
|
|
181
181
|
async cancelJob(a) {
|
|
182
182
|
return this.request(`/admin/jobs/${a}/cancel`, {
|
|
@@ -187,10 +187,10 @@ class Ht {
|
|
|
187
187
|
async listRegisteredJobs() {
|
|
188
188
|
return this.request("/admin/jobs/registered");
|
|
189
189
|
}
|
|
190
|
-
async runRegisteredJob(a,
|
|
190
|
+
async runRegisteredJob(a, s) {
|
|
191
191
|
return this.request(`/admin/jobs/registered/${a}/run`, {
|
|
192
192
|
method: "POST",
|
|
193
|
-
body: JSON.stringify(
|
|
193
|
+
body: JSON.stringify(s)
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
async runRawJob(a) {
|
|
@@ -200,9 +200,9 @@ class Ht {
|
|
|
200
200
|
});
|
|
201
201
|
}
|
|
202
202
|
async listJobRuns(a = {}) {
|
|
203
|
-
const
|
|
204
|
-
a.limit &&
|
|
205
|
-
const d =
|
|
203
|
+
const s = new URLSearchParams();
|
|
204
|
+
a.limit && s.append("limit", String(a.limit)), a.kind && s.append("kind", a.kind), a.status && s.append("status", a.status);
|
|
205
|
+
const d = s.toString();
|
|
206
206
|
return this.request(`/admin/jobs/runs${d ? `?${d}` : ""}`);
|
|
207
207
|
}
|
|
208
208
|
async getJobRun(a) {
|
|
@@ -228,49 +228,49 @@ class Ht {
|
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
async getAttachmentBlob(a) {
|
|
231
|
-
const
|
|
232
|
-
this.token && (
|
|
233
|
-
const d = await fetch(`${
|
|
231
|
+
const s = {};
|
|
232
|
+
this.token && (s.Authorization = `Bearer ${this.token}`);
|
|
233
|
+
const d = await fetch(`${Ye}/admin/chat-history/attachments/${a}`, {
|
|
234
234
|
method: "GET",
|
|
235
|
-
headers:
|
|
235
|
+
headers: s
|
|
236
236
|
});
|
|
237
237
|
if (!d.ok) {
|
|
238
|
-
const
|
|
239
|
-
throw new Error(
|
|
238
|
+
const o = await d.json().catch(() => ({ error: "Request failed" }));
|
|
239
|
+
throw new Error(o.error || `HTTP ${d.status}`);
|
|
240
240
|
}
|
|
241
241
|
return d.blob();
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
const T = new Ht();
|
|
245
245
|
function Wt({ onLoginSuccess: t }) {
|
|
246
|
-
const { t: a, i18n:
|
|
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
|
-
if (
|
|
248
|
+
if (o === "system") {
|
|
249
249
|
const v = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
250
|
-
|
|
250
|
+
R(v ? "dark" : "light");
|
|
251
251
|
} else
|
|
252
|
-
|
|
253
|
-
}, [
|
|
254
|
-
const
|
|
252
|
+
R(o);
|
|
253
|
+
}, [o]);
|
|
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
|
-
T.checkSetupStatus().then((v) =>
|
|
256
|
+
T.checkSetupStatus().then((v) => D(v.needs_setup)).catch(() => D(!1));
|
|
257
257
|
}, []);
|
|
258
258
|
const L = async (v) => {
|
|
259
|
-
v.preventDefault(),
|
|
259
|
+
v.preventDefault(), i(""), h(!0);
|
|
260
260
|
try {
|
|
261
261
|
await T.login(n, g), t();
|
|
262
262
|
} catch (O) {
|
|
263
|
-
|
|
263
|
+
i(O instanceof Error ? O.message : a("login.error"));
|
|
264
264
|
} finally {
|
|
265
265
|
h(!1);
|
|
266
266
|
}
|
|
267
|
-
},
|
|
268
|
-
if (v.preventDefault(),
|
|
269
|
-
|
|
267
|
+
}, $ = async (v) => {
|
|
268
|
+
if (v.preventDefault(), i(""), g !== S) {
|
|
269
|
+
i(a("login.passwords_mismatch"));
|
|
270
270
|
return;
|
|
271
271
|
}
|
|
272
272
|
if (g.length < 4) {
|
|
273
|
-
|
|
273
|
+
i(a("login.password_too_short"));
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
276
276
|
h(!0);
|
|
@@ -282,7 +282,7 @@ function Wt({ onLoginSuccess: t }) {
|
|
|
282
282
|
"analytics"
|
|
283
283
|
]), await T.login("admin", g), t();
|
|
284
284
|
} catch (O) {
|
|
285
|
-
|
|
285
|
+
i(O instanceof Error ? O.message : a("login.error"));
|
|
286
286
|
} finally {
|
|
287
287
|
h(!1);
|
|
288
288
|
}
|
|
@@ -299,14 +299,14 @@ function Wt({ 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") })
|
|
306
306
|
] }),
|
|
307
307
|
N ? (
|
|
308
308
|
/* ---- SETUP FORM ---- */
|
|
309
|
-
/* @__PURE__ */ r("form", { onSubmit:
|
|
309
|
+
/* @__PURE__ */ r("form", { onSubmit: $, className: "space-y-7", children: [
|
|
310
310
|
/* @__PURE__ */ r("div", { children: [
|
|
311
311
|
/* @__PURE__ */ e("label", { className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: a("login.username") }),
|
|
312
312
|
/* @__PURE__ */ e(
|
|
@@ -451,16 +451,20 @@ function Wt({ 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
|
-
queryKey: [re, "users", t, a,
|
|
457
|
-
queryFn: () => T.listUsers(t, a,
|
|
456
|
+
queryKey: [re, "users", t, a, s, d, o, n],
|
|
457
|
+
queryFn: () => T.listUsers(t, a, s, d, o, n),
|
|
458
|
+
// Infinite scroll grows `limit`, which changes the query key. Keep the previous
|
|
459
|
+
// (smaller) page mounted while the larger one loads so the list never collapses to
|
|
460
|
+
// empty — otherwise the scroll container resets to the top on every "load more".
|
|
461
|
+
placeholderData: Vt
|
|
458
462
|
});
|
|
459
463
|
}
|
|
460
|
-
function
|
|
461
|
-
const t =
|
|
464
|
+
function Qt() {
|
|
465
|
+
const t = _e(), a = () => {
|
|
462
466
|
t.invalidateQueries({ queryKey: [re, "users"] });
|
|
463
|
-
},
|
|
467
|
+
}, s = ae({
|
|
464
468
|
mutationFn: (g) => T.createUser(
|
|
465
469
|
g.phone,
|
|
466
470
|
g.name,
|
|
@@ -480,7 +484,7 @@ function Kt() {
|
|
|
480
484
|
data: _
|
|
481
485
|
}) => T.updateUser(g, _),
|
|
482
486
|
onSuccess: a
|
|
483
|
-
}),
|
|
487
|
+
}), o = ae({
|
|
484
488
|
mutationFn: (g) => T.deleteUser(g),
|
|
485
489
|
onSuccess: a
|
|
486
490
|
}), n = ae({
|
|
@@ -493,7 +497,7 @@ function Kt() {
|
|
|
493
497
|
}), l = ae({
|
|
494
498
|
mutationFn: (g) => T.refreshUserToken(g)
|
|
495
499
|
});
|
|
496
|
-
return { createUser:
|
|
500
|
+
return { createUser: s, updateUser: d, deleteUser: o, updateBalance: n, refreshToken: l };
|
|
497
501
|
}
|
|
498
502
|
function Gt(t = 30, a = "human") {
|
|
499
503
|
return oe({
|
|
@@ -508,9 +512,9 @@ function Zt() {
|
|
|
508
512
|
});
|
|
509
513
|
}
|
|
510
514
|
function Xt() {
|
|
511
|
-
const t =
|
|
515
|
+
const t = _e(), a = () => {
|
|
512
516
|
t.invalidateQueries({ queryKey: [re, "admins"] });
|
|
513
|
-
},
|
|
517
|
+
}, s = ae({
|
|
514
518
|
mutationFn: (n) => T.register(n.username, n.password, n.name, n.permissions),
|
|
515
519
|
onSuccess: a
|
|
516
520
|
}), d = ae({
|
|
@@ -519,16 +523,16 @@ function Xt() {
|
|
|
519
523
|
data: l
|
|
520
524
|
}) => T.updateAdmin(n, l),
|
|
521
525
|
onSuccess: a
|
|
522
|
-
}),
|
|
526
|
+
}), o = ae({
|
|
523
527
|
mutationFn: (n) => T.deleteAdmin(n),
|
|
524
528
|
onSuccess: a
|
|
525
529
|
});
|
|
526
|
-
return { createAdmin:
|
|
530
|
+
return { createAdmin: s, updateAdmin: d, deleteAdmin: o };
|
|
527
531
|
}
|
|
528
|
-
function Yt(t = 0, a = 50,
|
|
532
|
+
function Yt(t = 0, a = 50, s, d, o = "human") {
|
|
529
533
|
return oe({
|
|
530
|
-
queryKey: [re, "threads", t, a,
|
|
531
|
-
queryFn: () => T.listThreads(t, a,
|
|
534
|
+
queryKey: [re, "threads", t, a, s, d, o],
|
|
535
|
+
queryFn: () => T.listThreads(t, a, s, d, o)
|
|
532
536
|
});
|
|
533
537
|
}
|
|
534
538
|
function er(t) {
|
|
@@ -547,7 +551,7 @@ function Pr(t = 20, a) {
|
|
|
547
551
|
});
|
|
548
552
|
}
|
|
549
553
|
function Jr() {
|
|
550
|
-
const t =
|
|
554
|
+
const t = _e();
|
|
551
555
|
return { cancelJob: ae({
|
|
552
556
|
mutationFn: (d) => T.cancelJob(d),
|
|
553
557
|
onSuccess: () => {
|
|
@@ -579,8 +583,8 @@ function ar(t, a = !1) {
|
|
|
579
583
|
refetchInterval: a ? 2e3 : !1
|
|
580
584
|
});
|
|
581
585
|
}
|
|
582
|
-
function
|
|
583
|
-
const t =
|
|
586
|
+
function Ve() {
|
|
587
|
+
const t = _e(), a = () => t.invalidateQueries({ queryKey: [re, "jobRuns"] }), s = ae({
|
|
584
588
|
mutationFn: (n) => T.runRegisteredJob(n.jobId, {
|
|
585
589
|
params: n.params,
|
|
586
590
|
dry_run: n.dry_run,
|
|
@@ -590,11 +594,11 @@ function He() {
|
|
|
590
594
|
}), d = ae({
|
|
591
595
|
mutationFn: (n) => T.runRawJob(n),
|
|
592
596
|
onSuccess: a
|
|
593
|
-
}),
|
|
597
|
+
}), o = ae({
|
|
594
598
|
mutationFn: (n) => T.cancelJobRun(n),
|
|
595
599
|
onSuccess: a
|
|
596
600
|
});
|
|
597
|
-
return { runRegisteredJob:
|
|
601
|
+
return { runRegisteredJob: s, runRawJob: d, cancelJobRun: o };
|
|
598
602
|
}
|
|
599
603
|
function Ur() {
|
|
600
604
|
return {
|
|
@@ -604,87 +608,87 @@ function Ur() {
|
|
|
604
608
|
isAuthenticated: !!T.getToken()
|
|
605
609
|
};
|
|
606
610
|
}
|
|
607
|
-
function
|
|
611
|
+
function st(t, a, s) {
|
|
608
612
|
const d = (t || 0) / 1e6;
|
|
609
613
|
try {
|
|
610
|
-
return new Intl.NumberFormat(
|
|
614
|
+
return new Intl.NumberFormat(s, {
|
|
611
615
|
style: "currency",
|
|
612
616
|
currency: a,
|
|
613
617
|
minimumFractionDigits: d > 0 && d < 0.01 ? 6 : 2,
|
|
614
618
|
maximumFractionDigits: 6
|
|
615
619
|
}).format(d);
|
|
616
620
|
} catch {
|
|
617
|
-
return `${a} ${d.toLocaleString(
|
|
621
|
+
return `${a} ${d.toLocaleString(s, { maximumFractionDigits: 6 })}`;
|
|
618
622
|
}
|
|
619
623
|
}
|
|
620
|
-
function
|
|
624
|
+
function me(t, a, s) {
|
|
621
625
|
const d = (t || 0) / 1e6;
|
|
622
626
|
try {
|
|
623
|
-
return new Intl.NumberFormat(
|
|
627
|
+
return new Intl.NumberFormat(s, {
|
|
624
628
|
style: "currency",
|
|
625
629
|
currency: a,
|
|
626
630
|
minimumFractionDigits: 2,
|
|
627
631
|
maximumFractionDigits: 2
|
|
628
632
|
}).format(d);
|
|
629
633
|
} catch {
|
|
630
|
-
return `${a} ${d.toLocaleString(
|
|
634
|
+
return `${a} ${d.toLocaleString(s, {
|
|
631
635
|
minimumFractionDigits: 2,
|
|
632
636
|
maximumFractionDigits: 2
|
|
633
637
|
})}`;
|
|
634
638
|
}
|
|
635
639
|
}
|
|
636
640
|
function nr() {
|
|
637
|
-
const { t, i18n: a } = F(["admin", "translation"]), { app:
|
|
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";
|
|
638
642
|
H(() => {
|
|
639
|
-
const
|
|
640
|
-
return () => clearTimeout(
|
|
643
|
+
const u = setTimeout(() => S(l), 500);
|
|
644
|
+
return () => clearTimeout(u);
|
|
641
645
|
}, [l]);
|
|
642
646
|
const v = Yt(
|
|
643
647
|
h,
|
|
644
648
|
50,
|
|
645
649
|
_ || void 0,
|
|
646
650
|
w || void 0,
|
|
647
|
-
|
|
648
|
-
), O = er(
|
|
651
|
+
i
|
|
652
|
+
), O = er(o?.id ?? "");
|
|
649
653
|
H(() => {
|
|
650
|
-
N(0), p([]),
|
|
651
|
-
}, [_, w,
|
|
652
|
-
const
|
|
653
|
-
|
|
654
|
+
N(0), p([]), c(!0);
|
|
655
|
+
}, [_, w, i]), H(() => {
|
|
656
|
+
const u = v.data?.threads;
|
|
657
|
+
u && (p((j) => h === 0 ? u : [...j, ...u]), c(u.length === 50));
|
|
654
658
|
}, [v.data, h]);
|
|
655
|
-
const P = O.data?.items ?? [], Z = v.isLoading, k = v.isFetching && h > 0, m = O.isLoading,
|
|
656
|
-
n(
|
|
657
|
-
},
|
|
658
|
-
N((
|
|
659
|
-
},
|
|
660
|
-
|
|
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();
|
|
661
665
|
try {
|
|
662
|
-
const
|
|
663
|
-
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"), {
|
|
664
668
|
description: t("sidebar:share_description")
|
|
665
669
|
});
|
|
666
670
|
} catch {
|
|
667
|
-
|
|
671
|
+
fe.error(t("sidebar:share_failed"));
|
|
668
672
|
}
|
|
669
|
-
}, z = (
|
|
670
|
-
const
|
|
673
|
+
}, z = (u) => {
|
|
674
|
+
const j = new Date(u);
|
|
671
675
|
return new Intl.DateTimeFormat(L ? "fa-IR" : "en-US", {
|
|
672
676
|
year: "numeric",
|
|
673
677
|
month: "long",
|
|
674
678
|
day: "numeric",
|
|
675
679
|
hour: "2-digit",
|
|
676
680
|
minute: "2-digit"
|
|
677
|
-
}).format(
|
|
678
|
-
},
|
|
679
|
-
if (typeof
|
|
681
|
+
}).format(j);
|
|
682
|
+
}, Q = (u) => {
|
|
683
|
+
if (typeof u == "string")
|
|
680
684
|
try {
|
|
681
|
-
return JSON.stringify(JSON.parse(
|
|
685
|
+
return JSON.stringify(JSON.parse(u), null, 2);
|
|
682
686
|
} catch {
|
|
683
|
-
return
|
|
687
|
+
return u;
|
|
684
688
|
}
|
|
685
|
-
return JSON.stringify(
|
|
686
|
-
}, W = ({ part:
|
|
687
|
-
const [
|
|
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");
|
|
688
692
|
return /* @__PURE__ */ r(
|
|
689
693
|
"div",
|
|
690
694
|
{
|
|
@@ -694,14 +698,14 @@ function nr() {
|
|
|
694
698
|
/* @__PURE__ */ r(
|
|
695
699
|
"div",
|
|
696
700
|
{
|
|
697
|
-
onClick: () =>
|
|
701
|
+
onClick: () => V(!I),
|
|
698
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",
|
|
699
703
|
children: [
|
|
700
704
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
701
705
|
/* @__PURE__ */ e(
|
|
702
706
|
"svg",
|
|
703
707
|
{
|
|
704
|
-
className: `w-3 h-3 text-gray-400 transition-transform ${
|
|
708
|
+
className: `w-3 h-3 text-gray-400 transition-transform ${I ? "rotate-180" : ""}`,
|
|
705
709
|
fill: "none",
|
|
706
710
|
viewBox: "0 0 24 24",
|
|
707
711
|
stroke: "currentColor",
|
|
@@ -722,62 +726,45 @@ function nr() {
|
|
|
722
726
|
/* @__PURE__ */ e(
|
|
723
727
|
"span",
|
|
724
728
|
{
|
|
725
|
-
className: `text-[10px] px-2 py-0.5 rounded-full ${
|
|
726
|
-
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")
|
|
727
731
|
}
|
|
728
732
|
)
|
|
729
733
|
]
|
|
730
734
|
}
|
|
731
735
|
),
|
|
732
|
-
|
|
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: [
|
|
733
737
|
/* @__PURE__ */ r("div", { children: [
|
|
734
738
|
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: "Input" }),
|
|
735
|
-
/* @__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) })
|
|
736
740
|
] }),
|
|
737
|
-
(
|
|
738
|
-
/* @__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" }),
|
|
739
743
|
/* @__PURE__ */ e(
|
|
740
744
|
"pre",
|
|
741
745
|
{
|
|
742
|
-
className: `text-xs p-2 rounded-lg overflow-x-auto ${
|
|
743
|
-
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)
|
|
744
748
|
}
|
|
745
749
|
)
|
|
746
750
|
] })
|
|
747
751
|
] })
|
|
748
752
|
]
|
|
749
753
|
},
|
|
750
|
-
|
|
754
|
+
j
|
|
751
755
|
);
|
|
752
|
-
},
|
|
756
|
+
}, B = async (u, j) => {
|
|
753
757
|
try {
|
|
754
|
-
const
|
|
755
|
-
G.href =
|
|
756
|
-
} catch (
|
|
757
|
-
console.error("Download failed:",
|
|
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
|
+
} catch (I) {
|
|
761
|
+
console.error("Download failed:", I), C(I instanceof Error ? I.message : "Download failed");
|
|
758
762
|
}
|
|
759
|
-
},
|
|
760
|
-
if (typeof
|
|
761
|
-
if (
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
Ge,
|
|
765
|
-
{
|
|
766
|
-
part: {
|
|
767
|
-
type: "data-choice-question",
|
|
768
|
-
data: R
|
|
769
|
-
},
|
|
770
|
-
message: {
|
|
771
|
-
id: `admin-choice-${q}`,
|
|
772
|
-
role: "assistant",
|
|
773
|
-
parts: [c]
|
|
774
|
-
},
|
|
775
|
-
disabled: !0
|
|
776
|
-
},
|
|
777
|
-
q
|
|
778
|
-
) : /* @__PURE__ */ e("div", { className: "whitespace-pre-wrap", dir: "auto", children: c.text }, q);
|
|
779
|
-
}
|
|
780
|
-
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")
|
|
781
768
|
return /* @__PURE__ */ r(
|
|
782
769
|
"div",
|
|
783
770
|
{
|
|
@@ -785,35 +772,27 @@ function nr() {
|
|
|
785
772
|
dir: "auto",
|
|
786
773
|
children: [
|
|
787
774
|
/* @__PURE__ */ e("div", { className: "font-bold mb-1 uppercase tracking-tighter opacity-70", children: "Reasoning" }),
|
|
788
|
-
|
|
775
|
+
u.text
|
|
789
776
|
]
|
|
790
777
|
},
|
|
791
|
-
|
|
778
|
+
j
|
|
792
779
|
);
|
|
793
|
-
if (
|
|
794
|
-
const
|
|
780
|
+
if (u.type === "data-reference") {
|
|
781
|
+
const I = u.data || u.reference;
|
|
795
782
|
return /* @__PURE__ */ r(
|
|
796
783
|
"div",
|
|
797
784
|
{
|
|
798
785
|
className: "my-2 p-2.5 bg-primary/5 rounded-lg border border-primary/15 text-xs",
|
|
799
786
|
dir: "auto",
|
|
800
787
|
children: [
|
|
801
|
-
/* @__PURE__ */ e("div", { className: "font-bold mb-1 uppercase tracking-tighter text-primary/80", children:
|
|
802
|
-
/* @__PURE__ */ e("div", { className: "text-muted-foreground line-clamp-3", children:
|
|
788
|
+
/* @__PURE__ */ e("div", { className: "font-bold mb-1 uppercase tracking-tighter text-primary/80", children: I?.label || t("chat.reference", "Reference") }),
|
|
789
|
+
/* @__PURE__ */ e("div", { className: "text-muted-foreground line-clamp-3", children: I?.excerpt || t("chat.source_unavailable", "Source unavailable") })
|
|
803
790
|
]
|
|
804
791
|
},
|
|
805
|
-
|
|
792
|
+
j
|
|
806
793
|
);
|
|
807
794
|
}
|
|
808
|
-
return
|
|
809
|
-
Ge,
|
|
810
|
-
{
|
|
811
|
-
part: c,
|
|
812
|
-
message: { id: `admin-choice-${q}`, role: "assistant", parts: [c] },
|
|
813
|
-
disabled: !0
|
|
814
|
-
},
|
|
815
|
-
q
|
|
816
|
-
) : 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(
|
|
817
796
|
"div",
|
|
818
797
|
{
|
|
819
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",
|
|
@@ -825,17 +804,17 @@ function nr() {
|
|
|
825
804
|
"span",
|
|
826
805
|
{
|
|
827
806
|
className: "text-sm text-foreground font-medium truncate",
|
|
828
|
-
title:
|
|
829
|
-
children:
|
|
807
|
+
title: u.filename || "File",
|
|
808
|
+
children: u.filename || t("chat_history.unnamed_file")
|
|
830
809
|
}
|
|
831
810
|
),
|
|
832
|
-
/* @__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" })
|
|
833
812
|
] })
|
|
834
813
|
] }),
|
|
835
|
-
|
|
814
|
+
u.object_name && /* @__PURE__ */ e(
|
|
836
815
|
"button",
|
|
837
816
|
{
|
|
838
|
-
onClick: () =>
|
|
817
|
+
onClick: () => B(u.object_name, u.filename),
|
|
839
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",
|
|
840
819
|
title: t("chat_history.download_file", "Download File"),
|
|
841
820
|
children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e(
|
|
@@ -851,18 +830,18 @@ function nr() {
|
|
|
851
830
|
)
|
|
852
831
|
]
|
|
853
832
|
},
|
|
854
|
-
|
|
833
|
+
j
|
|
855
834
|
) : /* @__PURE__ */ e(
|
|
856
835
|
"div",
|
|
857
836
|
{
|
|
858
837
|
className: "my-2 p-2 bg-muted/40 rounded-lg border border-border text-xs font-mono opacity-60",
|
|
859
|
-
children: JSON.stringify(
|
|
838
|
+
children: JSON.stringify(u)
|
|
860
839
|
},
|
|
861
|
-
|
|
840
|
+
j
|
|
862
841
|
);
|
|
863
|
-
},
|
|
864
|
-
const { scrollTop:
|
|
865
|
-
|
|
842
|
+
}, xe = (u) => {
|
|
843
|
+
const { scrollTop: j, scrollHeight: I, clientHeight: V } = u.currentTarget;
|
|
844
|
+
I - j <= V + 50 && !k && R && K();
|
|
866
845
|
};
|
|
867
846
|
return /* @__PURE__ */ r("div", { className: "p-5 h-full flex flex-col gap-4 overflow-hidden", dir: L ? "rtl" : "ltr", children: [
|
|
868
847
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -872,8 +851,8 @@ function nr() {
|
|
|
872
851
|
/* @__PURE__ */ r(
|
|
873
852
|
"form",
|
|
874
853
|
{
|
|
875
|
-
onSubmit: (
|
|
876
|
-
|
|
854
|
+
onSubmit: (u) => {
|
|
855
|
+
u.preventDefault(), S(l);
|
|
877
856
|
},
|
|
878
857
|
className: "flex-1 min-w-[16rem] flex gap-2",
|
|
879
858
|
children: [
|
|
@@ -882,7 +861,7 @@ function nr() {
|
|
|
882
861
|
{
|
|
883
862
|
type: "text",
|
|
884
863
|
value: l,
|
|
885
|
-
onChange: (
|
|
864
|
+
onChange: (u) => g(u.target.value),
|
|
886
865
|
placeholder: t("chat_history.search_placeholder"),
|
|
887
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"
|
|
888
867
|
}
|
|
@@ -902,7 +881,7 @@ function nr() {
|
|
|
902
881
|
X,
|
|
903
882
|
{
|
|
904
883
|
value: w || "all",
|
|
905
|
-
onValueChange: (
|
|
884
|
+
onValueChange: (u) => x(u === "all" ? "" : u),
|
|
906
885
|
dir: L ? "rtl" : "ltr",
|
|
907
886
|
children: [
|
|
908
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, {}) }),
|
|
@@ -918,188 +897,186 @@ function nr() {
|
|
|
918
897
|
/* @__PURE__ */ r(
|
|
919
898
|
X,
|
|
920
899
|
{
|
|
921
|
-
value:
|
|
922
|
-
onValueChange: (
|
|
900
|
+
value: i,
|
|
901
|
+
onValueChange: (u) => b(u),
|
|
923
902
|
dir: L ? "rtl" : "ltr",
|
|
924
903
|
children: [
|
|
925
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, {}) }),
|
|
926
|
-
/* @__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)) })
|
|
927
906
|
]
|
|
928
907
|
}
|
|
929
908
|
)
|
|
930
909
|
] })
|
|
931
910
|
] }),
|
|
932
|
-
|
|
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 })
|
|
933
912
|
] }),
|
|
934
913
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-[380px_1fr] gap-4 flex-1 min-h-0", children: [
|
|
935
914
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col min-w-0", children: [
|
|
936
915
|
/* @__PURE__ */ e("div", { className: "px-5 py-2.5 border-b border-border/30", children: /* @__PURE__ */ r("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide", children: [
|
|
937
916
|
t("chat_history.threads_list"),
|
|
938
917
|
" (",
|
|
939
|
-
(
|
|
918
|
+
(D.length || 0).toLocaleString($),
|
|
940
919
|
")"
|
|
941
920
|
] }) }),
|
|
942
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-2 custom-scrollbar", onScroll:
|
|
943
|
-
|
|
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(
|
|
944
923
|
"div",
|
|
945
924
|
{
|
|
946
|
-
onClick: () => A(
|
|
947
|
-
className: `p-2.5 cursor-pointer transition-all rounded-xl border ${
|
|
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"}`,
|
|
948
927
|
children: [
|
|
949
928
|
/* @__PURE__ */ r("div", { className: "flex justify-between items-start mb-1.5 gap-4", children: [
|
|
950
929
|
/* @__PURE__ */ e(
|
|
951
930
|
"h3",
|
|
952
931
|
{
|
|
953
|
-
className: `font-medium text-sm truncate flex-1 ${
|
|
954
|
-
title:
|
|
955
|
-
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")
|
|
956
935
|
}
|
|
957
936
|
),
|
|
958
937
|
/* @__PURE__ */ r("div", { className: "flex gap-1 items-center", children: [
|
|
959
|
-
|
|
938
|
+
u.metadata?.external_user_id && /* @__PURE__ */ e(
|
|
960
939
|
"span",
|
|
961
940
|
{
|
|
962
941
|
className: "text-[10px] px-1.5 py-0.5 rounded-md bg-primary/10 text-primary font-medium truncate max-w-[120px]",
|
|
963
|
-
title: `${t("chat_history.external_user_id")}: ${
|
|
964
|
-
children:
|
|
942
|
+
title: `${t("chat_history.external_user_id")}: ${u.metadata.external_user_id}`,
|
|
943
|
+
children: u.metadata.external_user_id
|
|
965
944
|
}
|
|
966
945
|
),
|
|
967
|
-
|
|
968
|
-
|
|
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: "👎" })
|
|
969
948
|
] })
|
|
970
949
|
] }),
|
|
971
950
|
/* @__PURE__ */ r("div", { className: "text-xs space-y-1.5 text-muted-foreground", children: [
|
|
972
|
-
|
|
951
|
+
u.user_info && /* @__PURE__ */ r(
|
|
973
952
|
"div",
|
|
974
953
|
{
|
|
975
954
|
className: "flex flex-col gap-0.5 min-w-0",
|
|
976
|
-
title: `${[
|
|
977
|
-
(
|
|
978
|
-
).map((
|
|
979
|
-
const
|
|
980
|
-
if (
|
|
981
|
-
const
|
|
982
|
-
(G) => String(G.value) === String(
|
|
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(
|
|
961
|
+
(G) => String(G.value) === String(I)
|
|
983
962
|
);
|
|
984
|
-
return ` • ${
|
|
963
|
+
return ` • ${V ? t(V.label) : I}`;
|
|
985
964
|
}
|
|
986
|
-
return ` • ${
|
|
965
|
+
return ` • ${I}`;
|
|
987
966
|
}).join(
|
|
988
967
|
""
|
|
989
|
-
)}${
|
|
968
|
+
)}${u.user_info.metadata?.values !== void 0 && !d.some((j) => j.key === "values") ? ` • ${u.user_info.metadata.values}` : ""}`,
|
|
990
969
|
children: [
|
|
991
970
|
/* @__PURE__ */ r("div", { className: "font-medium text-foreground truncate flex items-center gap-1.5", children: [
|
|
992
|
-
/* @__PURE__ */ e("span", { children: [
|
|
993
|
-
|
|
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: [
|
|
994
973
|
"•",
|
|
995
974
|
" ",
|
|
996
|
-
|
|
975
|
+
u.user_info.phone
|
|
997
976
|
] })
|
|
998
977
|
] }),
|
|
999
978
|
/* @__PURE__ */ r("div", { className: "text-[10px] text-muted-foreground/70 truncate flex items-center gap-1", children: [
|
|
1000
|
-
d.filter((
|
|
1001
|
-
const
|
|
1002
|
-
return
|
|
1003
|
-
}).map((
|
|
1004
|
-
const
|
|
1005
|
-
let G = String(
|
|
1006
|
-
if (
|
|
1007
|
-
const
|
|
1008
|
-
(
|
|
979
|
+
d.filter((j) => {
|
|
980
|
+
const I = u.user_info?.metadata?.[j.key];
|
|
981
|
+
return I != null && I !== "";
|
|
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)
|
|
1009
988
|
);
|
|
1010
|
-
|
|
1011
|
-
} else
|
|
989
|
+
pe && (G = t(pe.label));
|
|
990
|
+
} else j.type === "checkbox" && (G = V ? "✓" : "✗");
|
|
1012
991
|
return /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
1013
|
-
|
|
992
|
+
I > 0 && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
1014
993
|
G
|
|
1015
|
-
] },
|
|
994
|
+
] }, j.key);
|
|
1016
995
|
}),
|
|
1017
|
-
|
|
996
|
+
u.user_info.metadata?.values !== void 0 && !d.some((j) => j.key === "values") && /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
1018
997
|
d.some(
|
|
1019
|
-
(
|
|
998
|
+
(j) => u.user_info?.metadata?.[j.key] !== void 0
|
|
1020
999
|
) && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
1021
|
-
String(
|
|
1000
|
+
String(u.user_info.metadata.values)
|
|
1022
1001
|
] })
|
|
1023
1002
|
] })
|
|
1024
1003
|
]
|
|
1025
1004
|
}
|
|
1026
1005
|
),
|
|
1027
|
-
|
|
1006
|
+
u.metadata?.usage && /* @__PURE__ */ r("div", { className: "flex gap-2 mt-2 pt-2 border-border/30", children: [
|
|
1028
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", {
|
|
1029
|
-
value: (
|
|
1008
|
+
value: (u.metadata.usage.cumulative_input_tokens ?? u.metadata.usage.input_tokens ?? 0).toLocaleString($)
|
|
1030
1009
|
}) }),
|
|
1031
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", {
|
|
1032
|
-
value: (
|
|
1033
|
-
|
|
1011
|
+
value: (u.metadata.usage.output_tokens || 0).toLocaleString(
|
|
1012
|
+
$
|
|
1034
1013
|
)
|
|
1035
1014
|
}) }),
|
|
1036
1015
|
/* @__PURE__ */ e(
|
|
1037
1016
|
"span",
|
|
1038
1017
|
{
|
|
1039
1018
|
className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground",
|
|
1040
|
-
title:
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
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",
|
|
1022
|
+
$
|
|
1044
1023
|
),
|
|
1045
|
-
children:
|
|
1046
|
-
value:
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
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",
|
|
1028
|
+
$
|
|
1050
1029
|
)
|
|
1051
1030
|
})
|
|
1052
1031
|
}
|
|
1053
1032
|
)
|
|
1054
1033
|
] }),
|
|
1055
|
-
/* @__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) })
|
|
1056
1035
|
] })
|
|
1057
1036
|
]
|
|
1058
1037
|
},
|
|
1059
|
-
|
|
1038
|
+
u.id
|
|
1060
1039
|
)),
|
|
1061
1040
|
k && /* @__PURE__ */ e("div", { className: "p-4 text-center text-muted-foreground text-xs", children: t("loading_more") })
|
|
1062
1041
|
] }) })
|
|
1063
1042
|
] }),
|
|
1064
1043
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col", children: [
|
|
1065
1044
|
/* @__PURE__ */ r("div", { className: "px-5 py-2.5 border-b border-border/30 flex items-center justify-between gap-4", children: [
|
|
1066
|
-
/* @__PURE__ */ e("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide truncate", children:
|
|
1067
|
-
title:
|
|
1045
|
+
/* @__PURE__ */ e("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide truncate", children: o ? t("chat_history.messages_for", {
|
|
1046
|
+
title: o.title || t("chat_history.no_thread_title")
|
|
1068
1047
|
}) : t("chat_history.messages") }),
|
|
1069
|
-
|
|
1048
|
+
o && /* @__PURE__ */ e(
|
|
1070
1049
|
"button",
|
|
1071
1050
|
{
|
|
1072
|
-
onClick: (
|
|
1051
|
+
onClick: (u) => M(u, o),
|
|
1073
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",
|
|
1074
1053
|
title: t("sidebar:share_conversation"),
|
|
1075
|
-
children: /* @__PURE__ */ e(
|
|
1054
|
+
children: /* @__PURE__ */ e(kt, { className: "w-4 h-4" })
|
|
1076
1055
|
}
|
|
1077
1056
|
)
|
|
1078
1057
|
] }),
|
|
1079
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children:
|
|
1080
|
-
const
|
|
1081
|
-
(ie) => ie?.type === "data-choice-question"
|
|
1082
|
-
) ? 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 || [];
|
|
1083
1060
|
return /* @__PURE__ */ r(
|
|
1084
1061
|
"div",
|
|
1085
1062
|
{
|
|
1086
|
-
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"}`,
|
|
1087
1064
|
children: [
|
|
1088
|
-
|
|
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" ? "👍" : "👎" }) }),
|
|
1089
1066
|
/* @__PURE__ */ r("div", { className: "flex justify-between items-center mb-1.5", children: [
|
|
1090
1067
|
/* @__PURE__ */ e(
|
|
1091
1068
|
"span",
|
|
1092
1069
|
{
|
|
1093
|
-
className: `text-[10px] font-bold uppercase tracking-wider ${
|
|
1094
|
-
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}`
|
|
1095
1072
|
}
|
|
1096
1073
|
),
|
|
1097
|
-
/* @__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) })
|
|
1098
1075
|
] }),
|
|
1099
|
-
/* @__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 })
|
|
1100
1077
|
]
|
|
1101
1078
|
},
|
|
1102
|
-
|
|
1079
|
+
u.id
|
|
1103
1080
|
);
|
|
1104
1081
|
}) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col items-center justify-center text-muted-foreground", children: [
|
|
1105
1082
|
/* @__PURE__ */ e(
|
|
@@ -1127,10 +1104,10 @@ function nr() {
|
|
|
1127
1104
|
] });
|
|
1128
1105
|
}
|
|
1129
1106
|
function sr() {
|
|
1130
|
-
const { t, i18n: a } = F(["admin", "translation"]), [
|
|
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({
|
|
1131
1108
|
queryKey: ["gentiq_admin", "permissions"],
|
|
1132
1109
|
queryFn: () => T.listPermissions()
|
|
1133
|
-
}).data?.permissions || [],
|
|
1110
|
+
}).data?.permissions || [], c = s || (x.error ? x.error instanceof Error ? x.error.message : t("error_loading") : ""), [f, C] = y({
|
|
1134
1111
|
username: "",
|
|
1135
1112
|
password: "",
|
|
1136
1113
|
name: "",
|
|
@@ -1152,7 +1129,7 @@ function sr() {
|
|
|
1152
1129
|
} catch (m) {
|
|
1153
1130
|
d(m instanceof Error ? m.message : t("error_loading"));
|
|
1154
1131
|
}
|
|
1155
|
-
},
|
|
1132
|
+
}, $ = async (k) => {
|
|
1156
1133
|
if (k.preventDefault(), !!l) {
|
|
1157
1134
|
d("");
|
|
1158
1135
|
try {
|
|
@@ -1161,9 +1138,9 @@ function sr() {
|
|
|
1161
1138
|
permissions: f.permissions
|
|
1162
1139
|
};
|
|
1163
1140
|
if (f.password && (m.password = f.password), await N.mutateAsync({ adminId: l.id, data: m }), l.id === _) {
|
|
1164
|
-
const
|
|
1165
|
-
if (
|
|
1166
|
-
const A = JSON.parse(
|
|
1141
|
+
const q = localStorage.getItem("admin_info");
|
|
1142
|
+
if (q) {
|
|
1143
|
+
const A = JSON.parse(q);
|
|
1167
1144
|
A.name = f.name, A.permissions = f.permissions, localStorage.setItem("admin_info", JSON.stringify(A)), window.location.reload();
|
|
1168
1145
|
return;
|
|
1169
1146
|
}
|
|
@@ -1177,7 +1154,7 @@ function sr() {
|
|
|
1177
1154
|
if (confirm(t("admins.confirm_delete_admin"))) {
|
|
1178
1155
|
d("");
|
|
1179
1156
|
try {
|
|
1180
|
-
await
|
|
1157
|
+
await D.mutateAsync(k);
|
|
1181
1158
|
} catch (m) {
|
|
1182
1159
|
d(m instanceof Error ? m.message : t("error_loading"));
|
|
1183
1160
|
}
|
|
@@ -1192,12 +1169,12 @@ function sr() {
|
|
|
1192
1169
|
}, P = (k) => {
|
|
1193
1170
|
C((m) => ({
|
|
1194
1171
|
...m,
|
|
1195
|
-
permissions: m.permissions.includes(k) ? m.permissions.filter((
|
|
1172
|
+
permissions: m.permissions.includes(k) ? m.permissions.filter((q) => q !== k) : [...m.permissions, k]
|
|
1196
1173
|
}));
|
|
1197
1174
|
}, Z = (k) => {
|
|
1198
|
-
const m = `admins.perm_${k}`,
|
|
1199
|
-
if (
|
|
1200
|
-
return
|
|
1175
|
+
const m = `admins.perm_${k}`, q = t(m);
|
|
1176
|
+
if (q !== m)
|
|
1177
|
+
return q;
|
|
1201
1178
|
switch (k) {
|
|
1202
1179
|
case "chat_history":
|
|
1203
1180
|
return t("admins.perm_chat_history");
|
|
@@ -1217,7 +1194,7 @@ function sr() {
|
|
|
1217
1194
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
|
|
1218
1195
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("admins.title") }),
|
|
1219
1196
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
1220
|
-
/* @__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("admins.admin_count", { count:
|
|
1197
|
+
/* @__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("admins.admin_count", { count: i.length }) }),
|
|
1221
1198
|
/* @__PURE__ */ e(
|
|
1222
1199
|
"button",
|
|
1223
1200
|
{
|
|
@@ -1230,13 +1207,13 @@ function sr() {
|
|
|
1230
1207
|
)
|
|
1231
1208
|
] })
|
|
1232
1209
|
] }),
|
|
1233
|
-
|
|
1234
|
-
|
|
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 }),
|
|
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: [
|
|
1235
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") }) }),
|
|
1236
1213
|
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r(
|
|
1237
1214
|
"form",
|
|
1238
1215
|
{
|
|
1239
|
-
onSubmit: l ?
|
|
1216
|
+
onSubmit: l ? $ : L,
|
|
1240
1217
|
className: "space-y-5",
|
|
1241
1218
|
children: [
|
|
1242
1219
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -1283,7 +1260,7 @@ function sr() {
|
|
|
1283
1260
|
] }),
|
|
1284
1261
|
/* @__PURE__ */ r("div", { children: [
|
|
1285
1262
|
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("admins.permissions") }),
|
|
1286
|
-
/* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children:
|
|
1263
|
+
/* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children: R.map((k) => /* @__PURE__ */ r("label", { className: "flex items-center gap-3 cursor-pointer group", children: [
|
|
1287
1264
|
/* @__PURE__ */ e("div", { className: "relative flex items-center", children: /* @__PURE__ */ e(
|
|
1288
1265
|
"input",
|
|
1289
1266
|
{
|
|
@@ -1329,7 +1306,7 @@ function sr() {
|
|
|
1329
1306
|
/* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t("admins.permissions") }),
|
|
1330
1307
|
/* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t("users.actions") })
|
|
1331
1308
|
] }) }),
|
|
1332
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children:
|
|
1309
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: i.map((k) => /* @__PURE__ */ r(
|
|
1333
1310
|
"tr",
|
|
1334
1311
|
{
|
|
1335
1312
|
className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50",
|
|
@@ -1405,7 +1382,7 @@ function sr() {
|
|
|
1405
1382
|
k.id
|
|
1406
1383
|
)) })
|
|
1407
1384
|
] }),
|
|
1408
|
-
|
|
1385
|
+
i.length === 0 && !b && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
|
|
1409
1386
|
/* @__PURE__ */ e(
|
|
1410
1387
|
"svg",
|
|
1411
1388
|
{
|
|
@@ -1454,9 +1431,9 @@ function or({ message: t, onDismiss: a }) {
|
|
|
1454
1431
|
function ir({
|
|
1455
1432
|
users: t,
|
|
1456
1433
|
loading: a,
|
|
1457
|
-
totalCount:
|
|
1434
|
+
totalCount: s,
|
|
1458
1435
|
userMetadataFields: d,
|
|
1459
|
-
sortBy:
|
|
1436
|
+
sortBy: o,
|
|
1460
1437
|
sortOrder: n,
|
|
1461
1438
|
onSort: l,
|
|
1462
1439
|
onLoadMore: g,
|
|
@@ -1464,16 +1441,16 @@ function ir({
|
|
|
1464
1441
|
onEdit: S,
|
|
1465
1442
|
onRecharge: w,
|
|
1466
1443
|
onCopyToken: x,
|
|
1467
|
-
onDelete:
|
|
1444
|
+
onDelete: i
|
|
1468
1445
|
}) {
|
|
1469
|
-
const { t: b, i18n: h } = F(["admin", "translation"]), N = h.language === "fa",
|
|
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" });
|
|
1470
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(
|
|
1471
1448
|
"div",
|
|
1472
1449
|
{
|
|
1473
1450
|
className: "overflow-auto flex-1 min-h-0 custom-scrollbar",
|
|
1474
1451
|
onScroll: (p) => {
|
|
1475
|
-
const
|
|
1476
|
-
|
|
1452
|
+
const R = p.currentTarget;
|
|
1453
|
+
R.scrollHeight - R.scrollTop - R.clientHeight < 160 && !a && t.length < s && g();
|
|
1477
1454
|
},
|
|
1478
1455
|
children: [
|
|
1479
1456
|
/* @__PURE__ */ r("table", { className: `w-full ${N ? "text-right" : "text-left"} border-collapse`, children: [
|
|
@@ -1482,7 +1459,7 @@ function ir({
|
|
|
1482
1459
|
"th",
|
|
1483
1460
|
{
|
|
1484
1461
|
className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50",
|
|
1485
|
-
"aria-sort":
|
|
1462
|
+
"aria-sort": o === p ? n === "asc" ? "ascending" : "descending" : "none",
|
|
1486
1463
|
children: /* @__PURE__ */ r(
|
|
1487
1464
|
"button",
|
|
1488
1465
|
{
|
|
@@ -1490,11 +1467,11 @@ function ir({
|
|
|
1490
1467
|
onClick: () => l(p),
|
|
1491
1468
|
className: "inline-flex items-center gap-1.5 hover:text-foreground transition-colors",
|
|
1492
1469
|
title: b(
|
|
1493
|
-
|
|
1470
|
+
o === p && n === "asc" ? "users.sort_descending" : "users.sort_ascending"
|
|
1494
1471
|
),
|
|
1495
1472
|
children: [
|
|
1496
1473
|
/* @__PURE__ */ e("span", { children: b(`users.${p}`) }),
|
|
1497
|
-
|
|
1474
|
+
D(p)
|
|
1498
1475
|
]
|
|
1499
1476
|
}
|
|
1500
1477
|
)
|
|
@@ -1523,14 +1500,14 @@ function ir({
|
|
|
1523
1500
|
p.type === "service" && /* @__PURE__ */ e("span", { className: "text-[10px] px-1.5 py-0.5 rounded-md bg-primary/10 text-primary font-medium uppercase tracking-wide", children: "API" })
|
|
1524
1501
|
] }) }),
|
|
1525
1502
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: p.surname || /* @__PURE__ */ e("span", { className: "text-muted-foreground/50", children: "—" }) }),
|
|
1526
|
-
d.map((
|
|
1527
|
-
const
|
|
1528
|
-
let f = String(
|
|
1529
|
-
if (
|
|
1530
|
-
const C =
|
|
1503
|
+
d.map((R) => {
|
|
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));
|
|
1531
1508
|
C && (f = b(C.label));
|
|
1532
1509
|
}
|
|
1533
|
-
return /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children:
|
|
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);
|
|
1534
1511
|
}),
|
|
1535
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: [
|
|
1536
1513
|
/* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
@@ -1579,7 +1556,7 @@ function ir({
|
|
|
1579
1556
|
onClick: () => _(p),
|
|
1580
1557
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1581
1558
|
title: b("users.usage_summary"),
|
|
1582
|
-
children: /* @__PURE__ */ e(
|
|
1559
|
+
children: /* @__PURE__ */ e(Ct, { className: "w-4 h-4" })
|
|
1583
1560
|
}
|
|
1584
1561
|
),
|
|
1585
1562
|
/* @__PURE__ */ e(
|
|
@@ -1666,7 +1643,7 @@ function ir({
|
|
|
1666
1643
|
/* @__PURE__ */ e(
|
|
1667
1644
|
"button",
|
|
1668
1645
|
{
|
|
1669
|
-
onClick: () =>
|
|
1646
|
+
onClick: () => i(p.id),
|
|
1670
1647
|
className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
|
|
1671
1648
|
title: b("delete"),
|
|
1672
1649
|
children: /* @__PURE__ */ e(
|
|
@@ -1732,22 +1709,47 @@ function ir({
|
|
|
1732
1709
|
}
|
|
1733
1710
|
) });
|
|
1734
1711
|
}
|
|
1735
|
-
function
|
|
1712
|
+
function ot(t, a = /* @__PURE__ */ new Date()) {
|
|
1713
|
+
const s = new Date(a);
|
|
1714
|
+
switch (s.setMilliseconds(0), t) {
|
|
1715
|
+
case "minute":
|
|
1716
|
+
s.setSeconds(0), s.getTime() < a.getTime() && s.setMinutes(s.getMinutes() + 1);
|
|
1717
|
+
break;
|
|
1718
|
+
case "hour":
|
|
1719
|
+
s.setMinutes(0, 0, 0), s.getTime() < a.getTime() && s.setHours(s.getHours() + 1);
|
|
1720
|
+
break;
|
|
1721
|
+
case "day":
|
|
1722
|
+
s.setHours(0, 0, 0, 0), s.getTime() < a.getTime() && s.setDate(s.getDate() + 1);
|
|
1723
|
+
break;
|
|
1724
|
+
case "week": {
|
|
1725
|
+
s.setHours(0, 0, 0, 0);
|
|
1726
|
+
const d = (s.getDay() + 6) % 7;
|
|
1727
|
+
s.setDate(s.getDate() - d), s.getTime() < a.getTime() && s.setDate(s.getDate() + 7);
|
|
1728
|
+
break;
|
|
1729
|
+
}
|
|
1730
|
+
case "month":
|
|
1731
|
+
s.setHours(0, 0, 0, 0), s.setDate(1), s.getTime() < a.getTime() && s.setMonth(s.getMonth() + 1);
|
|
1732
|
+
break;
|
|
1733
|
+
}
|
|
1734
|
+
return s.toISOString();
|
|
1735
|
+
}
|
|
1736
|
+
function le({ className: t, ...a }) {
|
|
1736
1737
|
return /* @__PURE__ */ e(
|
|
1737
|
-
|
|
1738
|
+
Xe.Root,
|
|
1738
1739
|
{
|
|
1739
1740
|
"data-slot": "switch",
|
|
1740
|
-
|
|
1741
|
+
dir: "ltr",
|
|
1742
|
+
className: ke(
|
|
1741
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",
|
|
1742
1744
|
t
|
|
1743
1745
|
),
|
|
1744
1746
|
...a,
|
|
1745
1747
|
children: /* @__PURE__ */ e(
|
|
1746
|
-
|
|
1748
|
+
Xe.Thumb,
|
|
1747
1749
|
{
|
|
1748
1750
|
"data-slot": "switch-thumb",
|
|
1749
|
-
className:
|
|
1750
|
-
"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)]
|
|
1751
|
+
className: ke(
|
|
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"
|
|
1751
1753
|
)
|
|
1752
1754
|
}
|
|
1753
1755
|
)
|
|
@@ -1758,12 +1760,12 @@ const lr = (t) => t.replace(/[^0-9]/g, "");
|
|
|
1758
1760
|
function dr({
|
|
1759
1761
|
editingUser: t,
|
|
1760
1762
|
appSettings: a,
|
|
1761
|
-
userMetadataFields:
|
|
1763
|
+
userMetadataFields: s,
|
|
1762
1764
|
onClose: d,
|
|
1763
|
-
onSaved:
|
|
1765
|
+
onSaved: o,
|
|
1764
1766
|
onError: n
|
|
1765
1767
|
}) {
|
|
1766
|
-
const { t: l, i18n: g } = F(["admin", "translation"]), _ = g.language === "fa", S = _ ? "text-right" : "text-left", [w, x] = y(!1), [
|
|
1768
|
+
const { t: l, i18n: g } = F(["admin", "translation"]), _ = g.language === "fa", S = _ ? "text-right" : "text-left", [w, x] = y(!1), [i, b] = y(
|
|
1767
1769
|
() => t ? {
|
|
1768
1770
|
accountType: t.type ?? "human",
|
|
1769
1771
|
phone: t.phone ?? "",
|
|
@@ -1795,99 +1797,101 @@ function dr({
|
|
|
1795
1797
|
}
|
|
1796
1798
|
), [h, N] = y(() => {
|
|
1797
1799
|
if (!t?.metadata) return {};
|
|
1798
|
-
const
|
|
1799
|
-
return
|
|
1800
|
-
t.metadata?.[f.key] !== void 0 ?
|
|
1801
|
-
}),
|
|
1800
|
+
const c = {};
|
|
1801
|
+
return s.forEach((f) => {
|
|
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;
|
|
1802
1804
|
});
|
|
1803
1805
|
H(() => {
|
|
1804
1806
|
try {
|
|
1805
|
-
const f = { ...
|
|
1806
|
-
C !==
|
|
1807
|
+
const f = { ...i.metadata ? JSON.parse(i.metadata) : {}, ...h }, C = JSON.stringify(f, null, 2);
|
|
1808
|
+
C !== i.metadata && b((L) => ({ ...L, metadata: C }));
|
|
1807
1809
|
} catch {
|
|
1808
1810
|
}
|
|
1809
1811
|
}, [h]), H(() => {
|
|
1810
|
-
const
|
|
1812
|
+
const c = { ...h };
|
|
1811
1813
|
let f = !1;
|
|
1812
|
-
|
|
1813
|
-
C.condition && !
|
|
1814
|
-
}), f && N(
|
|
1815
|
-
}, [h,
|
|
1816
|
-
const
|
|
1817
|
-
if (!
|
|
1814
|
+
s.forEach((C) => {
|
|
1815
|
+
C.condition && !Qe(C.condition, h) && c[C.key] !== void 0 && (delete c[C.key], f = !0);
|
|
1816
|
+
}), f && N(c);
|
|
1817
|
+
}, [h, s]);
|
|
1818
|
+
const D = () => {
|
|
1819
|
+
if (!i.rechargeEnabled)
|
|
1818
1820
|
return { enabled: !1 };
|
|
1819
|
-
const
|
|
1820
|
-
return !Number.isInteger(
|
|
1821
|
+
const c = Number(i.rechargeIntervalValue);
|
|
1822
|
+
return !Number.isInteger(c) || c <= 0 ? (n(l("users.recharge_interval_invalid")), null) : {
|
|
1821
1823
|
enabled: !0,
|
|
1822
|
-
interval_value:
|
|
1823
|
-
interval_unit:
|
|
1824
|
-
|
|
1824
|
+
interval_value: c,
|
|
1825
|
+
interval_unit: i.rechargeIntervalUnit,
|
|
1826
|
+
// When blank, default to the next round boundary of the interval in the admin's
|
|
1827
|
+
// local time (e.g. next local midnight for daily) rather than the request time.
|
|
1828
|
+
anchor_at: i.rechargeAnchorAt ? new Date(i.rechargeAnchorAt).toISOString() : ot(i.rechargeIntervalUnit)
|
|
1825
1829
|
};
|
|
1826
|
-
}, p = async (
|
|
1827
|
-
|
|
1828
|
-
const f =
|
|
1830
|
+
}, p = async (c) => {
|
|
1831
|
+
c.preventDefault();
|
|
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;
|
|
1829
1833
|
if (f > L) {
|
|
1830
1834
|
n(l("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
1831
1835
|
return;
|
|
1832
1836
|
}
|
|
1833
|
-
if (C >
|
|
1837
|
+
if (C > $) {
|
|
1834
1838
|
n(l("users.requests_exceed_limit", "Requests cannot exceed limit"));
|
|
1835
1839
|
return;
|
|
1836
1840
|
}
|
|
1837
1841
|
let v = {};
|
|
1838
|
-
if (
|
|
1842
|
+
if (i.metadata)
|
|
1839
1843
|
try {
|
|
1840
|
-
v = JSON.parse(
|
|
1844
|
+
v = JSON.parse(i.metadata);
|
|
1841
1845
|
} catch {
|
|
1842
1846
|
n(l("users.invalid_json", "Invalid JSON format"));
|
|
1843
1847
|
return;
|
|
1844
1848
|
}
|
|
1845
|
-
const O =
|
|
1849
|
+
const O = D();
|
|
1846
1850
|
if (O) {
|
|
1847
1851
|
x(!0);
|
|
1848
1852
|
try {
|
|
1849
1853
|
await T.createUser(
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1854
|
+
i.phone || null,
|
|
1855
|
+
i.name,
|
|
1856
|
+
i.surname || null,
|
|
1857
|
+
i.tokens ? parseInt(i.tokens) : void 0,
|
|
1858
|
+
i.requests ? parseInt(i.requests) : void 0,
|
|
1859
|
+
i.tokensLimit ? parseInt(i.tokensLimit) : void 0,
|
|
1860
|
+
i.requestsLimit ? parseInt(i.requestsLimit) : void 0,
|
|
1857
1861
|
v,
|
|
1858
1862
|
O,
|
|
1859
|
-
|
|
1860
|
-
),
|
|
1863
|
+
i.accountType
|
|
1864
|
+
), o();
|
|
1861
1865
|
} catch (P) {
|
|
1862
1866
|
n(P instanceof Error ? P.message : l("error_loading"));
|
|
1863
1867
|
} finally {
|
|
1864
1868
|
x(!1);
|
|
1865
1869
|
}
|
|
1866
1870
|
}
|
|
1867
|
-
},
|
|
1868
|
-
if (
|
|
1871
|
+
}, R = async (c) => {
|
|
1872
|
+
if (c.preventDefault(), !t) return;
|
|
1869
1873
|
let f = {};
|
|
1870
|
-
if (
|
|
1874
|
+
if (i.metadata)
|
|
1871
1875
|
try {
|
|
1872
|
-
f = JSON.parse(
|
|
1876
|
+
f = JSON.parse(i.metadata);
|
|
1873
1877
|
} catch {
|
|
1874
1878
|
n(l("users.invalid_json", "Invalid JSON format"));
|
|
1875
1879
|
return;
|
|
1876
1880
|
}
|
|
1877
|
-
const C =
|
|
1881
|
+
const C = D();
|
|
1878
1882
|
if (C) {
|
|
1879
1883
|
x(!0);
|
|
1880
1884
|
try {
|
|
1881
|
-
const
|
|
1882
|
-
phone:
|
|
1883
|
-
name:
|
|
1884
|
-
surname:
|
|
1885
|
+
const $ = (await T.updateUser(t.id, {
|
|
1886
|
+
phone: i.phone || void 0,
|
|
1887
|
+
name: i.name,
|
|
1888
|
+
surname: i.surname || void 0,
|
|
1885
1889
|
metadata: f,
|
|
1886
1890
|
recharge_policy: C
|
|
1887
1891
|
})).user.recharge_policy;
|
|
1888
|
-
if (!(
|
|
1892
|
+
if (!($?.enabled === C.enabled && (!C.enabled || $.interval_value === C.interval_value && $.interval_unit === C.interval_unit)))
|
|
1889
1893
|
throw new Error(l("users.recharge_policy_not_saved"));
|
|
1890
|
-
|
|
1894
|
+
o();
|
|
1891
1895
|
} catch (L) {
|
|
1892
1896
|
n(L instanceof Error ? L.message : l("error_loading"));
|
|
1893
1897
|
} finally {
|
|
@@ -1904,7 +1908,7 @@ function dr({
|
|
|
1904
1908
|
"aria-labelledby": "user-form-modal-title",
|
|
1905
1909
|
children: /* @__PURE__ */ r("div", { className: "bg-card rounded-2xl border border-border w-full max-w-xl shadow-2xl overflow-hidden", children: [
|
|
1906
1910
|
/* @__PURE__ */ e("div", { className: "px-6 py-5 border-b border-border bg-muted/20", children: /* @__PURE__ */ e("h3", { id: "user-form-modal-title", className: "text-lg font-bold text-foreground", children: l(t ? "users.edit_user" : "users.add_user") }) }),
|
|
1907
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: t ?
|
|
1911
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: t ? R : p, children: [
|
|
1908
1912
|
/* @__PURE__ */ r("div", { className: "space-y-6 max-h-[60vh] overflow-y-auto px-1 custom-scrollbar", children: [
|
|
1909
1913
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
1910
1914
|
!t && /* @__PURE__ */ r("div", { children: [
|
|
@@ -1912,8 +1916,8 @@ function dr({
|
|
|
1912
1916
|
/* @__PURE__ */ r(
|
|
1913
1917
|
X,
|
|
1914
1918
|
{
|
|
1915
|
-
value:
|
|
1916
|
-
onValueChange: (
|
|
1919
|
+
value: i.accountType,
|
|
1920
|
+
onValueChange: (c) => b({ ...i, accountType: c }),
|
|
1917
1921
|
dir: _ ? "rtl" : "ltr",
|
|
1918
1922
|
children: [
|
|
1919
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, {}) }),
|
|
@@ -1924,12 +1928,12 @@ function dr({
|
|
|
1924
1928
|
]
|
|
1925
1929
|
}
|
|
1926
1930
|
),
|
|
1927
|
-
|
|
1931
|
+
i.accountType === "service" && /* @__PURE__ */ e("p", { className: "mt-2 text-xs text-muted-foreground", children: l("users.account_type_service_help") })
|
|
1928
1932
|
] }),
|
|
1929
1933
|
/* @__PURE__ */ r("div", { children: [
|
|
1930
1934
|
/* @__PURE__ */ r("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: [
|
|
1931
1935
|
l("users.phone"),
|
|
1932
|
-
|
|
1936
|
+
i.accountType === "service" && /* @__PURE__ */ r("span", { className: "ml-1 normal-case text-muted-foreground/60", children: [
|
|
1933
1937
|
"(",
|
|
1934
1938
|
l("users.optional"),
|
|
1935
1939
|
")"
|
|
@@ -1939,16 +1943,16 @@ function dr({
|
|
|
1939
1943
|
"input",
|
|
1940
1944
|
{
|
|
1941
1945
|
type: "text",
|
|
1942
|
-
value:
|
|
1943
|
-
onChange: (
|
|
1946
|
+
value: i.phone,
|
|
1947
|
+
onChange: (c) => b({ ...i, phone: lr(c.target.value) }),
|
|
1944
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",
|
|
1945
1949
|
placeholder: l("users.phone_placeholder"),
|
|
1946
|
-
required:
|
|
1950
|
+
required: i.accountType === "human",
|
|
1947
1951
|
dir: "ltr"
|
|
1948
1952
|
}
|
|
1949
1953
|
)
|
|
1950
1954
|
] }),
|
|
1951
|
-
|
|
1955
|
+
i.accountType === "service" ? (
|
|
1952
1956
|
// A service account is an integration, not a person: a single service name, no surname.
|
|
1953
1957
|
/* @__PURE__ */ r("div", { children: [
|
|
1954
1958
|
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: l("users.service_name") }),
|
|
@@ -1956,8 +1960,8 @@ function dr({
|
|
|
1956
1960
|
"input",
|
|
1957
1961
|
{
|
|
1958
1962
|
type: "text",
|
|
1959
|
-
value:
|
|
1960
|
-
onChange: (
|
|
1963
|
+
value: i.name,
|
|
1964
|
+
onChange: (c) => b({ ...i, name: c.target.value }),
|
|
1961
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}`,
|
|
1962
1966
|
placeholder: l("users.service_name_placeholder"),
|
|
1963
1967
|
required: !0
|
|
@@ -1971,8 +1975,8 @@ function dr({
|
|
|
1971
1975
|
"input",
|
|
1972
1976
|
{
|
|
1973
1977
|
type: "text",
|
|
1974
|
-
value:
|
|
1975
|
-
onChange: (
|
|
1978
|
+
value: i.name,
|
|
1979
|
+
onChange: (c) => b({ ...i, name: c.target.value }),
|
|
1976
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}`,
|
|
1977
1981
|
required: !0
|
|
1978
1982
|
}
|
|
@@ -1984,8 +1988,8 @@ function dr({
|
|
|
1984
1988
|
"input",
|
|
1985
1989
|
{
|
|
1986
1990
|
type: "text",
|
|
1987
|
-
value:
|
|
1988
|
-
onChange: (
|
|
1991
|
+
value: i.surname ?? "",
|
|
1992
|
+
onChange: (c) => b({ ...i, surname: c.target.value }),
|
|
1989
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}`,
|
|
1990
1994
|
required: !0
|
|
1991
1995
|
}
|
|
@@ -2002,8 +2006,8 @@ function dr({
|
|
|
2002
2006
|
"input",
|
|
2003
2007
|
{
|
|
2004
2008
|
type: "number",
|
|
2005
|
-
value:
|
|
2006
|
-
onChange: (
|
|
2009
|
+
value: i.tokens,
|
|
2010
|
+
onChange: (c) => b({ ...i, tokens: c.target.value }),
|
|
2007
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",
|
|
2008
2012
|
dir: "ltr",
|
|
2009
2013
|
placeholder: "0"
|
|
@@ -2016,11 +2020,11 @@ function dr({
|
|
|
2016
2020
|
"input",
|
|
2017
2021
|
{
|
|
2018
2022
|
type: "number",
|
|
2019
|
-
value:
|
|
2020
|
-
onChange: (
|
|
2023
|
+
value: i.tokensLimit,
|
|
2024
|
+
onChange: (c) => b({ ...i, tokensLimit: c.target.value }),
|
|
2021
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",
|
|
2022
2026
|
dir: "ltr",
|
|
2023
|
-
placeholder:
|
|
2027
|
+
placeholder: i.tokens || String(a?.initial_balance_tokens ?? "250000")
|
|
2024
2028
|
}
|
|
2025
2029
|
)
|
|
2026
2030
|
] })
|
|
@@ -2032,11 +2036,11 @@ function dr({
|
|
|
2032
2036
|
"input",
|
|
2033
2037
|
{
|
|
2034
2038
|
type: "number",
|
|
2035
|
-
value:
|
|
2036
|
-
onChange: (
|
|
2039
|
+
value: i.requests,
|
|
2040
|
+
onChange: (c) => b({ ...i, requests: c.target.value }),
|
|
2037
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",
|
|
2038
2042
|
dir: "ltr",
|
|
2039
|
-
placeholder:
|
|
2043
|
+
placeholder: i.requests || String(a?.initial_balance_requests ?? "0")
|
|
2040
2044
|
}
|
|
2041
2045
|
)
|
|
2042
2046
|
] }),
|
|
@@ -2046,11 +2050,11 @@ function dr({
|
|
|
2046
2050
|
"input",
|
|
2047
2051
|
{
|
|
2048
2052
|
type: "number",
|
|
2049
|
-
value:
|
|
2050
|
-
onChange: (
|
|
2053
|
+
value: i.requestsLimit,
|
|
2054
|
+
onChange: (c) => b({ ...i, requestsLimit: c.target.value }),
|
|
2051
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",
|
|
2052
2056
|
dir: "ltr",
|
|
2053
|
-
placeholder:
|
|
2057
|
+
placeholder: i.requests || String(a?.initial_balance_requests ?? "100")
|
|
2054
2058
|
}
|
|
2055
2059
|
)
|
|
2056
2060
|
] })
|
|
@@ -2064,13 +2068,13 @@ function dr({
|
|
|
2064
2068
|
] }),
|
|
2065
2069
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 shrink-0 pt-0.5", children: [
|
|
2066
2070
|
/* @__PURE__ */ e(
|
|
2067
|
-
|
|
2071
|
+
le,
|
|
2068
2072
|
{
|
|
2069
2073
|
id: "admin-recharge-enabled",
|
|
2070
|
-
checked:
|
|
2071
|
-
onCheckedChange: (
|
|
2072
|
-
...
|
|
2073
|
-
rechargeEnabled:
|
|
2074
|
+
checked: i.rechargeEnabled,
|
|
2075
|
+
onCheckedChange: (c) => b({
|
|
2076
|
+
...i,
|
|
2077
|
+
rechargeEnabled: c
|
|
2074
2078
|
}),
|
|
2075
2079
|
"aria-label": l("users.auto_recharge")
|
|
2076
2080
|
}
|
|
@@ -2085,7 +2089,7 @@ function dr({
|
|
|
2085
2089
|
)
|
|
2086
2090
|
] })
|
|
2087
2091
|
] }),
|
|
2088
|
-
|
|
2092
|
+
i.rechargeEnabled && /* @__PURE__ */ r("div", { className: "space-y-4 rounded-xl border border-border/60 bg-muted/15 p-4", children: [
|
|
2089
2093
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2090
2094
|
/* @__PURE__ */ r("div", { children: [
|
|
2091
2095
|
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: l("users.recharge_interval") }),
|
|
@@ -2095,8 +2099,8 @@ function dr({
|
|
|
2095
2099
|
type: "number",
|
|
2096
2100
|
min: "1",
|
|
2097
2101
|
step: "1",
|
|
2098
|
-
value:
|
|
2099
|
-
onChange: (
|
|
2102
|
+
value: i.rechargeIntervalValue,
|
|
2103
|
+
onChange: (c) => b({ ...i, rechargeIntervalValue: c.target.value }),
|
|
2100
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",
|
|
2101
2105
|
required: !0,
|
|
2102
2106
|
dir: "ltr"
|
|
@@ -2108,15 +2112,15 @@ function dr({
|
|
|
2108
2112
|
/* @__PURE__ */ r(
|
|
2109
2113
|
X,
|
|
2110
2114
|
{
|
|
2111
|
-
value:
|
|
2112
|
-
onValueChange: (
|
|
2113
|
-
...
|
|
2114
|
-
rechargeIntervalUnit:
|
|
2115
|
+
value: i.rechargeIntervalUnit,
|
|
2116
|
+
onValueChange: (c) => b({
|
|
2117
|
+
...i,
|
|
2118
|
+
rechargeIntervalUnit: c
|
|
2115
2119
|
}),
|
|
2116
2120
|
dir: _ ? "rtl" : "ltr",
|
|
2117
2121
|
children: [
|
|
2118
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, {}) }),
|
|
2119
|
-
/* @__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)) })
|
|
2120
2124
|
]
|
|
2121
2125
|
}
|
|
2122
2126
|
)
|
|
@@ -2139,85 +2143,85 @@ function dr({
|
|
|
2139
2143
|
] })
|
|
2140
2144
|
] })
|
|
2141
2145
|
] }),
|
|
2142
|
-
|
|
2146
|
+
s.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
|
|
2143
2147
|
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: l("users.custom_fields") }),
|
|
2144
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children:
|
|
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(
|
|
2145
2149
|
"div",
|
|
2146
2150
|
{
|
|
2147
2151
|
className: "animate-in fade-in slide-in-from-top-1 duration-200",
|
|
2148
2152
|
children: [
|
|
2149
2153
|
/* @__PURE__ */ r("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: [
|
|
2150
|
-
l(
|
|
2154
|
+
l(c.label),
|
|
2151
2155
|
" ",
|
|
2152
|
-
|
|
2156
|
+
c.required && /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
2153
2157
|
] }),
|
|
2154
|
-
|
|
2158
|
+
c.type === "select" ? /* @__PURE__ */ r(
|
|
2155
2159
|
X,
|
|
2156
2160
|
{
|
|
2157
|
-
value: String(h[
|
|
2161
|
+
value: String(h[c.key] || ""),
|
|
2158
2162
|
onValueChange: (f) => N({
|
|
2159
2163
|
...h,
|
|
2160
|
-
[
|
|
2164
|
+
[c.key]: f
|
|
2161
2165
|
}),
|
|
2162
|
-
required:
|
|
2166
|
+
required: c.required,
|
|
2163
2167
|
dir: _ ? "rtl" : "ltr",
|
|
2164
2168
|
children: [
|
|
2165
2169
|
/* @__PURE__ */ e(
|
|
2166
2170
|
Y,
|
|
2167
2171
|
{
|
|
2168
|
-
className:
|
|
2172
|
+
className: ke(
|
|
2169
2173
|
"w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]",
|
|
2170
2174
|
S
|
|
2171
2175
|
),
|
|
2172
2176
|
children: /* @__PURE__ */ e(
|
|
2173
2177
|
ee,
|
|
2174
2178
|
{
|
|
2175
|
-
placeholder: l(
|
|
2179
|
+
placeholder: l(c.placeholder || "select_placeholder")
|
|
2176
2180
|
}
|
|
2177
2181
|
)
|
|
2178
2182
|
}
|
|
2179
2183
|
),
|
|
2180
|
-
/* @__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))) })
|
|
2181
2185
|
]
|
|
2182
2186
|
}
|
|
2183
|
-
) :
|
|
2187
|
+
) : c.type === "checkbox" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-3 h-[46px] px-1", children: [
|
|
2184
2188
|
/* @__PURE__ */ e(
|
|
2185
|
-
|
|
2189
|
+
we,
|
|
2186
2190
|
{
|
|
2187
|
-
id: `admin-md-${
|
|
2188
|
-
checked: !!h[
|
|
2191
|
+
id: `admin-md-${c.key}`,
|
|
2192
|
+
checked: !!h[c.key],
|
|
2189
2193
|
onCheckedChange: (f) => N({
|
|
2190
2194
|
...h,
|
|
2191
|
-
[
|
|
2195
|
+
[c.key]: !!f
|
|
2192
2196
|
}),
|
|
2193
|
-
required:
|
|
2197
|
+
required: c.required
|
|
2194
2198
|
}
|
|
2195
2199
|
),
|
|
2196
2200
|
/* @__PURE__ */ e(
|
|
2197
2201
|
"label",
|
|
2198
2202
|
{
|
|
2199
|
-
htmlFor: `admin-md-${
|
|
2203
|
+
htmlFor: `admin-md-${c.key}`,
|
|
2200
2204
|
className: "text-sm text-foreground/80 cursor-pointer select-none",
|
|
2201
|
-
children: l(
|
|
2205
|
+
children: l(c.placeholder || c.label)
|
|
2202
2206
|
}
|
|
2203
2207
|
)
|
|
2204
2208
|
] }) : /* @__PURE__ */ e(
|
|
2205
2209
|
"input",
|
|
2206
2210
|
{
|
|
2207
|
-
type:
|
|
2208
|
-
value: h[
|
|
2211
|
+
type: c.type,
|
|
2212
|
+
value: h[c.key] || "",
|
|
2209
2213
|
onChange: (f) => N({
|
|
2210
2214
|
...h,
|
|
2211
|
-
[
|
|
2215
|
+
[c.key]: f.target.value
|
|
2212
2216
|
}),
|
|
2213
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}`,
|
|
2214
|
-
placeholder: l(
|
|
2215
|
-
required:
|
|
2218
|
+
placeholder: l(c.placeholder || ""),
|
|
2219
|
+
required: c.required
|
|
2216
2220
|
}
|
|
2217
2221
|
)
|
|
2218
2222
|
]
|
|
2219
2223
|
},
|
|
2220
|
-
|
|
2224
|
+
c.key
|
|
2221
2225
|
) : null) })
|
|
2222
2226
|
] }),
|
|
2223
2227
|
/* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4", children: [
|
|
@@ -2228,8 +2232,8 @@ function dr({
|
|
|
2228
2232
|
/* @__PURE__ */ e(
|
|
2229
2233
|
"textarea",
|
|
2230
2234
|
{
|
|
2231
|
-
value:
|
|
2232
|
-
onChange: (
|
|
2235
|
+
value: i.metadata,
|
|
2236
|
+
onChange: (c) => b({ ...i, metadata: c.target.value }),
|
|
2233
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",
|
|
2234
2238
|
placeholder: '{ "key": "value" }',
|
|
2235
2239
|
dir: "ltr"
|
|
@@ -2262,7 +2266,7 @@ function dr({
|
|
|
2262
2266
|
}
|
|
2263
2267
|
);
|
|
2264
2268
|
}
|
|
2265
|
-
function
|
|
2269
|
+
function it({ onClick: t, label: a = "Close" }) {
|
|
2266
2270
|
return /* @__PURE__ */ e(
|
|
2267
2271
|
"button",
|
|
2268
2272
|
{
|
|
@@ -2285,31 +2289,31 @@ function lt({ onClick: t, label: a = "Close" }) {
|
|
|
2285
2289
|
}
|
|
2286
2290
|
);
|
|
2287
2291
|
}
|
|
2288
|
-
function cr({ user: t, onClose: a, onSaved:
|
|
2289
|
-
const { t:
|
|
2292
|
+
function cr({ user: t, onClose: a, onSaved: s, onError: d }) {
|
|
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 = () => {
|
|
2290
2294
|
_(x || String(t.balance?.token_limit || 0)), w(b || String(t.balance?.request_limit || 0));
|
|
2291
|
-
},
|
|
2295
|
+
}, D = async (p) => {
|
|
2292
2296
|
p.preventDefault();
|
|
2293
|
-
const
|
|
2294
|
-
if (
|
|
2295
|
-
d(
|
|
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;
|
|
2298
|
+
if (R > f) {
|
|
2299
|
+
d(o("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
2296
2300
|
return;
|
|
2297
2301
|
}
|
|
2298
|
-
if (
|
|
2299
|
-
d(
|
|
2302
|
+
if (c > C) {
|
|
2303
|
+
d(o("users.requests_exceed_limit", "Requests cannot exceed limit"));
|
|
2300
2304
|
return;
|
|
2301
2305
|
}
|
|
2302
2306
|
l(!0);
|
|
2303
2307
|
try {
|
|
2304
2308
|
await T.updateUserBalance(
|
|
2305
2309
|
t.id,
|
|
2306
|
-
|
|
2307
|
-
|
|
2310
|
+
R,
|
|
2311
|
+
c,
|
|
2308
2312
|
x ? parseInt(x) : void 0,
|
|
2309
2313
|
b ? parseInt(b) : void 0
|
|
2310
|
-
),
|
|
2314
|
+
), s();
|
|
2311
2315
|
} catch (L) {
|
|
2312
|
-
d(L instanceof Error ? L.message :
|
|
2316
|
+
d(L instanceof Error ? L.message : o("error_loading"));
|
|
2313
2317
|
} finally {
|
|
2314
2318
|
l(!1);
|
|
2315
2319
|
}
|
|
@@ -2324,17 +2328,17 @@ function cr({ user: t, onClose: a, onSaved: i, onError: d }) {
|
|
|
2324
2328
|
children: /* @__PURE__ */ r("div", { className: "bg-card rounded-2xl border border-border w-full max-w-sm shadow-2xl overflow-hidden", children: [
|
|
2325
2329
|
/* @__PURE__ */ r("div", { className: "px-6 py-5 border-b border-border bg-muted/20 flex items-center justify-between", children: [
|
|
2326
2330
|
/* @__PURE__ */ r("h3", { id: "recharge-modal-title", className: "text-lg font-bold text-foreground", children: [
|
|
2327
|
-
|
|
2331
|
+
o("users.update_balance_for"),
|
|
2328
2332
|
" ",
|
|
2329
2333
|
t.name
|
|
2330
2334
|
] }),
|
|
2331
|
-
/* @__PURE__ */ e(
|
|
2335
|
+
/* @__PURE__ */ e(it, { onClick: a })
|
|
2332
2336
|
] }),
|
|
2333
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit:
|
|
2337
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: D, children: [
|
|
2334
2338
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
2335
2339
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2336
2340
|
/* @__PURE__ */ r("div", { children: [
|
|
2337
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
2341
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: o("users.token_count") }),
|
|
2338
2342
|
/* @__PURE__ */ e(
|
|
2339
2343
|
"input",
|
|
2340
2344
|
{
|
|
@@ -2348,13 +2352,13 @@ function cr({ user: t, onClose: a, onSaved: i, onError: d }) {
|
|
|
2348
2352
|
)
|
|
2349
2353
|
] }),
|
|
2350
2354
|
/* @__PURE__ */ r("div", { children: [
|
|
2351
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
2355
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: o("users.token_limit") }),
|
|
2352
2356
|
/* @__PURE__ */ e(
|
|
2353
2357
|
"input",
|
|
2354
2358
|
{
|
|
2355
2359
|
type: "number",
|
|
2356
2360
|
value: x,
|
|
2357
|
-
onChange: (p) =>
|
|
2361
|
+
onChange: (p) => i(p.target.value),
|
|
2358
2362
|
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",
|
|
2359
2363
|
dir: "ltr",
|
|
2360
2364
|
placeholder: g
|
|
@@ -2364,7 +2368,7 @@ function cr({ user: t, onClose: a, onSaved: i, onError: d }) {
|
|
|
2364
2368
|
] }),
|
|
2365
2369
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2366
2370
|
/* @__PURE__ */ r("div", { children: [
|
|
2367
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
2371
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: o("users.request_count") }),
|
|
2368
2372
|
/* @__PURE__ */ e(
|
|
2369
2373
|
"input",
|
|
2370
2374
|
{
|
|
@@ -2378,7 +2382,7 @@ function cr({ user: t, onClose: a, onSaved: i, onError: d }) {
|
|
|
2378
2382
|
)
|
|
2379
2383
|
] }),
|
|
2380
2384
|
/* @__PURE__ */ r("div", { children: [
|
|
2381
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
2385
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: o("users.request_limit") }),
|
|
2382
2386
|
/* @__PURE__ */ e(
|
|
2383
2387
|
"input",
|
|
2384
2388
|
{
|
|
@@ -2400,7 +2404,7 @@ function cr({ user: t, onClose: a, onSaved: i, onError: d }) {
|
|
|
2400
2404
|
type: "button",
|
|
2401
2405
|
onClick: N,
|
|
2402
2406
|
className: "flex-1 px-4 py-3 bg-secondary text-secondary-foreground border border-border rounded-xl text-sm font-medium hover:bg-secondary/80 transition-colors",
|
|
2403
|
-
children:
|
|
2407
|
+
children: o("users.full_charge")
|
|
2404
2408
|
}
|
|
2405
2409
|
),
|
|
2406
2410
|
/* @__PURE__ */ e(
|
|
@@ -2409,7 +2413,7 @@ function cr({ user: t, onClose: a, onSaved: i, onError: d }) {
|
|
|
2409
2413
|
type: "submit",
|
|
2410
2414
|
disabled: n,
|
|
2411
2415
|
className: "flex-1 px-4 py-3 bg-primary text-primary-foreground rounded-xl text-sm font-bold hover:opacity-90 transition-all shadow-md hover:shadow-lg disabled:opacity-50",
|
|
2412
|
-
children:
|
|
2416
|
+
children: o(n ? "users.updating" : "users.update_balance")
|
|
2413
2417
|
}
|
|
2414
2418
|
)
|
|
2415
2419
|
] })
|
|
@@ -2437,73 +2441,75 @@ const ur = {
|
|
|
2437
2441
|
function mr({
|
|
2438
2442
|
searchQuery: t,
|
|
2439
2443
|
userMetadataFields: a,
|
|
2440
|
-
onClose:
|
|
2444
|
+
onClose: s,
|
|
2441
2445
|
onApplied: d,
|
|
2442
|
-
onError:
|
|
2446
|
+
onError: o
|
|
2443
2447
|
}) {
|
|
2444
|
-
const { t: n, i18n: l } = F(["admin", "translation"]), g = l.language === "fa", [_, S] = y(!1), [w, x] = y(null), [
|
|
2445
|
-
let
|
|
2446
|
-
if (
|
|
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 = {};
|
|
2450
|
+
if (i.metadata.trim())
|
|
2447
2451
|
try {
|
|
2448
|
-
|
|
2452
|
+
c = JSON.parse(i.metadata);
|
|
2449
2453
|
} catch {
|
|
2450
|
-
return
|
|
2454
|
+
return o(n("users.invalid_json", "Invalid JSON format")), null;
|
|
2451
2455
|
}
|
|
2452
2456
|
const f = {};
|
|
2453
|
-
Object.entries(
|
|
2454
|
-
Array.isArray(
|
|
2457
|
+
Object.entries(c).forEach(([L, $]) => {
|
|
2458
|
+
Array.isArray($) ? f[L] = $ : $ !== "" && $ !== void 0 && $ !== null && (f[L] = [$]);
|
|
2455
2459
|
});
|
|
2456
|
-
const C =
|
|
2460
|
+
const C = i.userIds.split(/[\s,]+/).map((L) => L.trim()).filter(Boolean);
|
|
2457
2461
|
return {
|
|
2458
|
-
query:
|
|
2462
|
+
query: i.useCurrentSearch && t || void 0,
|
|
2459
2463
|
user_ids: C.length > 0 ? C : void 0,
|
|
2460
2464
|
metadata_in: Object.keys(f).length > 0 ? f : void 0
|
|
2461
2465
|
};
|
|
2462
|
-
}, N = (
|
|
2466
|
+
}, N = (c) => {
|
|
2463
2467
|
const f = h();
|
|
2464
2468
|
return f ? {
|
|
2465
|
-
operation:
|
|
2466
|
-
tokens:
|
|
2467
|
-
requests:
|
|
2468
|
-
token_limit:
|
|
2469
|
-
request_limit:
|
|
2469
|
+
operation: i.operation,
|
|
2470
|
+
tokens: i.tokens === "" ? void 0 : Number(i.tokens),
|
|
2471
|
+
requests: i.requests === "" ? void 0 : Number(i.requests),
|
|
2472
|
+
token_limit: i.tokenLimit === "" ? void 0 : Number(i.tokenLimit),
|
|
2473
|
+
request_limit: i.requestLimit === "" ? void 0 : Number(i.requestLimit),
|
|
2470
2474
|
filters: f,
|
|
2471
|
-
dry_run:
|
|
2475
|
+
dry_run: c
|
|
2472
2476
|
} : null;
|
|
2473
|
-
},
|
|
2477
|
+
}, D = (c) => {
|
|
2474
2478
|
const f = h();
|
|
2475
2479
|
if (!f) return null;
|
|
2476
|
-
if (!
|
|
2480
|
+
if (!i.renewalEnabled)
|
|
2477
2481
|
return {
|
|
2478
2482
|
recharge_policy: { enabled: !1 },
|
|
2479
2483
|
filters: f,
|
|
2480
|
-
dry_run:
|
|
2484
|
+
dry_run: c
|
|
2481
2485
|
};
|
|
2482
|
-
const C = Number(
|
|
2483
|
-
return !Number.isInteger(C) || C <= 0 ? (
|
|
2486
|
+
const C = Number(i.renewalIntervalValue);
|
|
2487
|
+
return !Number.isInteger(C) || C <= 0 ? (o(n("users.recharge_interval_invalid")), null) : {
|
|
2484
2488
|
recharge_policy: {
|
|
2485
2489
|
enabled: !0,
|
|
2486
2490
|
interval_value: C,
|
|
2487
|
-
interval_unit:
|
|
2488
|
-
|
|
2491
|
+
interval_unit: i.renewalIntervalUnit,
|
|
2492
|
+
// When blank, default to the next round boundary of the interval in the admin's
|
|
2493
|
+
// local time (e.g. next local midnight for daily) rather than the request time.
|
|
2494
|
+
anchor_at: i.renewalAnchorAt ? new Date(i.renewalAnchorAt).toISOString() : ot(i.renewalIntervalUnit)
|
|
2489
2495
|
},
|
|
2490
2496
|
filters: f,
|
|
2491
|
-
dry_run:
|
|
2497
|
+
dry_run: c
|
|
2492
2498
|
};
|
|
2493
2499
|
}, p = async () => {
|
|
2494
|
-
if (
|
|
2495
|
-
const C =
|
|
2500
|
+
if (i.applyRenewal && !i.applyBalance) {
|
|
2501
|
+
const C = D(!0);
|
|
2496
2502
|
return C ? (await T.bulkUpdateUserRenewal(C)).matched : null;
|
|
2497
2503
|
}
|
|
2498
|
-
const
|
|
2499
|
-
return
|
|
2500
|
-
},
|
|
2501
|
-
if (
|
|
2502
|
-
|
|
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) {
|
|
2508
|
+
o(n("users.bulk_select_change"));
|
|
2503
2509
|
return;
|
|
2504
2510
|
}
|
|
2505
|
-
const f =
|
|
2506
|
-
if (!(
|
|
2511
|
+
const f = i.applyBalance ? N(!1) : null, C = i.applyRenewal ? D(!1) : null;
|
|
2512
|
+
if (!(i.applyBalance && !f) && !(i.applyRenewal && !C)) {
|
|
2507
2513
|
S(!0);
|
|
2508
2514
|
try {
|
|
2509
2515
|
const L = await p();
|
|
@@ -2511,7 +2517,7 @@ function mr({
|
|
|
2511
2517
|
const v = f ? await T.bulkUpdateUserBalance(f) : null, O = C ? await T.bulkUpdateUserRenewal(C) : null;
|
|
2512
2518
|
x((O || v)?.matched ?? null), d();
|
|
2513
2519
|
} catch (L) {
|
|
2514
|
-
|
|
2520
|
+
o(L instanceof Error ? L.message : n("error_loading"));
|
|
2515
2521
|
} finally {
|
|
2516
2522
|
S(!1);
|
|
2517
2523
|
}
|
|
@@ -2530,18 +2536,18 @@ function mr({
|
|
|
2530
2536
|
/* @__PURE__ */ e("h3", { id: "bulk-balance-modal-title", className: "text-lg font-bold text-foreground", children: n("users.bulk_balance") }),
|
|
2531
2537
|
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground mt-1", children: n("users.bulk_balance_help") })
|
|
2532
2538
|
] }),
|
|
2533
|
-
/* @__PURE__ */ e(
|
|
2539
|
+
/* @__PURE__ */ e(it, { onClick: s })
|
|
2534
2540
|
] }),
|
|
2535
|
-
/* @__PURE__ */ r("form", { onSubmit:
|
|
2541
|
+
/* @__PURE__ */ r("form", { onSubmit: R, className: "flex min-h-0 flex-1 flex-col", children: [
|
|
2536
2542
|
/* @__PURE__ */ r("div", { className: "min-h-0 flex-1 overflow-y-auto px-5 py-4 space-y-4 custom-scrollbar", children: [
|
|
2537
2543
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: [
|
|
2538
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: [
|
|
2539
2545
|
/* @__PURE__ */ e(
|
|
2540
|
-
|
|
2546
|
+
we,
|
|
2541
2547
|
{
|
|
2542
|
-
checked:
|
|
2543
|
-
onCheckedChange: (
|
|
2544
|
-
b({ ...
|
|
2548
|
+
checked: i.applyBalance,
|
|
2549
|
+
onCheckedChange: (c) => {
|
|
2550
|
+
b({ ...i, applyBalance: !!c }), x(null);
|
|
2545
2551
|
}
|
|
2546
2552
|
}
|
|
2547
2553
|
),
|
|
@@ -2549,11 +2555,11 @@ function mr({
|
|
|
2549
2555
|
] }),
|
|
2550
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: [
|
|
2551
2557
|
/* @__PURE__ */ e(
|
|
2552
|
-
|
|
2558
|
+
we,
|
|
2553
2559
|
{
|
|
2554
|
-
checked:
|
|
2555
|
-
onCheckedChange: (
|
|
2556
|
-
b({ ...
|
|
2560
|
+
checked: i.applyRenewal,
|
|
2561
|
+
onCheckedChange: (c) => {
|
|
2562
|
+
b({ ...i, applyRenewal: !!c }), x(null);
|
|
2557
2563
|
}
|
|
2558
2564
|
}
|
|
2559
2565
|
),
|
|
@@ -2566,11 +2572,11 @@ function mr({
|
|
|
2566
2572
|
/* @__PURE__ */ r(
|
|
2567
2573
|
X,
|
|
2568
2574
|
{
|
|
2569
|
-
value:
|
|
2570
|
-
onValueChange: (
|
|
2575
|
+
value: i.operation,
|
|
2576
|
+
onValueChange: (c) => {
|
|
2571
2577
|
b({
|
|
2572
|
-
...
|
|
2573
|
-
operation:
|
|
2578
|
+
...i,
|
|
2579
|
+
operation: c
|
|
2574
2580
|
}), x(null);
|
|
2575
2581
|
},
|
|
2576
2582
|
dir: g ? "rtl" : "ltr",
|
|
@@ -2587,32 +2593,32 @@ function mr({
|
|
|
2587
2593
|
] }),
|
|
2588
2594
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3 md:pt-6", children: [
|
|
2589
2595
|
/* @__PURE__ */ e(
|
|
2590
|
-
|
|
2596
|
+
we,
|
|
2591
2597
|
{
|
|
2592
2598
|
id: "bulk-use-search",
|
|
2593
|
-
checked:
|
|
2594
|
-
onCheckedChange: (
|
|
2595
|
-
b({ ...
|
|
2599
|
+
checked: i.useCurrentSearch,
|
|
2600
|
+
onCheckedChange: (c) => {
|
|
2601
|
+
b({ ...i, useCurrentSearch: !!c }), x(null);
|
|
2596
2602
|
}
|
|
2597
2603
|
}
|
|
2598
2604
|
),
|
|
2599
2605
|
/* @__PURE__ */ e("label", { htmlFor: "bulk-use-search", className: "text-sm text-foreground cursor-pointer", children: n("users.bulk_use_current_search") })
|
|
2600
2606
|
] })
|
|
2601
2607
|
] }),
|
|
2602
|
-
|
|
2608
|
+
i.applyBalance && /* @__PURE__ */ r("div", { className: "grid grid-cols-2 lg:grid-cols-4 gap-3", children: [
|
|
2603
2609
|
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
2604
2610
|
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider", children: n("users.token_count") }),
|
|
2605
2611
|
/* @__PURE__ */ e(
|
|
2606
2612
|
"input",
|
|
2607
2613
|
{
|
|
2608
2614
|
type: "number",
|
|
2609
|
-
value:
|
|
2610
|
-
onChange: (
|
|
2611
|
-
b({ ...
|
|
2615
|
+
value: i.tokens,
|
|
2616
|
+
onChange: (c) => {
|
|
2617
|
+
b({ ...i, tokens: c.target.value }), x(null);
|
|
2612
2618
|
},
|
|
2613
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",
|
|
2614
|
-
disabled:
|
|
2615
|
-
required:
|
|
2620
|
+
disabled: i.operation === "full_charge",
|
|
2621
|
+
required: i.operation === "set",
|
|
2616
2622
|
dir: "ltr"
|
|
2617
2623
|
}
|
|
2618
2624
|
)
|
|
@@ -2623,13 +2629,13 @@ function mr({
|
|
|
2623
2629
|
"input",
|
|
2624
2630
|
{
|
|
2625
2631
|
type: "number",
|
|
2626
|
-
value:
|
|
2627
|
-
onChange: (
|
|
2628
|
-
b({ ...
|
|
2632
|
+
value: i.requests,
|
|
2633
|
+
onChange: (c) => {
|
|
2634
|
+
b({ ...i, requests: c.target.value }), x(null);
|
|
2629
2635
|
},
|
|
2630
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",
|
|
2631
|
-
disabled:
|
|
2632
|
-
required:
|
|
2637
|
+
disabled: i.operation === "full_charge",
|
|
2638
|
+
required: i.operation === "set",
|
|
2633
2639
|
dir: "ltr"
|
|
2634
2640
|
}
|
|
2635
2641
|
)
|
|
@@ -2640,9 +2646,9 @@ function mr({
|
|
|
2640
2646
|
"input",
|
|
2641
2647
|
{
|
|
2642
2648
|
type: "number",
|
|
2643
|
-
value:
|
|
2644
|
-
onChange: (
|
|
2645
|
-
b({ ...
|
|
2649
|
+
value: i.tokenLimit,
|
|
2650
|
+
onChange: (c) => {
|
|
2651
|
+
b({ ...i, tokenLimit: c.target.value }), x(null);
|
|
2646
2652
|
},
|
|
2647
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",
|
|
2648
2654
|
dir: "ltr"
|
|
@@ -2655,9 +2661,9 @@ function mr({
|
|
|
2655
2661
|
"input",
|
|
2656
2662
|
{
|
|
2657
2663
|
type: "number",
|
|
2658
|
-
value:
|
|
2659
|
-
onChange: (
|
|
2660
|
-
b({ ...
|
|
2664
|
+
value: i.requestLimit,
|
|
2665
|
+
onChange: (c) => {
|
|
2666
|
+
b({ ...i, requestLimit: c.target.value }), x(null);
|
|
2661
2667
|
},
|
|
2662
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",
|
|
2663
2669
|
dir: "ltr"
|
|
@@ -2665,7 +2671,7 @@ function mr({
|
|
|
2665
2671
|
)
|
|
2666
2672
|
] })
|
|
2667
2673
|
] }),
|
|
2668
|
-
|
|
2674
|
+
i.applyRenewal && /* @__PURE__ */ r("div", { className: "space-y-3 rounded-lg border border-border/60 bg-muted/10 p-3", children: [
|
|
2669
2675
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-3", children: [
|
|
2670
2676
|
/* @__PURE__ */ r("div", { children: [
|
|
2671
2677
|
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/80", children: n("users.bulk_renewal_policy") }),
|
|
@@ -2673,18 +2679,18 @@ function mr({
|
|
|
2673
2679
|
] }),
|
|
2674
2680
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
2675
2681
|
/* @__PURE__ */ e(
|
|
2676
|
-
|
|
2682
|
+
le,
|
|
2677
2683
|
{
|
|
2678
|
-
checked:
|
|
2679
|
-
onCheckedChange: (
|
|
2680
|
-
b({ ...
|
|
2684
|
+
checked: i.renewalEnabled,
|
|
2685
|
+
onCheckedChange: (c) => {
|
|
2686
|
+
b({ ...i, renewalEnabled: c }), x(null);
|
|
2681
2687
|
}
|
|
2682
2688
|
}
|
|
2683
2689
|
),
|
|
2684
2690
|
/* @__PURE__ */ e("span", { className: "text-sm text-foreground", children: n("users.enabled") })
|
|
2685
2691
|
] })
|
|
2686
2692
|
] }),
|
|
2687
|
-
|
|
2693
|
+
i.renewalEnabled && /* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-3", children: [
|
|
2688
2694
|
/* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
2689
2695
|
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider", children: n("users.recharge_interval") }),
|
|
2690
2696
|
/* @__PURE__ */ e(
|
|
@@ -2693,9 +2699,9 @@ function mr({
|
|
|
2693
2699
|
type: "number",
|
|
2694
2700
|
min: "1",
|
|
2695
2701
|
step: "1",
|
|
2696
|
-
value:
|
|
2697
|
-
onChange: (
|
|
2698
|
-
b({ ...
|
|
2702
|
+
value: i.renewalIntervalValue,
|
|
2703
|
+
onChange: (c) => {
|
|
2704
|
+
b({ ...i, renewalIntervalValue: c.target.value }), x(null);
|
|
2699
2705
|
},
|
|
2700
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",
|
|
2701
2707
|
required: !0,
|
|
@@ -2708,17 +2714,17 @@ function mr({
|
|
|
2708
2714
|
/* @__PURE__ */ r(
|
|
2709
2715
|
X,
|
|
2710
2716
|
{
|
|
2711
|
-
value:
|
|
2712
|
-
onValueChange: (
|
|
2717
|
+
value: i.renewalIntervalUnit,
|
|
2718
|
+
onValueChange: (c) => {
|
|
2713
2719
|
b({
|
|
2714
|
-
...
|
|
2715
|
-
renewalIntervalUnit:
|
|
2720
|
+
...i,
|
|
2721
|
+
renewalIntervalUnit: c
|
|
2716
2722
|
}), x(null);
|
|
2717
2723
|
},
|
|
2718
2724
|
dir: g ? "rtl" : "ltr",
|
|
2719
2725
|
children: [
|
|
2720
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, {}) }),
|
|
2721
|
-
/* @__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)) })
|
|
2722
2728
|
]
|
|
2723
2729
|
}
|
|
2724
2730
|
)
|
|
@@ -2729,9 +2735,9 @@ function mr({
|
|
|
2729
2735
|
"input",
|
|
2730
2736
|
{
|
|
2731
2737
|
type: "datetime-local",
|
|
2732
|
-
value:
|
|
2733
|
-
onChange: (
|
|
2734
|
-
b({ ...
|
|
2738
|
+
value: i.renewalAnchorAt,
|
|
2739
|
+
onChange: (c) => {
|
|
2740
|
+
b({ ...i, renewalAnchorAt: c.target.value }), x(null);
|
|
2735
2741
|
},
|
|
2736
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",
|
|
2737
2743
|
dir: "ltr"
|
|
@@ -2746,9 +2752,9 @@ function mr({
|
|
|
2746
2752
|
/* @__PURE__ */ e(
|
|
2747
2753
|
"textarea",
|
|
2748
2754
|
{
|
|
2749
|
-
value:
|
|
2750
|
-
onChange: (
|
|
2751
|
-
b({ ...
|
|
2755
|
+
value: i.userIds,
|
|
2756
|
+
onChange: (c) => {
|
|
2757
|
+
b({ ...i, userIds: c.target.value }), x(null);
|
|
2752
2758
|
},
|
|
2753
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]",
|
|
2754
2760
|
placeholder: "user_abc, user_xyz",
|
|
@@ -2761,9 +2767,9 @@ function mr({
|
|
|
2761
2767
|
/* @__PURE__ */ e(
|
|
2762
2768
|
"textarea",
|
|
2763
2769
|
{
|
|
2764
|
-
value:
|
|
2765
|
-
onChange: (
|
|
2766
|
-
b({ ...
|
|
2770
|
+
value: i.metadata,
|
|
2771
|
+
onChange: (c) => {
|
|
2772
|
+
b({ ...i, metadata: c.target.value }), x(null);
|
|
2767
2773
|
},
|
|
2768
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]",
|
|
2769
2775
|
placeholder: '{ "grade": ["10", "11"], "major": ["math", "science"] }',
|
|
@@ -2774,7 +2780,7 @@ function mr({
|
|
|
2774
2780
|
n("users.bulk_available_metadata"),
|
|
2775
2781
|
":",
|
|
2776
2782
|
" ",
|
|
2777
|
-
a.map((
|
|
2783
|
+
a.map((c) => c.key).join(", ")
|
|
2778
2784
|
] })
|
|
2779
2785
|
] })
|
|
2780
2786
|
] })
|
|
@@ -2796,24 +2802,24 @@ function mr({
|
|
|
2796
2802
|
}
|
|
2797
2803
|
);
|
|
2798
2804
|
}
|
|
2799
|
-
function hr({ user: t, onClose: a, onError:
|
|
2800
|
-
const { t: d, i18n:
|
|
2805
|
+
function hr({ user: t, onClose: a, onError: s }) {
|
|
2806
|
+
const { t: d, i18n: o } = F(["admin", "translation"]), n = o.language === "fa" ? "fa-IR" : "en-US", [l, g] = y(null), [_, S] = y(!1);
|
|
2801
2807
|
return H(() => {
|
|
2802
2808
|
if (!t) return;
|
|
2803
2809
|
let w = !1;
|
|
2804
2810
|
return g(null), S(!0), T.getUserUsageSummary(t.id).then((x) => {
|
|
2805
2811
|
w || g(x);
|
|
2806
2812
|
}).catch((x) => {
|
|
2807
|
-
w || (
|
|
2813
|
+
w || (s(x instanceof Error ? x.message : d("error_loading")), a());
|
|
2808
2814
|
}).finally(() => {
|
|
2809
2815
|
w || S(!1);
|
|
2810
2816
|
}), () => {
|
|
2811
2817
|
w = !0;
|
|
2812
2818
|
};
|
|
2813
|
-
}, [t]), /* @__PURE__ */ e(
|
|
2814
|
-
/* @__PURE__ */ r(
|
|
2815
|
-
/* @__PURE__ */ e(
|
|
2816
|
-
/* @__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}` : "" })
|
|
2817
2823
|
] }),
|
|
2818
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: [
|
|
2819
2825
|
[d("users.input_tokens"), l.input_tokens.toLocaleString(n)],
|
|
@@ -2822,7 +2828,7 @@ function hr({ user: t, onClose: a, onError: i }) {
|
|
|
2822
2828
|
[d("users.requests_made"), l.requests.toLocaleString(n)],
|
|
2823
2829
|
[
|
|
2824
2830
|
d("users.total_cost"),
|
|
2825
|
-
|
|
2831
|
+
st(l.total_cost_microunits, l.currency, n)
|
|
2826
2832
|
],
|
|
2827
2833
|
[d("users.renewals"), l.renewal_count.toLocaleString(n)],
|
|
2828
2834
|
[d("users.unpriced_requests"), l.unpriced_requests.toLocaleString(n)]
|
|
@@ -2832,56 +2838,56 @@ function hr({ user: t, onClose: a, onError: i }) {
|
|
|
2832
2838
|
] }, w)) }) : null
|
|
2833
2839
|
] }) });
|
|
2834
2840
|
}
|
|
2835
|
-
const
|
|
2841
|
+
const Ie = 25;
|
|
2836
2842
|
function pr() {
|
|
2837
|
-
const { t, i18n: a } = F(["admin", "translation"]), { app:
|
|
2838
|
-
data:
|
|
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"] }), {
|
|
2844
|
+
data: M,
|
|
2839
2845
|
isLoading: z,
|
|
2840
|
-
isFetching:
|
|
2846
|
+
isFetching: Q,
|
|
2841
2847
|
error: W
|
|
2842
|
-
} =
|
|
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]);
|
|
2843
2849
|
H(() => {
|
|
2844
|
-
T.getSettings().then(
|
|
2850
|
+
T.getSettings().then(R).catch((J) => console.error("Failed to load app settings", J));
|
|
2845
2851
|
}, []), H(() => {
|
|
2846
2852
|
const J = setTimeout(() => {
|
|
2847
2853
|
w(g);
|
|
2848
2854
|
}, 500);
|
|
2849
2855
|
return () => clearTimeout(J);
|
|
2850
2856
|
}, [g]), H(() => {
|
|
2851
|
-
f(
|
|
2857
|
+
f(Ie);
|
|
2852
2858
|
}, [S, x, b, N]);
|
|
2853
|
-
const
|
|
2854
|
-
x === J ? h((
|
|
2859
|
+
const V = (J) => {
|
|
2860
|
+
x === J ? h((ce) => ce === "asc" ? "desc" : "asc") : (i(J), h("asc"));
|
|
2855
2861
|
}, G = async (J) => {
|
|
2856
2862
|
if (confirm(t("users.confirm_delete_user")))
|
|
2857
2863
|
try {
|
|
2858
2864
|
await A.deleteUser.mutateAsync(J);
|
|
2859
|
-
} catch (
|
|
2860
|
-
l(
|
|
2865
|
+
} catch (ce) {
|
|
2866
|
+
l(ce instanceof Error ? ce.message : t("error_loading"));
|
|
2861
2867
|
}
|
|
2862
|
-
},
|
|
2868
|
+
}, pe = async (J) => {
|
|
2863
2869
|
try {
|
|
2864
|
-
const
|
|
2865
|
-
if (!
|
|
2870
|
+
const We = (await T.refreshUserToken(J.id))?.user?.token;
|
|
2871
|
+
if (!We) {
|
|
2866
2872
|
l(t("users.no_token"));
|
|
2867
2873
|
return;
|
|
2868
2874
|
}
|
|
2869
|
-
await navigator.clipboard.writeText(
|
|
2870
|
-
} catch (
|
|
2871
|
-
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"));
|
|
2872
2878
|
}
|
|
2873
|
-
},
|
|
2879
|
+
}, De = () => {
|
|
2874
2880
|
v(null), L(!0);
|
|
2875
|
-
},
|
|
2881
|
+
}, dt = (J) => {
|
|
2876
2882
|
v(J), L(!0);
|
|
2877
|
-
},
|
|
2883
|
+
}, He = () => {
|
|
2878
2884
|
L(!1), v(null);
|
|
2879
2885
|
};
|
|
2880
|
-
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir:
|
|
2886
|
+
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: o ? "rtl" : "ltr", children: [
|
|
2881
2887
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
|
|
2882
2888
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("users.title") }),
|
|
2883
|
-
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row items-center gap-2 flex-1 max-w-
|
|
2884
|
-
/* @__PURE__ */ e("div", { className: "flex-1 w-full md:w-auto", children: /* @__PURE__ */ e(
|
|
2889
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row items-center gap-2 flex-1 max-w-5xl justify-end", children: [
|
|
2890
|
+
/* @__PURE__ */ e("div", { className: "flex-1 w-full md:w-auto md:min-w-[320px]", children: /* @__PURE__ */ e(
|
|
2885
2891
|
"input",
|
|
2886
2892
|
{
|
|
2887
2893
|
type: "text",
|
|
@@ -2896,22 +2902,22 @@ function pr() {
|
|
|
2896
2902
|
X,
|
|
2897
2903
|
{
|
|
2898
2904
|
value: N,
|
|
2899
|
-
onValueChange: (J) =>
|
|
2900
|
-
dir:
|
|
2905
|
+
onValueChange: (J) => D(J),
|
|
2906
|
+
dir: o ? "rtl" : "ltr",
|
|
2901
2907
|
children: [
|
|
2902
2908
|
/* @__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, {}) }),
|
|
2903
2909
|
/* @__PURE__ */ e(te, { className: "rounded-xl border-border bg-card", children: ["human", "service", "all"].map((J) => /* @__PURE__ */ e(E, { value: J, children: t(`users.source_${J}`) }, J)) })
|
|
2904
2910
|
]
|
|
2905
2911
|
}
|
|
2906
2912
|
),
|
|
2907
|
-
/* @__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 }) }),
|
|
2908
2914
|
/* @__PURE__ */ r(
|
|
2909
2915
|
"button",
|
|
2910
2916
|
{
|
|
2911
|
-
onClick: () =>
|
|
2917
|
+
onClick: () => q(!0),
|
|
2912
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",
|
|
2913
2919
|
children: [
|
|
2914
|
-
/* @__PURE__ */ e(
|
|
2920
|
+
/* @__PURE__ */ e(jt, { className: "w-4 h-4" }),
|
|
2915
2921
|
t("users.bulk_balance")
|
|
2916
2922
|
]
|
|
2917
2923
|
}
|
|
@@ -2919,7 +2925,7 @@ function pr() {
|
|
|
2919
2925
|
/* @__PURE__ */ e(
|
|
2920
2926
|
"button",
|
|
2921
2927
|
{
|
|
2922
|
-
onClick:
|
|
2928
|
+
onClick: De,
|
|
2923
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",
|
|
2924
2930
|
children: t("users.add_user")
|
|
2925
2931
|
}
|
|
@@ -2928,17 +2934,17 @@ function pr() {
|
|
|
2928
2934
|
] })
|
|
2929
2935
|
] }),
|
|
2930
2936
|
/* @__PURE__ */ e(hr, { user: Z, onClose: () => k(null), onError: l }),
|
|
2931
|
-
|
|
2937
|
+
j && /* @__PURE__ */ e(or, { message: j, onDismiss: () => l("") }),
|
|
2932
2938
|
m && /* @__PURE__ */ e(
|
|
2933
2939
|
mr,
|
|
2934
2940
|
{
|
|
2935
2941
|
searchQuery: g,
|
|
2936
|
-
userMetadataFields:
|
|
2942
|
+
userMetadataFields: I,
|
|
2937
2943
|
onClose: () => {
|
|
2938
|
-
|
|
2944
|
+
q(!1), l("");
|
|
2939
2945
|
},
|
|
2940
2946
|
onApplied: () => {
|
|
2941
|
-
|
|
2947
|
+
q(!1), K();
|
|
2942
2948
|
},
|
|
2943
2949
|
onError: l
|
|
2944
2950
|
}
|
|
@@ -2946,12 +2952,12 @@ function pr() {
|
|
|
2946
2952
|
C && /* @__PURE__ */ e(
|
|
2947
2953
|
dr,
|
|
2948
2954
|
{
|
|
2949
|
-
editingUser:
|
|
2955
|
+
editingUser: $,
|
|
2950
2956
|
appSettings: p,
|
|
2951
|
-
userMetadataFields:
|
|
2952
|
-
onClose:
|
|
2957
|
+
userMetadataFields: I,
|
|
2958
|
+
onClose: He,
|
|
2953
2959
|
onSaved: () => {
|
|
2954
|
-
|
|
2960
|
+
K(), He();
|
|
2955
2961
|
},
|
|
2956
2962
|
onError: l
|
|
2957
2963
|
}
|
|
@@ -2964,7 +2970,7 @@ function pr() {
|
|
|
2964
2970
|
P(null), l("");
|
|
2965
2971
|
},
|
|
2966
2972
|
onSaved: () => {
|
|
2967
|
-
|
|
2973
|
+
K(), P(null);
|
|
2968
2974
|
},
|
|
2969
2975
|
onError: l
|
|
2970
2976
|
}
|
|
@@ -2972,45 +2978,45 @@ function pr() {
|
|
|
2972
2978
|
/* @__PURE__ */ e(
|
|
2973
2979
|
ir,
|
|
2974
2980
|
{
|
|
2975
|
-
users:
|
|
2976
|
-
loading:
|
|
2977
|
-
totalCount:
|
|
2978
|
-
userMetadataFields:
|
|
2981
|
+
users: B,
|
|
2982
|
+
loading: xe,
|
|
2983
|
+
totalCount: de,
|
|
2984
|
+
userMetadataFields: I,
|
|
2979
2985
|
sortBy: x,
|
|
2980
2986
|
sortOrder: b,
|
|
2981
|
-
onSort:
|
|
2982
|
-
onLoadMore: () => f((J) => J +
|
|
2987
|
+
onSort: V,
|
|
2988
|
+
onLoadMore: () => f((J) => J + Ie),
|
|
2983
2989
|
onUsage: k,
|
|
2984
|
-
onEdit:
|
|
2990
|
+
onEdit: dt,
|
|
2985
2991
|
onRecharge: (J) => {
|
|
2986
2992
|
P(J), l("");
|
|
2987
2993
|
},
|
|
2988
|
-
onCopyToken:
|
|
2994
|
+
onCopyToken: pe,
|
|
2989
2995
|
onDelete: G
|
|
2990
2996
|
}
|
|
2991
2997
|
)
|
|
2992
2998
|
] });
|
|
2993
2999
|
}
|
|
2994
|
-
function
|
|
2995
|
-
const d = [],
|
|
3000
|
+
function Ne(t, a, s) {
|
|
3001
|
+
const d = [], o = /* @__PURE__ */ new Date(), n = t || [], l = new Map(n.map((g) => [g.date, g]));
|
|
2996
3002
|
for (let g = a - 1; g >= 0; g--) {
|
|
2997
|
-
const S = new Date(
|
|
3003
|
+
const S = new Date(o.getTime() - g * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
|
2998
3004
|
if (l.has(S))
|
|
2999
3005
|
d.push(l.get(S));
|
|
3000
3006
|
else {
|
|
3001
3007
|
const w = { date: S };
|
|
3002
|
-
|
|
3008
|
+
s.forEach((x) => w[x] = 0), d.push(w);
|
|
3003
3009
|
}
|
|
3004
3010
|
}
|
|
3005
3011
|
return d;
|
|
3006
3012
|
}
|
|
3007
3013
|
function gr() {
|
|
3008
|
-
const { t, i18n: a } = F(["admin", "translation"]), [
|
|
3014
|
+
const { t, i18n: a } = F(["admin", "translation"]), [s, d] = y(30), [o, n] = y("human"), {
|
|
3009
3015
|
data: l,
|
|
3010
3016
|
isLoading: g,
|
|
3011
3017
|
error: _,
|
|
3012
3018
|
refetch: S
|
|
3013
|
-
} = Gt(
|
|
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(() => {
|
|
3014
3020
|
if (!l) return null;
|
|
3015
3021
|
const m = l;
|
|
3016
3022
|
return {
|
|
@@ -3027,10 +3033,10 @@ function gr() {
|
|
|
3027
3033
|
},
|
|
3028
3034
|
trends: {
|
|
3029
3035
|
...m.trends || {},
|
|
3030
|
-
users:
|
|
3031
|
-
threads:
|
|
3032
|
-
messages:
|
|
3033
|
-
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, [
|
|
3034
3040
|
"input_tokens",
|
|
3035
3041
|
"output_tokens",
|
|
3036
3042
|
"requests",
|
|
@@ -3044,49 +3050,49 @@ function gr() {
|
|
|
3044
3050
|
},
|
|
3045
3051
|
active_users: m.active_users || []
|
|
3046
3052
|
};
|
|
3047
|
-
}, [l,
|
|
3053
|
+
}, [l, s]);
|
|
3048
3054
|
H(() => {
|
|
3049
|
-
const m = Object.entries(
|
|
3055
|
+
const m = Object.entries(i.current).filter(
|
|
3050
3056
|
(A) => !!A[1]
|
|
3051
3057
|
);
|
|
3052
3058
|
if (m.length === 0) return;
|
|
3053
|
-
const
|
|
3054
|
-
for (const
|
|
3055
|
-
const
|
|
3056
|
-
|
|
3059
|
+
const q = new ResizeObserver((A) => {
|
|
3060
|
+
for (const K of A) {
|
|
3061
|
+
const M = K.target.dataset.chartId;
|
|
3062
|
+
M && x((z) => ({
|
|
3057
3063
|
...z,
|
|
3058
|
-
[
|
|
3064
|
+
[M]: K.contentRect.width
|
|
3059
3065
|
}));
|
|
3060
3066
|
}
|
|
3061
3067
|
});
|
|
3062
|
-
return m.forEach(([, A]) =>
|
|
3068
|
+
return m.forEach(([, A]) => q.observe(A)), () => q.disconnect();
|
|
3063
3069
|
}, [p]);
|
|
3064
|
-
const
|
|
3065
|
-
|
|
3066
|
-
},
|
|
3070
|
+
const R = (m) => (q) => {
|
|
3071
|
+
i.current[m] = q;
|
|
3072
|
+
}, c = (m, q = 0) => {
|
|
3067
3073
|
if (!m || m.length === 0) return null;
|
|
3068
|
-
const A = m.length,
|
|
3069
|
-
let
|
|
3070
|
-
if (
|
|
3071
|
-
|
|
3074
|
+
const A = m.length, K = new Intl.DateTimeFormat(N, { month: "short" });
|
|
3075
|
+
let M = [];
|
|
3076
|
+
if (s <= 14)
|
|
3077
|
+
M = Array.from({ length: A }, (z, Q) => Q);
|
|
3072
3078
|
else {
|
|
3073
|
-
const z = b ? 45 : 35,
|
|
3074
|
-
for (let
|
|
3075
|
-
|
|
3076
|
-
|
|
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);
|
|
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);
|
|
3077
3083
|
}
|
|
3078
|
-
return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: b ? "rtl" : "ltr", children:
|
|
3079
|
-
const
|
|
3080
|
-
if (!
|
|
3081
|
-
const W = new Date(
|
|
3084
|
+
return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: b ? "rtl" : "ltr", children: M.map((z) => {
|
|
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;
|
|
3082
3088
|
return /* @__PURE__ */ r(
|
|
3083
3089
|
"div",
|
|
3084
3090
|
{
|
|
3085
3091
|
className: "absolute top-0 transform -translate-x-1/2 flex flex-col items-center",
|
|
3086
|
-
style: { left: `${
|
|
3092
|
+
style: { left: `${xe}%` },
|
|
3087
3093
|
children: [
|
|
3088
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-gray-600 dark:text-gray-400 font-medium leading-none", children:
|
|
3089
|
-
/* @__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 })
|
|
3090
3096
|
]
|
|
3091
3097
|
},
|
|
3092
3098
|
z
|
|
@@ -3095,9 +3101,9 @@ function gr() {
|
|
|
3095
3101
|
};
|
|
3096
3102
|
if (g)
|
|
3097
3103
|
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground", children: t("analytics.loading_analytics") });
|
|
3098
|
-
if (
|
|
3104
|
+
if (D)
|
|
3099
3105
|
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "text-center", children: [
|
|
3100
|
-
/* @__PURE__ */ e("div", { className: "text-destructive mb-4", children:
|
|
3106
|
+
/* @__PURE__ */ e("div", { className: "text-destructive mb-4", children: D }),
|
|
3101
3107
|
/* @__PURE__ */ e(
|
|
3102
3108
|
"button",
|
|
3103
3109
|
{
|
|
@@ -3110,25 +3116,25 @@ function gr() {
|
|
|
3110
3116
|
if (!p) return null;
|
|
3111
3117
|
const f = (m) => {
|
|
3112
3118
|
if (m <= 0) return 10;
|
|
3113
|
-
const
|
|
3114
|
-
let
|
|
3115
|
-
return
|
|
3116
|
-
}, C = Math.max(...p.trends.threads.map((m) => m.count) || [1]), L = Math.max(...p.trends.messages.map((m) => m.count) || [1]),
|
|
3119
|
+
const q = m * 1.15, A = Math.pow(10, Math.floor(Math.log10(q))), K = q / A;
|
|
3120
|
+
let M;
|
|
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);
|
|
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(
|
|
3117
3123
|
...p.trends.token_usage.map((m) => (m.input_tokens || 0) + (m.output_tokens || 0)) || [1]
|
|
3118
3124
|
), v = Math.max(
|
|
3119
3125
|
...p.trends.token_usage.map((m) => m.cost_microunits) || [1]
|
|
3120
|
-
), O = f(C), P = f(L), Z = f(
|
|
3126
|
+
), O = f(C), P = f(L), Z = f($), k = f(v);
|
|
3121
3127
|
return /* @__PURE__ */ r("div", { className: "h-full overflow-auto p-5 flex flex-col gap-5", dir: b ? "rtl" : "ltr", children: [
|
|
3122
3128
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3", children: [
|
|
3123
3129
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
3124
3130
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("analytics.title") }),
|
|
3125
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: t(`analytics.source_caption_${
|
|
3131
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: t(`analytics.source_caption_${o}`) })
|
|
3126
3132
|
] }),
|
|
3127
3133
|
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3128
3134
|
/* @__PURE__ */ r(
|
|
3129
3135
|
X,
|
|
3130
3136
|
{
|
|
3131
|
-
value:
|
|
3137
|
+
value: o,
|
|
3132
3138
|
onValueChange: (m) => n(m),
|
|
3133
3139
|
dir: b ? "rtl" : "ltr",
|
|
3134
3140
|
children: [
|
|
@@ -3144,8 +3150,8 @@ function gr() {
|
|
|
3144
3150
|
{
|
|
3145
3151
|
onClick: () => d(m),
|
|
3146
3152
|
title: t("analytics.days", { count: m }),
|
|
3147
|
-
"aria-pressed":
|
|
3148
|
-
className: `px-3 py-1.5 text-sm font-medium rounded-lg transition-all ${
|
|
3153
|
+
"aria-pressed": s === m,
|
|
3154
|
+
className: `px-3 py-1.5 text-sm font-medium rounded-lg transition-all ${s === m ? "bg-primary text-primary-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
|
|
3149
3155
|
children: m.toLocaleString(h)
|
|
3150
3156
|
},
|
|
3151
3157
|
m
|
|
@@ -3245,12 +3251,12 @@ function gr() {
|
|
|
3245
3251
|
"p",
|
|
3246
3252
|
{
|
|
3247
3253
|
className: "text-sm font-medium text-foreground",
|
|
3248
|
-
title:
|
|
3254
|
+
title: me(
|
|
3249
3255
|
p.overview.total_cost_microunits,
|
|
3250
3256
|
p.overview.currency,
|
|
3251
3257
|
h
|
|
3252
3258
|
),
|
|
3253
|
-
children:
|
|
3259
|
+
children: me(
|
|
3254
3260
|
p.overview.total_cost_microunits,
|
|
3255
3261
|
p.overview.currency,
|
|
3256
3262
|
h
|
|
@@ -3287,7 +3293,7 @@ function gr() {
|
|
|
3287
3293
|
"div",
|
|
3288
3294
|
{
|
|
3289
3295
|
className: "h-64 flex flex-col",
|
|
3290
|
-
ref:
|
|
3296
|
+
ref: R("threads"),
|
|
3291
3297
|
"data-chart-id": "threads",
|
|
3292
3298
|
children: [
|
|
3293
3299
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
@@ -3301,7 +3307,7 @@ function gr() {
|
|
|
3301
3307
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
3302
3308
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
3303
3309
|
] }),
|
|
3304
|
-
p.trends.threads.length > 0 ? p.trends.threads.map((m,
|
|
3310
|
+
p.trends.threads.length > 0 ? p.trends.threads.map((m, q) => /* @__PURE__ */ e(
|
|
3305
3311
|
"div",
|
|
3306
3312
|
{
|
|
3307
3313
|
className: "w-1.5 group relative flex flex-col justify-end h-full",
|
|
@@ -3320,13 +3326,13 @@ function gr() {
|
|
|
3320
3326
|
}
|
|
3321
3327
|
)
|
|
3322
3328
|
},
|
|
3323
|
-
|
|
3329
|
+
q
|
|
3324
3330
|
)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
3325
3331
|
] })
|
|
3326
3332
|
] }),
|
|
3327
3333
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
3328
3334
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
3329
|
-
|
|
3335
|
+
c(p.trends.threads, w.threads)
|
|
3330
3336
|
] })
|
|
3331
3337
|
]
|
|
3332
3338
|
}
|
|
@@ -3338,7 +3344,7 @@ function gr() {
|
|
|
3338
3344
|
"div",
|
|
3339
3345
|
{
|
|
3340
3346
|
className: "h-64 flex flex-col",
|
|
3341
|
-
ref:
|
|
3347
|
+
ref: R("messages"),
|
|
3342
3348
|
"data-chart-id": "messages",
|
|
3343
3349
|
children: [
|
|
3344
3350
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
@@ -3352,7 +3358,7 @@ function gr() {
|
|
|
3352
3358
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
3353
3359
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
3354
3360
|
] }),
|
|
3355
|
-
p.trends.messages.length > 0 ? p.trends.messages.map((m,
|
|
3361
|
+
p.trends.messages.length > 0 ? p.trends.messages.map((m, q) => /* @__PURE__ */ e(
|
|
3356
3362
|
"div",
|
|
3357
3363
|
{
|
|
3358
3364
|
className: "w-1.5 group relative flex flex-col justify-end h-full",
|
|
@@ -3371,13 +3377,13 @@ function gr() {
|
|
|
3371
3377
|
}
|
|
3372
3378
|
)
|
|
3373
3379
|
},
|
|
3374
|
-
|
|
3380
|
+
q
|
|
3375
3381
|
)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
3376
3382
|
] })
|
|
3377
3383
|
] }),
|
|
3378
3384
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
3379
3385
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
3380
|
-
|
|
3386
|
+
c(p.trends.messages, w.messages)
|
|
3381
3387
|
] })
|
|
3382
3388
|
]
|
|
3383
3389
|
}
|
|
@@ -3389,7 +3395,7 @@ function gr() {
|
|
|
3389
3395
|
"div",
|
|
3390
3396
|
{
|
|
3391
3397
|
className: "h-64 flex flex-col",
|
|
3392
|
-
ref:
|
|
3398
|
+
ref: R("token-usage"),
|
|
3393
3399
|
"data-chart-id": "token-usage",
|
|
3394
3400
|
children: [
|
|
3395
3401
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
@@ -3403,7 +3409,7 @@ function gr() {
|
|
|
3403
3409
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
3404
3410
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
3405
3411
|
] }),
|
|
3406
|
-
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) => {
|
|
3407
3413
|
const A = (m.input_tokens || 0) + (m.output_tokens || 0);
|
|
3408
3414
|
return /* @__PURE__ */ e(
|
|
3409
3415
|
"div",
|
|
@@ -3424,14 +3430,14 @@ function gr() {
|
|
|
3424
3430
|
}
|
|
3425
3431
|
)
|
|
3426
3432
|
},
|
|
3427
|
-
|
|
3433
|
+
q
|
|
3428
3434
|
);
|
|
3429
3435
|
}) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
3430
3436
|
] })
|
|
3431
3437
|
] }),
|
|
3432
3438
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
3433
3439
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
3434
|
-
|
|
3440
|
+
c(p.trends.token_usage, w["token-usage"])
|
|
3435
3441
|
] })
|
|
3436
3442
|
]
|
|
3437
3443
|
}
|
|
@@ -3443,29 +3449,29 @@ function gr() {
|
|
|
3443
3449
|
"div",
|
|
3444
3450
|
{
|
|
3445
3451
|
className: "h-64 flex flex-col",
|
|
3446
|
-
ref:
|
|
3452
|
+
ref: R("cost"),
|
|
3447
3453
|
"data-chart-id": "cost",
|
|
3448
3454
|
children: [
|
|
3449
3455
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
3450
3456
|
/* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[70px]", children: [
|
|
3451
|
-
/* @__PURE__ */ e("span", { children:
|
|
3457
|
+
/* @__PURE__ */ e("span", { children: me(
|
|
3452
3458
|
k || 0,
|
|
3453
3459
|
p.overview.currency,
|
|
3454
3460
|
h
|
|
3455
3461
|
) }),
|
|
3456
|
-
/* @__PURE__ */ e("span", { children:
|
|
3462
|
+
/* @__PURE__ */ e("span", { children: me(
|
|
3457
3463
|
Math.floor((k || 0) / 2),
|
|
3458
3464
|
p.overview.currency,
|
|
3459
3465
|
h
|
|
3460
3466
|
) }),
|
|
3461
|
-
/* @__PURE__ */ e("span", { children:
|
|
3467
|
+
/* @__PURE__ */ e("span", { children: me(0, p.overview.currency, h) })
|
|
3462
3468
|
] }),
|
|
3463
3469
|
/* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
3464
3470
|
/* @__PURE__ */ r("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
|
|
3465
3471
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
3466
3472
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
3467
3473
|
] }),
|
|
3468
|
-
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(
|
|
3469
3475
|
"div",
|
|
3470
3476
|
{
|
|
3471
3477
|
className: "w-1.5 group relative flex flex-col justify-end h-full",
|
|
@@ -3477,7 +3483,7 @@ function gr() {
|
|
|
3477
3483
|
height: `${(m.cost_microunits || 0) / k * 100}%`
|
|
3478
3484
|
},
|
|
3479
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: [
|
|
3480
|
-
/* @__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(
|
|
3481
3487
|
m.cost_microunits || 0,
|
|
3482
3488
|
p.overview.currency,
|
|
3483
3489
|
h
|
|
@@ -3490,13 +3496,13 @@ function gr() {
|
|
|
3490
3496
|
}
|
|
3491
3497
|
)
|
|
3492
3498
|
},
|
|
3493
|
-
|
|
3499
|
+
q
|
|
3494
3500
|
)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
3495
3501
|
] })
|
|
3496
3502
|
] }),
|
|
3497
3503
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
3498
3504
|
/* @__PURE__ */ e("div", { className: "min-w-[70px] invisible" }),
|
|
3499
|
-
|
|
3505
|
+
c(p.trends.token_usage, w.cost)
|
|
3500
3506
|
] })
|
|
3501
3507
|
]
|
|
3502
3508
|
}
|
|
@@ -3510,17 +3516,17 @@ function gr() {
|
|
|
3510
3516
|
/* @__PURE__ */ r("div", { className: "relative w-56 h-56 lg:w-60 lg:h-60", children: [
|
|
3511
3517
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 100", className: "w-full h-full -rotate-90 drop-shadow-md", children: (() => {
|
|
3512
3518
|
const m = p.distributions.feedback_sentiment.filter(
|
|
3513
|
-
(
|
|
3514
|
-
),
|
|
3515
|
-
if (
|
|
3516
|
-
const A = m.find((
|
|
3517
|
-
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: [
|
|
3518
3524
|
/* @__PURE__ */ e(
|
|
3519
3525
|
"circle",
|
|
3520
3526
|
{
|
|
3521
3527
|
cx: "50",
|
|
3522
3528
|
cy: "50",
|
|
3523
|
-
r:
|
|
3529
|
+
r: M,
|
|
3524
3530
|
fill: "transparent",
|
|
3525
3531
|
stroke: "currentColor",
|
|
3526
3532
|
strokeWidth: "10",
|
|
@@ -3542,12 +3548,12 @@ function gr() {
|
|
|
3542
3548
|
{
|
|
3543
3549
|
cx: "50",
|
|
3544
3550
|
cy: "50",
|
|
3545
|
-
r:
|
|
3551
|
+
r: M,
|
|
3546
3552
|
fill: "transparent",
|
|
3547
3553
|
stroke: "url(#posGradient)",
|
|
3548
3554
|
strokeWidth: "10",
|
|
3549
|
-
strokeDasharray: `${
|
|
3550
|
-
strokeLinecap:
|
|
3555
|
+
strokeDasharray: `${Q / 100 * z} ${z}`,
|
|
3556
|
+
strokeLinecap: Q > 0 ? "round" : "butt",
|
|
3551
3557
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
3552
3558
|
}
|
|
3553
3559
|
),
|
|
@@ -3556,12 +3562,12 @@ function gr() {
|
|
|
3556
3562
|
{
|
|
3557
3563
|
cx: "50",
|
|
3558
3564
|
cy: "50",
|
|
3559
|
-
r:
|
|
3565
|
+
r: M,
|
|
3560
3566
|
fill: "transparent",
|
|
3561
3567
|
stroke: "url(#negGradient)",
|
|
3562
3568
|
strokeWidth: "10",
|
|
3563
3569
|
strokeDasharray: `${W / 100 * z} ${z}`,
|
|
3564
|
-
strokeDashoffset: -(
|
|
3570
|
+
strokeDashoffset: -(Q / 100 * z),
|
|
3565
3571
|
strokeLinecap: W > 0 ? "round" : "butt",
|
|
3566
3572
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
3567
3573
|
}
|
|
@@ -3569,16 +3575,16 @@ function gr() {
|
|
|
3569
3575
|
] });
|
|
3570
3576
|
})() }),
|
|
3571
3577
|
/* @__PURE__ */ r("div", { className: "absolute inset-0 flex flex-col items-center justify-center pointer-events-none", children: [
|
|
3572
|
-
/* @__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) }),
|
|
3573
3579
|
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground uppercase tracking-widest mt-1", children: t("analytics.total_feedback") })
|
|
3574
3580
|
] })
|
|
3575
3581
|
] }),
|
|
3576
3582
|
/* @__PURE__ */ e("div", { className: "flex flex-col gap-4 min-w-[140px]", children: [...p.distributions.feedback_sentiment].filter(
|
|
3577
3583
|
(m) => m.sentiment === "positive" || m.sentiment === "negative"
|
|
3578
|
-
).sort((m,
|
|
3584
|
+
).sort((m, q) => m.sentiment === "positive" ? -1 : 1).map((m) => {
|
|
3579
3585
|
const A = p.distributions.feedback_sentiment.filter(
|
|
3580
3586
|
(W) => W.sentiment === "positive" || W.sentiment === "negative"
|
|
3581
|
-
).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" ? "👍" : "👎";
|
|
3582
3588
|
return /* @__PURE__ */ r(
|
|
3583
3589
|
"div",
|
|
3584
3590
|
{
|
|
@@ -3592,14 +3598,14 @@ function gr() {
|
|
|
3592
3598
|
}
|
|
3593
3599
|
),
|
|
3594
3600
|
/* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground font-medium", children: [
|
|
3595
|
-
|
|
3601
|
+
M,
|
|
3596
3602
|
" ",
|
|
3597
|
-
|
|
3603
|
+
Q
|
|
3598
3604
|
] })
|
|
3599
3605
|
] }),
|
|
3600
3606
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
3601
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: [
|
|
3602
|
-
(
|
|
3608
|
+
(K || 0).toLocaleString(h, {
|
|
3603
3609
|
maximumFractionDigits: 0
|
|
3604
3610
|
}),
|
|
3605
3611
|
"%"
|
|
@@ -3641,7 +3647,7 @@ function gr() {
|
|
|
3641
3647
|
] })
|
|
3642
3648
|
] });
|
|
3643
3649
|
}
|
|
3644
|
-
function
|
|
3650
|
+
function ye({ title: t, icon: a }) {
|
|
3645
3651
|
return /* @__PURE__ */ r("div", { className: "relative py-12", children: [
|
|
3646
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" }) }),
|
|
3647
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: [
|
|
@@ -3650,31 +3656,31 @@ function _e({ title: t, icon: a }) {
|
|
|
3650
3656
|
] }) })
|
|
3651
3657
|
] });
|
|
3652
3658
|
}
|
|
3653
|
-
function
|
|
3659
|
+
function ve({ value: t }) {
|
|
3654
3660
|
const { t: a } = F(["admin", "translation", "settings"]);
|
|
3655
3661
|
if (!t || !t.includes(":") && !t.includes(".")) return null;
|
|
3656
|
-
const
|
|
3657
|
-
return
|
|
3662
|
+
const s = a(t);
|
|
3663
|
+
return s === t ? null : /* @__PURE__ */ r("div", { className: "mt-1.5 px-3 py-1 bg-primary/5 rounded-lg border border-primary/10 inline-flex items-center gap-2", children: [
|
|
3658
3664
|
/* @__PURE__ */ r("span", { className: "text-[10px] font-bold text-primary/60 uppercase tracking-tighter", children: [
|
|
3659
3665
|
a("app_settings.preview", { defaultValue: "Preview" }),
|
|
3660
3666
|
":"
|
|
3661
3667
|
] }),
|
|
3662
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children:
|
|
3668
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children: s })
|
|
3663
3669
|
] });
|
|
3664
3670
|
}
|
|
3665
3671
|
function fr({
|
|
3666
3672
|
settings: t,
|
|
3667
3673
|
setSettings: a,
|
|
3668
|
-
accentValue:
|
|
3674
|
+
accentValue: s,
|
|
3669
3675
|
accentIsValid: d
|
|
3670
3676
|
}) {
|
|
3671
|
-
const { t:
|
|
3677
|
+
const { t: o } = F(["admin", "translation", "settings"]);
|
|
3672
3678
|
return /* @__PURE__ */ r("section", { children: [
|
|
3673
|
-
/* @__PURE__ */ e(
|
|
3679
|
+
/* @__PURE__ */ e(ye, { title: o("app_settings.sections.general"), icon: Fe }),
|
|
3674
3680
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
3675
3681
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
3676
3682
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3677
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
3683
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: o("app_settings.general.app_name") }),
|
|
3678
3684
|
/* @__PURE__ */ e(
|
|
3679
3685
|
se,
|
|
3680
3686
|
{
|
|
@@ -3686,10 +3692,10 @@ function fr({
|
|
|
3686
3692
|
dir: "auto"
|
|
3687
3693
|
}
|
|
3688
3694
|
),
|
|
3689
|
-
/* @__PURE__ */ e(
|
|
3695
|
+
/* @__PURE__ */ e(ve, { value: t.app_name })
|
|
3690
3696
|
] }),
|
|
3691
3697
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3692
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
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") }),
|
|
3693
3699
|
/* @__PURE__ */ e(
|
|
3694
3700
|
se,
|
|
3695
3701
|
{
|
|
@@ -3701,11 +3707,11 @@ function fr({
|
|
|
3701
3707
|
dir: "auto"
|
|
3702
3708
|
}
|
|
3703
3709
|
),
|
|
3704
|
-
/* @__PURE__ */ e(
|
|
3710
|
+
/* @__PURE__ */ e(ve, { value: t.admin_title || "" })
|
|
3705
3711
|
] })
|
|
3706
3712
|
] }),
|
|
3707
3713
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3708
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
3714
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: o("app_settings.general.language") }),
|
|
3709
3715
|
/* @__PURE__ */ r(
|
|
3710
3716
|
X,
|
|
3711
3717
|
{
|
|
@@ -3721,21 +3727,21 @@ function fr({
|
|
|
3721
3727
|
}
|
|
3722
3728
|
),
|
|
3723
3729
|
/* @__PURE__ */ r("p", { className: "mt-3 text-[10px] text-muted-foreground/50 italic flex items-center gap-1.5 ml-1", children: [
|
|
3724
|
-
/* @__PURE__ */ e(
|
|
3725
|
-
|
|
3730
|
+
/* @__PURE__ */ e(at, { className: "size-3" }),
|
|
3731
|
+
o("app_settings.general.language_help")
|
|
3726
3732
|
] })
|
|
3727
3733
|
] }),
|
|
3728
3734
|
/* @__PURE__ */ r("div", { className: "space-y-5 rounded-2xl border border-border/50 bg-muted/10 p-5", children: [
|
|
3729
3735
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
3730
|
-
/* @__PURE__ */ e(
|
|
3736
|
+
/* @__PURE__ */ e(Tt, { className: "size-4 text-primary" }),
|
|
3731
3737
|
/* @__PURE__ */ r("div", { children: [
|
|
3732
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children:
|
|
3733
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children:
|
|
3738
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children: o("app_settings.general.appearance") }),
|
|
3739
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: o("app_settings.general.appearance_help") })
|
|
3734
3740
|
] })
|
|
3735
3741
|
] }),
|
|
3736
3742
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
|
|
3737
3743
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3738
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
3744
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: o("app_settings.general.default_theme") }),
|
|
3739
3745
|
/* @__PURE__ */ r(
|
|
3740
3746
|
X,
|
|
3741
3747
|
{
|
|
@@ -3747,25 +3753,25 @@ function fr({
|
|
|
3747
3753
|
children: [
|
|
3748
3754
|
/* @__PURE__ */ e(Y, { className: "bg-muted/20 border-transparent focus:bg-background h-11 w-full", children: /* @__PURE__ */ e(ee, {}) }),
|
|
3749
3755
|
/* @__PURE__ */ r(te, { children: [
|
|
3750
|
-
/* @__PURE__ */ e(E, { value: "system", children:
|
|
3751
|
-
/* @__PURE__ */ e(E, { value: "light", children:
|
|
3752
|
-
/* @__PURE__ */ e(E, { value: "dark", children:
|
|
3756
|
+
/* @__PURE__ */ e(E, { value: "system", children: o("settings:general.themes.system") }),
|
|
3757
|
+
/* @__PURE__ */ e(E, { value: "light", children: o("settings:general.themes.light") }),
|
|
3758
|
+
/* @__PURE__ */ e(E, { value: "dark", children: o("settings:general.themes.dark") })
|
|
3753
3759
|
] })
|
|
3754
3760
|
]
|
|
3755
3761
|
}
|
|
3756
3762
|
)
|
|
3757
3763
|
] }),
|
|
3758
3764
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3759
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
3765
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: o("app_settings.general.default_accent") }),
|
|
3760
3766
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
3761
3767
|
/* @__PURE__ */ e(
|
|
3762
3768
|
"div",
|
|
3763
3769
|
{
|
|
3764
3770
|
className: "size-10 shrink-0 rounded-xl border border-border shadow-sm",
|
|
3765
3771
|
style: {
|
|
3766
|
-
backgroundColor: d &&
|
|
3772
|
+
backgroundColor: d && s ? s : "transparent"
|
|
3767
3773
|
},
|
|
3768
|
-
"aria-label":
|
|
3774
|
+
"aria-label": o("app_settings.general.default_accent_preview")
|
|
3769
3775
|
}
|
|
3770
3776
|
),
|
|
3771
3777
|
/* @__PURE__ */ e(
|
|
@@ -3785,7 +3791,7 @@ function fr({
|
|
|
3785
3791
|
"p",
|
|
3786
3792
|
{
|
|
3787
3793
|
className: `text-[10px] ${d ? "text-muted-foreground/60" : "text-destructive"}`,
|
|
3788
|
-
children:
|
|
3794
|
+
children: o(d ? "app_settings.general.default_accent_help" : "app_settings.general.default_accent_invalid")
|
|
3789
3795
|
}
|
|
3790
3796
|
)
|
|
3791
3797
|
] })
|
|
@@ -3794,36 +3800,36 @@ function fr({
|
|
|
3794
3800
|
] })
|
|
3795
3801
|
] });
|
|
3796
3802
|
}
|
|
3797
|
-
function
|
|
3803
|
+
function ie({
|
|
3798
3804
|
title: t,
|
|
3799
3805
|
help: a,
|
|
3800
|
-
checked:
|
|
3806
|
+
checked: s,
|
|
3801
3807
|
onCheckedChange: d,
|
|
3802
|
-
className:
|
|
3808
|
+
className: o
|
|
3803
3809
|
}) {
|
|
3804
3810
|
return /* @__PURE__ */ r(
|
|
3805
3811
|
"div",
|
|
3806
3812
|
{
|
|
3807
|
-
className:
|
|
3813
|
+
className: ke(
|
|
3808
3814
|
"p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors",
|
|
3809
|
-
|
|
3815
|
+
o
|
|
3810
3816
|
),
|
|
3811
3817
|
children: [
|
|
3812
3818
|
/* @__PURE__ */ r("div", { className: "flex-1", children: [
|
|
3813
3819
|
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: t }),
|
|
3814
3820
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: a })
|
|
3815
3821
|
] }),
|
|
3816
|
-
/* @__PURE__ */ e(
|
|
3822
|
+
/* @__PURE__ */ e(le, { checked: s, onCheckedChange: d })
|
|
3817
3823
|
]
|
|
3818
3824
|
}
|
|
3819
3825
|
);
|
|
3820
3826
|
}
|
|
3821
|
-
function
|
|
3827
|
+
function Re({
|
|
3822
3828
|
title: t,
|
|
3823
3829
|
fields: a,
|
|
3824
|
-
values:
|
|
3830
|
+
values: s,
|
|
3825
3831
|
onChange: d,
|
|
3826
|
-
columns:
|
|
3832
|
+
columns: o = 4
|
|
3827
3833
|
}) {
|
|
3828
3834
|
const { t: n, i18n: l } = F(["admin"]), g = l.language === "fa";
|
|
3829
3835
|
return /* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
@@ -3834,7 +3840,7 @@ function $e({
|
|
|
3834
3840
|
/* @__PURE__ */ e(
|
|
3835
3841
|
"div",
|
|
3836
3842
|
{
|
|
3837
|
-
className: `grid grid-cols-1 gap-4 ${
|
|
3843
|
+
className: `grid grid-cols-1 gap-4 ${o === 2 ? "sm:grid-cols-2" : "sm:grid-cols-4"}`,
|
|
3838
3844
|
children: a.map((_) => /* @__PURE__ */ r(
|
|
3839
3845
|
"div",
|
|
3840
3846
|
{
|
|
@@ -3844,7 +3850,7 @@ function $e({
|
|
|
3844
3850
|
/* @__PURE__ */ r(
|
|
3845
3851
|
X,
|
|
3846
3852
|
{
|
|
3847
|
-
value:
|
|
3853
|
+
value: s?.[_.id] || "editable",
|
|
3848
3854
|
onValueChange: (S) => d(_.id, S),
|
|
3849
3855
|
dir: g ? "rtl" : "ltr",
|
|
3850
3856
|
children: [
|
|
@@ -3868,16 +3874,16 @@ function $e({
|
|
|
3868
3874
|
function br({
|
|
3869
3875
|
settings: t,
|
|
3870
3876
|
setSettings: a,
|
|
3871
|
-
userMetadataFields:
|
|
3877
|
+
userMetadataFields: s,
|
|
3872
3878
|
isRtl: d
|
|
3873
3879
|
}) {
|
|
3874
|
-
const { t:
|
|
3880
|
+
const { t: o } = F(["admin", "translation", "settings"]);
|
|
3875
3881
|
return /* @__PURE__ */ r("section", { children: [
|
|
3876
|
-
/* @__PURE__ */ e(
|
|
3882
|
+
/* @__PURE__ */ e(ye, { title: o("app_settings.sections.chat"), icon: At }),
|
|
3877
3883
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
3878
3884
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
3879
3885
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3880
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
3886
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: o("app_settings.chat.welcome_greeting") }),
|
|
3881
3887
|
/* @__PURE__ */ e(
|
|
3882
3888
|
se,
|
|
3883
3889
|
{
|
|
@@ -3889,10 +3895,10 @@ function br({
|
|
|
3889
3895
|
dir: "auto"
|
|
3890
3896
|
}
|
|
3891
3897
|
),
|
|
3892
|
-
/* @__PURE__ */ e(
|
|
3898
|
+
/* @__PURE__ */ e(ve, { value: t.welcome_greeting || "" })
|
|
3893
3899
|
] }),
|
|
3894
3900
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3895
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
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") }),
|
|
3896
3902
|
/* @__PURE__ */ e(
|
|
3897
3903
|
se,
|
|
3898
3904
|
{
|
|
@@ -3903,13 +3909,13 @@ function br({
|
|
|
3903
3909
|
dir: "auto"
|
|
3904
3910
|
}
|
|
3905
3911
|
),
|
|
3906
|
-
/* @__PURE__ */ e(
|
|
3912
|
+
/* @__PURE__ */ e(ve, { value: t.welcome_subtitle || "" })
|
|
3907
3913
|
] })
|
|
3908
3914
|
] }),
|
|
3909
3915
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
3910
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
3916
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: o("app_settings.chat.disclaimer") }),
|
|
3911
3917
|
/* @__PURE__ */ e(
|
|
3912
|
-
|
|
3918
|
+
Ae,
|
|
3913
3919
|
{
|
|
3914
3920
|
value: t.disclaimer || "",
|
|
3915
3921
|
onChange: (n) => a({ ...t, disclaimer: n.target.value }),
|
|
@@ -3917,87 +3923,87 @@ function br({
|
|
|
3917
3923
|
dir: "auto"
|
|
3918
3924
|
}
|
|
3919
3925
|
),
|
|
3920
|
-
/* @__PURE__ */ e(
|
|
3926
|
+
/* @__PURE__ */ e(ve, { value: t.disclaimer || "" })
|
|
3921
3927
|
] }),
|
|
3922
3928
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-6 pt-2", children: [
|
|
3923
3929
|
/* @__PURE__ */ e(
|
|
3924
|
-
|
|
3930
|
+
ie,
|
|
3925
3931
|
{
|
|
3926
|
-
title:
|
|
3927
|
-
help:
|
|
3932
|
+
title: o("app_settings.chat.show_tool_details"),
|
|
3933
|
+
help: o("app_settings.chat.show_tool_details_help"),
|
|
3928
3934
|
checked: t.show_tool_details,
|
|
3929
3935
|
onCheckedChange: (n) => a({ ...t, show_tool_details: n })
|
|
3930
3936
|
}
|
|
3931
3937
|
),
|
|
3932
3938
|
/* @__PURE__ */ e(
|
|
3933
|
-
|
|
3939
|
+
ie,
|
|
3934
3940
|
{
|
|
3935
|
-
title:
|
|
3936
|
-
help:
|
|
3941
|
+
title: o("app_settings.chat.show_settings"),
|
|
3942
|
+
help: o("app_settings.chat.show_settings_help"),
|
|
3937
3943
|
checked: t.show_settings,
|
|
3938
3944
|
onCheckedChange: (n) => a({ ...t, show_settings: n })
|
|
3939
3945
|
}
|
|
3940
3946
|
),
|
|
3941
3947
|
/* @__PURE__ */ e(
|
|
3942
|
-
|
|
3948
|
+
ie,
|
|
3943
3949
|
{
|
|
3944
|
-
title:
|
|
3945
|
-
help:
|
|
3950
|
+
title: o("app_settings.chat.show_version_in_settings"),
|
|
3951
|
+
help: o("app_settings.chat.show_version_in_settings_help"),
|
|
3946
3952
|
checked: t.show_version_in_settings,
|
|
3947
3953
|
onCheckedChange: (n) => a({ ...t, show_version_in_settings: n })
|
|
3948
3954
|
}
|
|
3949
3955
|
),
|
|
3950
3956
|
/* @__PURE__ */ e(
|
|
3951
|
-
|
|
3957
|
+
ie,
|
|
3952
3958
|
{
|
|
3953
|
-
title:
|
|
3954
|
-
help:
|
|
3959
|
+
title: o("app_settings.chat.disable_signup"),
|
|
3960
|
+
help: o("app_settings.chat.disable_signup_help"),
|
|
3955
3961
|
checked: t.disable_signup,
|
|
3956
3962
|
onCheckedChange: (n) => a({ ...t, disable_signup: n })
|
|
3957
3963
|
}
|
|
3958
3964
|
),
|
|
3959
3965
|
/* @__PURE__ */ e(
|
|
3960
|
-
|
|
3966
|
+
ie,
|
|
3961
3967
|
{
|
|
3962
|
-
title:
|
|
3963
|
-
help:
|
|
3968
|
+
title: o("app_settings.chat.disable_auth_page"),
|
|
3969
|
+
help: o("app_settings.chat.disable_auth_page_help"),
|
|
3964
3970
|
checked: t.disable_auth_page,
|
|
3965
3971
|
onCheckedChange: (n) => a({ ...t, disable_auth_page: n }),
|
|
3966
3972
|
className: "sm:col-span-2"
|
|
3967
3973
|
}
|
|
3968
3974
|
),
|
|
3969
3975
|
/* @__PURE__ */ e(
|
|
3970
|
-
|
|
3976
|
+
ie,
|
|
3971
3977
|
{
|
|
3972
|
-
title:
|
|
3973
|
-
help:
|
|
3978
|
+
title: o("app_settings.chat.composer_attachments"),
|
|
3979
|
+
help: o("app_settings.chat.composer_attachments_help"),
|
|
3974
3980
|
checked: t.composer_attachments,
|
|
3975
3981
|
onCheckedChange: (n) => a({ ...t, composer_attachments: n })
|
|
3976
3982
|
}
|
|
3977
3983
|
),
|
|
3978
3984
|
/* @__PURE__ */ e(
|
|
3979
|
-
|
|
3985
|
+
ie,
|
|
3980
3986
|
{
|
|
3981
|
-
title:
|
|
3982
|
-
help:
|
|
3987
|
+
title: o("app_settings.chat.thread_actions_feedback"),
|
|
3988
|
+
help: o("app_settings.chat.thread_actions_feedback_help"),
|
|
3983
3989
|
checked: t.thread_actions_feedback,
|
|
3984
3990
|
onCheckedChange: (n) => a({ ...t, thread_actions_feedback: n })
|
|
3985
3991
|
}
|
|
3986
3992
|
),
|
|
3987
3993
|
/* @__PURE__ */ e(
|
|
3988
|
-
|
|
3994
|
+
ie,
|
|
3989
3995
|
{
|
|
3990
|
-
title:
|
|
3991
|
-
help:
|
|
3996
|
+
title: o("app_settings.chat.thread_actions_retry"),
|
|
3997
|
+
help: o("app_settings.chat.thread_actions_retry_help"),
|
|
3992
3998
|
checked: t.thread_actions_retry,
|
|
3993
3999
|
onCheckedChange: (n) => a({ ...t, thread_actions_retry: n })
|
|
3994
4000
|
}
|
|
3995
4001
|
),
|
|
3996
4002
|
/* @__PURE__ */ e(
|
|
3997
|
-
|
|
4003
|
+
ie,
|
|
3998
4004
|
{
|
|
3999
|
-
title:
|
|
4000
|
-
help:
|
|
4005
|
+
title: o("app_settings.chat.history_enabled"),
|
|
4006
|
+
help: o("app_settings.chat.history_enabled_help"),
|
|
4001
4007
|
checked: t.history_enabled,
|
|
4002
4008
|
onCheckedChange: (n) => a({ ...t, history_enabled: n }),
|
|
4003
4009
|
className: "sm:col-span-2"
|
|
@@ -4005,9 +4011,9 @@ function br({
|
|
|
4005
4011
|
),
|
|
4006
4012
|
t.history_enabled && /* @__PURE__ */ r("div", { className: "sm:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4 p-6 bg-muted/10 rounded-2xl border border-border/40 animate-in fade-in slide-in-from-top-2 duration-300", children: [
|
|
4007
4013
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
4008
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children:
|
|
4014
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children: o("app_settings.chat.history_show_delete") }),
|
|
4009
4015
|
/* @__PURE__ */ e(
|
|
4010
|
-
|
|
4016
|
+
le,
|
|
4011
4017
|
{
|
|
4012
4018
|
checked: t.history_show_delete,
|
|
4013
4019
|
onCheckedChange: (n) => a({ ...t, history_show_delete: n })
|
|
@@ -4015,9 +4021,9 @@ function br({
|
|
|
4015
4021
|
)
|
|
4016
4022
|
] }),
|
|
4017
4023
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
4018
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children:
|
|
4024
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children: o("app_settings.chat.history_show_rename") }),
|
|
4019
4025
|
/* @__PURE__ */ e(
|
|
4020
|
-
|
|
4026
|
+
le,
|
|
4021
4027
|
{
|
|
4022
4028
|
checked: t.history_show_rename,
|
|
4023
4029
|
onCheckedChange: (n) => a({ ...t, history_show_rename: n })
|
|
@@ -4025,9 +4031,9 @@ function br({
|
|
|
4025
4031
|
)
|
|
4026
4032
|
] }),
|
|
4027
4033
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
4028
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children:
|
|
4034
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children: o("app_settings.chat.history_show_share") }),
|
|
4029
4035
|
/* @__PURE__ */ e(
|
|
4030
|
-
|
|
4036
|
+
le,
|
|
4031
4037
|
{
|
|
4032
4038
|
checked: t.history_show_share,
|
|
4033
4039
|
onCheckedChange: (n) => a({ ...t, history_show_share: n })
|
|
@@ -4035,9 +4041,9 @@ function br({
|
|
|
4035
4041
|
)
|
|
4036
4042
|
] }),
|
|
4037
4043
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
4038
|
-
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children:
|
|
4044
|
+
/* @__PURE__ */ e(U, { className: "text-xs font-medium text-foreground/70", children: o("app_settings.chat.history_show_pin") }),
|
|
4039
4045
|
/* @__PURE__ */ e(
|
|
4040
|
-
|
|
4046
|
+
le,
|
|
4041
4047
|
{
|
|
4042
4048
|
checked: t.history_show_pin,
|
|
4043
4049
|
onCheckedChange: (n) => a({ ...t, history_show_pin: n })
|
|
@@ -4048,8 +4054,8 @@ function br({
|
|
|
4048
4054
|
] }),
|
|
4049
4055
|
/* @__PURE__ */ r("div", { className: "pt-10 space-y-6", children: [
|
|
4050
4056
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
4051
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children:
|
|
4052
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children:
|
|
4057
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children: o("app_settings.chat.sections_modes") }),
|
|
4058
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children: o("app_settings.chat.sections_modes_help") })
|
|
4053
4059
|
] }),
|
|
4054
4060
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-4", children: [
|
|
4055
4061
|
{ id: "settings_general_mode", label: "app_settings.chat.general_tab" },
|
|
@@ -4060,7 +4066,7 @@ function br({
|
|
|
4060
4066
|
{
|
|
4061
4067
|
className: "p-4 border border-border/40 rounded-2xl space-y-3 bg-muted/5",
|
|
4062
4068
|
children: [
|
|
4063
|
-
/* @__PURE__ */ e(U, { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70", children:
|
|
4069
|
+
/* @__PURE__ */ e(U, { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70", children: o(n.label) }),
|
|
4064
4070
|
/* @__PURE__ */ r(
|
|
4065
4071
|
X,
|
|
4066
4072
|
{
|
|
@@ -4070,9 +4076,9 @@ function br({
|
|
|
4070
4076
|
children: [
|
|
4071
4077
|
/* @__PURE__ */ e(Y, { className: "bg-background border-transparent h-9 text-xs", children: /* @__PURE__ */ e(ee, {}) }),
|
|
4072
4078
|
/* @__PURE__ */ r(te, { children: [
|
|
4073
|
-
/* @__PURE__ */ e(E, { value: "editable", children:
|
|
4074
|
-
/* @__PURE__ */ e(E, { value: "faded", children:
|
|
4075
|
-
/* @__PURE__ */ e(E, { value: "hidden", children:
|
|
4079
|
+
/* @__PURE__ */ e(E, { value: "editable", children: o("app_settings.chat.mode_editable") }),
|
|
4080
|
+
/* @__PURE__ */ e(E, { value: "faded", children: o("app_settings.chat.mode_faded") }),
|
|
4081
|
+
/* @__PURE__ */ e(E, { value: "hidden", children: o("app_settings.chat.mode_hidden") })
|
|
4076
4082
|
] })
|
|
4077
4083
|
]
|
|
4078
4084
|
}
|
|
@@ -4084,19 +4090,19 @@ function br({
|
|
|
4084
4090
|
] }),
|
|
4085
4091
|
/* @__PURE__ */ r("div", { className: "pt-10 space-y-8", children: [
|
|
4086
4092
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
4087
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children:
|
|
4088
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children:
|
|
4093
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children: o("app_settings.chat.inner_fields_modes") }),
|
|
4094
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children: o("app_settings.chat.inner_fields_modes_help") })
|
|
4089
4095
|
] }),
|
|
4090
4096
|
/* @__PURE__ */ r("div", { className: "space-y-10", children: [
|
|
4091
4097
|
/* @__PURE__ */ e(
|
|
4092
|
-
|
|
4098
|
+
Re,
|
|
4093
4099
|
{
|
|
4094
|
-
title:
|
|
4100
|
+
title: o("app_settings.chat.general_tab"),
|
|
4095
4101
|
fields: [
|
|
4096
|
-
{ id: "theme", label:
|
|
4097
|
-
{ id: "accent", label:
|
|
4098
|
-
{ id: "radius", label:
|
|
4099
|
-
{ id: "language", label:
|
|
4102
|
+
{ id: "theme", label: o("settings:general.theme") },
|
|
4103
|
+
{ id: "accent", label: o("settings:general.accent") },
|
|
4104
|
+
{ id: "radius", label: o("settings:general.radius") },
|
|
4105
|
+
{ id: "language", label: o("settings:general.language") }
|
|
4100
4106
|
],
|
|
4101
4107
|
values: t.settings_general_fields,
|
|
4102
4108
|
onChange: (n, l) => a((g) => ({
|
|
@@ -4106,17 +4112,17 @@ function br({
|
|
|
4106
4112
|
}
|
|
4107
4113
|
),
|
|
4108
4114
|
/* @__PURE__ */ e(
|
|
4109
|
-
|
|
4115
|
+
Re,
|
|
4110
4116
|
{
|
|
4111
|
-
title:
|
|
4117
|
+
title: o("app_settings.chat.profile_tab"),
|
|
4112
4118
|
fields: [
|
|
4113
|
-
{ id: "name", label:
|
|
4114
|
-
{ id: "surname", label:
|
|
4115
|
-
{ id: "phone", label:
|
|
4116
|
-
{ id: "password", label:
|
|
4117
|
-
...
|
|
4119
|
+
{ id: "name", label: o("settings:profile.name") },
|
|
4120
|
+
{ id: "surname", label: o("settings:profile.surname") },
|
|
4121
|
+
{ id: "phone", label: o("settings:profile.phone") },
|
|
4122
|
+
{ id: "password", label: o("settings:profile.password") },
|
|
4123
|
+
...s.map((n) => ({
|
|
4118
4124
|
id: n.key,
|
|
4119
|
-
label:
|
|
4125
|
+
label: o(n.label)
|
|
4120
4126
|
}))
|
|
4121
4127
|
],
|
|
4122
4128
|
values: t.settings_profile_fields,
|
|
@@ -4127,12 +4133,12 @@ function br({
|
|
|
4127
4133
|
}
|
|
4128
4134
|
),
|
|
4129
4135
|
/* @__PURE__ */ e(
|
|
4130
|
-
|
|
4136
|
+
Re,
|
|
4131
4137
|
{
|
|
4132
|
-
title:
|
|
4138
|
+
title: o("app_settings.chat.account_tab"),
|
|
4133
4139
|
fields: [
|
|
4134
|
-
{ id: "balance", label:
|
|
4135
|
-
{ id: "logout", label:
|
|
4140
|
+
{ id: "balance", label: o("settings:account.balance") },
|
|
4141
|
+
{ id: "logout", label: o("settings:account.logout") }
|
|
4136
4142
|
],
|
|
4137
4143
|
values: t.settings_account_fields,
|
|
4138
4144
|
onChange: (n, l) => a((g) => ({
|
|
@@ -4156,7 +4162,7 @@ function xr() {
|
|
|
4156
4162
|
return [];
|
|
4157
4163
|
}
|
|
4158
4164
|
}
|
|
4159
|
-
function
|
|
4165
|
+
function lt(t) {
|
|
4160
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";
|
|
4161
4167
|
}
|
|
4162
4168
|
function vr(t) {
|
|
@@ -4172,18 +4178,18 @@ function vr(t) {
|
|
|
4172
4178
|
}
|
|
4173
4179
|
}
|
|
4174
4180
|
function yr({ job: t, onClose: a }) {
|
|
4175
|
-
const { t:
|
|
4181
|
+
const { t: s } = F(["admin"]), { runRegisteredJob: d } = Ve(), [o, n] = y(() => {
|
|
4176
4182
|
const h = {};
|
|
4177
4183
|
for (const N of t.params) {
|
|
4178
|
-
const
|
|
4179
|
-
h[N.name] = p ? String(
|
|
4184
|
+
const D = N.default, p = typeof D == "string" || typeof D == "number" || typeof D == "boolean";
|
|
4185
|
+
h[N.name] = p ? String(D) : N.type === "bool" ? "false" : "";
|
|
4180
4186
|
}
|
|
4181
4187
|
return h;
|
|
4182
|
-
}), [l, g] = y(!1), [_, S] = y(""), w = t.danger === "destructive", x = !w || _.trim() === t.name,
|
|
4188
|
+
}), [l, g] = y(!1), [_, S] = y(""), w = t.danger === "destructive", x = !w || _.trim() === t.name, i = (h, N) => n((D) => ({ ...D, [h]: N })), b = async () => {
|
|
4183
4189
|
const h = {};
|
|
4184
4190
|
for (const N of t.params) {
|
|
4185
|
-
const
|
|
4186
|
-
N.type === "bool" ? h[N.name] =
|
|
4191
|
+
const D = o[N.name];
|
|
4192
|
+
N.type === "bool" ? h[N.name] = D === "true" : D !== "" && (h[N.name] = D);
|
|
4187
4193
|
}
|
|
4188
4194
|
try {
|
|
4189
4195
|
await d.mutateAsync({
|
|
@@ -4191,9 +4197,9 @@ function yr({ job: t, onClose: a }) {
|
|
|
4191
4197
|
params: h,
|
|
4192
4198
|
dry_run: l,
|
|
4193
4199
|
confirm: w ? _ : void 0
|
|
4194
|
-
}),
|
|
4200
|
+
}), fe.success(s("jobs.run_started", { name: t.name })), a();
|
|
4195
4201
|
} catch (N) {
|
|
4196
|
-
|
|
4202
|
+
fe.error(N instanceof Error ? N.message : s("jobs.run_failed"));
|
|
4197
4203
|
}
|
|
4198
4204
|
};
|
|
4199
4205
|
return (
|
|
@@ -4202,17 +4208,17 @@ function yr({ job: t, onClose: a }) {
|
|
|
4202
4208
|
// close button positions itself with `rtl:` utilities that key off the RTL <body>
|
|
4203
4209
|
// ancestor, so force it back to the right edge for this LTR island.
|
|
4204
4210
|
/* @__PURE__ */ r(
|
|
4205
|
-
|
|
4211
|
+
Le,
|
|
4206
4212
|
{
|
|
4207
4213
|
dir: "ltr",
|
|
4208
4214
|
className: "max-w-lg text-left [&_[data-slot=dialog-close]]:!right-4 [&_[data-slot=dialog-close]]:!left-auto",
|
|
4209
4215
|
children: [
|
|
4210
|
-
/* @__PURE__ */ r(
|
|
4211
|
-
/* @__PURE__ */ r(
|
|
4216
|
+
/* @__PURE__ */ r(qe, { className: "text-left", children: [
|
|
4217
|
+
/* @__PURE__ */ r(je, { className: "flex items-center gap-2", children: [
|
|
4212
4218
|
t.name,
|
|
4213
|
-
/* @__PURE__ */ e(
|
|
4219
|
+
/* @__PURE__ */ e(Se, { variant: "outline", className: lt(t.danger), children: s(`jobs.danger.${t.danger}`) })
|
|
4214
4220
|
] }),
|
|
4215
|
-
t.description && /* @__PURE__ */ e(
|
|
4221
|
+
t.description && /* @__PURE__ */ e(Te, { children: t.description })
|
|
4216
4222
|
] }),
|
|
4217
4223
|
/* @__PURE__ */ r("div", { className: "space-y-4 py-2", children: [
|
|
4218
4224
|
t.params.map((h) => /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
@@ -4221,16 +4227,16 @@ function yr({ job: t, onClose: a }) {
|
|
|
4221
4227
|
h.required && /* @__PURE__ */ e("span", { className: "text-destructive ml-1", children: "*" })
|
|
4222
4228
|
] }),
|
|
4223
4229
|
h.type === "bool" ? /* @__PURE__ */ e("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e(
|
|
4224
|
-
|
|
4230
|
+
le,
|
|
4225
4231
|
{
|
|
4226
|
-
checked:
|
|
4227
|
-
onCheckedChange: (N) =>
|
|
4232
|
+
checked: o[h.name] === "true",
|
|
4233
|
+
onCheckedChange: (N) => i(h.name, N ? "true" : "false")
|
|
4228
4234
|
}
|
|
4229
4235
|
) }) : h.choices && h.choices.length > 0 ? /* @__PURE__ */ r(
|
|
4230
4236
|
"select",
|
|
4231
4237
|
{
|
|
4232
|
-
value:
|
|
4233
|
-
onChange: (N) =>
|
|
4238
|
+
value: o[h.name],
|
|
4239
|
+
onChange: (N) => i(h.name, N.target.value),
|
|
4234
4240
|
className: "w-full h-10 rounded-md border border-input bg-muted/20 px-3 text-sm",
|
|
4235
4241
|
children: [
|
|
4236
4242
|
/* @__PURE__ */ e("option", { value: "", children: "—" }),
|
|
@@ -4238,10 +4244,10 @@ function yr({ job: t, onClose: a }) {
|
|
|
4238
4244
|
]
|
|
4239
4245
|
}
|
|
4240
4246
|
) : h.type === "text" ? /* @__PURE__ */ e(
|
|
4241
|
-
|
|
4247
|
+
Ae,
|
|
4242
4248
|
{
|
|
4243
|
-
value:
|
|
4244
|
-
onChange: (N) =>
|
|
4249
|
+
value: o[h.name],
|
|
4250
|
+
onChange: (N) => i(h.name, N.target.value),
|
|
4245
4251
|
className: "bg-muted/20 font-mono text-xs",
|
|
4246
4252
|
rows: 4
|
|
4247
4253
|
}
|
|
@@ -4249,8 +4255,8 @@ function yr({ job: t, onClose: a }) {
|
|
|
4249
4255
|
se,
|
|
4250
4256
|
{
|
|
4251
4257
|
type: h.type === "int" || h.type === "float" ? "number" : "text",
|
|
4252
|
-
value:
|
|
4253
|
-
onChange: (N) =>
|
|
4258
|
+
value: o[h.name],
|
|
4259
|
+
onChange: (N) => i(h.name, N.target.value),
|
|
4254
4260
|
className: "bg-muted/20 border-transparent"
|
|
4255
4261
|
}
|
|
4256
4262
|
),
|
|
@@ -4258,15 +4264,15 @@ function yr({ job: t, onClose: a }) {
|
|
|
4258
4264
|
] }, h.name)),
|
|
4259
4265
|
t.supports_dry_run && /* @__PURE__ */ r("div", { className: "flex items-center justify-between rounded-xl border border-border/40 p-3", children: [
|
|
4260
4266
|
/* @__PURE__ */ r("div", { children: [
|
|
4261
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children:
|
|
4262
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/70", children:
|
|
4267
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium", children: s("jobs.dry_run") }),
|
|
4268
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/70", children: s("jobs.dry_run_help") })
|
|
4263
4269
|
] }),
|
|
4264
|
-
/* @__PURE__ */ e(
|
|
4270
|
+
/* @__PURE__ */ e(le, { checked: l, onCheckedChange: g })
|
|
4265
4271
|
] }),
|
|
4266
4272
|
w && /* @__PURE__ */ r("div", { className: "space-y-1.5", children: [
|
|
4267
4273
|
/* @__PURE__ */ r(U, { className: "text-xs font-bold text-destructive flex items-center gap-1.5", children: [
|
|
4268
4274
|
/* @__PURE__ */ e(Mt, { className: "size-3.5" }),
|
|
4269
|
-
|
|
4275
|
+
s("jobs.confirm_destructive", { name: t.name })
|
|
4270
4276
|
] }),
|
|
4271
4277
|
/* @__PURE__ */ e(
|
|
4272
4278
|
se,
|
|
@@ -4279,8 +4285,8 @@ function yr({ job: t, onClose: a }) {
|
|
|
4279
4285
|
)
|
|
4280
4286
|
] })
|
|
4281
4287
|
] }),
|
|
4282
|
-
/* @__PURE__ */ r(
|
|
4283
|
-
/* @__PURE__ */ e(
|
|
4288
|
+
/* @__PURE__ */ r(Je, { children: [
|
|
4289
|
+
/* @__PURE__ */ e(Ue, { asChild: !0, children: /* @__PURE__ */ e(ne, { variant: "ghost", children: s("cancel") }) }),
|
|
4284
4290
|
/* @__PURE__ */ r(
|
|
4285
4291
|
ne,
|
|
4286
4292
|
{
|
|
@@ -4288,8 +4294,8 @@ function yr({ job: t, onClose: a }) {
|
|
|
4288
4294
|
onClick: b,
|
|
4289
4295
|
disabled: !x || d.isPending,
|
|
4290
4296
|
children: [
|
|
4291
|
-
d.isPending ? /* @__PURE__ */ e(
|
|
4292
|
-
|
|
4297
|
+
d.isPending ? /* @__PURE__ */ e(Be, { className: "size-4 animate-spin" }) : /* @__PURE__ */ e(ze, { className: "size-4" }),
|
|
4298
|
+
s(l ? "jobs.run_dry" : "jobs.run")
|
|
4293
4299
|
]
|
|
4294
4300
|
}
|
|
4295
4301
|
)
|
|
@@ -4300,9 +4306,9 @@ function yr({ job: t, onClose: a }) {
|
|
|
4300
4306
|
);
|
|
4301
4307
|
}
|
|
4302
4308
|
function _r({ run: t }) {
|
|
4303
|
-
const { t: a } = F(["admin"]),
|
|
4309
|
+
const { t: a } = F(["admin"]), s = t.params && Object.keys(t.params).length > 0;
|
|
4304
4310
|
return /* @__PURE__ */ r("div", { className: "space-y-3 pt-3", dir: "ltr", children: [
|
|
4305
|
-
(
|
|
4311
|
+
(s || t.code) && /* @__PURE__ */ r("div", { children: [
|
|
4306
4312
|
/* @__PURE__ */ e(U, { className: "text-xs font-bold text-muted-foreground", children: a("jobs.inputs") }),
|
|
4307
4313
|
/* @__PURE__ */ e("pre", { className: "mt-1 max-h-40 overflow-auto rounded-lg bg-muted/30 border border-border/40 p-3 text-[11px] font-mono whitespace-pre-wrap", children: t.code ? t.code : JSON.stringify(t.params, null, 2) })
|
|
4308
4314
|
] }),
|
|
@@ -4322,7 +4328,7 @@ ${a("jobs.output_truncated")}` : ""
|
|
|
4322
4328
|
] });
|
|
4323
4329
|
}
|
|
4324
4330
|
function Nr({ summary: t }) {
|
|
4325
|
-
const { t: a, i18n:
|
|
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, {
|
|
4326
4332
|
dateStyle: "short",
|
|
4327
4333
|
timeStyle: "short"
|
|
4328
4334
|
});
|
|
@@ -4331,17 +4337,17 @@ function Nr({ summary: t }) {
|
|
|
4331
4337
|
"button",
|
|
4332
4338
|
{
|
|
4333
4339
|
type: "button",
|
|
4334
|
-
onClick: () =>
|
|
4340
|
+
onClick: () => o((w) => !w),
|
|
4335
4341
|
className: "w-full flex items-center justify-between gap-3 p-3 text-start hover:bg-muted/10 transition-all",
|
|
4336
4342
|
children: [
|
|
4337
4343
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
4338
4344
|
/* @__PURE__ */ e(
|
|
4339
|
-
|
|
4345
|
+
nt,
|
|
4340
4346
|
{
|
|
4341
4347
|
className: `size-3.5 text-muted-foreground/60 shrink-0 transition-transform ${d ? "" : "-rotate-90"}`
|
|
4342
4348
|
}
|
|
4343
4349
|
),
|
|
4344
|
-
/* @__PURE__ */ e(
|
|
4350
|
+
/* @__PURE__ */ e(Se, { variant: "outline", className: vr(_.status), children: a(`jobs.status.${_.status}`) }),
|
|
4345
4351
|
/* @__PURE__ */ e("span", { className: "text-sm truncate", children: _.name }),
|
|
4346
4352
|
_.dry_run && /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground/60", children: [
|
|
4347
4353
|
"(",
|
|
@@ -4356,7 +4362,7 @@ function Nr({ summary: t }) {
|
|
|
4356
4362
|
]
|
|
4357
4363
|
}
|
|
4358
4364
|
),
|
|
4359
|
-
d && /* @__PURE__ */ e("div", { className: "px-3 pb-3", children: l ? /* @__PURE__ */ r(
|
|
4365
|
+
d && /* @__PURE__ */ e("div", { className: "px-3 pb-3", children: l ? /* @__PURE__ */ r(et, { children: [
|
|
4360
4366
|
/* @__PURE__ */ e(_r, { run: _ }),
|
|
4361
4367
|
n && /* @__PURE__ */ r(
|
|
4362
4368
|
ne,
|
|
@@ -4367,34 +4373,34 @@ function Nr({ summary: t }) {
|
|
|
4367
4373
|
onClick: () => g.mutate(_.id),
|
|
4368
4374
|
disabled: g.isPending,
|
|
4369
4375
|
children: [
|
|
4370
|
-
/* @__PURE__ */ e(
|
|
4376
|
+
/* @__PURE__ */ e($t, { className: "size-3.5" }),
|
|
4371
4377
|
a("jobs.cancel_run")
|
|
4372
4378
|
]
|
|
4373
4379
|
}
|
|
4374
4380
|
)
|
|
4375
4381
|
] }) : /* @__PURE__ */ r("div", { className: "flex items-center gap-2 py-4 text-xs text-muted-foreground/60", children: [
|
|
4376
|
-
/* @__PURE__ */ e(
|
|
4382
|
+
/* @__PURE__ */ e(Be, { className: "size-3.5 animate-spin" }),
|
|
4377
4383
|
a("loading")
|
|
4378
4384
|
] }) })
|
|
4379
4385
|
] });
|
|
4380
4386
|
}
|
|
4381
4387
|
function wr({ runs: t }) {
|
|
4382
4388
|
const { t: a } = F(["admin"]);
|
|
4383
|
-
return /* @__PURE__ */ r(
|
|
4384
|
-
/* @__PURE__ */ r(
|
|
4385
|
-
/* @__PURE__ */ e(
|
|
4386
|
-
/* @__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") })
|
|
4387
4393
|
] }),
|
|
4388
|
-
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((
|
|
4389
|
-
/* @__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") }) }) })
|
|
4390
4396
|
] });
|
|
4391
4397
|
}
|
|
4392
4398
|
function kr() {
|
|
4393
|
-
const { t } = F(["admin"]), { runRawJob: a } =
|
|
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 () => {
|
|
4394
4400
|
try {
|
|
4395
|
-
await a.mutateAsync({ code:
|
|
4401
|
+
await a.mutateAsync({ code: o, confirm_phrase: l }), fe.success(t("jobs.run_started", { name: "Raw Python" })), n(""), g("");
|
|
4396
4402
|
} catch (w) {
|
|
4397
|
-
|
|
4403
|
+
fe.error(w instanceof Error ? w.message : t("jobs.run_failed"));
|
|
4398
4404
|
}
|
|
4399
4405
|
};
|
|
4400
4406
|
return /* @__PURE__ */ r("div", { className: "rounded-2xl border border-destructive/30 bg-destructive/5 overflow-hidden", children: [
|
|
@@ -4406,25 +4412,25 @@ function kr() {
|
|
|
4406
4412
|
className: "w-full flex items-center justify-between gap-2 p-4 text-start",
|
|
4407
4413
|
children: [
|
|
4408
4414
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
4409
|
-
/* @__PURE__ */ e(
|
|
4415
|
+
/* @__PURE__ */ e(Rt, { className: "size-4 text-destructive" }),
|
|
4410
4416
|
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-destructive", children: t("jobs.raw.title") })
|
|
4411
4417
|
] }),
|
|
4412
4418
|
/* @__PURE__ */ e(
|
|
4413
|
-
|
|
4419
|
+
nt,
|
|
4414
4420
|
{
|
|
4415
|
-
className: `size-4 text-destructive/70 transition-transform ${
|
|
4421
|
+
className: `size-4 text-destructive/70 transition-transform ${s ? "" : "-rotate-90"}`
|
|
4416
4422
|
}
|
|
4417
4423
|
)
|
|
4418
4424
|
]
|
|
4419
4425
|
}
|
|
4420
4426
|
),
|
|
4421
|
-
|
|
4427
|
+
s && /* @__PURE__ */ r("div", { className: "px-4 pb-4 space-y-4", children: [
|
|
4422
4428
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/80", children: t("jobs.raw.warning") }),
|
|
4423
4429
|
/* @__PURE__ */ e(
|
|
4424
|
-
|
|
4430
|
+
Ae,
|
|
4425
4431
|
{
|
|
4426
4432
|
dir: "ltr",
|
|
4427
|
-
value:
|
|
4433
|
+
value: o,
|
|
4428
4434
|
onChange: (w) => n(w.target.value),
|
|
4429
4435
|
rows: 8,
|
|
4430
4436
|
spellCheck: !1,
|
|
@@ -4453,7 +4459,7 @@ result = {"ok": True}`,
|
|
|
4453
4459
|
onClick: S,
|
|
4454
4460
|
disabled: !_ || a.isPending,
|
|
4455
4461
|
children: [
|
|
4456
|
-
a.isPending ? /* @__PURE__ */ e(
|
|
4462
|
+
a.isPending ? /* @__PURE__ */ e(Be, { className: "size-4 animate-spin" }) : /* @__PURE__ */ e(ze, { className: "size-4" }),
|
|
4457
4463
|
t("jobs.raw.run")
|
|
4458
4464
|
]
|
|
4459
4465
|
}
|
|
@@ -4462,48 +4468,48 @@ result = {"ok": True}`,
|
|
|
4462
4468
|
] });
|
|
4463
4469
|
}
|
|
4464
4470
|
function Cr() {
|
|
4465
|
-
const { t } = F(["admin"]), a =
|
|
4466
|
-
if (!
|
|
4467
|
-
const w =
|
|
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);
|
|
4472
|
+
if (!s) return null;
|
|
4473
|
+
const w = o?.jobs || [], x = n?.runs || [];
|
|
4468
4474
|
return /* @__PURE__ */ r("section", { children: [
|
|
4469
|
-
/* @__PURE__ */ e(
|
|
4475
|
+
/* @__PURE__ */ e(ye, { title: t("jobs.section_title"), icon: Dt }),
|
|
4470
4476
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-8", children: [
|
|
4471
4477
|
/* @__PURE__ */ r("div", { className: "space-y-3 text-left", dir: "ltr", children: [
|
|
4472
4478
|
w.length === 0 && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground/70 italic", children: t("jobs.no_jobs") }),
|
|
4473
|
-
w.map((
|
|
4479
|
+
w.map((i) => /* @__PURE__ */ r(
|
|
4474
4480
|
"div",
|
|
4475
4481
|
{
|
|
4476
4482
|
className: "flex items-center justify-between gap-4 rounded-2xl border border-border/40 p-4 hover:bg-muted/5 transition-all",
|
|
4477
4483
|
children: [
|
|
4478
4484
|
/* @__PURE__ */ r("div", { className: "min-w-0", children: [
|
|
4479
4485
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
4480
|
-
/* @__PURE__ */ e("p", { className: "text-sm font-bold truncate", children:
|
|
4481
|
-
/* @__PURE__ */ e(
|
|
4486
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-bold truncate", children: i.name }),
|
|
4487
|
+
/* @__PURE__ */ e(Se, { variant: "outline", className: lt(i.danger), children: t(`jobs.danger.${i.danger}`) })
|
|
4482
4488
|
] }),
|
|
4483
|
-
|
|
4489
|
+
i.description && /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground/70 mt-0.5 line-clamp-2", children: i.description })
|
|
4484
4490
|
] }),
|
|
4485
|
-
/* @__PURE__ */ r(ne, { variant: "outline", size: "sm", onClick: () => g(
|
|
4486
|
-
/* @__PURE__ */ e(
|
|
4491
|
+
/* @__PURE__ */ r(ne, { variant: "outline", size: "sm", onClick: () => g(i), children: [
|
|
4492
|
+
/* @__PURE__ */ e(ze, { className: "size-3.5" }),
|
|
4487
4493
|
t("jobs.run")
|
|
4488
4494
|
] })
|
|
4489
4495
|
]
|
|
4490
4496
|
},
|
|
4491
|
-
|
|
4497
|
+
i.id
|
|
4492
4498
|
))
|
|
4493
4499
|
] }),
|
|
4494
4500
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ r(ne, { variant: "outline", size: "sm", onClick: () => S(!0), children: [
|
|
4495
|
-
/* @__PURE__ */ e(
|
|
4501
|
+
/* @__PURE__ */ e(It, { className: "size-3.5" }),
|
|
4496
4502
|
t("jobs.view_history"),
|
|
4497
|
-
x.length > 0 && /* @__PURE__ */ e(
|
|
4503
|
+
x.length > 0 && /* @__PURE__ */ e(Se, { variant: "secondary", className: "ml-1", children: x.length })
|
|
4498
4504
|
] }) }),
|
|
4499
4505
|
d && /* @__PURE__ */ e(kr, {})
|
|
4500
4506
|
] }),
|
|
4501
|
-
/* @__PURE__ */ e(
|
|
4502
|
-
/* @__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 }) })
|
|
4503
4509
|
] });
|
|
4504
4510
|
}
|
|
4505
4511
|
function Sr({ translations: t, onChange: a }) {
|
|
4506
|
-
const { t:
|
|
4512
|
+
const { t: s } = F(["admin"]), [d, o] = y("fa"), [n, l] = y("translation"), [g, _] = y("{}"), [S, w] = y("");
|
|
4507
4513
|
H(() => {
|
|
4508
4514
|
const h = t?.[d]?.[n] || {};
|
|
4509
4515
|
_(JSON.stringify(h, null, 2)), w("");
|
|
@@ -4522,9 +4528,9 @@ function Sr({ translations: t, onChange: a }) {
|
|
|
4522
4528
|
} catch {
|
|
4523
4529
|
w("Invalid JSON format");
|
|
4524
4530
|
}
|
|
4525
|
-
},
|
|
4531
|
+
}, i = () => {
|
|
4526
4532
|
const h = prompt("Enter language code (e.g. en, fa, fr):");
|
|
4527
|
-
h && !t?.[h] && (a({ ...t, [h]: {} }),
|
|
4533
|
+
h && !t?.[h] && (a({ ...t, [h]: {} }), o(h));
|
|
4528
4534
|
}, b = () => {
|
|
4529
4535
|
const h = prompt("Enter namespace (e.g. chat, admin):");
|
|
4530
4536
|
h && !t?.[d]?.[h] && (a({
|
|
@@ -4538,8 +4544,8 @@ function Sr({ translations: t, onChange: a }) {
|
|
|
4538
4544
|
return /* @__PURE__ */ r("div", { className: "border border-border/60 rounded-2xl overflow-hidden bg-background", children: [
|
|
4539
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: [
|
|
4540
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: [
|
|
4541
|
-
/* @__PURE__ */ e("div", { className: "p-2 px-3 bg-muted/20 rounded-lg border border-border/40 ml-1", children: /* @__PURE__ */ e(
|
|
4542
|
-
/* @__PURE__ */ r(X, { value: d, onValueChange:
|
|
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" }) }),
|
|
4548
|
+
/* @__PURE__ */ r(X, { value: d, onValueChange: o, children: [
|
|
4543
4549
|
/* @__PURE__ */ e(
|
|
4544
4550
|
Y,
|
|
4545
4551
|
{
|
|
@@ -4568,10 +4574,10 @@ function Sr({ translations: t, onChange: a }) {
|
|
|
4568
4574
|
"button",
|
|
4569
4575
|
{
|
|
4570
4576
|
type: "button",
|
|
4571
|
-
onClick:
|
|
4577
|
+
onClick: i,
|
|
4572
4578
|
title: "Add Language",
|
|
4573
4579
|
className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40",
|
|
4574
|
-
children: /* @__PURE__ */ e(
|
|
4580
|
+
children: /* @__PURE__ */ e(Ot, { className: "size-4" })
|
|
4575
4581
|
}
|
|
4576
4582
|
),
|
|
4577
4583
|
/* @__PURE__ */ e(
|
|
@@ -4581,7 +4587,7 @@ function Sr({ translations: t, onChange: a }) {
|
|
|
4581
4587
|
onClick: b,
|
|
4582
4588
|
title: "Add Namespace",
|
|
4583
4589
|
className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40",
|
|
4584
|
-
children: /* @__PURE__ */ e(
|
|
4590
|
+
children: /* @__PURE__ */ e(Fe, { className: "size-4" })
|
|
4585
4591
|
}
|
|
4586
4592
|
)
|
|
4587
4593
|
] })
|
|
@@ -4589,10 +4595,10 @@ function Sr({ translations: t, onChange: a }) {
|
|
|
4589
4595
|
/* @__PURE__ */ r("div", { className: "relative p-6", children: [
|
|
4590
4596
|
/* @__PURE__ */ r("div", { className: "absolute top-8 right-10 flex items-center gap-2", children: [
|
|
4591
4597
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted-foreground/40 uppercase tracking-widest", children: "JSON EDITOR" }),
|
|
4592
|
-
/* @__PURE__ */ e(
|
|
4598
|
+
/* @__PURE__ */ e(Et, { className: "size-3 text-muted-foreground/30" })
|
|
4593
4599
|
] }),
|
|
4594
4600
|
/* @__PURE__ */ e(
|
|
4595
|
-
|
|
4601
|
+
Ae,
|
|
4596
4602
|
{
|
|
4597
4603
|
value: g,
|
|
4598
4604
|
onChange: (h) => x(h.target.value),
|
|
@@ -4607,35 +4613,35 @@ function Sr({ translations: t, onChange: a }) {
|
|
|
4607
4613
|
] })
|
|
4608
4614
|
] }),
|
|
4609
4615
|
/* @__PURE__ */ e("div", { className: "p-6 bg-muted/5 border-t border-border/40 flex items-center justify-between", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
4610
|
-
/* @__PURE__ */ e("div", { className: "p-1 px-2 bg-primary/5 rounded border border-primary/10", children: /* @__PURE__ */ e("span", { className: "text-[10px] font-black text-primary uppercase", children:
|
|
4611
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-muted-foreground/60 font-medium", children:
|
|
4616
|
+
/* @__PURE__ */ e("div", { className: "p-1 px-2 bg-primary/5 rounded border border-primary/10", children: /* @__PURE__ */ e("span", { className: "text-[10px] font-black text-primary uppercase", children: s("app_settings.tips_label", { defaultValue: "TIPS" }) }) }),
|
|
4617
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] text-muted-foreground/60 font-medium", children: s("app_settings.editor_tips") })
|
|
4612
4618
|
] }) })
|
|
4613
4619
|
] });
|
|
4614
4620
|
}
|
|
4615
4621
|
function Lr() {
|
|
4616
4622
|
const { t, i18n: a } = F(["admin", "translation", "settings"]), {
|
|
4617
|
-
app:
|
|
4623
|
+
app: s,
|
|
4618
4624
|
welcome: d,
|
|
4619
|
-
disclaimer:
|
|
4625
|
+
disclaimer: o,
|
|
4620
4626
|
history: n,
|
|
4621
4627
|
threadActions: l,
|
|
4622
4628
|
composer: g,
|
|
4623
4629
|
theme: _,
|
|
4624
4630
|
settings: S
|
|
4625
|
-
} =
|
|
4631
|
+
} = be(), [w, x] = y(!1), [i, b] = y(!1), [h, N] = y(""), [D, p] = y(""), [R, c] = y(!1), f = he(
|
|
4626
4632
|
() => ({
|
|
4627
|
-
app_name:
|
|
4628
|
-
admin_title:
|
|
4633
|
+
app_name: s?.name || "Gentiq",
|
|
4634
|
+
admin_title: s?.adminTitle || "",
|
|
4629
4635
|
default_theme: _?.defaultTheme || "system",
|
|
4630
4636
|
default_accent: _?.accent || "oklch(0.623 0.214 259.815)",
|
|
4631
4637
|
welcome_greeting: typeof d?.greeting == "string" ? d.greeting : "",
|
|
4632
4638
|
welcome_subtitle: d?.subtitle || "",
|
|
4633
|
-
disclaimer: typeof
|
|
4634
|
-
show_tool_details:
|
|
4635
|
-
show_settings:
|
|
4636
|
-
show_version_in_settings:
|
|
4637
|
-
disable_signup:
|
|
4638
|
-
disable_auth_page:
|
|
4639
|
+
disclaimer: typeof o == "string" ? o : "",
|
|
4640
|
+
show_tool_details: s?.showToolDetails ?? !0,
|
|
4641
|
+
show_settings: s?.showSettings ?? !0,
|
|
4642
|
+
show_version_in_settings: s?.showVersionInSettings ?? !0,
|
|
4643
|
+
disable_signup: s?.disableSignup ?? !1,
|
|
4644
|
+
disable_auth_page: s?.disableAuthPage ?? !1,
|
|
4639
4645
|
composer_attachments: g?.attachments?.enabled ?? !0,
|
|
4640
4646
|
thread_actions_feedback: l?.feedback ?? !0,
|
|
4641
4647
|
thread_actions_retry: l?.retry ?? !0,
|
|
@@ -4644,9 +4650,9 @@ function Lr() {
|
|
|
4644
4650
|
history_show_rename: n?.showRename ?? !0,
|
|
4645
4651
|
history_show_share: n?.showShare ?? !0,
|
|
4646
4652
|
history_show_pin: n?.showPin ?? !0,
|
|
4647
|
-
settings_general_mode:
|
|
4648
|
-
settings_profile_mode:
|
|
4649
|
-
settings_account_mode:
|
|
4653
|
+
settings_general_mode: s?.settingsGeneralMode || "editable",
|
|
4654
|
+
settings_profile_mode: s?.settingsProfileMode || "editable",
|
|
4655
|
+
settings_account_mode: s?.settingsAccountMode || "editable",
|
|
4650
4656
|
settings_general_fields: S?.sections?.general?.fields || {},
|
|
4651
4657
|
settings_profile_fields: S?.sections?.profile?.fields || {},
|
|
4652
4658
|
settings_account_fields: S?.sections?.account?.fields || {},
|
|
@@ -4656,9 +4662,9 @@ function Lr() {
|
|
|
4656
4662
|
translations: {}
|
|
4657
4663
|
}),
|
|
4658
4664
|
[
|
|
4659
|
-
i,
|
|
4660
|
-
d,
|
|
4661
4665
|
s,
|
|
4666
|
+
d,
|
|
4667
|
+
o,
|
|
4662
4668
|
n,
|
|
4663
4669
|
l,
|
|
4664
4670
|
g,
|
|
@@ -4666,16 +4672,16 @@ function Lr() {
|
|
|
4666
4672
|
a.language,
|
|
4667
4673
|
S
|
|
4668
4674
|
]
|
|
4669
|
-
), [C, L] = y(f),
|
|
4675
|
+
), [C, L] = y(f), $ = a.language === "fa", v = (C.default_accent || "").trim(), O = !v || typeof CSS < "u" && CSS.supports("color", v);
|
|
4670
4676
|
H(() => {
|
|
4671
4677
|
(async () => {
|
|
4672
4678
|
x(!0);
|
|
4673
4679
|
try {
|
|
4674
4680
|
const m = await T.getSettings();
|
|
4675
4681
|
if (m && Object.keys(m).length > 0) {
|
|
4676
|
-
const
|
|
4682
|
+
const q = JSON.parse(JSON.stringify(a.store.data));
|
|
4677
4683
|
m.translations && Object.keys(m.translations).forEach((A) => {
|
|
4678
|
-
|
|
4684
|
+
q[A] || (q[A] = {}), Object.assign(q[A], m.translations[A]);
|
|
4679
4685
|
}), L((A) => ({
|
|
4680
4686
|
...A,
|
|
4681
4687
|
...m,
|
|
@@ -4684,14 +4690,14 @@ function Lr() {
|
|
|
4684
4690
|
settings_general_fields: m.settings_general_fields ?? A.settings_general_fields,
|
|
4685
4691
|
settings_profile_fields: m.settings_profile_fields ?? A.settings_profile_fields,
|
|
4686
4692
|
settings_account_fields: m.settings_account_fields ?? A.settings_account_fields,
|
|
4687
|
-
translations:
|
|
4693
|
+
translations: q
|
|
4688
4694
|
}));
|
|
4689
4695
|
} else {
|
|
4690
|
-
const
|
|
4696
|
+
const q = {
|
|
4691
4697
|
...f,
|
|
4692
4698
|
translations: a.store.data
|
|
4693
4699
|
};
|
|
4694
|
-
L(
|
|
4700
|
+
L(q), m || T.updateSettings(q).catch(console.error);
|
|
4695
4701
|
}
|
|
4696
4702
|
} catch (m) {
|
|
4697
4703
|
console.error("Failed to fetch settings", m), N(t("app_settings.save_error"));
|
|
@@ -4719,7 +4725,7 @@ function Lr() {
|
|
|
4719
4725
|
}, Z = async () => {
|
|
4720
4726
|
x(!0), N("");
|
|
4721
4727
|
try {
|
|
4722
|
-
await T.resetSettings(),
|
|
4728
|
+
await T.resetSettings(), c(!1), window.location.reload();
|
|
4723
4729
|
} catch (k) {
|
|
4724
4730
|
N(k instanceof Error ? k.message : t("app_settings.save_error"));
|
|
4725
4731
|
} finally {
|
|
@@ -4729,38 +4735,38 @@ function Lr() {
|
|
|
4729
4735
|
return w ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3", children: [
|
|
4730
4736
|
/* @__PURE__ */ e("div", { className: "w-10 h-10 border-3 border-primary/20 border-t-primary rounded-full animate-spin" }),
|
|
4731
4737
|
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground font-medium", children: t("loading") })
|
|
4732
|
-
] }) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col overflow-hidden", dir:
|
|
4738
|
+
] }) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col overflow-hidden", dir: $ ? "rtl" : "ltr", children: [
|
|
4733
4739
|
/* @__PURE__ */ r("div", { className: "px-8 py-6 border-b border-border bg-background/50 backdrop-blur-md z-20 flex items-center justify-between flex-shrink-0", children: [
|
|
4734
4740
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
4735
4741
|
/* @__PURE__ */ r("div", { className: "flex items-baseline gap-3 flex-wrap", children: [
|
|
4736
4742
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight", children: t("app_settings.title") }),
|
|
4737
|
-
|
|
4743
|
+
s?.version && /* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground font-mono", dir: "ltr", children: [
|
|
4738
4744
|
"v",
|
|
4739
|
-
|
|
4745
|
+
s.version
|
|
4740
4746
|
] })
|
|
4741
4747
|
] }),
|
|
4742
4748
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("app_settings.subtitle") })
|
|
4743
4749
|
] }),
|
|
4744
4750
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: [
|
|
4745
|
-
/* @__PURE__ */ r(
|
|
4746
|
-
/* @__PURE__ */ e(
|
|
4751
|
+
/* @__PURE__ */ r(Ce, { open: R, onOpenChange: c, children: [
|
|
4752
|
+
/* @__PURE__ */ e(ht, { asChild: !0, children: /* @__PURE__ */ r(
|
|
4747
4753
|
"button",
|
|
4748
4754
|
{
|
|
4749
4755
|
type: "button",
|
|
4750
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",
|
|
4751
4757
|
children: [
|
|
4752
|
-
/* @__PURE__ */ e(
|
|
4758
|
+
/* @__PURE__ */ e(at, { className: "size-3.5" }),
|
|
4753
4759
|
t("app_settings.reset_button", { defaultValue: "Reset to Defaults" })
|
|
4754
4760
|
]
|
|
4755
4761
|
}
|
|
4756
4762
|
) }),
|
|
4757
|
-
/* @__PURE__ */ r(
|
|
4758
|
-
/* @__PURE__ */ r(
|
|
4759
|
-
/* @__PURE__ */ e(
|
|
4760
|
-
/* @__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") })
|
|
4761
4767
|
] }),
|
|
4762
|
-
/* @__PURE__ */ r(
|
|
4763
|
-
/* @__PURE__ */ e(
|
|
4768
|
+
/* @__PURE__ */ r(Je, { children: [
|
|
4769
|
+
/* @__PURE__ */ e(Ue, { asChild: !0, children: /* @__PURE__ */ e(ne, { variant: "ghost", children: t("cancel") }) }),
|
|
4764
4770
|
/* @__PURE__ */ e(ne, { variant: "destructive", onClick: Z, children: t("app_settings.reset_button") })
|
|
4765
4771
|
] })
|
|
4766
4772
|
] })
|
|
@@ -4770,22 +4776,22 @@ function Lr() {
|
|
|
4770
4776
|
{
|
|
4771
4777
|
type: "submit",
|
|
4772
4778
|
form: "settings-form",
|
|
4773
|
-
disabled:
|
|
4779
|
+
disabled: i || !O,
|
|
4774
4780
|
className: "px-8 py-2.5 bg-primary text-primary-foreground rounded-xl text-sm font-bold hover:opacity-90 transition-all shadow-md hover:shadow-lg disabled:opacity-50 flex items-center gap-2",
|
|
4775
4781
|
children: [
|
|
4776
|
-
|
|
4777
|
-
t(
|
|
4782
|
+
i && /* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-primary-foreground/20 border-t-primary-foreground rounded-full animate-spin" }),
|
|
4783
|
+
t(i ? "saving" : "app_settings.save")
|
|
4778
4784
|
]
|
|
4779
4785
|
}
|
|
4780
4786
|
)
|
|
4781
4787
|
] })
|
|
4782
4788
|
] }),
|
|
4783
4789
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto custom-scrollbar", children: /* @__PURE__ */ r("div", { className: "max-w-4xl mx-auto py-10 px-8", children: [
|
|
4784
|
-
(h ||
|
|
4790
|
+
(h || D) && /* @__PURE__ */ e(
|
|
4785
4791
|
"div",
|
|
4786
4792
|
{
|
|
4787
4793
|
className: `mb-12 px-4 py-3 rounded-xl text-sm border animate-in fade-in slide-in-from-top-1 duration-300 ${h ? "bg-destructive/10 border-destructive/20 text-destructive" : "bg-green-500/10 border-green-500/20 text-green-600 dark:text-green-400"}`,
|
|
4788
|
-
children: h ||
|
|
4794
|
+
children: h || D
|
|
4789
4795
|
}
|
|
4790
4796
|
),
|
|
4791
4797
|
/* @__PURE__ */ r(
|
|
@@ -4809,12 +4815,12 @@ function Lr() {
|
|
|
4809
4815
|
{
|
|
4810
4816
|
settings: C,
|
|
4811
4817
|
setSettings: L,
|
|
4812
|
-
userMetadataFields:
|
|
4813
|
-
isRtl:
|
|
4818
|
+
userMetadataFields: s?.userMetadataFields || [],
|
|
4819
|
+
isRtl: $
|
|
4814
4820
|
}
|
|
4815
4821
|
),
|
|
4816
4822
|
/* @__PURE__ */ r("section", { children: [
|
|
4817
|
-
/* @__PURE__ */ e(
|
|
4823
|
+
/* @__PURE__ */ e(ye, { title: t("app_settings.sections.user_billing"), icon: Ft }),
|
|
4818
4824
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
4819
4825
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
4820
4826
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
@@ -4854,7 +4860,7 @@ function Lr() {
|
|
|
4854
4860
|
] })
|
|
4855
4861
|
] }),
|
|
4856
4862
|
/* @__PURE__ */ r("section", { children: [
|
|
4857
|
-
/* @__PURE__ */ e(
|
|
4863
|
+
/* @__PURE__ */ e(ye, { title: t("app_settings.translations_management"), icon: Pt }),
|
|
4858
4864
|
/* @__PURE__ */ e(
|
|
4859
4865
|
Sr,
|
|
4860
4866
|
{
|
|
@@ -4870,15 +4876,15 @@ function Lr() {
|
|
|
4870
4876
|
] }) })
|
|
4871
4877
|
] });
|
|
4872
4878
|
}
|
|
4873
|
-
function
|
|
4874
|
-
const { t, i18n: a } = F(["admin"]),
|
|
4879
|
+
function ge() {
|
|
4880
|
+
const { t, i18n: a } = F(["admin"]), s = a.language === "fa";
|
|
4875
4881
|
return /* @__PURE__ */ r(
|
|
4876
4882
|
"div",
|
|
4877
4883
|
{
|
|
4878
4884
|
className: "h-full flex flex-col items-center justify-center p-6 text-center gap-4 animate-in fade-in duration-500",
|
|
4879
|
-
dir:
|
|
4885
|
+
dir: s ? "rtl" : "ltr",
|
|
4880
4886
|
children: [
|
|
4881
|
-
/* @__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" }) }),
|
|
4882
4888
|
/* @__PURE__ */ r("div", { className: "space-y-1 max-w-sm", children: [
|
|
4883
4889
|
/* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground tracking-tight", children: t("errors.access_denied_title", "Access Denied") }),
|
|
4884
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.") })
|
|
@@ -4888,21 +4894,21 @@ function fe() {
|
|
|
4888
4894
|
);
|
|
4889
4895
|
}
|
|
4890
4896
|
const qr = ({ className: t }) => {
|
|
4891
|
-
const { t: a } = F(["theme"]), { theme:
|
|
4892
|
-
d(
|
|
4897
|
+
const { t: a } = F(["theme"]), { theme: s, setTheme: d } = Pe(), o = () => {
|
|
4898
|
+
d(s === "system" ? "light" : s === "light" ? "dark" : "system");
|
|
4893
4899
|
}, n = () => {
|
|
4894
|
-
switch (
|
|
4900
|
+
switch (s) {
|
|
4895
4901
|
case "light":
|
|
4896
|
-
return /* @__PURE__ */ e(Bt, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
4897
|
-
case "dark":
|
|
4898
4902
|
return /* @__PURE__ */ e(zt, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
4903
|
+
case "dark":
|
|
4904
|
+
return /* @__PURE__ */ e(Ut, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
4899
4905
|
case "system":
|
|
4900
|
-
return /* @__PURE__ */ e(
|
|
4906
|
+
return /* @__PURE__ */ e(Ze, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
4901
4907
|
default:
|
|
4902
|
-
return /* @__PURE__ */ e(
|
|
4908
|
+
return /* @__PURE__ */ e(Ze, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
4903
4909
|
}
|
|
4904
4910
|
}, l = () => {
|
|
4905
|
-
switch (
|
|
4911
|
+
switch (s) {
|
|
4906
4912
|
case "light":
|
|
4907
4913
|
return a("dark");
|
|
4908
4914
|
case "dark":
|
|
@@ -4913,16 +4919,16 @@ const qr = ({ className: t }) => {
|
|
|
4913
4919
|
return a("toggle");
|
|
4914
4920
|
}
|
|
4915
4921
|
};
|
|
4916
|
-
return /* @__PURE__ */ r(
|
|
4917
|
-
/* @__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: [
|
|
4918
4924
|
n(),
|
|
4919
4925
|
/* @__PURE__ */ e("span", { className: "sr-only", children: a("toggle") })
|
|
4920
4926
|
] }) }),
|
|
4921
|
-
/* @__PURE__ */ e(
|
|
4927
|
+
/* @__PURE__ */ e(Ee, { children: l() })
|
|
4922
4928
|
] });
|
|
4923
4929
|
};
|
|
4924
4930
|
function jr({ extraPages: t = [], disabledPages: a = [] }) {
|
|
4925
|
-
const
|
|
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");
|
|
4926
4932
|
H(() => {
|
|
4927
4933
|
if (g === "system") {
|
|
4928
4934
|
const v = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -4930,7 +4936,7 @@ function jr({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
4930
4936
|
} else
|
|
4931
4937
|
h(g);
|
|
4932
4938
|
}, [g]);
|
|
4933
|
-
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";
|
|
4934
4940
|
H(() => {
|
|
4935
4941
|
const v = localStorage.getItem("admin_info");
|
|
4936
4942
|
if (v)
|
|
@@ -4938,32 +4944,32 @@ function jr({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
4938
4944
|
const P = JSON.parse(v).permissions || [];
|
|
4939
4945
|
if (S(P), d.pathname === "/admin" || d.pathname === "/admin/")
|
|
4940
4946
|
if (P.includes("analytics") && !a.includes("analytics"))
|
|
4941
|
-
|
|
4947
|
+
s("/admin/analytics", { replace: !0 });
|
|
4942
4948
|
else if (P.includes("chat_history") && !a.includes("chat_history"))
|
|
4943
|
-
|
|
4949
|
+
s("/admin/chat-history", { replace: !0 });
|
|
4944
4950
|
else if (P.includes("user_management") && !a.includes("user_management"))
|
|
4945
|
-
|
|
4951
|
+
s("/admin/users", { replace: !0 });
|
|
4946
4952
|
else if (P.includes("admin_management") && !a.includes("admin_management"))
|
|
4947
|
-
|
|
4953
|
+
s("/admin/admins", { replace: !0 });
|
|
4948
4954
|
else if (P.includes("settings") && !a.includes("settings"))
|
|
4949
|
-
|
|
4955
|
+
s("/admin/settings", { replace: !0 });
|
|
4950
4956
|
else {
|
|
4951
4957
|
const Z = t.find(
|
|
4952
4958
|
(k) => !k.permission || P.includes(k.permission)
|
|
4953
4959
|
);
|
|
4954
|
-
Z &&
|
|
4960
|
+
Z && s(`/admin/${Z.path}`, { replace: !0 });
|
|
4955
4961
|
}
|
|
4956
4962
|
} catch (O) {
|
|
4957
4963
|
console.error("Failed to parse admin_info", O);
|
|
4958
4964
|
}
|
|
4959
4965
|
else
|
|
4960
4966
|
console.warn("DashboardPage: No adminInfo found in localStorage");
|
|
4961
|
-
}, [
|
|
4962
|
-
const
|
|
4967
|
+
}, [s, d.pathname]);
|
|
4968
|
+
const R = () => {
|
|
4963
4969
|
T.clearToken(), window.location.reload();
|
|
4964
|
-
},
|
|
4970
|
+
}, c = (v) => _.includes(v), f = (v) => _.includes(v) && !a.includes(v), C = Object.keys(n.services?.resourceStore?.data || {}).filter(
|
|
4965
4971
|
(v) => v !== "dev"
|
|
4966
|
-
), L = C.length > 0 ? C : ["en", "fa"],
|
|
4972
|
+
), L = C.length > 0 ? C : ["en", "fa"], $ = (v) => {
|
|
4967
4973
|
localStorage.setItem("gentiq-admin-language", v), n.changeLanguage(v), x(!1), document.activeElement instanceof HTMLElement && document.activeElement.blur();
|
|
4968
4974
|
};
|
|
4969
4975
|
return /* @__PURE__ */ r(
|
|
@@ -4975,56 +4981,56 @@ function jr({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
4975
4981
|
/* @__PURE__ */ e("header", { className: "glass border-b border-border sticky top-0 z-50", children: /* @__PURE__ */ e("div", { className: "px-8", children: /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-stretch justify-between min-h-[72px] gap-y-4", children: [
|
|
4976
4982
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-stretch gap-x-12", children: [
|
|
4977
4983
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3 py-4 md:py-0", children: [
|
|
4978
|
-
/* @__PURE__ */ e("img", { src: N, alt:
|
|
4979
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children:
|
|
4984
|
+
/* @__PURE__ */ e("img", { src: N, alt: D, className: "size-8 object-contain" }),
|
|
4985
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: D })
|
|
4980
4986
|
] }),
|
|
4981
4987
|
/* @__PURE__ */ r("nav", { className: "flex items-stretch gap-8", children: [
|
|
4982
4988
|
!a.includes("analytics") && /* @__PURE__ */ e(
|
|
4983
4989
|
"button",
|
|
4984
4990
|
{
|
|
4985
|
-
onClick: () =>
|
|
4991
|
+
onClick: () => s("/admin/analytics"),
|
|
4986
4992
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/analytics" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
4987
|
-
children:
|
|
4993
|
+
children: o("dashboard.tabs.analytics")
|
|
4988
4994
|
}
|
|
4989
4995
|
),
|
|
4990
4996
|
!a.includes("chat_history") && /* @__PURE__ */ e(
|
|
4991
4997
|
"button",
|
|
4992
4998
|
{
|
|
4993
|
-
onClick: () =>
|
|
4999
|
+
onClick: () => s("/admin/chat-history"),
|
|
4994
5000
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/chat-history" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
4995
|
-
children:
|
|
5001
|
+
children: o("dashboard.tabs.chat_history")
|
|
4996
5002
|
}
|
|
4997
5003
|
),
|
|
4998
5004
|
!a.includes("user_management") && /* @__PURE__ */ e(
|
|
4999
5005
|
"button",
|
|
5000
5006
|
{
|
|
5001
|
-
onClick: () =>
|
|
5007
|
+
onClick: () => s("/admin/users"),
|
|
5002
5008
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/users" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
5003
|
-
children:
|
|
5009
|
+
children: o("dashboard.tabs.users")
|
|
5004
5010
|
}
|
|
5005
5011
|
),
|
|
5006
5012
|
!a.includes("admin_management") && /* @__PURE__ */ e(
|
|
5007
5013
|
"button",
|
|
5008
5014
|
{
|
|
5009
|
-
onClick: () =>
|
|
5015
|
+
onClick: () => s("/admin/admins"),
|
|
5010
5016
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/admins" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
5011
|
-
children:
|
|
5017
|
+
children: o("dashboard.tabs.admins")
|
|
5012
5018
|
}
|
|
5013
5019
|
),
|
|
5014
5020
|
!a.includes("settings") && /* @__PURE__ */ e(
|
|
5015
5021
|
"button",
|
|
5016
5022
|
{
|
|
5017
|
-
onClick: () =>
|
|
5023
|
+
onClick: () => s("/admin/settings"),
|
|
5018
5024
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/settings" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
5019
|
-
children:
|
|
5025
|
+
children: o("dashboard.tabs.settings")
|
|
5020
5026
|
}
|
|
5021
5027
|
),
|
|
5022
5028
|
t.map((v) => /* @__PURE__ */ e(
|
|
5023
5029
|
"button",
|
|
5024
5030
|
{
|
|
5025
|
-
onClick: () =>
|
|
5031
|
+
onClick: () => s(`/admin/${v.path}`),
|
|
5026
5032
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === `/admin/${v.path}` ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
5027
|
-
children: typeof v.label == "string" ?
|
|
5033
|
+
children: typeof v.label == "string" ? o(v.label) : v.label
|
|
5028
5034
|
},
|
|
5029
5035
|
`tab-${v.path}`
|
|
5030
5036
|
))
|
|
@@ -5032,23 +5038,23 @@ function jr({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
5032
5038
|
] }),
|
|
5033
5039
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 py-4 md:py-0", children: [
|
|
5034
5040
|
/* @__PURE__ */ r(
|
|
5035
|
-
|
|
5041
|
+
pt,
|
|
5036
5042
|
{
|
|
5037
5043
|
onOpenChange: (v) => {
|
|
5038
|
-
v ? x(!1) : (
|
|
5039
|
-
|
|
5044
|
+
v ? x(!1) : (i.current = !0, setTimeout(() => {
|
|
5045
|
+
i.current = !1;
|
|
5040
5046
|
}, 200));
|
|
5041
5047
|
},
|
|
5042
5048
|
children: [
|
|
5043
5049
|
/* @__PURE__ */ r(
|
|
5044
|
-
|
|
5050
|
+
$e,
|
|
5045
5051
|
{
|
|
5046
5052
|
open: w,
|
|
5047
5053
|
onOpenChange: (v) => {
|
|
5048
|
-
v &&
|
|
5054
|
+
v && i.current || x(v);
|
|
5049
5055
|
},
|
|
5050
5056
|
children: [
|
|
5051
|
-
/* @__PURE__ */ e(
|
|
5057
|
+
/* @__PURE__ */ e(Oe, { asChild: !0, children: /* @__PURE__ */ e(gt, { asChild: !0, children: /* @__PURE__ */ e(
|
|
5052
5058
|
ne,
|
|
5053
5059
|
{
|
|
5054
5060
|
variant: "ghost",
|
|
@@ -5058,16 +5064,16 @@ function jr({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
5058
5064
|
children: (n.language?.split("-")[0] || "").toUpperCase()
|
|
5059
5065
|
}
|
|
5060
5066
|
) }) }),
|
|
5061
|
-
/* @__PURE__ */ e(
|
|
5067
|
+
/* @__PURE__ */ e(Ee, { side: "bottom", className: "text-xs", children: o("dashboard.language", "Change Language") })
|
|
5062
5068
|
]
|
|
5063
5069
|
}
|
|
5064
5070
|
),
|
|
5065
|
-
/* @__PURE__ */ e(
|
|
5066
|
-
|
|
5071
|
+
/* @__PURE__ */ e(ft, { align: "center", className: "min-w-[8rem]", children: L.map((v) => /* @__PURE__ */ e(
|
|
5072
|
+
bt,
|
|
5067
5073
|
{
|
|
5068
|
-
onClick: () =>
|
|
5074
|
+
onClick: () => $(v),
|
|
5069
5075
|
className: v === n.language ? "bg-primary/10" : "",
|
|
5070
|
-
children:
|
|
5076
|
+
children: o(`general.languages.${v}`, v.toUpperCase())
|
|
5071
5077
|
},
|
|
5072
5078
|
v
|
|
5073
5079
|
)) })
|
|
@@ -5076,77 +5082,77 @@ function jr({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
5076
5082
|
),
|
|
5077
5083
|
/* @__PURE__ */ e(qr, { className: "size-9 !bg-transparent hover:bg-muted text-muted-foreground" }),
|
|
5078
5084
|
/* @__PURE__ */ e("div", { className: "w-px h-5 bg-border mx-1" }),
|
|
5079
|
-
/* @__PURE__ */ r(
|
|
5080
|
-
/* @__PURE__ */ e(
|
|
5085
|
+
/* @__PURE__ */ r($e, { children: [
|
|
5086
|
+
/* @__PURE__ */ e(Oe, { asChild: !0, children: /* @__PURE__ */ e(
|
|
5081
5087
|
ne,
|
|
5082
5088
|
{
|
|
5083
5089
|
variant: "ghost",
|
|
5084
5090
|
size: "icon",
|
|
5085
5091
|
className: "hover:bg-destructive/10 hover:scale-105 active:scale-95 text-muted-foreground hover:text-destructive",
|
|
5086
|
-
onClick:
|
|
5087
|
-
children: /* @__PURE__ */ e(
|
|
5092
|
+
onClick: R,
|
|
5093
|
+
children: /* @__PURE__ */ e(Bt, { className: "size-5" })
|
|
5088
5094
|
}
|
|
5089
5095
|
) }),
|
|
5090
|
-
/* @__PURE__ */ e(
|
|
5096
|
+
/* @__PURE__ */ e(Ee, { side: "bottom", className: "text-xs", children: o("dashboard.logout") })
|
|
5091
5097
|
] })
|
|
5092
5098
|
] })
|
|
5093
5099
|
] }) }) }),
|
|
5094
|
-
/* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ r(
|
|
5095
|
-
/* @__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 }) }),
|
|
5096
5102
|
/* @__PURE__ */ e(
|
|
5097
|
-
|
|
5103
|
+
ue,
|
|
5098
5104
|
{
|
|
5099
5105
|
path: "/analytics",
|
|
5100
|
-
element: f("analytics") ? /* @__PURE__ */ e(gr, {}) : /* @__PURE__ */ e(
|
|
5106
|
+
element: f("analytics") ? /* @__PURE__ */ e(gr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5101
5107
|
}
|
|
5102
5108
|
),
|
|
5103
5109
|
/* @__PURE__ */ e(
|
|
5104
|
-
|
|
5110
|
+
ue,
|
|
5105
5111
|
{
|
|
5106
5112
|
path: "/chat-history",
|
|
5107
|
-
element: f("chat_history") ? /* @__PURE__ */ e(nr, {}) : /* @__PURE__ */ e(
|
|
5113
|
+
element: f("chat_history") ? /* @__PURE__ */ e(nr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5108
5114
|
}
|
|
5109
5115
|
),
|
|
5110
5116
|
/* @__PURE__ */ e(
|
|
5111
|
-
|
|
5117
|
+
ue,
|
|
5112
5118
|
{
|
|
5113
5119
|
path: "/admins",
|
|
5114
|
-
element: f("admin_management") ? /* @__PURE__ */ e(sr, {}) : /* @__PURE__ */ e(
|
|
5120
|
+
element: f("admin_management") ? /* @__PURE__ */ e(sr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5115
5121
|
}
|
|
5116
5122
|
),
|
|
5117
5123
|
/* @__PURE__ */ e(
|
|
5118
|
-
|
|
5124
|
+
ue,
|
|
5119
5125
|
{
|
|
5120
5126
|
path: "/settings",
|
|
5121
|
-
element: f("settings") ? /* @__PURE__ */ e(Lr, {}) : /* @__PURE__ */ e(
|
|
5127
|
+
element: f("settings") ? /* @__PURE__ */ e(Lr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5122
5128
|
}
|
|
5123
5129
|
),
|
|
5124
5130
|
/* @__PURE__ */ e(
|
|
5125
|
-
|
|
5131
|
+
ue,
|
|
5126
5132
|
{
|
|
5127
5133
|
path: "/users",
|
|
5128
|
-
element: f("user_management") ? /* @__PURE__ */ e(pr, {}) : /* @__PURE__ */ e(
|
|
5134
|
+
element: f("user_management") ? /* @__PURE__ */ e(pr, {}) : /* @__PURE__ */ e(ge, {})
|
|
5129
5135
|
}
|
|
5130
5136
|
),
|
|
5131
5137
|
t.map((v) => /* @__PURE__ */ e(
|
|
5132
|
-
|
|
5138
|
+
ue,
|
|
5133
5139
|
{
|
|
5134
5140
|
path: `/${v.path}`,
|
|
5135
|
-
element: v.permission && !
|
|
5141
|
+
element: v.permission && !c(v.permission) ? /* @__PURE__ */ e(ge, {}) : v.element
|
|
5136
5142
|
},
|
|
5137
5143
|
`route-${v.path}`
|
|
5138
5144
|
)),
|
|
5139
|
-
/* @__PURE__ */ e(
|
|
5145
|
+
/* @__PURE__ */ e(ue, { path: "*", element: /* @__PURE__ */ e(Ge, { to: "/admin/analytics", replace: !0 }) })
|
|
5140
5146
|
] }) }) })
|
|
5141
5147
|
]
|
|
5142
5148
|
}
|
|
5143
5149
|
);
|
|
5144
5150
|
}
|
|
5145
5151
|
function zr(t) {
|
|
5146
|
-
const a =
|
|
5147
|
-
const
|
|
5148
|
-
return
|
|
5149
|
-
resources:
|
|
5152
|
+
const a = he(() => {
|
|
5153
|
+
const s = ct.createInstance();
|
|
5154
|
+
return s.use(xt).use(ut).init({
|
|
5155
|
+
resources: vt,
|
|
5150
5156
|
fallbackLng: "en",
|
|
5151
5157
|
interpolation: { escapeValue: !1 },
|
|
5152
5158
|
detection: {
|
|
@@ -5154,19 +5160,19 @@ function zr(t) {
|
|
|
5154
5160
|
lookupLocalStorage: "gentiq-admin-language",
|
|
5155
5161
|
caches: ["localStorage"]
|
|
5156
5162
|
}
|
|
5157
|
-
}),
|
|
5163
|
+
}), s;
|
|
5158
5164
|
}, []);
|
|
5159
5165
|
return /* @__PURE__ */ e(mt, { i18n: a, children: /* @__PURE__ */ e(Tr, { ...t }) });
|
|
5160
5166
|
}
|
|
5161
5167
|
function Tr({ extraPages: t, disabledPages: a = [] }) {
|
|
5162
|
-
const { app:
|
|
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);
|
|
5163
5169
|
H(() => {
|
|
5164
5170
|
d?.resources && Object.entries(d.resources).forEach(([h, N]) => {
|
|
5165
|
-
Object.entries(N).forEach(([
|
|
5166
|
-
n.addResourceBundle(h,
|
|
5171
|
+
Object.entries(N).forEach(([D, p]) => {
|
|
5172
|
+
n.addResourceBundle(h, D, p, !0, !0);
|
|
5167
5173
|
});
|
|
5168
|
-
}), !localStorage.getItem("gentiq-admin-language") &&
|
|
5169
|
-
}, [d?.resources, n,
|
|
5174
|
+
}), !localStorage.getItem("gentiq-admin-language") && s?.language && n.language !== s.language && n.changeLanguage(s.language), x(!0);
|
|
5175
|
+
}, [d?.resources, n, s?.language]), H(() => {
|
|
5170
5176
|
const b = T.getToken();
|
|
5171
5177
|
return g(!!b), S(!1), document.body.classList.add("admin-theme-root"), () => {
|
|
5172
5178
|
document.body.classList.remove("admin-theme-root");
|
|
@@ -5174,10 +5180,10 @@ function Tr({ extraPages: t, disabledPages: a = [] }) {
|
|
|
5174
5180
|
}, []), H(() => {
|
|
5175
5181
|
w && (document.documentElement.dir = n.language === "fa" ? "rtl" : "ltr", document.documentElement.lang = n.language);
|
|
5176
5182
|
}, [w, n.language]);
|
|
5177
|
-
const
|
|
5183
|
+
const i = () => {
|
|
5178
5184
|
g(!0);
|
|
5179
5185
|
};
|
|
5180
|
-
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:
|
|
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 }) });
|
|
5181
5187
|
}
|
|
5182
5188
|
export {
|
|
5183
5189
|
zr as AdminPanel,
|
|
@@ -5189,9 +5195,9 @@ export {
|
|
|
5189
5195
|
Jr as useAdminJobsMutations,
|
|
5190
5196
|
er as useAdminThreadItems,
|
|
5191
5197
|
Yt as useAdminThreads,
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5198
|
+
Kt as useAdminUsers,
|
|
5199
|
+
Qt as useAdminUsersMutations,
|
|
5200
|
+
Ve as useJobMutations,
|
|
5195
5201
|
ar as useJobRun,
|
|
5196
5202
|
rr as useJobRuns,
|
|
5197
5203
|
tr as useRegisteredJobs
|