gentiq 0.7.28 → 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,8 +1,8 @@
1
1
  import { jsx as e, jsxs as r, Fragment as Ue } from "react/jsx-runtime";
2
2
  import { useState as b, useEffect as W, useMemo as pe, useRef as Ie } from "react";
3
3
  import ze from "i18next";
4
- import { useTranslation as ee, initReactI18next as Je, I18nextProvider as Pe } 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-DIJ7BlxY.js";
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
6
  import { useNavigate as it, useLocation as ot, Routes as lt, Route as ae, Navigate as Le } from "react-router-dom";
7
7
  import { Share2 as dt, RefreshCcw as qe, Globe as xe, Keyboard as ct, Wallet as mt, Languages as ut, Plus as ht, Hash as pt, ShieldAlert as gt, Monitor as je, Moon as ft, Sun as xt, LogOut as bt } from "lucide-react";
8
8
  import { toast as Te } from "sonner";
@@ -193,8 +193,8 @@ function yt({ onLoginSuccess: t }) {
193
193
  h.preventDefault(), I(""), C(!0);
194
194
  try {
195
195
  await k.login(u, _), t();
196
- } catch (J) {
197
- I(J instanceof Error ? J.message : n("login.error"));
196
+ } catch (P) {
197
+ I(P instanceof Error ? P.message : n("login.error"));
198
198
  } finally {
199
199
  C(!1);
200
200
  }
@@ -215,8 +215,8 @@ function yt({ onLoginSuccess: t }) {
215
215
  "Admin",
216
216
  ["chat_history", "admin_management", "user_management", "analytics"]
217
217
  ), await k.login("admin", _), t();
218
- } catch (J) {
219
- I(J instanceof Error ? J.message : n("login.error"));
218
+ } catch (P) {
219
+ I(P instanceof Error ? P.message : n("login.error"));
220
220
  } finally {
221
221
  C(!1);
222
222
  }
@@ -350,7 +350,7 @@ function yt({ onLoginSuccess: t }) {
350
350
  ] });
351
351
  }
352
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", J = h ? "fa-IR" : "en-US", d = async (s = !1) => {
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) => {
354
354
  s ? D(!0) : (A(!0), V(0)), O("");
355
355
  try {
356
356
  const f = s ? E + 50 : 0, q = await k.listThreads(
@@ -409,7 +409,7 @@ function Nt() {
409
409
  return s;
410
410
  }
411
411
  return JSON.stringify(s, null, 2);
412
- }, P = ({ part: s, idx: f }) => {
412
+ }, J = ({ part: s, idx: f }) => {
413
413
  const [q, i] = b(!1), w = s.tool_name || (s.type && s.type.startsWith("tool-") ? s.type.slice(5) : "tool");
414
414
  return /* @__PURE__ */ r("div", { dir: "ltr", className: "my-2 border border-border/50 rounded-xl overflow-hidden bg-muted/20 text-left", children: [
415
415
  /* @__PURE__ */ r(
@@ -457,7 +457,7 @@ function Nt() {
457
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: [
458
458
  /* @__PURE__ */ e("div", { className: "font-bold mb-1 uppercase tracking-tighter opacity-70", children: "Reasoning" }),
459
459
  s.text
460
- ] }, f) : s.type === "dynamic-tool" || s.type && s.type.startsWith("tool-") || s.tool_call_id ? /* @__PURE__ */ e(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: [
461
461
  /* @__PURE__ */ r("div", { className: "flex items-center gap-3 overflow-hidden", children: [
462
462
  /* @__PURE__ */ e("div", { className: "flex-shrink-0 w-8 h-8 flex items-center justify-center bg-primary/10 rounded-lg text-primary", children: /* @__PURE__ */ e("span", { className: "text-xl", children: "📎" }) }),
463
463
  /* @__PURE__ */ r("div", { className: "flex flex-col min-w-0", children: [
@@ -535,7 +535,7 @@ function Nt() {
535
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: [
536
536
  t("chat_history.threads_list"),
537
537
  " (",
538
- (x.length || 0).toLocaleString(J),
538
+ (x.length || 0).toLocaleString(P),
539
539
  ")"
540
540
  ] }) }),
541
541
  /* @__PURE__ */ e(
@@ -598,7 +598,7 @@ function Nt() {
598
598
  const i = s.user_info?.metadata?.[f.key];
599
599
  let w = String(i);
600
600
  if (f.type === "select") {
601
- const F = f.options?.find((X) => String(X.value) === String(i));
601
+ const F = f.options?.find((Y) => String(Y.value) === String(i));
602
602
  F && (w = t(F.label));
603
603
  } else f.type === "checkbox" && (w = i ? "✓" : "✗");
604
604
  return /* @__PURE__ */ r("span", { className: "flex items-center gap-1", children: [
@@ -615,8 +615,8 @@ function Nt() {
615
615
  }
616
616
  ),
617
617
  s.metadata?.usage && /* @__PURE__ */ r("div", { className: "flex gap-2 mt-2 pt-2 border-border/30", children: [
618
- /* @__PURE__ */ e("span", { className: "inline-flex items-center gap-1 bg-muted/30 px-2 py-0.5 rounded-md text-[9px] text-muted-foreground", children: t("chat_history.input_tokens", { value: (s.metadata.usage.input_tokens || 0).toLocaleString(J) }) }),
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(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) }) })
620
620
  ] }),
621
621
  /* @__PURE__ */ e("div", { className: "text-[10px] text-muted-foreground mt-1", children: g(s.created_at) })
622
622
  ] })
@@ -747,7 +747,7 @@ function wt() {
747
747
  name: c.name,
748
748
  permissions: c.permissions
749
749
  }), H(!0);
750
- }, J = (c) => {
750
+ }, P = (c) => {
751
751
  z((l) => ({
752
752
  ...l,
753
753
  permissions: l.permissions.includes(c) ? l.permissions.filter((g) => g !== c) : [...l.permissions, c]
@@ -842,7 +842,7 @@ function wt() {
842
842
  {
843
843
  type: "checkbox",
844
844
  checked: y.permissions.includes(c),
845
- onChange: () => J(c),
845
+ onChange: () => P(c),
846
846
  disabled: y.username === "admin" && c === "admin_management",
847
847
  className: "peer h-4 w-4 rounded border-input text-primary focus:ring-ring transition-all disabled:opacity-50"
848
848
  }
@@ -919,7 +919,7 @@ function wt() {
919
919
  }
920
920
  const _t = (t) => t.replace(/[^0-9]/g, "");
921
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, J] = b(""), [d, c] = b(""), [l, g] = b(""), L = n.language === "fa", P = L ? "text-right" : "text-left", [p, j] = b({
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({
923
923
  phone: "",
924
924
  name: "",
925
925
  surname: "",
@@ -1045,7 +1045,7 @@ function kt() {
1045
1045
  requestsLimit: y?.initial_balance_requests?.toString() || "",
1046
1046
  metadata: ""
1047
1047
  }), s({});
1048
- }, X = async (a) => {
1048
+ }, Y = async (a) => {
1049
1049
  if (confirm(t("users.confirm_delete_user")))
1050
1050
  try {
1051
1051
  await k.deleteUser(a), f();
@@ -1073,7 +1073,7 @@ function kt() {
1073
1073
  S,
1074
1074
  $,
1075
1075
  G
1076
- ), V(null), B(""), J(""), c(""), g(""), f();
1076
+ ), V(null), B(""), P(""), c(""), g(""), f();
1077
1077
  } catch (te) {
1078
1078
  N(te instanceof Error ? te.message : t("error_loading"));
1079
1079
  } finally {
@@ -1100,7 +1100,7 @@ function kt() {
1100
1100
  }, Re = () => {
1101
1101
  if (!E) return;
1102
1102
  const a = d || String(E.balance?.token_limit || 0), S = l || String(E.balance?.request_limit || 0);
1103
- B(a), J(S);
1103
+ B(a), P(S);
1104
1104
  }, Fe = (a) => {
1105
1105
  I(a);
1106
1106
  const S = a.metadata ? JSON.stringify(a.metadata, null, 2) : "";
@@ -1183,7 +1183,7 @@ function kt() {
1183
1183
  type: "text",
1184
1184
  value: p.name,
1185
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 ${P}`,
1186
+ className: `w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm ${J}`,
1187
1187
  required: !0
1188
1188
  }
1189
1189
  )
@@ -1196,7 +1196,7 @@ function kt() {
1196
1196
  type: "text",
1197
1197
  value: p.surname,
1198
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 ${P}`,
1199
+ className: `w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm ${J}`,
1200
1200
  required: !0
1201
1201
  }
1202
1202
  )
@@ -1282,7 +1282,7 @@ function kt() {
1282
1282
  required: a.required,
1283
1283
  dir: L ? "rtl" : "ltr",
1284
1284
  children: [
1285
- /* @__PURE__ */ e(ie, { className: be("w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground transition-all text-sm h-[46px]", P), children: /* @__PURE__ */ e(oe, { placeholder: t(a.placeholder || "select_placeholder") }) }),
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
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))) })
1287
1287
  ]
1288
1288
  }
@@ -1303,7 +1303,7 @@ function kt() {
1303
1303
  type: a.type,
1304
1304
  value: M[a.key] || "",
1305
1305
  onChange: (S) => s({ ...M, [a.key]: S.target.value }),
1306
- className: `w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm ${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}`,
1307
1307
  placeholder: t(a.placeholder || ""),
1308
1308
  required: a.required
1309
1309
  }
@@ -1409,7 +1409,7 @@ function kt() {
1409
1409
  {
1410
1410
  type: "number",
1411
1411
  value: h,
1412
- onChange: (a) => J(a.target.value),
1412
+ onChange: (a) => P(a.target.value),
1413
1413
  className: "w-full px-4 py-3 bg-input/50 border border-border rounded-xl text-foreground focus:ring-2 focus:ring-ring focus:border-transparent transition-all text-sm text-left",
1414
1414
  required: !0,
1415
1415
  dir: "ltr"
@@ -1525,7 +1525,7 @@ function kt() {
1525
1525
  "button",
1526
1526
  {
1527
1527
  onClick: () => {
1528
- 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)), N("");
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("");
1529
1529
  },
1530
1530
  className: "p-2 text-muted-foreground hover:text-primary hover:bg-primary/10 rounded-xl transition-all",
1531
1531
  title: t("users.recharge"),
@@ -1544,7 +1544,7 @@ function kt() {
1544
1544
  /* @__PURE__ */ e(
1545
1545
  "button",
1546
1546
  {
1547
- onClick: () => X(a.id),
1547
+ onClick: () => Y(a.id),
1548
1548
  className: "p-2 text-destructive hover:text-destructive/80 hover:bg-destructive/10 rounded-xl transition-all",
1549
1549
  title: t("delete"),
1550
1550
  children: /* @__PURE__ */ e("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: "w-4 h-4", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0" }) })
@@ -1577,7 +1577,7 @@ function St() {
1577
1577
  return d.observe(I.current), () => d.disconnect();
1578
1578
  }, []);
1579
1579
  const U = (d, c, l) => {
1580
- const g = [], L = /* @__PURE__ */ new Date(), P = d || [], p = 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]));
1581
1581
  for (let j = c - 1; j >= 0; j--) {
1582
1582
  const s = new Date(L.getTime() - j * 24 * 60 * 60 * 1e3).toISOString().split("T")[0];
1583
1583
  if (p.has(s))
@@ -1593,17 +1593,17 @@ function St() {
1593
1593
  const c = d.length, l = new Intl.DateTimeFormat(O, { month: "short" });
1594
1594
  let g = [];
1595
1595
  if (N <= 14)
1596
- g = Array.from({ length: c }, (L, P) => P);
1596
+ g = Array.from({ length: c }, (L, J) => J);
1597
1597
  else {
1598
- const L = D ? 45 : 35, P = T > 0 ? Math.floor(T / L) : 6, p = Math.max(1, Math.ceil(c / Math.max(1, P)));
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
1599
  for (let j = 0; j < c; j += p)
1600
1600
  g.push(j);
1601
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);
1602
1602
  }
1603
1603
  return /* @__PURE__ */ e("div", { className: "relative w-full h-8 mt-2", dir: D ? "rtl" : "ltr", children: g.map((L) => {
1604
- const P = d[L];
1605
- if (!P) return null;
1606
- const p = new Date(P.date), j = p.toLocaleDateString(O, { day: "numeric" }), M = l.format(p), 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;
1607
1607
  return /* @__PURE__ */ r(
1608
1608
  "div",
1609
1609
  {
@@ -1668,7 +1668,7 @@ function St() {
1668
1668
  const c = d * 1.15, l = Math.pow(10, Math.floor(Math.log10(c))), g = c / l;
1669
1669
  let L;
1670
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);
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), 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);
1672
1672
  return /* @__PURE__ */ r("div", { className: "h-full overflow-auto p-5 flex flex-col gap-5", dir: D ? "rtl" : "ltr", children: [
1673
1673
  /* @__PURE__ */ r("div", { className: "flex flex-col md:flex-row md:items-center justify-between gap-3", children: [
1674
1674
  /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-foreground tracking-tight whitespace-nowrap", children: t("analytics.title") }),
@@ -1784,8 +1784,8 @@ function St() {
1784
1784
  /* @__PURE__ */ r("div", { className: "h-64 flex flex-col", ref: I, children: [
1785
1785
  /* @__PURE__ */ r("div", { className: "flex-1 flex gap-2 min-h-0", dir: "ltr", children: [
1786
1786
  /* @__PURE__ */ r("div", { className: "flex flex-col justify-between text-[10px] text-muted-foreground pt-6 text-right min-w-[24px]", children: [
1787
- /* @__PURE__ */ e("span", { children: (J || 0).toLocaleString(C) }),
1788
- /* @__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) }),
1789
1789
  /* @__PURE__ */ e("span", { children: "0" })
1790
1790
  ] }),
1791
1791
  /* @__PURE__ */ r("div", { className: "flex-1 relative flex items-end justify-between pt-6 border-b border-border/30", children: [
@@ -1797,7 +1797,7 @@ function St() {
1797
1797
  "div",
1798
1798
  {
1799
1799
  className: "bg-primary/80 w-full rounded-t-lg transition-all group-hover:bg-primary relative",
1800
- style: { height: `${d.tokens / J * 100}%` },
1800
+ style: { height: `${d.tokens / P * 100}%` },
1801
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: [
1802
1802
  /* @__PURE__ */ e("span", { className: "text-[10px] font-medium text-primary leading-none mb-0.5", children: (d.tokens || 0).toLocaleString(C) }),
1803
1803
  /* @__PURE__ */ e("span", { className: "text-[9px] text-muted-foreground leading-none whitespace-nowrap", children: new Date(d.date).toLocaleDateString(O, { month: "short", day: "numeric" }) })
@@ -1821,7 +1821,7 @@ function St() {
1821
1821
  (M) => M.sentiment === "positive" || M.sentiment === "negative"
1822
1822
  ), c = d.reduce((M, s) => M + s.count, 0);
1823
1823
  if (c === 0) return null;
1824
- const l = d.find((M) => M.sentiment === "positive")?.count || 0, g = d.find((M) => M.sentiment === "negative")?.count || 0, L = 40, P = 2 * Math.PI * L, p = l / c * 100, j = g / c * 100;
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
1825
  return /* @__PURE__ */ r(Ue, { children: [
1826
1826
  /* @__PURE__ */ e(
1827
1827
  "circle",
@@ -1854,7 +1854,7 @@ function St() {
1854
1854
  fill: "transparent",
1855
1855
  stroke: "url(#posGradient)",
1856
1856
  strokeWidth: "10",
1857
- strokeDasharray: `${p / 100 * P} ${P}`,
1857
+ strokeDasharray: `${p / 100 * J} ${J}`,
1858
1858
  strokeLinecap: p > 0 ? "round" : "butt",
1859
1859
  className: "transition-all duration-1000 ease-out drop-shadow-sm"
1860
1860
  }
@@ -1868,8 +1868,8 @@ function St() {
1868
1868
  fill: "transparent",
1869
1869
  stroke: "url(#negGradient)",
1870
1870
  strokeWidth: "10",
1871
- strokeDasharray: `${j / 100 * P} ${P}`,
1872
- strokeDashoffset: -(p / 100 * P),
1871
+ strokeDasharray: `${j / 100 * J} ${J}`,
1872
+ strokeDashoffset: -(p / 100 * J),
1873
1873
  strokeLinecap: j > 0 ? "round" : "butt",
1874
1874
  className: "transition-all duration-1000 ease-out drop-shadow-sm"
1875
1875
  }
@@ -1884,10 +1884,10 @@ function St() {
1884
1884
  /* @__PURE__ */ e("div", { className: "flex flex-col gap-4 min-w-[140px]", children: [...o.distributions.feedback_sentiment].filter((d) => d.sentiment === "positive" || d.sentiment === "negative").sort((d, c) => d.sentiment === "positive" ? -1 : 1).map((d) => {
1885
1885
  const l = o.distributions.feedback_sentiment.filter(
1886
1886
  (j) => j.sentiment === "positive" || j.sentiment === "negative"
1887
- ).reduce((j, M) => j + M.count, 0), 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", p = 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" ? "👍" : "👎";
1888
1888
  return /* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-6 group", children: [
1889
1889
  /* @__PURE__ */ r("div", { className: "flex items-center gap-3", children: [
1890
- /* @__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` }),
1891
1891
  /* @__PURE__ */ r("span", { className: "text-sm text-muted-foreground font-medium", children: [
1892
1892
  L,
1893
1893
  " ",
@@ -1912,7 +1912,7 @@ function St() {
1912
1912
  ] }),
1913
1913
  /* @__PURE__ */ e("div", { className: "grid grid-cols-1 lg:grid-cols-2 gap-5", children: /* @__PURE__ */ r("div", { className: "glass-surface rounded-2xl shadow-sm p-7", children: [
1914
1914
  /* @__PURE__ */ e("h3", { className: "text-[11px] font-bold text-muted-foreground/80 mb-6 uppercase tracking-widest", children: t("analytics.active_users") }),
1915
- /* @__PURE__ */ e("div", { className: "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(
1916
1916
  "div",
1917
1917
  {
1918
1918
  className: "flex items-center justify-between p-3 bg-muted/30 rounded-xl hover:bg-muted/50 transition-colors",
@@ -1929,11 +1929,11 @@ function St() {
1929
1929
  ]
1930
1930
  },
1931
1931
  d.user_id
1932
- )) : /* @__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") }) }) })
1933
1933
  ] }) })
1934
1934
  ] });
1935
1935
  }
1936
- function Y({ className: t, ...n }) {
1936
+ function X({ className: t, ...n }) {
1937
1937
  return /* @__PURE__ */ e(
1938
1938
  Ae.Root,
1939
1939
  {
@@ -1956,7 +1956,7 @@ function Y({ className: t, ...n }) {
1956
1956
  );
1957
1957
  }
1958
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(""), [J, d] = b(!1), c = pe(() => ({
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(() => ({
1960
1960
  app_name: o?.name || "Gentiq",
1961
1961
  admin_title: o?.adminTitle || "",
1962
1962
  welcome_greeting: m?.greeting || "",
@@ -1964,6 +1964,8 @@ function Ct() {
1964
1964
  disclaimer: typeof x == "string" ? x : "",
1965
1965
  show_tool_details: o?.showToolDetails ?? !0,
1966
1966
  show_settings: o?.showSettings ?? !0,
1967
+ disable_signup: o?.disableSignup ?? !1,
1968
+ disable_auth_page: o?.disableAuthPage ?? !1,
1967
1969
  composer_attachments: _?.attachments?.enabled ?? !0,
1968
1970
  thread_actions_feedback: v?.feedback ?? !0,
1969
1971
  thread_actions_retry: v?.retry ?? !0,
@@ -1990,10 +1992,10 @@ function Ct() {
1990
1992
  const w = await k.getSettings();
1991
1993
  if (w && Object.keys(w).length > 0) {
1992
1994
  const F = JSON.parse(JSON.stringify(n.store.data));
1993
- w.translations && Object.keys(w.translations).forEach((X) => {
1994
- F[X] || (F[X] = {}), Object.assign(F[X], w.translations[X]);
1995
- }), g((X) => ({
1996
- ...X,
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,
1997
1999
  ...w,
1998
2000
  translations: F
1999
2001
  }));
@@ -2008,7 +2010,7 @@ function Ct() {
2008
2010
  }
2009
2011
  })();
2010
2012
  }, [t, c, n.store.data]);
2011
- const P = async (i) => {
2013
+ const J = async (i) => {
2012
2014
  i && i.preventDefault(), I(!0), U(""), C("");
2013
2015
  try {
2014
2016
  await k.updateSettings(l), U(t("app_settings.save_success")), setTimeout(() => U(""), 3e3);
@@ -2096,7 +2098,7 @@ function Ct() {
2096
2098
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("app_settings.subtitle") })
2097
2099
  ] }),
2098
2100
  /* @__PURE__ */ r("div", { className: "flex items-center gap-4", children: [
2099
- /* @__PURE__ */ r(Be, { open: J, onOpenChange: d, children: [
2101
+ /* @__PURE__ */ r(Be, { open: P, onOpenChange: d, children: [
2100
2102
  /* @__PURE__ */ e(Ve, { asChild: !0, children: /* @__PURE__ */ r(
2101
2103
  "button",
2102
2104
  {
@@ -2136,7 +2138,7 @@ function Ct() {
2136
2138
  ] }),
2137
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: [
2138
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 }),
2139
- /* @__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: [
2140
2142
  /* @__PURE__ */ r("section", { children: [
2141
2143
  /* @__PURE__ */ e(M, { title: t("app_settings.sections.general"), icon: xe }),
2142
2144
  /* @__PURE__ */ r("div", { className: "p-2 space-y-10", children: [
@@ -2249,7 +2251,7 @@ function Ct() {
2249
2251
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.show_tool_details_help") })
2250
2252
  ] }),
2251
2253
  /* @__PURE__ */ e(
2252
- Y,
2254
+ X,
2253
2255
  {
2254
2256
  checked: l.show_tool_details,
2255
2257
  onCheckedChange: (i) => g({ ...l, show_tool_details: i })
@@ -2262,20 +2264,46 @@ function Ct() {
2262
2264
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.show_settings_help") })
2263
2265
  ] }),
2264
2266
  /* @__PURE__ */ e(
2265
- Y,
2267
+ X,
2266
2268
  {
2267
2269
  checked: l.show_settings,
2268
2270
  onCheckedChange: (i) => g({ ...l, show_settings: i })
2269
2271
  }
2270
2272
  )
2271
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
+ ] }),
2272
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: [
2273
2301
  /* @__PURE__ */ r("div", { className: "flex-1", children: [
2274
2302
  /* @__PURE__ */ e("p", { className: "text-xs font-bold text-foreground/80", children: t("app_settings.chat.composer_attachments") }),
2275
2303
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.composer_attachments_help") })
2276
2304
  ] }),
2277
2305
  /* @__PURE__ */ e(
2278
- Y,
2306
+ X,
2279
2307
  {
2280
2308
  checked: l.composer_attachments,
2281
2309
  onCheckedChange: (i) => g({ ...l, composer_attachments: i })
@@ -2288,7 +2316,7 @@ function Ct() {
2288
2316
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.thread_actions_feedback_help") })
2289
2317
  ] }),
2290
2318
  /* @__PURE__ */ e(
2291
- Y,
2319
+ X,
2292
2320
  {
2293
2321
  checked: l.thread_actions_feedback,
2294
2322
  onCheckedChange: (i) => g({ ...l, thread_actions_feedback: i })
@@ -2301,7 +2329,7 @@ function Ct() {
2301
2329
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.thread_actions_retry_help") })
2302
2330
  ] }),
2303
2331
  /* @__PURE__ */ e(
2304
- Y,
2332
+ X,
2305
2333
  {
2306
2334
  checked: l.thread_actions_retry,
2307
2335
  onCheckedChange: (i) => g({ ...l, thread_actions_retry: i })
@@ -2314,7 +2342,7 @@ function Ct() {
2314
2342
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground/60 leading-relaxed mt-1", children: t("app_settings.chat.history_enabled_help") })
2315
2343
  ] }),
2316
2344
  /* @__PURE__ */ e(
2317
- Y,
2345
+ X,
2318
2346
  {
2319
2347
  checked: l.history_enabled,
2320
2348
  onCheckedChange: (i) => g({ ...l, history_enabled: i })
@@ -2325,7 +2353,7 @@ function Ct() {
2325
2353
  /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
2326
2354
  /* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_delete") }),
2327
2355
  /* @__PURE__ */ e(
2328
- Y,
2356
+ X,
2329
2357
  {
2330
2358
  checked: l.history_show_delete,
2331
2359
  onCheckedChange: (i) => g({ ...l, history_show_delete: i })
@@ -2335,7 +2363,7 @@ function Ct() {
2335
2363
  /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
2336
2364
  /* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_rename") }),
2337
2365
  /* @__PURE__ */ e(
2338
- Y,
2366
+ X,
2339
2367
  {
2340
2368
  checked: l.history_show_rename,
2341
2369
  onCheckedChange: (i) => g({ ...l, history_show_rename: i })
@@ -2345,7 +2373,7 @@ function Ct() {
2345
2373
  /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
2346
2374
  /* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_share") }),
2347
2375
  /* @__PURE__ */ e(
2348
- Y,
2376
+ X,
2349
2377
  {
2350
2378
  checked: l.history_show_share,
2351
2379
  onCheckedChange: (i) => g({ ...l, history_show_share: i })
@@ -2355,7 +2383,7 @@ function Ct() {
2355
2383
  /* @__PURE__ */ r("div", { className: "flex items-center justify-between", children: [
2356
2384
  /* @__PURE__ */ e(Q, { className: "text-xs font-medium text-foreground/70", children: t("app_settings.chat.history_show_pin") }),
2357
2385
  /* @__PURE__ */ e(
2358
- Y,
2386
+ X,
2359
2387
  {
2360
2388
  checked: l.history_show_pin,
2361
2389
  onCheckedChange: (i) => g({ ...l, history_show_pin: i })
@@ -2660,8 +2688,8 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
2660
2688
  const c = t.find((l) => !l.permission || d.includes(l.permission));
2661
2689
  c && o(`/admin/${c.path}`, { replace: !0 });
2662
2690
  }
2663
- } catch (J) {
2664
- console.error("Failed to parse admin_info", J);
2691
+ } catch (P) {
2692
+ console.error("Failed to parse admin_info", P);
2665
2693
  }
2666
2694
  else
2667
2695
  console.warn("DashboardPage: No adminInfo found in localStorage");
@@ -2807,7 +2835,7 @@ function qt({ extraPages: t = [], disabledPages: n = [] }) {
2807
2835
  function Ft(t) {
2808
2836
  const n = pe(() => {
2809
2837
  const o = ze.createInstance();
2810
- return o.use(st).use(Je).init({
2838
+ return o.use(st).use(Pe).init({
2811
2839
  resources: at,
2812
2840
  fallbackLng: "en",
2813
2841
  interpolation: { escapeValue: !1 },
@@ -2818,7 +2846,7 @@ function Ft(t) {
2818
2846
  }
2819
2847
  }), o;
2820
2848
  }, []);
2821
- return /* @__PURE__ */ e(Pe, { i18n: n, children: /* @__PURE__ */ e(jt, { ...t }) });
2849
+ return /* @__PURE__ */ e(Je, { i18n: n, children: /* @__PURE__ */ e(jt, { ...t }) });
2822
2850
  }
2823
2851
  function jt({ extraPages: t, disabledPages: n = [] }) {
2824
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);
@@ -2868,13 +2896,13 @@ function zt() {
2868
2896
  });
2869
2897
  return { createUser: o, updateUser: m, deleteUser: x, updateBalance: u, refreshToken: v };
2870
2898
  }
2871
- function Jt(t = 30) {
2899
+ function Pt(t = 30) {
2872
2900
  return ue({
2873
2901
  queryKey: [se, "analytics", t],
2874
2902
  queryFn: () => k.getAnalytics(t)
2875
2903
  });
2876
2904
  }
2877
- function Pt() {
2905
+ function Jt() {
2878
2906
  return ue({
2879
2907
  queryKey: [se, "admins"],
2880
2908
  queryFn: () => k.listAdmins()
@@ -2935,9 +2963,9 @@ function Kt() {
2935
2963
  }
2936
2964
  export {
2937
2965
  Ft as AdminPanel,
2938
- Pt as useAdminAdmins,
2966
+ Jt as useAdminAdmins,
2939
2967
  Ht as useAdminAdminsMutations,
2940
- Jt as useAdminAnalytics,
2968
+ Pt as useAdminAnalytics,
2941
2969
  Kt as useAdminAuth,
2942
2970
  Wt as useAdminJobs,
2943
2971
  Gt as useAdminJobsMutations,