gentiq 0.8.3 → 0.10.0
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/dist/{checkbox-hWwU3a5K.js → checkbox-BuMyz6YI.js} +1722 -1753
- package/dist/gentiq-admin.es.js +4479 -3091
- package/dist/gentiq-index.es.js +1975 -1381
- package/dist/gentiq.css +1 -1
- package/dist/src/App.d.ts +1 -1
- package/dist/src/ComponentsContext.d.ts +1 -1
- package/dist/src/Part.d.ts +2 -1
- package/dist/src/admin/components/ErrorBanner.d.ts +7 -0
- package/dist/src/admin/components/I18nPreview.d.ts +6 -0
- package/dist/src/admin/components/ModalCloseButton.d.ts +7 -0
- package/dist/src/admin/components/SectionHeader.d.ts +8 -0
- package/dist/src/admin/lib/api.d.ts +192 -22
- package/dist/src/admin/pages/settings/ChatSection.d.ts +12 -0
- package/dist/src/admin/pages/settings/FieldModeGrid.d.ts +14 -0
- package/dist/src/admin/pages/settings/GeneralSection.d.ts +11 -0
- package/dist/src/admin/pages/settings/JobsSection.d.ts +1 -0
- package/dist/src/admin/pages/settings/SettingsToggleCard.d.ts +10 -0
- package/dist/src/admin/pages/settings/TranslationEditor.d.ts +9 -0
- package/dist/src/admin/pages/settings/types.d.ts +12 -0
- package/dist/src/admin/pages/users/UserBulkBalanceModal.d.ts +11 -0
- package/dist/src/admin/pages/users/UserFormModal.d.ts +13 -0
- package/dist/src/admin/pages/users/UserRechargeModal.d.ts +10 -0
- package/dist/src/admin/pages/users/UserUsageDialog.d.ts +9 -0
- package/dist/src/admin/pages/users/UsersTable.d.ts +21 -0
- package/dist/src/components/PromptInputArea.d.ts +1 -1
- package/dist/src/components/ai-elements/Conversation.d.ts +10 -0
- package/dist/src/hooks/useGentiqAdmin.d.ts +39 -12
- package/dist/src/hooks/useGentiqChat.d.ts +3 -2
- package/dist/src/index.d.ts +4 -3
- package/dist/src/lib/GentiqApiContext.d.ts +12 -0
- package/dist/src/lib/api.d.ts +37 -17
- package/dist/src/lib/errors.d.ts +6 -5
- package/dist/src/lib/messageParts.d.ts +40 -0
- package/dist/src/locales/en.json.d.ts +520 -456
- package/dist/src/locales/fa.json.d.ts +519 -455
- package/dist/src/parts/FilePart.d.ts +1 -1
- package/dist/src/parts/ToolPart.d.ts +1 -1
- package/dist/src/types.d.ts +188 -14
- package/package.json +5 -5
- package/dist/src/components/ai-elements/Branch.d.ts +0 -20
- package/dist/src/components/ai-elements/Image.d.ts +0 -6
- package/dist/src/components/ai-elements/InlineCitation.d.ts +0 -38
- package/dist/src/components/ai-elements/Task.d.ts +0 -14
- package/dist/src/components/ai-elements/WebPreview.d.ts +0 -34
- package/dist/src/components/ui/carousel.d.ts +0 -19
package/dist/gentiq-index.es.js
CHANGED
|
@@ -1,513 +1,861 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import * as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { QueryClient as
|
|
5
|
-
import { I18nextProvider as
|
|
6
|
-
import { Trans as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { Loader2Icon as
|
|
10
|
-
import { useTheme as
|
|
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
|
|
1
|
+
import { jsx as e, jsxs as s, Fragment as _e } from "react/jsx-runtime";
|
|
2
|
+
import * as se from "react";
|
|
3
|
+
import { useState as _, useMemo as Q, useEffect as B, useRef as re, useCallback as ee, useLayoutEffect as et } from "react";
|
|
4
|
+
import { QueryClient as tt, QueryClientProvider as at, useQueryClient as he, useQuery as rt, useInfiniteQuery as nt } from "@tanstack/react-query";
|
|
5
|
+
import { I18nextProvider as st, useTranslation as ue } from "react-i18next";
|
|
6
|
+
import { Trans as or, Translation as ir, useTranslation as lr, withTranslation as cr } from "react-i18next";
|
|
7
|
+
import { G as be, g as ot, d as it, a as lt, C as je, T as ct, u as ne, b as Oe, c as oe, j as xe, e as ge, f as de, h as He, i as v, k as dt, l as Ue, m as Be, n as Ke, o as Qe, B as ae, p as Ve, q as ye, D as Ge, r as ut, s as We, L as X, I as Y, S as we, t as Ne, v as ke, w as Se, x as fe, y as ht, z as pt, A as Me, E as mt, F as gt, H as ft, J as pe, K as bt, M as yt, N as vt, O as xt, P as wt, Q as Nt } from "./checkbox-BuMyz6YI.js";
|
|
8
|
+
import { R as ur, U as hr, V as pr, W as mr, X as gr, Y as fr, Z as br, _ as yr, $ as vr, a0 as xr, a1 as wr, a2 as Nr, a3 as kr, a4 as Sr, a5 as Cr, a6 as _r, a7 as Tr, a8 as Pr } from "./checkbox-BuMyz6YI.js";
|
|
9
|
+
import { Loader2Icon as kt, OctagonXIcon as St, TriangleAlertIcon as Ct, InfoIcon as _t, CircleCheckIcon as Tt, XIcon as Pt, PanelLeftIcon as Et, Layers as Ae, User as Mt, ShieldCheck as At, Settings as Ce, Smartphone as It, Lock as Rt, Save as Dt, Sun as $t, Moon as Lt, Monitor as Ft, Zap as Ie, Globe as qt, Coins as zt, LogOut as jt, CirclePlus as Ot, Plus as Ht, Search as Ut, Check as Bt, X as Kt, Pin as Re, MoreVertical as Qt, PinOff as Vt, Share2 as Gt, Pencil as Wt, Trash as Jt } from "lucide-react";
|
|
10
|
+
import { useTheme as Xt } from "next-themes";
|
|
11
|
+
import { Toaster as Yt, toast as te } from "sonner";
|
|
12
|
+
import { useChat as Zt } from "@ai-sdk/react";
|
|
13
|
+
import { DefaultChatTransport as ea } from "ai";
|
|
14
|
+
import { useLocation as Je, useNavigate as Te, Navigate as ta, useParams as aa } from "react-router-dom";
|
|
15
|
+
import { nanoid as me } from "nanoid";
|
|
16
|
+
import { Slot as ra } from "@radix-ui/react-slot";
|
|
17
|
+
import { cva as na } from "class-variance-authority";
|
|
18
18
|
import "@radix-ui/react-separator";
|
|
19
|
-
import * as
|
|
20
|
-
const
|
|
21
|
-
const { theme: t = "system" } =
|
|
19
|
+
import * as le from "@radix-ui/react-dialog";
|
|
20
|
+
const sa = ({ ...a }) => {
|
|
21
|
+
const { theme: t = "system" } = Xt();
|
|
22
22
|
return /* @__PURE__ */ e(
|
|
23
|
-
|
|
23
|
+
Yt,
|
|
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(Tt, { className: "size-4" }),
|
|
29
|
+
info: /* @__PURE__ */ e(_t, { className: "size-4" }),
|
|
30
|
+
warning: /* @__PURE__ */ e(Ct, { className: "size-4" }),
|
|
31
|
+
error: /* @__PURE__ */ e(St, { className: "size-4" }),
|
|
32
|
+
loading: /* @__PURE__ */ e(kt, { className: "size-4 animate-spin" })
|
|
33
33
|
},
|
|
34
34
|
style: {
|
|
35
35
|
"--normal-bg": "var(--popover)",
|
|
36
36
|
"--normal-text": "var(--popover-foreground)",
|
|
37
37
|
"--normal-border": "var(--border)",
|
|
38
|
-
"--border-radius": "var(--radius)"
|
|
38
|
+
"--border-radius": "var(--radius)",
|
|
39
|
+
fontFamily: "var(--gentiq-font-family)"
|
|
39
40
|
},
|
|
40
41
|
...a
|
|
41
42
|
}
|
|
42
43
|
);
|
|
44
|
+
}, oa = () => ({
|
|
45
|
+
api: {
|
|
46
|
+
basePath: "/api"
|
|
47
|
+
},
|
|
48
|
+
app: {
|
|
49
|
+
basePath: "/",
|
|
50
|
+
cacheNamespace: "gentiq"
|
|
51
|
+
}
|
|
52
|
+
}), ia = {
|
|
53
|
+
getToken: () => localStorage.getItem("token"),
|
|
54
|
+
setToken: (a) => localStorage.setItem("token", a),
|
|
55
|
+
clearToken: () => {
|
|
56
|
+
localStorage.removeItem("token");
|
|
57
|
+
},
|
|
58
|
+
getHeaders: () => {
|
|
59
|
+
const a = localStorage.getItem("token");
|
|
60
|
+
return a ? { Authorization: `Bearer ${a}` } : {};
|
|
61
|
+
}
|
|
43
62
|
};
|
|
44
|
-
function
|
|
63
|
+
function la(a) {
|
|
64
|
+
let t = oa(), d = ia;
|
|
65
|
+
const o = {
|
|
66
|
+
/**
|
|
67
|
+
* Merge new config into this instance. Safe to call repeatedly (e.g. when
|
|
68
|
+
* the provider re-resolves config after fetching dynamic settings).
|
|
69
|
+
*/
|
|
70
|
+
configure: (n) => {
|
|
71
|
+
if (t = {
|
|
72
|
+
...t,
|
|
73
|
+
...n,
|
|
74
|
+
api: n.api ? { ...t.api, ...n.api } : t.api,
|
|
75
|
+
app: n.app ? { ...t.app, ...n.app } : t.app
|
|
76
|
+
}, n.api?.authAdapter) {
|
|
77
|
+
const i = n.api.authAdapter;
|
|
78
|
+
d = {
|
|
79
|
+
...i,
|
|
80
|
+
getHeaders: i.getHeaders || (() => {
|
|
81
|
+
const r = i.getToken();
|
|
82
|
+
return r ? { Authorization: `Bearer ${r}` } : {};
|
|
83
|
+
})
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
getConfig: () => t,
|
|
88
|
+
getToken: () => d.getToken(),
|
|
89
|
+
setToken: (n) => {
|
|
90
|
+
d.setToken(n);
|
|
91
|
+
},
|
|
92
|
+
clearToken: () => {
|
|
93
|
+
d.clearToken();
|
|
94
|
+
},
|
|
95
|
+
getHeaders: () => d.getHeaders(),
|
|
96
|
+
getEndpoint: (n, i, ...r) => {
|
|
97
|
+
const u = t.api?.endpoints?.[n];
|
|
98
|
+
return u ? typeof u == "function" ? u(...r) : u : typeof i == "function" ? i(...r) : i;
|
|
99
|
+
},
|
|
100
|
+
handleResponse: async (n, i = "Request failed") => {
|
|
101
|
+
if (!n.ok) {
|
|
102
|
+
const r = await n.json().catch(() => ({}));
|
|
103
|
+
if (r.error && (typeof r.error.code == "string" || typeof r.error.message == "string"))
|
|
104
|
+
throw new be(r, n.status);
|
|
105
|
+
let u = i, c = "error", y = null;
|
|
106
|
+
throw typeof r.detail == "string" ? u = r.detail : typeof r.message == "string" ? u = r.message : typeof r.error == "string" ? u = r.error : Array.isArray(r.detail) ? (u = "Validation failed", y = r.detail, c = "validation_error") : r.error && typeof r.error.message == "string" && (u = r.error.message), new be(
|
|
107
|
+
{
|
|
108
|
+
error: {
|
|
109
|
+
code: c,
|
|
110
|
+
message: u,
|
|
111
|
+
details: y
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
n.status
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return n.json();
|
|
118
|
+
},
|
|
119
|
+
login: async (n, i) => {
|
|
120
|
+
const r = o.getEndpoint("login", "/public/auth/login"), u = await fetch(`${t.api?.basePath}${r}`, {
|
|
121
|
+
method: "POST",
|
|
122
|
+
headers: { "Content-Type": "application/json" },
|
|
123
|
+
body: JSON.stringify({ phone: n, password: i })
|
|
124
|
+
}), c = await o.handleResponse(u, "Login failed");
|
|
125
|
+
return c.token && o.setToken(c.token), c;
|
|
126
|
+
},
|
|
127
|
+
register: async (n, i, r, u, c) => {
|
|
128
|
+
const y = o.getEndpoint("register", "/public/auth/register"), k = await fetch(`${t.api?.basePath}${y}`, {
|
|
129
|
+
method: "POST",
|
|
130
|
+
headers: { "Content-Type": "application/json" },
|
|
131
|
+
body: JSON.stringify({ phone: n, password: i, name: r, surname: u, metadata: c })
|
|
132
|
+
}), g = await o.handleResponse(k, "Registration failed");
|
|
133
|
+
return g.token && o.setToken(g.token), g;
|
|
134
|
+
},
|
|
135
|
+
getBalance: async () => {
|
|
136
|
+
const n = o.getEndpoint("balance", "/users/balance"), i = await fetch(`${t.api?.basePath}${n}`, {
|
|
137
|
+
headers: {
|
|
138
|
+
...d.getHeaders()
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
return o.handleResponse(i, "Failed to fetch balance");
|
|
142
|
+
},
|
|
143
|
+
getHistory: async (n = 0, i = 50) => {
|
|
144
|
+
const r = o.getEndpoint("threads", "/chat/threads"), u = await fetch(`${t.api?.basePath}${r}?skip=${n}&limit=${i}`, {
|
|
145
|
+
headers: {
|
|
146
|
+
...d.getHeaders()
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return o.handleResponse(u, "Failed to fetch chat history");
|
|
150
|
+
},
|
|
151
|
+
getThreadMessages: async (n) => {
|
|
152
|
+
if (!o.getToken()) throw new Error("No token found");
|
|
153
|
+
const r = o.getEndpoint(
|
|
154
|
+
"threadMessages",
|
|
155
|
+
(c) => `/chat/threads/${c.replace(/^\//, "")}`,
|
|
156
|
+
n
|
|
157
|
+
), u = await fetch(`${t.api?.basePath}${r}`, {
|
|
158
|
+
headers: {
|
|
159
|
+
...d.getHeaders()
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
return o.handleResponse(u, "Failed to fetch thread messages");
|
|
163
|
+
},
|
|
164
|
+
deleteThread: async (n) => {
|
|
165
|
+
if (!o.getToken()) throw new Error("No token found");
|
|
166
|
+
const r = o.getEndpoint(
|
|
167
|
+
"deleteThread",
|
|
168
|
+
(c) => `/chat/threads/${c.replace(/^\//, "")}`,
|
|
169
|
+
n
|
|
170
|
+
), u = await fetch(`${t.api?.basePath}${r}`, {
|
|
171
|
+
method: "DELETE",
|
|
172
|
+
headers: {
|
|
173
|
+
...d.getHeaders()
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
return o.handleResponse(u, "Failed to delete thread");
|
|
177
|
+
},
|
|
178
|
+
updateThreadTitle: async (n, i) => {
|
|
179
|
+
if (!o.getToken()) throw new Error("No token found");
|
|
180
|
+
const u = o.getEndpoint(
|
|
181
|
+
"updateThreadTitle",
|
|
182
|
+
(y) => `/chat/threads/${y.replace(/^\//, "")}`,
|
|
183
|
+
n
|
|
184
|
+
), c = await fetch(`${t.api?.basePath}${u}`, {
|
|
185
|
+
method: "PATCH",
|
|
186
|
+
headers: {
|
|
187
|
+
"Content-Type": "application/json",
|
|
188
|
+
...d.getHeaders()
|
|
189
|
+
},
|
|
190
|
+
body: JSON.stringify({ title: i })
|
|
191
|
+
});
|
|
192
|
+
return o.handleResponse(c, "Failed to update thread title");
|
|
193
|
+
},
|
|
194
|
+
/**
|
|
195
|
+
* Fetch an attachment from the Minio-backed proxy endpoint and return
|
|
196
|
+
* a local blob URL usable in <img src>. Caller should revoke via
|
|
197
|
+
* URL.revokeObjectURL when the component unmounts.
|
|
198
|
+
*/
|
|
199
|
+
async getAttachmentBlobUrl(n) {
|
|
200
|
+
if (t.api?.attachmentResolver)
|
|
201
|
+
return t.api.attachmentResolver(n);
|
|
202
|
+
const i = o.getEndpoint(
|
|
203
|
+
"attachments",
|
|
204
|
+
(c) => `/chat/attachments/${c}`,
|
|
205
|
+
n
|
|
206
|
+
), r = await fetch(`${t.api?.basePath}${i}`, {
|
|
207
|
+
headers: { ...d.getHeaders() }
|
|
208
|
+
});
|
|
209
|
+
if (!r.ok) return o.handleResponse(r, "Failed to fetch attachment");
|
|
210
|
+
const u = await r.blob();
|
|
211
|
+
return URL.createObjectURL(u);
|
|
212
|
+
},
|
|
213
|
+
/**
|
|
214
|
+
* Fetch an attachment from the public shared endpoint and return
|
|
215
|
+
* a local blob URL.
|
|
216
|
+
*/
|
|
217
|
+
async getPublicAttachmentBlobUrl(n) {
|
|
218
|
+
const i = o.getEndpoint(
|
|
219
|
+
"sharedAttachments",
|
|
220
|
+
(c) => `/public/attachments/${c}`,
|
|
221
|
+
n
|
|
222
|
+
), r = await fetch(`${t.api?.basePath}${i}`, {
|
|
223
|
+
headers: {
|
|
224
|
+
"Content-Type": "application/json"
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
if (!r.ok) return o.handleResponse(r, "Failed to fetch public attachment");
|
|
228
|
+
const u = await r.blob();
|
|
229
|
+
return URL.createObjectURL(u);
|
|
230
|
+
},
|
|
231
|
+
saveFeedback: async (n, i, r) => {
|
|
232
|
+
const u = o.getEndpoint("feedback", "/chat/feedback"), c = await fetch(`${t.api?.basePath}${u}`, {
|
|
233
|
+
method: "POST",
|
|
234
|
+
headers: {
|
|
235
|
+
"Content-Type": "application/json",
|
|
236
|
+
...d.getHeaders()
|
|
237
|
+
},
|
|
238
|
+
body: JSON.stringify({
|
|
239
|
+
thread_id: n.replace(/^\//, ""),
|
|
240
|
+
message_id: i,
|
|
241
|
+
sentiment: r
|
|
242
|
+
})
|
|
243
|
+
});
|
|
244
|
+
return o.handleResponse(c, "Failed to save feedback");
|
|
245
|
+
},
|
|
246
|
+
getMe: async () => {
|
|
247
|
+
const n = o.getEndpoint("me", "/users/me"), i = await fetch(`${t.api?.basePath}${n}`, {
|
|
248
|
+
headers: {
|
|
249
|
+
...d.getHeaders()
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
return o.handleResponse(i, "Failed to fetch user profile");
|
|
253
|
+
},
|
|
254
|
+
updateMe: async (n) => {
|
|
255
|
+
const i = o.getEndpoint("me", "/users/me"), r = await fetch(`${t.api?.basePath}${i}`, {
|
|
256
|
+
method: "PATCH",
|
|
257
|
+
headers: {
|
|
258
|
+
"Content-Type": "application/json",
|
|
259
|
+
...d.getHeaders()
|
|
260
|
+
},
|
|
261
|
+
body: JSON.stringify(n)
|
|
262
|
+
});
|
|
263
|
+
return o.handleResponse(r, "Failed to update user profile");
|
|
264
|
+
},
|
|
265
|
+
pinThread: async (n, i) => {
|
|
266
|
+
if (!o.getToken()) throw new Error("No token found");
|
|
267
|
+
const u = o.getEndpoint(
|
|
268
|
+
"updateThreadTitle",
|
|
269
|
+
(y) => `/chat/threads/${y.replace(/^\//, "")}`,
|
|
270
|
+
n
|
|
271
|
+
), c = await fetch(`${t.api?.basePath}${u}`, {
|
|
272
|
+
method: "PATCH",
|
|
273
|
+
headers: {
|
|
274
|
+
"Content-Type": "application/json",
|
|
275
|
+
...d.getHeaders()
|
|
276
|
+
},
|
|
277
|
+
body: JSON.stringify({ pinned: i })
|
|
278
|
+
});
|
|
279
|
+
return o.handleResponse(c, "Failed to pin thread");
|
|
280
|
+
},
|
|
281
|
+
shareThread: async (n) => {
|
|
282
|
+
if (!o.getToken()) throw new Error("No token found");
|
|
283
|
+
const r = o.getEndpoint(
|
|
284
|
+
"shareThread",
|
|
285
|
+
(c) => `/chat/threads/${c.replace(/^\//, "")}/share`,
|
|
286
|
+
n
|
|
287
|
+
), u = await fetch(`${t.api?.basePath}${r}`, {
|
|
288
|
+
method: "POST",
|
|
289
|
+
headers: {
|
|
290
|
+
...d.getHeaders()
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
return o.handleResponse(u, "Failed to share thread");
|
|
294
|
+
},
|
|
295
|
+
getSharedThread: async (n) => {
|
|
296
|
+
const i = o.getEndpoint("sharedThread", (u) => `/public/shared/${u}`, n), r = await fetch(`${t.api?.basePath}${i}`, {
|
|
297
|
+
headers: {
|
|
298
|
+
"Content-Type": "application/json"
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
return o.handleResponse(r, "Failed to fetch shared thread");
|
|
302
|
+
},
|
|
303
|
+
getAppConfig: async () => {
|
|
304
|
+
const n = await fetch(`${t.api?.basePath}/config`);
|
|
305
|
+
return o.handleResponse(n, "Failed to fetch app configuration");
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
return a && o.configure(a), o;
|
|
309
|
+
}
|
|
310
|
+
function Za({
|
|
45
311
|
children: a,
|
|
46
312
|
api: t,
|
|
47
|
-
app:
|
|
48
|
-
i18n:
|
|
49
|
-
components:
|
|
50
|
-
history:
|
|
51
|
-
welcome:
|
|
52
|
-
threadActions:
|
|
53
|
-
composer:
|
|
54
|
-
theme:
|
|
55
|
-
disclaimer:
|
|
56
|
-
settings:
|
|
313
|
+
app: d,
|
|
314
|
+
i18n: o,
|
|
315
|
+
components: n,
|
|
316
|
+
history: i,
|
|
317
|
+
welcome: r,
|
|
318
|
+
threadActions: u,
|
|
319
|
+
composer: c,
|
|
320
|
+
theme: y,
|
|
321
|
+
disclaimer: k,
|
|
322
|
+
settings: g
|
|
57
323
|
}) {
|
|
58
|
-
const [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
s?.app_name && (document.title = P.t(s.app_name));
|
|
67
|
-
}, [s, P]);
|
|
68
|
-
const q = O(() => {
|
|
69
|
-
const d = {
|
|
324
|
+
const [p, A] = _(null), P = Q(() => o?.instance ?? ot, [o?.instance]), I = t || {}, [E] = _(() => la({ api: I }));
|
|
325
|
+
B(() => {
|
|
326
|
+
E.getAppConfig().then((w) => A(w)).catch((w) => console.debug("Gentiq: No dynamic settings available or fetch failed", w));
|
|
327
|
+
}, [E]), B(() => {
|
|
328
|
+
p?.app_name && (document.title = P.t(p.app_name));
|
|
329
|
+
}, [p, P]);
|
|
330
|
+
const R = Q(() => {
|
|
331
|
+
const w = {
|
|
70
332
|
basePath: "/",
|
|
71
333
|
cacheNamespace: "gentiq",
|
|
72
|
-
...
|
|
334
|
+
...d
|
|
73
335
|
};
|
|
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
|
-
}, [
|
|
89
|
-
if (!
|
|
90
|
-
const
|
|
336
|
+
return p ? {
|
|
337
|
+
...w,
|
|
338
|
+
name: (p.app_name ? P.t(p.app_name) : null) || w.name,
|
|
339
|
+
adminTitle: (p.admin_title ? P.t(p.admin_title) : null) || w.adminTitle,
|
|
340
|
+
version: p.app_version || w.version,
|
|
341
|
+
showSettings: p.show_settings ?? w.showSettings,
|
|
342
|
+
showVersionInSettings: p.show_version_in_settings ?? w.showVersionInSettings,
|
|
343
|
+
showToolDetails: p.show_tool_details ?? w.showToolDetails,
|
|
344
|
+
disableSignup: p.disable_signup ?? w.disableSignup,
|
|
345
|
+
disableAuthPage: p.disable_auth_page ?? w.disableAuthPage,
|
|
346
|
+
settingsGeneralMode: p.settings_general_mode || w.settingsGeneralMode,
|
|
347
|
+
settingsProfileMode: p.settings_profile_mode || w.settingsProfileMode,
|
|
348
|
+
settingsAccountMode: p.settings_account_mode || w.settingsAccountMode
|
|
349
|
+
} : w;
|
|
350
|
+
}, [d, p, P]), D = Q(() => {
|
|
351
|
+
if (!p) return r;
|
|
352
|
+
const w = typeof r?.greeting == "function" ? r.greeting : p.welcome_greeting || r?.greeting;
|
|
91
353
|
return {
|
|
92
|
-
...
|
|
93
|
-
greeting:
|
|
94
|
-
subtitle:
|
|
354
|
+
...r,
|
|
355
|
+
greeting: w,
|
|
356
|
+
subtitle: p.welcome_subtitle || r?.subtitle
|
|
95
357
|
};
|
|
96
|
-
}, [
|
|
97
|
-
const
|
|
98
|
-
return
|
|
99
|
-
}, [
|
|
358
|
+
}, [r, p]), T = Q(() => {
|
|
359
|
+
const w = p?.disclaimer || k;
|
|
360
|
+
return typeof w == "string" ? P.t(w) : w;
|
|
361
|
+
}, [k, p, P]), q = Q(() => p ? {
|
|
362
|
+
...i,
|
|
363
|
+
enabled: p.history_enabled ?? i?.enabled,
|
|
364
|
+
showDelete: p.history_show_delete ?? i?.showDelete,
|
|
365
|
+
showRename: p.history_show_rename ?? i?.showRename,
|
|
366
|
+
showShare: p.history_show_share ?? i?.showShare,
|
|
367
|
+
showPin: p.history_show_pin ?? i?.showPin
|
|
368
|
+
} : i, [i, p]), x = Q(() => p ? {
|
|
100
369
|
...u,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
showPin: s.history_show_pin ?? u?.showPin
|
|
106
|
-
} : u, [u, s]), x = O(() => s ? {
|
|
107
|
-
...f,
|
|
108
|
-
feedback: s.thread_actions_feedback ?? f?.feedback,
|
|
109
|
-
retry: s.thread_actions_retry ?? f?.retry
|
|
110
|
-
} : f, [f, s]), B = O(() => s ? {
|
|
111
|
-
...h,
|
|
370
|
+
feedback: p.thread_actions_feedback ?? u?.feedback,
|
|
371
|
+
retry: p.thread_actions_retry ?? u?.retry
|
|
372
|
+
} : u, [u, p]), V = Q(() => p ? {
|
|
373
|
+
...c,
|
|
112
374
|
attachments: {
|
|
113
|
-
...
|
|
114
|
-
enabled:
|
|
375
|
+
...c?.attachments,
|
|
376
|
+
enabled: p.composer_attachments ?? c?.attachments?.enabled
|
|
115
377
|
}
|
|
116
|
-
} :
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
378
|
+
} : c, [c, p]), K = Q(
|
|
379
|
+
() => ({
|
|
380
|
+
...y,
|
|
381
|
+
defaultTheme: p?.default_theme ?? y?.defaultTheme,
|
|
382
|
+
accent: p?.default_accent ?? y?.accent
|
|
383
|
+
}),
|
|
384
|
+
[y, p]
|
|
385
|
+
), M = Q(() => p ? {
|
|
386
|
+
...g,
|
|
122
387
|
sections: {
|
|
123
|
-
...
|
|
388
|
+
...g?.sections,
|
|
124
389
|
general: {
|
|
125
|
-
...
|
|
126
|
-
mode:
|
|
127
|
-
enabled:
|
|
390
|
+
...g?.sections?.general,
|
|
391
|
+
mode: p.settings_general_mode || g?.sections?.general?.mode,
|
|
392
|
+
enabled: g?.sections?.general?.enabled ?? !0,
|
|
128
393
|
fields: {
|
|
129
|
-
...
|
|
130
|
-
...
|
|
394
|
+
...g?.sections?.general?.fields,
|
|
395
|
+
...p.settings_general_fields
|
|
131
396
|
}
|
|
132
397
|
},
|
|
133
398
|
profile: {
|
|
134
|
-
...
|
|
135
|
-
mode:
|
|
136
|
-
enabled:
|
|
399
|
+
...g?.sections?.profile,
|
|
400
|
+
mode: p.settings_profile_mode || g?.sections?.profile?.mode,
|
|
401
|
+
enabled: g?.sections?.profile?.enabled ?? !0,
|
|
137
402
|
fields: {
|
|
138
|
-
...
|
|
139
|
-
...
|
|
403
|
+
...g?.sections?.profile?.fields,
|
|
404
|
+
...p.settings_profile_fields
|
|
140
405
|
}
|
|
141
406
|
},
|
|
142
407
|
account: {
|
|
143
|
-
...
|
|
144
|
-
mode:
|
|
145
|
-
enabled:
|
|
408
|
+
...g?.sections?.account,
|
|
409
|
+
mode: p.settings_account_mode || g?.sections?.account?.mode,
|
|
410
|
+
enabled: g?.sections?.account?.enabled ?? !0,
|
|
146
411
|
fields: {
|
|
147
|
-
...
|
|
148
|
-
...
|
|
412
|
+
...g?.sections?.account?.fields,
|
|
413
|
+
...p.settings_account_fields
|
|
149
414
|
}
|
|
150
415
|
}
|
|
151
416
|
}
|
|
152
|
-
} :
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
417
|
+
} : g, [g, p]), $ = Q(
|
|
418
|
+
() => new tt({
|
|
419
|
+
defaultOptions: {
|
|
420
|
+
queries: {
|
|
421
|
+
staleTime: 5e3,
|
|
422
|
+
retry: 1
|
|
423
|
+
}
|
|
157
424
|
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
425
|
+
}),
|
|
426
|
+
[]
|
|
427
|
+
);
|
|
428
|
+
B(() => {
|
|
429
|
+
E.configure({
|
|
430
|
+
api: I,
|
|
431
|
+
app: R
|
|
164
432
|
});
|
|
165
|
-
}, [
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
Object.entries(
|
|
169
|
-
P.addResourceBundle(
|
|
433
|
+
}, [E, R]);
|
|
434
|
+
const G = re(null), F = o?.resources;
|
|
435
|
+
F !== G.current && (G.current = F, F && Object.entries(F).forEach(([w, m]) => {
|
|
436
|
+
Object.entries(m).forEach(([C, f]) => {
|
|
437
|
+
P.addResourceBundle(w, C, f, !0, !0);
|
|
170
438
|
});
|
|
171
439
|
}));
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
Object.entries(
|
|
175
|
-
P.addResourceBundle(
|
|
440
|
+
const J = re(null), W = p?.translations;
|
|
441
|
+
W && W !== J.current && (J.current = W, Object.entries(W).forEach(([w, m]) => {
|
|
442
|
+
Object.entries(m).forEach(([C, f]) => {
|
|
443
|
+
P.addResourceBundle(w, C, f, !0, !0);
|
|
176
444
|
});
|
|
177
445
|
}));
|
|
178
|
-
const
|
|
179
|
-
return
|
|
180
|
-
Object.entries(
|
|
181
|
-
|
|
446
|
+
const j = re(null), L = o?.instance;
|
|
447
|
+
return L && L !== j.current && (j.current = L, Object.entries(it).forEach(([w, m]) => {
|
|
448
|
+
Object.entries(m).forEach(([C, f]) => {
|
|
449
|
+
L.hasResourceBundle(w, C) || L.addResourceBundle(w, C, f, !0, !1);
|
|
182
450
|
});
|
|
183
|
-
})), /* @__PURE__ */ e(
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
|
|
451
|
+
})), /* @__PURE__ */ e(st, { i18n: P, children: /* @__PURE__ */ s(at, { client: $, children: [
|
|
452
|
+
/* @__PURE__ */ e(lt, { api: E, children: /* @__PURE__ */ s(
|
|
453
|
+
je,
|
|
186
454
|
{
|
|
187
|
-
components:
|
|
188
|
-
history:
|
|
189
|
-
welcome:
|
|
455
|
+
components: n,
|
|
456
|
+
history: q,
|
|
457
|
+
welcome: D,
|
|
190
458
|
threadActions: x,
|
|
191
|
-
composer:
|
|
192
|
-
theme:
|
|
193
|
-
disclaimer:
|
|
194
|
-
app:
|
|
195
|
-
i18n:
|
|
196
|
-
settings:
|
|
459
|
+
composer: V,
|
|
460
|
+
theme: K,
|
|
461
|
+
disclaimer: T,
|
|
462
|
+
app: R,
|
|
463
|
+
i18n: o,
|
|
464
|
+
settings: M,
|
|
197
465
|
children: [
|
|
198
|
-
/* @__PURE__ */ e(
|
|
199
|
-
/* @__PURE__ */ e(
|
|
466
|
+
/* @__PURE__ */ e(ca, {}),
|
|
467
|
+
/* @__PURE__ */ e(ct, { defaultTheme: "system", storageKey: "chatbot-theme", config: K, children: a })
|
|
200
468
|
]
|
|
201
469
|
}
|
|
202
|
-
),
|
|
203
|
-
/* @__PURE__ */ e(
|
|
470
|
+
) }),
|
|
471
|
+
/* @__PURE__ */ e(sa, { richColors: !0 })
|
|
204
472
|
] }) });
|
|
205
473
|
}
|
|
206
|
-
function
|
|
207
|
-
const { app: a } =
|
|
208
|
-
return
|
|
474
|
+
function ca() {
|
|
475
|
+
const { app: a } = ne();
|
|
476
|
+
return Oe(), B(() => {
|
|
209
477
|
a?.name && (document.title = a.name);
|
|
210
|
-
}, [a?.name]),
|
|
478
|
+
}, [a?.name]), B(() => {
|
|
211
479
|
if (!a?.favicon) return;
|
|
212
480
|
let t = document.querySelector("link[rel~='icon']");
|
|
213
481
|
t || (t = document.createElement("link"), t.rel = "icon", document.head.appendChild(t)), t.href = a.favicon;
|
|
214
482
|
}, [a?.favicon]), null;
|
|
215
483
|
}
|
|
216
|
-
function
|
|
217
|
-
const a =
|
|
218
|
-
const
|
|
219
|
-
if (
|
|
220
|
-
if (
|
|
221
|
-
let
|
|
222
|
-
return
|
|
484
|
+
function Pe() {
|
|
485
|
+
const a = Je(), t = Te(), n = oe().getConfig().app?.basePath || "/", i = Q(() => {
|
|
486
|
+
const u = a.pathname, c = u.endsWith("/") && u !== "/" ? u.slice(0, -1) : u, y = n.endsWith("/") && n !== "/" ? n.slice(0, -1) : n;
|
|
487
|
+
if (c === (y || "/")) return "/";
|
|
488
|
+
if (u.startsWith(y) && y !== "/") {
|
|
489
|
+
let k = u.slice(y.length);
|
|
490
|
+
return k.startsWith("/") || (k = "/" + k), k;
|
|
223
491
|
}
|
|
224
|
-
return
|
|
225
|
-
}, [a.pathname,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
492
|
+
return y === "/" ? u : "/";
|
|
493
|
+
}, [a.pathname, n]), r = ee(
|
|
494
|
+
(u) => {
|
|
495
|
+
t(xe(n, u || "/"), { replace: !1 });
|
|
496
|
+
},
|
|
497
|
+
[t, n]
|
|
498
|
+
);
|
|
499
|
+
return [i, r];
|
|
229
500
|
}
|
|
230
|
-
function
|
|
231
|
-
const { t } =
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}, [
|
|
235
|
-
const
|
|
236
|
-
|
|
501
|
+
function da({ onFinish: a } = {}) {
|
|
502
|
+
const { t } = ue(["chat", "errors"]), d = he(), o = oe(), n = o.getConfig(), i = n.app?.cacheNamespace || "gentiq", [r, u] = Pe(), [c, y] = _(() => me()), k = re(/* @__PURE__ */ new Set());
|
|
503
|
+
B(() => {
|
|
504
|
+
y((f) => r === "/" ? me() : f && r !== `/${f}` ? me() : f);
|
|
505
|
+
}, [r]);
|
|
506
|
+
const g = Q(() => r === "/" ? c : r.replace(/^\//, ""), [r, c]), p = ee((f) => (k.current.add(f), f), []), A = ee(() => {
|
|
507
|
+
k.current.forEach((f) => URL.revokeObjectURL(f)), k.current.clear();
|
|
237
508
|
}, []);
|
|
238
|
-
|
|
509
|
+
B(() => () => A(), [A]);
|
|
239
510
|
const {
|
|
240
|
-
data:
|
|
241
|
-
isLoading:
|
|
242
|
-
isError:
|
|
243
|
-
} =
|
|
244
|
-
queryKey: [
|
|
511
|
+
data: P,
|
|
512
|
+
isLoading: I,
|
|
513
|
+
isError: E
|
|
514
|
+
} = rt({
|
|
515
|
+
queryKey: [i, "threadMessages", g],
|
|
245
516
|
queryFn: async () => {
|
|
246
|
-
if (
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
249
|
-
return !
|
|
250
|
-
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
if (
|
|
517
|
+
if (r === "/") return [];
|
|
518
|
+
if (r === `/${c}`) return [];
|
|
519
|
+
const f = await o.getThreadMessages(g);
|
|
520
|
+
return !f.items || !Array.isArray(f.items) ? [] : await Promise.all(
|
|
521
|
+
f.items.map(async (S) => {
|
|
522
|
+
const Z = typeof S.content == "string" ? S.content : S.content?.text || JSON.stringify(S.content), z = [...Array.isArray(S.parts) && S.parts.length > 0 ? S.parts : [{ type: "text", text: Z }]].sort((b, l) => b.type === "file" && l.type !== "file" ? -1 : b.type !== "file" && l.type === "file" ? 1 : 0), U = await Promise.all(
|
|
523
|
+
z.map(async (b) => {
|
|
524
|
+
if (b.type === "file" && b.object_name && !b.url)
|
|
254
525
|
try {
|
|
255
|
-
const
|
|
256
|
-
return {
|
|
257
|
-
|
|
258
|
-
|
|
526
|
+
const l = await o.getAttachmentBlobUrl(b.object_name);
|
|
527
|
+
return {
|
|
528
|
+
...b,
|
|
529
|
+
url: p(l),
|
|
530
|
+
mediaType: b.mediaType || b.media_type
|
|
531
|
+
};
|
|
532
|
+
} catch (l) {
|
|
533
|
+
return console.warn("Load attachment failed:", b.object_name, l), { ...b, mediaType: b.mediaType || b.media_type };
|
|
259
534
|
}
|
|
260
|
-
return
|
|
535
|
+
return b;
|
|
261
536
|
})
|
|
262
537
|
);
|
|
263
538
|
return {
|
|
264
|
-
id:
|
|
265
|
-
role:
|
|
266
|
-
parts:
|
|
267
|
-
metadata: { feedback:
|
|
539
|
+
id: S.id || me(),
|
|
540
|
+
role: S.role,
|
|
541
|
+
parts: U,
|
|
542
|
+
metadata: { feedback: S.feedback }
|
|
268
543
|
};
|
|
269
544
|
})
|
|
270
545
|
);
|
|
271
546
|
},
|
|
272
|
-
enabled:
|
|
547
|
+
enabled: r !== "/",
|
|
273
548
|
staleTime: 5e3
|
|
274
549
|
// Keep history fresh for 5 seconds
|
|
275
|
-
}),
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
error:
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
550
|
+
}), R = Q(
|
|
551
|
+
() => new ea({
|
|
552
|
+
api: o.getEndpoint("chat", "/chat"),
|
|
553
|
+
fetch: async (f, O) => {
|
|
554
|
+
const S = new Headers(O?.headers), Z = o.getHeaders();
|
|
555
|
+
Object.entries(Z).forEach(([b, l]) => {
|
|
556
|
+
S.set(b, l);
|
|
557
|
+
}), S.set("X-Thread-Id", g);
|
|
558
|
+
const H = n.api?.basePath || "/api", z = typeof f == "string" && !f.startsWith("http") ? `${H}${f.startsWith("/") ? f : "/" + f}` : f, U = await fetch(z, { ...O, headers: S });
|
|
559
|
+
if (!U.ok) {
|
|
560
|
+
const b = await U.json().catch(() => ({}));
|
|
561
|
+
if (b.error && (typeof b.error.code == "string" || typeof b.error.message == "string"))
|
|
562
|
+
throw new be(b, U.status);
|
|
563
|
+
let l = U.statusText || `HTTP ${U.status}`, h = "error", N = null;
|
|
564
|
+
throw typeof b.detail == "string" ? l = b.detail : typeof b.message == "string" ? l = b.message : typeof b.error == "string" ? l = b.error : Array.isArray(b.detail) ? (l = "Validation failed", N = b.detail, h = "validation_error") : b.error && typeof b.error.message == "string" && (l = b.error.message), new be(
|
|
565
|
+
{
|
|
566
|
+
error: {
|
|
567
|
+
code: h,
|
|
568
|
+
message: l,
|
|
569
|
+
details: N
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
U.status
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
return U;
|
|
295
576
|
}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}, [
|
|
301
|
-
id:
|
|
302
|
-
onFinish:
|
|
303
|
-
transport:
|
|
304
|
-
}), [
|
|
305
|
-
|
|
577
|
+
}),
|
|
578
|
+
[g, n.api?.basePath, o]
|
|
579
|
+
), D = ee(() => {
|
|
580
|
+
M("ready"), d.invalidateQueries({ queryKey: [i, "conversations"] }), a?.();
|
|
581
|
+
}, [d, a, i]), T = Zt({
|
|
582
|
+
id: g,
|
|
583
|
+
onFinish: D,
|
|
584
|
+
transport: R
|
|
585
|
+
}), { setMessages: q, sendMessage: x, stop: V } = T, [K, M] = _("idle"), [$, G] = _(null), F = ee(() => {
|
|
586
|
+
G(null);
|
|
306
587
|
}, []);
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}, [
|
|
310
|
-
|
|
311
|
-
}, [
|
|
312
|
-
if (
|
|
313
|
-
|
|
588
|
+
B(() => {
|
|
589
|
+
P && (r === `/${c}` || (q(P), M("ready")));
|
|
590
|
+
}, [P, q, r, c]), B(() => {
|
|
591
|
+
r === "/" && (q([]), M("idle"));
|
|
592
|
+
}, [r, q]), B(() => {
|
|
593
|
+
if (r === "/") {
|
|
594
|
+
M("idle");
|
|
314
595
|
return;
|
|
315
596
|
}
|
|
316
|
-
const
|
|
317
|
-
|
|
318
|
-
}, [
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
597
|
+
const f = r === `/${c}`;
|
|
598
|
+
I && !f ? M("loading-history") : E || $ || T.error ? M("error") : T.status === "streaming" || T.status === "submitted" ? M(T.status) : M("ready");
|
|
599
|
+
}, [
|
|
600
|
+
I,
|
|
601
|
+
E,
|
|
602
|
+
T.status,
|
|
603
|
+
$,
|
|
604
|
+
T.error,
|
|
605
|
+
r,
|
|
606
|
+
c
|
|
607
|
+
]), B(() => () => {
|
|
608
|
+
V();
|
|
609
|
+
}, [g, V]);
|
|
610
|
+
const J = re(/* @__PURE__ */ new Set()), W = Q(
|
|
611
|
+
() => T.messages.filter((f) => f.role === "assistant"),
|
|
612
|
+
[T.messages]
|
|
613
|
+
);
|
|
614
|
+
B(() => {
|
|
615
|
+
let f = !1;
|
|
616
|
+
for (const O of W) {
|
|
617
|
+
if (J.current.has(O.id)) continue;
|
|
618
|
+
const S = O.parts.find((H) => H.type === "data-title");
|
|
619
|
+
(S ? ge(S) : void 0)?.data?.[0]?.title && (J.current.add(O.id), f = !0);
|
|
328
620
|
}
|
|
329
|
-
|
|
330
|
-
}, [
|
|
331
|
-
const
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
(
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
}, [p.setMessages]), L = J(async (b, d, n = []) => {
|
|
358
|
-
const k = u === "/", I = b.trim();
|
|
359
|
-
if (!(!I && (!d || d.length === 0) && n.length === 0) && !(Q === "loading-history" || Q === "streaming" || Q === "submitted")) {
|
|
360
|
-
if (p.stop(), k) {
|
|
361
|
-
g(`/${y}`);
|
|
362
|
-
const j = I || (n[0]?.excerpt ? `↳ ${n[0].excerpt}` : t("attach_file")), S = j.length > 30 ? j.slice(0, 30) + "..." : j;
|
|
363
|
-
i.setQueryData([c, "conversations"], (w) => {
|
|
364
|
-
const z = { id: `/${y}`, firstMessage: S, timestamp: Date.now() };
|
|
365
|
-
return w && Array.isArray(w.pages) ? {
|
|
366
|
-
...w,
|
|
367
|
-
pages: w.pages.map((Y, Z) => Z === 0 ? {
|
|
368
|
-
...Y,
|
|
369
|
-
threads: [z, ...Y.threads || []]
|
|
370
|
-
} : Y)
|
|
371
|
-
} : [z, ...Array.isArray(w) ? w : []];
|
|
621
|
+
f && d.invalidateQueries({ queryKey: [i, "conversations"] });
|
|
622
|
+
}, [W, d, i]);
|
|
623
|
+
const j = re(null), L = ee(
|
|
624
|
+
(f) => {
|
|
625
|
+
if (f.length === 0) return;
|
|
626
|
+
const O = f.map((S) => ({
|
|
627
|
+
type: "data-reference",
|
|
628
|
+
data: S
|
|
629
|
+
}));
|
|
630
|
+
q((S) => {
|
|
631
|
+
const Z = new Set(f.map((b) => b.id));
|
|
632
|
+
if (S.some(
|
|
633
|
+
(b) => b.parts.some(
|
|
634
|
+
(l) => l.type === "data-reference" && Z.has(ge(l).data?.id)
|
|
635
|
+
)
|
|
636
|
+
)) return S;
|
|
637
|
+
const z = [...S].reverse().findIndex(
|
|
638
|
+
(b) => b.role === "user" && !b.parts.some((l) => l.type === "data-reference")
|
|
639
|
+
);
|
|
640
|
+
if (z === -1) return S;
|
|
641
|
+
const U = S.length - 1 - z;
|
|
642
|
+
return S.map((b, l) => l !== U ? b : {
|
|
643
|
+
...b,
|
|
644
|
+
metadata: {
|
|
645
|
+
...b.metadata || {},
|
|
646
|
+
references: f
|
|
647
|
+
},
|
|
648
|
+
parts: [...O, ...b.parts]
|
|
372
649
|
});
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
650
|
+
});
|
|
651
|
+
},
|
|
652
|
+
[q]
|
|
653
|
+
);
|
|
654
|
+
B(() => {
|
|
655
|
+
const f = j.current;
|
|
656
|
+
if (!f) return;
|
|
657
|
+
const O = new Set(f.map((H) => H.id));
|
|
658
|
+
if (T.messages.some(
|
|
659
|
+
(H) => H.parts.some(
|
|
660
|
+
(z) => z.type === "data-reference" && O.has(ge(z).data?.id)
|
|
661
|
+
)
|
|
662
|
+
)) {
|
|
663
|
+
j.current = null;
|
|
664
|
+
return;
|
|
386
665
|
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
666
|
+
T.messages.some(
|
|
667
|
+
(H) => H.role === "user" && !H.parts.some((z) => z.type === "data-reference")
|
|
668
|
+
) && (L(f), j.current = null);
|
|
669
|
+
}, [T.messages, L]);
|
|
670
|
+
const w = ee(
|
|
671
|
+
async (f, O, S = []) => {
|
|
672
|
+
const Z = r === "/", H = f.trim();
|
|
673
|
+
if (!(!H && (!O || O.length === 0) && S.length === 0) && !(K === "loading-history" || K === "streaming" || K === "submitted")) {
|
|
674
|
+
if (V(), Z) {
|
|
675
|
+
u(`/${g}`);
|
|
676
|
+
const z = H || (S[0]?.excerpt ? `↳ ${S[0].excerpt}` : t("attach_file")), U = z.length > 30 ? z.slice(0, 30) + "..." : z;
|
|
677
|
+
d.setQueryData([i, "conversations"], (b) => {
|
|
678
|
+
const l = {
|
|
679
|
+
id: `/${g}`,
|
|
680
|
+
firstMessage: U,
|
|
681
|
+
timestamp: Date.now()
|
|
682
|
+
};
|
|
683
|
+
return !b || !Array.isArray(b.pages) ? {
|
|
684
|
+
pages: [{ threads: [l], nextSkip: 0, hasMore: !1 }],
|
|
685
|
+
pageParams: [0]
|
|
686
|
+
} : {
|
|
687
|
+
...b,
|
|
688
|
+
pages: b.pages.map(
|
|
689
|
+
(h, N) => N === 0 ? { ...h, threads: [l, ...h.threads || []] } : h
|
|
690
|
+
)
|
|
691
|
+
};
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
M("submitted"), G(null), j.current = S.length > 0 ? S : null;
|
|
695
|
+
try {
|
|
696
|
+
S.length > 0 ? await x({ text: H, files: O }, { body: { references: S } }) : await x({ text: H, files: O });
|
|
697
|
+
} catch (z) {
|
|
698
|
+
console.error("Failed to send message:", z);
|
|
699
|
+
const U = de(z, t);
|
|
700
|
+
G(new Error(U)), M("error");
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
[
|
|
705
|
+
V,
|
|
706
|
+
x,
|
|
707
|
+
u,
|
|
708
|
+
r,
|
|
709
|
+
g,
|
|
710
|
+
t,
|
|
711
|
+
d,
|
|
712
|
+
K,
|
|
713
|
+
i
|
|
714
|
+
]
|
|
715
|
+
), m = ee(() => {
|
|
716
|
+
V(), M("ready"), d.invalidateQueries({ queryKey: [i, "conversations"] });
|
|
717
|
+
}, [V, d, i]), C = Q(() => {
|
|
718
|
+
if ($) return $;
|
|
719
|
+
if (T.error) {
|
|
720
|
+
const f = de(T.error, t);
|
|
721
|
+
return new Error(f);
|
|
394
722
|
}
|
|
395
723
|
return null;
|
|
396
|
-
}, [
|
|
397
|
-
return
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
724
|
+
}, [$, T.error, t]);
|
|
725
|
+
return Q(
|
|
726
|
+
() => ({
|
|
727
|
+
...T,
|
|
728
|
+
sendMessage: w,
|
|
729
|
+
stop: m,
|
|
730
|
+
clearError: F,
|
|
731
|
+
error: C,
|
|
732
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- ChatStatus is a superset of the AI SDK status union expected downstream
|
|
733
|
+
status: K,
|
|
734
|
+
isLoadingHistory: K === "loading-history",
|
|
735
|
+
isErrorHistory: K === "error" || !!C || E,
|
|
736
|
+
conversationId: r
|
|
737
|
+
}),
|
|
738
|
+
[T, w, m, F, C, K, E, r]
|
|
739
|
+
);
|
|
409
740
|
}
|
|
410
|
-
function
|
|
411
|
-
const { t:
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
741
|
+
function ua({ classNames: a = {}, disclaimer: t }) {
|
|
742
|
+
const { t: d, i18n: o } = ue(["chat", "translation"]), n = da(), {
|
|
743
|
+
messages: i,
|
|
744
|
+
status: r,
|
|
745
|
+
regenerate: u,
|
|
746
|
+
error: c,
|
|
747
|
+
clearError: y,
|
|
748
|
+
stop: k,
|
|
749
|
+
isLoadingHistory: g,
|
|
750
|
+
conversationId: p,
|
|
751
|
+
sendMessage: A
|
|
752
|
+
} = n, { MessageList: P, PromptInput: I, composer: E, disclaimer: R } = ne(), D = t ?? R, T = o.exists("chat:disclaimer") ? d("chat:disclaimer") : null, q = typeof D == "string" ? d(D) : D ?? T, [x, V] = _(null), K = re(r);
|
|
753
|
+
et(() => {
|
|
754
|
+
c && y();
|
|
755
|
+
}, [p, y, c]);
|
|
756
|
+
const M = i[i.length - 1], $ = M?.role === "assistant" && (r === "ready" || M.parts.some((F) => F.type === "data-chat-finished"));
|
|
757
|
+
B(() => {
|
|
758
|
+
r === "error" && K.current !== "error" && x !== p ? V(p) : r === "submitted" && x !== null && V(null), K.current = r;
|
|
759
|
+
}, [r, p]);
|
|
760
|
+
const G = r === "error" && (p === "/" || x === p);
|
|
420
761
|
return /* @__PURE__ */ e(
|
|
421
|
-
|
|
762
|
+
He,
|
|
422
763
|
{
|
|
423
|
-
enabled:
|
|
424
|
-
maxItems:
|
|
425
|
-
maxExcerptLength:
|
|
426
|
-
children: /* @__PURE__ */
|
|
764
|
+
enabled: E?.references?.enabled ?? !0,
|
|
765
|
+
maxItems: E?.references?.maxItems,
|
|
766
|
+
maxExcerptLength: E?.references?.maxExcerptLength,
|
|
767
|
+
children: /* @__PURE__ */ s("div", { className: v("relative flex flex-col h-full overflow-hidden", a.container), children: [
|
|
427
768
|
/* @__PURE__ */ e(
|
|
428
769
|
P,
|
|
429
770
|
{
|
|
430
|
-
messages:
|
|
431
|
-
status:
|
|
432
|
-
isLoadingHistory:
|
|
433
|
-
error:
|
|
434
|
-
conversationId:
|
|
435
|
-
regen: (
|
|
436
|
-
onSuggestionClick: (
|
|
437
|
-
chat:
|
|
771
|
+
messages: i,
|
|
772
|
+
status: r,
|
|
773
|
+
isLoadingHistory: g,
|
|
774
|
+
error: G ? c : null,
|
|
775
|
+
conversationId: p,
|
|
776
|
+
regen: (F) => u({ messageId: F }),
|
|
777
|
+
onSuggestionClick: (F) => A(F),
|
|
778
|
+
chat: n,
|
|
438
779
|
className: v("flex-1", a.messageList)
|
|
439
780
|
}
|
|
440
781
|
),
|
|
441
|
-
/* @__PURE__ */
|
|
782
|
+
/* @__PURE__ */ s("div", { className: "absolute bottom-0 left-0 right-0 z-10 pointer-events-none flex flex-col items-stretch", children: [
|
|
442
783
|
/* @__PURE__ */ e(
|
|
443
|
-
|
|
784
|
+
I,
|
|
444
785
|
{
|
|
445
|
-
onSend:
|
|
446
|
-
status:
|
|
447
|
-
isLastMessageFinished:
|
|
448
|
-
stop:
|
|
449
|
-
isErrorVisible:
|
|
450
|
-
conversationId:
|
|
451
|
-
className: v(
|
|
786
|
+
onSend: A,
|
|
787
|
+
status: r,
|
|
788
|
+
isLastMessageFinished: $,
|
|
789
|
+
stop: k,
|
|
790
|
+
isErrorVisible: G,
|
|
791
|
+
conversationId: p,
|
|
792
|
+
className: v(
|
|
793
|
+
"pointer-events-auto",
|
|
794
|
+
a.inputArea,
|
|
795
|
+
q && "pb-0 md:pb-0"
|
|
796
|
+
)
|
|
452
797
|
}
|
|
453
798
|
),
|
|
454
|
-
|
|
799
|
+
q && /* @__PURE__ */ s("div", { className: "relative py-1 px-4 flex justify-center items-center pointer-events-auto", children: [
|
|
455
800
|
/* @__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" }),
|
|
456
|
-
/* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children:
|
|
801
|
+
/* @__PURE__ */ e("p", { className: "text-[10px] md:text-[11px] text-muted-foreground/60 select-none text-center leading-tight", children: q })
|
|
457
802
|
] })
|
|
458
803
|
] })
|
|
459
804
|
] })
|
|
460
805
|
}
|
|
461
806
|
);
|
|
462
807
|
}
|
|
463
|
-
const
|
|
808
|
+
const ha = ({
|
|
464
809
|
components: a,
|
|
465
810
|
history: t,
|
|
466
|
-
welcome:
|
|
467
|
-
threadActions:
|
|
468
|
-
composer:
|
|
469
|
-
theme:
|
|
470
|
-
disclaimer:
|
|
471
|
-
...
|
|
811
|
+
welcome: d,
|
|
812
|
+
threadActions: o,
|
|
813
|
+
composer: n,
|
|
814
|
+
theme: i,
|
|
815
|
+
disclaimer: r,
|
|
816
|
+
...u
|
|
472
817
|
}) => {
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
818
|
+
const c = ne(), y = Q(
|
|
819
|
+
() => ({
|
|
820
|
+
...c,
|
|
821
|
+
...a,
|
|
822
|
+
toolComponents: {
|
|
823
|
+
...c.toolComponents,
|
|
824
|
+
...a?.toolComponents
|
|
825
|
+
},
|
|
826
|
+
referenceAdapters: {
|
|
827
|
+
...c.referenceAdapters,
|
|
828
|
+
...a?.referenceAdapters
|
|
829
|
+
}
|
|
830
|
+
}),
|
|
831
|
+
[c, a]
|
|
832
|
+
);
|
|
485
833
|
return /* @__PURE__ */ e(
|
|
486
|
-
|
|
834
|
+
je,
|
|
487
835
|
{
|
|
488
|
-
components:
|
|
489
|
-
history: t ??
|
|
490
|
-
welcome:
|
|
491
|
-
threadActions:
|
|
492
|
-
composer:
|
|
493
|
-
theme:
|
|
494
|
-
disclaimer:
|
|
495
|
-
app:
|
|
496
|
-
i18n:
|
|
497
|
-
settings:
|
|
498
|
-
children: /* @__PURE__ */ e(
|
|
836
|
+
components: y,
|
|
837
|
+
history: t ?? c.history,
|
|
838
|
+
welcome: d ?? c.welcome,
|
|
839
|
+
threadActions: o ?? c.threadActions,
|
|
840
|
+
composer: n ?? c.composer,
|
|
841
|
+
theme: i ?? c.theme,
|
|
842
|
+
disclaimer: r ?? c.disclaimer,
|
|
843
|
+
app: c.app,
|
|
844
|
+
i18n: c.i18n,
|
|
845
|
+
settings: c.settings,
|
|
846
|
+
children: /* @__PURE__ */ e(ua, { ...u })
|
|
499
847
|
}
|
|
500
848
|
);
|
|
501
849
|
};
|
|
502
|
-
function
|
|
503
|
-
return /* @__PURE__ */ e(
|
|
850
|
+
function pa({ ...a }) {
|
|
851
|
+
return /* @__PURE__ */ e(le.Root, { "data-slot": "sheet", ...a });
|
|
504
852
|
}
|
|
505
|
-
function
|
|
506
|
-
return /* @__PURE__ */ e(
|
|
853
|
+
function ma({ ...a }) {
|
|
854
|
+
return /* @__PURE__ */ e(le.Portal, { "data-slot": "sheet-portal", ...a });
|
|
507
855
|
}
|
|
508
|
-
function
|
|
856
|
+
function ga({ className: a, ...t }) {
|
|
509
857
|
return /* @__PURE__ */ e(
|
|
510
|
-
|
|
858
|
+
le.Overlay,
|
|
511
859
|
{
|
|
512
860
|
"data-slot": "sheet-overlay",
|
|
513
861
|
className: v(
|
|
@@ -518,31 +866,31 @@ function ca({ className: a, ...t }) {
|
|
|
518
866
|
}
|
|
519
867
|
);
|
|
520
868
|
}
|
|
521
|
-
function
|
|
869
|
+
function fa({
|
|
522
870
|
className: a,
|
|
523
871
|
children: t,
|
|
524
|
-
side:
|
|
525
|
-
...
|
|
872
|
+
side: d = "right",
|
|
873
|
+
...o
|
|
526
874
|
}) {
|
|
527
|
-
return /* @__PURE__ */
|
|
528
|
-
/* @__PURE__ */ e(
|
|
529
|
-
/* @__PURE__ */
|
|
530
|
-
|
|
875
|
+
return /* @__PURE__ */ s(ma, { children: [
|
|
876
|
+
/* @__PURE__ */ e(ga, {}),
|
|
877
|
+
/* @__PURE__ */ s(
|
|
878
|
+
le.Content,
|
|
531
879
|
{
|
|
532
880
|
"data-slot": "sheet-content",
|
|
533
881
|
className: v(
|
|
534
882
|
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
883
|
+
d === "right" && "data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
|
884
|
+
d === "left" && "data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
|
885
|
+
d === "top" && "data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
|
886
|
+
d === "bottom" && "data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
|
539
887
|
a
|
|
540
888
|
),
|
|
541
|
-
...
|
|
889
|
+
...o,
|
|
542
890
|
children: [
|
|
543
891
|
t,
|
|
544
|
-
/* @__PURE__ */
|
|
545
|
-
/* @__PURE__ */ e(
|
|
892
|
+
/* @__PURE__ */ s(le.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: [
|
|
893
|
+
/* @__PURE__ */ e(Pt, { className: "size-4" }),
|
|
546
894
|
/* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
|
|
547
895
|
] })
|
|
548
896
|
]
|
|
@@ -550,12 +898,12 @@ function da({
|
|
|
550
898
|
)
|
|
551
899
|
] });
|
|
552
900
|
}
|
|
553
|
-
function
|
|
901
|
+
function ba({ className: a, ...t }) {
|
|
554
902
|
return /* @__PURE__ */ e("div", { "data-slot": "sheet-header", className: v("flex flex-col gap-1.5 p-4", a), ...t });
|
|
555
903
|
}
|
|
556
|
-
function
|
|
904
|
+
function ya({ className: a, ...t }) {
|
|
557
905
|
return /* @__PURE__ */ e(
|
|
558
|
-
|
|
906
|
+
le.Title,
|
|
559
907
|
{
|
|
560
908
|
"data-slot": "sheet-title",
|
|
561
909
|
className: v("text-foreground font-semibold", a),
|
|
@@ -563,9 +911,9 @@ function ma({ className: a, ...t }) {
|
|
|
563
911
|
}
|
|
564
912
|
);
|
|
565
913
|
}
|
|
566
|
-
function
|
|
914
|
+
function va({ className: a, ...t }) {
|
|
567
915
|
return /* @__PURE__ */ e(
|
|
568
|
-
|
|
916
|
+
le.Description,
|
|
569
917
|
{
|
|
570
918
|
"data-slot": "sheet-description",
|
|
571
919
|
className: v("text-muted-foreground text-sm", a),
|
|
@@ -573,109 +921,109 @@ function ha({ className: a, ...t }) {
|
|
|
573
921
|
}
|
|
574
922
|
);
|
|
575
923
|
}
|
|
576
|
-
const
|
|
577
|
-
function
|
|
578
|
-
const a =
|
|
924
|
+
const xa = "sidebar_state", wa = 3600 * 24 * 7, Na = "19rem", ka = "18rem", Sa = "3rem", Ca = "b", Xe = se.createContext(null);
|
|
925
|
+
function ve() {
|
|
926
|
+
const a = se.useContext(Xe);
|
|
579
927
|
if (!a)
|
|
580
928
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
581
929
|
return a;
|
|
582
930
|
}
|
|
583
|
-
function
|
|
931
|
+
function _a({
|
|
584
932
|
defaultOpen: a = !0,
|
|
585
933
|
open: t,
|
|
586
|
-
onOpenChange:
|
|
587
|
-
className:
|
|
588
|
-
style:
|
|
589
|
-
children:
|
|
590
|
-
...
|
|
934
|
+
onOpenChange: d,
|
|
935
|
+
className: o,
|
|
936
|
+
style: n,
|
|
937
|
+
children: i,
|
|
938
|
+
...r
|
|
591
939
|
}) {
|
|
592
|
-
const
|
|
593
|
-
(
|
|
594
|
-
const
|
|
595
|
-
|
|
940
|
+
const u = dt(), [c, y] = se.useState(!1), [k, g] = se.useState(a), p = t ?? k, A = se.useCallback(
|
|
941
|
+
(R) => {
|
|
942
|
+
const D = typeof R == "function" ? R(p) : R;
|
|
943
|
+
d ? d(D) : g(D), document.cookie = `${xa}=${D}; path=/; max-age=${wa}`;
|
|
596
944
|
},
|
|
597
|
-
[
|
|
598
|
-
), P =
|
|
599
|
-
|
|
600
|
-
}, [
|
|
601
|
-
|
|
602
|
-
const
|
|
603
|
-
|
|
945
|
+
[d, p]
|
|
946
|
+
), P = se.useCallback(() => {
|
|
947
|
+
u ? y((R) => !R) : A((R) => !R);
|
|
948
|
+
}, [u, A, y]);
|
|
949
|
+
se.useEffect(() => {
|
|
950
|
+
const R = (D) => {
|
|
951
|
+
D.key === Ca && (D.metaKey || D.ctrlKey) && (D.preventDefault(), P());
|
|
604
952
|
};
|
|
605
|
-
return window.addEventListener("keydown",
|
|
606
|
-
window.removeEventListener("keydown",
|
|
953
|
+
return window.addEventListener("keydown", R), () => {
|
|
954
|
+
window.removeEventListener("keydown", R);
|
|
607
955
|
};
|
|
608
956
|
}, [P]);
|
|
609
|
-
const
|
|
957
|
+
const I = p ? "expanded" : "collapsed", E = se.useMemo(
|
|
610
958
|
() => ({
|
|
611
|
-
state:
|
|
612
|
-
open:
|
|
613
|
-
setOpen:
|
|
614
|
-
isMobile:
|
|
615
|
-
openMobile:
|
|
616
|
-
setOpenMobile:
|
|
959
|
+
state: I,
|
|
960
|
+
open: p,
|
|
961
|
+
setOpen: A,
|
|
962
|
+
isMobile: u,
|
|
963
|
+
openMobile: c,
|
|
964
|
+
setOpenMobile: y,
|
|
617
965
|
toggleSidebar: P
|
|
618
966
|
}),
|
|
619
|
-
[
|
|
967
|
+
[I, p, A, u, c, y, P]
|
|
620
968
|
);
|
|
621
|
-
return /* @__PURE__ */ e(
|
|
969
|
+
return /* @__PURE__ */ e(Xe.Provider, { value: E, children: /* @__PURE__ */ e(Ue, { delayDuration: 0, children: /* @__PURE__ */ e(
|
|
622
970
|
"div",
|
|
623
971
|
{
|
|
624
972
|
"data-slot": "sidebar-wrapper",
|
|
625
973
|
style: {
|
|
626
|
-
"--sidebar-width":
|
|
627
|
-
"--sidebar-width-icon":
|
|
628
|
-
...
|
|
974
|
+
"--sidebar-width": Na,
|
|
975
|
+
"--sidebar-width-icon": Sa,
|
|
976
|
+
...n
|
|
629
977
|
},
|
|
630
|
-
className: v("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
|
|
631
|
-
...
|
|
632
|
-
children:
|
|
978
|
+
className: v("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full", o),
|
|
979
|
+
...r,
|
|
980
|
+
children: i
|
|
633
981
|
}
|
|
634
982
|
) }) });
|
|
635
983
|
}
|
|
636
|
-
function
|
|
984
|
+
function Ta({
|
|
637
985
|
side: a = "left",
|
|
638
986
|
variant: t = "sidebar",
|
|
639
|
-
collapsible:
|
|
640
|
-
className:
|
|
641
|
-
children:
|
|
642
|
-
...
|
|
987
|
+
collapsible: d = "offcanvas",
|
|
988
|
+
className: o,
|
|
989
|
+
children: n,
|
|
990
|
+
...i
|
|
643
991
|
}) {
|
|
644
|
-
const { isMobile:
|
|
645
|
-
return
|
|
992
|
+
const { isMobile: r, state: u, openMobile: c, setOpenMobile: y } = ve();
|
|
993
|
+
return d === "none" ? /* @__PURE__ */ e(
|
|
646
994
|
"div",
|
|
647
995
|
{
|
|
648
996
|
"data-slot": "sidebar",
|
|
649
|
-
className: v("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
|
|
650
|
-
...
|
|
651
|
-
children:
|
|
997
|
+
className: v("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col", o),
|
|
998
|
+
...i,
|
|
999
|
+
children: n
|
|
652
1000
|
}
|
|
653
|
-
) :
|
|
654
|
-
|
|
1001
|
+
) : r ? /* @__PURE__ */ e(pa, { open: c, onOpenChange: y, ...i, children: /* @__PURE__ */ s(
|
|
1002
|
+
fa,
|
|
655
1003
|
{
|
|
656
|
-
onOpenAutoFocus: (
|
|
1004
|
+
onOpenAutoFocus: (k) => k.preventDefault(),
|
|
657
1005
|
"data-sidebar": "sidebar",
|
|
658
1006
|
"data-slot": "sidebar",
|
|
659
1007
|
"data-mobile": "true",
|
|
660
1008
|
className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
|
|
661
1009
|
style: {
|
|
662
|
-
"--sidebar-width":
|
|
1010
|
+
"--sidebar-width": ka
|
|
663
1011
|
},
|
|
664
1012
|
side: a,
|
|
665
1013
|
children: [
|
|
666
|
-
/* @__PURE__ */
|
|
667
|
-
/* @__PURE__ */ e(
|
|
668
|
-
/* @__PURE__ */ e(
|
|
1014
|
+
/* @__PURE__ */ s(ba, { className: "sr-only", children: [
|
|
1015
|
+
/* @__PURE__ */ e(ya, { children: "Sidebar" }),
|
|
1016
|
+
/* @__PURE__ */ e(va, { children: "Displays the mobile sidebar." })
|
|
669
1017
|
] }),
|
|
670
|
-
/* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children:
|
|
1018
|
+
/* @__PURE__ */ e("div", { className: "flex h-full w-full flex-col", children: n })
|
|
671
1019
|
]
|
|
672
1020
|
}
|
|
673
|
-
) }) : /* @__PURE__ */
|
|
1021
|
+
) }) : /* @__PURE__ */ s(
|
|
674
1022
|
"div",
|
|
675
1023
|
{
|
|
676
1024
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
677
|
-
"data-state":
|
|
678
|
-
"data-collapsible":
|
|
1025
|
+
"data-state": u,
|
|
1026
|
+
"data-collapsible": u === "collapsed" ? d : "",
|
|
679
1027
|
"data-variant": t,
|
|
680
1028
|
"data-side": a,
|
|
681
1029
|
"data-slot": "sidebar",
|
|
@@ -701,16 +1049,16 @@ function wa({
|
|
|
701
1049
|
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)]",
|
|
702
1050
|
// Adjust the padding for floating and inset variants.
|
|
703
1051
|
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",
|
|
704
|
-
|
|
1052
|
+
o
|
|
705
1053
|
),
|
|
706
|
-
...
|
|
1054
|
+
...i,
|
|
707
1055
|
children: /* @__PURE__ */ e(
|
|
708
1056
|
"div",
|
|
709
1057
|
{
|
|
710
1058
|
"data-sidebar": "sidebar",
|
|
711
1059
|
"data-slot": "sidebar-inner",
|
|
712
1060
|
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",
|
|
713
|
-
children:
|
|
1061
|
+
children: n
|
|
714
1062
|
}
|
|
715
1063
|
)
|
|
716
1064
|
}
|
|
@@ -719,28 +1067,28 @@ function wa({
|
|
|
719
1067
|
}
|
|
720
1068
|
);
|
|
721
1069
|
}
|
|
722
|
-
function
|
|
723
|
-
const { toggleSidebar:
|
|
724
|
-
return /* @__PURE__ */
|
|
725
|
-
|
|
1070
|
+
function Pa({ className: a, onClick: t, ...d }) {
|
|
1071
|
+
const { toggleSidebar: o } = ve();
|
|
1072
|
+
return /* @__PURE__ */ s(
|
|
1073
|
+
ae,
|
|
726
1074
|
{
|
|
727
1075
|
"data-sidebar": "trigger",
|
|
728
1076
|
"data-slot": "sidebar-trigger",
|
|
729
1077
|
variant: "ghost",
|
|
730
1078
|
size: "icon",
|
|
731
1079
|
className: v("size-7", a),
|
|
732
|
-
onClick: (
|
|
733
|
-
t?.(
|
|
1080
|
+
onClick: (n) => {
|
|
1081
|
+
t?.(n), o();
|
|
734
1082
|
},
|
|
735
|
-
...
|
|
1083
|
+
...d,
|
|
736
1084
|
children: [
|
|
737
|
-
/* @__PURE__ */ e(
|
|
1085
|
+
/* @__PURE__ */ e(Et, {}),
|
|
738
1086
|
/* @__PURE__ */ e("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
739
1087
|
]
|
|
740
1088
|
}
|
|
741
1089
|
);
|
|
742
1090
|
}
|
|
743
|
-
function
|
|
1091
|
+
function Ea({ className: a, ...t }) {
|
|
744
1092
|
return /* @__PURE__ */ e(
|
|
745
1093
|
"div",
|
|
746
1094
|
{
|
|
@@ -751,7 +1099,7 @@ function ka({ className: a, ...t }) {
|
|
|
751
1099
|
}
|
|
752
1100
|
);
|
|
753
1101
|
}
|
|
754
|
-
function
|
|
1102
|
+
function Ma({ className: a, ...t }) {
|
|
755
1103
|
return /* @__PURE__ */ e(
|
|
756
1104
|
"div",
|
|
757
1105
|
{
|
|
@@ -765,7 +1113,7 @@ function _a({ className: a, ...t }) {
|
|
|
765
1113
|
}
|
|
766
1114
|
);
|
|
767
1115
|
}
|
|
768
|
-
function
|
|
1116
|
+
function Aa({ className: a, ...t }) {
|
|
769
1117
|
return /* @__PURE__ */ e(
|
|
770
1118
|
"div",
|
|
771
1119
|
{
|
|
@@ -776,7 +1124,7 @@ function Ca({ className: a, ...t }) {
|
|
|
776
1124
|
}
|
|
777
1125
|
);
|
|
778
1126
|
}
|
|
779
|
-
function
|
|
1127
|
+
function De({ className: a, ...t }) {
|
|
780
1128
|
return /* @__PURE__ */ e(
|
|
781
1129
|
"div",
|
|
782
1130
|
{
|
|
@@ -787,7 +1135,7 @@ function Ae({ className: a, ...t }) {
|
|
|
787
1135
|
}
|
|
788
1136
|
);
|
|
789
1137
|
}
|
|
790
|
-
function
|
|
1138
|
+
function $e({ className: a, ...t }) {
|
|
791
1139
|
return /* @__PURE__ */ e(
|
|
792
1140
|
"ul",
|
|
793
1141
|
{
|
|
@@ -809,7 +1157,7 @@ function Le({ className: a, ...t }) {
|
|
|
809
1157
|
}
|
|
810
1158
|
);
|
|
811
1159
|
}
|
|
812
|
-
const
|
|
1160
|
+
const Ia = na(
|
|
813
1161
|
"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",
|
|
814
1162
|
{
|
|
815
1163
|
variants: {
|
|
@@ -829,476 +1177,636 @@ const Sa = ta(
|
|
|
829
1177
|
}
|
|
830
1178
|
}
|
|
831
1179
|
);
|
|
832
|
-
function
|
|
1180
|
+
function Fe({
|
|
833
1181
|
asChild: a = !1,
|
|
834
1182
|
isActive: t = !1,
|
|
835
|
-
variant:
|
|
836
|
-
size:
|
|
837
|
-
tooltip:
|
|
838
|
-
className:
|
|
839
|
-
...
|
|
1183
|
+
variant: d = "default",
|
|
1184
|
+
size: o = "default",
|
|
1185
|
+
tooltip: n,
|
|
1186
|
+
className: i,
|
|
1187
|
+
...r
|
|
840
1188
|
}) {
|
|
841
|
-
const
|
|
842
|
-
|
|
1189
|
+
const u = a ? ra : "button", { isMobile: c, state: y } = ve(), k = /* @__PURE__ */ e(
|
|
1190
|
+
u,
|
|
843
1191
|
{
|
|
844
1192
|
"data-slot": "sidebar-menu-button",
|
|
845
1193
|
"data-sidebar": "menu-button",
|
|
846
|
-
"data-size":
|
|
1194
|
+
"data-size": o,
|
|
847
1195
|
"data-active": t,
|
|
848
|
-
className: v(
|
|
849
|
-
...
|
|
1196
|
+
className: v(Ia({ variant: d, size: o }), i),
|
|
1197
|
+
...r
|
|
850
1198
|
}
|
|
851
1199
|
);
|
|
852
|
-
return
|
|
853
|
-
children:
|
|
854
|
-
}), /* @__PURE__ */
|
|
855
|
-
/* @__PURE__ */ e(
|
|
856
|
-
/* @__PURE__ */ e(
|
|
857
|
-
] })) :
|
|
1200
|
+
return n ? (typeof n == "string" && (n = {
|
|
1201
|
+
children: n
|
|
1202
|
+
}), /* @__PURE__ */ s(Be, { children: [
|
|
1203
|
+
/* @__PURE__ */ e(Ke, { asChild: !0, children: k }),
|
|
1204
|
+
/* @__PURE__ */ e(Qe, { side: "right", align: "center", hidden: y !== "collapsed" || c, ...n })
|
|
1205
|
+
] })) : k;
|
|
858
1206
|
}
|
|
859
|
-
function
|
|
860
|
-
const { t, i18n:
|
|
861
|
-
{ id: "general", label: t("sections.general", "General"), icon:
|
|
862
|
-
{ id: "profile", label: t("sections.profile", "Profile"), icon:
|
|
863
|
-
{ id: "account", label: t("sections.account", "Account"), icon:
|
|
864
|
-
].filter((
|
|
865
|
-
const
|
|
866
|
-
return (
|
|
867
|
-
}), [t,
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
1207
|
+
function Ra({ trigger: a }) {
|
|
1208
|
+
const { t, i18n: d } = ue(["settings", "translation"]), { app: o, settings: n } = ne(), i = oe(), r = he(), { theme: u, setTheme: c, accent: y, setAccent: k, radius: g, setRadius: p } = Ve(), [A, P] = _(null), [I, E] = _(!1), R = re(null), D = Q(() => [
|
|
1209
|
+
{ id: "general", label: t("sections.general", "General"), icon: Ae },
|
|
1210
|
+
{ id: "profile", label: t("sections.profile", "Profile"), icon: Mt },
|
|
1211
|
+
{ id: "account", label: t("sections.account", "Account"), icon: At }
|
|
1212
|
+
].filter((h) => {
|
|
1213
|
+
const N = n?.sections?.[h.id];
|
|
1214
|
+
return (N?.mode ?? (N?.enabled === !1 ? "hidden" : "editable")) !== "hidden";
|
|
1215
|
+
}), [t, n]), [T, q] = _(D[0]?.id || "general"), x = ee(
|
|
1216
|
+
(l, h, N = "editable") => {
|
|
1217
|
+
const ie = n?.sections?.[l]?.fields;
|
|
1218
|
+
return ie && ie[h] || N;
|
|
1219
|
+
},
|
|
1220
|
+
[n]
|
|
1221
|
+
), [V, K] = _(""), [M, $] = _(""), [G, F] = _(""), [J, W] = _(""), j = Q(
|
|
1222
|
+
() => o?.userMetadataFields?.filter((l) => l.showInProfile) || [],
|
|
1223
|
+
[o?.userMetadataFields]
|
|
1224
|
+
), [L, w] = _({}), [m, C] = _(!1), f = d.language === "fa", O = f ? "text-right" : "text-left", S = ee(async () => {
|
|
871
1225
|
try {
|
|
872
|
-
const l = await
|
|
873
|
-
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}),
|
|
1226
|
+
const l = await i.getMe();
|
|
1227
|
+
P(l), K(l.name || ""), $(l.surname || ""), F(l.phone || "");
|
|
1228
|
+
const h = {};
|
|
1229
|
+
j.forEach((N) => {
|
|
1230
|
+
h[N.key] = l.metadata?.[N.key] ?? N.defaultValue ?? "";
|
|
1231
|
+
}), w(h);
|
|
878
1232
|
} catch (l) {
|
|
879
|
-
console.error("Failed to fetch user:", l),
|
|
1233
|
+
console.error("Failed to fetch user:", l), te.error(de(l, t));
|
|
880
1234
|
}
|
|
881
|
-
}, [t,
|
|
882
|
-
|
|
883
|
-
if (!
|
|
884
|
-
|
|
1235
|
+
}, [t, j, i]);
|
|
1236
|
+
B(() => {
|
|
1237
|
+
if (!I) {
|
|
1238
|
+
R.current = null;
|
|
885
1239
|
return;
|
|
886
1240
|
}
|
|
887
|
-
(
|
|
888
|
-
}, [
|
|
889
|
-
const l = { ...
|
|
890
|
-
let
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
}),
|
|
894
|
-
}, [
|
|
895
|
-
const
|
|
896
|
-
|
|
1241
|
+
(R.current === null || T === "account") && S(), R.current = T;
|
|
1242
|
+
}, [I, T, S]), B(() => {
|
|
1243
|
+
const l = { ...L };
|
|
1244
|
+
let h = !1;
|
|
1245
|
+
j.forEach((N) => {
|
|
1246
|
+
N.condition && !ye(N.condition, L) && l[N.key] !== void 0 && (delete l[N.key], h = !0);
|
|
1247
|
+
}), h && w(l);
|
|
1248
|
+
}, [L, j]);
|
|
1249
|
+
const Z = async () => {
|
|
1250
|
+
C(!0);
|
|
897
1251
|
try {
|
|
898
|
-
const l = { name:
|
|
899
|
-
|
|
900
|
-
const
|
|
901
|
-
|
|
902
|
-
ct(m?.cacheNamespace || "gentiq"),
|
|
903
|
-
o
|
|
904
|
-
), ee.success(t("profile.success", "Profile updated successfully")), H(""), S();
|
|
1252
|
+
const l = { name: V, surname: M, phone: G, metadata: L };
|
|
1253
|
+
J && (l.password = J);
|
|
1254
|
+
const h = await i.updateMe(l);
|
|
1255
|
+
r.setQueryData(ht(o?.cacheNamespace || "gentiq"), h), te.success(t("profile.success", "Profile updated successfully")), W(""), S();
|
|
905
1256
|
} catch (l) {
|
|
906
|
-
|
|
1257
|
+
te.error(de(l, t));
|
|
907
1258
|
} finally {
|
|
908
|
-
|
|
1259
|
+
C(!1);
|
|
909
1260
|
}
|
|
910
|
-
},
|
|
911
|
-
window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (
|
|
912
|
-
},
|
|
913
|
-
|
|
914
|
-
},
|
|
915
|
-
return /* @__PURE__ */
|
|
916
|
-
/* @__PURE__ */ e(
|
|
1261
|
+
}, H = () => {
|
|
1262
|
+
window.confirm(t("account.logout_confirm", "Are you sure you want to logout?")) && (i.clearToken(), window.location.reload());
|
|
1263
|
+
}, z = (l) => {
|
|
1264
|
+
d.changeLanguage(l);
|
|
1265
|
+
}, U = A?.balance ? Math.max(0, Math.min(100, A.balance.tokens / (A.balance.token_limit || 1) * 100)) : 0, b = A?.balance ? Math.max(0, Math.min(100, A.balance.requests / (A.balance.request_limit || 1) * 100)) : 0;
|
|
1266
|
+
return /* @__PURE__ */ s(Ge, { open: I, onOpenChange: E, children: [
|
|
1267
|
+
/* @__PURE__ */ e(ut, { asChild: !0, children: a || /* @__PURE__ */ e(ae, { variant: "ghost", size: "icon", className: "rounded-full", children: /* @__PURE__ */ e(Ce, { className: "h-5 w-5" }) }) }),
|
|
917
1268
|
/* @__PURE__ */ e(
|
|
918
|
-
|
|
1269
|
+
We,
|
|
919
1270
|
{
|
|
920
|
-
dir:
|
|
1271
|
+
dir: f ? "rtl" : "ltr",
|
|
921
1272
|
className: v(
|
|
922
1273
|
"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]",
|
|
923
|
-
|
|
1274
|
+
f && "rtl"
|
|
924
1275
|
),
|
|
925
|
-
children: /* @__PURE__ */
|
|
926
|
-
/* @__PURE__ */
|
|
927
|
-
/* @__PURE__ */ e("div", { className: "flex items-center justify-between px-4 sm:px-6 mb-2 sm:mb-4", children: /* @__PURE__ */
|
|
928
|
-
/* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(
|
|
1276
|
+
children: /* @__PURE__ */ s("div", { className: "flex flex-col h-full w-full min-h-0 overflow-hidden", children: [
|
|
1277
|
+
/* @__PURE__ */ s("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: [
|
|
1278
|
+
/* @__PURE__ */ e("div", { className: "flex items-center justify-between px-4 sm:px-6 mb-2 sm:mb-4", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
|
|
1279
|
+
/* @__PURE__ */ e("div", { className: "bg-primary/10 p-1.5 rounded-lg", children: /* @__PURE__ */ e(Ce, { className: "h-5 w-5 text-primary" }) }),
|
|
929
1280
|
/* @__PURE__ */ e("span", { className: "font-bold text-lg", children: t("title", "Settings") })
|
|
930
1281
|
] }) }),
|
|
931
|
-
/* @__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:
|
|
1282
|
+
/* @__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: D.map((l) => /* @__PURE__ */ s(
|
|
932
1283
|
"button",
|
|
933
1284
|
{
|
|
934
|
-
onClick: () =>
|
|
1285
|
+
onClick: () => q(l.id),
|
|
935
1286
|
className: v(
|
|
936
1287
|
"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",
|
|
937
|
-
|
|
938
|
-
|
|
1288
|
+
T === l.id ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground hover:border-border",
|
|
1289
|
+
n?.sections?.[l.id]?.mode === "faded" && "opacity-50 pointer-events-none select-none"
|
|
939
1290
|
),
|
|
940
1291
|
children: [
|
|
941
|
-
/* @__PURE__ */ e(
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1292
|
+
/* @__PURE__ */ e(
|
|
1293
|
+
l.icon,
|
|
1294
|
+
{
|
|
1295
|
+
className: v(
|
|
1296
|
+
"h-3.5 w-3.5 sm:h-4 sm:w-4 transition-transform",
|
|
1297
|
+
T === l.id && "scale-110"
|
|
1298
|
+
)
|
|
1299
|
+
}
|
|
1300
|
+
),
|
|
945
1301
|
l.label
|
|
946
1302
|
]
|
|
947
1303
|
},
|
|
948
1304
|
l.id
|
|
949
1305
|
)) }) })
|
|
950
1306
|
] }),
|
|
951
|
-
/* @__PURE__ */ e("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */
|
|
952
|
-
|
|
953
|
-
/* @__PURE__ */
|
|
1307
|
+
/* @__PURE__ */ e("div", { className: "flex-1 relative min-h-0 h-full bg-background", children: /* @__PURE__ */ s("div", { className: "absolute inset-0 overflow-y-auto p-5 sm:p-8 pt-12 sm:pt-12 custom-scrollbar", children: [
|
|
1308
|
+
T === "profile" && /* @__PURE__ */ s("div", { className: "space-y-6 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1309
|
+
/* @__PURE__ */ s("div", { children: [
|
|
954
1310
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("profile.title", "Profile Information") }),
|
|
955
1311
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("profile.subtitle", "Update your personal details below.") })
|
|
956
1312
|
] }),
|
|
957
|
-
/* @__PURE__ */
|
|
958
|
-
/* @__PURE__ */
|
|
959
|
-
x("profile", "name") !== "hidden" && /* @__PURE__ */
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
{
|
|
1010
|
-
id: "pass",
|
|
1011
|
-
type: "password",
|
|
1012
|
-
value: L,
|
|
1013
|
-
onChange: (l) => H(l.target.value),
|
|
1014
|
-
disabled: x("profile", "password") === "faded",
|
|
1015
|
-
placeholder: t("profile.password_placeholder", "Leave empty to keep current"),
|
|
1016
|
-
className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary pl-10 pr-3 text-left",
|
|
1017
|
-
dir: "ltr"
|
|
1018
|
-
}
|
|
1019
|
-
)
|
|
1020
|
-
] })
|
|
1313
|
+
/* @__PURE__ */ s("div", { className: "grid gap-6", children: [
|
|
1314
|
+
/* @__PURE__ */ s("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4", children: [
|
|
1315
|
+
x("profile", "name") !== "hidden" && /* @__PURE__ */ s(
|
|
1316
|
+
"div",
|
|
1317
|
+
{
|
|
1318
|
+
className: v(
|
|
1319
|
+
"flex flex-col gap-3",
|
|
1320
|
+
x("profile", "name") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1321
|
+
),
|
|
1322
|
+
children: [
|
|
1323
|
+
/* @__PURE__ */ e(X, { htmlFor: "name", className: "px-1", children: t("profile.name", "First Name") }),
|
|
1324
|
+
/* @__PURE__ */ e(
|
|
1325
|
+
Y,
|
|
1326
|
+
{
|
|
1327
|
+
id: "name",
|
|
1328
|
+
value: V,
|
|
1329
|
+
onChange: (l) => K(l.target.value),
|
|
1330
|
+
disabled: x("profile", "name") === "faded",
|
|
1331
|
+
className: v(
|
|
1332
|
+
"bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
|
|
1333
|
+
O
|
|
1334
|
+
)
|
|
1335
|
+
}
|
|
1336
|
+
)
|
|
1337
|
+
]
|
|
1338
|
+
}
|
|
1339
|
+
),
|
|
1340
|
+
x("profile", "surname") !== "hidden" && /* @__PURE__ */ s(
|
|
1341
|
+
"div",
|
|
1342
|
+
{
|
|
1343
|
+
className: v(
|
|
1344
|
+
"flex flex-col gap-3",
|
|
1345
|
+
x("profile", "surname") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1346
|
+
),
|
|
1347
|
+
children: [
|
|
1348
|
+
/* @__PURE__ */ e(X, { htmlFor: "surname", className: "px-1", children: t("profile.surname", "Last Name") }),
|
|
1349
|
+
/* @__PURE__ */ e(
|
|
1350
|
+
Y,
|
|
1351
|
+
{
|
|
1352
|
+
id: "surname",
|
|
1353
|
+
value: M,
|
|
1354
|
+
onChange: (l) => $(l.target.value),
|
|
1355
|
+
disabled: x("profile", "surname") === "faded",
|
|
1356
|
+
className: v(
|
|
1357
|
+
"bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
|
|
1358
|
+
O
|
|
1359
|
+
)
|
|
1360
|
+
}
|
|
1361
|
+
)
|
|
1362
|
+
]
|
|
1363
|
+
}
|
|
1364
|
+
)
|
|
1021
1365
|
] }),
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1366
|
+
x("profile", "phone") !== "hidden" && /* @__PURE__ */ s(
|
|
1367
|
+
"div",
|
|
1368
|
+
{
|
|
1369
|
+
className: v(
|
|
1370
|
+
"flex flex-col gap-3",
|
|
1371
|
+
x("profile", "phone") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1372
|
+
),
|
|
1373
|
+
children: [
|
|
1374
|
+
/* @__PURE__ */ e(X, { htmlFor: "phone", className: "px-1 text-left", children: t("profile.phone", "Phone Number") }),
|
|
1375
|
+
/* @__PURE__ */ s("div", { className: "relative", children: [
|
|
1376
|
+
/* @__PURE__ */ e(It, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground left-3" }),
|
|
1377
|
+
/* @__PURE__ */ e(
|
|
1378
|
+
Y,
|
|
1379
|
+
{
|
|
1380
|
+
id: "phone",
|
|
1381
|
+
value: G,
|
|
1382
|
+
onChange: (l) => F(l.target.value),
|
|
1383
|
+
disabled: x("profile", "phone") === "faded",
|
|
1384
|
+
className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary pl-10 pr-3 text-left",
|
|
1385
|
+
dir: "ltr"
|
|
1386
|
+
}
|
|
1387
|
+
)
|
|
1388
|
+
] })
|
|
1389
|
+
]
|
|
1390
|
+
}
|
|
1391
|
+
),
|
|
1392
|
+
x("profile", "password") !== "hidden" && /* @__PURE__ */ s(
|
|
1393
|
+
"div",
|
|
1394
|
+
{
|
|
1395
|
+
className: v(
|
|
1396
|
+
"flex flex-col gap-3",
|
|
1397
|
+
x("profile", "password") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1398
|
+
),
|
|
1399
|
+
children: [
|
|
1400
|
+
/* @__PURE__ */ e(X, { htmlFor: "pass", className: "px-1 text-left", children: t("profile.password", "New Password") }),
|
|
1401
|
+
/* @__PURE__ */ s("div", { className: "relative", children: [
|
|
1402
|
+
/* @__PURE__ */ e(Rt, { className: "absolute top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground left-3" }),
|
|
1403
|
+
/* @__PURE__ */ e(
|
|
1404
|
+
Y,
|
|
1405
|
+
{
|
|
1406
|
+
id: "pass",
|
|
1407
|
+
type: "password",
|
|
1408
|
+
value: J,
|
|
1409
|
+
onChange: (l) => W(l.target.value),
|
|
1410
|
+
disabled: x("profile", "password") === "faded",
|
|
1411
|
+
placeholder: t(
|
|
1412
|
+
"profile.password_placeholder",
|
|
1413
|
+
"Leave empty to keep current"
|
|
1414
|
+
),
|
|
1415
|
+
className: "bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary pl-10 pr-3 text-left",
|
|
1416
|
+
dir: "ltr"
|
|
1417
|
+
}
|
|
1418
|
+
)
|
|
1419
|
+
] })
|
|
1420
|
+
]
|
|
1421
|
+
}
|
|
1422
|
+
),
|
|
1423
|
+
j.map((l) => {
|
|
1424
|
+
const h = x("profile", l.key, l.mode || "editable");
|
|
1425
|
+
return h === "hidden" || !ye(l.condition, L) ? null : /* @__PURE__ */ s(
|
|
1426
|
+
"div",
|
|
1427
|
+
{
|
|
1428
|
+
className: v(
|
|
1429
|
+
"flex flex-col gap-3 animate-in fade-in slide-in-from-top-1 duration-200",
|
|
1430
|
+
h === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1049
1431
|
),
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1432
|
+
children: [
|
|
1433
|
+
/* @__PURE__ */ e(X, { htmlFor: `profile-${l.key}`, className: "px-1", children: t(l.label) }),
|
|
1434
|
+
l.type === "select" ? /* @__PURE__ */ s(
|
|
1435
|
+
we,
|
|
1436
|
+
{
|
|
1437
|
+
value: String(L[l.key] || ""),
|
|
1438
|
+
onValueChange: (N) => w({ ...L, [l.key]: N }),
|
|
1439
|
+
disabled: h === "faded",
|
|
1440
|
+
dir: f ? "rtl" : "ltr",
|
|
1441
|
+
children: [
|
|
1442
|
+
/* @__PURE__ */ e(Ne, { className: "bg-muted/30 border-border/50 rounded-xl focus:ring-primary h-11", children: /* @__PURE__ */ e(
|
|
1443
|
+
ke,
|
|
1444
|
+
{
|
|
1445
|
+
placeholder: t(l.placeholder || "profile.select_placeholder")
|
|
1446
|
+
}
|
|
1447
|
+
) }),
|
|
1448
|
+
/* @__PURE__ */ e(Se, { className: "rounded-xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: l.options?.map((N) => /* @__PURE__ */ e(
|
|
1449
|
+
fe,
|
|
1450
|
+
{
|
|
1451
|
+
value: String(N.value),
|
|
1452
|
+
className: "rounded-lg focus:bg-primary/10",
|
|
1453
|
+
children: t(N.label)
|
|
1454
|
+
},
|
|
1455
|
+
String(N.value)
|
|
1456
|
+
)) })
|
|
1457
|
+
]
|
|
1458
|
+
}
|
|
1459
|
+
) : l.type === "checkbox" ? /* @__PURE__ */ s("div", { className: "flex items-center gap-3 px-1 py-1", children: [
|
|
1460
|
+
/* @__PURE__ */ e(
|
|
1461
|
+
"input",
|
|
1462
|
+
{
|
|
1463
|
+
id: `profile-${l.key}`,
|
|
1464
|
+
type: "checkbox",
|
|
1465
|
+
checked: !!L[l.key],
|
|
1466
|
+
disabled: h === "faded",
|
|
1467
|
+
onChange: (N) => w({ ...L, [l.key]: N.target.checked }),
|
|
1468
|
+
className: "h-5 w-5 rounded-md border-border/50 bg-muted/30 text-primary focus:ring-primary transition-all cursor-pointer"
|
|
1469
|
+
}
|
|
1470
|
+
),
|
|
1471
|
+
/* @__PURE__ */ e(
|
|
1472
|
+
X,
|
|
1473
|
+
{
|
|
1474
|
+
htmlFor: `profile-${l.key}`,
|
|
1475
|
+
className: "text-sm font-medium text-muted-foreground cursor-pointer",
|
|
1476
|
+
children: t(l.placeholder || l.label)
|
|
1477
|
+
}
|
|
1478
|
+
)
|
|
1479
|
+
] }) : /* @__PURE__ */ e(
|
|
1480
|
+
Y,
|
|
1481
|
+
{
|
|
1482
|
+
id: `profile-${l.key}`,
|
|
1483
|
+
type: l.type,
|
|
1484
|
+
value: L[l.key] || "",
|
|
1485
|
+
disabled: h === "faded",
|
|
1486
|
+
onChange: (N) => w({ ...L, [l.key]: N.target.value }),
|
|
1487
|
+
placeholder: t(l.placeholder || ""),
|
|
1488
|
+
className: v(
|
|
1489
|
+
"bg-muted/30 border-border/50 rounded-xl focus-visible:ring-primary h-11",
|
|
1490
|
+
O
|
|
1491
|
+
)
|
|
1492
|
+
}
|
|
1493
|
+
)
|
|
1494
|
+
]
|
|
1495
|
+
},
|
|
1496
|
+
l.key
|
|
1497
|
+
);
|
|
1064
1498
|
}),
|
|
1065
|
-
/* @__PURE__ */ e("div", { className: "pt-4 flex justify-center", children: /* @__PURE__ */
|
|
1066
|
-
|
|
1499
|
+
/* @__PURE__ */ e("div", { className: "pt-4 flex justify-center", children: /* @__PURE__ */ s(
|
|
1500
|
+
ae,
|
|
1067
1501
|
{
|
|
1068
|
-
onClick:
|
|
1069
|
-
disabled:
|
|
1502
|
+
onClick: Z,
|
|
1503
|
+
disabled: m,
|
|
1070
1504
|
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]",
|
|
1071
1505
|
children: [
|
|
1072
1506
|
/* @__PURE__ */ e(Dt, { className: "h-4 w-4" }),
|
|
1073
|
-
|
|
1507
|
+
m ? t("profile.saving", "Saving...") : t("profile.save", "Save Changes")
|
|
1074
1508
|
]
|
|
1075
1509
|
}
|
|
1076
1510
|
) })
|
|
1077
1511
|
] })
|
|
1078
1512
|
] }),
|
|
1079
|
-
|
|
1080
|
-
/* @__PURE__ */
|
|
1513
|
+
T === "general" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1514
|
+
/* @__PURE__ */ s("div", { children: [
|
|
1081
1515
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("general.title", "General Settings") }),
|
|
1082
1516
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("general.subtitle", "Configure look and feel and language.") })
|
|
1083
1517
|
] }),
|
|
1084
|
-
/* @__PURE__ */
|
|
1085
|
-
x("general", "theme") !== "hidden" && /* @__PURE__ */
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
/* @__PURE__ */ r(
|
|
1092
|
-
"button",
|
|
1093
|
-
{
|
|
1094
|
-
onClick: () => f("light"),
|
|
1095
|
-
disabled: x("general", "theme") === "faded",
|
|
1096
|
-
className: v(
|
|
1097
|
-
"flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
|
|
1098
|
-
g === "light" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1099
|
-
),
|
|
1100
|
-
children: [
|
|
1101
|
-
/* @__PURE__ */ e(At, { className: "h-4 w-4" }),
|
|
1102
|
-
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: t("general.themes.light", "Light") })
|
|
1103
|
-
]
|
|
1104
|
-
}
|
|
1105
|
-
),
|
|
1106
|
-
/* @__PURE__ */ r(
|
|
1107
|
-
"button",
|
|
1108
|
-
{
|
|
1109
|
-
onClick: () => f("dark"),
|
|
1110
|
-
disabled: x("general", "theme") === "faded",
|
|
1111
|
-
className: v(
|
|
1112
|
-
"flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
|
|
1113
|
-
g === "dark" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1114
|
-
),
|
|
1115
|
-
children: [
|
|
1116
|
-
/* @__PURE__ */ e(Et, { className: "h-4 w-4" }),
|
|
1117
|
-
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: t("general.themes.dark", "Dark") })
|
|
1118
|
-
]
|
|
1119
|
-
}
|
|
1518
|
+
/* @__PURE__ */ s("div", { className: "space-y-8", children: [
|
|
1519
|
+
x("general", "theme") !== "hidden" && /* @__PURE__ */ s(
|
|
1520
|
+
"div",
|
|
1521
|
+
{
|
|
1522
|
+
className: v(
|
|
1523
|
+
"space-y-3",
|
|
1524
|
+
x("general", "theme") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1120
1525
|
),
|
|
1121
|
-
|
|
1122
|
-
"
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
t("general.accent", "Accent Color")
|
|
1142
|
-
] }),
|
|
1143
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-4 sm:grid-cols-8 gap-3 w-full", children: [
|
|
1144
|
-
"oklch(0.623 0.214 259.815)",
|
|
1145
|
-
// Blue
|
|
1146
|
-
"oklch(0.585 0.233 277.117)",
|
|
1147
|
-
// Indigo
|
|
1148
|
-
"oklch(0.627 0.265 303.9)",
|
|
1149
|
-
// Purple
|
|
1150
|
-
"oklch(0.645 0.246 16.439)",
|
|
1151
|
-
// Rose
|
|
1152
|
-
"oklch(0.712 0.194 46.666)",
|
|
1153
|
-
// Orange
|
|
1154
|
-
"oklch(0.627 0.194 149.214)",
|
|
1155
|
-
// Green
|
|
1156
|
-
"oklch(0.633 0.145 182.903)",
|
|
1157
|
-
// Teal
|
|
1158
|
-
"oklch(0.552 0.016 285.938)"
|
|
1159
|
-
// Slate
|
|
1160
|
-
].map((l) => {
|
|
1161
|
-
const o = (h || "oklch(0.623 0.214 259.815)") === l;
|
|
1162
|
-
return /* @__PURE__ */ e(
|
|
1163
|
-
"button",
|
|
1164
|
-
{
|
|
1165
|
-
onClick: () => N(l),
|
|
1166
|
-
disabled: x("general", "accent") === "faded",
|
|
1167
|
-
className: v(
|
|
1168
|
-
"h-8 w-8 rounded-full border-2 transition-all hover:scale-110 active:scale-95 shadow-sm",
|
|
1169
|
-
o ? "border-foreground" : "border-transparent"
|
|
1526
|
+
children: [
|
|
1527
|
+
/* @__PURE__ */ s(X, { className: "text-sm font-semibold flex items-center gap-2", children: [
|
|
1528
|
+
/* @__PURE__ */ e(Ae, { className: "h-4 w-4 text-primary" }),
|
|
1529
|
+
t("general.theme", "Theme")
|
|
1530
|
+
] }),
|
|
1531
|
+
/* @__PURE__ */ s("div", { className: "flex p-1 bg-muted/50 rounded-2xl border border-border/40 w-full", children: [
|
|
1532
|
+
/* @__PURE__ */ s(
|
|
1533
|
+
"button",
|
|
1534
|
+
{
|
|
1535
|
+
onClick: () => c("light"),
|
|
1536
|
+
disabled: x("general", "theme") === "faded",
|
|
1537
|
+
className: v(
|
|
1538
|
+
"flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
|
|
1539
|
+
u === "light" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1540
|
+
),
|
|
1541
|
+
children: [
|
|
1542
|
+
/* @__PURE__ */ e($t, { className: "h-4 w-4" }),
|
|
1543
|
+
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: t("general.themes.light", "Light") })
|
|
1544
|
+
]
|
|
1545
|
+
}
|
|
1170
1546
|
),
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
].map((l) => {
|
|
1186
|
-
const o = (y || "1.25rem") === l.value;
|
|
1187
|
-
return /* @__PURE__ */ e(
|
|
1188
|
-
"button",
|
|
1189
|
-
{
|
|
1190
|
-
onClick: () => C(l.value),
|
|
1191
|
-
disabled: x("general", "radius") === "faded",
|
|
1192
|
-
className: v(
|
|
1193
|
-
"flex-1 py-2 rounded-xl transition-all text-sm font-medium",
|
|
1194
|
-
o ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1547
|
+
/* @__PURE__ */ s(
|
|
1548
|
+
"button",
|
|
1549
|
+
{
|
|
1550
|
+
onClick: () => c("dark"),
|
|
1551
|
+
disabled: x("general", "theme") === "faded",
|
|
1552
|
+
className: v(
|
|
1553
|
+
"flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
|
|
1554
|
+
u === "dark" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1555
|
+
),
|
|
1556
|
+
children: [
|
|
1557
|
+
/* @__PURE__ */ e(Lt, { className: "h-4 w-4" }),
|
|
1558
|
+
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: t("general.themes.dark", "Dark") })
|
|
1559
|
+
]
|
|
1560
|
+
}
|
|
1195
1561
|
),
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
]
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1562
|
+
/* @__PURE__ */ s(
|
|
1563
|
+
"button",
|
|
1564
|
+
{
|
|
1565
|
+
onClick: () => c("system"),
|
|
1566
|
+
disabled: x("general", "theme") === "faded",
|
|
1567
|
+
className: v(
|
|
1568
|
+
"flex-1 flex items-center justify-center gap-2 py-2.5 rounded-xl transition-all",
|
|
1569
|
+
u === "system" ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1570
|
+
),
|
|
1571
|
+
children: [
|
|
1572
|
+
/* @__PURE__ */ e(Ft, { className: "h-4 w-4" }),
|
|
1573
|
+
/* @__PURE__ */ e("span", { className: "text-sm font-medium", children: t("general.themes.system", "System") })
|
|
1574
|
+
]
|
|
1575
|
+
}
|
|
1576
|
+
)
|
|
1577
|
+
] })
|
|
1578
|
+
]
|
|
1579
|
+
}
|
|
1580
|
+
),
|
|
1581
|
+
x("general", "accent") !== "hidden" && /* @__PURE__ */ s(
|
|
1582
|
+
"div",
|
|
1583
|
+
{
|
|
1584
|
+
className: v(
|
|
1585
|
+
"space-y-4",
|
|
1586
|
+
x("general", "accent") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1587
|
+
),
|
|
1588
|
+
children: [
|
|
1589
|
+
/* @__PURE__ */ s(X, { className: "text-sm font-semibold flex items-center gap-2", children: [
|
|
1590
|
+
/* @__PURE__ */ e(Ie, { className: "h-4 w-4 text-primary" }),
|
|
1591
|
+
t("general.accent", "Accent Color")
|
|
1592
|
+
] }),
|
|
1593
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-4 sm:grid-cols-8 gap-3 w-full", children: [
|
|
1594
|
+
"oklch(0.623 0.214 259.815)",
|
|
1595
|
+
// Blue
|
|
1596
|
+
"oklch(0.585 0.233 277.117)",
|
|
1597
|
+
// Indigo
|
|
1598
|
+
"oklch(0.627 0.265 303.9)",
|
|
1599
|
+
// Purple
|
|
1600
|
+
"oklch(0.645 0.246 16.439)",
|
|
1601
|
+
// Rose
|
|
1602
|
+
"oklch(0.712 0.194 46.666)",
|
|
1603
|
+
// Orange
|
|
1604
|
+
"oklch(0.627 0.194 149.214)",
|
|
1605
|
+
// Green
|
|
1606
|
+
"oklch(0.633 0.145 182.903)",
|
|
1607
|
+
// Teal
|
|
1608
|
+
"oklch(0.552 0.016 285.938)"
|
|
1609
|
+
// Slate
|
|
1610
|
+
].map((l) => {
|
|
1611
|
+
const h = (y || "oklch(0.623 0.214 259.815)") === l;
|
|
1612
|
+
return /* @__PURE__ */ e(
|
|
1613
|
+
"button",
|
|
1614
|
+
{
|
|
1615
|
+
onClick: () => k(l),
|
|
1616
|
+
disabled: x("general", "accent") === "faded",
|
|
1617
|
+
className: v(
|
|
1618
|
+
"h-8 w-8 rounded-full border-2 transition-all hover:scale-110 active:scale-95 shadow-sm",
|
|
1619
|
+
h ? "border-foreground" : "border-transparent"
|
|
1620
|
+
),
|
|
1621
|
+
style: { backgroundColor: l }
|
|
1622
|
+
},
|
|
1623
|
+
l
|
|
1624
|
+
);
|
|
1625
|
+
}) })
|
|
1626
|
+
]
|
|
1627
|
+
}
|
|
1628
|
+
),
|
|
1629
|
+
x("general", "radius") !== "hidden" && /* @__PURE__ */ s(
|
|
1630
|
+
"div",
|
|
1631
|
+
{
|
|
1632
|
+
className: v(
|
|
1633
|
+
"space-y-4",
|
|
1634
|
+
x("general", "radius") === "faded" && "opacity-50 pointer-events-none select-none"
|
|
1635
|
+
),
|
|
1636
|
+
children: [
|
|
1637
|
+
/* @__PURE__ */ s(X, { className: "text-sm font-semibold flex items-center gap-2", children: [
|
|
1638
|
+
/* @__PURE__ */ e("div", { className: "h-4 w-4 rounded-md border-2 border-primary" }),
|
|
1639
|
+
t("general.radius", "Rounded Corners")
|
|
1640
|
+
] }),
|
|
1641
|
+
/* @__PURE__ */ e("div", { className: "flex p-1 bg-muted/50 rounded-2xl border border-border/40 w-full", children: [
|
|
1642
|
+
{ id: "sharp", value: "0.3rem" },
|
|
1643
|
+
{ id: "round", value: "1.25rem" }
|
|
1644
|
+
].map((l) => {
|
|
1645
|
+
const h = (g || "1.25rem") === l.value;
|
|
1646
|
+
return /* @__PURE__ */ e(
|
|
1647
|
+
"button",
|
|
1648
|
+
{
|
|
1649
|
+
onClick: () => p(l.value),
|
|
1650
|
+
disabled: x("general", "radius") === "faded",
|
|
1651
|
+
className: v(
|
|
1652
|
+
"flex-1 py-2 rounded-xl transition-all text-sm font-medium",
|
|
1653
|
+
h ? "bg-background shadow-md text-primary" : "text-muted-foreground hover:text-foreground"
|
|
1654
|
+
),
|
|
1655
|
+
children: t(`general.radius_levels.${l.id}`)
|
|
1656
|
+
},
|
|
1657
|
+
l.id
|
|
1658
|
+
);
|
|
1659
|
+
}) })
|
|
1660
|
+
]
|
|
1661
|
+
}
|
|
1662
|
+
),
|
|
1663
|
+
x("general", "language") !== "hidden" && /* @__PURE__ */ s(
|
|
1664
|
+
"div",
|
|
1665
|
+
{
|
|
1666
|
+
className: v(
|
|
1667
|
+
"space-y-3",
|
|
1668
|
+
x("general", "language") === "faded" && "opacity-50"
|
|
1669
|
+
),
|
|
1670
|
+
children: [
|
|
1671
|
+
/* @__PURE__ */ s(X, { className: "text-sm font-semibold flex items-center gap-2", children: [
|
|
1672
|
+
/* @__PURE__ */ e(qt, { className: "h-4 w-4 text-primary" }),
|
|
1673
|
+
t("general.language", "Language")
|
|
1674
|
+
] }),
|
|
1675
|
+
/* @__PURE__ */ s(
|
|
1676
|
+
we,
|
|
1677
|
+
{
|
|
1678
|
+
value: d.language,
|
|
1679
|
+
onValueChange: z,
|
|
1680
|
+
disabled: x("general", "language") === "faded",
|
|
1681
|
+
dir: f ? "rtl" : "ltr",
|
|
1682
|
+
children: [
|
|
1683
|
+
/* @__PURE__ */ e(Ne, { className: "w-full bg-muted/50 rounded-2xl border-border/40 h-11 focus:ring-primary/20", children: /* @__PURE__ */ e(
|
|
1684
|
+
ke,
|
|
1685
|
+
{
|
|
1686
|
+
placeholder: t("general.language_placeholder", "Select language")
|
|
1687
|
+
}
|
|
1688
|
+
) }),
|
|
1689
|
+
/* @__PURE__ */ s(Se, { className: "rounded-2xl border-border/40 shadow-xl bg-background/95 backdrop-blur-md", children: [
|
|
1690
|
+
/* @__PURE__ */ e(fe, { value: "en", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
|
|
1691
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted-foreground mr-1", children: "EN" }),
|
|
1692
|
+
t("general.languages.en", "English")
|
|
1693
|
+
] }) }),
|
|
1694
|
+
/* @__PURE__ */ e(fe, { value: "fa", className: "rounded-xl focus:bg-primary/10", children: /* @__PURE__ */ s("span", { className: "flex items-center gap-2", children: [
|
|
1695
|
+
/* @__PURE__ */ e("span", { className: "text-xs font-bold text-muted-foreground mr-1", children: "FA" }),
|
|
1696
|
+
t("general.languages.fa", "Persian")
|
|
1697
|
+
] }) })
|
|
1698
|
+
] })
|
|
1699
|
+
]
|
|
1700
|
+
}
|
|
1701
|
+
)
|
|
1702
|
+
]
|
|
1703
|
+
}
|
|
1704
|
+
)
|
|
1230
1705
|
] })
|
|
1231
1706
|
] }),
|
|
1232
|
-
|
|
1233
|
-
/* @__PURE__ */
|
|
1707
|
+
T === "account" && /* @__PURE__ */ s("div", { className: "space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-300", children: [
|
|
1708
|
+
/* @__PURE__ */ s("div", { children: [
|
|
1234
1709
|
/* @__PURE__ */ e("h2", { className: "text-xl font-bold tracking-tight", children: t("account.title", "Account & Usage") }),
|
|
1235
1710
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: t("account.subtitle", "Monitor your quotas and manage your session.") })
|
|
1236
1711
|
] }),
|
|
1237
|
-
/* @__PURE__ */
|
|
1238
|
-
x("account", "balance") !== "hidden" && /* @__PURE__ */
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
/* @__PURE__ */
|
|
1248
|
-
|
|
1249
|
-
"%"
|
|
1250
|
-
] })
|
|
1712
|
+
/* @__PURE__ */ s("div", { className: "space-y-6", children: [
|
|
1713
|
+
x("account", "balance") !== "hidden" && /* @__PURE__ */ s(
|
|
1714
|
+
"div",
|
|
1715
|
+
{
|
|
1716
|
+
className: v(
|
|
1717
|
+
"p-6 bg-muted/30 rounded-3xl border border-border/40 space-y-6",
|
|
1718
|
+
x("account", "balance") === "faded" && "opacity-50"
|
|
1719
|
+
),
|
|
1720
|
+
children: [
|
|
1721
|
+
/* @__PURE__ */ s(X, { className: "text-xs font-bold uppercase tracking-wider text-primary flex items-center gap-2", children: [
|
|
1722
|
+
/* @__PURE__ */ e(zt, { className: "h-4 w-4" }),
|
|
1723
|
+
t("account.balance", "Current Balance")
|
|
1251
1724
|
] }),
|
|
1252
|
-
/* @__PURE__ */
|
|
1253
|
-
"div",
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
"
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1725
|
+
/* @__PURE__ */ s("div", { className: "space-y-5", children: [
|
|
1726
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
1727
|
+
/* @__PURE__ */ s("div", { className: "flex justify-between text-sm mb-1", children: [
|
|
1728
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-muted-foreground", children: t("account.tokens", "Tokens") }),
|
|
1729
|
+
/* @__PURE__ */ s("span", { className: "font-bold text-primary", children: [
|
|
1730
|
+
U.toLocaleString(d.language, {
|
|
1731
|
+
maximumFractionDigits: 0
|
|
1732
|
+
}),
|
|
1733
|
+
"%"
|
|
1734
|
+
] })
|
|
1735
|
+
] }),
|
|
1736
|
+
/* @__PURE__ */ e(
|
|
1737
|
+
"div",
|
|
1738
|
+
{
|
|
1739
|
+
className: "h-2.5 w-full bg-muted/50 rounded-full overflow-hidden border border-border/20 p-0.5",
|
|
1740
|
+
dir: "ltr",
|
|
1741
|
+
children: /* @__PURE__ */ e(
|
|
1742
|
+
"div",
|
|
1743
|
+
{
|
|
1744
|
+
className: v(
|
|
1745
|
+
"h-full rounded-full transition-all duration-1000 shadow-sm",
|
|
1746
|
+
U > 60 ? "bg-emerald-500 shadow-emerald-500/20" : U > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
|
|
1747
|
+
),
|
|
1748
|
+
style: { width: `${U}%` }
|
|
1749
|
+
}
|
|
1750
|
+
)
|
|
1751
|
+
}
|
|
1752
|
+
)
|
|
1268
1753
|
] }),
|
|
1269
|
-
/* @__PURE__ */
|
|
1270
|
-
|
|
1271
|
-
|
|
1754
|
+
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
1755
|
+
/* @__PURE__ */ s("div", { className: "flex justify-between text-sm mb-1", children: [
|
|
1756
|
+
/* @__PURE__ */ s("span", { className: "font-medium text-muted-foreground flex items-center gap-1.5 focus:outline-none", children: [
|
|
1757
|
+
/* @__PURE__ */ e(Ie, { className: "h-3.5 w-3.5 text-blue-500" }),
|
|
1758
|
+
t("account.requests", "Requests")
|
|
1759
|
+
] }),
|
|
1760
|
+
/* @__PURE__ */ s("span", { className: "font-bold text-primary", children: [
|
|
1761
|
+
b.toLocaleString(d.language, {
|
|
1762
|
+
maximumFractionDigits: 0
|
|
1763
|
+
}),
|
|
1764
|
+
"%"
|
|
1765
|
+
] })
|
|
1766
|
+
] }),
|
|
1767
|
+
/* @__PURE__ */ e(
|
|
1768
|
+
"div",
|
|
1769
|
+
{
|
|
1770
|
+
className: "h-2.5 w-full bg-muted/50 rounded-full overflow-hidden border border-border/20 p-0.5",
|
|
1771
|
+
dir: "ltr",
|
|
1772
|
+
children: /* @__PURE__ */ e(
|
|
1773
|
+
"div",
|
|
1774
|
+
{
|
|
1775
|
+
className: v(
|
|
1776
|
+
"h-full rounded-full transition-all duration-1000 shadow-sm",
|
|
1777
|
+
b > 60 ? "bg-emerald-500 shadow-emerald-500/20" : b > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
|
|
1778
|
+
),
|
|
1779
|
+
style: { width: `${b}%` }
|
|
1780
|
+
}
|
|
1781
|
+
)
|
|
1782
|
+
}
|
|
1783
|
+
)
|
|
1272
1784
|
] })
|
|
1273
|
-
] })
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
se > 60 ? "bg-emerald-500 shadow-emerald-500/20" : se > 20 ? "bg-amber-500 shadow-amber-500/20" : "bg-destructive shadow-destructive/20"
|
|
1280
|
-
),
|
|
1281
|
-
style: { width: `${se}%` }
|
|
1282
|
-
}
|
|
1283
|
-
) })
|
|
1284
|
-
] })
|
|
1285
|
-
] })
|
|
1286
|
-
] }),
|
|
1287
|
-
/* @__PURE__ */ r("div", { className: "pt-2 flex flex-col gap-3", children: [
|
|
1288
|
-
s?.balance?.updated_at && x("account", "balance") !== "hidden" && /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground px-1", children: [
|
|
1785
|
+
] })
|
|
1786
|
+
]
|
|
1787
|
+
}
|
|
1788
|
+
),
|
|
1789
|
+
/* @__PURE__ */ s("div", { className: "pt-2 flex flex-col gap-3", children: [
|
|
1790
|
+
A?.balance?.updated_at && x("account", "balance") !== "hidden" && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground px-1", children: [
|
|
1289
1791
|
t("account.last_recharge", "Last balance update on"),
|
|
1290
|
-
":
|
|
1291
|
-
|
|
1792
|
+
":",
|
|
1793
|
+
" ",
|
|
1794
|
+
new Date(A.balance?.updated_at || "").toLocaleDateString(
|
|
1795
|
+
d.language
|
|
1796
|
+
)
|
|
1292
1797
|
] }),
|
|
1293
|
-
x("account", "logout") !== "hidden" && /* @__PURE__ */
|
|
1294
|
-
|
|
1798
|
+
x("account", "logout") !== "hidden" && /* @__PURE__ */ s(
|
|
1799
|
+
ae,
|
|
1295
1800
|
{
|
|
1296
1801
|
variant: "destructive",
|
|
1297
|
-
onClick:
|
|
1802
|
+
onClick: H,
|
|
1298
1803
|
disabled: x("account", "logout") === "faded",
|
|
1299
|
-
className: v(
|
|
1804
|
+
className: v(
|
|
1805
|
+
"rounded-2xl gap-2 font-bold h-12 shadow-lg shadow-destructive/10 transition-all active:scale-[0.98]",
|
|
1806
|
+
x("account", "logout") === "faded" && "opacity-50 pointer-events-none"
|
|
1807
|
+
),
|
|
1300
1808
|
children: [
|
|
1301
|
-
/* @__PURE__ */ e(
|
|
1809
|
+
/* @__PURE__ */ e(jt, { className: "h-4 w-4" }),
|
|
1302
1810
|
t("account.logout", "Logout from Account")
|
|
1303
1811
|
]
|
|
1304
1812
|
}
|
|
@@ -1307,62 +1815,64 @@ function Pa({ trigger: a }) {
|
|
|
1307
1815
|
] })
|
|
1308
1816
|
] })
|
|
1309
1817
|
] }) }),
|
|
1310
|
-
|
|
1311
|
-
"
|
|
1312
|
-
|
|
1313
|
-
|
|
1818
|
+
o?.showVersionInSettings !== !1 && o?.version && x("general", "version") !== "hidden" && /* @__PURE__ */ e(
|
|
1819
|
+
"div",
|
|
1820
|
+
{
|
|
1821
|
+
className: v(
|
|
1822
|
+
"shrink-0 border-t border-border/30 px-5 sm:px-8 py-3 flex justify-center bg-background/80",
|
|
1823
|
+
x("general", "version", "faded") === "faded" && "opacity-70"
|
|
1824
|
+
),
|
|
1825
|
+
children: /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground text-center", dir: "ltr", children: /* @__PURE__ */ s("span", { className: "font-mono text-foreground/75", children: [
|
|
1826
|
+
"v",
|
|
1827
|
+
o.version
|
|
1828
|
+
] }) })
|
|
1829
|
+
}
|
|
1830
|
+
)
|
|
1314
1831
|
] })
|
|
1315
1832
|
}
|
|
1316
1833
|
)
|
|
1317
1834
|
] });
|
|
1318
1835
|
}
|
|
1319
|
-
function
|
|
1320
|
-
const [, t] =
|
|
1321
|
-
|
|
1322
|
-
if (
|
|
1323
|
-
const
|
|
1324
|
-
|
|
1836
|
+
function Ye({ hideActions: a = !1 }) {
|
|
1837
|
+
const [, t] = Pe(), { t: d } = ue(["sidebar", "chat"]), { history: o, app: n } = ne(), { theme: i } = Ve(), r = !a && (o?.enabled ?? !0), [u, c] = _("light");
|
|
1838
|
+
B(() => {
|
|
1839
|
+
if (i === "system") {
|
|
1840
|
+
const g = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
1841
|
+
c(g ? "dark" : "light");
|
|
1325
1842
|
} else
|
|
1326
|
-
|
|
1327
|
-
}, [
|
|
1328
|
-
const
|
|
1329
|
-
return /* @__PURE__ */
|
|
1330
|
-
/* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children:
|
|
1331
|
-
/* @__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(
|
|
1332
|
-
|
|
1333
|
-
{
|
|
1334
|
-
|
|
1335
|
-
alt: y,
|
|
1336
|
-
className: "size-8 object-contain"
|
|
1337
|
-
}
|
|
1338
|
-
) }) }),
|
|
1339
|
-
/* @__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: [
|
|
1340
|
-
/* @__PURE__ */ r(Ue, { children: [
|
|
1341
|
-
/* @__PURE__ */ e(Be, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1843
|
+
c(i);
|
|
1844
|
+
}, [i]);
|
|
1845
|
+
const y = Q(() => n?.logo ? typeof n.logo == "string" ? n.logo : u === "dark" ? n.logo.dark : n.logo.light : pt, [n?.logo, u]), k = n?.name || "Gentiq";
|
|
1846
|
+
return /* @__PURE__ */ s("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: [
|
|
1847
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 md:gap-2 min-w-[36px] md:min-w-[80px]", children: r && /* @__PURE__ */ e(Pa, { className: "hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 rounded-lg size-9" }) }),
|
|
1848
|
+
/* @__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("img", { src: y, alt: k, className: "size-8 object-contain" }) }) }),
|
|
1849
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-1.5 min-w-[36px] md:min-w-[80px] justify-end", children: !a && /* @__PURE__ */ s(_e, { children: [
|
|
1850
|
+
/* @__PURE__ */ s(Be, { children: [
|
|
1851
|
+
/* @__PURE__ */ e(Ke, { asChild: !0, children: /* @__PURE__ */ e(
|
|
1342
1852
|
"button",
|
|
1343
1853
|
{
|
|
1344
1854
|
type: "button",
|
|
1345
1855
|
className: v(
|
|
1346
1856
|
"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",
|
|
1347
|
-
|
|
1857
|
+
r && "md:hidden"
|
|
1348
1858
|
),
|
|
1349
1859
|
onClick: () => {
|
|
1350
1860
|
t("/");
|
|
1351
1861
|
},
|
|
1352
|
-
children: /* @__PURE__ */ e(
|
|
1862
|
+
children: /* @__PURE__ */ e(Ot, { className: "size-5" })
|
|
1353
1863
|
}
|
|
1354
1864
|
) }),
|
|
1355
|
-
/* @__PURE__ */ e(
|
|
1865
|
+
/* @__PURE__ */ e(Qe, { side: "bottom", className: "text-xs", children: d("new_chat") })
|
|
1356
1866
|
] }),
|
|
1357
|
-
|
|
1358
|
-
|
|
1867
|
+
n?.showSettings !== !1 && /* @__PURE__ */ e(
|
|
1868
|
+
Ra,
|
|
1359
1869
|
{
|
|
1360
1870
|
trigger: /* @__PURE__ */ e(
|
|
1361
1871
|
"button",
|
|
1362
1872
|
{
|
|
1363
1873
|
type: "button",
|
|
1364
1874
|
className: "flex items-center justify-center size-9 rounded-lg hover:bg-accent/60 transition-all duration-200 hover:scale-105 active:scale-95 text-muted-foreground hover:text-primary",
|
|
1365
|
-
children: /* @__PURE__ */ e(
|
|
1875
|
+
children: /* @__PURE__ */ e(Ce, { className: "size-5" })
|
|
1366
1876
|
}
|
|
1367
1877
|
)
|
|
1368
1878
|
}
|
|
@@ -1370,275 +1880,342 @@ function Xe({ hideActions: a = !1 }) {
|
|
|
1370
1880
|
] }) })
|
|
1371
1881
|
] });
|
|
1372
1882
|
}
|
|
1373
|
-
const
|
|
1374
|
-
function
|
|
1375
|
-
const
|
|
1376
|
-
return
|
|
1377
|
-
queryKey: [
|
|
1378
|
-
queryFn: async ({ pageParam:
|
|
1379
|
-
const
|
|
1883
|
+
const qe = 20;
|
|
1884
|
+
function Da() {
|
|
1885
|
+
const a = oe(), d = a.getConfig().app?.cacheNamespace || "gentiq";
|
|
1886
|
+
return nt({
|
|
1887
|
+
queryKey: [d, "conversations"],
|
|
1888
|
+
queryFn: async ({ pageParam: o = 0 }) => {
|
|
1889
|
+
const n = await a.getHistory(o, qe);
|
|
1380
1890
|
return {
|
|
1381
|
-
threads:
|
|
1382
|
-
id: `/${
|
|
1383
|
-
firstMessage:
|
|
1384
|
-
timestamp: new Date(
|
|
1385
|
-
pinned: !!
|
|
1891
|
+
threads: n.threads.map((i) => ({
|
|
1892
|
+
id: `/${i.id}`,
|
|
1893
|
+
firstMessage: i.title || i.firstMessage || "Chat",
|
|
1894
|
+
timestamp: new Date(i.created_at).getTime(),
|
|
1895
|
+
pinned: !!i.pinned
|
|
1386
1896
|
})),
|
|
1387
|
-
nextSkip:
|
|
1388
|
-
hasMore:
|
|
1897
|
+
nextSkip: o + qe,
|
|
1898
|
+
hasMore: o + n.threads.length < (n.total_count ?? 0)
|
|
1389
1899
|
};
|
|
1390
1900
|
},
|
|
1391
1901
|
initialPageParam: 0,
|
|
1392
|
-
getNextPageParam: (
|
|
1902
|
+
getNextPageParam: (o) => o.hasMore ? o.nextSkip : void 0,
|
|
1393
1903
|
staleTime: 1e3 * 60 * 5
|
|
1394
1904
|
// 5 minutes
|
|
1395
1905
|
});
|
|
1396
1906
|
}
|
|
1397
|
-
async function
|
|
1398
|
-
const
|
|
1907
|
+
async function $a(a, t, d, o, n) {
|
|
1908
|
+
const r = a.getConfig().app?.cacheNamespace || "gentiq";
|
|
1399
1909
|
try {
|
|
1400
|
-
await
|
|
1401
|
-
} catch (
|
|
1402
|
-
console.error("Failed to delete conversation:",
|
|
1910
|
+
await a.deleteThread(t), d.invalidateQueries({ queryKey: [r, "conversations"] }), n === t && o("/");
|
|
1911
|
+
} catch (u) {
|
|
1912
|
+
console.error("Failed to delete conversation:", u), te.error("Failed to delete conversation");
|
|
1403
1913
|
}
|
|
1404
1914
|
}
|
|
1405
|
-
function
|
|
1406
|
-
const { t, i18n:
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
isLoading: N
|
|
1412
|
-
} = Ta(), { history: y, app: C } = re(), s = C?.basePath || "/", M = y?.enabled ?? !1, P = u?.pages.flatMap((o) => o.threads) ?? [], [U, q] = Ce(), A = ue(), p = ae(null), Q = J(
|
|
1413
|
-
(o) => {
|
|
1414
|
-
p.current && (p.current.disconnect(), p.current = null), o && f && !h && (p.current = new IntersectionObserver(
|
|
1415
|
-
(_) => {
|
|
1416
|
-
_[0].isIntersecting && g();
|
|
1915
|
+
function La({ side: a = "left" }) {
|
|
1916
|
+
const { t, i18n: d } = ue(["sidebar", "translation"]), { setOpenMobile: o, isMobile: n } = ve(), { data: i, fetchNextPage: r, hasNextPage: u, isFetchingNextPage: c, isLoading: y } = Da(), { history: k, app: g } = ne(), p = g?.basePath || "/", A = k?.enabled ?? !1, P = i?.pages.flatMap((h) => h.threads) ?? [], [I, E] = Pe(), R = he(), D = re(null), T = ee(
|
|
1917
|
+
(h) => {
|
|
1918
|
+
D.current && (D.current.disconnect(), D.current = null), h && u && !c && (D.current = new IntersectionObserver(
|
|
1919
|
+
(N) => {
|
|
1920
|
+
N[0].isIntersecting && r();
|
|
1417
1921
|
},
|
|
1418
1922
|
{
|
|
1419
1923
|
threshold: 0,
|
|
1420
1924
|
rootMargin: "100px"
|
|
1421
1925
|
}
|
|
1422
|
-
),
|
|
1926
|
+
), D.current.observe(h));
|
|
1423
1927
|
},
|
|
1424
|
-
[
|
|
1425
|
-
),
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1928
|
+
[u, r, c]
|
|
1929
|
+
), q = oe(), V = q.getConfig().app?.cacheNamespace || "gentiq", [K, M] = _(!1), [$, G] = _(null), [F, J] = _(""), [W, j] = _(null), [L, w] = _(""), m = re(null), C = ee(
|
|
1930
|
+
(h, N) => {
|
|
1931
|
+
h.button !== 0 || h.metaKey || h.ctrlKey || (h.preventDefault(), E(N), n && o(!1));
|
|
1932
|
+
},
|
|
1933
|
+
[E, n, o]
|
|
1934
|
+
), f = P.filter((h) => h.firstMessage?.toLowerCase().includes(F.toLowerCase())).sort((h, N) => h.pinned && !N.pinned ? -1 : !h.pinned && N.pinned ? 1 : N.timestamp - h.timestamp), O = async (h) => {
|
|
1430
1935
|
try {
|
|
1431
|
-
await
|
|
1936
|
+
await q.pinThread(h.id.replace(/^\//, ""), !h.pinned), R.invalidateQueries({ queryKey: [V, "conversations"] }), te.success(h.pinned ? t("unpinned_success") : t("pinned_success"));
|
|
1432
1937
|
} catch {
|
|
1433
|
-
|
|
1938
|
+
te.error(t("pin_failed"));
|
|
1434
1939
|
}
|
|
1435
|
-
}, S = async (
|
|
1940
|
+
}, S = async (h) => {
|
|
1436
1941
|
try {
|
|
1437
|
-
const
|
|
1438
|
-
navigator.clipboard.writeText(
|
|
1942
|
+
const N = await q.shareThread(h.id.replace(/^\//, "")), ie = `${window.location.origin}${N.url}`;
|
|
1943
|
+
navigator.clipboard.writeText(ie), te.success(t("share_success"), {
|
|
1439
1944
|
description: t("share_description")
|
|
1440
1945
|
});
|
|
1441
1946
|
} catch {
|
|
1442
|
-
|
|
1947
|
+
te.error(t("share_failed"));
|
|
1443
1948
|
}
|
|
1444
|
-
},
|
|
1445
|
-
|
|
1446
|
-
},
|
|
1447
|
-
|
|
1448
|
-
},
|
|
1449
|
-
if (
|
|
1949
|
+
}, Z = (h) => {
|
|
1950
|
+
j(h.id), w(h.firstMessage ?? ""), setTimeout(() => m.current?.focus(), 0);
|
|
1951
|
+
}, H = (h) => {
|
|
1952
|
+
h?.preventDefault(), h?.stopPropagation(), j(null), w("");
|
|
1953
|
+
}, z = async (h) => {
|
|
1954
|
+
if (h?.preventDefault(), h && "stopPropagation" in h && h.stopPropagation(), !(!W || !L.trim()))
|
|
1450
1955
|
try {
|
|
1451
|
-
await
|
|
1956
|
+
await q.updateThreadTitle(W, L), R.invalidateQueries({ queryKey: [V, "conversations"] }), j(null), te.success(t("rename_success"));
|
|
1452
1957
|
} catch {
|
|
1453
|
-
|
|
1958
|
+
te.error(t("rename_failed"));
|
|
1454
1959
|
}
|
|
1455
|
-
},
|
|
1456
|
-
|
|
1457
|
-
},
|
|
1458
|
-
|
|
1459
|
-
|
|
1960
|
+
}, U = (h) => {
|
|
1961
|
+
G(h), M(!0);
|
|
1962
|
+
}, b = () => {
|
|
1963
|
+
$ && ($a(
|
|
1964
|
+
q,
|
|
1965
|
+
$.id,
|
|
1966
|
+
R,
|
|
1967
|
+
E,
|
|
1968
|
+
I
|
|
1969
|
+
), M(!1), G(null), te.success(t("chat_deleted_success")));
|
|
1970
|
+
}, l = (h) => new Intl.DateTimeFormat(d.language, {
|
|
1460
1971
|
year: "numeric",
|
|
1461
1972
|
month: "short",
|
|
1462
1973
|
day: "numeric",
|
|
1463
1974
|
hour: "2-digit",
|
|
1464
1975
|
minute: "2-digit",
|
|
1465
|
-
calendar:
|
|
1466
|
-
}).format(new Date(
|
|
1467
|
-
return /* @__PURE__ */ e(
|
|
1468
|
-
/* @__PURE__ */ e(
|
|
1469
|
-
/* @__PURE__ */ e(
|
|
1470
|
-
|
|
1976
|
+
calendar: d.language === "fa" ? "persian" : "gregory"
|
|
1977
|
+
}).format(new Date(h));
|
|
1978
|
+
return /* @__PURE__ */ e(Ue, { children: /* @__PURE__ */ s(Ta, { collapsible: "icon", side: a, children: [
|
|
1979
|
+
/* @__PURE__ */ e(Ma, { className: "custom-scrollbar", children: /* @__PURE__ */ s(Aa, { children: [
|
|
1980
|
+
/* @__PURE__ */ e($e, { 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(
|
|
1981
|
+
Fe,
|
|
1471
1982
|
{
|
|
1472
1983
|
asChild: !0,
|
|
1473
1984
|
tooltip: t("tooltip_new_conversation"),
|
|
1474
1985
|
className: "h-[52px] rounded-2xl bg-white/40 dark:bg-white/5 border border-border/40 hover:border-primary/50 hover:bg-white/90 dark:hover:bg-white/10 text-foreground shadow-[0_4px_12px_-4px_rgba(0,0,0,0.1)] hover:shadow-[0_12px_30px_-10px_var(--glow)] transition-all duration-500 group-data-[collapsible=icon]:size-10 group-data-[collapsible=icon]:p-0! mb-2 group/new-chat overflow-hidden backdrop-blur-md group-data-[collapsible=icon]:mx-auto",
|
|
1475
|
-
children: /* @__PURE__ */
|
|
1986
|
+
children: /* @__PURE__ */ s(
|
|
1476
1987
|
"a",
|
|
1477
1988
|
{
|
|
1478
|
-
href:
|
|
1479
|
-
onClick: (
|
|
1989
|
+
href: xe(p, "/"),
|
|
1990
|
+
onClick: (h) => C(h, "/"),
|
|
1480
1991
|
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",
|
|
1481
1992
|
children: [
|
|
1482
1993
|
/* @__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" }),
|
|
1483
|
-
/* @__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(
|
|
1994
|
+
/* @__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(Ht, { className: "size-5! text-primary transition-all duration-700 group-hover/new-chat:rotate-180 group-hover/new-chat:scale-110" }) }),
|
|
1484
1995
|
/* @__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") })
|
|
1485
1996
|
]
|
|
1486
1997
|
}
|
|
1487
1998
|
)
|
|
1488
1999
|
}
|
|
1489
2000
|
) }) }),
|
|
1490
|
-
|
|
1491
|
-
/* @__PURE__ */ e(
|
|
2001
|
+
A && /* @__PURE__ */ e(De, { className: "group-data-[collapsible=icon]:hidden mb-6 px-2", children: /* @__PURE__ */ s("div", { className: "relative group/search", children: [
|
|
2002
|
+
/* @__PURE__ */ e(Ut, { className: "absolute left-3 top-1/2 -translate-y-1/2 size-4 opacity-40 group-focus-within/search:opacity-70 transition-opacity" }),
|
|
1492
2003
|
/* @__PURE__ */ e(
|
|
1493
|
-
|
|
2004
|
+
Y,
|
|
1494
2005
|
{
|
|
1495
2006
|
placeholder: t("search_conversations"),
|
|
1496
|
-
value:
|
|
1497
|
-
onChange: (
|
|
2007
|
+
value: F,
|
|
2008
|
+
onChange: (h) => J(h.target.value),
|
|
1498
2009
|
className: "pl-9 h-10 bg-accent/15 border border-border/40 focus-visible:ring-primary/20 rounded-xl transition-all"
|
|
1499
2010
|
}
|
|
1500
2011
|
)
|
|
1501
2012
|
] }) }),
|
|
1502
|
-
|
|
1503
|
-
/* @__PURE__ */
|
|
1504
|
-
|
|
1505
|
-
const
|
|
1506
|
-
return /* @__PURE__ */ e(Le, { className: "group/sidebar-menu-item relative", children:
|
|
2013
|
+
A && /* @__PURE__ */ s(De, { className: "group-data-[collapsible=icon]:hidden", children: [
|
|
2014
|
+
/* @__PURE__ */ s($e, { children: [
|
|
2015
|
+
f.map((h, N) => {
|
|
2016
|
+
const ie = W === h.id, Ee = Me(h.firstMessage ?? ""), Ze = Ee === "rtl";
|
|
2017
|
+
return /* @__PURE__ */ e(Le, { className: "group/sidebar-menu-item relative", children: ie ? /* @__PURE__ */ s("div", { className: "flex items-center gap-1 px-2 py-1.5 w-full", children: [
|
|
1507
2018
|
/* @__PURE__ */ e(
|
|
1508
|
-
|
|
2019
|
+
Y,
|
|
1509
2020
|
{
|
|
1510
|
-
ref:
|
|
1511
|
-
value:
|
|
1512
|
-
onChange: (
|
|
1513
|
-
onKeyDown: (
|
|
1514
|
-
|
|
2021
|
+
ref: m,
|
|
2022
|
+
value: L,
|
|
2023
|
+
onChange: (ce) => w(ce.target.value),
|
|
2024
|
+
onKeyDown: (ce) => {
|
|
2025
|
+
ce.key === "Enter" && z(), ce.key === "Escape" && H();
|
|
1515
2026
|
},
|
|
1516
2027
|
className: "h-8 py-0 px-2 text-sm",
|
|
1517
|
-
dir:
|
|
2028
|
+
dir: Me(L)
|
|
2029
|
+
}
|
|
2030
|
+
),
|
|
2031
|
+
/* @__PURE__ */ e(
|
|
2032
|
+
ae,
|
|
2033
|
+
{
|
|
2034
|
+
size: "icon",
|
|
2035
|
+
variant: "ghost",
|
|
2036
|
+
className: "size-8 shrink-0 text-green-600 hover:text-green-700 hover:bg-green-50",
|
|
2037
|
+
onClick: z,
|
|
2038
|
+
children: /* @__PURE__ */ e(Bt, { className: "size-4" })
|
|
1518
2039
|
}
|
|
1519
2040
|
),
|
|
1520
|
-
/* @__PURE__ */ e(te, { size: "icon", variant: "ghost", className: "size-8 shrink-0 text-green-600 hover:text-green-700 hover:bg-green-50", onClick: Y, children: /* @__PURE__ */ e($t, { className: "size-4" }) }),
|
|
1521
|
-
/* @__PURE__ */ e(te, { size: "icon", variant: "ghost", className: "size-8 shrink-0 text-destructive hover:bg-destructive/10", onClick: z, children: /* @__PURE__ */ e(Ut, { className: "size-4" }) })
|
|
1522
|
-
] }) : /* @__PURE__ */ r(ke, { children: [
|
|
1523
2041
|
/* @__PURE__ */ e(
|
|
1524
|
-
|
|
2042
|
+
ae,
|
|
2043
|
+
{
|
|
2044
|
+
size: "icon",
|
|
2045
|
+
variant: "ghost",
|
|
2046
|
+
className: "size-8 shrink-0 text-destructive hover:bg-destructive/10",
|
|
2047
|
+
onClick: H,
|
|
2048
|
+
children: /* @__PURE__ */ e(Kt, { className: "size-4" })
|
|
2049
|
+
}
|
|
2050
|
+
)
|
|
2051
|
+
] }) : /* @__PURE__ */ s(_e, { children: [
|
|
2052
|
+
/* @__PURE__ */ e(
|
|
2053
|
+
Fe,
|
|
1525
2054
|
{
|
|
1526
2055
|
asChild: !0,
|
|
1527
2056
|
className: v("h-auto py-2.5 px-3", {
|
|
1528
|
-
"bg-accent opacity-100 pointer-events-none":
|
|
1529
|
-
"opacity-70 hover:opacity-100":
|
|
2057
|
+
"bg-accent opacity-100 pointer-events-none": h.id === I,
|
|
2058
|
+
"opacity-70 hover:opacity-100": h.id !== I
|
|
1530
2059
|
}),
|
|
1531
|
-
children: /* @__PURE__ */
|
|
2060
|
+
children: /* @__PURE__ */ s(
|
|
1532
2061
|
"a",
|
|
1533
2062
|
{
|
|
1534
|
-
href:
|
|
1535
|
-
onClick: (
|
|
1536
|
-
dir:
|
|
1537
|
-
className: v(
|
|
2063
|
+
href: xe(p, h.id),
|
|
2064
|
+
onClick: (ce) => C(ce, h.id),
|
|
2065
|
+
dir: Ee,
|
|
2066
|
+
className: v(
|
|
2067
|
+
"flex flex-col gap-0.5 w-full overflow-hidden",
|
|
2068
|
+
Ze ? "items-end" : "items-start"
|
|
2069
|
+
),
|
|
1538
2070
|
children: [
|
|
1539
|
-
/* @__PURE__ */ e(
|
|
1540
|
-
|
|
2071
|
+
/* @__PURE__ */ e(
|
|
2072
|
+
"span",
|
|
2073
|
+
{
|
|
2074
|
+
className: v(
|
|
2075
|
+
"truncate w-full font-medium text-[0.9375rem]",
|
|
2076
|
+
d.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"
|
|
2077
|
+
),
|
|
2078
|
+
children: h.firstMessage
|
|
2079
|
+
}
|
|
2080
|
+
),
|
|
2081
|
+
/* @__PURE__ */ e(
|
|
2082
|
+
"div",
|
|
2083
|
+
{
|
|
2084
|
+
className: v(
|
|
2085
|
+
"text-[10px] opacity-40 w-full",
|
|
2086
|
+
d.language === "fa" ? "pl-16 text-right" : "pr-16 text-left"
|
|
2087
|
+
),
|
|
2088
|
+
children: l(h.timestamp)
|
|
2089
|
+
}
|
|
2090
|
+
)
|
|
1541
2091
|
]
|
|
1542
2092
|
}
|
|
1543
2093
|
)
|
|
1544
2094
|
}
|
|
1545
2095
|
),
|
|
1546
|
-
/* @__PURE__ */
|
|
1547
|
-
"
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
{
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
className: "min-w-[120px] p-1",
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
2096
|
+
/* @__PURE__ */ s(
|
|
2097
|
+
"div",
|
|
2098
|
+
{
|
|
2099
|
+
className: v(
|
|
2100
|
+
"absolute top-1/2 -translate-y-1/2 flex items-center gap-1 transition-all duration-200 z-10",
|
|
2101
|
+
d.language === "fa" ? "left-2" : "right-1.5"
|
|
2102
|
+
),
|
|
2103
|
+
children: [
|
|
2104
|
+
h.pinned && /* @__PURE__ */ e(Re, { 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" }),
|
|
2105
|
+
/* @__PURE__ */ s(mt, { dir: d.language === "fa" ? "rtl" : "ltr", children: [
|
|
2106
|
+
/* @__PURE__ */ e(gt, { asChild: !0, children: /* @__PURE__ */ e(
|
|
2107
|
+
ae,
|
|
2108
|
+
{
|
|
2109
|
+
variant: "ghost",
|
|
2110
|
+
size: "icon",
|
|
2111
|
+
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",
|
|
2112
|
+
children: /* @__PURE__ */ e(Qt, { className: "size-3.5" })
|
|
2113
|
+
}
|
|
2114
|
+
) }),
|
|
2115
|
+
/* @__PURE__ */ s(ft, { align: "end", className: "min-w-[120px] p-1", children: [
|
|
2116
|
+
k?.showPin !== !1 && /* @__PURE__ */ s(
|
|
2117
|
+
pe,
|
|
2118
|
+
{
|
|
2119
|
+
onSelect: () => O(h),
|
|
2120
|
+
className: "cursor-pointer flex items-center gap-2",
|
|
2121
|
+
children: [
|
|
2122
|
+
h.pinned ? /* @__PURE__ */ e(Vt, { className: "size-4" }) : /* @__PURE__ */ e(Re, { className: "size-4" }),
|
|
2123
|
+
/* @__PURE__ */ e("span", { children: h.pinned ? t("unpin_conversation") : t("pin_conversation") })
|
|
2124
|
+
]
|
|
2125
|
+
}
|
|
2126
|
+
),
|
|
2127
|
+
k?.showShare !== !1 && /* @__PURE__ */ s(
|
|
2128
|
+
pe,
|
|
2129
|
+
{
|
|
2130
|
+
onSelect: () => S(h),
|
|
2131
|
+
className: "cursor-pointer flex items-center gap-2",
|
|
2132
|
+
children: [
|
|
2133
|
+
/* @__PURE__ */ e(Gt, { className: "size-4" }),
|
|
2134
|
+
/* @__PURE__ */ e("span", { children: t("share_conversation") })
|
|
2135
|
+
]
|
|
2136
|
+
}
|
|
2137
|
+
),
|
|
2138
|
+
(k?.showRename ?? !1) && /* @__PURE__ */ s(
|
|
2139
|
+
pe,
|
|
2140
|
+
{
|
|
2141
|
+
onSelect: () => Z(h),
|
|
2142
|
+
className: "cursor-pointer flex items-center gap-2",
|
|
2143
|
+
children: [
|
|
2144
|
+
/* @__PURE__ */ e(Wt, { className: "size-4" }),
|
|
2145
|
+
/* @__PURE__ */ e("span", { children: t("rename_conversation") })
|
|
2146
|
+
]
|
|
2147
|
+
}
|
|
2148
|
+
),
|
|
2149
|
+
(k?.showDelete ?? !1) && /* @__PURE__ */ s(
|
|
2150
|
+
pe,
|
|
1581
2151
|
{
|
|
1582
2152
|
className: "text-destructive focus:text-destructive focus:bg-destructive/10 cursor-pointer flex items-center gap-2",
|
|
1583
|
-
onSelect: () =>
|
|
2153
|
+
onSelect: () => U(h),
|
|
1584
2154
|
children: [
|
|
1585
|
-
/* @__PURE__ */ e(
|
|
2155
|
+
/* @__PURE__ */ e(Jt, { className: "size-4" }),
|
|
1586
2156
|
/* @__PURE__ */ e("span", { children: t("delete_conversation") })
|
|
1587
2157
|
]
|
|
1588
2158
|
}
|
|
1589
2159
|
)
|
|
1590
|
-
]
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
] }) },
|
|
2160
|
+
] })
|
|
2161
|
+
] })
|
|
2162
|
+
]
|
|
2163
|
+
}
|
|
2164
|
+
)
|
|
2165
|
+
] }) }, N);
|
|
1596
2166
|
}),
|
|
1597
|
-
!
|
|
2167
|
+
!y && P.length === 0 && !F && /* @__PURE__ */ e("div", { className: "px-4 py-8 text-center text-sm opacity-40", children: t("no_conversations") })
|
|
1598
2168
|
] }),
|
|
1599
|
-
/* @__PURE__ */ e("div", { ref:
|
|
1600
|
-
|
|
2169
|
+
/* @__PURE__ */ e("div", { ref: T, className: "h-4 w-full" }),
|
|
2170
|
+
c && /* @__PURE__ */ s("div", { className: "flex flex-col items-center gap-2 p-4 pt-0 opacity-60", children: [
|
|
1601
2171
|
/* @__PURE__ */ e("div", { className: "size-4 border-2 border-primary border-t-transparent rounded-full animate-spin" }),
|
|
1602
2172
|
/* @__PURE__ */ e("span", { className: "text-[10px] uppercase tracking-wider font-medium", children: t("loading_more") })
|
|
1603
2173
|
] })
|
|
1604
2174
|
] })
|
|
1605
2175
|
] }) }),
|
|
1606
|
-
/* @__PURE__ */ e(
|
|
1607
|
-
/* @__PURE__ */ e(
|
|
1608
|
-
|
|
2176
|
+
/* @__PURE__ */ e(Ea, {}),
|
|
2177
|
+
/* @__PURE__ */ e(Ge, { open: K, onOpenChange: M, children: /* @__PURE__ */ s(
|
|
2178
|
+
We,
|
|
1609
2179
|
{
|
|
1610
|
-
onKeyDown: (
|
|
1611
|
-
|
|
2180
|
+
onKeyDown: (h) => {
|
|
2181
|
+
h.key === "Enter" && (h.preventDefault(), b());
|
|
1612
2182
|
},
|
|
1613
2183
|
children: [
|
|
1614
|
-
/* @__PURE__ */
|
|
1615
|
-
/* @__PURE__ */ e(
|
|
1616
|
-
/* @__PURE__ */ e(
|
|
2184
|
+
/* @__PURE__ */ s(bt, { children: [
|
|
2185
|
+
/* @__PURE__ */ e(yt, { children: t("delete_confirm_title") }),
|
|
2186
|
+
/* @__PURE__ */ e(vt, { children: t("delete_confirm_description") })
|
|
1617
2187
|
] }),
|
|
1618
|
-
/* @__PURE__ */
|
|
2188
|
+
/* @__PURE__ */ s(xt, { children: [
|
|
1619
2189
|
/* @__PURE__ */ e(
|
|
1620
|
-
|
|
2190
|
+
ae,
|
|
1621
2191
|
{
|
|
1622
2192
|
variant: "outline",
|
|
1623
2193
|
onClick: () => {
|
|
1624
|
-
|
|
2194
|
+
M(!1);
|
|
1625
2195
|
},
|
|
1626
2196
|
children: t("cancel")
|
|
1627
2197
|
}
|
|
1628
2198
|
),
|
|
1629
|
-
/* @__PURE__ */ e(
|
|
2199
|
+
/* @__PURE__ */ e(ae, { variant: "destructive", onClick: b, autoFocus: !0, children: t("delete") })
|
|
1630
2200
|
] })
|
|
1631
2201
|
]
|
|
1632
2202
|
}
|
|
1633
2203
|
) })
|
|
1634
2204
|
] }) });
|
|
1635
2205
|
}
|
|
1636
|
-
function
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
2206
|
+
function er({
|
|
2207
|
+
sidebar: a,
|
|
2208
|
+
header: t,
|
|
2209
|
+
components: d,
|
|
2210
|
+
classNames: o,
|
|
2211
|
+
disclaimer: n,
|
|
2212
|
+
welcome: i
|
|
2213
|
+
}) {
|
|
2214
|
+
const { config: r } = Oe(), { history: u } = ne(), c = r?.language === "fa" ? "right" : "left", y = u?.enabled ?? !0;
|
|
2215
|
+
return /* @__PURE__ */ s(_a, { defaultOpen: y, children: [
|
|
2216
|
+
a !== void 0 ? a : y ? /* @__PURE__ */ e(La, { side: c }) : null,
|
|
2217
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col flex-1 h-dvh overflow-hidden relative", children: [
|
|
2218
|
+
t !== void 0 ? t : /* @__PURE__ */ e(Ye, {}),
|
|
1642
2219
|
/* @__PURE__ */ e(
|
|
1643
2220
|
"div",
|
|
1644
2221
|
{
|
|
@@ -1647,12 +2224,12 @@ function Ga({ sidebar: a, header: t, components: i, classNames: m, disclaimer: c
|
|
|
1647
2224
|
"has-[.stick-to-bottom:empty]:overflow-visible has-[.stick-to-bottom:empty]:flex-initial transition-[flex] duration-200"
|
|
1648
2225
|
),
|
|
1649
2226
|
children: /* @__PURE__ */ e(
|
|
1650
|
-
|
|
2227
|
+
ha,
|
|
1651
2228
|
{
|
|
1652
|
-
components:
|
|
1653
|
-
classNames:
|
|
1654
|
-
disclaimer:
|
|
1655
|
-
welcome:
|
|
2229
|
+
components: d,
|
|
2230
|
+
classNames: o,
|
|
2231
|
+
disclaimer: n,
|
|
2232
|
+
welcome: i
|
|
1656
2233
|
}
|
|
1657
2234
|
)
|
|
1658
2235
|
}
|
|
@@ -1660,302 +2237,318 @@ function Ga({ sidebar: a, header: t, components: i, classNames: m, disclaimer: c
|
|
|
1660
2237
|
] })
|
|
1661
2238
|
] });
|
|
1662
2239
|
}
|
|
1663
|
-
function
|
|
1664
|
-
const [t,
|
|
1665
|
-
return
|
|
2240
|
+
function tr({ children: a }) {
|
|
2241
|
+
const [t, d] = _(null), o = Je(), n = Te(), i = he(), r = oe();
|
|
2242
|
+
return B(() => {
|
|
1666
2243
|
(async () => {
|
|
1667
|
-
const
|
|
1668
|
-
if (
|
|
2244
|
+
const c = new URLSearchParams(o.search), y = c.get("token");
|
|
2245
|
+
if (y)
|
|
1669
2246
|
try {
|
|
1670
|
-
|
|
1671
|
-
const
|
|
1672
|
-
|
|
2247
|
+
r.setToken(y), await r.getBalance(), c.delete("token");
|
|
2248
|
+
const g = c.toString(), p = o.pathname + (g ? `?${g}` : "");
|
|
2249
|
+
n(p, { replace: !0 }), d(!0);
|
|
1673
2250
|
return;
|
|
1674
|
-
} catch (
|
|
1675
|
-
console.error("Error validating token from URL:",
|
|
2251
|
+
} catch (g) {
|
|
2252
|
+
console.error("Error validating token from URL:", g), d(!1);
|
|
1676
2253
|
return;
|
|
1677
2254
|
}
|
|
1678
|
-
if (!
|
|
1679
|
-
|
|
2255
|
+
if (!r.getToken()) {
|
|
2256
|
+
d(!1);
|
|
1680
2257
|
return;
|
|
1681
2258
|
}
|
|
1682
2259
|
try {
|
|
1683
|
-
await
|
|
1684
|
-
} catch (
|
|
1685
|
-
console.error("Token validation failed:",
|
|
2260
|
+
await r.getBalance(), d(!0);
|
|
2261
|
+
} catch (g) {
|
|
2262
|
+
console.error("Token validation failed:", g), g?.status === 401 ? (r.clearToken(), i.clear(), d(!1)) : d(!0);
|
|
1686
2263
|
}
|
|
1687
2264
|
})();
|
|
1688
|
-
}, [
|
|
2265
|
+
}, [o.search, n, o.pathname, i, r]), 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(_e, { children: a }) : /* @__PURE__ */ e(ta, { to: "/login", replace: !0 });
|
|
1689
2266
|
}
|
|
1690
|
-
const
|
|
1691
|
-
function
|
|
1692
|
-
const { t: a, i18n: t } =
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
}
|
|
2267
|
+
const ze = (a) => a.replace(/[^0-9]/g, "");
|
|
2268
|
+
function ar() {
|
|
2269
|
+
const { t: a, i18n: t } = ue(["login", "translation"]), { app: d } = ne(), o = oe(), n = t.dir() === "rtl", i = n ? "text-right" : "text-left", r = Te(), u = he(), [c, y] = _("login"), k = !!d?.disableSignup, g = !!d?.disableAuthPage, [p, A] = _(""), [P, I] = _(""), [E, R] = _(""), [D, T] = _(""), [q, x] = _(""), [V, K] = _(""), M = Q(
|
|
2270
|
+
() => d?.userMetadataFields?.filter((m) => m.showInSignup) || [],
|
|
2271
|
+
[d?.userMetadataFields]
|
|
2272
|
+
), [$, G] = _(() => {
|
|
2273
|
+
const m = {};
|
|
2274
|
+
return M.forEach((C) => {
|
|
2275
|
+
C.defaultValue !== void 0 && (m[C.key] = C.defaultValue);
|
|
2276
|
+
}), m;
|
|
1697
2277
|
});
|
|
1698
|
-
|
|
1699
|
-
const
|
|
1700
|
-
let
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
}),
|
|
1704
|
-
}, [
|
|
1705
|
-
const [
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
}, [
|
|
1709
|
-
const
|
|
1710
|
-
|
|
2278
|
+
B(() => {
|
|
2279
|
+
const m = { ...$ };
|
|
2280
|
+
let C = !1;
|
|
2281
|
+
M.forEach((f) => {
|
|
2282
|
+
f.condition && !ye(f.condition, $) && m[f.key] !== void 0 && (delete m[f.key], C = !0);
|
|
2283
|
+
}), C && G(m);
|
|
2284
|
+
}, [$, M]);
|
|
2285
|
+
const [F, J] = _(""), [W, j] = _(!1);
|
|
2286
|
+
B(() => {
|
|
2287
|
+
k && c === "register" && y("login");
|
|
2288
|
+
}, [k, c]);
|
|
2289
|
+
const L = async (m) => {
|
|
2290
|
+
m.preventDefault(), J(""), j(!0);
|
|
1711
2291
|
try {
|
|
1712
|
-
await
|
|
1713
|
-
} catch (
|
|
1714
|
-
|
|
2292
|
+
await o.login(p, P), u.clear(), r("/");
|
|
2293
|
+
} catch (C) {
|
|
2294
|
+
J(de(C, a));
|
|
1715
2295
|
} finally {
|
|
1716
|
-
|
|
2296
|
+
j(!1);
|
|
1717
2297
|
}
|
|
1718
|
-
},
|
|
1719
|
-
|
|
2298
|
+
}, w = async (m) => {
|
|
2299
|
+
m.preventDefault(), J(""), j(!0);
|
|
1720
2300
|
try {
|
|
1721
|
-
await
|
|
1722
|
-
} catch (
|
|
1723
|
-
|
|
2301
|
+
await o.register(E, D, q, V, $), u.clear(), r("/");
|
|
2302
|
+
} catch (C) {
|
|
2303
|
+
J(de(C, a));
|
|
1724
2304
|
} finally {
|
|
1725
|
-
|
|
2305
|
+
j(!1);
|
|
1726
2306
|
}
|
|
1727
2307
|
};
|
|
1728
|
-
return
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
"
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
"button",
|
|
1748
|
-
{
|
|
1749
|
-
type: "button",
|
|
1750
|
-
onClick: () => {
|
|
1751
|
-
h("register"), L("");
|
|
1752
|
-
},
|
|
1753
|
-
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${f === "register" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
1754
|
-
children: a("signup_tab", "Sign Up")
|
|
1755
|
-
}
|
|
1756
|
-
)
|
|
1757
|
-
] }),
|
|
1758
|
-
f === "login" && /* @__PURE__ */ r("form", { onSubmit: b, className: "space-y-4", children: [
|
|
1759
|
-
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1760
|
-
/* @__PURE__ */ e(G, { htmlFor: "login-phone", children: a("phone", "Phone") }),
|
|
1761
|
-
/* @__PURE__ */ e(
|
|
1762
|
-
X,
|
|
1763
|
-
{
|
|
1764
|
-
id: "login-phone",
|
|
1765
|
-
type: "tel",
|
|
1766
|
-
value: C,
|
|
1767
|
-
onChange: (n) => s(qe(n.target.value)),
|
|
1768
|
-
required: !0,
|
|
1769
|
-
className: "text-left",
|
|
1770
|
-
placeholder: a("phone_placeholder", "Phone number"),
|
|
1771
|
-
dir: "ltr"
|
|
1772
|
-
}
|
|
1773
|
-
)
|
|
1774
|
-
] }),
|
|
1775
|
-
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1776
|
-
/* @__PURE__ */ e(G, { htmlFor: "login-pass", children: a("password", "Password") }),
|
|
1777
|
-
/* @__PURE__ */ e(
|
|
1778
|
-
X,
|
|
1779
|
-
{
|
|
1780
|
-
id: "login-pass",
|
|
1781
|
-
type: "password",
|
|
1782
|
-
value: M,
|
|
1783
|
-
onChange: (n) => P(n.target.value),
|
|
1784
|
-
required: !0,
|
|
1785
|
-
className: "text-left",
|
|
1786
|
-
placeholder: "••••••••",
|
|
1787
|
-
dir: "ltr"
|
|
1788
|
-
}
|
|
1789
|
-
)
|
|
1790
|
-
] }),
|
|
1791
|
-
R && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: R }),
|
|
1792
|
-
/* @__PURE__ */ e(
|
|
1793
|
-
te,
|
|
1794
|
-
{
|
|
1795
|
-
type: "submit",
|
|
1796
|
-
disabled: H,
|
|
1797
|
-
className: "w-full font-semibold",
|
|
1798
|
-
children: H ? a("logging_in", "Logging in...") : a("login_button", "Login")
|
|
1799
|
-
}
|
|
1800
|
-
)
|
|
1801
|
-
] }),
|
|
1802
|
-
!N && f === "register" && /* @__PURE__ */ r("form", { onSubmit: d, className: "space-y-4", children: [
|
|
1803
|
-
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1804
|
-
/* @__PURE__ */ e(G, { htmlFor: "reg-phone", children: a("phone", "Phone") }),
|
|
1805
|
-
/* @__PURE__ */ e(
|
|
1806
|
-
X,
|
|
1807
|
-
{
|
|
1808
|
-
id: "reg-phone",
|
|
1809
|
-
type: "tel",
|
|
1810
|
-
value: U,
|
|
1811
|
-
onChange: (n) => q(qe(n.target.value)),
|
|
1812
|
-
required: !0,
|
|
1813
|
-
className: "text-left",
|
|
1814
|
-
placeholder: a("phone_placeholder", "Phone number"),
|
|
1815
|
-
dir: "ltr"
|
|
1816
|
-
}
|
|
1817
|
-
)
|
|
1818
|
-
] }),
|
|
1819
|
-
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1820
|
-
/* @__PURE__ */ e(G, { htmlFor: "reg-pass", children: a("password", "Password") }),
|
|
1821
|
-
/* @__PURE__ */ e(
|
|
1822
|
-
X,
|
|
1823
|
-
{
|
|
1824
|
-
id: "reg-pass",
|
|
1825
|
-
type: "password",
|
|
1826
|
-
value: A,
|
|
1827
|
-
onChange: (n) => p(n.target.value),
|
|
1828
|
-
required: !0,
|
|
1829
|
-
className: "text-left",
|
|
1830
|
-
placeholder: "••••••••",
|
|
1831
|
-
dir: "ltr"
|
|
1832
|
-
}
|
|
1833
|
-
)
|
|
1834
|
-
] }),
|
|
1835
|
-
/* @__PURE__ */ r("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
1836
|
-
/* @__PURE__ */ r("div", { className: "space-y-3", children: [
|
|
1837
|
-
/* @__PURE__ */ e(G, { htmlFor: "reg-name", children: a("name", "Name") }),
|
|
2308
|
+
return g ? /* @__PURE__ */ e(
|
|
2309
|
+
"div",
|
|
2310
|
+
{
|
|
2311
|
+
className: "min-h-screen bg-background flex items-center justify-center p-4",
|
|
2312
|
+
dir: t.dir(),
|
|
2313
|
+
children: /* @__PURE__ */ s("div", { className: "w-full max-w-lg bg-card border border-border rounded-xl shadow-lg p-8 text-center space-y-4", children: [
|
|
2314
|
+
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold", children: d?.name }),
|
|
2315
|
+
/* @__PURE__ */ e("p", { className: "text-muted-foreground", children: a("auth_page_disabled_title", "The sign-in page is currently disabled.") }),
|
|
2316
|
+
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground/80", children: a("auth_page_disabled_description", "Please contact the administrator for access.") })
|
|
2317
|
+
] })
|
|
2318
|
+
}
|
|
2319
|
+
) : /* @__PURE__ */ e(
|
|
2320
|
+
"div",
|
|
2321
|
+
{
|
|
2322
|
+
className: "min-h-screen bg-background flex flex-col items-center justify-center p-4",
|
|
2323
|
+
dir: t.dir(),
|
|
2324
|
+
children: /* @__PURE__ */ s("div", { className: "w-full max-w-md bg-card border border-border rounded-xl shadow-lg p-6", children: [
|
|
2325
|
+
/* @__PURE__ */ e("div", { className: "text-center mb-6", children: /* @__PURE__ */ e("h1", { className: "text-2xl font-bold bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent", children: d?.name }) }),
|
|
2326
|
+
/* @__PURE__ */ s("div", { className: "flex bg-muted p-1 rounded-lg mb-6", children: [
|
|
1838
2327
|
/* @__PURE__ */ e(
|
|
1839
|
-
|
|
2328
|
+
"button",
|
|
1840
2329
|
{
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
placeholder: a("name_placeholder", "First Name")
|
|
2330
|
+
type: "button",
|
|
2331
|
+
onClick: () => {
|
|
2332
|
+
y("login"), J("");
|
|
2333
|
+
},
|
|
2334
|
+
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${c === "login" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
2335
|
+
children: a("login_tab", "Login")
|
|
1848
2336
|
}
|
|
1849
|
-
)
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
/* @__PURE__ */ e(G, { htmlFor: "reg-surname", children: a("surname", "Surname") }),
|
|
1853
|
-
/* @__PURE__ */ e(
|
|
1854
|
-
X,
|
|
2337
|
+
),
|
|
2338
|
+
!k && /* @__PURE__ */ e(
|
|
2339
|
+
"button",
|
|
1855
2340
|
{
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
placeholder: a("surname_placeholder", "Last Name")
|
|
2341
|
+
type: "button",
|
|
2342
|
+
onClick: () => {
|
|
2343
|
+
y("register"), J("");
|
|
2344
|
+
},
|
|
2345
|
+
className: `flex-1 py-2 text-sm font-medium rounded-md transition-all ${c === "register" ? "bg-background shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"}`,
|
|
2346
|
+
children: a("signup_tab", "Sign Up")
|
|
1863
2347
|
}
|
|
1864
2348
|
)
|
|
1865
|
-
] })
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
2349
|
+
] }),
|
|
2350
|
+
c === "login" && /* @__PURE__ */ s("form", { onSubmit: L, className: "space-y-4", children: [
|
|
2351
|
+
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
2352
|
+
/* @__PURE__ */ e(X, { htmlFor: "login-phone", children: a("phone", "Phone") }),
|
|
2353
|
+
/* @__PURE__ */ e(
|
|
2354
|
+
Y,
|
|
2355
|
+
{
|
|
2356
|
+
id: "login-phone",
|
|
2357
|
+
type: "tel",
|
|
2358
|
+
value: p,
|
|
2359
|
+
onChange: (m) => A(ze(m.target.value)),
|
|
2360
|
+
required: !0,
|
|
2361
|
+
className: "text-left",
|
|
2362
|
+
placeholder: a("phone_placeholder", "Phone number"),
|
|
2363
|
+
dir: "ltr"
|
|
2364
|
+
}
|
|
2365
|
+
)
|
|
2366
|
+
] }),
|
|
2367
|
+
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
2368
|
+
/* @__PURE__ */ e(X, { htmlFor: "login-pass", children: a("password", "Password") }),
|
|
2369
|
+
/* @__PURE__ */ e(
|
|
2370
|
+
Y,
|
|
2371
|
+
{
|
|
2372
|
+
id: "login-pass",
|
|
2373
|
+
type: "password",
|
|
2374
|
+
value: P,
|
|
2375
|
+
onChange: (m) => I(m.target.value),
|
|
2376
|
+
required: !0,
|
|
2377
|
+
className: "text-left",
|
|
2378
|
+
placeholder: "••••••••",
|
|
2379
|
+
dir: "ltr"
|
|
2380
|
+
}
|
|
2381
|
+
)
|
|
2382
|
+
] }),
|
|
2383
|
+
F && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: F }),
|
|
2384
|
+
/* @__PURE__ */ e(ae, { type: "submit", disabled: W, className: "w-full font-semibold", children: W ? a("logging_in", "Logging in...") : a("login_button", "Login") })
|
|
2385
|
+
] }),
|
|
2386
|
+
!k && c === "register" && /* @__PURE__ */ s("form", { onSubmit: w, className: "space-y-4", children: [
|
|
2387
|
+
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
2388
|
+
/* @__PURE__ */ e(X, { htmlFor: "reg-phone", children: a("phone", "Phone") }),
|
|
2389
|
+
/* @__PURE__ */ e(
|
|
2390
|
+
Y,
|
|
2391
|
+
{
|
|
2392
|
+
id: "reg-phone",
|
|
2393
|
+
type: "tel",
|
|
2394
|
+
value: E,
|
|
2395
|
+
onChange: (m) => R(ze(m.target.value)),
|
|
2396
|
+
required: !0,
|
|
2397
|
+
className: "text-left",
|
|
2398
|
+
placeholder: a("phone_placeholder", "Phone number"),
|
|
2399
|
+
dir: "ltr"
|
|
2400
|
+
}
|
|
2401
|
+
)
|
|
2402
|
+
] }),
|
|
2403
|
+
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
2404
|
+
/* @__PURE__ */ e(X, { htmlFor: "reg-pass", children: a("password", "Password") }),
|
|
2405
|
+
/* @__PURE__ */ e(
|
|
2406
|
+
Y,
|
|
2407
|
+
{
|
|
2408
|
+
id: "reg-pass",
|
|
2409
|
+
type: "password",
|
|
2410
|
+
value: D,
|
|
2411
|
+
onChange: (m) => T(m.target.value),
|
|
2412
|
+
required: !0,
|
|
2413
|
+
className: "text-left",
|
|
2414
|
+
placeholder: "••••••••",
|
|
2415
|
+
dir: "ltr"
|
|
2416
|
+
}
|
|
2417
|
+
)
|
|
2418
|
+
] }),
|
|
2419
|
+
/* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-4", children: [
|
|
2420
|
+
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
2421
|
+
/* @__PURE__ */ e(X, { htmlFor: "reg-name", children: a("name", "Name") }),
|
|
2422
|
+
/* @__PURE__ */ e(
|
|
2423
|
+
Y,
|
|
2424
|
+
{
|
|
2425
|
+
id: "reg-name",
|
|
2426
|
+
type: "text",
|
|
2427
|
+
value: q,
|
|
2428
|
+
onChange: (m) => x(m.target.value),
|
|
2429
|
+
required: !0,
|
|
2430
|
+
className: i,
|
|
2431
|
+
placeholder: a("name_placeholder", "First Name")
|
|
2432
|
+
}
|
|
2433
|
+
)
|
|
2434
|
+
] }),
|
|
2435
|
+
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
2436
|
+
/* @__PURE__ */ e(X, { htmlFor: "reg-surname", children: a("surname", "Surname") }),
|
|
2437
|
+
/* @__PURE__ */ e(
|
|
2438
|
+
Y,
|
|
2439
|
+
{
|
|
2440
|
+
id: "reg-surname",
|
|
2441
|
+
type: "text",
|
|
2442
|
+
value: V,
|
|
2443
|
+
onChange: (m) => K(m.target.value),
|
|
2444
|
+
required: !0,
|
|
2445
|
+
className: i,
|
|
2446
|
+
placeholder: a("surname_placeholder", "Last Name")
|
|
2447
|
+
}
|
|
2448
|
+
)
|
|
2449
|
+
] })
|
|
2450
|
+
] }),
|
|
2451
|
+
M.map((m) => ye(m.condition, $) ? /* @__PURE__ */ s(
|
|
2452
|
+
"div",
|
|
1884
2453
|
{
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
2454
|
+
className: "space-y-3 animate-in fade-in slide-in-from-top-1 duration-200",
|
|
2455
|
+
children: [
|
|
2456
|
+
/* @__PURE__ */ e(X, { htmlFor: `signup-${m.key}`, children: a(m.label) }),
|
|
2457
|
+
m.type === "select" ? /* @__PURE__ */ s(
|
|
2458
|
+
we,
|
|
2459
|
+
{
|
|
2460
|
+
value: String($[m.key] || ""),
|
|
2461
|
+
onValueChange: (C) => G({ ...$, [m.key]: C }),
|
|
2462
|
+
required: m.required,
|
|
2463
|
+
dir: n ? "rtl" : "ltr",
|
|
2464
|
+
children: [
|
|
2465
|
+
/* @__PURE__ */ e(Ne, { className: v("bg-background", i), children: /* @__PURE__ */ e(ke, { placeholder: a(m.placeholder || "select_placeholder") }) }),
|
|
2466
|
+
/* @__PURE__ */ e(Se, { className: "rounded-xl", children: m.options?.map((C) => /* @__PURE__ */ e(fe, { value: String(C.value), children: a(C.label) }, String(C.value))) })
|
|
2467
|
+
]
|
|
2468
|
+
}
|
|
2469
|
+
) : m.type === "checkbox" ? /* @__PURE__ */ s("div", { className: "flex items-center gap-2 py-2", children: [
|
|
2470
|
+
/* @__PURE__ */ e(
|
|
2471
|
+
wt,
|
|
2472
|
+
{
|
|
2473
|
+
id: `signup-${m.key}`,
|
|
2474
|
+
checked: !!$[m.key],
|
|
2475
|
+
onCheckedChange: (C) => G({ ...$, [m.key]: !!C }),
|
|
2476
|
+
required: m.required
|
|
2477
|
+
}
|
|
2478
|
+
),
|
|
2479
|
+
/* @__PURE__ */ e(
|
|
2480
|
+
"label",
|
|
2481
|
+
{
|
|
2482
|
+
htmlFor: `signup-${m.key}`,
|
|
2483
|
+
className: "text-sm text-muted-foreground cursor-pointer select-none",
|
|
2484
|
+
children: a(m.placeholder || m.label)
|
|
2485
|
+
}
|
|
2486
|
+
)
|
|
2487
|
+
] }) : /* @__PURE__ */ e(
|
|
2488
|
+
Y,
|
|
2489
|
+
{
|
|
2490
|
+
id: `signup-${m.key}`,
|
|
2491
|
+
type: m.type,
|
|
2492
|
+
value: $[m.key] || "",
|
|
2493
|
+
onChange: (C) => G({ ...$, [m.key]: C.target.value }),
|
|
2494
|
+
required: m.required,
|
|
2495
|
+
className: i,
|
|
2496
|
+
placeholder: a(m.placeholder || "")
|
|
2497
|
+
}
|
|
2498
|
+
)
|
|
2499
|
+
]
|
|
2500
|
+
},
|
|
2501
|
+
m.key
|
|
2502
|
+
) : null),
|
|
2503
|
+
F && /* @__PURE__ */ e("div", { className: "text-sm text-destructive", children: F }),
|
|
2504
|
+
/* @__PURE__ */ e(ae, { type: "submit", disabled: W, className: "w-full font-semibold", children: W ? a("signing_up", "Signing up...") : a("signup_button", "Sign Up") })
|
|
2505
|
+
] })
|
|
2506
|
+
] })
|
|
2507
|
+
}
|
|
2508
|
+
);
|
|
1917
2509
|
}
|
|
1918
|
-
function
|
|
1919
|
-
const { shareId: a } =
|
|
1920
|
-
return
|
|
1921
|
-
|
|
1922
|
-
}, []),
|
|
2510
|
+
function Fa() {
|
|
2511
|
+
const { shareId: a } = aa(), [t, d] = _(null), [o, n] = _(!0), [i, r] = _(null), { MessageList: u } = ne(), c = oe(), y = re(/* @__PURE__ */ new Set());
|
|
2512
|
+
return B(() => () => {
|
|
2513
|
+
y.current.forEach((k) => URL.revokeObjectURL(k)), y.current.clear();
|
|
2514
|
+
}, []), B(() => {
|
|
1923
2515
|
if (!a) return;
|
|
1924
2516
|
(async () => {
|
|
1925
2517
|
try {
|
|
1926
|
-
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
if (!
|
|
1931
|
-
const
|
|
1932
|
-
|
|
1933
|
-
|
|
2518
|
+
n(!0);
|
|
2519
|
+
const g = await c.getSharedThread(a);
|
|
2520
|
+
g.items && (g.items = await Promise.all(
|
|
2521
|
+
g.items.map(async (p) => {
|
|
2522
|
+
if (!p.parts) return p;
|
|
2523
|
+
const A = await Promise.all(
|
|
2524
|
+
p.parts.map(async (P) => {
|
|
2525
|
+
const I = ge(P);
|
|
2526
|
+
if (I.type === "file" && I.object_name && !I.url)
|
|
1934
2527
|
try {
|
|
1935
|
-
const
|
|
1936
|
-
return
|
|
1937
|
-
} catch (
|
|
1938
|
-
console.error("Failed to resolve shared attachment:",
|
|
2528
|
+
const E = await c.getPublicAttachmentBlobUrl(I.object_name);
|
|
2529
|
+
return y.current.add(E), { ...I, url: E };
|
|
2530
|
+
} catch (E) {
|
|
2531
|
+
console.error("Failed to resolve shared attachment:", I.object_name, E);
|
|
1939
2532
|
}
|
|
1940
|
-
return
|
|
2533
|
+
return I;
|
|
1941
2534
|
})
|
|
1942
2535
|
);
|
|
1943
|
-
return { ...
|
|
2536
|
+
return { ...p, parts: A };
|
|
1944
2537
|
})
|
|
1945
|
-
)),
|
|
1946
|
-
} catch (
|
|
1947
|
-
console.error("Failed to fetch shared chat:",
|
|
2538
|
+
)), d(g);
|
|
2539
|
+
} catch (g) {
|
|
2540
|
+
console.error("Failed to fetch shared chat:", g), r(g instanceof Error ? g.message : "Failed to load shared chat");
|
|
1948
2541
|
} finally {
|
|
1949
|
-
|
|
2542
|
+
n(!1);
|
|
1950
2543
|
}
|
|
1951
2544
|
})();
|
|
1952
|
-
}, [a]),
|
|
2545
|
+
}, [a, c]), o ? /* @__PURE__ */ e("div", { className: "flex h-dvh items-center justify-center", children: /* @__PURE__ */ e(Nt, {}) }) : i || !t ? /* @__PURE__ */ s("div", { className: "flex h-dvh flex-col items-center justify-center p-4 text-center", children: [
|
|
1953
2546
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold text-destructive mb-2 font-display", children: "Shared Chat Not Found" }),
|
|
1954
|
-
/* @__PURE__ */ e("p", { className: "text-muted-foreground max-w-md", children:
|
|
1955
|
-
] }) : /* @__PURE__ */
|
|
1956
|
-
/* @__PURE__ */ e(
|
|
1957
|
-
/* @__PURE__ */ e("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ e(
|
|
1958
|
-
|
|
2547
|
+
/* @__PURE__ */ e("p", { className: "text-muted-foreground max-w-md", children: i || "This shared conversation might have been deleted or the link is invalid." })
|
|
2548
|
+
] }) : /* @__PURE__ */ s("div", { className: "relative flex flex-col h-dvh overflow-hidden bg-background", children: [
|
|
2549
|
+
/* @__PURE__ */ e(Ye, { hideActions: !0 }),
|
|
2550
|
+
/* @__PURE__ */ e("div", { className: "flex-1 min-h-0 overflow-hidden relative flex flex-col", children: /* @__PURE__ */ e(He, { readonly: !0, children: /* @__PURE__ */ e(
|
|
2551
|
+
u,
|
|
1959
2552
|
{
|
|
1960
2553
|
messages: t.items || [],
|
|
1961
2554
|
status: "ready",
|
|
@@ -1972,47 +2565,48 @@ function Da() {
|
|
|
1972
2565
|
) }) })
|
|
1973
2566
|
] });
|
|
1974
2567
|
}
|
|
1975
|
-
function
|
|
1976
|
-
return /* @__PURE__ */ e(
|
|
2568
|
+
function rr() {
|
|
2569
|
+
return /* @__PURE__ */ e(Fa, {});
|
|
1977
2570
|
}
|
|
1978
2571
|
export {
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2572
|
+
La as AppSidebar,
|
|
2573
|
+
ha as Chat,
|
|
2574
|
+
er as ChatUI,
|
|
2575
|
+
ur as ChoiceQuestionPart,
|
|
2576
|
+
hr as FilePart,
|
|
2577
|
+
Za as GentiqProvider,
|
|
2578
|
+
pr as MessageList,
|
|
2579
|
+
mr as Part,
|
|
2580
|
+
gr as PromptInputArea,
|
|
2581
|
+
fr as ReasoningPart,
|
|
2582
|
+
br as ReferencePart,
|
|
2583
|
+
yr as Referenceable,
|
|
2584
|
+
tr as RequireAuth,
|
|
2585
|
+
we as Select,
|
|
2586
|
+
Se as SelectContent,
|
|
2587
|
+
vr as SelectGroup,
|
|
2588
|
+
fe as SelectItem,
|
|
2589
|
+
xr as SelectLabel,
|
|
2590
|
+
wr as SelectScrollDownButton,
|
|
2591
|
+
Nr as SelectScrollUpButton,
|
|
2592
|
+
kr as SelectSeparator,
|
|
2593
|
+
Ne as SelectTrigger,
|
|
2594
|
+
ke as SelectValue,
|
|
2595
|
+
Ra as SettingsDialog,
|
|
2596
|
+
rr as SharedChatView,
|
|
2597
|
+
_a as SidebarProvider,
|
|
2598
|
+
Sr as TextPart,
|
|
2599
|
+
Cr as ToolPart,
|
|
2600
|
+
or as Trans,
|
|
2601
|
+
ir as Translation,
|
|
2602
|
+
ar as UserLoginPage,
|
|
2603
|
+
_r as WelcomeScreen,
|
|
2604
|
+
la as createGentiqApi,
|
|
2605
|
+
Tr as useChatReferences,
|
|
2606
|
+
ne as useComponents,
|
|
2607
|
+
oe as useGentiqApi,
|
|
2608
|
+
da as useGentiqChat,
|
|
2609
|
+
Pr as useGentiqUser,
|
|
2610
|
+
lr as useTranslation,
|
|
2611
|
+
cr as withTranslation
|
|
2018
2612
|
};
|