@versini/sassysaint 5.0.0 → 5.1.2

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.
@@ -0,0 +1,1981 @@
1
+ import { jsxs as m, jsx as o, Fragment as S } from "react/jsx-runtime";
2
+ import { g as _, D as I, CARDS as v, renderDataAsList as X, pluralize as oe, ABOUT_TITLE as Ke, MODEL_GPT4 as Xe, numberFormatter as Ze, durationFormatter as Ie, NA as qe, ROLE_ASSISTANT as Je, extractAverage as Qe, GPT4_MAX_TOKENS as et, rn as U, STATS as _e, b as me, j as $, R as z, LOCAL_STORAGE_PREFIX as P, LOCAL_STORAGE_SORT as tt, O as V, ACTION_RESET as at, ACTION_RESTORE as ot, truncate as rt, ACTION_SORT as ie, LOCAL_STORAGE_SEARCH as nt, ae as it, ACTION_SEARCH as st, HISTORY_TITLE as lt, getCurrentGeoLocation as ct, LOCAL_STORAGE_TAG_SUMMARIZE as pe, LOCAL_STORAGE_TAG_PROOFREAD as fe, LOCAL_STORAGE_TAG_REPHRASE as be, TAG_CONTENT as se, TAGS as le, LOCAL_STORAGE_CHAT_DETAILS as dt, G as ut, v as ve, PROFILE_TITLE as mt, LOG_OUT as ye } from "./index.B5Wp8y85.js";
3
+ import * as de from "react";
4
+ import re, { forwardRef as Ae, useState as C, useRef as Z, useContext as B, useEffect as O, Suspense as ht, lazy as gt, useId as pt, useMemo as ft } from "react";
5
+ import { AppContext as ne, serviceCall as M, SERVICE_TYPES as L, HistoryContext as Re, E as F, f as x, ce as bt, ge as vt, me as ce, ie as R, ue as yt, be as kt, he as Tt, we as ke } from "./index.B5nDJSgt.js";
6
+ import f from "clsx";
7
+ import { useFloatingTree as Me, useFloatingNodeId as Ct, useListItem as Le, useFloating as Nt, offset as wt, flip as Et, shift as St, autoUpdate as xt, useClick as It, useRole as _t, useDismiss as At, useListNavigation as Rt, useTypeahead as Mt, useInteractions as Lt, useMergeRefs as Be, FloatingNode as Bt, FloatingList as Ot, FloatingPortal as Ht, FloatingFocusManager as Dt, FloatingTree as zt } from "@floating-ui/react";
8
+ const Pt = ({
9
+ className: e,
10
+ viewBox: t,
11
+ spacing: a,
12
+ title: r,
13
+ monotone: n,
14
+ ...i
15
+ }) => /* @__PURE__ */ m(
16
+ _,
17
+ {
18
+ defaultViewBox: "0 0 512 512",
19
+ defaultClassName: "size-5",
20
+ viewBox: t,
21
+ className: e,
22
+ spacing: a,
23
+ title: r || "Back",
24
+ ...i,
25
+ children: [
26
+ /* @__PURE__ */ o(
27
+ "path",
28
+ {
29
+ opacity: n ? "1" : "0.4",
30
+ d: "M288.4 93.4c2.9-17.4 19.4-29.2 36.9-26.3C431.3 84.9 512 177 512 288c0 123.7-100.3 224-224 224C177 512 84.9 431.3 67.1 325.3c-2.9-17.4 8.8-33.9 26.3-36.9s33.9 8.8 36.9 26.3C142.9 390.4 208.8 448 288 448c88.4 0 160-71.6 160-160c0-79.2-57.6-145.1-133.3-157.8c-17.4-2.9-29.2-19.4-26.3-36.9z"
31
+ }
32
+ ),
33
+ /* @__PURE__ */ o("path", { d: "M32 0H192c17.7 0 32 14.3 32 32s-14.3 32-32 32H109.3L342.6 297.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L64 109.3V192c0 17.7-14.3 32-32 32s-32-14.3-32-32V32C0 14.3 14.3 0 32 0z" })
34
+ ]
35
+ }
36
+ ), Vt = ({
37
+ className: e,
38
+ viewBox: t,
39
+ spacing: a,
40
+ title: r,
41
+ monotone: n,
42
+ ...i
43
+ }) => /* @__PURE__ */ m(
44
+ _,
45
+ {
46
+ defaultViewBox: "0 0 448 512",
47
+ defaultClassName: "size-5",
48
+ viewBox: t,
49
+ className: e,
50
+ spacing: a,
51
+ title: r || "Chart",
52
+ ...i,
53
+ children: [
54
+ /* @__PURE__ */ o(
55
+ "path",
56
+ {
57
+ opacity: n ? "1" : "0.4",
58
+ d: "M160 80c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48V432c0 26.5-21.5 48-48 48H208c-26.5 0-48-21.5-48-48V80z"
59
+ }
60
+ ),
61
+ /* @__PURE__ */ o("path", { d: "M368 96c-26.5 0-48 21.5-48 48V432c0 26.5 21.5 48 48 48h32c26.5 0 48-21.5 48-48V144c0-26.5-21.5-48-48-48H368zM48 224c-26.5 0-48 21.5-48 48V432c0 26.5 21.5 48 48 48H80c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48H48z" })
62
+ ]
63
+ }
64
+ ), Ft = ({
65
+ className: e,
66
+ viewBox: t,
67
+ spacing: a,
68
+ title: r,
69
+ monotone: n,
70
+ ...i
71
+ }) => /* @__PURE__ */ m(
72
+ _,
73
+ {
74
+ defaultViewBox: "0 0 448 512",
75
+ defaultClassName: "size-5",
76
+ viewBox: t,
77
+ className: e,
78
+ spacing: a,
79
+ title: r || "Delete",
80
+ ...i,
81
+ children: [
82
+ /* @__PURE__ */ o(
83
+ "path",
84
+ {
85
+ opacity: n ? "1" : "0.4",
86
+ d: "M416 96H32V448c0 35.3 28.7 64 64 64H352c35.3 0 64-28.7 64-64V96zM144 176V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V176c0-8.8 7.2-16 16-16s16 7.2 16 16zm96 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V176c0-8.8 7.2-16 16-16s16 7.2 16 16zm96 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V176c0-8.8 7.2-16 16-16s16 7.2 16 16z"
87
+ }
88
+ ),
89
+ /* @__PURE__ */ o("path", { d: "M163.8 0c-12.1 0-23.2 6.8-28.6 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8z" })
90
+ ]
91
+ }
92
+ ), Te = ({
93
+ className: e,
94
+ viewBox: t,
95
+ spacing: a,
96
+ title: r,
97
+ monotone: n,
98
+ ...i
99
+ }) => /* @__PURE__ */ m(
100
+ _,
101
+ {
102
+ defaultViewBox: "0 0 512 512",
103
+ defaultClassName: "size-5",
104
+ viewBox: t,
105
+ className: e,
106
+ spacing: a,
107
+ title: r || "Edit",
108
+ ...i,
109
+ children: [
110
+ /* @__PURE__ */ o(
111
+ "path",
112
+ {
113
+ opacity: n ? "1" : "0.4",
114
+ d: "M0 160c0-53 43-96 96-96h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32 14.3-32 32V416c0 17.7 14.3 32 32 32H352c17.7 0 32-14.3 32-32V320c0-17.7 14.3-32 32-32s32 14.3 32 32v96c0 53-43 96-96 96H96c-53 0-96-43-96-96V160z"
115
+ }
116
+ ),
117
+ /* @__PURE__ */ o("path", { d: "M392.4 21.7L362.3 51.7l97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2L471.6 21.7c-21.9-21.9-57.3-21.9-79.2 0zM339.7 74.3L172.4 241.7c-6.1 6.1-10.8 13.6-13.5 21.9l-29.6 88.8c-2.9 8.6-.6 18.1 5.8 24.6s15.9 8.7 24.6 5.8l88.8-29.6c8.2-2.7 15.7-7.4 21.9-13.5L437.7 172.3 339.7 74.3z" })
118
+ ]
119
+ }
120
+ ), $t = ({
121
+ className: e,
122
+ viewBox: t,
123
+ spacing: a,
124
+ title: r,
125
+ monotone: n,
126
+ ...i
127
+ }) => /* @__PURE__ */ m(
128
+ _,
129
+ {
130
+ defaultViewBox: "0 0 512 512",
131
+ defaultClassName: "size-5",
132
+ viewBox: t,
133
+ className: e,
134
+ spacing: a,
135
+ title: r || "History",
136
+ ...i,
137
+ children: [
138
+ /* @__PURE__ */ o(
139
+ "path",
140
+ {
141
+ opacity: n ? "1" : "0.4",
142
+ d: "M120.2 120.2C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8z"
143
+ }
144
+ ),
145
+ /* @__PURE__ */ o("path", { d: "M256 128c13.3 0 24 10.7 24 24v94.1l65 65c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-72-72c-4.5-4.5-7-10.6-7-17V152c0-13.3 10.7-24 24-24z" })
146
+ ]
147
+ }
148
+ ), Ut = ({
149
+ className: e,
150
+ viewBox: t,
151
+ spacing: a,
152
+ title: r,
153
+ monotone: n,
154
+ ...i
155
+ }) => /* @__PURE__ */ m(
156
+ _,
157
+ {
158
+ defaultViewBox: "0 0 512 512",
159
+ defaultClassName: "size-5",
160
+ viewBox: t,
161
+ className: e,
162
+ spacing: a,
163
+ title: r || "Info",
164
+ ...i,
165
+ children: [
166
+ /* @__PURE__ */ o(
167
+ "path",
168
+ {
169
+ opacity: "0.4",
170
+ d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"
171
+ }
172
+ ),
173
+ /* @__PURE__ */ o("path", { d: "M256 128a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM192 248c0-13.3 10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h24V272H216c-13.3 0-24-10.7-24-24z" })
174
+ ]
175
+ }
176
+ ), Gt = ({
177
+ className: e,
178
+ viewBox: t,
179
+ spacing: a,
180
+ title: r,
181
+ monotone: n,
182
+ ...i
183
+ }) => /* @__PURE__ */ m(
184
+ _,
185
+ {
186
+ defaultViewBox: "0 0 576 512",
187
+ defaultClassName: "size-5",
188
+ viewBox: t,
189
+ className: e,
190
+ spacing: a,
191
+ title: r || "Profile",
192
+ ...i,
193
+ children: [
194
+ /* @__PURE__ */ o(
195
+ "path",
196
+ {
197
+ opacity: "0.4",
198
+ d: "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H512c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm80 256h64c44.2 0 80 35.8 80 80c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16c0-44.2 35.8-80 80-80zm-32-96a64 64 0 1 1 128 0 64 64 0 1 1 -128 0zm256-32H496c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H496c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H496c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s7.2-16 16-16z"
199
+ }
200
+ ),
201
+ /* @__PURE__ */ o("path", { d: "M176 256a64 64 0 1 0 0-128 64 64 0 1 0 0 128zm-32 32c-44.2 0-80 35.8-80 80c0 8.8 7.2 16 16 16H272c8.8 0 16-7.2 16-16c0-44.2-35.8-80-80-80H144z" })
202
+ ]
203
+ }
204
+ ), jt = ({
205
+ className: e,
206
+ viewBox: t,
207
+ spacing: a,
208
+ title: r,
209
+ monotone: n,
210
+ ...i
211
+ }) => /* @__PURE__ */ m(
212
+ _,
213
+ {
214
+ defaultViewBox: "0 0 512 512",
215
+ defaultClassName: "size-5",
216
+ viewBox: t,
217
+ className: e,
218
+ spacing: a,
219
+ title: r || "Restore",
220
+ ...i,
221
+ children: [
222
+ /* @__PURE__ */ o(
223
+ "path",
224
+ {
225
+ opacity: n ? "1" : "0.4",
226
+ d: "M208 64H432c8.8 0 16 7.2 16 16V304c0 8.8-7.2 16-16 16H416v64h16c44.2 0 80-35.8 80-80V80c0-44.2-35.8-80-80-80H208c-44.2 0-80 35.8-80 80V96h64V80c0-8.8 7.2-16 16-16z"
227
+ }
228
+ ),
229
+ /* @__PURE__ */ o("path", { d: "M64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V192c0-35.3-28.7-64-64-64H64zm32 64H288c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32-14.3-32-32s14.3-32 32-32z" })
230
+ ]
231
+ }
232
+ ), Wt = ({
233
+ className: e,
234
+ viewBox: t,
235
+ spacing: a,
236
+ title: r,
237
+ monotone: n,
238
+ ...i
239
+ }) => /* @__PURE__ */ o(
240
+ _,
241
+ {
242
+ defaultViewBox: "0 0 448 512",
243
+ defaultClassName: "size-5",
244
+ viewBox: t,
245
+ className: e,
246
+ spacing: a,
247
+ title: r || "Settings",
248
+ ...i,
249
+ children: /* @__PURE__ */ o("path", { d: "M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z" })
250
+ }
251
+ ), ue = de.createContext({
252
+ getItemProps: () => ({}),
253
+ activeIndex: null,
254
+ /* v8 ignore next 2 */
255
+ setActiveIndex: () => {
256
+ },
257
+ setHasFocusInside: () => {
258
+ },
259
+ isOpen: !1
260
+ }), Ce = (e) => {
261
+ if (typeof e == "string")
262
+ return e;
263
+ if (typeof e == "function")
264
+ return e.displayName || e.name || "Component";
265
+ if (typeof e == "object" && e !== null && "type" in e) {
266
+ const t = e.type;
267
+ if (typeof t == "function" || typeof t == "object")
268
+ return t.displayName || t.name || "Component";
269
+ }
270
+ return "Element";
271
+ }, Oe = Ae(
272
+ ({
273
+ trigger: e,
274
+ children: t,
275
+ label: a = "Open menu",
276
+ defaultPlacement: r = "bottom-start",
277
+ onOpenChange: n,
278
+ spacing: i,
279
+ mode: l = "system",
280
+ focusMode: c = "system",
281
+ ...s
282
+ }, d) => {
283
+ const [u, p] = C(!1), [y, h] = C(!1), [g, k] = C(null), w = Z([]), b = Z([]), T = B(ue), N = Me(), E = Ct(), G = Le(), { floatingStyles: j, refs: Q, context: A } = Nt({
284
+ nodeId: E,
285
+ open: u,
286
+ onOpenChange: (Y) => {
287
+ p(Y), n == null || n(Y);
288
+ },
289
+ placement: r,
290
+ strategy: "fixed",
291
+ middleware: [wt({ mainAxis: 10 }), Et(), St()],
292
+ whileElementsMounted: xt
293
+ }), ee = It(A, {
294
+ event: "mousedown",
295
+ toggle: !0,
296
+ ignoreMouse: !1
297
+ }), W = _t(A, { role: "menu" }), Ve = At(A, { bubbles: !0 }), Fe = Rt(A, {
298
+ listRef: w,
299
+ activeIndex: g,
300
+ nested: !1,
301
+ onNavigate: k,
302
+ loop: !0
303
+ }), $e = Mt(A, {
304
+ listRef: b,
305
+ onMatch: u ? k : void 0,
306
+ activeIndex: g
307
+ }), { getReferenceProps: Ue, getFloatingProps: Ge, getItemProps: je } = Lt([ee, W, Ve, Fe, $e]), We = Ce(e) === "Button" || Ce(e) === "ButtonIcon", Ye = re.cloneElement(e, {
308
+ mode: l,
309
+ focusMode: c,
310
+ spacing: i,
311
+ noInternalClick: We,
312
+ "aria-label": a,
313
+ "data-open": u ? "" : void 0,
314
+ "data-focus-inside": y ? "" : void 0,
315
+ ref: Be([Q.setReference, G.ref, d]),
316
+ ...Ue(
317
+ T.getItemProps({
318
+ ...s
319
+ })
320
+ )
321
+ });
322
+ return O(() => {
323
+ if (!N)
324
+ return;
325
+ function Y() {
326
+ p(!1), n == null || n(!1);
327
+ }
328
+ return N.events.on("click", Y), () => {
329
+ N.events.off("click", Y);
330
+ };
331
+ }, [N, n]), O(() => {
332
+ u && N && N.events.emit("menuopen", { nodeId: E });
333
+ }, [N, u, E]), /* @__PURE__ */ m(Bt, { id: E, children: [
334
+ Ye,
335
+ /* @__PURE__ */ o(
336
+ ue.Provider,
337
+ {
338
+ value: {
339
+ activeIndex: g,
340
+ setActiveIndex: k,
341
+ getItemProps: je,
342
+ setHasFocusInside: h,
343
+ isOpen: u
344
+ },
345
+ children: /* @__PURE__ */ o(Ot, { elementsRef: w, labelsRef: b, children: u && /* @__PURE__ */ o(Ht, { children: /* @__PURE__ */ o(
346
+ Dt,
347
+ {
348
+ context: A,
349
+ modal: !1,
350
+ initialFocus: 0,
351
+ returnFocus: !0,
352
+ children: /* @__PURE__ */ o(
353
+ "div",
354
+ {
355
+ ref: Q.setFloating,
356
+ className: "rounded-md bg-surface-light p-4 shadow-sm shadow-border-dark outline-none sm:p-2",
357
+ style: j,
358
+ ...Ge(),
359
+ children: t
360
+ }
361
+ )
362
+ }
363
+ ) }) })
364
+ }
365
+ )
366
+ ] });
367
+ }
368
+ ), He = Ae((e, t) => /* @__PURE__ */ o(zt, { children: /* @__PURE__ */ o(Oe, { ...e, ref: t }) }));
369
+ He.displayName = "Menu";
370
+ Oe.displayName = "MenuComponent";
371
+ const D = de.forwardRef(({ label: e, disabled: t, icon: a, ...r }, n) => {
372
+ const i = de.useContext(ue), l = Le({ label: t ? null : e }), c = Me();
373
+ return /* @__PURE__ */ m(
374
+ "button",
375
+ {
376
+ ...r,
377
+ ref: Be([l.ref, n]),
378
+ role: "menuitem",
379
+ className: "m-0 flex w-full rounded-md border border-transparent bg-none px-3 py-2 text-left text-base outline-none focus:border focus:border-border-medium focus:bg-surface-lighter focus:underline disabled:cursor-not-allowed disabled:text-copy-medium sm:py-1",
380
+ tabIndex: 0,
381
+ disabled: t,
382
+ ...i.getItemProps({
383
+ onClick(s) {
384
+ var d;
385
+ (d = r.onClick) == null || d.call(r, s), c == null || c.events.emit("click");
386
+ },
387
+ onFocus(s) {
388
+ var d;
389
+ (d = r.onFocus) == null || d.call(r, s), i.setHasFocusInside(!0);
390
+ }
391
+ }),
392
+ children: [
393
+ a,
394
+ e && /* @__PURE__ */ o("span", { className: "pl-2", children: e })
395
+ ]
396
+ }
397
+ );
398
+ });
399
+ D.displayName = "MenuItem";
400
+ const Yt = ({ className: e, ...t }) => {
401
+ const a = f(e, "my-1 border-t border-border-medium");
402
+ return /* @__PURE__ */ o("div", { className: a, ...t });
403
+ };
404
+ /*!
405
+ @versini/ui-menu v1.0.4
406
+ © 2024 gizmette.com
407
+ */
408
+ try {
409
+ window.__VERSINI_UI_MENU__ || (window.__VERSINI_UI_MENU__ = {
410
+ version: "1.0.4",
411
+ buildTime: "09/24/2024 07:45 PM EDT",
412
+ homepage: "https://github.com/aversini/ui-components",
413
+ license: "MIT"
414
+ });
415
+ } catch {
416
+ }
417
+ /*!
418
+ @versini/ui-panel v1.0.4
419
+ © 2024 gizmette.com
420
+ */
421
+ try {
422
+ window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
423
+ version: "1.0.4",
424
+ buildTime: "09/24/2024 07:45 PM EDT",
425
+ homepage: "https://github.com/aversini/ui-components",
426
+ license: "MIT"
427
+ });
428
+ } catch {
429
+ }
430
+ const Ne = "av-messagebox", we = "av-panel", Ee = "av-button", Kt = (e) => {
431
+ let t = "";
432
+ if (typeof e == "number" || typeof e == "string")
433
+ t = "m-" + e;
434
+ else {
435
+ const a = [];
436
+ (e == null ? void 0 : e.t) !== void 0 && a.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && a.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && a.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && a.push(`ml-${e.l}`), t = a.join(" ");
437
+ }
438
+ return t;
439
+ }, he = "icon", Xt = "button", Zt = "link", qt = ({
440
+ type: e,
441
+ size: t,
442
+ labelRight: a,
443
+ labelLeft: r,
444
+ align: n
445
+ }) => {
446
+ const i = "text-sm font-medium max-h-8 py-0", l = "text-base font-medium max-h-9 py-1", c = "text-lg font-medium max-h-12 py-2";
447
+ switch (e) {
448
+ case Xt:
449
+ return f("px-4", {
450
+ [i]: t === "small",
451
+ [l]: t === "medium",
452
+ [c]: t === "large"
453
+ });
454
+ case Zt:
455
+ return f("px-4 text-center", {
456
+ [i]: t === "small",
457
+ [l]: t === "medium",
458
+ [c]: t === "large"
459
+ });
460
+ case he:
461
+ return f("inline-flex items-center", {
462
+ "justify-center": n === "center",
463
+ "justify-start": n === "left",
464
+ "justify-end": n === "right",
465
+ "h-6 w-6 p-0": t === "small" && !(a || r),
466
+ "h-6 px-4 text-sm font-medium": t === "small" && (a || r),
467
+ "h-8 w-8 p-1": t === "medium" && !(a || r),
468
+ "h-8 px-4 text-base font-medium": t === "medium" && (a || r),
469
+ "h-12 w-12 p-2": t === "large" && !(a || r),
470
+ "h-12 px-4 text-lg font-medium": t === "large" && (a || r)
471
+ });
472
+ }
473
+ }, Jt = ({
474
+ mode: e,
475
+ noBackground: t,
476
+ noTruncate: a,
477
+ variant: r
478
+ }) => {
479
+ if (t)
480
+ return "not-prose rounded-full";
481
+ if (r === "primary")
482
+ return f("not-prose rounded-full", {
483
+ truncate: !a,
484
+ "bg-action-dark text-copy-light": e === "dark",
485
+ "bg-action-light text-copy-lighter": e === "light",
486
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
487
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "alt-system"
488
+ });
489
+ if (r === "secondary")
490
+ return f("not-prose rounded-full", {
491
+ truncate: !a,
492
+ "bg-action-dark text-copy-light": e === "light",
493
+ "bg-action-light text-copy-lighter": e === "dark",
494
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
495
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "system"
496
+ });
497
+ if (r === "danger")
498
+ return f("not-prose rounded-full", {
499
+ truncate: !a,
500
+ "bg-action-danger-dark text-copy-light": e === "dark",
501
+ "bg-action-danger-light text-copy-lighter": e === "light",
502
+ "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
503
+ "bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
504
+ });
505
+ }, Qt = ({
506
+ mode: e,
507
+ disabled: t,
508
+ variant: a
509
+ }) => {
510
+ if (t)
511
+ return "";
512
+ if (a === "primary")
513
+ return f("hover:text-copy-light-hover", {
514
+ "hover:bg-action-dark-hover": e === "dark",
515
+ "hover:bg-action-light-hover": e === "light",
516
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
517
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
518
+ });
519
+ if (a === "secondary")
520
+ return f("hover:text-copy-light-hover", {
521
+ "hover:bg-action-dark-hover": e === "light",
522
+ "hover:bg-action-light-hover": e === "dark",
523
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
524
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
525
+ });
526
+ if (a === "danger")
527
+ return f("hover:text-copy-light-hover", {
528
+ "hover:bg-action-danger-dark-hover": e === "dark",
529
+ "hover:bg-action-danger-light-hover": e === "light",
530
+ "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
531
+ "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
532
+ });
533
+ }, ea = ({
534
+ mode: e,
535
+ disabled: t,
536
+ variant: a
537
+ }) => {
538
+ if (t)
539
+ return "";
540
+ if (a === "primary")
541
+ return f("active:text-copy-light-active", {
542
+ "active:bg-action-dark-active": e === "dark",
543
+ "active:bg-action-light-active": e === "light",
544
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
545
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
546
+ });
547
+ if (a === "secondary")
548
+ return f("active:text-copy-light-active", {
549
+ "active:bg-action-dark-active": e === "light",
550
+ "active:bg-action-light-active": e === "dark",
551
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
552
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
553
+ });
554
+ if (a === "danger")
555
+ return f("active:text-copy-lighter-active", {
556
+ "active:bg-action-danger-dark-active": e === "dark",
557
+ "active:bg-action-danger-light-active": e === "light",
558
+ "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
559
+ "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
560
+ });
561
+ }, ta = ({
562
+ mode: e,
563
+ noBorder: t,
564
+ variant: a
565
+ }) => {
566
+ if (t)
567
+ return "border border-transparent";
568
+ if (a === "primary")
569
+ return f("border", {
570
+ "border-border-dark": e === "dark",
571
+ "border-border-accent": e === "light",
572
+ "border-border-dark dark:border-border-accent": e === "system",
573
+ "border-border-accent dark:border-border-dark": e === "alt-system"
574
+ });
575
+ if (a === "secondary")
576
+ return f("border", {
577
+ "border-border-dark": e === "light",
578
+ "border-border-accent": e === "dark",
579
+ "border-border-dark dark:border-border-accent": e === "alt-system",
580
+ "border-border-accent dark:border-border-dark": e === "system"
581
+ });
582
+ if (a === "danger")
583
+ return f("border", {
584
+ "border-border-danger-dark": e === "dark",
585
+ "border-border-danger-medium": e === "light",
586
+ "border-border-danger-dark dark:border-border-danger-medium": e === "system",
587
+ "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
588
+ });
589
+ }, aa = ({ focusMode: e }) => f("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
590
+ "focus:outline-focus-dark": e === "dark",
591
+ "focus:outline-focus-light": e === "light",
592
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
593
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
594
+ }), De = ({
595
+ type: e,
596
+ className: t,
597
+ raw: a,
598
+ mode: r,
599
+ focusMode: n,
600
+ disabled: i,
601
+ fullWidth: l,
602
+ size: c,
603
+ noBorder: s,
604
+ labelRight: d,
605
+ labelLeft: u,
606
+ spacing: p,
607
+ noBackground: y,
608
+ variant: h,
609
+ noTruncate: g,
610
+ align: k
611
+ }) => (h || (h = "primary"), a ? f(Ee, t) : f(
612
+ Ee,
613
+ t,
614
+ Kt(p),
615
+ Jt({ mode: r, variant: h, noBackground: y, noTruncate: g }),
616
+ qt({ type: e, size: c, labelRight: d, labelLeft: u, align: k }),
617
+ ta({ mode: r, variant: h, noBorder: s }),
618
+ aa({ focusMode: n }),
619
+ Qt({ mode: r, variant: h, disabled: i }),
620
+ ea({ mode: r, variant: h, disabled: i }),
621
+ {
622
+ "w-full": l,
623
+ "disabled:cursor-not-allowed disabled:opacity-50": i
624
+ }
625
+ )), oa = (e, t, a) => {
626
+ var r;
627
+ !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((r = e == null ? void 0 : e.currentTarget) == null ? void 0 : r.focus) == "function" && e.currentTarget.focus(), typeof a == "function" && a(e);
628
+ }, ge = re.forwardRef((e, t) => {
629
+ const { onClick: a, noInternalClick: r = !1, ...n } = e;
630
+ return /* @__PURE__ */ o(
631
+ "button",
632
+ {
633
+ ref: t,
634
+ onClick: (i) => {
635
+ oa(i, r, a);
636
+ },
637
+ ...n
638
+ }
639
+ );
640
+ });
641
+ ge.displayName = "BaseButton";
642
+ const ze = re.forwardRef(
643
+ ({
644
+ children: e,
645
+ disabled: t = !1,
646
+ mode: a = "system",
647
+ focusMode: r = "system",
648
+ fullWidth: n = !1,
649
+ className: i,
650
+ type: l = "button",
651
+ raw: c = !1,
652
+ noBorder: s = !1,
653
+ "aria-label": d,
654
+ label: u,
655
+ size: p = "medium",
656
+ labelRight: y,
657
+ labelLeft: h,
658
+ spacing: g,
659
+ noBackground: k = !1,
660
+ align: w = "center",
661
+ ...b
662
+ }, T) => {
663
+ const N = De({
664
+ type: he,
665
+ mode: a,
666
+ focusMode: r,
667
+ fullWidth: n,
668
+ disabled: t,
669
+ raw: c,
670
+ className: i,
671
+ noBorder: s,
672
+ size: p,
673
+ labelRight: y,
674
+ labelLeft: h,
675
+ spacing: g,
676
+ noBackground: k,
677
+ align: w
678
+ }), E = f({
679
+ "text-copy-accent-dark": a === "light" && !c,
680
+ "text-copy-light": a === "dark" && !c,
681
+ "text-copy-accent-dark dark:text-copy-light": a === "alt-system" && !c,
682
+ "text-copy-light dark:text-copy-accent-dark": a === "system" && !c
683
+ });
684
+ return /* @__PURE__ */ m(
685
+ ge,
686
+ {
687
+ ref: T,
688
+ className: N,
689
+ disabled: t,
690
+ type: l,
691
+ "aria-label": d || u,
692
+ ...b,
693
+ children: [
694
+ h && /* @__PURE__ */ o("span", { className: "pr-2", children: h }),
695
+ /* @__PURE__ */ o("div", { className: E, children: e }),
696
+ y && /* @__PURE__ */ o("span", { className: "pl-2", children: y })
697
+ ]
698
+ }
699
+ );
700
+ }
701
+ );
702
+ ze.displayName = "ButtonIcon";
703
+ /*!
704
+ @versini/ui-button v1.1.4
705
+ © 2024 gizmette.com
706
+ */
707
+ try {
708
+ window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
709
+ version: "1.1.4",
710
+ buildTime: "09/24/2024 07:45 PM EDT",
711
+ homepage: "https://github.com/aversini/ui-components",
712
+ license: "MIT"
713
+ });
714
+ } catch {
715
+ }
716
+ const ra = re.forwardRef(
717
+ ({
718
+ children: e,
719
+ disabled: t = !1,
720
+ mode: a = "system",
721
+ focusMode: r = "system",
722
+ fullWidth: n = !1,
723
+ className: i,
724
+ type: l = "button",
725
+ raw: c = !1,
726
+ noBorder: s = !1,
727
+ "aria-label": d,
728
+ label: u,
729
+ size: p = "medium",
730
+ labelRight: y,
731
+ labelLeft: h,
732
+ spacing: g,
733
+ noBackground: k = !1,
734
+ align: w = "center",
735
+ active: b = !1,
736
+ ...T
737
+ }, N) => {
738
+ const E = De({
739
+ type: he,
740
+ mode: a,
741
+ focusMode: r,
742
+ fullWidth: n,
743
+ disabled: t,
744
+ raw: c,
745
+ className: i,
746
+ noBorder: s,
747
+ size: p,
748
+ labelRight: y,
749
+ labelLeft: h,
750
+ spacing: g,
751
+ noBackground: k,
752
+ align: w
753
+ }), G = f({
754
+ "text-copy-accent-dark": a === "light" && !c,
755
+ "text-copy-light": a === "dark" && !c,
756
+ "text-copy-accent-dark dark:text-copy-light": a === "alt-system" && !c,
757
+ "text-copy-light dark:text-copy-accent-dark": a === "system" && !c
758
+ }), j = b ? f(
759
+ "relative",
760
+ "focus-within:static",
761
+ "focus-within:after:border-transparent",
762
+ "after:absolute",
763
+ "after:content-['']",
764
+ "after:border-b-2",
765
+ "after:bottom-[-4px]",
766
+ "after:left-0",
767
+ "after:right-0",
768
+ {
769
+ "after:border-table-dark": a === "dark",
770
+ "after:border-table-light": a === "light",
771
+ "after:border-table-dark dark:after:border-table-light": a === "system",
772
+ "after:border-table-light dark:after:border-table-dark": a === "alt-system"
773
+ }
774
+ ) : "";
775
+ return /* @__PURE__ */ o("div", { className: j, children: /* @__PURE__ */ m(
776
+ ge,
777
+ {
778
+ ref: N,
779
+ className: E,
780
+ disabled: t,
781
+ type: l,
782
+ "aria-label": d || u,
783
+ ...T,
784
+ children: [
785
+ h && /* @__PURE__ */ o("span", { className: "pr-2", children: h }),
786
+ /* @__PURE__ */ o("div", { className: G, children: e }),
787
+ y && /* @__PURE__ */ o("span", { className: "pl-2", children: y })
788
+ ]
789
+ }
790
+ ) });
791
+ }
792
+ );
793
+ ra.displayName = "ButtonSort";
794
+ const na = (e) => {
795
+ let t = "";
796
+ if (typeof e == "number" || typeof e == "string")
797
+ t = "m-" + e;
798
+ else {
799
+ const a = [];
800
+ (e == null ? void 0 : e.t) !== void 0 && a.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && a.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && a.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && a.push(`ml-${e.l}`), t = a.join(" ");
801
+ }
802
+ return t;
803
+ }, ia = ({
804
+ children: e,
805
+ fill: t,
806
+ viewBox: a,
807
+ className: r,
808
+ defaultViewBox: n,
809
+ defaultClassName: i,
810
+ spacing: l,
811
+ title: c,
812
+ semantic: s = !1,
813
+ ...d
814
+ }) => {
815
+ const u = na(l), p = f(
816
+ u,
817
+ r || i
818
+ );
819
+ return /* @__PURE__ */ m(S, { children: [
820
+ /* @__PURE__ */ o(
821
+ "svg",
822
+ {
823
+ xmlns: "http://www.w3.org/2000/svg",
824
+ className: p,
825
+ viewBox: a || n,
826
+ fill: t || "currentColor",
827
+ role: "img",
828
+ "aria-hidden": !s,
829
+ focusable: !1,
830
+ ...d,
831
+ children: e
832
+ }
833
+ ),
834
+ c && s && /* @__PURE__ */ o("span", { className: "sr-only", children: c })
835
+ ] });
836
+ };
837
+ /*!
838
+ @versini/ui-private v1.4.13
839
+ © 2024 gizmette.com
840
+ */
841
+ try {
842
+ window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
843
+ version: "1.4.13",
844
+ buildTime: "09/24/2024 07:45 PM EDT",
845
+ homepage: "https://github.com/aversini/ui-components",
846
+ license: "MIT"
847
+ });
848
+ } catch {
849
+ }
850
+ const sa = ({
851
+ className: e,
852
+ viewBox: t,
853
+ spacing: a,
854
+ title: r,
855
+ monotone: n,
856
+ ...i
857
+ }) => /* @__PURE__ */ o(
858
+ ia,
859
+ {
860
+ defaultViewBox: "0 0 384 512",
861
+ defaultClassName: "size-5",
862
+ viewBox: t,
863
+ className: e,
864
+ spacing: a,
865
+ title: r || "Close",
866
+ ...i,
867
+ children: /* @__PURE__ */ o("path", { d: "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3l105.4 105.3c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256l105.3-105.4z" })
868
+ }
869
+ );
870
+ /*!
871
+ @versini/ui-icons v1.12.5
872
+ © 2024 gizmette.com
873
+ */
874
+ try {
875
+ window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
876
+ version: "1.12.5",
877
+ buildTime: "09/24/2024 07:45 PM EDT",
878
+ homepage: "https://github.com/aversini/ui-components",
879
+ license: "MIT"
880
+ });
881
+ } catch {
882
+ }
883
+ const K = "panel", te = "messagebox", la = ({
884
+ className: e,
885
+ kind: t,
886
+ borderMode: a
887
+ }) => ({
888
+ main: f("prose prose-lighter flex flex-col bg-surface-medium", {
889
+ [`${we} h-full min-h-[95%] sm:h-auto sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: t === K,
890
+ [`${we} w-full sm:w-[95%] md:max-w-2xl`]: t === K && !e,
891
+ [`${Ne} rounded-lg border-2`]: t === te,
892
+ [`${Ne} w-[95%] sm:w-[50%] md:max-w-2xl`]: t === te && !e,
893
+ [`${e}`]: !!e,
894
+ "sm:border-border-dark": a === "dark" && t === K,
895
+ "sm:border-border-accent": a === "light" && t === K,
896
+ "border-border-dark": a === "dark" && t === te,
897
+ "border-border-accent": a === "light" && t === te
898
+ }),
899
+ content: "flex flex-grow flex-col py-2 sm:py-4 sm:px-4 px-2",
900
+ footer: "flex flex-grow flex-col sm:p-4 p-2",
901
+ header: "sm:p-4 mb-0 p-2",
902
+ close: "sm:p-4 p-2"
903
+ }), J = (e) => gt(
904
+ () => import("./index.DY3Gz5Cp.DIHttQr7.js").then((t) => ({
905
+ default: t[e]
906
+ }))
907
+ ), ca = J("Modal"), da = J("ModalClose"), ua = J("ModalContent"), ma = J("ModalDescription"), ha = J("ModalHeading"), H = ({
908
+ open: e,
909
+ onOpenChange: t,
910
+ title: a,
911
+ children: r,
912
+ footer: n,
913
+ borderMode: i = "light",
914
+ kind: l = K,
915
+ className: c
916
+ }) => {
917
+ const s = Z(""), d = la({ className: c, kind: l, borderMode: i });
918
+ return O(() => (e && (s.current = document.title, document.title = `${a} | ${s.current}`), () => {
919
+ e && (document.title = s.current);
920
+ }), [a, e]), /* @__PURE__ */ o(ht, { fallback: /* @__PURE__ */ o("div", {}), children: e && /* @__PURE__ */ o(ca, { open: e, onOpenChange: t, children: /* @__PURE__ */ m(ua, { className: d.main, children: [
921
+ /* @__PURE__ */ m("div", { className: "flex flex-row-reverse items-center justify-between", children: [
922
+ /* @__PURE__ */ o(
923
+ da,
924
+ {
925
+ className: d.close,
926
+ trigger: /* @__PURE__ */ o(
927
+ ze,
928
+ {
929
+ mode: "dark",
930
+ focusMode: "light",
931
+ noBorder: !0,
932
+ label: "Close",
933
+ children: /* @__PURE__ */ o(sa, {})
934
+ }
935
+ )
936
+ }
937
+ ),
938
+ /* @__PURE__ */ o(ha, { className: d.header, children: a })
939
+ ] }),
940
+ /* @__PURE__ */ o(ma, { className: d.content, children: r }),
941
+ n && /* @__PURE__ */ o("div", { className: d.footer, children: n })
942
+ ] }) }) });
943
+ };
944
+ function q(e) {
945
+ return pt();
946
+ }
947
+ const ga = ({ stats: e }) => {
948
+ const t = (e == null ? void 0 : e.plugins) || [], a = (e == null ? void 0 : e.version) || "", r = (e == null ? void 0 : e.models) || [], n = q(), i = q();
949
+ return /* @__PURE__ */ m(S, { children: [
950
+ /* @__PURE__ */ o("div", { className: "mb-4", children: /* @__PURE__ */ o(
951
+ I,
952
+ {
953
+ header: v.ABOUT.TITLE_CLIENT,
954
+ className: "prose-dark dark:prose-lighter",
955
+ children: X(n, {
956
+ [v.ABOUT.VERSION]: "4.5.1",
957
+ [v.ABOUT.BUILD_TIMESTAMP]: "09/25/2024 12:19 PM EDT"
958
+ })
959
+ }
960
+ ) }),
961
+ /* @__PURE__ */ o(
962
+ I,
963
+ {
964
+ header: v.ABOUT.TITLE_SERVER,
965
+ className: "prose-dark dark:prose-lighter",
966
+ children: X(i, {
967
+ [v.ABOUT.VERSION]: a,
968
+ [oe(v.ABOUT.ENGINE, r.length)]: /* @__PURE__ */ o(S, { children: r.map((l) => /* @__PURE__ */ o("div", { className: "text-right", children: l }, l)) }),
969
+ [oe(v.ABOUT.PLUGIN, t.length)]: /* @__PURE__ */ o(S, { children: t.map((l) => /* @__PURE__ */ o("div", { className: "text-right", children: l }, l)) })
970
+ })
971
+ }
972
+ )
973
+ ] });
974
+ }, pa = ({
975
+ open: e,
976
+ onOpenChange: t
977
+ }) => {
978
+ const { serverStats: a } = B(ne);
979
+ return /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: Ke, children: /* @__PURE__ */ o(ga, { stats: a }) });
980
+ }, fa = (e) => Ie(e), ba = (e) => {
981
+ if (!e || e.length === 0)
982
+ return qe;
983
+ const t = e.filter(
984
+ (a) => {
985
+ var r, n;
986
+ return ((r = a == null ? void 0 : a.message) == null ? void 0 : r.role) === Je && typeof ((n = a == null ? void 0 : a.message) == null ? void 0 : n.processingTime) == "number";
987
+ }
988
+ ).map((a) => a.message.processingTime);
989
+ return Qe({
990
+ data: t,
991
+ formatter: fa
992
+ });
993
+ }, va = ({
994
+ isAuthenticated: e,
995
+ stats: t
996
+ }) => {
997
+ const { state: a } = B(ne), r = et - Number(a == null ? void 0 : a.usage), n = q(), i = q();
998
+ return e ? /* @__PURE__ */ m(S, { children: [
999
+ a && a.messages.length > 0 && /* @__PURE__ */ o("div", { className: "mb-4", children: /* @__PURE__ */ o(
1000
+ I,
1001
+ {
1002
+ header: v.CURRENT_STATISTICS.TITLE,
1003
+ className: "prose-dark dark:prose-lighter",
1004
+ children: X(n, {
1005
+ [v.CURRENT_STATISTICS.MODEL_NAME]: (a == null ? void 0 : a.model) || Xe,
1006
+ [v.CURRENT_STATISTICS.TOKENS_USED]: a == null ? void 0 : a.usage,
1007
+ [v.CURRENT_STATISTICS.REMAINING_TOKENS]: Ze.format(r),
1008
+ [v.CURRENT_STATISTICS.PROCESSING_TIME]: ba(a == null ? void 0 : a.messages)
1009
+ })
1010
+ }
1011
+ ) }),
1012
+ /* @__PURE__ */ o(
1013
+ I,
1014
+ {
1015
+ header: v.MAIN_STATISTICS.TITLE,
1016
+ className: "prose-dark dark:prose-lighter",
1017
+ children: X(i, {
1018
+ [oe(v.MAIN_STATISTICS.TOTAL, t.totalChats)]: t.totalChats,
1019
+ [v.MAIN_STATISTICS.PROCESSING_TIME]: Ie(
1020
+ t.averageProcessingTimes
1021
+ )
1022
+ })
1023
+ }
1024
+ )
1025
+ ] }) : null;
1026
+ }, ya = ({
1027
+ open: e,
1028
+ onOpenChange: t
1029
+ }) => {
1030
+ const [a, r] = C({
1031
+ averageProcessingTimes: 0,
1032
+ totalChats: 0
1033
+ }), { isAuthenticated: n, getAccessToken: i, user: l } = U();
1034
+ return O(() => {
1035
+ !e || !l || (async () => {
1036
+ try {
1037
+ const c = await M({
1038
+ accessToken: await i(),
1039
+ type: L.GET_CHATS_STATS,
1040
+ params: {
1041
+ userId: l.username
1042
+ }
1043
+ });
1044
+ c.status === 200 && r(c.data);
1045
+ } catch {
1046
+ }
1047
+ })();
1048
+ }, [e, i, l]), /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: _e, children: /* @__PURE__ */ o(va, { isAuthenticated: n, stats: a }) });
1049
+ }, Pe = ({
1050
+ showConfirmation: e,
1051
+ setShowConfirmation: t,
1052
+ action: a,
1053
+ children: r,
1054
+ customStrings: n
1055
+ }) => /* @__PURE__ */ o(
1056
+ H,
1057
+ {
1058
+ kind: "messagebox",
1059
+ open: e,
1060
+ onOpenChange: t,
1061
+ title: n.title,
1062
+ footer: /* @__PURE__ */ m(me, { columnGap: 2, alignHorizontal: "flex-end", children: [
1063
+ /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(
1064
+ z,
1065
+ {
1066
+ mode: "dark",
1067
+ variant: "secondary",
1068
+ focusMode: "light",
1069
+ onClick: () => {
1070
+ t(!1);
1071
+ },
1072
+ children: n.cancelAction
1073
+ }
1074
+ ) }),
1075
+ /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(
1076
+ z,
1077
+ {
1078
+ mode: "dark",
1079
+ variant: "danger",
1080
+ focusMode: "light",
1081
+ onClick: () => {
1082
+ t(!1), a();
1083
+ },
1084
+ children: n.confirmAction
1085
+ }
1086
+ ) })
1087
+ ] }),
1088
+ children: r
1089
+ }
1090
+ );
1091
+ var ka = typeof window < "u", Ta = function(e, t) {
1092
+ return ka ? window.matchMedia(e).matches : (process.env.NODE_ENV !== "production" && console.warn("`useMedia` When server side rendering, defaultState should be defined to prevent a hydration mismatches."), !1);
1093
+ }, Ca = function(e, t) {
1094
+ var a = C(Ta(e)), r = a[0], n = a[1];
1095
+ return O(function() {
1096
+ var i = !0, l = window.matchMedia(e), c = function() {
1097
+ i && n(!!l.matches);
1098
+ };
1099
+ return l.addEventListener("change", c), n(l.matches), function() {
1100
+ i = !1, l.removeEventListener("change", c);
1101
+ };
1102
+ }, [e]), r;
1103
+ };
1104
+ const Na = async (e, t, a, r) => {
1105
+ try {
1106
+ const n = await M({
1107
+ accessToken: r,
1108
+ type: L.GET_CHAT,
1109
+ params: {
1110
+ id: e.id
1111
+ }
1112
+ });
1113
+ n.status === 200 && (t({
1114
+ type: at
1115
+ }), t({
1116
+ type: ot,
1117
+ payload: {
1118
+ id: e.id,
1119
+ model: n.data.model,
1120
+ usage: n.data.usage,
1121
+ messages: n.data.messages
1122
+ }
1123
+ }), a(!1));
1124
+ } catch {
1125
+ }
1126
+ }, Se = (e) => {
1127
+ const t = e[0];
1128
+ return rt(t == null ? void 0 : t.content, 100);
1129
+ }, wa = ({
1130
+ filteredHistory: e,
1131
+ setFilteredHistory: t,
1132
+ dispatch: a,
1133
+ onOpenChange: r
1134
+ }) => {
1135
+ var w;
1136
+ const { user: n, getAccessToken: i } = U(), l = Z({
1137
+ id: 0,
1138
+ timestamp: "",
1139
+ message: ""
1140
+ }), [c, s] = C(!1), d = Ca("(min-width: 480px)"), { state: u, dispatch: p } = B(Re), [, y] = F({
1141
+ key: P + tt,
1142
+ initialValue: u.sortDirection
1143
+ }), h = e.data.sort(
1144
+ (b, T) => {
1145
+ switch (u.sortedCell) {
1146
+ case "timestamp":
1147
+ if (u.sortDirection === x.ASC)
1148
+ return new Date(b[u.sortedCell]).getTime() - new Date(T[u.sortedCell]).getTime();
1149
+ if (u.sortDirection === x.DESC)
1150
+ return new Date(T[u.sortedCell]).getTime() - new Date(b[u.sortedCell]).getTime();
1151
+ break;
1152
+ default:
1153
+ return 0;
1154
+ }
1155
+ return 0;
1156
+ }
1157
+ ), g = (b) => {
1158
+ switch (u.sortDirection) {
1159
+ case !1:
1160
+ y(x.ASC), p({
1161
+ type: ie,
1162
+ payload: {
1163
+ sortedCell: b,
1164
+ sortDirection: x.ASC
1165
+ }
1166
+ });
1167
+ break;
1168
+ case x.ASC:
1169
+ y(x.DESC), p({
1170
+ type: ie,
1171
+ payload: {
1172
+ sortedCell: b,
1173
+ sortDirection: x.DESC
1174
+ }
1175
+ });
1176
+ break;
1177
+ default:
1178
+ y(x.ASC), p({
1179
+ type: ie,
1180
+ payload: {
1181
+ sortedCell: b,
1182
+ sortDirection: x.ASC
1183
+ }
1184
+ });
1185
+ break;
1186
+ }
1187
+ };
1188
+ return /* @__PURE__ */ m(S, { children: [
1189
+ /* @__PURE__ */ m(
1190
+ Pe,
1191
+ {
1192
+ showConfirmation: c,
1193
+ setShowConfirmation: s,
1194
+ action: async () => {
1195
+ const b = l.current;
1196
+ try {
1197
+ const T = await M({
1198
+ accessToken: await i(),
1199
+ type: L.DELETE_CHAT,
1200
+ params: {
1201
+ userId: (n == null ? void 0 : n.username) || "",
1202
+ id: b.id
1203
+ }
1204
+ });
1205
+ T.status === 200 && t({ data: T.data });
1206
+ } catch {
1207
+ }
1208
+ },
1209
+ customStrings: {
1210
+ confirmAction: "Delete",
1211
+ cancelAction: "Cancel",
1212
+ title: "Delete chat"
1213
+ },
1214
+ children: [
1215
+ /* @__PURE__ */ o("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
1216
+ /* @__PURE__ */ m("ul", { className: "m-0", children: [
1217
+ /* @__PURE__ */ m("li", { children: [
1218
+ "Timestamp:",
1219
+ " ",
1220
+ /* @__PURE__ */ o("span", { className: "text-lg", children: l.current && l.current.timestamp })
1221
+ ] }),
1222
+ /* @__PURE__ */ m("li", { children: [
1223
+ "First message:",
1224
+ " ",
1225
+ /* @__PURE__ */ o("span", { className: "text-lg", children: (w = l.current) == null ? void 0 : w.message })
1226
+ ] })
1227
+ ] })
1228
+ ]
1229
+ }
1230
+ ),
1231
+ /* @__PURE__ */ m(bt, { stickyHeader: !0, stickyFooter: !0, wrapperClassName: "max-h-[60vh]", children: [
1232
+ /* @__PURE__ */ o(vt, { children: /* @__PURE__ */ m(ce, { children: [
1233
+ d && /* @__PURE__ */ o(R, { className: "sr-only", children: "Row" }),
1234
+ /* @__PURE__ */ o(
1235
+ yt,
1236
+ {
1237
+ cellId: "timestamp",
1238
+ align: "left",
1239
+ sortDirection: u.sortDirection,
1240
+ sortedCell: u.sortedCell,
1241
+ onClick: () => {
1242
+ g("timestamp");
1243
+ },
1244
+ children: "Date"
1245
+ }
1246
+ ),
1247
+ /* @__PURE__ */ o(R, { children: "First message" }),
1248
+ /* @__PURE__ */ o(R, { className: "text-right", children: "Actions" })
1249
+ ] }) }),
1250
+ /* @__PURE__ */ o(kt, { children: h.map((b, T) => {
1251
+ var N;
1252
+ return ((N = b == null ? void 0 : b.messages) == null ? void 0 : N.length) > 0 ? /* @__PURE__ */ m(ce, { children: [
1253
+ d && /* @__PURE__ */ o(R, { children: T + 1 }),
1254
+ /* @__PURE__ */ o(
1255
+ R,
1256
+ {
1257
+ component: "th",
1258
+ scope: "row",
1259
+ className: "font-medium text-gray-400 sm:whitespace-nowrap",
1260
+ children: b.timestamp
1261
+ }
1262
+ ),
1263
+ /* @__PURE__ */ o(R, { className: "max-w-[100px] text-white sm:max-w-full", children: Se(b.messages) }),
1264
+ /* @__PURE__ */ o(R, { children: /* @__PURE__ */ m("div", { className: "flex justify-end gap-2", children: [
1265
+ /* @__PURE__ */ o(
1266
+ V,
1267
+ {
1268
+ focusMode: "alt-system",
1269
+ noBorder: !0,
1270
+ label: "Restore chat",
1271
+ onClick: async () => {
1272
+ const E = await i();
1273
+ Na(
1274
+ b,
1275
+ a,
1276
+ r,
1277
+ E
1278
+ );
1279
+ },
1280
+ children: /* @__PURE__ */ o(jt, { className: "h-3 w-3", monotone: !0 })
1281
+ }
1282
+ ),
1283
+ /* @__PURE__ */ o(
1284
+ V,
1285
+ {
1286
+ focusMode: "alt-system",
1287
+ noBorder: !0,
1288
+ label: "Delete chat",
1289
+ onClick: () => {
1290
+ l.current = {
1291
+ id: b.id,
1292
+ timestamp: b.timestamp,
1293
+ message: Se(b.messages)
1294
+ }, s(!c);
1295
+ },
1296
+ children: /* @__PURE__ */ o("div", { className: "text-red-400", children: /* @__PURE__ */ o(Ft, { className: "h-3 w-3", monotone: !0 }) })
1297
+ }
1298
+ )
1299
+ ] }) })
1300
+ ] }, `${v.HISTORY.TITLE}-${b.id}-${T}`) : null;
1301
+ }) }),
1302
+ /* @__PURE__ */ o(Tt, { children: /* @__PURE__ */ o(ce, { children: /* @__PURE__ */ o(R, { colSpan: 4, children: /* @__PURE__ */ o("div", { children: oe(
1303
+ `${e.data.length} chat`,
1304
+ e.data.length
1305
+ ) }) }) }) })
1306
+ ] })
1307
+ ] });
1308
+ };
1309
+ function xe(e, t) {
1310
+ return t ? e.filter(
1311
+ (a) => a.messages.some(
1312
+ (r) => r.content !== null && r.content.toLowerCase().includes(t.toLowerCase())
1313
+ )
1314
+ ) : e;
1315
+ }
1316
+ const Ea = ({
1317
+ onOpenChange: e,
1318
+ historyData: t
1319
+ }) => {
1320
+ const { isAuthenticated: a } = U(), r = Z(null), { dispatch: n } = B(ne), { state: i, dispatch: l } = B(Re), [, c] = F({
1321
+ key: P + nt,
1322
+ initialValue: i.searchString
1323
+ }), s = ft(() => t, [t]), [d, u] = C({
1324
+ data: s
1325
+ }), p = (g) => {
1326
+ const k = xe(s, g);
1327
+ u({
1328
+ data: k
1329
+ }), c(g), l({
1330
+ type: st,
1331
+ payload: { searchString: g }
1332
+ });
1333
+ }, y = (g) => {
1334
+ p(g.target.value);
1335
+ }, h = async (g) => {
1336
+ g.preventDefault();
1337
+ };
1338
+ return O(() => {
1339
+ const g = xe(
1340
+ t,
1341
+ i.searchString
1342
+ );
1343
+ u({
1344
+ data: g
1345
+ });
1346
+ }, [t, i.searchString]), a ? d && d.data && /* @__PURE__ */ m(S, { children: [
1347
+ /* @__PURE__ */ o("form", { autoComplete: "off", onSubmit: h, children: /* @__PURE__ */ o(
1348
+ it,
1349
+ {
1350
+ ref: r,
1351
+ defaultValue: i.searchString,
1352
+ focusMode: "light",
1353
+ name: "Search",
1354
+ label: "Search",
1355
+ onChange: y,
1356
+ spacing: { t: 2, b: 2 },
1357
+ ...i.searchString && {
1358
+ rightElement: /* @__PURE__ */ o(
1359
+ z,
1360
+ {
1361
+ disabled: !i.searchString,
1362
+ mode: "dark",
1363
+ noBorder: !0,
1364
+ size: "small",
1365
+ onClick: () => {
1366
+ var g;
1367
+ p(""), (g = r.current) != null && g.value && (r.current.value = "", r.current.focus());
1368
+ },
1369
+ children: "Reset"
1370
+ }
1371
+ )
1372
+ }
1373
+ }
1374
+ ) }),
1375
+ /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 sm:flex-row", children: /* @__PURE__ */ o(
1376
+ wa,
1377
+ {
1378
+ filteredHistory: d,
1379
+ setFilteredHistory: u,
1380
+ dispatch: n,
1381
+ onOpenChange: e
1382
+ }
1383
+ ) })
1384
+ ] }) : null;
1385
+ }, Sa = ({
1386
+ open: e,
1387
+ onOpenChange: t,
1388
+ historyData: a
1389
+ }) => /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: lt, children: /* @__PURE__ */ o(Ea, { onOpenChange: t, historyData: a }) });
1390
+ /*!
1391
+ @versini/ui-toggle v1.0.3
1392
+ © 2024 gizmette.com
1393
+ */
1394
+ try {
1395
+ window.__VERSINI_UI_TOGGLE__ || (window.__VERSINI_UI_TOGGLE__ = {
1396
+ version: "1.0.3",
1397
+ buildTime: "09/24/2024 07:45 PM EDT",
1398
+ homepage: "https://github.com/aversini/ui-components",
1399
+ license: "MIT"
1400
+ });
1401
+ } catch {
1402
+ }
1403
+ const xa = "av-toggle", Ia = (e) => {
1404
+ let t = "";
1405
+ if (typeof e == "number" || typeof e == "string")
1406
+ t = "m-" + e;
1407
+ else {
1408
+ const a = [];
1409
+ (e == null ? void 0 : e.t) !== void 0 && a.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && a.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && a.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && a.push(`ml-${e.l}`), t = a.join(" ");
1410
+ }
1411
+ return t;
1412
+ }, _a = () => f("peer", "h-6", "w-11", "rounded-full"), Aa = ({
1413
+ focusMode: e
1414
+ }) => f(
1415
+ "peer-focus:outline",
1416
+ "peer-focus:outline-2",
1417
+ "peer-focus:outline-offset-2",
1418
+ {
1419
+ "peer-focus:outline-focus-dark": e === "dark",
1420
+ "peer-focus:outline-focus-light": e === "light",
1421
+ "peer-focus:outline-focus-light dark:peer-focus:outline-focus-dark": e === "alt-system",
1422
+ "peer-focus:outline-focus-dark dark:peer-focus:outline-focus-light": e === "system"
1423
+ }
1424
+ ), Ra = () => f(
1425
+ "peer-checked:after:translate-x-full",
1426
+ // background color when checked
1427
+ "peer-checked:bg-violet-500",
1428
+ // knob circle and border color when checked
1429
+ "peer-checked:after:bg-white",
1430
+ "peer-checked:after:border-white"
1431
+ ), Ma = () => f(
1432
+ "after:left-[2px]",
1433
+ "after:top-[2px]",
1434
+ "after:border",
1435
+ "after:border-surface-light dark:after:border-surface-medium",
1436
+ "after:bg-surface-light dark:after:bg-surface-medium",
1437
+ "after:absolute",
1438
+ "after:h-5",
1439
+ "after:w-5",
1440
+ "after:rounded-full",
1441
+ "after:transition-all",
1442
+ "after:content-['']"
1443
+ ), La = ({
1444
+ mode: e,
1445
+ noBorder: t
1446
+ }) => f({
1447
+ border: !t,
1448
+ "border-border-dark bg-surface-medium": e === "light",
1449
+ "border-border-light bg-surface-darker": e === "dark",
1450
+ "border-border-light bg-surface-darker dark:border-border-dark dark:bg-surface-medium": e === "alt-system",
1451
+ "border-border-dark bg-surface-medium dark:border-border-light dark:bg-surface-darker": e === "system"
1452
+ }), Ba = ({
1453
+ mode: e,
1454
+ labelHidden: t
1455
+ }) => t ? "sr-only" : f("ml-2 text-sm", {
1456
+ "text-copy-dark": e === "light",
1457
+ "text-copy-lighter": e === "dark",
1458
+ "text-copy-lighter dark:text-copy-dark": e === "alt-system",
1459
+ "text-copy-dark dark:text-copy-lighter": e === "system"
1460
+ }), Oa = ({ spacing: e }) => f(
1461
+ xa,
1462
+ "relative flex cursor-pointer items-center",
1463
+ Ia(e)
1464
+ ), Ha = ({
1465
+ mode: e,
1466
+ focusMode: t,
1467
+ labelHidden: a,
1468
+ spacing: r,
1469
+ noBorder: n
1470
+ }) => ({
1471
+ toggle: f(
1472
+ _a(),
1473
+ La({ mode: e, noBorder: n }),
1474
+ Aa({ focusMode: t }),
1475
+ Ma(),
1476
+ Ra()
1477
+ ),
1478
+ label: Ba({ mode: e, labelHidden: a }),
1479
+ input: "peer sr-only",
1480
+ wrapper: Oa({ spacing: r })
1481
+ }), ae = ({
1482
+ checked: e = !1,
1483
+ onChange: t,
1484
+ label: a,
1485
+ labelHidden: r = !1,
1486
+ name: n,
1487
+ mode: i = "system",
1488
+ focusMode: l = "system",
1489
+ spacing: c,
1490
+ noBorder: s = !1
1491
+ }) => {
1492
+ const d = Ha({
1493
+ mode: i,
1494
+ focusMode: l,
1495
+ labelHidden: r,
1496
+ spacing: c,
1497
+ noBorder: s
1498
+ }), u = (p) => {
1499
+ t == null || t(p.target.checked);
1500
+ };
1501
+ return /* @__PURE__ */ m("label", { className: d.wrapper, children: [
1502
+ /* @__PURE__ */ o(
1503
+ "input",
1504
+ {
1505
+ name: n,
1506
+ checked: e,
1507
+ type: "checkbox",
1508
+ className: d.input,
1509
+ onChange: u
1510
+ }
1511
+ ),
1512
+ /* @__PURE__ */ o("div", { className: d.toggle }),
1513
+ /* @__PURE__ */ o("span", { className: d.label, children: a })
1514
+ ] });
1515
+ }, Da = ({
1516
+ open: e,
1517
+ onOpenChange: t
1518
+ }) => {
1519
+ const { getAccessToken: a, user: r } = U(), [n, i] = C({
1520
+ loaded: !1,
1521
+ content: "",
1522
+ loadingLocation: !1,
1523
+ location: ""
1524
+ }), l = async (s) => {
1525
+ s.preventDefault();
1526
+ try {
1527
+ await M({
1528
+ accessToken: await a(),
1529
+ type: L.SET_CUSTOM_INSTRUCTIONS,
1530
+ params: {
1531
+ user: r == null ? void 0 : r.username,
1532
+ instructions: n.content,
1533
+ location: n.location
1534
+ }
1535
+ });
1536
+ } catch {
1537
+ }
1538
+ }, c = async () => {
1539
+ i((s) => ({
1540
+ ...s,
1541
+ location: "...",
1542
+ loadingLocation: !0
1543
+ }));
1544
+ try {
1545
+ const s = Date.now(), d = await ct(), u = await M({
1546
+ accessToken: await a(),
1547
+ type: L.GET_LOCATION,
1548
+ params: {
1549
+ latitude: d.latitude,
1550
+ longitude: d.longitude
1551
+ }
1552
+ }), y = Date.now() - s;
1553
+ if (y < 2e3 && await new Promise((h) => setTimeout(h, 2e3 - y)), u.status === 200) {
1554
+ const { city: h, state: g, country: k, displayName: w } = u.data, b = h && g && k ? `${h}, ${g}, ${k}` : w;
1555
+ i((T) => ({
1556
+ ...T,
1557
+ loaded: !0,
1558
+ location: b,
1559
+ loadingLocation: !1
1560
+ }));
1561
+ } else
1562
+ i((h) => ({
1563
+ ...h,
1564
+ loaded: !0,
1565
+ location: "",
1566
+ loadingLocation: !1
1567
+ }));
1568
+ } catch {
1569
+ }
1570
+ };
1571
+ return O(() => {
1572
+ if (!e || !r) {
1573
+ i({
1574
+ loaded: !1,
1575
+ loadingLocation: !1,
1576
+ content: "",
1577
+ location: ""
1578
+ });
1579
+ return;
1580
+ }
1581
+ (async () => {
1582
+ try {
1583
+ const s = await M({
1584
+ accessToken: await a(),
1585
+ type: L.GET_CUSTOM_INSTRUCTIONS,
1586
+ params: {
1587
+ user: r.username
1588
+ }
1589
+ });
1590
+ s.status === 200 && i((d) => ({
1591
+ ...d,
1592
+ loaded: !0,
1593
+ content: s.data.instructions,
1594
+ location: s.data.location
1595
+ }));
1596
+ } catch {
1597
+ }
1598
+ })();
1599
+ }, [r, e]), /* @__PURE__ */ o(S, { children: n.loaded && /* @__PURE__ */ m(
1600
+ H,
1601
+ {
1602
+ open: e,
1603
+ onOpenChange: t,
1604
+ title: "Engine Fine Tuning",
1605
+ footer: /* @__PURE__ */ m(me, { columnGap: 2, alignHorizontal: "flex-end", children: [
1606
+ /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(
1607
+ z,
1608
+ {
1609
+ mode: "dark",
1610
+ variant: "secondary",
1611
+ focusMode: "light",
1612
+ onClick: () => {
1613
+ t(!1);
1614
+ },
1615
+ children: "Cancel"
1616
+ }
1617
+ ) }),
1618
+ /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(
1619
+ z,
1620
+ {
1621
+ mode: "dark",
1622
+ variant: "danger",
1623
+ focusMode: "light",
1624
+ onClick: async (s) => {
1625
+ t(!1), await l(s);
1626
+ },
1627
+ children: "Save"
1628
+ }
1629
+ ) })
1630
+ ] }),
1631
+ children: [
1632
+ /* @__PURE__ */ m(
1633
+ I,
1634
+ {
1635
+ header: "Custom Instructions",
1636
+ className: "prose-dark dark:prose-lighter",
1637
+ children: [
1638
+ /* @__PURE__ */ o("p", { children: "What would you like Sassy Saint to know about you to provide better responses?" }),
1639
+ /* @__PURE__ */ o(
1640
+ ke,
1641
+ {
1642
+ mode: "alt-system",
1643
+ autoCapitalize: "off",
1644
+ autoComplete: "off",
1645
+ autoCorrect: "off",
1646
+ name: "customInstructions",
1647
+ label: "Custom Instructions",
1648
+ value: n.content,
1649
+ onChange: (s) => {
1650
+ i((d) => ({
1651
+ ...d,
1652
+ loaded: !0,
1653
+ content: s.target.value
1654
+ }));
1655
+ },
1656
+ helperText: "Press ENTER to add a new line."
1657
+ }
1658
+ )
1659
+ ]
1660
+ }
1661
+ ),
1662
+ /* @__PURE__ */ m(
1663
+ I,
1664
+ {
1665
+ header: "Location",
1666
+ className: "prose-dark dark:prose-lighter",
1667
+ spacing: { t: 4 },
1668
+ children: [
1669
+ /* @__PURE__ */ o("p", { children: "You can share your location to receive customized responses based on your area." }),
1670
+ /* @__PURE__ */ o(
1671
+ ke,
1672
+ {
1673
+ mode: "alt-system",
1674
+ name: "location",
1675
+ label: "Location",
1676
+ value: n.location,
1677
+ onChange: (s) => {
1678
+ i((d) => ({
1679
+ ...d,
1680
+ loaded: !0,
1681
+ location: s.target.value
1682
+ }));
1683
+ },
1684
+ helperText: "Enter your location or press auto-detect."
1685
+ }
1686
+ ),
1687
+ /* @__PURE__ */ o(
1688
+ z,
1689
+ {
1690
+ spacing: { t: 2 },
1691
+ size: "small",
1692
+ noBorder: !0,
1693
+ disabled: n.loadingLocation,
1694
+ onClick: c,
1695
+ children: n.loadingLocation ? "Detecting..." : "Auto-detect"
1696
+ }
1697
+ )
1698
+ ]
1699
+ }
1700
+ )
1701
+ ]
1702
+ }
1703
+ ) });
1704
+ }, za = ({
1705
+ open: e,
1706
+ onOpenChange: t
1707
+ }) => {
1708
+ const [a, r] = F({
1709
+ key: P + pe,
1710
+ initialValue: !1
1711
+ }), [n, i] = F({
1712
+ key: P + fe,
1713
+ initialValue: !1
1714
+ }), [l, c] = F({
1715
+ key: P + be,
1716
+ initialValue: !1
1717
+ }), s = (p) => {
1718
+ r(p);
1719
+ }, d = (p) => {
1720
+ i(p);
1721
+ }, u = (p) => {
1722
+ c(p);
1723
+ };
1724
+ return /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: "Tags", children: /* @__PURE__ */ m(I, { header: v.TAGS.TITLE, className: "prose-dark dark:prose-lighter", children: [
1725
+ /* @__PURE__ */ o("p", { children: v.TAGS.DESCRIPTION }),
1726
+ /* @__PURE__ */ o(
1727
+ ae,
1728
+ {
1729
+ noBorder: !0,
1730
+ label: se[le.SUMMARIZE_ARTICLE].label,
1731
+ name: pe,
1732
+ onChange: s,
1733
+ checked: a
1734
+ }
1735
+ ),
1736
+ /* @__PURE__ */ o(
1737
+ ae,
1738
+ {
1739
+ spacing: { t: 2 },
1740
+ noBorder: !0,
1741
+ label: se[le.PROOFREAD_CONTENT].label,
1742
+ name: fe,
1743
+ onChange: d,
1744
+ checked: n
1745
+ }
1746
+ ),
1747
+ /* @__PURE__ */ o(
1748
+ ae,
1749
+ {
1750
+ spacing: { t: 2 },
1751
+ noBorder: !0,
1752
+ label: se[le.REPHRASE_CONTENT].label,
1753
+ name: be,
1754
+ onChange: u,
1755
+ checked: l
1756
+ }
1757
+ )
1758
+ ] }) });
1759
+ }, Pa = () => {
1760
+ const { isAuthenticated: e, user: t, registeringForPasskey: a, authenticationType: r } = U(), [n, i] = F({
1761
+ key: P + dt,
1762
+ initialValue: !1
1763
+ }), [l, c] = C(!1), [s, d] = C(!1), u = q(), p = (t == null ? void 0 : t.username) || "", y = (k) => {
1764
+ i(k);
1765
+ }, h = () => {
1766
+ c(!l);
1767
+ }, g = () => {
1768
+ d(!s);
1769
+ };
1770
+ return e && p ? /* @__PURE__ */ m(S, { children: [
1771
+ l && /* @__PURE__ */ o(
1772
+ Da,
1773
+ {
1774
+ open: l,
1775
+ onOpenChange: c
1776
+ }
1777
+ ),
1778
+ s && /* @__PURE__ */ o(za, { open: s, onOpenChange: d }),
1779
+ /* @__PURE__ */ m(
1780
+ I,
1781
+ {
1782
+ header: v.PREFERENCES.TITLE,
1783
+ className: "prose-dark dark:prose-lighter",
1784
+ children: [
1785
+ X(u, {
1786
+ [v.PREFERENCES.NAME]: p,
1787
+ [v.PREFERENCES.EMAIL]: (t == null ? void 0 : t.email) || "",
1788
+ [v.PREFERENCES.ENGINE_DETAILS]: /* @__PURE__ */ o(
1789
+ ae,
1790
+ {
1791
+ noBorder: !0,
1792
+ labelHidden: !0,
1793
+ label: v.PREFERENCES.ENGINE_DETAILS,
1794
+ name: v.PREFERENCES.ENGINE_DETAILS,
1795
+ onChange: y,
1796
+ checked: n
1797
+ }
1798
+ )
1799
+ }),
1800
+ /* @__PURE__ */ o(
1801
+ V,
1802
+ {
1803
+ spacing: { t: 2 },
1804
+ size: "small",
1805
+ onClick: h,
1806
+ labelLeft: "Engine Fine Tuning",
1807
+ children: /* @__PURE__ */ o(Te, { className: "size-3", monotone: !0 })
1808
+ }
1809
+ ),
1810
+ /* @__PURE__ */ o(
1811
+ V,
1812
+ {
1813
+ spacing: { t: 2, l: 2 },
1814
+ size: "small",
1815
+ onClick: g,
1816
+ labelLeft: "Tags",
1817
+ children: /* @__PURE__ */ o(Te, { className: "size-3", monotone: !0 })
1818
+ }
1819
+ )
1820
+ ]
1821
+ }
1822
+ ),
1823
+ r !== ut.PASSKEY && /* @__PURE__ */ m(
1824
+ I,
1825
+ {
1826
+ spacing: { t: 4 },
1827
+ className: "prose-dark dark:prose-lighter",
1828
+ header: /* @__PURE__ */ o("h2", { className: "m-0", children: /* @__PURE__ */ m(me, { columnGap: 3, alignVertical: "center", children: [
1829
+ /* @__PURE__ */ o($, { children: /* @__PURE__ */ o(ve, { className: "size-8" }) }),
1830
+ /* @__PURE__ */ o($, { children: /* @__PURE__ */ o("div", { children: v.PREFERENCES.PASSKEY_TITLE }) })
1831
+ ] }) }),
1832
+ children: [
1833
+ /* @__PURE__ */ o("p", { children: v.PREFERENCES.PASSKEY_INSTRUCTIONS }),
1834
+ /* @__PURE__ */ o(
1835
+ V,
1836
+ {
1837
+ size: "small",
1838
+ spacing: { t: 2 },
1839
+ onClick: a,
1840
+ labelLeft: v.PREFERENCES.PASSKEY_BUTTON,
1841
+ children: /* @__PURE__ */ o(ve, { className: "size-5", monotone: !0 })
1842
+ }
1843
+ )
1844
+ ]
1845
+ }
1846
+ )
1847
+ ] }) : null;
1848
+ }, Va = ({
1849
+ open: e,
1850
+ onOpenChange: t
1851
+ }) => /* @__PURE__ */ o(H, { open: e, onOpenChange: t, title: mt, children: /* @__PURE__ */ o(Pa, {}) }), Ya = () => {
1852
+ const { state: e } = B(ne), [t, a] = C(!1), [r, n] = C(!1), [i, l] = C(!1), [c, s] = C(!1), [d, u] = C([]), [p, y] = C(!1), [h, g] = C({
1853
+ done: !1,
1854
+ progress: !1,
1855
+ timestamp: Date.now()
1856
+ }), { logout: k, getAccessToken: w, user: b } = U(), T = () => {
1857
+ a(!t);
1858
+ }, N = () => {
1859
+ n(!r);
1860
+ }, E = () => {
1861
+ l(!i);
1862
+ }, G = () => {
1863
+ s(!c);
1864
+ }, j = async (A) => {
1865
+ const ee = Date.now();
1866
+ if (A && !(!b || !e || h.progress || h.done === !0 && ee - h.timestamp < 5e3)) {
1867
+ g({
1868
+ done: !0,
1869
+ progress: !0,
1870
+ timestamp: ee
1871
+ });
1872
+ try {
1873
+ const W = await M({
1874
+ accessToken: await w(),
1875
+ type: L.GET_CHATS,
1876
+ params: {
1877
+ userId: b.username
1878
+ }
1879
+ });
1880
+ W.status === 200 && (u(W.data), g({
1881
+ done: !0,
1882
+ progress: !1,
1883
+ timestamp: Date.now()
1884
+ }));
1885
+ } catch {
1886
+ g({
1887
+ done: !0,
1888
+ progress: !1,
1889
+ timestamp: Date.now()
1890
+ });
1891
+ }
1892
+ }
1893
+ }, Q = () => {
1894
+ y(!p);
1895
+ };
1896
+ return /* @__PURE__ */ m(S, { children: [
1897
+ /* @__PURE__ */ o(
1898
+ Pe,
1899
+ {
1900
+ showConfirmation: p,
1901
+ setShowConfirmation: y,
1902
+ action: k,
1903
+ customStrings: {
1904
+ confirmAction: ye,
1905
+ cancelAction: "Cancel",
1906
+ title: ye
1907
+ },
1908
+ children: /* @__PURE__ */ o("p", { children: "Are you sure you want to log out?" })
1909
+ }
1910
+ ),
1911
+ /* @__PURE__ */ o(Va, { open: t, onOpenChange: a }),
1912
+ /* @__PURE__ */ o(ya, { open: r, onOpenChange: n }),
1913
+ /* @__PURE__ */ o(
1914
+ Sa,
1915
+ {
1916
+ open: i,
1917
+ onOpenChange: l,
1918
+ historyData: d
1919
+ }
1920
+ ),
1921
+ /* @__PURE__ */ o(pa, { open: c, onOpenChange: s }),
1922
+ /* @__PURE__ */ o("div", { className: "relative", children: /* @__PURE__ */ o("div", { className: "absolute bottom-[-28px] right-[-7px]", children: /* @__PURE__ */ m(
1923
+ He,
1924
+ {
1925
+ mode: "dark",
1926
+ focusMode: "light",
1927
+ trigger: /* @__PURE__ */ o(V, { children: /* @__PURE__ */ o(Wt, {}) }),
1928
+ defaultPlacement: "bottom-end",
1929
+ onOpenChange: j,
1930
+ children: [
1931
+ /* @__PURE__ */ o(
1932
+ D,
1933
+ {
1934
+ label: "Profile",
1935
+ onClick: T,
1936
+ icon: /* @__PURE__ */ o(Gt, {})
1937
+ }
1938
+ ),
1939
+ /* @__PURE__ */ o(
1940
+ D,
1941
+ {
1942
+ label: _e,
1943
+ onClick: N,
1944
+ icon: /* @__PURE__ */ o(Vt, {})
1945
+ }
1946
+ ),
1947
+ /* @__PURE__ */ o(
1948
+ D,
1949
+ {
1950
+ label: "History",
1951
+ onClick: E,
1952
+ icon: /* @__PURE__ */ o($t, {})
1953
+ }
1954
+ ),
1955
+ /* @__PURE__ */ o(
1956
+ D,
1957
+ {
1958
+ label: "About",
1959
+ onClick: G,
1960
+ icon: /* @__PURE__ */ o(Ut, {})
1961
+ }
1962
+ ),
1963
+ e && e.id && !e.isComponent && /* @__PURE__ */ m(S, { children: [
1964
+ /* @__PURE__ */ o(Yt, {}),
1965
+ /* @__PURE__ */ o(
1966
+ D,
1967
+ {
1968
+ label: "Log out",
1969
+ onClick: Q,
1970
+ icon: /* @__PURE__ */ o("div", { className: "text-red-700", children: /* @__PURE__ */ o(Pt, { monotone: !0 }) })
1971
+ }
1972
+ )
1973
+ ] })
1974
+ ]
1975
+ }
1976
+ ) }) })
1977
+ ] });
1978
+ };
1979
+ export {
1980
+ Ya as default
1981
+ };