gentiq 0.7.27 → 0.7.29

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