gentiq 0.7.26 → 0.7.28

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