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