gentiq 0.7.28 → 0.7.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/{checkbox-DIJ7BlxY.js → checkbox-DllHCh8Z.js} +540 -506
- package/dist/gentiq-admin.es.js +880 -832
- package/dist/gentiq-index.es.js +762 -746
- package/dist/gentiq.css +1 -1
- package/dist/src/lib/errors.d.ts +2 -1
- package/dist/src/locales/en.json.d.ts +11 -1
- package/dist/src/locales/fa.json.d.ts +11 -1
- package/dist/src/types.d.ts +9 -0
- package/package.json +1 -1
package/dist/gentiq-admin.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as t, Fragment as Ue } from "react/jsx-runtime";
|
|
2
2
|
import { useState as b, useEffect as W, useMemo as pe, useRef as Ie } from "react";
|
|
3
3
|
import ze from "i18next";
|
|
4
|
-
import { useTranslation as ee, initReactI18next as
|
|
5
|
-
import { G as ke, a as me, m as we, v as $e, n as Se, S as ne, q as ie, r as oe, e as be, s as le, t as K, K as He, D as Be, o as Ve, p as We, E as Ge, F as Ke, H as Ze, J as Qe, a0 as Xe, B as he, L as Q, I as de, a1 as Ce, i as ve, k as ye, l as Ne, x as Ye, y as et, z as tt, A as rt, a2 as st, d as at, T as nt } from "./checkbox-
|
|
4
|
+
import { useTranslation as ee, initReactI18next as Pe, I18nextProvider as Je } from "react-i18next";
|
|
5
|
+
import { G as ke, a as me, m as we, v as $e, n as Se, S as ne, q as ie, r as oe, e as be, s as le, t as K, K as He, D as Be, o as Ve, p as We, E as Ge, F as Ke, H as Ze, J as Qe, a0 as Xe, B as he, L as Q, I as de, a1 as Ce, i as ve, k as ye, l as Ne, x as Ye, y as et, z as tt, A as rt, a2 as st, d as at, T as nt } from "./checkbox-DllHCh8Z.js";
|
|
6
6
|
import { useNavigate as it, useLocation as ot, Routes as lt, Route as ae, Navigate as Le } from "react-router-dom";
|
|
7
7
|
import { Share2 as dt, RefreshCcw as qe, Globe as xe, Keyboard as ct, Wallet as mt, Languages as ut, Plus as ht, Hash as pt, ShieldAlert as gt, Monitor as je, Moon as ft, Sun as xt, LogOut as bt } from "lucide-react";
|
|
8
8
|
import { toast as Te } from "sonner";
|
|
@@ -14,8 +14,8 @@ class vt {
|
|
|
14
14
|
constructor() {
|
|
15
15
|
this.token = localStorage.getItem("admin_token");
|
|
16
16
|
}
|
|
17
|
-
setToken(
|
|
18
|
-
this.token =
|
|
17
|
+
setToken(i) {
|
|
18
|
+
this.token = i, localStorage.setItem("admin_token", i);
|
|
19
19
|
}
|
|
20
20
|
clearToken() {
|
|
21
21
|
this.token = null, localStorage.removeItem("admin_token"), localStorage.removeItem("admin_info");
|
|
@@ -23,10 +23,10 @@ class vt {
|
|
|
23
23
|
getToken() {
|
|
24
24
|
return this.token;
|
|
25
25
|
}
|
|
26
|
-
async request(
|
|
26
|
+
async request(i, o = {}) {
|
|
27
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 x = await fetch(`${Me}${
|
|
29
|
+
const x = await fetch(`${Me}${i}`, {
|
|
30
30
|
...o,
|
|
31
31
|
headers: m
|
|
32
32
|
});
|
|
@@ -45,10 +45,10 @@ class vt {
|
|
|
45
45
|
}
|
|
46
46
|
return x.json();
|
|
47
47
|
}
|
|
48
|
-
async login(
|
|
48
|
+
async login(i, o) {
|
|
49
49
|
const m = await this.request("/admin/login", {
|
|
50
50
|
method: "POST",
|
|
51
|
-
body: JSON.stringify({ username:
|
|
51
|
+
body: JSON.stringify({ username: i, password: o })
|
|
52
52
|
});
|
|
53
53
|
this.setToken(m.token);
|
|
54
54
|
const x = {
|
|
@@ -62,46 +62,46 @@ class vt {
|
|
|
62
62
|
async checkSetupStatus() {
|
|
63
63
|
return this.request("/admin/setup-status");
|
|
64
64
|
}
|
|
65
|
-
async register(
|
|
65
|
+
async register(i, o, m, x) {
|
|
66
66
|
return this.request("/admin/admins", {
|
|
67
67
|
method: "POST",
|
|
68
|
-
body: JSON.stringify({ username:
|
|
68
|
+
body: JSON.stringify({ username: i, password: o, name: m, permissions: x })
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
async listAdmins() {
|
|
72
72
|
return this.request("/admin/admins");
|
|
73
73
|
}
|
|
74
|
-
async updateAdmin(
|
|
75
|
-
return this.request(`/admin/admins/${
|
|
74
|
+
async updateAdmin(i, o) {
|
|
75
|
+
return this.request(`/admin/admins/${i}`, {
|
|
76
76
|
method: "PATCH",
|
|
77
77
|
body: JSON.stringify(o)
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
|
-
async deleteAdmin(
|
|
81
|
-
return this.request(`/admin/admins/${
|
|
80
|
+
async deleteAdmin(i) {
|
|
81
|
+
return this.request(`/admin/admins/${i}`, {
|
|
82
82
|
method: "DELETE"
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
async listPermissions() {
|
|
86
86
|
return this.request("/admin/permissions");
|
|
87
87
|
}
|
|
88
|
-
async listThreads(
|
|
89
|
-
const u = new URLSearchParams({ skip:
|
|
88
|
+
async listThreads(i = 0, o = 50, m, x) {
|
|
89
|
+
const u = new URLSearchParams({ skip: i.toString(), limit: o.toString() });
|
|
90
90
|
return m && u.append("query", m), x && u.append("feedback", x), this.request(`/admin/chat-history/threads?${u}`);
|
|
91
91
|
}
|
|
92
|
-
async getThreadItems(
|
|
93
|
-
return this.request(`/admin/chat-history/threads/${
|
|
92
|
+
async getThreadItems(i) {
|
|
93
|
+
return this.request(`/admin/chat-history/threads/${i}/items`);
|
|
94
94
|
}
|
|
95
|
-
async shareThread(
|
|
96
|
-
return this.request(`/admin/chat-history/threads/${
|
|
95
|
+
async shareThread(i) {
|
|
96
|
+
return this.request(`/admin/chat-history/threads/${i}/share`, {
|
|
97
97
|
method: "POST"
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
-
async listUsers(
|
|
101
|
-
const x = new URLSearchParams({ skip:
|
|
100
|
+
async listUsers(i = 0, o = 100, m = "") {
|
|
101
|
+
const x = new URLSearchParams({ skip: i.toString(), limit: o.toString() });
|
|
102
102
|
return m && x.append("query", m), this.request(`/admin/users?${x.toString()}`);
|
|
103
103
|
}
|
|
104
|
-
async createUser(
|
|
104
|
+
async createUser(i, o, m, x, u, v, _, N) {
|
|
105
105
|
const H = x !== void 0 || u !== void 0 || v !== void 0 || _ !== void 0 ? {
|
|
106
106
|
tokens: x || 0,
|
|
107
107
|
requests: u || 0,
|
|
@@ -110,50 +110,50 @@ class vt {
|
|
|
110
110
|
} : void 0;
|
|
111
111
|
return this.request("/admin/users", {
|
|
112
112
|
method: "POST",
|
|
113
|
-
body: JSON.stringify({ phone:
|
|
113
|
+
body: JSON.stringify({ phone: i, name: o, surname: m, balance: H, metadata: N })
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
async updateUser(
|
|
117
|
-
return this.request(`/admin/users/${
|
|
116
|
+
async updateUser(i, o) {
|
|
117
|
+
return this.request(`/admin/users/${i}`, {
|
|
118
118
|
method: "PATCH",
|
|
119
119
|
body: JSON.stringify(o)
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
-
async deleteUser(
|
|
123
|
-
return this.request(`/admin/users/${
|
|
122
|
+
async deleteUser(i) {
|
|
123
|
+
return this.request(`/admin/users/${i}`, {
|
|
124
124
|
method: "DELETE"
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
async updateUserBalance(
|
|
128
|
-
return this.request(`/admin/users/${
|
|
127
|
+
async updateUserBalance(i, o, m, x, u) {
|
|
128
|
+
return this.request(`/admin/users/${i}/balance`, {
|
|
129
129
|
method: "POST",
|
|
130
130
|
body: JSON.stringify({ tokens: o, requests: m, token_limit: x, request_limit: u })
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
|
-
async refreshUserToken(
|
|
134
|
-
return this.request(`/admin/users/${
|
|
133
|
+
async refreshUserToken(i) {
|
|
134
|
+
return this.request(`/admin/users/${i}/refresh-token`, {
|
|
135
135
|
method: "POST"
|
|
136
136
|
});
|
|
137
137
|
}
|
|
138
|
-
async getAnalytics(
|
|
139
|
-
return this.request(`/admin/analytics?days=${
|
|
138
|
+
async getAnalytics(i = 30) {
|
|
139
|
+
return this.request(`/admin/analytics?days=${i}`);
|
|
140
140
|
}
|
|
141
|
-
async listJobs(
|
|
142
|
-
const m = new URLSearchParams({ limit:
|
|
141
|
+
async listJobs(i = 20, o) {
|
|
142
|
+
const m = new URLSearchParams({ limit: i.toString() });
|
|
143
143
|
return o && m.append("type", o), this.request(`/admin/jobs?${m}`);
|
|
144
144
|
}
|
|
145
|
-
async cancelJob(
|
|
146
|
-
return this.request(`/admin/jobs/${
|
|
145
|
+
async cancelJob(i) {
|
|
146
|
+
return this.request(`/admin/jobs/${i}/cancel`, {
|
|
147
147
|
method: "POST"
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
async getSettings() {
|
|
151
151
|
return this.request("/admin/settings");
|
|
152
152
|
}
|
|
153
|
-
async updateSettings(
|
|
153
|
+
async updateSettings(i) {
|
|
154
154
|
return this.request("/admin/settings", {
|
|
155
155
|
method: "PATCH",
|
|
156
|
-
body: JSON.stringify(
|
|
156
|
+
body: JSON.stringify(i)
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
159
|
async resetSettings() {
|
|
@@ -161,10 +161,10 @@ class vt {
|
|
|
161
161
|
method: "DELETE"
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
|
-
async getAttachmentBlob(
|
|
164
|
+
async getAttachmentBlob(i) {
|
|
165
165
|
const o = {};
|
|
166
166
|
this.token && (o.Authorization = `Bearer ${this.token}`);
|
|
167
|
-
const m = await fetch(`${Me}/admin/chat-history/attachments/${
|
|
167
|
+
const m = await fetch(`${Me}/admin/chat-history/attachments/${i}`, {
|
|
168
168
|
method: "GET",
|
|
169
169
|
headers: o
|
|
170
170
|
});
|
|
@@ -176,8 +176,8 @@ class vt {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
const k = new vt();
|
|
179
|
-
function yt({ onLoginSuccess:
|
|
180
|
-
const { t:
|
|
179
|
+
function yt({ onLoginSuccess: r }) {
|
|
180
|
+
const { t: i, i18n: o } = ee(["admin", "translation"]), { app: m } = me(), { theme: x } = we(), [u, v] = b(""), [_, N] = b(""), [H, T] = b(""), [A, I] = b(""), [D, C] = b(!1), [O, U] = b(null), [y, z] = b("light");
|
|
181
181
|
W(() => {
|
|
182
182
|
if (x === "system") {
|
|
183
183
|
const h = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
@@ -192,19 +192,19 @@ function yt({ onLoginSuccess: t }) {
|
|
|
192
192
|
const Z = async (h) => {
|
|
193
193
|
h.preventDefault(), I(""), C(!0);
|
|
194
194
|
try {
|
|
195
|
-
await k.login(u, _),
|
|
196
|
-
} catch (
|
|
197
|
-
I(
|
|
195
|
+
await k.login(u, _), r();
|
|
196
|
+
} catch (P) {
|
|
197
|
+
I(P instanceof Error ? P.message : i("login.error"));
|
|
198
198
|
} finally {
|
|
199
199
|
C(!1);
|
|
200
200
|
}
|
|
201
201
|
}, B = async (h) => {
|
|
202
202
|
if (h.preventDefault(), I(""), _ !== H) {
|
|
203
|
-
I(
|
|
203
|
+
I(i("login.passwords_mismatch"));
|
|
204
204
|
return;
|
|
205
205
|
}
|
|
206
206
|
if (_.length < 4) {
|
|
207
|
-
I(
|
|
207
|
+
I(i("login.password_too_short"));
|
|
208
208
|
return;
|
|
209
209
|
}
|
|
210
210
|
C(!0);
|
|
@@ -214,30 +214,30 @@ function yt({ onLoginSuccess: t }) {
|
|
|
214
214
|
_,
|
|
215
215
|
"Admin",
|
|
216
216
|
["chat_history", "admin_management", "user_management", "analytics"]
|
|
217
|
-
), await k.login("admin", _),
|
|
218
|
-
} catch (
|
|
219
|
-
I(
|
|
217
|
+
), await k.login("admin", _), r();
|
|
218
|
+
} catch (P) {
|
|
219
|
+
I(P instanceof Error ? P.message : i("login.error"));
|
|
220
220
|
} finally {
|
|
221
221
|
C(!1);
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
-
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__ */
|
|
224
|
+
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__ */ t("div", { className: "min-h-screen bg-background flex items-center justify-center p-4 relative overflow-hidden", dir: V ? "rtl" : "ltr", children: [
|
|
225
225
|
/* @__PURE__ */ e("div", { className: "absolute top-[-10%] right-[-10%] w-[50%] h-[50%] bg-primary/10 rounded-full blur-3xl animate-pulse" }),
|
|
226
226
|
/* @__PURE__ */ e("div", { className: "absolute bottom-[-10%] left-[-10%] w-[40%] h-[40%] bg-primary/5 dark:bg-primary/10 rounded-full blur-3xl" }),
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
-
/* @__PURE__ */
|
|
229
|
-
/* @__PURE__ */
|
|
230
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ t("div", { className: "w-full max-w-md z-10", children: [
|
|
228
|
+
/* @__PURE__ */ t("div", { className: "glass rounded-3xl p-10 shadow-2xl", children: [
|
|
229
|
+
/* @__PURE__ */ t("div", { className: "text-center mb-10", children: [
|
|
230
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-4 mb-6", children: [
|
|
231
231
|
/* @__PURE__ */ e("img", { src: R, alt: E, className: "size-16 object-contain" }),
|
|
232
|
-
/* @__PURE__ */ e("h1", { className: "text-3xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: O ?
|
|
232
|
+
/* @__PURE__ */ e("h1", { className: "text-3xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: O ? i("login.setup_title") : E })
|
|
233
233
|
] }),
|
|
234
|
-
O && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-3", children:
|
|
234
|
+
O && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-3", children: i("login.setup_description") })
|
|
235
235
|
] }),
|
|
236
236
|
O ? (
|
|
237
237
|
/* ---- SETUP FORM ---- */
|
|
238
|
-
/* @__PURE__ */
|
|
239
|
-
/* @__PURE__ */
|
|
240
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
238
|
+
/* @__PURE__ */ t("form", { onSubmit: B, className: "space-y-7", children: [
|
|
239
|
+
/* @__PURE__ */ t("div", { children: [
|
|
240
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: i("login.username") }),
|
|
241
241
|
/* @__PURE__ */ e(
|
|
242
242
|
"input",
|
|
243
243
|
{
|
|
@@ -248,8 +248,8 @@ function yt({ onLoginSuccess: t }) {
|
|
|
248
248
|
}
|
|
249
249
|
)
|
|
250
250
|
] }),
|
|
251
|
-
/* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */ e("label", { htmlFor: "setup-password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
251
|
+
/* @__PURE__ */ t("div", { children: [
|
|
252
|
+
/* @__PURE__ */ e("label", { htmlFor: "setup-password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: i("login.set_password") }),
|
|
253
253
|
/* @__PURE__ */ e(
|
|
254
254
|
"input",
|
|
255
255
|
{
|
|
@@ -259,13 +259,13 @@ function yt({ onLoginSuccess: t }) {
|
|
|
259
259
|
onChange: (h) => N(h.target.value),
|
|
260
260
|
required: !0,
|
|
261
261
|
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",
|
|
262
|
-
placeholder:
|
|
262
|
+
placeholder: i("login.set_password_placeholder"),
|
|
263
263
|
dir: "ltr"
|
|
264
264
|
}
|
|
265
265
|
)
|
|
266
266
|
] }),
|
|
267
|
-
/* @__PURE__ */
|
|
268
|
-
/* @__PURE__ */ e("label", { htmlFor: "setup-confirm", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
267
|
+
/* @__PURE__ */ t("div", { children: [
|
|
268
|
+
/* @__PURE__ */ e("label", { htmlFor: "setup-confirm", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: i("login.confirm_password") }),
|
|
269
269
|
/* @__PURE__ */ e(
|
|
270
270
|
"input",
|
|
271
271
|
{
|
|
@@ -275,7 +275,7 @@ function yt({ onLoginSuccess: t }) {
|
|
|
275
275
|
onChange: (h) => T(h.target.value),
|
|
276
276
|
required: !0,
|
|
277
277
|
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",
|
|
278
|
-
placeholder:
|
|
278
|
+
placeholder: i("login.confirm_password_placeholder"),
|
|
279
279
|
dir: "ltr"
|
|
280
280
|
}
|
|
281
281
|
)
|
|
@@ -287,18 +287,18 @@ function yt({ onLoginSuccess: t }) {
|
|
|
287
287
|
type: "submit",
|
|
288
288
|
disabled: D,
|
|
289
289
|
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]",
|
|
290
|
-
children: D ? /* @__PURE__ */
|
|
290
|
+
children: D ? /* @__PURE__ */ t("div", { className: "flex items-center justify-center gap-2", children: [
|
|
291
291
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin" }),
|
|
292
|
-
/* @__PURE__ */ e("span", { children:
|
|
293
|
-
] }) :
|
|
292
|
+
/* @__PURE__ */ e("span", { children: i("login.setting_up") })
|
|
293
|
+
] }) : i("login.create_admin")
|
|
294
294
|
}
|
|
295
295
|
)
|
|
296
296
|
] })
|
|
297
297
|
) : (
|
|
298
298
|
/* ---- LOGIN FORM ---- */
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
301
|
-
/* @__PURE__ */ e("label", { htmlFor: "username", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
299
|
+
/* @__PURE__ */ t("form", { onSubmit: Z, className: "space-y-7", children: [
|
|
300
|
+
/* @__PURE__ */ t("div", { children: [
|
|
301
|
+
/* @__PURE__ */ e("label", { htmlFor: "username", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: i("login.username") }),
|
|
302
302
|
/* @__PURE__ */ e(
|
|
303
303
|
"input",
|
|
304
304
|
{
|
|
@@ -308,13 +308,13 @@ function yt({ onLoginSuccess: t }) {
|
|
|
308
308
|
onChange: (h) => v(h.target.value),
|
|
309
309
|
required: !0,
|
|
310
310
|
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",
|
|
311
|
-
placeholder:
|
|
311
|
+
placeholder: i("login.username_placeholder"),
|
|
312
312
|
dir: "ltr"
|
|
313
313
|
}
|
|
314
314
|
)
|
|
315
315
|
] }),
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
/* @__PURE__ */ e("label", { htmlFor: "password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
316
|
+
/* @__PURE__ */ t("div", { children: [
|
|
317
|
+
/* @__PURE__ */ e("label", { htmlFor: "password", className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children: i("login.password") }),
|
|
318
318
|
/* @__PURE__ */ e(
|
|
319
319
|
"input",
|
|
320
320
|
{
|
|
@@ -324,7 +324,7 @@ function yt({ onLoginSuccess: t }) {
|
|
|
324
324
|
onChange: (h) => N(h.target.value),
|
|
325
325
|
required: !0,
|
|
326
326
|
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",
|
|
327
|
-
placeholder:
|
|
327
|
+
placeholder: i("login.password_placeholder"),
|
|
328
328
|
dir: "ltr"
|
|
329
329
|
}
|
|
330
330
|
)
|
|
@@ -336,21 +336,21 @@ function yt({ onLoginSuccess: t }) {
|
|
|
336
336
|
type: "submit",
|
|
337
337
|
disabled: D,
|
|
338
338
|
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]",
|
|
339
|
-
children: D ? /* @__PURE__ */
|
|
339
|
+
children: D ? /* @__PURE__ */ t("div", { className: "flex items-center justify-center gap-2", children: [
|
|
340
340
|
/* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-current border-t-transparent rounded-full animate-spin" }),
|
|
341
|
-
/* @__PURE__ */ e("span", { children:
|
|
342
|
-
] }) :
|
|
341
|
+
/* @__PURE__ */ e("span", { children: i("login.logging_in") })
|
|
342
|
+
] }) : i("login.submit")
|
|
343
343
|
}
|
|
344
344
|
)
|
|
345
345
|
] })
|
|
346
346
|
)
|
|
347
347
|
] }),
|
|
348
|
-
/* @__PURE__ */ e("div", { className: "mt-10 text-center text-[10px] text-muted-foreground uppercase tracking-widest font-bold", children: /* @__PURE__ */ e("p", { children:
|
|
348
|
+
/* @__PURE__ */ e("div", { className: "mt-10 text-center text-[10px] text-muted-foreground uppercase tracking-widest font-bold", children: /* @__PURE__ */ e("p", { children: i("login.copyright") }) })
|
|
349
349
|
] })
|
|
350
350
|
] });
|
|
351
351
|
}
|
|
352
352
|
function Nt() {
|
|
353
|
-
const { t, i18n:
|
|
353
|
+
const { t: r, i18n: i } = ee(["admin", "translation"]), { app: o } = me(), m = o?.userMetadataFields || [], [x, u] = b([]), [v, _] = b(null), [N, H] = b([]), [T, A] = b(!1), [I, D] = b(!1), [C, O] = b(""), [U, y] = b(""), [z, R] = b(""), [E, V] = b(0), [Z, B] = b(!0), h = i.language === "fa", P = h ? "fa-IR" : "en-US", d = async (s = !1) => {
|
|
354
354
|
s ? D(!0) : (A(!0), V(0)), O("");
|
|
355
355
|
try {
|
|
356
356
|
const f = s ? E + 50 : 0, q = await k.listThreads(
|
|
@@ -359,9 +359,9 @@ function Nt() {
|
|
|
359
359
|
U || void 0,
|
|
360
360
|
z || void 0
|
|
361
361
|
);
|
|
362
|
-
s ? (u((
|
|
362
|
+
s ? (u((n) => [...n, ...q.threads]), V(f)) : (u(q.threads), V(0)), B(q.threads.length === 50);
|
|
363
363
|
} catch (f) {
|
|
364
|
-
O(f instanceof Error ? f.message :
|
|
364
|
+
O(f instanceof Error ? f.message : r("error_loading"));
|
|
365
365
|
} finally {
|
|
366
366
|
A(!1), D(!1);
|
|
367
367
|
}
|
|
@@ -371,19 +371,19 @@ function Nt() {
|
|
|
371
371
|
const f = await k.getThreadItems(s.id);
|
|
372
372
|
H(f.items);
|
|
373
373
|
} catch (f) {
|
|
374
|
-
O(f instanceof Error ? f.message :
|
|
374
|
+
O(f instanceof Error ? f.message : r("error_loading"));
|
|
375
375
|
} finally {
|
|
376
376
|
A(!1);
|
|
377
377
|
}
|
|
378
378
|
}, l = async (s, f) => {
|
|
379
379
|
s.stopPropagation();
|
|
380
380
|
try {
|
|
381
|
-
const q = await k.shareThread(f.id),
|
|
382
|
-
navigator.clipboard.writeText(
|
|
383
|
-
description:
|
|
381
|
+
const q = await k.shareThread(f.id), n = `${window.location.origin}${q.url}`;
|
|
382
|
+
navigator.clipboard.writeText(n), Te.success(r("sidebar.share_success"), {
|
|
383
|
+
description: r("sidebar.share_description")
|
|
384
384
|
});
|
|
385
385
|
} catch {
|
|
386
|
-
Te.error(
|
|
386
|
+
Te.error(r("sidebar.share_failed"));
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
389
|
W(() => {
|
|
@@ -392,7 +392,7 @@ function Nt() {
|
|
|
392
392
|
}, 500);
|
|
393
393
|
return () => clearTimeout(s);
|
|
394
394
|
}, [U, z]);
|
|
395
|
-
const
|
|
395
|
+
const p = (s) => {
|
|
396
396
|
const f = new Date(s);
|
|
397
397
|
return new Intl.DateTimeFormat(h ? "fa-IR" : "en-US", {
|
|
398
398
|
year: "numeric",
|
|
@@ -409,16 +409,16 @@ function Nt() {
|
|
|
409
409
|
return s;
|
|
410
410
|
}
|
|
411
411
|
return JSON.stringify(s, null, 2);
|
|
412
|
-
},
|
|
413
|
-
const [q,
|
|
414
|
-
return /* @__PURE__ */
|
|
415
|
-
/* @__PURE__ */
|
|
412
|
+
}, J = ({ part: s, idx: f }) => {
|
|
413
|
+
const [q, n] = b(!1), w = s.tool_name || (s.type && s.type.startsWith("tool-") ? s.type.slice(5) : "tool");
|
|
414
|
+
return /* @__PURE__ */ t("div", { dir: "ltr", className: "my-2 border border-border/50 rounded-xl overflow-hidden bg-muted/20 text-left", children: [
|
|
415
|
+
/* @__PURE__ */ t(
|
|
416
416
|
"div",
|
|
417
417
|
{
|
|
418
|
-
onClick: () =>
|
|
418
|
+
onClick: () => n(!q),
|
|
419
419
|
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",
|
|
420
420
|
children: [
|
|
421
|
-
/* @__PURE__ */
|
|
421
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
422
422
|
/* @__PURE__ */ e(
|
|
423
423
|
"svg",
|
|
424
424
|
{
|
|
@@ -432,58 +432,58 @@ function Nt() {
|
|
|
432
432
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold uppercase tracking-widest text-muted-foreground", children: "Tool" }),
|
|
433
433
|
/* @__PURE__ */ e("span", { className: "text-xs font-semibold", children: w })
|
|
434
434
|
] }),
|
|
435
|
-
/* @__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" ?
|
|
435
|
+
/* @__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" ? r("chat_history.output_available") : r("chat_history.running") })
|
|
436
436
|
]
|
|
437
437
|
}
|
|
438
438
|
),
|
|
439
|
-
q && /* @__PURE__ */
|
|
440
|
-
/* @__PURE__ */
|
|
439
|
+
q && /* @__PURE__ */ t("div", { className: "p-2.5 space-y-2.5 animate-in fade-in slide-in-from-top-1 duration-200", children: [
|
|
440
|
+
/* @__PURE__ */ t("div", { children: [
|
|
441
441
|
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: "Input" }),
|
|
442
442
|
/* @__PURE__ */ e("pre", { className: "text-xs bg-black/5 dark:bg-black/20 p-2 rounded-lg overflow-x-auto", children: L(s.input) })
|
|
443
443
|
] }),
|
|
444
|
-
(s.output || s.error_text || s.errorText) && /* @__PURE__ */
|
|
444
|
+
(s.output || s.error_text || s.errorText) && /* @__PURE__ */ t("div", { children: [
|
|
445
445
|
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: s.error_text || s.errorText ? "Error" : "Output" }),
|
|
446
446
|
/* @__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) })
|
|
447
447
|
] })
|
|
448
448
|
] })
|
|
449
449
|
] }, f);
|
|
450
|
-
},
|
|
450
|
+
}, g = async (s, f) => {
|
|
451
451
|
try {
|
|
452
|
-
const q = await k.getAttachmentBlob(s),
|
|
453
|
-
w.href =
|
|
452
|
+
const q = await k.getAttachmentBlob(s), n = window.URL.createObjectURL(q), w = document.createElement("a");
|
|
453
|
+
w.href = n, w.download = f || s.split("/").pop() || "download", document.body.appendChild(w), w.click(), window.URL.revokeObjectURL(n), document.body.removeChild(w);
|
|
454
454
|
} catch (q) {
|
|
455
455
|
console.error("Download failed:", q), O(q instanceof Error ? q.message : "Download failed");
|
|
456
456
|
}
|
|
457
|
-
}, 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__ */
|
|
457
|
+
}, 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__ */ t("div", { className: "my-2 p-2.5 bg-muted/40 rounded-lg border border-border text-xs italic text-muted-foreground", dir: "auto", children: [
|
|
458
458
|
/* @__PURE__ */ e("div", { className: "font-bold mb-1 uppercase tracking-tighter opacity-70", children: "Reasoning" }),
|
|
459
459
|
s.text
|
|
460
|
-
] }, f) : s.type === "dynamic-tool" || s.type && s.type.startsWith("tool-") || s.tool_call_id ? /* @__PURE__ */ e(
|
|
461
|
-
/* @__PURE__ */
|
|
460
|
+
] }, f) : s.type === "dynamic-tool" || s.type && s.type.startsWith("tool-") || s.tool_call_id ? /* @__PURE__ */ e(J, { part: s, idx: f }, f) : s.type === "file" ? /* @__PURE__ */ t("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: [
|
|
461
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
462
462
|
/* @__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: "📎" }) }),
|
|
463
|
-
/* @__PURE__ */
|
|
464
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-foreground font-medium truncate", title: s.filename || "File", children: s.filename ||
|
|
463
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col min-w-0", children: [
|
|
464
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-foreground font-medium truncate", title: s.filename || "File", children: s.filename || r("chat_history.unnamed_file") }),
|
|
465
465
|
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground uppercase tracking-wider font-bold", children: s.media_type || s.mime_type || s.mediaType || "file" })
|
|
466
466
|
] })
|
|
467
467
|
] }),
|
|
468
468
|
s.object_name && /* @__PURE__ */ e(
|
|
469
469
|
"button",
|
|
470
470
|
{
|
|
471
|
-
onClick: () =>
|
|
471
|
+
onClick: () => g(s.object_name, s.filename),
|
|
472
472
|
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",
|
|
473
|
-
title:
|
|
473
|
+
title: r("chat_history.download_file", "Download File"),
|
|
474
474
|
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" }) })
|
|
475
475
|
}
|
|
476
476
|
)
|
|
477
477
|
] }, 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) => {
|
|
478
|
-
const { scrollTop: f, scrollHeight: q, clientHeight:
|
|
479
|
-
q - f <=
|
|
478
|
+
const { scrollTop: f, scrollHeight: q, clientHeight: n } = s.currentTarget;
|
|
479
|
+
q - f <= n + 50 && !I && Z && d(!0);
|
|
480
480
|
};
|
|
481
|
-
return /* @__PURE__ */
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
/* @__PURE__ */
|
|
484
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children:
|
|
485
|
-
/* @__PURE__ */
|
|
486
|
-
/* @__PURE__ */
|
|
481
|
+
return /* @__PURE__ */ t("div", { className: "p-5 h-full flex flex-col gap-4 overflow-hidden", dir: h ? "rtl" : "ltr", children: [
|
|
482
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col gap-3", children: [
|
|
483
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-4", children: [
|
|
484
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: r("chat_history.title") }),
|
|
485
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row gap-3 flex-1 max-w-3xl justify-end", children: [
|
|
486
|
+
/* @__PURE__ */ t(
|
|
487
487
|
"form",
|
|
488
488
|
{
|
|
489
489
|
onSubmit: (s) => {
|
|
@@ -497,7 +497,7 @@ function Nt() {
|
|
|
497
497
|
type: "text",
|
|
498
498
|
value: U,
|
|
499
499
|
onChange: (s) => y(s.target.value),
|
|
500
|
-
placeholder:
|
|
500
|
+
placeholder: r("chat_history.search_placeholder"),
|
|
501
501
|
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"
|
|
502
502
|
}
|
|
503
503
|
),
|
|
@@ -506,23 +506,23 @@ function Nt() {
|
|
|
506
506
|
{
|
|
507
507
|
type: "submit",
|
|
508
508
|
className: "px-5 py-2.5 bg-primary text-primary-foreground rounded-xl hover:opacity-90 transition-all font-semibold text-sm shadow-sm hover:shadow-md",
|
|
509
|
-
children:
|
|
509
|
+
children: r("chat_history.search_button")
|
|
510
510
|
}
|
|
511
511
|
)
|
|
512
512
|
]
|
|
513
513
|
}
|
|
514
514
|
),
|
|
515
|
-
/* @__PURE__ */
|
|
515
|
+
/* @__PURE__ */ t(
|
|
516
516
|
"select",
|
|
517
517
|
{
|
|
518
518
|
value: z,
|
|
519
519
|
onChange: (s) => R(s.target.value),
|
|
520
520
|
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]",
|
|
521
521
|
children: [
|
|
522
|
-
/* @__PURE__ */ e("option", { value: "", children:
|
|
523
|
-
/* @__PURE__ */ e("option", { value: "liked", children:
|
|
524
|
-
/* @__PURE__ */ e("option", { value: "disliked", children:
|
|
525
|
-
/* @__PURE__ */ e("option", { value: "any", children:
|
|
522
|
+
/* @__PURE__ */ e("option", { value: "", children: r("chat_history.all_feedbacks", "All Feedbacks") }),
|
|
523
|
+
/* @__PURE__ */ e("option", { value: "liked", children: r("chat_history.liked_feedbacks", "Liked 👍") }),
|
|
524
|
+
/* @__PURE__ */ e("option", { value: "disliked", children: r("chat_history.disliked_feedbacks", "Disliked 👎") }),
|
|
525
|
+
/* @__PURE__ */ e("option", { value: "any", children: r("chat_history.any_feedback", "With Feedback") })
|
|
526
526
|
]
|
|
527
527
|
}
|
|
528
528
|
)
|
|
@@ -530,12 +530,12 @@ function Nt() {
|
|
|
530
530
|
] }),
|
|
531
531
|
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 })
|
|
532
532
|
] }),
|
|
533
|
-
/* @__PURE__ */
|
|
534
|
-
/* @__PURE__ */
|
|
535
|
-
/* @__PURE__ */ e("div", { className: "px-5 py-2.5 border-b border-border/30", children: /* @__PURE__ */
|
|
536
|
-
|
|
533
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-1 lg:grid-cols-[380px_1fr] gap-4 flex-1 min-h-0", children: [
|
|
534
|
+
/* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col min-w-0", children: [
|
|
535
|
+
/* @__PURE__ */ e("div", { className: "px-5 py-2.5 border-b border-border/30", children: /* @__PURE__ */ t("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide", children: [
|
|
536
|
+
r("chat_history.threads_list"),
|
|
537
537
|
" (",
|
|
538
|
-
(x.length || 0).toLocaleString(
|
|
538
|
+
(x.length || 0).toLocaleString(P),
|
|
539
539
|
")"
|
|
540
540
|
] }) }),
|
|
541
541
|
/* @__PURE__ */ e(
|
|
@@ -543,70 +543,70 @@ function Nt() {
|
|
|
543
543
|
{
|
|
544
544
|
className: "flex-1 overflow-y-auto p-2 custom-scrollbar",
|
|
545
545
|
onScroll: M,
|
|
546
|
-
children: T && x.length === 0 ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-muted-foreground text-sm", children:
|
|
547
|
-
x.map((s) => /* @__PURE__ */
|
|
546
|
+
children: T && x.length === 0 ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-muted-foreground text-sm", children: r("chat_history.no_threads") }) : /* @__PURE__ */ t("div", { className: "space-y-1", children: [
|
|
547
|
+
x.map((s) => /* @__PURE__ */ t(
|
|
548
548
|
"div",
|
|
549
549
|
{
|
|
550
550
|
onClick: () => c(s),
|
|
551
551
|
className: `p-2.5 cursor-pointer transition-all rounded-xl border ${v?.id === s.id ? "bg-card border-border shadow-sm" : "border-transparent hover:bg-muted/50"}`,
|
|
552
552
|
children: [
|
|
553
|
-
/* @__PURE__ */
|
|
553
|
+
/* @__PURE__ */ t("div", { className: "flex justify-between items-start mb-1.5 gap-4", children: [
|
|
554
554
|
/* @__PURE__ */ e(
|
|
555
555
|
"h3",
|
|
556
556
|
{
|
|
557
557
|
className: `font-medium text-sm truncate flex-1 ${v?.id === s.id ? "text-primary" : "text-foreground"}`,
|
|
558
|
-
title: s.title ||
|
|
559
|
-
children: s.title ||
|
|
558
|
+
title: s.title || r("chat_history.no_thread_title"),
|
|
559
|
+
children: s.title || r("chat_history.no_thread_title")
|
|
560
560
|
}
|
|
561
561
|
),
|
|
562
|
-
/* @__PURE__ */
|
|
562
|
+
/* @__PURE__ */ t("div", { className: "flex gap-1", children: [
|
|
563
563
|
s.feedback_info && s.feedback_info.like > 0 && /* @__PURE__ */ e("span", { className: "text-xs", children: "👍" }),
|
|
564
564
|
s.feedback_info && s.feedback_info.dislike > 0 && /* @__PURE__ */ e("span", { className: "text-xs", children: "👎" })
|
|
565
565
|
] })
|
|
566
566
|
] }),
|
|
567
|
-
/* @__PURE__ */
|
|
568
|
-
s.user_info && /* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ t("div", { className: "text-xs space-y-1.5 text-muted-foreground", children: [
|
|
568
|
+
s.user_info && /* @__PURE__ */ t(
|
|
569
569
|
"div",
|
|
570
570
|
{
|
|
571
571
|
className: "flex flex-col gap-0.5 min-w-0",
|
|
572
572
|
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) => {
|
|
573
573
|
const q = s.user_info?.metadata?.[f.key];
|
|
574
574
|
if (f.type === "select") {
|
|
575
|
-
const
|
|
576
|
-
return ` • ${
|
|
575
|
+
const n = f.options?.find((w) => String(w.value) === String(q));
|
|
576
|
+
return ` • ${n ? r(n.label) : q}`;
|
|
577
577
|
}
|
|
578
578
|
return ` • ${q}`;
|
|
579
579
|
}).join("")}${s.user_info.metadata?.values !== void 0 && !m.some((f) => f.key === "values") ? ` • ${s.user_info.metadata.values}` : ""}`,
|
|
580
580
|
children: [
|
|
581
|
-
/* @__PURE__ */
|
|
582
|
-
/* @__PURE__ */
|
|
581
|
+
/* @__PURE__ */ t("div", { className: "font-medium text-foreground truncate flex items-center gap-1.5", children: [
|
|
582
|
+
/* @__PURE__ */ t("span", { children: [
|
|
583
583
|
s.user_info.name,
|
|
584
584
|
" ",
|
|
585
585
|
s.user_info.surname
|
|
586
586
|
] }),
|
|
587
|
-
s.user_info.phone && /* @__PURE__ */
|
|
587
|
+
s.user_info.phone && /* @__PURE__ */ t("span", { className: "text-[11px] text-foreground/70 font-normal", children: [
|
|
588
588
|
"•",
|
|
589
589
|
" ",
|
|
590
590
|
s.user_info.phone
|
|
591
591
|
] })
|
|
592
592
|
] }),
|
|
593
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ t("div", { className: "text-[10px] text-muted-foreground/70 truncate flex items-center gap-1", children: [
|
|
594
594
|
m.filter((f) => {
|
|
595
595
|
const q = s.user_info?.metadata?.[f.key];
|
|
596
596
|
return q != null && q !== "";
|
|
597
597
|
}).map((f, q) => {
|
|
598
|
-
const
|
|
599
|
-
let w = String(
|
|
598
|
+
const n = s.user_info?.metadata?.[f.key];
|
|
599
|
+
let w = String(n);
|
|
600
600
|
if (f.type === "select") {
|
|
601
|
-
const F = f.options?.find((
|
|
602
|
-
F && (w =
|
|
603
|
-
} else f.type === "checkbox" && (w =
|
|
604
|
-
return /* @__PURE__ */
|
|
601
|
+
const F = f.options?.find((Y) => String(Y.value) === String(n));
|
|
602
|
+
F && (w = r(F.label));
|
|
603
|
+
} else f.type === "checkbox" && (w = n ? "✓" : "✗");
|
|
604
|
+
return /* @__PURE__ */ t("span", { className: "flex items-center gap-1", children: [
|
|
605
605
|
q > 0 && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
606
606
|
w
|
|
607
607
|
] }, f.key);
|
|
608
608
|
}),
|
|
609
|
-
s.user_info.metadata?.values !== void 0 && !m.some((f) => f.key === "values") && /* @__PURE__ */
|
|
609
|
+
s.user_info.metadata?.values !== void 0 && !m.some((f) => f.key === "values") && /* @__PURE__ */ t("span", { className: "flex items-center gap-1", children: [
|
|
610
610
|
m.some((f) => s.user_info?.metadata?.[f.key] !== void 0) && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
611
611
|
String(s.user_info.metadata.values)
|
|
612
612
|
] })
|
|
@@ -614,61 +614,61 @@ function Nt() {
|
|
|
614
614
|
]
|
|
615
615
|
}
|
|
616
616
|
),
|
|
617
|
-
s.metadata?.usage && /* @__PURE__ */
|
|
618
|
-
/* @__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:
|
|
619
|
-
/* @__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:
|
|
617
|
+
s.metadata?.usage && /* @__PURE__ */ t("div", { className: "flex gap-2 mt-2 pt-2 border-border/30", children: [
|
|
618
|
+
/* @__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: r("chat_history.input_tokens", { value: (s.metadata.usage.input_tokens || 0).toLocaleString(P) }) }),
|
|
619
|
+
/* @__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: r("chat_history.output_tokens", { value: (s.metadata.usage.output_tokens || 0).toLocaleString(P) }) })
|
|
620
620
|
] }),
|
|
621
|
-
/* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children:
|
|
621
|
+
/* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: p(s.created_at) })
|
|
622
622
|
] })
|
|
623
623
|
]
|
|
624
624
|
},
|
|
625
625
|
s.id
|
|
626
626
|
)),
|
|
627
|
-
I && /* @__PURE__ */ e("div", { className: "p-4 text-center text-muted-foreground text-xs", children:
|
|
627
|
+
I && /* @__PURE__ */ e("div", { className: "p-4 text-center text-muted-foreground text-xs", children: r("loading_more") })
|
|
628
628
|
] })
|
|
629
629
|
}
|
|
630
630
|
)
|
|
631
631
|
] }),
|
|
632
|
-
/* @__PURE__ */
|
|
633
|
-
/* @__PURE__ */
|
|
634
|
-
/* @__PURE__ */ e("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide truncate", children: v ?
|
|
632
|
+
/* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col", children: [
|
|
633
|
+
/* @__PURE__ */ t("div", { className: "px-5 py-2.5 border-b border-border/30 flex items-center justify-between gap-4", children: [
|
|
634
|
+
/* @__PURE__ */ e("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide truncate", children: v ? r("chat_history.messages_for", { title: v.title || r("chat_history.no_thread_title") }) : r("chat_history.messages") }),
|
|
635
635
|
v && /* @__PURE__ */ e(
|
|
636
636
|
"button",
|
|
637
637
|
{
|
|
638
638
|
onClick: (s) => l(s, v),
|
|
639
639
|
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",
|
|
640
|
-
title:
|
|
640
|
+
title: r("sidebar.share_conversation"),
|
|
641
641
|
children: /* @__PURE__ */ e(dt, { className: "w-4 h-4" })
|
|
642
642
|
}
|
|
643
643
|
)
|
|
644
644
|
] }),
|
|
645
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children: v ? T ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children:
|
|
645
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children: v ? T ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: r("chat_history.loading_messages") }) : N.length === 0 ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: r("chat_history.empty_thread") }) : /* @__PURE__ */ e("div", { className: "space-y-6", children: N.map((s) => {
|
|
646
646
|
const f = s.role === "user", q = s.role === "assistant";
|
|
647
|
-
return /* @__PURE__ */
|
|
647
|
+
return /* @__PURE__ */ t(
|
|
648
648
|
"div",
|
|
649
649
|
{
|
|
650
650
|
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"}`,
|
|
651
651
|
children: [
|
|
652
652
|
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" ? "👍" : "👎" }) }),
|
|
653
|
-
/* @__PURE__ */
|
|
654
|
-
/* @__PURE__ */ e("span", { className: `text-[10px] font-bold uppercase tracking-wider ${f || q ? "text-primary" : "text-muted-foreground"}`, children: f ? v?.user_info?.name ? `${v.user_info.name} ${v.user_info.surname || ""}`.trim() :
|
|
655
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children:
|
|
653
|
+
/* @__PURE__ */ t("div", { className: "flex justify-between items-center mb-1.5", children: [
|
|
654
|
+
/* @__PURE__ */ e("span", { className: `text-[10px] font-bold uppercase tracking-wider ${f || q ? "text-primary" : "text-muted-foreground"}`, children: f ? v?.user_info?.name ? `${v.user_info.name} ${v.user_info.surname || ""}`.trim() : r("chat_history.user_label") : q ? r("chat_history.assistant_label") : `${s.role}` }),
|
|
655
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children: p(s.created_at) })
|
|
656
656
|
] }),
|
|
657
|
-
/* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children: s.parts && s.parts.length > 0 ? s.parts.map((
|
|
657
|
+
/* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children: s.parts && s.parts.length > 0 ? s.parts.map((n, w) => j(n, w)) : 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 })
|
|
658
658
|
]
|
|
659
659
|
},
|
|
660
660
|
s.id
|
|
661
661
|
);
|
|
662
|
-
}) }) : /* @__PURE__ */
|
|
662
|
+
}) }) : /* @__PURE__ */ t("div", { className: "h-full flex flex-col items-center justify-center text-muted-foreground", children: [
|
|
663
663
|
/* @__PURE__ */ e("svg", { className: "w-12 h-12 mb-4 opacity-50", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, 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" }) }),
|
|
664
|
-
/* @__PURE__ */ e("p", { className: "text-sm", children:
|
|
664
|
+
/* @__PURE__ */ e("p", { className: "text-sm", children: r("chat_history.select_thread") })
|
|
665
665
|
] }) })
|
|
666
666
|
] })
|
|
667
667
|
] })
|
|
668
668
|
] });
|
|
669
669
|
}
|
|
670
670
|
function wt() {
|
|
671
|
-
const { t, i18n:
|
|
671
|
+
const { t: r, i18n: i } = ee(["admin", "translation"]), [o, m] = b([]), [x, u] = b(!1), [v, _] = b(""), [N, H] = b(!1), [T, A] = b(null), [I, D] = b([]), [C, O] = b(null), U = i.language === "fa", [y, z] = b({
|
|
672
672
|
username: "",
|
|
673
673
|
password: "",
|
|
674
674
|
name: "",
|
|
@@ -681,7 +681,7 @@ function wt() {
|
|
|
681
681
|
const l = localStorage.getItem("admin_info");
|
|
682
682
|
l && O(JSON.parse(l).admin_id);
|
|
683
683
|
} catch (c) {
|
|
684
|
-
_(c instanceof Error ? c.message :
|
|
684
|
+
_(c instanceof Error ? c.message : r("error_loading"));
|
|
685
685
|
} finally {
|
|
686
686
|
u(!1);
|
|
687
687
|
}
|
|
@@ -706,7 +706,7 @@ function wt() {
|
|
|
706
706
|
y.permissions
|
|
707
707
|
), H(!1), z({ username: "", password: "", name: "", permissions: [] }), R();
|
|
708
708
|
} catch (l) {
|
|
709
|
-
_(l instanceof Error ? l.message :
|
|
709
|
+
_(l instanceof Error ? l.message : r("error_loading"));
|
|
710
710
|
} finally {
|
|
711
711
|
u(!1);
|
|
712
712
|
}
|
|
@@ -719,26 +719,26 @@ function wt() {
|
|
|
719
719
|
permissions: y.permissions
|
|
720
720
|
};
|
|
721
721
|
if (y.password && (l.password = y.password), await k.updateAdmin(T.id, l), T.id === C) {
|
|
722
|
-
const
|
|
723
|
-
if (
|
|
724
|
-
const L = JSON.parse(
|
|
722
|
+
const p = localStorage.getItem("admin_info");
|
|
723
|
+
if (p) {
|
|
724
|
+
const L = JSON.parse(p);
|
|
725
725
|
L.name = y.name, L.permissions = y.permissions, localStorage.setItem("admin_info", JSON.stringify(L)), window.location.reload();
|
|
726
726
|
return;
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
729
|
A(null), z({ username: "", password: "", name: "", permissions: [] }), R();
|
|
730
730
|
} catch (l) {
|
|
731
|
-
_(l instanceof Error ? l.message :
|
|
731
|
+
_(l instanceof Error ? l.message : r("error_loading"));
|
|
732
732
|
} finally {
|
|
733
733
|
u(!1);
|
|
734
734
|
}
|
|
735
735
|
}
|
|
736
736
|
}, B = async (c) => {
|
|
737
|
-
if (confirm(
|
|
737
|
+
if (confirm(r("admins.confirm_delete_admin")))
|
|
738
738
|
try {
|
|
739
739
|
await k.deleteAdmin(c), R();
|
|
740
740
|
} catch (l) {
|
|
741
|
-
_(l instanceof Error ? l.message :
|
|
741
|
+
_(l instanceof Error ? l.message : r("error_loading"));
|
|
742
742
|
}
|
|
743
743
|
}, h = (c) => {
|
|
744
744
|
A(c), z({
|
|
@@ -747,35 +747,35 @@ function wt() {
|
|
|
747
747
|
name: c.name,
|
|
748
748
|
permissions: c.permissions
|
|
749
749
|
}), H(!0);
|
|
750
|
-
},
|
|
750
|
+
}, P = (c) => {
|
|
751
751
|
z((l) => ({
|
|
752
752
|
...l,
|
|
753
|
-
permissions: l.permissions.includes(c) ? l.permissions.filter((
|
|
753
|
+
permissions: l.permissions.includes(c) ? l.permissions.filter((p) => p !== c) : [...l.permissions, c]
|
|
754
754
|
}));
|
|
755
755
|
}, d = (c) => {
|
|
756
|
-
const l = `admins.perm_${c}`,
|
|
757
|
-
if (
|
|
758
|
-
return
|
|
756
|
+
const l = `admins.perm_${c}`, p = r(l);
|
|
757
|
+
if (p !== l)
|
|
758
|
+
return p;
|
|
759
759
|
switch (c) {
|
|
760
760
|
case "chat_history":
|
|
761
|
-
return
|
|
761
|
+
return r("admins.perm_chat_history");
|
|
762
762
|
case "admin_management":
|
|
763
|
-
return
|
|
763
|
+
return r("admins.perm_admin_management");
|
|
764
764
|
case "user_management":
|
|
765
|
-
return
|
|
765
|
+
return r("admins.perm_user_management");
|
|
766
766
|
case "analytics":
|
|
767
|
-
return
|
|
767
|
+
return r("admins.perm_analytics");
|
|
768
768
|
case "settings":
|
|
769
|
-
return
|
|
769
|
+
return r("admins.perm_settings");
|
|
770
770
|
default:
|
|
771
771
|
return c;
|
|
772
772
|
}
|
|
773
773
|
};
|
|
774
|
-
return /* @__PURE__ */
|
|
775
|
-
/* @__PURE__ */
|
|
776
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children:
|
|
777
|
-
/* @__PURE__ */
|
|
778
|
-
/* @__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:
|
|
774
|
+
return /* @__PURE__ */ t("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: U ? "rtl" : "ltr", children: [
|
|
775
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
|
|
776
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: r("admins.title") }),
|
|
777
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
778
|
+
/* @__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: r("admins.admin_count", { count: o.length }) }),
|
|
779
779
|
/* @__PURE__ */ e(
|
|
780
780
|
"button",
|
|
781
781
|
{
|
|
@@ -783,17 +783,17 @@ function wt() {
|
|
|
783
783
|
A(null), z({ username: "", password: "", name: "", permissions: [] }), H(!0);
|
|
784
784
|
},
|
|
785
785
|
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",
|
|
786
|
-
children:
|
|
786
|
+
children: r("admins.add_admin")
|
|
787
787
|
}
|
|
788
788
|
)
|
|
789
789
|
] })
|
|
790
790
|
] }),
|
|
791
791
|
v && /* @__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: v }),
|
|
792
|
-
N && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */
|
|
793
|
-
/* @__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:
|
|
794
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */
|
|
795
|
-
/* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
792
|
+
N && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ t("div", { className: "bg-card rounded-2xl border border-border w-full max-w-md shadow-2xl overflow-hidden", children: [
|
|
793
|
+
/* @__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: r(T ? "admins.edit_admin" : "admins.add_admin") }) }),
|
|
794
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ t("form", { onSubmit: T ? Z : V, className: "space-y-5", children: [
|
|
795
|
+
/* @__PURE__ */ t("div", { children: [
|
|
796
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("admins.username") }),
|
|
797
797
|
/* @__PURE__ */ e(
|
|
798
798
|
"input",
|
|
799
799
|
{
|
|
@@ -807,8 +807,8 @@ function wt() {
|
|
|
807
807
|
}
|
|
808
808
|
)
|
|
809
809
|
] }),
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
810
|
+
/* @__PURE__ */ t("div", { children: [
|
|
811
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("admins.name") }),
|
|
812
812
|
/* @__PURE__ */ e(
|
|
813
813
|
"input",
|
|
814
814
|
{
|
|
@@ -820,8 +820,8 @@ function wt() {
|
|
|
820
820
|
}
|
|
821
821
|
)
|
|
822
822
|
] }),
|
|
823
|
-
/* @__PURE__ */
|
|
824
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
823
|
+
/* @__PURE__ */ t("div", { children: [
|
|
824
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r(T ? "admins.password_edit" : "admins.password") }),
|
|
825
825
|
/* @__PURE__ */ e(
|
|
826
826
|
"input",
|
|
827
827
|
{
|
|
@@ -834,15 +834,15 @@ function wt() {
|
|
|
834
834
|
}
|
|
835
835
|
)
|
|
836
836
|
] }),
|
|
837
|
-
/* @__PURE__ */
|
|
838
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
839
|
-
/* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children: I.map((c) => /* @__PURE__ */
|
|
837
|
+
/* @__PURE__ */ t("div", { children: [
|
|
838
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("admins.permissions") }),
|
|
839
|
+
/* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children: I.map((c) => /* @__PURE__ */ t("label", { className: "flex items-center gap-3 cursor-pointer group", children: [
|
|
840
840
|
/* @__PURE__ */ e("div", { className: "relative flex items-center", children: /* @__PURE__ */ e(
|
|
841
841
|
"input",
|
|
842
842
|
{
|
|
843
843
|
type: "checkbox",
|
|
844
844
|
checked: y.permissions.includes(c),
|
|
845
|
-
onChange: () =>
|
|
845
|
+
onChange: () => P(c),
|
|
846
846
|
disabled: y.username === "admin" && c === "admin_management",
|
|
847
847
|
className: "peer h-4 w-4 rounded border-input text-primary focus:ring-ring transition-all disabled:opacity-50"
|
|
848
848
|
}
|
|
@@ -850,14 +850,14 @@ function wt() {
|
|
|
850
850
|
/* @__PURE__ */ e("span", { className: "text-sm text-foreground/70 group-hover:text-foreground transition-colors select-none", children: d(c) })
|
|
851
851
|
] }, c)) })
|
|
852
852
|
] }),
|
|
853
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ t("div", { className: "flex gap-3 pt-4", children: [
|
|
854
854
|
/* @__PURE__ */ e(
|
|
855
855
|
"button",
|
|
856
856
|
{
|
|
857
857
|
type: "button",
|
|
858
858
|
onClick: () => H(!1),
|
|
859
859
|
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",
|
|
860
|
-
children:
|
|
860
|
+
children: r("cancel")
|
|
861
861
|
}
|
|
862
862
|
),
|
|
863
863
|
/* @__PURE__ */ e(
|
|
@@ -866,31 +866,31 @@ function wt() {
|
|
|
866
866
|
type: "submit",
|
|
867
867
|
disabled: x,
|
|
868
868
|
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",
|
|
869
|
-
children:
|
|
869
|
+
children: r(x ? "saving" : "save")
|
|
870
870
|
}
|
|
871
871
|
)
|
|
872
872
|
] })
|
|
873
873
|
] }) })
|
|
874
874
|
] }) }),
|
|
875
|
-
/* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */
|
|
876
|
-
/* @__PURE__ */
|
|
877
|
-
/* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */
|
|
878
|
-
/* @__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:
|
|
879
|
-
/* @__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:
|
|
880
|
-
/* @__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:
|
|
881
|
-
/* @__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:
|
|
875
|
+
/* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ t("div", { className: "overflow-x-auto flex-1", children: [
|
|
876
|
+
/* @__PURE__ */ t("table", { className: `w-full ${U ? "text-right" : "text-left"} border-collapse`, children: [
|
|
877
|
+
/* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ t("tr", { children: [
|
|
878
|
+
/* @__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: r("admins.name") }),
|
|
879
|
+
/* @__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: r("admins.username") }),
|
|
880
|
+
/* @__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: r("admins.permissions") }),
|
|
881
|
+
/* @__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: r("users.actions") })
|
|
882
882
|
] }) }),
|
|
883
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: o.map((c) => /* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: o.map((c) => /* @__PURE__ */ t("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
|
|
884
884
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children: c.name }),
|
|
885
885
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground font-mono", dir: "ltr", children: c.username }),
|
|
886
886
|
/* @__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)) }) }),
|
|
887
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */
|
|
887
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: [
|
|
888
888
|
/* @__PURE__ */ e(
|
|
889
889
|
"button",
|
|
890
890
|
{
|
|
891
891
|
onClick: () => h(c),
|
|
892
892
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
893
|
-
title:
|
|
893
|
+
title: r("edit"),
|
|
894
894
|
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" }) })
|
|
895
895
|
}
|
|
896
896
|
),
|
|
@@ -899,27 +899,27 @@ function wt() {
|
|
|
899
899
|
{
|
|
900
900
|
onClick: () => B(c.id),
|
|
901
901
|
className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
|
|
902
|
-
title:
|
|
902
|
+
title: r("delete"),
|
|
903
903
|
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" }) })
|
|
904
904
|
}
|
|
905
905
|
)
|
|
906
906
|
] }) })
|
|
907
907
|
] }, c.id)) })
|
|
908
908
|
] }),
|
|
909
|
-
o.length === 0 && !x && /* @__PURE__ */
|
|
909
|
+
o.length === 0 && !x && /* @__PURE__ */ t("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
|
|
910
910
|
/* @__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" }) }),
|
|
911
|
-
|
|
911
|
+
r("admins.no_admins")
|
|
912
912
|
] }),
|
|
913
|
-
x && /* @__PURE__ */
|
|
913
|
+
x && /* @__PURE__ */ t("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-3", children: [
|
|
914
914
|
/* @__PURE__ */ e("div", { className: "w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin" }),
|
|
915
|
-
/* @__PURE__ */ e("span", { children:
|
|
915
|
+
/* @__PURE__ */ e("span", { children: r("loading") })
|
|
916
916
|
] })
|
|
917
917
|
] }) })
|
|
918
918
|
] });
|
|
919
919
|
}
|
|
920
|
-
const _t = (
|
|
920
|
+
const _t = (r) => r.replace(/[^0-9]/g, "");
|
|
921
921
|
function kt() {
|
|
922
|
-
const { t, i18n:
|
|
922
|
+
const { t: r, i18n: i } = ee(["admin", "translation"]), { app: o } = me(), [m, x] = b([]), [u, v] = b(!1), [_, N] = b(""), [H, T] = b(!1), [A, I] = b(null), [D, C] = b(""), [O, U] = b(0), [y, z] = b(null), R = pe(() => o?.userMetadataFields || [], [o?.userMetadataFields]), [E, V] = b(null), [Z, B] = b(""), [h, P] = b(""), [d, c] = b(""), [l, p] = b(""), L = i.language === "fa", J = L ? "text-right" : "text-left", [g, j] = b({
|
|
923
923
|
phone: "",
|
|
924
924
|
name: "",
|
|
925
925
|
surname: "",
|
|
@@ -935,7 +935,7 @@ function kt() {
|
|
|
935
935
|
const a = await k.listUsers(0, 100, D);
|
|
936
936
|
x(a.users || []), U(a.count || 0);
|
|
937
937
|
} catch (a) {
|
|
938
|
-
N(a instanceof Error ? a.message :
|
|
938
|
+
N(a instanceof Error ? a.message : r("error_loading"));
|
|
939
939
|
} finally {
|
|
940
940
|
v(!1);
|
|
941
941
|
}
|
|
@@ -950,7 +950,7 @@ function kt() {
|
|
|
950
950
|
W(() => {
|
|
951
951
|
q();
|
|
952
952
|
}, []), W(() => {
|
|
953
|
-
y && !A && !
|
|
953
|
+
y && !A && !g.tokens && !g.requests && j((a) => ({
|
|
954
954
|
...a,
|
|
955
955
|
tokens: y.initial_balance_tokens?.toString() || "",
|
|
956
956
|
requests: y.initial_balance_requests?.toString() || "",
|
|
@@ -964,8 +964,8 @@ function kt() {
|
|
|
964
964
|
return () => clearTimeout(a);
|
|
965
965
|
}, [D]), W(() => {
|
|
966
966
|
try {
|
|
967
|
-
const S = { ...
|
|
968
|
-
$ !==
|
|
967
|
+
const S = { ...g.metadata ? JSON.parse(g.metadata) : {}, ...M }, $ = JSON.stringify(S, null, 2);
|
|
968
|
+
$ !== g.metadata && j((G) => ({ ...G, metadata: $ }));
|
|
969
969
|
} catch {
|
|
970
970
|
}
|
|
971
971
|
}, [M]), W(() => {
|
|
@@ -975,62 +975,62 @@ function kt() {
|
|
|
975
975
|
$.condition && !Se($.condition, M) && a[$.key] !== void 0 && (delete a[$.key], S = !0);
|
|
976
976
|
}), S && s(a);
|
|
977
977
|
}, [M, R]);
|
|
978
|
-
const
|
|
978
|
+
const n = async (a) => {
|
|
979
979
|
a.preventDefault();
|
|
980
|
-
const S =
|
|
980
|
+
const S = g.tokens ? parseInt(g.tokens) : 0, $ = g.requests ? parseInt(g.requests) : 0, G = g.tokensLimit ? parseInt(g.tokensLimit) : S, te = g.requestsLimit ? parseInt(g.requestsLimit) : $;
|
|
981
981
|
if (S > G) {
|
|
982
|
-
N(
|
|
982
|
+
N(r("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
983
983
|
return;
|
|
984
984
|
}
|
|
985
985
|
if ($ > te) {
|
|
986
|
-
N(
|
|
986
|
+
N(r("users.requests_exceed_limit", "Requests cannot exceed limit"));
|
|
987
987
|
return;
|
|
988
988
|
}
|
|
989
989
|
let ge = {};
|
|
990
|
-
if (
|
|
990
|
+
if (g.metadata)
|
|
991
991
|
try {
|
|
992
|
-
ge = JSON.parse(
|
|
992
|
+
ge = JSON.parse(g.metadata);
|
|
993
993
|
} catch {
|
|
994
|
-
N(
|
|
994
|
+
N(r("users.invalid_json", "Invalid JSON format"));
|
|
995
995
|
return;
|
|
996
996
|
}
|
|
997
997
|
v(!0);
|
|
998
998
|
try {
|
|
999
999
|
await k.createUser(
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1000
|
+
g.phone,
|
|
1001
|
+
g.name,
|
|
1002
|
+
g.surname,
|
|
1003
|
+
g.tokens ? parseInt(g.tokens) : void 0,
|
|
1004
|
+
g.requests ? parseInt(g.requests) : void 0,
|
|
1005
|
+
g.tokensLimit ? parseInt(g.tokensLimit) : void 0,
|
|
1006
|
+
g.requestsLimit ? parseInt(g.requestsLimit) : void 0,
|
|
1007
1007
|
ge
|
|
1008
1008
|
), T(!1), F(), f();
|
|
1009
1009
|
} catch (fe) {
|
|
1010
|
-
N(fe instanceof Error ? fe.message :
|
|
1010
|
+
N(fe instanceof Error ? fe.message : r("error_loading"));
|
|
1011
1011
|
} finally {
|
|
1012
1012
|
v(!1);
|
|
1013
1013
|
}
|
|
1014
1014
|
}, w = async (a) => {
|
|
1015
1015
|
if (a.preventDefault(), !A) return;
|
|
1016
1016
|
let S = {};
|
|
1017
|
-
if (
|
|
1017
|
+
if (g.metadata)
|
|
1018
1018
|
try {
|
|
1019
|
-
S = JSON.parse(
|
|
1019
|
+
S = JSON.parse(g.metadata);
|
|
1020
1020
|
} catch {
|
|
1021
|
-
N(
|
|
1021
|
+
N(r("users.invalid_json", "Invalid JSON format"));
|
|
1022
1022
|
return;
|
|
1023
1023
|
}
|
|
1024
1024
|
v(!0);
|
|
1025
1025
|
try {
|
|
1026
1026
|
await k.updateUser(A.id, {
|
|
1027
|
-
phone:
|
|
1028
|
-
name:
|
|
1029
|
-
surname:
|
|
1027
|
+
phone: g.phone,
|
|
1028
|
+
name: g.name,
|
|
1029
|
+
surname: g.surname,
|
|
1030
1030
|
metadata: S
|
|
1031
1031
|
}), I(null), T(!1), F(), f();
|
|
1032
1032
|
} catch ($) {
|
|
1033
|
-
N($ instanceof Error ? $.message :
|
|
1033
|
+
N($ instanceof Error ? $.message : r("error_loading"));
|
|
1034
1034
|
} finally {
|
|
1035
1035
|
v(!1);
|
|
1036
1036
|
}
|
|
@@ -1045,23 +1045,23 @@ function kt() {
|
|
|
1045
1045
|
requestsLimit: y?.initial_balance_requests?.toString() || "",
|
|
1046
1046
|
metadata: ""
|
|
1047
1047
|
}), s({});
|
|
1048
|
-
},
|
|
1049
|
-
if (confirm(
|
|
1048
|
+
}, Y = async (a) => {
|
|
1049
|
+
if (confirm(r("users.confirm_delete_user")))
|
|
1050
1050
|
try {
|
|
1051
1051
|
await k.deleteUser(a), f();
|
|
1052
1052
|
} catch (S) {
|
|
1053
|
-
N(S instanceof Error ? S.message :
|
|
1053
|
+
N(S instanceof Error ? S.message : r("error_loading"));
|
|
1054
1054
|
}
|
|
1055
1055
|
}, De = async (a) => {
|
|
1056
1056
|
try {
|
|
1057
1057
|
const $ = (await k.refreshUserToken(a.id))?.user?.token;
|
|
1058
1058
|
if (!$) {
|
|
1059
|
-
N(
|
|
1059
|
+
N(r("users.no_token"));
|
|
1060
1060
|
return;
|
|
1061
1061
|
}
|
|
1062
|
-
await navigator.clipboard.writeText($), alert(
|
|
1062
|
+
await navigator.clipboard.writeText($), alert(r("users.token_copied"));
|
|
1063
1063
|
} catch (S) {
|
|
1064
|
-
N(S instanceof Error ? S.message :
|
|
1064
|
+
N(S instanceof Error ? S.message : r("error_loading"));
|
|
1065
1065
|
}
|
|
1066
1066
|
}, Ee = async (a, S, $, G) => {
|
|
1067
1067
|
if (E) {
|
|
@@ -1073,9 +1073,9 @@ function kt() {
|
|
|
1073
1073
|
S,
|
|
1074
1074
|
$,
|
|
1075
1075
|
G
|
|
1076
|
-
), V(null), B(""),
|
|
1076
|
+
), V(null), B(""), P(""), c(""), p(""), f();
|
|
1077
1077
|
} catch (te) {
|
|
1078
|
-
N(te instanceof Error ? te.message :
|
|
1078
|
+
N(te instanceof Error ? te.message : r("error_loading"));
|
|
1079
1079
|
} finally {
|
|
1080
1080
|
v(!1);
|
|
1081
1081
|
}
|
|
@@ -1084,11 +1084,11 @@ function kt() {
|
|
|
1084
1084
|
if (a.preventDefault(), !E) return;
|
|
1085
1085
|
const S = parseInt(Z) || 0, $ = parseInt(h) || 0, G = d ? parseInt(d) : E.balance?.token_limit || 0, te = l ? parseInt(l) : E.balance?.request_limit || 0;
|
|
1086
1086
|
if (S > G) {
|
|
1087
|
-
N(
|
|
1087
|
+
N(r("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
1088
1088
|
return;
|
|
1089
1089
|
}
|
|
1090
1090
|
if ($ > te) {
|
|
1091
|
-
N(
|
|
1091
|
+
N(r("users.requests_exceed_limit", "Requests cannot exceed limit"));
|
|
1092
1092
|
return;
|
|
1093
1093
|
}
|
|
1094
1094
|
await Ee(
|
|
@@ -1100,7 +1100,7 @@ function kt() {
|
|
|
1100
1100
|
}, Re = () => {
|
|
1101
1101
|
if (!E) return;
|
|
1102
1102
|
const a = d || String(E.balance?.token_limit || 0), S = l || String(E.balance?.request_limit || 0);
|
|
1103
|
-
B(a),
|
|
1103
|
+
B(a), P(S);
|
|
1104
1104
|
}, Fe = (a) => {
|
|
1105
1105
|
I(a);
|
|
1106
1106
|
const S = a.metadata ? JSON.stringify(a.metadata, null, 2) : "";
|
|
@@ -1121,22 +1121,22 @@ function kt() {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
T(!0);
|
|
1123
1123
|
};
|
|
1124
|
-
return /* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1126
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children:
|
|
1127
|
-
/* @__PURE__ */
|
|
1124
|
+
return /* @__PURE__ */ t("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: L ? "rtl" : "ltr", children: [
|
|
1125
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
|
|
1126
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: r("users.title") }),
|
|
1127
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row items-center gap-2 flex-1 max-w-4xl justify-end", children: [
|
|
1128
1128
|
/* @__PURE__ */ e("div", { className: "flex-1 w-full md:w-auto", children: /* @__PURE__ */ e(
|
|
1129
1129
|
"input",
|
|
1130
1130
|
{
|
|
1131
1131
|
type: "text",
|
|
1132
1132
|
value: D,
|
|
1133
1133
|
onChange: (a) => C(a.target.value),
|
|
1134
|
-
placeholder:
|
|
1134
|
+
placeholder: r("chat_history.search_placeholder"),
|
|
1135
1135
|
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"
|
|
1136
1136
|
}
|
|
1137
1137
|
) }),
|
|
1138
|
-
/* @__PURE__ */
|
|
1139
|
-
/* @__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:
|
|
1138
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2 shrink-0", children: [
|
|
1139
|
+
/* @__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: r("users.user_count", { count: O }) }),
|
|
1140
1140
|
/* @__PURE__ */ e(
|
|
1141
1141
|
"button",
|
|
1142
1142
|
{
|
|
@@ -1144,137 +1144,137 @@ function kt() {
|
|
|
1144
1144
|
I(null), F(), T(!0);
|
|
1145
1145
|
},
|
|
1146
1146
|
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",
|
|
1147
|
-
children:
|
|
1147
|
+
children: r("users.add_user")
|
|
1148
1148
|
}
|
|
1149
1149
|
)
|
|
1150
1150
|
] })
|
|
1151
1151
|
] })
|
|
1152
1152
|
] }),
|
|
1153
|
-
_ && /* @__PURE__ */
|
|
1153
|
+
_ && /* @__PURE__ */ t("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: [
|
|
1154
1154
|
/* @__PURE__ */ e("span", { children: _ }),
|
|
1155
1155
|
/* @__PURE__ */ e("button", { onClick: () => N(""), 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" }) }) })
|
|
1156
1156
|
] }),
|
|
1157
|
-
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__ */
|
|
1158
|
-
/* @__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:
|
|
1159
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */
|
|
1160
|
-
/* @__PURE__ */
|
|
1161
|
-
/* @__PURE__ */
|
|
1162
|
-
/* @__PURE__ */
|
|
1163
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1157
|
+
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__ */ t("div", { className: "bg-card rounded-2xl border border-border w-full max-w-xl shadow-2xl overflow-hidden", children: [
|
|
1158
|
+
/* @__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: r(A ? "users.edit_user" : "users.add_user") }) }),
|
|
1159
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ t("form", { onSubmit: A ? w : n, children: [
|
|
1160
|
+
/* @__PURE__ */ t("div", { className: "space-y-6 max-h-[60vh] overflow-y-auto px-1 custom-scrollbar", children: [
|
|
1161
|
+
/* @__PURE__ */ t("div", { className: "space-y-4", children: [
|
|
1162
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1163
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.phone") }),
|
|
1164
1164
|
/* @__PURE__ */ e(
|
|
1165
1165
|
"input",
|
|
1166
1166
|
{
|
|
1167
1167
|
type: "text",
|
|
1168
|
-
value:
|
|
1169
|
-
onChange: (a) => j({ ...
|
|
1168
|
+
value: g.phone,
|
|
1169
|
+
onChange: (a) => j({ ...g, phone: _t(a.target.value) }),
|
|
1170
1170
|
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",
|
|
1171
|
-
placeholder:
|
|
1171
|
+
placeholder: r("users.phone_placeholder"),
|
|
1172
1172
|
required: !0,
|
|
1173
1173
|
dir: "ltr"
|
|
1174
1174
|
}
|
|
1175
1175
|
)
|
|
1176
1176
|
] }),
|
|
1177
|
-
/* @__PURE__ */
|
|
1178
|
-
/* @__PURE__ */
|
|
1179
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1177
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1178
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1179
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.name") }),
|
|
1180
1180
|
/* @__PURE__ */ e(
|
|
1181
1181
|
"input",
|
|
1182
1182
|
{
|
|
1183
1183
|
type: "text",
|
|
1184
|
-
value:
|
|
1185
|
-
onChange: (a) => j({ ...
|
|
1186
|
-
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 ${
|
|
1184
|
+
value: g.name,
|
|
1185
|
+
onChange: (a) => j({ ...g, name: a.target.value }),
|
|
1186
|
+
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 ${J}`,
|
|
1187
1187
|
required: !0
|
|
1188
1188
|
}
|
|
1189
1189
|
)
|
|
1190
1190
|
] }),
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1191
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1192
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.surname") }),
|
|
1193
1193
|
/* @__PURE__ */ e(
|
|
1194
1194
|
"input",
|
|
1195
1195
|
{
|
|
1196
1196
|
type: "text",
|
|
1197
|
-
value:
|
|
1198
|
-
onChange: (a) => j({ ...
|
|
1199
|
-
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 ${
|
|
1197
|
+
value: g.surname,
|
|
1198
|
+
onChange: (a) => j({ ...g, surname: a.target.value }),
|
|
1199
|
+
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 ${J}`,
|
|
1200
1200
|
required: !0
|
|
1201
1201
|
}
|
|
1202
1202
|
)
|
|
1203
1203
|
] })
|
|
1204
1204
|
] })
|
|
1205
1205
|
] }),
|
|
1206
|
-
!A && /* @__PURE__ */
|
|
1207
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children:
|
|
1208
|
-
/* @__PURE__ */
|
|
1209
|
-
/* @__PURE__ */
|
|
1210
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1206
|
+
!A && /* @__PURE__ */ t("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
|
|
1207
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: r("users.initial_balance") }),
|
|
1208
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1209
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1210
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.initial_tokens") }),
|
|
1211
1211
|
/* @__PURE__ */ e(
|
|
1212
1212
|
"input",
|
|
1213
1213
|
{
|
|
1214
1214
|
type: "number",
|
|
1215
|
-
value:
|
|
1216
|
-
onChange: (a) => j({ ...
|
|
1215
|
+
value: g.tokens,
|
|
1216
|
+
onChange: (a) => j({ ...g, tokens: a.target.value }),
|
|
1217
1217
|
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",
|
|
1218
1218
|
dir: "ltr",
|
|
1219
1219
|
placeholder: "0"
|
|
1220
1220
|
}
|
|
1221
1221
|
)
|
|
1222
1222
|
] }),
|
|
1223
|
-
/* @__PURE__ */
|
|
1224
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1223
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1224
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.token_limit") }),
|
|
1225
1225
|
/* @__PURE__ */ e(
|
|
1226
1226
|
"input",
|
|
1227
1227
|
{
|
|
1228
1228
|
type: "number",
|
|
1229
|
-
value:
|
|
1230
|
-
onChange: (a) => j({ ...
|
|
1229
|
+
value: g.tokensLimit,
|
|
1230
|
+
onChange: (a) => j({ ...g, tokensLimit: a.target.value }),
|
|
1231
1231
|
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",
|
|
1232
1232
|
dir: "ltr",
|
|
1233
|
-
placeholder:
|
|
1233
|
+
placeholder: g.tokens || String(y?.initial_balance_tokens ?? "250000")
|
|
1234
1234
|
}
|
|
1235
1235
|
)
|
|
1236
1236
|
] })
|
|
1237
1237
|
] }),
|
|
1238
|
-
/* @__PURE__ */
|
|
1239
|
-
/* @__PURE__ */
|
|
1240
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1238
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1239
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1240
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.initial_requests") }),
|
|
1241
1241
|
/* @__PURE__ */ e(
|
|
1242
1242
|
"input",
|
|
1243
1243
|
{
|
|
1244
1244
|
type: "number",
|
|
1245
|
-
value:
|
|
1246
|
-
onChange: (a) => j({ ...
|
|
1245
|
+
value: g.requests,
|
|
1246
|
+
onChange: (a) => j({ ...g, requests: a.target.value }),
|
|
1247
1247
|
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",
|
|
1248
1248
|
dir: "ltr",
|
|
1249
|
-
placeholder:
|
|
1249
|
+
placeholder: g.requests || String(y?.initial_balance_requests ?? "0")
|
|
1250
1250
|
}
|
|
1251
1251
|
)
|
|
1252
1252
|
] }),
|
|
1253
|
-
/* @__PURE__ */
|
|
1254
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1253
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1254
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.request_limit") }),
|
|
1255
1255
|
/* @__PURE__ */ e(
|
|
1256
1256
|
"input",
|
|
1257
1257
|
{
|
|
1258
1258
|
type: "number",
|
|
1259
|
-
value:
|
|
1260
|
-
onChange: (a) => j({ ...
|
|
1259
|
+
value: g.requestsLimit,
|
|
1260
|
+
onChange: (a) => j({ ...g, requestsLimit: a.target.value }),
|
|
1261
1261
|
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",
|
|
1262
1262
|
dir: "ltr",
|
|
1263
|
-
placeholder:
|
|
1263
|
+
placeholder: g.requests || String(y?.initial_balance_requests ?? "100")
|
|
1264
1264
|
}
|
|
1265
1265
|
)
|
|
1266
1266
|
] })
|
|
1267
1267
|
] })
|
|
1268
1268
|
] }),
|
|
1269
|
-
R.length > 0 && /* @__PURE__ */
|
|
1270
|
-
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children:
|
|
1271
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: R.map((a) => Se(a.condition, M) ? /* @__PURE__ */
|
|
1272
|
-
/* @__PURE__ */
|
|
1273
|
-
|
|
1269
|
+
R.length > 0 && /* @__PURE__ */ t("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
|
|
1270
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: r("users.custom_fields") }),
|
|
1271
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: R.map((a) => Se(a.condition, M) ? /* @__PURE__ */ t("div", { className: "animate-in fade-in slide-in-from-top-1 duration-200", children: [
|
|
1272
|
+
/* @__PURE__ */ t("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: [
|
|
1273
|
+
r(a.label),
|
|
1274
1274
|
" ",
|
|
1275
1275
|
a.required && /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
1276
1276
|
] }),
|
|
1277
|
-
a.type === "select" ? /* @__PURE__ */
|
|
1277
|
+
a.type === "select" ? /* @__PURE__ */ t(
|
|
1278
1278
|
ne,
|
|
1279
1279
|
{
|
|
1280
1280
|
value: String(M[a.key] || ""),
|
|
@@ -1282,11 +1282,11 @@ function kt() {
|
|
|
1282
1282
|
required: a.required,
|
|
1283
1283
|
dir: L ? "rtl" : "ltr",
|
|
1284
1284
|
children: [
|
|
1285
|
-
/* @__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]",
|
|
1286
|
-
/* @__PURE__ */ e(le, { className: "rounded-xl border-border bg-card", children: a.options?.map((S) => /* @__PURE__ */ e(K, { value: String(S.value), children:
|
|
1285
|
+
/* @__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]", J), children: /* @__PURE__ */ e(oe, { placeholder: r(a.placeholder || "select_placeholder") }) }),
|
|
1286
|
+
/* @__PURE__ */ e(le, { className: "rounded-xl border-border bg-card", children: a.options?.map((S) => /* @__PURE__ */ e(K, { value: String(S.value), children: r(S.label) }, String(S.value))) })
|
|
1287
1287
|
]
|
|
1288
1288
|
}
|
|
1289
|
-
) : a.type === "checkbox" ? /* @__PURE__ */
|
|
1289
|
+
) : a.type === "checkbox" ? /* @__PURE__ */ t("div", { className: "flex items-center gap-3 h-[46px] px-1", children: [
|
|
1290
1290
|
/* @__PURE__ */ e(
|
|
1291
1291
|
He,
|
|
1292
1292
|
{
|
|
@@ -1296,30 +1296,30 @@ function kt() {
|
|
|
1296
1296
|
required: a.required
|
|
1297
1297
|
}
|
|
1298
1298
|
),
|
|
1299
|
-
/* @__PURE__ */ e("label", { htmlFor: `admin-md-${a.key}`, className: "text-sm text-foreground/80 cursor-pointer select-none", children:
|
|
1299
|
+
/* @__PURE__ */ e("label", { htmlFor: `admin-md-${a.key}`, className: "text-sm text-foreground/80 cursor-pointer select-none", children: r(a.placeholder || a.label) })
|
|
1300
1300
|
] }) : /* @__PURE__ */ e(
|
|
1301
1301
|
"input",
|
|
1302
1302
|
{
|
|
1303
1303
|
type: a.type,
|
|
1304
1304
|
value: M[a.key] || "",
|
|
1305
1305
|
onChange: (S) => s({ ...M, [a.key]: S.target.value }),
|
|
1306
|
-
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 ${
|
|
1307
|
-
placeholder:
|
|
1306
|
+
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 ${J}`,
|
|
1307
|
+
placeholder: r(a.placeholder || ""),
|
|
1308
1308
|
required: a.required
|
|
1309
1309
|
}
|
|
1310
1310
|
)
|
|
1311
1311
|
] }, a.key) : null) })
|
|
1312
1312
|
] }),
|
|
1313
|
-
/* @__PURE__ */
|
|
1314
|
-
/* @__PURE__ */
|
|
1315
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider", children:
|
|
1316
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground opacity-60", children:
|
|
1313
|
+
/* @__PURE__ */ t("div", { className: "border-t border-border/50 pt-4 mt-4", children: [
|
|
1314
|
+
/* @__PURE__ */ t("div", { className: "flex items-center justify-between mb-2", children: [
|
|
1315
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider", children: r("users.metadata_raw") }),
|
|
1316
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground opacity-60", children: r("users.advanced_usage") })
|
|
1317
1317
|
] }),
|
|
1318
1318
|
/* @__PURE__ */ e(
|
|
1319
1319
|
"textarea",
|
|
1320
1320
|
{
|
|
1321
|
-
value:
|
|
1322
|
-
onChange: (a) => j({ ...
|
|
1321
|
+
value: g.metadata,
|
|
1322
|
+
onChange: (a) => j({ ...g, metadata: a.target.value }),
|
|
1323
1323
|
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",
|
|
1324
1324
|
placeholder: '{ "key": "value" }',
|
|
1325
1325
|
dir: "ltr"
|
|
@@ -1327,7 +1327,7 @@ function kt() {
|
|
|
1327
1327
|
)
|
|
1328
1328
|
] })
|
|
1329
1329
|
] }),
|
|
1330
|
-
/* @__PURE__ */
|
|
1330
|
+
/* @__PURE__ */ t("div", { className: "flex gap-3 pt-6", children: [
|
|
1331
1331
|
/* @__PURE__ */ e(
|
|
1332
1332
|
"button",
|
|
1333
1333
|
{
|
|
@@ -1336,7 +1336,7 @@ function kt() {
|
|
|
1336
1336
|
T(!1), I(null);
|
|
1337
1337
|
},
|
|
1338
1338
|
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",
|
|
1339
|
-
children:
|
|
1339
|
+
children: r("cancel")
|
|
1340
1340
|
}
|
|
1341
1341
|
),
|
|
1342
1342
|
/* @__PURE__ */ e(
|
|
@@ -1345,16 +1345,16 @@ function kt() {
|
|
|
1345
1345
|
type: "submit",
|
|
1346
1346
|
disabled: u,
|
|
1347
1347
|
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",
|
|
1348
|
-
children:
|
|
1348
|
+
children: r(u ? "saving" : "save")
|
|
1349
1349
|
}
|
|
1350
1350
|
)
|
|
1351
1351
|
] })
|
|
1352
1352
|
] }) })
|
|
1353
1353
|
] }) }),
|
|
1354
|
-
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__ */
|
|
1355
|
-
/* @__PURE__ */
|
|
1356
|
-
/* @__PURE__ */
|
|
1357
|
-
|
|
1354
|
+
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__ */ t("div", { className: "bg-card rounded-2xl border border-border w-full max-w-sm shadow-2xl overflow-hidden", children: [
|
|
1355
|
+
/* @__PURE__ */ t("div", { className: "px-6 py-5 border-b border-border bg-muted/20 flex items-center justify-between", children: [
|
|
1356
|
+
/* @__PURE__ */ t("h3", { className: "text-lg font-bold text-foreground", children: [
|
|
1357
|
+
r("users.update_balance_for"),
|
|
1358
1358
|
" ",
|
|
1359
1359
|
E.name
|
|
1360
1360
|
] }),
|
|
@@ -1369,11 +1369,11 @@ function kt() {
|
|
|
1369
1369
|
}
|
|
1370
1370
|
)
|
|
1371
1371
|
] }),
|
|
1372
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */
|
|
1373
|
-
/* @__PURE__ */
|
|
1374
|
-
/* @__PURE__ */
|
|
1375
|
-
/* @__PURE__ */
|
|
1376
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1372
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ t("form", { onSubmit: Oe, children: [
|
|
1373
|
+
/* @__PURE__ */ t("div", { className: "space-y-4", children: [
|
|
1374
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1375
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1376
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.token_count") }),
|
|
1377
1377
|
/* @__PURE__ */ e(
|
|
1378
1378
|
"input",
|
|
1379
1379
|
{
|
|
@@ -1386,8 +1386,8 @@ function kt() {
|
|
|
1386
1386
|
}
|
|
1387
1387
|
)
|
|
1388
1388
|
] }),
|
|
1389
|
-
/* @__PURE__ */
|
|
1390
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1389
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1390
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.token_limit") }),
|
|
1391
1391
|
/* @__PURE__ */ e(
|
|
1392
1392
|
"input",
|
|
1393
1393
|
{
|
|
@@ -1401,29 +1401,29 @@ function kt() {
|
|
|
1401
1401
|
)
|
|
1402
1402
|
] })
|
|
1403
1403
|
] }),
|
|
1404
|
-
/* @__PURE__ */
|
|
1405
|
-
/* @__PURE__ */
|
|
1406
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1404
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1405
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1406
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.request_count") }),
|
|
1407
1407
|
/* @__PURE__ */ e(
|
|
1408
1408
|
"input",
|
|
1409
1409
|
{
|
|
1410
1410
|
type: "number",
|
|
1411
1411
|
value: h,
|
|
1412
|
-
onChange: (a) =>
|
|
1412
|
+
onChange: (a) => P(a.target.value),
|
|
1413
1413
|
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",
|
|
1414
1414
|
required: !0,
|
|
1415
1415
|
dir: "ltr"
|
|
1416
1416
|
}
|
|
1417
1417
|
)
|
|
1418
1418
|
] }),
|
|
1419
|
-
/* @__PURE__ */
|
|
1420
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children:
|
|
1419
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1420
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: r("users.request_limit") }),
|
|
1421
1421
|
/* @__PURE__ */ e(
|
|
1422
1422
|
"input",
|
|
1423
1423
|
{
|
|
1424
1424
|
type: "number",
|
|
1425
1425
|
value: l,
|
|
1426
|
-
onChange: (a) =>
|
|
1426
|
+
onChange: (a) => p(a.target.value),
|
|
1427
1427
|
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",
|
|
1428
1428
|
dir: "ltr",
|
|
1429
1429
|
placeholder: h
|
|
@@ -1432,14 +1432,14 @@ function kt() {
|
|
|
1432
1432
|
] })
|
|
1433
1433
|
] })
|
|
1434
1434
|
] }),
|
|
1435
|
-
/* @__PURE__ */
|
|
1435
|
+
/* @__PURE__ */ t("div", { className: "flex gap-3 pt-6", children: [
|
|
1436
1436
|
/* @__PURE__ */ e(
|
|
1437
1437
|
"button",
|
|
1438
1438
|
{
|
|
1439
1439
|
type: "button",
|
|
1440
1440
|
onClick: Re,
|
|
1441
1441
|
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",
|
|
1442
|
-
children:
|
|
1442
|
+
children: r("users.full_charge")
|
|
1443
1443
|
}
|
|
1444
1444
|
),
|
|
1445
1445
|
/* @__PURE__ */ e(
|
|
@@ -1448,23 +1448,23 @@ function kt() {
|
|
|
1448
1448
|
type: "submit",
|
|
1449
1449
|
disabled: u,
|
|
1450
1450
|
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",
|
|
1451
|
-
children:
|
|
1451
|
+
children: r(u ? "users.updating" : "users.update_balance")
|
|
1452
1452
|
}
|
|
1453
1453
|
)
|
|
1454
1454
|
] })
|
|
1455
1455
|
] }) })
|
|
1456
1456
|
] }) }),
|
|
1457
|
-
/* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */
|
|
1458
|
-
/* @__PURE__ */
|
|
1459
|
-
/* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */
|
|
1460
|
-
/* @__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:
|
|
1461
|
-
/* @__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:
|
|
1462
|
-
/* @__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:
|
|
1463
|
-
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:
|
|
1464
|
-
/* @__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:
|
|
1465
|
-
/* @__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:
|
|
1457
|
+
/* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ t("div", { className: "overflow-x-auto flex-1 custom-scrollbar", children: [
|
|
1458
|
+
/* @__PURE__ */ t("table", { className: `w-full ${L ? "text-right" : "text-left"} border-collapse`, children: [
|
|
1459
|
+
/* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ t("tr", { children: [
|
|
1460
|
+
/* @__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: r("users.phone") }),
|
|
1461
|
+
/* @__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: r("users.name") }),
|
|
1462
|
+
/* @__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: r("users.surname") }),
|
|
1463
|
+
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: r(a.label) }, a.key)),
|
|
1464
|
+
/* @__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: r("users.balance") }),
|
|
1465
|
+
/* @__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: r("users.actions") })
|
|
1466
1466
|
] }) }),
|
|
1467
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: m.map((a) => /* @__PURE__ */
|
|
1467
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: m.map((a) => /* @__PURE__ */ t("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
|
|
1468
1468
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground font-mono", dir: "ltr", children: a.phone }),
|
|
1469
1469
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground", children: a.name }),
|
|
1470
1470
|
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: a.surname }),
|
|
@@ -1473,16 +1473,16 @@ function kt() {
|
|
|
1473
1473
|
let G = String($ ?? "");
|
|
1474
1474
|
if (S.type === "select" && $ !== void 0) {
|
|
1475
1475
|
const te = S.options?.find((ge) => String(ge.value) === String($));
|
|
1476
|
-
te && (G =
|
|
1476
|
+
te && (G = r(te.label));
|
|
1477
1477
|
}
|
|
1478
1478
|
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: "✗" }) : G }, S.key);
|
|
1479
1479
|
}),
|
|
1480
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground w-[120px]", children: a.balance ? /* @__PURE__ */
|
|
1481
|
-
/* @__PURE__ */
|
|
1482
|
-
/* @__PURE__ */
|
|
1483
|
-
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children:
|
|
1484
|
-
/* @__PURE__ */
|
|
1485
|
-
(a.balance.token_limit > 0 ? Math.round(a.balance.tokens / a.balance.token_limit * 100) : 0).toLocaleString(
|
|
1480
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground w-[120px]", children: a.balance ? /* @__PURE__ */ t("div", { className: "flex flex-col gap-3 min-w-0 py-1", children: [
|
|
1481
|
+
/* @__PURE__ */ t("div", { className: "space-y-1", children: [
|
|
1482
|
+
/* @__PURE__ */ t("div", { className: "flex justify-between text-[10px] font-semibold", children: [
|
|
1483
|
+
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: r("users.tokens_label") }),
|
|
1484
|
+
/* @__PURE__ */ t("span", { className: "text-foreground", children: [
|
|
1485
|
+
(a.balance.token_limit > 0 ? Math.round(a.balance.tokens / a.balance.token_limit * 100) : 0).toLocaleString(i.language),
|
|
1486
1486
|
"%"
|
|
1487
1487
|
] })
|
|
1488
1488
|
] }),
|
|
@@ -1494,11 +1494,11 @@ function kt() {
|
|
|
1494
1494
|
}
|
|
1495
1495
|
) })
|
|
1496
1496
|
] }),
|
|
1497
|
-
/* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */
|
|
1499
|
-
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children:
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
(a.balance.request_limit > 0 ? Math.round(a.balance.requests / a.balance.request_limit * 100) : 0).toLocaleString(
|
|
1497
|
+
/* @__PURE__ */ t("div", { className: "space-y-1", children: [
|
|
1498
|
+
/* @__PURE__ */ t("div", { className: "flex justify-between text-[10px] font-semibold", children: [
|
|
1499
|
+
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: r("users.requests_label") }),
|
|
1500
|
+
/* @__PURE__ */ t("span", { className: "text-foreground", children: [
|
|
1501
|
+
(a.balance.request_limit > 0 ? Math.round(a.balance.requests / a.balance.request_limit * 100) : 0).toLocaleString(i.language),
|
|
1502
1502
|
"%"
|
|
1503
1503
|
] })
|
|
1504
1504
|
] }),
|
|
@@ -1511,13 +1511,13 @@ function kt() {
|
|
|
1511
1511
|
) })
|
|
1512
1512
|
] })
|
|
1513
1513
|
] }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground/40 text-[10px]", children: "—" }) }),
|
|
1514
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */
|
|
1514
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-1.5", children: [
|
|
1515
1515
|
/* @__PURE__ */ e(
|
|
1516
1516
|
"button",
|
|
1517
1517
|
{
|
|
1518
1518
|
onClick: () => Fe(a),
|
|
1519
1519
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1520
|
-
title:
|
|
1520
|
+
title: r("edit"),
|
|
1521
1521
|
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" }) })
|
|
1522
1522
|
}
|
|
1523
1523
|
),
|
|
@@ -1525,10 +1525,10 @@ function kt() {
|
|
|
1525
1525
|
"button",
|
|
1526
1526
|
{
|
|
1527
1527
|
onClick: () => {
|
|
1528
|
-
V(a), B(String(a.balance?.tokens || 0)),
|
|
1528
|
+
V(a), B(String(a.balance?.tokens || 0)), P(String(a.balance?.requests || 0)), c(String(a.balance?.token_limit || 0)), p(String(a.balance?.request_limit || 0)), N("");
|
|
1529
1529
|
},
|
|
1530
1530
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1531
|
-
title:
|
|
1531
|
+
title: r("users.recharge"),
|
|
1532
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: "M2.25 18.75a60.07 60.07 0 0 1 15.797 2.101c.727.198 1.453-.342 1.453-1.096V18.75M3.75 4.5v.75A.75.75 0 0 1 3 6h-.75m0 0v-.375c0-.621.504-1.125 1.125-1.125H20.25M2.25 6v9m18-10.5v.75c0 .414.336.75.75.75h.75m-1.5-1.5h.375c.621 0 1.125.504 1.125 1.125v9.75c0 .621-.504 1.125-1.125 1.125h-.375m1.5-1.5H21a.75.75 0 0 0-.75.75v.75m0 0H3.75m0 0h-.375a1.125 1.125 0 0 1-1.125-1.125V15m1.5 1.5v-.75A.75.75 0 0 0 3 15h-.75M15 10.5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm3 0h.008v.008H18V10.5Zm-12 0h.008v.008H6V10.5Z" }) })
|
|
1533
1533
|
}
|
|
1534
1534
|
),
|
|
@@ -1537,35 +1537,35 @@ function kt() {
|
|
|
1537
1537
|
{
|
|
1538
1538
|
onClick: () => De(a),
|
|
1539
1539
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1540
|
-
title:
|
|
1540
|
+
title: r("users.copy_token"),
|
|
1541
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: "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" }) })
|
|
1542
1542
|
}
|
|
1543
1543
|
),
|
|
1544
1544
|
/* @__PURE__ */ e(
|
|
1545
1545
|
"button",
|
|
1546
1546
|
{
|
|
1547
|
-
onClick: () =>
|
|
1547
|
+
onClick: () => Y(a.id),
|
|
1548
1548
|
className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
|
|
1549
|
-
title:
|
|
1549
|
+
title: r("delete"),
|
|
1550
1550
|
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" }) })
|
|
1551
1551
|
}
|
|
1552
1552
|
)
|
|
1553
1553
|
] }) })
|
|
1554
1554
|
] }, a.id)) })
|
|
1555
1555
|
] }),
|
|
1556
|
-
m.length === 0 && !u && /* @__PURE__ */
|
|
1556
|
+
m.length === 0 && !u && /* @__PURE__ */ t("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
|
|
1557
1557
|
/* @__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" }) }),
|
|
1558
|
-
|
|
1558
|
+
r("users.no_users")
|
|
1559
1559
|
] }),
|
|
1560
|
-
u && /* @__PURE__ */
|
|
1560
|
+
u && /* @__PURE__ */ t("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-3", children: [
|
|
1561
1561
|
/* @__PURE__ */ e("div", { className: "w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin" }),
|
|
1562
|
-
/* @__PURE__ */ e("span", { children:
|
|
1562
|
+
/* @__PURE__ */ e("span", { children: r("loading") })
|
|
1563
1563
|
] })
|
|
1564
1564
|
] }) })
|
|
1565
1565
|
] });
|
|
1566
1566
|
}
|
|
1567
1567
|
function St() {
|
|
1568
|
-
const { t, i18n:
|
|
1568
|
+
const { t: r, i18n: i } = ee(["admin", "translation"]), [o, m] = b(null), [x, u] = b(!0), [v, _] = b(""), [N, H] = b(30), [T, A] = b(0), I = Ie(null), D = i.language === "fa", C = D ? "fa-IR" : "en-US", O = D ? "fa-IR-u-ca-persian" : "en-US";
|
|
1569
1569
|
W(() => {
|
|
1570
1570
|
z();
|
|
1571
1571
|
}, [N]), W(() => {
|
|
@@ -1577,34 +1577,34 @@ function St() {
|
|
|
1577
1577
|
return d.observe(I.current), () => d.disconnect();
|
|
1578
1578
|
}, []);
|
|
1579
1579
|
const U = (d, c, l) => {
|
|
1580
|
-
const
|
|
1580
|
+
const p = [], L = /* @__PURE__ */ new Date(), J = d || [], g = new Map(J.map((j) => [j.date, j]));
|
|
1581
1581
|
for (let j = c - 1; j >= 0; j--) {
|
|
1582
1582
|
const s = new Date(L.getTime() - j * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
|
1583
|
-
if (
|
|
1584
|
-
|
|
1583
|
+
if (g.has(s))
|
|
1584
|
+
p.push(g.get(s));
|
|
1585
1585
|
else {
|
|
1586
1586
|
const f = { date: s };
|
|
1587
|
-
l.forEach((q) => f[q] = 0),
|
|
1587
|
+
l.forEach((q) => f[q] = 0), p.push(f);
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
|
-
return
|
|
1590
|
+
return p;
|
|
1591
1591
|
}, y = (d) => {
|
|
1592
1592
|
if (!d || d.length === 0) return null;
|
|
1593
1593
|
const c = d.length, l = new Intl.DateTimeFormat(O, { month: "short" });
|
|
1594
|
-
let
|
|
1594
|
+
let p = [];
|
|
1595
1595
|
if (N <= 14)
|
|
1596
|
-
|
|
1596
|
+
p = Array.from({ length: c }, (L, J) => J);
|
|
1597
1597
|
else {
|
|
1598
|
-
const L = D ? 45 : 35,
|
|
1599
|
-
for (let j = 0; j < c; j +=
|
|
1600
|
-
|
|
1601
|
-
|
|
1598
|
+
const L = D ? 45 : 35, J = T > 0 ? Math.floor(T / L) : 6, g = Math.max(1, Math.ceil(c / Math.max(1, J)));
|
|
1599
|
+
for (let j = 0; j < c; j += g)
|
|
1600
|
+
p.push(j);
|
|
1601
|
+
p.length > 0 && p[p.length - 1] !== c - 1 && (c - 1 - p[p.length - 1] > g / 2 ? p.push(c - 1) : p[p.length - 1] = c - 1);
|
|
1602
1602
|
}
|
|
1603
|
-
return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: D ? "rtl" : "ltr", children:
|
|
1604
|
-
const
|
|
1605
|
-
if (!
|
|
1606
|
-
const
|
|
1607
|
-
return /* @__PURE__ */
|
|
1603
|
+
return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: D ? "rtl" : "ltr", children: p.map((L) => {
|
|
1604
|
+
const J = d[L];
|
|
1605
|
+
if (!J) return null;
|
|
1606
|
+
const g = new Date(J.date), j = g.toLocaleDateString(O, { day: "numeric" }), M = l.format(g), s = c > 1 ? L / (c - 1) * 100 : 50;
|
|
1607
|
+
return /* @__PURE__ */ t(
|
|
1608
1608
|
"div",
|
|
1609
1609
|
{
|
|
1610
1610
|
className: "absolute top-0 transform -translate-x-1/2 flex flex-col items-center",
|
|
@@ -1643,87 +1643,87 @@ function St() {
|
|
|
1643
1643
|
};
|
|
1644
1644
|
m(c);
|
|
1645
1645
|
} catch (d) {
|
|
1646
|
-
_(d instanceof Error ? d.message :
|
|
1646
|
+
_(d instanceof Error ? d.message : r("analytics.error_loading"));
|
|
1647
1647
|
} finally {
|
|
1648
1648
|
u(!1);
|
|
1649
1649
|
}
|
|
1650
1650
|
};
|
|
1651
1651
|
if (x)
|
|
1652
|
-
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground", children:
|
|
1652
|
+
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground", children: r("analytics.loading_analytics") });
|
|
1653
1653
|
if (v)
|
|
1654
|
-
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */
|
|
1654
|
+
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ t("div", { className: "text-center", children: [
|
|
1655
1655
|
/* @__PURE__ */ e("div", { className: "text-destructive mb-4", children: v }),
|
|
1656
1656
|
/* @__PURE__ */ e(
|
|
1657
1657
|
"button",
|
|
1658
1658
|
{
|
|
1659
1659
|
onClick: z,
|
|
1660
1660
|
className: "px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-colors",
|
|
1661
|
-
children:
|
|
1661
|
+
children: r("retry")
|
|
1662
1662
|
}
|
|
1663
1663
|
)
|
|
1664
1664
|
] }) });
|
|
1665
1665
|
if (!o) return null;
|
|
1666
1666
|
const R = (d) => {
|
|
1667
1667
|
if (d <= 0) return 10;
|
|
1668
|
-
const c = d * 1.15, l = Math.pow(10, Math.floor(Math.log10(c))),
|
|
1668
|
+
const c = d * 1.15, l = Math.pow(10, Math.floor(Math.log10(c))), p = c / l;
|
|
1669
1669
|
let L;
|
|
1670
|
-
return
|
|
1671
|
-
}, 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), h = R(V),
|
|
1672
|
-
return /* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1674
|
-
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children:
|
|
1670
|
+
return p <= 1.2 ? L = 0.2 : p <= 2.5 ? L = 0.5 : p <= 5 ? L = 1 : L = 2, Math.ceil(c / (L * l)) * (L * l);
|
|
1671
|
+
}, 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), h = R(V), P = R(Z);
|
|
1672
|
+
return /* @__PURE__ */ t("div", { className: "h-full overflow-auto p-5 flex flex-col gap-5", dir: D ? "rtl" : "ltr", children: [
|
|
1673
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3", children: [
|
|
1674
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: r("analytics.title") }),
|
|
1675
1675
|
/* @__PURE__ */ e("div", { className: "flex gap-2", children: [7, 14, 30, 90].map((d) => /* @__PURE__ */ e(
|
|
1676
1676
|
"button",
|
|
1677
1677
|
{
|
|
1678
1678
|
onClick: () => H(d),
|
|
1679
1679
|
className: `px-4 py-2 text-sm font-medium rounded-xl transition-all shadow-sm ${N === d ? "bg-primary text-primary-foreground shadow-md" : "bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground border border-border/50"}`,
|
|
1680
|
-
children:
|
|
1680
|
+
children: r("analytics.days", { count: d })
|
|
1681
1681
|
},
|
|
1682
1682
|
d
|
|
1683
1683
|
)) })
|
|
1684
1684
|
] }),
|
|
1685
|
-
/* @__PURE__ */
|
|
1686
|
-
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */
|
|
1687
|
-
/* @__PURE__ */
|
|
1688
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children:
|
|
1685
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
|
|
1686
|
+
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
1687
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1688
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: r("analytics.total_users") }),
|
|
1689
1689
|
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_users || 0).toLocaleString(C) })
|
|
1690
1690
|
] }),
|
|
1691
1691
|
/* @__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" }) }) })
|
|
1692
1692
|
] }) }),
|
|
1693
|
-
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */
|
|
1694
|
-
/* @__PURE__ */
|
|
1695
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children:
|
|
1693
|
+
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
1694
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1695
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: r("analytics.total_threads") }),
|
|
1696
1696
|
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_threads || 0).toLocaleString(C) })
|
|
1697
1697
|
] }),
|
|
1698
1698
|
/* @__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" }) }) })
|
|
1699
1699
|
] }) }),
|
|
1700
|
-
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */
|
|
1701
|
-
/* @__PURE__ */
|
|
1702
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children:
|
|
1700
|
+
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
1701
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1702
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: r("analytics.total_messages") }),
|
|
1703
1703
|
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_messages || 0).toLocaleString(C) })
|
|
1704
1704
|
] }),
|
|
1705
1705
|
/* @__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" }) }) })
|
|
1706
1706
|
] }) }),
|
|
1707
|
-
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */
|
|
1708
|
-
/* @__PURE__ */
|
|
1709
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children:
|
|
1707
|
+
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
1708
|
+
/* @__PURE__ */ t("div", { children: [
|
|
1709
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: r("analytics.total_token_usage") }),
|
|
1710
1710
|
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_token_usage || 0).toLocaleString(C) })
|
|
1711
1711
|
] }),
|
|
1712
1712
|
/* @__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" }) }) })
|
|
1713
1713
|
] }) })
|
|
1714
1714
|
] }),
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children:
|
|
1718
|
-
/* @__PURE__ */
|
|
1719
|
-
/* @__PURE__ */
|
|
1720
|
-
/* @__PURE__ */
|
|
1715
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: [
|
|
1716
|
+
/* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1717
|
+
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.threads_chart") }),
|
|
1718
|
+
/* @__PURE__ */ t("div", { className: "h-64 flex flex-col", ref: I, children: [
|
|
1719
|
+
/* @__PURE__ */ t("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
1720
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
|
|
1721
1721
|
/* @__PURE__ */ e("span", { children: (B || 0).toLocaleString(C) }),
|
|
1722
1722
|
/* @__PURE__ */ e("span", { children: Math.floor((B || 0) / 2).toLocaleString(C) }),
|
|
1723
1723
|
/* @__PURE__ */ e("span", { children: "0" })
|
|
1724
1724
|
] }),
|
|
1725
|
-
/* @__PURE__ */
|
|
1726
|
-
/* @__PURE__ */
|
|
1725
|
+
/* @__PURE__ */ t("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
1726
|
+
/* @__PURE__ */ t("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
|
|
1727
1727
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
1728
1728
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
1729
1729
|
] }),
|
|
@@ -1732,31 +1732,31 @@ function St() {
|
|
|
1732
1732
|
{
|
|
1733
1733
|
className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
|
|
1734
1734
|
style: { height: `${d.count / B * 100}%` },
|
|
1735
|
-
children: /* @__PURE__ */
|
|
1735
|
+
children: /* @__PURE__ */ t("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: [
|
|
1736
1736
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: d.count.toLocaleString(C) }),
|
|
1737
1737
|
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(d.date).toLocaleDateString(O, { month: "short", day: "numeric" }) })
|
|
1738
1738
|
] })
|
|
1739
1739
|
}
|
|
1740
|
-
) }, c)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children:
|
|
1740
|
+
) }, c)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: r("no_data") })
|
|
1741
1741
|
] })
|
|
1742
1742
|
] }),
|
|
1743
|
-
/* @__PURE__ */
|
|
1743
|
+
/* @__PURE__ */ t("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
1744
1744
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
1745
1745
|
y(o.trends.threads)
|
|
1746
1746
|
] })
|
|
1747
1747
|
] })
|
|
1748
1748
|
] }),
|
|
1749
|
-
/* @__PURE__ */
|
|
1750
|
-
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children:
|
|
1751
|
-
/* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1753
|
-
/* @__PURE__ */
|
|
1749
|
+
/* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1750
|
+
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.messages_chart") }),
|
|
1751
|
+
/* @__PURE__ */ t("div", { className: "h-64 flex flex-col", ref: I, children: [
|
|
1752
|
+
/* @__PURE__ */ t("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
1753
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
|
|
1754
1754
|
/* @__PURE__ */ e("span", { children: (h || 0).toLocaleString(C) }),
|
|
1755
1755
|
/* @__PURE__ */ e("span", { children: Math.floor((h || 0) / 2).toLocaleString(C) }),
|
|
1756
1756
|
/* @__PURE__ */ e("span", { children: "0" })
|
|
1757
1757
|
] }),
|
|
1758
|
-
/* @__PURE__ */
|
|
1759
|
-
/* @__PURE__ */
|
|
1758
|
+
/* @__PURE__ */ t("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
1759
|
+
/* @__PURE__ */ t("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
|
|
1760
1760
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
1761
1761
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
1762
1762
|
] }),
|
|
@@ -1765,31 +1765,31 @@ function St() {
|
|
|
1765
1765
|
{
|
|
1766
1766
|
className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
|
|
1767
1767
|
style: { height: `${d.count / h * 100}%` },
|
|
1768
|
-
children: /* @__PURE__ */
|
|
1768
|
+
children: /* @__PURE__ */ t("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: [
|
|
1769
1769
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: d.count.toLocaleString(C) }),
|
|
1770
1770
|
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(d.date).toLocaleDateString(O, { month: "short", day: "numeric" }) })
|
|
1771
1771
|
] })
|
|
1772
1772
|
}
|
|
1773
|
-
) }, c)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children:
|
|
1773
|
+
) }, c)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: r("no_data") })
|
|
1774
1774
|
] })
|
|
1775
1775
|
] }),
|
|
1776
|
-
/* @__PURE__ */
|
|
1776
|
+
/* @__PURE__ */ t("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
1777
1777
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
1778
1778
|
y(o.trends.messages)
|
|
1779
1779
|
] })
|
|
1780
1780
|
] })
|
|
1781
1781
|
] }),
|
|
1782
|
-
/* @__PURE__ */
|
|
1783
|
-
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children:
|
|
1784
|
-
/* @__PURE__ */
|
|
1785
|
-
/* @__PURE__ */
|
|
1786
|
-
/* @__PURE__ */
|
|
1787
|
-
/* @__PURE__ */ e("span", { children: (
|
|
1788
|
-
/* @__PURE__ */ e("span", { children: Math.floor((
|
|
1782
|
+
/* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1783
|
+
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.token_usage_chart") }),
|
|
1784
|
+
/* @__PURE__ */ t("div", { className: "h-64 flex flex-col", ref: I, children: [
|
|
1785
|
+
/* @__PURE__ */ t("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
1786
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
|
|
1787
|
+
/* @__PURE__ */ e("span", { children: (P || 0).toLocaleString(C) }),
|
|
1788
|
+
/* @__PURE__ */ e("span", { children: Math.floor((P || 0) / 2).toLocaleString(C) }),
|
|
1789
1789
|
/* @__PURE__ */ e("span", { children: "0" })
|
|
1790
1790
|
] }),
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1791
|
+
/* @__PURE__ */ t("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
1792
|
+
/* @__PURE__ */ t("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
|
|
1793
1793
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
1794
1794
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
1795
1795
|
] }),
|
|
@@ -1797,32 +1797,32 @@ function St() {
|
|
|
1797
1797
|
"div",
|
|
1798
1798
|
{
|
|
1799
1799
|
className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
|
|
1800
|
-
style: { height: `${d.tokens /
|
|
1801
|
-
children: /* @__PURE__ */
|
|
1800
|
+
style: { height: `${d.tokens / P * 100}%` },
|
|
1801
|
+
children: /* @__PURE__ */ t("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: [
|
|
1802
1802
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: (d.tokens || 0).toLocaleString(C) }),
|
|
1803
1803
|
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(d.date).toLocaleDateString(O, { month: "short", day: "numeric" }) })
|
|
1804
1804
|
] })
|
|
1805
1805
|
}
|
|
1806
|
-
) }, c)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children:
|
|
1806
|
+
) }, c)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: r("no_data") })
|
|
1807
1807
|
] })
|
|
1808
1808
|
] }),
|
|
1809
|
-
/* @__PURE__ */
|
|
1809
|
+
/* @__PURE__ */ t("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
1810
1810
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
1811
1811
|
y(o.trends.token_usage)
|
|
1812
1812
|
] })
|
|
1813
1813
|
] })
|
|
1814
1814
|
] }),
|
|
1815
|
-
/* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children:
|
|
1817
|
-
/* @__PURE__ */ e("div", { className: "h-64 flex flex-col justify-center", children: o.distributions.feedback_sentiment.length > 0 ? /* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1815
|
+
/* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1816
|
+
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.feedback") }),
|
|
1817
|
+
/* @__PURE__ */ e("div", { className: "h-64 flex flex-col justify-center", children: o.distributions.feedback_sentiment.length > 0 ? /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row items-center justify-center gap-8 lg:gap-12", children: [
|
|
1818
|
+
/* @__PURE__ */ t("div", { className: "relative w-56 h-56 lg:w-60 lg:h-60", children: [
|
|
1819
1819
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 100", className: "w-full h-full -rotate-90 drop-shadow-md", children: (() => {
|
|
1820
1820
|
const d = o.distributions.feedback_sentiment.filter(
|
|
1821
1821
|
(M) => M.sentiment === "positive" || M.sentiment === "negative"
|
|
1822
1822
|
), c = d.reduce((M, s) => M + s.count, 0);
|
|
1823
1823
|
if (c === 0) return null;
|
|
1824
|
-
const l = d.find((M) => M.sentiment === "positive")?.count || 0,
|
|
1825
|
-
return /* @__PURE__ */
|
|
1824
|
+
const l = d.find((M) => M.sentiment === "positive")?.count || 0, p = d.find((M) => M.sentiment === "negative")?.count || 0, L = 40, J = 2 * Math.PI * L, g = l / c * 100, j = p / c * 100;
|
|
1825
|
+
return /* @__PURE__ */ t(Ue, { children: [
|
|
1826
1826
|
/* @__PURE__ */ e(
|
|
1827
1827
|
"circle",
|
|
1828
1828
|
{
|
|
@@ -1835,12 +1835,12 @@ function St() {
|
|
|
1835
1835
|
className: "text-muted"
|
|
1836
1836
|
}
|
|
1837
1837
|
),
|
|
1838
|
-
/* @__PURE__ */
|
|
1839
|
-
/* @__PURE__ */
|
|
1838
|
+
/* @__PURE__ */ t("defs", { children: [
|
|
1839
|
+
/* @__PURE__ */ t("linearGradient", { id: "posGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
|
|
1840
1840
|
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: "var(--primary)", stopOpacity: "0.8" }),
|
|
1841
1841
|
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: "var(--primary)" })
|
|
1842
1842
|
] }),
|
|
1843
|
-
/* @__PURE__ */
|
|
1843
|
+
/* @__PURE__ */ t("linearGradient", { id: "negGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", children: [
|
|
1844
1844
|
/* @__PURE__ */ e("stop", { offset: "0%", stopColor: "var(--destructive)", stopOpacity: "0.8" }),
|
|
1845
1845
|
/* @__PURE__ */ e("stop", { offset: "100%", stopColor: "var(--destructive)" })
|
|
1846
1846
|
] })
|
|
@@ -1854,8 +1854,8 @@ function St() {
|
|
|
1854
1854
|
fill: "transparent",
|
|
1855
1855
|
stroke: "url(#posGradient)",
|
|
1856
1856
|
strokeWidth: "10",
|
|
1857
|
-
strokeDasharray: `${
|
|
1858
|
-
strokeLinecap:
|
|
1857
|
+
strokeDasharray: `${g / 100 * J} ${J}`,
|
|
1858
|
+
strokeLinecap: g > 0 ? "round" : "butt",
|
|
1859
1859
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
1860
1860
|
}
|
|
1861
1861
|
),
|
|
@@ -1868,38 +1868,38 @@ function St() {
|
|
|
1868
1868
|
fill: "transparent",
|
|
1869
1869
|
stroke: "url(#negGradient)",
|
|
1870
1870
|
strokeWidth: "10",
|
|
1871
|
-
strokeDasharray: `${j / 100 *
|
|
1872
|
-
strokeDashoffset: -(
|
|
1871
|
+
strokeDasharray: `${j / 100 * J} ${J}`,
|
|
1872
|
+
strokeDashoffset: -(g / 100 * J),
|
|
1873
1873
|
strokeLinecap: j > 0 ? "round" : "butt",
|
|
1874
1874
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
1875
1875
|
}
|
|
1876
1876
|
)
|
|
1877
1877
|
] });
|
|
1878
1878
|
})() }),
|
|
1879
|
-
/* @__PURE__ */
|
|
1879
|
+
/* @__PURE__ */ t("div", { className: "absolute inset-0 flex flex-col items-center justify-center pointer-events-none", children: [
|
|
1880
1880
|
/* @__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) }),
|
|
1881
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground uppercase tracking-widest mt-1", children:
|
|
1881
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground uppercase tracking-widest mt-1", children: r("analytics.total_feedback") })
|
|
1882
1882
|
] })
|
|
1883
1883
|
] }),
|
|
1884
1884
|
/* @__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) => {
|
|
1885
1885
|
const l = o.distributions.feedback_sentiment.filter(
|
|
1886
1886
|
(j) => j.sentiment === "positive" || j.sentiment === "negative"
|
|
1887
|
-
).reduce((j, M) => j + M.count, 0),
|
|
1888
|
-
return /* @__PURE__ */
|
|
1889
|
-
/* @__PURE__ */
|
|
1890
|
-
/* @__PURE__ */ e("div", { className: `w-3 h-3 rounded-full ${
|
|
1891
|
-
/* @__PURE__ */
|
|
1887
|
+
).reduce((j, M) => j + M.count, 0), p = l > 0 ? d.count / l * 100 : 0, L = d.sentiment === "positive" ? r("analytics.positive") : r("analytics.negative"), J = d.sentiment === "positive" ? "bg-primary" : "bg-destructive", g = d.sentiment === "positive" ? "👍" : "👎";
|
|
1888
|
+
return /* @__PURE__ */ t("div", { className: "flex items-center justify-between gap-6 group", children: [
|
|
1889
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
|
|
1890
|
+
/* @__PURE__ */ e("div", { className: `w-3 h-3 rounded-full ${J} shadow-sm group-hover:scale-110 transition-transform` }),
|
|
1891
|
+
/* @__PURE__ */ t("span", { className: "text-sm text-muted-foreground font-medium", children: [
|
|
1892
1892
|
L,
|
|
1893
1893
|
" ",
|
|
1894
|
-
|
|
1894
|
+
g
|
|
1895
1895
|
] })
|
|
1896
1896
|
] }),
|
|
1897
|
-
/* @__PURE__ */
|
|
1898
|
-
/* @__PURE__ */
|
|
1899
|
-
(
|
|
1897
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
1898
|
+
/* @__PURE__ */ t("span", { className: "text-sm font-semibold text-foreground bg-muted/50 px-2.5 py-1 rounded-lg min-w-[50px] text-center", children: [
|
|
1899
|
+
(p || 0).toLocaleString(C, { maximumFractionDigits: 0 }),
|
|
1900
1900
|
"%"
|
|
1901
1901
|
] }),
|
|
1902
|
-
/* @__PURE__ */
|
|
1902
|
+
/* @__PURE__ */ t("span", { className: "text-[13px] font-normal text-muted-foreground w-12 text-right", children: [
|
|
1903
1903
|
"(",
|
|
1904
1904
|
(d.count || 0).toLocaleString(C),
|
|
1905
1905
|
")"
|
|
@@ -1907,42 +1907,42 @@ function St() {
|
|
|
1907
1907
|
] })
|
|
1908
1908
|
] }, d.sentiment);
|
|
1909
1909
|
}) })
|
|
1910
|
-
] }) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children:
|
|
1910
|
+
] }) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children: r("no_data") }) })
|
|
1911
1911
|
] })
|
|
1912
1912
|
] }),
|
|
1913
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: /* @__PURE__ */
|
|
1914
|
-
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children:
|
|
1915
|
-
/* @__PURE__ */ e("div", { className: "space-y-2.5", children: o.active_users.length > 0 ? o.active_users.map((d) => /* @__PURE__ */
|
|
1913
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: /* @__PURE__ */ t("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1914
|
+
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: r("analytics.active_users") }),
|
|
1915
|
+
/* @__PURE__ */ e("div", { className: "h-64 overflow-y-auto pr-1", children: /* @__PURE__ */ e("div", { className: "space-y-2.5", children: o.active_users.length > 0 ? o.active_users.slice(0, 5).map((d) => /* @__PURE__ */ t(
|
|
1916
1916
|
"div",
|
|
1917
1917
|
{
|
|
1918
1918
|
className: "flex items-center justify-between p-3 bg-muted/30 rounded-xl hover:bg-muted/50 transition-colors",
|
|
1919
1919
|
children: [
|
|
1920
|
-
/* @__PURE__ */
|
|
1920
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
|
|
1921
1921
|
/* @__PURE__ */ e("div", { className: "w-9 h-9 rounded-full bg-primary/10 flex items-center justify-center text-primary text-sm font-medium", children: d.name.charAt(0) }),
|
|
1922
1922
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground", children: d.name }) })
|
|
1923
1923
|
] }),
|
|
1924
|
-
/* @__PURE__ */
|
|
1924
|
+
/* @__PURE__ */ t("div", { className: "text-sm font-semibold text-primary", children: [
|
|
1925
1925
|
(d.thread_count || 0).toLocaleString(C),
|
|
1926
1926
|
" ",
|
|
1927
|
-
|
|
1927
|
+
r("analytics.threads")
|
|
1928
1928
|
] })
|
|
1929
1929
|
]
|
|
1930
1930
|
},
|
|
1931
1931
|
d.user_id
|
|
1932
|
-
)) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children:
|
|
1932
|
+
)) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children: r("no_data") }) }) })
|
|
1933
1933
|
] }) })
|
|
1934
1934
|
] });
|
|
1935
1935
|
}
|
|
1936
|
-
function
|
|
1936
|
+
function X({ className: r, ...i }) {
|
|
1937
1937
|
return /* @__PURE__ */ e(
|
|
1938
1938
|
Ae.Root,
|
|
1939
1939
|
{
|
|
1940
1940
|
"data-slot": "switch",
|
|
1941
1941
|
className: be(
|
|
1942
1942
|
"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",
|
|
1943
|
-
|
|
1943
|
+
r
|
|
1944
1944
|
),
|
|
1945
|
-
...
|
|
1945
|
+
...i,
|
|
1946
1946
|
children: /* @__PURE__ */ e(
|
|
1947
1947
|
Ae.Thumb,
|
|
1948
1948
|
{
|
|
@@ -1956,7 +1956,7 @@ function Y({ className: t, ...n }) {
|
|
|
1956
1956
|
);
|
|
1957
1957
|
}
|
|
1958
1958
|
function Ct() {
|
|
1959
|
-
const { t, i18n:
|
|
1959
|
+
const { t: r, i18n: i } = ee(["admin", "translation", "settings"]), { app: o, welcome: m, disclaimer: x, history: u, threadActions: v, composer: _, settings: N } = me(), [H, T] = b(!1), [A, I] = b(!1), [D, C] = b(""), [O, U] = b(""), [y, z] = b("fa"), [R, E] = b("translation"), [V, Z] = b("{}"), [B, h] = b(""), [P, d] = b(!1), c = pe(() => ({
|
|
1960
1960
|
app_name: o?.name || "Gentiq",
|
|
1961
1961
|
admin_title: o?.adminTitle || "",
|
|
1962
1962
|
welcome_greeting: m?.greeting || "",
|
|
@@ -1964,6 +1964,9 @@ function Ct() {
|
|
|
1964
1964
|
disclaimer: typeof x == "string" ? x : "",
|
|
1965
1965
|
show_tool_details: o?.showToolDetails ?? !0,
|
|
1966
1966
|
show_settings: o?.showSettings ?? !0,
|
|
1967
|
+
show_version_in_settings: o?.showVersionInSettings ?? !0,
|
|
1968
|
+
disable_signup: o?.disableSignup ?? !1,
|
|
1969
|
+
disable_auth_page: o?.disableAuthPage ?? !1,
|
|
1967
1970
|
composer_attachments: _?.attachments?.enabled ?? !0,
|
|
1968
1971
|
thread_actions_feedback: v?.feedback ?? !0,
|
|
1969
1972
|
thread_actions_retry: v?.retry ?? !0,
|
|
@@ -1978,64 +1981,64 @@ function Ct() {
|
|
|
1978
1981
|
settings_general_fields: N?.sections?.general?.fields || {},
|
|
1979
1982
|
settings_profile_fields: N?.sections?.profile?.fields || {},
|
|
1980
1983
|
settings_account_fields: N?.sections?.account?.fields || {},
|
|
1981
|
-
language:
|
|
1984
|
+
language: i.language || "fa",
|
|
1982
1985
|
initial_balance_tokens: 25e4,
|
|
1983
1986
|
initial_balance_requests: 100,
|
|
1984
1987
|
translations: {}
|
|
1985
|
-
}), [o, m, x, u, v, _,
|
|
1988
|
+
}), [o, m, x, u, v, _, i.language, N]), [l, p] = b(c), L = i.language === "fa";
|
|
1986
1989
|
W(() => {
|
|
1987
1990
|
(async () => {
|
|
1988
1991
|
T(!0);
|
|
1989
1992
|
try {
|
|
1990
1993
|
const w = await k.getSettings();
|
|
1991
1994
|
if (w && Object.keys(w).length > 0) {
|
|
1992
|
-
const F = JSON.parse(JSON.stringify(
|
|
1993
|
-
w.translations && Object.keys(w.translations).forEach((
|
|
1994
|
-
F[
|
|
1995
|
-
}),
|
|
1996
|
-
...
|
|
1995
|
+
const F = JSON.parse(JSON.stringify(i.store.data));
|
|
1996
|
+
w.translations && Object.keys(w.translations).forEach((Y) => {
|
|
1997
|
+
F[Y] || (F[Y] = {}), Object.assign(F[Y], w.translations[Y]);
|
|
1998
|
+
}), p((Y) => ({
|
|
1999
|
+
...Y,
|
|
1997
2000
|
...w,
|
|
1998
2001
|
translations: F
|
|
1999
2002
|
}));
|
|
2000
2003
|
} else {
|
|
2001
|
-
const F = { ...c, translations:
|
|
2002
|
-
|
|
2004
|
+
const F = { ...c, translations: i.store.data };
|
|
2005
|
+
p(F), w || k.updateSettings(F).catch(console.error);
|
|
2003
2006
|
}
|
|
2004
2007
|
} catch (w) {
|
|
2005
|
-
console.error("Failed to fetch settings", w), C(
|
|
2008
|
+
console.error("Failed to fetch settings", w), C(r("app_settings.save_error"));
|
|
2006
2009
|
} finally {
|
|
2007
2010
|
T(!1);
|
|
2008
2011
|
}
|
|
2009
2012
|
})();
|
|
2010
|
-
}, [
|
|
2011
|
-
const
|
|
2012
|
-
|
|
2013
|
+
}, [r, c, i.store.data]);
|
|
2014
|
+
const J = async (n) => {
|
|
2015
|
+
n && n.preventDefault(), I(!0), U(""), C("");
|
|
2013
2016
|
try {
|
|
2014
|
-
await k.updateSettings(l), U(
|
|
2017
|
+
await k.updateSettings(l), U(r("app_settings.save_success")), setTimeout(() => U(""), 3e3);
|
|
2015
2018
|
} catch (w) {
|
|
2016
|
-
C(w instanceof Error ? w.message :
|
|
2019
|
+
C(w instanceof Error ? w.message : r("app_settings.save_error"));
|
|
2017
2020
|
} finally {
|
|
2018
2021
|
I(!1);
|
|
2019
2022
|
}
|
|
2020
|
-
},
|
|
2023
|
+
}, g = async () => {
|
|
2021
2024
|
T(!0), C("");
|
|
2022
2025
|
try {
|
|
2023
2026
|
await k.resetSettings(), d(!1), window.location.reload();
|
|
2024
|
-
} catch (
|
|
2025
|
-
C(
|
|
2027
|
+
} catch (n) {
|
|
2028
|
+
C(n instanceof Error ? n.message : r("app_settings.save_error"));
|
|
2026
2029
|
} finally {
|
|
2027
2030
|
T(!1);
|
|
2028
2031
|
}
|
|
2029
2032
|
};
|
|
2030
2033
|
W(() => {
|
|
2031
|
-
const
|
|
2032
|
-
Z(JSON.stringify(
|
|
2034
|
+
const n = l.translations?.[y]?.[R] || {};
|
|
2035
|
+
Z(JSON.stringify(n, null, 2)), h("");
|
|
2033
2036
|
}, [y, R, l.translations]);
|
|
2034
|
-
const j = (
|
|
2035
|
-
Z(
|
|
2037
|
+
const j = (n) => {
|
|
2038
|
+
Z(n);
|
|
2036
2039
|
try {
|
|
2037
|
-
const w = JSON.parse(
|
|
2038
|
-
|
|
2040
|
+
const w = JSON.parse(n);
|
|
2041
|
+
p((F) => ({
|
|
2039
2042
|
...F,
|
|
2040
2043
|
translations: {
|
|
2041
2044
|
...F.translations,
|
|
@@ -2048,78 +2051,84 @@ function Ct() {
|
|
|
2048
2051
|
} catch {
|
|
2049
2052
|
h("Invalid JSON format");
|
|
2050
2053
|
}
|
|
2051
|
-
}, M = ({ title:
|
|
2054
|
+
}, M = ({ title: n, icon: w }) => /* @__PURE__ */ t("div", { className: "relative py-12", children: [
|
|
2052
2055
|
/* @__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" }) }),
|
|
2053
|
-
/* @__PURE__ */ e("div", { className: "relative flex justify-center", children: /* @__PURE__ */
|
|
2056
|
+
/* @__PURE__ */ e("div", { className: "relative flex justify-center", children: /* @__PURE__ */ t("span", { className: "bg-background px-6 text-sm font-bold text-muted-foreground uppercase tracking-[0.2em] flex items-center gap-3", children: [
|
|
2054
2057
|
/* @__PURE__ */ e(w, { className: "size-4 text-primary/60" }),
|
|
2055
|
-
|
|
2058
|
+
n
|
|
2056
2059
|
] }) })
|
|
2057
|
-
] }), s = ({ value:
|
|
2058
|
-
if (!
|
|
2059
|
-
const w =
|
|
2060
|
-
return w ===
|
|
2061
|
-
/* @__PURE__ */
|
|
2062
|
-
|
|
2060
|
+
] }), s = ({ value: n }) => {
|
|
2061
|
+
if (!n || !n.includes(":") && !n.includes(".")) return null;
|
|
2062
|
+
const w = r(n);
|
|
2063
|
+
return w === n ? null : /* @__PURE__ */ t("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: [
|
|
2064
|
+
/* @__PURE__ */ t("span", { className: "text-[10px] font-bold text-primary/60 uppercase tracking-tighter", children: [
|
|
2065
|
+
r("app_settings.preview", { defaultValue: "Preview" }),
|
|
2063
2066
|
":"
|
|
2064
2067
|
] }),
|
|
2065
2068
|
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children: w })
|
|
2066
2069
|
] });
|
|
2067
2070
|
}, f = () => {
|
|
2068
|
-
const
|
|
2069
|
-
|
|
2071
|
+
const n = prompt("Enter language code (e.g. en, fa, fr):");
|
|
2072
|
+
n && !l.translations?.[n] && (p((w) => ({
|
|
2070
2073
|
...w,
|
|
2071
2074
|
translations: {
|
|
2072
2075
|
...w.translations,
|
|
2073
|
-
[
|
|
2076
|
+
[n]: {}
|
|
2074
2077
|
}
|
|
2075
|
-
})), z(
|
|
2078
|
+
})), z(n));
|
|
2076
2079
|
}, q = () => {
|
|
2077
|
-
const
|
|
2078
|
-
|
|
2080
|
+
const n = prompt("Enter namespace (e.g. chat, admin):");
|
|
2081
|
+
n && !l.translations?.[y]?.[n] && (p((w) => ({
|
|
2079
2082
|
...w,
|
|
2080
2083
|
translations: {
|
|
2081
2084
|
...w.translations,
|
|
2082
2085
|
[y]: {
|
|
2083
2086
|
...w.translations?.[y],
|
|
2084
|
-
[
|
|
2087
|
+
[n]: {}
|
|
2085
2088
|
}
|
|
2086
2089
|
}
|
|
2087
|
-
})), E(
|
|
2090
|
+
})), E(n));
|
|
2088
2091
|
};
|
|
2089
|
-
return H ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */
|
|
2092
|
+
return H ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ t("div", { className: "flex flex-col items-center gap-3", children: [
|
|
2090
2093
|
/* @__PURE__ */ e("div", { className: "w-10 h-10 border-3 border-primary/20 border-t-primary rounded-full animate-spin" }),
|
|
2091
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground font-medium", children:
|
|
2092
|
-
] }) }) : /* @__PURE__ */
|
|
2093
|
-
/* @__PURE__ */
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2096
|
-
|
|
2094
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground font-medium", children: r("loading") })
|
|
2095
|
+
] }) }) : /* @__PURE__ */ t("div", { className: "h-full flex flex-col overflow-hidden", dir: L ? "rtl" : "ltr", children: [
|
|
2096
|
+
/* @__PURE__ */ t("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: [
|
|
2097
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col gap-1", children: [
|
|
2098
|
+
/* @__PURE__ */ t("div", { className: "flex items-baseline gap-3 flex-wrap", children: [
|
|
2099
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight", children: r("app_settings.title") }),
|
|
2100
|
+
o?.version && /* @__PURE__ */ t("span", { className: "text-sm text-muted-foreground font-mono", dir: "ltr", children: [
|
|
2101
|
+
"v",
|
|
2102
|
+
o.version
|
|
2103
|
+
] })
|
|
2104
|
+
] }),
|
|
2105
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: r("app_settings.subtitle") })
|
|
2097
2106
|
] }),
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
2100
|
-
/* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */
|
|
2107
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-4", children: [
|
|
2108
|
+
/* @__PURE__ */ t(Be, { open: P, onOpenChange: d, children: [
|
|
2109
|
+
/* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */ t(
|
|
2101
2110
|
"button",
|
|
2102
2111
|
{
|
|
2103
2112
|
type: "button",
|
|
2104
2113
|
className: "px-4 py-2 bg-muted/20 text-muted-foreground hover:bg-muted/40 rounded-xl text-xs font-bold transition-all flex items-center gap-2 border border-border/50",
|
|
2105
2114
|
children: [
|
|
2106
2115
|
/* @__PURE__ */ e(qe, { className: "size-3.5" }),
|
|
2107
|
-
|
|
2116
|
+
r("app_settings.reset_button", { defaultValue: "Reset to Defaults" })
|
|
2108
2117
|
]
|
|
2109
2118
|
}
|
|
2110
2119
|
) }),
|
|
2111
|
-
/* @__PURE__ */
|
|
2112
|
-
/* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */ e(Ke, { children:
|
|
2114
|
-
/* @__PURE__ */ e(Ze, { children:
|
|
2120
|
+
/* @__PURE__ */ t(We, { children: [
|
|
2121
|
+
/* @__PURE__ */ t(Ge, { children: [
|
|
2122
|
+
/* @__PURE__ */ e(Ke, { children: r("app_settings.reset_confirm_title") }),
|
|
2123
|
+
/* @__PURE__ */ e(Ze, { children: r("app_settings.reset_confirm_description") })
|
|
2115
2124
|
] }),
|
|
2116
|
-
/* @__PURE__ */
|
|
2117
|
-
/* @__PURE__ */ e(Xe, { asChild: !0, children: /* @__PURE__ */ e(he, { variant: "ghost", children:
|
|
2118
|
-
/* @__PURE__ */ e(he, { variant: "destructive", onClick:
|
|
2125
|
+
/* @__PURE__ */ t(Qe, { children: [
|
|
2126
|
+
/* @__PURE__ */ e(Xe, { asChild: !0, children: /* @__PURE__ */ e(he, { variant: "ghost", children: r("cancel") }) }),
|
|
2127
|
+
/* @__PURE__ */ e(he, { variant: "destructive", onClick: g, children: r("app_settings.reset_button") })
|
|
2119
2128
|
] })
|
|
2120
2129
|
] })
|
|
2121
2130
|
] }),
|
|
2122
|
-
/* @__PURE__ */
|
|
2131
|
+
/* @__PURE__ */ t(
|
|
2123
2132
|
"button",
|
|
2124
2133
|
{
|
|
2125
2134
|
type: "submit",
|
|
@@ -2128,27 +2137,27 @@ function Ct() {
|
|
|
2128
2137
|
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",
|
|
2129
2138
|
children: [
|
|
2130
2139
|
A && /* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-primary-foreground/20 border-t-primary-foreground rounded-full animate-spin" }),
|
|
2131
|
-
|
|
2140
|
+
r(A ? "saving" : "app_settings.save")
|
|
2132
2141
|
]
|
|
2133
2142
|
}
|
|
2134
2143
|
)
|
|
2135
2144
|
] })
|
|
2136
2145
|
] }),
|
|
2137
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto custom-scrollbar", children: /* @__PURE__ */
|
|
2146
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto custom-scrollbar", children: /* @__PURE__ */ t("div", { className: "max-w-4xl mx-auto py-10 px-8", children: [
|
|
2138
2147
|
(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 }),
|
|
2139
|
-
/* @__PURE__ */
|
|
2140
|
-
/* @__PURE__ */
|
|
2141
|
-
/* @__PURE__ */ e(M, { title:
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2144
|
-
/* @__PURE__ */
|
|
2145
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
2148
|
+
/* @__PURE__ */ t("form", { id: "settings-form", onSubmit: J, className: "space-y-16 animate-in fade-in slide-in-from-bottom-2 duration-500", children: [
|
|
2149
|
+
/* @__PURE__ */ t("section", { children: [
|
|
2150
|
+
/* @__PURE__ */ e(M, { title: r("app_settings.sections.general"), icon: xe }),
|
|
2151
|
+
/* @__PURE__ */ t("div", { className: "p-2 space-y-10", children: [
|
|
2152
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
2153
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
2154
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.general.app_name") }),
|
|
2146
2155
|
/* @__PURE__ */ e(
|
|
2147
2156
|
de,
|
|
2148
2157
|
{
|
|
2149
2158
|
type: "text",
|
|
2150
2159
|
value: l.app_name,
|
|
2151
|
-
onChange: (
|
|
2160
|
+
onChange: (n) => p({ ...l, app_name: n.target.value }),
|
|
2152
2161
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2153
2162
|
placeholder: "Gentiq AI",
|
|
2154
2163
|
dir: "auto"
|
|
@@ -2156,14 +2165,14 @@ function Ct() {
|
|
|
2156
2165
|
),
|
|
2157
2166
|
/* @__PURE__ */ e(s, { value: l.app_name })
|
|
2158
2167
|
] }),
|
|
2159
|
-
/* @__PURE__ */
|
|
2160
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
2168
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
2169
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.general.admin_title") }),
|
|
2161
2170
|
/* @__PURE__ */ e(
|
|
2162
2171
|
de,
|
|
2163
2172
|
{
|
|
2164
2173
|
type: "text",
|
|
2165
2174
|
value: l.admin_title || "",
|
|
2166
|
-
onChange: (
|
|
2175
|
+
onChange: (n) => p({ ...l, admin_title: n.target.value }),
|
|
2167
2176
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2168
2177
|
placeholder: "Gentiq Admin",
|
|
2169
2178
|
dir: "auto"
|
|
@@ -2172,41 +2181,41 @@ function Ct() {
|
|
|
2172
2181
|
/* @__PURE__ */ e(s, { value: l.admin_title || "" })
|
|
2173
2182
|
] })
|
|
2174
2183
|
] }),
|
|
2175
|
-
/* @__PURE__ */
|
|
2176
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
2177
|
-
/* @__PURE__ */
|
|
2184
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
2185
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.general.language") }),
|
|
2186
|
+
/* @__PURE__ */ t(
|
|
2178
2187
|
ne,
|
|
2179
2188
|
{
|
|
2180
2189
|
value: l.language,
|
|
2181
|
-
onValueChange: (
|
|
2190
|
+
onValueChange: (n) => p({ ...l, language: n }),
|
|
2182
2191
|
children: [
|
|
2183
2192
|
/* @__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, {}) }),
|
|
2184
|
-
/* @__PURE__ */
|
|
2193
|
+
/* @__PURE__ */ t(le, { children: [
|
|
2185
2194
|
/* @__PURE__ */ e(K, { value: "fa", children: "فارسی (Persian)" }),
|
|
2186
2195
|
/* @__PURE__ */ e(K, { value: "en", children: "English" })
|
|
2187
2196
|
] })
|
|
2188
2197
|
]
|
|
2189
2198
|
}
|
|
2190
2199
|
),
|
|
2191
|
-
/* @__PURE__ */
|
|
2200
|
+
/* @__PURE__ */ t("p", { className: "mt-3 text-[10px] text-muted-foreground/50 italic flex items-center gap-1.5 ml-1", children: [
|
|
2192
2201
|
/* @__PURE__ */ e(qe, { className: "size-3" }),
|
|
2193
|
-
|
|
2202
|
+
r("app_settings.general.language_help")
|
|
2194
2203
|
] })
|
|
2195
2204
|
] })
|
|
2196
2205
|
] })
|
|
2197
2206
|
] }),
|
|
2198
|
-
/* @__PURE__ */
|
|
2199
|
-
/* @__PURE__ */ e(M, { title:
|
|
2200
|
-
/* @__PURE__ */
|
|
2201
|
-
/* @__PURE__ */
|
|
2202
|
-
/* @__PURE__ */
|
|
2203
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
2207
|
+
/* @__PURE__ */ t("section", { children: [
|
|
2208
|
+
/* @__PURE__ */ e(M, { title: r("app_settings.sections.chat"), icon: ct }),
|
|
2209
|
+
/* @__PURE__ */ t("div", { className: "p-2 space-y-10", children: [
|
|
2210
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
2211
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
2212
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.chat.welcome_greeting") }),
|
|
2204
2213
|
/* @__PURE__ */ e(
|
|
2205
2214
|
de,
|
|
2206
2215
|
{
|
|
2207
2216
|
type: "text",
|
|
2208
2217
|
value: l.welcome_greeting || "",
|
|
2209
|
-
onChange: (
|
|
2218
|
+
onChange: (n) => p({ ...l, welcome_greeting: n.target.value }),
|
|
2210
2219
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2211
2220
|
placeholder: "e.g. chat:welcome",
|
|
2212
2221
|
dir: "auto"
|
|
@@ -2214,14 +2223,14 @@ function Ct() {
|
|
|
2214
2223
|
),
|
|
2215
2224
|
/* @__PURE__ */ e(s, { value: l.welcome_greeting || "" })
|
|
2216
2225
|
] }),
|
|
2217
|
-
/* @__PURE__ */
|
|
2218
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
2226
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
2227
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.chat.welcome_subtitle") }),
|
|
2219
2228
|
/* @__PURE__ */ e(
|
|
2220
2229
|
de,
|
|
2221
2230
|
{
|
|
2222
2231
|
type: "text",
|
|
2223
2232
|
value: l.welcome_subtitle || "",
|
|
2224
|
-
onChange: (
|
|
2233
|
+
onChange: (n) => p({ ...l, welcome_subtitle: n.target.value }),
|
|
2225
2234
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2226
2235
|
dir: "auto"
|
|
2227
2236
|
}
|
|
@@ -2229,335 +2238,374 @@ function Ct() {
|
|
|
2229
2238
|
/* @__PURE__ */ e(s, { value: l.welcome_subtitle || "" })
|
|
2230
2239
|
] })
|
|
2231
2240
|
] }),
|
|
2232
|
-
/* @__PURE__ */
|
|
2233
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
2241
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
2242
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.chat.disclaimer") }),
|
|
2234
2243
|
/* @__PURE__ */ e(
|
|
2235
2244
|
Ce,
|
|
2236
2245
|
{
|
|
2237
2246
|
value: l.disclaimer || "",
|
|
2238
|
-
onChange: (
|
|
2247
|
+
onChange: (n) => p({ ...l, disclaimer: n.target.value }),
|
|
2239
2248
|
className: "bg-muted/20 border-transparent focus:bg-background min-h-[120px] py-4 resize-none leading-relaxed",
|
|
2240
2249
|
dir: "auto"
|
|
2241
2250
|
}
|
|
2242
2251
|
),
|
|
2243
2252
|
/* @__PURE__ */ e(s, { value: l.disclaimer || "" })
|
|
2244
2253
|
] }),
|
|
2245
|
-
/* @__PURE__ */
|
|
2246
|
-
/* @__PURE__ */
|
|
2247
|
-
/* @__PURE__ */
|
|
2248
|
-
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children:
|
|
2249
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children:
|
|
2254
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-6 pt-2", children: [
|
|
2255
|
+
/* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
|
|
2256
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: [
|
|
2257
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.show_tool_details") }),
|
|
2258
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.show_tool_details_help") })
|
|
2250
2259
|
] }),
|
|
2251
2260
|
/* @__PURE__ */ e(
|
|
2252
|
-
|
|
2261
|
+
X,
|
|
2253
2262
|
{
|
|
2254
2263
|
checked: l.show_tool_details,
|
|
2255
|
-
onCheckedChange: (
|
|
2264
|
+
onCheckedChange: (n) => p({ ...l, show_tool_details: n })
|
|
2256
2265
|
}
|
|
2257
2266
|
)
|
|
2258
2267
|
] }),
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
/* @__PURE__ */
|
|
2261
|
-
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children:
|
|
2262
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children:
|
|
2268
|
+
/* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
|
|
2269
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: [
|
|
2270
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.show_settings") }),
|
|
2271
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.show_settings_help") })
|
|
2263
2272
|
] }),
|
|
2264
2273
|
/* @__PURE__ */ e(
|
|
2265
|
-
|
|
2274
|
+
X,
|
|
2266
2275
|
{
|
|
2267
2276
|
checked: l.show_settings,
|
|
2268
|
-
onCheckedChange: (
|
|
2277
|
+
onCheckedChange: (n) => p({ ...l, show_settings: n })
|
|
2278
|
+
}
|
|
2279
|
+
)
|
|
2280
|
+
] }),
|
|
2281
|
+
/* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
|
|
2282
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: [
|
|
2283
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.show_version_in_settings") }),
|
|
2284
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.show_version_in_settings_help") })
|
|
2285
|
+
] }),
|
|
2286
|
+
/* @__PURE__ */ e(
|
|
2287
|
+
X,
|
|
2288
|
+
{
|
|
2289
|
+
checked: l.show_version_in_settings,
|
|
2290
|
+
onCheckedChange: (n) => p({ ...l, show_version_in_settings: n })
|
|
2291
|
+
}
|
|
2292
|
+
)
|
|
2293
|
+
] }),
|
|
2294
|
+
/* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
|
|
2295
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: [
|
|
2296
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.disable_signup") }),
|
|
2297
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.disable_signup_help") })
|
|
2298
|
+
] }),
|
|
2299
|
+
/* @__PURE__ */ e(
|
|
2300
|
+
X,
|
|
2301
|
+
{
|
|
2302
|
+
checked: l.disable_signup,
|
|
2303
|
+
onCheckedChange: (n) => p({ ...l, disable_signup: n })
|
|
2304
|
+
}
|
|
2305
|
+
)
|
|
2306
|
+
] }),
|
|
2307
|
+
/* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors sm:col-span-2", children: [
|
|
2308
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: [
|
|
2309
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.disable_auth_page") }),
|
|
2310
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.disable_auth_page_help") })
|
|
2311
|
+
] }),
|
|
2312
|
+
/* @__PURE__ */ e(
|
|
2313
|
+
X,
|
|
2314
|
+
{
|
|
2315
|
+
checked: l.disable_auth_page,
|
|
2316
|
+
onCheckedChange: (n) => p({ ...l, disable_auth_page: n })
|
|
2269
2317
|
}
|
|
2270
2318
|
)
|
|
2271
2319
|
] }),
|
|
2272
|
-
/* @__PURE__ */
|
|
2273
|
-
/* @__PURE__ */
|
|
2274
|
-
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children:
|
|
2275
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children:
|
|
2320
|
+
/* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
|
|
2321
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: [
|
|
2322
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.composer_attachments") }),
|
|
2323
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.composer_attachments_help") })
|
|
2276
2324
|
] }),
|
|
2277
2325
|
/* @__PURE__ */ e(
|
|
2278
|
-
|
|
2326
|
+
X,
|
|
2279
2327
|
{
|
|
2280
2328
|
checked: l.composer_attachments,
|
|
2281
|
-
onCheckedChange: (
|
|
2329
|
+
onCheckedChange: (n) => p({ ...l, composer_attachments: n })
|
|
2282
2330
|
}
|
|
2283
2331
|
)
|
|
2284
2332
|
] }),
|
|
2285
|
-
/* @__PURE__ */
|
|
2286
|
-
/* @__PURE__ */
|
|
2287
|
-
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children:
|
|
2288
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children:
|
|
2333
|
+
/* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
|
|
2334
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: [
|
|
2335
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.thread_actions_feedback") }),
|
|
2336
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.thread_actions_feedback_help") })
|
|
2289
2337
|
] }),
|
|
2290
2338
|
/* @__PURE__ */ e(
|
|
2291
|
-
|
|
2339
|
+
X,
|
|
2292
2340
|
{
|
|
2293
2341
|
checked: l.thread_actions_feedback,
|
|
2294
|
-
onCheckedChange: (
|
|
2342
|
+
onCheckedChange: (n) => p({ ...l, thread_actions_feedback: n })
|
|
2295
2343
|
}
|
|
2296
2344
|
)
|
|
2297
2345
|
] }),
|
|
2298
|
-
/* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children:
|
|
2301
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children:
|
|
2346
|
+
/* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
|
|
2347
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: [
|
|
2348
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.thread_actions_retry") }),
|
|
2349
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.thread_actions_retry_help") })
|
|
2302
2350
|
] }),
|
|
2303
2351
|
/* @__PURE__ */ e(
|
|
2304
|
-
|
|
2352
|
+
X,
|
|
2305
2353
|
{
|
|
2306
2354
|
checked: l.thread_actions_retry,
|
|
2307
|
-
onCheckedChange: (
|
|
2355
|
+
onCheckedChange: (n) => p({ ...l, thread_actions_retry: n })
|
|
2308
2356
|
}
|
|
2309
2357
|
)
|
|
2310
2358
|
] }),
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
/* @__PURE__ */
|
|
2313
|
-
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children:
|
|
2314
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children:
|
|
2359
|
+
/* @__PURE__ */ t("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors sm:col-span-2", children: [
|
|
2360
|
+
/* @__PURE__ */ t("div", { className: "flex-1", children: [
|
|
2361
|
+
/* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: r("app_settings.chat.history_enabled") }),
|
|
2362
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: r("app_settings.chat.history_enabled_help") })
|
|
2315
2363
|
] }),
|
|
2316
2364
|
/* @__PURE__ */ e(
|
|
2317
|
-
|
|
2365
|
+
X,
|
|
2318
2366
|
{
|
|
2319
2367
|
checked: l.history_enabled,
|
|
2320
|
-
onCheckedChange: (
|
|
2368
|
+
onCheckedChange: (n) => p({ ...l, history_enabled: n })
|
|
2321
2369
|
}
|
|
2322
2370
|
)
|
|
2323
2371
|
] }),
|
|
2324
|
-
l.history_enabled && /* @__PURE__ */
|
|
2325
|
-
/* @__PURE__ */
|
|
2326
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children:
|
|
2372
|
+
l.history_enabled && /* @__PURE__ */ t("div", { className: "sm:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4 p-6 bg-muted/10 rounded-2xl border border-border/40 animate-in fade-in slide-in-from-top-2 duration-300", children: [
|
|
2373
|
+
/* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
2374
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children: r("app_settings.chat.history_show_delete") }),
|
|
2327
2375
|
/* @__PURE__ */ e(
|
|
2328
|
-
|
|
2376
|
+
X,
|
|
2329
2377
|
{
|
|
2330
2378
|
checked: l.history_show_delete,
|
|
2331
|
-
onCheckedChange: (
|
|
2379
|
+
onCheckedChange: (n) => p({ ...l, history_show_delete: n })
|
|
2332
2380
|
}
|
|
2333
2381
|
)
|
|
2334
2382
|
] }),
|
|
2335
|
-
/* @__PURE__ */
|
|
2336
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children:
|
|
2383
|
+
/* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
2384
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children: r("app_settings.chat.history_show_rename") }),
|
|
2337
2385
|
/* @__PURE__ */ e(
|
|
2338
|
-
|
|
2386
|
+
X,
|
|
2339
2387
|
{
|
|
2340
2388
|
checked: l.history_show_rename,
|
|
2341
|
-
onCheckedChange: (
|
|
2389
|
+
onCheckedChange: (n) => p({ ...l, history_show_rename: n })
|
|
2342
2390
|
}
|
|
2343
2391
|
)
|
|
2344
2392
|
] }),
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children:
|
|
2393
|
+
/* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
2394
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children: r("app_settings.chat.history_show_share") }),
|
|
2347
2395
|
/* @__PURE__ */ e(
|
|
2348
|
-
|
|
2396
|
+
X,
|
|
2349
2397
|
{
|
|
2350
2398
|
checked: l.history_show_share,
|
|
2351
|
-
onCheckedChange: (
|
|
2399
|
+
onCheckedChange: (n) => p({ ...l, history_show_share: n })
|
|
2352
2400
|
}
|
|
2353
2401
|
)
|
|
2354
2402
|
] }),
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children:
|
|
2403
|
+
/* @__PURE__ */ t("div", { className: "flex items-center justify-between", children: [
|
|
2404
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children: r("app_settings.chat.history_show_pin") }),
|
|
2357
2405
|
/* @__PURE__ */ e(
|
|
2358
|
-
|
|
2406
|
+
X,
|
|
2359
2407
|
{
|
|
2360
2408
|
checked: l.history_show_pin,
|
|
2361
|
-
onCheckedChange: (
|
|
2409
|
+
onCheckedChange: (n) => p({ ...l, history_show_pin: n })
|
|
2362
2410
|
}
|
|
2363
2411
|
)
|
|
2364
2412
|
] })
|
|
2365
2413
|
] })
|
|
2366
2414
|
] }),
|
|
2367
|
-
/* @__PURE__ */
|
|
2368
|
-
/* @__PURE__ */
|
|
2369
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children:
|
|
2370
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children:
|
|
2415
|
+
/* @__PURE__ */ t("div", { className: "pt-10 space-y-6", children: [
|
|
2416
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col gap-1", children: [
|
|
2417
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children: r("app_settings.chat.sections_modes") }),
|
|
2418
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children: r("app_settings.chat.sections_modes_help") })
|
|
2371
2419
|
] }),
|
|
2372
2420
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-3 gap-4", children: [
|
|
2373
2421
|
{ id: "settings_general_mode", label: "app_settings.chat.general_tab" },
|
|
2374
2422
|
{ id: "settings_profile_mode", label: "app_settings.chat.profile_tab" },
|
|
2375
2423
|
{ id: "settings_account_mode", label: "app_settings.chat.account_tab" }
|
|
2376
|
-
].map((
|
|
2377
|
-
/* @__PURE__ */ e(Q, { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70", children:
|
|
2378
|
-
/* @__PURE__ */
|
|
2424
|
+
].map((n) => /* @__PURE__ */ t("div", { className: "p-4 border border-border/40 rounded-2xl space-y-3 bg-muted/5", children: [
|
|
2425
|
+
/* @__PURE__ */ e(Q, { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70", children: r(n.label) }),
|
|
2426
|
+
/* @__PURE__ */ t(
|
|
2379
2427
|
ne,
|
|
2380
2428
|
{
|
|
2381
|
-
value: l[
|
|
2382
|
-
onValueChange: (w) =>
|
|
2429
|
+
value: l[n.id],
|
|
2430
|
+
onValueChange: (w) => p({ ...l, [n.id]: w }),
|
|
2383
2431
|
dir: L ? "rtl" : "ltr",
|
|
2384
2432
|
children: [
|
|
2385
2433
|
/* @__PURE__ */ e(ie, { className: "bg-background border-transparent h-9 text-xs", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2386
|
-
/* @__PURE__ */
|
|
2387
|
-
/* @__PURE__ */ e(K, { value: "editable", children:
|
|
2388
|
-
/* @__PURE__ */ e(K, { value: "faded", children:
|
|
2389
|
-
/* @__PURE__ */ e(K, { value: "hidden", children:
|
|
2434
|
+
/* @__PURE__ */ t(le, { children: [
|
|
2435
|
+
/* @__PURE__ */ e(K, { value: "editable", children: r("app_settings.chat.mode_editable") }),
|
|
2436
|
+
/* @__PURE__ */ e(K, { value: "faded", children: r("app_settings.chat.mode_faded") }),
|
|
2437
|
+
/* @__PURE__ */ e(K, { value: "hidden", children: r("app_settings.chat.mode_hidden") })
|
|
2390
2438
|
] })
|
|
2391
2439
|
]
|
|
2392
2440
|
}
|
|
2393
2441
|
)
|
|
2394
|
-
] },
|
|
2442
|
+
] }, n.id)) })
|
|
2395
2443
|
] }),
|
|
2396
|
-
/* @__PURE__ */
|
|
2397
|
-
/* @__PURE__ */
|
|
2398
|
-
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children:
|
|
2399
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children:
|
|
2444
|
+
/* @__PURE__ */ t("div", { className: "pt-10 space-y-8", children: [
|
|
2445
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col gap-1", children: [
|
|
2446
|
+
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children: r("app_settings.chat.inner_fields_modes") }),
|
|
2447
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed", children: r("app_settings.chat.inner_fields_modes_help") })
|
|
2400
2448
|
] }),
|
|
2401
|
-
/* @__PURE__ */
|
|
2402
|
-
/* @__PURE__ */
|
|
2403
|
-
/* @__PURE__ */
|
|
2449
|
+
/* @__PURE__ */ t("div", { className: "space-y-10", children: [
|
|
2450
|
+
/* @__PURE__ */ t("div", { className: "space-y-4", children: [
|
|
2451
|
+
/* @__PURE__ */ t("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
|
|
2404
2452
|
/* @__PURE__ */ e("div", { className: "w-1 h-1 rounded-full bg-primary/40" }),
|
|
2405
|
-
|
|
2453
|
+
r("app_settings.chat.general_tab")
|
|
2406
2454
|
] }),
|
|
2407
2455
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-4 gap-4", children: [
|
|
2408
|
-
{ id: "theme", label:
|
|
2409
|
-
{ id: "accent", label:
|
|
2410
|
-
{ id: "radius", label:
|
|
2411
|
-
{ id: "language", label:
|
|
2412
|
-
].map((
|
|
2413
|
-
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children:
|
|
2414
|
-
/* @__PURE__ */
|
|
2456
|
+
{ id: "theme", label: r("settings:general.theme") },
|
|
2457
|
+
{ id: "accent", label: r("settings:general.accent") },
|
|
2458
|
+
{ id: "radius", label: r("settings:general.radius") },
|
|
2459
|
+
{ id: "language", label: r("settings:general.language") }
|
|
2460
|
+
].map((n) => /* @__PURE__ */ t("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
|
|
2461
|
+
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children: n.label }),
|
|
2462
|
+
/* @__PURE__ */ t(
|
|
2415
2463
|
ne,
|
|
2416
2464
|
{
|
|
2417
|
-
value: l.settings_general_fields?.[
|
|
2418
|
-
onValueChange: (w) =>
|
|
2465
|
+
value: l.settings_general_fields?.[n.id] || "editable",
|
|
2466
|
+
onValueChange: (w) => p((F) => ({
|
|
2419
2467
|
...F,
|
|
2420
|
-
settings_general_fields: { ...F.settings_general_fields, [
|
|
2468
|
+
settings_general_fields: { ...F.settings_general_fields, [n.id]: w }
|
|
2421
2469
|
})),
|
|
2422
2470
|
dir: L ? "rtl" : "ltr",
|
|
2423
2471
|
children: [
|
|
2424
2472
|
/* @__PURE__ */ e(ie, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */ e(K, { value: "editable", className: "text-[10px]", children:
|
|
2427
|
-
/* @__PURE__ */ e(K, { value: "faded", className: "text-[10px]", children:
|
|
2428
|
-
/* @__PURE__ */ e(K, { value: "hidden", className: "text-[10px]", children:
|
|
2473
|
+
/* @__PURE__ */ t(le, { children: [
|
|
2474
|
+
/* @__PURE__ */ e(K, { value: "editable", className: "text-[10px]", children: r("app_settings.chat.mode_editable") }),
|
|
2475
|
+
/* @__PURE__ */ e(K, { value: "faded", className: "text-[10px]", children: r("app_settings.chat.mode_faded") }),
|
|
2476
|
+
/* @__PURE__ */ e(K, { value: "hidden", className: "text-[10px]", children: r("app_settings.chat.mode_hidden") })
|
|
2429
2477
|
] })
|
|
2430
2478
|
]
|
|
2431
2479
|
}
|
|
2432
2480
|
)
|
|
2433
|
-
] },
|
|
2481
|
+
] }, n.id)) })
|
|
2434
2482
|
] }),
|
|
2435
|
-
/* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2483
|
+
/* @__PURE__ */ t("div", { className: "space-y-4", children: [
|
|
2484
|
+
/* @__PURE__ */ t("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
|
|
2437
2485
|
/* @__PURE__ */ e("div", { className: "w-1 h-1 rounded-full bg-primary/40" }),
|
|
2438
|
-
|
|
2486
|
+
r("app_settings.chat.profile_tab")
|
|
2439
2487
|
] }),
|
|
2440
2488
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-4 gap-4", children: [
|
|
2441
|
-
{ id: "name", label:
|
|
2442
|
-
{ id: "surname", label:
|
|
2443
|
-
{ id: "phone", label:
|
|
2444
|
-
{ id: "password", label:
|
|
2445
|
-
...(o?.userMetadataFields || []).map((
|
|
2446
|
-
].map((
|
|
2447
|
-
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children:
|
|
2448
|
-
/* @__PURE__ */
|
|
2489
|
+
{ id: "name", label: r("settings:profile.name") },
|
|
2490
|
+
{ id: "surname", label: r("settings:profile.surname") },
|
|
2491
|
+
{ id: "phone", label: r("settings:profile.phone") },
|
|
2492
|
+
{ id: "password", label: r("settings:profile.password") },
|
|
2493
|
+
...(o?.userMetadataFields || []).map((n) => ({ id: n.key, label: r(n.label) }))
|
|
2494
|
+
].map((n) => /* @__PURE__ */ t("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
|
|
2495
|
+
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children: n.label }),
|
|
2496
|
+
/* @__PURE__ */ t(
|
|
2449
2497
|
ne,
|
|
2450
2498
|
{
|
|
2451
|
-
value: l.settings_profile_fields?.[
|
|
2452
|
-
onValueChange: (w) =>
|
|
2499
|
+
value: l.settings_profile_fields?.[n.id] || "editable",
|
|
2500
|
+
onValueChange: (w) => p((F) => ({
|
|
2453
2501
|
...F,
|
|
2454
|
-
settings_profile_fields: { ...F.settings_profile_fields, [
|
|
2502
|
+
settings_profile_fields: { ...F.settings_profile_fields, [n.id]: w }
|
|
2455
2503
|
})),
|
|
2456
2504
|
dir: L ? "rtl" : "ltr",
|
|
2457
2505
|
children: [
|
|
2458
2506
|
/* @__PURE__ */ e(ie, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2459
|
-
/* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */ e(K, { value: "editable", className: "text-[10px]", children:
|
|
2461
|
-
/* @__PURE__ */ e(K, { value: "faded", className: "text-[10px]", children:
|
|
2462
|
-
/* @__PURE__ */ e(K, { value: "hidden", className: "text-[10px]", children:
|
|
2507
|
+
/* @__PURE__ */ t(le, { children: [
|
|
2508
|
+
/* @__PURE__ */ e(K, { value: "editable", className: "text-[10px]", children: r("app_settings.chat.mode_editable") }),
|
|
2509
|
+
/* @__PURE__ */ e(K, { value: "faded", className: "text-[10px]", children: r("app_settings.chat.mode_faded") }),
|
|
2510
|
+
/* @__PURE__ */ e(K, { value: "hidden", className: "text-[10px]", children: r("app_settings.chat.mode_hidden") })
|
|
2463
2511
|
] })
|
|
2464
2512
|
]
|
|
2465
2513
|
}
|
|
2466
2514
|
)
|
|
2467
|
-
] },
|
|
2515
|
+
] }, n.id)) })
|
|
2468
2516
|
] }),
|
|
2469
|
-
/* @__PURE__ */
|
|
2470
|
-
/* @__PURE__ */
|
|
2517
|
+
/* @__PURE__ */ t("div", { className: "space-y-4", children: [
|
|
2518
|
+
/* @__PURE__ */ t("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
|
|
2471
2519
|
/* @__PURE__ */ e("div", { className: "w-1 h-1 rounded-full bg-primary/40" }),
|
|
2472
|
-
|
|
2520
|
+
r("app_settings.chat.account_tab")
|
|
2473
2521
|
] }),
|
|
2474
2522
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
2475
|
-
{ id: "balance", label:
|
|
2476
|
-
{ id: "logout", label:
|
|
2477
|
-
].map((
|
|
2478
|
-
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children:
|
|
2479
|
-
/* @__PURE__ */
|
|
2523
|
+
{ id: "balance", label: r("settings:account.balance") },
|
|
2524
|
+
{ id: "logout", label: r("settings:account.logout") }
|
|
2525
|
+
].map((n) => /* @__PURE__ */ t("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
|
|
2526
|
+
/* @__PURE__ */ e(Q, { className: "text-[10px] font-medium text-muted-foreground/70", children: n.label }),
|
|
2527
|
+
/* @__PURE__ */ t(
|
|
2480
2528
|
ne,
|
|
2481
2529
|
{
|
|
2482
|
-
value: l.settings_account_fields?.[
|
|
2483
|
-
onValueChange: (w) =>
|
|
2530
|
+
value: l.settings_account_fields?.[n.id] || "editable",
|
|
2531
|
+
onValueChange: (w) => p((F) => ({
|
|
2484
2532
|
...F,
|
|
2485
|
-
settings_account_fields: { ...F.settings_account_fields, [
|
|
2533
|
+
settings_account_fields: { ...F.settings_account_fields, [n.id]: w }
|
|
2486
2534
|
})),
|
|
2487
2535
|
dir: L ? "rtl" : "ltr",
|
|
2488
2536
|
children: [
|
|
2489
2537
|
/* @__PURE__ */ e(ie, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
/* @__PURE__ */ e(K, { value: "editable", className: "text-[10px]", children:
|
|
2492
|
-
/* @__PURE__ */ e(K, { value: "faded", className: "text-[10px]", children:
|
|
2493
|
-
/* @__PURE__ */ e(K, { value: "hidden", className: "text-[10px]", children:
|
|
2538
|
+
/* @__PURE__ */ t(le, { children: [
|
|
2539
|
+
/* @__PURE__ */ e(K, { value: "editable", className: "text-[10px]", children: r("app_settings.chat.mode_editable") }),
|
|
2540
|
+
/* @__PURE__ */ e(K, { value: "faded", className: "text-[10px]", children: r("app_settings.chat.mode_faded") }),
|
|
2541
|
+
/* @__PURE__ */ e(K, { value: "hidden", className: "text-[10px]", children: r("app_settings.chat.mode_hidden") })
|
|
2494
2542
|
] })
|
|
2495
2543
|
]
|
|
2496
2544
|
}
|
|
2497
2545
|
)
|
|
2498
|
-
] },
|
|
2546
|
+
] }, n.id)) })
|
|
2499
2547
|
] })
|
|
2500
2548
|
] })
|
|
2501
2549
|
] })
|
|
2502
2550
|
] })
|
|
2503
2551
|
] }),
|
|
2504
|
-
/* @__PURE__ */
|
|
2505
|
-
/* @__PURE__ */ e(M, { title:
|
|
2506
|
-
/* @__PURE__ */
|
|
2507
|
-
/* @__PURE__ */
|
|
2508
|
-
/* @__PURE__ */
|
|
2509
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
2552
|
+
/* @__PURE__ */ t("section", { children: [
|
|
2553
|
+
/* @__PURE__ */ e(M, { title: r("app_settings.sections.user_billing"), icon: mt }),
|
|
2554
|
+
/* @__PURE__ */ t("div", { className: "p-2 space-y-10", children: [
|
|
2555
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
2556
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
2557
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.user_billing.initial_balance_tokens") }),
|
|
2510
2558
|
/* @__PURE__ */ e(
|
|
2511
2559
|
de,
|
|
2512
2560
|
{
|
|
2513
2561
|
type: "number",
|
|
2514
2562
|
value: l.initial_balance_tokens ?? "",
|
|
2515
|
-
onChange: (
|
|
2563
|
+
onChange: (n) => p({ ...l, initial_balance_tokens: parseInt(n.target.value) || 0 }),
|
|
2516
2564
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2517
2565
|
placeholder: "250000"
|
|
2518
2566
|
}
|
|
2519
2567
|
)
|
|
2520
2568
|
] }),
|
|
2521
|
-
/* @__PURE__ */
|
|
2522
|
-
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children:
|
|
2569
|
+
/* @__PURE__ */ t("div", { className: "space-y-2", children: [
|
|
2570
|
+
/* @__PURE__ */ e(Q, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: r("app_settings.user_billing.initial_balance_requests") }),
|
|
2523
2571
|
/* @__PURE__ */ e(
|
|
2524
2572
|
de,
|
|
2525
2573
|
{
|
|
2526
2574
|
type: "number",
|
|
2527
2575
|
value: l.initial_balance_requests ?? "",
|
|
2528
|
-
onChange: (
|
|
2576
|
+
onChange: (n) => p({ ...l, initial_balance_requests: parseInt(n.target.value) || 0 }),
|
|
2529
2577
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2530
2578
|
placeholder: "100"
|
|
2531
2579
|
}
|
|
2532
2580
|
)
|
|
2533
2581
|
] })
|
|
2534
2582
|
] }),
|
|
2535
|
-
/* @__PURE__ */ e("p", { className: "mt-3 text-[10px] text-muted-foreground/50 italic flex items-center gap-1.5 ml-1", children:
|
|
2583
|
+
/* @__PURE__ */ e("p", { className: "mt-3 text-[10px] text-muted-foreground/50 italic flex items-center gap-1.5 ml-1", children: r("app_settings.user_billing.initial_balance_help") })
|
|
2536
2584
|
] })
|
|
2537
2585
|
] }),
|
|
2538
|
-
/* @__PURE__ */
|
|
2539
|
-
/* @__PURE__ */ e(M, { title:
|
|
2540
|
-
/* @__PURE__ */
|
|
2541
|
-
/* @__PURE__ */
|
|
2542
|
-
/* @__PURE__ */
|
|
2586
|
+
/* @__PURE__ */ t("section", { children: [
|
|
2587
|
+
/* @__PURE__ */ e(M, { title: r("app_settings.translations_management"), icon: ut }),
|
|
2588
|
+
/* @__PURE__ */ t("div", { className: "border border-border/60 rounded-2xl overflow-hidden bg-background", children: [
|
|
2589
|
+
/* @__PURE__ */ t("div", { className: "p-6 border-b border-border/50 bg-muted/5 flex flex-col sm:flex-row items-center gap-4", children: [
|
|
2590
|
+
/* @__PURE__ */ t("div", { className: "flex-1 flex items-center gap-4 p-1.5 bg-background border border-border/60 rounded-xl w-full", children: [
|
|
2543
2591
|
/* @__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" }) }),
|
|
2544
|
-
/* @__PURE__ */
|
|
2592
|
+
/* @__PURE__ */ t(ne, { value: y, onValueChange: z, children: [
|
|
2545
2593
|
/* @__PURE__ */ e(ie, { size: "sm", className: "border-none shadow-none bg-transparent h-8 font-black uppercase tracking-wider", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2546
|
-
/* @__PURE__ */ e(le, { children: Object.keys(l.translations || {}).sort().map((
|
|
2594
|
+
/* @__PURE__ */ e(le, { children: Object.keys(l.translations || {}).sort().map((n) => /* @__PURE__ */ e(K, { value: n, children: n.toUpperCase() }, n)) })
|
|
2547
2595
|
] }),
|
|
2548
2596
|
/* @__PURE__ */ e("div", { className: "w-px h-6 bg-border/60" }),
|
|
2549
|
-
/* @__PURE__ */
|
|
2597
|
+
/* @__PURE__ */ t(ne, { value: R, onValueChange: E, children: [
|
|
2550
2598
|
/* @__PURE__ */ e(ie, { size: "sm", className: "border-none shadow-none bg-transparent h-8 flex-1 font-bold", children: /* @__PURE__ */ e(oe, {}) }),
|
|
2551
|
-
/* @__PURE__ */ e(le, { children: Object.keys(l.translations?.[y] || {}).sort().map((
|
|
2599
|
+
/* @__PURE__ */ e(le, { children: Object.keys(l.translations?.[y] || {}).sort().map((n) => /* @__PURE__ */ e(K, { value: n, children: n }, n)) })
|
|
2552
2600
|
] })
|
|
2553
2601
|
] }),
|
|
2554
|
-
/* @__PURE__ */
|
|
2602
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-2", children: [
|
|
2555
2603
|
/* @__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(ht, { className: "size-4" }) }),
|
|
2556
2604
|
/* @__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" }) })
|
|
2557
2605
|
] })
|
|
2558
2606
|
] }),
|
|
2559
|
-
/* @__PURE__ */
|
|
2560
|
-
/* @__PURE__ */
|
|
2607
|
+
/* @__PURE__ */ t("div", { className: "relative p-6", children: [
|
|
2608
|
+
/* @__PURE__ */ t("div", { className: "absolute top-8 right-10 flex items-center gap-2", children: [
|
|
2561
2609
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted-foreground/40 uppercase tracking-widest", children: "JSON EDITOR" }),
|
|
2562
2610
|
/* @__PURE__ */ e(pt, { className: "size-3 text-muted-foreground/30" })
|
|
2563
2611
|
] }),
|
|
@@ -2565,20 +2613,20 @@ function Ct() {
|
|
|
2565
2613
|
Ce,
|
|
2566
2614
|
{
|
|
2567
2615
|
value: V,
|
|
2568
|
-
onChange: (
|
|
2616
|
+
onChange: (n) => j(n.target.value),
|
|
2569
2617
|
dir: "ltr",
|
|
2570
2618
|
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"}`,
|
|
2571
2619
|
spellCheck: !1
|
|
2572
2620
|
}
|
|
2573
2621
|
),
|
|
2574
|
-
B && /* @__PURE__ */
|
|
2622
|
+
B && /* @__PURE__ */ t("div", { className: "mt-2 text-[11px] text-destructive font-bold flex items-center gap-2 px-2", children: [
|
|
2575
2623
|
/* @__PURE__ */ e("div", { className: "size-1.5 rounded-full bg-destructive animate-pulse" }),
|
|
2576
2624
|
B
|
|
2577
2625
|
] })
|
|
2578
2626
|
] }),
|
|
2579
|
-
/* @__PURE__ */ e("div", { className: "p-6 bg-muted/5 border-t border-border/40 flex items-center justify-between", children: /* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */ e("div", { className: "p-1 px-2 bg-primary/5 rounded border border-primary/10", children: /* @__PURE__ */ e("span", { className: "text-[10px] font-black text-primary uppercase", children:
|
|
2581
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] text-muted-foreground/60 font-medium", children:
|
|
2627
|
+
/* @__PURE__ */ e("div", { className: "p-6 bg-muted/5 border-t border-border/40 flex items-center justify-between", children: /* @__PURE__ */ t("div", { className: "flex items-center gap-3", children: [
|
|
2628
|
+
/* @__PURE__ */ e("div", { className: "p-1 px-2 bg-primary/5 rounded border border-primary/10", children: /* @__PURE__ */ e("span", { className: "text-[10px] font-black text-primary uppercase", children: r("app_settings.tips_label", { defaultValue: "TIPS" }) }) }),
|
|
2629
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] text-muted-foreground/60 font-medium", children: r("app_settings.editor_tips") })
|
|
2582
2630
|
] }) })
|
|
2583
2631
|
] })
|
|
2584
2632
|
] })
|
|
@@ -2587,17 +2635,17 @@ function Ct() {
|
|
|
2587
2635
|
] });
|
|
2588
2636
|
}
|
|
2589
2637
|
function ce() {
|
|
2590
|
-
const { t, i18n:
|
|
2591
|
-
return /* @__PURE__ */
|
|
2638
|
+
const { t: r, i18n: i } = ee(["admin"]), o = i.language === "fa";
|
|
2639
|
+
return /* @__PURE__ */ t("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: [
|
|
2592
2640
|
/* @__PURE__ */ e("div", { className: "bg-destructive/10 p-4 rounded-2xl border border-destructive/20 relative", children: /* @__PURE__ */ e(gt, { className: "size-10 text-destructive/70" }) }),
|
|
2593
|
-
/* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground tracking-tight", children:
|
|
2595
|
-
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground leading-relaxed", children:
|
|
2641
|
+
/* @__PURE__ */ t("div", { className: "space-y-1 max-w-sm", children: [
|
|
2642
|
+
/* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground tracking-tight", children: r("errors.access_denied_title", "Access Denied") }),
|
|
2643
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground leading-relaxed", children: r("errors.access_denied_message", "You don't have permission to access this page.") })
|
|
2596
2644
|
] })
|
|
2597
2645
|
] });
|
|
2598
2646
|
}
|
|
2599
|
-
const Lt = ({ className:
|
|
2600
|
-
const { t:
|
|
2647
|
+
const Lt = ({ className: r }) => {
|
|
2648
|
+
const { t: i } = ee(["theme"]), { theme: o, setTheme: m } = we(), x = () => {
|
|
2601
2649
|
m(o === "system" ? "light" : o === "light" ? "dark" : "system");
|
|
2602
2650
|
}, u = () => {
|
|
2603
2651
|
switch (o) {
|
|
@@ -2613,24 +2661,24 @@ const Lt = ({ className: t }) => {
|
|
|
2613
2661
|
}, v = () => {
|
|
2614
2662
|
switch (o) {
|
|
2615
2663
|
case "light":
|
|
2616
|
-
return
|
|
2664
|
+
return i("dark");
|
|
2617
2665
|
case "dark":
|
|
2618
|
-
return
|
|
2666
|
+
return i("system");
|
|
2619
2667
|
case "system":
|
|
2620
|
-
return
|
|
2668
|
+
return i("light");
|
|
2621
2669
|
default:
|
|
2622
|
-
return
|
|
2670
|
+
return i("toggle");
|
|
2623
2671
|
}
|
|
2624
2672
|
};
|
|
2625
|
-
return /* @__PURE__ */
|
|
2626
|
-
/* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */
|
|
2673
|
+
return /* @__PURE__ */ t(ve, { children: [
|
|
2674
|
+
/* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ t(he, { variant: "ghost", size: "icon", onClick: x, className: r, children: [
|
|
2627
2675
|
u(),
|
|
2628
|
-
/* @__PURE__ */ e("span", { className: "sr-only", children:
|
|
2676
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: i("toggle") })
|
|
2629
2677
|
] }) }),
|
|
2630
2678
|
/* @__PURE__ */ e(Ne, { children: v() })
|
|
2631
2679
|
] });
|
|
2632
2680
|
};
|
|
2633
|
-
function qt({ extraPages:
|
|
2681
|
+
function qt({ extraPages: r = [], disabledPages: i = [] }) {
|
|
2634
2682
|
const o = it(), m = ot(), { t: x, i18n: u } = ee(["admin", "settings", "translation"]), { app: v } = me(), { theme: _ } = we(), [N, H] = b([]), [T, A] = b(!1), I = Ie(!1), [D, C] = b("light");
|
|
2635
2683
|
W(() => {
|
|
2636
2684
|
if (_ === "system") {
|
|
@@ -2646,40 +2694,40 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2646
2694
|
try {
|
|
2647
2695
|
const d = JSON.parse(h).permissions || [];
|
|
2648
2696
|
if (H(d), m.pathname === "/admin" || m.pathname === "/admin/")
|
|
2649
|
-
if (d.includes("analytics") && !
|
|
2697
|
+
if (d.includes("analytics") && !i.includes("analytics"))
|
|
2650
2698
|
o("/admin/analytics", { replace: !0 });
|
|
2651
|
-
else if (d.includes("chat_history") && !
|
|
2699
|
+
else if (d.includes("chat_history") && !i.includes("chat_history"))
|
|
2652
2700
|
o("/admin/chat-history", { replace: !0 });
|
|
2653
|
-
else if (d.includes("user_management") && !
|
|
2701
|
+
else if (d.includes("user_management") && !i.includes("user_management"))
|
|
2654
2702
|
o("/admin/users", { replace: !0 });
|
|
2655
|
-
else if (d.includes("admin_management") && !
|
|
2703
|
+
else if (d.includes("admin_management") && !i.includes("admin_management"))
|
|
2656
2704
|
o("/admin/admins", { replace: !0 });
|
|
2657
|
-
else if (d.includes("settings") && !
|
|
2705
|
+
else if (d.includes("settings") && !i.includes("settings"))
|
|
2658
2706
|
o("/admin/settings", { replace: !0 });
|
|
2659
2707
|
else {
|
|
2660
|
-
const c =
|
|
2708
|
+
const c = r.find((l) => !l.permission || d.includes(l.permission));
|
|
2661
2709
|
c && o(`/admin/${c.path}`, { replace: !0 });
|
|
2662
2710
|
}
|
|
2663
|
-
} catch (
|
|
2664
|
-
console.error("Failed to parse admin_info",
|
|
2711
|
+
} catch (P) {
|
|
2712
|
+
console.error("Failed to parse admin_info", P);
|
|
2665
2713
|
}
|
|
2666
2714
|
else
|
|
2667
2715
|
console.warn("DashboardPage: No adminInfo found in localStorage");
|
|
2668
2716
|
}, [o, m.pathname]);
|
|
2669
2717
|
const z = () => {
|
|
2670
2718
|
k.clearToken(), window.location.reload();
|
|
2671
|
-
}, R = (h) => N.includes(h), E = (h) => N.includes(h) && !
|
|
2719
|
+
}, R = (h) => N.includes(h), E = (h) => N.includes(h) && !i.includes(h), V = Object.keys(u.services?.resourceStore?.data || {}).filter((h) => h !== "dev"), Z = V.length > 0 ? V : ["en", "fa"], B = (h) => {
|
|
2672
2720
|
localStorage.setItem("gentiq-admin-language", h), u.changeLanguage(h), A(!1), document.activeElement instanceof HTMLElement && document.activeElement.blur();
|
|
2673
2721
|
};
|
|
2674
|
-
return /* @__PURE__ */
|
|
2675
|
-
/* @__PURE__ */ e("header", { className: "glass border-b border-border sticky top-0 z-50", children: /* @__PURE__ */ e("div", { className: "px-8", children: /* @__PURE__ */
|
|
2676
|
-
/* @__PURE__ */
|
|
2677
|
-
/* @__PURE__ */
|
|
2722
|
+
return /* @__PURE__ */ t("div", { className: "min-h-screen bg-background overflow-hidden flex flex-col", dir: y ? "rtl" : "ltr", children: [
|
|
2723
|
+
/* @__PURE__ */ e("header", { className: "glass border-b border-border sticky top-0 z-50", children: /* @__PURE__ */ e("div", { className: "px-8", children: /* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-stretch justify-between min-h-[72px] gap-y-4", children: [
|
|
2724
|
+
/* @__PURE__ */ t("div", { className: "flex flex-col md:flex-row md:items-stretch gap-x-12", children: [
|
|
2725
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-3 py-4 md:py-0", children: [
|
|
2678
2726
|
/* @__PURE__ */ e("img", { src: O, alt: U, className: "size-8 object-contain" }),
|
|
2679
2727
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: U })
|
|
2680
2728
|
] }),
|
|
2681
|
-
/* @__PURE__ */
|
|
2682
|
-
!
|
|
2729
|
+
/* @__PURE__ */ t("nav", { className: "flex items-stretch gap-8", children: [
|
|
2730
|
+
!i.includes("analytics") && /* @__PURE__ */ e(
|
|
2683
2731
|
"button",
|
|
2684
2732
|
{
|
|
2685
2733
|
onClick: () => o("/admin/analytics"),
|
|
@@ -2687,7 +2735,7 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2687
2735
|
children: x("dashboard.tabs.analytics")
|
|
2688
2736
|
}
|
|
2689
2737
|
),
|
|
2690
|
-
!
|
|
2738
|
+
!i.includes("chat_history") && /* @__PURE__ */ e(
|
|
2691
2739
|
"button",
|
|
2692
2740
|
{
|
|
2693
2741
|
onClick: () => o("/admin/chat-history"),
|
|
@@ -2695,7 +2743,7 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2695
2743
|
children: x("dashboard.tabs.chat_history")
|
|
2696
2744
|
}
|
|
2697
2745
|
),
|
|
2698
|
-
!
|
|
2746
|
+
!i.includes("user_management") && /* @__PURE__ */ e(
|
|
2699
2747
|
"button",
|
|
2700
2748
|
{
|
|
2701
2749
|
onClick: () => o("/admin/users"),
|
|
@@ -2703,7 +2751,7 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2703
2751
|
children: x("dashboard.tabs.users")
|
|
2704
2752
|
}
|
|
2705
2753
|
),
|
|
2706
|
-
!
|
|
2754
|
+
!i.includes("admin_management") && /* @__PURE__ */ e(
|
|
2707
2755
|
"button",
|
|
2708
2756
|
{
|
|
2709
2757
|
onClick: () => o("/admin/admins"),
|
|
@@ -2711,7 +2759,7 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2711
2759
|
children: x("dashboard.tabs.admins")
|
|
2712
2760
|
}
|
|
2713
2761
|
),
|
|
2714
|
-
!
|
|
2762
|
+
!i.includes("settings") && /* @__PURE__ */ e(
|
|
2715
2763
|
"button",
|
|
2716
2764
|
{
|
|
2717
2765
|
onClick: () => o("/admin/settings"),
|
|
@@ -2719,7 +2767,7 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2719
2767
|
children: x("dashboard.tabs.settings")
|
|
2720
2768
|
}
|
|
2721
2769
|
),
|
|
2722
|
-
|
|
2770
|
+
r.map((h) => /* @__PURE__ */ e(
|
|
2723
2771
|
"button",
|
|
2724
2772
|
{
|
|
2725
2773
|
onClick: () => o(`/admin/${h.path}`),
|
|
@@ -2730,13 +2778,13 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2730
2778
|
))
|
|
2731
2779
|
] })
|
|
2732
2780
|
] }),
|
|
2733
|
-
/* @__PURE__ */
|
|
2734
|
-
/* @__PURE__ */
|
|
2781
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1.5 py-4 md:py-0", children: [
|
|
2782
|
+
/* @__PURE__ */ t(Ye, { onOpenChange: (h) => {
|
|
2735
2783
|
h ? A(!1) : (I.current = !0, setTimeout(() => {
|
|
2736
2784
|
I.current = !1;
|
|
2737
2785
|
}, 200));
|
|
2738
2786
|
}, children: [
|
|
2739
|
-
/* @__PURE__ */
|
|
2787
|
+
/* @__PURE__ */ t(
|
|
2740
2788
|
ve,
|
|
2741
2789
|
{
|
|
2742
2790
|
open: T,
|
|
@@ -2770,7 +2818,7 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2770
2818
|
] }),
|
|
2771
2819
|
/* @__PURE__ */ e(Lt, { className: "size-9 !bg-transparent hover:bg-muted text-muted-foreground" }),
|
|
2772
2820
|
/* @__PURE__ */ e("div", { className: "w-px h-5 bg-border mx-1" }),
|
|
2773
|
-
/* @__PURE__ */
|
|
2821
|
+
/* @__PURE__ */ t(ve, { children: [
|
|
2774
2822
|
/* @__PURE__ */ e(ye, { asChild: !0, children: /* @__PURE__ */ e(
|
|
2775
2823
|
he,
|
|
2776
2824
|
{
|
|
@@ -2785,14 +2833,14 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2785
2833
|
] })
|
|
2786
2834
|
] })
|
|
2787
2835
|
] }) }) }),
|
|
2788
|
-
/* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */
|
|
2836
|
+
/* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ t(lt, { children: [
|
|
2789
2837
|
/* @__PURE__ */ e(ae, { path: "/", element: /* @__PURE__ */ e(Le, { to: "/admin/analytics", replace: !0 }) }),
|
|
2790
2838
|
/* @__PURE__ */ e(ae, { path: "/analytics", element: E("analytics") ? /* @__PURE__ */ e(St, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2791
2839
|
/* @__PURE__ */ e(ae, { path: "/chat-history", element: E("chat_history") ? /* @__PURE__ */ e(Nt, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2792
2840
|
/* @__PURE__ */ e(ae, { path: "/admins", element: E("admin_management") ? /* @__PURE__ */ e(wt, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2793
2841
|
/* @__PURE__ */ e(ae, { path: "/settings", element: E("settings") ? /* @__PURE__ */ e(Ct, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2794
2842
|
/* @__PURE__ */ e(ae, { path: "/users", element: E("user_management") ? /* @__PURE__ */ e(kt, {}) : /* @__PURE__ */ e(ce, {}) }),
|
|
2795
|
-
|
|
2843
|
+
r.map((h) => /* @__PURE__ */ e(
|
|
2796
2844
|
ae,
|
|
2797
2845
|
{
|
|
2798
2846
|
path: `/${h.path}`,
|
|
@@ -2804,10 +2852,10 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
|
|
|
2804
2852
|
] }) }) })
|
|
2805
2853
|
] });
|
|
2806
2854
|
}
|
|
2807
|
-
function Ft(
|
|
2808
|
-
const
|
|
2855
|
+
function Ft(r) {
|
|
2856
|
+
const i = pe(() => {
|
|
2809
2857
|
const o = ze.createInstance();
|
|
2810
|
-
return o.use(st).use(
|
|
2858
|
+
return o.use(st).use(Pe).init({
|
|
2811
2859
|
resources: at,
|
|
2812
2860
|
fallbackLng: "en",
|
|
2813
2861
|
interpolation: { escapeValue: !1 },
|
|
@@ -2818,9 +2866,9 @@ function Ft(t) {
|
|
|
2818
2866
|
}
|
|
2819
2867
|
}), o;
|
|
2820
2868
|
}, []);
|
|
2821
|
-
return /* @__PURE__ */ e(
|
|
2869
|
+
return /* @__PURE__ */ e(Je, { i18n: i, children: /* @__PURE__ */ e(jt, { ...r }) });
|
|
2822
2870
|
}
|
|
2823
|
-
function jt({ extraPages:
|
|
2871
|
+
function jt({ extraPages: r, disabledPages: i = [] }) {
|
|
2824
2872
|
const { app: o, i18n: m } = me(), { t: x, i18n: u } = ee(["admin", "translation"]), [v, _] = b(!1), [N, H] = b(!0), [T, A] = b(!1);
|
|
2825
2873
|
W(() => {
|
|
2826
2874
|
m?.resources && Object.entries(m.resources).forEach(([C, O]) => {
|
|
@@ -2839,95 +2887,95 @@ function jt({ extraPages: t, disabledPages: n = [] }) {
|
|
|
2839
2887
|
const I = () => {
|
|
2840
2888
|
_(!0);
|
|
2841
2889
|
};
|
|
2842
|
-
return N || !T ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: x("loading") }) }) : /* @__PURE__ */ e(nt, { storageKey: "gentiq-admin-theme", children: v ? /* @__PURE__ */ e(qt, { extraPages:
|
|
2890
|
+
return N || !T ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: x("loading") }) }) : /* @__PURE__ */ e(nt, { storageKey: "gentiq-admin-theme", children: v ? /* @__PURE__ */ e(qt, { extraPages: r, disabledPages: i }) : /* @__PURE__ */ e(yt, { onLoginSuccess: I }) });
|
|
2843
2891
|
}
|
|
2844
2892
|
const se = "gentiq_admin";
|
|
2845
|
-
function Ut(
|
|
2893
|
+
function Ut(r = 0, i = 100, o = "") {
|
|
2846
2894
|
return ue({
|
|
2847
|
-
queryKey: [se, "users",
|
|
2848
|
-
queryFn: () => k.listUsers(
|
|
2895
|
+
queryKey: [se, "users", r, i, o],
|
|
2896
|
+
queryFn: () => k.listUsers(r, i, o)
|
|
2849
2897
|
});
|
|
2850
2898
|
}
|
|
2851
2899
|
function zt() {
|
|
2852
|
-
const
|
|
2853
|
-
|
|
2900
|
+
const r = _e(), i = () => {
|
|
2901
|
+
r.invalidateQueries({ queryKey: [se, "users"] });
|
|
2854
2902
|
}, o = re({
|
|
2855
2903
|
mutationFn: (_) => k.createUser(_.phone, _.name, _.surname, _.tokens, _.requests),
|
|
2856
|
-
onSuccess:
|
|
2904
|
+
onSuccess: i
|
|
2857
2905
|
}), m = re({
|
|
2858
2906
|
mutationFn: ({ userId: _, data: N }) => k.updateUser(_, N),
|
|
2859
|
-
onSuccess:
|
|
2907
|
+
onSuccess: i
|
|
2860
2908
|
}), x = re({
|
|
2861
2909
|
mutationFn: (_) => k.deleteUser(_),
|
|
2862
|
-
onSuccess:
|
|
2910
|
+
onSuccess: i
|
|
2863
2911
|
}), u = re({
|
|
2864
2912
|
mutationFn: ({ userId: _, tokens: N, requests: H }) => k.updateUserBalance(_, N, H),
|
|
2865
|
-
onSuccess:
|
|
2913
|
+
onSuccess: i
|
|
2866
2914
|
}), v = re({
|
|
2867
2915
|
mutationFn: (_) => k.refreshUserToken(_)
|
|
2868
2916
|
});
|
|
2869
2917
|
return { createUser: o, updateUser: m, deleteUser: x, updateBalance: u, refreshToken: v };
|
|
2870
2918
|
}
|
|
2871
|
-
function
|
|
2919
|
+
function Pt(r = 30) {
|
|
2872
2920
|
return ue({
|
|
2873
|
-
queryKey: [se, "analytics",
|
|
2874
|
-
queryFn: () => k.getAnalytics(
|
|
2921
|
+
queryKey: [se, "analytics", r],
|
|
2922
|
+
queryFn: () => k.getAnalytics(r)
|
|
2875
2923
|
});
|
|
2876
2924
|
}
|
|
2877
|
-
function
|
|
2925
|
+
function Jt() {
|
|
2878
2926
|
return ue({
|
|
2879
2927
|
queryKey: [se, "admins"],
|
|
2880
2928
|
queryFn: () => k.listAdmins()
|
|
2881
2929
|
});
|
|
2882
2930
|
}
|
|
2883
2931
|
function Ht() {
|
|
2884
|
-
const
|
|
2885
|
-
|
|
2932
|
+
const r = _e(), i = () => {
|
|
2933
|
+
r.invalidateQueries({ queryKey: [se, "admins"] });
|
|
2886
2934
|
}, o = re({
|
|
2887
2935
|
mutationFn: (u) => k.register(u.username, u.password, u.name, u.permissions),
|
|
2888
|
-
onSuccess:
|
|
2936
|
+
onSuccess: i
|
|
2889
2937
|
}), m = re({
|
|
2890
2938
|
mutationFn: ({ adminId: u, data: v }) => k.updateAdmin(u, v),
|
|
2891
|
-
onSuccess:
|
|
2939
|
+
onSuccess: i
|
|
2892
2940
|
}), x = re({
|
|
2893
2941
|
mutationFn: (u) => k.deleteAdmin(u),
|
|
2894
|
-
onSuccess:
|
|
2942
|
+
onSuccess: i
|
|
2895
2943
|
});
|
|
2896
2944
|
return { createAdmin: o, updateAdmin: m, deleteAdmin: x };
|
|
2897
2945
|
}
|
|
2898
|
-
function Bt(
|
|
2946
|
+
function Bt(r = 0, i = 50, o, m) {
|
|
2899
2947
|
return ue({
|
|
2900
|
-
queryKey: [se, "threads",
|
|
2901
|
-
queryFn: () => k.listThreads(
|
|
2948
|
+
queryKey: [se, "threads", r, i, o, m],
|
|
2949
|
+
queryFn: () => k.listThreads(r, i, o, m)
|
|
2902
2950
|
});
|
|
2903
2951
|
}
|
|
2904
|
-
function Vt(
|
|
2952
|
+
function Vt(r) {
|
|
2905
2953
|
return ue({
|
|
2906
|
-
queryKey: [se, "threadItems",
|
|
2907
|
-
queryFn: () => k.getThreadItems(
|
|
2908
|
-
enabled: !!
|
|
2954
|
+
queryKey: [se, "threadItems", r],
|
|
2955
|
+
queryFn: () => k.getThreadItems(r),
|
|
2956
|
+
enabled: !!r
|
|
2909
2957
|
});
|
|
2910
2958
|
}
|
|
2911
|
-
function Wt(
|
|
2959
|
+
function Wt(r = 20, i) {
|
|
2912
2960
|
return ue({
|
|
2913
|
-
queryKey: [se, "jobs",
|
|
2914
|
-
queryFn: () => k.listJobs(
|
|
2961
|
+
queryKey: [se, "jobs", r, i],
|
|
2962
|
+
queryFn: () => k.listJobs(r, i),
|
|
2915
2963
|
refetchInterval: 5e3
|
|
2916
2964
|
// Auto-refresh jobs every 5 seconds
|
|
2917
2965
|
});
|
|
2918
2966
|
}
|
|
2919
2967
|
function Gt() {
|
|
2920
|
-
const
|
|
2968
|
+
const r = _e();
|
|
2921
2969
|
return { cancelJob: re({
|
|
2922
2970
|
mutationFn: (m) => k.cancelJob(m),
|
|
2923
2971
|
onSuccess: () => {
|
|
2924
|
-
|
|
2972
|
+
r.invalidateQueries({ queryKey: [se, "jobs"] });
|
|
2925
2973
|
}
|
|
2926
2974
|
}) };
|
|
2927
2975
|
}
|
|
2928
2976
|
function Kt() {
|
|
2929
2977
|
return {
|
|
2930
|
-
login: async (
|
|
2978
|
+
login: async (r, i) => k.login(r, i),
|
|
2931
2979
|
logout: () => k.clearToken(),
|
|
2932
2980
|
getToken: () => k.getToken(),
|
|
2933
2981
|
isAuthenticated: !!k.getToken()
|
|
@@ -2935,9 +2983,9 @@ function Kt() {
|
|
|
2935
2983
|
}
|
|
2936
2984
|
export {
|
|
2937
2985
|
Ft as AdminPanel,
|
|
2938
|
-
|
|
2986
|
+
Jt as useAdminAdmins,
|
|
2939
2987
|
Ht as useAdminAdminsMutations,
|
|
2940
|
-
|
|
2988
|
+
Pt as useAdminAnalytics,
|
|
2941
2989
|
Kt as useAdminAuth,
|
|
2942
2990
|
Wt as useAdminJobs,
|
|
2943
2991
|
Gt as useAdminJobsMutations,
|