gentiq 0.7.26 → 0.7.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{checkbox-D3JJhc0K.js → checkbox-plYm_Rxp.js} +1000 -987
- package/dist/gentiq-admin.es.js +1038 -952
- package/dist/gentiq-index.es.js +1017 -1027
- package/dist/gentiq.css +1 -1
- package/dist/src/locales/en.json.d.ts +8 -1
- package/dist/src/locales/fa.json.d.ts +8 -1
- package/package.json +1 -1
package/dist/gentiq-admin.es.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as e, jsxs as r, Fragment as
|
|
2
|
-
import { useState as x, useEffect as
|
|
3
|
-
import
|
|
4
|
-
import { useTranslation as ee, initReactI18next as
|
|
5
|
-
import { a as me,
|
|
6
|
-
import { useNavigate as
|
|
7
|
-
import { Share2 as
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as Fe } from "react/jsx-runtime";
|
|
2
|
+
import { useState as x, useEffect as W, useMemo as pe, useRef as Me } from "react";
|
|
3
|
+
import Ue from "i18next";
|
|
4
|
+
import { useTranslation as ee, initReactI18next as ze, I18nextProvider as Je } from "react-i18next";
|
|
5
|
+
import { a as me, m as we, v as Ie, n as ke, S as ne, q as ie, r as oe, e as be, s as le, t as G, K as Pe, D as He, o as Be, p as Ve, E as We, F as Ke, H as Ge, J as Ze, a0 as Qe, B as he, L as Q, I as de, a1 as Se, i as ve, k as ye, l as Ne, x as Xe, y as Ye, z as et, A as tt, a2 as rt, d as st, T as at } from "./checkbox-plYm_Rxp.js";
|
|
6
|
+
import { useNavigate as nt, useLocation as it, Routes as ot, Route as ae, Navigate as Ce } from "react-router-dom";
|
|
7
|
+
import { Share2 as lt, RefreshCcw as Le, Globe as xe, Keyboard as dt, Wallet as ct, Languages as mt, Plus as ut, Hash as ht, ShieldAlert as pt, Monitor as qe, Moon as gt, Sun as ft, LogOut as xt } from "lucide-react";
|
|
8
8
|
import { toast as je } from "sonner";
|
|
9
|
-
import * as
|
|
10
|
-
import { useQuery as ue, useQueryClient as _e, useMutation as
|
|
9
|
+
import * as Te from "@radix-ui/react-switch";
|
|
10
|
+
import { useQuery as ue, useQueryClient as _e, useMutation as re } from "@tanstack/react-query";
|
|
11
11
|
const Ae = "/api";
|
|
12
|
-
class
|
|
12
|
+
class bt {
|
|
13
13
|
token = null;
|
|
14
14
|
constructor() {
|
|
15
15
|
this.token = localStorage.getItem("admin_token");
|
|
16
16
|
}
|
|
17
|
-
setToken(
|
|
18
|
-
this.token =
|
|
17
|
+
setToken(n) {
|
|
18
|
+
this.token = n, localStorage.setItem("admin_token", n);
|
|
19
19
|
}
|
|
20
20
|
clearToken() {
|
|
21
21
|
this.token = null, localStorage.removeItem("admin_token"), localStorage.removeItem("admin_info");
|
|
@@ -23,128 +23,128 @@ class ut {
|
|
|
23
23
|
getToken() {
|
|
24
24
|
return this.token;
|
|
25
25
|
}
|
|
26
|
-
async request(
|
|
27
|
-
const m = new Headers(
|
|
26
|
+
async request(n, o = {}) {
|
|
27
|
+
const m = new Headers(o.headers);
|
|
28
28
|
m.has("Content-Type") || m.set("Content-Type", "application/json"), this.token && m.set("Authorization", `Bearer ${this.token}`);
|
|
29
|
-
const
|
|
30
|
-
...
|
|
29
|
+
const b = await fetch(`${Ae}${n}`, {
|
|
30
|
+
...o,
|
|
31
31
|
headers: m
|
|
32
32
|
});
|
|
33
|
-
if (!
|
|
34
|
-
const p = await
|
|
35
|
-
throw new Error(p.error || `HTTP ${
|
|
33
|
+
if (!b.ok) {
|
|
34
|
+
const p = await b.json().catch(() => ({ error: "Request failed" }));
|
|
35
|
+
throw new Error(p.error || `HTTP ${b.status}`);
|
|
36
36
|
}
|
|
37
|
-
return
|
|
37
|
+
return b.json();
|
|
38
38
|
}
|
|
39
|
-
async login(
|
|
39
|
+
async login(n, o) {
|
|
40
40
|
const m = await this.request("/admin/login", {
|
|
41
41
|
method: "POST",
|
|
42
|
-
body: JSON.stringify({ username:
|
|
42
|
+
body: JSON.stringify({ username: n, password: o })
|
|
43
43
|
});
|
|
44
44
|
this.setToken(m.token);
|
|
45
|
-
const
|
|
45
|
+
const b = {
|
|
46
46
|
admin_id: m.admin_id,
|
|
47
47
|
username: m.username,
|
|
48
48
|
name: m.name,
|
|
49
49
|
permissions: m.permissions
|
|
50
50
|
};
|
|
51
|
-
return localStorage.setItem("admin_info", JSON.stringify(
|
|
51
|
+
return localStorage.setItem("admin_info", JSON.stringify(b)), m;
|
|
52
52
|
}
|
|
53
53
|
async checkSetupStatus() {
|
|
54
54
|
return this.request("/admin/setup-status");
|
|
55
55
|
}
|
|
56
|
-
async register(
|
|
56
|
+
async register(n, o, m, b) {
|
|
57
57
|
return this.request("/admin/admins", {
|
|
58
58
|
method: "POST",
|
|
59
|
-
body: JSON.stringify({ username:
|
|
59
|
+
body: JSON.stringify({ username: n, password: o, name: m, permissions: b })
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
62
|
async listAdmins() {
|
|
63
63
|
return this.request("/admin/admins");
|
|
64
64
|
}
|
|
65
|
-
async updateAdmin(
|
|
66
|
-
return this.request(`/admin/admins/${
|
|
65
|
+
async updateAdmin(n, o) {
|
|
66
|
+
return this.request(`/admin/admins/${n}`, {
|
|
67
67
|
method: "PATCH",
|
|
68
|
-
body: JSON.stringify(
|
|
68
|
+
body: JSON.stringify(o)
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
-
async deleteAdmin(
|
|
72
|
-
return this.request(`/admin/admins/${
|
|
71
|
+
async deleteAdmin(n) {
|
|
72
|
+
return this.request(`/admin/admins/${n}`, {
|
|
73
73
|
method: "DELETE"
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
async listPermissions() {
|
|
77
77
|
return this.request("/admin/permissions");
|
|
78
78
|
}
|
|
79
|
-
async listThreads(
|
|
80
|
-
const p = new URLSearchParams({ skip:
|
|
81
|
-
return m && p.append("query", m),
|
|
79
|
+
async listThreads(n = 0, o = 50, m, b) {
|
|
80
|
+
const p = new URLSearchParams({ skip: n.toString(), limit: o.toString() });
|
|
81
|
+
return m && p.append("query", m), b && p.append("feedback", b), this.request(`/admin/chat-history/threads?${p}`);
|
|
82
82
|
}
|
|
83
|
-
async getThreadItems(
|
|
84
|
-
return this.request(`/admin/chat-history/threads/${
|
|
83
|
+
async getThreadItems(n) {
|
|
84
|
+
return this.request(`/admin/chat-history/threads/${n}/items`);
|
|
85
85
|
}
|
|
86
|
-
async shareThread(
|
|
87
|
-
return this.request(`/admin/chat-history/threads/${
|
|
86
|
+
async shareThread(n) {
|
|
87
|
+
return this.request(`/admin/chat-history/threads/${n}/share`, {
|
|
88
88
|
method: "POST"
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
async listUsers(
|
|
92
|
-
const
|
|
93
|
-
return m &&
|
|
91
|
+
async listUsers(n = 0, o = 100, m = "") {
|
|
92
|
+
const b = new URLSearchParams({ skip: n.toString(), limit: o.toString() });
|
|
93
|
+
return m && b.append("query", m), this.request(`/admin/users?${b.toString()}`);
|
|
94
94
|
}
|
|
95
|
-
async createUser(
|
|
96
|
-
const
|
|
97
|
-
tokens:
|
|
95
|
+
async createUser(n, o, m, b, p, N, _, w) {
|
|
96
|
+
const H = b !== void 0 || p !== void 0 || N !== void 0 || _ !== void 0 ? {
|
|
97
|
+
tokens: b || 0,
|
|
98
98
|
requests: p || 0,
|
|
99
|
-
token_limit:
|
|
99
|
+
token_limit: N || b || 0,
|
|
100
100
|
request_limit: _ || p || 0
|
|
101
101
|
} : void 0;
|
|
102
102
|
return this.request("/admin/users", {
|
|
103
103
|
method: "POST",
|
|
104
|
-
body: JSON.stringify({ phone:
|
|
104
|
+
body: JSON.stringify({ phone: n, name: o, surname: m, balance: H, metadata: w })
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
|
-
async updateUser(
|
|
108
|
-
return this.request(`/admin/users/${
|
|
107
|
+
async updateUser(n, o) {
|
|
108
|
+
return this.request(`/admin/users/${n}`, {
|
|
109
109
|
method: "PATCH",
|
|
110
|
-
body: JSON.stringify(
|
|
110
|
+
body: JSON.stringify(o)
|
|
111
111
|
});
|
|
112
112
|
}
|
|
113
|
-
async deleteUser(
|
|
114
|
-
return this.request(`/admin/users/${
|
|
113
|
+
async deleteUser(n) {
|
|
114
|
+
return this.request(`/admin/users/${n}`, {
|
|
115
115
|
method: "DELETE"
|
|
116
116
|
});
|
|
117
117
|
}
|
|
118
|
-
async updateUserBalance(
|
|
119
|
-
return this.request(`/admin/users/${
|
|
118
|
+
async updateUserBalance(n, o, m, b, p) {
|
|
119
|
+
return this.request(`/admin/users/${n}/balance`, {
|
|
120
120
|
method: "POST",
|
|
121
|
-
body: JSON.stringify({ tokens:
|
|
121
|
+
body: JSON.stringify({ tokens: o, requests: m, token_limit: b, request_limit: p })
|
|
122
122
|
});
|
|
123
123
|
}
|
|
124
|
-
async refreshUserToken(
|
|
125
|
-
return this.request(`/admin/users/${
|
|
124
|
+
async refreshUserToken(n) {
|
|
125
|
+
return this.request(`/admin/users/${n}/refresh-token`, {
|
|
126
126
|
method: "POST"
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
async getAnalytics(
|
|
130
|
-
return this.request(`/admin/analytics?days=${
|
|
129
|
+
async getAnalytics(n = 30) {
|
|
130
|
+
return this.request(`/admin/analytics?days=${n}`);
|
|
131
131
|
}
|
|
132
|
-
async listJobs(
|
|
133
|
-
const m = new URLSearchParams({ limit:
|
|
134
|
-
return
|
|
132
|
+
async listJobs(n = 20, o) {
|
|
133
|
+
const m = new URLSearchParams({ limit: n.toString() });
|
|
134
|
+
return o && m.append("type", o), this.request(`/admin/jobs?${m}`);
|
|
135
135
|
}
|
|
136
|
-
async cancelJob(
|
|
137
|
-
return this.request(`/admin/jobs/${
|
|
136
|
+
async cancelJob(n) {
|
|
137
|
+
return this.request(`/admin/jobs/${n}/cancel`, {
|
|
138
138
|
method: "POST"
|
|
139
139
|
});
|
|
140
140
|
}
|
|
141
141
|
async getSettings() {
|
|
142
142
|
return this.request("/admin/settings");
|
|
143
143
|
}
|
|
144
|
-
async updateSettings(
|
|
144
|
+
async updateSettings(n) {
|
|
145
145
|
return this.request("/admin/settings", {
|
|
146
146
|
method: "PATCH",
|
|
147
|
-
body: JSON.stringify(
|
|
147
|
+
body: JSON.stringify(n)
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
async resetSettings() {
|
|
@@ -152,53 +152,53 @@ class ut {
|
|
|
152
152
|
method: "DELETE"
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
async getAttachmentBlob(
|
|
156
|
-
const
|
|
157
|
-
this.token && (
|
|
158
|
-
const m = await fetch(`${Ae}/admin/chat-history/attachments/${
|
|
155
|
+
async getAttachmentBlob(n) {
|
|
156
|
+
const o = {};
|
|
157
|
+
this.token && (o.Authorization = `Bearer ${this.token}`);
|
|
158
|
+
const m = await fetch(`${Ae}/admin/chat-history/attachments/${n}`, {
|
|
159
159
|
method: "GET",
|
|
160
|
-
headers:
|
|
160
|
+
headers: o
|
|
161
161
|
});
|
|
162
162
|
if (!m.ok) {
|
|
163
|
-
const
|
|
164
|
-
throw new Error(
|
|
163
|
+
const b = await m.json().catch(() => ({ error: "Request failed" }));
|
|
164
|
+
throw new Error(b.error || `HTTP ${m.status}`);
|
|
165
165
|
}
|
|
166
166
|
return m.blob();
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
const k = new
|
|
170
|
-
function
|
|
171
|
-
const { t:
|
|
172
|
-
|
|
173
|
-
if (
|
|
174
|
-
const
|
|
175
|
-
|
|
169
|
+
const k = new bt();
|
|
170
|
+
function vt({ onLoginSuccess: t }) {
|
|
171
|
+
const { t: n, i18n: o } = ee(["admin", "translation"]), { app: m } = me(), { theme: b } = we(), [p, N] = x(""), [_, w] = x(""), [H, T] = x(""), [A, I] = x(""), [D, C] = x(!1), [O, U] = x(null), [v, z] = x("light");
|
|
172
|
+
W(() => {
|
|
173
|
+
if (b === "system") {
|
|
174
|
+
const u = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
175
|
+
z(u ? "dark" : "light");
|
|
176
176
|
} else
|
|
177
|
-
|
|
178
|
-
}, [
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
k.checkSetupStatus().then((
|
|
177
|
+
z(b);
|
|
178
|
+
}, [b]);
|
|
179
|
+
const R = pe(() => m?.logo ? typeof m.logo == "string" ? m.logo : v === "dark" ? m.logo.dark : m.logo.light : Ie, [m?.logo, v]), E = m?.adminTitle || m?.name, V = o.language === "fa";
|
|
180
|
+
W(() => {
|
|
181
|
+
k.checkSetupStatus().then((u) => U(u.needs_setup)).catch(() => U(!1));
|
|
182
182
|
}, []);
|
|
183
|
-
const
|
|
184
|
-
|
|
183
|
+
const Z = async (u) => {
|
|
184
|
+
u.preventDefault(), I(""), C(!0);
|
|
185
185
|
try {
|
|
186
186
|
await k.login(p, _), t();
|
|
187
|
-
} catch (
|
|
188
|
-
|
|
187
|
+
} catch (J) {
|
|
188
|
+
I(J instanceof Error ? J.message : n("login.error"));
|
|
189
189
|
} finally {
|
|
190
|
-
|
|
190
|
+
C(!1);
|
|
191
191
|
}
|
|
192
|
-
}, B = async (
|
|
193
|
-
if (
|
|
194
|
-
|
|
192
|
+
}, B = async (u) => {
|
|
193
|
+
if (u.preventDefault(), I(""), _ !== H) {
|
|
194
|
+
I(n("login.passwords_mismatch"));
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
197
|
if (_.length < 4) {
|
|
198
|
-
|
|
198
|
+
I(n("login.password_too_short"));
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
|
|
201
|
+
C(!0);
|
|
202
202
|
try {
|
|
203
203
|
await k.register(
|
|
204
204
|
"admin",
|
|
@@ -206,10 +206,10 @@ function ht({ onLoginSuccess: t }) {
|
|
|
206
206
|
"Admin",
|
|
207
207
|
["chat_history", "admin_management", "user_management", "analytics"]
|
|
208
208
|
), await k.login("admin", _), t();
|
|
209
|
-
} catch (
|
|
210
|
-
|
|
209
|
+
} catch (J) {
|
|
210
|
+
I(J instanceof Error ? J.message : n("login.error"));
|
|
211
211
|
} finally {
|
|
212
|
-
|
|
212
|
+
C(!1);
|
|
213
213
|
}
|
|
214
214
|
};
|
|
215
215
|
return O === null ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-6 h-6 border-2 border-border border-t-primary rounded-full animate-spin" }) }) : /* @__PURE__ */ r("div", { className: "min-h-screen bg-background flex items-center justify-center p-4 relative overflow-hidden", dir: V ? "rtl" : "ltr", children: [
|
|
@@ -219,16 +219,16 @@ function ht({ onLoginSuccess: t }) {
|
|
|
219
219
|
/* @__PURE__ */ r("div", { className: "glass rounded-3xl p-10 shadow-2xl", children: [
|
|
220
220
|
/* @__PURE__ */ r("div", { className: "text-center mb-10", children: [
|
|
221
221
|
/* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-4 mb-6", children: [
|
|
222
|
-
/* @__PURE__ */ e("img", { src:
|
|
223
|
-
/* @__PURE__ */ e("h1", { className: "text-3xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: O ?
|
|
222
|
+
/* @__PURE__ */ e("img", { src: R, alt: E, className: "size-16 object-contain" }),
|
|
223
|
+
/* @__PURE__ */ e("h1", { className: "text-3xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: O ? n("login.setup_title") : E })
|
|
224
224
|
] }),
|
|
225
|
-
O && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-3", children:
|
|
225
|
+
O && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-3", children: n("login.setup_description") })
|
|
226
226
|
] }),
|
|
227
227
|
O ? (
|
|
228
228
|
/* ---- SETUP FORM ---- */
|
|
229
229
|
/* @__PURE__ */ r("form", { onSubmit: B, className: "space-y-7", children: [
|
|
230
230
|
/* @__PURE__ */ r("div", { children: [
|
|
231
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
231
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.username") }),
|
|
232
232
|
/* @__PURE__ */ e(
|
|
233
233
|
"input",
|
|
234
234
|
{
|
|
@@ -240,38 +240,38 @@ function ht({ onLoginSuccess: t }) {
|
|
|
240
240
|
)
|
|
241
241
|
] }),
|
|
242
242
|
/* @__PURE__ */ r("div", { children: [
|
|
243
|
-
/* @__PURE__ */ e("label", { htmlFor: "setup-password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
243
|
+
/* @__PURE__ */ e("label", { htmlFor: "setup-password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.set_password") }),
|
|
244
244
|
/* @__PURE__ */ e(
|
|
245
245
|
"input",
|
|
246
246
|
{
|
|
247
247
|
id: "setup-password",
|
|
248
248
|
type: "password",
|
|
249
249
|
value: _,
|
|
250
|
-
onChange: (
|
|
250
|
+
onChange: (u) => w(u.target.value),
|
|
251
251
|
required: !0,
|
|
252
252
|
className: "w-full px-5 py-3.5 rounded-2xl border-0 bg-card text-foreground placeholder-muted-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm text-left",
|
|
253
|
-
placeholder:
|
|
253
|
+
placeholder: n("login.set_password_placeholder"),
|
|
254
254
|
dir: "ltr"
|
|
255
255
|
}
|
|
256
256
|
)
|
|
257
257
|
] }),
|
|
258
258
|
/* @__PURE__ */ r("div", { children: [
|
|
259
|
-
/* @__PURE__ */ e("label", { htmlFor: "setup-confirm", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
259
|
+
/* @__PURE__ */ e("label", { htmlFor: "setup-confirm", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.confirm_password") }),
|
|
260
260
|
/* @__PURE__ */ e(
|
|
261
261
|
"input",
|
|
262
262
|
{
|
|
263
263
|
id: "setup-confirm",
|
|
264
264
|
type: "password",
|
|
265
|
-
value:
|
|
266
|
-
onChange: (
|
|
265
|
+
value: H,
|
|
266
|
+
onChange: (u) => T(u.target.value),
|
|
267
267
|
required: !0,
|
|
268
268
|
className: "w-full px-5 py-3.5 rounded-2xl border-0 bg-card text-foreground placeholder-muted-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm text-left",
|
|
269
|
-
placeholder:
|
|
269
|
+
placeholder: n("login.confirm_password_placeholder"),
|
|
270
270
|
dir: "ltr"
|
|
271
271
|
}
|
|
272
272
|
)
|
|
273
273
|
] }),
|
|
274
|
-
|
|
274
|
+
A && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3.5 rounded-2xl text-xs backdrop-blur-sm", children: A }),
|
|
275
275
|
/* @__PURE__ */ e(
|
|
276
276
|
"button",
|
|
277
277
|
{
|
|
@@ -280,47 +280,47 @@ function ht({ onLoginSuccess: t }) {
|
|
|
280
280
|
className: "w-full bg-primary text-primary-foreground font-bold py-4 px-6 rounded-2xl hover:opacity-90 transition-all text-sm shadow-lg hover:shadow-xl disabled:opacity-50 active:scale-[0.98]",
|
|
281
281
|
children: D ? /* @__PURE__ */ r("div", { className: "flex items-center justify-center gap-2", children: [
|
|
282
282
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin" }),
|
|
283
|
-
/* @__PURE__ */ e("span", { children:
|
|
284
|
-
] }) :
|
|
283
|
+
/* @__PURE__ */ e("span", { children: n("login.setting_up") })
|
|
284
|
+
] }) : n("login.create_admin")
|
|
285
285
|
}
|
|
286
286
|
)
|
|
287
287
|
] })
|
|
288
288
|
) : (
|
|
289
289
|
/* ---- LOGIN FORM ---- */
|
|
290
|
-
/* @__PURE__ */ r("form", { onSubmit:
|
|
290
|
+
/* @__PURE__ */ r("form", { onSubmit: Z, className: "space-y-7", children: [
|
|
291
291
|
/* @__PURE__ */ r("div", { children: [
|
|
292
|
-
/* @__PURE__ */ e("label", { htmlFor: "username", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
292
|
+
/* @__PURE__ */ e("label", { htmlFor: "username", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.username") }),
|
|
293
293
|
/* @__PURE__ */ e(
|
|
294
294
|
"input",
|
|
295
295
|
{
|
|
296
296
|
id: "username",
|
|
297
297
|
type: "text",
|
|
298
298
|
value: p,
|
|
299
|
-
onChange: (
|
|
299
|
+
onChange: (u) => N(u.target.value),
|
|
300
300
|
required: !0,
|
|
301
301
|
className: "w-full px-5 py-3.5 rounded-2xl border-0 bg-card text-foreground placeholder-muted-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm text-left",
|
|
302
|
-
placeholder:
|
|
302
|
+
placeholder: n("login.username_placeholder"),
|
|
303
303
|
dir: "ltr"
|
|
304
304
|
}
|
|
305
305
|
)
|
|
306
306
|
] }),
|
|
307
307
|
/* @__PURE__ */ r("div", { children: [
|
|
308
|
-
/* @__PURE__ */ e("label", { htmlFor: "password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
308
|
+
/* @__PURE__ */ e("label", { htmlFor: "password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: n("login.password") }),
|
|
309
309
|
/* @__PURE__ */ e(
|
|
310
310
|
"input",
|
|
311
311
|
{
|
|
312
312
|
id: "password",
|
|
313
313
|
type: "password",
|
|
314
314
|
value: _,
|
|
315
|
-
onChange: (
|
|
315
|
+
onChange: (u) => w(u.target.value),
|
|
316
316
|
required: !0,
|
|
317
317
|
className: "w-full px-5 py-3.5 rounded-2xl border-0 bg-card text-foreground placeholder-muted-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm text-left",
|
|
318
|
-
placeholder:
|
|
318
|
+
placeholder: n("login.password_placeholder"),
|
|
319
319
|
dir: "ltr"
|
|
320
320
|
}
|
|
321
321
|
)
|
|
322
322
|
] }),
|
|
323
|
-
|
|
323
|
+
A && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3.5 rounded-2xl text-xs backdrop-blur-sm", children: A }),
|
|
324
324
|
/* @__PURE__ */ e(
|
|
325
325
|
"button",
|
|
326
326
|
{
|
|
@@ -329,70 +329,70 @@ function ht({ onLoginSuccess: t }) {
|
|
|
329
329
|
className: "w-full bg-primary text-primary-foreground font-bold py-4 px-6 rounded-2xl hover:opacity-90 transition-all text-sm shadow-lg hover:shadow-xl disabled:opacity-50 active:scale-[0.98]",
|
|
330
330
|
children: D ? /* @__PURE__ */ r("div", { className: "flex items-center justify-center gap-2", children: [
|
|
331
331
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin" }),
|
|
332
|
-
/* @__PURE__ */ e("span", { children:
|
|
333
|
-
] }) :
|
|
332
|
+
/* @__PURE__ */ e("span", { children: n("login.logging_in") })
|
|
333
|
+
] }) : n("login.submit")
|
|
334
334
|
}
|
|
335
335
|
)
|
|
336
336
|
] })
|
|
337
337
|
)
|
|
338
338
|
] }),
|
|
339
|
-
/* @__PURE__ */ e("div", { className: "mt-10 text-center text-[10px] text-muted-foreground uppercase tracking-widest font-bold", children: /* @__PURE__ */ e("p", { children:
|
|
339
|
+
/* @__PURE__ */ e("div", { className: "mt-10 text-center text-[10px] text-muted-foreground uppercase tracking-widest font-bold", children: /* @__PURE__ */ e("p", { children: n("login.copyright") }) })
|
|
340
340
|
] })
|
|
341
341
|
] });
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
const { t, i18n:
|
|
345
|
-
s ? D(!0) : (
|
|
343
|
+
function yt() {
|
|
344
|
+
const { t, i18n: n } = ee(["admin", "translation"]), { app: o } = me(), m = o?.userMetadataFields || [], [b, p] = x([]), [N, _] = x(null), [w, H] = x([]), [T, A] = x(!1), [I, D] = x(!1), [C, O] = x(""), [U, v] = x(""), [z, R] = x(""), [E, V] = x(0), [Z, B] = x(!0), u = n.language === "fa", J = u ? "fa-IR" : "en-US", d = async (s = !1) => {
|
|
345
|
+
s ? D(!0) : (A(!0), V(0)), O("");
|
|
346
346
|
try {
|
|
347
|
-
const
|
|
348
|
-
|
|
347
|
+
const f = s ? E + 50 : 0, q = await k.listThreads(
|
|
348
|
+
f,
|
|
349
349
|
50,
|
|
350
|
-
|
|
351
|
-
|
|
350
|
+
U || void 0,
|
|
351
|
+
z || void 0
|
|
352
352
|
);
|
|
353
|
-
s ? (p((
|
|
354
|
-
} catch (
|
|
355
|
-
O(
|
|
353
|
+
s ? (p((i) => [...i, ...q.threads]), V(f)) : (p(q.threads), V(0)), B(q.threads.length === 50);
|
|
354
|
+
} catch (f) {
|
|
355
|
+
O(f instanceof Error ? f.message : t("error_loading"));
|
|
356
356
|
} finally {
|
|
357
|
-
|
|
357
|
+
A(!1), D(!1);
|
|
358
358
|
}
|
|
359
359
|
}, c = async (s) => {
|
|
360
|
-
_(s),
|
|
360
|
+
_(s), A(!0), O("");
|
|
361
361
|
try {
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
} catch (
|
|
365
|
-
O(
|
|
362
|
+
const f = await k.getThreadItems(s.id);
|
|
363
|
+
H(f.items);
|
|
364
|
+
} catch (f) {
|
|
365
|
+
O(f instanceof Error ? f.message : t("error_loading"));
|
|
366
366
|
} finally {
|
|
367
|
-
|
|
367
|
+
A(!1);
|
|
368
368
|
}
|
|
369
|
-
}, l = async (s,
|
|
369
|
+
}, l = async (s, f) => {
|
|
370
370
|
s.stopPropagation();
|
|
371
371
|
try {
|
|
372
|
-
const
|
|
373
|
-
navigator.clipboard.writeText(
|
|
372
|
+
const q = await k.shareThread(f.id), i = `${window.location.origin}${q.url}`;
|
|
373
|
+
navigator.clipboard.writeText(i), je.success(t("sidebar.share_success"), {
|
|
374
374
|
description: t("sidebar.share_description")
|
|
375
375
|
});
|
|
376
376
|
} catch {
|
|
377
377
|
je.error(t("sidebar.share_failed"));
|
|
378
378
|
}
|
|
379
379
|
};
|
|
380
|
-
|
|
380
|
+
W(() => {
|
|
381
381
|
const s = setTimeout(() => {
|
|
382
382
|
d();
|
|
383
383
|
}, 500);
|
|
384
384
|
return () => clearTimeout(s);
|
|
385
|
-
}, [
|
|
385
|
+
}, [U, z]);
|
|
386
386
|
const g = (s) => {
|
|
387
|
-
const
|
|
388
|
-
return new Intl.DateTimeFormat(
|
|
387
|
+
const f = new Date(s);
|
|
388
|
+
return new Intl.DateTimeFormat(u ? "fa-IR" : "en-US", {
|
|
389
389
|
year: "numeric",
|
|
390
390
|
month: "long",
|
|
391
391
|
day: "numeric",
|
|
392
392
|
hour: "2-digit",
|
|
393
393
|
minute: "2-digit"
|
|
394
|
-
}).format(
|
|
395
|
-
},
|
|
394
|
+
}).format(f);
|
|
395
|
+
}, L = (s) => {
|
|
396
396
|
if (typeof s == "string")
|
|
397
397
|
try {
|
|
398
398
|
return JSON.stringify(JSON.parse(s), null, 2);
|
|
@@ -400,20 +400,20 @@ function pt() {
|
|
|
400
400
|
return s;
|
|
401
401
|
}
|
|
402
402
|
return JSON.stringify(s, null, 2);
|
|
403
|
-
},
|
|
404
|
-
const [
|
|
403
|
+
}, P = ({ part: s, idx: f }) => {
|
|
404
|
+
const [q, i] = x(!1), y = s.tool_name || (s.type && s.type.startsWith("tool-") ? s.type.slice(5) : "tool");
|
|
405
405
|
return /* @__PURE__ */ r("div", { dir: "ltr", className: "my-2 border border-border/50 rounded-xl overflow-hidden bg-muted/20 text-left", children: [
|
|
406
406
|
/* @__PURE__ */ r(
|
|
407
407
|
"div",
|
|
408
408
|
{
|
|
409
|
-
onClick: () =>
|
|
409
|
+
onClick: () => i(!q),
|
|
410
410
|
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",
|
|
411
411
|
children: [
|
|
412
412
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
413
413
|
/* @__PURE__ */ e(
|
|
414
414
|
"svg",
|
|
415
415
|
{
|
|
416
|
-
className: `w-3 h-3 text-gray-400 transition-transform ${
|
|
416
|
+
className: `w-3 h-3 text-gray-400 transition-transform ${q ? "rotate-180" : ""}`,
|
|
417
417
|
fill: "none",
|
|
418
418
|
viewBox: "0 0 24 24",
|
|
419
419
|
stroke: "currentColor",
|
|
@@ -421,34 +421,34 @@ function pt() {
|
|
|
421
421
|
}
|
|
422
422
|
),
|
|
423
423
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold uppercase tracking-widest text-muted-foreground", children: "Tool" }),
|
|
424
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-semibold", children:
|
|
424
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-semibold", children: y })
|
|
425
425
|
] }),
|
|
426
426
|
/* @__PURE__ */ e("span", { className: `text-[10px] px-2 py-0.5 rounded-full ${s.state === "output-available" ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"}`, children: s.state === "output-available" ? t("chat_history.output_available") : t("chat_history.running") })
|
|
427
427
|
]
|
|
428
428
|
}
|
|
429
429
|
),
|
|
430
|
-
|
|
430
|
+
q && /* @__PURE__ */ r("div", { className: "p-2.5 space-y-2.5 animate-in fade-in slide-in-from-top-1 duration-200", children: [
|
|
431
431
|
/* @__PURE__ */ r("div", { children: [
|
|
432
432
|
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: "Input" }),
|
|
433
|
-
/* @__PURE__ */ e("pre", { className: "text-xs bg-black/5 dark:bg-black/20 p-2 rounded-lg overflow-x-auto", children:
|
|
433
|
+
/* @__PURE__ */ e("pre", { className: "text-xs bg-black/5 dark:bg-black/20 p-2 rounded-lg overflow-x-auto", children: L(s.input) })
|
|
434
434
|
] }),
|
|
435
435
|
(s.output || s.error_text || s.errorText) && /* @__PURE__ */ r("div", { children: [
|
|
436
436
|
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: s.error_text || s.errorText ? "Error" : "Output" }),
|
|
437
|
-
/* @__PURE__ */ e("pre", { className: `text-xs p-2 rounded-lg overflow-x-auto ${s.error_text || s.errorText ? "bg-destructive/10 text-destructive" : "bg-primary/5 text-foreground/80"}`, children:
|
|
437
|
+
/* @__PURE__ */ e("pre", { className: `text-xs p-2 rounded-lg overflow-x-auto ${s.error_text || s.errorText ? "bg-destructive/10 text-destructive" : "bg-primary/5 text-foreground/80"}`, children: L(s.output || s.error_text || s.errorText) })
|
|
438
438
|
] })
|
|
439
439
|
] })
|
|
440
|
-
] },
|
|
441
|
-
},
|
|
440
|
+
] }, f);
|
|
441
|
+
}, h = async (s, f) => {
|
|
442
442
|
try {
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
} catch (
|
|
446
|
-
console.error("Download failed:",
|
|
443
|
+
const q = await k.getAttachmentBlob(s), i = window.URL.createObjectURL(q), y = document.createElement("a");
|
|
444
|
+
y.href = i, y.download = f || s.split("/").pop() || "download", document.body.appendChild(y), y.click(), window.URL.revokeObjectURL(i), document.body.removeChild(y);
|
|
445
|
+
} catch (q) {
|
|
446
|
+
console.error("Download failed:", q), O(q instanceof Error ? q.message : "Download failed");
|
|
447
447
|
}
|
|
448
|
-
},
|
|
448
|
+
}, j = (s, f) => typeof s == "string" ? /* @__PURE__ */ e("div", { children: s }, f) : s.type === "text" ? /* @__PURE__ */ e("div", { className: "whitespace-pre-wrap", dir: "auto", children: s.text }, f) : s.type === "reasoning" ? /* @__PURE__ */ r("div", { className: "my-2 p-2.5 bg-muted/40 rounded-lg border border-border text-xs italic text-muted-foreground", dir: "auto", children: [
|
|
449
449
|
/* @__PURE__ */ e("div", { className: "font-bold mb-1 uppercase tracking-tighter opacity-70", children: "Reasoning" }),
|
|
450
450
|
s.text
|
|
451
|
-
] },
|
|
451
|
+
] }, f) : s.type === "dynamic-tool" || s.type && s.type.startsWith("tool-") || s.tool_call_id ? /* @__PURE__ */ e(P, { part: s, idx: f }, f) : s.type === "file" ? /* @__PURE__ */ r("div", { 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", children: [
|
|
452
452
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
453
453
|
/* @__PURE__ */ e("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center bg-primary/10 rounded-lg text-primary", children: /* @__PURE__ */ e("span", { className: "text-xl", children: "📎" }) }),
|
|
454
454
|
/* @__PURE__ */ r("div", { className: "flex flex-col min-w-0", children: [
|
|
@@ -459,17 +459,17 @@ function pt() {
|
|
|
459
459
|
s.object_name && /* @__PURE__ */ e(
|
|
460
460
|
"button",
|
|
461
461
|
{
|
|
462
|
-
onClick: () =>
|
|
462
|
+
onClick: () => h(s.object_name, s.filename),
|
|
463
463
|
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",
|
|
464
464
|
title: t("chat_history.download_file", "Download File"),
|
|
465
465
|
children: /* @__PURE__ */ e("svg", { className: "w-4 h-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" }) })
|
|
466
466
|
}
|
|
467
467
|
)
|
|
468
|
-
] },
|
|
469
|
-
const { scrollTop:
|
|
470
|
-
|
|
468
|
+
] }, f) : /* @__PURE__ */ e("div", { className: "my-2 p-2 bg-muted/40 rounded-lg border border-border text-xs font-mono opacity-60", children: JSON.stringify(s) }, f), M = (s) => {
|
|
469
|
+
const { scrollTop: f, scrollHeight: q, clientHeight: i } = s.currentTarget;
|
|
470
|
+
q - f <= i + 50 && !I && Z && d(!0);
|
|
471
471
|
};
|
|
472
|
-
return /* @__PURE__ */ r("div", { className: "p-5 h-full flex flex-col gap-4 overflow-hidden", dir:
|
|
472
|
+
return /* @__PURE__ */ r("div", { className: "p-5 h-full flex flex-col gap-4 overflow-hidden", dir: u ? "rtl" : "ltr", children: [
|
|
473
473
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-3", children: [
|
|
474
474
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-4", children: [
|
|
475
475
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("chat_history.title") }),
|
|
@@ -486,8 +486,8 @@ function pt() {
|
|
|
486
486
|
"input",
|
|
487
487
|
{
|
|
488
488
|
type: "text",
|
|
489
|
-
value:
|
|
490
|
-
onChange: (s) =>
|
|
489
|
+
value: U,
|
|
490
|
+
onChange: (s) => v(s.target.value),
|
|
491
491
|
placeholder: t("chat_history.search_placeholder"),
|
|
492
492
|
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"
|
|
493
493
|
}
|
|
@@ -506,8 +506,8 @@ function pt() {
|
|
|
506
506
|
/* @__PURE__ */ r(
|
|
507
507
|
"select",
|
|
508
508
|
{
|
|
509
|
-
value:
|
|
510
|
-
onChange: (s) =>
|
|
509
|
+
value: z,
|
|
510
|
+
onChange: (s) => R(s.target.value),
|
|
511
511
|
className: "px-4 py-2.5 border-0 rounded-xl glass-surface text-foreground focus:ring-2 focus:ring-primary/20 transition-all text-sm shadow-sm min-w-[180px]",
|
|
512
512
|
children: [
|
|
513
513
|
/* @__PURE__ */ e("option", { value: "", children: t("chat_history.all_feedbacks", "All Feedbacks") }),
|
|
@@ -519,33 +519,33 @@ function pt() {
|
|
|
519
519
|
)
|
|
520
520
|
] })
|
|
521
521
|
] }),
|
|
522
|
-
|
|
522
|
+
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", children: C })
|
|
523
523
|
] }),
|
|
524
524
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-[380px_1fr] gap-4 flex-1 min-h-0", children: [
|
|
525
525
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col min-w-0", children: [
|
|
526
526
|
/* @__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: [
|
|
527
527
|
t("chat_history.threads_list"),
|
|
528
528
|
" (",
|
|
529
|
-
(
|
|
529
|
+
(b.length || 0).toLocaleString(J),
|
|
530
530
|
")"
|
|
531
531
|
] }) }),
|
|
532
532
|
/* @__PURE__ */ e(
|
|
533
533
|
"div",
|
|
534
534
|
{
|
|
535
535
|
className: "flex-1 overflow-y-auto p-2 custom-scrollbar",
|
|
536
|
-
onScroll:
|
|
537
|
-
children: T &&
|
|
538
|
-
|
|
536
|
+
onScroll: M,
|
|
537
|
+
children: T && b.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: [
|
|
538
|
+
b.map((s) => /* @__PURE__ */ r(
|
|
539
539
|
"div",
|
|
540
540
|
{
|
|
541
541
|
onClick: () => c(s),
|
|
542
|
-
className: `p-2.5 cursor-pointer transition-all rounded-xl border ${
|
|
542
|
+
className: `p-2.5 cursor-pointer transition-all rounded-xl border ${N?.id === s.id ? "bg-card border-border shadow-sm" : "border-transparent hover:bg-muted/50"}`,
|
|
543
543
|
children: [
|
|
544
544
|
/* @__PURE__ */ r("div", { className: "flex justify-between items-start mb-1.5 gap-4", children: [
|
|
545
545
|
/* @__PURE__ */ e(
|
|
546
546
|
"h3",
|
|
547
547
|
{
|
|
548
|
-
className: `font-medium text-sm truncate flex-1 ${
|
|
548
|
+
className: `font-medium text-sm truncate flex-1 ${N?.id === s.id ? "text-primary" : "text-foreground"}`,
|
|
549
549
|
title: s.title || t("chat_history.no_thread_title"),
|
|
550
550
|
children: s.title || t("chat_history.no_thread_title")
|
|
551
551
|
}
|
|
@@ -560,14 +560,14 @@ function pt() {
|
|
|
560
560
|
"div",
|
|
561
561
|
{
|
|
562
562
|
className: "flex flex-col gap-0.5 min-w-0",
|
|
563
|
-
title: `${s.user_info.name} ${s.user_info.surname} ${s.user_info.phone ? ` • ${s.user_info.phone}` : ""}${m.filter((
|
|
564
|
-
const
|
|
565
|
-
if (
|
|
566
|
-
const
|
|
567
|
-
return ` • ${
|
|
563
|
+
title: `${s.user_info.name} ${s.user_info.surname} ${s.user_info.phone ? ` • ${s.user_info.phone}` : ""}${m.filter((f) => s.user_info?.metadata?.[f.key] !== void 0 && s.user_info?.metadata?.[f.key] !== "").map((f) => {
|
|
564
|
+
const q = s.user_info?.metadata?.[f.key];
|
|
565
|
+
if (f.type === "select") {
|
|
566
|
+
const i = f.options?.find((y) => String(y.value) === String(q));
|
|
567
|
+
return ` • ${i ? t(i.label) : q}`;
|
|
568
568
|
}
|
|
569
|
-
return ` • ${
|
|
570
|
-
}).join("")}${s.user_info.metadata?.values !== void 0 && !m.some((
|
|
569
|
+
return ` • ${q}`;
|
|
570
|
+
}).join("")}${s.user_info.metadata?.values !== void 0 && !m.some((f) => f.key === "values") ? ` • ${s.user_info.metadata.values}` : ""}`,
|
|
571
571
|
children: [
|
|
572
572
|
/* @__PURE__ */ r("div", { className: "font-medium text-foreground truncate flex items-center gap-1.5", children: [
|
|
573
573
|
/* @__PURE__ */ r("span", { children: [
|
|
@@ -582,23 +582,23 @@ function pt() {
|
|
|
582
582
|
] })
|
|
583
583
|
] }),
|
|
584
584
|
/* @__PURE__ */ r("div", { className: "text-[10px] text-muted-foreground/70 truncate flex items-center gap-1", children: [
|
|
585
|
-
m.filter((
|
|
586
|
-
const
|
|
587
|
-
return
|
|
588
|
-
}).map((
|
|
589
|
-
const
|
|
590
|
-
let
|
|
591
|
-
if (
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
} else
|
|
585
|
+
m.filter((f) => {
|
|
586
|
+
const q = s.user_info?.metadata?.[f.key];
|
|
587
|
+
return q != null && q !== "";
|
|
588
|
+
}).map((f, q) => {
|
|
589
|
+
const i = s.user_info?.metadata?.[f.key];
|
|
590
|
+
let y = String(i);
|
|
591
|
+
if (f.type === "select") {
|
|
592
|
+
const F = f.options?.find((X) => String(X.value) === String(i));
|
|
593
|
+
F && (y = t(F.label));
|
|
594
|
+
} else f.type === "checkbox" && (y = i ? "✓" : "✗");
|
|
595
595
|
return /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
] },
|
|
596
|
+
q > 0 && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
597
|
+
y
|
|
598
|
+
] }, f.key);
|
|
599
599
|
}),
|
|
600
|
-
s.user_info.metadata?.values !== void 0 && !m.some((
|
|
601
|
-
m.some((
|
|
600
|
+
s.user_info.metadata?.values !== void 0 && !m.some((f) => f.key === "values") && /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
601
|
+
m.some((f) => s.user_info?.metadata?.[f.key] !== void 0) && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
602
602
|
String(s.user_info.metadata.values)
|
|
603
603
|
] })
|
|
604
604
|
] })
|
|
@@ -606,8 +606,8 @@ function pt() {
|
|
|
606
606
|
}
|
|
607
607
|
),
|
|
608
608
|
s.metadata?.usage && /* @__PURE__ */ r("div", { className: "flex gap-2 mt-2 pt-2 border-border/30", children: [
|
|
609
|
-
/* @__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", { value: (s.metadata.usage.input_tokens || 0).toLocaleString(
|
|
610
|
-
/* @__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", { value: (s.metadata.usage.output_tokens || 0).toLocaleString(
|
|
609
|
+
/* @__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", { value: (s.metadata.usage.input_tokens || 0).toLocaleString(J) }) }),
|
|
610
|
+
/* @__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", { value: (s.metadata.usage.output_tokens || 0).toLocaleString(J) }) })
|
|
611
611
|
] }),
|
|
612
612
|
/* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: g(s.created_at) })
|
|
613
613
|
] })
|
|
@@ -615,37 +615,37 @@ function pt() {
|
|
|
615
615
|
},
|
|
616
616
|
s.id
|
|
617
617
|
)),
|
|
618
|
-
|
|
618
|
+
I && /* @__PURE__ */ e("div", { className: "p-4 text-center text-muted-foreground text-xs", children: t("loading_more") })
|
|
619
619
|
] })
|
|
620
620
|
}
|
|
621
621
|
)
|
|
622
622
|
] }),
|
|
623
623
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col", children: [
|
|
624
624
|
/* @__PURE__ */ r("div", { className: "px-5 py-2.5 border-b border-border/30 flex items-center justify-between gap-4", children: [
|
|
625
|
-
/* @__PURE__ */ e("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide truncate", children:
|
|
626
|
-
|
|
625
|
+
/* @__PURE__ */ e("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide truncate", children: N ? t("chat_history.messages_for", { title: N.title || t("chat_history.no_thread_title") }) : t("chat_history.messages") }),
|
|
626
|
+
N && /* @__PURE__ */ e(
|
|
627
627
|
"button",
|
|
628
628
|
{
|
|
629
|
-
onClick: (s) => l(s,
|
|
629
|
+
onClick: (s) => l(s, N),
|
|
630
630
|
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",
|
|
631
631
|
title: t("sidebar.share_conversation"),
|
|
632
|
-
children: /* @__PURE__ */ e(
|
|
632
|
+
children: /* @__PURE__ */ e(lt, { className: "w-4 h-4" })
|
|
633
633
|
}
|
|
634
634
|
)
|
|
635
635
|
] }),
|
|
636
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children:
|
|
637
|
-
const
|
|
636
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children: N ? T ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: t("chat_history.loading_messages") }) : w.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: w.map((s) => {
|
|
637
|
+
const f = s.role === "user", q = s.role === "assistant";
|
|
638
638
|
return /* @__PURE__ */ r(
|
|
639
639
|
"div",
|
|
640
640
|
{
|
|
641
|
-
className: `p-3.5 rounded-2xl transition-all relative ${
|
|
641
|
+
className: `p-3.5 rounded-2xl transition-all relative ${f ? "bg-primary/10 ms-12 rounded-te-sm" : q ? "glass shadow-sm me-12 rounded-ts-sm" : "bg-muted/30 border border-border/50"}`,
|
|
642
642
|
children: [
|
|
643
643
|
s.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: s.feedback === "like" ? "👍" : "👎" }) }),
|
|
644
644
|
/* @__PURE__ */ r("div", { className: "flex justify-between items-center mb-1.5", children: [
|
|
645
|
-
/* @__PURE__ */ e("span", { className: `text-[10px] font-bold uppercase tracking-wider ${
|
|
645
|
+
/* @__PURE__ */ e("span", { className: `text-[10px] font-bold uppercase tracking-wider ${f || q ? "text-primary" : "text-muted-foreground"}`, children: f ? N?.user_info?.name ? `${N.user_info.name} ${N.user_info.surname || ""}`.trim() : t("chat_history.user_label") : q ? t("chat_history.assistant_label") : `${s.role}` }),
|
|
646
646
|
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children: g(s.created_at) })
|
|
647
647
|
] }),
|
|
648
|
-
/* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children: s.parts && s.parts.length > 0 ? s.parts.map((
|
|
648
|
+
/* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children: s.parts && s.parts.length > 0 ? s.parts.map((i, y) => j(i, y)) : typeof s.content == "object" ? /* @__PURE__ */ e("pre", { className: "text-xs font-mono bg-muted/40 p-2.5 rounded-xl", dir: "ltr", children: JSON.stringify(s.content, null, 2) }) : s.content })
|
|
649
649
|
]
|
|
650
650
|
},
|
|
651
651
|
s.id
|
|
@@ -658,13 +658,13 @@ function pt() {
|
|
|
658
658
|
] })
|
|
659
659
|
] });
|
|
660
660
|
}
|
|
661
|
-
function
|
|
662
|
-
const { t, i18n:
|
|
661
|
+
function Nt() {
|
|
662
|
+
const { t, i18n: n } = ee(["admin", "translation"]), [o, m] = x([]), [b, p] = x(!1), [N, _] = x(""), [w, H] = x(!1), [T, A] = x(null), [I, D] = x([]), [C, O] = x(null), U = n.language === "fa", [v, z] = x({
|
|
663
663
|
username: "",
|
|
664
664
|
password: "",
|
|
665
665
|
name: "",
|
|
666
666
|
permissions: []
|
|
667
|
-
}),
|
|
667
|
+
}), R = async () => {
|
|
668
668
|
p(!0), _("");
|
|
669
669
|
try {
|
|
670
670
|
const c = await k.listAdmins();
|
|
@@ -676,7 +676,7 @@ function gt() {
|
|
|
676
676
|
} finally {
|
|
677
677
|
p(!1);
|
|
678
678
|
}
|
|
679
|
-
},
|
|
679
|
+
}, E = async () => {
|
|
680
680
|
try {
|
|
681
681
|
const c = await k.listPermissions();
|
|
682
682
|
D(c.permissions);
|
|
@@ -684,40 +684,40 @@ function gt() {
|
|
|
684
684
|
console.error("Failed to load permissions", c);
|
|
685
685
|
}
|
|
686
686
|
};
|
|
687
|
-
|
|
688
|
-
|
|
687
|
+
W(() => {
|
|
688
|
+
R(), E();
|
|
689
689
|
}, []);
|
|
690
690
|
const V = async (c) => {
|
|
691
691
|
c.preventDefault(), p(!0);
|
|
692
692
|
try {
|
|
693
693
|
await k.register(
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
),
|
|
694
|
+
v.username,
|
|
695
|
+
v.password,
|
|
696
|
+
v.name,
|
|
697
|
+
v.permissions
|
|
698
|
+
), H(!1), z({ username: "", password: "", name: "", permissions: [] }), R();
|
|
699
699
|
} catch (l) {
|
|
700
700
|
_(l instanceof Error ? l.message : t("error_loading"));
|
|
701
701
|
} finally {
|
|
702
702
|
p(!1);
|
|
703
703
|
}
|
|
704
|
-
},
|
|
704
|
+
}, Z = async (c) => {
|
|
705
705
|
if (c.preventDefault(), !!T) {
|
|
706
706
|
p(!0);
|
|
707
707
|
try {
|
|
708
708
|
const l = {
|
|
709
|
-
name:
|
|
710
|
-
permissions:
|
|
709
|
+
name: v.name,
|
|
710
|
+
permissions: v.permissions
|
|
711
711
|
};
|
|
712
|
-
if (
|
|
712
|
+
if (v.password && (l.password = v.password), await k.updateAdmin(T.id, l), T.id === C) {
|
|
713
713
|
const g = localStorage.getItem("admin_info");
|
|
714
714
|
if (g) {
|
|
715
|
-
const
|
|
716
|
-
|
|
715
|
+
const L = JSON.parse(g);
|
|
716
|
+
L.name = v.name, L.permissions = v.permissions, localStorage.setItem("admin_info", JSON.stringify(L)), window.location.reload();
|
|
717
717
|
return;
|
|
718
718
|
}
|
|
719
719
|
}
|
|
720
|
-
|
|
720
|
+
A(null), z({ username: "", password: "", name: "", permissions: [] }), R();
|
|
721
721
|
} catch (l) {
|
|
722
722
|
_(l instanceof Error ? l.message : t("error_loading"));
|
|
723
723
|
} finally {
|
|
@@ -727,19 +727,19 @@ function gt() {
|
|
|
727
727
|
}, B = async (c) => {
|
|
728
728
|
if (confirm(t("admins.confirm_delete_admin")))
|
|
729
729
|
try {
|
|
730
|
-
await k.deleteAdmin(c),
|
|
730
|
+
await k.deleteAdmin(c), R();
|
|
731
731
|
} catch (l) {
|
|
732
732
|
_(l instanceof Error ? l.message : t("error_loading"));
|
|
733
733
|
}
|
|
734
|
-
},
|
|
735
|
-
|
|
734
|
+
}, u = (c) => {
|
|
735
|
+
A(c), z({
|
|
736
736
|
username: c.username,
|
|
737
737
|
password: "",
|
|
738
738
|
name: c.name,
|
|
739
739
|
permissions: c.permissions
|
|
740
|
-
}),
|
|
741
|
-
},
|
|
742
|
-
|
|
740
|
+
}), H(!0);
|
|
741
|
+
}, J = (c) => {
|
|
742
|
+
z((l) => ({
|
|
743
743
|
...l,
|
|
744
744
|
permissions: l.permissions.includes(c) ? l.permissions.filter((g) => g !== c) : [...l.permissions, c]
|
|
745
745
|
}));
|
|
@@ -762,16 +762,16 @@ function gt() {
|
|
|
762
762
|
return c;
|
|
763
763
|
}
|
|
764
764
|
};
|
|
765
|
-
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir:
|
|
765
|
+
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: U ? "rtl" : "ltr", children: [
|
|
766
766
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
|
|
767
767
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("admins.title") }),
|
|
768
768
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
769
|
-
/* @__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:
|
|
769
|
+
/* @__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: o.length }) }),
|
|
770
770
|
/* @__PURE__ */ e(
|
|
771
771
|
"button",
|
|
772
772
|
{
|
|
773
773
|
onClick: () => {
|
|
774
|
-
|
|
774
|
+
A(null), z({ username: "", password: "", name: "", permissions: [] }), H(!0);
|
|
775
775
|
},
|
|
776
776
|
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",
|
|
777
777
|
children: t("admins.add_admin")
|
|
@@ -779,10 +779,10 @@ function gt() {
|
|
|
779
779
|
)
|
|
780
780
|
] })
|
|
781
781
|
] }),
|
|
782
|
-
|
|
783
|
-
|
|
782
|
+
N && /* @__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: N }),
|
|
783
|
+
w && /* @__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: [
|
|
784
784
|
/* @__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(T ? "admins.edit_admin" : "admins.add_admin") }) }),
|
|
785
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: T ?
|
|
785
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: T ? Z : V, className: "space-y-5", children: [
|
|
786
786
|
/* @__PURE__ */ r("div", { children: [
|
|
787
787
|
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("admins.username") }),
|
|
788
788
|
/* @__PURE__ */ e(
|
|
@@ -790,8 +790,8 @@ function gt() {
|
|
|
790
790
|
{
|
|
791
791
|
type: "text",
|
|
792
792
|
disabled: !!T,
|
|
793
|
-
value:
|
|
794
|
-
onChange: (c) =>
|
|
793
|
+
value: v.username,
|
|
794
|
+
onChange: (c) => z({ ...v, username: c.target.value }),
|
|
795
795
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground disabled:opacity-50 focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm font-mono dir-ltr",
|
|
796
796
|
required: !0,
|
|
797
797
|
dir: "ltr"
|
|
@@ -804,8 +804,8 @@ function gt() {
|
|
|
804
804
|
"input",
|
|
805
805
|
{
|
|
806
806
|
type: "text",
|
|
807
|
-
value:
|
|
808
|
-
onChange: (c) =>
|
|
807
|
+
value: v.name,
|
|
808
|
+
onChange: (c) => z({ ...v, name: c.target.value }),
|
|
809
809
|
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",
|
|
810
810
|
required: !0
|
|
811
811
|
}
|
|
@@ -817,8 +817,8 @@ function gt() {
|
|
|
817
817
|
"input",
|
|
818
818
|
{
|
|
819
819
|
type: "password",
|
|
820
|
-
value:
|
|
821
|
-
onChange: (c) =>
|
|
820
|
+
value: v.password,
|
|
821
|
+
onChange: (c) => z({ ...v, password: c.target.value }),
|
|
822
822
|
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 font-mono dir-ltr",
|
|
823
823
|
required: !T,
|
|
824
824
|
dir: "ltr"
|
|
@@ -827,14 +827,14 @@ function gt() {
|
|
|
827
827
|
] }),
|
|
828
828
|
/* @__PURE__ */ r("div", { children: [
|
|
829
829
|
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("admins.permissions") }),
|
|
830
|
-
/* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children:
|
|
830
|
+
/* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children: I.map((c) => /* @__PURE__ */ r("label", { className: "flex items-center gap-3 cursor-pointer group", children: [
|
|
831
831
|
/* @__PURE__ */ e("div", { className: "relative flex items-center", children: /* @__PURE__ */ e(
|
|
832
832
|
"input",
|
|
833
833
|
{
|
|
834
834
|
type: "checkbox",
|
|
835
|
-
checked:
|
|
836
|
-
onChange: () =>
|
|
837
|
-
disabled:
|
|
835
|
+
checked: v.permissions.includes(c),
|
|
836
|
+
onChange: () => J(c),
|
|
837
|
+
disabled: v.username === "admin" && c === "admin_management",
|
|
838
838
|
className: "peer h-4 w-4 rounded border-input text-primary focus:ring-ring transition-all disabled:opacity-50"
|
|
839
839
|
}
|
|
840
840
|
) }),
|
|
@@ -846,7 +846,7 @@ function gt() {
|
|
|
846
846
|
"button",
|
|
847
847
|
{
|
|
848
848
|
type: "button",
|
|
849
|
-
onClick: () =>
|
|
849
|
+
onClick: () => H(!1),
|
|
850
850
|
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",
|
|
851
851
|
children: t("cancel")
|
|
852
852
|
}
|
|
@@ -855,23 +855,23 @@ function gt() {
|
|
|
855
855
|
"button",
|
|
856
856
|
{
|
|
857
857
|
type: "submit",
|
|
858
|
-
disabled:
|
|
858
|
+
disabled: b,
|
|
859
859
|
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",
|
|
860
|
-
children: t(
|
|
860
|
+
children: t(b ? "saving" : "save")
|
|
861
861
|
}
|
|
862
862
|
)
|
|
863
863
|
] })
|
|
864
864
|
] }) })
|
|
865
865
|
] }) }),
|
|
866
866
|
/* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ r("div", { className: "overflow-x-auto flex-1", children: [
|
|
867
|
-
/* @__PURE__ */ r("table", { className: `w-full ${
|
|
867
|
+
/* @__PURE__ */ r("table", { className: `w-full ${U ? "text-right" : "text-left"} border-collapse`, children: [
|
|
868
868
|
/* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ r("tr", { children: [
|
|
869
869
|
/* @__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.name") }),
|
|
870
870
|
/* @__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.username") }),
|
|
871
871
|
/* @__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") }),
|
|
872
872
|
/* @__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") })
|
|
873
873
|
] }) }),
|
|
874
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children:
|
|
874
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: o.map((c) => /* @__PURE__ */ r("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
|
|
875
875
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children: c.name }),
|
|
876
876
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground font-mono", dir: "ltr", children: c.username }),
|
|
877
877
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: c.permissions.map((l) => /* @__PURE__ */ e("span", { className: "px-2 py-0.5 bg-muted/50 text-foreground/80 rounded text-[10px] border border-border/50", children: d(l) }, l)) }) }),
|
|
@@ -879,13 +879,13 @@ function gt() {
|
|
|
879
879
|
/* @__PURE__ */ e(
|
|
880
880
|
"button",
|
|
881
881
|
{
|
|
882
|
-
onClick: () =>
|
|
882
|
+
onClick: () => u(c),
|
|
883
883
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
884
884
|
title: t("edit"),
|
|
885
885
|
children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" }) })
|
|
886
886
|
}
|
|
887
887
|
),
|
|
888
|
-
c.id !==
|
|
888
|
+
c.id !== C && /* @__PURE__ */ e(
|
|
889
889
|
"button",
|
|
890
890
|
{
|
|
891
891
|
onClick: () => B(c.id),
|
|
@@ -897,19 +897,20 @@ function gt() {
|
|
|
897
897
|
] }) })
|
|
898
898
|
] }, c.id)) })
|
|
899
899
|
] }),
|
|
900
|
-
|
|
900
|
+
o.length === 0 && !b && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
|
|
901
901
|
/* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1, stroke: "currentColor", className: "w-12 h-12 opacity-20", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" }) }),
|
|
902
902
|
t("admins.no_admins")
|
|
903
903
|
] }),
|
|
904
|
-
|
|
904
|
+
b && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-3", children: [
|
|
905
905
|
/* @__PURE__ */ e("div", { className: "w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin" }),
|
|
906
906
|
/* @__PURE__ */ e("span", { children: t("loading") })
|
|
907
907
|
] })
|
|
908
908
|
] }) })
|
|
909
909
|
] });
|
|
910
910
|
}
|
|
911
|
-
|
|
912
|
-
|
|
911
|
+
const wt = (t) => t.replace(/[^0-9]/g, "");
|
|
912
|
+
function _t() {
|
|
913
|
+
const { t, i18n: n } = ee(["admin", "translation"]), { app: o } = me(), [m, b] = x([]), [p, N] = x(!1), [_, w] = x(""), [H, T] = x(!1), [A, I] = x(null), [D, C] = x(""), [O, U] = x(0), [v, z] = x(null), R = pe(() => o?.userMetadataFields || [], [o?.userMetadataFields]), [E, V] = x(null), [Z, B] = x(""), [u, J] = x(""), [d, c] = x(""), [l, g] = x(""), L = n.language === "fa", P = L ? "text-right" : "text-left", [h, j] = x({
|
|
913
914
|
phone: "",
|
|
914
915
|
name: "",
|
|
915
916
|
surname: "",
|
|
@@ -919,160 +920,199 @@ function ft() {
|
|
|
919
920
|
requestsLimit: "",
|
|
920
921
|
metadata: ""
|
|
921
922
|
// Keep raw JSON for advanced users
|
|
922
|
-
}), [M,
|
|
923
|
-
|
|
923
|
+
}), [M, s] = x({}), f = async () => {
|
|
924
|
+
N(!0), w("");
|
|
924
925
|
try {
|
|
925
|
-
const
|
|
926
|
-
|
|
927
|
-
} catch (
|
|
928
|
-
|
|
926
|
+
const a = await k.listUsers(0, 100, D);
|
|
927
|
+
b(a.users || []), U(a.count || 0);
|
|
928
|
+
} catch (a) {
|
|
929
|
+
w(a instanceof Error ? a.message : t("error_loading"));
|
|
929
930
|
} finally {
|
|
930
|
-
|
|
931
|
+
N(!1);
|
|
932
|
+
}
|
|
933
|
+
}, q = async () => {
|
|
934
|
+
try {
|
|
935
|
+
const a = await k.getSettings();
|
|
936
|
+
z(a);
|
|
937
|
+
} catch (a) {
|
|
938
|
+
console.error("Failed to load app settings", a);
|
|
931
939
|
}
|
|
932
940
|
};
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
941
|
+
W(() => {
|
|
942
|
+
q();
|
|
943
|
+
}, []), W(() => {
|
|
944
|
+
v && !A && !h.tokens && !h.requests && j((a) => ({
|
|
945
|
+
...a,
|
|
946
|
+
tokens: v.initial_balance_tokens?.toString() || "",
|
|
947
|
+
requests: v.initial_balance_requests?.toString() || "",
|
|
948
|
+
tokensLimit: v.initial_balance_tokens?.toString() || "",
|
|
949
|
+
requestsLimit: v.initial_balance_requests?.toString() || ""
|
|
950
|
+
}));
|
|
951
|
+
}, [v]), W(() => {
|
|
952
|
+
const a = setTimeout(() => {
|
|
953
|
+
f();
|
|
936
954
|
}, 500);
|
|
937
|
-
return () => clearTimeout(
|
|
938
|
-
}, [D]),
|
|
955
|
+
return () => clearTimeout(a);
|
|
956
|
+
}, [D]), W(() => {
|
|
939
957
|
try {
|
|
940
|
-
const
|
|
941
|
-
|
|
958
|
+
const S = { ...h.metadata ? JSON.parse(h.metadata) : {}, ...M }, $ = JSON.stringify(S, null, 2);
|
|
959
|
+
$ !== h.metadata && j((K) => ({ ...K, metadata: $ }));
|
|
942
960
|
} catch {
|
|
943
961
|
}
|
|
944
|
-
}, [M]),
|
|
945
|
-
const
|
|
946
|
-
let
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
}),
|
|
950
|
-
}, [M,
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
const
|
|
954
|
-
if (
|
|
955
|
-
|
|
962
|
+
}, [M]), W(() => {
|
|
963
|
+
const a = { ...M };
|
|
964
|
+
let S = !1;
|
|
965
|
+
R.forEach(($) => {
|
|
966
|
+
$.condition && !ke($.condition, M) && a[$.key] !== void 0 && (delete a[$.key], S = !0);
|
|
967
|
+
}), S && s(a);
|
|
968
|
+
}, [M, R]);
|
|
969
|
+
const i = async (a) => {
|
|
970
|
+
a.preventDefault();
|
|
971
|
+
const S = h.tokens ? parseInt(h.tokens) : 0, $ = h.requests ? parseInt(h.requests) : 0, K = h.tokensLimit ? parseInt(h.tokensLimit) : S, te = h.requestsLimit ? parseInt(h.requestsLimit) : $;
|
|
972
|
+
if (S > K) {
|
|
973
|
+
w(t("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
956
974
|
return;
|
|
957
975
|
}
|
|
958
|
-
if (
|
|
959
|
-
|
|
976
|
+
if ($ > te) {
|
|
977
|
+
w(t("users.requests_exceed_limit", "Requests cannot exceed limit"));
|
|
960
978
|
return;
|
|
961
979
|
}
|
|
962
|
-
let
|
|
963
|
-
if (
|
|
980
|
+
let ge = {};
|
|
981
|
+
if (h.metadata)
|
|
964
982
|
try {
|
|
965
|
-
|
|
983
|
+
ge = JSON.parse(h.metadata);
|
|
966
984
|
} catch {
|
|
967
|
-
|
|
985
|
+
w(t("users.invalid_json", "Invalid JSON format"));
|
|
968
986
|
return;
|
|
969
987
|
}
|
|
970
|
-
|
|
988
|
+
N(!0);
|
|
971
989
|
try {
|
|
972
990
|
await k.createUser(
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
), T(!1),
|
|
991
|
+
h.phone,
|
|
992
|
+
h.name,
|
|
993
|
+
h.surname,
|
|
994
|
+
h.tokens ? parseInt(h.tokens) : void 0,
|
|
995
|
+
h.requests ? parseInt(h.requests) : void 0,
|
|
996
|
+
h.tokensLimit ? parseInt(h.tokensLimit) : void 0,
|
|
997
|
+
h.requestsLimit ? parseInt(h.requestsLimit) : void 0,
|
|
998
|
+
ge
|
|
999
|
+
), T(!1), F(), f();
|
|
982
1000
|
} catch (fe) {
|
|
983
|
-
|
|
1001
|
+
w(fe instanceof Error ? fe.message : t("error_loading"));
|
|
984
1002
|
} finally {
|
|
985
|
-
|
|
1003
|
+
N(!1);
|
|
986
1004
|
}
|
|
987
|
-
},
|
|
988
|
-
if (
|
|
989
|
-
let
|
|
990
|
-
if (
|
|
1005
|
+
}, y = async (a) => {
|
|
1006
|
+
if (a.preventDefault(), !A) return;
|
|
1007
|
+
let S = {};
|
|
1008
|
+
if (h.metadata)
|
|
991
1009
|
try {
|
|
992
|
-
|
|
1010
|
+
S = JSON.parse(h.metadata);
|
|
993
1011
|
} catch {
|
|
994
|
-
|
|
1012
|
+
w(t("users.invalid_json", "Invalid JSON format"));
|
|
995
1013
|
return;
|
|
996
1014
|
}
|
|
997
|
-
|
|
1015
|
+
N(!0);
|
|
998
1016
|
try {
|
|
999
|
-
await k.updateUser(
|
|
1000
|
-
phone:
|
|
1001
|
-
name:
|
|
1002
|
-
surname:
|
|
1003
|
-
metadata:
|
|
1004
|
-
}),
|
|
1005
|
-
} catch (
|
|
1006
|
-
|
|
1017
|
+
await k.updateUser(A.id, {
|
|
1018
|
+
phone: h.phone,
|
|
1019
|
+
name: h.name,
|
|
1020
|
+
surname: h.surname,
|
|
1021
|
+
metadata: S
|
|
1022
|
+
}), I(null), T(!1), F(), f();
|
|
1023
|
+
} catch ($) {
|
|
1024
|
+
w($ instanceof Error ? $.message : t("error_loading"));
|
|
1007
1025
|
} finally {
|
|
1008
|
-
|
|
1026
|
+
N(!1);
|
|
1009
1027
|
}
|
|
1010
|
-
},
|
|
1011
|
-
|
|
1012
|
-
|
|
1028
|
+
}, F = () => {
|
|
1029
|
+
j({
|
|
1030
|
+
phone: "",
|
|
1031
|
+
name: "",
|
|
1032
|
+
surname: "",
|
|
1033
|
+
tokens: v?.initial_balance_tokens?.toString() || "",
|
|
1034
|
+
requests: v?.initial_balance_requests?.toString() || "",
|
|
1035
|
+
tokensLimit: v?.initial_balance_tokens?.toString() || "",
|
|
1036
|
+
requestsLimit: v?.initial_balance_requests?.toString() || "",
|
|
1037
|
+
metadata: ""
|
|
1038
|
+
}), s({});
|
|
1039
|
+
}, X = async (a) => {
|
|
1013
1040
|
if (confirm(t("users.confirm_delete_user")))
|
|
1014
1041
|
try {
|
|
1015
|
-
await k.deleteUser(
|
|
1016
|
-
} catch (
|
|
1017
|
-
|
|
1042
|
+
await k.deleteUser(a), f();
|
|
1043
|
+
} catch (S) {
|
|
1044
|
+
w(S instanceof Error ? S.message : t("error_loading"));
|
|
1018
1045
|
}
|
|
1019
|
-
},
|
|
1046
|
+
}, $e = async (a) => {
|
|
1020
1047
|
try {
|
|
1021
|
-
const
|
|
1022
|
-
if (
|
|
1023
|
-
|
|
1048
|
+
const $ = (await k.refreshUserToken(a.id))?.user?.token;
|
|
1049
|
+
if (!$) {
|
|
1050
|
+
w(t("users.no_token"));
|
|
1024
1051
|
return;
|
|
1025
1052
|
}
|
|
1026
|
-
await navigator.clipboard.writeText(
|
|
1027
|
-
} catch (
|
|
1028
|
-
|
|
1053
|
+
await navigator.clipboard.writeText($), alert(t("users.token_copied"));
|
|
1054
|
+
} catch (S) {
|
|
1055
|
+
w(S instanceof Error ? S.message : t("error_loading"));
|
|
1029
1056
|
}
|
|
1030
|
-
},
|
|
1031
|
-
if (
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1057
|
+
}, De = async (a, S, $, K) => {
|
|
1058
|
+
if (E) {
|
|
1059
|
+
N(!0);
|
|
1060
|
+
try {
|
|
1061
|
+
await k.updateUserBalance(
|
|
1062
|
+
E.id,
|
|
1063
|
+
a,
|
|
1064
|
+
S,
|
|
1065
|
+
$,
|
|
1066
|
+
K
|
|
1067
|
+
), V(null), B(""), J(""), c(""), g(""), f();
|
|
1068
|
+
} catch (te) {
|
|
1069
|
+
w(te instanceof Error ? te.message : t("error_loading"));
|
|
1070
|
+
} finally {
|
|
1071
|
+
N(!1);
|
|
1072
|
+
}
|
|
1036
1073
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1074
|
+
}, Ee = async (a) => {
|
|
1075
|
+
if (a.preventDefault(), !E) return;
|
|
1076
|
+
const S = parseInt(Z) || 0, $ = parseInt(u) || 0, K = d ? parseInt(d) : E.balance?.token_limit || 0, te = l ? parseInt(l) : E.balance?.request_limit || 0;
|
|
1077
|
+
if (S > K) {
|
|
1078
|
+
w(t("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
1039
1079
|
return;
|
|
1040
1080
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
I.id,
|
|
1045
|
-
L,
|
|
1046
|
-
E,
|
|
1047
|
-
h ? parseInt(h) : void 0,
|
|
1048
|
-
d ? parseInt(d) : void 0
|
|
1049
|
-
), P(null), V(""), B(""), z(""), c(""), F();
|
|
1050
|
-
} catch (le) {
|
|
1051
|
-
N(le instanceof Error ? le.message : t("error_loading"));
|
|
1052
|
-
} finally {
|
|
1053
|
-
y(!1);
|
|
1081
|
+
if ($ > te) {
|
|
1082
|
+
w(t("users.requests_exceed_limit", "Requests cannot exceed limit"));
|
|
1083
|
+
return;
|
|
1054
1084
|
}
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1085
|
+
await De(
|
|
1086
|
+
S,
|
|
1087
|
+
$,
|
|
1088
|
+
d ? parseInt(d) : void 0,
|
|
1089
|
+
l ? parseInt(l) : void 0
|
|
1090
|
+
);
|
|
1091
|
+
}, Oe = () => {
|
|
1092
|
+
if (!E) return;
|
|
1093
|
+
const a = d || String(E.balance?.token_limit || 0), S = l || String(E.balance?.request_limit || 0);
|
|
1094
|
+
B(a), J(S);
|
|
1095
|
+
}, Re = (a) => {
|
|
1096
|
+
I(a);
|
|
1097
|
+
const S = a.metadata ? JSON.stringify(a.metadata, null, 2) : "";
|
|
1098
|
+
if (j({
|
|
1099
|
+
phone: a.phone,
|
|
1100
|
+
name: a.name,
|
|
1101
|
+
surname: a.surname,
|
|
1062
1102
|
tokens: "",
|
|
1063
1103
|
requests: "",
|
|
1064
1104
|
tokensLimit: "",
|
|
1065
1105
|
requestsLimit: "",
|
|
1066
|
-
metadata:
|
|
1067
|
-
}),
|
|
1068
|
-
const
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
}), $
|
|
1106
|
+
metadata: S
|
|
1107
|
+
}), a.metadata) {
|
|
1108
|
+
const $ = {};
|
|
1109
|
+
R.forEach((K) => {
|
|
1110
|
+
a.metadata?.[K.key] !== void 0 ? $[K.key] = a.metadata[K.key] : K.defaultValue !== void 0 && ($[K.key] = K.defaultValue);
|
|
1111
|
+
}), s($);
|
|
1072
1112
|
}
|
|
1073
1113
|
T(!0);
|
|
1074
1114
|
};
|
|
1075
|
-
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir:
|
|
1115
|
+
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: L ? "rtl" : "ltr", children: [
|
|
1076
1116
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
|
|
1077
1117
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("users.title") }),
|
|
1078
1118
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row items-center gap-2 flex-1 max-w-4xl justify-end", children: [
|
|
@@ -1081,7 +1121,7 @@ function ft() {
|
|
|
1081
1121
|
{
|
|
1082
1122
|
type: "text",
|
|
1083
1123
|
value: D,
|
|
1084
|
-
onChange: (
|
|
1124
|
+
onChange: (a) => C(a.target.value),
|
|
1085
1125
|
placeholder: t("chat_history.search_placeholder"),
|
|
1086
1126
|
className: "w-full 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"
|
|
1087
1127
|
}
|
|
@@ -1092,7 +1132,7 @@ function ft() {
|
|
|
1092
1132
|
"button",
|
|
1093
1133
|
{
|
|
1094
1134
|
onClick: () => {
|
|
1095
|
-
|
|
1135
|
+
I(null), F(), T(!0);
|
|
1096
1136
|
},
|
|
1097
1137
|
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",
|
|
1098
1138
|
children: t("users.add_user")
|
|
@@ -1103,11 +1143,11 @@ function ft() {
|
|
|
1103
1143
|
] }),
|
|
1104
1144
|
_ && /* @__PURE__ */ r("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm flex-shrink-0 flex justify-between items-center group", children: [
|
|
1105
1145
|
/* @__PURE__ */ e("span", { children: _ }),
|
|
1106
|
-
/* @__PURE__ */ e("button", { onClick: () =>
|
|
1146
|
+
/* @__PURE__ */ e("button", { onClick: () => w(""), className: "opacity-50 hover:opacity-100 transition-opacity p-1", children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) }) })
|
|
1107
1147
|
] }),
|
|
1108
|
-
|
|
1109
|
-
/* @__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(
|
|
1110
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit:
|
|
1148
|
+
H && /* @__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-xl shadow-2xl overflow-hidden", children: [
|
|
1149
|
+
/* @__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(A ? "users.edit_user" : "users.add_user") }) }),
|
|
1150
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: A ? y : i, children: [
|
|
1111
1151
|
/* @__PURE__ */ r("div", { className: "space-y-6 max-h-[60vh] overflow-y-auto px-1 custom-scrollbar", children: [
|
|
1112
1152
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
1113
1153
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -1116,9 +1156,9 @@ function ft() {
|
|
|
1116
1156
|
"input",
|
|
1117
1157
|
{
|
|
1118
1158
|
type: "text",
|
|
1119
|
-
value:
|
|
1120
|
-
onChange: (
|
|
1121
|
-
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
|
|
1159
|
+
value: h.phone,
|
|
1160
|
+
onChange: (a) => j({ ...h, phone: wt(a.target.value) }),
|
|
1161
|
+
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",
|
|
1122
1162
|
placeholder: t("users.phone_placeholder"),
|
|
1123
1163
|
required: !0,
|
|
1124
1164
|
dir: "ltr"
|
|
@@ -1132,9 +1172,9 @@ function ft() {
|
|
|
1132
1172
|
"input",
|
|
1133
1173
|
{
|
|
1134
1174
|
type: "text",
|
|
1135
|
-
value:
|
|
1136
|
-
onChange: (
|
|
1137
|
-
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 ${
|
|
1175
|
+
value: h.name,
|
|
1176
|
+
onChange: (a) => j({ ...h, name: a.target.value }),
|
|
1177
|
+
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 ${P}`,
|
|
1138
1178
|
required: !0
|
|
1139
1179
|
}
|
|
1140
1180
|
)
|
|
@@ -1145,16 +1185,16 @@ function ft() {
|
|
|
1145
1185
|
"input",
|
|
1146
1186
|
{
|
|
1147
1187
|
type: "text",
|
|
1148
|
-
value:
|
|
1149
|
-
onChange: (
|
|
1150
|
-
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 ${
|
|
1188
|
+
value: h.surname,
|
|
1189
|
+
onChange: (a) => j({ ...h, surname: a.target.value }),
|
|
1190
|
+
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 ${P}`,
|
|
1151
1191
|
required: !0
|
|
1152
1192
|
}
|
|
1153
1193
|
)
|
|
1154
1194
|
] })
|
|
1155
1195
|
] })
|
|
1156
1196
|
] }),
|
|
1157
|
-
!
|
|
1197
|
+
!A && /* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
|
|
1158
1198
|
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: t("users.initial_balance") }),
|
|
1159
1199
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1160
1200
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -1163,9 +1203,9 @@ function ft() {
|
|
|
1163
1203
|
"input",
|
|
1164
1204
|
{
|
|
1165
1205
|
type: "number",
|
|
1166
|
-
value:
|
|
1167
|
-
onChange: (
|
|
1168
|
-
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
|
|
1206
|
+
value: h.tokens,
|
|
1207
|
+
onChange: (a) => j({ ...h, tokens: a.target.value }),
|
|
1208
|
+
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",
|
|
1169
1209
|
dir: "ltr",
|
|
1170
1210
|
placeholder: "0"
|
|
1171
1211
|
}
|
|
@@ -1177,11 +1217,11 @@ function ft() {
|
|
|
1177
1217
|
"input",
|
|
1178
1218
|
{
|
|
1179
1219
|
type: "number",
|
|
1180
|
-
value:
|
|
1181
|
-
onChange: (
|
|
1182
|
-
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
|
|
1220
|
+
value: h.tokensLimit,
|
|
1221
|
+
onChange: (a) => j({ ...h, tokensLimit: a.target.value }),
|
|
1222
|
+
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",
|
|
1183
1223
|
dir: "ltr",
|
|
1184
|
-
placeholder:
|
|
1224
|
+
placeholder: h.tokens || String(v?.initial_balance_tokens ?? "250000")
|
|
1185
1225
|
}
|
|
1186
1226
|
)
|
|
1187
1227
|
] })
|
|
@@ -1193,11 +1233,11 @@ function ft() {
|
|
|
1193
1233
|
"input",
|
|
1194
1234
|
{
|
|
1195
1235
|
type: "number",
|
|
1196
|
-
value:
|
|
1197
|
-
onChange: (
|
|
1198
|
-
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
|
|
1236
|
+
value: h.requests,
|
|
1237
|
+
onChange: (a) => j({ ...h, requests: a.target.value }),
|
|
1238
|
+
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",
|
|
1199
1239
|
dir: "ltr",
|
|
1200
|
-
placeholder: "0"
|
|
1240
|
+
placeholder: h.requests || String(v?.initial_balance_requests ?? "0")
|
|
1201
1241
|
}
|
|
1202
1242
|
)
|
|
1203
1243
|
] }),
|
|
@@ -1207,59 +1247,59 @@ function ft() {
|
|
|
1207
1247
|
"input",
|
|
1208
1248
|
{
|
|
1209
1249
|
type: "number",
|
|
1210
|
-
value:
|
|
1211
|
-
onChange: (
|
|
1212
|
-
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
|
|
1250
|
+
value: h.requestsLimit,
|
|
1251
|
+
onChange: (a) => j({ ...h, requestsLimit: a.target.value }),
|
|
1252
|
+
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",
|
|
1213
1253
|
dir: "ltr",
|
|
1214
|
-
placeholder:
|
|
1254
|
+
placeholder: h.requests || String(v?.initial_balance_requests ?? "100")
|
|
1215
1255
|
}
|
|
1216
1256
|
)
|
|
1217
1257
|
] })
|
|
1218
1258
|
] })
|
|
1219
1259
|
] }),
|
|
1220
|
-
|
|
1260
|
+
R.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
|
|
1221
1261
|
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: t("users.custom_fields") }),
|
|
1222
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children:
|
|
1262
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: R.map((a) => ke(a.condition, M) ? /* @__PURE__ */ r("div", { className: "animate-in fade-in slide-in-from-top-1 duration-200", children: [
|
|
1223
1263
|
/* @__PURE__ */ r("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: [
|
|
1224
|
-
t(
|
|
1264
|
+
t(a.label),
|
|
1225
1265
|
" ",
|
|
1226
|
-
|
|
1266
|
+
a.required && /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
1227
1267
|
] }),
|
|
1228
|
-
|
|
1229
|
-
|
|
1268
|
+
a.type === "select" ? /* @__PURE__ */ r(
|
|
1269
|
+
ne,
|
|
1230
1270
|
{
|
|
1231
|
-
value: String(M[
|
|
1232
|
-
onValueChange: (
|
|
1233
|
-
required:
|
|
1234
|
-
dir:
|
|
1271
|
+
value: String(M[a.key] || ""),
|
|
1272
|
+
onValueChange: (S) => s({ ...M, [a.key]: S }),
|
|
1273
|
+
required: a.required,
|
|
1274
|
+
dir: L ? "rtl" : "ltr",
|
|
1235
1275
|
children: [
|
|
1236
|
-
/* @__PURE__ */ e(
|
|
1237
|
-
/* @__PURE__ */ e(
|
|
1276
|
+
/* @__PURE__ */ e(ie, { className: be("w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]", P), children: /* @__PURE__ */ e(oe, { placeholder: t(a.placeholder || "select_placeholder") }) }),
|
|
1277
|
+
/* @__PURE__ */ e(le, { className: "rounded-xl border-border bg-card", children: a.options?.map((S) => /* @__PURE__ */ e(G, { value: String(S.value), children: t(S.label) }, String(S.value))) })
|
|
1238
1278
|
]
|
|
1239
1279
|
}
|
|
1240
|
-
) :
|
|
1280
|
+
) : a.type === "checkbox" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-3 h-[46px] px-1", children: [
|
|
1241
1281
|
/* @__PURE__ */ e(
|
|
1242
|
-
|
|
1282
|
+
Pe,
|
|
1243
1283
|
{
|
|
1244
|
-
id: `admin-md-${
|
|
1245
|
-
checked: !!M[
|
|
1246
|
-
onCheckedChange: (
|
|
1247
|
-
required:
|
|
1284
|
+
id: `admin-md-${a.key}`,
|
|
1285
|
+
checked: !!M[a.key],
|
|
1286
|
+
onCheckedChange: (S) => s({ ...M, [a.key]: !!S }),
|
|
1287
|
+
required: a.required
|
|
1248
1288
|
}
|
|
1249
1289
|
),
|
|
1250
|
-
/* @__PURE__ */ e("label", { htmlFor: `admin-md-${
|
|
1290
|
+
/* @__PURE__ */ e("label", { htmlFor: `admin-md-${a.key}`, className: "text-sm text-foreground/80 cursor-pointer select-none", children: t(a.placeholder || a.label) })
|
|
1251
1291
|
] }) : /* @__PURE__ */ e(
|
|
1252
1292
|
"input",
|
|
1253
1293
|
{
|
|
1254
|
-
type:
|
|
1255
|
-
value: M[
|
|
1256
|
-
onChange: (
|
|
1257
|
-
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 ${
|
|
1258
|
-
placeholder: t(
|
|
1259
|
-
required:
|
|
1294
|
+
type: a.type,
|
|
1295
|
+
value: M[a.key] || "",
|
|
1296
|
+
onChange: (S) => s({ ...M, [a.key]: S.target.value }),
|
|
1297
|
+
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 ${P}`,
|
|
1298
|
+
placeholder: t(a.placeholder || ""),
|
|
1299
|
+
required: a.required
|
|
1260
1300
|
}
|
|
1261
1301
|
)
|
|
1262
|
-
] },
|
|
1302
|
+
] }, a.key) : null) })
|
|
1263
1303
|
] }),
|
|
1264
1304
|
/* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4", children: [
|
|
1265
1305
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between mb-2", children: [
|
|
@@ -1269,8 +1309,8 @@ function ft() {
|
|
|
1269
1309
|
/* @__PURE__ */ e(
|
|
1270
1310
|
"textarea",
|
|
1271
1311
|
{
|
|
1272
|
-
value:
|
|
1273
|
-
onChange: (
|
|
1312
|
+
value: h.metadata,
|
|
1313
|
+
onChange: (a) => j({ ...h, metadata: a.target.value }),
|
|
1274
1314
|
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",
|
|
1275
1315
|
placeholder: '{ "key": "value" }',
|
|
1276
1316
|
dir: "ltr"
|
|
@@ -1284,7 +1324,7 @@ function ft() {
|
|
|
1284
1324
|
{
|
|
1285
1325
|
type: "button",
|
|
1286
1326
|
onClick: () => {
|
|
1287
|
-
T(!1),
|
|
1327
|
+
T(!1), I(null);
|
|
1288
1328
|
},
|
|
1289
1329
|
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",
|
|
1290
1330
|
children: t("cancel")
|
|
@@ -1302,13 +1342,25 @@ function ft() {
|
|
|
1302
1342
|
] })
|
|
1303
1343
|
] }) })
|
|
1304
1344
|
] }) }),
|
|
1305
|
-
|
|
1306
|
-
/* @__PURE__ */
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1345
|
+
E && /* @__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-sm shadow-2xl overflow-hidden", children: [
|
|
1346
|
+
/* @__PURE__ */ r("div", { className: "px-6 py-5 border-b border-border bg-muted/20 flex items-center justify-between", children: [
|
|
1347
|
+
/* @__PURE__ */ r("h3", { className: "text-lg font-bold text-foreground", children: [
|
|
1348
|
+
t("users.update_balance_for"),
|
|
1349
|
+
" ",
|
|
1350
|
+
E.name
|
|
1351
|
+
] }),
|
|
1352
|
+
/* @__PURE__ */ e(
|
|
1353
|
+
"button",
|
|
1354
|
+
{
|
|
1355
|
+
onClick: () => {
|
|
1356
|
+
V(null), w("");
|
|
1357
|
+
},
|
|
1358
|
+
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
1359
|
+
children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", className: "w-5 h-5", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
|
|
1360
|
+
}
|
|
1361
|
+
)
|
|
1362
|
+
] }),
|
|
1363
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: Ee, children: [
|
|
1312
1364
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
1313
1365
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1314
1366
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -1317,9 +1369,9 @@ function ft() {
|
|
|
1317
1369
|
"input",
|
|
1318
1370
|
{
|
|
1319
1371
|
type: "number",
|
|
1320
|
-
value:
|
|
1321
|
-
onChange: (
|
|
1322
|
-
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
|
|
1372
|
+
value: Z,
|
|
1373
|
+
onChange: (a) => B(a.target.value),
|
|
1374
|
+
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",
|
|
1323
1375
|
required: !0,
|
|
1324
1376
|
dir: "ltr"
|
|
1325
1377
|
}
|
|
@@ -1331,11 +1383,11 @@ function ft() {
|
|
|
1331
1383
|
"input",
|
|
1332
1384
|
{
|
|
1333
1385
|
type: "number",
|
|
1334
|
-
value:
|
|
1335
|
-
onChange: (
|
|
1336
|
-
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
|
|
1386
|
+
value: d,
|
|
1387
|
+
onChange: (a) => c(a.target.value),
|
|
1388
|
+
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",
|
|
1337
1389
|
dir: "ltr",
|
|
1338
|
-
placeholder:
|
|
1390
|
+
placeholder: Z
|
|
1339
1391
|
}
|
|
1340
1392
|
)
|
|
1341
1393
|
] })
|
|
@@ -1347,9 +1399,9 @@ function ft() {
|
|
|
1347
1399
|
"input",
|
|
1348
1400
|
{
|
|
1349
1401
|
type: "number",
|
|
1350
|
-
value:
|
|
1351
|
-
onChange: (
|
|
1352
|
-
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
|
|
1402
|
+
value: u,
|
|
1403
|
+
onChange: (a) => J(a.target.value),
|
|
1404
|
+
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",
|
|
1353
1405
|
required: !0,
|
|
1354
1406
|
dir: "ltr"
|
|
1355
1407
|
}
|
|
@@ -1361,11 +1413,11 @@ function ft() {
|
|
|
1361
1413
|
"input",
|
|
1362
1414
|
{
|
|
1363
1415
|
type: "number",
|
|
1364
|
-
value:
|
|
1365
|
-
onChange: (
|
|
1366
|
-
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
|
|
1416
|
+
value: l,
|
|
1417
|
+
onChange: (a) => g(a.target.value),
|
|
1418
|
+
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",
|
|
1367
1419
|
dir: "ltr",
|
|
1368
|
-
placeholder:
|
|
1420
|
+
placeholder: u
|
|
1369
1421
|
}
|
|
1370
1422
|
)
|
|
1371
1423
|
] })
|
|
@@ -1376,11 +1428,9 @@ function ft() {
|
|
|
1376
1428
|
"button",
|
|
1377
1429
|
{
|
|
1378
1430
|
type: "button",
|
|
1379
|
-
onClick:
|
|
1380
|
-
P(null), N("");
|
|
1381
|
-
},
|
|
1431
|
+
onClick: Oe,
|
|
1382
1432
|
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",
|
|
1383
|
-
children: t("
|
|
1433
|
+
children: t("users.full_charge")
|
|
1384
1434
|
}
|
|
1385
1435
|
),
|
|
1386
1436
|
/* @__PURE__ */ e(
|
|
@@ -1388,7 +1438,7 @@ function ft() {
|
|
|
1388
1438
|
{
|
|
1389
1439
|
type: "submit",
|
|
1390
1440
|
disabled: p,
|
|
1391
|
-
className: "flex-1 px-4 py-3 bg-
|
|
1441
|
+
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",
|
|
1392
1442
|
children: t(p ? "users.updating" : "users.update_balance")
|
|
1393
1443
|
}
|
|
1394
1444
|
)
|
|
@@ -1396,42 +1446,42 @@ function ft() {
|
|
|
1396
1446
|
] }) })
|
|
1397
1447
|
] }) }),
|
|
1398
1448
|
/* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ r("div", { className: "overflow-x-auto flex-1 custom-scrollbar", children: [
|
|
1399
|
-
/* @__PURE__ */ r("table", { className: `w-full ${
|
|
1449
|
+
/* @__PURE__ */ r("table", { className: `w-full ${L ? "text-right" : "text-left"} border-collapse`, children: [
|
|
1400
1450
|
/* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ r("tr", { children: [
|
|
1401
1451
|
/* @__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.phone") }),
|
|
1402
1452
|
/* @__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.name") }),
|
|
1403
1453
|
/* @__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.surname") }),
|
|
1404
|
-
|
|
1454
|
+
R.map((a) => /* @__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(a.label) }, a.key)),
|
|
1405
1455
|
/* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50 w-[120px]", children: t("users.balance") }),
|
|
1406
1456
|
/* @__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") })
|
|
1407
1457
|
] }) }),
|
|
1408
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: m.map((
|
|
1409
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground font-mono", dir: "ltr", children:
|
|
1410
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children:
|
|
1411
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children:
|
|
1412
|
-
|
|
1413
|
-
const
|
|
1414
|
-
let
|
|
1415
|
-
if (
|
|
1416
|
-
const
|
|
1417
|
-
|
|
1458
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: m.map((a) => /* @__PURE__ */ r("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
|
|
1459
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground font-mono", dir: "ltr", children: a.phone }),
|
|
1460
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children: a.name }),
|
|
1461
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: a.surname }),
|
|
1462
|
+
R.map((S) => {
|
|
1463
|
+
const $ = a.metadata?.[S.key];
|
|
1464
|
+
let K = String($ ?? "");
|
|
1465
|
+
if (S.type === "select" && $ !== void 0) {
|
|
1466
|
+
const te = S.options?.find((ge) => String(ge.value) === String($));
|
|
1467
|
+
te && (K = t(te.label));
|
|
1418
1468
|
}
|
|
1419
|
-
return /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children:
|
|
1469
|
+
return /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: S.type === "checkbox" ? $ ? /* @__PURE__ */ e("span", { className: "text-emerald-500 font-bold", children: "✓" }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground opacity-30", children: "✗" }) : K }, S.key);
|
|
1420
1470
|
}),
|
|
1421
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground w-[120px]", children:
|
|
1471
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground w-[120px]", children: a.balance ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 min-w-0 py-1", children: [
|
|
1422
1472
|
/* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
1423
1473
|
/* @__PURE__ */ r("div", { className: "flex justify-between text-[10px] font-semibold", children: [
|
|
1424
1474
|
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t("users.tokens_label") }),
|
|
1425
1475
|
/* @__PURE__ */ r("span", { className: "text-foreground", children: [
|
|
1426
|
-
(
|
|
1476
|
+
(a.balance.token_limit > 0 ? Math.round(a.balance.tokens / a.balance.token_limit * 100) : 0).toLocaleString(n.language),
|
|
1427
1477
|
"%"
|
|
1428
1478
|
] })
|
|
1429
1479
|
] }),
|
|
1430
1480
|
/* @__PURE__ */ e("div", { className: "h-1 w-full bg-muted rounded-full overflow-hidden", dir: "ltr", children: /* @__PURE__ */ e(
|
|
1431
1481
|
"div",
|
|
1432
1482
|
{
|
|
1433
|
-
className: `h-full rounded-full transition-all duration-500 ${
|
|
1434
|
-
style: { width: `${Math.min(100, Math.max(0,
|
|
1483
|
+
className: `h-full rounded-full transition-all duration-500 ${a.balance.tokens / (a.balance.token_limit || 1) > 0.6 ? "bg-emerald-500" : a.balance.tokens / (a.balance.token_limit || 1) > 0.2 ? "bg-amber-500" : "bg-destructive"}`,
|
|
1484
|
+
style: { width: `${Math.min(100, Math.max(0, a.balance.tokens / (a.balance.token_limit || 1) * 100))}%` }
|
|
1435
1485
|
}
|
|
1436
1486
|
) })
|
|
1437
1487
|
] }),
|
|
@@ -1439,15 +1489,15 @@ function ft() {
|
|
|
1439
1489
|
/* @__PURE__ */ r("div", { className: "flex justify-between text-[10px] font-semibold", children: [
|
|
1440
1490
|
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t("users.requests_label") }),
|
|
1441
1491
|
/* @__PURE__ */ r("span", { className: "text-foreground", children: [
|
|
1442
|
-
(
|
|
1492
|
+
(a.balance.request_limit > 0 ? Math.round(a.balance.requests / a.balance.request_limit * 100) : 0).toLocaleString(n.language),
|
|
1443
1493
|
"%"
|
|
1444
1494
|
] })
|
|
1445
1495
|
] }),
|
|
1446
1496
|
/* @__PURE__ */ e("div", { className: "h-1 w-full bg-muted rounded-full overflow-hidden", dir: "ltr", children: /* @__PURE__ */ e(
|
|
1447
1497
|
"div",
|
|
1448
1498
|
{
|
|
1449
|
-
className: `h-full rounded-full transition-all duration-500 ${
|
|
1450
|
-
style: { width: `${Math.min(100, Math.max(0,
|
|
1499
|
+
className: `h-full rounded-full transition-all duration-500 ${a.balance.requests / (a.balance.request_limit || 1) > 0.6 ? "bg-emerald-500" : a.balance.requests / (a.balance.request_limit || 1) > 0.2 ? "bg-amber-500" : "bg-destructive"}`,
|
|
1500
|
+
style: { width: `${Math.min(100, Math.max(0, a.balance.requests / (a.balance.request_limit || 1) * 100))}%` }
|
|
1451
1501
|
}
|
|
1452
1502
|
) })
|
|
1453
1503
|
] })
|
|
@@ -1456,7 +1506,7 @@ function ft() {
|
|
|
1456
1506
|
/* @__PURE__ */ e(
|
|
1457
1507
|
"button",
|
|
1458
1508
|
{
|
|
1459
|
-
onClick: () =>
|
|
1509
|
+
onClick: () => Re(a),
|
|
1460
1510
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1461
1511
|
title: t("edit"),
|
|
1462
1512
|
children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" }) })
|
|
@@ -1466,7 +1516,7 @@ function ft() {
|
|
|
1466
1516
|
"button",
|
|
1467
1517
|
{
|
|
1468
1518
|
onClick: () => {
|
|
1469
|
-
|
|
1519
|
+
V(a), B(String(a.balance?.tokens || 0)), J(String(a.balance?.requests || 0)), c(String(a.balance?.token_limit || 0)), g(String(a.balance?.request_limit || 0)), w("");
|
|
1470
1520
|
},
|
|
1471
1521
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1472
1522
|
title: t("users.recharge"),
|
|
@@ -1476,7 +1526,7 @@ function ft() {
|
|
|
1476
1526
|
/* @__PURE__ */ e(
|
|
1477
1527
|
"button",
|
|
1478
1528
|
{
|
|
1479
|
-
onClick: () =>
|
|
1529
|
+
onClick: () => $e(a),
|
|
1480
1530
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1481
1531
|
title: t("users.copy_token"),
|
|
1482
1532
|
children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z" }) })
|
|
@@ -1485,14 +1535,14 @@ function ft() {
|
|
|
1485
1535
|
/* @__PURE__ */ e(
|
|
1486
1536
|
"button",
|
|
1487
1537
|
{
|
|
1488
|
-
onClick: () =>
|
|
1538
|
+
onClick: () => X(a.id),
|
|
1489
1539
|
className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
|
|
1490
1540
|
title: t("delete"),
|
|
1491
1541
|
children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" }) })
|
|
1492
1542
|
}
|
|
1493
1543
|
)
|
|
1494
1544
|
] }) })
|
|
1495
|
-
] },
|
|
1545
|
+
] }, a.id)) })
|
|
1496
1546
|
] }),
|
|
1497
1547
|
m.length === 0 && !p && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
|
|
1498
1548
|
/* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/xl", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1, stroke: "currentColor", className: "w-12 h-12 opacity-20", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M18 18.72a9.094 9.094 0 0 0 3.741-.479 3 3 0 0 0-4.682-2.72m.94 3.198.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0 1 12 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 0 1 6 18.719m12 0a5.971 5.971 0 0 0-.941-3.197m0 0A5.995 5.995 0 0 0 12 12.75a5.995 5.995 0 0 0-5.058 2.772m0 0a3 3 0 0 0-4.681 2.72 8.986 8.986 0 0 0 3.74.477m.94-3.197a5.971 5.971 0 0 0-.94 3.197M15 6.75a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm6 3a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Zm-13.5 0a2.25 2.25 0 1 1-4.5 0 2.25 2.25 0 0 1 4.5 0Z" }) }),
|
|
@@ -1505,63 +1555,63 @@ function ft() {
|
|
|
1505
1555
|
] }) })
|
|
1506
1556
|
] });
|
|
1507
1557
|
}
|
|
1508
|
-
function
|
|
1509
|
-
const { t, i18n:
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
}, [
|
|
1513
|
-
if (!
|
|
1558
|
+
function kt() {
|
|
1559
|
+
const { t, i18n: n } = ee(["admin", "translation"]), [o, m] = x(null), [b, p] = x(!0), [N, _] = x(""), [w, H] = x(30), [T, A] = x(0), I = Me(null), D = n.language === "fa", C = D ? "fa-IR" : "en-US", O = D ? "fa-IR-u-ca-persian" : "en-US";
|
|
1560
|
+
W(() => {
|
|
1561
|
+
z();
|
|
1562
|
+
}, [w]), W(() => {
|
|
1563
|
+
if (!I.current) return;
|
|
1514
1564
|
const d = new ResizeObserver((c) => {
|
|
1515
1565
|
for (const l of c)
|
|
1516
|
-
|
|
1566
|
+
A(l.contentRect.width);
|
|
1517
1567
|
});
|
|
1518
|
-
return d.observe(
|
|
1568
|
+
return d.observe(I.current), () => d.disconnect();
|
|
1519
1569
|
}, []);
|
|
1520
|
-
const
|
|
1521
|
-
const g = [],
|
|
1522
|
-
for (let
|
|
1523
|
-
const s = new Date(
|
|
1524
|
-
if (
|
|
1525
|
-
g.push(
|
|
1570
|
+
const U = (d, c, l) => {
|
|
1571
|
+
const g = [], L = /* @__PURE__ */ new Date(), P = d || [], h = new Map(P.map((j) => [j.date, j]));
|
|
1572
|
+
for (let j = c - 1; j >= 0; j--) {
|
|
1573
|
+
const s = new Date(L.getTime() - j * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
|
1574
|
+
if (h.has(s))
|
|
1575
|
+
g.push(h.get(s));
|
|
1526
1576
|
else {
|
|
1527
|
-
const
|
|
1528
|
-
l.forEach((
|
|
1577
|
+
const f = { date: s };
|
|
1578
|
+
l.forEach((q) => f[q] = 0), g.push(f);
|
|
1529
1579
|
}
|
|
1530
1580
|
}
|
|
1531
1581
|
return g;
|
|
1532
|
-
},
|
|
1582
|
+
}, v = (d) => {
|
|
1533
1583
|
if (!d || d.length === 0) return null;
|
|
1534
1584
|
const c = d.length, l = new Intl.DateTimeFormat(O, { month: "short" });
|
|
1535
1585
|
let g = [];
|
|
1536
|
-
if (
|
|
1537
|
-
g = Array.from({ length: c }, (
|
|
1586
|
+
if (w <= 14)
|
|
1587
|
+
g = Array.from({ length: c }, (L, P) => P);
|
|
1538
1588
|
else {
|
|
1539
|
-
const
|
|
1540
|
-
for (let
|
|
1541
|
-
g.push(
|
|
1542
|
-
g.length > 0 && g[g.length - 1] !== c - 1 && (c - 1 - g[g.length - 1] >
|
|
1589
|
+
const L = D ? 45 : 35, P = T > 0 ? Math.floor(T / L) : 6, h = Math.max(1, Math.ceil(c / Math.max(1, P)));
|
|
1590
|
+
for (let j = 0; j < c; j += h)
|
|
1591
|
+
g.push(j);
|
|
1592
|
+
g.length > 0 && g[g.length - 1] !== c - 1 && (c - 1 - g[g.length - 1] > h / 2 ? g.push(c - 1) : g[g.length - 1] = c - 1);
|
|
1543
1593
|
}
|
|
1544
|
-
return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: D ? "rtl" : "ltr", children: g.map((
|
|
1545
|
-
const
|
|
1546
|
-
if (!
|
|
1547
|
-
const
|
|
1594
|
+
return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: D ? "rtl" : "ltr", children: g.map((L) => {
|
|
1595
|
+
const P = d[L];
|
|
1596
|
+
if (!P) return null;
|
|
1597
|
+
const h = new Date(P.date), j = h.toLocaleDateString(O, { day: "numeric" }), M = l.format(h), s = c > 1 ? L / (c - 1) * 100 : 50;
|
|
1548
1598
|
return /* @__PURE__ */ r(
|
|
1549
1599
|
"div",
|
|
1550
1600
|
{
|
|
1551
1601
|
className: "absolute top-0 transform -translate-x-1/2 flex flex-col items-center",
|
|
1552
1602
|
style: { left: `${s}%` },
|
|
1553
1603
|
children: [
|
|
1554
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-gray-600 dark:text-gray-400 font-medium leading-none", children:
|
|
1555
|
-
/* @__PURE__ */ e("span", { className: "text-[9px] text-gray-400 dark:text-gray-500 mt-1 leading-none whitespace-nowrap", children:
|
|
1604
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-gray-600 dark:text-gray-400 font-medium leading-none", children: j }),
|
|
1605
|
+
/* @__PURE__ */ e("span", { className: "text-[9px] text-gray-400 dark:text-gray-500 mt-1 leading-none whitespace-nowrap", children: M })
|
|
1556
1606
|
]
|
|
1557
1607
|
},
|
|
1558
|
-
|
|
1608
|
+
L
|
|
1559
1609
|
);
|
|
1560
1610
|
}) });
|
|
1561
|
-
},
|
|
1611
|
+
}, z = async () => {
|
|
1562
1612
|
p(!0), _("");
|
|
1563
1613
|
try {
|
|
1564
|
-
const d = await k.getAnalytics(
|
|
1614
|
+
const d = await k.getAnalytics(w), c = {
|
|
1565
1615
|
...d,
|
|
1566
1616
|
overview: d.overview || {
|
|
1567
1617
|
total_users: 0,
|
|
@@ -1571,10 +1621,10 @@ function xt() {
|
|
|
1571
1621
|
},
|
|
1572
1622
|
trends: {
|
|
1573
1623
|
...d.trends || {},
|
|
1574
|
-
users:
|
|
1575
|
-
threads:
|
|
1576
|
-
messages:
|
|
1577
|
-
token_usage:
|
|
1624
|
+
users: U(d.trends?.users, w, ["count"]),
|
|
1625
|
+
threads: U(d.trends?.threads, w, ["count"]),
|
|
1626
|
+
messages: U(d.trends?.messages, w, ["count"]),
|
|
1627
|
+
token_usage: U(d.trends?.token_usage, w, ["tokens", "requests"])
|
|
1578
1628
|
},
|
|
1579
1629
|
distributions: {
|
|
1580
1630
|
...d.distributions || {},
|
|
@@ -1589,35 +1639,35 @@ function xt() {
|
|
|
1589
1639
|
p(!1);
|
|
1590
1640
|
}
|
|
1591
1641
|
};
|
|
1592
|
-
if (
|
|
1642
|
+
if (b)
|
|
1593
1643
|
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground", children: t("analytics.loading_analytics") });
|
|
1594
|
-
if (
|
|
1644
|
+
if (N)
|
|
1595
1645
|
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "text-center", children: [
|
|
1596
|
-
/* @__PURE__ */ e("div", { className: "text-destructive mb-4", children:
|
|
1646
|
+
/* @__PURE__ */ e("div", { className: "text-destructive mb-4", children: N }),
|
|
1597
1647
|
/* @__PURE__ */ e(
|
|
1598
1648
|
"button",
|
|
1599
1649
|
{
|
|
1600
|
-
onClick:
|
|
1650
|
+
onClick: z,
|
|
1601
1651
|
className: "px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-colors",
|
|
1602
1652
|
children: t("retry")
|
|
1603
1653
|
}
|
|
1604
1654
|
)
|
|
1605
1655
|
] }) });
|
|
1606
|
-
if (!
|
|
1607
|
-
const
|
|
1656
|
+
if (!o) return null;
|
|
1657
|
+
const R = (d) => {
|
|
1608
1658
|
if (d <= 0) return 10;
|
|
1609
1659
|
const c = d * 1.15, l = Math.pow(10, Math.floor(Math.log10(c))), g = c / l;
|
|
1610
|
-
let
|
|
1611
|
-
return g <= 1.2 ?
|
|
1612
|
-
},
|
|
1660
|
+
let L;
|
|
1661
|
+
return g <= 1.2 ? L = 0.2 : g <= 2.5 ? L = 0.5 : g <= 5 ? L = 1 : L = 2, Math.ceil(c / (L * l)) * (L * l);
|
|
1662
|
+
}, E = Math.max(...o.trends.threads.map((d) => d.count) || [1]), V = Math.max(...o.trends.messages.map((d) => d.count) || [1]), Z = Math.max(...o.trends.token_usage.map((d) => d.tokens) || [1]), B = R(E), u = R(V), J = R(Z);
|
|
1613
1663
|
return /* @__PURE__ */ r("div", { className: "h-full overflow-auto p-5 flex flex-col gap-5", dir: D ? "rtl" : "ltr", children: [
|
|
1614
1664
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3", children: [
|
|
1615
1665
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("analytics.title") }),
|
|
1616
1666
|
/* @__PURE__ */ e("div", { className: "flex gap-2", children: [7, 14, 30, 90].map((d) => /* @__PURE__ */ e(
|
|
1617
1667
|
"button",
|
|
1618
1668
|
{
|
|
1619
|
-
onClick: () =>
|
|
1620
|
-
className: `px-4 py-2 text-sm font-medium rounded-xl transition-all shadow-sm ${
|
|
1669
|
+
onClick: () => H(d),
|
|
1670
|
+
className: `px-4 py-2 text-sm font-medium rounded-xl transition-all shadow-sm ${w === d ? "bg-primary text-primary-foreground shadow-md" : "bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground border border-border/50"}`,
|
|
1621
1671
|
children: t("analytics.days", { count: d })
|
|
1622
1672
|
},
|
|
1623
1673
|
d
|
|
@@ -1627,28 +1677,28 @@ function xt() {
|
|
|
1627
1677
|
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
1628
1678
|
/* @__PURE__ */ r("div", { children: [
|
|
1629
1679
|
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_users") }),
|
|
1630
|
-
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (
|
|
1680
|
+
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_users || 0).toLocaleString(C) })
|
|
1631
1681
|
] }),
|
|
1632
1682
|
/* @__PURE__ */ e("div", { className: "w-10 h-10 bg-primary/10 rounded-xl flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-5 h-5 text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z" }) }) })
|
|
1633
1683
|
] }) }),
|
|
1634
1684
|
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
1635
1685
|
/* @__PURE__ */ r("div", { children: [
|
|
1636
1686
|
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_threads") }),
|
|
1637
|
-
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (
|
|
1687
|
+
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_threads || 0).toLocaleString(C) })
|
|
1638
1688
|
] }),
|
|
1639
1689
|
/* @__PURE__ */ e("div", { className: "w-10 h-10 bg-primary/10 rounded-xl flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-5 h-5 text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }) })
|
|
1640
1690
|
] }) }),
|
|
1641
1691
|
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
1642
1692
|
/* @__PURE__ */ r("div", { children: [
|
|
1643
1693
|
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_messages") }),
|
|
1644
|
-
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (
|
|
1694
|
+
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_messages || 0).toLocaleString(C) })
|
|
1645
1695
|
] }),
|
|
1646
1696
|
/* @__PURE__ */ e("div", { className: "w-10 h-10 bg-primary/10 rounded-xl flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-5 h-5 text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 8h10M7 12h4m1 8l-4-4H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-3l-4 4z" }) }) })
|
|
1647
1697
|
] }) }),
|
|
1648
1698
|
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
1649
1699
|
/* @__PURE__ */ r("div", { children: [
|
|
1650
1700
|
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_token_usage") }),
|
|
1651
|
-
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (
|
|
1701
|
+
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_token_usage || 0).toLocaleString(C) })
|
|
1652
1702
|
] }),
|
|
1653
1703
|
/* @__PURE__ */ e("div", { className: "w-10 h-10 bg-primary/10 rounded-xl flex items-center justify-center", children: /* @__PURE__ */ e("svg", { className: "w-5 h-5 text-primary", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M13 10V3L4 14h7v7l9-11h-7z" }) }) })
|
|
1654
1704
|
] }) })
|
|
@@ -1656,11 +1706,11 @@ function xt() {
|
|
|
1656
1706
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: [
|
|
1657
1707
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1658
1708
|
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.threads_chart") }),
|
|
1659
|
-
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref:
|
|
1709
|
+
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: I, children: [
|
|
1660
1710
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
1661
1711
|
/* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
|
|
1662
|
-
/* @__PURE__ */ e("span", { children: (B || 0).toLocaleString(
|
|
1663
|
-
/* @__PURE__ */ e("span", { children: Math.floor((B || 0) / 2).toLocaleString(
|
|
1712
|
+
/* @__PURE__ */ e("span", { children: (B || 0).toLocaleString(C) }),
|
|
1713
|
+
/* @__PURE__ */ e("span", { children: Math.floor((B || 0) / 2).toLocaleString(C) }),
|
|
1664
1714
|
/* @__PURE__ */ e("span", { children: "0" })
|
|
1665
1715
|
] }),
|
|
1666
1716
|
/* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
@@ -1668,13 +1718,13 @@ function xt() {
|
|
|
1668
1718
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
1669
1719
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
1670
1720
|
] }),
|
|
1671
|
-
|
|
1721
|
+
o.trends.threads.length > 0 ? o.trends.threads.map((d, c) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
|
|
1672
1722
|
"div",
|
|
1673
1723
|
{
|
|
1674
1724
|
className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
|
|
1675
1725
|
style: { height: `${d.count / B * 100}%` },
|
|
1676
1726
|
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: [
|
|
1677
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: d.count.toLocaleString(
|
|
1727
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: d.count.toLocaleString(C) }),
|
|
1678
1728
|
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(d.date).toLocaleDateString(O, { month: "short", day: "numeric" }) })
|
|
1679
1729
|
] })
|
|
1680
1730
|
}
|
|
@@ -1683,17 +1733,17 @@ function xt() {
|
|
|
1683
1733
|
] }),
|
|
1684
1734
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
1685
1735
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
1686
|
-
|
|
1736
|
+
v(o.trends.threads)
|
|
1687
1737
|
] })
|
|
1688
1738
|
] })
|
|
1689
1739
|
] }),
|
|
1690
1740
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1691
1741
|
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.messages_chart") }),
|
|
1692
|
-
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref:
|
|
1742
|
+
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: I, children: [
|
|
1693
1743
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
1694
1744
|
/* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
|
|
1695
|
-
/* @__PURE__ */ e("span", { children: (
|
|
1696
|
-
/* @__PURE__ */ e("span", { children: Math.floor((
|
|
1745
|
+
/* @__PURE__ */ e("span", { children: (u || 0).toLocaleString(C) }),
|
|
1746
|
+
/* @__PURE__ */ e("span", { children: Math.floor((u || 0) / 2).toLocaleString(C) }),
|
|
1697
1747
|
/* @__PURE__ */ e("span", { children: "0" })
|
|
1698
1748
|
] }),
|
|
1699
1749
|
/* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
@@ -1701,13 +1751,13 @@ function xt() {
|
|
|
1701
1751
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
1702
1752
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
1703
1753
|
] }),
|
|
1704
|
-
|
|
1754
|
+
o.trends.messages.length > 0 ? o.trends.messages.map((d, c) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
|
|
1705
1755
|
"div",
|
|
1706
1756
|
{
|
|
1707
1757
|
className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
|
|
1708
|
-
style: { height: `${d.count /
|
|
1758
|
+
style: { height: `${d.count / u * 100}%` },
|
|
1709
1759
|
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: [
|
|
1710
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: d.count.toLocaleString(
|
|
1760
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: d.count.toLocaleString(C) }),
|
|
1711
1761
|
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(d.date).toLocaleDateString(O, { month: "short", day: "numeric" }) })
|
|
1712
1762
|
] })
|
|
1713
1763
|
}
|
|
@@ -1716,17 +1766,17 @@ function xt() {
|
|
|
1716
1766
|
] }),
|
|
1717
1767
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
1718
1768
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
1719
|
-
|
|
1769
|
+
v(o.trends.messages)
|
|
1720
1770
|
] })
|
|
1721
1771
|
] })
|
|
1722
1772
|
] }),
|
|
1723
1773
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1724
1774
|
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.token_usage_chart") }),
|
|
1725
|
-
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref:
|
|
1775
|
+
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: I, children: [
|
|
1726
1776
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
1727
1777
|
/* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
|
|
1728
|
-
/* @__PURE__ */ e("span", { children: (
|
|
1729
|
-
/* @__PURE__ */ e("span", { children: Math.floor((
|
|
1778
|
+
/* @__PURE__ */ e("span", { children: (J || 0).toLocaleString(C) }),
|
|
1779
|
+
/* @__PURE__ */ e("span", { children: Math.floor((J || 0) / 2).toLocaleString(C) }),
|
|
1730
1780
|
/* @__PURE__ */ e("span", { children: "0" })
|
|
1731
1781
|
] }),
|
|
1732
1782
|
/* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
@@ -1734,13 +1784,13 @@ function xt() {
|
|
|
1734
1784
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
1735
1785
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
1736
1786
|
] }),
|
|
1737
|
-
|
|
1787
|
+
o.trends.token_usage.length > 0 ? o.trends.token_usage.map((d, c) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
|
|
1738
1788
|
"div",
|
|
1739
1789
|
{
|
|
1740
1790
|
className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
|
|
1741
|
-
style: { height: `${d.tokens /
|
|
1791
|
+
style: { height: `${d.tokens / J * 100}%` },
|
|
1742
1792
|
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: [
|
|
1743
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: (d.tokens || 0).toLocaleString(
|
|
1793
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: (d.tokens || 0).toLocaleString(C) }),
|
|
1744
1794
|
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(d.date).toLocaleDateString(O, { month: "short", day: "numeric" }) })
|
|
1745
1795
|
] })
|
|
1746
1796
|
}
|
|
@@ -1749,27 +1799,27 @@ function xt() {
|
|
|
1749
1799
|
] }),
|
|
1750
1800
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
1751
1801
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
1752
|
-
|
|
1802
|
+
v(o.trends.token_usage)
|
|
1753
1803
|
] })
|
|
1754
1804
|
] })
|
|
1755
1805
|
] }),
|
|
1756
1806
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1757
1807
|
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.feedback") }),
|
|
1758
|
-
/* @__PURE__ */ e("div", { className: "h-64 flex flex-col justify-center", children:
|
|
1808
|
+
/* @__PURE__ */ e("div", { className: "h-64 flex flex-col justify-center", children: o.distributions.feedback_sentiment.length > 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row items-center justify-center gap-8 lg:gap-12", children: [
|
|
1759
1809
|
/* @__PURE__ */ r("div", { className: "relative w-56 h-56 lg:w-60 lg:h-60", children: [
|
|
1760
1810
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 100", className: "w-full h-full -rotate-90 drop-shadow-md", children: (() => {
|
|
1761
|
-
const d =
|
|
1762
|
-
(
|
|
1763
|
-
), c = d.reduce((
|
|
1811
|
+
const d = o.distributions.feedback_sentiment.filter(
|
|
1812
|
+
(M) => M.sentiment === "positive" || M.sentiment === "negative"
|
|
1813
|
+
), c = d.reduce((M, s) => M + s.count, 0);
|
|
1764
1814
|
if (c === 0) return null;
|
|
1765
|
-
const l = d.find((
|
|
1766
|
-
return /* @__PURE__ */ r(
|
|
1815
|
+
const l = d.find((M) => M.sentiment === "positive")?.count || 0, g = d.find((M) => M.sentiment === "negative")?.count || 0, L = 40, P = 2 * Math.PI * L, h = l / c * 100, j = g / c * 100;
|
|
1816
|
+
return /* @__PURE__ */ r(Fe, { children: [
|
|
1767
1817
|
/* @__PURE__ */ e(
|
|
1768
1818
|
"circle",
|
|
1769
1819
|
{
|
|
1770
1820
|
cx: "50",
|
|
1771
1821
|
cy: "50",
|
|
1772
|
-
r:
|
|
1822
|
+
r: L,
|
|
1773
1823
|
fill: "transparent",
|
|
1774
1824
|
stroke: "currentColor",
|
|
1775
1825
|
strokeWidth: "10",
|
|
@@ -1791,12 +1841,12 @@ function xt() {
|
|
|
1791
1841
|
{
|
|
1792
1842
|
cx: "50",
|
|
1793
1843
|
cy: "50",
|
|
1794
|
-
r:
|
|
1844
|
+
r: L,
|
|
1795
1845
|
fill: "transparent",
|
|
1796
1846
|
stroke: "url(#posGradient)",
|
|
1797
1847
|
strokeWidth: "10",
|
|
1798
|
-
strokeDasharray: `${
|
|
1799
|
-
strokeLinecap:
|
|
1848
|
+
strokeDasharray: `${h / 100 * P} ${P}`,
|
|
1849
|
+
strokeLinecap: h > 0 ? "round" : "butt",
|
|
1800
1850
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
1801
1851
|
}
|
|
1802
1852
|
),
|
|
@@ -1805,44 +1855,44 @@ function xt() {
|
|
|
1805
1855
|
{
|
|
1806
1856
|
cx: "50",
|
|
1807
1857
|
cy: "50",
|
|
1808
|
-
r:
|
|
1858
|
+
r: L,
|
|
1809
1859
|
fill: "transparent",
|
|
1810
1860
|
stroke: "url(#negGradient)",
|
|
1811
1861
|
strokeWidth: "10",
|
|
1812
|
-
strokeDasharray: `${
|
|
1813
|
-
strokeDashoffset: -(
|
|
1814
|
-
strokeLinecap:
|
|
1862
|
+
strokeDasharray: `${j / 100 * P} ${P}`,
|
|
1863
|
+
strokeDashoffset: -(h / 100 * P),
|
|
1864
|
+
strokeLinecap: j > 0 ? "round" : "butt",
|
|
1815
1865
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
1816
1866
|
}
|
|
1817
1867
|
)
|
|
1818
1868
|
] });
|
|
1819
1869
|
})() }),
|
|
1820
1870
|
/* @__PURE__ */ r("div", { className: "absolute inset-0 flex flex-col items-center justify-center pointer-events-none", children: [
|
|
1821
|
-
/* @__PURE__ */ e("span", { className: "text-3xl lg:text-4xl font-light text-foreground", children:
|
|
1871
|
+
/* @__PURE__ */ e("span", { className: "text-3xl lg:text-4xl font-light text-foreground", children: o.distributions.feedback_sentiment.filter((d) => d.sentiment === "positive" || d.sentiment === "negative").reduce((d, c) => d + (c.count || 0), 0).toLocaleString(C) }),
|
|
1822
1872
|
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground uppercase tracking-widest mt-1", children: t("analytics.total_feedback") })
|
|
1823
1873
|
] })
|
|
1824
1874
|
] }),
|
|
1825
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col gap-4 min-w-[140px]", children: [...
|
|
1826
|
-
const l =
|
|
1827
|
-
(
|
|
1828
|
-
).reduce((
|
|
1875
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col gap-4 min-w-[140px]", children: [...o.distributions.feedback_sentiment].filter((d) => d.sentiment === "positive" || d.sentiment === "negative").sort((d, c) => d.sentiment === "positive" ? -1 : 1).map((d) => {
|
|
1876
|
+
const l = o.distributions.feedback_sentiment.filter(
|
|
1877
|
+
(j) => j.sentiment === "positive" || j.sentiment === "negative"
|
|
1878
|
+
).reduce((j, M) => j + M.count, 0), g = l > 0 ? d.count / l * 100 : 0, L = d.sentiment === "positive" ? t("analytics.positive") : t("analytics.negative"), P = d.sentiment === "positive" ? "bg-primary" : "bg-destructive", h = d.sentiment === "positive" ? "👍" : "👎";
|
|
1829
1879
|
return /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-6 group", children: [
|
|
1830
1880
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
1831
|
-
/* @__PURE__ */ e("div", { className: `w-3 h-3 rounded-full ${
|
|
1881
|
+
/* @__PURE__ */ e("div", { className: `w-3 h-3 rounded-full ${P} shadow-sm group-hover:scale-110 transition-transform` }),
|
|
1832
1882
|
/* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground font-medium", children: [
|
|
1833
|
-
|
|
1883
|
+
L,
|
|
1834
1884
|
" ",
|
|
1835
|
-
|
|
1885
|
+
h
|
|
1836
1886
|
] })
|
|
1837
1887
|
] }),
|
|
1838
1888
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
1839
1889
|
/* @__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: [
|
|
1840
|
-
(g || 0).toLocaleString(
|
|
1890
|
+
(g || 0).toLocaleString(C, { maximumFractionDigits: 0 }),
|
|
1841
1891
|
"%"
|
|
1842
1892
|
] }),
|
|
1843
1893
|
/* @__PURE__ */ r("span", { className: "text-[13px] font-normal text-muted-foreground w-12 text-right", children: [
|
|
1844
1894
|
"(",
|
|
1845
|
-
(d.count || 0).toLocaleString(
|
|
1895
|
+
(d.count || 0).toLocaleString(C),
|
|
1846
1896
|
")"
|
|
1847
1897
|
] })
|
|
1848
1898
|
] })
|
|
@@ -1853,7 +1903,7 @@ function xt() {
|
|
|
1853
1903
|
] }),
|
|
1854
1904
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1855
1905
|
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.active_users") }),
|
|
1856
|
-
/* @__PURE__ */ e("div", { className: "space-y-2.5", children:
|
|
1906
|
+
/* @__PURE__ */ e("div", { className: "space-y-2.5", children: o.active_users.length > 0 ? o.active_users.map((d) => /* @__PURE__ */ r(
|
|
1857
1907
|
"div",
|
|
1858
1908
|
{
|
|
1859
1909
|
className: "flex items-center justify-between p-3 bg-muted/30 rounded-xl hover:bg-muted/50 transition-colors",
|
|
@@ -1863,7 +1913,7 @@ function xt() {
|
|
|
1863
1913
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground", children: d.name }) })
|
|
1864
1914
|
] }),
|
|
1865
1915
|
/* @__PURE__ */ r("div", { className: "text-sm font-semibold text-primary", children: [
|
|
1866
|
-
(d.thread_count || 0).toLocaleString(
|
|
1916
|
+
(d.thread_count || 0).toLocaleString(C),
|
|
1867
1917
|
" ",
|
|
1868
1918
|
t("analytics.threads")
|
|
1869
1919
|
] })
|
|
@@ -1874,18 +1924,18 @@ function xt() {
|
|
|
1874
1924
|
] }) })
|
|
1875
1925
|
] });
|
|
1876
1926
|
}
|
|
1877
|
-
function Y({ className: t, ...
|
|
1927
|
+
function Y({ className: t, ...n }) {
|
|
1878
1928
|
return /* @__PURE__ */ e(
|
|
1879
|
-
|
|
1929
|
+
Te.Root,
|
|
1880
1930
|
{
|
|
1881
1931
|
"data-slot": "switch",
|
|
1882
1932
|
className: be(
|
|
1883
1933
|
"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",
|
|
1884
1934
|
t
|
|
1885
1935
|
),
|
|
1886
|
-
...
|
|
1936
|
+
...n,
|
|
1887
1937
|
children: /* @__PURE__ */ e(
|
|
1888
|
-
|
|
1938
|
+
Te.Thumb,
|
|
1889
1939
|
{
|
|
1890
1940
|
"data-slot": "switch-thumb",
|
|
1891
1941
|
className: be(
|
|
@@ -1896,147 +1946,149 @@ function Y({ className: t, ...a }) {
|
|
|
1896
1946
|
}
|
|
1897
1947
|
);
|
|
1898
1948
|
}
|
|
1899
|
-
function
|
|
1900
|
-
const { t, i18n:
|
|
1901
|
-
app_name:
|
|
1902
|
-
admin_title:
|
|
1949
|
+
function St() {
|
|
1950
|
+
const { t, i18n: n } = ee(["admin", "translation", "settings"]), { app: o, welcome: m, disclaimer: b, history: p, threadActions: N, composer: _, settings: w } = me(), [H, T] = x(!1), [A, I] = x(!1), [D, C] = x(""), [O, U] = x(""), [v, z] = x("fa"), [R, E] = x("translation"), [V, Z] = x("{}"), [B, u] = x(""), [J, d] = x(!1), c = pe(() => ({
|
|
1951
|
+
app_name: o?.name || "Gentiq",
|
|
1952
|
+
admin_title: o?.adminTitle || "",
|
|
1903
1953
|
welcome_greeting: m?.greeting || "",
|
|
1904
1954
|
welcome_subtitle: m?.subtitle || "",
|
|
1905
|
-
disclaimer: typeof
|
|
1906
|
-
show_tool_details:
|
|
1907
|
-
show_settings:
|
|
1955
|
+
disclaimer: typeof b == "string" ? b : "",
|
|
1956
|
+
show_tool_details: o?.showToolDetails ?? !0,
|
|
1957
|
+
show_settings: o?.showSettings ?? !0,
|
|
1908
1958
|
composer_attachments: _?.attachments?.enabled ?? !0,
|
|
1909
|
-
thread_actions_feedback:
|
|
1910
|
-
thread_actions_retry:
|
|
1959
|
+
thread_actions_feedback: N?.feedback ?? !0,
|
|
1960
|
+
thread_actions_retry: N?.retry ?? !0,
|
|
1911
1961
|
history_enabled: p?.enabled ?? !0,
|
|
1912
1962
|
history_show_delete: p?.showDelete ?? !0,
|
|
1913
1963
|
history_show_rename: p?.showRename ?? !0,
|
|
1914
1964
|
history_show_share: p?.showShare ?? !0,
|
|
1915
1965
|
history_show_pin: p?.showPin ?? !0,
|
|
1916
|
-
settings_general_mode:
|
|
1917
|
-
settings_profile_mode:
|
|
1918
|
-
settings_account_mode:
|
|
1919
|
-
settings_general_fields:
|
|
1920
|
-
settings_profile_fields:
|
|
1921
|
-
settings_account_fields:
|
|
1922
|
-
language:
|
|
1966
|
+
settings_general_mode: o?.settingsGeneralMode || "editable",
|
|
1967
|
+
settings_profile_mode: o?.settingsProfileMode || "editable",
|
|
1968
|
+
settings_account_mode: o?.settingsAccountMode || "editable",
|
|
1969
|
+
settings_general_fields: w?.sections?.general?.fields || {},
|
|
1970
|
+
settings_profile_fields: w?.sections?.profile?.fields || {},
|
|
1971
|
+
settings_account_fields: w?.sections?.account?.fields || {},
|
|
1972
|
+
language: n.language || "fa",
|
|
1973
|
+
initial_balance_tokens: 25e4,
|
|
1974
|
+
initial_balance_requests: 100,
|
|
1923
1975
|
translations: {}
|
|
1924
|
-
}), [
|
|
1925
|
-
|
|
1976
|
+
}), [o, m, b, p, N, _, n.language, w]), [l, g] = x(c), L = n.language === "fa";
|
|
1977
|
+
W(() => {
|
|
1926
1978
|
(async () => {
|
|
1927
1979
|
T(!0);
|
|
1928
1980
|
try {
|
|
1929
|
-
const
|
|
1930
|
-
if (
|
|
1931
|
-
const
|
|
1932
|
-
|
|
1933
|
-
|
|
1981
|
+
const y = await k.getSettings();
|
|
1982
|
+
if (y && Object.keys(y).length > 0) {
|
|
1983
|
+
const F = JSON.parse(JSON.stringify(n.store.data));
|
|
1984
|
+
y.translations && Object.keys(y.translations).forEach((X) => {
|
|
1985
|
+
F[X] || (F[X] = {}), Object.assign(F[X], y.translations[X]);
|
|
1934
1986
|
}), g((X) => ({
|
|
1935
1987
|
...X,
|
|
1936
|
-
...
|
|
1937
|
-
translations:
|
|
1988
|
+
...y,
|
|
1989
|
+
translations: F
|
|
1938
1990
|
}));
|
|
1939
1991
|
} else {
|
|
1940
|
-
const
|
|
1941
|
-
g(
|
|
1992
|
+
const F = { ...c, translations: n.store.data };
|
|
1993
|
+
g(F), y || k.updateSettings(F).catch(console.error);
|
|
1942
1994
|
}
|
|
1943
|
-
} catch (
|
|
1944
|
-
console.error("Failed to fetch settings",
|
|
1995
|
+
} catch (y) {
|
|
1996
|
+
console.error("Failed to fetch settings", y), C(t("app_settings.save_error"));
|
|
1945
1997
|
} finally {
|
|
1946
1998
|
T(!1);
|
|
1947
1999
|
}
|
|
1948
2000
|
})();
|
|
1949
|
-
}, [t, c,
|
|
1950
|
-
const
|
|
1951
|
-
|
|
2001
|
+
}, [t, c, n.store.data]);
|
|
2002
|
+
const P = async (i) => {
|
|
2003
|
+
i && i.preventDefault(), I(!0), U(""), C("");
|
|
1952
2004
|
try {
|
|
1953
|
-
await k.updateSettings(l),
|
|
1954
|
-
} catch (
|
|
1955
|
-
|
|
2005
|
+
await k.updateSettings(l), U(t("app_settings.save_success")), setTimeout(() => U(""), 3e3);
|
|
2006
|
+
} catch (y) {
|
|
2007
|
+
C(y instanceof Error ? y.message : t("app_settings.save_error"));
|
|
1956
2008
|
} finally {
|
|
1957
|
-
|
|
2009
|
+
I(!1);
|
|
1958
2010
|
}
|
|
1959
|
-
},
|
|
1960
|
-
T(!0),
|
|
2011
|
+
}, h = async () => {
|
|
2012
|
+
T(!0), C("");
|
|
1961
2013
|
try {
|
|
1962
2014
|
await k.resetSettings(), d(!1), window.location.reload();
|
|
1963
|
-
} catch (
|
|
1964
|
-
|
|
2015
|
+
} catch (i) {
|
|
2016
|
+
C(i instanceof Error ? i.message : t("app_settings.save_error"));
|
|
1965
2017
|
} finally {
|
|
1966
2018
|
T(!1);
|
|
1967
2019
|
}
|
|
1968
2020
|
};
|
|
1969
|
-
|
|
1970
|
-
const
|
|
1971
|
-
|
|
1972
|
-
}, [
|
|
1973
|
-
const
|
|
1974
|
-
|
|
2021
|
+
W(() => {
|
|
2022
|
+
const i = l.translations?.[v]?.[R] || {};
|
|
2023
|
+
Z(JSON.stringify(i, null, 2)), u("");
|
|
2024
|
+
}, [v, R, l.translations]);
|
|
2025
|
+
const j = (i) => {
|
|
2026
|
+
Z(i);
|
|
1975
2027
|
try {
|
|
1976
|
-
const
|
|
1977
|
-
g((
|
|
1978
|
-
...
|
|
2028
|
+
const y = JSON.parse(i);
|
|
2029
|
+
g((F) => ({
|
|
2030
|
+
...F,
|
|
1979
2031
|
translations: {
|
|
1980
|
-
...
|
|
1981
|
-
[
|
|
1982
|
-
...
|
|
1983
|
-
[
|
|
2032
|
+
...F.translations,
|
|
2033
|
+
[v]: {
|
|
2034
|
+
...F.translations?.[v],
|
|
2035
|
+
[R]: y
|
|
1984
2036
|
}
|
|
1985
2037
|
}
|
|
1986
|
-
})),
|
|
2038
|
+
})), u("");
|
|
1987
2039
|
} catch {
|
|
1988
|
-
|
|
2040
|
+
u("Invalid JSON format");
|
|
1989
2041
|
}
|
|
1990
|
-
},
|
|
2042
|
+
}, M = ({ title: i, icon: y }) => /* @__PURE__ */ r("div", { className: "relative py-12", children: [
|
|
1991
2043
|
/* @__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" }) }),
|
|
1992
2044
|
/* @__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: [
|
|
1993
|
-
/* @__PURE__ */ e(
|
|
1994
|
-
|
|
2045
|
+
/* @__PURE__ */ e(y, { className: "size-4 text-primary/60" }),
|
|
2046
|
+
i
|
|
1995
2047
|
] }) })
|
|
1996
|
-
] }), s = ({ value:
|
|
1997
|
-
if (!
|
|
1998
|
-
const
|
|
1999
|
-
return
|
|
2048
|
+
] }), s = ({ value: i }) => {
|
|
2049
|
+
if (!i || !i.includes(":") && !i.includes(".")) return null;
|
|
2050
|
+
const y = t(i);
|
|
2051
|
+
return y === i ? 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: [
|
|
2000
2052
|
/* @__PURE__ */ r("span", { className: "text-[10px] font-bold text-primary/60 uppercase tracking-tighter", children: [
|
|
2001
2053
|
t("app_settings.preview", { defaultValue: "Preview" }),
|
|
2002
2054
|
":"
|
|
2003
2055
|
] }),
|
|
2004
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children:
|
|
2056
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children: y })
|
|
2005
2057
|
] });
|
|
2006
|
-
},
|
|
2007
|
-
const
|
|
2008
|
-
|
|
2009
|
-
...
|
|
2058
|
+
}, f = () => {
|
|
2059
|
+
const i = prompt("Enter language code (e.g. en, fa, fr):");
|
|
2060
|
+
i && !l.translations?.[i] && (g((y) => ({
|
|
2061
|
+
...y,
|
|
2010
2062
|
translations: {
|
|
2011
|
-
...
|
|
2012
|
-
[
|
|
2063
|
+
...y.translations,
|
|
2064
|
+
[i]: {}
|
|
2013
2065
|
}
|
|
2014
|
-
})),
|
|
2015
|
-
},
|
|
2016
|
-
const
|
|
2017
|
-
|
|
2018
|
-
...
|
|
2066
|
+
})), z(i));
|
|
2067
|
+
}, q = () => {
|
|
2068
|
+
const i = prompt("Enter namespace (e.g. chat, admin):");
|
|
2069
|
+
i && !l.translations?.[v]?.[i] && (g((y) => ({
|
|
2070
|
+
...y,
|
|
2019
2071
|
translations: {
|
|
2020
|
-
...
|
|
2021
|
-
[
|
|
2022
|
-
...
|
|
2023
|
-
[
|
|
2072
|
+
...y.translations,
|
|
2073
|
+
[v]: {
|
|
2074
|
+
...y.translations?.[v],
|
|
2075
|
+
[i]: {}
|
|
2024
2076
|
}
|
|
2025
2077
|
}
|
|
2026
|
-
})),
|
|
2078
|
+
})), E(i));
|
|
2027
2079
|
};
|
|
2028
|
-
return
|
|
2080
|
+
return H ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3", children: [
|
|
2029
2081
|
/* @__PURE__ */ e("div", { className: "w-10 h-10 border-3 border-primary/20 border-t-primary rounded-full animate-spin" }),
|
|
2030
2082
|
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground font-medium", children: t("loading") })
|
|
2031
|
-
] }) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col overflow-hidden", dir:
|
|
2083
|
+
] }) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col overflow-hidden", dir: L ? "rtl" : "ltr", children: [
|
|
2032
2084
|
/* @__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: [
|
|
2033
2085
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
2034
2086
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight", children: t("app_settings.title") }),
|
|
2035
2087
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("app_settings.subtitle") })
|
|
2036
2088
|
] }),
|
|
2037
2089
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: [
|
|
2038
|
-
/* @__PURE__ */ r(
|
|
2039
|
-
/* @__PURE__ */ e(
|
|
2090
|
+
/* @__PURE__ */ r(He, { open: J, onOpenChange: d, children: [
|
|
2091
|
+
/* @__PURE__ */ e(Be, { asChild: !0, children: /* @__PURE__ */ r(
|
|
2040
2092
|
"button",
|
|
2041
2093
|
{
|
|
2042
2094
|
type: "button",
|
|
@@ -2047,14 +2099,14 @@ function bt() {
|
|
|
2047
2099
|
]
|
|
2048
2100
|
}
|
|
2049
2101
|
) }),
|
|
2050
|
-
/* @__PURE__ */ r(
|
|
2051
|
-
/* @__PURE__ */ r(
|
|
2052
|
-
/* @__PURE__ */ e(
|
|
2053
|
-
/* @__PURE__ */ e(
|
|
2102
|
+
/* @__PURE__ */ r(Ve, { children: [
|
|
2103
|
+
/* @__PURE__ */ r(We, { children: [
|
|
2104
|
+
/* @__PURE__ */ e(Ke, { children: t("app_settings.reset_confirm_title") }),
|
|
2105
|
+
/* @__PURE__ */ e(Ge, { children: t("app_settings.reset_confirm_description") })
|
|
2054
2106
|
] }),
|
|
2055
|
-
/* @__PURE__ */ r(
|
|
2056
|
-
/* @__PURE__ */ e(
|
|
2057
|
-
/* @__PURE__ */ e(he, { variant: "destructive", onClick:
|
|
2107
|
+
/* @__PURE__ */ r(Ze, { children: [
|
|
2108
|
+
/* @__PURE__ */ e(Qe, { asChild: !0, children: /* @__PURE__ */ e(he, { variant: "ghost", children: t("cancel") }) }),
|
|
2109
|
+
/* @__PURE__ */ e(he, { variant: "destructive", onClick: h, children: t("app_settings.reset_button") })
|
|
2058
2110
|
] })
|
|
2059
2111
|
] })
|
|
2060
2112
|
] }),
|
|
@@ -2063,11 +2115,11 @@ function bt() {
|
|
|
2063
2115
|
{
|
|
2064
2116
|
type: "submit",
|
|
2065
2117
|
form: "settings-form",
|
|
2066
|
-
disabled:
|
|
2118
|
+
disabled: A,
|
|
2067
2119
|
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",
|
|
2068
2120
|
children: [
|
|
2069
|
-
|
|
2070
|
-
t(
|
|
2121
|
+
A && /* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-primary-foreground/20 border-t-primary-foreground rounded-full animate-spin" }),
|
|
2122
|
+
t(A ? "saving" : "app_settings.save")
|
|
2071
2123
|
]
|
|
2072
2124
|
}
|
|
2073
2125
|
)
|
|
@@ -2075,19 +2127,19 @@ function bt() {
|
|
|
2075
2127
|
] }),
|
|
2076
2128
|
/* @__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: [
|
|
2077
2129
|
(D || O) && /* @__PURE__ */ e("div", { className: `mb-12 px-4 py-3 rounded-xl text-sm border animate-in fade-in slide-in-from-top-1 duration-300 ${D ? "bg-destructive/10 border-destructive/20 text-destructive" : "bg-green-500/10 border-green-500/20 text-green-600 dark:text-green-400"}`, children: D || O }),
|
|
2078
|
-
/* @__PURE__ */ r("form", { id: "settings-form", onSubmit:
|
|
2130
|
+
/* @__PURE__ */ r("form", { id: "settings-form", onSubmit: P, className: "space-y-16 animate-in fade-in slide-in-from-bottom-2 duration-500", children: [
|
|
2079
2131
|
/* @__PURE__ */ r("section", { children: [
|
|
2080
|
-
/* @__PURE__ */ e(
|
|
2132
|
+
/* @__PURE__ */ e(M, { title: t("app_settings.sections.general"), icon: xe }),
|
|
2081
2133
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
2082
2134
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
2083
2135
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2084
2136
|
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.app_name") }),
|
|
2085
2137
|
/* @__PURE__ */ e(
|
|
2086
|
-
|
|
2138
|
+
de,
|
|
2087
2139
|
{
|
|
2088
2140
|
type: "text",
|
|
2089
2141
|
value: l.app_name,
|
|
2090
|
-
onChange: (
|
|
2142
|
+
onChange: (i) => g({ ...l, app_name: i.target.value }),
|
|
2091
2143
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2092
2144
|
placeholder: "Gentiq AI",
|
|
2093
2145
|
dir: "auto"
|
|
@@ -2098,11 +2150,11 @@ function bt() {
|
|
|
2098
2150
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2099
2151
|
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.admin_title") }),
|
|
2100
2152
|
/* @__PURE__ */ e(
|
|
2101
|
-
|
|
2153
|
+
de,
|
|
2102
2154
|
{
|
|
2103
2155
|
type: "text",
|
|
2104
2156
|
value: l.admin_title || "",
|
|
2105
|
-
onChange: (
|
|
2157
|
+
onChange: (i) => g({ ...l, admin_title: i.target.value }),
|
|
2106
2158
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2107
2159
|
placeholder: "Gentiq Admin",
|
|
2108
2160
|
dir: "auto"
|
|
@@ -2114,15 +2166,15 @@ function bt() {
|
|
|
2114
2166
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2115
2167
|
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.language") }),
|
|
2116
2168
|
/* @__PURE__ */ r(
|
|
2117
|
-
|
|
2169
|
+
ne,
|
|
2118
2170
|
{
|
|
2119
2171
|
value: l.language,
|
|
2120
|
-
onValueChange: (
|
|
2172
|
+
onValueChange: (i) => g({ ...l, language: i }),
|
|
2121
2173
|
children: [
|
|
2122
|
-
/* @__PURE__ */ e(
|
|
2123
|
-
/* @__PURE__ */ r(
|
|
2124
|
-
/* @__PURE__ */ e(
|
|
2125
|
-
/* @__PURE__ */ e(
|
|
2174
|
+
/* @__PURE__ */ e(ie, { className: "bg-muted/20 border-transparent focus:bg-background h-11 w-full flex-row-reverse justify-end gap-3", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2175
|
+
/* @__PURE__ */ r(le, { children: [
|
|
2176
|
+
/* @__PURE__ */ e(G, { value: "fa", children: "فارسی (Persian)" }),
|
|
2177
|
+
/* @__PURE__ */ e(G, { value: "en", children: "English" })
|
|
2126
2178
|
] })
|
|
2127
2179
|
]
|
|
2128
2180
|
}
|
|
@@ -2135,17 +2187,17 @@ function bt() {
|
|
|
2135
2187
|
] })
|
|
2136
2188
|
] }),
|
|
2137
2189
|
/* @__PURE__ */ r("section", { children: [
|
|
2138
|
-
/* @__PURE__ */ e(
|
|
2190
|
+
/* @__PURE__ */ e(M, { title: t("app_settings.sections.chat"), icon: dt }),
|
|
2139
2191
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
2140
2192
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
2141
2193
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2142
2194
|
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.chat.welcome_greeting") }),
|
|
2143
2195
|
/* @__PURE__ */ e(
|
|
2144
|
-
|
|
2196
|
+
de,
|
|
2145
2197
|
{
|
|
2146
2198
|
type: "text",
|
|
2147
2199
|
value: l.welcome_greeting || "",
|
|
2148
|
-
onChange: (
|
|
2200
|
+
onChange: (i) => g({ ...l, welcome_greeting: i.target.value }),
|
|
2149
2201
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2150
2202
|
placeholder: "e.g. chat:welcome",
|
|
2151
2203
|
dir: "auto"
|
|
@@ -2156,11 +2208,11 @@ function bt() {
|
|
|
2156
2208
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2157
2209
|
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.chat.welcome_subtitle") }),
|
|
2158
2210
|
/* @__PURE__ */ e(
|
|
2159
|
-
|
|
2211
|
+
de,
|
|
2160
2212
|
{
|
|
2161
2213
|
type: "text",
|
|
2162
2214
|
value: l.welcome_subtitle || "",
|
|
2163
|
-
onChange: (
|
|
2215
|
+
onChange: (i) => g({ ...l, welcome_subtitle: i.target.value }),
|
|
2164
2216
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2165
2217
|
dir: "auto"
|
|
2166
2218
|
}
|
|
@@ -2174,7 +2226,7 @@ function bt() {
|
|
|
2174
2226
|
Se,
|
|
2175
2227
|
{
|
|
2176
2228
|
value: l.disclaimer || "",
|
|
2177
|
-
onChange: (
|
|
2229
|
+
onChange: (i) => g({ ...l, disclaimer: i.target.value }),
|
|
2178
2230
|
className: "bg-muted/20 border-transparent focus:bg-background min-h-[120px] py-4 resize-none leading-relaxed",
|
|
2179
2231
|
dir: "auto"
|
|
2180
2232
|
}
|
|
@@ -2191,7 +2243,7 @@ function bt() {
|
|
|
2191
2243
|
Y,
|
|
2192
2244
|
{
|
|
2193
2245
|
checked: l.show_tool_details,
|
|
2194
|
-
onCheckedChange: (
|
|
2246
|
+
onCheckedChange: (i) => g({ ...l, show_tool_details: i })
|
|
2195
2247
|
}
|
|
2196
2248
|
)
|
|
2197
2249
|
] }),
|
|
@@ -2204,7 +2256,7 @@ function bt() {
|
|
|
2204
2256
|
Y,
|
|
2205
2257
|
{
|
|
2206
2258
|
checked: l.show_settings,
|
|
2207
|
-
onCheckedChange: (
|
|
2259
|
+
onCheckedChange: (i) => g({ ...l, show_settings: i })
|
|
2208
2260
|
}
|
|
2209
2261
|
)
|
|
2210
2262
|
] }),
|
|
@@ -2217,7 +2269,7 @@ function bt() {
|
|
|
2217
2269
|
Y,
|
|
2218
2270
|
{
|
|
2219
2271
|
checked: l.composer_attachments,
|
|
2220
|
-
onCheckedChange: (
|
|
2272
|
+
onCheckedChange: (i) => g({ ...l, composer_attachments: i })
|
|
2221
2273
|
}
|
|
2222
2274
|
)
|
|
2223
2275
|
] }),
|
|
@@ -2230,7 +2282,7 @@ function bt() {
|
|
|
2230
2282
|
Y,
|
|
2231
2283
|
{
|
|
2232
2284
|
checked: l.thread_actions_feedback,
|
|
2233
|
-
onCheckedChange: (
|
|
2285
|
+
onCheckedChange: (i) => g({ ...l, thread_actions_feedback: i })
|
|
2234
2286
|
}
|
|
2235
2287
|
)
|
|
2236
2288
|
] }),
|
|
@@ -2243,7 +2295,7 @@ function bt() {
|
|
|
2243
2295
|
Y,
|
|
2244
2296
|
{
|
|
2245
2297
|
checked: l.thread_actions_retry,
|
|
2246
|
-
onCheckedChange: (
|
|
2298
|
+
onCheckedChange: (i) => g({ ...l, thread_actions_retry: i })
|
|
2247
2299
|
}
|
|
2248
2300
|
)
|
|
2249
2301
|
] }),
|
|
@@ -2256,7 +2308,7 @@ function bt() {
|
|
|
2256
2308
|
Y,
|
|
2257
2309
|
{
|
|
2258
2310
|
checked: l.history_enabled,
|
|
2259
|
-
onCheckedChange: (
|
|
2311
|
+
onCheckedChange: (i) => g({ ...l, history_enabled: i })
|
|
2260
2312
|
}
|
|
2261
2313
|
)
|
|
2262
2314
|
] }),
|
|
@@ -2267,7 +2319,7 @@ function bt() {
|
|
|
2267
2319
|
Y,
|
|
2268
2320
|
{
|
|
2269
2321
|
checked: l.history_show_delete,
|
|
2270
|
-
onCheckedChange: (
|
|
2322
|
+
onCheckedChange: (i) => g({ ...l, history_show_delete: i })
|
|
2271
2323
|
}
|
|
2272
2324
|
)
|
|
2273
2325
|
] }),
|
|
@@ -2277,7 +2329,7 @@ function bt() {
|
|
|
2277
2329
|
Y,
|
|
2278
2330
|
{
|
|
2279
2331
|
checked: l.history_show_rename,
|
|
2280
|
-
onCheckedChange: (
|
|
2332
|
+
onCheckedChange: (i) => g({ ...l, history_show_rename: i })
|
|
2281
2333
|
}
|
|
2282
2334
|
)
|
|
2283
2335
|
] }),
|
|
@@ -2287,7 +2339,7 @@ function bt() {
|
|
|
2287
2339
|
Y,
|
|
2288
2340
|
{
|
|
2289
2341
|
checked: l.history_show_share,
|
|
2290
|
-
onCheckedChange: (
|
|
2342
|
+
onCheckedChange: (i) => g({ ...l, history_show_share: i })
|
|
2291
2343
|
}
|
|
2292
2344
|
)
|
|
2293
2345
|
] }),
|
|
@@ -2297,7 +2349,7 @@ function bt() {
|
|
|
2297
2349
|
Y,
|
|
2298
2350
|
{
|
|
2299
2351
|
checked: l.history_show_pin,
|
|
2300
|
-
onCheckedChange: (
|
|
2352
|
+
onCheckedChange: (i) => g({ ...l, history_show_pin: i })
|
|
2301
2353
|
}
|
|
2302
2354
|
)
|
|
2303
2355
|
] })
|
|
@@ -2312,25 +2364,25 @@ function bt() {
|
|
|
2312
2364
|
{ id: "settings_general_mode", label: "app_settings.chat.general_tab" },
|
|
2313
2365
|
{ id: "settings_profile_mode", label: "app_settings.chat.profile_tab" },
|
|
2314
2366
|
{ id: "settings_account_mode", label: "app_settings.chat.account_tab" }
|
|
2315
|
-
].map((
|
|
2316
|
-
/* @__PURE__ */ e(Q, { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70", children: t(
|
|
2367
|
+
].map((i) => /* @__PURE__ */ r("div", { className: "p-4 border border-border/40 rounded-2xl space-y-3 bg-muted/5", children: [
|
|
2368
|
+
/* @__PURE__ */ e(Q, { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70", children: t(i.label) }),
|
|
2317
2369
|
/* @__PURE__ */ r(
|
|
2318
|
-
|
|
2370
|
+
ne,
|
|
2319
2371
|
{
|
|
2320
|
-
value: l[
|
|
2321
|
-
onValueChange: (
|
|
2322
|
-
dir:
|
|
2372
|
+
value: l[i.id],
|
|
2373
|
+
onValueChange: (y) => g({ ...l, [i.id]: y }),
|
|
2374
|
+
dir: L ? "rtl" : "ltr",
|
|
2323
2375
|
children: [
|
|
2324
|
-
/* @__PURE__ */ e(
|
|
2325
|
-
/* @__PURE__ */ r(
|
|
2326
|
-
/* @__PURE__ */ e(
|
|
2327
|
-
/* @__PURE__ */ e(
|
|
2328
|
-
/* @__PURE__ */ e(
|
|
2376
|
+
/* @__PURE__ */ e(ie, { className: "bg-background border-transparent h-9 text-xs", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2377
|
+
/* @__PURE__ */ r(le, { children: [
|
|
2378
|
+
/* @__PURE__ */ e(G, { value: "editable", children: t("app_settings.chat.mode_editable") }),
|
|
2379
|
+
/* @__PURE__ */ e(G, { value: "faded", children: t("app_settings.chat.mode_faded") }),
|
|
2380
|
+
/* @__PURE__ */ e(G, { value: "hidden", children: t("app_settings.chat.mode_hidden") })
|
|
2329
2381
|
] })
|
|
2330
2382
|
]
|
|
2331
2383
|
}
|
|
2332
2384
|
)
|
|
2333
|
-
] },
|
|
2385
|
+
] }, i.id)) })
|
|
2334
2386
|
] }),
|
|
2335
2387
|
/* @__PURE__ */ r("div", { className: "pt-10 space-y-8", children: [
|
|
2336
2388
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
@@ -2348,28 +2400,28 @@ function bt() {
|
|
|
2348
2400
|
{ id: "accent", label: t("settings:general.accent") },
|
|
2349
2401
|
{ id: "radius", label: t("settings:general.radius") },
|
|
2350
2402
|
{ id: "language", label: t("settings:general.language") }
|
|
2351
|
-
].map((
|
|
2352
|
-
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children:
|
|
2403
|
+
].map((i) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
|
|
2404
|
+
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children: i.label }),
|
|
2353
2405
|
/* @__PURE__ */ r(
|
|
2354
|
-
|
|
2406
|
+
ne,
|
|
2355
2407
|
{
|
|
2356
|
-
value: l.settings_general_fields?.[
|
|
2357
|
-
onValueChange: (
|
|
2358
|
-
...
|
|
2359
|
-
settings_general_fields: { ...
|
|
2408
|
+
value: l.settings_general_fields?.[i.id] || "editable",
|
|
2409
|
+
onValueChange: (y) => g((F) => ({
|
|
2410
|
+
...F,
|
|
2411
|
+
settings_general_fields: { ...F.settings_general_fields, [i.id]: y }
|
|
2360
2412
|
})),
|
|
2361
|
-
dir:
|
|
2413
|
+
dir: L ? "rtl" : "ltr",
|
|
2362
2414
|
children: [
|
|
2363
|
-
/* @__PURE__ */ e(
|
|
2364
|
-
/* @__PURE__ */ r(
|
|
2365
|
-
/* @__PURE__ */ e(
|
|
2366
|
-
/* @__PURE__ */ e(
|
|
2367
|
-
/* @__PURE__ */ e(
|
|
2415
|
+
/* @__PURE__ */ e(ie, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2416
|
+
/* @__PURE__ */ r(le, { children: [
|
|
2417
|
+
/* @__PURE__ */ e(G, { value: "editable", className: "text-[10px]", children: t("app_settings.chat.mode_editable") }),
|
|
2418
|
+
/* @__PURE__ */ e(G, { value: "faded", className: "text-[10px]", children: t("app_settings.chat.mode_faded") }),
|
|
2419
|
+
/* @__PURE__ */ e(G, { value: "hidden", className: "text-[10px]", children: t("app_settings.chat.mode_hidden") })
|
|
2368
2420
|
] })
|
|
2369
2421
|
]
|
|
2370
2422
|
}
|
|
2371
2423
|
)
|
|
2372
|
-
] },
|
|
2424
|
+
] }, i.id)) })
|
|
2373
2425
|
] }),
|
|
2374
2426
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
2375
2427
|
/* @__PURE__ */ r("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
|
|
@@ -2381,29 +2433,29 @@ function bt() {
|
|
|
2381
2433
|
{ id: "surname", label: t("settings:profile.surname") },
|
|
2382
2434
|
{ id: "phone", label: t("settings:profile.phone") },
|
|
2383
2435
|
{ id: "password", label: t("settings:profile.password") },
|
|
2384
|
-
...(
|
|
2385
|
-
].map((
|
|
2386
|
-
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children:
|
|
2436
|
+
...(o?.userMetadataFields || []).map((i) => ({ id: i.key, label: t(i.label) }))
|
|
2437
|
+
].map((i) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
|
|
2438
|
+
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children: i.label }),
|
|
2387
2439
|
/* @__PURE__ */ r(
|
|
2388
|
-
|
|
2440
|
+
ne,
|
|
2389
2441
|
{
|
|
2390
|
-
value: l.settings_profile_fields?.[
|
|
2391
|
-
onValueChange: (
|
|
2392
|
-
...
|
|
2393
|
-
settings_profile_fields: { ...
|
|
2442
|
+
value: l.settings_profile_fields?.[i.id] || "editable",
|
|
2443
|
+
onValueChange: (y) => g((F) => ({
|
|
2444
|
+
...F,
|
|
2445
|
+
settings_profile_fields: { ...F.settings_profile_fields, [i.id]: y }
|
|
2394
2446
|
})),
|
|
2395
|
-
dir:
|
|
2447
|
+
dir: L ? "rtl" : "ltr",
|
|
2396
2448
|
children: [
|
|
2397
|
-
/* @__PURE__ */ e(
|
|
2398
|
-
/* @__PURE__ */ r(
|
|
2399
|
-
/* @__PURE__ */ e(
|
|
2400
|
-
/* @__PURE__ */ e(
|
|
2401
|
-
/* @__PURE__ */ e(
|
|
2449
|
+
/* @__PURE__ */ e(ie, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2450
|
+
/* @__PURE__ */ r(le, { children: [
|
|
2451
|
+
/* @__PURE__ */ e(G, { value: "editable", className: "text-[10px]", children: t("app_settings.chat.mode_editable") }),
|
|
2452
|
+
/* @__PURE__ */ e(G, { value: "faded", className: "text-[10px]", children: t("app_settings.chat.mode_faded") }),
|
|
2453
|
+
/* @__PURE__ */ e(G, { value: "hidden", className: "text-[10px]", children: t("app_settings.chat.mode_hidden") })
|
|
2402
2454
|
] })
|
|
2403
2455
|
]
|
|
2404
2456
|
}
|
|
2405
2457
|
)
|
|
2406
|
-
] },
|
|
2458
|
+
] }, i.id)) })
|
|
2407
2459
|
] }),
|
|
2408
2460
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
2409
2461
|
/* @__PURE__ */ r("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
|
|
@@ -2413,64 +2465,98 @@ function bt() {
|
|
|
2413
2465
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
2414
2466
|
{ id: "balance", label: t("settings:account.balance") },
|
|
2415
2467
|
{ id: "logout", label: t("settings:account.logout") }
|
|
2416
|
-
].map((
|
|
2417
|
-
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children:
|
|
2468
|
+
].map((i) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
|
|
2469
|
+
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children: i.label }),
|
|
2418
2470
|
/* @__PURE__ */ r(
|
|
2419
|
-
|
|
2471
|
+
ne,
|
|
2420
2472
|
{
|
|
2421
|
-
value: l.settings_account_fields?.[
|
|
2422
|
-
onValueChange: (
|
|
2423
|
-
...
|
|
2424
|
-
settings_account_fields: { ...
|
|
2473
|
+
value: l.settings_account_fields?.[i.id] || "editable",
|
|
2474
|
+
onValueChange: (y) => g((F) => ({
|
|
2475
|
+
...F,
|
|
2476
|
+
settings_account_fields: { ...F.settings_account_fields, [i.id]: y }
|
|
2425
2477
|
})),
|
|
2426
|
-
dir:
|
|
2478
|
+
dir: L ? "rtl" : "ltr",
|
|
2427
2479
|
children: [
|
|
2428
|
-
/* @__PURE__ */ e(
|
|
2429
|
-
/* @__PURE__ */ r(
|
|
2430
|
-
/* @__PURE__ */ e(
|
|
2431
|
-
/* @__PURE__ */ e(
|
|
2432
|
-
/* @__PURE__ */ e(
|
|
2480
|
+
/* @__PURE__ */ e(ie, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2481
|
+
/* @__PURE__ */ r(le, { children: [
|
|
2482
|
+
/* @__PURE__ */ e(G, { value: "editable", className: "text-[10px]", children: t("app_settings.chat.mode_editable") }),
|
|
2483
|
+
/* @__PURE__ */ e(G, { value: "faded", className: "text-[10px]", children: t("app_settings.chat.mode_faded") }),
|
|
2484
|
+
/* @__PURE__ */ e(G, { value: "hidden", className: "text-[10px]", children: t("app_settings.chat.mode_hidden") })
|
|
2433
2485
|
] })
|
|
2434
2486
|
]
|
|
2435
2487
|
}
|
|
2436
2488
|
)
|
|
2437
|
-
] },
|
|
2489
|
+
] }, i.id)) })
|
|
2438
2490
|
] })
|
|
2439
2491
|
] })
|
|
2440
2492
|
] })
|
|
2441
2493
|
] })
|
|
2442
2494
|
] }),
|
|
2443
2495
|
/* @__PURE__ */ r("section", { children: [
|
|
2444
|
-
/* @__PURE__ */ e(
|
|
2496
|
+
/* @__PURE__ */ e(M, { title: t("app_settings.sections.user_billing"), icon: ct }),
|
|
2497
|
+
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
2498
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
2499
|
+
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2500
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.user_billing.initial_balance_tokens") }),
|
|
2501
|
+
/* @__PURE__ */ e(
|
|
2502
|
+
de,
|
|
2503
|
+
{
|
|
2504
|
+
type: "number",
|
|
2505
|
+
value: l.initial_balance_tokens ?? "",
|
|
2506
|
+
onChange: (i) => g({ ...l, initial_balance_tokens: parseInt(i.target.value) || 0 }),
|
|
2507
|
+
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2508
|
+
placeholder: "250000"
|
|
2509
|
+
}
|
|
2510
|
+
)
|
|
2511
|
+
] }),
|
|
2512
|
+
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2513
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.user_billing.initial_balance_requests") }),
|
|
2514
|
+
/* @__PURE__ */ e(
|
|
2515
|
+
de,
|
|
2516
|
+
{
|
|
2517
|
+
type: "number",
|
|
2518
|
+
value: l.initial_balance_requests ?? "",
|
|
2519
|
+
onChange: (i) => g({ ...l, initial_balance_requests: parseInt(i.target.value) || 0 }),
|
|
2520
|
+
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2521
|
+
placeholder: "100"
|
|
2522
|
+
}
|
|
2523
|
+
)
|
|
2524
|
+
] })
|
|
2525
|
+
] }),
|
|
2526
|
+
/* @__PURE__ */ e("p", { className: "mt-3 text-[10px] text-muted-foreground/50 italic flex items-center gap-1.5 ml-1", children: t("app_settings.user_billing.initial_balance_help") })
|
|
2527
|
+
] })
|
|
2528
|
+
] }),
|
|
2529
|
+
/* @__PURE__ */ r("section", { children: [
|
|
2530
|
+
/* @__PURE__ */ e(M, { title: t("app_settings.translations_management"), icon: mt }),
|
|
2445
2531
|
/* @__PURE__ */ r("div", { className: "border border-border/60 rounded-2xl overflow-hidden bg-background", children: [
|
|
2446
2532
|
/* @__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: [
|
|
2447
2533
|
/* @__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: [
|
|
2448
2534
|
/* @__PURE__ */ e("div", { className: "p-2 px-3 bg-muted/20 rounded-lg border border-border/40 ml-1", children: /* @__PURE__ */ e(xe, { className: "size-4 text-muted-foreground" }) }),
|
|
2449
|
-
/* @__PURE__ */ r(
|
|
2450
|
-
/* @__PURE__ */ e(
|
|
2451
|
-
/* @__PURE__ */ e(
|
|
2535
|
+
/* @__PURE__ */ r(ne, { value: v, onValueChange: z, children: [
|
|
2536
|
+
/* @__PURE__ */ e(ie, { size: "sm", className: "border-none shadow-none bg-transparent h-8 font-black uppercase tracking-wider", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2537
|
+
/* @__PURE__ */ e(le, { children: Object.keys(l.translations || {}).sort().map((i) => /* @__PURE__ */ e(G, { value: i, children: i.toUpperCase() }, i)) })
|
|
2452
2538
|
] }),
|
|
2453
2539
|
/* @__PURE__ */ e("div", { className: "w-px h-6 bg-border/60" }),
|
|
2454
|
-
/* @__PURE__ */ r(
|
|
2455
|
-
/* @__PURE__ */ e(
|
|
2456
|
-
/* @__PURE__ */ e(
|
|
2540
|
+
/* @__PURE__ */ r(ne, { value: R, onValueChange: E, children: [
|
|
2541
|
+
/* @__PURE__ */ e(ie, { size: "sm", className: "border-none shadow-none bg-transparent h-8 flex-1 font-bold", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2542
|
+
/* @__PURE__ */ e(le, { children: Object.keys(l.translations?.[v] || {}).sort().map((i) => /* @__PURE__ */ e(G, { value: i, children: i }, i)) })
|
|
2457
2543
|
] })
|
|
2458
2544
|
] }),
|
|
2459
2545
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
2460
|
-
/* @__PURE__ */ e("button", { type: "button", onClick:
|
|
2461
|
-
/* @__PURE__ */ e("button", { type: "button", onClick:
|
|
2546
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: f, title: "Add Language", className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40", children: /* @__PURE__ */ e(ut, { className: "size-4" }) }),
|
|
2547
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: q, title: "Add Namespace", className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40", children: /* @__PURE__ */ e(xe, { className: "size-4" }) })
|
|
2462
2548
|
] })
|
|
2463
2549
|
] }),
|
|
2464
2550
|
/* @__PURE__ */ r("div", { className: "relative p-6", children: [
|
|
2465
2551
|
/* @__PURE__ */ r("div", { className: "absolute top-8 right-10 flex items-center gap-2", children: [
|
|
2466
2552
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted-foreground/40 uppercase tracking-widest", children: "JSON EDITOR" }),
|
|
2467
|
-
/* @__PURE__ */ e(
|
|
2553
|
+
/* @__PURE__ */ e(ht, { className: "size-3 text-muted-foreground/30" })
|
|
2468
2554
|
] }),
|
|
2469
2555
|
/* @__PURE__ */ e(
|
|
2470
2556
|
Se,
|
|
2471
2557
|
{
|
|
2472
2558
|
value: V,
|
|
2473
|
-
onChange: (
|
|
2559
|
+
onChange: (i) => j(i.target.value),
|
|
2474
2560
|
dir: "ltr",
|
|
2475
2561
|
className: `w-full min-h-[500px] bg-muted/5 font-mono text-[13px] p-8 rounded-xl border focus:ring-1 focus:outline-none leading-relaxed resize-y text-left ${B ? "border-destructive/40 focus:ring-destructive/20" : "border-border/40 focus:ring-primary/20"}`,
|
|
2476
2562
|
spellCheck: !1
|
|
@@ -2492,188 +2578,188 @@ function bt() {
|
|
|
2492
2578
|
] });
|
|
2493
2579
|
}
|
|
2494
2580
|
function ce() {
|
|
2495
|
-
const { t, i18n:
|
|
2496
|
-
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col items-center justify-center p-6 text-center gap-4 animate-in fade-in duration-500", dir:
|
|
2497
|
-
/* @__PURE__ */ e("div", { className: "bg-destructive/10 p-4 rounded-2xl border border-destructive/20 relative", children: /* @__PURE__ */ e(
|
|
2581
|
+
const { t, i18n: n } = ee(["admin"]), o = n.language === "fa";
|
|
2582
|
+
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col items-center justify-center p-6 text-center gap-4 animate-in fade-in duration-500", dir: o ? "rtl" : "ltr", children: [
|
|
2583
|
+
/* @__PURE__ */ e("div", { className: "bg-destructive/10 p-4 rounded-2xl border border-destructive/20 relative", children: /* @__PURE__ */ e(pt, { className: "size-10 text-destructive/70" }) }),
|
|
2498
2584
|
/* @__PURE__ */ r("div", { className: "space-y-1 max-w-sm", children: [
|
|
2499
2585
|
/* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground tracking-tight", children: t("errors.access_denied_title", "Access Denied") }),
|
|
2500
2586
|
/* @__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.") })
|
|
2501
2587
|
] })
|
|
2502
2588
|
] });
|
|
2503
2589
|
}
|
|
2504
|
-
const
|
|
2505
|
-
const { t:
|
|
2506
|
-
m(
|
|
2590
|
+
const Ct = ({ className: t }) => {
|
|
2591
|
+
const { t: n } = ee(["theme"]), { theme: o, setTheme: m } = we(), b = () => {
|
|
2592
|
+
m(o === "system" ? "light" : o === "light" ? "dark" : "system");
|
|
2507
2593
|
}, p = () => {
|
|
2508
|
-
switch (
|
|
2594
|
+
switch (o) {
|
|
2509
2595
|
case "light":
|
|
2510
|
-
return /* @__PURE__ */ e(
|
|
2596
|
+
return /* @__PURE__ */ e(ft, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
2511
2597
|
case "dark":
|
|
2512
|
-
return /* @__PURE__ */ e(
|
|
2598
|
+
return /* @__PURE__ */ e(gt, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
2513
2599
|
case "system":
|
|
2514
|
-
return /* @__PURE__ */ e(
|
|
2600
|
+
return /* @__PURE__ */ e(qe, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
2515
2601
|
default:
|
|
2516
|
-
return /* @__PURE__ */ e(
|
|
2602
|
+
return /* @__PURE__ */ e(qe, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
2517
2603
|
}
|
|
2518
|
-
},
|
|
2519
|
-
switch (
|
|
2604
|
+
}, N = () => {
|
|
2605
|
+
switch (o) {
|
|
2520
2606
|
case "light":
|
|
2521
|
-
return
|
|
2607
|
+
return n("dark");
|
|
2522
2608
|
case "dark":
|
|
2523
|
-
return
|
|
2609
|
+
return n("system");
|
|
2524
2610
|
case "system":
|
|
2525
|
-
return
|
|
2611
|
+
return n("light");
|
|
2526
2612
|
default:
|
|
2527
|
-
return
|
|
2613
|
+
return n("toggle");
|
|
2528
2614
|
}
|
|
2529
2615
|
};
|
|
2530
2616
|
return /* @__PURE__ */ r(ve, { children: [
|
|
2531
|
-
/* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ r(he, { variant: "ghost", size: "icon", onClick:
|
|
2617
|
+
/* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ r(he, { variant: "ghost", size: "icon", onClick: b, className: t, children: [
|
|
2532
2618
|
p(),
|
|
2533
|
-
/* @__PURE__ */ e("span", { className: "sr-only", children:
|
|
2619
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: n("toggle") })
|
|
2534
2620
|
] }) }),
|
|
2535
|
-
/* @__PURE__ */ e(Ne, { children:
|
|
2621
|
+
/* @__PURE__ */ e(Ne, { children: N() })
|
|
2536
2622
|
] });
|
|
2537
2623
|
};
|
|
2538
|
-
function
|
|
2539
|
-
const
|
|
2540
|
-
|
|
2624
|
+
function Lt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
2625
|
+
const o = nt(), m = it(), { t: b, i18n: p } = ee(["admin", "settings", "translation"]), { app: N } = me(), { theme: _ } = we(), [w, H] = x([]), [T, A] = x(!1), I = Me(!1), [D, C] = x("light");
|
|
2626
|
+
W(() => {
|
|
2541
2627
|
if (_ === "system") {
|
|
2542
|
-
const
|
|
2543
|
-
|
|
2628
|
+
const u = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
2629
|
+
C(u ? "dark" : "light");
|
|
2544
2630
|
} else
|
|
2545
|
-
|
|
2631
|
+
C(_);
|
|
2546
2632
|
}, [_]);
|
|
2547
|
-
const O = pe(() =>
|
|
2548
|
-
|
|
2549
|
-
const
|
|
2550
|
-
if (
|
|
2633
|
+
const O = pe(() => N?.logo ? typeof N.logo == "string" ? N.logo : D === "dark" ? N.logo.dark : N.logo.light : Ie, [N?.logo, D]), U = N?.adminTitle || N?.name, v = p.language === "fa";
|
|
2634
|
+
W(() => {
|
|
2635
|
+
const u = localStorage.getItem("admin_info");
|
|
2636
|
+
if (u)
|
|
2551
2637
|
try {
|
|
2552
|
-
const d = JSON.parse(
|
|
2553
|
-
if (
|
|
2554
|
-
if (d.includes("analytics") && !
|
|
2555
|
-
|
|
2556
|
-
else if (d.includes("chat_history") && !
|
|
2557
|
-
|
|
2558
|
-
else if (d.includes("user_management") && !
|
|
2559
|
-
|
|
2560
|
-
else if (d.includes("admin_management") && !
|
|
2561
|
-
|
|
2562
|
-
else if (d.includes("settings") && !
|
|
2563
|
-
|
|
2638
|
+
const d = JSON.parse(u).permissions || [];
|
|
2639
|
+
if (H(d), m.pathname === "/admin" || m.pathname === "/admin/")
|
|
2640
|
+
if (d.includes("analytics") && !n.includes("analytics"))
|
|
2641
|
+
o("/admin/analytics", { replace: !0 });
|
|
2642
|
+
else if (d.includes("chat_history") && !n.includes("chat_history"))
|
|
2643
|
+
o("/admin/chat-history", { replace: !0 });
|
|
2644
|
+
else if (d.includes("user_management") && !n.includes("user_management"))
|
|
2645
|
+
o("/admin/users", { replace: !0 });
|
|
2646
|
+
else if (d.includes("admin_management") && !n.includes("admin_management"))
|
|
2647
|
+
o("/admin/admins", { replace: !0 });
|
|
2648
|
+
else if (d.includes("settings") && !n.includes("settings"))
|
|
2649
|
+
o("/admin/settings", { replace: !0 });
|
|
2564
2650
|
else {
|
|
2565
2651
|
const c = t.find((l) => !l.permission || d.includes(l.permission));
|
|
2566
|
-
c &&
|
|
2652
|
+
c && o(`/admin/${c.path}`, { replace: !0 });
|
|
2567
2653
|
}
|
|
2568
|
-
} catch (
|
|
2569
|
-
console.error("Failed to parse admin_info",
|
|
2654
|
+
} catch (J) {
|
|
2655
|
+
console.error("Failed to parse admin_info", J);
|
|
2570
2656
|
}
|
|
2571
2657
|
else
|
|
2572
2658
|
console.warn("DashboardPage: No adminInfo found in localStorage");
|
|
2573
|
-
}, [
|
|
2574
|
-
const
|
|
2659
|
+
}, [o, m.pathname]);
|
|
2660
|
+
const z = () => {
|
|
2575
2661
|
k.clearToken(), window.location.reload();
|
|
2576
|
-
},
|
|
2577
|
-
localStorage.setItem("gentiq-admin-language",
|
|
2662
|
+
}, R = (u) => w.includes(u), E = (u) => w.includes(u) && !n.includes(u), V = Object.keys(p.services?.resourceStore?.data || {}).filter((u) => u !== "dev"), Z = V.length > 0 ? V : ["en", "fa"], B = (u) => {
|
|
2663
|
+
localStorage.setItem("gentiq-admin-language", u), p.changeLanguage(u), A(!1), document.activeElement instanceof HTMLElement && document.activeElement.blur();
|
|
2578
2664
|
};
|
|
2579
|
-
return /* @__PURE__ */ r("div", { className: "min-h-screen bg-background overflow-hidden flex flex-col", dir:
|
|
2665
|
+
return /* @__PURE__ */ r("div", { className: "min-h-screen bg-background overflow-hidden flex flex-col", dir: v ? "rtl" : "ltr", children: [
|
|
2580
2666
|
/* @__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: [
|
|
2581
2667
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-stretch gap-x-12", children: [
|
|
2582
2668
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3 py-4 md:py-0", children: [
|
|
2583
|
-
/* @__PURE__ */ e("img", { src: O, alt:
|
|
2584
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children:
|
|
2669
|
+
/* @__PURE__ */ e("img", { src: O, alt: U, className: "size-8 object-contain" }),
|
|
2670
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: U })
|
|
2585
2671
|
] }),
|
|
2586
2672
|
/* @__PURE__ */ r("nav", { className: "flex items-stretch gap-8", children: [
|
|
2587
|
-
!
|
|
2673
|
+
!n.includes("analytics") && /* @__PURE__ */ e(
|
|
2588
2674
|
"button",
|
|
2589
2675
|
{
|
|
2590
|
-
onClick: () =>
|
|
2676
|
+
onClick: () => o("/admin/analytics"),
|
|
2591
2677
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${m.pathname === "/admin/analytics" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
2592
|
-
children:
|
|
2678
|
+
children: b("dashboard.tabs.analytics")
|
|
2593
2679
|
}
|
|
2594
2680
|
),
|
|
2595
|
-
!
|
|
2681
|
+
!n.includes("chat_history") && /* @__PURE__ */ e(
|
|
2596
2682
|
"button",
|
|
2597
2683
|
{
|
|
2598
|
-
onClick: () =>
|
|
2684
|
+
onClick: () => o("/admin/chat-history"),
|
|
2599
2685
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${m.pathname === "/admin/chat-history" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
2600
|
-
children:
|
|
2686
|
+
children: b("dashboard.tabs.chat_history")
|
|
2601
2687
|
}
|
|
2602
2688
|
),
|
|
2603
|
-
!
|
|
2689
|
+
!n.includes("user_management") && /* @__PURE__ */ e(
|
|
2604
2690
|
"button",
|
|
2605
2691
|
{
|
|
2606
|
-
onClick: () =>
|
|
2692
|
+
onClick: () => o("/admin/users"),
|
|
2607
2693
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${m.pathname === "/admin/users" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
2608
|
-
children:
|
|
2694
|
+
children: b("dashboard.tabs.users")
|
|
2609
2695
|
}
|
|
2610
2696
|
),
|
|
2611
|
-
!
|
|
2697
|
+
!n.includes("admin_management") && /* @__PURE__ */ e(
|
|
2612
2698
|
"button",
|
|
2613
2699
|
{
|
|
2614
|
-
onClick: () =>
|
|
2700
|
+
onClick: () => o("/admin/admins"),
|
|
2615
2701
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${m.pathname === "/admin/admins" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
2616
|
-
children:
|
|
2702
|
+
children: b("dashboard.tabs.admins")
|
|
2617
2703
|
}
|
|
2618
2704
|
),
|
|
2619
|
-
!
|
|
2705
|
+
!n.includes("settings") && /* @__PURE__ */ e(
|
|
2620
2706
|
"button",
|
|
2621
2707
|
{
|
|
2622
|
-
onClick: () =>
|
|
2708
|
+
onClick: () => o("/admin/settings"),
|
|
2623
2709
|
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${m.pathname === "/admin/settings" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
2624
|
-
children:
|
|
2710
|
+
children: b("dashboard.tabs.settings")
|
|
2625
2711
|
}
|
|
2626
2712
|
),
|
|
2627
|
-
t.map((
|
|
2713
|
+
t.map((u) => /* @__PURE__ */ e(
|
|
2628
2714
|
"button",
|
|
2629
2715
|
{
|
|
2630
|
-
onClick: () =>
|
|
2631
|
-
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${m.pathname === `/admin/${
|
|
2632
|
-
children: typeof
|
|
2716
|
+
onClick: () => o(`/admin/${u.path}`),
|
|
2717
|
+
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${m.pathname === `/admin/${u.path}` ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
2718
|
+
children: typeof u.label == "string" ? b(u.label) : u.label
|
|
2633
2719
|
},
|
|
2634
|
-
`tab-${
|
|
2720
|
+
`tab-${u.path}`
|
|
2635
2721
|
))
|
|
2636
2722
|
] })
|
|
2637
2723
|
] }),
|
|
2638
2724
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 py-4 md:py-0", children: [
|
|
2639
|
-
/* @__PURE__ */ r(
|
|
2640
|
-
|
|
2641
|
-
|
|
2725
|
+
/* @__PURE__ */ r(Xe, { onOpenChange: (u) => {
|
|
2726
|
+
u ? A(!1) : (I.current = !0, setTimeout(() => {
|
|
2727
|
+
I.current = !1;
|
|
2642
2728
|
}, 200));
|
|
2643
2729
|
}, children: [
|
|
2644
2730
|
/* @__PURE__ */ r(
|
|
2645
2731
|
ve,
|
|
2646
2732
|
{
|
|
2647
2733
|
open: T,
|
|
2648
|
-
onOpenChange: (
|
|
2649
|
-
|
|
2734
|
+
onOpenChange: (u) => {
|
|
2735
|
+
u && I.current || A(u);
|
|
2650
2736
|
},
|
|
2651
2737
|
children: [
|
|
2652
|
-
/* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ e(
|
|
2738
|
+
/* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ e(Ye, { asChild: !0, children: /* @__PURE__ */ e(
|
|
2653
2739
|
he,
|
|
2654
2740
|
{
|
|
2655
2741
|
variant: "ghost",
|
|
2656
2742
|
size: "icon",
|
|
2657
2743
|
className: "font-bold text-xs text-muted-foreground hover:bg-muted",
|
|
2658
|
-
onPointerDown: () =>
|
|
2744
|
+
onPointerDown: () => A(!1),
|
|
2659
2745
|
children: (p.language?.split("-")[0] || "").toUpperCase()
|
|
2660
2746
|
}
|
|
2661
2747
|
) }) }),
|
|
2662
|
-
/* @__PURE__ */ e(Ne, { side: "bottom", className: "text-xs", children:
|
|
2748
|
+
/* @__PURE__ */ e(Ne, { side: "bottom", className: "text-xs", children: b("dashboard.language", "Change Language") })
|
|
2663
2749
|
]
|
|
2664
2750
|
}
|
|
2665
2751
|
),
|
|
2666
|
-
/* @__PURE__ */ e(
|
|
2667
|
-
|
|
2752
|
+
/* @__PURE__ */ e(et, { align: "center", className: "min-w-[8rem]", children: Z.map((u) => /* @__PURE__ */ e(
|
|
2753
|
+
tt,
|
|
2668
2754
|
{
|
|
2669
|
-
onClick: () => B(
|
|
2670
|
-
className:
|
|
2671
|
-
children:
|
|
2755
|
+
onClick: () => B(u),
|
|
2756
|
+
className: u === p.language ? "bg-primary/10" : "",
|
|
2757
|
+
children: b(`general.languages.${u}`, u.toUpperCase())
|
|
2672
2758
|
},
|
|
2673
|
-
|
|
2759
|
+
u
|
|
2674
2760
|
)) })
|
|
2675
2761
|
] }),
|
|
2676
|
-
/* @__PURE__ */ e(
|
|
2762
|
+
/* @__PURE__ */ e(Ct, { className: "size-9 !bg-transparent hover:bg-muted text-muted-foreground" }),
|
|
2677
2763
|
/* @__PURE__ */ e("div", { className: "w-px h-5 bg-border mx-1" }),
|
|
2678
2764
|
/* @__PURE__ */ r(ve, { children: [
|
|
2679
2765
|
/* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ e(
|
|
@@ -2682,38 +2768,38 @@ function yt({ extraPages: t = [], disabledPages: a = [] }) {
|
|
|
2682
2768
|
variant: "ghost",
|
|
2683
2769
|
size: "icon",
|
|
2684
2770
|
className: "hover:bg-destructive/10 hover:scale-105 active:scale-95 text-muted-foreground hover:text-destructive",
|
|
2685
|
-
onClick:
|
|
2686
|
-
children: /* @__PURE__ */ e(
|
|
2771
|
+
onClick: z,
|
|
2772
|
+
children: /* @__PURE__ */ e(xt, { className: "size-5" })
|
|
2687
2773
|
}
|
|
2688
2774
|
) }),
|
|
2689
|
-
/* @__PURE__ */ e(Ne, { side: "bottom", className: "text-xs", children:
|
|
2775
|
+
/* @__PURE__ */ e(Ne, { side: "bottom", className: "text-xs", children: b("dashboard.logout") })
|
|
2690
2776
|
] })
|
|
2691
2777
|
] })
|
|
2692
2778
|
] }) }) }),
|
|
2693
|
-
/* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ r(
|
|
2694
|
-
/* @__PURE__ */ e(
|
|
2695
|
-
/* @__PURE__ */ e(
|
|
2696
|
-
/* @__PURE__ */ e(
|
|
2697
|
-
/* @__PURE__ */ e(
|
|
2698
|
-
/* @__PURE__ */ e(
|
|
2699
|
-
/* @__PURE__ */ e(
|
|
2700
|
-
t.map((
|
|
2701
|
-
|
|
2779
|
+
/* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ r(ot, { children: [
|
|
2780
|
+
/* @__PURE__ */ e(ae, { path: "/", element: /* @__PURE__ */ e(Ce, { to: "/admin/analytics", replace: !0 }) }),
|
|
2781
|
+
/* @__PURE__ */ e(ae, { path: "/analytics", element: E("analytics") ? /* @__PURE__ */ e(kt, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2782
|
+
/* @__PURE__ */ e(ae, { path: "/chat-history", element: E("chat_history") ? /* @__PURE__ */ e(yt, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2783
|
+
/* @__PURE__ */ e(ae, { path: "/admins", element: E("admin_management") ? /* @__PURE__ */ e(Nt, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2784
|
+
/* @__PURE__ */ e(ae, { path: "/settings", element: E("settings") ? /* @__PURE__ */ e(St, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2785
|
+
/* @__PURE__ */ e(ae, { path: "/users", element: E("user_management") ? /* @__PURE__ */ e(_t, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2786
|
+
t.map((u) => /* @__PURE__ */ e(
|
|
2787
|
+
ae,
|
|
2702
2788
|
{
|
|
2703
|
-
path: `/${
|
|
2704
|
-
element:
|
|
2789
|
+
path: `/${u.path}`,
|
|
2790
|
+
element: u.permission && !R(u.permission) ? /* @__PURE__ */ e(ce, {}) : u.element
|
|
2705
2791
|
},
|
|
2706
|
-
`route-${
|
|
2792
|
+
`route-${u.path}`
|
|
2707
2793
|
)),
|
|
2708
|
-
/* @__PURE__ */ e(
|
|
2794
|
+
/* @__PURE__ */ e(ae, { path: "*", element: /* @__PURE__ */ e(Ce, { to: "/admin/analytics", replace: !0 }) })
|
|
2709
2795
|
] }) }) })
|
|
2710
2796
|
] });
|
|
2711
2797
|
}
|
|
2712
|
-
function
|
|
2713
|
-
const
|
|
2714
|
-
const
|
|
2715
|
-
return
|
|
2716
|
-
resources:
|
|
2798
|
+
function Rt(t) {
|
|
2799
|
+
const n = pe(() => {
|
|
2800
|
+
const o = Ue.createInstance();
|
|
2801
|
+
return o.use(rt).use(ze).init({
|
|
2802
|
+
resources: st,
|
|
2717
2803
|
fallbackLng: "en",
|
|
2718
2804
|
interpolation: { escapeValue: !1 },
|
|
2719
2805
|
detection: {
|
|
@@ -2721,133 +2807,133 @@ function At(t) {
|
|
|
2721
2807
|
lookupLocalStorage: "gentiq-admin-language",
|
|
2722
2808
|
caches: ["localStorage"]
|
|
2723
2809
|
}
|
|
2724
|
-
}),
|
|
2810
|
+
}), o;
|
|
2725
2811
|
}, []);
|
|
2726
|
-
return /* @__PURE__ */ e(
|
|
2812
|
+
return /* @__PURE__ */ e(Je, { i18n: n, children: /* @__PURE__ */ e(qt, { ...t }) });
|
|
2727
2813
|
}
|
|
2728
|
-
function
|
|
2729
|
-
const { app:
|
|
2730
|
-
|
|
2731
|
-
m?.resources && Object.entries(m.resources).forEach(([
|
|
2732
|
-
Object.entries(O).forEach(([
|
|
2733
|
-
p.addResourceBundle(
|
|
2814
|
+
function qt({ extraPages: t, disabledPages: n = [] }) {
|
|
2815
|
+
const { app: o, i18n: m } = me(), { t: b, i18n: p } = ee(["admin", "translation"]), [N, _] = x(!1), [w, H] = x(!0), [T, A] = x(!1);
|
|
2816
|
+
W(() => {
|
|
2817
|
+
m?.resources && Object.entries(m.resources).forEach(([C, O]) => {
|
|
2818
|
+
Object.entries(O).forEach(([U, v]) => {
|
|
2819
|
+
p.addResourceBundle(C, U, v, !0, !0);
|
|
2734
2820
|
});
|
|
2735
|
-
}), !localStorage.getItem("gentiq-admin-language") &&
|
|
2736
|
-
}, [m?.resources, p,
|
|
2821
|
+
}), !localStorage.getItem("gentiq-admin-language") && o?.language && p.language !== o.language && p.changeLanguage(o.language), A(!0);
|
|
2822
|
+
}, [m?.resources, p, o?.language]), W(() => {
|
|
2737
2823
|
const D = k.getToken();
|
|
2738
|
-
return _(!!D),
|
|
2824
|
+
return _(!!D), H(!1), document.body.classList.add("admin-theme-root"), () => {
|
|
2739
2825
|
document.body.classList.remove("admin-theme-root");
|
|
2740
2826
|
};
|
|
2741
|
-
}, []),
|
|
2827
|
+
}, []), W(() => {
|
|
2742
2828
|
T && (document.documentElement.dir = p.language === "fa" ? "rtl" : "ltr", document.documentElement.lang = p.language);
|
|
2743
2829
|
}, [T, p.language]);
|
|
2744
|
-
const
|
|
2830
|
+
const I = () => {
|
|
2745
2831
|
_(!0);
|
|
2746
2832
|
};
|
|
2747
|
-
return
|
|
2833
|
+
return w || !T ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: b("loading") }) }) : /* @__PURE__ */ e(at, { storageKey: "gentiq-admin-theme", children: N ? /* @__PURE__ */ e(Lt, { extraPages: t, disabledPages: n }) : /* @__PURE__ */ e(vt, { onLoginSuccess: I }) });
|
|
2748
2834
|
}
|
|
2749
|
-
const
|
|
2750
|
-
function
|
|
2835
|
+
const se = "gentiq_admin";
|
|
2836
|
+
function Ft(t = 0, n = 100, o = "") {
|
|
2751
2837
|
return ue({
|
|
2752
|
-
queryKey: [
|
|
2753
|
-
queryFn: () => k.listUsers(t,
|
|
2838
|
+
queryKey: [se, "users", t, n, o],
|
|
2839
|
+
queryFn: () => k.listUsers(t, n, o)
|
|
2754
2840
|
});
|
|
2755
2841
|
}
|
|
2756
|
-
function
|
|
2757
|
-
const t = _e(),
|
|
2758
|
-
t.invalidateQueries({ queryKey: [
|
|
2759
|
-
},
|
|
2842
|
+
function Ut() {
|
|
2843
|
+
const t = _e(), n = () => {
|
|
2844
|
+
t.invalidateQueries({ queryKey: [se, "users"] });
|
|
2845
|
+
}, o = re({
|
|
2760
2846
|
mutationFn: (_) => k.createUser(_.phone, _.name, _.surname, _.tokens, _.requests),
|
|
2761
|
-
onSuccess:
|
|
2762
|
-
}), m =
|
|
2763
|
-
mutationFn: ({ userId: _, data:
|
|
2764
|
-
onSuccess:
|
|
2765
|
-
}),
|
|
2847
|
+
onSuccess: n
|
|
2848
|
+
}), m = re({
|
|
2849
|
+
mutationFn: ({ userId: _, data: w }) => k.updateUser(_, w),
|
|
2850
|
+
onSuccess: n
|
|
2851
|
+
}), b = re({
|
|
2766
2852
|
mutationFn: (_) => k.deleteUser(_),
|
|
2767
|
-
onSuccess:
|
|
2768
|
-
}), p =
|
|
2769
|
-
mutationFn: ({ userId: _, tokens:
|
|
2770
|
-
onSuccess:
|
|
2771
|
-
}),
|
|
2853
|
+
onSuccess: n
|
|
2854
|
+
}), p = re({
|
|
2855
|
+
mutationFn: ({ userId: _, tokens: w, requests: H }) => k.updateUserBalance(_, w, H),
|
|
2856
|
+
onSuccess: n
|
|
2857
|
+
}), N = re({
|
|
2772
2858
|
mutationFn: (_) => k.refreshUserToken(_)
|
|
2773
2859
|
});
|
|
2774
|
-
return { createUser:
|
|
2860
|
+
return { createUser: o, updateUser: m, deleteUser: b, updateBalance: p, refreshToken: N };
|
|
2775
2861
|
}
|
|
2776
|
-
function
|
|
2862
|
+
function zt(t = 30) {
|
|
2777
2863
|
return ue({
|
|
2778
|
-
queryKey: [
|
|
2864
|
+
queryKey: [se, "analytics", t],
|
|
2779
2865
|
queryFn: () => k.getAnalytics(t)
|
|
2780
2866
|
});
|
|
2781
2867
|
}
|
|
2782
|
-
function
|
|
2868
|
+
function Jt() {
|
|
2783
2869
|
return ue({
|
|
2784
|
-
queryKey: [
|
|
2870
|
+
queryKey: [se, "admins"],
|
|
2785
2871
|
queryFn: () => k.listAdmins()
|
|
2786
2872
|
});
|
|
2787
2873
|
}
|
|
2788
|
-
function
|
|
2789
|
-
const t = _e(),
|
|
2790
|
-
t.invalidateQueries({ queryKey: [
|
|
2791
|
-
},
|
|
2874
|
+
function Pt() {
|
|
2875
|
+
const t = _e(), n = () => {
|
|
2876
|
+
t.invalidateQueries({ queryKey: [se, "admins"] });
|
|
2877
|
+
}, o = re({
|
|
2792
2878
|
mutationFn: (p) => k.register(p.username, p.password, p.name, p.permissions),
|
|
2793
|
-
onSuccess:
|
|
2794
|
-
}), m =
|
|
2795
|
-
mutationFn: ({ adminId: p, data:
|
|
2796
|
-
onSuccess:
|
|
2797
|
-
}),
|
|
2879
|
+
onSuccess: n
|
|
2880
|
+
}), m = re({
|
|
2881
|
+
mutationFn: ({ adminId: p, data: N }) => k.updateAdmin(p, N),
|
|
2882
|
+
onSuccess: n
|
|
2883
|
+
}), b = re({
|
|
2798
2884
|
mutationFn: (p) => k.deleteAdmin(p),
|
|
2799
|
-
onSuccess:
|
|
2885
|
+
onSuccess: n
|
|
2800
2886
|
});
|
|
2801
|
-
return { createAdmin:
|
|
2887
|
+
return { createAdmin: o, updateAdmin: m, deleteAdmin: b };
|
|
2802
2888
|
}
|
|
2803
|
-
function
|
|
2889
|
+
function Ht(t = 0, n = 50, o, m) {
|
|
2804
2890
|
return ue({
|
|
2805
|
-
queryKey: [
|
|
2806
|
-
queryFn: () => k.listThreads(t,
|
|
2891
|
+
queryKey: [se, "threads", t, n, o, m],
|
|
2892
|
+
queryFn: () => k.listThreads(t, n, o, m)
|
|
2807
2893
|
});
|
|
2808
2894
|
}
|
|
2809
|
-
function
|
|
2895
|
+
function Bt(t) {
|
|
2810
2896
|
return ue({
|
|
2811
|
-
queryKey: [
|
|
2897
|
+
queryKey: [se, "threadItems", t],
|
|
2812
2898
|
queryFn: () => k.getThreadItems(t),
|
|
2813
2899
|
enabled: !!t
|
|
2814
2900
|
});
|
|
2815
2901
|
}
|
|
2816
|
-
function
|
|
2902
|
+
function Vt(t = 20, n) {
|
|
2817
2903
|
return ue({
|
|
2818
|
-
queryKey: [
|
|
2819
|
-
queryFn: () => k.listJobs(t,
|
|
2904
|
+
queryKey: [se, "jobs", t, n],
|
|
2905
|
+
queryFn: () => k.listJobs(t, n),
|
|
2820
2906
|
refetchInterval: 5e3
|
|
2821
2907
|
// Auto-refresh jobs every 5 seconds
|
|
2822
2908
|
});
|
|
2823
2909
|
}
|
|
2824
|
-
function
|
|
2910
|
+
function Wt() {
|
|
2825
2911
|
const t = _e();
|
|
2826
|
-
return { cancelJob:
|
|
2912
|
+
return { cancelJob: re({
|
|
2827
2913
|
mutationFn: (m) => k.cancelJob(m),
|
|
2828
2914
|
onSuccess: () => {
|
|
2829
|
-
t.invalidateQueries({ queryKey: [
|
|
2915
|
+
t.invalidateQueries({ queryKey: [se, "jobs"] });
|
|
2830
2916
|
}
|
|
2831
2917
|
}) };
|
|
2832
2918
|
}
|
|
2833
|
-
function
|
|
2919
|
+
function Kt() {
|
|
2834
2920
|
return {
|
|
2835
|
-
login: async (t,
|
|
2921
|
+
login: async (t, n) => k.login(t, n),
|
|
2836
2922
|
logout: () => k.clearToken(),
|
|
2837
2923
|
getToken: () => k.getToken(),
|
|
2838
2924
|
isAuthenticated: !!k.getToken()
|
|
2839
2925
|
};
|
|
2840
2926
|
}
|
|
2841
2927
|
export {
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2928
|
+
Rt as AdminPanel,
|
|
2929
|
+
Jt as useAdminAdmins,
|
|
2930
|
+
Pt as useAdminAdminsMutations,
|
|
2931
|
+
zt as useAdminAnalytics,
|
|
2932
|
+
Kt as useAdminAuth,
|
|
2933
|
+
Vt as useAdminJobs,
|
|
2934
|
+
Wt as useAdminJobsMutations,
|
|
2935
|
+
Bt as useAdminThreadItems,
|
|
2936
|
+
Ht as useAdminThreads,
|
|
2937
|
+
Ft as useAdminUsers,
|
|
2938
|
+
Ut as useAdminUsersMutations
|
|
2853
2939
|
};
|