gentiq 0.7.32 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{checkbox-CdPG-d34.js → checkbox-XoTpU9VY.js} +128 -128
- package/dist/gentiq-admin.es.js +1707 -1375
- package/dist/gentiq-index.es.js +2 -2
- package/dist/gentiq.css +1 -1
- package/dist/src/admin/lib/api.d.ts +30 -3
- package/dist/src/admin/lib/format.d.ts +2 -0
- package/dist/src/hooks/useGentiqAdmin.d.ts +4 -1
- package/dist/src/locales/en.json.d.ts +33 -0
- package/dist/src/locales/fa.json.d.ts +33 -0
- package/package.json +1 -1
package/dist/gentiq-admin.es.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as e, jsxs as r, Fragment as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { useTranslation as
|
|
5
|
-
import { G as
|
|
6
|
-
import { useNavigate as
|
|
7
|
-
import { Share2 as
|
|
8
|
-
import { toast as
|
|
9
|
-
import * as
|
|
10
|
-
import { useQuery as
|
|
11
|
-
const
|
|
12
|
-
class
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as mt } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useEffect as Y, useMemo as Ce, useRef as Le } from "react";
|
|
3
|
+
import ut from "i18next";
|
|
4
|
+
import { useTranslation as me, initReactI18next as ht, I18nextProvider as pt } from "react-i18next";
|
|
5
|
+
import { G as Ue, a as Ne, m as De, w as He, e as Te, n as Oe, D as We, p as Ge, F as Ke, H as Ze, J as Qe, S as oe, q as le, r as de, s as ce, t as Z, M as gt, o as ft, K as xt, a2 as bt, B as Se, L as X, I as fe, a3 as Fe, i as Ae, k as Ie, l as Me, y as vt, z as yt, A as _t, E as Nt, a4 as wt, d as kt, T as St } from "./checkbox-XoTpU9VY.js";
|
|
6
|
+
import { useNavigate as Ct, useLocation as Lt, Routes as qt, Route as ge, Navigate as Re } from "react-router-dom";
|
|
7
|
+
import { Share2 as jt, Info as Tt, ArrowUpDown as At, ArrowUp as It, ArrowDown as Mt, RefreshCcw as Pe, Globe as je, Palette as Dt, Keyboard as $t, Wallet as Et, Languages as Ut, Plus as Ot, Hash as Ft, ShieldAlert as Rt, Monitor as ze, Moon as Pt, Sun as zt, LogOut as Jt } from "lucide-react";
|
|
8
|
+
import { toast as Je } from "sonner";
|
|
9
|
+
import * as Ve from "@radix-ui/react-switch";
|
|
10
|
+
import { useQuery as we, useQueryClient as $e, useMutation as ue } from "@tanstack/react-query";
|
|
11
|
+
const Be = "/api";
|
|
12
|
+
class Vt {
|
|
13
13
|
token = null;
|
|
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,137 +23,145 @@ class yt {
|
|
|
23
23
|
getToken() {
|
|
24
24
|
return this.token;
|
|
25
25
|
}
|
|
26
|
-
async request(
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
...
|
|
31
|
-
headers:
|
|
26
|
+
async request(i, o = {}) {
|
|
27
|
+
const d = new Headers(o.headers);
|
|
28
|
+
d.has("Content-Type") || d.set("Content-Type", "application/json"), this.token && d.set("Authorization", `Bearer ${this.token}`);
|
|
29
|
+
const g = await fetch(`${Be}${i}`, {
|
|
30
|
+
...o,
|
|
31
|
+
headers: d
|
|
32
32
|
});
|
|
33
|
-
if (!
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
36
|
-
throw new
|
|
37
|
-
let
|
|
38
|
-
throw typeof
|
|
33
|
+
if (!g.ok) {
|
|
34
|
+
const c = await g.json().catch(() => ({}));
|
|
35
|
+
if (c.error && (typeof c.error.code == "string" || typeof c.error.message == "string"))
|
|
36
|
+
throw new Ue(c, g.status);
|
|
37
|
+
let x = `HTTP ${g.status}`, N = "error", _ = null;
|
|
38
|
+
throw typeof c.detail == "string" ? x = c.detail : typeof c.message == "string" ? x = c.message : typeof c.error == "string" ? x = c.error : Array.isArray(c.detail) ? (x = "Validation failed", _ = c.detail, N = "validation_error") : c.error && typeof c.error.message == "string" && (x = c.error.message), new Ue({
|
|
39
39
|
error: {
|
|
40
|
-
code:
|
|
41
|
-
message:
|
|
42
|
-
details:
|
|
40
|
+
code: N,
|
|
41
|
+
message: x,
|
|
42
|
+
details: _
|
|
43
43
|
}
|
|
44
|
-
},
|
|
44
|
+
}, g.status);
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return g.json();
|
|
47
47
|
}
|
|
48
|
-
async login(
|
|
49
|
-
const
|
|
48
|
+
async login(i, o) {
|
|
49
|
+
const d = 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
|
-
this.setToken(
|
|
54
|
-
const
|
|
55
|
-
admin_id:
|
|
56
|
-
username:
|
|
57
|
-
name:
|
|
58
|
-
permissions:
|
|
53
|
+
this.setToken(d.token);
|
|
54
|
+
const g = {
|
|
55
|
+
admin_id: d.admin_id,
|
|
56
|
+
username: d.username,
|
|
57
|
+
name: d.name,
|
|
58
|
+
permissions: d.permissions
|
|
59
59
|
};
|
|
60
|
-
return localStorage.setItem("admin_info", JSON.stringify(
|
|
60
|
+
return localStorage.setItem("admin_info", JSON.stringify(g)), d;
|
|
61
61
|
}
|
|
62
62
|
async checkSetupStatus() {
|
|
63
63
|
return this.request("/admin/setup-status");
|
|
64
64
|
}
|
|
65
|
-
async register(
|
|
65
|
+
async register(i, o, d, g) {
|
|
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: d, permissions: g })
|
|
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
|
-
body: JSON.stringify(
|
|
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
|
|
90
|
-
return
|
|
88
|
+
async listThreads(i = 0, o = 50, d, g) {
|
|
89
|
+
const c = new URLSearchParams({ skip: i.toString(), limit: o.toString() });
|
|
90
|
+
return d && c.append("query", d), g && c.append("feedback", g), this.request(`/admin/chat-history/threads?${c}`);
|
|
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({
|
|
102
|
-
|
|
100
|
+
async listUsers(i = 0, o = 100, d = "", g = "name", c = "asc") {
|
|
101
|
+
const x = new URLSearchParams({
|
|
102
|
+
skip: i.toString(),
|
|
103
|
+
limit: o.toString(),
|
|
104
|
+
sort_by: g,
|
|
105
|
+
sort_order: c
|
|
106
|
+
});
|
|
107
|
+
return d && x.append("query", d), this.request(`/admin/users?${x.toString()}`);
|
|
103
108
|
}
|
|
104
|
-
async createUser(
|
|
105
|
-
const
|
|
106
|
-
tokens:
|
|
107
|
-
requests:
|
|
108
|
-
token_limit:
|
|
109
|
-
request_limit:
|
|
109
|
+
async createUser(i, o, d, g, c, x, N, _, B) {
|
|
110
|
+
const M = g !== void 0 || c !== void 0 || x !== void 0 || N !== void 0 ? {
|
|
111
|
+
tokens: g || 0,
|
|
112
|
+
requests: c || 0,
|
|
113
|
+
token_limit: x || g || 0,
|
|
114
|
+
request_limit: N || c || 0
|
|
110
115
|
} : void 0;
|
|
111
116
|
return this.request("/admin/users", {
|
|
112
117
|
method: "POST",
|
|
113
|
-
body: JSON.stringify({ phone:
|
|
118
|
+
body: JSON.stringify({ phone: i, name: o, surname: d, balance: M, metadata: _, recharge_policy: B })
|
|
114
119
|
});
|
|
115
120
|
}
|
|
116
|
-
async updateUser(
|
|
117
|
-
return this.request(`/admin/users/${
|
|
121
|
+
async updateUser(i, o) {
|
|
122
|
+
return this.request(`/admin/users/${i}`, {
|
|
118
123
|
method: "PATCH",
|
|
119
|
-
body: JSON.stringify(
|
|
124
|
+
body: JSON.stringify(o)
|
|
120
125
|
});
|
|
121
126
|
}
|
|
122
|
-
async deleteUser(
|
|
123
|
-
return this.request(`/admin/users/${
|
|
127
|
+
async deleteUser(i) {
|
|
128
|
+
return this.request(`/admin/users/${i}`, {
|
|
124
129
|
method: "DELETE"
|
|
125
130
|
});
|
|
126
131
|
}
|
|
127
|
-
async updateUserBalance(
|
|
128
|
-
return this.request(`/admin/users/${
|
|
132
|
+
async updateUserBalance(i, o, d, g, c) {
|
|
133
|
+
return this.request(`/admin/users/${i}/balance`, {
|
|
129
134
|
method: "POST",
|
|
130
|
-
body: JSON.stringify({ tokens:
|
|
135
|
+
body: JSON.stringify({ tokens: o, requests: d, token_limit: g, request_limit: c })
|
|
131
136
|
});
|
|
132
137
|
}
|
|
133
|
-
async refreshUserToken(
|
|
134
|
-
return this.request(`/admin/users/${
|
|
138
|
+
async refreshUserToken(i) {
|
|
139
|
+
return this.request(`/admin/users/${i}/refresh-token`, {
|
|
135
140
|
method: "POST"
|
|
136
141
|
});
|
|
137
142
|
}
|
|
138
|
-
async
|
|
139
|
-
return this.request(`/admin/
|
|
143
|
+
async getUserUsageSummary(i) {
|
|
144
|
+
return this.request(`/admin/users/${i}/usage-summary`);
|
|
145
|
+
}
|
|
146
|
+
async getAnalytics(i = 30) {
|
|
147
|
+
return this.request(`/admin/analytics?days=${i}`);
|
|
140
148
|
}
|
|
141
|
-
async listJobs(
|
|
142
|
-
const
|
|
143
|
-
return
|
|
149
|
+
async listJobs(i = 20, o) {
|
|
150
|
+
const d = new URLSearchParams({ limit: i.toString() });
|
|
151
|
+
return o && d.append("type", o), this.request(`/admin/jobs?${d}`);
|
|
144
152
|
}
|
|
145
|
-
async cancelJob(
|
|
146
|
-
return this.request(`/admin/jobs/${
|
|
153
|
+
async cancelJob(i) {
|
|
154
|
+
return this.request(`/admin/jobs/${i}/cancel`, {
|
|
147
155
|
method: "POST"
|
|
148
156
|
});
|
|
149
157
|
}
|
|
150
158
|
async getSettings() {
|
|
151
159
|
return this.request("/admin/settings");
|
|
152
160
|
}
|
|
153
|
-
async updateSettings(
|
|
161
|
+
async updateSettings(i) {
|
|
154
162
|
return this.request("/admin/settings", {
|
|
155
163
|
method: "PATCH",
|
|
156
|
-
body: JSON.stringify(
|
|
164
|
+
body: JSON.stringify(i)
|
|
157
165
|
});
|
|
158
166
|
}
|
|
159
167
|
async resetSettings() {
|
|
@@ -161,83 +169,83 @@ class yt {
|
|
|
161
169
|
method: "DELETE"
|
|
162
170
|
});
|
|
163
171
|
}
|
|
164
|
-
async getAttachmentBlob(
|
|
165
|
-
const
|
|
166
|
-
this.token && (
|
|
167
|
-
const
|
|
172
|
+
async getAttachmentBlob(i) {
|
|
173
|
+
const o = {};
|
|
174
|
+
this.token && (o.Authorization = `Bearer ${this.token}`);
|
|
175
|
+
const d = await fetch(`${Be}/admin/chat-history/attachments/${i}`, {
|
|
168
176
|
method: "GET",
|
|
169
|
-
headers:
|
|
177
|
+
headers: o
|
|
170
178
|
});
|
|
171
|
-
if (!
|
|
172
|
-
const
|
|
173
|
-
throw new Error(
|
|
179
|
+
if (!d.ok) {
|
|
180
|
+
const g = await d.json().catch(() => ({ error: "Request failed" }));
|
|
181
|
+
throw new Error(g.error || `HTTP ${d.status}`);
|
|
174
182
|
}
|
|
175
|
-
return
|
|
183
|
+
return d.blob();
|
|
176
184
|
}
|
|
177
185
|
}
|
|
178
|
-
const
|
|
179
|
-
function
|
|
180
|
-
const { t:
|
|
181
|
-
|
|
182
|
-
if (
|
|
186
|
+
const w = new Vt();
|
|
187
|
+
function Bt({ onLoginSuccess: t }) {
|
|
188
|
+
const { t: i, i18n: o } = me(["admin", "translation"]), { app: d } = Ne(), { theme: g } = De(), [c, x] = p(""), [N, _] = p(""), [B, M] = p(""), [A, F] = p(""), [R, k] = p(!1), [$, H] = p(null), [S, D] = p("light");
|
|
189
|
+
Y(() => {
|
|
190
|
+
if (g === "system") {
|
|
183
191
|
const h = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
184
|
-
|
|
192
|
+
D(h ? "dark" : "light");
|
|
185
193
|
} else
|
|
186
|
-
|
|
187
|
-
}, [
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
D(g);
|
|
195
|
+
}, [g]);
|
|
196
|
+
const K = Ce(() => d?.logo ? typeof d.logo == "string" ? d.logo : S === "dark" ? d.logo.dark : d.logo.light : He, [d?.logo, S]), W = d?.adminTitle || d?.name, P = o.language === "fa";
|
|
197
|
+
Y(() => {
|
|
198
|
+
w.checkSetupStatus().then((h) => H(h.needs_setup)).catch(() => H(!1));
|
|
191
199
|
}, []);
|
|
192
|
-
const
|
|
193
|
-
h.preventDefault(),
|
|
200
|
+
const ae = async (h) => {
|
|
201
|
+
h.preventDefault(), F(""), k(!0);
|
|
194
202
|
try {
|
|
195
|
-
await
|
|
196
|
-
} catch (
|
|
197
|
-
|
|
203
|
+
await w.login(c, N), t();
|
|
204
|
+
} catch (E) {
|
|
205
|
+
F(E instanceof Error ? E.message : i("login.error"));
|
|
198
206
|
} finally {
|
|
199
|
-
|
|
207
|
+
k(!1);
|
|
200
208
|
}
|
|
201
|
-
},
|
|
202
|
-
if (h.preventDefault(),
|
|
203
|
-
|
|
209
|
+
}, Q = async (h) => {
|
|
210
|
+
if (h.preventDefault(), F(""), N !== B) {
|
|
211
|
+
F(i("login.passwords_mismatch"));
|
|
204
212
|
return;
|
|
205
213
|
}
|
|
206
|
-
if (
|
|
207
|
-
|
|
214
|
+
if (N.length < 4) {
|
|
215
|
+
F(i("login.password_too_short"));
|
|
208
216
|
return;
|
|
209
217
|
}
|
|
210
|
-
|
|
218
|
+
k(!0);
|
|
211
219
|
try {
|
|
212
|
-
await
|
|
220
|
+
await w.register(
|
|
213
221
|
"admin",
|
|
214
|
-
|
|
222
|
+
N,
|
|
215
223
|
"Admin",
|
|
216
224
|
["chat_history", "admin_management", "user_management", "analytics"]
|
|
217
|
-
), await
|
|
218
|
-
} catch (
|
|
219
|
-
|
|
225
|
+
), await w.login("admin", N), t();
|
|
226
|
+
} catch (E) {
|
|
227
|
+
F(E instanceof Error ? E.message : i("login.error"));
|
|
220
228
|
} finally {
|
|
221
|
-
|
|
229
|
+
k(!1);
|
|
222
230
|
}
|
|
223
231
|
};
|
|
224
|
-
return
|
|
232
|
+
return $ === null ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "w-6 h-6 border-2 border-border border-t-primary rounded-full animate-spin" }) }) : /* @__PURE__ */ r("div", { className: "min-h-screen bg-background flex items-center justify-center p-4 relative overflow-hidden", dir: P ? "rtl" : "ltr", children: [
|
|
225
233
|
/* @__PURE__ */ e("div", { className: "absolute top-[-10%] right-[-10%] w-[50%] h-[50%] bg-primary/10 rounded-full blur-3xl animate-pulse" }),
|
|
226
234
|
/* @__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
235
|
/* @__PURE__ */ r("div", { className: "w-full max-w-md z-10", children: [
|
|
228
236
|
/* @__PURE__ */ r("div", { className: "glass rounded-3xl p-10 shadow-2xl", children: [
|
|
229
237
|
/* @__PURE__ */ r("div", { className: "text-center mb-10", children: [
|
|
230
238
|
/* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-4 mb-6", children: [
|
|
231
|
-
/* @__PURE__ */ e("img", { src:
|
|
232
|
-
/* @__PURE__ */ e("h1", { className: "text-3xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children:
|
|
239
|
+
/* @__PURE__ */ e("img", { src: K, alt: W, className: "size-16 object-contain" }),
|
|
240
|
+
/* @__PURE__ */ e("h1", { className: "text-3xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: $ ? i("login.setup_title") : W })
|
|
233
241
|
] }),
|
|
234
|
-
|
|
242
|
+
$ && /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground mt-3", children: i("login.setup_description") })
|
|
235
243
|
] }),
|
|
236
|
-
|
|
244
|
+
$ ? (
|
|
237
245
|
/* ---- SETUP FORM ---- */
|
|
238
|
-
/* @__PURE__ */ r("form", { onSubmit:
|
|
246
|
+
/* @__PURE__ */ r("form", { onSubmit: Q, className: "space-y-7", children: [
|
|
239
247
|
/* @__PURE__ */ r("div", { children: [
|
|
240
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-bold text-muted-foreground uppercase tracking-widest mb-3.5 mx-1", children:
|
|
248
|
+
/* @__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
249
|
/* @__PURE__ */ e(
|
|
242
250
|
"input",
|
|
243
251
|
{
|
|
@@ -249,180 +257,209 @@ function Nt({ onLoginSuccess: t }) {
|
|
|
249
257
|
)
|
|
250
258
|
] }),
|
|
251
259
|
/* @__PURE__ */ r("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:
|
|
260
|
+
/* @__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
261
|
/* @__PURE__ */ e(
|
|
254
262
|
"input",
|
|
255
263
|
{
|
|
256
264
|
id: "setup-password",
|
|
257
265
|
type: "password",
|
|
258
|
-
value:
|
|
259
|
-
onChange: (h) =>
|
|
266
|
+
value: N,
|
|
267
|
+
onChange: (h) => _(h.target.value),
|
|
260
268
|
required: !0,
|
|
261
269
|
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:
|
|
270
|
+
placeholder: i("login.set_password_placeholder"),
|
|
263
271
|
dir: "ltr"
|
|
264
272
|
}
|
|
265
273
|
)
|
|
266
274
|
] }),
|
|
267
275
|
/* @__PURE__ */ r("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:
|
|
276
|
+
/* @__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
277
|
/* @__PURE__ */ e(
|
|
270
278
|
"input",
|
|
271
279
|
{
|
|
272
280
|
id: "setup-confirm",
|
|
273
281
|
type: "password",
|
|
274
|
-
value:
|
|
275
|
-
onChange: (h) =>
|
|
282
|
+
value: B,
|
|
283
|
+
onChange: (h) => M(h.target.value),
|
|
276
284
|
required: !0,
|
|
277
285
|
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:
|
|
286
|
+
placeholder: i("login.confirm_password_placeholder"),
|
|
279
287
|
dir: "ltr"
|
|
280
288
|
}
|
|
281
289
|
)
|
|
282
290
|
] }),
|
|
283
|
-
|
|
291
|
+
A && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3.5 rounded-2xl text-xs backdrop-blur-sm", children: A }),
|
|
284
292
|
/* @__PURE__ */ e(
|
|
285
293
|
"button",
|
|
286
294
|
{
|
|
287
295
|
type: "submit",
|
|
288
|
-
disabled:
|
|
296
|
+
disabled: R,
|
|
289
297
|
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:
|
|
298
|
+
children: R ? /* @__PURE__ */ r("div", { className: "flex items-center justify-center gap-2", children: [
|
|
291
299
|
/* @__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
|
-
] }) :
|
|
300
|
+
/* @__PURE__ */ e("span", { children: i("login.setting_up") })
|
|
301
|
+
] }) : i("login.create_admin")
|
|
294
302
|
}
|
|
295
303
|
)
|
|
296
304
|
] })
|
|
297
305
|
) : (
|
|
298
306
|
/* ---- LOGIN FORM ---- */
|
|
299
|
-
/* @__PURE__ */ r("form", { onSubmit:
|
|
307
|
+
/* @__PURE__ */ r("form", { onSubmit: ae, className: "space-y-7", children: [
|
|
300
308
|
/* @__PURE__ */ r("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:
|
|
309
|
+
/* @__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
310
|
/* @__PURE__ */ e(
|
|
303
311
|
"input",
|
|
304
312
|
{
|
|
305
313
|
id: "username",
|
|
306
314
|
type: "text",
|
|
307
|
-
value:
|
|
308
|
-
onChange: (h) =>
|
|
315
|
+
value: c,
|
|
316
|
+
onChange: (h) => x(h.target.value),
|
|
309
317
|
required: !0,
|
|
310
318
|
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:
|
|
319
|
+
placeholder: i("login.username_placeholder"),
|
|
312
320
|
dir: "ltr"
|
|
313
321
|
}
|
|
314
322
|
)
|
|
315
323
|
] }),
|
|
316
324
|
/* @__PURE__ */ r("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:
|
|
325
|
+
/* @__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
326
|
/* @__PURE__ */ e(
|
|
319
327
|
"input",
|
|
320
328
|
{
|
|
321
329
|
id: "password",
|
|
322
330
|
type: "password",
|
|
323
|
-
value:
|
|
324
|
-
onChange: (h) =>
|
|
331
|
+
value: N,
|
|
332
|
+
onChange: (h) => _(h.target.value),
|
|
325
333
|
required: !0,
|
|
326
334
|
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:
|
|
335
|
+
placeholder: i("login.password_placeholder"),
|
|
328
336
|
dir: "ltr"
|
|
329
337
|
}
|
|
330
338
|
)
|
|
331
339
|
] }),
|
|
332
|
-
|
|
340
|
+
A && /* @__PURE__ */ e("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3.5 rounded-2xl text-xs backdrop-blur-sm", children: A }),
|
|
333
341
|
/* @__PURE__ */ e(
|
|
334
342
|
"button",
|
|
335
343
|
{
|
|
336
344
|
type: "submit",
|
|
337
|
-
disabled:
|
|
345
|
+
disabled: R,
|
|
338
346
|
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:
|
|
347
|
+
children: R ? /* @__PURE__ */ r("div", { className: "flex items-center justify-center gap-2", children: [
|
|
340
348
|
/* @__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
|
-
] }) :
|
|
349
|
+
/* @__PURE__ */ e("span", { children: i("login.logging_in") })
|
|
350
|
+
] }) : i("login.submit")
|
|
343
351
|
}
|
|
344
352
|
)
|
|
345
353
|
] })
|
|
346
354
|
)
|
|
347
355
|
] }),
|
|
348
|
-
/* @__PURE__ */ e("div", { className: "mt-10 text-center text-[10px] text-muted-foreground uppercase tracking-widest font-bold", children: /* @__PURE__ */ e("p", { children:
|
|
356
|
+
/* @__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
357
|
] })
|
|
350
358
|
] });
|
|
351
359
|
}
|
|
352
|
-
function
|
|
353
|
-
const
|
|
354
|
-
|
|
360
|
+
function Xe(t, i, o) {
|
|
361
|
+
const d = (t || 0) / 1e6;
|
|
362
|
+
try {
|
|
363
|
+
return new Intl.NumberFormat(o, {
|
|
364
|
+
style: "currency",
|
|
365
|
+
currency: i,
|
|
366
|
+
minimumFractionDigits: d > 0 && d < 0.01 ? 6 : 2,
|
|
367
|
+
maximumFractionDigits: 6
|
|
368
|
+
}).format(d);
|
|
369
|
+
} catch {
|
|
370
|
+
return `${i} ${d.toLocaleString(o, { maximumFractionDigits: 6 })}`;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
function xe(t, i, o) {
|
|
374
|
+
const d = (t || 0) / 1e6;
|
|
375
|
+
try {
|
|
376
|
+
return new Intl.NumberFormat(o, {
|
|
377
|
+
style: "currency",
|
|
378
|
+
currency: i,
|
|
379
|
+
minimumFractionDigits: 2,
|
|
380
|
+
maximumFractionDigits: 2
|
|
381
|
+
}).format(d);
|
|
382
|
+
} catch {
|
|
383
|
+
return `${i} ${d.toLocaleString(o, {
|
|
384
|
+
minimumFractionDigits: 2,
|
|
385
|
+
maximumFractionDigits: 2
|
|
386
|
+
})}`;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
function Ht() {
|
|
390
|
+
const { t, i18n: i } = me(["admin", "translation"]), { app: o } = Ne(), d = o?.userMetadataFields || [], [g, c] = p([]), [x, N] = p(null), [_, B] = p([]), [M, A] = p(!1), [F, R] = p(!1), [k, $] = p(""), [H, S] = p(""), [D, K] = p(""), [W, P] = p(0), [ae, Q] = p(!0), h = i.language === "fa", E = h ? "fa-IR" : "en-US", U = async (n = !1) => {
|
|
391
|
+
n ? R(!0) : (A(!0), P(0)), $("");
|
|
355
392
|
try {
|
|
356
|
-
const
|
|
357
|
-
|
|
393
|
+
const m = n ? W + 50 : 0, v = await w.listThreads(
|
|
394
|
+
m,
|
|
358
395
|
50,
|
|
359
396
|
H || void 0,
|
|
360
|
-
|
|
397
|
+
D || void 0
|
|
361
398
|
);
|
|
362
|
-
|
|
363
|
-
} catch (
|
|
364
|
-
|
|
399
|
+
n ? (c((L) => [...L, ...v.threads]), P(m)) : (c(v.threads), P(0)), Q(v.threads.length === 50);
|
|
400
|
+
} catch (m) {
|
|
401
|
+
$(m instanceof Error ? m.message : t("error_loading"));
|
|
365
402
|
} finally {
|
|
366
|
-
|
|
403
|
+
A(!1), R(!1);
|
|
367
404
|
}
|
|
368
|
-
},
|
|
369
|
-
|
|
405
|
+
}, f = async (n) => {
|
|
406
|
+
N(n), A(!0), $("");
|
|
370
407
|
try {
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
} catch (
|
|
374
|
-
|
|
408
|
+
const m = await w.getThreadItems(n.id);
|
|
409
|
+
B(m.items);
|
|
410
|
+
} catch (m) {
|
|
411
|
+
$(m instanceof Error ? m.message : t("error_loading"));
|
|
375
412
|
} finally {
|
|
376
|
-
|
|
413
|
+
A(!1);
|
|
377
414
|
}
|
|
378
|
-
},
|
|
379
|
-
|
|
415
|
+
}, q = async (n, m) => {
|
|
416
|
+
n.stopPropagation();
|
|
380
417
|
try {
|
|
381
|
-
const
|
|
382
|
-
navigator.clipboard.writeText(
|
|
418
|
+
const v = await w.shareThread(m.id), L = `${window.location.origin}${v.url}`;
|
|
419
|
+
navigator.clipboard.writeText(L), Je.success(t("sidebar.share_success"), {
|
|
383
420
|
description: t("sidebar.share_description")
|
|
384
421
|
});
|
|
385
422
|
} catch {
|
|
386
|
-
|
|
423
|
+
Je.error(t("sidebar.share_failed"));
|
|
387
424
|
}
|
|
388
425
|
};
|
|
389
|
-
|
|
390
|
-
const
|
|
391
|
-
|
|
426
|
+
Y(() => {
|
|
427
|
+
const n = setTimeout(() => {
|
|
428
|
+
U();
|
|
392
429
|
}, 500);
|
|
393
|
-
return () => clearTimeout(
|
|
394
|
-
}, [H,
|
|
395
|
-
const
|
|
396
|
-
const
|
|
430
|
+
return () => clearTimeout(n);
|
|
431
|
+
}, [H, D]);
|
|
432
|
+
const s = (n) => {
|
|
433
|
+
const m = new Date(n);
|
|
397
434
|
return new Intl.DateTimeFormat(h ? "fa-IR" : "en-US", {
|
|
398
435
|
year: "numeric",
|
|
399
436
|
month: "long",
|
|
400
437
|
day: "numeric",
|
|
401
438
|
hour: "2-digit",
|
|
402
439
|
minute: "2-digit"
|
|
403
|
-
}).format(
|
|
404
|
-
},
|
|
405
|
-
if (typeof
|
|
440
|
+
}).format(m);
|
|
441
|
+
}, u = (n) => {
|
|
442
|
+
if (typeof n == "string")
|
|
406
443
|
try {
|
|
407
|
-
return JSON.stringify(JSON.parse(
|
|
444
|
+
return JSON.stringify(JSON.parse(n), null, 2);
|
|
408
445
|
} catch {
|
|
409
|
-
return
|
|
446
|
+
return n;
|
|
410
447
|
}
|
|
411
|
-
return JSON.stringify(
|
|
412
|
-
},
|
|
413
|
-
const [
|
|
448
|
+
return JSON.stringify(n, null, 2);
|
|
449
|
+
}, j = ({ part: n, idx: m }) => {
|
|
450
|
+
const [v, L] = p(!1), G = n.tool_name || (n.type && n.type.startsWith("tool-") ? n.type.slice(5) : "tool");
|
|
414
451
|
return /* @__PURE__ */ r("div", { dir: "ltr", className: "my-2 border border-border/50 rounded-xl overflow-hidden bg-muted/20 text-left", children: [
|
|
415
452
|
/* @__PURE__ */ r(
|
|
416
453
|
"div",
|
|
417
454
|
{
|
|
418
|
-
onClick: () =>
|
|
455
|
+
onClick: () => L(!v),
|
|
419
456
|
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
457
|
children: [
|
|
421
458
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
422
459
|
/* @__PURE__ */ e(
|
|
423
460
|
"svg",
|
|
424
461
|
{
|
|
425
|
-
className: `w-3 h-3 text-gray-400 transition-transform ${
|
|
462
|
+
className: `w-3 h-3 text-gray-400 transition-transform ${v ? "rotate-180" : ""}`,
|
|
426
463
|
fill: "none",
|
|
427
464
|
viewBox: "0 0 24 24",
|
|
428
465
|
stroke: "currentColor",
|
|
@@ -430,53 +467,53 @@ function _t() {
|
|
|
430
467
|
}
|
|
431
468
|
),
|
|
432
469
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold uppercase tracking-widest text-muted-foreground", children: "Tool" }),
|
|
433
|
-
/* @__PURE__ */ e("span", { className: "text-xs font-semibold", children:
|
|
470
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-semibold", children: G })
|
|
434
471
|
] }),
|
|
435
|
-
/* @__PURE__ */ e("span", { className: `text-[10px] px-2 py-0.5 rounded-full ${
|
|
472
|
+
/* @__PURE__ */ e("span", { className: `text-[10px] px-2 py-0.5 rounded-full ${n.state === "output-available" ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"}`, children: n.state === "output-available" ? t("chat_history.output_available") : t("chat_history.running") })
|
|
436
473
|
]
|
|
437
474
|
}
|
|
438
475
|
),
|
|
439
|
-
|
|
476
|
+
v && /* @__PURE__ */ r("div", { className: "p-2.5 space-y-2.5 animate-in fade-in slide-in-from-top-1 duration-200", children: [
|
|
440
477
|
/* @__PURE__ */ r("div", { children: [
|
|
441
478
|
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: "Input" }),
|
|
442
|
-
/* @__PURE__ */ e("pre", { className: "text-xs bg-black/5 dark:bg-black/20 p-2 rounded-lg overflow-x-auto", children:
|
|
479
|
+
/* @__PURE__ */ e("pre", { className: "text-xs bg-black/5 dark:bg-black/20 p-2 rounded-lg overflow-x-auto", children: u(n.input) })
|
|
443
480
|
] }),
|
|
444
|
-
(
|
|
445
|
-
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children:
|
|
446
|
-
/* @__PURE__ */ e("pre", { className: `text-xs p-2 rounded-lg overflow-x-auto ${
|
|
481
|
+
(n.output || n.error_text || n.errorText) && /* @__PURE__ */ r("div", { children: [
|
|
482
|
+
/* @__PURE__ */ e("div", { className: "text-[10px] uppercase font-bold text-muted-foreground mb-1", children: n.error_text || n.errorText ? "Error" : "Output" }),
|
|
483
|
+
/* @__PURE__ */ e("pre", { className: `text-xs p-2 rounded-lg overflow-x-auto ${n.error_text || n.errorText ? "bg-destructive/10 text-destructive" : "bg-primary/5 text-foreground/80"}`, children: u(n.output || n.error_text || n.errorText) })
|
|
447
484
|
] })
|
|
448
485
|
] })
|
|
449
|
-
] },
|
|
450
|
-
},
|
|
486
|
+
] }, m);
|
|
487
|
+
}, O = async (n, m) => {
|
|
451
488
|
try {
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
} catch (
|
|
455
|
-
console.error("Download failed:",
|
|
489
|
+
const v = await w.getAttachmentBlob(n), L = window.URL.createObjectURL(v), G = document.createElement("a");
|
|
490
|
+
G.href = L, G.download = m || n.split("/").pop() || "download", document.body.appendChild(G), G.click(), window.URL.revokeObjectURL(L), document.body.removeChild(G);
|
|
491
|
+
} catch (v) {
|
|
492
|
+
console.error("Download failed:", v), $(v instanceof Error ? v.message : "Download failed");
|
|
456
493
|
}
|
|
457
|
-
},
|
|
494
|
+
}, C = (n, m) => typeof n == "string" ? /* @__PURE__ */ e("div", { children: n }, m) : n.type === "text" ? /* @__PURE__ */ e("div", { className: "whitespace-pre-wrap", dir: "auto", children: n.text }, m) : n.type === "reasoning" ? /* @__PURE__ */ r("div", { className: "my-2 p-2.5 bg-muted/40 rounded-lg border border-border text-xs italic text-muted-foreground", dir: "auto", children: [
|
|
458
495
|
/* @__PURE__ */ e("div", { className: "font-bold mb-1 uppercase tracking-tighter opacity-70", children: "Reasoning" }),
|
|
459
|
-
|
|
460
|
-
] },
|
|
496
|
+
n.text
|
|
497
|
+
] }, m) : n.type === "dynamic-tool" || n.type && n.type.startsWith("tool-") || n.tool_call_id ? /* @__PURE__ */ e(j, { part: n, idx: m }, m) : n.type === "file" ? /* @__PURE__ */ r("div", { className: "my-2 flex items-center justify-between p-2.5 bg-muted/40 rounded-xl border border-border group hover:border-primary/30 transition-all", children: [
|
|
461
498
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
462
499
|
/* @__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
500
|
/* @__PURE__ */ r("div", { className: "flex flex-col min-w-0", children: [
|
|
464
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-foreground font-medium truncate", title:
|
|
465
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground uppercase tracking-wider font-bold", children:
|
|
501
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-foreground font-medium truncate", title: n.filename || "File", children: n.filename || t("chat_history.unnamed_file") }),
|
|
502
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground uppercase tracking-wider font-bold", children: n.media_type || n.mime_type || n.mediaType || "file" })
|
|
466
503
|
] })
|
|
467
504
|
] }),
|
|
468
|
-
|
|
505
|
+
n.object_name && /* @__PURE__ */ e(
|
|
469
506
|
"button",
|
|
470
507
|
{
|
|
471
|
-
onClick: () =>
|
|
508
|
+
onClick: () => O(n.object_name, n.filename),
|
|
472
509
|
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
510
|
title: t("chat_history.download_file", "Download File"),
|
|
474
511
|
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
512
|
}
|
|
476
513
|
)
|
|
477
|
-
] },
|
|
478
|
-
const { scrollTop:
|
|
479
|
-
|
|
514
|
+
] }, m) : /* @__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(n) }, m), z = (n) => {
|
|
515
|
+
const { scrollTop: m, scrollHeight: v, clientHeight: L } = n.currentTarget;
|
|
516
|
+
v - m <= L + 50 && !F && ae && U(!0);
|
|
480
517
|
};
|
|
481
518
|
return /* @__PURE__ */ r("div", { className: "p-5 h-full flex flex-col gap-4 overflow-hidden", dir: h ? "rtl" : "ltr", children: [
|
|
482
519
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-3", children: [
|
|
@@ -486,8 +523,8 @@ function _t() {
|
|
|
486
523
|
/* @__PURE__ */ r(
|
|
487
524
|
"form",
|
|
488
525
|
{
|
|
489
|
-
onSubmit: (
|
|
490
|
-
|
|
526
|
+
onSubmit: (n) => {
|
|
527
|
+
n.preventDefault(), U();
|
|
491
528
|
},
|
|
492
529
|
className: "flex-1 flex gap-2",
|
|
493
530
|
children: [
|
|
@@ -496,7 +533,7 @@ function _t() {
|
|
|
496
533
|
{
|
|
497
534
|
type: "text",
|
|
498
535
|
value: H,
|
|
499
|
-
onChange: (
|
|
536
|
+
onChange: (n) => S(n.target.value),
|
|
500
537
|
placeholder: t("chat_history.search_placeholder"),
|
|
501
538
|
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
539
|
}
|
|
@@ -515,8 +552,8 @@ function _t() {
|
|
|
515
552
|
/* @__PURE__ */ r(
|
|
516
553
|
"select",
|
|
517
554
|
{
|
|
518
|
-
value:
|
|
519
|
-
onChange: (
|
|
555
|
+
value: D,
|
|
556
|
+
onChange: (n) => K(n.target.value),
|
|
520
557
|
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
558
|
children: [
|
|
522
559
|
/* @__PURE__ */ e("option", { value: "", children: t("chat_history.all_feedbacks", "All Feedbacks") }),
|
|
@@ -528,136 +565,156 @@ function _t() {
|
|
|
528
565
|
)
|
|
529
566
|
] })
|
|
530
567
|
] }),
|
|
531
|
-
|
|
568
|
+
k && /* @__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: k })
|
|
532
569
|
] }),
|
|
533
570
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-[380px_1fr] gap-4 flex-1 min-h-0", children: [
|
|
534
571
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col min-w-0", children: [
|
|
535
572
|
/* @__PURE__ */ e("div", { className: "px-5 py-2.5 border-b border-border/30", children: /* @__PURE__ */ r("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide", children: [
|
|
536
573
|
t("chat_history.threads_list"),
|
|
537
574
|
" (",
|
|
538
|
-
(
|
|
575
|
+
(g.length || 0).toLocaleString(E),
|
|
539
576
|
")"
|
|
540
577
|
] }) }),
|
|
541
578
|
/* @__PURE__ */ e(
|
|
542
579
|
"div",
|
|
543
580
|
{
|
|
544
581
|
className: "flex-1 overflow-y-auto p-2 custom-scrollbar",
|
|
545
|
-
onScroll:
|
|
546
|
-
children:
|
|
547
|
-
|
|
582
|
+
onScroll: z,
|
|
583
|
+
children: M && g.length === 0 ? /* @__PURE__ */ e("div", { className: "p-8 text-center text-muted-foreground text-sm", children: t("chat_history.no_threads") }) : /* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
584
|
+
g.map((n) => /* @__PURE__ */ r(
|
|
548
585
|
"div",
|
|
549
586
|
{
|
|
550
|
-
onClick: () =>
|
|
551
|
-
className: `p-2.5 cursor-pointer transition-all rounded-xl border ${
|
|
587
|
+
onClick: () => f(n),
|
|
588
|
+
className: `p-2.5 cursor-pointer transition-all rounded-xl border ${x?.id === n.id ? "bg-card border-border shadow-sm" : "border-transparent hover:bg-muted/50"}`,
|
|
552
589
|
children: [
|
|
553
590
|
/* @__PURE__ */ r("div", { className: "flex justify-between items-start mb-1.5 gap-4", children: [
|
|
554
591
|
/* @__PURE__ */ e(
|
|
555
592
|
"h3",
|
|
556
593
|
{
|
|
557
|
-
className: `font-medium text-sm truncate flex-1 ${
|
|
558
|
-
title:
|
|
559
|
-
children:
|
|
594
|
+
className: `font-medium text-sm truncate flex-1 ${x?.id === n.id ? "text-primary" : "text-foreground"}`,
|
|
595
|
+
title: n.title || t("chat_history.no_thread_title"),
|
|
596
|
+
children: n.title || t("chat_history.no_thread_title")
|
|
560
597
|
}
|
|
561
598
|
),
|
|
562
599
|
/* @__PURE__ */ r("div", { className: "flex gap-1", children: [
|
|
563
|
-
|
|
564
|
-
|
|
600
|
+
n.feedback_info && n.feedback_info.like > 0 && /* @__PURE__ */ e("span", { className: "text-xs", children: "👍" }),
|
|
601
|
+
n.feedback_info && n.feedback_info.dislike > 0 && /* @__PURE__ */ e("span", { className: "text-xs", children: "👎" })
|
|
565
602
|
] })
|
|
566
603
|
] }),
|
|
567
604
|
/* @__PURE__ */ r("div", { className: "text-xs space-y-1.5 text-muted-foreground", children: [
|
|
568
|
-
|
|
605
|
+
n.user_info && /* @__PURE__ */ r(
|
|
569
606
|
"div",
|
|
570
607
|
{
|
|
571
608
|
className: "flex flex-col gap-0.5 min-w-0",
|
|
572
|
-
title: `${
|
|
573
|
-
const
|
|
574
|
-
if (
|
|
575
|
-
const
|
|
576
|
-
return ` • ${
|
|
609
|
+
title: `${n.user_info.name} ${n.user_info.surname} ${n.user_info.phone ? ` • ${n.user_info.phone}` : ""}${d.filter((m) => n.user_info?.metadata?.[m.key] !== void 0 && n.user_info?.metadata?.[m.key] !== "").map((m) => {
|
|
610
|
+
const v = n.user_info?.metadata?.[m.key];
|
|
611
|
+
if (m.type === "select") {
|
|
612
|
+
const L = m.options?.find((G) => String(G.value) === String(v));
|
|
613
|
+
return ` • ${L ? t(L.label) : v}`;
|
|
577
614
|
}
|
|
578
|
-
return ` • ${
|
|
579
|
-
}).join("")}${
|
|
615
|
+
return ` • ${v}`;
|
|
616
|
+
}).join("")}${n.user_info.metadata?.values !== void 0 && !d.some((m) => m.key === "values") ? ` • ${n.user_info.metadata.values}` : ""}`,
|
|
580
617
|
children: [
|
|
581
618
|
/* @__PURE__ */ r("div", { className: "font-medium text-foreground truncate flex items-center gap-1.5", children: [
|
|
582
619
|
/* @__PURE__ */ r("span", { children: [
|
|
583
|
-
|
|
620
|
+
n.user_info.name,
|
|
584
621
|
" ",
|
|
585
|
-
|
|
622
|
+
n.user_info.surname
|
|
586
623
|
] }),
|
|
587
|
-
|
|
624
|
+
n.user_info.phone && /* @__PURE__ */ r("span", { className: "text-[11px] text-foreground/70 font-normal", children: [
|
|
588
625
|
"•",
|
|
589
626
|
" ",
|
|
590
|
-
|
|
627
|
+
n.user_info.phone
|
|
591
628
|
] })
|
|
592
629
|
] }),
|
|
593
630
|
/* @__PURE__ */ r("div", { className: "text-[10px] text-muted-foreground/70 truncate flex items-center gap-1", children: [
|
|
594
|
-
|
|
595
|
-
const
|
|
596
|
-
return
|
|
597
|
-
}).map((
|
|
598
|
-
const
|
|
599
|
-
let
|
|
600
|
-
if (
|
|
601
|
-
const
|
|
602
|
-
|
|
603
|
-
} else
|
|
631
|
+
d.filter((m) => {
|
|
632
|
+
const v = n.user_info?.metadata?.[m.key];
|
|
633
|
+
return v != null && v !== "";
|
|
634
|
+
}).map((m, v) => {
|
|
635
|
+
const L = n.user_info?.metadata?.[m.key];
|
|
636
|
+
let G = String(L);
|
|
637
|
+
if (m.type === "select") {
|
|
638
|
+
const pe = m.options?.find((l) => String(l.value) === String(L));
|
|
639
|
+
pe && (G = t(pe.label));
|
|
640
|
+
} else m.type === "checkbox" && (G = L ? "✓" : "✗");
|
|
604
641
|
return /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
] },
|
|
642
|
+
v > 0 && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
643
|
+
G
|
|
644
|
+
] }, m.key);
|
|
608
645
|
}),
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
String(
|
|
646
|
+
n.user_info.metadata?.values !== void 0 && !d.some((m) => m.key === "values") && /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
|
|
647
|
+
d.some((m) => n.user_info?.metadata?.[m.key] !== void 0) && /* @__PURE__ */ e("span", { className: "opacity-30", children: "|" }),
|
|
648
|
+
String(n.user_info.metadata.values)
|
|
612
649
|
] })
|
|
613
650
|
] })
|
|
614
651
|
]
|
|
615
652
|
}
|
|
616
653
|
),
|
|
617
|
-
|
|
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: t("chat_history.input_tokens", {
|
|
619
|
-
|
|
654
|
+
n.metadata?.usage && /* @__PURE__ */ r("div", { className: "flex gap-2 mt-2 pt-2 border-border/30", children: [
|
|
655
|
+
/* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground", children: t("chat_history.input_tokens", {
|
|
656
|
+
value: (n.metadata.usage.cumulative_input_tokens ?? n.metadata.usage.input_tokens ?? 0).toLocaleString(E)
|
|
657
|
+
}) }),
|
|
658
|
+
/* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground", children: t("chat_history.output_tokens", { value: (n.metadata.usage.output_tokens || 0).toLocaleString(E) }) }),
|
|
659
|
+
/* @__PURE__ */ e(
|
|
660
|
+
"span",
|
|
661
|
+
{
|
|
662
|
+
className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground",
|
|
663
|
+
title: n.metadata.usage.cost_incomplete || n.metadata.usage.total_cost_microunits === void 0 ? void 0 : Xe(
|
|
664
|
+
n.metadata.usage.total_cost_microunits || 0,
|
|
665
|
+
n.metadata.usage.currency || "USD",
|
|
666
|
+
E
|
|
667
|
+
),
|
|
668
|
+
children: n.metadata.usage.cost_incomplete || n.metadata.usage.total_cost_microunits === void 0 ? t("chat_history.unpriced") : t("chat_history.cost", {
|
|
669
|
+
value: xe(
|
|
670
|
+
n.metadata.usage.total_cost_microunits || 0,
|
|
671
|
+
n.metadata.usage.currency || "USD",
|
|
672
|
+
E
|
|
673
|
+
)
|
|
674
|
+
})
|
|
675
|
+
}
|
|
676
|
+
)
|
|
620
677
|
] }),
|
|
621
|
-
/* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children:
|
|
678
|
+
/* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: s(n.created_at) })
|
|
622
679
|
] })
|
|
623
680
|
]
|
|
624
681
|
},
|
|
625
|
-
|
|
682
|
+
n.id
|
|
626
683
|
)),
|
|
627
|
-
|
|
684
|
+
F && /* @__PURE__ */ e("div", { className: "p-4 text-center text-muted-foreground text-xs", children: t("loading_more") })
|
|
628
685
|
] })
|
|
629
686
|
}
|
|
630
687
|
)
|
|
631
688
|
] }),
|
|
632
689
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm overflow-hidden flex flex-col", children: [
|
|
633
690
|
/* @__PURE__ */ r("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:
|
|
635
|
-
|
|
691
|
+
/* @__PURE__ */ e("h2", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wide truncate", children: x ? t("chat_history.messages_for", { title: x.title || t("chat_history.no_thread_title") }) : t("chat_history.messages") }),
|
|
692
|
+
x && /* @__PURE__ */ e(
|
|
636
693
|
"button",
|
|
637
694
|
{
|
|
638
|
-
onClick: (
|
|
695
|
+
onClick: (n) => q(n, x),
|
|
639
696
|
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
697
|
title: t("sidebar.share_conversation"),
|
|
641
|
-
children: /* @__PURE__ */ e(
|
|
698
|
+
children: /* @__PURE__ */ e(jt, { className: "w-4 h-4" })
|
|
642
699
|
}
|
|
643
700
|
)
|
|
644
701
|
] }),
|
|
645
|
-
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children:
|
|
646
|
-
const
|
|
702
|
+
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto p-4 custom-scrollbar", children: x ? M ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: t("chat_history.loading_messages") }) : _.length === 0 ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground text-sm", children: t("chat_history.empty_thread") }) : /* @__PURE__ */ e("div", { className: "space-y-6", children: _.map((n) => {
|
|
703
|
+
const m = n.role === "user", v = n.role === "assistant";
|
|
647
704
|
return /* @__PURE__ */ r(
|
|
648
705
|
"div",
|
|
649
706
|
{
|
|
650
|
-
className: `p-3.5 rounded-2xl transition-all relative ${
|
|
707
|
+
className: `p-3.5 rounded-2xl transition-all relative ${m ? "bg-primary/10 ms-12 rounded-te-sm" : v ? "glass shadow-sm me-12 rounded-ts-sm" : "bg-muted/30 border border-border/50"}`,
|
|
651
708
|
children: [
|
|
652
|
-
|
|
709
|
+
n.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: n.feedback === "like" ? "👍" : "👎" }) }),
|
|
653
710
|
/* @__PURE__ */ r("div", { className: "flex justify-between items-center mb-1.5", children: [
|
|
654
|
-
/* @__PURE__ */ e("span", { className: `text-[10px] font-bold uppercase tracking-wider ${
|
|
655
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children:
|
|
711
|
+
/* @__PURE__ */ e("span", { className: `text-[10px] font-bold uppercase tracking-wider ${m || v ? "text-primary" : "text-muted-foreground"}`, children: m ? x?.user_info?.name ? `${x.user_info.name} ${x.user_info.surname || ""}`.trim() : t("chat_history.user_label") : v ? t("chat_history.assistant_label") : `${n.role}` }),
|
|
712
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-muted-foreground", children: s(n.created_at) })
|
|
656
713
|
] }),
|
|
657
|
-
/* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children:
|
|
714
|
+
/* @__PURE__ */ e("div", { className: "text-sm text-foreground leading-relaxed", dir: "auto", children: n.parts && n.parts.length > 0 ? n.parts.map((L, G) => C(L, G)) : typeof n.content == "object" ? /* @__PURE__ */ e("pre", { className: "text-xs font-mono bg-muted/40 p-2.5 rounded-xl", dir: "ltr", children: JSON.stringify(n.content, null, 2) }) : n.content })
|
|
658
715
|
]
|
|
659
716
|
},
|
|
660
|
-
|
|
717
|
+
n.id
|
|
661
718
|
);
|
|
662
719
|
}) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col items-center justify-center text-muted-foreground", children: [
|
|
663
720
|
/* @__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" }) }),
|
|
@@ -667,96 +724,96 @@ function _t() {
|
|
|
667
724
|
] })
|
|
668
725
|
] });
|
|
669
726
|
}
|
|
670
|
-
function
|
|
671
|
-
const { t, i18n:
|
|
727
|
+
function Wt() {
|
|
728
|
+
const { t, i18n: i } = me(["admin", "translation"]), [o, d] = p([]), [g, c] = p(!1), [x, N] = p(""), [_, B] = p(!1), [M, A] = p(null), [F, R] = p([]), [k, $] = p(null), H = i.language === "fa", [S, D] = p({
|
|
672
729
|
username: "",
|
|
673
730
|
password: "",
|
|
674
731
|
name: "",
|
|
675
732
|
permissions: []
|
|
676
|
-
}),
|
|
677
|
-
|
|
733
|
+
}), K = async () => {
|
|
734
|
+
c(!0), N("");
|
|
678
735
|
try {
|
|
679
|
-
const
|
|
680
|
-
|
|
681
|
-
const
|
|
682
|
-
|
|
683
|
-
} catch (
|
|
684
|
-
|
|
736
|
+
const f = await w.listAdmins();
|
|
737
|
+
d(f.admins || []);
|
|
738
|
+
const q = localStorage.getItem("admin_info");
|
|
739
|
+
q && $(JSON.parse(q).admin_id);
|
|
740
|
+
} catch (f) {
|
|
741
|
+
N(f instanceof Error ? f.message : t("error_loading"));
|
|
685
742
|
} finally {
|
|
686
|
-
|
|
743
|
+
c(!1);
|
|
687
744
|
}
|
|
688
|
-
},
|
|
745
|
+
}, W = async () => {
|
|
689
746
|
try {
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
} catch (
|
|
693
|
-
console.error("Failed to load permissions",
|
|
747
|
+
const f = await w.listPermissions();
|
|
748
|
+
R(f.permissions);
|
|
749
|
+
} catch (f) {
|
|
750
|
+
console.error("Failed to load permissions", f);
|
|
694
751
|
}
|
|
695
752
|
};
|
|
696
|
-
|
|
697
|
-
|
|
753
|
+
Y(() => {
|
|
754
|
+
K(), W();
|
|
698
755
|
}, []);
|
|
699
|
-
const
|
|
700
|
-
|
|
756
|
+
const P = async (f) => {
|
|
757
|
+
f.preventDefault(), c(!0);
|
|
701
758
|
try {
|
|
702
|
-
await
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
),
|
|
708
|
-
} catch (
|
|
709
|
-
|
|
759
|
+
await w.register(
|
|
760
|
+
S.username,
|
|
761
|
+
S.password,
|
|
762
|
+
S.name,
|
|
763
|
+
S.permissions
|
|
764
|
+
), B(!1), D({ username: "", password: "", name: "", permissions: [] }), K();
|
|
765
|
+
} catch (q) {
|
|
766
|
+
N(q instanceof Error ? q.message : t("error_loading"));
|
|
710
767
|
} finally {
|
|
711
|
-
|
|
768
|
+
c(!1);
|
|
712
769
|
}
|
|
713
|
-
},
|
|
714
|
-
if (
|
|
715
|
-
|
|
770
|
+
}, ae = async (f) => {
|
|
771
|
+
if (f.preventDefault(), !!M) {
|
|
772
|
+
c(!0);
|
|
716
773
|
try {
|
|
717
|
-
const
|
|
718
|
-
name:
|
|
719
|
-
permissions:
|
|
774
|
+
const q = {
|
|
775
|
+
name: S.name,
|
|
776
|
+
permissions: S.permissions
|
|
720
777
|
};
|
|
721
|
-
if (
|
|
722
|
-
const
|
|
723
|
-
if (
|
|
724
|
-
const
|
|
725
|
-
|
|
778
|
+
if (S.password && (q.password = S.password), await w.updateAdmin(M.id, q), M.id === k) {
|
|
779
|
+
const s = localStorage.getItem("admin_info");
|
|
780
|
+
if (s) {
|
|
781
|
+
const u = JSON.parse(s);
|
|
782
|
+
u.name = S.name, u.permissions = S.permissions, localStorage.setItem("admin_info", JSON.stringify(u)), window.location.reload();
|
|
726
783
|
return;
|
|
727
784
|
}
|
|
728
785
|
}
|
|
729
|
-
|
|
730
|
-
} catch (
|
|
731
|
-
|
|
786
|
+
A(null), D({ username: "", password: "", name: "", permissions: [] }), K();
|
|
787
|
+
} catch (q) {
|
|
788
|
+
N(q instanceof Error ? q.message : t("error_loading"));
|
|
732
789
|
} finally {
|
|
733
|
-
|
|
790
|
+
c(!1);
|
|
734
791
|
}
|
|
735
792
|
}
|
|
736
|
-
},
|
|
793
|
+
}, Q = async (f) => {
|
|
737
794
|
if (confirm(t("admins.confirm_delete_admin")))
|
|
738
795
|
try {
|
|
739
|
-
await
|
|
740
|
-
} catch (
|
|
741
|
-
|
|
796
|
+
await w.deleteAdmin(f), K();
|
|
797
|
+
} catch (q) {
|
|
798
|
+
N(q instanceof Error ? q.message : t("error_loading"));
|
|
742
799
|
}
|
|
743
|
-
}, h = (
|
|
744
|
-
|
|
745
|
-
username:
|
|
800
|
+
}, h = (f) => {
|
|
801
|
+
A(f), D({
|
|
802
|
+
username: f.username,
|
|
746
803
|
password: "",
|
|
747
|
-
name:
|
|
748
|
-
permissions:
|
|
749
|
-
}),
|
|
750
|
-
},
|
|
751
|
-
|
|
752
|
-
...
|
|
753
|
-
permissions:
|
|
804
|
+
name: f.name,
|
|
805
|
+
permissions: f.permissions
|
|
806
|
+
}), B(!0);
|
|
807
|
+
}, E = (f) => {
|
|
808
|
+
D((q) => ({
|
|
809
|
+
...q,
|
|
810
|
+
permissions: q.permissions.includes(f) ? q.permissions.filter((s) => s !== f) : [...q.permissions, f]
|
|
754
811
|
}));
|
|
755
|
-
},
|
|
756
|
-
const
|
|
757
|
-
if (
|
|
758
|
-
return
|
|
759
|
-
switch (
|
|
812
|
+
}, U = (f) => {
|
|
813
|
+
const q = `admins.perm_${f}`, s = t(q);
|
|
814
|
+
if (s !== q)
|
|
815
|
+
return s;
|
|
816
|
+
switch (f) {
|
|
760
817
|
case "chat_history":
|
|
761
818
|
return t("admins.perm_chat_history");
|
|
762
819
|
case "admin_management":
|
|
@@ -768,19 +825,19 @@ function wt() {
|
|
|
768
825
|
case "settings":
|
|
769
826
|
return t("admins.perm_settings");
|
|
770
827
|
default:
|
|
771
|
-
return
|
|
828
|
+
return f;
|
|
772
829
|
}
|
|
773
830
|
};
|
|
774
831
|
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: H ? "rtl" : "ltr", children: [
|
|
775
832
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
|
|
776
833
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("admins.title") }),
|
|
777
834
|
/* @__PURE__ */ r("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: t("admins.admin_count", { count:
|
|
835
|
+
/* @__PURE__ */ e("div", { className: "glass-surface px-4 py-2.5 rounded-xl text-xs font-medium text-muted-foreground border border-border shadow-sm", children: t("admins.admin_count", { count: o.length }) }),
|
|
779
836
|
/* @__PURE__ */ e(
|
|
780
837
|
"button",
|
|
781
838
|
{
|
|
782
839
|
onClick: () => {
|
|
783
|
-
|
|
840
|
+
A(null), D({ username: "", password: "", name: "", permissions: [] }), B(!0);
|
|
784
841
|
},
|
|
785
842
|
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
843
|
children: t("admins.add_admin")
|
|
@@ -788,19 +845,19 @@ function wt() {
|
|
|
788
845
|
)
|
|
789
846
|
] })
|
|
790
847
|
] }),
|
|
791
|
-
|
|
792
|
-
|
|
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: t(
|
|
794
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit:
|
|
848
|
+
x && /* @__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: x }),
|
|
849
|
+
_ && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ r("div", { className: "bg-card rounded-2xl border border-border w-full max-w-md shadow-2xl overflow-hidden", children: [
|
|
850
|
+
/* @__PURE__ */ e("div", { className: "px-6 py-5 border-b border-border bg-muted/20", children: /* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground", children: t(M ? "admins.edit_admin" : "admins.add_admin") }) }),
|
|
851
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: M ? ae : P, className: "space-y-5", children: [
|
|
795
852
|
/* @__PURE__ */ r("div", { children: [
|
|
796
853
|
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("admins.username") }),
|
|
797
854
|
/* @__PURE__ */ e(
|
|
798
855
|
"input",
|
|
799
856
|
{
|
|
800
857
|
type: "text",
|
|
801
|
-
disabled: !!
|
|
802
|
-
value:
|
|
803
|
-
onChange: (
|
|
858
|
+
disabled: !!M,
|
|
859
|
+
value: S.username,
|
|
860
|
+
onChange: (f) => D({ ...S, username: f.target.value }),
|
|
804
861
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground disabled:opacity-50 focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm font-mono dir-ltr",
|
|
805
862
|
required: !0,
|
|
806
863
|
dir: "ltr"
|
|
@@ -813,49 +870,49 @@ function wt() {
|
|
|
813
870
|
"input",
|
|
814
871
|
{
|
|
815
872
|
type: "text",
|
|
816
|
-
value:
|
|
817
|
-
onChange: (
|
|
873
|
+
value: S.name,
|
|
874
|
+
onChange: (f) => D({ ...S, name: f.target.value }),
|
|
818
875
|
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",
|
|
819
876
|
required: !0
|
|
820
877
|
}
|
|
821
878
|
)
|
|
822
879
|
] }),
|
|
823
880
|
/* @__PURE__ */ r("div", { children: [
|
|
824
|
-
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t(
|
|
881
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t(M ? "admins.password_edit" : "admins.password") }),
|
|
825
882
|
/* @__PURE__ */ e(
|
|
826
883
|
"input",
|
|
827
884
|
{
|
|
828
885
|
type: "password",
|
|
829
|
-
value:
|
|
830
|
-
onChange: (
|
|
886
|
+
value: S.password,
|
|
887
|
+
onChange: (f) => D({ ...S, password: f.target.value }),
|
|
831
888
|
className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm font-mono dir-ltr",
|
|
832
|
-
required: !
|
|
889
|
+
required: !M,
|
|
833
890
|
dir: "ltr"
|
|
834
891
|
}
|
|
835
892
|
)
|
|
836
893
|
] }),
|
|
837
894
|
/* @__PURE__ */ r("div", { children: [
|
|
838
895
|
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("admins.permissions") }),
|
|
839
|
-
/* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children:
|
|
896
|
+
/* @__PURE__ */ e("div", { className: "space-y-3 p-4 bg-muted/30 rounded-xl border border-border", children: F.map((f) => /* @__PURE__ */ r("label", { className: "flex items-center gap-3 cursor-pointer group", children: [
|
|
840
897
|
/* @__PURE__ */ e("div", { className: "relative flex items-center", children: /* @__PURE__ */ e(
|
|
841
898
|
"input",
|
|
842
899
|
{
|
|
843
900
|
type: "checkbox",
|
|
844
|
-
checked:
|
|
845
|
-
onChange: () =>
|
|
846
|
-
disabled:
|
|
901
|
+
checked: S.permissions.includes(f),
|
|
902
|
+
onChange: () => E(f),
|
|
903
|
+
disabled: S.username === "admin" && f === "admin_management",
|
|
847
904
|
className: "peer h-4 w-4 rounded border-input text-primary focus:ring-ring transition-all disabled:opacity-50"
|
|
848
905
|
}
|
|
849
906
|
) }),
|
|
850
|
-
/* @__PURE__ */ e("span", { className: "text-sm text-foreground/70 group-hover:text-foreground transition-colors select-none", children:
|
|
851
|
-
] },
|
|
907
|
+
/* @__PURE__ */ e("span", { className: "text-sm text-foreground/70 group-hover:text-foreground transition-colors select-none", children: U(f) })
|
|
908
|
+
] }, f)) })
|
|
852
909
|
] }),
|
|
853
910
|
/* @__PURE__ */ r("div", { className: "flex gap-3 pt-4", children: [
|
|
854
911
|
/* @__PURE__ */ e(
|
|
855
912
|
"button",
|
|
856
913
|
{
|
|
857
914
|
type: "button",
|
|
858
|
-
onClick: () =>
|
|
915
|
+
onClick: () => B(!1),
|
|
859
916
|
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
917
|
children: t("cancel")
|
|
861
918
|
}
|
|
@@ -864,9 +921,9 @@ function wt() {
|
|
|
864
921
|
"button",
|
|
865
922
|
{
|
|
866
923
|
type: "submit",
|
|
867
|
-
disabled:
|
|
924
|
+
disabled: g,
|
|
868
925
|
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: t(
|
|
926
|
+
children: t(g ? "saving" : "save")
|
|
870
927
|
}
|
|
871
928
|
)
|
|
872
929
|
] })
|
|
@@ -880,46 +937,68 @@ function wt() {
|
|
|
880
937
|
/* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t("admins.permissions") }),
|
|
881
938
|
/* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t("users.actions") })
|
|
882
939
|
] }) }),
|
|
883
|
-
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children:
|
|
884
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children:
|
|
885
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground font-mono", dir: "ltr", children:
|
|
886
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children:
|
|
940
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: o.map((f) => /* @__PURE__ */ r("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
|
|
941
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 font-medium text-foreground", children: f.name }),
|
|
942
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground font-mono", dir: "ltr", children: f.username }),
|
|
943
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground", children: /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1.5", children: f.permissions.map((q) => /* @__PURE__ */ e("span", { className: "px-2 py-0.5 bg-muted/50 text-foreground/80 rounded text-[10px] border border-border/50", children: U(q) }, q)) }) }),
|
|
887
944
|
/* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
|
|
888
945
|
/* @__PURE__ */ e(
|
|
889
946
|
"button",
|
|
890
947
|
{
|
|
891
|
-
onClick: () => h(
|
|
948
|
+
onClick: () => h(f),
|
|
892
949
|
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
893
950
|
title: t("edit"),
|
|
894
951
|
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
952
|
}
|
|
896
953
|
),
|
|
897
|
-
|
|
954
|
+
f.id !== k && /* @__PURE__ */ e(
|
|
898
955
|
"button",
|
|
899
956
|
{
|
|
900
|
-
onClick: () =>
|
|
957
|
+
onClick: () => Q(f.id),
|
|
901
958
|
className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
|
|
902
959
|
title: t("delete"),
|
|
903
960
|
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
961
|
}
|
|
905
962
|
)
|
|
906
963
|
] }) })
|
|
907
|
-
] },
|
|
964
|
+
] }, f.id)) })
|
|
908
965
|
] }),
|
|
909
|
-
|
|
966
|
+
o.length === 0 && !g && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
|
|
910
967
|
/* @__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
968
|
t("admins.no_admins")
|
|
912
969
|
] }),
|
|
913
|
-
|
|
970
|
+
g && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-3", children: [
|
|
914
971
|
/* @__PURE__ */ e("div", { className: "w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin" }),
|
|
915
972
|
/* @__PURE__ */ e("span", { children: t("loading") })
|
|
916
973
|
] })
|
|
917
974
|
] }) })
|
|
918
975
|
] });
|
|
919
976
|
}
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
977
|
+
function re({ className: t, ...i }) {
|
|
978
|
+
return /* @__PURE__ */ e(
|
|
979
|
+
Ve.Root,
|
|
980
|
+
{
|
|
981
|
+
"data-slot": "switch",
|
|
982
|
+
className: Te(
|
|
983
|
+
"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",
|
|
984
|
+
t
|
|
985
|
+
),
|
|
986
|
+
...i,
|
|
987
|
+
children: /* @__PURE__ */ e(
|
|
988
|
+
Ve.Thumb,
|
|
989
|
+
{
|
|
990
|
+
"data-slot": "switch-thumb",
|
|
991
|
+
className: Te(
|
|
992
|
+
"bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] rtl:data-[state=checked]:-translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0"
|
|
993
|
+
)
|
|
994
|
+
}
|
|
995
|
+
)
|
|
996
|
+
}
|
|
997
|
+
);
|
|
998
|
+
}
|
|
999
|
+
const Gt = (t) => t.replace(/[^0-9]/g, ""), Kt = 25;
|
|
1000
|
+
function Zt() {
|
|
1001
|
+
const { t, i18n: i } = me(["admin", "translation"]), { app: o } = Ne(), [d, g] = p([]), [c, x] = p(!1), [N, _] = p(""), [B, M] = p(!1), [A, F] = p(null), [R, k] = p(""), [$, H] = p(0), [S, D] = p("name"), [K, W] = p("asc"), [P, ae] = p(null), Q = Le(0), h = Le(!1), E = Ce(() => o?.userMetadataFields || [], [o?.userMetadataFields]), [U, f] = p(null), [q, s] = p(""), [u, j] = p(""), [O, C] = p(""), [z, n] = p(""), [m, v] = p(null), [L, G] = p(null), [pe, l] = p(!1), T = i.language === "fa", J = T ? "fa-IR" : "en-US", ie = T ? "text-right" : "text-left", [b, te] = p({
|
|
923
1002
|
phone: "",
|
|
924
1003
|
name: "",
|
|
925
1004
|
surname: "",
|
|
@@ -927,184 +1006,231 @@ function St() {
|
|
|
927
1006
|
requests: "",
|
|
928
1007
|
tokensLimit: "",
|
|
929
1008
|
requestsLimit: "",
|
|
930
|
-
metadata: ""
|
|
1009
|
+
metadata: "",
|
|
931
1010
|
// Keep raw JSON for advanced users
|
|
932
|
-
|
|
933
|
-
|
|
1011
|
+
rechargeEnabled: !1,
|
|
1012
|
+
rechargeIntervalValue: "1",
|
|
1013
|
+
rechargeIntervalUnit: "month",
|
|
1014
|
+
rechargeAnchorAt: ""
|
|
1015
|
+
}), [se, be] = p({}), ke = async (a = !1, y = R, I = S, V = K) => {
|
|
1016
|
+
if (h.current) return;
|
|
1017
|
+
h.current = !0;
|
|
1018
|
+
const ee = ++Q.current;
|
|
1019
|
+
x(!0), _("");
|
|
934
1020
|
try {
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
1021
|
+
const ne = await w.listUsers(
|
|
1022
|
+
a ? d.length : 0,
|
|
1023
|
+
Kt,
|
|
1024
|
+
y,
|
|
1025
|
+
I,
|
|
1026
|
+
V
|
|
1027
|
+
);
|
|
1028
|
+
if (ee !== Q.current) return;
|
|
1029
|
+
g((ve) => a ? [...ve, ...ne.users || []] : ne.users || []), H(ne.count || 0);
|
|
1030
|
+
} catch (ne) {
|
|
1031
|
+
if (ee !== Q.current) return;
|
|
1032
|
+
_(ne instanceof Error ? ne.message : t("error_loading"));
|
|
939
1033
|
} finally {
|
|
940
|
-
|
|
1034
|
+
ee === Q.current && (x(!1), h.current = !1);
|
|
941
1035
|
}
|
|
942
|
-
},
|
|
1036
|
+
}, Ye = async () => {
|
|
943
1037
|
try {
|
|
944
|
-
const a = await
|
|
945
|
-
|
|
1038
|
+
const a = await w.getSettings();
|
|
1039
|
+
ae(a);
|
|
946
1040
|
} catch (a) {
|
|
947
1041
|
console.error("Failed to load app settings", a);
|
|
948
1042
|
}
|
|
949
1043
|
};
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
}, []),
|
|
953
|
-
|
|
1044
|
+
Y(() => {
|
|
1045
|
+
Ye();
|
|
1046
|
+
}, []), Y(() => {
|
|
1047
|
+
P && !A && !b.tokens && !b.requests && te((a) => ({
|
|
954
1048
|
...a,
|
|
955
|
-
tokens:
|
|
956
|
-
requests:
|
|
957
|
-
tokensLimit:
|
|
958
|
-
requestsLimit:
|
|
1049
|
+
tokens: P.initial_balance_tokens?.toString() || "",
|
|
1050
|
+
requests: P.initial_balance_requests?.toString() || "",
|
|
1051
|
+
tokensLimit: P.initial_balance_tokens?.toString() || "",
|
|
1052
|
+
requestsLimit: P.initial_balance_requests?.toString() || ""
|
|
959
1053
|
}));
|
|
960
|
-
}, [
|
|
1054
|
+
}, [P]), Y(() => {
|
|
1055
|
+
Q.current += 1, h.current = !1, g([]), H(0), x(!0);
|
|
961
1056
|
const a = setTimeout(() => {
|
|
962
|
-
|
|
1057
|
+
ke(!1, R, S, K);
|
|
963
1058
|
}, 500);
|
|
964
|
-
return () =>
|
|
965
|
-
|
|
1059
|
+
return () => {
|
|
1060
|
+
clearTimeout(a), Q.current += 1, h.current = !1;
|
|
1061
|
+
};
|
|
1062
|
+
}, [R, S, K]);
|
|
1063
|
+
const et = (a) => {
|
|
1064
|
+
S === a ? W((y) => y === "asc" ? "desc" : "asc") : (D(a), W("asc"));
|
|
1065
|
+
}, tt = (a) => S !== a ? /* @__PURE__ */ e(At, { className: "w-3.5 h-3.5 opacity-50" }) : K === "asc" ? /* @__PURE__ */ e(It, { className: "w-3.5 h-3.5" }) : /* @__PURE__ */ e(Mt, { className: "w-3.5 h-3.5" });
|
|
1066
|
+
Y(() => {
|
|
966
1067
|
try {
|
|
967
|
-
const
|
|
968
|
-
|
|
1068
|
+
const y = { ...b.metadata ? JSON.parse(b.metadata) : {}, ...se }, I = JSON.stringify(y, null, 2);
|
|
1069
|
+
I !== b.metadata && te((V) => ({ ...V, metadata: I }));
|
|
969
1070
|
} catch {
|
|
970
1071
|
}
|
|
971
|
-
}, [
|
|
972
|
-
const a = { ...
|
|
973
|
-
let
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
}),
|
|
977
|
-
}, [
|
|
978
|
-
const
|
|
1072
|
+
}, [se]), Y(() => {
|
|
1073
|
+
const a = { ...se };
|
|
1074
|
+
let y = !1;
|
|
1075
|
+
E.forEach((I) => {
|
|
1076
|
+
I.condition && !Oe(I.condition, se) && a[I.key] !== void 0 && (delete a[I.key], y = !0);
|
|
1077
|
+
}), y && be(a);
|
|
1078
|
+
}, [se, E]);
|
|
1079
|
+
const rt = async (a) => {
|
|
979
1080
|
a.preventDefault();
|
|
980
|
-
const
|
|
981
|
-
if (
|
|
982
|
-
|
|
1081
|
+
const y = b.tokens ? parseInt(b.tokens) : 0, I = b.requests ? parseInt(b.requests) : 0, V = b.tokensLimit ? parseInt(b.tokensLimit) : y, ee = b.requestsLimit ? parseInt(b.requestsLimit) : I;
|
|
1082
|
+
if (y > V) {
|
|
1083
|
+
_(t("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
983
1084
|
return;
|
|
984
1085
|
}
|
|
985
|
-
if (
|
|
986
|
-
|
|
1086
|
+
if (I > ee) {
|
|
1087
|
+
_(t("users.requests_exceed_limit", "Requests cannot exceed limit"));
|
|
987
1088
|
return;
|
|
988
1089
|
}
|
|
989
|
-
let
|
|
990
|
-
if (
|
|
1090
|
+
let ne = {};
|
|
1091
|
+
if (b.metadata)
|
|
991
1092
|
try {
|
|
992
|
-
|
|
1093
|
+
ne = JSON.parse(b.metadata);
|
|
993
1094
|
} catch {
|
|
994
|
-
|
|
1095
|
+
_(t("users.invalid_json", "Invalid JSON format"));
|
|
995
1096
|
return;
|
|
996
1097
|
}
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1098
|
+
const ve = Ee();
|
|
1099
|
+
if (ve) {
|
|
1100
|
+
x(!0);
|
|
1101
|
+
try {
|
|
1102
|
+
await w.createUser(
|
|
1103
|
+
b.phone,
|
|
1104
|
+
b.name,
|
|
1105
|
+
b.surname,
|
|
1106
|
+
b.tokens ? parseInt(b.tokens) : void 0,
|
|
1107
|
+
b.requests ? parseInt(b.requests) : void 0,
|
|
1108
|
+
b.tokensLimit ? parseInt(b.tokensLimit) : void 0,
|
|
1109
|
+
b.requestsLimit ? parseInt(b.requestsLimit) : void 0,
|
|
1110
|
+
ne,
|
|
1111
|
+
ve
|
|
1112
|
+
), M(!1), qe(), ke();
|
|
1113
|
+
} catch (ye) {
|
|
1114
|
+
_(ye instanceof Error ? ye.message : t("error_loading"));
|
|
1115
|
+
} finally {
|
|
1116
|
+
x(!1);
|
|
1117
|
+
}
|
|
1013
1118
|
}
|
|
1014
|
-
},
|
|
1015
|
-
if (a.preventDefault(), !
|
|
1016
|
-
let
|
|
1017
|
-
if (
|
|
1119
|
+
}, at = async (a) => {
|
|
1120
|
+
if (a.preventDefault(), !A) return;
|
|
1121
|
+
let y = {};
|
|
1122
|
+
if (b.metadata)
|
|
1018
1123
|
try {
|
|
1019
|
-
|
|
1124
|
+
y = JSON.parse(b.metadata);
|
|
1020
1125
|
} catch {
|
|
1021
|
-
|
|
1126
|
+
_(t("users.invalid_json", "Invalid JSON format"));
|
|
1022
1127
|
return;
|
|
1023
1128
|
}
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1129
|
+
const I = Ee();
|
|
1130
|
+
if (I) {
|
|
1131
|
+
x(!0);
|
|
1132
|
+
try {
|
|
1133
|
+
const V = await w.updateUser(A.id, {
|
|
1134
|
+
phone: b.phone,
|
|
1135
|
+
name: b.name,
|
|
1136
|
+
surname: b.surname,
|
|
1137
|
+
metadata: y,
|
|
1138
|
+
recharge_policy: I
|
|
1139
|
+
}), ee = V.user.recharge_policy;
|
|
1140
|
+
if (!(ee?.enabled === I.enabled && (!I.enabled || ee.interval_value === I.interval_value && ee.interval_unit === I.interval_unit)))
|
|
1141
|
+
throw new Error(t("users.recharge_policy_not_saved"));
|
|
1142
|
+
Q.current += 1, h.current = !1, g((ve) => ve.map((ye) => ye.id === V.user.id ? V.user : ye)), F(null), M(!1), qe();
|
|
1143
|
+
} catch (V) {
|
|
1144
|
+
_(V instanceof Error ? V.message : t("error_loading"));
|
|
1145
|
+
} finally {
|
|
1146
|
+
x(!1);
|
|
1147
|
+
}
|
|
1036
1148
|
}
|
|
1037
|
-
},
|
|
1038
|
-
|
|
1149
|
+
}, qe = () => {
|
|
1150
|
+
te({
|
|
1039
1151
|
phone: "",
|
|
1040
1152
|
name: "",
|
|
1041
1153
|
surname: "",
|
|
1042
|
-
tokens:
|
|
1043
|
-
requests:
|
|
1044
|
-
tokensLimit:
|
|
1045
|
-
requestsLimit:
|
|
1046
|
-
metadata: ""
|
|
1047
|
-
|
|
1048
|
-
|
|
1154
|
+
tokens: P?.initial_balance_tokens?.toString() || "",
|
|
1155
|
+
requests: P?.initial_balance_requests?.toString() || "",
|
|
1156
|
+
tokensLimit: P?.initial_balance_tokens?.toString() || "",
|
|
1157
|
+
requestsLimit: P?.initial_balance_requests?.toString() || "",
|
|
1158
|
+
metadata: "",
|
|
1159
|
+
rechargeEnabled: !1,
|
|
1160
|
+
rechargeIntervalValue: "1",
|
|
1161
|
+
rechargeIntervalUnit: "month",
|
|
1162
|
+
rechargeAnchorAt: ""
|
|
1163
|
+
}), be({});
|
|
1164
|
+
}, st = async (a) => {
|
|
1049
1165
|
if (confirm(t("users.confirm_delete_user")))
|
|
1050
1166
|
try {
|
|
1051
|
-
await
|
|
1052
|
-
} catch (
|
|
1053
|
-
|
|
1167
|
+
await w.deleteUser(a), ke();
|
|
1168
|
+
} catch (y) {
|
|
1169
|
+
_(y instanceof Error ? y.message : t("error_loading"));
|
|
1054
1170
|
}
|
|
1055
|
-
},
|
|
1171
|
+
}, Ee = () => {
|
|
1172
|
+
if (!b.rechargeEnabled)
|
|
1173
|
+
return { enabled: !1 };
|
|
1174
|
+
const a = Number(b.rechargeIntervalValue);
|
|
1175
|
+
return !Number.isInteger(a) || a <= 0 ? (_(t("users.recharge_interval_invalid")), null) : {
|
|
1176
|
+
enabled: !0,
|
|
1177
|
+
interval_value: a,
|
|
1178
|
+
interval_unit: b.rechargeIntervalUnit,
|
|
1179
|
+
anchor_at: b.rechargeAnchorAt || (/* @__PURE__ */ new Date()).toISOString()
|
|
1180
|
+
};
|
|
1181
|
+
}, nt = async (a) => {
|
|
1056
1182
|
try {
|
|
1057
|
-
const
|
|
1058
|
-
if (
|
|
1059
|
-
|
|
1183
|
+
const I = (await w.refreshUserToken(a.id))?.user?.token;
|
|
1184
|
+
if (!I) {
|
|
1185
|
+
_(t("users.no_token"));
|
|
1060
1186
|
return;
|
|
1061
1187
|
}
|
|
1062
|
-
await navigator.clipboard.writeText(
|
|
1063
|
-
} catch (
|
|
1064
|
-
|
|
1188
|
+
await navigator.clipboard.writeText(I), alert(t("users.token_copied"));
|
|
1189
|
+
} catch (y) {
|
|
1190
|
+
_(y instanceof Error ? y.message : t("error_loading"));
|
|
1065
1191
|
}
|
|
1066
|
-
},
|
|
1067
|
-
if (
|
|
1068
|
-
|
|
1192
|
+
}, it = async (a, y, I, V) => {
|
|
1193
|
+
if (U) {
|
|
1194
|
+
x(!0);
|
|
1069
1195
|
try {
|
|
1070
|
-
await
|
|
1071
|
-
|
|
1196
|
+
await w.updateUserBalance(
|
|
1197
|
+
U.id,
|
|
1072
1198
|
a,
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
),
|
|
1077
|
-
} catch (
|
|
1078
|
-
|
|
1199
|
+
y,
|
|
1200
|
+
I,
|
|
1201
|
+
V
|
|
1202
|
+
), f(null), s(""), j(""), C(""), n(""), ke();
|
|
1203
|
+
} catch (ee) {
|
|
1204
|
+
_(ee instanceof Error ? ee.message : t("error_loading"));
|
|
1079
1205
|
} finally {
|
|
1080
|
-
|
|
1206
|
+
x(!1);
|
|
1081
1207
|
}
|
|
1082
1208
|
}
|
|
1083
|
-
},
|
|
1084
|
-
if (a.preventDefault(), !
|
|
1085
|
-
const
|
|
1086
|
-
if (
|
|
1087
|
-
|
|
1209
|
+
}, ot = async (a) => {
|
|
1210
|
+
if (a.preventDefault(), !U) return;
|
|
1211
|
+
const y = parseInt(q) || 0, I = parseInt(u) || 0, V = O ? parseInt(O) : U.balance?.token_limit || 0, ee = z ? parseInt(z) : U.balance?.request_limit || 0;
|
|
1212
|
+
if (y > V) {
|
|
1213
|
+
_(t("users.tokens_exceed_limit", "Tokens cannot exceed limit"));
|
|
1088
1214
|
return;
|
|
1089
1215
|
}
|
|
1090
|
-
if (
|
|
1091
|
-
|
|
1216
|
+
if (I > ee) {
|
|
1217
|
+
_(t("users.requests_exceed_limit", "Requests cannot exceed limit"));
|
|
1092
1218
|
return;
|
|
1093
1219
|
}
|
|
1094
|
-
await
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1220
|
+
await it(
|
|
1221
|
+
y,
|
|
1222
|
+
I,
|
|
1223
|
+
O ? parseInt(O) : void 0,
|
|
1224
|
+
z ? parseInt(z) : void 0
|
|
1099
1225
|
);
|
|
1100
|
-
},
|
|
1101
|
-
if (!
|
|
1102
|
-
const a =
|
|
1103
|
-
|
|
1104
|
-
},
|
|
1105
|
-
|
|
1106
|
-
const
|
|
1107
|
-
if (
|
|
1226
|
+
}, lt = () => {
|
|
1227
|
+
if (!U) return;
|
|
1228
|
+
const a = O || String(U.balance?.token_limit || 0), y = z || String(U.balance?.request_limit || 0);
|
|
1229
|
+
s(a), j(y);
|
|
1230
|
+
}, dt = (a) => {
|
|
1231
|
+
F(a);
|
|
1232
|
+
const y = a.metadata ? JSON.stringify(a.metadata, null, 2) : "";
|
|
1233
|
+
if (te({
|
|
1108
1234
|
phone: a.phone,
|
|
1109
1235
|
name: a.name,
|
|
1110
1236
|
surname: a.surname,
|
|
@@ -1112,16 +1238,29 @@ function St() {
|
|
|
1112
1238
|
requests: "",
|
|
1113
1239
|
tokensLimit: "",
|
|
1114
1240
|
requestsLimit: "",
|
|
1115
|
-
metadata:
|
|
1241
|
+
metadata: y,
|
|
1242
|
+
rechargeEnabled: a.recharge_policy?.enabled ?? !1,
|
|
1243
|
+
rechargeIntervalValue: String(a.recharge_policy?.interval_value ?? 1),
|
|
1244
|
+
rechargeIntervalUnit: a.recharge_policy?.interval_unit ?? "month",
|
|
1245
|
+
rechargeAnchorAt: a.recharge_policy?.anchor_at ?? ""
|
|
1116
1246
|
}), a.metadata) {
|
|
1117
|
-
const
|
|
1118
|
-
|
|
1119
|
-
a.metadata?.[
|
|
1120
|
-
}),
|
|
1247
|
+
const I = {};
|
|
1248
|
+
E.forEach((V) => {
|
|
1249
|
+
a.metadata?.[V.key] !== void 0 ? I[V.key] = a.metadata[V.key] : V.defaultValue !== void 0 && (I[V.key] = V.defaultValue);
|
|
1250
|
+
}), be(I);
|
|
1251
|
+
}
|
|
1252
|
+
M(!0);
|
|
1253
|
+
}, ct = async (a) => {
|
|
1254
|
+
v(a), G(null), l(!0);
|
|
1255
|
+
try {
|
|
1256
|
+
G(await w.getUserUsageSummary(a.id));
|
|
1257
|
+
} catch (y) {
|
|
1258
|
+
_(y instanceof Error ? y.message : t("error_loading")), v(null);
|
|
1259
|
+
} finally {
|
|
1260
|
+
l(!1);
|
|
1121
1261
|
}
|
|
1122
|
-
D(!0);
|
|
1123
1262
|
};
|
|
1124
|
-
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir:
|
|
1263
|
+
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col p-5 overflow-hidden gap-4", dir: T ? "rtl" : "ltr", children: [
|
|
1125
1264
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3 flex-shrink-0", children: [
|
|
1126
1265
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("users.title") }),
|
|
1127
1266
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row items-center gap-2 flex-1 max-w-4xl justify-end", children: [
|
|
@@ -1129,19 +1268,19 @@ function St() {
|
|
|
1129
1268
|
"input",
|
|
1130
1269
|
{
|
|
1131
1270
|
type: "text",
|
|
1132
|
-
value:
|
|
1133
|
-
onChange: (a) =>
|
|
1271
|
+
value: R,
|
|
1272
|
+
onChange: (a) => k(a.target.value),
|
|
1134
1273
|
placeholder: t("chat_history.search_placeholder"),
|
|
1135
1274
|
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
1275
|
}
|
|
1137
1276
|
) }),
|
|
1138
1277
|
/* @__PURE__ */ r("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: t("users.user_count", { count:
|
|
1278
|
+
/* @__PURE__ */ e("div", { className: "glass-surface px-4 py-2.5 rounded-xl text-xs font-medium text-muted-foreground border border-border shadow-sm", children: t("users.user_count", { count: $ }) }),
|
|
1140
1279
|
/* @__PURE__ */ e(
|
|
1141
1280
|
"button",
|
|
1142
1281
|
{
|
|
1143
1282
|
onClick: () => {
|
|
1144
|
-
|
|
1283
|
+
F(null), qe(), M(!0);
|
|
1145
1284
|
},
|
|
1146
1285
|
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
1286
|
children: t("users.add_user")
|
|
@@ -1150,13 +1289,41 @@ function St() {
|
|
|
1150
1289
|
] })
|
|
1151
1290
|
] })
|
|
1152
1291
|
] }),
|
|
1153
|
-
|
|
1154
|
-
/* @__PURE__ */
|
|
1155
|
-
|
|
1292
|
+
/* @__PURE__ */ e(We, { open: !!m, onOpenChange: (a) => !a && v(null), children: /* @__PURE__ */ r(Ge, { children: [
|
|
1293
|
+
/* @__PURE__ */ r(Ke, { children: [
|
|
1294
|
+
/* @__PURE__ */ e(Ze, { children: t("users.usage_summary") }),
|
|
1295
|
+
/* @__PURE__ */ e(Qe, { children: m ? `${m.name} ${m.surname}` : "" })
|
|
1296
|
+
] }),
|
|
1297
|
+
pe ? /* @__PURE__ */ e("div", { className: "py-10 flex justify-center", children: /* @__PURE__ */ e("div", { className: "w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin" }) }) : L ? /* @__PURE__ */ e("div", { className: "grid grid-cols-2 gap-3", children: [
|
|
1298
|
+
[t("users.input_tokens"), L.input_tokens.toLocaleString(J)],
|
|
1299
|
+
[t("users.output_tokens"), L.output_tokens.toLocaleString(J)],
|
|
1300
|
+
[t("users.total_tokens"), L.total_tokens.toLocaleString(J)],
|
|
1301
|
+
[t("users.requests_made"), L.requests.toLocaleString(J)],
|
|
1302
|
+
[
|
|
1303
|
+
t("users.total_cost"),
|
|
1304
|
+
Xe(
|
|
1305
|
+
L.total_cost_microunits,
|
|
1306
|
+
L.currency,
|
|
1307
|
+
J
|
|
1308
|
+
)
|
|
1309
|
+
],
|
|
1310
|
+
[t("users.renewals"), L.renewal_count.toLocaleString(J)],
|
|
1311
|
+
[
|
|
1312
|
+
t("users.unpriced_requests"),
|
|
1313
|
+
L.unpriced_requests.toLocaleString(J)
|
|
1314
|
+
]
|
|
1315
|
+
].map(([a, y]) => /* @__PURE__ */ r("div", { className: "rounded-xl border border-border bg-muted/20 p-4", children: [
|
|
1316
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] uppercase tracking-wider text-muted-foreground", children: a }),
|
|
1317
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-lg font-semibold text-foreground", children: y })
|
|
1318
|
+
] }, a)) }) : null
|
|
1319
|
+
] }) }),
|
|
1320
|
+
N && /* @__PURE__ */ r("div", { className: "bg-destructive/10 border border-destructive/20 text-destructive px-4 py-3 rounded-xl text-sm backdrop-blur-sm flex-shrink-0 flex justify-between items-center group", children: [
|
|
1321
|
+
/* @__PURE__ */ e("span", { children: N }),
|
|
1322
|
+
/* @__PURE__ */ e("button", { onClick: () => _(""), 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
1323
|
] }),
|
|
1157
|
-
|
|
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: t(
|
|
1159
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit:
|
|
1324
|
+
B && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ r("div", { className: "bg-card rounded-2xl border border-border w-full max-w-xl shadow-2xl overflow-hidden", children: [
|
|
1325
|
+
/* @__PURE__ */ e("div", { className: "px-6 py-5 border-b border-border bg-muted/20", children: /* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground", children: t(A ? "users.edit_user" : "users.add_user") }) }),
|
|
1326
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: A ? at : rt, children: [
|
|
1160
1327
|
/* @__PURE__ */ r("div", { className: "space-y-6 max-h-[60vh] overflow-y-auto px-1 custom-scrollbar", children: [
|
|
1161
1328
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
1162
1329
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -1165,8 +1332,8 @@ function St() {
|
|
|
1165
1332
|
"input",
|
|
1166
1333
|
{
|
|
1167
1334
|
type: "text",
|
|
1168
|
-
value:
|
|
1169
|
-
onChange: (a) =>
|
|
1335
|
+
value: b.phone,
|
|
1336
|
+
onChange: (a) => te({ ...b, phone: Gt(a.target.value) }),
|
|
1170
1337
|
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
1338
|
placeholder: t("users.phone_placeholder"),
|
|
1172
1339
|
required: !0,
|
|
@@ -1181,9 +1348,9 @@ function St() {
|
|
|
1181
1348
|
"input",
|
|
1182
1349
|
{
|
|
1183
1350
|
type: "text",
|
|
1184
|
-
value:
|
|
1185
|
-
onChange: (a) =>
|
|
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 ${
|
|
1351
|
+
value: b.name,
|
|
1352
|
+
onChange: (a) => te({ ...b, name: a.target.value }),
|
|
1353
|
+
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 ${ie}`,
|
|
1187
1354
|
required: !0
|
|
1188
1355
|
}
|
|
1189
1356
|
)
|
|
@@ -1194,16 +1361,16 @@ function St() {
|
|
|
1194
1361
|
"input",
|
|
1195
1362
|
{
|
|
1196
1363
|
type: "text",
|
|
1197
|
-
value:
|
|
1198
|
-
onChange: (a) =>
|
|
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 ${
|
|
1364
|
+
value: b.surname,
|
|
1365
|
+
onChange: (a) => te({ ...b, surname: a.target.value }),
|
|
1366
|
+
className: `w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm ${ie}`,
|
|
1200
1367
|
required: !0
|
|
1201
1368
|
}
|
|
1202
1369
|
)
|
|
1203
1370
|
] })
|
|
1204
1371
|
] })
|
|
1205
1372
|
] }),
|
|
1206
|
-
!
|
|
1373
|
+
!A && /* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
|
|
1207
1374
|
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: t("users.initial_balance") }),
|
|
1208
1375
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1209
1376
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -1212,8 +1379,8 @@ function St() {
|
|
|
1212
1379
|
"input",
|
|
1213
1380
|
{
|
|
1214
1381
|
type: "number",
|
|
1215
|
-
value:
|
|
1216
|
-
onChange: (a) =>
|
|
1382
|
+
value: b.tokens,
|
|
1383
|
+
onChange: (a) => te({ ...b, tokens: a.target.value }),
|
|
1217
1384
|
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
1385
|
dir: "ltr",
|
|
1219
1386
|
placeholder: "0"
|
|
@@ -1226,11 +1393,11 @@ function St() {
|
|
|
1226
1393
|
"input",
|
|
1227
1394
|
{
|
|
1228
1395
|
type: "number",
|
|
1229
|
-
value:
|
|
1230
|
-
onChange: (a) =>
|
|
1396
|
+
value: b.tokensLimit,
|
|
1397
|
+
onChange: (a) => te({ ...b, tokensLimit: a.target.value }),
|
|
1231
1398
|
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
1399
|
dir: "ltr",
|
|
1233
|
-
placeholder:
|
|
1400
|
+
placeholder: b.tokens || String(P?.initial_balance_tokens ?? "250000")
|
|
1234
1401
|
}
|
|
1235
1402
|
)
|
|
1236
1403
|
] })
|
|
@@ -1242,11 +1409,11 @@ function St() {
|
|
|
1242
1409
|
"input",
|
|
1243
1410
|
{
|
|
1244
1411
|
type: "number",
|
|
1245
|
-
value:
|
|
1246
|
-
onChange: (a) =>
|
|
1412
|
+
value: b.requests,
|
|
1413
|
+
onChange: (a) => te({ ...b, requests: a.target.value }),
|
|
1247
1414
|
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
1415
|
dir: "ltr",
|
|
1249
|
-
placeholder:
|
|
1416
|
+
placeholder: b.requests || String(P?.initial_balance_requests ?? "0")
|
|
1250
1417
|
}
|
|
1251
1418
|
)
|
|
1252
1419
|
] }),
|
|
@@ -1256,43 +1423,115 @@ function St() {
|
|
|
1256
1423
|
"input",
|
|
1257
1424
|
{
|
|
1258
1425
|
type: "number",
|
|
1259
|
-
value:
|
|
1260
|
-
onChange: (a) =>
|
|
1426
|
+
value: b.requestsLimit,
|
|
1427
|
+
onChange: (a) => te({ ...b, requestsLimit: a.target.value }),
|
|
1261
1428
|
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
1429
|
dir: "ltr",
|
|
1263
|
-
placeholder:
|
|
1430
|
+
placeholder: b.requests || String(P?.initial_balance_requests ?? "100")
|
|
1264
1431
|
}
|
|
1265
1432
|
)
|
|
1266
1433
|
] })
|
|
1267
1434
|
] })
|
|
1268
1435
|
] }),
|
|
1269
|
-
|
|
1436
|
+
/* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
|
|
1437
|
+
/* @__PURE__ */ r("div", { className: "flex items-start gap-4", children: [
|
|
1438
|
+
/* @__PURE__ */ r("div", { children: [
|
|
1439
|
+
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: t("users.auto_recharge") }),
|
|
1440
|
+
/* @__PURE__ */ e("p", { className: "mt-1 text-xs text-muted-foreground", children: t("users.auto_recharge_help") })
|
|
1441
|
+
] }),
|
|
1442
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-2 shrink-0 pt-0.5", children: [
|
|
1443
|
+
/* @__PURE__ */ e(
|
|
1444
|
+
re,
|
|
1445
|
+
{
|
|
1446
|
+
id: "admin-recharge-enabled",
|
|
1447
|
+
checked: b.rechargeEnabled,
|
|
1448
|
+
onCheckedChange: (a) => te({
|
|
1449
|
+
...b,
|
|
1450
|
+
rechargeEnabled: a
|
|
1451
|
+
}),
|
|
1452
|
+
"aria-label": t("users.auto_recharge")
|
|
1453
|
+
}
|
|
1454
|
+
),
|
|
1455
|
+
/* @__PURE__ */ e("label", { htmlFor: "admin-recharge-enabled", className: "text-sm text-foreground cursor-pointer", children: t("users.enabled") })
|
|
1456
|
+
] })
|
|
1457
|
+
] }),
|
|
1458
|
+
b.rechargeEnabled && /* @__PURE__ */ r("div", { className: "space-y-4 rounded-xl border border-border/60 bg-muted/15 p-4", children: [
|
|
1459
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1460
|
+
/* @__PURE__ */ r("div", { children: [
|
|
1461
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.recharge_interval") }),
|
|
1462
|
+
/* @__PURE__ */ e(
|
|
1463
|
+
"input",
|
|
1464
|
+
{
|
|
1465
|
+
type: "number",
|
|
1466
|
+
min: "1",
|
|
1467
|
+
step: "1",
|
|
1468
|
+
value: b.rechargeIntervalValue,
|
|
1469
|
+
onChange: (a) => te({ ...b, rechargeIntervalValue: a.target.value }),
|
|
1470
|
+
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",
|
|
1471
|
+
required: !0,
|
|
1472
|
+
dir: "ltr"
|
|
1473
|
+
}
|
|
1474
|
+
)
|
|
1475
|
+
] }),
|
|
1476
|
+
/* @__PURE__ */ r("div", { children: [
|
|
1477
|
+
/* @__PURE__ */ e("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: t("users.recharge_unit") }),
|
|
1478
|
+
/* @__PURE__ */ r(
|
|
1479
|
+
oe,
|
|
1480
|
+
{
|
|
1481
|
+
value: b.rechargeIntervalUnit,
|
|
1482
|
+
onValueChange: (a) => te({
|
|
1483
|
+
...b,
|
|
1484
|
+
rechargeIntervalUnit: a
|
|
1485
|
+
}),
|
|
1486
|
+
dir: T ? "rtl" : "ltr",
|
|
1487
|
+
children: [
|
|
1488
|
+
/* @__PURE__ */ e(le, { className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]", children: /* @__PURE__ */ e(de, {}) }),
|
|
1489
|
+
/* @__PURE__ */ e(ce, { className: "rounded-xl border-border bg-card", children: ["minute", "hour", "day", "week", "month"].map((a) => /* @__PURE__ */ e(Z, { value: a, children: t(`users.recharge_unit_${a}`) }, a)) })
|
|
1490
|
+
]
|
|
1491
|
+
}
|
|
1492
|
+
)
|
|
1493
|
+
] })
|
|
1494
|
+
] }),
|
|
1495
|
+
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: t("users.recharge_schedule_help") }),
|
|
1496
|
+
A?.recharge_policy?.enabled && /* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs", children: [
|
|
1497
|
+
/* @__PURE__ */ r("div", { className: "rounded-lg bg-background/50 border border-border/50 p-3", children: [
|
|
1498
|
+
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t("users.next_recharge") }),
|
|
1499
|
+
/* @__PURE__ */ e("p", { className: "mt-1 font-medium text-foreground", dir: "ltr", children: A.recharge_policy.next_recharge_at ? new Date(A.recharge_policy.next_recharge_at).toLocaleString(i.language) : t("users.not_available") })
|
|
1500
|
+
] }),
|
|
1501
|
+
/* @__PURE__ */ r("div", { className: "rounded-lg bg-background/50 border border-border/50 p-3", children: [
|
|
1502
|
+
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t("users.last_recharge") }),
|
|
1503
|
+
/* @__PURE__ */ e("p", { className: "mt-1 font-medium text-foreground", dir: "ltr", children: A.recharge_policy.last_recharged_at ? new Date(A.recharge_policy.last_recharged_at).toLocaleString(i.language) : t("users.not_available") })
|
|
1504
|
+
] })
|
|
1505
|
+
] })
|
|
1506
|
+
] })
|
|
1507
|
+
] }),
|
|
1508
|
+
E.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-border/50 pt-4 mt-4 space-y-4", children: [
|
|
1270
1509
|
/* @__PURE__ */ e("h4", { className: "text-sm font-bold text-foreground/70", children: t("users.custom_fields") }),
|
|
1271
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children:
|
|
1510
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: E.map((a) => Oe(a.condition, se) ? /* @__PURE__ */ r("div", { className: "animate-in fade-in slide-in-from-top-1 duration-200", children: [
|
|
1272
1511
|
/* @__PURE__ */ r("label", { className: "block text-xs font-medium text-muted-foreground uppercase tracking-wider mb-3", children: [
|
|
1273
1512
|
t(a.label),
|
|
1274
1513
|
" ",
|
|
1275
1514
|
a.required && /* @__PURE__ */ e("span", { className: "text-destructive", children: "*" })
|
|
1276
1515
|
] }),
|
|
1277
1516
|
a.type === "select" ? /* @__PURE__ */ r(
|
|
1278
|
-
|
|
1517
|
+
oe,
|
|
1279
1518
|
{
|
|
1280
|
-
value: String(
|
|
1281
|
-
onValueChange: (
|
|
1519
|
+
value: String(se[a.key] || ""),
|
|
1520
|
+
onValueChange: (y) => be({ ...se, [a.key]: y }),
|
|
1282
1521
|
required: a.required,
|
|
1283
|
-
dir:
|
|
1522
|
+
dir: T ? "rtl" : "ltr",
|
|
1284
1523
|
children: [
|
|
1285
|
-
/* @__PURE__ */ e(
|
|
1286
|
-
/* @__PURE__ */ e(
|
|
1524
|
+
/* @__PURE__ */ e(le, { className: Te("w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]", ie), children: /* @__PURE__ */ e(de, { placeholder: t(a.placeholder || "select_placeholder") }) }),
|
|
1525
|
+
/* @__PURE__ */ e(ce, { className: "rounded-xl border-border bg-card", children: a.options?.map((y) => /* @__PURE__ */ e(Z, { value: String(y.value), children: t(y.label) }, String(y.value))) })
|
|
1287
1526
|
]
|
|
1288
1527
|
}
|
|
1289
1528
|
) : a.type === "checkbox" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-3 h-[46px] px-1", children: [
|
|
1290
1529
|
/* @__PURE__ */ e(
|
|
1291
|
-
|
|
1530
|
+
gt,
|
|
1292
1531
|
{
|
|
1293
1532
|
id: `admin-md-${a.key}`,
|
|
1294
|
-
checked: !!
|
|
1295
|
-
onCheckedChange: (
|
|
1533
|
+
checked: !!se[a.key],
|
|
1534
|
+
onCheckedChange: (y) => be({ ...se, [a.key]: !!y }),
|
|
1296
1535
|
required: a.required
|
|
1297
1536
|
}
|
|
1298
1537
|
),
|
|
@@ -1301,9 +1540,9 @@ function St() {
|
|
|
1301
1540
|
"input",
|
|
1302
1541
|
{
|
|
1303
1542
|
type: a.type,
|
|
1304
|
-
value:
|
|
1305
|
-
onChange: (
|
|
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 ${
|
|
1543
|
+
value: se[a.key] || "",
|
|
1544
|
+
onChange: (y) => be({ ...se, [a.key]: y.target.value }),
|
|
1545
|
+
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 ${ie}`,
|
|
1307
1546
|
placeholder: t(a.placeholder || ""),
|
|
1308
1547
|
required: a.required
|
|
1309
1548
|
}
|
|
@@ -1318,8 +1557,8 @@ function St() {
|
|
|
1318
1557
|
/* @__PURE__ */ e(
|
|
1319
1558
|
"textarea",
|
|
1320
1559
|
{
|
|
1321
|
-
value:
|
|
1322
|
-
onChange: (a) =>
|
|
1560
|
+
value: b.metadata,
|
|
1561
|
+
onChange: (a) => te({ ...b, metadata: a.target.value }),
|
|
1323
1562
|
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
1563
|
placeholder: '{ "key": "value" }',
|
|
1325
1564
|
dir: "ltr"
|
|
@@ -1333,7 +1572,7 @@ function St() {
|
|
|
1333
1572
|
{
|
|
1334
1573
|
type: "button",
|
|
1335
1574
|
onClick: () => {
|
|
1336
|
-
|
|
1575
|
+
M(!1), F(null);
|
|
1337
1576
|
},
|
|
1338
1577
|
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
1578
|
children: t("cancel")
|
|
@@ -1343,33 +1582,33 @@ function St() {
|
|
|
1343
1582
|
"button",
|
|
1344
1583
|
{
|
|
1345
1584
|
type: "submit",
|
|
1346
|
-
disabled:
|
|
1585
|
+
disabled: c,
|
|
1347
1586
|
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: t(
|
|
1587
|
+
children: t(c ? "saving" : "save")
|
|
1349
1588
|
}
|
|
1350
1589
|
)
|
|
1351
1590
|
] })
|
|
1352
1591
|
] }) })
|
|
1353
1592
|
] }) }),
|
|
1354
|
-
|
|
1593
|
+
U && /* @__PURE__ */ e("div", { className: "fixed inset-0 bg-background/20 backdrop-blur-md flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ r("div", { className: "bg-card rounded-2xl border border-border w-full max-w-sm shadow-2xl overflow-hidden", children: [
|
|
1355
1594
|
/* @__PURE__ */ r("div", { className: "px-6 py-5 border-b border-border bg-muted/20 flex items-center justify-between", children: [
|
|
1356
1595
|
/* @__PURE__ */ r("h3", { className: "text-lg font-bold text-foreground", children: [
|
|
1357
1596
|
t("users.update_balance_for"),
|
|
1358
1597
|
" ",
|
|
1359
|
-
|
|
1598
|
+
U.name
|
|
1360
1599
|
] }),
|
|
1361
1600
|
/* @__PURE__ */ e(
|
|
1362
1601
|
"button",
|
|
1363
1602
|
{
|
|
1364
1603
|
onClick: () => {
|
|
1365
|
-
|
|
1604
|
+
f(null), _("");
|
|
1366
1605
|
},
|
|
1367
1606
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
1368
1607
|
children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 2, stroke: "currentColor", className: "w-5 h-5", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" }) })
|
|
1369
1608
|
}
|
|
1370
1609
|
)
|
|
1371
1610
|
] }),
|
|
1372
|
-
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit:
|
|
1611
|
+
/* @__PURE__ */ e("div", { className: "p-8", children: /* @__PURE__ */ r("form", { onSubmit: ot, children: [
|
|
1373
1612
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
1374
1613
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1375
1614
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -1378,8 +1617,8 @@ function St() {
|
|
|
1378
1617
|
"input",
|
|
1379
1618
|
{
|
|
1380
1619
|
type: "number",
|
|
1381
|
-
value:
|
|
1382
|
-
onChange: (a) =>
|
|
1620
|
+
value: q,
|
|
1621
|
+
onChange: (a) => s(a.target.value),
|
|
1383
1622
|
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",
|
|
1384
1623
|
required: !0,
|
|
1385
1624
|
dir: "ltr"
|
|
@@ -1392,11 +1631,11 @@ function St() {
|
|
|
1392
1631
|
"input",
|
|
1393
1632
|
{
|
|
1394
1633
|
type: "number",
|
|
1395
|
-
value:
|
|
1396
|
-
onChange: (a) =>
|
|
1634
|
+
value: O,
|
|
1635
|
+
onChange: (a) => C(a.target.value),
|
|
1397
1636
|
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",
|
|
1398
1637
|
dir: "ltr",
|
|
1399
|
-
placeholder:
|
|
1638
|
+
placeholder: q
|
|
1400
1639
|
}
|
|
1401
1640
|
)
|
|
1402
1641
|
] })
|
|
@@ -1408,8 +1647,8 @@ function St() {
|
|
|
1408
1647
|
"input",
|
|
1409
1648
|
{
|
|
1410
1649
|
type: "number",
|
|
1411
|
-
value:
|
|
1412
|
-
onChange: (a) =>
|
|
1650
|
+
value: u,
|
|
1651
|
+
onChange: (a) => j(a.target.value),
|
|
1413
1652
|
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
1653
|
required: !0,
|
|
1415
1654
|
dir: "ltr"
|
|
@@ -1422,11 +1661,11 @@ function St() {
|
|
|
1422
1661
|
"input",
|
|
1423
1662
|
{
|
|
1424
1663
|
type: "number",
|
|
1425
|
-
value:
|
|
1426
|
-
onChange: (a) =>
|
|
1664
|
+
value: z,
|
|
1665
|
+
onChange: (a) => n(a.target.value),
|
|
1427
1666
|
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
1667
|
dir: "ltr",
|
|
1429
|
-
placeholder:
|
|
1668
|
+
placeholder: u
|
|
1430
1669
|
}
|
|
1431
1670
|
)
|
|
1432
1671
|
] })
|
|
@@ -1437,7 +1676,7 @@ function St() {
|
|
|
1437
1676
|
"button",
|
|
1438
1677
|
{
|
|
1439
1678
|
type: "button",
|
|
1440
|
-
onClick:
|
|
1679
|
+
onClick: lt,
|
|
1441
1680
|
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
1681
|
children: t("users.full_charge")
|
|
1443
1682
|
}
|
|
@@ -1446,268 +1685,345 @@ function St() {
|
|
|
1446
1685
|
"button",
|
|
1447
1686
|
{
|
|
1448
1687
|
type: "submit",
|
|
1449
|
-
disabled:
|
|
1688
|
+
disabled: c,
|
|
1450
1689
|
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: t(
|
|
1690
|
+
children: t(c ? "users.updating" : "users.update_balance")
|
|
1452
1691
|
}
|
|
1453
1692
|
)
|
|
1454
1693
|
] })
|
|
1455
1694
|
] }) })
|
|
1456
1695
|
] }) }),
|
|
1457
|
-
/* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ r(
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: a.surname }),
|
|
1471
|
-
J.map((C) => {
|
|
1472
|
-
const $ = a.metadata?.[C.key];
|
|
1473
|
-
let X = String($ ?? "");
|
|
1474
|
-
if (C.type === "select" && $ !== void 0) {
|
|
1475
|
-
const re = C.options?.find((be) => String(be.value) === String($));
|
|
1476
|
-
re && (X = t(re.label));
|
|
1477
|
-
}
|
|
1478
|
-
return /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: C.type === "checkbox" ? $ ? /* @__PURE__ */ e("span", { className: "text-emerald-500 font-bold", children: "✓" }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground opacity-30", children: "✗" }) : X }, C.key);
|
|
1479
|
-
}),
|
|
1480
|
-
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground w-[120px]", children: a.balance ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 min-w-0 py-1", children: [
|
|
1481
|
-
/* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
1482
|
-
/* @__PURE__ */ r("div", { className: "flex justify-between text-[10px] font-semibold", children: [
|
|
1483
|
-
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t("users.tokens_label") }),
|
|
1484
|
-
/* @__PURE__ */ r("span", { className: "text-foreground", children: [
|
|
1485
|
-
(a.balance.token_limit > 0 ? Math.round(a.balance.tokens / a.balance.token_limit * 100) : 0).toLocaleString(n.language),
|
|
1486
|
-
"%"
|
|
1487
|
-
] })
|
|
1488
|
-
] }),
|
|
1489
|
-
/* @__PURE__ */ e("div", { className: "h-1 w-full bg-muted rounded-full overflow-hidden", dir: "ltr", children: /* @__PURE__ */ e(
|
|
1490
|
-
"div",
|
|
1696
|
+
/* @__PURE__ */ e("div", { className: "glass-surface border border-border rounded-2xl overflow-hidden shadow-sm flex-1 flex flex-col", children: /* @__PURE__ */ r(
|
|
1697
|
+
"div",
|
|
1698
|
+
{
|
|
1699
|
+
className: "overflow-auto flex-1 min-h-0 custom-scrollbar",
|
|
1700
|
+
onScroll: (a) => {
|
|
1701
|
+
const y = a.currentTarget;
|
|
1702
|
+
y.scrollHeight - y.scrollTop - y.clientHeight < 160 && !c && d.length < $ && ke(!0);
|
|
1703
|
+
},
|
|
1704
|
+
children: [
|
|
1705
|
+
/* @__PURE__ */ r("table", { className: `w-full ${T ? "text-right" : "text-left"} border-collapse`, children: [
|
|
1706
|
+
/* @__PURE__ */ e("thead", { className: "bg-muted/30 sticky top-0 z-10 backdrop-blur-md", children: /* @__PURE__ */ r("tr", { children: [
|
|
1707
|
+
["phone", "name", "surname"].map((a) => /* @__PURE__ */ e(
|
|
1708
|
+
"th",
|
|
1491
1709
|
{
|
|
1492
|
-
className:
|
|
1493
|
-
|
|
1710
|
+
className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50",
|
|
1711
|
+
"aria-sort": S === a ? K === "asc" ? "ascending" : "descending" : "none",
|
|
1712
|
+
children: /* @__PURE__ */ r(
|
|
1713
|
+
"button",
|
|
1714
|
+
{
|
|
1715
|
+
type: "button",
|
|
1716
|
+
onClick: () => et(a),
|
|
1717
|
+
className: "inline-flex items-center gap-1.5 hover:text-foreground transition-colors",
|
|
1718
|
+
title: t(S === a && K === "asc" ? "users.sort_descending" : "users.sort_ascending"),
|
|
1719
|
+
children: [
|
|
1720
|
+
/* @__PURE__ */ e("span", { children: t(`users.${a}`) }),
|
|
1721
|
+
tt(a)
|
|
1722
|
+
]
|
|
1723
|
+
}
|
|
1724
|
+
)
|
|
1725
|
+
},
|
|
1726
|
+
a
|
|
1727
|
+
)),
|
|
1728
|
+
E.map((a) => /* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t(a.label) }, a.key)),
|
|
1729
|
+
/* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50 w-[120px]", children: t("users.balance") }),
|
|
1730
|
+
/* @__PURE__ */ e("th", { className: "px-4 py-3.5 text-[11px] font-bold text-muted-foreground uppercase tracking-widest border-b border-border/50", children: t("users.actions") })
|
|
1731
|
+
] }) }),
|
|
1732
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-border", children: d.map((a) => /* @__PURE__ */ r("tr", { className: "hover:bg-muted/30 transition-colors text-xs border-b border-border/50", children: [
|
|
1733
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground font-mono", dir: "ltr", children: a.phone }),
|
|
1734
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground", children: a.name }),
|
|
1735
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: a.surname }),
|
|
1736
|
+
E.map((y) => {
|
|
1737
|
+
const I = a.metadata?.[y.key];
|
|
1738
|
+
let V = String(I ?? "");
|
|
1739
|
+
if (y.type === "select" && I !== void 0) {
|
|
1740
|
+
const ee = y.options?.find((ne) => String(ne.value) === String(I));
|
|
1741
|
+
ee && (V = t(ee.label));
|
|
1494
1742
|
}
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1743
|
+
return /* @__PURE__ */ e("td", { className: "px-4 py-3 text-foreground/80", children: y.type === "checkbox" ? I ? /* @__PURE__ */ e("span", { className: "text-emerald-500 font-bold", children: "✓" }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground opacity-30", children: "✗" }) : V }, y.key);
|
|
1744
|
+
}),
|
|
1745
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3 text-muted-foreground w-[120px]", children: a.balance ? /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 min-w-0 py-1", children: [
|
|
1746
|
+
/* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
1747
|
+
/* @__PURE__ */ r("div", { className: "flex justify-between text-[10px] font-semibold", children: [
|
|
1748
|
+
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t("users.tokens_label") }),
|
|
1749
|
+
/* @__PURE__ */ r("span", { className: "text-foreground", children: [
|
|
1750
|
+
(a.balance.token_limit > 0 ? Math.round(a.balance.tokens / a.balance.token_limit * 100) : 0).toLocaleString(i.language),
|
|
1751
|
+
"%"
|
|
1752
|
+
] })
|
|
1753
|
+
] }),
|
|
1754
|
+
/* @__PURE__ */ e("div", { className: "h-1 w-full bg-muted rounded-full overflow-hidden", dir: "ltr", children: /* @__PURE__ */ e(
|
|
1755
|
+
"div",
|
|
1756
|
+
{
|
|
1757
|
+
className: `h-full rounded-full transition-all duration-500 ${a.balance.tokens / (a.balance.token_limit || 1) > 0.6 ? "bg-emerald-500" : a.balance.tokens / (a.balance.token_limit || 1) > 0.2 ? "bg-amber-500" : "bg-destructive"}`,
|
|
1758
|
+
style: { width: `${Math.min(100, Math.max(0, a.balance.tokens / (a.balance.token_limit || 1) * 100))}%` }
|
|
1759
|
+
}
|
|
1760
|
+
) })
|
|
1761
|
+
] }),
|
|
1762
|
+
/* @__PURE__ */ r("div", { className: "space-y-1", children: [
|
|
1763
|
+
/* @__PURE__ */ r("div", { className: "flex justify-between text-[10px] font-semibold", children: [
|
|
1764
|
+
/* @__PURE__ */ e("span", { className: "text-muted-foreground", children: t("users.requests_label") }),
|
|
1765
|
+
/* @__PURE__ */ r("span", { className: "text-foreground", children: [
|
|
1766
|
+
(a.balance.request_limit > 0 ? Math.round(a.balance.requests / a.balance.request_limit * 100) : 0).toLocaleString(i.language),
|
|
1767
|
+
"%"
|
|
1768
|
+
] })
|
|
1769
|
+
] }),
|
|
1770
|
+
/* @__PURE__ */ e("div", { className: "h-1 w-full bg-muted rounded-full overflow-hidden", dir: "ltr", children: /* @__PURE__ */ e(
|
|
1771
|
+
"div",
|
|
1772
|
+
{
|
|
1773
|
+
className: `h-full rounded-full transition-all duration-500 ${a.balance.requests / (a.balance.request_limit || 1) > 0.6 ? "bg-emerald-500" : a.balance.requests / (a.balance.request_limit || 1) > 0.2 ? "bg-amber-500" : "bg-destructive"}`,
|
|
1774
|
+
style: { width: `${Math.min(100, Math.max(0, a.balance.requests / (a.balance.request_limit || 1) * 100))}%` }
|
|
1775
|
+
}
|
|
1776
|
+
) })
|
|
1503
1777
|
] })
|
|
1504
|
-
] }),
|
|
1505
|
-
/* @__PURE__ */ e("
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1778
|
+
] }) : /* @__PURE__ */ e("span", { className: "text-muted-foreground/40 text-[10px]", children: "—" }) }),
|
|
1779
|
+
/* @__PURE__ */ e("td", { className: "px-4 py-3", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
|
|
1780
|
+
/* @__PURE__ */ e(
|
|
1781
|
+
"button",
|
|
1782
|
+
{
|
|
1783
|
+
onClick: () => ct(a),
|
|
1784
|
+
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1785
|
+
title: t("users.usage_summary"),
|
|
1786
|
+
children: /* @__PURE__ */ e(Tt, { className: "w-4 h-4" })
|
|
1787
|
+
}
|
|
1788
|
+
),
|
|
1789
|
+
/* @__PURE__ */ e(
|
|
1790
|
+
"button",
|
|
1791
|
+
{
|
|
1792
|
+
onClick: () => dt(a),
|
|
1793
|
+
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1794
|
+
title: t("edit"),
|
|
1795
|
+
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" }) })
|
|
1796
|
+
}
|
|
1797
|
+
),
|
|
1798
|
+
/* @__PURE__ */ e(
|
|
1799
|
+
"button",
|
|
1800
|
+
{
|
|
1801
|
+
onClick: () => {
|
|
1802
|
+
f(a), s(String(a.balance?.tokens || 0)), j(String(a.balance?.requests || 0)), C(String(a.balance?.token_limit || 0)), n(String(a.balance?.request_limit || 0)), _("");
|
|
1803
|
+
},
|
|
1804
|
+
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1805
|
+
title: t("users.recharge"),
|
|
1806
|
+
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" }) })
|
|
1807
|
+
}
|
|
1808
|
+
),
|
|
1809
|
+
/* @__PURE__ */ e(
|
|
1810
|
+
"button",
|
|
1811
|
+
{
|
|
1812
|
+
onClick: () => nt(a),
|
|
1813
|
+
className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
|
|
1814
|
+
title: t("users.copy_token"),
|
|
1815
|
+
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" }) })
|
|
1816
|
+
}
|
|
1817
|
+
),
|
|
1818
|
+
/* @__PURE__ */ e(
|
|
1819
|
+
"button",
|
|
1820
|
+
{
|
|
1821
|
+
onClick: () => st(a.id),
|
|
1822
|
+
className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
|
|
1823
|
+
title: t("delete"),
|
|
1824
|
+
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" }) })
|
|
1825
|
+
}
|
|
1826
|
+
)
|
|
1827
|
+
] }) })
|
|
1828
|
+
] }, a.id)) })
|
|
1829
|
+
] }),
|
|
1830
|
+
d.length === 0 && !c && /* @__PURE__ */ r("div", { className: "p-12 text-center text-muted-foreground text-sm flex flex-col items-center gap-2", children: [
|
|
1831
|
+
/* @__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" }) }),
|
|
1832
|
+
t("users.no_users")
|
|
1833
|
+
] }),
|
|
1834
|
+
c && /* @__PURE__ */ r("div", { className: `${d.length > 0 ? "p-5" : "p-12"} text-center text-muted-foreground text-sm flex flex-col items-center gap-3`, children: [
|
|
1835
|
+
/* @__PURE__ */ e("div", { className: "w-8 h-8 border-2 border-primary/20 border-t-primary rounded-full animate-spin" }),
|
|
1836
|
+
/* @__PURE__ */ e("span", { children: t("loading") })
|
|
1837
|
+
] })
|
|
1838
|
+
]
|
|
1839
|
+
}
|
|
1840
|
+
) })
|
|
1565
1841
|
] });
|
|
1566
1842
|
}
|
|
1567
|
-
function
|
|
1568
|
-
const { t, i18n:
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
}, [
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1843
|
+
function Qt() {
|
|
1844
|
+
const { t, i18n: i } = me(["admin", "translation"]), [o, d] = p(null), [g, c] = p(!0), [x, N] = p(""), [_, B] = p(30), [M, A] = p({}), F = Le({}), R = i.language === "fa", k = R ? "fa-IR" : "en-US", $ = R ? "fa-IR-u-ca-persian" : "en-US";
|
|
1845
|
+
Y(() => {
|
|
1846
|
+
K();
|
|
1847
|
+
}, [_]), Y(() => {
|
|
1848
|
+
const s = Object.entries(F.current).filter(
|
|
1849
|
+
(j) => !!j[1]
|
|
1850
|
+
);
|
|
1851
|
+
if (s.length === 0) return;
|
|
1852
|
+
const u = new ResizeObserver((j) => {
|
|
1853
|
+
for (const O of j) {
|
|
1854
|
+
const C = O.target.dataset.chartId;
|
|
1855
|
+
C && A((z) => ({
|
|
1856
|
+
...z,
|
|
1857
|
+
[C]: O.contentRect.width
|
|
1858
|
+
}));
|
|
1859
|
+
}
|
|
1576
1860
|
});
|
|
1577
|
-
return
|
|
1578
|
-
}, []);
|
|
1579
|
-
const H = (
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1861
|
+
return s.forEach(([, j]) => u.observe(j)), () => u.disconnect();
|
|
1862
|
+
}, [o]);
|
|
1863
|
+
const H = (s) => (u) => {
|
|
1864
|
+
F.current[s] = u;
|
|
1865
|
+
}, S = (s, u, j) => {
|
|
1866
|
+
const O = [], C = /* @__PURE__ */ new Date(), z = s || [], n = new Map(z.map((m) => [m.date, m]));
|
|
1867
|
+
for (let m = u - 1; m >= 0; m--) {
|
|
1868
|
+
const L = new Date(C.getTime() - m * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
|
|
1869
|
+
if (n.has(L))
|
|
1870
|
+
O.push(n.get(L));
|
|
1585
1871
|
else {
|
|
1586
|
-
const
|
|
1587
|
-
|
|
1872
|
+
const G = { date: L };
|
|
1873
|
+
j.forEach((pe) => G[pe] = 0), O.push(G);
|
|
1588
1874
|
}
|
|
1589
1875
|
}
|
|
1590
|
-
return
|
|
1591
|
-
},
|
|
1592
|
-
if (!
|
|
1593
|
-
const
|
|
1594
|
-
let
|
|
1595
|
-
if (
|
|
1596
|
-
|
|
1876
|
+
return O;
|
|
1877
|
+
}, D = (s, u = 0) => {
|
|
1878
|
+
if (!s || s.length === 0) return null;
|
|
1879
|
+
const j = s.length, O = new Intl.DateTimeFormat($, { month: "short" });
|
|
1880
|
+
let C = [];
|
|
1881
|
+
if (_ <= 14)
|
|
1882
|
+
C = Array.from({ length: j }, (z, n) => n);
|
|
1597
1883
|
else {
|
|
1598
|
-
const
|
|
1599
|
-
for (let
|
|
1600
|
-
|
|
1601
|
-
|
|
1884
|
+
const z = R ? 45 : 35, n = u > 0 ? Math.floor(u / z) : 6, m = Math.max(1, Math.ceil(j / Math.max(1, n)));
|
|
1885
|
+
for (let v = 0; v < j; v += m)
|
|
1886
|
+
C.push(v);
|
|
1887
|
+
C.length > 0 && C[C.length - 1] !== j - 1 && (j - 1 - C[C.length - 1] > m / 2 ? C.push(j - 1) : C[C.length - 1] = j - 1);
|
|
1602
1888
|
}
|
|
1603
|
-
return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir:
|
|
1604
|
-
const
|
|
1605
|
-
if (!
|
|
1606
|
-
const
|
|
1889
|
+
return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: R ? "rtl" : "ltr", children: C.map((z) => {
|
|
1890
|
+
const n = s[z];
|
|
1891
|
+
if (!n) return null;
|
|
1892
|
+
const m = new Date(n.date), v = m.toLocaleDateString($, { day: "numeric" }), L = O.format(m), G = j > 1 ? z / (j - 1) * 100 : 50;
|
|
1607
1893
|
return /* @__PURE__ */ r(
|
|
1608
1894
|
"div",
|
|
1609
1895
|
{
|
|
1610
1896
|
className: "absolute top-0 transform -translate-x-1/2 flex flex-col items-center",
|
|
1611
|
-
style: { left: `${
|
|
1897
|
+
style: { left: `${G}%` },
|
|
1612
1898
|
children: [
|
|
1613
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] text-gray-600 dark:text-gray-400 font-medium leading-none", children:
|
|
1614
|
-
/* @__PURE__ */ e("span", { className: "text-[9px] text-gray-400 dark:text-gray-500 mt-1 leading-none whitespace-nowrap", children:
|
|
1899
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] text-gray-600 dark:text-gray-400 font-medium leading-none", children: v }),
|
|
1900
|
+
/* @__PURE__ */ e("span", { className: "text-[9px] text-gray-400 dark:text-gray-500 mt-1 leading-none whitespace-nowrap", children: L })
|
|
1615
1901
|
]
|
|
1616
1902
|
},
|
|
1617
|
-
|
|
1903
|
+
z
|
|
1618
1904
|
);
|
|
1619
1905
|
}) });
|
|
1620
|
-
},
|
|
1621
|
-
|
|
1906
|
+
}, K = async () => {
|
|
1907
|
+
c(!0), N("");
|
|
1622
1908
|
try {
|
|
1623
|
-
const
|
|
1624
|
-
...
|
|
1625
|
-
overview:
|
|
1909
|
+
const s = await w.getAnalytics(_), u = {
|
|
1910
|
+
...s,
|
|
1911
|
+
overview: s.overview || {
|
|
1626
1912
|
total_users: 0,
|
|
1627
1913
|
total_threads: 0,
|
|
1628
1914
|
total_messages: 0,
|
|
1629
|
-
|
|
1915
|
+
total_input_tokens: 0,
|
|
1916
|
+
total_output_tokens: 0,
|
|
1917
|
+
total_cost_microunits: 0,
|
|
1918
|
+
unpriced_requests: 0,
|
|
1919
|
+
currency: "USD"
|
|
1630
1920
|
},
|
|
1631
1921
|
trends: {
|
|
1632
|
-
...
|
|
1633
|
-
users:
|
|
1634
|
-
threads:
|
|
1635
|
-
messages:
|
|
1636
|
-
token_usage:
|
|
1922
|
+
...s.trends || {},
|
|
1923
|
+
users: S(s.trends?.users, _, ["count"]),
|
|
1924
|
+
threads: S(s.trends?.threads, _, ["count"]),
|
|
1925
|
+
messages: S(s.trends?.messages, _, ["count"]),
|
|
1926
|
+
token_usage: S(
|
|
1927
|
+
s.trends?.token_usage,
|
|
1928
|
+
_,
|
|
1929
|
+
["input_tokens", "output_tokens", "requests", "cost_microunits", "unpriced_requests"]
|
|
1930
|
+
)
|
|
1637
1931
|
},
|
|
1638
1932
|
distributions: {
|
|
1639
|
-
...
|
|
1640
|
-
feedback_sentiment:
|
|
1933
|
+
...s.distributions || {},
|
|
1934
|
+
feedback_sentiment: s.distributions?.feedback_sentiment || []
|
|
1641
1935
|
},
|
|
1642
|
-
active_users:
|
|
1936
|
+
active_users: s.active_users || []
|
|
1643
1937
|
};
|
|
1644
|
-
|
|
1645
|
-
} catch (
|
|
1646
|
-
|
|
1938
|
+
d(u);
|
|
1939
|
+
} catch (s) {
|
|
1940
|
+
N(s instanceof Error ? s.message : t("analytics.error_loading"));
|
|
1647
1941
|
} finally {
|
|
1648
|
-
|
|
1942
|
+
c(!1);
|
|
1649
1943
|
}
|
|
1650
1944
|
};
|
|
1651
|
-
if (
|
|
1945
|
+
if (g)
|
|
1652
1946
|
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center text-muted-foreground", children: t("analytics.loading_analytics") });
|
|
1653
|
-
if (
|
|
1947
|
+
if (x)
|
|
1654
1948
|
return /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "text-center", children: [
|
|
1655
|
-
/* @__PURE__ */ e("div", { className: "text-destructive mb-4", children:
|
|
1949
|
+
/* @__PURE__ */ e("div", { className: "text-destructive mb-4", children: x }),
|
|
1656
1950
|
/* @__PURE__ */ e(
|
|
1657
1951
|
"button",
|
|
1658
1952
|
{
|
|
1659
|
-
onClick:
|
|
1953
|
+
onClick: K,
|
|
1660
1954
|
className: "px-4 py-2 bg-primary text-primary-foreground rounded-lg text-sm font-medium hover:opacity-90 transition-colors",
|
|
1661
1955
|
children: t("retry")
|
|
1662
1956
|
}
|
|
1663
1957
|
)
|
|
1664
1958
|
] }) });
|
|
1665
|
-
if (!
|
|
1666
|
-
const
|
|
1667
|
-
if (
|
|
1668
|
-
const
|
|
1669
|
-
let
|
|
1670
|
-
return
|
|
1671
|
-
},
|
|
1672
|
-
|
|
1959
|
+
if (!o) return null;
|
|
1960
|
+
const W = (s) => {
|
|
1961
|
+
if (s <= 0) return 10;
|
|
1962
|
+
const u = s * 1.15, j = Math.pow(10, Math.floor(Math.log10(u))), O = u / j;
|
|
1963
|
+
let C;
|
|
1964
|
+
return O <= 1.2 ? C = 0.2 : O <= 2.5 ? C = 0.5 : O <= 5 ? C = 1 : C = 2, Math.ceil(u / (C * j)) * (C * j);
|
|
1965
|
+
}, P = Math.max(...o.trends.threads.map((s) => s.count) || [1]), ae = Math.max(...o.trends.messages.map((s) => s.count) || [1]), Q = Math.max(
|
|
1966
|
+
...o.trends.token_usage.map((s) => (s.input_tokens || 0) + (s.output_tokens || 0)) || [1]
|
|
1967
|
+
), h = Math.max(...o.trends.token_usage.map((s) => s.cost_microunits) || [1]), E = W(P), U = W(ae), f = W(Q), q = W(h);
|
|
1968
|
+
return /* @__PURE__ */ r("div", { className: "h-full overflow-auto p-5 flex flex-col gap-5", dir: R ? "rtl" : "ltr", children: [
|
|
1673
1969
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3", children: [
|
|
1674
1970
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("analytics.title") }),
|
|
1675
|
-
/* @__PURE__ */ e("div", { className: "flex gap-2", children: [7, 14, 30, 90].map((
|
|
1971
|
+
/* @__PURE__ */ e("div", { className: "flex gap-2", children: [7, 14, 30, 90].map((s) => /* @__PURE__ */ e(
|
|
1676
1972
|
"button",
|
|
1677
1973
|
{
|
|
1678
|
-
onClick: () =>
|
|
1679
|
-
className: `px-4 py-2 text-sm font-medium rounded-xl transition-all shadow-sm ${
|
|
1680
|
-
children: t("analytics.days", { count:
|
|
1974
|
+
onClick: () => B(s),
|
|
1975
|
+
className: `px-4 py-2 text-sm font-medium rounded-xl transition-all shadow-sm ${_ === s ? "bg-primary text-primary-foreground shadow-md" : "bg-muted/50 text-muted-foreground hover:bg-muted hover:text-foreground border border-border/50"}`,
|
|
1976
|
+
children: t("analytics.days", { count: s })
|
|
1681
1977
|
},
|
|
1682
|
-
|
|
1978
|
+
s
|
|
1683
1979
|
)) })
|
|
1684
1980
|
] }),
|
|
1685
1981
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4", children: [
|
|
1686
1982
|
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
1687
1983
|
/* @__PURE__ */ r("div", { children: [
|
|
1688
1984
|
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_users") }),
|
|
1689
|
-
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (
|
|
1985
|
+
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_users || 0).toLocaleString(k) })
|
|
1690
1986
|
] }),
|
|
1691
1987
|
/* @__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
1988
|
] }) }),
|
|
1693
1989
|
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
1694
1990
|
/* @__PURE__ */ r("div", { children: [
|
|
1695
1991
|
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_threads") }),
|
|
1696
|
-
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (
|
|
1992
|
+
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_threads || 0).toLocaleString(k) })
|
|
1697
1993
|
] }),
|
|
1698
1994
|
/* @__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
1995
|
] }) }),
|
|
1700
1996
|
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
1701
1997
|
/* @__PURE__ */ r("div", { children: [
|
|
1702
1998
|
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-1", children: t("analytics.total_messages") }),
|
|
1703
|
-
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (
|
|
1999
|
+
/* @__PURE__ */ e("p", { className: "text-2xl font-light text-foreground", children: (o.overview.total_messages || 0).toLocaleString(k) })
|
|
1704
2000
|
] }),
|
|
1705
2001
|
/* @__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
2002
|
] }) }),
|
|
1707
2003
|
/* @__PURE__ */ e("div", { className: "glass-surface rounded-2xl shadow-sm hover:shadow-md transition-shadow p-4", children: /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
1708
2004
|
/* @__PURE__ */ r("div", { children: [
|
|
1709
|
-
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-
|
|
1710
|
-
/* @__PURE__ */
|
|
2005
|
+
/* @__PURE__ */ e("p", { className: "text-[11px] uppercase tracking-widest font-bold text-muted-foreground/80 mb-2", children: t("analytics.usage_cost") }),
|
|
2006
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-3 gap-3", children: [
|
|
2007
|
+
/* @__PURE__ */ r("div", { children: [
|
|
2008
|
+
/* @__PURE__ */ e("p", { className: "text-[9px] text-muted-foreground", children: t("analytics.input") }),
|
|
2009
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground", children: (o.overview.total_input_tokens || 0).toLocaleString(k) })
|
|
2010
|
+
] }),
|
|
2011
|
+
/* @__PURE__ */ r("div", { children: [
|
|
2012
|
+
/* @__PURE__ */ e("p", { className: "text-[9px] text-muted-foreground", children: t("analytics.output") }),
|
|
2013
|
+
/* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground", children: (o.overview.total_output_tokens || 0).toLocaleString(k) })
|
|
2014
|
+
] }),
|
|
2015
|
+
/* @__PURE__ */ r("div", { children: [
|
|
2016
|
+
/* @__PURE__ */ e("p", { className: "text-[9px] text-muted-foreground", children: t("analytics.cost") }),
|
|
2017
|
+
/* @__PURE__ */ e(
|
|
2018
|
+
"p",
|
|
2019
|
+
{
|
|
2020
|
+
className: "text-sm font-medium text-foreground",
|
|
2021
|
+
title: xe(o.overview.total_cost_microunits, o.overview.currency, k),
|
|
2022
|
+
children: xe(o.overview.total_cost_microunits, o.overview.currency, k)
|
|
2023
|
+
}
|
|
2024
|
+
)
|
|
2025
|
+
] })
|
|
2026
|
+
] })
|
|
1711
2027
|
] }),
|
|
1712
2028
|
/* @__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
2029
|
] }) })
|
|
@@ -1715,11 +2031,11 @@ function Ct() {
|
|
|
1715
2031
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: [
|
|
1716
2032
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1717
2033
|
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.threads_chart") }),
|
|
1718
|
-
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref:
|
|
2034
|
+
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: H("threads"), "data-chart-id": "threads", children: [
|
|
1719
2035
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
1720
2036
|
/* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
|
|
1721
|
-
/* @__PURE__ */ e("span", { children: (
|
|
1722
|
-
/* @__PURE__ */ e("span", { children: Math.floor((
|
|
2037
|
+
/* @__PURE__ */ e("span", { children: (E || 0).toLocaleString(k) }),
|
|
2038
|
+
/* @__PURE__ */ e("span", { children: Math.floor((E || 0) / 2).toLocaleString(k) }),
|
|
1723
2039
|
/* @__PURE__ */ e("span", { children: "0" })
|
|
1724
2040
|
] }),
|
|
1725
2041
|
/* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
@@ -1727,32 +2043,32 @@ function Ct() {
|
|
|
1727
2043
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
1728
2044
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
1729
2045
|
] }),
|
|
1730
|
-
|
|
2046
|
+
o.trends.threads.length > 0 ? o.trends.threads.map((s, u) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
|
|
1731
2047
|
"div",
|
|
1732
2048
|
{
|
|
1733
2049
|
className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
|
|
1734
|
-
style: { height: `${
|
|
2050
|
+
style: { height: `${s.count / E * 100}%` },
|
|
1735
2051
|
children: /* @__PURE__ */ r("div", { className: "absolute bottom-full mb-1 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity bg-card px-2 py-1 rounded border border-border shadow-sm z-20 pointer-events-none flex flex-col items-center", children: [
|
|
1736
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children:
|
|
1737
|
-
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(
|
|
2052
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: s.count.toLocaleString(k) }),
|
|
2053
|
+
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(s.date).toLocaleDateString($, { month: "short", day: "numeric" }) })
|
|
1738
2054
|
] })
|
|
1739
2055
|
}
|
|
1740
|
-
) },
|
|
2056
|
+
) }, u)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
1741
2057
|
] })
|
|
1742
2058
|
] }),
|
|
1743
2059
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
1744
2060
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
1745
|
-
|
|
2061
|
+
D(o.trends.threads, M.threads)
|
|
1746
2062
|
] })
|
|
1747
2063
|
] })
|
|
1748
2064
|
] }),
|
|
1749
2065
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1750
2066
|
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.messages_chart") }),
|
|
1751
|
-
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref:
|
|
2067
|
+
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: H("messages"), "data-chart-id": "messages", children: [
|
|
1752
2068
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
1753
2069
|
/* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
|
|
1754
|
-
/* @__PURE__ */ e("span", { children: (
|
|
1755
|
-
/* @__PURE__ */ e("span", { children: Math.floor((
|
|
2070
|
+
/* @__PURE__ */ e("span", { children: (U || 0).toLocaleString(k) }),
|
|
2071
|
+
/* @__PURE__ */ e("span", { children: Math.floor((U || 0) / 2).toLocaleString(k) }),
|
|
1756
2072
|
/* @__PURE__ */ e("span", { children: "0" })
|
|
1757
2073
|
] }),
|
|
1758
2074
|
/* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
@@ -1760,32 +2076,32 @@ function Ct() {
|
|
|
1760
2076
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
1761
2077
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
1762
2078
|
] }),
|
|
1763
|
-
|
|
2079
|
+
o.trends.messages.length > 0 ? o.trends.messages.map((s, u) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
|
|
1764
2080
|
"div",
|
|
1765
2081
|
{
|
|
1766
2082
|
className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
|
|
1767
|
-
style: { height: `${
|
|
2083
|
+
style: { height: `${s.count / U * 100}%` },
|
|
1768
2084
|
children: /* @__PURE__ */ r("div", { className: "absolute bottom-full mb-1 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity bg-card px-2 py-1 rounded border border-border shadow-sm z-20 pointer-events-none flex flex-col items-center", children: [
|
|
1769
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children:
|
|
1770
|
-
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(
|
|
2085
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: s.count.toLocaleString(k) }),
|
|
2086
|
+
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(s.date).toLocaleDateString($, { month: "short", day: "numeric" }) })
|
|
1771
2087
|
] })
|
|
1772
2088
|
}
|
|
1773
|
-
) },
|
|
2089
|
+
) }, u)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
1774
2090
|
] })
|
|
1775
2091
|
] }),
|
|
1776
2092
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
1777
2093
|
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
1778
|
-
|
|
2094
|
+
D(o.trends.messages, M.messages)
|
|
1779
2095
|
] })
|
|
1780
2096
|
] })
|
|
1781
2097
|
] }),
|
|
1782
2098
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1783
2099
|
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.token_usage_chart") }),
|
|
1784
|
-
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref:
|
|
2100
|
+
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: H("token-usage"), "data-chart-id": "token-usage", children: [
|
|
1785
2101
|
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
1786
2102
|
/* @__PURE__ */ r("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: (
|
|
1788
|
-
/* @__PURE__ */ e("span", { children: Math.floor((
|
|
2103
|
+
/* @__PURE__ */ e("span", { children: (f || 0).toLocaleString(k) }),
|
|
2104
|
+
/* @__PURE__ */ e("span", { children: Math.floor((f || 0) / 2).toLocaleString(k) }),
|
|
1789
2105
|
/* @__PURE__ */ e("span", { children: "0" })
|
|
1790
2106
|
] }),
|
|
1791
2107
|
/* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
@@ -1793,42 +2109,80 @@ function Ct() {
|
|
|
1793
2109
|
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
1794
2110
|
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
1795
2111
|
] }),
|
|
1796
|
-
|
|
2112
|
+
o.trends.token_usage.length > 0 ? o.trends.token_usage.map((s, u) => {
|
|
2113
|
+
const j = (s.input_tokens || 0) + (s.output_tokens || 0);
|
|
2114
|
+
return /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
|
|
2115
|
+
"div",
|
|
2116
|
+
{
|
|
2117
|
+
className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
|
|
2118
|
+
style: { height: `${j / f * 100}%` },
|
|
2119
|
+
children: /* @__PURE__ */ r("div", { className: "absolute bottom-full mb-1 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity bg-card px-2 py-1 rounded border border-border shadow-sm z-20 pointer-events-none flex flex-col items-center", children: [
|
|
2120
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: j.toLocaleString(k) }),
|
|
2121
|
+
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(s.date).toLocaleDateString($, { month: "short", day: "numeric" }) })
|
|
2122
|
+
] })
|
|
2123
|
+
}
|
|
2124
|
+
) }, u);
|
|
2125
|
+
}) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
2126
|
+
] })
|
|
2127
|
+
] }),
|
|
2128
|
+
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
2129
|
+
/* @__PURE__ */ e("div", { className: "min-w-[24px] invisible" }),
|
|
2130
|
+
D(o.trends.token_usage, M["token-usage"])
|
|
2131
|
+
] })
|
|
2132
|
+
] })
|
|
2133
|
+
] }),
|
|
2134
|
+
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
2135
|
+
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.cost_chart") }),
|
|
2136
|
+
/* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: H("cost"), "data-chart-id": "cost", children: [
|
|
2137
|
+
/* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
|
|
2138
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[70px]", children: [
|
|
2139
|
+
/* @__PURE__ */ e("span", { children: xe(q || 0, o.overview.currency, k) }),
|
|
2140
|
+
/* @__PURE__ */ e("span", { children: xe(Math.floor((q || 0) / 2), o.overview.currency, k) }),
|
|
2141
|
+
/* @__PURE__ */ e("span", { children: xe(0, o.overview.currency, k) })
|
|
2142
|
+
] }),
|
|
2143
|
+
/* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
|
|
2144
|
+
/* @__PURE__ */ r("div", { className: "absolute inset-0 pt-6 pointer-events-none", children: [
|
|
2145
|
+
/* @__PURE__ */ e("div", { className: "absolute top-6 left-0 right-0 border-t border-border/30 w-full" }),
|
|
2146
|
+
/* @__PURE__ */ e("div", { className: "absolute top-[calc(50%-4px)] left-0 right-0 border-t border-border/30 w-full" })
|
|
2147
|
+
] }),
|
|
2148
|
+
o.trends.token_usage.length > 0 ? o.trends.token_usage.map((s, u) => /* @__PURE__ */ e("div", { className: "w-1.5 group relative flex flex-col justify-end h-full", children: /* @__PURE__ */ e(
|
|
1797
2149
|
"div",
|
|
1798
2150
|
{
|
|
1799
|
-
className: "bg-
|
|
1800
|
-
style: { height: `${
|
|
2151
|
+
className: "bg-emerald-500/80 w-full rounded-t-lg transition-all group-hover:bg-emerald-500 relative",
|
|
2152
|
+
style: { height: `${(s.cost_microunits || 0) / q * 100}%` },
|
|
1801
2153
|
children: /* @__PURE__ */ r("div", { className: "absolute bottom-full mb-1 left-1/2 -translate-x-1/2 opacity-0 group-hover:opacity-100 transition-opacity bg-card px-2 py-1 rounded border border-border shadow-sm z-20 pointer-events-none flex flex-col items-center", children: [
|
|
1802
|
-
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-
|
|
1803
|
-
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(
|
|
2154
|
+
/* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-emerald-500 leading-none mb-0.5", children: xe(s.cost_microunits || 0, o.overview.currency, k) }),
|
|
2155
|
+
/* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(s.date).toLocaleDateString($, { month: "short", day: "numeric" }) })
|
|
1804
2156
|
] })
|
|
1805
2157
|
}
|
|
1806
|
-
) },
|
|
2158
|
+
) }, u)) : /* @__PURE__ */ e("p", { className: "w-full text-center text-muted-foreground py-8", children: t("no_data") })
|
|
1807
2159
|
] })
|
|
1808
2160
|
] }),
|
|
1809
2161
|
/* @__PURE__ */ r("div", { className: "flex gap-2", dir: "ltr", children: [
|
|
1810
|
-
/* @__PURE__ */ e("div", { className: "min-w-[
|
|
1811
|
-
|
|
2162
|
+
/* @__PURE__ */ e("div", { className: "min-w-[70px] invisible" }),
|
|
2163
|
+
D(o.trends.token_usage, M.cost)
|
|
1812
2164
|
] })
|
|
1813
2165
|
] })
|
|
1814
|
-
] })
|
|
2166
|
+
] })
|
|
2167
|
+
] }),
|
|
2168
|
+
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: [
|
|
1815
2169
|
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1816
2170
|
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.feedback") }),
|
|
1817
|
-
/* @__PURE__ */ e("div", { className: "h-64 flex flex-col justify-center", children:
|
|
2171
|
+
/* @__PURE__ */ e("div", { className: "h-64 flex flex-col justify-center", children: o.distributions.feedback_sentiment.length > 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row items-center justify-center gap-8 lg:gap-12", children: [
|
|
1818
2172
|
/* @__PURE__ */ r("div", { className: "relative w-56 h-56 lg:w-60 lg:h-60", children: [
|
|
1819
2173
|
/* @__PURE__ */ e("svg", { viewBox: "0 0 100 100", className: "w-full h-full -rotate-90 drop-shadow-md", children: (() => {
|
|
1820
|
-
const
|
|
1821
|
-
(
|
|
1822
|
-
),
|
|
1823
|
-
if (
|
|
1824
|
-
const
|
|
1825
|
-
return /* @__PURE__ */ r(
|
|
2174
|
+
const s = o.distributions.feedback_sentiment.filter(
|
|
2175
|
+
(v) => v.sentiment === "positive" || v.sentiment === "negative"
|
|
2176
|
+
), u = s.reduce((v, L) => v + L.count, 0);
|
|
2177
|
+
if (u === 0) return null;
|
|
2178
|
+
const j = s.find((v) => v.sentiment === "positive")?.count || 0, O = s.find((v) => v.sentiment === "negative")?.count || 0, C = 40, z = 2 * Math.PI * C, n = j / u * 100, m = O / u * 100;
|
|
2179
|
+
return /* @__PURE__ */ r(mt, { children: [
|
|
1826
2180
|
/* @__PURE__ */ e(
|
|
1827
2181
|
"circle",
|
|
1828
2182
|
{
|
|
1829
2183
|
cx: "50",
|
|
1830
2184
|
cy: "50",
|
|
1831
|
-
r:
|
|
2185
|
+
r: C,
|
|
1832
2186
|
fill: "transparent",
|
|
1833
2187
|
stroke: "currentColor",
|
|
1834
2188
|
strokeWidth: "10",
|
|
@@ -1850,12 +2204,12 @@ function Ct() {
|
|
|
1850
2204
|
{
|
|
1851
2205
|
cx: "50",
|
|
1852
2206
|
cy: "50",
|
|
1853
|
-
r:
|
|
2207
|
+
r: C,
|
|
1854
2208
|
fill: "transparent",
|
|
1855
2209
|
stroke: "url(#posGradient)",
|
|
1856
2210
|
strokeWidth: "10",
|
|
1857
|
-
strokeDasharray: `${
|
|
1858
|
-
strokeLinecap:
|
|
2211
|
+
strokeDasharray: `${n / 100 * z} ${z}`,
|
|
2212
|
+
strokeLinecap: n > 0 ? "round" : "butt",
|
|
1859
2213
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
1860
2214
|
}
|
|
1861
2215
|
),
|
|
@@ -1864,276 +2218,254 @@ function Ct() {
|
|
|
1864
2218
|
{
|
|
1865
2219
|
cx: "50",
|
|
1866
2220
|
cy: "50",
|
|
1867
|
-
r:
|
|
2221
|
+
r: C,
|
|
1868
2222
|
fill: "transparent",
|
|
1869
2223
|
stroke: "url(#negGradient)",
|
|
1870
2224
|
strokeWidth: "10",
|
|
1871
|
-
strokeDasharray: `${
|
|
1872
|
-
strokeDashoffset: -(
|
|
1873
|
-
strokeLinecap:
|
|
2225
|
+
strokeDasharray: `${m / 100 * z} ${z}`,
|
|
2226
|
+
strokeDashoffset: -(n / 100 * z),
|
|
2227
|
+
strokeLinecap: m > 0 ? "round" : "butt",
|
|
1874
2228
|
className: "transition-all duration-1000 ease-out drop-shadow-sm"
|
|
1875
2229
|
}
|
|
1876
2230
|
)
|
|
1877
2231
|
] });
|
|
1878
2232
|
})() }),
|
|
1879
2233
|
/* @__PURE__ */ r("div", { className: "absolute inset-0 flex flex-col items-center justify-center pointer-events-none", children: [
|
|
1880
|
-
/* @__PURE__ */ e("span", { className: "text-3xl lg:text-4xl font-light text-foreground", children:
|
|
2234
|
+
/* @__PURE__ */ e("span", { className: "text-3xl lg:text-4xl font-light text-foreground", children: o.distributions.feedback_sentiment.filter((s) => s.sentiment === "positive" || s.sentiment === "negative").reduce((s, u) => s + (u.count || 0), 0).toLocaleString(k) }),
|
|
1881
2235
|
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground uppercase tracking-widest mt-1", children: t("analytics.total_feedback") })
|
|
1882
2236
|
] })
|
|
1883
2237
|
] }),
|
|
1884
|
-
/* @__PURE__ */ e("div", { className: "flex flex-col gap-4 min-w-[140px]", children: [...
|
|
1885
|
-
const
|
|
1886
|
-
(
|
|
1887
|
-
).reduce((
|
|
2238
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col gap-4 min-w-[140px]", children: [...o.distributions.feedback_sentiment].filter((s) => s.sentiment === "positive" || s.sentiment === "negative").sort((s, u) => s.sentiment === "positive" ? -1 : 1).map((s) => {
|
|
2239
|
+
const j = o.distributions.feedback_sentiment.filter(
|
|
2240
|
+
(m) => m.sentiment === "positive" || m.sentiment === "negative"
|
|
2241
|
+
).reduce((m, v) => m + v.count, 0), O = j > 0 ? s.count / j * 100 : 0, C = s.sentiment === "positive" ? t("analytics.positive") : t("analytics.negative"), z = s.sentiment === "positive" ? "bg-primary" : "bg-destructive", n = s.sentiment === "positive" ? "👍" : "👎";
|
|
1888
2242
|
return /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-6 group", children: [
|
|
1889
2243
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
1890
|
-
/* @__PURE__ */ e("div", { className: `w-3 h-3 rounded-full ${
|
|
2244
|
+
/* @__PURE__ */ e("div", { className: `w-3 h-3 rounded-full ${z} shadow-sm group-hover:scale-110 transition-transform` }),
|
|
1891
2245
|
/* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground font-medium", children: [
|
|
1892
|
-
|
|
2246
|
+
C,
|
|
1893
2247
|
" ",
|
|
1894
|
-
|
|
2248
|
+
n
|
|
1895
2249
|
] })
|
|
1896
2250
|
] }),
|
|
1897
2251
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
1898
2252
|
/* @__PURE__ */ r("span", { className: "text-sm font-semibold text-foreground bg-muted/50 px-2.5 py-1 rounded-lg min-w-[50px] text-center", children: [
|
|
1899
|
-
(
|
|
2253
|
+
(O || 0).toLocaleString(k, { maximumFractionDigits: 0 }),
|
|
1900
2254
|
"%"
|
|
1901
2255
|
] }),
|
|
1902
2256
|
/* @__PURE__ */ r("span", { className: "text-[13px] font-normal text-muted-foreground w-12 text-right", children: [
|
|
1903
2257
|
"(",
|
|
1904
|
-
(
|
|
2258
|
+
(s.count || 0).toLocaleString(k),
|
|
1905
2259
|
")"
|
|
1906
2260
|
] })
|
|
1907
2261
|
] })
|
|
1908
|
-
] },
|
|
2262
|
+
] }, s.sentiment);
|
|
1909
2263
|
}) })
|
|
1910
2264
|
] }) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children: t("no_data") }) })
|
|
2265
|
+
] }),
|
|
2266
|
+
/* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
2267
|
+
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.active_users") }),
|
|
2268
|
+
/* @__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((s) => /* @__PURE__ */ r(
|
|
2269
|
+
"div",
|
|
2270
|
+
{
|
|
2271
|
+
className: "flex items-center justify-between p-3 bg-muted/30 rounded-xl hover:bg-muted/50 transition-colors",
|
|
2272
|
+
children: [
|
|
2273
|
+
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
2274
|
+
/* @__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: s.name.charAt(0) }),
|
|
2275
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground", children: s.name }) })
|
|
2276
|
+
] }),
|
|
2277
|
+
/* @__PURE__ */ r("div", { className: "text-sm font-semibold text-primary", children: [
|
|
2278
|
+
(s.thread_count || 0).toLocaleString(k),
|
|
2279
|
+
" ",
|
|
2280
|
+
t("analytics.threads")
|
|
2281
|
+
] })
|
|
2282
|
+
]
|
|
2283
|
+
},
|
|
2284
|
+
s.user_id
|
|
2285
|
+
)) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children: t("no_data") }) }) })
|
|
1911
2286
|
] })
|
|
1912
|
-
] })
|
|
1913
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
|
|
1914
|
-
/* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("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: i.active_users.length > 0 ? i.active_users.slice(0, 5).map((d) => /* @__PURE__ */ r(
|
|
1916
|
-
"div",
|
|
1917
|
-
{
|
|
1918
|
-
className: "flex items-center justify-between p-3 bg-muted/30 rounded-xl hover:bg-muted/50 transition-colors",
|
|
1919
|
-
children: [
|
|
1920
|
-
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
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
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("p", { className: "text-sm font-medium text-foreground", children: d.name }) })
|
|
1923
|
-
] }),
|
|
1924
|
-
/* @__PURE__ */ r("div", { className: "text-sm font-semibold text-primary", children: [
|
|
1925
|
-
(d.thread_count || 0).toLocaleString(q),
|
|
1926
|
-
" ",
|
|
1927
|
-
t("analytics.threads")
|
|
1928
|
-
] })
|
|
1929
|
-
]
|
|
1930
|
-
},
|
|
1931
|
-
d.user_id
|
|
1932
|
-
)) : /* @__PURE__ */ e("p", { className: "text-center text-muted-foreground py-8", children: t("no_data") }) }) })
|
|
1933
|
-
] }) })
|
|
2287
|
+
] })
|
|
1934
2288
|
] });
|
|
1935
2289
|
}
|
|
1936
|
-
function
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
welcome_subtitle: m?.subtitle || "",
|
|
1966
|
-
disclaimer: typeof x == "string" ? x : "",
|
|
1967
|
-
show_tool_details: i?.showToolDetails ?? !0,
|
|
1968
|
-
show_settings: i?.showSettings ?? !0,
|
|
1969
|
-
show_version_in_settings: i?.showVersionInSettings ?? !0,
|
|
1970
|
-
disable_signup: i?.disableSignup ?? !1,
|
|
1971
|
-
disable_auth_page: i?.disableAuthPage ?? !1,
|
|
1972
|
-
composer_attachments: _?.attachments?.enabled ?? !0,
|
|
1973
|
-
thread_actions_feedback: v?.feedback ?? !0,
|
|
1974
|
-
thread_actions_retry: v?.retry ?? !0,
|
|
1975
|
-
history_enabled: u?.enabled ?? !0,
|
|
1976
|
-
history_show_delete: u?.showDelete ?? !0,
|
|
1977
|
-
history_show_rename: u?.showRename ?? !0,
|
|
1978
|
-
history_show_share: u?.showShare ?? !0,
|
|
1979
|
-
history_show_pin: u?.showPin ?? !0,
|
|
1980
|
-
settings_general_mode: i?.settingsGeneralMode || "editable",
|
|
1981
|
-
settings_profile_mode: i?.settingsProfileMode || "editable",
|
|
1982
|
-
settings_account_mode: i?.settingsAccountMode || "editable",
|
|
1983
|
-
settings_general_fields: P?.sections?.general?.fields || {},
|
|
1984
|
-
settings_profile_fields: P?.sections?.profile?.fields || {},
|
|
1985
|
-
settings_account_fields: P?.sections?.account?.fields || {},
|
|
1986
|
-
language: n.language || "fa",
|
|
2290
|
+
function Xt() {
|
|
2291
|
+
const { t, i18n: i } = me(["admin", "translation", "settings"]), { app: o, welcome: d, disclaimer: g, history: c, threadActions: x, composer: N, theme: _, settings: B } = Ne(), [M, A] = p(!1), [F, R] = p(!1), [k, $] = p(""), [H, S] = p(""), [D, K] = p("fa"), [W, P] = p("translation"), [ae, Q] = p("{}"), [h, E] = p(""), [U, f] = p(!1), q = Ce(() => ({
|
|
2292
|
+
app_name: o?.name || "Gentiq",
|
|
2293
|
+
admin_title: o?.adminTitle || "",
|
|
2294
|
+
default_theme: _?.defaultTheme || "system",
|
|
2295
|
+
default_accent: _?.accent || "oklch(0.623 0.214 259.815)",
|
|
2296
|
+
welcome_greeting: typeof d?.greeting == "string" ? d.greeting : "",
|
|
2297
|
+
welcome_subtitle: d?.subtitle || "",
|
|
2298
|
+
disclaimer: typeof g == "string" ? g : "",
|
|
2299
|
+
show_tool_details: o?.showToolDetails ?? !0,
|
|
2300
|
+
show_settings: o?.showSettings ?? !0,
|
|
2301
|
+
show_version_in_settings: o?.showVersionInSettings ?? !0,
|
|
2302
|
+
disable_signup: o?.disableSignup ?? !1,
|
|
2303
|
+
disable_auth_page: o?.disableAuthPage ?? !1,
|
|
2304
|
+
composer_attachments: N?.attachments?.enabled ?? !0,
|
|
2305
|
+
thread_actions_feedback: x?.feedback ?? !0,
|
|
2306
|
+
thread_actions_retry: x?.retry ?? !0,
|
|
2307
|
+
history_enabled: c?.enabled ?? !0,
|
|
2308
|
+
history_show_delete: c?.showDelete ?? !0,
|
|
2309
|
+
history_show_rename: c?.showRename ?? !0,
|
|
2310
|
+
history_show_share: c?.showShare ?? !0,
|
|
2311
|
+
history_show_pin: c?.showPin ?? !0,
|
|
2312
|
+
settings_general_mode: o?.settingsGeneralMode || "editable",
|
|
2313
|
+
settings_profile_mode: o?.settingsProfileMode || "editable",
|
|
2314
|
+
settings_account_mode: o?.settingsAccountMode || "editable",
|
|
2315
|
+
settings_general_fields: B?.sections?.general?.fields || {},
|
|
2316
|
+
settings_profile_fields: B?.sections?.profile?.fields || {},
|
|
2317
|
+
settings_account_fields: B?.sections?.account?.fields || {},
|
|
2318
|
+
language: i.language || "fa",
|
|
1987
2319
|
initial_balance_tokens: 25e4,
|
|
1988
2320
|
initial_balance_requests: 100,
|
|
1989
2321
|
translations: {}
|
|
1990
|
-
}), [
|
|
1991
|
-
|
|
2322
|
+
}), [o, d, g, c, x, N, _, i.language, B]), [s, u] = p(q), j = i.language === "fa", O = (s.default_accent || "").trim(), C = !O || typeof CSS < "u" && CSS.supports("color", O);
|
|
2323
|
+
Y(() => {
|
|
1992
2324
|
(async () => {
|
|
1993
|
-
|
|
2325
|
+
A(!0);
|
|
1994
2326
|
try {
|
|
1995
|
-
const
|
|
1996
|
-
if (
|
|
1997
|
-
const
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
}),
|
|
2001
|
-
...
|
|
2002
|
-
...
|
|
2003
|
-
translations:
|
|
2327
|
+
const T = await w.getSettings();
|
|
2328
|
+
if (T && Object.keys(T).length > 0) {
|
|
2329
|
+
const J = JSON.parse(JSON.stringify(i.store.data));
|
|
2330
|
+
T.translations && Object.keys(T.translations).forEach((ie) => {
|
|
2331
|
+
J[ie] || (J[ie] = {}), Object.assign(J[ie], T.translations[ie]);
|
|
2332
|
+
}), u((ie) => ({
|
|
2333
|
+
...ie,
|
|
2334
|
+
...T,
|
|
2335
|
+
translations: J
|
|
2004
2336
|
}));
|
|
2005
2337
|
} else {
|
|
2006
|
-
const
|
|
2007
|
-
|
|
2338
|
+
const J = { ...q, translations: i.store.data };
|
|
2339
|
+
u(J), T || w.updateSettings(J).catch(console.error);
|
|
2008
2340
|
}
|
|
2009
|
-
} catch (
|
|
2010
|
-
console.error("Failed to fetch settings",
|
|
2341
|
+
} catch (T) {
|
|
2342
|
+
console.error("Failed to fetch settings", T), $(t("app_settings.save_error"));
|
|
2011
2343
|
} finally {
|
|
2012
|
-
|
|
2344
|
+
A(!1);
|
|
2013
2345
|
}
|
|
2014
2346
|
})();
|
|
2015
|
-
}, [t,
|
|
2016
|
-
const
|
|
2017
|
-
if (
|
|
2018
|
-
|
|
2347
|
+
}, [t, q, i.store.data]);
|
|
2348
|
+
const z = async (l) => {
|
|
2349
|
+
if (l && l.preventDefault(), !C) {
|
|
2350
|
+
$(t("app_settings.general.default_accent_invalid"));
|
|
2019
2351
|
return;
|
|
2020
2352
|
}
|
|
2021
|
-
|
|
2353
|
+
R(!0), S(""), $("");
|
|
2022
2354
|
try {
|
|
2023
|
-
await
|
|
2024
|
-
...
|
|
2025
|
-
default_accent:
|
|
2026
|
-
}),
|
|
2027
|
-
} catch (
|
|
2028
|
-
|
|
2355
|
+
await w.updateSettings({
|
|
2356
|
+
...s,
|
|
2357
|
+
default_accent: O || null
|
|
2358
|
+
}), S(t("app_settings.save_success")), setTimeout(() => S(""), 3e3);
|
|
2359
|
+
} catch (T) {
|
|
2360
|
+
$(T instanceof Error ? T.message : t("app_settings.save_error"));
|
|
2029
2361
|
} finally {
|
|
2030
|
-
|
|
2362
|
+
R(!1);
|
|
2031
2363
|
}
|
|
2032
|
-
},
|
|
2033
|
-
|
|
2364
|
+
}, n = async () => {
|
|
2365
|
+
A(!0), $("");
|
|
2034
2366
|
try {
|
|
2035
|
-
await
|
|
2036
|
-
} catch (
|
|
2037
|
-
|
|
2367
|
+
await w.resetSettings(), f(!1), window.location.reload();
|
|
2368
|
+
} catch (l) {
|
|
2369
|
+
$(l instanceof Error ? l.message : t("app_settings.save_error"));
|
|
2038
2370
|
} finally {
|
|
2039
|
-
|
|
2371
|
+
A(!1);
|
|
2040
2372
|
}
|
|
2041
2373
|
};
|
|
2042
|
-
|
|
2043
|
-
const
|
|
2044
|
-
|
|
2045
|
-
}, [
|
|
2046
|
-
const
|
|
2047
|
-
|
|
2374
|
+
Y(() => {
|
|
2375
|
+
const l = s.translations?.[D]?.[W] || {};
|
|
2376
|
+
Q(JSON.stringify(l, null, 2)), E("");
|
|
2377
|
+
}, [D, W, s.translations]);
|
|
2378
|
+
const m = (l) => {
|
|
2379
|
+
Q(l);
|
|
2048
2380
|
try {
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2051
|
-
...
|
|
2381
|
+
const T = JSON.parse(l);
|
|
2382
|
+
u((J) => ({
|
|
2383
|
+
...J,
|
|
2052
2384
|
translations: {
|
|
2053
|
-
...
|
|
2054
|
-
[
|
|
2055
|
-
...
|
|
2056
|
-
[
|
|
2385
|
+
...J.translations,
|
|
2386
|
+
[D]: {
|
|
2387
|
+
...J.translations?.[D],
|
|
2388
|
+
[W]: T
|
|
2057
2389
|
}
|
|
2058
2390
|
}
|
|
2059
|
-
})),
|
|
2391
|
+
})), E("");
|
|
2060
2392
|
} catch {
|
|
2061
|
-
|
|
2393
|
+
E("Invalid JSON format");
|
|
2062
2394
|
}
|
|
2063
|
-
},
|
|
2395
|
+
}, v = ({ title: l, icon: T }) => /* @__PURE__ */ r("div", { className: "relative py-12", children: [
|
|
2064
2396
|
/* @__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" }) }),
|
|
2065
2397
|
/* @__PURE__ */ e("div", { className: "relative flex justify-center", children: /* @__PURE__ */ r("span", { className: "bg-background px-6 text-sm font-bold text-muted-foreground uppercase tracking-[0.2em] flex items-center gap-3", children: [
|
|
2066
|
-
/* @__PURE__ */ e(
|
|
2067
|
-
|
|
2398
|
+
/* @__PURE__ */ e(T, { className: "size-4 text-primary/60" }),
|
|
2399
|
+
l
|
|
2068
2400
|
] }) })
|
|
2069
|
-
] }),
|
|
2070
|
-
if (!
|
|
2071
|
-
const
|
|
2072
|
-
return
|
|
2401
|
+
] }), L = ({ value: l }) => {
|
|
2402
|
+
if (!l || !l.includes(":") && !l.includes(".")) return null;
|
|
2403
|
+
const T = t(l);
|
|
2404
|
+
return T === l ? null : /* @__PURE__ */ r("div", { className: "mt-1.5 px-3 py-1 bg-primary/5 rounded-lg border border-primary/10 inline-flex items-center gap-2", children: [
|
|
2073
2405
|
/* @__PURE__ */ r("span", { className: "text-[10px] font-bold text-primary/60 uppercase tracking-tighter", children: [
|
|
2074
2406
|
t("app_settings.preview", { defaultValue: "Preview" }),
|
|
2075
2407
|
":"
|
|
2076
2408
|
] }),
|
|
2077
|
-
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children:
|
|
2409
|
+
/* @__PURE__ */ e("span", { className: "text-[11px] font-medium text-foreground/70", children: T })
|
|
2078
2410
|
] });
|
|
2079
|
-
},
|
|
2080
|
-
const
|
|
2081
|
-
|
|
2082
|
-
...
|
|
2411
|
+
}, G = () => {
|
|
2412
|
+
const l = prompt("Enter language code (e.g. en, fa, fr):");
|
|
2413
|
+
l && !s.translations?.[l] && (u((T) => ({
|
|
2414
|
+
...T,
|
|
2083
2415
|
translations: {
|
|
2084
|
-
...
|
|
2085
|
-
[
|
|
2416
|
+
...T.translations,
|
|
2417
|
+
[l]: {}
|
|
2086
2418
|
}
|
|
2087
|
-
})),
|
|
2088
|
-
},
|
|
2089
|
-
const
|
|
2090
|
-
|
|
2091
|
-
...
|
|
2419
|
+
})), K(l));
|
|
2420
|
+
}, pe = () => {
|
|
2421
|
+
const l = prompt("Enter namespace (e.g. chat, admin):");
|
|
2422
|
+
l && !s.translations?.[D]?.[l] && (u((T) => ({
|
|
2423
|
+
...T,
|
|
2092
2424
|
translations: {
|
|
2093
|
-
...
|
|
2094
|
-
[
|
|
2095
|
-
...
|
|
2096
|
-
[
|
|
2425
|
+
...T.translations,
|
|
2426
|
+
[D]: {
|
|
2427
|
+
...T.translations?.[D],
|
|
2428
|
+
[l]: {}
|
|
2097
2429
|
}
|
|
2098
2430
|
}
|
|
2099
|
-
})),
|
|
2431
|
+
})), P(l));
|
|
2100
2432
|
};
|
|
2101
|
-
return
|
|
2433
|
+
return M ? /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center", children: /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-3", children: [
|
|
2102
2434
|
/* @__PURE__ */ e("div", { className: "w-10 h-10 border-3 border-primary/20 border-t-primary rounded-full animate-spin" }),
|
|
2103
2435
|
/* @__PURE__ */ e("span", { className: "text-sm text-muted-foreground font-medium", children: t("loading") })
|
|
2104
|
-
] }) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col overflow-hidden", dir:
|
|
2436
|
+
] }) }) : /* @__PURE__ */ r("div", { className: "h-full flex flex-col overflow-hidden", dir: j ? "rtl" : "ltr", children: [
|
|
2105
2437
|
/* @__PURE__ */ r("div", { className: "px-8 py-6 border-b border-border bg-background/50 backdrop-blur-md z-20 flex items-center justify-between flex-shrink-0", children: [
|
|
2106
2438
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
2107
2439
|
/* @__PURE__ */ r("div", { className: "flex items-baseline gap-3 flex-wrap", children: [
|
|
2108
2440
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight", children: t("app_settings.title") }),
|
|
2109
|
-
|
|
2441
|
+
o?.version && /* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground font-mono", dir: "ltr", children: [
|
|
2110
2442
|
"v",
|
|
2111
|
-
|
|
2443
|
+
o.version
|
|
2112
2444
|
] })
|
|
2113
2445
|
] }),
|
|
2114
2446
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("app_settings.subtitle") })
|
|
2115
2447
|
] }),
|
|
2116
2448
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: [
|
|
2117
|
-
/* @__PURE__ */ r(
|
|
2118
|
-
/* @__PURE__ */ e(
|
|
2449
|
+
/* @__PURE__ */ r(We, { open: U, onOpenChange: f, children: [
|
|
2450
|
+
/* @__PURE__ */ e(ft, { asChild: !0, children: /* @__PURE__ */ r(
|
|
2119
2451
|
"button",
|
|
2120
2452
|
{
|
|
2121
2453
|
type: "button",
|
|
2122
2454
|
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",
|
|
2123
2455
|
children: [
|
|
2124
|
-
/* @__PURE__ */ e(
|
|
2456
|
+
/* @__PURE__ */ e(Pe, { className: "size-3.5" }),
|
|
2125
2457
|
t("app_settings.reset_button", { defaultValue: "Reset to Defaults" })
|
|
2126
2458
|
]
|
|
2127
2459
|
}
|
|
2128
2460
|
) }),
|
|
2129
|
-
/* @__PURE__ */ r(
|
|
2130
|
-
/* @__PURE__ */ r(
|
|
2131
|
-
/* @__PURE__ */ e(
|
|
2132
|
-
/* @__PURE__ */ e(
|
|
2461
|
+
/* @__PURE__ */ r(Ge, { children: [
|
|
2462
|
+
/* @__PURE__ */ r(Ke, { children: [
|
|
2463
|
+
/* @__PURE__ */ e(Ze, { children: t("app_settings.reset_confirm_title") }),
|
|
2464
|
+
/* @__PURE__ */ e(Qe, { children: t("app_settings.reset_confirm_description") })
|
|
2133
2465
|
] }),
|
|
2134
|
-
/* @__PURE__ */ r(
|
|
2135
|
-
/* @__PURE__ */ e(
|
|
2136
|
-
/* @__PURE__ */ e(
|
|
2466
|
+
/* @__PURE__ */ r(xt, { children: [
|
|
2467
|
+
/* @__PURE__ */ e(bt, { asChild: !0, children: /* @__PURE__ */ e(Se, { variant: "ghost", children: t("cancel") }) }),
|
|
2468
|
+
/* @__PURE__ */ e(Se, { variant: "destructive", onClick: n, children: t("app_settings.reset_button") })
|
|
2137
2469
|
] })
|
|
2138
2470
|
] })
|
|
2139
2471
|
] }),
|
|
@@ -2142,78 +2474,78 @@ function Lt() {
|
|
|
2142
2474
|
{
|
|
2143
2475
|
type: "submit",
|
|
2144
2476
|
form: "settings-form",
|
|
2145
|
-
disabled:
|
|
2477
|
+
disabled: F || !C,
|
|
2146
2478
|
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",
|
|
2147
2479
|
children: [
|
|
2148
|
-
|
|
2149
|
-
t(
|
|
2480
|
+
F && /* @__PURE__ */ e("div", { className: "w-4 h-4 border-2 border-primary-foreground/20 border-t-primary-foreground rounded-full animate-spin" }),
|
|
2481
|
+
t(F ? "saving" : "app_settings.save")
|
|
2150
2482
|
]
|
|
2151
2483
|
}
|
|
2152
2484
|
)
|
|
2153
2485
|
] })
|
|
2154
2486
|
] }),
|
|
2155
2487
|
/* @__PURE__ */ e("div", { className: "flex-1 overflow-y-auto custom-scrollbar", children: /* @__PURE__ */ r("div", { className: "max-w-4xl mx-auto py-10 px-8", children: [
|
|
2156
|
-
(
|
|
2157
|
-
/* @__PURE__ */ r("form", { id: "settings-form", onSubmit:
|
|
2488
|
+
(k || H) && /* @__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 ${k ? "bg-destructive/10 border-destructive/20 text-destructive" : "bg-green-500/10 border-green-500/20 text-green-600 dark:text-green-400"}`, children: k || H }),
|
|
2489
|
+
/* @__PURE__ */ r("form", { id: "settings-form", onSubmit: z, className: "space-y-16 animate-in fade-in slide-in-from-bottom-2 duration-500", children: [
|
|
2158
2490
|
/* @__PURE__ */ r("section", { children: [
|
|
2159
|
-
/* @__PURE__ */ e(
|
|
2491
|
+
/* @__PURE__ */ e(v, { title: t("app_settings.sections.general"), icon: je }),
|
|
2160
2492
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
2161
2493
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
2162
2494
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2163
|
-
/* @__PURE__ */ e(
|
|
2495
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.app_name") }),
|
|
2164
2496
|
/* @__PURE__ */ e(
|
|
2165
|
-
|
|
2497
|
+
fe,
|
|
2166
2498
|
{
|
|
2167
2499
|
type: "text",
|
|
2168
|
-
value:
|
|
2169
|
-
onChange: (
|
|
2500
|
+
value: s.app_name,
|
|
2501
|
+
onChange: (l) => u({ ...s, app_name: l.target.value }),
|
|
2170
2502
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2171
2503
|
placeholder: "Gentiq AI",
|
|
2172
2504
|
dir: "auto"
|
|
2173
2505
|
}
|
|
2174
2506
|
),
|
|
2175
|
-
/* @__PURE__ */ e(
|
|
2507
|
+
/* @__PURE__ */ e(L, { value: s.app_name })
|
|
2176
2508
|
] }),
|
|
2177
2509
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2178
|
-
/* @__PURE__ */ e(
|
|
2510
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.admin_title") }),
|
|
2179
2511
|
/* @__PURE__ */ e(
|
|
2180
|
-
|
|
2512
|
+
fe,
|
|
2181
2513
|
{
|
|
2182
2514
|
type: "text",
|
|
2183
|
-
value:
|
|
2184
|
-
onChange: (
|
|
2515
|
+
value: s.admin_title || "",
|
|
2516
|
+
onChange: (l) => u({ ...s, admin_title: l.target.value }),
|
|
2185
2517
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2186
2518
|
placeholder: "Gentiq Admin",
|
|
2187
2519
|
dir: "auto"
|
|
2188
2520
|
}
|
|
2189
2521
|
),
|
|
2190
|
-
/* @__PURE__ */ e(
|
|
2522
|
+
/* @__PURE__ */ e(L, { value: s.admin_title || "" })
|
|
2191
2523
|
] })
|
|
2192
2524
|
] }),
|
|
2193
2525
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2194
|
-
/* @__PURE__ */ e(
|
|
2526
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.language") }),
|
|
2195
2527
|
/* @__PURE__ */ r(
|
|
2196
|
-
|
|
2528
|
+
oe,
|
|
2197
2529
|
{
|
|
2198
|
-
value:
|
|
2199
|
-
onValueChange: (
|
|
2530
|
+
value: s.language,
|
|
2531
|
+
onValueChange: (l) => u({ ...s, language: l }),
|
|
2200
2532
|
children: [
|
|
2201
|
-
/* @__PURE__ */ e(
|
|
2202
|
-
/* @__PURE__ */ r(
|
|
2203
|
-
/* @__PURE__ */ e(
|
|
2204
|
-
/* @__PURE__ */ e(
|
|
2533
|
+
/* @__PURE__ */ e(le, { className: "bg-muted/20 border-transparent focus:bg-background h-11 w-full flex-row-reverse justify-end gap-3", children: /* @__PURE__ */ e(de, {}) }),
|
|
2534
|
+
/* @__PURE__ */ r(ce, { children: [
|
|
2535
|
+
/* @__PURE__ */ e(Z, { value: "fa", children: "فارسی (Persian)" }),
|
|
2536
|
+
/* @__PURE__ */ e(Z, { value: "en", children: "English" })
|
|
2205
2537
|
] })
|
|
2206
2538
|
]
|
|
2207
2539
|
}
|
|
2208
2540
|
),
|
|
2209
2541
|
/* @__PURE__ */ r("p", { className: "mt-3 text-[10px] text-muted-foreground/50 italic flex items-center gap-1.5 ml-1", children: [
|
|
2210
|
-
/* @__PURE__ */ e(
|
|
2542
|
+
/* @__PURE__ */ e(Pe, { className: "size-3" }),
|
|
2211
2543
|
t("app_settings.general.language_help")
|
|
2212
2544
|
] })
|
|
2213
2545
|
] }),
|
|
2214
2546
|
/* @__PURE__ */ r("div", { className: "space-y-5 rounded-2xl border border-border/50 bg-muted/10 p-5", children: [
|
|
2215
2547
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
2216
|
-
/* @__PURE__ */ e(
|
|
2548
|
+
/* @__PURE__ */ e(Dt, { className: "size-4 text-primary" }),
|
|
2217
2549
|
/* @__PURE__ */ r("div", { children: [
|
|
2218
2550
|
/* @__PURE__ */ e("h3", { className: "text-sm font-bold text-foreground/80", children: t("app_settings.general.appearance") }),
|
|
2219
2551
|
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: t("app_settings.general.appearance_help") })
|
|
@@ -2221,99 +2553,99 @@ function Lt() {
|
|
|
2221
2553
|
] }),
|
|
2222
2554
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
|
|
2223
2555
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2224
|
-
/* @__PURE__ */ e(
|
|
2556
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.default_theme") }),
|
|
2225
2557
|
/* @__PURE__ */ r(
|
|
2226
|
-
|
|
2558
|
+
oe,
|
|
2227
2559
|
{
|
|
2228
|
-
value:
|
|
2229
|
-
onValueChange: (
|
|
2560
|
+
value: s.default_theme || "system",
|
|
2561
|
+
onValueChange: (l) => u({ ...s, default_theme: l }),
|
|
2230
2562
|
children: [
|
|
2231
|
-
/* @__PURE__ */ e(
|
|
2232
|
-
/* @__PURE__ */ r(
|
|
2233
|
-
/* @__PURE__ */ e(
|
|
2234
|
-
/* @__PURE__ */ e(
|
|
2235
|
-
/* @__PURE__ */ e(
|
|
2563
|
+
/* @__PURE__ */ e(le, { className: "bg-muted/20 border-transparent focus:bg-background h-11 w-full", children: /* @__PURE__ */ e(de, {}) }),
|
|
2564
|
+
/* @__PURE__ */ r(ce, { children: [
|
|
2565
|
+
/* @__PURE__ */ e(Z, { value: "system", children: t("settings:general.themes.system") }),
|
|
2566
|
+
/* @__PURE__ */ e(Z, { value: "light", children: t("settings:general.themes.light") }),
|
|
2567
|
+
/* @__PURE__ */ e(Z, { value: "dark", children: t("settings:general.themes.dark") })
|
|
2236
2568
|
] })
|
|
2237
2569
|
]
|
|
2238
2570
|
}
|
|
2239
2571
|
)
|
|
2240
2572
|
] }),
|
|
2241
2573
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2242
|
-
/* @__PURE__ */ e(
|
|
2574
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.general.default_accent") }),
|
|
2243
2575
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
|
|
2244
2576
|
/* @__PURE__ */ e(
|
|
2245
2577
|
"div",
|
|
2246
2578
|
{
|
|
2247
2579
|
className: "size-10 shrink-0 rounded-xl border border-border shadow-sm",
|
|
2248
|
-
style: { backgroundColor:
|
|
2580
|
+
style: { backgroundColor: C && O ? O : "transparent" },
|
|
2249
2581
|
"aria-label": t("app_settings.general.default_accent_preview")
|
|
2250
2582
|
}
|
|
2251
2583
|
),
|
|
2252
2584
|
/* @__PURE__ */ e(
|
|
2253
|
-
|
|
2585
|
+
fe,
|
|
2254
2586
|
{
|
|
2255
2587
|
type: "text",
|
|
2256
|
-
value:
|
|
2257
|
-
onChange: (
|
|
2588
|
+
value: s.default_accent || "",
|
|
2589
|
+
onChange: (l) => u({ ...s, default_accent: l.target.value }),
|
|
2258
2590
|
className: "bg-muted/20 border-transparent focus:bg-background h-11 font-mono",
|
|
2259
2591
|
placeholder: "oklch(0.623 0.214 259.815)",
|
|
2260
2592
|
dir: "ltr",
|
|
2261
|
-
"aria-invalid": !
|
|
2593
|
+
"aria-invalid": !C
|
|
2262
2594
|
}
|
|
2263
2595
|
)
|
|
2264
2596
|
] }),
|
|
2265
|
-
/* @__PURE__ */ e("p", { className: `text-[10px] ${
|
|
2597
|
+
/* @__PURE__ */ e("p", { className: `text-[10px] ${C ? "text-muted-foreground/60" : "text-destructive"}`, children: t(C ? "app_settings.general.default_accent_help" : "app_settings.general.default_accent_invalid") })
|
|
2266
2598
|
] })
|
|
2267
2599
|
] })
|
|
2268
2600
|
] })
|
|
2269
2601
|
] })
|
|
2270
2602
|
] }),
|
|
2271
2603
|
/* @__PURE__ */ r("section", { children: [
|
|
2272
|
-
/* @__PURE__ */ e(
|
|
2604
|
+
/* @__PURE__ */ e(v, { title: t("app_settings.sections.chat"), icon: $t }),
|
|
2273
2605
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
2274
2606
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
2275
2607
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2276
|
-
/* @__PURE__ */ e(
|
|
2608
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.chat.welcome_greeting") }),
|
|
2277
2609
|
/* @__PURE__ */ e(
|
|
2278
|
-
|
|
2610
|
+
fe,
|
|
2279
2611
|
{
|
|
2280
2612
|
type: "text",
|
|
2281
|
-
value:
|
|
2282
|
-
onChange: (
|
|
2613
|
+
value: s.welcome_greeting || "",
|
|
2614
|
+
onChange: (l) => u({ ...s, welcome_greeting: l.target.value }),
|
|
2283
2615
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2284
2616
|
placeholder: "e.g. chat:welcome",
|
|
2285
2617
|
dir: "auto"
|
|
2286
2618
|
}
|
|
2287
2619
|
),
|
|
2288
|
-
/* @__PURE__ */ e(
|
|
2620
|
+
/* @__PURE__ */ e(L, { value: s.welcome_greeting || "" })
|
|
2289
2621
|
] }),
|
|
2290
2622
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2291
|
-
/* @__PURE__ */ e(
|
|
2623
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.chat.welcome_subtitle") }),
|
|
2292
2624
|
/* @__PURE__ */ e(
|
|
2293
|
-
|
|
2625
|
+
fe,
|
|
2294
2626
|
{
|
|
2295
2627
|
type: "text",
|
|
2296
|
-
value:
|
|
2297
|
-
onChange: (
|
|
2628
|
+
value: s.welcome_subtitle || "",
|
|
2629
|
+
onChange: (l) => u({ ...s, welcome_subtitle: l.target.value }),
|
|
2298
2630
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2299
2631
|
dir: "auto"
|
|
2300
2632
|
}
|
|
2301
2633
|
),
|
|
2302
|
-
/* @__PURE__ */ e(
|
|
2634
|
+
/* @__PURE__ */ e(L, { value: s.welcome_subtitle || "" })
|
|
2303
2635
|
] })
|
|
2304
2636
|
] }),
|
|
2305
2637
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2306
|
-
/* @__PURE__ */ e(
|
|
2638
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.chat.disclaimer") }),
|
|
2307
2639
|
/* @__PURE__ */ e(
|
|
2308
|
-
|
|
2640
|
+
Fe,
|
|
2309
2641
|
{
|
|
2310
|
-
value:
|
|
2311
|
-
onChange: (
|
|
2642
|
+
value: s.disclaimer || "",
|
|
2643
|
+
onChange: (l) => u({ ...s, disclaimer: l.target.value }),
|
|
2312
2644
|
className: "bg-muted/20 border-transparent focus:bg-background min-h-[120px] py-4 resize-none leading-relaxed",
|
|
2313
2645
|
dir: "auto"
|
|
2314
2646
|
}
|
|
2315
2647
|
),
|
|
2316
|
-
/* @__PURE__ */ e(
|
|
2648
|
+
/* @__PURE__ */ e(L, { value: s.disclaimer || "" })
|
|
2317
2649
|
] }),
|
|
2318
2650
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-6 pt-2", children: [
|
|
2319
2651
|
/* @__PURE__ */ r("div", { className: "p-5 border border-border/40 rounded-2xl flex items-center justify-between hover:bg-muted/5 transition-colors", children: [
|
|
@@ -2322,10 +2654,10 @@ function Lt() {
|
|
|
2322
2654
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.show_tool_details_help") })
|
|
2323
2655
|
] }),
|
|
2324
2656
|
/* @__PURE__ */ e(
|
|
2325
|
-
|
|
2657
|
+
re,
|
|
2326
2658
|
{
|
|
2327
|
-
checked:
|
|
2328
|
-
onCheckedChange: (
|
|
2659
|
+
checked: s.show_tool_details,
|
|
2660
|
+
onCheckedChange: (l) => u({ ...s, show_tool_details: l })
|
|
2329
2661
|
}
|
|
2330
2662
|
)
|
|
2331
2663
|
] }),
|
|
@@ -2335,10 +2667,10 @@ function Lt() {
|
|
|
2335
2667
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.show_settings_help") })
|
|
2336
2668
|
] }),
|
|
2337
2669
|
/* @__PURE__ */ e(
|
|
2338
|
-
|
|
2670
|
+
re,
|
|
2339
2671
|
{
|
|
2340
|
-
checked:
|
|
2341
|
-
onCheckedChange: (
|
|
2672
|
+
checked: s.show_settings,
|
|
2673
|
+
onCheckedChange: (l) => u({ ...s, show_settings: l })
|
|
2342
2674
|
}
|
|
2343
2675
|
)
|
|
2344
2676
|
] }),
|
|
@@ -2348,10 +2680,10 @@ function Lt() {
|
|
|
2348
2680
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.show_version_in_settings_help") })
|
|
2349
2681
|
] }),
|
|
2350
2682
|
/* @__PURE__ */ e(
|
|
2351
|
-
|
|
2683
|
+
re,
|
|
2352
2684
|
{
|
|
2353
|
-
checked:
|
|
2354
|
-
onCheckedChange: (
|
|
2685
|
+
checked: s.show_version_in_settings,
|
|
2686
|
+
onCheckedChange: (l) => u({ ...s, show_version_in_settings: l })
|
|
2355
2687
|
}
|
|
2356
2688
|
)
|
|
2357
2689
|
] }),
|
|
@@ -2361,10 +2693,10 @@ function Lt() {
|
|
|
2361
2693
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.disable_signup_help") })
|
|
2362
2694
|
] }),
|
|
2363
2695
|
/* @__PURE__ */ e(
|
|
2364
|
-
|
|
2696
|
+
re,
|
|
2365
2697
|
{
|
|
2366
|
-
checked:
|
|
2367
|
-
onCheckedChange: (
|
|
2698
|
+
checked: s.disable_signup,
|
|
2699
|
+
onCheckedChange: (l) => u({ ...s, disable_signup: l })
|
|
2368
2700
|
}
|
|
2369
2701
|
)
|
|
2370
2702
|
] }),
|
|
@@ -2374,10 +2706,10 @@ function Lt() {
|
|
|
2374
2706
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.disable_auth_page_help") })
|
|
2375
2707
|
] }),
|
|
2376
2708
|
/* @__PURE__ */ e(
|
|
2377
|
-
|
|
2709
|
+
re,
|
|
2378
2710
|
{
|
|
2379
|
-
checked:
|
|
2380
|
-
onCheckedChange: (
|
|
2711
|
+
checked: s.disable_auth_page,
|
|
2712
|
+
onCheckedChange: (l) => u({ ...s, disable_auth_page: l })
|
|
2381
2713
|
}
|
|
2382
2714
|
)
|
|
2383
2715
|
] }),
|
|
@@ -2387,10 +2719,10 @@ function Lt() {
|
|
|
2387
2719
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.composer_attachments_help") })
|
|
2388
2720
|
] }),
|
|
2389
2721
|
/* @__PURE__ */ e(
|
|
2390
|
-
|
|
2722
|
+
re,
|
|
2391
2723
|
{
|
|
2392
|
-
checked:
|
|
2393
|
-
onCheckedChange: (
|
|
2724
|
+
checked: s.composer_attachments,
|
|
2725
|
+
onCheckedChange: (l) => u({ ...s, composer_attachments: l })
|
|
2394
2726
|
}
|
|
2395
2727
|
)
|
|
2396
2728
|
] }),
|
|
@@ -2400,10 +2732,10 @@ function Lt() {
|
|
|
2400
2732
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.thread_actions_feedback_help") })
|
|
2401
2733
|
] }),
|
|
2402
2734
|
/* @__PURE__ */ e(
|
|
2403
|
-
|
|
2735
|
+
re,
|
|
2404
2736
|
{
|
|
2405
|
-
checked:
|
|
2406
|
-
onCheckedChange: (
|
|
2737
|
+
checked: s.thread_actions_feedback,
|
|
2738
|
+
onCheckedChange: (l) => u({ ...s, thread_actions_feedback: l })
|
|
2407
2739
|
}
|
|
2408
2740
|
)
|
|
2409
2741
|
] }),
|
|
@@ -2413,10 +2745,10 @@ function Lt() {
|
|
|
2413
2745
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.thread_actions_retry_help") })
|
|
2414
2746
|
] }),
|
|
2415
2747
|
/* @__PURE__ */ e(
|
|
2416
|
-
|
|
2748
|
+
re,
|
|
2417
2749
|
{
|
|
2418
|
-
checked:
|
|
2419
|
-
onCheckedChange: (
|
|
2750
|
+
checked: s.thread_actions_retry,
|
|
2751
|
+
onCheckedChange: (l) => u({ ...s, thread_actions_retry: l })
|
|
2420
2752
|
}
|
|
2421
2753
|
)
|
|
2422
2754
|
] }),
|
|
@@ -2426,51 +2758,51 @@ function Lt() {
|
|
|
2426
2758
|
/* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.history_enabled_help") })
|
|
2427
2759
|
] }),
|
|
2428
2760
|
/* @__PURE__ */ e(
|
|
2429
|
-
|
|
2761
|
+
re,
|
|
2430
2762
|
{
|
|
2431
|
-
checked:
|
|
2432
|
-
onCheckedChange: (
|
|
2763
|
+
checked: s.history_enabled,
|
|
2764
|
+
onCheckedChange: (l) => u({ ...s, history_enabled: l })
|
|
2433
2765
|
}
|
|
2434
2766
|
)
|
|
2435
2767
|
] }),
|
|
2436
|
-
|
|
2768
|
+
s.history_enabled && /* @__PURE__ */ r("div", { className: "sm:col-span-2 grid grid-cols-1 sm:grid-cols-2 gap-4 p-6 bg-muted/10 rounded-2xl border border-border/40 animate-in fade-in slide-in-from-top-2 duration-300", children: [
|
|
2437
2769
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
2438
|
-
/* @__PURE__ */ e(
|
|
2770
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_delete") }),
|
|
2439
2771
|
/* @__PURE__ */ e(
|
|
2440
|
-
|
|
2772
|
+
re,
|
|
2441
2773
|
{
|
|
2442
|
-
checked:
|
|
2443
|
-
onCheckedChange: (
|
|
2774
|
+
checked: s.history_show_delete,
|
|
2775
|
+
onCheckedChange: (l) => u({ ...s, history_show_delete: l })
|
|
2444
2776
|
}
|
|
2445
2777
|
)
|
|
2446
2778
|
] }),
|
|
2447
2779
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
2448
|
-
/* @__PURE__ */ e(
|
|
2780
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_rename") }),
|
|
2449
2781
|
/* @__PURE__ */ e(
|
|
2450
|
-
|
|
2782
|
+
re,
|
|
2451
2783
|
{
|
|
2452
|
-
checked:
|
|
2453
|
-
onCheckedChange: (
|
|
2784
|
+
checked: s.history_show_rename,
|
|
2785
|
+
onCheckedChange: (l) => u({ ...s, history_show_rename: l })
|
|
2454
2786
|
}
|
|
2455
2787
|
)
|
|
2456
2788
|
] }),
|
|
2457
2789
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
2458
|
-
/* @__PURE__ */ e(
|
|
2790
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_share") }),
|
|
2459
2791
|
/* @__PURE__ */ e(
|
|
2460
|
-
|
|
2792
|
+
re,
|
|
2461
2793
|
{
|
|
2462
|
-
checked:
|
|
2463
|
-
onCheckedChange: (
|
|
2794
|
+
checked: s.history_show_share,
|
|
2795
|
+
onCheckedChange: (l) => u({ ...s, history_show_share: l })
|
|
2464
2796
|
}
|
|
2465
2797
|
)
|
|
2466
2798
|
] }),
|
|
2467
2799
|
/* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
|
|
2468
|
-
/* @__PURE__ */ e(
|
|
2800
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_pin") }),
|
|
2469
2801
|
/* @__PURE__ */ e(
|
|
2470
|
-
|
|
2802
|
+
re,
|
|
2471
2803
|
{
|
|
2472
|
-
checked:
|
|
2473
|
-
onCheckedChange: (
|
|
2804
|
+
checked: s.history_show_pin,
|
|
2805
|
+
onCheckedChange: (l) => u({ ...s, history_show_pin: l })
|
|
2474
2806
|
}
|
|
2475
2807
|
)
|
|
2476
2808
|
] })
|
|
@@ -2485,25 +2817,25 @@ function Lt() {
|
|
|
2485
2817
|
{ id: "settings_general_mode", label: "app_settings.chat.general_tab" },
|
|
2486
2818
|
{ id: "settings_profile_mode", label: "app_settings.chat.profile_tab" },
|
|
2487
2819
|
{ id: "settings_account_mode", label: "app_settings.chat.account_tab" }
|
|
2488
|
-
].map((
|
|
2489
|
-
/* @__PURE__ */ e(
|
|
2820
|
+
].map((l) => /* @__PURE__ */ r("div", { className: "p-4 border border-border/40 rounded-2xl space-y-3 bg-muted/5", children: [
|
|
2821
|
+
/* @__PURE__ */ e(X, { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground/70", children: t(l.label) }),
|
|
2490
2822
|
/* @__PURE__ */ r(
|
|
2491
|
-
|
|
2823
|
+
oe,
|
|
2492
2824
|
{
|
|
2493
|
-
value: l
|
|
2494
|
-
onValueChange: (
|
|
2495
|
-
dir:
|
|
2825
|
+
value: s[l.id],
|
|
2826
|
+
onValueChange: (T) => u({ ...s, [l.id]: T }),
|
|
2827
|
+
dir: j ? "rtl" : "ltr",
|
|
2496
2828
|
children: [
|
|
2497
|
-
/* @__PURE__ */ e(
|
|
2498
|
-
/* @__PURE__ */ r(
|
|
2499
|
-
/* @__PURE__ */ e(
|
|
2500
|
-
/* @__PURE__ */ e(
|
|
2501
|
-
/* @__PURE__ */ e(
|
|
2829
|
+
/* @__PURE__ */ e(le, { className: "bg-background border-transparent h-9 text-xs", children: /* @__PURE__ */ e(de, {}) }),
|
|
2830
|
+
/* @__PURE__ */ r(ce, { children: [
|
|
2831
|
+
/* @__PURE__ */ e(Z, { value: "editable", children: t("app_settings.chat.mode_editable") }),
|
|
2832
|
+
/* @__PURE__ */ e(Z, { value: "faded", children: t("app_settings.chat.mode_faded") }),
|
|
2833
|
+
/* @__PURE__ */ e(Z, { value: "hidden", children: t("app_settings.chat.mode_hidden") })
|
|
2502
2834
|
] })
|
|
2503
2835
|
]
|
|
2504
2836
|
}
|
|
2505
2837
|
)
|
|
2506
|
-
] },
|
|
2838
|
+
] }, l.id)) })
|
|
2507
2839
|
] }),
|
|
2508
2840
|
/* @__PURE__ */ r("div", { className: "pt-10 space-y-8", children: [
|
|
2509
2841
|
/* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
|
|
@@ -2521,28 +2853,28 @@ function Lt() {
|
|
|
2521
2853
|
{ id: "accent", label: t("settings:general.accent") },
|
|
2522
2854
|
{ id: "radius", label: t("settings:general.radius") },
|
|
2523
2855
|
{ id: "language", label: t("settings:general.language") }
|
|
2524
|
-
].map((
|
|
2525
|
-
/* @__PURE__ */ e(
|
|
2856
|
+
].map((l) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
|
|
2857
|
+
/* @__PURE__ */ e(X, { className: "text-[10px] font-medium text-muted-foreground/70", children: l.label }),
|
|
2526
2858
|
/* @__PURE__ */ r(
|
|
2527
|
-
|
|
2859
|
+
oe,
|
|
2528
2860
|
{
|
|
2529
|
-
value:
|
|
2530
|
-
onValueChange: (
|
|
2531
|
-
...
|
|
2532
|
-
settings_general_fields: { ...
|
|
2861
|
+
value: s.settings_general_fields?.[l.id] || "editable",
|
|
2862
|
+
onValueChange: (T) => u((J) => ({
|
|
2863
|
+
...J,
|
|
2864
|
+
settings_general_fields: { ...J.settings_general_fields, [l.id]: T }
|
|
2533
2865
|
})),
|
|
2534
|
-
dir:
|
|
2866
|
+
dir: j ? "rtl" : "ltr",
|
|
2535
2867
|
children: [
|
|
2536
|
-
/* @__PURE__ */ e(
|
|
2537
|
-
/* @__PURE__ */ r(
|
|
2538
|
-
/* @__PURE__ */ e(
|
|
2539
|
-
/* @__PURE__ */ e(
|
|
2540
|
-
/* @__PURE__ */ e(
|
|
2868
|
+
/* @__PURE__ */ e(le, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(de, {}) }),
|
|
2869
|
+
/* @__PURE__ */ r(ce, { children: [
|
|
2870
|
+
/* @__PURE__ */ e(Z, { value: "editable", className: "text-[10px]", children: t("app_settings.chat.mode_editable") }),
|
|
2871
|
+
/* @__PURE__ */ e(Z, { value: "faded", className: "text-[10px]", children: t("app_settings.chat.mode_faded") }),
|
|
2872
|
+
/* @__PURE__ */ e(Z, { value: "hidden", className: "text-[10px]", children: t("app_settings.chat.mode_hidden") })
|
|
2541
2873
|
] })
|
|
2542
2874
|
]
|
|
2543
2875
|
}
|
|
2544
2876
|
)
|
|
2545
|
-
] },
|
|
2877
|
+
] }, l.id)) })
|
|
2546
2878
|
] }),
|
|
2547
2879
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
2548
2880
|
/* @__PURE__ */ r("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
|
|
@@ -2554,29 +2886,29 @@ function Lt() {
|
|
|
2554
2886
|
{ id: "surname", label: t("settings:profile.surname") },
|
|
2555
2887
|
{ id: "phone", label: t("settings:profile.phone") },
|
|
2556
2888
|
{ id: "password", label: t("settings:profile.password") },
|
|
2557
|
-
...(
|
|
2558
|
-
].map((
|
|
2559
|
-
/* @__PURE__ */ e(
|
|
2889
|
+
...(o?.userMetadataFields || []).map((l) => ({ id: l.key, label: t(l.label) }))
|
|
2890
|
+
].map((l) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
|
|
2891
|
+
/* @__PURE__ */ e(X, { className: "text-[10px] font-medium text-muted-foreground/70", children: l.label }),
|
|
2560
2892
|
/* @__PURE__ */ r(
|
|
2561
|
-
|
|
2893
|
+
oe,
|
|
2562
2894
|
{
|
|
2563
|
-
value:
|
|
2564
|
-
onValueChange: (
|
|
2565
|
-
...
|
|
2566
|
-
settings_profile_fields: { ...
|
|
2895
|
+
value: s.settings_profile_fields?.[l.id] || "editable",
|
|
2896
|
+
onValueChange: (T) => u((J) => ({
|
|
2897
|
+
...J,
|
|
2898
|
+
settings_profile_fields: { ...J.settings_profile_fields, [l.id]: T }
|
|
2567
2899
|
})),
|
|
2568
|
-
dir:
|
|
2900
|
+
dir: j ? "rtl" : "ltr",
|
|
2569
2901
|
children: [
|
|
2570
|
-
/* @__PURE__ */ e(
|
|
2571
|
-
/* @__PURE__ */ r(
|
|
2572
|
-
/* @__PURE__ */ e(
|
|
2573
|
-
/* @__PURE__ */ e(
|
|
2574
|
-
/* @__PURE__ */ e(
|
|
2902
|
+
/* @__PURE__ */ e(le, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(de, {}) }),
|
|
2903
|
+
/* @__PURE__ */ r(ce, { children: [
|
|
2904
|
+
/* @__PURE__ */ e(Z, { value: "editable", className: "text-[10px]", children: t("app_settings.chat.mode_editable") }),
|
|
2905
|
+
/* @__PURE__ */ e(Z, { value: "faded", className: "text-[10px]", children: t("app_settings.chat.mode_faded") }),
|
|
2906
|
+
/* @__PURE__ */ e(Z, { value: "hidden", className: "text-[10px]", children: t("app_settings.chat.mode_hidden") })
|
|
2575
2907
|
] })
|
|
2576
2908
|
]
|
|
2577
2909
|
}
|
|
2578
2910
|
)
|
|
2579
|
-
] },
|
|
2911
|
+
] }, l.id)) })
|
|
2580
2912
|
] }),
|
|
2581
2913
|
/* @__PURE__ */ r("div", { className: "space-y-4", children: [
|
|
2582
2914
|
/* @__PURE__ */ r("h4", { className: "text-xs font-bold uppercase tracking-wider text-muted-foreground/50 flex items-center gap-2", children: [
|
|
@@ -2586,58 +2918,58 @@ function Lt() {
|
|
|
2586
2918
|
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
2587
2919
|
{ id: "balance", label: t("settings:account.balance") },
|
|
2588
2920
|
{ id: "logout", label: t("settings:account.logout") }
|
|
2589
|
-
].map((
|
|
2590
|
-
/* @__PURE__ */ e(
|
|
2921
|
+
].map((l) => /* @__PURE__ */ r("div", { className: "p-3 border border-border/40 rounded-xl space-y-2 bg-muted/5", children: [
|
|
2922
|
+
/* @__PURE__ */ e(X, { className: "text-[10px] font-medium text-muted-foreground/70", children: l.label }),
|
|
2591
2923
|
/* @__PURE__ */ r(
|
|
2592
|
-
|
|
2924
|
+
oe,
|
|
2593
2925
|
{
|
|
2594
|
-
value:
|
|
2595
|
-
onValueChange: (
|
|
2596
|
-
...
|
|
2597
|
-
settings_account_fields: { ...
|
|
2926
|
+
value: s.settings_account_fields?.[l.id] || "editable",
|
|
2927
|
+
onValueChange: (T) => u((J) => ({
|
|
2928
|
+
...J,
|
|
2929
|
+
settings_account_fields: { ...J.settings_account_fields, [l.id]: T }
|
|
2598
2930
|
})),
|
|
2599
|
-
dir:
|
|
2931
|
+
dir: j ? "rtl" : "ltr",
|
|
2600
2932
|
children: [
|
|
2601
|
-
/* @__PURE__ */ e(
|
|
2602
|
-
/* @__PURE__ */ r(
|
|
2603
|
-
/* @__PURE__ */ e(
|
|
2604
|
-
/* @__PURE__ */ e(
|
|
2605
|
-
/* @__PURE__ */ e(
|
|
2933
|
+
/* @__PURE__ */ e(le, { className: "bg-background border-transparent h-8 text-[10px]", children: /* @__PURE__ */ e(de, {}) }),
|
|
2934
|
+
/* @__PURE__ */ r(ce, { children: [
|
|
2935
|
+
/* @__PURE__ */ e(Z, { value: "editable", className: "text-[10px]", children: t("app_settings.chat.mode_editable") }),
|
|
2936
|
+
/* @__PURE__ */ e(Z, { value: "faded", className: "text-[10px]", children: t("app_settings.chat.mode_faded") }),
|
|
2937
|
+
/* @__PURE__ */ e(Z, { value: "hidden", className: "text-[10px]", children: t("app_settings.chat.mode_hidden") })
|
|
2606
2938
|
] })
|
|
2607
2939
|
]
|
|
2608
2940
|
}
|
|
2609
2941
|
)
|
|
2610
|
-
] },
|
|
2942
|
+
] }, l.id)) })
|
|
2611
2943
|
] })
|
|
2612
2944
|
] })
|
|
2613
2945
|
] })
|
|
2614
2946
|
] })
|
|
2615
2947
|
] }),
|
|
2616
2948
|
/* @__PURE__ */ r("section", { children: [
|
|
2617
|
-
/* @__PURE__ */ e(
|
|
2949
|
+
/* @__PURE__ */ e(v, { title: t("app_settings.sections.user_billing"), icon: Et }),
|
|
2618
2950
|
/* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
|
|
2619
2951
|
/* @__PURE__ */ r("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-10", children: [
|
|
2620
2952
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2621
|
-
/* @__PURE__ */ e(
|
|
2953
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.user_billing.initial_balance_tokens") }),
|
|
2622
2954
|
/* @__PURE__ */ e(
|
|
2623
|
-
|
|
2955
|
+
fe,
|
|
2624
2956
|
{
|
|
2625
2957
|
type: "number",
|
|
2626
|
-
value:
|
|
2627
|
-
onChange: (
|
|
2958
|
+
value: s.initial_balance_tokens ?? "",
|
|
2959
|
+
onChange: (l) => u({ ...s, initial_balance_tokens: parseInt(l.target.value) || 0 }),
|
|
2628
2960
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2629
2961
|
placeholder: "250000"
|
|
2630
2962
|
}
|
|
2631
2963
|
)
|
|
2632
2964
|
] }),
|
|
2633
2965
|
/* @__PURE__ */ r("div", { className: "space-y-2", children: [
|
|
2634
|
-
/* @__PURE__ */ e(
|
|
2966
|
+
/* @__PURE__ */ e(X, { className: "text-xs font-bold uppercase tracking-widest text-muted-foreground/60 ml-1", children: t("app_settings.user_billing.initial_balance_requests") }),
|
|
2635
2967
|
/* @__PURE__ */ e(
|
|
2636
|
-
|
|
2968
|
+
fe,
|
|
2637
2969
|
{
|
|
2638
2970
|
type: "number",
|
|
2639
|
-
value:
|
|
2640
|
-
onChange: (
|
|
2971
|
+
value: s.initial_balance_requests ?? "",
|
|
2972
|
+
onChange: (l) => u({ ...s, initial_balance_requests: parseInt(l.target.value) || 0 }),
|
|
2641
2973
|
className: "bg-muted/20 border-transparent focus:bg-background h-11",
|
|
2642
2974
|
placeholder: "100"
|
|
2643
2975
|
}
|
|
@@ -2648,36 +2980,36 @@ function Lt() {
|
|
|
2648
2980
|
] })
|
|
2649
2981
|
] }),
|
|
2650
2982
|
/* @__PURE__ */ r("section", { children: [
|
|
2651
|
-
/* @__PURE__ */ e(
|
|
2983
|
+
/* @__PURE__ */ e(v, { title: t("app_settings.translations_management"), icon: Ut }),
|
|
2652
2984
|
/* @__PURE__ */ r("div", { className: "border border-border/60 rounded-2xl overflow-hidden bg-background", children: [
|
|
2653
2985
|
/* @__PURE__ */ r("div", { className: "p-6 border-b border-border/50 bg-muted/5 flex flex-col sm:flex-row items-center gap-4", children: [
|
|
2654
2986
|
/* @__PURE__ */ r("div", { className: "flex-1 flex items-center gap-4 p-1.5 bg-background border border-border/60 rounded-xl w-full", children: [
|
|
2655
|
-
/* @__PURE__ */ e("div", { className: "p-2 px-3 bg-muted/20 rounded-lg border border-border/40 ml-1", children: /* @__PURE__ */ e(
|
|
2656
|
-
/* @__PURE__ */ r(
|
|
2657
|
-
/* @__PURE__ */ e(
|
|
2658
|
-
/* @__PURE__ */ e(
|
|
2987
|
+
/* @__PURE__ */ e("div", { className: "p-2 px-3 bg-muted/20 rounded-lg border border-border/40 ml-1", children: /* @__PURE__ */ e(je, { className: "size-4 text-muted-foreground" }) }),
|
|
2988
|
+
/* @__PURE__ */ r(oe, { value: D, onValueChange: K, children: [
|
|
2989
|
+
/* @__PURE__ */ e(le, { size: "sm", className: "border-none shadow-none bg-transparent h-8 font-black uppercase tracking-wider", children: /* @__PURE__ */ e(de, {}) }),
|
|
2990
|
+
/* @__PURE__ */ e(ce, { children: Object.keys(s.translations || {}).sort().map((l) => /* @__PURE__ */ e(Z, { value: l, children: l.toUpperCase() }, l)) })
|
|
2659
2991
|
] }),
|
|
2660
2992
|
/* @__PURE__ */ e("div", { className: "w-px h-6 bg-border/60" }),
|
|
2661
|
-
/* @__PURE__ */ r(
|
|
2662
|
-
/* @__PURE__ */ e(
|
|
2663
|
-
/* @__PURE__ */ e(
|
|
2993
|
+
/* @__PURE__ */ r(oe, { value: W, onValueChange: P, children: [
|
|
2994
|
+
/* @__PURE__ */ e(le, { size: "sm", className: "border-none shadow-none bg-transparent h-8 flex-1 font-bold", children: /* @__PURE__ */ e(de, {}) }),
|
|
2995
|
+
/* @__PURE__ */ e(ce, { children: Object.keys(s.translations?.[D] || {}).sort().map((l) => /* @__PURE__ */ e(Z, { value: l, children: l }, l)) })
|
|
2664
2996
|
] })
|
|
2665
2997
|
] }),
|
|
2666
2998
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
2667
|
-
/* @__PURE__ */ e("button", { type: "button", onClick:
|
|
2668
|
-
/* @__PURE__ */ e("button", { type: "button", onClick:
|
|
2999
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: G, title: "Add Language", className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40", children: /* @__PURE__ */ e(Ot, { className: "size-4" }) }),
|
|
3000
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: pe, title: "Add Namespace", className: "p-2.5 hover:bg-muted/30 rounded-xl transition-all border border-border/40", children: /* @__PURE__ */ e(je, { className: "size-4" }) })
|
|
2669
3001
|
] })
|
|
2670
3002
|
] }),
|
|
2671
3003
|
/* @__PURE__ */ r("div", { className: "relative p-6", children: [
|
|
2672
3004
|
/* @__PURE__ */ r("div", { className: "absolute top-8 right-10 flex items-center gap-2", children: [
|
|
2673
3005
|
/* @__PURE__ */ e("span", { className: "text-[10px] font-bold text-muted-foreground/40 uppercase tracking-widest", children: "JSON EDITOR" }),
|
|
2674
|
-
/* @__PURE__ */ e(
|
|
3006
|
+
/* @__PURE__ */ e(Ft, { className: "size-3 text-muted-foreground/30" })
|
|
2675
3007
|
] }),
|
|
2676
3008
|
/* @__PURE__ */ e(
|
|
2677
|
-
|
|
3009
|
+
Fe,
|
|
2678
3010
|
{
|
|
2679
|
-
value:
|
|
2680
|
-
onChange: (
|
|
3011
|
+
value: ae,
|
|
3012
|
+
onChange: (l) => m(l.target.value),
|
|
2681
3013
|
dir: "ltr",
|
|
2682
3014
|
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 ${h ? "border-destructive/40 focus:ring-destructive/20" : "border-border/40 focus:ring-primary/20"}`,
|
|
2683
3015
|
spellCheck: !1
|
|
@@ -2698,229 +3030,229 @@ function Lt() {
|
|
|
2698
3030
|
] }) })
|
|
2699
3031
|
] });
|
|
2700
3032
|
}
|
|
2701
|
-
function
|
|
2702
|
-
const { t, i18n:
|
|
2703
|
-
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col items-center justify-center p-6 text-center gap-4 animate-in fade-in duration-500", dir:
|
|
2704
|
-
/* @__PURE__ */ e("div", { className: "bg-destructive/10 p-4 rounded-2xl border border-destructive/20 relative", children: /* @__PURE__ */ e(
|
|
3033
|
+
function _e() {
|
|
3034
|
+
const { t, i18n: i } = me(["admin"]), o = i.language === "fa";
|
|
3035
|
+
return /* @__PURE__ */ r("div", { className: "h-full flex flex-col items-center justify-center p-6 text-center gap-4 animate-in fade-in duration-500", dir: o ? "rtl" : "ltr", children: [
|
|
3036
|
+
/* @__PURE__ */ e("div", { className: "bg-destructive/10 p-4 rounded-2xl border border-destructive/20 relative", children: /* @__PURE__ */ e(Rt, { className: "size-10 text-destructive/70" }) }),
|
|
2705
3037
|
/* @__PURE__ */ r("div", { className: "space-y-1 max-w-sm", children: [
|
|
2706
3038
|
/* @__PURE__ */ e("h3", { className: "text-lg font-bold text-foreground tracking-tight", children: t("errors.access_denied_title", "Access Denied") }),
|
|
2707
3039
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground leading-relaxed", children: t("errors.access_denied_message", "You don't have permission to access this page.") })
|
|
2708
3040
|
] })
|
|
2709
3041
|
] });
|
|
2710
3042
|
}
|
|
2711
|
-
const
|
|
2712
|
-
const { t:
|
|
2713
|
-
|
|
2714
|
-
},
|
|
2715
|
-
switch (
|
|
3043
|
+
const Yt = ({ className: t }) => {
|
|
3044
|
+
const { t: i } = me(["theme"]), { theme: o, setTheme: d } = De(), g = () => {
|
|
3045
|
+
d(o === "system" ? "light" : o === "light" ? "dark" : "system");
|
|
3046
|
+
}, c = () => {
|
|
3047
|
+
switch (o) {
|
|
2716
3048
|
case "light":
|
|
2717
|
-
return /* @__PURE__ */ e(
|
|
3049
|
+
return /* @__PURE__ */ e(zt, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
2718
3050
|
case "dark":
|
|
2719
|
-
return /* @__PURE__ */ e(
|
|
3051
|
+
return /* @__PURE__ */ e(Pt, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
2720
3052
|
case "system":
|
|
2721
|
-
return /* @__PURE__ */ e(
|
|
3053
|
+
return /* @__PURE__ */ e(ze, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
2722
3054
|
default:
|
|
2723
|
-
return /* @__PURE__ */ e(
|
|
3055
|
+
return /* @__PURE__ */ e(ze, { className: "h-[1.2rem] w-[1.2rem]" });
|
|
2724
3056
|
}
|
|
2725
|
-
},
|
|
2726
|
-
switch (
|
|
3057
|
+
}, x = () => {
|
|
3058
|
+
switch (o) {
|
|
2727
3059
|
case "light":
|
|
2728
|
-
return
|
|
3060
|
+
return i("dark");
|
|
2729
3061
|
case "dark":
|
|
2730
|
-
return
|
|
3062
|
+
return i("system");
|
|
2731
3063
|
case "system":
|
|
2732
|
-
return
|
|
3064
|
+
return i("light");
|
|
2733
3065
|
default:
|
|
2734
|
-
return
|
|
3066
|
+
return i("toggle");
|
|
2735
3067
|
}
|
|
2736
3068
|
};
|
|
2737
|
-
return /* @__PURE__ */ r(
|
|
2738
|
-
/* @__PURE__ */ e(
|
|
2739
|
-
|
|
2740
|
-
/* @__PURE__ */ e("span", { className: "sr-only", children:
|
|
3069
|
+
return /* @__PURE__ */ r(Ae, { children: [
|
|
3070
|
+
/* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ r(Se, { variant: "ghost", size: "icon", onClick: g, className: t, children: [
|
|
3071
|
+
c(),
|
|
3072
|
+
/* @__PURE__ */ e("span", { className: "sr-only", children: i("toggle") })
|
|
2741
3073
|
] }) }),
|
|
2742
|
-
/* @__PURE__ */ e(
|
|
3074
|
+
/* @__PURE__ */ e(Me, { children: x() })
|
|
2743
3075
|
] });
|
|
2744
3076
|
};
|
|
2745
|
-
function
|
|
2746
|
-
const
|
|
2747
|
-
|
|
2748
|
-
if (
|
|
3077
|
+
function er({ extraPages: t = [], disabledPages: i = [] }) {
|
|
3078
|
+
const o = Ct(), d = Lt(), { t: g, i18n: c } = me(["admin", "settings", "translation"]), { app: x } = Ne(), { theme: N } = De(), [_, B] = p([]), [M, A] = p(!1), F = Le(!1), [R, k] = p("light");
|
|
3079
|
+
Y(() => {
|
|
3080
|
+
if (N === "system") {
|
|
2749
3081
|
const h = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
2750
|
-
|
|
3082
|
+
k(h ? "dark" : "light");
|
|
2751
3083
|
} else
|
|
2752
|
-
|
|
2753
|
-
}, [
|
|
2754
|
-
const
|
|
2755
|
-
|
|
3084
|
+
k(N);
|
|
3085
|
+
}, [N]);
|
|
3086
|
+
const $ = Ce(() => x?.logo ? typeof x.logo == "string" ? x.logo : R === "dark" ? x.logo.dark : x.logo.light : He, [x?.logo, R]), H = x?.adminTitle || x?.name, S = c.language === "fa";
|
|
3087
|
+
Y(() => {
|
|
2756
3088
|
const h = localStorage.getItem("admin_info");
|
|
2757
3089
|
if (h)
|
|
2758
3090
|
try {
|
|
2759
|
-
const
|
|
2760
|
-
if (
|
|
2761
|
-
if (
|
|
2762
|
-
|
|
2763
|
-
else if (
|
|
2764
|
-
|
|
2765
|
-
else if (
|
|
2766
|
-
|
|
2767
|
-
else if (
|
|
2768
|
-
|
|
2769
|
-
else if (
|
|
2770
|
-
|
|
3091
|
+
const U = JSON.parse(h).permissions || [];
|
|
3092
|
+
if (B(U), d.pathname === "/admin" || d.pathname === "/admin/")
|
|
3093
|
+
if (U.includes("analytics") && !i.includes("analytics"))
|
|
3094
|
+
o("/admin/analytics", { replace: !0 });
|
|
3095
|
+
else if (U.includes("chat_history") && !i.includes("chat_history"))
|
|
3096
|
+
o("/admin/chat-history", { replace: !0 });
|
|
3097
|
+
else if (U.includes("user_management") && !i.includes("user_management"))
|
|
3098
|
+
o("/admin/users", { replace: !0 });
|
|
3099
|
+
else if (U.includes("admin_management") && !i.includes("admin_management"))
|
|
3100
|
+
o("/admin/admins", { replace: !0 });
|
|
3101
|
+
else if (U.includes("settings") && !i.includes("settings"))
|
|
3102
|
+
o("/admin/settings", { replace: !0 });
|
|
2771
3103
|
else {
|
|
2772
|
-
const
|
|
2773
|
-
|
|
3104
|
+
const f = t.find((q) => !q.permission || U.includes(q.permission));
|
|
3105
|
+
f && o(`/admin/${f.path}`, { replace: !0 });
|
|
2774
3106
|
}
|
|
2775
|
-
} catch (
|
|
2776
|
-
console.error("Failed to parse admin_info",
|
|
3107
|
+
} catch (E) {
|
|
3108
|
+
console.error("Failed to parse admin_info", E);
|
|
2777
3109
|
}
|
|
2778
3110
|
else
|
|
2779
3111
|
console.warn("DashboardPage: No adminInfo found in localStorage");
|
|
2780
|
-
}, [
|
|
2781
|
-
const
|
|
2782
|
-
|
|
2783
|
-
},
|
|
2784
|
-
localStorage.setItem("gentiq-admin-language", h),
|
|
3112
|
+
}, [o, d.pathname]);
|
|
3113
|
+
const D = () => {
|
|
3114
|
+
w.clearToken(), window.location.reload();
|
|
3115
|
+
}, K = (h) => _.includes(h), W = (h) => _.includes(h) && !i.includes(h), P = Object.keys(c.services?.resourceStore?.data || {}).filter((h) => h !== "dev"), ae = P.length > 0 ? P : ["en", "fa"], Q = (h) => {
|
|
3116
|
+
localStorage.setItem("gentiq-admin-language", h), c.changeLanguage(h), A(!1), document.activeElement instanceof HTMLElement && document.activeElement.blur();
|
|
2785
3117
|
};
|
|
2786
|
-
return /* @__PURE__ */ r("div", { className: "min-h-screen bg-background overflow-hidden flex flex-col", dir:
|
|
3118
|
+
return /* @__PURE__ */ r("div", { className: "min-h-screen bg-background overflow-hidden flex flex-col", dir: S ? "rtl" : "ltr", children: [
|
|
2787
3119
|
/* @__PURE__ */ e("header", { className: "glass border-b border-border sticky top-0 z-50", children: /* @__PURE__ */ e("div", { className: "px-8", children: /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-stretch justify-between min-h-[72px] gap-y-4", children: [
|
|
2788
3120
|
/* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-stretch gap-x-12", children: [
|
|
2789
3121
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-3 py-4 md:py-0", children: [
|
|
2790
|
-
/* @__PURE__ */ e("img", { src:
|
|
3122
|
+
/* @__PURE__ */ e("img", { src: $, alt: H, className: "size-8 object-contain" }),
|
|
2791
3123
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-black bg-gradient-to-l from-primary to-primary/60 bg-clip-text text-transparent", children: H })
|
|
2792
3124
|
] }),
|
|
2793
3125
|
/* @__PURE__ */ r("nav", { className: "flex items-stretch gap-8", children: [
|
|
2794
|
-
!
|
|
3126
|
+
!i.includes("analytics") && /* @__PURE__ */ e(
|
|
2795
3127
|
"button",
|
|
2796
3128
|
{
|
|
2797
|
-
onClick: () =>
|
|
2798
|
-
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${
|
|
2799
|
-
children:
|
|
3129
|
+
onClick: () => o("/admin/analytics"),
|
|
3130
|
+
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/analytics" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
3131
|
+
children: g("dashboard.tabs.analytics")
|
|
2800
3132
|
}
|
|
2801
3133
|
),
|
|
2802
|
-
!
|
|
3134
|
+
!i.includes("chat_history") && /* @__PURE__ */ e(
|
|
2803
3135
|
"button",
|
|
2804
3136
|
{
|
|
2805
|
-
onClick: () =>
|
|
2806
|
-
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${
|
|
2807
|
-
children:
|
|
3137
|
+
onClick: () => o("/admin/chat-history"),
|
|
3138
|
+
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/chat-history" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
3139
|
+
children: g("dashboard.tabs.chat_history")
|
|
2808
3140
|
}
|
|
2809
3141
|
),
|
|
2810
|
-
!
|
|
3142
|
+
!i.includes("user_management") && /* @__PURE__ */ e(
|
|
2811
3143
|
"button",
|
|
2812
3144
|
{
|
|
2813
|
-
onClick: () =>
|
|
2814
|
-
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${
|
|
2815
|
-
children:
|
|
3145
|
+
onClick: () => o("/admin/users"),
|
|
3146
|
+
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/users" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
3147
|
+
children: g("dashboard.tabs.users")
|
|
2816
3148
|
}
|
|
2817
3149
|
),
|
|
2818
|
-
!
|
|
3150
|
+
!i.includes("admin_management") && /* @__PURE__ */ e(
|
|
2819
3151
|
"button",
|
|
2820
3152
|
{
|
|
2821
|
-
onClick: () =>
|
|
2822
|
-
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${
|
|
2823
|
-
children:
|
|
3153
|
+
onClick: () => o("/admin/admins"),
|
|
3154
|
+
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/admins" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
3155
|
+
children: g("dashboard.tabs.admins")
|
|
2824
3156
|
}
|
|
2825
3157
|
),
|
|
2826
|
-
!
|
|
3158
|
+
!i.includes("settings") && /* @__PURE__ */ e(
|
|
2827
3159
|
"button",
|
|
2828
3160
|
{
|
|
2829
|
-
onClick: () =>
|
|
2830
|
-
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${
|
|
2831
|
-
children:
|
|
3161
|
+
onClick: () => o("/admin/settings"),
|
|
3162
|
+
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === "/admin/settings" ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
3163
|
+
children: g("dashboard.tabs.settings")
|
|
2832
3164
|
}
|
|
2833
3165
|
),
|
|
2834
3166
|
t.map((h) => /* @__PURE__ */ e(
|
|
2835
3167
|
"button",
|
|
2836
3168
|
{
|
|
2837
|
-
onClick: () =>
|
|
2838
|
-
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${
|
|
2839
|
-
children: typeof h.label == "string" ?
|
|
3169
|
+
onClick: () => o(`/admin/${h.path}`),
|
|
3170
|
+
className: `flex items-center text-base font-medium transition-all border-b-2 px-1 ${d.pathname === `/admin/${h.path}` ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border"}`,
|
|
3171
|
+
children: typeof h.label == "string" ? g(h.label) : h.label
|
|
2840
3172
|
},
|
|
2841
3173
|
`tab-${h.path}`
|
|
2842
3174
|
))
|
|
2843
3175
|
] })
|
|
2844
3176
|
] }),
|
|
2845
3177
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5 py-4 md:py-0", children: [
|
|
2846
|
-
/* @__PURE__ */ r(
|
|
2847
|
-
h ?
|
|
2848
|
-
|
|
3178
|
+
/* @__PURE__ */ r(vt, { onOpenChange: (h) => {
|
|
3179
|
+
h ? A(!1) : (F.current = !0, setTimeout(() => {
|
|
3180
|
+
F.current = !1;
|
|
2849
3181
|
}, 200));
|
|
2850
3182
|
}, children: [
|
|
2851
3183
|
/* @__PURE__ */ r(
|
|
2852
|
-
|
|
3184
|
+
Ae,
|
|
2853
3185
|
{
|
|
2854
|
-
open:
|
|
3186
|
+
open: M,
|
|
2855
3187
|
onOpenChange: (h) => {
|
|
2856
|
-
h &&
|
|
3188
|
+
h && F.current || A(h);
|
|
2857
3189
|
},
|
|
2858
3190
|
children: [
|
|
2859
|
-
/* @__PURE__ */ e(
|
|
2860
|
-
|
|
3191
|
+
/* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ e(yt, { asChild: !0, children: /* @__PURE__ */ e(
|
|
3192
|
+
Se,
|
|
2861
3193
|
{
|
|
2862
3194
|
variant: "ghost",
|
|
2863
3195
|
size: "icon",
|
|
2864
3196
|
className: "font-bold text-xs text-muted-foreground hover:bg-muted",
|
|
2865
|
-
onPointerDown: () =>
|
|
2866
|
-
children: (
|
|
3197
|
+
onPointerDown: () => A(!1),
|
|
3198
|
+
children: (c.language?.split("-")[0] || "").toUpperCase()
|
|
2867
3199
|
}
|
|
2868
3200
|
) }) }),
|
|
2869
|
-
/* @__PURE__ */ e(
|
|
3201
|
+
/* @__PURE__ */ e(Me, { side: "bottom", className: "text-xs", children: g("dashboard.language", "Change Language") })
|
|
2870
3202
|
]
|
|
2871
3203
|
}
|
|
2872
3204
|
),
|
|
2873
|
-
/* @__PURE__ */ e(
|
|
2874
|
-
|
|
3205
|
+
/* @__PURE__ */ e(_t, { align: "center", className: "min-w-[8rem]", children: ae.map((h) => /* @__PURE__ */ e(
|
|
3206
|
+
Nt,
|
|
2875
3207
|
{
|
|
2876
|
-
onClick: () =>
|
|
2877
|
-
className: h ===
|
|
2878
|
-
children:
|
|
3208
|
+
onClick: () => Q(h),
|
|
3209
|
+
className: h === c.language ? "bg-primary/10" : "",
|
|
3210
|
+
children: g(`general.languages.${h}`, h.toUpperCase())
|
|
2879
3211
|
},
|
|
2880
3212
|
h
|
|
2881
3213
|
)) })
|
|
2882
3214
|
] }),
|
|
2883
|
-
/* @__PURE__ */ e(
|
|
3215
|
+
/* @__PURE__ */ e(Yt, { className: "size-9 !bg-transparent hover:bg-muted text-muted-foreground" }),
|
|
2884
3216
|
/* @__PURE__ */ e("div", { className: "w-px h-5 bg-border mx-1" }),
|
|
2885
|
-
/* @__PURE__ */ r(
|
|
2886
|
-
/* @__PURE__ */ e(
|
|
2887
|
-
|
|
3217
|
+
/* @__PURE__ */ r(Ae, { children: [
|
|
3218
|
+
/* @__PURE__ */ e(Ie, { asChild: !0, children: /* @__PURE__ */ e(
|
|
3219
|
+
Se,
|
|
2888
3220
|
{
|
|
2889
3221
|
variant: "ghost",
|
|
2890
3222
|
size: "icon",
|
|
2891
3223
|
className: "hover:bg-destructive/10 hover:scale-105 active:scale-95 text-muted-foreground hover:text-destructive",
|
|
2892
|
-
onClick:
|
|
2893
|
-
children: /* @__PURE__ */ e(
|
|
3224
|
+
onClick: D,
|
|
3225
|
+
children: /* @__PURE__ */ e(Jt, { className: "size-5" })
|
|
2894
3226
|
}
|
|
2895
3227
|
) }),
|
|
2896
|
-
/* @__PURE__ */ e(
|
|
3228
|
+
/* @__PURE__ */ e(Me, { side: "bottom", className: "text-xs", children: g("dashboard.logout") })
|
|
2897
3229
|
] })
|
|
2898
3230
|
] })
|
|
2899
3231
|
] }) }) }),
|
|
2900
|
-
/* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ r(
|
|
2901
|
-
/* @__PURE__ */ e(
|
|
2902
|
-
/* @__PURE__ */ e(
|
|
2903
|
-
/* @__PURE__ */ e(
|
|
2904
|
-
/* @__PURE__ */ e(
|
|
2905
|
-
/* @__PURE__ */ e(
|
|
2906
|
-
/* @__PURE__ */ e(
|
|
3232
|
+
/* @__PURE__ */ e("main", { className: "flex-1 overflow-hidden relative", children: /* @__PURE__ */ e("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ r(qt, { children: [
|
|
3233
|
+
/* @__PURE__ */ e(ge, { path: "/", element: /* @__PURE__ */ e(Re, { to: "/admin/analytics", replace: !0 }) }),
|
|
3234
|
+
/* @__PURE__ */ e(ge, { path: "/analytics", element: W("analytics") ? /* @__PURE__ */ e(Qt, {}) : /* @__PURE__ */ e(_e, {}) }),
|
|
3235
|
+
/* @__PURE__ */ e(ge, { path: "/chat-history", element: W("chat_history") ? /* @__PURE__ */ e(Ht, {}) : /* @__PURE__ */ e(_e, {}) }),
|
|
3236
|
+
/* @__PURE__ */ e(ge, { path: "/admins", element: W("admin_management") ? /* @__PURE__ */ e(Wt, {}) : /* @__PURE__ */ e(_e, {}) }),
|
|
3237
|
+
/* @__PURE__ */ e(ge, { path: "/settings", element: W("settings") ? /* @__PURE__ */ e(Xt, {}) : /* @__PURE__ */ e(_e, {}) }),
|
|
3238
|
+
/* @__PURE__ */ e(ge, { path: "/users", element: W("user_management") ? /* @__PURE__ */ e(Zt, {}) : /* @__PURE__ */ e(_e, {}) }),
|
|
2907
3239
|
t.map((h) => /* @__PURE__ */ e(
|
|
2908
|
-
|
|
3240
|
+
ge,
|
|
2909
3241
|
{
|
|
2910
3242
|
path: `/${h.path}`,
|
|
2911
|
-
element: h.permission && !
|
|
3243
|
+
element: h.permission && !K(h.permission) ? /* @__PURE__ */ e(_e, {}) : h.element
|
|
2912
3244
|
},
|
|
2913
3245
|
`route-${h.path}`
|
|
2914
3246
|
)),
|
|
2915
|
-
/* @__PURE__ */ e(
|
|
3247
|
+
/* @__PURE__ */ e(ge, { path: "*", element: /* @__PURE__ */ e(Re, { to: "/admin/analytics", replace: !0 }) })
|
|
2916
3248
|
] }) }) })
|
|
2917
3249
|
] });
|
|
2918
3250
|
}
|
|
2919
|
-
function
|
|
2920
|
-
const
|
|
2921
|
-
const
|
|
2922
|
-
return
|
|
2923
|
-
resources:
|
|
3251
|
+
function mr(t) {
|
|
3252
|
+
const i = Ce(() => {
|
|
3253
|
+
const o = ut.createInstance();
|
|
3254
|
+
return o.use(wt).use(ht).init({
|
|
3255
|
+
resources: kt,
|
|
2924
3256
|
fallbackLng: "en",
|
|
2925
3257
|
interpolation: { escapeValue: !1 },
|
|
2926
3258
|
detection: {
|
|
@@ -2928,133 +3260,133 @@ function Ut(t) {
|
|
|
2928
3260
|
lookupLocalStorage: "gentiq-admin-language",
|
|
2929
3261
|
caches: ["localStorage"]
|
|
2930
3262
|
}
|
|
2931
|
-
}),
|
|
3263
|
+
}), o;
|
|
2932
3264
|
}, []);
|
|
2933
|
-
return /* @__PURE__ */ e(
|
|
3265
|
+
return /* @__PURE__ */ e(pt, { i18n: i, children: /* @__PURE__ */ e(tr, { ...t }) });
|
|
2934
3266
|
}
|
|
2935
|
-
function
|
|
2936
|
-
const { app:
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
Object.entries(
|
|
2940
|
-
|
|
3267
|
+
function tr({ extraPages: t, disabledPages: i = [] }) {
|
|
3268
|
+
const { app: o, i18n: d } = Ne(), { t: g, i18n: c } = me(["admin", "translation"]), [x, N] = p(!1), [_, B] = p(!0), [M, A] = p(!1);
|
|
3269
|
+
Y(() => {
|
|
3270
|
+
d?.resources && Object.entries(d.resources).forEach(([k, $]) => {
|
|
3271
|
+
Object.entries($).forEach(([H, S]) => {
|
|
3272
|
+
c.addResourceBundle(k, H, S, !0, !0);
|
|
2941
3273
|
});
|
|
2942
|
-
}), !localStorage.getItem("gentiq-admin-language") &&
|
|
2943
|
-
}, [
|
|
2944
|
-
const
|
|
2945
|
-
return
|
|
3274
|
+
}), !localStorage.getItem("gentiq-admin-language") && o?.language && c.language !== o.language && c.changeLanguage(o.language), A(!0);
|
|
3275
|
+
}, [d?.resources, c, o?.language]), Y(() => {
|
|
3276
|
+
const R = w.getToken();
|
|
3277
|
+
return N(!!R), B(!1), document.body.classList.add("admin-theme-root"), () => {
|
|
2946
3278
|
document.body.classList.remove("admin-theme-root");
|
|
2947
3279
|
};
|
|
2948
|
-
}, []),
|
|
2949
|
-
|
|
2950
|
-
}, [
|
|
2951
|
-
const
|
|
2952
|
-
|
|
3280
|
+
}, []), Y(() => {
|
|
3281
|
+
M && (document.documentElement.dir = c.language === "fa" ? "rtl" : "ltr", document.documentElement.lang = c.language);
|
|
3282
|
+
}, [M, c.language]);
|
|
3283
|
+
const F = () => {
|
|
3284
|
+
N(!0);
|
|
2953
3285
|
};
|
|
2954
|
-
return
|
|
3286
|
+
return _ || !M ? /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "text-muted-foreground", children: g("loading") }) }) : /* @__PURE__ */ e(St, { storageKey: "gentiq-admin-theme", children: x ? /* @__PURE__ */ e(er, { extraPages: t, disabledPages: i }) : /* @__PURE__ */ e(Bt, { onLoginSuccess: F }) });
|
|
2955
3287
|
}
|
|
2956
|
-
const
|
|
2957
|
-
function
|
|
2958
|
-
return
|
|
2959
|
-
queryKey: [
|
|
2960
|
-
queryFn: () =>
|
|
3288
|
+
const he = "gentiq_admin";
|
|
3289
|
+
function ur(t = 0, i = 100, o = "") {
|
|
3290
|
+
return we({
|
|
3291
|
+
queryKey: [he, "users", t, i, o],
|
|
3292
|
+
queryFn: () => w.listUsers(t, i, o)
|
|
2961
3293
|
});
|
|
2962
3294
|
}
|
|
2963
|
-
function
|
|
2964
|
-
const t =
|
|
2965
|
-
t.invalidateQueries({ queryKey: [
|
|
2966
|
-
},
|
|
2967
|
-
mutationFn: (
|
|
2968
|
-
onSuccess:
|
|
2969
|
-
}),
|
|
2970
|
-
mutationFn: ({ userId:
|
|
2971
|
-
onSuccess:
|
|
2972
|
-
}),
|
|
2973
|
-
mutationFn: (
|
|
2974
|
-
onSuccess:
|
|
2975
|
-
}),
|
|
2976
|
-
mutationFn: ({ userId:
|
|
2977
|
-
onSuccess:
|
|
2978
|
-
}),
|
|
2979
|
-
mutationFn: (
|
|
3295
|
+
function hr() {
|
|
3296
|
+
const t = $e(), i = () => {
|
|
3297
|
+
t.invalidateQueries({ queryKey: [he, "users"] });
|
|
3298
|
+
}, o = ue({
|
|
3299
|
+
mutationFn: (N) => w.createUser(N.phone, N.name, N.surname, N.tokens, N.requests),
|
|
3300
|
+
onSuccess: i
|
|
3301
|
+
}), d = ue({
|
|
3302
|
+
mutationFn: ({ userId: N, data: _ }) => w.updateUser(N, _),
|
|
3303
|
+
onSuccess: i
|
|
3304
|
+
}), g = ue({
|
|
3305
|
+
mutationFn: (N) => w.deleteUser(N),
|
|
3306
|
+
onSuccess: i
|
|
3307
|
+
}), c = ue({
|
|
3308
|
+
mutationFn: ({ userId: N, tokens: _, requests: B }) => w.updateUserBalance(N, _, B),
|
|
3309
|
+
onSuccess: i
|
|
3310
|
+
}), x = ue({
|
|
3311
|
+
mutationFn: (N) => w.refreshUserToken(N)
|
|
2980
3312
|
});
|
|
2981
|
-
return { createUser:
|
|
3313
|
+
return { createUser: o, updateUser: d, deleteUser: g, updateBalance: c, refreshToken: x };
|
|
2982
3314
|
}
|
|
2983
|
-
function
|
|
2984
|
-
return
|
|
2985
|
-
queryKey: [
|
|
2986
|
-
queryFn: () =>
|
|
3315
|
+
function pr(t = 30) {
|
|
3316
|
+
return we({
|
|
3317
|
+
queryKey: [he, "analytics", t],
|
|
3318
|
+
queryFn: () => w.getAnalytics(t)
|
|
2987
3319
|
});
|
|
2988
3320
|
}
|
|
2989
|
-
function
|
|
2990
|
-
return
|
|
2991
|
-
queryKey: [
|
|
2992
|
-
queryFn: () =>
|
|
3321
|
+
function gr() {
|
|
3322
|
+
return we({
|
|
3323
|
+
queryKey: [he, "admins"],
|
|
3324
|
+
queryFn: () => w.listAdmins()
|
|
2993
3325
|
});
|
|
2994
3326
|
}
|
|
2995
|
-
function
|
|
2996
|
-
const t =
|
|
2997
|
-
t.invalidateQueries({ queryKey: [
|
|
2998
|
-
},
|
|
2999
|
-
mutationFn: (
|
|
3000
|
-
onSuccess:
|
|
3001
|
-
}),
|
|
3002
|
-
mutationFn: ({ adminId:
|
|
3003
|
-
onSuccess:
|
|
3004
|
-
}),
|
|
3005
|
-
mutationFn: (
|
|
3006
|
-
onSuccess:
|
|
3327
|
+
function fr() {
|
|
3328
|
+
const t = $e(), i = () => {
|
|
3329
|
+
t.invalidateQueries({ queryKey: [he, "admins"] });
|
|
3330
|
+
}, o = ue({
|
|
3331
|
+
mutationFn: (c) => w.register(c.username, c.password, c.name, c.permissions),
|
|
3332
|
+
onSuccess: i
|
|
3333
|
+
}), d = ue({
|
|
3334
|
+
mutationFn: ({ adminId: c, data: x }) => w.updateAdmin(c, x),
|
|
3335
|
+
onSuccess: i
|
|
3336
|
+
}), g = ue({
|
|
3337
|
+
mutationFn: (c) => w.deleteAdmin(c),
|
|
3338
|
+
onSuccess: i
|
|
3007
3339
|
});
|
|
3008
|
-
return { createAdmin:
|
|
3340
|
+
return { createAdmin: o, updateAdmin: d, deleteAdmin: g };
|
|
3009
3341
|
}
|
|
3010
|
-
function
|
|
3011
|
-
return
|
|
3012
|
-
queryKey: [
|
|
3013
|
-
queryFn: () =>
|
|
3342
|
+
function xr(t = 0, i = 50, o, d) {
|
|
3343
|
+
return we({
|
|
3344
|
+
queryKey: [he, "threads", t, i, o, d],
|
|
3345
|
+
queryFn: () => w.listThreads(t, i, o, d)
|
|
3014
3346
|
});
|
|
3015
3347
|
}
|
|
3016
|
-
function
|
|
3017
|
-
return
|
|
3018
|
-
queryKey: [
|
|
3019
|
-
queryFn: () =>
|
|
3348
|
+
function br(t) {
|
|
3349
|
+
return we({
|
|
3350
|
+
queryKey: [he, "threadItems", t],
|
|
3351
|
+
queryFn: () => w.getThreadItems(t),
|
|
3020
3352
|
enabled: !!t
|
|
3021
3353
|
});
|
|
3022
3354
|
}
|
|
3023
|
-
function
|
|
3024
|
-
return
|
|
3025
|
-
queryKey: [
|
|
3026
|
-
queryFn: () =>
|
|
3355
|
+
function vr(t = 20, i) {
|
|
3356
|
+
return we({
|
|
3357
|
+
queryKey: [he, "jobs", t, i],
|
|
3358
|
+
queryFn: () => w.listJobs(t, i),
|
|
3027
3359
|
refetchInterval: 5e3
|
|
3028
3360
|
// Auto-refresh jobs every 5 seconds
|
|
3029
3361
|
});
|
|
3030
3362
|
}
|
|
3031
|
-
function
|
|
3032
|
-
const t =
|
|
3033
|
-
return { cancelJob:
|
|
3034
|
-
mutationFn: (
|
|
3363
|
+
function yr() {
|
|
3364
|
+
const t = $e();
|
|
3365
|
+
return { cancelJob: ue({
|
|
3366
|
+
mutationFn: (d) => w.cancelJob(d),
|
|
3035
3367
|
onSuccess: () => {
|
|
3036
|
-
t.invalidateQueries({ queryKey: [
|
|
3368
|
+
t.invalidateQueries({ queryKey: [he, "jobs"] });
|
|
3037
3369
|
}
|
|
3038
3370
|
}) };
|
|
3039
3371
|
}
|
|
3040
|
-
function
|
|
3372
|
+
function _r() {
|
|
3041
3373
|
return {
|
|
3042
|
-
login: async (t,
|
|
3043
|
-
logout: () =>
|
|
3044
|
-
getToken: () =>
|
|
3045
|
-
isAuthenticated: !!
|
|
3374
|
+
login: async (t, i) => w.login(t, i),
|
|
3375
|
+
logout: () => w.clearToken(),
|
|
3376
|
+
getToken: () => w.getToken(),
|
|
3377
|
+
isAuthenticated: !!w.getToken()
|
|
3046
3378
|
};
|
|
3047
3379
|
}
|
|
3048
3380
|
export {
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3381
|
+
mr as AdminPanel,
|
|
3382
|
+
gr as useAdminAdmins,
|
|
3383
|
+
fr as useAdminAdminsMutations,
|
|
3384
|
+
pr as useAdminAnalytics,
|
|
3385
|
+
_r as useAdminAuth,
|
|
3386
|
+
vr as useAdminJobs,
|
|
3387
|
+
yr as useAdminJobsMutations,
|
|
3388
|
+
br as useAdminThreadItems,
|
|
3389
|
+
xr as useAdminThreads,
|
|
3390
|
+
ur as useAdminUsers,
|
|
3391
|
+
hr as useAdminUsersMutations
|
|
3060
3392
|
};
|