gentiq 0.7.26 → 0.7.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,35 @@
1
- import { jsx as e, jsxs as n, Fragment as Ne } from "react/jsx-runtime";
2
- import * as Z from "react";
3
- import { useState as C, useMemo as j, useEffect as $, useRef as ee, useCallback as J, useLayoutEffect as Ve } from "react";
4
- import { QueryClient as We, QueryClientProvider as Xe, useQueryClient as pe, useQuery as Je, useInfiniteQuery as Ye } from "@tanstack/react-query";
5
- import { I18nextProvider as Ze, useTranslation as le } from "react-i18next";
6
- import { Trans as Xa, Translation as Ja, useTranslation as Ya, withTranslation as Za } from "react-i18next";
7
- import { g as et, u as T, d as tt, C as ze, T as at, a as te, b as Re, j as fe, G as rt, c as ie, e as g, f as qe, h as Fe, i as Oe, k as je, B as Y, l as $e, m as he, D as Be, n as nt, o as Ue, L as Q, I as G, S as be, p as ve, q as xe, r as ye, s as me, t as st, v as Se, w as ot, x as it, y as lt, z as de, A as ct, E as dt, F as ut, H as mt, J as ht, K as pt } from "./checkbox-D3JJhc0K.js";
8
- import { M as tr, N as ar, P as rr, O as nr, R as sr, Q as or, U as ir, V as lr, W as cr, X as dr, Y as ur, Z as mr, _ as hr } from "./checkbox-D3JJhc0K.js";
9
- import { Loader2Icon as gt, OctagonXIcon as ft, TriangleAlertIcon as bt, InfoIcon as vt, CircleCheckIcon as xt, XIcon as yt, PanelLeftIcon as wt, Layers as Pe, User as Nt, ShieldCheck as kt, Settings as we, Smartphone as Ct, Lock as _t, Save as St, Sun as Pt, Moon as Mt, Monitor as Tt, Zap as Me, Globe as It, Coins as Dt, LogOut as Et, CirclePlus as Lt, Plus as At, Search as zt, Check as Rt, X as qt, Pin as Te, MoreVertical as Ft, PinOff as Ot, Share2 as jt, Pencil as $t, Trash as Bt } from "lucide-react";
10
- import { useTheme as Ut } from "next-themes";
11
- import { Toaster as Kt, toast as X } from "sonner";
12
- import { useChat as Ht } from "@ai-sdk/react";
13
- import { DefaultChatTransport as Qt } from "ai";
14
- import { useLocation as Ke, useNavigate as ke, Navigate as Gt, useParams as Vt } from "react-router-dom";
1
+ import { jsx as e, jsxs as r, Fragment as ke } from "react/jsx-runtime";
2
+ import * as ae from "react";
3
+ import { useState as _, useMemo as O, useEffect as $, useRef as ee, useCallback as Y, useLayoutEffect as Xe } from "react";
4
+ import { QueryClient as Je, QueryClientProvider as Ye, useQueryClient as pe, useQuery as Ze, useInfiniteQuery as et } from "@tanstack/react-query";
5
+ import { I18nextProvider as tt, useTranslation as ce } from "react-i18next";
6
+ import { Trans as Ya, Translation as Za, useTranslation as er, withTranslation as tr } from "react-i18next";
7
+ import { g as at, u as M, d as rt, C as qe, T as nt, a as te, b as Fe, j as be, G as st, c as le, e as f, f as ot, h as je, i as Oe, k as $e, l as Be, B as Z, m as Ue, n as he, D as Ke, o as it, p as He, L as Q, I as V, S as ve, q as xe, r as ye, s as we, t as me, v as lt, w as Pe, x as ct, y as dt, z as ut, A as de, E as mt, F as ht, H as pt, J as gt, K as ft, M as bt } from "./checkbox-plYm_Rxp.js";
8
+ import { N as rr, O as nr, P as sr, Q as or, R as ir, U as lr, V as cr, W as dr, X as ur, Y as mr, Z as hr, _ as pr, $ as gr } from "./checkbox-plYm_Rxp.js";
9
+ import { Loader2Icon as vt, OctagonXIcon as xt, TriangleAlertIcon as yt, InfoIcon as wt, CircleCheckIcon as Nt, XIcon as kt, PanelLeftIcon as Ct, Layers as Me, User as _t, ShieldCheck as St, Settings as Ne, Smartphone as Pt, Lock as Mt, Save as Tt, Sun as Dt, Moon as It, Monitor as Et, Zap as Te, Globe as Lt, Coins as At, LogOut as zt, CirclePlus as Rt, Plus as qt, Search as Ft, Check as jt, X as Ot, Pin as De, MoreVertical as $t, PinOff as Bt, Share2 as Ut, Pencil as Kt, Trash as Ht } from "lucide-react";
10
+ import { useTheme as Qt } from "next-themes";
11
+ import { Toaster as Gt, toast as J } from "sonner";
12
+ import { useChat as Vt } from "@ai-sdk/react";
13
+ import { DefaultChatTransport as Wt } from "ai";
14
+ import { useLocation as Qe, useNavigate as Ce, Navigate as Xt, useParams as Jt } from "react-router-dom";
15
15
  import { nanoid as ue } from "nanoid";
16
- import { Slot as Wt } from "@radix-ui/react-slot";
17
- import { cva as Xt } from "class-variance-authority";
16
+ import { Slot as Yt } from "@radix-ui/react-slot";
17
+ import { cva as Zt } from "class-variance-authority";
18
18
  import "@radix-ui/react-separator";
19
- import * as re from "@radix-ui/react-dialog";
20
- const Jt = ({ ...r }) => {
21
- const { theme: t = "system" } = Ut();
19
+ import * as ne from "@radix-ui/react-dialog";
20
+ const ea = ({ ...a }) => {
21
+ const { theme: t = "system" } = Qt();
22
22
  return /* @__PURE__ */ e(
23
- Kt,
23
+ Gt,
24
24
  {
25
25
  theme: t,
26
26
  className: "toaster group",
27
27
  icons: {
28
- success: /* @__PURE__ */ e(xt, { className: "size-4" }),
29
- info: /* @__PURE__ */ e(vt, { className: "size-4" }),
30
- warning: /* @__PURE__ */ e(bt, { className: "size-4" }),
31
- error: /* @__PURE__ */ e(ft, { className: "size-4" }),
32
- loading: /* @__PURE__ */ e(gt, { className: "size-4 animate-spin" })
28
+ success: /* @__PURE__ */ e(Nt, { className: "size-4" }),
29
+ info: /* @__PURE__ */ e(wt, { className: "size-4" }),
30
+ warning: /* @__PURE__ */ e(yt, { className: "size-4" }),
31
+ error: /* @__PURE__ */ e(xt, { className: "size-4" }),
32
+ loading: /* @__PURE__ */ e(vt, { className: "size-4 animate-spin" })
33
33
  },
34
34
  style: {
35
35
  "--normal-bg": "var(--popover)",
@@ -37,107 +37,107 @@ const Jt = ({ ...r }) => {
37
37
  "--normal-border": "var(--border)",
38
38
  "--border-radius": "var(--radius)"
39
39
  },
40
- ...r
40
+ ...a
41
41
  }
42
42
  );
43
43
  };
44
- function Ua({
45
- children: r,
44
+ function Ha({
45
+ children: a,
46
46
  api: t,
47
- app: o,
48
- i18n: d,
49
- components: i,
50
- history: c,
51
- welcome: m,
47
+ app: i,
48
+ i18n: u,
49
+ components: l,
50
+ history: d,
51
+ welcome: h,
52
52
  threadActions: p,
53
- composer: u,
54
- theme: w,
55
- disclaimer: b,
56
- settings: v
53
+ composer: m,
54
+ theme: N,
55
+ disclaimer: v,
56
+ settings: y
57
57
  }) {
58
- const [l, S] = C(null), _ = j(
59
- () => d?.instance ?? et,
58
+ const [c, P] = _(null), S = O(
59
+ () => u?.instance ?? at,
60
60
  // eslint-disable-next-line react-hooks/exhaustive-deps
61
- [d?.instance]
62
- ), q = t || {};
61
+ [u?.instance]
62
+ ), z = t || {};
63
63
  $(() => {
64
- T.getAppConfig().then((s) => S(s)).catch((s) => console.debug("Gentiq: No dynamic settings available or fetch failed", s));
64
+ M.getAppConfig().then((n) => P(n)).catch((n) => console.debug("Gentiq: No dynamic settings available or fetch failed", n));
65
65
  }, []), $(() => {
66
- l?.app_name && (document.title = _.t(l.app_name));
67
- }, [l, _]);
68
- const O = j(() => {
69
- const s = {
66
+ c?.app_name && (document.title = S.t(c.app_name));
67
+ }, [c, S]);
68
+ const B = O(() => {
69
+ const n = {
70
70
  basePath: "/",
71
71
  cacheNamespace: "gentiq",
72
- ...o
72
+ ...i
73
73
  };
74
- return l ? {
75
- ...s,
76
- name: (l.app_name ? _.t(l.app_name) : null) || s.name,
77
- adminTitle: (l.admin_title ? _.t(l.admin_title) : null) || s.adminTitle,
78
- showSettings: l.show_settings ?? s.showSettings,
79
- showToolDetails: l.show_tool_details ?? s.showToolDetails,
80
- settingsGeneralMode: l.settings_general_mode || s.settingsGeneralMode,
81
- settingsProfileMode: l.settings_profile_mode || s.settingsProfileMode,
82
- settingsAccountMode: l.settings_account_mode || s.settingsAccountMode
83
- } : s;
84
- }, [o, l, _]), P = j(() => l ? {
85
- ...m,
86
- greeting: l.welcome_greeting || m?.greeting,
87
- subtitle: l.welcome_subtitle || m?.subtitle
88
- } : m, [m, l]), y = j(() => {
89
- const s = l?.disclaimer || b;
90
- return s && _.t(s);
91
- }, [b, l, _]), h = j(() => l ? {
92
- ...c,
93
- enabled: l.history_enabled ?? c?.enabled,
94
- showDelete: l.history_show_delete ?? c?.showDelete,
95
- showRename: l.history_show_rename ?? c?.showRename,
96
- showShare: l.history_show_share ?? c?.showShare,
97
- showPin: l.history_show_pin ?? c?.showPin
98
- } : c, [c, l]), E = j(() => l ? {
74
+ return c ? {
75
+ ...n,
76
+ name: (c.app_name ? S.t(c.app_name) : null) || n.name,
77
+ adminTitle: (c.admin_title ? S.t(c.admin_title) : null) || n.adminTitle,
78
+ showSettings: c.show_settings ?? n.showSettings,
79
+ showToolDetails: c.show_tool_details ?? n.showToolDetails,
80
+ settingsGeneralMode: c.settings_general_mode || n.settingsGeneralMode,
81
+ settingsProfileMode: c.settings_profile_mode || n.settingsProfileMode,
82
+ settingsAccountMode: c.settings_account_mode || n.settingsAccountMode
83
+ } : n;
84
+ }, [i, c, S]), C = O(() => c ? {
85
+ ...h,
86
+ greeting: c.welcome_greeting || h?.greeting,
87
+ subtitle: c.welcome_subtitle || h?.subtitle
88
+ } : h, [h, c]), x = O(() => {
89
+ const n = c?.disclaimer || v;
90
+ return n && S.t(n);
91
+ }, [v, c, S]), g = O(() => c ? {
92
+ ...d,
93
+ enabled: c.history_enabled ?? d?.enabled,
94
+ showDelete: c.history_show_delete ?? d?.showDelete,
95
+ showRename: c.history_show_rename ?? d?.showRename,
96
+ showShare: c.history_show_share ?? d?.showShare,
97
+ showPin: c.history_show_pin ?? d?.showPin
98
+ } : d, [d, c]), L = O(() => c ? {
99
99
  ...p,
100
- feedback: l.thread_actions_feedback ?? p?.feedback,
101
- retry: l.thread_actions_retry ?? p?.retry
102
- } : p, [p, l]), z = j(() => l ? {
103
- ...u,
100
+ feedback: c.thread_actions_feedback ?? p?.feedback,
101
+ retry: c.thread_actions_retry ?? p?.retry
102
+ } : p, [p, c]), q = O(() => c ? {
103
+ ...m,
104
104
  attachments: {
105
- ...u?.attachments,
106
- enabled: l.composer_attachments ?? u?.attachments?.enabled
105
+ ...m?.attachments,
106
+ enabled: c.composer_attachments ?? m?.attachments?.enabled
107
107
  }
108
- } : u, [u, l]), I = j(() => l ? {
109
- ...v,
108
+ } : m, [m, c]), D = O(() => c ? {
109
+ ...y,
110
110
  sections: {
111
- ...v?.sections,
111
+ ...y?.sections,
112
112
  general: {
113
- ...v?.sections?.general,
114
- mode: l.settings_general_mode || v?.sections?.general?.mode,
115
- enabled: v?.sections?.general?.enabled ?? !0,
113
+ ...y?.sections?.general,
114
+ mode: c.settings_general_mode || y?.sections?.general?.mode,
115
+ enabled: y?.sections?.general?.enabled ?? !0,
116
116
  fields: {
117
- ...v?.sections?.general?.fields,
118
- ...l.settings_general_fields
117
+ ...y?.sections?.general?.fields,
118
+ ...c.settings_general_fields
119
119
  }
120
120
  },
121
121
  profile: {
122
- ...v?.sections?.profile,
123
- mode: l.settings_profile_mode || v?.sections?.profile?.mode,
124
- enabled: v?.sections?.profile?.enabled ?? !0,
122
+ ...y?.sections?.profile,
123
+ mode: c.settings_profile_mode || y?.sections?.profile?.mode,
124
+ enabled: y?.sections?.profile?.enabled ?? !0,
125
125
  fields: {
126
- ...v?.sections?.profile?.fields,
127
- ...l.settings_profile_fields
126
+ ...y?.sections?.profile?.fields,
127
+ ...c.settings_profile_fields
128
128
  }
129
129
  },
130
130
  account: {
131
- ...v?.sections?.account,
132
- mode: l.settings_account_mode || v?.sections?.account?.mode,
133
- enabled: v?.sections?.account?.enabled ?? !0,
131
+ ...y?.sections?.account,
132
+ mode: c.settings_account_mode || y?.sections?.account?.mode,
133
+ enabled: y?.sections?.account?.enabled ?? !0,
134
134
  fields: {
135
- ...v?.sections?.account?.fields,
136
- ...l.settings_account_fields
135
+ ...y?.sections?.account?.fields,
136
+ ...c.settings_account_fields
137
137
  }
138
138
  }
139
139
  }
140
- } : v, [v, l]), H = j(() => new We({
140
+ } : y, [y, c]), j = O(() => new Je({
141
141
  defaultOptions: {
142
142
  queries: {
143
143
  staleTime: 5e3,
@@ -146,354 +146,343 @@ function Ua({
146
146
  }
147
147
  }), []);
148
148
  $(() => {
149
- T.init({
150
- api: q,
151
- app: O
149
+ M.init({
150
+ api: z,
151
+ app: B
152
152
  });
153
- }, [O]);
154
- const B = ee(null), F = d?.resources;
155
- F !== B.current && (B.current = F, F && Object.entries(F).forEach(([s, x]) => {
156
- Object.entries(x).forEach(([D, A]) => {
157
- _.addResourceBundle(s, D, A, !0, !0);
153
+ }, [B]);
154
+ const U = ee(null), A = u?.resources;
155
+ A !== U.current && (U.current = A, A && Object.entries(A).forEach(([n, w]) => {
156
+ Object.entries(w).forEach(([T, I]) => {
157
+ S.addResourceBundle(n, T, I, !0, !0);
158
158
  });
159
159
  }));
160
- const L = ee(null), U = l?.translations;
161
- U && U !== L.current && (L.current = U, Object.entries(U).forEach(([s, x]) => {
162
- Object.entries(x).forEach(([D, A]) => {
163
- _.addResourceBundle(s, D, A, !0, !0);
160
+ const E = ee(null), G = c?.translations;
161
+ G && G !== E.current && (E.current = G, Object.entries(G).forEach(([n, w]) => {
162
+ Object.entries(w).forEach(([T, I]) => {
163
+ S.addResourceBundle(n, T, I, !0, !0);
164
164
  });
165
165
  }));
166
- const K = ee(null), f = d?.instance;
167
- return f && f !== K.current && (K.current = f, Object.entries(tt).forEach(([s, x]) => {
168
- Object.entries(x).forEach(([D, A]) => {
169
- f.hasResourceBundle(s, D) || f.addResourceBundle(s, D, A, !0, !1);
166
+ const K = ee(null), b = u?.instance;
167
+ return b && b !== K.current && (K.current = b, Object.entries(rt).forEach(([n, w]) => {
168
+ Object.entries(w).forEach(([T, I]) => {
169
+ b.hasResourceBundle(n, T) || b.addResourceBundle(n, T, I, !0, !1);
170
170
  });
171
- })), /* @__PURE__ */ e(Ze, { i18n: _, children: /* @__PURE__ */ n(Xe, { client: H, children: [
172
- /* @__PURE__ */ n(
173
- ze,
171
+ })), /* @__PURE__ */ e(tt, { i18n: S, children: /* @__PURE__ */ r(Ye, { client: j, children: [
172
+ /* @__PURE__ */ r(
173
+ qe,
174
174
  {
175
- components: i,
176
- history: h,
177
- welcome: P,
178
- threadActions: E,
179
- composer: z,
180
- theme: w,
181
- disclaimer: y,
182
- app: O,
183
- i18n: d,
184
- settings: I,
175
+ components: l,
176
+ history: g,
177
+ welcome: C,
178
+ threadActions: L,
179
+ composer: q,
180
+ theme: N,
181
+ disclaimer: x,
182
+ app: B,
183
+ i18n: u,
184
+ settings: D,
185
185
  children: [
186
- /* @__PURE__ */ e(Yt, {}),
187
- /* @__PURE__ */ e(at, { defaultTheme: "system", storageKey: "chatbot-theme", config: w, children: r })
186
+ /* @__PURE__ */ e(ta, {}),
187
+ /* @__PURE__ */ e(nt, { defaultTheme: "system", storageKey: "chatbot-theme", config: N, children: a })
188
188
  ]
189
189
  }
190
190
  ),
191
- /* @__PURE__ */ e(Jt, { richColors: !0 })
191
+ /* @__PURE__ */ e(ea, { richColors: !0 })
192
192
  ] }) });
193
193
  }
194
- function Yt() {
195
- const { app: r } = te();
196
- return Re(), $(() => {
197
- r?.name && (document.title = r.name);
198
- }, [r?.name]), $(() => {
199
- if (!r?.favicon) return;
194
+ function ta() {
195
+ const { app: a } = te();
196
+ return Fe(), $(() => {
197
+ a?.name && (document.title = a.name);
198
+ }, [a?.name]), $(() => {
199
+ if (!a?.favicon) return;
200
200
  let t = document.querySelector("link[rel~='icon']");
201
- t || (t = document.createElement("link"), t.rel = "icon", document.head.appendChild(t)), t.href = r.favicon;
202
- }, [r?.favicon]), null;
201
+ t || (t = document.createElement("link"), t.rel = "icon", document.head.appendChild(t)), t.href = a.favicon;
202
+ }, [a?.favicon]), null;
203
203
  }
204
- function Ce() {
205
- const r = Ke(), t = ke(), d = T.getConfig().app?.basePath || "/", i = j(() => {
206
- const m = r.pathname, p = m.endsWith("/") && m !== "/" ? m.slice(0, -1) : m, u = d.endsWith("/") && d !== "/" ? d.slice(0, -1) : d;
207
- if (p === (u || "/")) return "/";
208
- if (m.startsWith(u) && u !== "/") {
209
- let w = m.slice(u.length);
210
- return w.startsWith("/") || (w = "/" + w), w;
204
+ function _e() {
205
+ const a = Qe(), t = Ce(), u = M.getConfig().app?.basePath || "/", l = O(() => {
206
+ const h = a.pathname, p = h.endsWith("/") && h !== "/" ? h.slice(0, -1) : h, m = u.endsWith("/") && u !== "/" ? u.slice(0, -1) : u;
207
+ if (p === (m || "/")) return "/";
208
+ if (h.startsWith(m) && m !== "/") {
209
+ let N = h.slice(m.length);
210
+ return N.startsWith("/") || (N = "/" + N), N;
211
211
  }
212
- return u === "/" ? m : "/";
213
- }, [r.pathname, d]), c = J((m) => {
214
- t(fe(d, m || "/"), { replace: !1 });
215
- }, [t, d]);
216
- return [i, c];
212
+ return m === "/" ? h : "/";
213
+ }, [a.pathname, u]), d = Y((h) => {
214
+ t(be(u, h || "/"), { replace: !1 });
215
+ }, [t, u]);
216
+ return [l, d];
217
217
  }
218
- function Zt({ onFinish: r } = {}) {
219
- const { t } = le(["chat", "errors"]), o = pe(), d = T.getConfig(), i = d.app?.cacheNamespace || "gentiq", [c, m] = Ce(), [p, u] = C(() => ue()), w = ee(/* @__PURE__ */ new Set());
218
+ function aa({ onFinish: a } = {}) {
219
+ const { t } = ce(["chat", "errors"]), i = pe(), u = M.getConfig(), l = u.app?.cacheNamespace || "gentiq", [d, h] = _e(), [p, m] = _(() => ue()), N = ee(/* @__PURE__ */ new Set());
220
220
  $(() => {
221
- c === "/" ? u(ue()) : p && c !== `/${p}` && u(ue());
222
- }, [c]);
223
- const b = j(() => c === "/" ? p : c.replace(/^\//, ""), [c, p]), v = J((f) => (w.current.add(f), f), []), l = J(() => {
224
- w.current.forEach((f) => URL.revokeObjectURL(f)), w.current.clear();
221
+ d === "/" ? m(ue()) : p && d !== `/${p}` && m(ue());
222
+ }, [d]);
223
+ const v = O(() => d === "/" ? p : d.replace(/^\//, ""), [d, p]), y = Y((b) => (N.current.add(b), b), []), c = Y(() => {
224
+ N.current.forEach((b) => URL.revokeObjectURL(b)), N.current.clear();
225
225
  }, []);
226
- $(() => () => l(), [l]);
226
+ $(() => () => c(), [c]);
227
227
  const {
228
- data: S,
229
- isLoading: _,
230
- isError: q
231
- } = Je({
232
- queryKey: [i, "threadMessages", b],
228
+ data: P,
229
+ isLoading: S,
230
+ isError: z
231
+ } = Ze({
232
+ queryKey: [l, "threadMessages", v],
233
233
  queryFn: async () => {
234
- if (c === "/") return [];
235
- if (c === `/${p}`) return [];
236
- const f = await T.getThreadMessages(b);
237
- return !f.items || !Array.isArray(f.items) ? [] : Promise.all(
238
- f.items.map(async (s) => {
239
- const x = typeof s.content == "string" ? s.content : s.content?.text || JSON.stringify(s.content), A = [...Array.isArray(s.parts) && s.parts.length > 0 ? s.parts : [{ type: "text", text: x }]].sort((N, R) => N.type === "file" && R.type !== "file" ? -1 : N.type !== "file" && R.type === "file" ? 1 : 0), V = await Promise.all(
240
- A.map(async (N) => {
241
- if (N.type === "file" && N.object_name && !N.url)
234
+ if (d === "/") return [];
235
+ if (d === `/${p}`) return [];
236
+ const b = await M.getThreadMessages(v);
237
+ return !b.items || !Array.isArray(b.items) ? [] : Promise.all(
238
+ b.items.map(async (n) => {
239
+ const w = typeof n.content == "string" ? n.content : n.content?.text || JSON.stringify(n.content), I = [...Array.isArray(n.parts) && n.parts.length > 0 ? n.parts : [{ type: "text", text: w }]].sort((k, R) => k.type === "file" && R.type !== "file" ? -1 : k.type !== "file" && R.type === "file" ? 1 : 0), W = await Promise.all(
240
+ I.map(async (k) => {
241
+ if (k.type === "file" && k.object_name && !k.url)
242
242
  try {
243
- const R = await T.getAttachmentBlobUrl(N.object_name);
244
- return { ...N, url: v(R), mediaType: N.mediaType || N.media_type };
243
+ const R = await M.getAttachmentBlobUrl(k.object_name);
244
+ return { ...k, url: y(R), mediaType: k.mediaType || k.media_type };
245
245
  } catch (R) {
246
- return console.warn("Load attachment failed:", N.object_name, R), { ...N, mediaType: N.mediaType || N.media_type };
246
+ return console.warn("Load attachment failed:", k.object_name, R), { ...k, mediaType: k.mediaType || k.media_type };
247
247
  }
248
- return N;
248
+ return k;
249
249
  })
250
250
  );
251
251
  return {
252
- id: s.id || ue(),
253
- role: s.role,
254
- parts: V,
255
- metadata: { feedback: s.feedback }
252
+ id: n.id || ue(),
253
+ role: n.role,
254
+ parts: W,
255
+ metadata: { feedback: n.feedback }
256
256
  };
257
257
  })
258
258
  );
259
259
  },
260
- enabled: c !== "/",
260
+ enabled: d !== "/",
261
261
  staleTime: 5e3
262
262
  // Keep history fresh for 5 seconds
263
- }), O = j(() => new Qt({
264
- api: T.getEndpoint("chat", "/chat"),
265
- fetch: async (f, s) => {
266
- const x = new Headers(s?.headers), D = T.getHeaders();
267
- Object.entries(D).forEach(([R, W]) => {
268
- x.set(R, W);
269
- }), x.set("X-Thread-Id", b);
270
- const A = d.api?.basePath || "/api", V = typeof f == "string" && !f.startsWith("http") ? `${A}${f.startsWith("/") ? f : "/" + f}` : f, N = await fetch(V, { ...s, headers: x });
271
- if (!N.ok) {
272
- const R = await N.json().catch(() => ({}));
263
+ }), B = O(() => new Wt({
264
+ api: M.getEndpoint("chat", "/chat"),
265
+ fetch: async (b, n) => {
266
+ const w = new Headers(n?.headers), T = M.getHeaders();
267
+ Object.entries(T).forEach(([R, X]) => {
268
+ w.set(R, X);
269
+ }), w.set("X-Thread-Id", v);
270
+ const I = u.api?.basePath || "/api", W = typeof b == "string" && !b.startsWith("http") ? `${I}${b.startsWith("/") ? b : "/" + b}` : b, k = await fetch(W, { ...n, headers: w });
271
+ if (!k.ok) {
272
+ const R = await k.json().catch(() => ({}));
273
273
  if (R.error && (R.error.code || R.error.message))
274
- throw new rt(R, N.status);
275
- const W = R.error || R.message || N.statusText;
276
- throw new Error(`${N.status}: ${W}`);
274
+ throw new st(R, k.status);
275
+ const X = R.error || R.message || k.statusText;
276
+ throw new Error(`${k.status}: ${X}`);
277
277
  }
278
- return N;
278
+ return k;
279
279
  }
280
- }), [b, d.api?.basePath]), P = J(() => {
281
- E("ready"), o.invalidateQueries({ queryKey: [i, "conversations"] }), r?.();
282
- }, [o, r, i]), y = Ht({
283
- id: b,
284
- onFinish: P,
285
- transport: O
286
- }), [h, E] = C("idle"), [z, I] = C(null), H = J(() => {
287
- I(null);
280
+ }), [v, u.api?.basePath]), C = Y(() => {
281
+ L("ready"), i.invalidateQueries({ queryKey: [l, "conversations"] }), a?.();
282
+ }, [i, a, l]), x = Vt({
283
+ id: v,
284
+ onFinish: C,
285
+ transport: B
286
+ }), [g, L] = _("idle"), [q, D] = _(null), j = Y(() => {
287
+ D(null);
288
288
  }, []);
289
289
  $(() => {
290
- S && (c === `/${p}` || (y.setMessages(S), E("ready")));
291
- }, [S, y.setMessages, c, p]), $(() => {
292
- c === "/" && (y.setMessages([]), E("idle"));
293
- }, [c, y.setMessages]), $(() => {
294
- if (c === "/") {
295
- E("idle");
290
+ P && (d === `/${p}` || (x.setMessages(P), L("ready")));
291
+ }, [P, x.setMessages, d, p]), $(() => {
292
+ d === "/" && (x.setMessages([]), L("idle"));
293
+ }, [d, x.setMessages]), $(() => {
294
+ if (d === "/") {
295
+ L("idle");
296
296
  return;
297
297
  }
298
- const f = c === `/${p}`;
299
- _ && !f ? E("loading-history") : q || z || y.error ? E("error") : y.status === "streaming" || y.status === "submitted" ? E(y.status) : E("ready");
300
- }, [_, q, y.status, z, y.error, c, p]), $(() => () => {
301
- y.stop();
302
- }, [b, y.stop]);
303
- const B = ee(/* @__PURE__ */ new Set()), F = j(() => y.messages.filter((f) => f.role === "assistant"), [y.messages]);
298
+ const b = d === `/${p}`;
299
+ S && !b ? L("loading-history") : z || q || x.error ? L("error") : x.status === "streaming" || x.status === "submitted" ? L(x.status) : L("ready");
300
+ }, [S, z, x.status, q, x.error, d, p]), $(() => () => {
301
+ x.stop();
302
+ }, [v, x.stop]);
303
+ const U = ee(/* @__PURE__ */ new Set()), A = O(() => x.messages.filter((b) => b.role === "assistant"), [x.messages]);
304
304
  $(() => {
305
- let f = !1;
306
- for (const s of F) {
307
- if (B.current.has(s.id)) continue;
308
- const x = s.parts.find((D) => D.type === "data-title");
309
- x && x.data?.[0]?.title && (B.current.add(s.id), f = !0);
305
+ let b = !1;
306
+ for (const n of A) {
307
+ if (U.current.has(n.id)) continue;
308
+ const w = n.parts.find((T) => T.type === "data-title");
309
+ w && w.data?.[0]?.title && (U.current.add(n.id), b = !0);
310
310
  }
311
- f && o.invalidateQueries({ queryKey: [i, "conversations"] });
312
- }, [F, o, i]);
313
- const L = J(async (f, s) => {
314
- const x = c === "/", D = f.trim();
315
- if (!(!D && (!s || s.length === 0)) && !(h === "loading-history" || h === "streaming" || h === "submitted")) {
316
- if (y.stop(), x) {
317
- m(`/${b}`);
318
- const A = D || t("attach_file"), V = A.length > 30 ? A.slice(0, 30) + "..." : A;
319
- o.setQueryData([i, "conversations"], (N) => {
320
- const R = { id: `/${b}`, firstMessage: V, timestamp: Date.now() };
321
- return N && Array.isArray(N.pages) ? {
322
- ...N,
323
- pages: N.pages.map((W, ce) => ce === 0 ? {
324
- ...W,
325
- threads: [R, ...W.threads || []]
326
- } : W)
327
- } : [R, ...Array.isArray(N) ? N : []];
311
+ b && i.invalidateQueries({ queryKey: [l, "conversations"] });
312
+ }, [A, i, l]);
313
+ const E = Y(async (b, n) => {
314
+ const w = d === "/", T = b.trim();
315
+ if (!(!T && (!n || n.length === 0)) && !(g === "loading-history" || g === "streaming" || g === "submitted")) {
316
+ if (x.stop(), w) {
317
+ h(`/${v}`);
318
+ const I = T || t("attach_file"), W = I.length > 30 ? I.slice(0, 30) + "..." : I;
319
+ i.setQueryData([l, "conversations"], (k) => {
320
+ const R = { id: `/${v}`, firstMessage: W, timestamp: Date.now() };
321
+ return k && Array.isArray(k.pages) ? {
322
+ ...k,
323
+ pages: k.pages.map((X, se) => se === 0 ? {
324
+ ...X,
325
+ threads: [R, ...X.threads || []]
326
+ } : X)
327
+ } : [R, ...Array.isArray(k) ? k : []];
328
328
  });
329
329
  }
330
- E("submitted"), I(null);
330
+ L("submitted"), D(null);
331
331
  try {
332
- await y.sendMessage({ text: D, files: s });
333
- } catch (A) {
334
- console.error("Failed to send message:", A);
335
- const V = ie(A, t);
336
- I(new Error(V)), E("error");
332
+ await x.sendMessage({ text: T, files: n });
333
+ } catch (I) {
334
+ console.error("Failed to send message:", I);
335
+ const W = le(I, t);
336
+ D(new Error(W)), L("error");
337
337
  }
338
338
  }
339
- }, [y, m, c, b, t, o, h, i]), U = J(() => {
340
- y.stop(), E("ready"), o.invalidateQueries({ queryKey: [i, "conversations"] });
341
- }, [y.stop, o, i]), K = j(() => {
342
- if (z) return z;
343
- if (y.error) {
344
- const f = ie(y.error, t);
345
- return new Error(f);
339
+ }, [x, h, d, v, t, i, g, l]), G = Y(() => {
340
+ x.stop(), L("ready"), i.invalidateQueries({ queryKey: [l, "conversations"] });
341
+ }, [x.stop, i, l]), K = O(() => {
342
+ if (q) return q;
343
+ if (x.error) {
344
+ const b = le(x.error, t);
345
+ return new Error(b);
346
346
  }
347
347
  return null;
348
- }, [z, y.error, t]);
349
- return j(() => ({
350
- ...y,
351
- sendMessage: L,
352
- stop: U,
353
- clearError: H,
348
+ }, [q, x.error, t]);
349
+ return O(() => ({
350
+ ...x,
351
+ sendMessage: E,
352
+ stop: G,
353
+ clearError: j,
354
354
  error: K,
355
- status: h,
355
+ status: g,
356
356
  // Cast to any to satisfy Chat.tsx expectations of AI SDK statuses
357
- isLoadingHistory: h === "loading-history",
358
- isErrorHistory: h === "error" || !!K || q,
359
- conversationId: c
360
- }), [y, L, U, H, K, h, q, c]);
357
+ isLoadingHistory: g === "loading-history",
358
+ isErrorHistory: g === "error" || !!K || z,
359
+ conversationId: d
360
+ }), [x, E, G, j, K, g, z, d]);
361
361
  }
362
- function ea({ classNames: r = {}, disclaimer: t }) {
363
- const { t: o, i18n: d } = le(["chat", "translation"]), i = Zt(), { messages: c, status: m, regenerate: p, error: u, clearError: w, stop: b, isLoadingHistory: v, conversationId: l, sendMessage: S } = i, { MessageList: _, PromptInput: q, disclaimer: O } = te(), P = t ?? O, y = d.exists("chat:disclaimer") ? o("chat:disclaimer") : null, h = typeof P == "string" ? o(P) : P ?? y, [E, z] = C(null), I = ee(m);
364
- Ve(() => {
365
- u && w();
366
- }, [l, w, u]);
367
- const H = c[c.length - 1], B = H?.role === "assistant" && (m === "ready" || H.parts.some((L) => L.type === "data-chat-finished"));
362
+ function ra({ classNames: a = {}, disclaimer: t }) {
363
+ const { t: i, i18n: u } = ce(["chat", "translation"]), l = aa(), { messages: d, status: h, regenerate: p, error: m, clearError: N, stop: v, isLoadingHistory: y, conversationId: c, sendMessage: P } = l, { MessageList: S, PromptInput: z, disclaimer: B } = te(), C = t ?? B, x = u.exists("chat:disclaimer") ? i("chat:disclaimer") : null, g = typeof C == "string" ? i(C) : C ?? x, [L, q] = _(null), D = ee(h);
364
+ Xe(() => {
365
+ m && N();
366
+ }, [c, N, m]);
367
+ const j = d[d.length - 1], U = j?.role === "assistant" && (h === "ready" || j.parts.some((E) => E.type === "data-chat-finished"));
368
368
  $(() => {
369
- m === "error" && I.current !== "error" && E !== l ? z(l) : m === "submitted" && E !== null && z(null), I.current = m;
370
- }, [m, l]);
371
- const F = m === "error" && (l === "/" || E === l);
372
- return /* @__PURE__ */ n("div", { className: g("relative flex flex-col h-full overflow-hidden", r.container), children: [
369
+ h === "error" && D.current !== "error" && L !== c ? q(c) : h === "submitted" && L !== null && q(null), D.current = h;
370
+ }, [h, c]);
371
+ const A = h === "error" && (c === "/" || L === c);
372
+ return /* @__PURE__ */ r("div", { className: f("relative flex flex-col h-full overflow-hidden", a.container), children: [
373
373
  /* @__PURE__ */ e(
374
- _,
374
+ S,
375
375
  {
376
- messages: c,
377
- status: m,
378
- isLoadingHistory: v,
379
- error: F ? u : null,
380
- conversationId: l,
381
- regen: (L) => p({ messageId: L }),
382
- onSuggestionClick: (L) => S(L),
383
- chat: i,
384
- className: g("flex-1", r.messageList)
376
+ messages: d,
377
+ status: h,
378
+ isLoadingHistory: y,
379
+ error: A ? m : null,
380
+ conversationId: c,
381
+ regen: (E) => p({ messageId: E }),
382
+ onSuggestionClick: (E) => P(E),
383
+ chat: l,
384
+ className: f("flex-1", a.messageList)
385
385
  }
386
386
  ),
387
- /* @__PURE__ */ n("div", { className: "absolute bottom-0 left-0 right-0 z-10 pointer-events-none flex flex-col items-stretch", children: [
387
+ /* @__PURE__ */ r("div", { className: "absolute bottom-0 left-0 right-0 z-10 pointer-events-none flex flex-col items-stretch", children: [
388
388
  /* @__PURE__ */ e(
389
- q,
389
+ z,
390
390
  {
391
- onSend: S,
392
- status: m,
393
- isLastMessageFinished: B,
394
- stop: b,
395
- isErrorVisible: F,
396
- conversationId: l,
397
- className: g("pointer-events-auto", r.inputArea, h && "pb-0 md:pb-0")
391
+ onSend: P,
392
+ status: h,
393
+ isLastMessageFinished: U,
394
+ stop: v,
395
+ isErrorVisible: A,
396
+ conversationId: c,
397
+ className: f("pointer-events-auto", a.inputArea, g && "pb-0 md:pb-0")
398
398
  }
399
399
  ),
400
- h && /* @__PURE__ */ n("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
400
+ g && /* @__PURE__ */ r("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
401
401
  /* @__PURE__ */ e("div", { className: "absolute inset-x-0 bottom-0 top-[-20px] bg-background/80 backdrop-blur-sm [mask-image:linear-gradient(to_top,black_60%,transparent)] pointer-events-none -z-10" }),
402
- /* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children: h })
402
+ /* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children: g })
403
403
  ] })
404
404
  ] })
405
405
  ] });
406
406
  }
407
- const ta = ({
408
- components: r,
407
+ const na = ({
408
+ components: a,
409
409
  history: t,
410
- welcome: o,
411
- threadActions: d,
412
- composer: i,
413
- theme: c,
414
- disclaimer: m,
410
+ welcome: i,
411
+ threadActions: u,
412
+ composer: l,
413
+ theme: d,
414
+ disclaimer: h,
415
415
  ...p
416
416
  }) => {
417
- const u = te(), w = j(() => ({
418
- ...u,
419
- ...r,
417
+ const m = te(), N = O(() => ({
418
+ ...m,
419
+ ...a,
420
420
  toolComponents: {
421
- ...u.toolComponents,
422
- ...r?.toolComponents
421
+ ...m.toolComponents,
422
+ ...a?.toolComponents
423
423
  }
424
- }), [u, r]);
424
+ }), [m, a]);
425
425
  return /* @__PURE__ */ e(
426
- ze,
426
+ qe,
427
427
  {
428
- components: w,
429
- history: t ?? u.history,
430
- welcome: o ?? u.welcome,
431
- threadActions: d ?? u.threadActions,
432
- composer: i ?? u.composer,
433
- theme: c ?? u.theme,
434
- disclaimer: m ?? u.disclaimer,
435
- app: u.app,
436
- i18n: u.i18n,
437
- settings: u.settings,
438
- children: /* @__PURE__ */ e(ea, { ...p })
428
+ components: N,
429
+ history: t ?? m.history,
430
+ welcome: i ?? m.welcome,
431
+ threadActions: u ?? m.threadActions,
432
+ composer: l ?? m.composer,
433
+ theme: d ?? m.theme,
434
+ disclaimer: h ?? m.disclaimer,
435
+ app: m.app,
436
+ i18n: m.i18n,
437
+ settings: m.settings,
438
+ children: /* @__PURE__ */ e(ra, { ...p })
439
439
  }
440
440
  );
441
- }, ge = 768;
442
- function aa() {
443
- const [r, t] = Z.useState(void 0);
444
- return Z.useEffect(() => {
445
- const o = window.matchMedia(`(max-width: ${ge - 1}px)`), d = () => {
446
- t(window.innerWidth < ge);
447
- };
448
- return o.addEventListener("change", d), t(window.innerWidth < ge), () => {
449
- o.removeEventListener("change", d);
450
- };
451
- }, []), !!r;
452
- }
453
- function ra({ ...r }) {
454
- return /* @__PURE__ */ e(re.Root, { "data-slot": "sheet", ...r });
441
+ };
442
+ function sa({ ...a }) {
443
+ return /* @__PURE__ */ e(ne.Root, { "data-slot": "sheet", ...a });
455
444
  }
456
- function na({ ...r }) {
457
- return /* @__PURE__ */ e(re.Portal, { "data-slot": "sheet-portal", ...r });
445
+ function oa({ ...a }) {
446
+ return /* @__PURE__ */ e(ne.Portal, { "data-slot": "sheet-portal", ...a });
458
447
  }
459
- function sa({ className: r, ...t }) {
448
+ function ia({ className: a, ...t }) {
460
449
  return /* @__PURE__ */ e(
461
- re.Overlay,
450
+ ne.Overlay,
462
451
  {
463
452
  "data-slot": "sheet-overlay",
464
- className: g(
453
+ className: f(
465
454
  "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
466
- r
455
+ a
467
456
  ),
468
457
  ...t
469
458
  }
470
459
  );
471
460
  }
472
- function oa({
473
- className: r,
461
+ function la({
462
+ className: a,
474
463
  children: t,
475
- side: o = "right",
476
- ...d
464
+ side: i = "right",
465
+ ...u
477
466
  }) {
478
- return /* @__PURE__ */ n(na, { children: [
479
- /* @__PURE__ */ e(sa, {}),
480
- /* @__PURE__ */ n(
481
- re.Content,
467
+ return /* @__PURE__ */ r(oa, { children: [
468
+ /* @__PURE__ */ e(ia, {}),
469
+ /* @__PURE__ */ r(
470
+ ne.Content,
482
471
  {
483
472
  "data-slot": "sheet-content",
484
- className: g(
473
+ className: f(
485
474
  "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
486
- o === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
487
- o === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
488
- o === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
489
- o === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
490
- r
475
+ i === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
476
+ i === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
477
+ i === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
478
+ i === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
479
+ a
491
480
  ),
492
- ...d,
481
+ ...u,
493
482
  children: [
494
483
  t,
495
- /* @__PURE__ */ n(re.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
496
- /* @__PURE__ */ e(yt, { className: "size-4" }),
484
+ /* @__PURE__ */ r(ne.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
485
+ /* @__PURE__ */ e(kt, { className: "size-4" }),
497
486
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
498
487
  ] })
499
488
  ]
@@ -501,141 +490,141 @@ function oa({
501
490
  )
502
491
  ] });
503
492
  }
504
- function ia({ className: r, ...t }) {
505
- return /* @__PURE__ */ e("div", { "data-slot": "sheet-header", className: g("flex flex-col gap-1.5 p-4", r), ...t });
493
+ function ca({ className: a, ...t }) {
494
+ return /* @__PURE__ */ e("div", { "data-slot": "sheet-header", className: f("flex flex-col gap-1.5 p-4", a), ...t });
506
495
  }
507
- function la({ className: r, ...t }) {
496
+ function da({ className: a, ...t }) {
508
497
  return /* @__PURE__ */ e(
509
- re.Title,
498
+ ne.Title,
510
499
  {
511
500
  "data-slot": "sheet-title",
512
- className: g("text-foreground font-semibold", r),
501
+ className: f("text-foreground font-semibold", a),
513
502
  ...t
514
503
  }
515
504
  );
516
505
  }
517
- function ca({ className: r, ...t }) {
506
+ function ua({ className: a, ...t }) {
518
507
  return /* @__PURE__ */ e(
519
- re.Description,
508
+ ne.Description,
520
509
  {
521
510
  "data-slot": "sheet-description",
522
- className: g("text-muted-foreground text-sm", r),
511
+ className: f("text-muted-foreground text-sm", a),
523
512
  ...t
524
513
  }
525
514
  );
526
515
  }
527
- const da = "sidebar_state", ua = 3600 * 24 * 7, ma = "19rem", ha = "18rem", pa = "3rem", ga = "b", He = Z.createContext(null);
528
- function _e() {
529
- const r = Z.useContext(He);
530
- if (!r)
516
+ const ma = "sidebar_state", ha = 3600 * 24 * 7, pa = "19rem", ga = "18rem", fa = "3rem", ba = "b", Ge = ae.createContext(null);
517
+ function ge() {
518
+ const a = ae.useContext(Ge);
519
+ if (!a)
531
520
  throw new Error("useSidebar must be used within a SidebarProvider.");
532
- return r;
521
+ return a;
533
522
  }
534
- function fa({
535
- defaultOpen: r = !0,
523
+ function va({
524
+ defaultOpen: a = !0,
536
525
  open: t,
537
- onOpenChange: o,
538
- className: d,
539
- style: i,
540
- children: c,
541
- ...m
526
+ onOpenChange: i,
527
+ className: u,
528
+ style: l,
529
+ children: d,
530
+ ...h
542
531
  }) {
543
- const p = aa(), [u, w] = Z.useState(!1), [b, v] = Z.useState(r), l = t ?? b, S = Z.useCallback(
544
- (P) => {
545
- const y = typeof P == "function" ? P(l) : P;
546
- o ? o(y) : v(y), document.cookie = `${da}=${y}; path=/; max-age=${ua}`;
532
+ const p = ot(), [m, N] = ae.useState(!1), [v, y] = ae.useState(a), c = t ?? v, P = ae.useCallback(
533
+ (C) => {
534
+ const x = typeof C == "function" ? C(c) : C;
535
+ i ? i(x) : y(x), document.cookie = `${ma}=${x}; path=/; max-age=${ha}`;
547
536
  },
548
- [o, l]
549
- ), _ = Z.useCallback(() => {
550
- p ? w((P) => !P) : S((P) => !P);
551
- }, [p, S, w]);
552
- Z.useEffect(() => {
553
- const P = (y) => {
554
- y.key === ga && (y.metaKey || y.ctrlKey) && (y.preventDefault(), _());
537
+ [i, c]
538
+ ), S = ae.useCallback(() => {
539
+ p ? N((C) => !C) : P((C) => !C);
540
+ }, [p, P, N]);
541
+ ae.useEffect(() => {
542
+ const C = (x) => {
543
+ x.key === ba && (x.metaKey || x.ctrlKey) && (x.preventDefault(), S());
555
544
  };
556
- return window.addEventListener("keydown", P), () => {
557
- window.removeEventListener("keydown", P);
545
+ return window.addEventListener("keydown", C), () => {
546
+ window.removeEventListener("keydown", C);
558
547
  };
559
- }, [_]);
560
- const q = l ? "expanded" : "collapsed", O = Z.useMemo(
548
+ }, [S]);
549
+ const z = c ? "expanded" : "collapsed", B = ae.useMemo(
561
550
  () => ({
562
- state: q,
563
- open: l,
564
- setOpen: S,
551
+ state: z,
552
+ open: c,
553
+ setOpen: P,
565
554
  isMobile: p,
566
- openMobile: u,
567
- setOpenMobile: w,
568
- toggleSidebar: _
555
+ openMobile: m,
556
+ setOpenMobile: N,
557
+ toggleSidebar: S
569
558
  }),
570
- [q, l, S, p, u, w, _]
559
+ [z, c, P, p, m, N, S]
571
560
  );
572
- return /* @__PURE__ */ e(He.Provider, { value: O, children: /* @__PURE__ */ e(qe, { delayDuration: 0, children: /* @__PURE__ */ e(
561
+ return /* @__PURE__ */ e(Ge.Provider, { value: B, children: /* @__PURE__ */ e(je, { delayDuration: 0, children: /* @__PURE__ */ e(
573
562
  "div",
574
563
  {
575
564
  "data-slot": "sidebar-wrapper",
576
565
  style: {
577
- "--sidebar-width": ma,
578
- "--sidebar-width-icon": pa,
579
- ...i
566
+ "--sidebar-width": pa,
567
+ "--sidebar-width-icon": fa,
568
+ ...l
580
569
  },
581
- className: g("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", d),
582
- ...m,
583
- children: c
570
+ className: f("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", u),
571
+ ...h,
572
+ children: d
584
573
  }
585
574
  ) }) });
586
575
  }
587
- function ba({
588
- side: r = "left",
576
+ function xa({
577
+ side: a = "left",
589
578
  variant: t = "sidebar",
590
- collapsible: o = "offcanvas",
591
- className: d,
592
- children: i,
593
- ...c
579
+ collapsible: i = "offcanvas",
580
+ className: u,
581
+ children: l,
582
+ ...d
594
583
  }) {
595
- const { isMobile: m, state: p, openMobile: u, setOpenMobile: w } = _e();
596
- return o === "none" ? /* @__PURE__ */ e(
584
+ const { isMobile: h, state: p, openMobile: m, setOpenMobile: N } = ge();
585
+ return i === "none" ? /* @__PURE__ */ e(
597
586
  "div",
598
587
  {
599
588
  "data-slot": "sidebar",
600
- className: g("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", d),
601
- ...c,
602
- children: i
589
+ className: f("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", u),
590
+ ...d,
591
+ children: l
603
592
  }
604
- ) : m ? /* @__PURE__ */ e(ra, { open: u, onOpenChange: w, ...c, children: /* @__PURE__ */ n(
605
- oa,
593
+ ) : h ? /* @__PURE__ */ e(sa, { open: m, onOpenChange: N, ...d, children: /* @__PURE__ */ r(
594
+ la,
606
595
  {
607
- onOpenAutoFocus: (b) => b.preventDefault(),
596
+ onOpenAutoFocus: (v) => v.preventDefault(),
608
597
  "data-sidebar": "sidebar",
609
598
  "data-slot": "sidebar",
610
599
  "data-mobile": "true",
611
600
  className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
612
601
  style: {
613
- "--sidebar-width": ha
602
+ "--sidebar-width": ga
614
603
  },
615
- side: r,
604
+ side: a,
616
605
  children: [
617
- /* @__PURE__ */ n(ia, { className: "sr-only", children: [
618
- /* @__PURE__ */ e(la, { children: "Sidebar" }),
619
- /* @__PURE__ */ e(ca, { children: "Displays the mobile sidebar." })
606
+ /* @__PURE__ */ r(ca, { className: "sr-only", children: [
607
+ /* @__PURE__ */ e(da, { children: "Sidebar" }),
608
+ /* @__PURE__ */ e(ua, { children: "Displays the mobile sidebar." })
620
609
  ] }),
621
- /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: i })
610
+ /* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: l })
622
611
  ]
623
612
  }
624
- ) }) : /* @__PURE__ */ n(
613
+ ) }) : /* @__PURE__ */ r(
625
614
  "div",
626
615
  {
627
616
  className: "group peer text-sidebar-foreground hidden md:block",
628
617
  "data-state": p,
629
- "data-collapsible": p === "collapsed" ? o : "",
618
+ "data-collapsible": p === "collapsed" ? i : "",
630
619
  "data-variant": t,
631
- "data-side": r,
620
+ "data-side": a,
632
621
  "data-slot": "sidebar",
633
622
  children: [
634
623
  /* @__PURE__ */ e(
635
624
  "div",
636
625
  {
637
626
  "data-slot": "sidebar-gap",
638
- className: g(
627
+ className: f(
639
628
  "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
640
629
  "group-data-[collapsible=offcanvas]:w-0",
641
630
  "group-data-[side=right]:rotate-180",
@@ -647,21 +636,21 @@ function ba({
647
636
  "div",
648
637
  {
649
638
  "data-slot": "sidebar-container",
650
- className: g(
639
+ className: f(
651
640
  "fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
652
- r === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
641
+ a === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
653
642
  // Adjust the padding for floating and inset variants.
654
643
  t === "floating" || t === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
655
- d
644
+ u
656
645
  ),
657
- ...c,
646
+ ...d,
658
647
  children: /* @__PURE__ */ e(
659
648
  "div",
660
649
  {
661
650
  "data-sidebar": "sidebar",
662
651
  "data-slot": "sidebar-inner",
663
652
  className: "bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",
664
- children: i
653
+ children: l
665
654
  }
666
655
  )
667
656
  }
@@ -670,97 +659,97 @@ function ba({
670
659
  }
671
660
  );
672
661
  }
673
- function va({ className: r, onClick: t, ...o }) {
674
- const { toggleSidebar: d } = _e();
675
- return /* @__PURE__ */ n(
676
- Y,
662
+ function ya({ className: a, onClick: t, ...i }) {
663
+ const { toggleSidebar: u } = ge();
664
+ return /* @__PURE__ */ r(
665
+ Z,
677
666
  {
678
667
  "data-sidebar": "trigger",
679
668
  "data-slot": "sidebar-trigger",
680
669
  variant: "ghost",
681
670
  size: "icon",
682
- className: g("size-7", r),
683
- onClick: (i) => {
684
- t?.(i), d();
671
+ className: f("size-7", a),
672
+ onClick: (l) => {
673
+ t?.(l), u();
685
674
  },
686
- ...o,
675
+ ...i,
687
676
  children: [
688
- /* @__PURE__ */ e(wt, {}),
677
+ /* @__PURE__ */ e(Ct, {}),
689
678
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Toggle Sidebar" })
690
679
  ]
691
680
  }
692
681
  );
693
682
  }
694
- function xa({ className: r, ...t }) {
683
+ function wa({ className: a, ...t }) {
695
684
  return /* @__PURE__ */ e(
696
685
  "div",
697
686
  {
698
687
  "data-slot": "sidebar-footer",
699
688
  "data-sidebar": "footer",
700
- className: g("flex flex-col gap-2 p-2", r),
689
+ className: f("flex flex-col gap-2 p-2", a),
701
690
  ...t
702
691
  }
703
692
  );
704
693
  }
705
- function ya({ className: r, ...t }) {
694
+ function Na({ className: a, ...t }) {
706
695
  return /* @__PURE__ */ e(
707
696
  "div",
708
697
  {
709
698
  "data-slot": "sidebar-content",
710
699
  "data-sidebar": "content",
711
- className: g(
700
+ className: f(
712
701
  "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
713
- r
702
+ a
714
703
  ),
715
704
  ...t
716
705
  }
717
706
  );
718
707
  }
719
- function wa({ className: r, ...t }) {
708
+ function ka({ className: a, ...t }) {
720
709
  return /* @__PURE__ */ e(
721
710
  "div",
722
711
  {
723
712
  "data-slot": "sidebar-group",
724
713
  "data-sidebar": "group",
725
- className: g("relative flex w-full min-w-0 flex-col p-2", r),
714
+ className: f("relative flex w-full min-w-0 flex-col p-2", a),
726
715
  ...t
727
716
  }
728
717
  );
729
718
  }
730
- function Ie({ className: r, ...t }) {
719
+ function Ie({ className: a, ...t }) {
731
720
  return /* @__PURE__ */ e(
732
721
  "div",
733
722
  {
734
723
  "data-slot": "sidebar-group-content",
735
724
  "data-sidebar": "group-content",
736
- className: g("w-full text-sm", r),
725
+ className: f("w-full text-sm", a),
737
726
  ...t
738
727
  }
739
728
  );
740
729
  }
741
- function De({ className: r, ...t }) {
730
+ function Ee({ className: a, ...t }) {
742
731
  return /* @__PURE__ */ e(
743
732
  "ul",
744
733
  {
745
734
  "data-slot": "sidebar-menu",
746
735
  "data-sidebar": "menu",
747
- className: g("flex w-full min-w-0 flex-col gap-1", r),
736
+ className: f("flex w-full min-w-0 flex-col gap-1", a),
748
737
  ...t
749
738
  }
750
739
  );
751
740
  }
752
- function Ee({ className: r, ...t }) {
741
+ function Le({ className: a, ...t }) {
753
742
  return /* @__PURE__ */ e(
754
743
  "li",
755
744
  {
756
745
  "data-slot": "sidebar-menu-item",
757
746
  "data-sidebar": "menu-item",
758
- className: g("group/menu-item relative", r),
747
+ className: f("group/menu-item relative", a),
759
748
  ...t
760
749
  }
761
750
  );
762
751
  }
763
- const Na = Xt(
752
+ const Ca = Zt(
764
753
  "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-start text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
765
754
  {
766
755
  variants: {
@@ -780,184 +769,184 @@ const Na = Xt(
780
769
  }
781
770
  }
782
771
  );
783
- function Le({
784
- asChild: r = !1,
772
+ function Ae({
773
+ asChild: a = !1,
785
774
  isActive: t = !1,
786
- variant: o = "default",
787
- size: d = "default",
788
- tooltip: i,
789
- className: c,
790
- ...m
775
+ variant: i = "default",
776
+ size: u = "default",
777
+ tooltip: l,
778
+ className: d,
779
+ ...h
791
780
  }) {
792
- const p = r ? Wt : "button", { isMobile: u, state: w } = _e(), b = /* @__PURE__ */ e(
781
+ const p = a ? Yt : "button", { isMobile: m, state: N } = ge(), v = /* @__PURE__ */ e(
793
782
  p,
794
783
  {
795
784
  "data-slot": "sidebar-menu-button",
796
785
  "data-sidebar": "menu-button",
797
- "data-size": d,
786
+ "data-size": u,
798
787
  "data-active": t,
799
- className: g(Na({ variant: o, size: d }), c),
800
- ...m
788
+ className: f(Ca({ variant: i, size: u }), d),
789
+ ...h
801
790
  }
802
791
  );
803
- return i ? (typeof i == "string" && (i = {
804
- children: i
805
- }), /* @__PURE__ */ n(Fe, { children: [
806
- /* @__PURE__ */ e(Oe, { asChild: !0, children: b }),
807
- /* @__PURE__ */ e(je, { side: "right", align: "center", hidden: w !== "collapsed" || u, ...i })
808
- ] })) : b;
792
+ return l ? (typeof l == "string" && (l = {
793
+ children: l
794
+ }), /* @__PURE__ */ r(Oe, { children: [
795
+ /* @__PURE__ */ e($e, { asChild: !0, children: v }),
796
+ /* @__PURE__ */ e(Be, { side: "right", align: "center", hidden: N !== "collapsed" || m, ...l })
797
+ ] })) : v;
809
798
  }
810
- function ka({ trigger: r }) {
811
- const { t, i18n: o } = le(["settings", "translation"]), { app: d, settings: i } = te(), { theme: c, setTheme: m, accent: p, setAccent: u, radius: w, setRadius: b } = $e(), [v, l] = C(null), [S, _] = C(!1), q = ee(null), O = j(() => [
812
- { id: "general", label: t("sections.general", "General"), icon: Pe },
813
- { id: "profile", label: t("sections.profile", "Profile"), icon: Nt },
814
- { id: "account", label: t("sections.account", "Account"), icon: kt }
815
- ].filter((k) => {
816
- const M = i?.sections?.[k.id];
817
- return (M?.mode ?? (M?.enabled === !1 ? "hidden" : "editable")) !== "hidden";
818
- }), [t, i]), [P, y] = C(O[0]?.id || "general"), h = J((a, k, M = "editable") => {
819
- const se = i?.sections?.[a]?.fields;
820
- return se && se[k] || M;
821
- }, [i]), [E, z] = C(""), [I, H] = C(""), [B, F] = C(""), [L, U] = C(""), K = j(() => d?.userMetadataFields?.filter((a) => a.showInProfile) || [], [d?.userMetadataFields]), [f, s] = C({}), [x, D] = C(!1), A = o.language === "fa", V = A ? "text-right" : "text-left", N = J(async () => {
799
+ function _a({ trigger: a }) {
800
+ const { t, i18n: i } = ce(["settings", "translation"]), { app: u, settings: l } = te(), { theme: d, setTheme: h, accent: p, setAccent: m, radius: N, setRadius: v } = Ue(), [y, c] = _(null), [P, S] = _(!1), z = ee(null), B = O(() => [
801
+ { id: "general", label: t("sections.general", "General"), icon: Me },
802
+ { id: "profile", label: t("sections.profile", "Profile"), icon: _t },
803
+ { id: "account", label: t("sections.account", "Account"), icon: St }
804
+ ].filter((F) => {
805
+ const s = l?.sections?.[F.id];
806
+ return (s?.mode ?? (s?.enabled === !1 ? "hidden" : "editable")) !== "hidden";
807
+ }), [t, l]), [C, x] = _(B[0]?.id || "general"), g = Y((o, F, s = "editable") => {
808
+ const H = l?.sections?.[o]?.fields;
809
+ return H && H[F] || s;
810
+ }, [l]), [L, q] = _(""), [D, j] = _(""), [U, A] = _(""), [E, G] = _(""), K = O(() => u?.userMetadataFields?.filter((o) => o.showInProfile) || [], [u?.userMetadataFields]), [b, n] = _({}), [w, T] = _(!1), I = i.language === "fa", W = I ? "text-right" : "text-left", k = Y(async () => {
822
811
  try {
823
- const a = await T.getMe();
824
- l(a), z(a.name || ""), H(a.surname || ""), F(a.phone || "");
825
- const k = {};
826
- K.forEach((M) => {
827
- k[M.key] = a.metadata?.[M.key] ?? M.defaultValue ?? "";
828
- }), s(k);
829
- } catch (a) {
830
- console.error("Failed to fetch user:", a), X.error(ie(a, t));
812
+ const o = await M.getMe();
813
+ c(o), q(o.name || ""), j(o.surname || ""), A(o.phone || "");
814
+ const F = {};
815
+ K.forEach((s) => {
816
+ F[s.key] = o.metadata?.[s.key] ?? s.defaultValue ?? "";
817
+ }), n(F);
818
+ } catch (o) {
819
+ console.error("Failed to fetch user:", o), J.error(le(o, t));
831
820
  }
832
821
  }, [t, K]);
833
822
  $(() => {
834
- if (!S) {
835
- q.current = null;
823
+ if (!P) {
824
+ z.current = null;
836
825
  return;
837
826
  }
838
- (q.current === null || P === "account") && N(), q.current = P;
839
- }, [S, P, N]), $(() => {
840
- const a = { ...f };
841
- let k = !1;
842
- K.forEach((M) => {
843
- M.condition && !he(M.condition, f) && a[M.key] !== void 0 && (delete a[M.key], k = !0);
844
- }), k && s(a);
845
- }, [f, K]);
827
+ (z.current === null || C === "account") && k(), z.current = C;
828
+ }, [P, C, k]), $(() => {
829
+ const o = { ...b };
830
+ let F = !1;
831
+ K.forEach((s) => {
832
+ s.condition && !he(s.condition, b) && o[s.key] !== void 0 && (delete o[s.key], F = !0);
833
+ }), F && n(o);
834
+ }, [b, K]);
846
835
  const R = async () => {
847
- D(!0);
836
+ T(!0);
848
837
  try {
849
- const a = { name: E, surname: I, phone: B, metadata: f };
850
- L && (a.password = L), await T.updateMe(a), X.success(t("profile.success", "Profile updated successfully")), U(""), N();
851
- } catch (a) {
852
- X.error(ie(a, t));
838
+ const o = { name: L, surname: D, phone: U, metadata: b };
839
+ E && (o.password = E), await M.updateMe(o), J.success(t("profile.success", "Profile updated successfully")), G(""), k();
840
+ } catch (o) {
841
+ J.error(le(o, t));
853
842
  } finally {
854
- D(!1);
843
+ T(!1);
855
844
  }
856
- }, W = () => {
857
- window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (T.clearToken(), window.location.reload());
858
- }, ce = (a) => {
859
- o.changeLanguage(a);
860
- }, ae = v ? Math.max(0, Math.min(100, v.balance.tokens / (v.balance.token_limit || 1) * 100)) : 0, ne = v ? Math.max(0, Math.min(100, v.balance.requests / (v.balance.request_limit || 1) * 100)) : 0;
861
- return /* @__PURE__ */ n(Be, { open: S, onOpenChange: _, children: [
862
- /* @__PURE__ */ e(nt, { asChild: !0, children: r || /* @__PURE__ */ e(Y, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ e(we, { className: "h-5 w-5" }) }) }),
845
+ }, X = () => {
846
+ window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (M.clearToken(), window.location.reload());
847
+ }, se = (o) => {
848
+ i.changeLanguage(o);
849
+ }, re = y ? Math.max(0, Math.min(100, y.balance.tokens / (y.balance.token_limit || 1) * 100)) : 0, oe = y ? Math.max(0, Math.min(100, y.balance.requests / (y.balance.request_limit || 1) * 100)) : 0;
850
+ return /* @__PURE__ */ r(Ke, { open: P, onOpenChange: S, children: [
851
+ /* @__PURE__ */ e(it, { asChild: !0, children: a || /* @__PURE__ */ e(Z, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ e(Ne, { className: "h-5 w-5" }) }) }),
863
852
  /* @__PURE__ */ e(
864
- Ue,
853
+ He,
865
854
  {
866
- dir: A ? "rtl" : "ltr",
867
- className: g(
855
+ dir: I ? "rtl" : "ltr",
856
+ className: f(
868
857
  "w-full sm:w-[95vw] sm:max-w-[700px] p-0 gap-0 overflow-hidden rounded-t-2xl sm:rounded-3xl border-none shadow-2xl bg-background/95 backdrop-blur-md h-[90vh] sm:h-[750px]",
869
- A && "rtl"
858
+ I && "rtl"
870
859
  ),
871
- children: /* @__PURE__ */ n("div", { className: "flex flex-col h-full w-full min-h-0 overflow-hidden", children: [
872
- /* @__PURE__ */ n("div", { className: "w-full bg-muted/20 sm:bg-muted/30 border-b border-border/40 pt-12 sm:pt-6 flex flex-col shrink-0", children: [
873
- /* @__PURE__ */ e("div", { className: "flex items-center justify-between px-4 sm:px-6 mb-2 sm:mb-4", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
874
- /* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(we, { className: "h-5 w-5 text-primary" }) }),
860
+ children: /* @__PURE__ */ r("div", { className: "flex flex-col h-full w-full min-h-0 overflow-hidden", children: [
861
+ /* @__PURE__ */ r("div", { className: "w-full bg-muted/20 sm:bg-muted/30 border-b border-border/40 pt-12 sm:pt-6 flex flex-col shrink-0", children: [
862
+ /* @__PURE__ */ e("div", { className: "flex items-center justify-between px-4 sm:px-6 mb-2 sm:mb-4", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
863
+ /* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(Ne, { className: "h-5 w-5 text-primary" }) }),
875
864
  /* @__PURE__ */ e("span", { className: "font-bold text-lg", children: t("title", "Settings") })
876
865
  ] }) }),
877
- /* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: O.map((a) => /* @__PURE__ */ n(
866
+ /* @__PURE__ */ e("div", { className: "w-full overflow-x-auto no-scrollbar pt-2 px-2 sm:px-4", children: /* @__PURE__ */ e("nav", { className: "flex items-center gap-2 sm:gap-6 w-max", children: B.map((o) => /* @__PURE__ */ r(
878
867
  "button",
879
868
  {
880
- onClick: () => y(a.id),
881
- className: g(
869
+ onClick: () => x(o.id),
870
+ className: f(
882
871
  "flex items-center gap-1.5 sm:gap-2 pb-2 sm:pb-3 pt-1 px-2 sm:px-1 text-sm sm:text-base font-medium transition-all border-b-2 whitespace-nowrap shrink-0",
883
- P === a.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
884
- i?.sections?.[a.id]?.mode === "faded" && "opacity-50 pointer-events-none select-none"
872
+ C === o.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
873
+ l?.sections?.[o.id]?.mode === "faded" && "opacity-50 pointer-events-none select-none"
885
874
  ),
886
875
  children: [
887
- /* @__PURE__ */ e(a.icon, { className: g(
876
+ /* @__PURE__ */ e(o.icon, { className: f(
888
877
  "h-3.5 w-3.5 sm:h-4 sm:w-4 transition-transform",
889
- P === a.id && "scale-110"
878
+ C === o.id && "scale-110"
890
879
  ) }),
891
- a.label
880
+ o.label
892
881
  ]
893
882
  },
894
- a.id
883
+ o.id
895
884
  )) }) })
896
885
  ] }),
897
- /* @__PURE__ */ e("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ n("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-12 sm:pt-12 custom-scrollbar", children: [
898
- P === "profile" && /* @__PURE__ */ n("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
899
- /* @__PURE__ */ n("div", { children: [
886
+ /* @__PURE__ */ e("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ r("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-12 sm:pt-12 custom-scrollbar", children: [
887
+ C === "profile" && /* @__PURE__ */ r("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
888
+ /* @__PURE__ */ r("div", { children: [
900
889
  /* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("profile.title", "Profile Information") }),
901
890
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("profile.subtitle", "Update your personal details below.") })
902
891
  ] }),
903
- /* @__PURE__ */ n("div", { className: "grid gap-6", children: [
904
- /* @__PURE__ */ n("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
905
- h("profile", "name") !== "hidden" && /* @__PURE__ */ n("div", { className: g("flex flex-col gap-3", h("profile", "name") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
892
+ /* @__PURE__ */ r("div", { className: "grid gap-6", children: [
893
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
894
+ g("profile", "name") !== "hidden" && /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", g("profile", "name") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
906
895
  /* @__PURE__ */ e(Q, { htmlFor: "name", className: "px-1", children: t("profile.name", "First Name") }),
907
896
  /* @__PURE__ */ e(
908
- G,
897
+ V,
909
898
  {
910
899
  id: "name",
911
- value: E,
912
- onChange: (a) => z(a.target.value),
913
- disabled: h("profile", "name") === "faded",
914
- className: g("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", V)
900
+ value: L,
901
+ onChange: (o) => q(o.target.value),
902
+ disabled: g("profile", "name") === "faded",
903
+ className: f("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", W)
915
904
  }
916
905
  )
917
906
  ] }),
918
- h("profile", "surname") !== "hidden" && /* @__PURE__ */ n("div", { className: g("flex flex-col gap-3", h("profile", "surname") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
907
+ g("profile", "surname") !== "hidden" && /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", g("profile", "surname") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
919
908
  /* @__PURE__ */ e(Q, { htmlFor: "surname", className: "px-1", children: t("profile.surname", "Last Name") }),
920
909
  /* @__PURE__ */ e(
921
- G,
910
+ V,
922
911
  {
923
912
  id: "surname",
924
- value: I,
925
- onChange: (a) => H(a.target.value),
926
- disabled: h("profile", "surname") === "faded",
927
- className: g("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", V)
913
+ value: D,
914
+ onChange: (o) => j(o.target.value),
915
+ disabled: g("profile", "surname") === "faded",
916
+ className: f("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", W)
928
917
  }
929
918
  )
930
919
  ] })
931
920
  ] }),
932
- h("profile", "phone") !== "hidden" && /* @__PURE__ */ n("div", { className: g("flex flex-col gap-3", h("profile", "phone") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
921
+ g("profile", "phone") !== "hidden" && /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", g("profile", "phone") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
933
922
  /* @__PURE__ */ e(Q, { htmlFor: "phone", className: "px-1 text-left", children: t("profile.phone", "Phone Number") }),
934
- /* @__PURE__ */ n("div", { className: "relative", children: [
935
- /* @__PURE__ */ e(Ct, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground left-3" }),
923
+ /* @__PURE__ */ r("div", { className: "relative", children: [
924
+ /* @__PURE__ */ e(Pt, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground left-3" }),
936
925
  /* @__PURE__ */ e(
937
- G,
926
+ V,
938
927
  {
939
928
  id: "phone",
940
- value: B,
941
- onChange: (a) => F(a.target.value),
942
- disabled: h("profile", "phone") === "faded",
929
+ value: U,
930
+ onChange: (o) => A(o.target.value),
931
+ disabled: g("profile", "phone") === "faded",
943
932
  className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary pl-10 pr-3 text-left",
944
933
  dir: "ltr"
945
934
  }
946
935
  )
947
936
  ] })
948
937
  ] }),
949
- h("profile", "password") !== "hidden" && /* @__PURE__ */ n("div", { className: g("flex flex-col gap-3", h("profile", "password") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
938
+ g("profile", "password") !== "hidden" && /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", g("profile", "password") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
950
939
  /* @__PURE__ */ e(Q, { htmlFor: "pass", className: "px-1 text-left", children: t("profile.password", "New Password") }),
951
- /* @__PURE__ */ n("div", { className: "relative", children: [
952
- /* @__PURE__ */ e(_t, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground left-3" }),
940
+ /* @__PURE__ */ r("div", { className: "relative", children: [
941
+ /* @__PURE__ */ e(Mt, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground left-3" }),
953
942
  /* @__PURE__ */ e(
954
- G,
943
+ V,
955
944
  {
956
945
  id: "pass",
957
946
  type: "password",
958
- value: L,
959
- onChange: (a) => U(a.target.value),
960
- disabled: h("profile", "password") === "faded",
947
+ value: E,
948
+ onChange: (o) => G(o.target.value),
949
+ disabled: g("profile", "password") === "faded",
961
950
  placeholder: t("profile.password_placeholder", "Leave empty to keep current"),
962
951
  className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary pl-10 pr-3 text-left",
963
952
  dir: "ltr"
@@ -965,125 +954,125 @@ function ka({ trigger: r }) {
965
954
  )
966
955
  ] })
967
956
  ] }),
968
- K.map((a) => {
969
- const k = h("profile", a.key, a.mode || "editable");
970
- return k === "hidden" || !he(a.condition, f) ? null : /* @__PURE__ */ n("div", { className: g("flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200", k === "faded" && "opacity-50 pointer-events-none select-none"), children: [
971
- /* @__PURE__ */ e(Q, { htmlFor: `profile-${a.key}`, className: "px-1", children: t(a.label) }),
972
- a.type === "select" ? /* @__PURE__ */ n(
973
- be,
957
+ K.map((o) => {
958
+ const F = g("profile", o.key, o.mode || "editable");
959
+ return F === "hidden" || !he(o.condition, b) ? null : /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200", F === "faded" && "opacity-50 pointer-events-none select-none"), children: [
960
+ /* @__PURE__ */ e(Q, { htmlFor: `profile-${o.key}`, className: "px-1", children: t(o.label) }),
961
+ o.type === "select" ? /* @__PURE__ */ r(
962
+ ve,
974
963
  {
975
- value: String(f[a.key] || ""),
976
- onValueChange: (M) => s({ ...f, [a.key]: M }),
977
- disabled: k === "faded",
978
- dir: A ? "rtl" : "ltr",
964
+ value: String(b[o.key] || ""),
965
+ onValueChange: (s) => n({ ...b, [o.key]: s }),
966
+ disabled: F === "faded",
967
+ dir: I ? "rtl" : "ltr",
979
968
  children: [
980
- /* @__PURE__ */ e(ve, { className: "bg-muted/30 border-border/50 rounded-xl focus:ring-primary h-11", children: /* @__PURE__ */ e(xe, { placeholder: t(a.placeholder || "profile.select_placeholder") }) }),
981
- /* @__PURE__ */ e(ye, { className: "rounded-xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: a.options?.map((M) => /* @__PURE__ */ e(me, { value: String(M.value), className: "rounded-lg focus:bg-primary/10", children: t(M.label) }, String(M.value))) })
969
+ /* @__PURE__ */ e(xe, { className: "bg-muted/30 border-border/50 rounded-xl focus:ring-primary h-11", children: /* @__PURE__ */ e(ye, { placeholder: t(o.placeholder || "profile.select_placeholder") }) }),
970
+ /* @__PURE__ */ e(we, { className: "rounded-xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: o.options?.map((s) => /* @__PURE__ */ e(me, { value: String(s.value), className: "rounded-lg focus:bg-primary/10", children: t(s.label) }, String(s.value))) })
982
971
  ]
983
972
  }
984
- ) : a.type === "checkbox" ? /* @__PURE__ */ n("div", { className: "flex items-center gap-3 px-1 py-1", children: [
973
+ ) : o.type === "checkbox" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-3 px-1 py-1", children: [
985
974
  /* @__PURE__ */ e(
986
975
  "input",
987
976
  {
988
- id: `profile-${a.key}`,
977
+ id: `profile-${o.key}`,
989
978
  type: "checkbox",
990
- checked: !!f[a.key],
991
- disabled: k === "faded",
992
- onChange: (M) => s({ ...f, [a.key]: M.target.checked }),
979
+ checked: !!b[o.key],
980
+ disabled: F === "faded",
981
+ onChange: (s) => n({ ...b, [o.key]: s.target.checked }),
993
982
  className: "h-5 w-5 rounded-md border-border/50 bg-muted/30 text-primary focus:ring-primary transition-all cursor-pointer"
994
983
  }
995
984
  ),
996
- /* @__PURE__ */ e(Q, { htmlFor: `profile-${a.key}`, className: "text-sm font-medium text-muted-foreground cursor-pointer", children: t(a.placeholder || a.label) })
985
+ /* @__PURE__ */ e(Q, { htmlFor: `profile-${o.key}`, className: "text-sm font-medium text-muted-foreground cursor-pointer", children: t(o.placeholder || o.label) })
997
986
  ] }) : /* @__PURE__ */ e(
998
- G,
987
+ V,
999
988
  {
1000
- id: `profile-${a.key}`,
1001
- type: a.type,
1002
- value: f[a.key] || "",
1003
- disabled: k === "faded",
1004
- onChange: (M) => s({ ...f, [a.key]: M.target.value }),
1005
- placeholder: t(a.placeholder || ""),
1006
- className: g("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", V)
989
+ id: `profile-${o.key}`,
990
+ type: o.type,
991
+ value: b[o.key] || "",
992
+ disabled: F === "faded",
993
+ onChange: (s) => n({ ...b, [o.key]: s.target.value }),
994
+ placeholder: t(o.placeholder || ""),
995
+ className: f("bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11", W)
1007
996
  }
1008
997
  )
1009
- ] }, a.key);
998
+ ] }, o.key);
1010
999
  }),
1011
- /* @__PURE__ */ e("div", { className: "pt-4 flex justify-center", children: /* @__PURE__ */ n(
1012
- Y,
1000
+ /* @__PURE__ */ e("div", { className: "pt-4 flex justify-center", children: /* @__PURE__ */ r(
1001
+ Z,
1013
1002
  {
1014
1003
  onClick: R,
1015
- disabled: x,
1004
+ disabled: w,
1016
1005
  className: "w-full sm:w-auto px-8 rounded-xl gap-2 font-semibold shadow-lg shadow-primary/20 h-11 transition-all active:scale-[0.98]",
1017
1006
  children: [
1018
- /* @__PURE__ */ e(St, { className: "h-4 w-4" }),
1019
- x ? t("profile.saving", "Saving...") : t("profile.save", "Save Changes")
1007
+ /* @__PURE__ */ e(Tt, { className: "h-4 w-4" }),
1008
+ w ? t("profile.saving", "Saving...") : t("profile.save", "Save Changes")
1020
1009
  ]
1021
1010
  }
1022
1011
  ) })
1023
1012
  ] })
1024
1013
  ] }),
1025
- P === "general" && /* @__PURE__ */ n("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1026
- /* @__PURE__ */ n("div", { children: [
1014
+ C === "general" && /* @__PURE__ */ r("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1015
+ /* @__PURE__ */ r("div", { children: [
1027
1016
  /* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("general.title", "General Settings") }),
1028
1017
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("general.subtitle", "Configure look and feel and language.") })
1029
1018
  ] }),
1030
- /* @__PURE__ */ n("div", { className: "space-y-8", children: [
1031
- h("general", "theme") !== "hidden" && /* @__PURE__ */ n("div", { className: g("space-y-3", h("general", "theme") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
1032
- /* @__PURE__ */ n(Q, { className: "text-sm font-semibold flex items-center gap-2", children: [
1033
- /* @__PURE__ */ e(Pe, { className: "h-4 w-4 text-primary" }),
1019
+ /* @__PURE__ */ r("div", { className: "space-y-8", children: [
1020
+ g("general", "theme") !== "hidden" && /* @__PURE__ */ r("div", { className: f("space-y-3", g("general", "theme") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
1021
+ /* @__PURE__ */ r(Q, { className: "text-sm font-semibold flex items-center gap-2", children: [
1022
+ /* @__PURE__ */ e(Me, { className: "h-4 w-4 text-primary" }),
1034
1023
  t("general.theme", "Theme")
1035
1024
  ] }),
1036
- /* @__PURE__ */ n("div", { className: "flex p-1 bg-muted/50 rounded-2xl border border-border/40 w-full", children: [
1037
- /* @__PURE__ */ n(
1025
+ /* @__PURE__ */ r("div", { className: "flex p-1 bg-muted/50 rounded-2xl border border-border/40 w-full", children: [
1026
+ /* @__PURE__ */ r(
1038
1027
  "button",
1039
1028
  {
1040
- onClick: () => m("light"),
1041
- disabled: h("general", "theme") === "faded",
1042
- className: g(
1029
+ onClick: () => h("light"),
1030
+ disabled: g("general", "theme") === "faded",
1031
+ className: f(
1043
1032
  "flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
1044
- c === "light" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
1033
+ d === "light" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
1045
1034
  ),
1046
1035
  children: [
1047
- /* @__PURE__ */ e(Pt, { className: "h-4 w-4" }),
1036
+ /* @__PURE__ */ e(Dt, { className: "h-4 w-4" }),
1048
1037
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: t("general.themes.light", "Light") })
1049
1038
  ]
1050
1039
  }
1051
1040
  ),
1052
- /* @__PURE__ */ n(
1041
+ /* @__PURE__ */ r(
1053
1042
  "button",
1054
1043
  {
1055
- onClick: () => m("dark"),
1056
- disabled: h("general", "theme") === "faded",
1057
- className: g(
1044
+ onClick: () => h("dark"),
1045
+ disabled: g("general", "theme") === "faded",
1046
+ className: f(
1058
1047
  "flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
1059
- c === "dark" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
1048
+ d === "dark" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
1060
1049
  ),
1061
1050
  children: [
1062
- /* @__PURE__ */ e(Mt, { className: "h-4 w-4" }),
1051
+ /* @__PURE__ */ e(It, { className: "h-4 w-4" }),
1063
1052
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: t("general.themes.dark", "Dark") })
1064
1053
  ]
1065
1054
  }
1066
1055
  ),
1067
- /* @__PURE__ */ n(
1056
+ /* @__PURE__ */ r(
1068
1057
  "button",
1069
1058
  {
1070
- onClick: () => m("system"),
1071
- disabled: h("general", "theme") === "faded",
1072
- className: g(
1059
+ onClick: () => h("system"),
1060
+ disabled: g("general", "theme") === "faded",
1061
+ className: f(
1073
1062
  "flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
1074
- c === "system" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
1063
+ d === "system" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
1075
1064
  ),
1076
1065
  children: [
1077
- /* @__PURE__ */ e(Tt, { className: "h-4 w-4" }),
1066
+ /* @__PURE__ */ e(Et, { className: "h-4 w-4" }),
1078
1067
  /* @__PURE__ */ e("span", { className: "text-sm font-medium", children: t("general.themes.system", "System") })
1079
1068
  ]
1080
1069
  }
1081
1070
  )
1082
1071
  ] })
1083
1072
  ] }),
1084
- h("general", "accent") !== "hidden" && /* @__PURE__ */ n("div", { className: g("space-y-4", h("general", "accent") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
1085
- /* @__PURE__ */ n(Q, { className: "text-sm font-semibold flex items-center gap-2", children: [
1086
- /* @__PURE__ */ e(Me, { className: "h-4 w-4 text-primary" }),
1073
+ g("general", "accent") !== "hidden" && /* @__PURE__ */ r("div", { className: f("space-y-4", g("general", "accent") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
1074
+ /* @__PURE__ */ r(Q, { className: "text-sm font-semibold flex items-center gap-2", children: [
1075
+ /* @__PURE__ */ e(Te, { className: "h-4 w-4 text-primary" }),
1087
1076
  t("general.accent", "Accent Color")
1088
1077
  ] }),
1089
1078
  /* @__PURE__ */ e("div", { className: "grid grid-cols-4 sm:grid-cols-8 gap-3 w-full", children: [
@@ -1103,68 +1092,68 @@ function ka({ trigger: r }) {
1103
1092
  // Teal
1104
1093
  "oklch(0.552 0.016 285.938)"
1105
1094
  // Slate
1106
- ].map((a) => {
1107
- const k = (p || "oklch(0.623 0.214 259.815)") === a;
1095
+ ].map((o) => {
1096
+ const F = (p || "oklch(0.623 0.214 259.815)") === o;
1108
1097
  return /* @__PURE__ */ e(
1109
1098
  "button",
1110
1099
  {
1111
- onClick: () => u(a),
1112
- disabled: h("general", "accent") === "faded",
1113
- className: g(
1100
+ onClick: () => m(o),
1101
+ disabled: g("general", "accent") === "faded",
1102
+ className: f(
1114
1103
  "h-8 w-8 rounded-full border-2 transition-all hover:scale-110 active:scale-95 shadow-sm",
1115
- k ? "border-foreground" : "border-transparent"
1104
+ F ? "border-foreground" : "border-transparent"
1116
1105
  ),
1117
- style: { backgroundColor: a }
1106
+ style: { backgroundColor: o }
1118
1107
  },
1119
- a
1108
+ o
1120
1109
  );
1121
1110
  }) })
1122
1111
  ] }),
1123
- h("general", "radius") !== "hidden" && /* @__PURE__ */ n("div", { className: g("space-y-4", h("general", "radius") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
1124
- /* @__PURE__ */ n(Q, { className: "text-sm font-semibold flex items-center gap-2", children: [
1112
+ g("general", "radius") !== "hidden" && /* @__PURE__ */ r("div", { className: f("space-y-4", g("general", "radius") === "faded" && "opacity-50 pointer-events-none select-none"), children: [
1113
+ /* @__PURE__ */ r(Q, { className: "text-sm font-semibold flex items-center gap-2", children: [
1125
1114
  /* @__PURE__ */ e("div", { className: "h-4 w-4 rounded-md border-2 border-primary" }),
1126
1115
  t("general.radius", "Rounded Corners")
1127
1116
  ] }),
1128
1117
  /* @__PURE__ */ e("div", { className: "flex p-1 bg-muted/50 rounded-2xl border border-border/40 w-full", children: [
1129
1118
  { id: "sharp", value: "0.3rem" },
1130
1119
  { id: "round", value: "1.25rem" }
1131
- ].map((a) => {
1132
- const k = (w || "1.25rem") === a.value;
1120
+ ].map((o) => {
1121
+ const F = (N || "1.25rem") === o.value;
1133
1122
  return /* @__PURE__ */ e(
1134
1123
  "button",
1135
1124
  {
1136
- onClick: () => b(a.value),
1137
- disabled: h("general", "radius") === "faded",
1138
- className: g(
1125
+ onClick: () => v(o.value),
1126
+ disabled: g("general", "radius") === "faded",
1127
+ className: f(
1139
1128
  "flex-1 py-2 rounded-xl transition-all text-sm font-medium",
1140
- k ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
1129
+ F ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
1141
1130
  ),
1142
- children: t(`general.radius_levels.${a.id}`)
1131
+ children: t(`general.radius_levels.${o.id}`)
1143
1132
  },
1144
- a.id
1133
+ o.id
1145
1134
  );
1146
1135
  }) })
1147
1136
  ] }),
1148
- h("general", "language") !== "hidden" && /* @__PURE__ */ n("div", { className: g("space-y-3", h("general", "language") === "faded" && "opacity-50"), children: [
1149
- /* @__PURE__ */ n(Q, { className: "text-sm font-semibold flex items-center gap-2", children: [
1150
- /* @__PURE__ */ e(It, { className: "h-4 w-4 text-primary" }),
1137
+ g("general", "language") !== "hidden" && /* @__PURE__ */ r("div", { className: f("space-y-3", g("general", "language") === "faded" && "opacity-50"), children: [
1138
+ /* @__PURE__ */ r(Q, { className: "text-sm font-semibold flex items-center gap-2", children: [
1139
+ /* @__PURE__ */ e(Lt, { className: "h-4 w-4 text-primary" }),
1151
1140
  t("general.language", "Language")
1152
1141
  ] }),
1153
- /* @__PURE__ */ n(
1154
- be,
1142
+ /* @__PURE__ */ r(
1143
+ ve,
1155
1144
  {
1156
- value: o.language,
1157
- onValueChange: ce,
1158
- disabled: h("general", "language") === "faded",
1159
- dir: A ? "rtl" : "ltr",
1145
+ value: i.language,
1146
+ onValueChange: se,
1147
+ disabled: g("general", "language") === "faded",
1148
+ dir: I ? "rtl" : "ltr",
1160
1149
  children: [
1161
- /* @__PURE__ */ e(ve, { className: "w-full bg-muted/50 rounded-2xl border-border/40 h-11 focus:ring-primary/20", children: /* @__PURE__ */ e(xe, { placeholder: t("general.language_placeholder", "Select language") }) }),
1162
- /* @__PURE__ */ n(ye, { className: "rounded-2xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: [
1163
- /* @__PURE__ */ e(me, { value: "en", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1150
+ /* @__PURE__ */ e(xe, { className: "w-full bg-muted/50 rounded-2xl border-border/40 h-11 focus:ring-primary/20", children: /* @__PURE__ */ e(ye, { placeholder: t("general.language_placeholder", "Select language") }) }),
1151
+ /* @__PURE__ */ r(we, { className: "rounded-2xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: [
1152
+ /* @__PURE__ */ e(me, { value: "en", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ r("span", { className: "flex items-center gap-2", children: [
1164
1153
  /* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted-foreground mr-1", children: "EN" }),
1165
1154
  t("general.languages.en", "English")
1166
1155
  ] }) }),
1167
- /* @__PURE__ */ e(me, { value: "fa", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ n("span", { className: "flex items-center gap-2", children: [
1156
+ /* @__PURE__ */ e(me, { value: "fa", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ r("span", { className: "flex items-center gap-2", children: [
1168
1157
  /* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted-foreground mr-1", children: "FA" }),
1169
1158
  t("general.languages.fa", "Persian")
1170
1159
  ] }) })
@@ -1175,76 +1164,76 @@ function ka({ trigger: r }) {
1175
1164
  ] })
1176
1165
  ] })
1177
1166
  ] }),
1178
- P === "account" && /* @__PURE__ */ n("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1179
- /* @__PURE__ */ n("div", { children: [
1167
+ C === "account" && /* @__PURE__ */ r("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
1168
+ /* @__PURE__ */ r("div", { children: [
1180
1169
  /* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("account.title", "Account & Usage") }),
1181
1170
  /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("account.subtitle", "Monitor your quotas and manage your session.") })
1182
1171
  ] }),
1183
- /* @__PURE__ */ n("div", { className: "space-y-6", children: [
1184
- h("account", "balance") !== "hidden" && /* @__PURE__ */ n("div", { className: g("p-6 bg-muted/30 rounded-3xl border border-border/40 space-y-6", h("account", "balance") === "faded" && "opacity-50"), children: [
1185
- /* @__PURE__ */ n(Q, { className: "text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2", children: [
1186
- /* @__PURE__ */ e(Dt, { className: "h-4 w-4" }),
1172
+ /* @__PURE__ */ r("div", { className: "space-y-6", children: [
1173
+ g("account", "balance") !== "hidden" && /* @__PURE__ */ r("div", { className: f("p-6 bg-muted/30 rounded-3xl border border-border/40 space-y-6", g("account", "balance") === "faded" && "opacity-50"), children: [
1174
+ /* @__PURE__ */ r(Q, { className: "text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2", children: [
1175
+ /* @__PURE__ */ e(At, { className: "h-4 w-4" }),
1187
1176
  t("account.balance", "Current Balance")
1188
1177
  ] }),
1189
- /* @__PURE__ */ n("div", { className: "space-y-5", children: [
1190
- /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1191
- /* @__PURE__ */ n("div", { className: "flex justify-between text-sm mb-1", children: [
1178
+ /* @__PURE__ */ r("div", { className: "space-y-5", children: [
1179
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
1180
+ /* @__PURE__ */ r("div", { className: "flex justify-between text-sm mb-1", children: [
1192
1181
  /* @__PURE__ */ e("span", { className: "font-medium text-muted-foreground", children: t("account.tokens", "Tokens") }),
1193
- /* @__PURE__ */ n("span", { className: "font-bold text-primary", children: [
1194
- ae.toLocaleString(o.language, { maximumFractionDigits: 0 }),
1182
+ /* @__PURE__ */ r("span", { className: "font-bold text-primary", children: [
1183
+ re.toLocaleString(i.language, { maximumFractionDigits: 0 }),
1195
1184
  "%"
1196
1185
  ] })
1197
1186
  ] }),
1198
1187
  /* @__PURE__ */ e("div", { className: "h-2.5 w-full bg-muted/50 rounded-full overflow-hidden border border-border/20 p-0.5", dir: "ltr", children: /* @__PURE__ */ e(
1199
1188
  "div",
1200
1189
  {
1201
- className: g(
1190
+ className: f(
1202
1191
  "h-full rounded-full transition-all duration-1000 shadow-sm",
1203
- ae > 60 ? "bg-emerald-500 shadow-emerald-500/20" : ae > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
1192
+ re > 60 ? "bg-emerald-500 shadow-emerald-500/20" : re > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
1204
1193
  ),
1205
- style: { width: `${ae}%` }
1194
+ style: { width: `${re}%` }
1206
1195
  }
1207
1196
  ) })
1208
1197
  ] }),
1209
- /* @__PURE__ */ n("div", { className: "space-y-2", children: [
1210
- /* @__PURE__ */ n("div", { className: "flex justify-between text-sm mb-1", children: [
1211
- /* @__PURE__ */ n("span", { className: "font-medium text-muted-foreground flex items-center gap-1.5 focus:outline-none", children: [
1212
- /* @__PURE__ */ e(Me, { className: "h-3.5 w-3.5 text-blue-500" }),
1198
+ /* @__PURE__ */ r("div", { className: "space-y-2", children: [
1199
+ /* @__PURE__ */ r("div", { className: "flex justify-between text-sm mb-1", children: [
1200
+ /* @__PURE__ */ r("span", { className: "font-medium text-muted-foreground flex items-center gap-1.5 focus:outline-none", children: [
1201
+ /* @__PURE__ */ e(Te, { className: "h-3.5 w-3.5 text-blue-500" }),
1213
1202
  t("account.requests", "Requests")
1214
1203
  ] }),
1215
- /* @__PURE__ */ n("span", { className: "font-bold text-primary", children: [
1216
- ne.toLocaleString(o.language, { maximumFractionDigits: 0 }),
1204
+ /* @__PURE__ */ r("span", { className: "font-bold text-primary", children: [
1205
+ oe.toLocaleString(i.language, { maximumFractionDigits: 0 }),
1217
1206
  "%"
1218
1207
  ] })
1219
1208
  ] }),
1220
1209
  /* @__PURE__ */ e("div", { className: "h-2.5 w-full bg-muted/50 rounded-full overflow-hidden border border-border/20 p-0.5", dir: "ltr", children: /* @__PURE__ */ e(
1221
1210
  "div",
1222
1211
  {
1223
- className: g(
1212
+ className: f(
1224
1213
  "h-full rounded-full transition-all duration-1000 shadow-sm",
1225
- ne > 60 ? "bg-emerald-500 shadow-emerald-500/20" : ne > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
1214
+ oe > 60 ? "bg-emerald-500 shadow-emerald-500/20" : oe > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
1226
1215
  ),
1227
- style: { width: `${ne}%` }
1216
+ style: { width: `${oe}%` }
1228
1217
  }
1229
1218
  ) })
1230
1219
  ] })
1231
1220
  ] })
1232
1221
  ] }),
1233
- /* @__PURE__ */ n("div", { className: "pt-2 flex flex-col gap-3", children: [
1234
- v?.balance.updated_at && h("account", "balance") !== "hidden" && /* @__PURE__ */ n("p", { className: "text-xs text-muted-foreground px-1", children: [
1222
+ /* @__PURE__ */ r("div", { className: "pt-2 flex flex-col gap-3", children: [
1223
+ y?.balance.updated_at && g("account", "balance") !== "hidden" && /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground px-1", children: [
1235
1224
  t("account.last_recharge", "Last balance update on"),
1236
1225
  ": ",
1237
- new Date(v.balance.updated_at).toLocaleDateString(o.language)
1226
+ new Date(y.balance.updated_at).toLocaleDateString(i.language)
1238
1227
  ] }),
1239
- h("account", "logout") !== "hidden" && /* @__PURE__ */ n(
1240
- Y,
1228
+ g("account", "logout") !== "hidden" && /* @__PURE__ */ r(
1229
+ Z,
1241
1230
  {
1242
1231
  variant: "destructive",
1243
- onClick: W,
1244
- disabled: h("account", "logout") === "faded",
1245
- className: g("rounded-2xl gap-2 font-bold h-12 shadow-lg shadow-destructive/10 transition-all active:scale-[0.98]", h("account", "logout") === "faded" && "opacity-50 pointer-events-none"),
1232
+ onClick: X,
1233
+ disabled: g("account", "logout") === "faded",
1234
+ className: f("rounded-2xl gap-2 font-bold h-12 shadow-lg shadow-destructive/10 transition-all active:scale-[0.98]", g("account", "logout") === "faded" && "opacity-50 pointer-events-none"),
1246
1235
  children: [
1247
- /* @__PURE__ */ e(Et, { className: "h-4 w-4" }),
1236
+ /* @__PURE__ */ e(zt, { className: "h-4 w-4" }),
1248
1237
  t("account.logout", "Logout from Account")
1249
1238
  ]
1250
1239
  }
@@ -1258,53 +1247,53 @@ function ka({ trigger: r }) {
1258
1247
  )
1259
1248
  ] });
1260
1249
  }
1261
- function Qe({ hideActions: r = !1 }) {
1262
- const [, t] = Ce(), { t: o } = le(["sidebar", "chat"]), { history: d, app: i } = te(), { theme: c } = $e(), m = !r && (d?.enabled ?? !0), [p, u] = C("light");
1250
+ function Ve({ hideActions: a = !1 }) {
1251
+ const [, t] = _e(), { t: i } = ce(["sidebar", "chat"]), { history: u, app: l } = te(), { theme: d } = Ue(), h = !a && (u?.enabled ?? !0), [p, m] = _("light");
1263
1252
  $(() => {
1264
- if (c === "system") {
1265
- const v = window.matchMedia("(prefers-color-scheme: dark)").matches;
1266
- u(v ? "dark" : "light");
1253
+ if (d === "system") {
1254
+ const y = window.matchMedia("(prefers-color-scheme: dark)").matches;
1255
+ m(y ? "dark" : "light");
1267
1256
  } else
1268
- u(c);
1269
- }, [c]);
1270
- const w = j(() => i?.logo ? typeof i.logo == "string" ? i.logo : p === "dark" ? i.logo.dark : i.logo.light : st, [i?.logo, p]), b = i?.name || "Gentiq";
1271
- return /* @__PURE__ */ n("header", { className: "relative flex items-center justify-between px-3 md:px-4 h-14 sticky top-0 z-40 w-full glass border-b border-border/30 transition-all duration-300", children: [
1272
- /* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children: m && /* @__PURE__ */ e(va, { className: "hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 rounded-lg size-9" }) }),
1257
+ m(d);
1258
+ }, [d]);
1259
+ const N = O(() => l?.logo ? typeof l.logo == "string" ? l.logo : p === "dark" ? l.logo.dark : l.logo.light : lt, [l?.logo, p]), v = l?.name || "Gentiq";
1260
+ return /* @__PURE__ */ r("header", { className: "relative flex items-center justify-between px-3 md:px-4 h-14 sticky top-0 z-40 w-full glass border-b border-border/30 transition-all duration-300", children: [
1261
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children: h && /* @__PURE__ */ e(ya, { className: "hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 rounded-lg size-9" }) }),
1273
1262
  /* @__PURE__ */ e("div", { className: "absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2.5 select-none animate-in fade-in zoom-in-95 duration-500", children: /* @__PURE__ */ e(
1274
1263
  "img",
1275
1264
  {
1276
- src: w,
1277
- alt: b,
1265
+ src: N,
1266
+ alt: v,
1278
1267
  className: "size-8 object-contain"
1279
1268
  }
1280
1269
  ) }) }),
1281
- /* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 min-w-[36px] md:min-w-[80px] justify-end", children: !r && /* @__PURE__ */ n(Ne, { children: [
1282
- /* @__PURE__ */ n(Fe, { children: [
1283
- /* @__PURE__ */ e(Oe, { asChild: !0, children: /* @__PURE__ */ e(
1270
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 min-w-[36px] md:min-w-[80px] justify-end", children: !a && /* @__PURE__ */ r(ke, { children: [
1271
+ /* @__PURE__ */ r(Oe, { children: [
1272
+ /* @__PURE__ */ e($e, { asChild: !0, children: /* @__PURE__ */ e(
1284
1273
  "button",
1285
1274
  {
1286
1275
  type: "button",
1287
- className: g(
1276
+ className: f(
1288
1277
  "flex items-center justify-center size-9 rounded-lg hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 text-muted-foreground hover:text-primary",
1289
- m && "md:hidden"
1278
+ h && "md:hidden"
1290
1279
  ),
1291
1280
  onClick: () => {
1292
1281
  t("/");
1293
1282
  },
1294
- children: /* @__PURE__ */ e(Lt, { className: "size-5" })
1283
+ children: /* @__PURE__ */ e(Rt, { className: "size-5" })
1295
1284
  }
1296
1285
  ) }),
1297
- /* @__PURE__ */ e(je, { side: "bottom", className: "text-xs", children: o("new_chat") })
1286
+ /* @__PURE__ */ e(Be, { side: "bottom", className: "text-xs", children: i("new_chat") })
1298
1287
  ] }),
1299
- i?.showSettings !== !1 && /* @__PURE__ */ e(
1300
- ka,
1288
+ l?.showSettings !== !1 && /* @__PURE__ */ e(
1289
+ _a,
1301
1290
  {
1302
1291
  trigger: /* @__PURE__ */ e(
1303
1292
  "button",
1304
1293
  {
1305
1294
  type: "button",
1306
1295
  className: "flex items-center justify-center size-9 rounded-lg hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 text-muted-foreground hover:text-primary",
1307
- children: /* @__PURE__ */ e(we, { className: "size-5" })
1296
+ children: /* @__PURE__ */ e(Ne, { className: "size-5" })
1308
1297
  }
1309
1298
  )
1310
1299
  }
@@ -1312,219 +1301,219 @@ function Qe({ hideActions: r = !1 }) {
1312
1301
  ] }) })
1313
1302
  ] });
1314
1303
  }
1315
- const Ae = 20;
1316
- function Ca() {
1317
- const t = T.getConfig().app?.cacheNamespace || "gentiq";
1318
- return Ye({
1304
+ const ze = 20;
1305
+ function Sa() {
1306
+ const t = M.getConfig().app?.cacheNamespace || "gentiq";
1307
+ return et({
1319
1308
  queryKey: [t, "conversations"],
1320
- queryFn: async ({ pageParam: o = 0 }) => {
1321
- const d = await T.getHistory(o, Ae);
1309
+ queryFn: async ({ pageParam: i = 0 }) => {
1310
+ const u = await M.getHistory(i, ze);
1322
1311
  return {
1323
- threads: d.threads.map((i) => ({
1324
- id: `/${i.id}`,
1325
- firstMessage: i.title || i.firstMessage || "Chat",
1326
- timestamp: new Date(i.created_at).getTime(),
1327
- pinned: !!i.pinned
1312
+ threads: u.threads.map((l) => ({
1313
+ id: `/${l.id}`,
1314
+ firstMessage: l.title || l.firstMessage || "Chat",
1315
+ timestamp: new Date(l.created_at).getTime(),
1316
+ pinned: !!l.pinned
1328
1317
  })),
1329
- nextSkip: o + Ae,
1330
- hasMore: o + d.threads.length < (d.total_count ?? 0)
1318
+ nextSkip: i + ze,
1319
+ hasMore: i + u.threads.length < (u.total_count ?? 0)
1331
1320
  };
1332
1321
  },
1333
1322
  initialPageParam: 0,
1334
- getNextPageParam: (o) => o.hasMore ? o.nextSkip : void 0,
1323
+ getNextPageParam: (i) => i.hasMore ? i.nextSkip : void 0,
1335
1324
  staleTime: 1e3 * 60 * 5
1336
1325
  // 5 minutes
1337
1326
  });
1338
1327
  }
1339
- async function _a(r, t, o, d) {
1340
- const c = T.getConfig().app?.cacheNamespace || "gentiq";
1328
+ async function Pa(a, t, i, u) {
1329
+ const d = M.getConfig().app?.cacheNamespace || "gentiq";
1341
1330
  try {
1342
- await T.deleteThread(r), t.invalidateQueries({ queryKey: [c, "conversations"] }), d === r && o("/");
1343
- } catch (m) {
1344
- console.error("Failed to delete conversation:", m), X.error("Failed to delete conversation");
1331
+ await M.deleteThread(a), t.invalidateQueries({ queryKey: [d, "conversations"] }), u === a && i("/");
1332
+ } catch (h) {
1333
+ console.error("Failed to delete conversation:", h), J.error("Failed to delete conversation");
1345
1334
  }
1346
1335
  }
1347
- function Sa({ side: r = "left" }) {
1348
- const { t, i18n: o } = le(["sidebar", "translation"]), {
1336
+ function Ma({ side: a = "left" }) {
1337
+ const { t, i18n: i } = ce(["sidebar", "translation"]), { setOpenMobile: u, isMobile: l } = ge(), {
1349
1338
  data: d,
1350
- fetchNextPage: i,
1351
- hasNextPage: c,
1339
+ fetchNextPage: h,
1340
+ hasNextPage: p,
1352
1341
  isFetchingNextPage: m,
1353
- isLoading: p
1354
- } = Ca(), { history: u, app: w } = te(), b = w?.basePath || "/", v = u?.enabled ?? !1, l = d?.pages.flatMap((a) => a.threads) ?? [], [S, _] = Ce(), q = pe(), O = ee(null), P = J(
1355
- (a) => {
1356
- O.current && (O.current.disconnect(), O.current = null), a && c && !m && (O.current = new IntersectionObserver(
1357
- (k) => {
1358
- k[0].isIntersecting && i();
1342
+ isLoading: N
1343
+ } = Sa(), { history: v, app: y } = te(), c = y?.basePath || "/", P = v?.enabled ?? !1, S = d?.pages.flatMap((s) => s.threads) ?? [], [z, B] = _e(), C = pe(), x = ee(null), g = Y(
1344
+ (s) => {
1345
+ x.current && (x.current.disconnect(), x.current = null), s && p && !m && (x.current = new IntersectionObserver(
1346
+ (H) => {
1347
+ H[0].isIntersecting && h();
1359
1348
  },
1360
1349
  {
1361
1350
  threshold: 0,
1362
1351
  rootMargin: "100px"
1363
1352
  }
1364
- ), O.current.observe(a));
1353
+ ), x.current.observe(s));
1365
1354
  },
1366
- [c, i, m]
1367
- ), h = T.getConfig().app?.cacheNamespace || "gentiq", [E, z] = C(!1), [I, H] = C(null), [B, F] = C(""), [L, U] = C(null), [K, f] = C(""), s = ee(null), x = J((a, k) => {
1368
- a.button !== 0 || a.metaKey || a.ctrlKey || (a.preventDefault(), _(k));
1369
- }, [_]), D = l.filter(
1370
- (a) => a.firstMessage?.toLowerCase().includes(B.toLowerCase())
1371
- ).sort((a, k) => a.pinned && !k.pinned ? -1 : !a.pinned && k.pinned ? 1 : k.timestamp - a.timestamp), A = async (a) => {
1355
+ [p, h, m]
1356
+ ), q = M.getConfig().app?.cacheNamespace || "gentiq", [D, j] = _(!1), [U, A] = _(null), [E, G] = _(""), [K, b] = _(null), [n, w] = _(""), T = ee(null), I = Y((s, H) => {
1357
+ s.button !== 0 || s.metaKey || s.ctrlKey || (s.preventDefault(), B(H), l && u(!1));
1358
+ }, [B, l, u]), W = S.filter(
1359
+ (s) => s.firstMessage?.toLowerCase().includes(E.toLowerCase())
1360
+ ).sort((s, H) => s.pinned && !H.pinned ? -1 : !s.pinned && H.pinned ? 1 : H.timestamp - s.timestamp), k = async (s) => {
1372
1361
  try {
1373
- await T.pinThread(a.id.replace(/^\//, ""), !a.pinned), q.invalidateQueries({ queryKey: [h, "conversations"] }), X.success(a.pinned ? t("unpinned_success") : t("pinned_success"));
1362
+ await M.pinThread(s.id.replace(/^\//, ""), !s.pinned), C.invalidateQueries({ queryKey: [q, "conversations"] }), J.success(s.pinned ? t("unpinned_success") : t("pinned_success"));
1374
1363
  } catch {
1375
- X.error(t("pin_failed"));
1364
+ J.error(t("pin_failed"));
1376
1365
  }
1377
- }, V = async (a) => {
1366
+ }, R = async (s) => {
1378
1367
  try {
1379
- const k = await T.shareThread(a.id.replace(/^\//, "")), M = `${window.location.origin}${k.url}`;
1380
- navigator.clipboard.writeText(M), X.success(t("share_success"), {
1368
+ const H = await M.shareThread(s.id.replace(/^\//, "")), fe = `${window.location.origin}${H.url}`;
1369
+ navigator.clipboard.writeText(fe), J.success(t("share_success"), {
1381
1370
  description: t("share_description")
1382
1371
  });
1383
1372
  } catch {
1384
- X.error(t("share_failed"));
1373
+ J.error(t("share_failed"));
1385
1374
  }
1386
- }, N = (a) => {
1387
- U(a.id), f(a.firstMessage ?? ""), setTimeout(() => s.current?.focus(), 0);
1388
- }, R = (a) => {
1389
- a?.preventDefault(), a?.stopPropagation(), U(null), f("");
1390
- }, W = async (a) => {
1391
- if (a?.preventDefault(), a && "stopPropagation" in a && a.stopPropagation(), !(!L || !K.trim()))
1375
+ }, X = (s) => {
1376
+ b(s.id), w(s.firstMessage ?? ""), setTimeout(() => T.current?.focus(), 0);
1377
+ }, se = (s) => {
1378
+ s?.preventDefault(), s?.stopPropagation(), b(null), w("");
1379
+ }, re = async (s) => {
1380
+ if (s?.preventDefault(), s && "stopPropagation" in s && s.stopPropagation(), !(!K || !n.trim()))
1392
1381
  try {
1393
- await T.updateThreadTitle(L, K), q.invalidateQueries({ queryKey: [h, "conversations"] }), U(null), X.success(t("rename_success"));
1382
+ await M.updateThreadTitle(K, n), C.invalidateQueries({ queryKey: [q, "conversations"] }), b(null), J.success(t("rename_success"));
1394
1383
  } catch {
1395
- X.error(t("rename_failed"));
1384
+ J.error(t("rename_failed"));
1396
1385
  }
1397
- }, ce = (a) => {
1398
- H(a), z(!0);
1399
- }, ae = () => {
1400
- I && (_a(I.id, q, _, S), z(!1), H(null), X.success(t("chat_deleted_success")));
1401
- }, ne = (a) => new Intl.DateTimeFormat(o.language, {
1386
+ }, oe = (s) => {
1387
+ A(s), j(!0);
1388
+ }, o = () => {
1389
+ U && (Pa(U.id, C, B, z), j(!1), A(null), J.success(t("chat_deleted_success")));
1390
+ }, F = (s) => new Intl.DateTimeFormat(i.language, {
1402
1391
  year: "numeric",
1403
1392
  month: "short",
1404
1393
  day: "numeric",
1405
1394
  hour: "2-digit",
1406
1395
  minute: "2-digit",
1407
- calendar: o.language === "fa" ? "persian" : "gregory"
1408
- }).format(new Date(a));
1409
- return /* @__PURE__ */ e(qe, { children: /* @__PURE__ */ n(ba, { collapsible: "icon", side: r, children: [
1410
- /* @__PURE__ */ e(ya, { className: "custom-scrollbar", children: /* @__PURE__ */ n(wa, { children: [
1411
- /* @__PURE__ */ e(De, { className: "mt-2 mb-6 px-2 group-data-[collapsible=icon]:px-0", children: /* @__PURE__ */ e(Ee, { className: "group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:justify-center", children: /* @__PURE__ */ e(
1412
- Le,
1396
+ calendar: i.language === "fa" ? "persian" : "gregory"
1397
+ }).format(new Date(s));
1398
+ return /* @__PURE__ */ e(je, { children: /* @__PURE__ */ r(xa, { collapsible: "icon", side: a, children: [
1399
+ /* @__PURE__ */ e(Na, { className: "custom-scrollbar", children: /* @__PURE__ */ r(ka, { children: [
1400
+ /* @__PURE__ */ e(Ee, { className: "mt-2 mb-6 px-2 group-data-[collapsible=icon]:px-0", children: /* @__PURE__ */ e(Le, { className: "group-data-[collapsible=icon]:flex group-data-[collapsible=icon]:justify-center", children: /* @__PURE__ */ e(
1401
+ Ae,
1413
1402
  {
1414
1403
  asChild: !0,
1415
1404
  tooltip: t("tooltip_new_conversation"),
1416
1405
  className: "h-[52px] rounded-2xl bg-white/40 dark:bg-white/5 border border-border/40 hover:border-primary/50 hover:bg-white/90 dark:hover:bg-white/10 text-foreground shadow-[0_4px_12px_-4px_rgba(0,0,0,0.1)] hover:shadow-[0_12px_30px_-10px_var(--glow)] transition-all duration-500 group-data-[collapsible=icon]:size-10 group-data-[collapsible=icon]:p-0! mb-2 group/new-chat overflow-hidden backdrop-blur-md group-data-[collapsible=icon]:mx-auto",
1417
- children: /* @__PURE__ */ n(
1406
+ children: /* @__PURE__ */ r(
1418
1407
  "a",
1419
1408
  {
1420
- href: fe(b, "/"),
1421
- onClick: (a) => x(a, "/"),
1409
+ href: be(c, "/"),
1410
+ onClick: (s) => I(s, "/"),
1422
1411
  className: "px-5 group-data-[collapsible=icon]:px-0 group-data-[collapsible=icon]:justify-center flex items-center gap-3 active:scale-[0.96] w-full h-full relative",
1423
1412
  children: [
1424
1413
  /* @__PURE__ */ e("div", { className: "absolute inset-0 bg-linear-to-tr from-primary/10 via-transparent to-primary/5 opacity-0 group-hover/new-chat:opacity-100 transition-opacity duration-700" }),
1425
- /* @__PURE__ */ e("div", { className: "relative size-8 rounded-xl bg-linear-to-br from-primary/20 to-primary/5 flex items-center justify-center shrink-0 group-hover/new-chat:from-primary/30 group-hover/new-chat:to-primary/10 transition-all duration-500 shadow-inner", children: /* @__PURE__ */ e(At, { className: "size-5! text-primary transition-all duration-700 group-hover/new-chat:rotate-180 group-hover/new-chat:scale-110" }) }),
1414
+ /* @__PURE__ */ e("div", { className: "relative size-8 rounded-xl bg-linear-to-br from-primary/20 to-primary/5 flex items-center justify-center shrink-0 group-hover/new-chat:from-primary/30 group-hover/new-chat:to-primary/10 transition-all duration-500 shadow-inner", children: /* @__PURE__ */ e(qt, { className: "size-5! text-primary transition-all duration-700 group-hover/new-chat:rotate-180 group-hover/new-chat:scale-110" }) }),
1426
1415
  /* @__PURE__ */ e("span", { className: "font-bold text-[0.95rem] group-data-[collapsible=icon]:hidden tracking-tight bg-clip-text text-foreground/90 group-hover/new-chat:text-foreground transition-colors", children: t("new_conversation") })
1427
1416
  ]
1428
1417
  }
1429
1418
  )
1430
1419
  }
1431
1420
  ) }) }),
1432
- v && /* @__PURE__ */ e(Ie, { className: "group-data-[collapsible=icon]:hidden mb-6 px-2", children: /* @__PURE__ */ n("div", { className: "relative group/search", children: [
1433
- /* @__PURE__ */ e(zt, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 opacity-40 group-focus-within/search:opacity-70 transition-opacity" }),
1421
+ P && /* @__PURE__ */ e(Ie, { className: "group-data-[collapsible=icon]:hidden mb-6 px-2", children: /* @__PURE__ */ r("div", { className: "relative group/search", children: [
1422
+ /* @__PURE__ */ e(Ft, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 opacity-40 group-focus-within/search:opacity-70 transition-opacity" }),
1434
1423
  /* @__PURE__ */ e(
1435
- G,
1424
+ V,
1436
1425
  {
1437
1426
  placeholder: t("search_conversations"),
1438
- value: B,
1439
- onChange: (a) => F(a.target.value),
1427
+ value: E,
1428
+ onChange: (s) => G(s.target.value),
1440
1429
  className: "pl-9 h-10 bg-accent/15 border border-border/40 focus-visible:ring-primary/20 rounded-xl transition-all"
1441
1430
  }
1442
1431
  )
1443
1432
  ] }) }),
1444
- v && /* @__PURE__ */ n(Ie, { className: "group-data-[collapsible=icon]:hidden", children: [
1445
- /* @__PURE__ */ n(De, { children: [
1446
- D.map((a, k) => {
1447
- const M = L === a.id, se = Se(a.firstMessage ?? ""), Ge = se === "rtl";
1448
- return /* @__PURE__ */ e(Ee, { className: "group/sidebar-menu-item relative", children: M ? /* @__PURE__ */ n("div", { className: "flex items-center gap-1 px-2 py-1.5 w-full", children: [
1433
+ P && /* @__PURE__ */ r(Ie, { className: "group-data-[collapsible=icon]:hidden", children: [
1434
+ /* @__PURE__ */ r(Ee, { children: [
1435
+ W.map((s, H) => {
1436
+ const fe = K === s.id, Se = Pe(s.firstMessage ?? ""), We = Se === "rtl";
1437
+ return /* @__PURE__ */ e(Le, { className: "group/sidebar-menu-item relative", children: fe ? /* @__PURE__ */ r("div", { className: "flex items-center gap-1 px-2 py-1.5 w-full", children: [
1449
1438
  /* @__PURE__ */ e(
1450
- G,
1439
+ V,
1451
1440
  {
1452
- ref: s,
1453
- value: K,
1454
- onChange: (oe) => f(oe.target.value),
1455
- onKeyDown: (oe) => {
1456
- oe.key === "Enter" && W(), oe.key === "Escape" && R();
1441
+ ref: T,
1442
+ value: n,
1443
+ onChange: (ie) => w(ie.target.value),
1444
+ onKeyDown: (ie) => {
1445
+ ie.key === "Enter" && re(), ie.key === "Escape" && se();
1457
1446
  },
1458
1447
  className: "h-8 py-0 px-2 text-sm",
1459
- dir: Se(K)
1448
+ dir: Pe(n)
1460
1449
  }
1461
1450
  ),
1462
- /* @__PURE__ */ e(Y, { size: "icon", variant: "ghost", className: "size-8 shrink-0 text-green-600 hover:text-green-700 hover:bg-green-50", onClick: W, children: /* @__PURE__ */ e(Rt, { className: "size-4" }) }),
1463
- /* @__PURE__ */ e(Y, { size: "icon", variant: "ghost", className: "size-8 shrink-0 text-destructive hover:bg-destructive/10", onClick: R, children: /* @__PURE__ */ e(qt, { className: "size-4" }) })
1464
- ] }) : /* @__PURE__ */ n(Ne, { children: [
1451
+ /* @__PURE__ */ e(Z, { size: "icon", variant: "ghost", className: "size-8 shrink-0 text-green-600 hover:text-green-700 hover:bg-green-50", onClick: re, children: /* @__PURE__ */ e(jt, { className: "size-4" }) }),
1452
+ /* @__PURE__ */ e(Z, { size: "icon", variant: "ghost", className: "size-8 shrink-0 text-destructive hover:bg-destructive/10", onClick: se, children: /* @__PURE__ */ e(Ot, { className: "size-4" }) })
1453
+ ] }) : /* @__PURE__ */ r(ke, { children: [
1465
1454
  /* @__PURE__ */ e(
1466
- Le,
1455
+ Ae,
1467
1456
  {
1468
1457
  asChild: !0,
1469
- className: g("h-auto py-2.5 px-3", {
1470
- "bg-accent opacity-100 pointer-events-none": a.id === S,
1471
- "opacity-70 hover:opacity-100": a.id !== S
1458
+ className: f("h-auto py-2.5 px-3", {
1459
+ "bg-accent opacity-100 pointer-events-none": s.id === z,
1460
+ "opacity-70 hover:opacity-100": s.id !== z
1472
1461
  }),
1473
- children: /* @__PURE__ */ n(
1462
+ children: /* @__PURE__ */ r(
1474
1463
  "a",
1475
1464
  {
1476
- href: fe(b, a.id),
1477
- onClick: (oe) => x(oe, a.id),
1478
- dir: se,
1479
- className: g("flex flex-col gap-0.5 w-full overflow-hidden", Ge ? "items-end" : "items-start"),
1465
+ href: be(c, s.id),
1466
+ onClick: (ie) => I(ie, s.id),
1467
+ dir: Se,
1468
+ className: f("flex flex-col gap-0.5 w-full overflow-hidden", We ? "items-end" : "items-start"),
1480
1469
  children: [
1481
- /* @__PURE__ */ e("span", { className: g("truncate w-full font-medium text-[0.9375rem]", o.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: a.firstMessage }),
1482
- /* @__PURE__ */ e("div", { className: g("text-[10px] opacity-40 w-full", o.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: ne(a.timestamp) })
1470
+ /* @__PURE__ */ e("span", { className: f("truncate w-full font-medium text-[0.9375rem]", i.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: s.firstMessage }),
1471
+ /* @__PURE__ */ e("div", { className: f("text-[10px] opacity-40 w-full", i.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"), children: F(s.timestamp) })
1483
1472
  ]
1484
1473
  }
1485
1474
  )
1486
1475
  }
1487
1476
  ),
1488
- /* @__PURE__ */ n("div", { className: g(
1477
+ /* @__PURE__ */ r("div", { className: f(
1489
1478
  "absolute top-1/2 -translate-y-1/2 flex items-center gap-1 transition-all duration-200 z-10",
1490
- o.language === "fa" ? "left-2" : "right-1.5"
1479
+ i.language === "fa" ? "left-2" : "right-1.5"
1491
1480
  ), children: [
1492
- a.pinned && /* @__PURE__ */ e(Te, { className: "size-3.5 text-primary opacity-70 md:absolute md:inset-0 md:m-auto md:group-hover/sidebar-menu-item:opacity-0 transition-opacity pointer-events-none" }),
1493
- /* @__PURE__ */ n(ot, { dir: o.language === "fa" ? "rtl" : "ltr", children: [
1494
- /* @__PURE__ */ e(it, { asChild: !0, children: /* @__PURE__ */ e(
1495
- Y,
1481
+ s.pinned && /* @__PURE__ */ e(De, { className: "size-3.5 text-primary opacity-70 md:absolute md:inset-0 md:m-auto md:group-hover/sidebar-menu-item:opacity-0 transition-opacity pointer-events-none" }),
1482
+ /* @__PURE__ */ r(ct, { dir: i.language === "fa" ? "rtl" : "ltr", children: [
1483
+ /* @__PURE__ */ e(dt, { asChild: !0, children: /* @__PURE__ */ e(
1484
+ Z,
1496
1485
  {
1497
1486
  variant: "ghost",
1498
1487
  size: "icon",
1499
1488
  className: "size-7 rounded-full opacity-100 md:opacity-0 md:group-hover/sidebar-menu-item:opacity-100 hover:bg-accent hover:text-accent-foreground data-[state=open]:opacity-100 transition-all",
1500
- children: /* @__PURE__ */ e(Ft, { className: "size-3.5" })
1489
+ children: /* @__PURE__ */ e($t, { className: "size-3.5" })
1501
1490
  }
1502
1491
  ) }),
1503
- /* @__PURE__ */ n(
1504
- lt,
1492
+ /* @__PURE__ */ r(
1493
+ ut,
1505
1494
  {
1506
1495
  align: "end",
1507
1496
  className: "min-w-[120px] p-1",
1508
1497
  children: [
1509
- u?.showPin !== !1 && /* @__PURE__ */ n(de, { onSelect: () => A(a), className: "cursor-pointer flex items-center gap-2", children: [
1510
- a.pinned ? /* @__PURE__ */ e(Ot, { className: "size-4" }) : /* @__PURE__ */ e(Te, { className: "size-4" }),
1511
- /* @__PURE__ */ e("span", { children: a.pinned ? t("unpin_conversation") : t("pin_conversation") })
1498
+ v?.showPin !== !1 && /* @__PURE__ */ r(de, { onSelect: () => k(s), className: "cursor-pointer flex items-center gap-2", children: [
1499
+ s.pinned ? /* @__PURE__ */ e(Bt, { className: "size-4" }) : /* @__PURE__ */ e(De, { className: "size-4" }),
1500
+ /* @__PURE__ */ e("span", { children: s.pinned ? t("unpin_conversation") : t("pin_conversation") })
1512
1501
  ] }),
1513
- u?.showShare !== !1 && /* @__PURE__ */ n(de, { onSelect: () => V(a), className: "cursor-pointer flex items-center gap-2", children: [
1514
- /* @__PURE__ */ e(jt, { className: "size-4" }),
1502
+ v?.showShare !== !1 && /* @__PURE__ */ r(de, { onSelect: () => R(s), className: "cursor-pointer flex items-center gap-2", children: [
1503
+ /* @__PURE__ */ e(Ut, { className: "size-4" }),
1515
1504
  /* @__PURE__ */ e("span", { children: t("share_conversation") })
1516
1505
  ] }),
1517
- (u?.showRename ?? !1) && /* @__PURE__ */ n(de, { onSelect: () => N(a), className: "cursor-pointer flex items-center gap-2", children: [
1518
- /* @__PURE__ */ e($t, { className: "size-4" }),
1506
+ (v?.showRename ?? !1) && /* @__PURE__ */ r(de, { onSelect: () => X(s), className: "cursor-pointer flex items-center gap-2", children: [
1507
+ /* @__PURE__ */ e(Kt, { className: "size-4" }),
1519
1508
  /* @__PURE__ */ e("span", { children: t("rename_conversation") })
1520
1509
  ] }),
1521
- (u?.showDelete ?? !1) && /* @__PURE__ */ n(
1510
+ (v?.showDelete ?? !1) && /* @__PURE__ */ r(
1522
1511
  de,
1523
1512
  {
1524
1513
  className: "text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer flex items-center gap-2",
1525
- onSelect: () => ce(a),
1514
+ onSelect: () => oe(s),
1526
1515
  children: [
1527
- /* @__PURE__ */ e(Bt, { className: "size-4" }),
1516
+ /* @__PURE__ */ e(Ht, { className: "size-4" }),
1528
1517
  /* @__PURE__ */ e("span", { children: t("delete_conversation") })
1529
1518
  ]
1530
1519
  }
@@ -1534,67 +1523,67 @@ function Sa({ side: r = "left" }) {
1534
1523
  )
1535
1524
  ] })
1536
1525
  ] })
1537
- ] }) }, k);
1526
+ ] }) }, H);
1538
1527
  }),
1539
- !p && l.length === 0 && !B && /* @__PURE__ */ e("div", { className: "px-4 py-8 text-center text-sm opacity-40", children: t("no_conversations") })
1528
+ !N && S.length === 0 && !E && /* @__PURE__ */ e("div", { className: "px-4 py-8 text-center text-sm opacity-40", children: t("no_conversations") })
1540
1529
  ] }),
1541
- /* @__PURE__ */ e("div", { ref: P, className: "h-4 w-full" }),
1542
- m && /* @__PURE__ */ n("div", { className: "flex flex-col items-center gap-2 p-4 pt-0 opacity-60", children: [
1530
+ /* @__PURE__ */ e("div", { ref: g, className: "h-4 w-full" }),
1531
+ m && /* @__PURE__ */ r("div", { className: "flex flex-col items-center gap-2 p-4 pt-0 opacity-60", children: [
1543
1532
  /* @__PURE__ */ e("div", { className: "size-4 border-2 border-primary border-t-transparent rounded-full animate-spin" }),
1544
1533
  /* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wider font-medium", children: t("loading_more") })
1545
1534
  ] })
1546
1535
  ] })
1547
1536
  ] }) }),
1548
- /* @__PURE__ */ e(xa, {}),
1549
- /* @__PURE__ */ e(Be, { open: E, onOpenChange: z, children: /* @__PURE__ */ n(
1550
- Ue,
1537
+ /* @__PURE__ */ e(wa, {}),
1538
+ /* @__PURE__ */ e(Ke, { open: D, onOpenChange: j, children: /* @__PURE__ */ r(
1539
+ He,
1551
1540
  {
1552
- onKeyDown: (a) => {
1553
- a.key === "Enter" && (a.preventDefault(), ae());
1541
+ onKeyDown: (s) => {
1542
+ s.key === "Enter" && (s.preventDefault(), o());
1554
1543
  },
1555
1544
  children: [
1556
- /* @__PURE__ */ n(ct, { children: [
1557
- /* @__PURE__ */ e(dt, { children: t("delete_confirm_title") }),
1558
- /* @__PURE__ */ e(ut, { children: t("delete_confirm_description") })
1545
+ /* @__PURE__ */ r(mt, { children: [
1546
+ /* @__PURE__ */ e(ht, { children: t("delete_confirm_title") }),
1547
+ /* @__PURE__ */ e(pt, { children: t("delete_confirm_description") })
1559
1548
  ] }),
1560
- /* @__PURE__ */ n(mt, { children: [
1549
+ /* @__PURE__ */ r(gt, { children: [
1561
1550
  /* @__PURE__ */ e(
1562
- Y,
1551
+ Z,
1563
1552
  {
1564
1553
  variant: "outline",
1565
1554
  onClick: () => {
1566
- z(!1);
1555
+ j(!1);
1567
1556
  },
1568
1557
  children: t("cancel")
1569
1558
  }
1570
1559
  ),
1571
- /* @__PURE__ */ e(Y, { variant: "destructive", onClick: ae, autoFocus: !0, children: t("delete") })
1560
+ /* @__PURE__ */ e(Z, { variant: "destructive", onClick: o, autoFocus: !0, children: t("delete") })
1572
1561
  ] })
1573
1562
  ]
1574
1563
  }
1575
1564
  ) })
1576
1565
  ] }) });
1577
1566
  }
1578
- function Ka({ sidebar: r, header: t, components: o, classNames: d, disclaimer: i, welcome: c }) {
1579
- const { config: m } = Re(), { history: p } = te(), u = m?.language === "fa" ? "right" : "left", w = p?.enabled ?? !0;
1580
- return /* @__PURE__ */ n(fa, { defaultOpen: w, children: [
1581
- r !== void 0 ? r : w ? /* @__PURE__ */ e(Sa, { side: u }) : null,
1582
- /* @__PURE__ */ n("div", { className: "flex flex-col flex-1 h-dvh overflow-hidden relative", children: [
1583
- t !== void 0 ? t : /* @__PURE__ */ e(Qe, {}),
1567
+ function Qa({ sidebar: a, header: t, components: i, classNames: u, disclaimer: l, welcome: d }) {
1568
+ const { config: h } = Fe(), { history: p } = te(), m = h?.language === "fa" ? "right" : "left", N = p?.enabled ?? !0;
1569
+ return /* @__PURE__ */ r(va, { defaultOpen: N, children: [
1570
+ a !== void 0 ? a : N ? /* @__PURE__ */ e(Ma, { side: m }) : null,
1571
+ /* @__PURE__ */ r("div", { className: "flex flex-col flex-1 h-dvh overflow-hidden relative", children: [
1572
+ t !== void 0 ? t : /* @__PURE__ */ e(Ve, {}),
1584
1573
  /* @__PURE__ */ e(
1585
1574
  "div",
1586
1575
  {
1587
- className: g(
1576
+ className: f(
1588
1577
  "flex flex-col relative w-full flex-1 min-h-0 overflow-hidden",
1589
1578
  "has-[.stick-to-bottom:empty]:overflow-visible has-[.stick-to-bottom:empty]:flex-initial transition-[flex] duration-200"
1590
1579
  ),
1591
1580
  children: /* @__PURE__ */ e(
1592
- ta,
1581
+ na,
1593
1582
  {
1594
- components: o,
1595
- classNames: d,
1596
- disclaimer: i,
1597
- welcome: c
1583
+ components: i,
1584
+ classNames: u,
1585
+ disclaimer: l,
1586
+ welcome: d
1598
1587
  }
1599
1588
  )
1600
1589
  }
@@ -1602,78 +1591,79 @@ function Ka({ sidebar: r, header: t, components: o, classNames: d, disclaimer: i
1602
1591
  ] })
1603
1592
  ] });
1604
1593
  }
1605
- function Ha({ children: r }) {
1606
- const [t, o] = C(null), d = Ke(), i = ke(), c = pe();
1594
+ function Ga({ children: a }) {
1595
+ const [t, i] = _(null), u = Qe(), l = Ce(), d = pe();
1607
1596
  return $(() => {
1608
1597
  (async () => {
1609
- const p = new URLSearchParams(d.search), u = p.get("token");
1610
- if (u)
1598
+ const p = new URLSearchParams(u.search), m = p.get("token");
1599
+ if (m)
1611
1600
  try {
1612
- T.setToken(u), await T.getBalance(), p.delete("token");
1613
- const b = p.toString(), v = d.pathname + (b ? `?${b}` : "");
1614
- i(v, { replace: !0 }), o(!0);
1601
+ M.setToken(m), await M.getBalance(), p.delete("token");
1602
+ const v = p.toString(), y = u.pathname + (v ? `?${v}` : "");
1603
+ l(y, { replace: !0 }), i(!0);
1615
1604
  return;
1616
- } catch (b) {
1617
- console.error("Error validating token from URL:", b), o(!1);
1605
+ } catch (v) {
1606
+ console.error("Error validating token from URL:", v), i(!1);
1618
1607
  return;
1619
1608
  }
1620
- if (!T.getToken()) {
1621
- o(!1);
1609
+ if (!M.getToken()) {
1610
+ i(!1);
1622
1611
  return;
1623
1612
  }
1624
1613
  try {
1625
- await T.getBalance(), o(!0);
1626
- } catch (b) {
1627
- console.error("Token validation failed:", b), b.status === 401 ? (T.clearToken(), c.clear(), o(!1)) : o(!0);
1614
+ await M.getBalance(), i(!0);
1615
+ } catch (v) {
1616
+ console.error("Token validation failed:", v), v.status === 401 ? (M.clearToken(), d.clear(), i(!1)) : i(!0);
1628
1617
  }
1629
1618
  })();
1630
- }, [d.search, i, d.pathname, c]), t === null ? /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) : t ? /* @__PURE__ */ e(Ne, { children: r }) : /* @__PURE__ */ e(Gt, { to: "/login", replace: !0 });
1619
+ }, [u.search, l, u.pathname, d]), t === null ? /* @__PURE__ */ e("div", { className: "flex h-screen w-full items-center justify-center", children: /* @__PURE__ */ e("div", { className: "size-8 rounded-full border-4 border-primary border-t-transparent animate-spin" }) }) : t ? /* @__PURE__ */ e(ke, { children: a }) : /* @__PURE__ */ e(Xt, { to: "/login", replace: !0 });
1631
1620
  }
1632
- function Qa() {
1633
- const { t: r, i18n: t } = le(["login", "translation"]), { app: o } = te(), d = t.dir() === "rtl", i = d ? "text-right" : "text-left", c = ke(), m = pe(), [p, u] = C("login"), [w, b] = C(""), [v, l] = C(""), [S, _] = C(""), [q, O] = C(""), [P, y] = C(""), [h, E] = C(""), z = j(() => o?.userMetadataFields?.filter((s) => s.showInSignup) || [], [o?.userMetadataFields]), [I, H] = C(() => {
1634
- const s = {};
1635
- return z.forEach((x) => {
1636
- x.defaultValue !== void 0 && (s[x.key] = x.defaultValue);
1637
- }), s;
1621
+ const Re = (a) => a.replace(/[^0-9]/g, "");
1622
+ function Va() {
1623
+ const { t: a, i18n: t } = ce(["login", "translation"]), { app: i } = te(), u = t.dir() === "rtl", l = u ? "text-right" : "text-left", d = Ce(), h = pe(), [p, m] = _("login"), [N, v] = _(""), [y, c] = _(""), [P, S] = _(""), [z, B] = _(""), [C, x] = _(""), [g, L] = _(""), q = O(() => i?.userMetadataFields?.filter((n) => n.showInSignup) || [], [i?.userMetadataFields]), [D, j] = _(() => {
1624
+ const n = {};
1625
+ return q.forEach((w) => {
1626
+ w.defaultValue !== void 0 && (n[w.key] = w.defaultValue);
1627
+ }), n;
1638
1628
  });
1639
1629
  $(() => {
1640
- const s = { ...I };
1641
- let x = !1;
1642
- z.forEach((D) => {
1643
- D.condition && !he(D.condition, I) && s[D.key] !== void 0 && (delete s[D.key], x = !0);
1644
- }), x && H(s);
1645
- }, [I, z]);
1646
- const [B, F] = C(""), [L, U] = C(!1), K = async (s) => {
1647
- s.preventDefault(), F(""), U(!0);
1630
+ const n = { ...D };
1631
+ let w = !1;
1632
+ q.forEach((T) => {
1633
+ T.condition && !he(T.condition, D) && n[T.key] !== void 0 && (delete n[T.key], w = !0);
1634
+ }), w && j(n);
1635
+ }, [D, q]);
1636
+ const [U, A] = _(""), [E, G] = _(!1), K = async (n) => {
1637
+ n.preventDefault(), A(""), G(!0);
1648
1638
  try {
1649
- await T.login(w, v), m.clear(), c("/");
1650
- } catch (x) {
1651
- F(ie(x, r));
1639
+ await M.login(N, y), h.clear(), d("/");
1640
+ } catch (w) {
1641
+ A(le(w, a));
1652
1642
  } finally {
1653
- U(!1);
1643
+ G(!1);
1654
1644
  }
1655
- }, f = async (s) => {
1656
- s.preventDefault(), F(""), U(!0);
1645
+ }, b = async (n) => {
1646
+ n.preventDefault(), A(""), G(!0);
1657
1647
  try {
1658
- await T.register(S, q, P, h, I), m.clear(), c("/");
1659
- } catch (x) {
1660
- F(ie(x, r));
1648
+ await M.register(P, z, C, g, D), h.clear(), d("/");
1649
+ } catch (w) {
1650
+ A(le(w, a));
1661
1651
  } finally {
1662
- U(!1);
1652
+ G(!1);
1663
1653
  }
1664
1654
  };
1665
- return /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex flex-col items-center justify-center p-4", dir: t.dir(), children: /* @__PURE__ */ n("div", { className: "w-full max-w-md bg-card border border-border rounded-xl shadow-lg p-6", children: [
1666
- /* @__PURE__ */ e("div", { className: "text-center mb-6", children: /* @__PURE__ */ e("h1", { className: "text-2xl font-bold bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent", children: o?.name }) }),
1667
- /* @__PURE__ */ n("div", { className: "flex bg-muted p-1 rounded-lg mb-6", children: [
1655
+ return /* @__PURE__ */ e("div", { className: "min-h-screen bg-background flex flex-col items-center justify-center p-4", dir: t.dir(), children: /* @__PURE__ */ r("div", { className: "w-full max-w-md bg-card border border-border rounded-xl shadow-lg p-6", children: [
1656
+ /* @__PURE__ */ e("div", { className: "text-center mb-6", children: /* @__PURE__ */ e("h1", { className: "text-2xl font-bold bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent", children: i?.name }) }),
1657
+ /* @__PURE__ */ r("div", { className: "flex bg-muted p-1 rounded-lg mb-6", children: [
1668
1658
  /* @__PURE__ */ e(
1669
1659
  "button",
1670
1660
  {
1671
1661
  type: "button",
1672
1662
  onClick: () => {
1673
- u("login"), F("");
1663
+ m("login"), A("");
1674
1664
  },
1675
1665
  className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${p === "login" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
1676
- children: r("login_tab", "Login")
1666
+ children: a("login_tab", "Login")
1677
1667
  }
1678
1668
  ),
1679
1669
  /* @__PURE__ */ e(
@@ -1681,39 +1671,39 @@ function Qa() {
1681
1671
  {
1682
1672
  type: "button",
1683
1673
  onClick: () => {
1684
- u("register"), F("");
1674
+ m("register"), A("");
1685
1675
  },
1686
1676
  className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${p === "register" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
1687
- children: r("signup_tab", "Sign Up")
1677
+ children: a("signup_tab", "Sign Up")
1688
1678
  }
1689
1679
  )
1690
1680
  ] }),
1691
- p === "login" && /* @__PURE__ */ n("form", { onSubmit: K, className: "space-y-4", children: [
1692
- /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1693
- /* @__PURE__ */ e(Q, { htmlFor: "login-phone", children: r("phone", "Phone") }),
1681
+ p === "login" && /* @__PURE__ */ r("form", { onSubmit: K, className: "space-y-4", children: [
1682
+ /* @__PURE__ */ r("div", { className: "space-y-3", children: [
1683
+ /* @__PURE__ */ e(Q, { htmlFor: "login-phone", children: a("phone", "Phone") }),
1694
1684
  /* @__PURE__ */ e(
1695
- G,
1685
+ V,
1696
1686
  {
1697
1687
  id: "login-phone",
1698
1688
  type: "tel",
1699
- value: w,
1700
- onChange: (s) => b(s.target.value),
1689
+ value: N,
1690
+ onChange: (n) => v(Re(n.target.value)),
1701
1691
  required: !0,
1702
1692
  className: "text-left",
1703
- placeholder: r("phone_placeholder", "Phone number"),
1693
+ placeholder: a("phone_placeholder", "Phone number"),
1704
1694
  dir: "ltr"
1705
1695
  }
1706
1696
  )
1707
1697
  ] }),
1708
- /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1709
- /* @__PURE__ */ e(Q, { htmlFor: "login-pass", children: r("password", "Password") }),
1698
+ /* @__PURE__ */ r("div", { className: "space-y-3", children: [
1699
+ /* @__PURE__ */ e(Q, { htmlFor: "login-pass", children: a("password", "Password") }),
1710
1700
  /* @__PURE__ */ e(
1711
- G,
1701
+ V,
1712
1702
  {
1713
1703
  id: "login-pass",
1714
1704
  type: "password",
1715
- value: v,
1716
- onChange: (s) => l(s.target.value),
1705
+ value: y,
1706
+ onChange: (n) => c(n.target.value),
1717
1707
  required: !0,
1718
1708
  className: "text-left",
1719
1709
  placeholder: "••••••••",
@@ -1721,43 +1711,43 @@ function Qa() {
1721
1711
  }
1722
1712
  )
1723
1713
  ] }),
1724
- B && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: B }),
1714
+ U && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: U }),
1725
1715
  /* @__PURE__ */ e(
1726
- Y,
1716
+ Z,
1727
1717
  {
1728
1718
  type: "submit",
1729
- disabled: L,
1719
+ disabled: E,
1730
1720
  className: "w-full font-semibold",
1731
- children: L ? r("logging_in", "Logging in...") : r("login_button", "Login")
1721
+ children: E ? a("logging_in", "Logging in...") : a("login_button", "Login")
1732
1722
  }
1733
1723
  )
1734
1724
  ] }),
1735
- p === "register" && /* @__PURE__ */ n("form", { onSubmit: f, className: "space-y-4", children: [
1736
- /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1737
- /* @__PURE__ */ e(Q, { htmlFor: "reg-phone", children: r("phone", "Phone") }),
1725
+ p === "register" && /* @__PURE__ */ r("form", { onSubmit: b, className: "space-y-4", children: [
1726
+ /* @__PURE__ */ r("div", { className: "space-y-3", children: [
1727
+ /* @__PURE__ */ e(Q, { htmlFor: "reg-phone", children: a("phone", "Phone") }),
1738
1728
  /* @__PURE__ */ e(
1739
- G,
1729
+ V,
1740
1730
  {
1741
1731
  id: "reg-phone",
1742
1732
  type: "tel",
1743
- value: S,
1744
- onChange: (s) => _(s.target.value),
1733
+ value: P,
1734
+ onChange: (n) => S(Re(n.target.value)),
1745
1735
  required: !0,
1746
1736
  className: "text-left",
1747
- placeholder: r("phone_placeholder", "Phone number"),
1737
+ placeholder: a("phone_placeholder", "Phone number"),
1748
1738
  dir: "ltr"
1749
1739
  }
1750
1740
  )
1751
1741
  ] }),
1752
- /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1753
- /* @__PURE__ */ e(Q, { htmlFor: "reg-pass", children: r("password", "Password") }),
1742
+ /* @__PURE__ */ r("div", { className: "space-y-3", children: [
1743
+ /* @__PURE__ */ e(Q, { htmlFor: "reg-pass", children: a("password", "Password") }),
1754
1744
  /* @__PURE__ */ e(
1755
- G,
1745
+ V,
1756
1746
  {
1757
1747
  id: "reg-pass",
1758
1748
  type: "password",
1759
- value: q,
1760
- onChange: (s) => O(s.target.value),
1749
+ value: z,
1750
+ onChange: (n) => B(n.target.value),
1761
1751
  required: !0,
1762
1752
  className: "text-left",
1763
1753
  placeholder: "••••••••",
@@ -1765,128 +1755,128 @@ function Qa() {
1765
1755
  }
1766
1756
  )
1767
1757
  ] }),
1768
- /* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-4", children: [
1769
- /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1770
- /* @__PURE__ */ e(Q, { htmlFor: "reg-name", children: r("name", "Name") }),
1758
+ /* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
1759
+ /* @__PURE__ */ r("div", { className: "space-y-3", children: [
1760
+ /* @__PURE__ */ e(Q, { htmlFor: "reg-name", children: a("name", "Name") }),
1771
1761
  /* @__PURE__ */ e(
1772
- G,
1762
+ V,
1773
1763
  {
1774
1764
  id: "reg-name",
1775
1765
  type: "text",
1776
- value: P,
1777
- onChange: (s) => y(s.target.value),
1766
+ value: C,
1767
+ onChange: (n) => x(n.target.value),
1778
1768
  required: !0,
1779
- className: i,
1780
- placeholder: r("name_placeholder", "First Name")
1769
+ className: l,
1770
+ placeholder: a("name_placeholder", "First Name")
1781
1771
  }
1782
1772
  )
1783
1773
  ] }),
1784
- /* @__PURE__ */ n("div", { className: "space-y-3", children: [
1785
- /* @__PURE__ */ e(Q, { htmlFor: "reg-surname", children: r("surname", "Surname") }),
1774
+ /* @__PURE__ */ r("div", { className: "space-y-3", children: [
1775
+ /* @__PURE__ */ e(Q, { htmlFor: "reg-surname", children: a("surname", "Surname") }),
1786
1776
  /* @__PURE__ */ e(
1787
- G,
1777
+ V,
1788
1778
  {
1789
1779
  id: "reg-surname",
1790
1780
  type: "text",
1791
- value: h,
1792
- onChange: (s) => E(s.target.value),
1781
+ value: g,
1782
+ onChange: (n) => L(n.target.value),
1793
1783
  required: !0,
1794
- className: i,
1795
- placeholder: r("surname_placeholder", "Last Name")
1784
+ className: l,
1785
+ placeholder: a("surname_placeholder", "Last Name")
1796
1786
  }
1797
1787
  )
1798
1788
  ] })
1799
1789
  ] }),
1800
- z.map((s) => he(s.condition, I) ? /* @__PURE__ */ n("div", { className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200", children: [
1801
- /* @__PURE__ */ e(Q, { htmlFor: `signup-${s.key}`, children: r(s.label) }),
1802
- s.type === "select" ? /* @__PURE__ */ n(
1803
- be,
1790
+ q.map((n) => he(n.condition, D) ? /* @__PURE__ */ r("div", { className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200", children: [
1791
+ /* @__PURE__ */ e(Q, { htmlFor: `signup-${n.key}`, children: a(n.label) }),
1792
+ n.type === "select" ? /* @__PURE__ */ r(
1793
+ ve,
1804
1794
  {
1805
- value: String(I[s.key] || ""),
1806
- onValueChange: (x) => H({ ...I, [s.key]: x }),
1807
- required: s.required,
1808
- dir: d ? "rtl" : "ltr",
1795
+ value: String(D[n.key] || ""),
1796
+ onValueChange: (w) => j({ ...D, [n.key]: w }),
1797
+ required: n.required,
1798
+ dir: u ? "rtl" : "ltr",
1809
1799
  children: [
1810
- /* @__PURE__ */ e(ve, { className: g("bg-background", i), children: /* @__PURE__ */ e(xe, { placeholder: r(s.placeholder || "select_placeholder") }) }),
1811
- /* @__PURE__ */ e(ye, { className: "rounded-xl", children: s.options?.map((x) => /* @__PURE__ */ e(me, { value: String(x.value), children: r(x.label) }, String(x.value))) })
1800
+ /* @__PURE__ */ e(xe, { className: f("bg-background", l), children: /* @__PURE__ */ e(ye, { placeholder: a(n.placeholder || "select_placeholder") }) }),
1801
+ /* @__PURE__ */ e(we, { className: "rounded-xl", children: n.options?.map((w) => /* @__PURE__ */ e(me, { value: String(w.value), children: a(w.label) }, String(w.value))) })
1812
1802
  ]
1813
1803
  }
1814
- ) : s.type === "checkbox" ? /* @__PURE__ */ n("div", { className: "flex items-center gap-2 py-2", children: [
1804
+ ) : n.type === "checkbox" ? /* @__PURE__ */ r("div", { className: "flex items-center gap-2 py-2", children: [
1815
1805
  /* @__PURE__ */ e(
1816
- ht,
1806
+ ft,
1817
1807
  {
1818
- id: `signup-${s.key}`,
1819
- checked: !!I[s.key],
1820
- onCheckedChange: (x) => H({ ...I, [s.key]: !!x }),
1821
- required: s.required
1808
+ id: `signup-${n.key}`,
1809
+ checked: !!D[n.key],
1810
+ onCheckedChange: (w) => j({ ...D, [n.key]: !!w }),
1811
+ required: n.required
1822
1812
  }
1823
1813
  ),
1824
- /* @__PURE__ */ e("label", { htmlFor: `signup-${s.key}`, className: "text-sm text-muted-foreground cursor-pointer select-none", children: r(s.placeholder || s.label) })
1814
+ /* @__PURE__ */ e("label", { htmlFor: `signup-${n.key}`, className: "text-sm text-muted-foreground cursor-pointer select-none", children: a(n.placeholder || n.label) })
1825
1815
  ] }) : /* @__PURE__ */ e(
1826
- G,
1816
+ V,
1827
1817
  {
1828
- id: `signup-${s.key}`,
1829
- type: s.type,
1830
- value: I[s.key] || "",
1831
- onChange: (x) => H({ ...I, [s.key]: x.target.value }),
1832
- required: s.required,
1833
- className: i,
1834
- placeholder: r(s.placeholder || "")
1818
+ id: `signup-${n.key}`,
1819
+ type: n.type,
1820
+ value: D[n.key] || "",
1821
+ onChange: (w) => j({ ...D, [n.key]: w.target.value }),
1822
+ required: n.required,
1823
+ className: l,
1824
+ placeholder: a(n.placeholder || "")
1835
1825
  }
1836
1826
  )
1837
- ] }, s.key) : null),
1838
- B && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: B }),
1827
+ ] }, n.key) : null),
1828
+ U && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: U }),
1839
1829
  /* @__PURE__ */ e(
1840
- Y,
1830
+ Z,
1841
1831
  {
1842
1832
  type: "submit",
1843
- disabled: L,
1833
+ disabled: E,
1844
1834
  className: "w-full font-semibold",
1845
- children: L ? r("signing_up", "Signing up...") : r("signup_button", "Sign Up")
1835
+ children: E ? a("signing_up", "Signing up...") : a("signup_button", "Sign Up")
1846
1836
  }
1847
1837
  )
1848
1838
  ] })
1849
1839
  ] }) });
1850
1840
  }
1851
- function Pa() {
1852
- const { shareId: r } = Vt(), [t, o] = C(null), [d, i] = C(!0), [c, m] = C(null), { MessageList: p } = te(), u = ee(/* @__PURE__ */ new Set());
1841
+ function Ta() {
1842
+ const { shareId: a } = Jt(), [t, i] = _(null), [u, l] = _(!0), [d, h] = _(null), { MessageList: p } = te(), m = ee(/* @__PURE__ */ new Set());
1853
1843
  return $(() => () => {
1854
- u.current.forEach((w) => URL.revokeObjectURL(w)), u.current.clear();
1844
+ m.current.forEach((N) => URL.revokeObjectURL(N)), m.current.clear();
1855
1845
  }, []), $(() => {
1856
- if (!r) return;
1846
+ if (!a) return;
1857
1847
  (async () => {
1858
1848
  try {
1859
- i(!0);
1860
- const b = await T.getSharedThread(r);
1861
- b.items && (b.items = await Promise.all(
1862
- b.items.map(async (v) => {
1863
- if (!v.parts) return v;
1864
- const l = await Promise.all(
1865
- v.parts.map(async (S) => {
1866
- if (S.type === "file" && S.object_name && !S.url)
1849
+ l(!0);
1850
+ const v = await M.getSharedThread(a);
1851
+ v.items && (v.items = await Promise.all(
1852
+ v.items.map(async (y) => {
1853
+ if (!y.parts) return y;
1854
+ const c = await Promise.all(
1855
+ y.parts.map(async (P) => {
1856
+ if (P.type === "file" && P.object_name && !P.url)
1867
1857
  try {
1868
- const _ = await T.getPublicAttachmentBlobUrl(S.object_name);
1869
- return u.current.add(_), { ...S, url: _ };
1870
- } catch (_) {
1871
- console.error("Failed to resolve shared attachment:", S.object_name, _);
1858
+ const S = await M.getPublicAttachmentBlobUrl(P.object_name);
1859
+ return m.current.add(S), { ...P, url: S };
1860
+ } catch (S) {
1861
+ console.error("Failed to resolve shared attachment:", P.object_name, S);
1872
1862
  }
1873
- return S;
1863
+ return P;
1874
1864
  })
1875
1865
  );
1876
- return { ...v, parts: l };
1866
+ return { ...y, parts: c };
1877
1867
  })
1878
- )), o(b);
1879
- } catch (b) {
1880
- console.error("Failed to fetch shared chat:", b), m(b.message || "Failed to load shared chat");
1868
+ )), i(v);
1869
+ } catch (v) {
1870
+ console.error("Failed to fetch shared chat:", v), h(v.message || "Failed to load shared chat");
1881
1871
  } finally {
1882
- i(!1);
1872
+ l(!1);
1883
1873
  }
1884
1874
  })();
1885
- }, [r]), d ? /* @__PURE__ */ e("div", { className: "flex h-dvh items-center justify-center", children: /* @__PURE__ */ e(pt, {}) }) : c || !t ? /* @__PURE__ */ n("div", { className: "flex h-dvh flex-col items-center justify-center p-4 text-center", children: [
1875
+ }, [a]), u ? /* @__PURE__ */ e("div", { className: "flex h-dvh items-center justify-center", children: /* @__PURE__ */ e(bt, {}) }) : d || !t ? /* @__PURE__ */ r("div", { className: "flex h-dvh flex-col items-center justify-center p-4 text-center", children: [
1886
1876
  /* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-destructive mb-2 font-display", children: "Shared Chat Not Found" }),
1887
- /* @__PURE__ */ e("p", { className: "text-muted-foreground max-w-md", children: c || "This shared conversation might have been deleted or the link is invalid." })
1888
- ] }) : /* @__PURE__ */ n("div", { className: "relative flex flex-col h-dvh overflow-hidden bg-background", children: [
1889
- /* @__PURE__ */ e(Qe, { hideActions: !0 }),
1877
+ /* @__PURE__ */ e("p", { className: "text-muted-foreground max-w-md", children: d || "This shared conversation might have been deleted or the link is invalid." })
1878
+ ] }) : /* @__PURE__ */ r("div", { className: "relative flex flex-col h-dvh overflow-hidden bg-background", children: [
1879
+ /* @__PURE__ */ e(Ve, { hideActions: !0 }),
1890
1880
  /* @__PURE__ */ e("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ e(
1891
1881
  p,
1892
1882
  {
@@ -1905,42 +1895,42 @@ function Pa() {
1905
1895
  ) })
1906
1896
  ] });
1907
1897
  }
1908
- function Ga() {
1909
- return /* @__PURE__ */ e(Pa, {});
1898
+ function Wa() {
1899
+ return /* @__PURE__ */ e(Ta, {});
1910
1900
  }
1911
1901
  export {
1912
- Sa as AppSidebar,
1913
- ta as Chat,
1914
- Ka as ChatUI,
1915
- tr as FilePart,
1916
- Ua as GentiqProvider,
1917
- ar as MessageList,
1918
- rr as Part,
1919
- nr as PromptInputArea,
1920
- sr as ReasoningPart,
1921
- Ha as RequireAuth,
1922
- be as Select,
1923
- ye as SelectContent,
1924
- or as SelectGroup,
1902
+ Ma as AppSidebar,
1903
+ na as Chat,
1904
+ Qa as ChatUI,
1905
+ rr as FilePart,
1906
+ Ha as GentiqProvider,
1907
+ nr as MessageList,
1908
+ sr as Part,
1909
+ or as PromptInputArea,
1910
+ ir as ReasoningPart,
1911
+ Ga as RequireAuth,
1912
+ ve as Select,
1913
+ we as SelectContent,
1914
+ lr as SelectGroup,
1925
1915
  me as SelectItem,
1926
- ir as SelectLabel,
1927
- lr as SelectScrollDownButton,
1928
- cr as SelectScrollUpButton,
1929
- dr as SelectSeparator,
1930
- ve as SelectTrigger,
1931
- xe as SelectValue,
1932
- ka as SettingsDialog,
1933
- Ga as SharedChatView,
1934
- fa as SidebarProvider,
1935
- ur as TextPart,
1936
- mr as ToolPart,
1937
- Xa as Trans,
1938
- Ja as Translation,
1939
- Qa as UserLoginPage,
1940
- hr as WelcomeScreen,
1916
+ cr as SelectLabel,
1917
+ dr as SelectScrollDownButton,
1918
+ ur as SelectScrollUpButton,
1919
+ mr as SelectSeparator,
1920
+ xe as SelectTrigger,
1921
+ ye as SelectValue,
1922
+ _a as SettingsDialog,
1923
+ Wa as SharedChatView,
1924
+ va as SidebarProvider,
1925
+ hr as TextPart,
1926
+ pr as ToolPart,
1927
+ Ya as Trans,
1928
+ Za as Translation,
1929
+ Va as UserLoginPage,
1930
+ gr as WelcomeScreen,
1941
1931
  te as useComponents,
1942
- Zt as useGentiqChat,
1943
- Ya as useTranslation,
1944
- T as userAPI,
1945
- Za as withTranslation
1932
+ aa as useGentiqChat,
1933
+ er as useTranslation,
1934
+ M as userAPI,
1935
+ tr as withTranslation
1946
1936
  };