@versini/sassysaint 1.0.11 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1288 +0,0 @@
1
- import { jsxs as c, jsx as t, Fragment as w } from "react/jsx-runtime";
2
- import { O as D, i$1 as le, N as de, p as De, o as _e, g as A, N$1 as _, CARDS as C, renderDataAsList as F, pluralize as Q, ABOUT_TITLE as ze, MODEL_GPT4 as Be, numberFormatter as Ve, durationFormatter as Ce, NA as Pe, ROLE_ASSISTANT as Fe, extractAverage as Ge, GPT4_MAX_TOKENS as $e, Wr as U, STATS as Ne, b as q, j as M, x as Z, LOCAL_STORAGE_PREFIX as ee, LOCAL_STORAGE_SORT as Ue, ACTION_RESET as je, ACTION_RESTORE as Ke, truncate as Ye, ACTION_SORT as re, LOCAL_STORAGE_SEARCH as We, G as Xe, ACTION_SEARCH as Je, HISTORY_TITLE as qe, LOCAL_STORAGE_CHAT_DETAILS as Qe, LOCAL_STORAGE_LOCATION as Ze, G$1 as et, f$2 as tt, ACTION_LOCATION as me, getCurrentGeoLocation as st, convertLatitudeToDMS as at, convertLongitudeToDMS as nt, PROFILE_TITLE as rt, LOG_OUT as ue } from "./index.eFSALEqy.js";
3
- import * as ce from "react";
4
- import ot, { forwardRef as Te, useState as T, useRef as G, useContext as R, useEffect as L, Suspense as ct, lazy as it, useId as lt } from "react";
5
- import { g as dt, AppContext as j, serviceCall as se, SERVICE_TYPES as ae, HistoryContext as ye, E as te, k as v, et as mt, at as ut, lt as oe, J as H, ct as ht, st as pt, rt as ft } from "./useLocalStorage.CsBq2ZMB.js";
6
- import k from "clsx";
7
- import { useFloatingTree as be, useFloatingNodeId as gt, useListItem as Se, useFloating as Ct, offset as Nt, flip as Tt, shift as yt, autoUpdate as bt, useClick as St, useRole as wt, useDismiss as kt, useListNavigation as Et, useTypeahead as xt, useInteractions as vt, useMergeRefs as we, FloatingNode as At, FloatingList as It, FloatingPortal as Ht, FloatingFocusManager as Mt, FloatingTree as Rt } from "@floating-ui/react";
8
- const ie = ce.createContext({
9
- getItemProps: () => ({}),
10
- activeIndex: null,
11
- /* v8 ignore next 2 */
12
- setActiveIndex: () => {
13
- },
14
- setHasFocusInside: () => {
15
- },
16
- isOpen: !1
17
- }), he = (e) => {
18
- if (typeof e == "string")
19
- return e;
20
- if (typeof e == "function")
21
- return e.displayName || e.name || "Component";
22
- if (typeof e == "object" && e !== null && "type" in e) {
23
- const s = e.type;
24
- if (typeof s == "function" || typeof s == "object")
25
- return s.displayName || s.name || "Component";
26
- }
27
- return "Element";
28
- }, ke = Te(
29
- ({
30
- trigger: e,
31
- children: s,
32
- label: a = "Open menu",
33
- defaultPlacement: n = "bottom-start",
34
- onOpenChange: r,
35
- spacing: o,
36
- mode: l = "system",
37
- focusMode: d = "system",
38
- ...h
39
- }, m) => {
40
- const [N, u] = T(!1), [y, b] = T(!1), [S, f] = T(null), E = G([]), i = G([]), p = R(ie), g = be(), x = gt(), z = Se(), { floatingStyles: ne, refs: W, context: I } = Ct({
41
- nodeId: x,
42
- open: N,
43
- onOpenChange: (V) => {
44
- u(V), r == null || r(V);
45
- },
46
- placement: n,
47
- strategy: "fixed",
48
- middleware: [Nt({ mainAxis: 10 }), Tt(), yt()],
49
- whileElementsMounted: bt
50
- }), X = St(I, {
51
- event: "mousedown",
52
- toggle: !0,
53
- ignoreMouse: !1
54
- }), B = wt(I, { role: "menu" }), ve = kt(I, { bubbles: !0 }), Ae = Et(I, {
55
- listRef: E,
56
- activeIndex: S,
57
- nested: !1,
58
- onNavigate: f,
59
- loop: !0
60
- }), Ie = xt(I, {
61
- listRef: i,
62
- onMatch: N ? f : void 0,
63
- activeIndex: S
64
- }), { getReferenceProps: He, getFloatingProps: Me, getItemProps: Re } = vt([X, B, ve, Ae, Ie]), Le = he(e) === "Button" || he(e) === "ButtonIcon", Oe = ot.cloneElement(e, {
65
- mode: l,
66
- focusMode: d,
67
- spacing: o,
68
- noInternalClick: Le,
69
- "aria-label": a,
70
- "data-open": N ? "" : void 0,
71
- "data-focus-inside": y ? "" : void 0,
72
- ref: we([W.setReference, z.ref, m]),
73
- ...He(
74
- p.getItemProps({
75
- ...h
76
- })
77
- )
78
- });
79
- return L(() => {
80
- if (!g)
81
- return;
82
- function V() {
83
- u(!1), r == null || r(!1);
84
- }
85
- return g.events.on("click", V), () => {
86
- g.events.off("click", V);
87
- };
88
- }, [g, r]), L(() => {
89
- N && g && g.events.emit("menuopen", { nodeId: x });
90
- }, [g, N, x]), /* @__PURE__ */ c(At, { id: x, children: [
91
- Oe,
92
- /* @__PURE__ */ t(
93
- ie.Provider,
94
- {
95
- value: {
96
- activeIndex: S,
97
- setActiveIndex: f,
98
- getItemProps: Re,
99
- setHasFocusInside: b,
100
- isOpen: N
101
- },
102
- children: /* @__PURE__ */ t(It, { elementsRef: E, labelsRef: i, children: N && /* @__PURE__ */ t(Ht, { children: /* @__PURE__ */ t(
103
- Mt,
104
- {
105
- context: I,
106
- modal: !1,
107
- initialFocus: 0,
108
- returnFocus: !0,
109
- children: /* @__PURE__ */ t(
110
- "div",
111
- {
112
- ref: W.setFloating,
113
- className: "rounded-md bg-surface-light p-4 shadow-sm shadow-border-dark outline-none sm:p-2",
114
- style: ne,
115
- ...Me(),
116
- children: s
117
- }
118
- )
119
- }
120
- ) }) })
121
- }
122
- )
123
- ] });
124
- }
125
- ), Ee = Te((e, s) => /* @__PURE__ */ t(Rt, { children: /* @__PURE__ */ t(ke, { ...e, ref: s }) }));
126
- Ee.displayName = "Menu";
127
- ke.displayName = "MenuComponent";
128
- const O = ce.forwardRef(({ label: e, disabled: s, icon: a, ...n }, r) => {
129
- const o = ce.useContext(ie), l = Se({ label: s ? null : e }), d = be();
130
- return /* @__PURE__ */ c(
131
- "button",
132
- {
133
- ...n,
134
- ref: we([l.ref, r]),
135
- role: "menuitem",
136
- 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",
137
- tabIndex: 0,
138
- disabled: s,
139
- ...o.getItemProps({
140
- onClick(h) {
141
- var m;
142
- (m = n.onClick) == null || m.call(n, h), d == null || d.events.emit("click");
143
- },
144
- onFocus(h) {
145
- var m;
146
- (m = n.onFocus) == null || m.call(n, h), o.setHasFocusInside(!0);
147
- }
148
- }),
149
- children: [
150
- a,
151
- e && /* @__PURE__ */ t("span", { className: "pl-2", children: e })
152
- ]
153
- }
154
- );
155
- });
156
- O.displayName = "MenuItem";
157
- const Lt = ({ className: e, ...s }) => {
158
- const a = k(e, "my-1 border-t border-border-medium");
159
- return /* @__PURE__ */ t("div", { className: a, ...s });
160
- }, Ot = ({
161
- className: e,
162
- viewBox: s,
163
- spacing: a,
164
- title: n,
165
- monotone: r,
166
- ...o
167
- }) => /* @__PURE__ */ t(
168
- dt,
169
- {
170
- defaultViewBox: "0 0 384 512",
171
- defaultClassName: "size-5",
172
- viewBox: s,
173
- className: e,
174
- spacing: a,
175
- title: n || "Close",
176
- ...o,
177
- children: /* @__PURE__ */ t("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" })
178
- }
179
- ), P = "panel", J = "messagebox", Dt = ({
180
- className: e,
181
- kind: s,
182
- borderMode: a
183
- }) => ({
184
- main: k("prose prose-lighter flex flex-col bg-surface-medium", {
185
- [`${le} h-full min-h-[95%] sm:h-auto sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: s === P,
186
- [`${le} w-full sm:w-[95%] md:max-w-2xl`]: s === P && !e,
187
- [`${de} rounded-lg border-2`]: s === J,
188
- [`${de} w-[95%] sm:w-[50%] md:max-w-2xl`]: s === J && !e,
189
- [`${e}`]: !!e,
190
- "sm:border-border-dark": a === "dark" && s === P,
191
- "sm:border-border-accent": a === "light" && s === P,
192
- "border-border-dark": a === "dark" && s === J,
193
- "border-border-accent": a === "light" && s === J
194
- }),
195
- content: "flex flex-grow flex-col py-2 sm:py-4 px-4",
196
- footer: "flex flex-grow flex-col p-4",
197
- header: "p-4 mb-0",
198
- close: "p-4"
199
- }), K = (e) => it(
200
- () => import("./index.BcV6McvW.U50izDOU.js").then((s) => ({
201
- default: s[e]
202
- }))
203
- ), _t = K("Modal"), zt = K("ModalClose"), Bt = K("ModalContent"), Vt = K("ModalDescription"), Pt = K("ModalHeading"), Y = ({
204
- open: e,
205
- onOpenChange: s,
206
- title: a,
207
- children: n,
208
- footer: r,
209
- borderMode: o = "light",
210
- kind: l = P,
211
- className: d
212
- }) => {
213
- const h = G(""), m = Dt({ className: d, kind: l, borderMode: o });
214
- return L(() => (e && (h.current = document.title, document.title = `${a} | ${h.current}`), () => {
215
- e && (document.title = h.current);
216
- }), [a, e]), /* @__PURE__ */ t(ct, { fallback: /* @__PURE__ */ t("div", {}), children: e && /* @__PURE__ */ t(_t, { open: e, onOpenChange: s, children: /* @__PURE__ */ c(Bt, { className: m.main, children: [
217
- /* @__PURE__ */ c("div", { className: "flex flex-row-reverse items-center justify-between", children: [
218
- /* @__PURE__ */ t(
219
- zt,
220
- {
221
- className: m.close,
222
- trigger: /* @__PURE__ */ t(
223
- D,
224
- {
225
- mode: "dark",
226
- focusMode: "light",
227
- noBorder: !0,
228
- label: "Close",
229
- children: /* @__PURE__ */ t(Ot, {})
230
- }
231
- )
232
- }
233
- ),
234
- /* @__PURE__ */ t(Pt, { className: m.header, children: a })
235
- ] }),
236
- /* @__PURE__ */ t(Vt, { className: m.content, children: n }),
237
- r && /* @__PURE__ */ t("div", { className: m.footer, children: r })
238
- ] }) }) });
239
- }, Ft = () => k("peer", "h-6", "w-11", "rounded-full"), Gt = ({
240
- focusMode: e
241
- }) => k(
242
- "peer-focus:outline",
243
- "peer-focus:outline-2",
244
- "peer-focus:outline-offset-2",
245
- {
246
- "peer-focus:outline-focus-dark": e === "dark",
247
- "peer-focus:outline-focus-light": e === "light",
248
- "peer-focus:outline-focus-light dark:peer-focus:outline-focus-dark": e === "alt-system",
249
- "peer-focus:outline-focus-dark dark:peer-focus:outline-focus-light": e === "system"
250
- }
251
- ), $t = () => k(
252
- "peer-checked:after:translate-x-full",
253
- // background color when checked
254
- "peer-checked:bg-violet-500",
255
- // knob circle and border color when checked
256
- "peer-checked:after:bg-white",
257
- "peer-checked:after:border-white"
258
- ), Ut = () => k(
259
- "after:left-[2px]",
260
- "after:top-[2px]",
261
- "after:border",
262
- "after:border-surface-light dark:after:border-surface-medium",
263
- "after:bg-surface-light dark:after:bg-surface-medium",
264
- "after:absolute",
265
- "after:h-5",
266
- "after:w-5",
267
- "after:rounded-full",
268
- "after:transition-all",
269
- "after:content-['']"
270
- ), jt = ({
271
- mode: e,
272
- noBorder: s
273
- }) => k({
274
- border: !s,
275
- "border-border-dark bg-surface-medium": e === "light",
276
- "border-border-light bg-surface-darker": e === "dark",
277
- "border-border-light bg-surface-darker dark:border-border-dark dark:bg-surface-medium": e === "alt-system",
278
- "border-border-dark bg-surface-medium dark:border-border-light dark:bg-surface-darker": e === "system"
279
- }), Kt = ({
280
- mode: e,
281
- labelHidden: s
282
- }) => s ? "sr-only" : k("ml-2 text-sm", {
283
- "text-copy-dark": e === "light",
284
- "text-copy-lighter": e === "dark",
285
- "text-copy-lighter dark:text-copy-dark": e === "alt-system",
286
- "text-copy-dark dark:text-copy-lighter": e === "system"
287
- }), Yt = ({ spacing: e }) => k(
288
- De,
289
- "relative flex cursor-pointer items-center",
290
- _e(e)
291
- ), Wt = ({
292
- mode: e,
293
- focusMode: s,
294
- labelHidden: a,
295
- spacing: n,
296
- noBorder: r
297
- }) => ({
298
- toggle: k(
299
- Ft(),
300
- jt({ mode: e, noBorder: r }),
301
- Gt({ focusMode: s }),
302
- Ut(),
303
- $t()
304
- ),
305
- label: Kt({ mode: e, labelHidden: a }),
306
- input: "peer sr-only",
307
- wrapper: Yt({ spacing: n })
308
- }), Xt = ({
309
- checked: e = !1,
310
- onChange: s,
311
- label: a,
312
- labelHidden: n = !1,
313
- name: r,
314
- mode: o = "system",
315
- focusMode: l = "system",
316
- spacing: d,
317
- noBorder: h = !1
318
- }) => {
319
- const m = Wt({
320
- mode: o,
321
- focusMode: l,
322
- labelHidden: n,
323
- spacing: d,
324
- noBorder: h
325
- }), N = (u) => {
326
- s == null || s(u.target.checked);
327
- };
328
- return /* @__PURE__ */ c("label", { className: m.wrapper, children: [
329
- /* @__PURE__ */ t(
330
- "input",
331
- {
332
- name: r,
333
- checked: e,
334
- type: "checkbox",
335
- className: m.input,
336
- onChange: N
337
- }
338
- ),
339
- /* @__PURE__ */ t("div", { className: m.toggle }),
340
- /* @__PURE__ */ t("span", { className: m.label, children: a })
341
- ] });
342
- }, Jt = ({
343
- className: e,
344
- viewBox: s,
345
- spacing: a,
346
- title: n,
347
- monotone: r,
348
- ...o
349
- }) => /* @__PURE__ */ c(
350
- A,
351
- {
352
- defaultViewBox: "0 0 512 512",
353
- defaultClassName: "size-5",
354
- viewBox: s,
355
- className: e,
356
- spacing: a,
357
- title: n || "Back",
358
- ...o,
359
- children: [
360
- /* @__PURE__ */ t(
361
- "path",
362
- {
363
- opacity: r ? "1" : "0.4",
364
- 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"
365
- }
366
- ),
367
- /* @__PURE__ */ t("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" })
368
- ]
369
- }
370
- ), qt = ({
371
- className: e,
372
- viewBox: s,
373
- spacing: a,
374
- title: n,
375
- monotone: r,
376
- ...o
377
- }) => /* @__PURE__ */ c(
378
- A,
379
- {
380
- defaultViewBox: "0 0 448 512",
381
- defaultClassName: "size-5",
382
- viewBox: s,
383
- className: e,
384
- spacing: a,
385
- title: n || "Chart",
386
- ...o,
387
- children: [
388
- /* @__PURE__ */ t(
389
- "path",
390
- {
391
- opacity: r ? "1" : "0.4",
392
- 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"
393
- }
394
- ),
395
- /* @__PURE__ */ t("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" })
396
- ]
397
- }
398
- ), Qt = ({
399
- className: e,
400
- viewBox: s,
401
- spacing: a,
402
- title: n,
403
- monotone: r,
404
- ...o
405
- }) => /* @__PURE__ */ c(
406
- A,
407
- {
408
- defaultViewBox: "0 0 448 512",
409
- defaultClassName: "size-5",
410
- viewBox: s,
411
- className: e,
412
- spacing: a,
413
- title: n || "Delete",
414
- ...o,
415
- children: [
416
- /* @__PURE__ */ t(
417
- "path",
418
- {
419
- opacity: r ? "1" : "0.4",
420
- 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"
421
- }
422
- ),
423
- /* @__PURE__ */ t("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" })
424
- ]
425
- }
426
- ), Zt = ({
427
- className: e,
428
- viewBox: s,
429
- spacing: a,
430
- title: n,
431
- monotone: r,
432
- ...o
433
- }) => /* @__PURE__ */ c(
434
- A,
435
- {
436
- defaultViewBox: "0 0 512 512",
437
- defaultClassName: "size-5",
438
- viewBox: s,
439
- className: e,
440
- spacing: a,
441
- title: n || "History",
442
- ...o,
443
- children: [
444
- /* @__PURE__ */ t(
445
- "path",
446
- {
447
- opacity: r ? "1" : "0.4",
448
- 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"
449
- }
450
- ),
451
- /* @__PURE__ */ t("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" })
452
- ]
453
- }
454
- ), es = ({
455
- className: e,
456
- viewBox: s,
457
- spacing: a,
458
- title: n,
459
- monotone: r,
460
- ...o
461
- }) => /* @__PURE__ */ c(
462
- A,
463
- {
464
- defaultViewBox: "0 0 512 512",
465
- defaultClassName: "size-5",
466
- viewBox: s,
467
- className: e,
468
- spacing: a,
469
- title: n || "Info",
470
- ...o,
471
- children: [
472
- /* @__PURE__ */ t(
473
- "path",
474
- {
475
- opacity: "0.4",
476
- 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"
477
- }
478
- ),
479
- /* @__PURE__ */ t("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" })
480
- ]
481
- }
482
- ), ts = ({
483
- className: e,
484
- viewBox: s,
485
- spacing: a,
486
- title: n,
487
- monotone: r,
488
- ...o
489
- }) => /* @__PURE__ */ c(
490
- A,
491
- {
492
- defaultViewBox: "0 0 576 512",
493
- defaultClassName: "size-5",
494
- viewBox: s,
495
- className: e,
496
- spacing: a,
497
- title: n || "Profile",
498
- ...o,
499
- children: [
500
- /* @__PURE__ */ t(
501
- "path",
502
- {
503
- opacity: "0.4",
504
- 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"
505
- }
506
- ),
507
- /* @__PURE__ */ t("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" })
508
- ]
509
- }
510
- ), pe = ({
511
- className: e,
512
- viewBox: s,
513
- spacing: a,
514
- title: n,
515
- monotone: r,
516
- ...o
517
- }) => /* @__PURE__ */ c(
518
- A,
519
- {
520
- defaultViewBox: "0 0 512 512",
521
- defaultClassName: "size-5",
522
- viewBox: s,
523
- className: e,
524
- spacing: a,
525
- title: n || "Refresh",
526
- ...o,
527
- children: [
528
- /* @__PURE__ */ t(
529
- "path",
530
- {
531
- className: "fa-secondary",
532
- opacity: r ? "1" : "0.4",
533
- d: "M80 396.9V448c0 17.7-14.3 32-32 32s-32-14.3-32-32V320c0-17.7 14.3-32 32-32H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H125.6l17.2 17.1c62.5 62.5 163.8 62.5 226.3 0c17.5-17.5 30.1-38 37.8-59.8c5.9-16.7 24.2-25.4 40.8-19.5s25.4 24.2 19.5 40.8c-10.8 30.6-28.4 59.3-52.9 83.8c-87.5 87.5-229.3 87.5-316.7 0L80 396.9z"
534
- }
535
- ),
536
- /* @__PURE__ */ t(
537
- "path",
538
- {
539
- className: "fa-primary",
540
- d: "M105.1 202.6c7.7-21.8 20.2-42.3 37.8-59.8c62.5-62.5 163.8-62.5 226.3 0L386.3 160H336c-17.7 0-32 14.3-32 32s14.3 32 32 32H463.5c0 0 0 0 0 0h.4c17.7 0 32-14.3 32-32V64c0-17.7-14.3-32-32-32s-32 14.3-32 32v51.2L414.4 97.6c-87.5-87.5-229.3-87.5-316.8 0C73.2 122 55.6 150.7 44.8 181.4c-5.9 16.7 2.9 34.9 19.5 40.8s34.9-2.9 40.8-19.5z"
541
- }
542
- )
543
- ]
544
- }
545
- ), ss = ({
546
- className: e,
547
- viewBox: s,
548
- spacing: a,
549
- title: n,
550
- monotone: r,
551
- ...o
552
- }) => /* @__PURE__ */ c(
553
- A,
554
- {
555
- defaultViewBox: "0 0 512 512",
556
- defaultClassName: "size-5",
557
- viewBox: s,
558
- className: e,
559
- spacing: a,
560
- title: n || "Restore",
561
- ...o,
562
- children: [
563
- /* @__PURE__ */ t(
564
- "path",
565
- {
566
- opacity: r ? "1" : "0.4",
567
- 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"
568
- }
569
- ),
570
- /* @__PURE__ */ t("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" })
571
- ]
572
- }
573
- ), as = ({
574
- className: e,
575
- viewBox: s,
576
- spacing: a,
577
- title: n,
578
- monotone: r,
579
- ...o
580
- }) => /* @__PURE__ */ t(
581
- A,
582
- {
583
- defaultViewBox: "0 0 448 512",
584
- defaultClassName: "size-5",
585
- viewBox: s,
586
- className: e,
587
- spacing: a,
588
- title: n || "Settings",
589
- ...o,
590
- children: /* @__PURE__ */ t("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" })
591
- }
592
- );
593
- function $(e) {
594
- return lt();
595
- }
596
- const ns = ({ stats: e }) => {
597
- const s = (e == null ? void 0 : e.plugins) || [], a = (e == null ? void 0 : e.version) || "", n = (e == null ? void 0 : e.models) || [], r = $(), o = $();
598
- return /* @__PURE__ */ c(w, { children: [
599
- /* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t(
600
- _,
601
- {
602
- header: C.ABOUT.TITLE_CLIENT,
603
- className: "prose-dark dark:prose-lighter",
604
- children: F(r, {
605
- [C.ABOUT.VERSION]: "3.4.5",
606
- [C.ABOUT.BUILD_TIMESTAMP]: "08/01/2024 07:46 PM EDT"
607
- })
608
- }
609
- ) }),
610
- /* @__PURE__ */ t(
611
- _,
612
- {
613
- header: C.ABOUT.TITLE_SERVER,
614
- className: "prose-dark dark:prose-lighter",
615
- children: F(o, {
616
- [C.ABOUT.VERSION]: a,
617
- [Q(C.ABOUT.ENGINE, n.length)]: /* @__PURE__ */ t(w, { children: n.map((l) => /* @__PURE__ */ t("div", { className: "text-right", children: l }, l)) }),
618
- [Q(C.ABOUT.PLUGIN, s.length)]: /* @__PURE__ */ t(w, { children: s.map((l) => /* @__PURE__ */ t("div", { className: "text-right", children: l }, l)) })
619
- })
620
- }
621
- )
622
- ] });
623
- }, rs = ({
624
- open: e,
625
- onOpenChange: s
626
- }) => {
627
- const { serverStats: a } = R(j);
628
- return /* @__PURE__ */ t(Y, { open: e, onOpenChange: s, title: ze, children: /* @__PURE__ */ t(ns, { stats: a }) });
629
- }, os = (e) => Ce(e), cs = (e) => {
630
- if (!e || e.length === 0)
631
- return Pe;
632
- const s = e.filter(
633
- (a) => {
634
- var n, r;
635
- return ((n = a == null ? void 0 : a.message) == null ? void 0 : n.role) === Fe && typeof ((r = a == null ? void 0 : a.message) == null ? void 0 : r.processingTime) == "number";
636
- }
637
- ).map((a) => a.message.processingTime);
638
- return Ge({
639
- data: s,
640
- formatter: os
641
- });
642
- }, is = ({
643
- isAuthenticated: e,
644
- stats: s
645
- }) => {
646
- const { state: a } = R(j), n = $e - Number(a == null ? void 0 : a.usage), r = $(), o = $();
647
- return e ? /* @__PURE__ */ c(w, { children: [
648
- a && a.messages.length > 0 && /* @__PURE__ */ t("div", { className: "mb-4", children: /* @__PURE__ */ t(
649
- _,
650
- {
651
- header: C.CURRENT_STATISTICS.TITLE,
652
- className: "prose-dark dark:prose-lighter",
653
- children: F(r, {
654
- [C.CURRENT_STATISTICS.MODEL_NAME]: (a == null ? void 0 : a.model) || Be,
655
- [C.CURRENT_STATISTICS.TOKENS_USED]: a == null ? void 0 : a.usage,
656
- [C.CURRENT_STATISTICS.REMAINING_TOKENS]: Ve.format(n),
657
- [C.CURRENT_STATISTICS.PROCESSING_TIME]: cs(a == null ? void 0 : a.messages)
658
- })
659
- }
660
- ) }),
661
- /* @__PURE__ */ t(
662
- _,
663
- {
664
- header: C.MAIN_STATISTICS.TITLE,
665
- className: "prose-dark dark:prose-lighter",
666
- children: F(o, {
667
- [Q(C.MAIN_STATISTICS.TOTAL, s.totalChats)]: s.totalChats,
668
- [C.MAIN_STATISTICS.PROCESSING_TIME]: Ce(
669
- s.averageProcessingTimes
670
- )
671
- })
672
- }
673
- )
674
- ] }) : null;
675
- }, ls = ({
676
- open: e,
677
- onOpenChange: s
678
- }) => {
679
- const [a, n] = T({
680
- averageProcessingTimes: 0,
681
- totalChats: 0
682
- }), { isAuthenticated: r, getAccessToken: o, user: l } = U();
683
- return L(() => {
684
- !e || !l || (async () => {
685
- try {
686
- const d = await se({
687
- accessToken: await o(),
688
- type: ae.GET_CHATS_STATS,
689
- params: {
690
- userId: l.username
691
- }
692
- });
693
- d.status === 200 && n(d.data);
694
- } catch {
695
- }
696
- })();
697
- }, [e, o, l]), /* @__PURE__ */ t(Y, { open: e, onOpenChange: s, title: Ne, children: /* @__PURE__ */ t(is, { isAuthenticated: r, stats: a }) });
698
- }, xe = ({
699
- showConfirmation: e,
700
- setShowConfirmation: s,
701
- action: a,
702
- children: n,
703
- customStrings: r
704
- }) => /* @__PURE__ */ t(
705
- Y,
706
- {
707
- kind: "messagebox",
708
- open: e,
709
- onOpenChange: s,
710
- title: r.title,
711
- footer: /* @__PURE__ */ c(q, { columnGap: 2, alignHorizontal: "flex-end", children: [
712
- /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t(
713
- Z,
714
- {
715
- mode: "dark",
716
- variant: "secondary",
717
- focusMode: "light",
718
- onClick: () => {
719
- s(!1);
720
- },
721
- children: r.cancelAction
722
- }
723
- ) }),
724
- /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t(
725
- Z,
726
- {
727
- mode: "dark",
728
- variant: "danger",
729
- focusMode: "light",
730
- onClick: () => {
731
- s(!1), a();
732
- },
733
- children: r.confirmAction
734
- }
735
- ) })
736
- ] }),
737
- children: n
738
- }
739
- );
740
- var ds = typeof window < "u", ms = function(e, s) {
741
- return ds ? 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);
742
- }, us = function(e, s) {
743
- var a = T(ms(e)), n = a[0], r = a[1];
744
- return L(function() {
745
- var o = !0, l = window.matchMedia(e), d = function() {
746
- o && r(!!l.matches);
747
- };
748
- return l.addEventListener("change", d), r(l.matches), function() {
749
- o = !1, l.removeEventListener("change", d);
750
- };
751
- }, [e]), n;
752
- };
753
- const hs = async (e, s, a, n) => {
754
- try {
755
- const r = await se({
756
- accessToken: n,
757
- type: ae.GET_CHAT,
758
- params: {
759
- id: e.id
760
- }
761
- });
762
- r.status === 200 && (s({
763
- type: je
764
- }), s({
765
- type: Ke,
766
- payload: {
767
- id: e.id,
768
- model: r.data.model,
769
- usage: r.data.usage,
770
- messages: r.data.messages
771
- }
772
- }), a(!1));
773
- } catch {
774
- }
775
- }, fe = (e) => {
776
- const s = e[0];
777
- return Ye(s == null ? void 0 : s.content, 100);
778
- }, ps = ({
779
- filteredHistory: e,
780
- setFilteredHistory: s,
781
- setFullHistory: a,
782
- dispatch: n,
783
- onOpenChange: r
784
- }) => {
785
- var i;
786
- const { user: o, getAccessToken: l } = U(), d = G({
787
- id: 0,
788
- timestamp: "",
789
- message: ""
790
- }), [h, m] = T(!1), N = us("(min-width: 480px)"), { state: u, dispatch: y } = R(ye), [, b] = te({
791
- key: ee + Ue,
792
- initialValue: u.sortDirection
793
- }), S = e.data.sort(
794
- (p, g) => {
795
- switch (u.sortedCell) {
796
- case "timestamp":
797
- if (u.sortDirection === v.ASC)
798
- return new Date(p[u.sortedCell]).getTime() - new Date(g[u.sortedCell]).getTime();
799
- if (u.sortDirection === v.DESC)
800
- return new Date(g[u.sortedCell]).getTime() - new Date(p[u.sortedCell]).getTime();
801
- break;
802
- default:
803
- return 0;
804
- }
805
- return 0;
806
- }
807
- ), f = (p) => {
808
- switch (u.sortDirection) {
809
- case !1:
810
- b(v.ASC), y({
811
- type: re,
812
- payload: {
813
- sortedCell: p,
814
- sortDirection: v.ASC
815
- }
816
- });
817
- break;
818
- case v.ASC:
819
- b(v.DESC), y({
820
- type: re,
821
- payload: {
822
- sortedCell: p,
823
- sortDirection: v.DESC
824
- }
825
- });
826
- break;
827
- default:
828
- b(v.ASC), y({
829
- type: re,
830
- payload: {
831
- sortedCell: p,
832
- sortDirection: v.ASC
833
- }
834
- });
835
- break;
836
- }
837
- };
838
- return /* @__PURE__ */ c(w, { children: [
839
- /* @__PURE__ */ c(
840
- xe,
841
- {
842
- showConfirmation: h,
843
- setShowConfirmation: m,
844
- action: async () => {
845
- const p = d.current;
846
- try {
847
- const g = await se({
848
- accessToken: await l(),
849
- type: ae.DELETE_CHAT,
850
- params: {
851
- userId: (o == null ? void 0 : o.username) || "",
852
- id: p.id
853
- }
854
- });
855
- g.status === 200 && (a(g.data), s({ data: g.data }));
856
- } catch {
857
- }
858
- },
859
- customStrings: {
860
- confirmAction: "Delete",
861
- cancelAction: "Cancel",
862
- title: "Delete chat"
863
- },
864
- children: [
865
- /* @__PURE__ */ t("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
866
- /* @__PURE__ */ c("ul", { className: "m-0", children: [
867
- /* @__PURE__ */ c("li", { children: [
868
- "Timestamp:",
869
- " ",
870
- /* @__PURE__ */ t("span", { className: "text-lg", children: d.current && d.current.timestamp })
871
- ] }),
872
- /* @__PURE__ */ c("li", { children: [
873
- "First message:",
874
- " ",
875
- /* @__PURE__ */ t("span", { className: "text-lg", children: (i = d.current) == null ? void 0 : i.message })
876
- ] })
877
- ] })
878
- ]
879
- }
880
- ),
881
- /* @__PURE__ */ c(mt, { stickyHeader: !0, stickyFooter: !0, wrapperClassName: "max-h-[60vh]", children: [
882
- /* @__PURE__ */ t(ut, { children: /* @__PURE__ */ c(oe, { children: [
883
- N && /* @__PURE__ */ t(H, { className: "sr-only", children: "Row" }),
884
- /* @__PURE__ */ t(
885
- ht,
886
- {
887
- cellId: "timestamp",
888
- align: "left",
889
- sortDirection: u.sortDirection,
890
- sortedCell: u.sortedCell,
891
- onClick: () => {
892
- f("timestamp");
893
- },
894
- children: "Date"
895
- }
896
- ),
897
- /* @__PURE__ */ t(H, { children: "First message" }),
898
- /* @__PURE__ */ t(H, { className: "text-right", children: "Actions" })
899
- ] }) }),
900
- /* @__PURE__ */ t(pt, { children: S.map((p, g) => {
901
- var x;
902
- return ((x = p == null ? void 0 : p.messages) == null ? void 0 : x.length) > 0 ? /* @__PURE__ */ c(oe, { children: [
903
- N && /* @__PURE__ */ t(H, { children: g + 1 }),
904
- /* @__PURE__ */ t(
905
- H,
906
- {
907
- component: "th",
908
- scope: "row",
909
- className: "font-medium text-gray-400 sm:whitespace-nowrap",
910
- children: p.timestamp
911
- }
912
- ),
913
- /* @__PURE__ */ t(H, { className: "max-w-[100px] text-white sm:max-w-full", children: fe(p.messages) }),
914
- /* @__PURE__ */ t(H, { children: /* @__PURE__ */ c("div", { className: "flex justify-end gap-2", children: [
915
- /* @__PURE__ */ t(
916
- D,
917
- {
918
- focusMode: "alt-system",
919
- noBorder: !0,
920
- label: "Restore chat",
921
- onClick: async () => {
922
- const z = await l();
923
- hs(
924
- p,
925
- n,
926
- r,
927
- z
928
- );
929
- },
930
- children: /* @__PURE__ */ t(ss, { className: "h-3 w-3", monotone: !0 })
931
- }
932
- ),
933
- /* @__PURE__ */ t(
934
- D,
935
- {
936
- focusMode: "alt-system",
937
- noBorder: !0,
938
- label: "Delete chat",
939
- onClick: () => {
940
- d.current = {
941
- id: p.id,
942
- timestamp: p.timestamp,
943
- message: fe(p.messages)
944
- }, m(!h);
945
- },
946
- children: /* @__PURE__ */ t("div", { className: "text-red-400", children: /* @__PURE__ */ t(Qt, { className: "h-3 w-3", monotone: !0 }) })
947
- }
948
- )
949
- ] }) })
950
- ] }, `${C.HISTORY.TITLE}-${p.id}-${g}`) : null;
951
- }) }),
952
- /* @__PURE__ */ t(ft, { children: /* @__PURE__ */ t(oe, { children: /* @__PURE__ */ t(H, { colSpan: 4, children: /* @__PURE__ */ t("div", { children: Q(
953
- `${e.data.length} chat`,
954
- e.data.length
955
- ) }) }) }) })
956
- ] })
957
- ] });
958
- };
959
- function ge(e, s) {
960
- return s ? e.filter(
961
- (a) => a.messages.some(
962
- (n) => n.content !== null && n.content.toLowerCase().includes(s.toLowerCase())
963
- )
964
- ) : e;
965
- }
966
- const fs = ({
967
- onOpenChange: e,
968
- historyData: s
969
- }) => {
970
- const { isAuthenticated: a } = U(), n = G(null), { dispatch: r } = R(j), { state: o, dispatch: l } = R(ye), [, d] = te({
971
- key: ee + We,
972
- initialValue: o.searchString
973
- }), [h, m] = T(s), [N, u] = T({
974
- data: h
975
- }), y = (f) => {
976
- const E = ge(h, f);
977
- u({
978
- data: E
979
- }), d(f), l({
980
- type: Je,
981
- payload: { searchString: f }
982
- });
983
- }, b = (f) => {
984
- y(f.target.value);
985
- }, S = async (f) => {
986
- f.preventDefault();
987
- };
988
- return L(() => {
989
- const f = ge(
990
- h,
991
- o.searchString
992
- );
993
- u({
994
- data: f
995
- });
996
- }, [h, o.searchString]), a ? N && N.data && /* @__PURE__ */ c(w, { children: [
997
- /* @__PURE__ */ t("form", { autoComplete: "off", onSubmit: S, children: /* @__PURE__ */ t(
998
- Xe,
999
- {
1000
- ref: n,
1001
- defaultValue: o.searchString,
1002
- focusMode: "light",
1003
- name: "Search",
1004
- label: "Search",
1005
- onChange: b,
1006
- spacing: { t: 2, b: 2 },
1007
- ...o.searchString && {
1008
- rightElement: /* @__PURE__ */ t(
1009
- Z,
1010
- {
1011
- disabled: !o.searchString,
1012
- mode: "dark",
1013
- noBorder: !0,
1014
- size: "small",
1015
- onClick: () => {
1016
- var f;
1017
- y(""), (f = n.current) != null && f.value && (n.current.value = "", n.current.focus());
1018
- },
1019
- children: "Reset"
1020
- }
1021
- )
1022
- }
1023
- }
1024
- ) }),
1025
- /* @__PURE__ */ t("div", { className: "flex flex-col gap-2 sm:flex-row", children: /* @__PURE__ */ t(
1026
- ps,
1027
- {
1028
- filteredHistory: N,
1029
- setFilteredHistory: u,
1030
- setFullHistory: m,
1031
- dispatch: r,
1032
- onOpenChange: e
1033
- }
1034
- ) })
1035
- ] }) : null;
1036
- }, gs = ({
1037
- open: e,
1038
- onOpenChange: s,
1039
- historyData: a
1040
- }) => /* @__PURE__ */ t(Y, { open: e, onOpenChange: s, title: qe, children: /* @__PURE__ */ t(fs, { onOpenChange: s, historyData: a }) }), Cs = () => {
1041
- const { isAuthenticated: e, user: s, registeringForPasskey: a, authenticationType: n } = U(), [r, o] = te({
1042
- key: ee + Qe,
1043
- initialValue: !1
1044
- }), [, l, d] = te({
1045
- key: ee + Ze,
1046
- initialValue: { latitude: 0, longitude: 0, accuracy: 0 }
1047
- }), [h, m] = T(!0), N = $(), { state: u, dispatch: y } = R(j), b = (s == null ? void 0 : s.username) || "", S = (i) => {
1048
- o(i);
1049
- }, f = async () => {
1050
- m(!1), d(), y({
1051
- type: me,
1052
- payload: {
1053
- location: {
1054
- latitude: 0,
1055
- longitude: 0,
1056
- accuracy: 0
1057
- }
1058
- }
1059
- });
1060
- const i = await st();
1061
- l(i), y({
1062
- type: me,
1063
- payload: {
1064
- location: i
1065
- }
1066
- });
1067
- };
1068
- L(() => {
1069
- let i;
1070
- return h || (i = window.setTimeout(() => {
1071
- m(!0);
1072
- }, 3e3)), () => {
1073
- clearTimeout(i);
1074
- };
1075
- }, [h]);
1076
- const E = (i) => {
1077
- if (i != null && i.city && (i != null && i.country) && (i != null && i.region))
1078
- return /* @__PURE__ */ t(w, { children: /* @__PURE__ */ c(q, { alignVertical: "center", columnGap: 4, children: [
1079
- /* @__PURE__ */ c(M, { children: [
1080
- /* @__PURE__ */ c("div", { className: "text-right", children: [
1081
- i.city,
1082
- ", ",
1083
- i.region
1084
- ] }),
1085
- /* @__PURE__ */ t("div", { className: "text-right", children: i.country })
1086
- ] }),
1087
- /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t(
1088
- D,
1089
- {
1090
- disabled: !h,
1091
- size: "small",
1092
- className: "mt-2",
1093
- onClick: f,
1094
- children: /* @__PURE__ */ t(pe, { className: "size-3", monotone: !0 })
1095
- }
1096
- ) })
1097
- ] }) });
1098
- const p = at(i == null ? void 0 : i.latitude), g = nt(i == null ? void 0 : i.longitude);
1099
- return /* @__PURE__ */ t(w, { children: /* @__PURE__ */ c(q, { alignVertical: "center", columnGap: 4, children: [
1100
- /* @__PURE__ */ c(M, { children: [
1101
- /* @__PURE__ */ t("div", { children: p }),
1102
- /* @__PURE__ */ t("div", { children: g })
1103
- ] }),
1104
- /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t(
1105
- D,
1106
- {
1107
- size: "small",
1108
- className: "mt-2",
1109
- onClick: f,
1110
- children: /* @__PURE__ */ t(pe, { className: "size-3", monotone: !0 })
1111
- }
1112
- ) })
1113
- ] }) });
1114
- };
1115
- return e && b ? /* @__PURE__ */ c(w, { children: [
1116
- /* @__PURE__ */ t(
1117
- _,
1118
- {
1119
- header: C.PREFERENCES.TITLE,
1120
- className: "prose-dark dark:prose-lighter",
1121
- children: F(N, {
1122
- [C.PREFERENCES.NAME]: b,
1123
- // [CARDS.PREFERENCES.EMAIL]: endUser.email,
1124
- [C.PREFERENCES.ENGINE_DETAILS]: /* @__PURE__ */ t(
1125
- Xt,
1126
- {
1127
- noBorder: !0,
1128
- labelHidden: !0,
1129
- label: C.PREFERENCES.ENGINE_DETAILS,
1130
- name: C.PREFERENCES.ENGINE_DETAILS,
1131
- onChange: S,
1132
- checked: r
1133
- }
1134
- ),
1135
- [C.PREFERENCES.LOCATION]: E(u == null ? void 0 : u.location)
1136
- })
1137
- }
1138
- ),
1139
- n !== et.PASSKEY && /* @__PURE__ */ c(
1140
- _,
1141
- {
1142
- spacing: { t: 4 },
1143
- className: "prose-dark dark:prose-lighter",
1144
- header: /* @__PURE__ */ t("h2", { className: "m-0", children: /* @__PURE__ */ c(q, { columnGap: 3, alignVertical: "center", children: [
1145
- /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t(tt, { className: "size-6 text-center" }) }),
1146
- /* @__PURE__ */ t(M, { children: /* @__PURE__ */ t("div", { children: "Passkey" }) })
1147
- ] }) }),
1148
- children: [
1149
- "Sign in without a password using a passkey (face or fingerprint sign-in).",
1150
- /* @__PURE__ */ t(Z, { spacing: { t: 2 }, onClick: a, children: "Create a Passkey" })
1151
- ]
1152
- }
1153
- )
1154
- ] }) : null;
1155
- }, Ns = ({
1156
- open: e,
1157
- onOpenChange: s
1158
- }) => /* @__PURE__ */ t(Y, { open: e, onOpenChange: s, title: rt, children: /* @__PURE__ */ t(Cs, {}) }), Es = () => {
1159
- const { state: e } = R(j), [s, a] = T(!1), [n, r] = T(!1), [o, l] = T(!1), [d, h] = T(!1), [m, N] = T([]), [u, y] = T(!1), [b, S] = T({
1160
- done: !1,
1161
- progress: !1,
1162
- timestamp: Date.now()
1163
- }), { logout: f, getAccessToken: E, user: i } = U(), p = () => {
1164
- a(!s);
1165
- }, g = () => {
1166
- r(!n);
1167
- }, x = () => {
1168
- l(!o);
1169
- }, z = () => {
1170
- h(!d);
1171
- }, ne = async (I) => {
1172
- const X = Date.now();
1173
- if (I && !(!i || !e || b.progress || b.done === !0 && X - b.timestamp < 5e3)) {
1174
- S({
1175
- done: !0,
1176
- progress: !0,
1177
- timestamp: X
1178
- });
1179
- try {
1180
- const B = await se({
1181
- accessToken: await E(),
1182
- type: ae.GET_CHATS,
1183
- params: {
1184
- userId: i.username
1185
- }
1186
- });
1187
- B.status === 200 && (N(B.data), S({
1188
- done: !0,
1189
- progress: !1,
1190
- timestamp: Date.now()
1191
- }));
1192
- } catch {
1193
- S({
1194
- done: !0,
1195
- progress: !1,
1196
- timestamp: Date.now()
1197
- });
1198
- }
1199
- }
1200
- }, W = () => {
1201
- y(!u);
1202
- };
1203
- return /* @__PURE__ */ c(w, { children: [
1204
- /* @__PURE__ */ t(
1205
- xe,
1206
- {
1207
- showConfirmation: u,
1208
- setShowConfirmation: y,
1209
- action: f,
1210
- customStrings: {
1211
- confirmAction: ue,
1212
- cancelAction: "Cancel",
1213
- title: ue
1214
- },
1215
- children: /* @__PURE__ */ t("p", { children: "Are you sure you want to log out?" })
1216
- }
1217
- ),
1218
- /* @__PURE__ */ t(Ns, { open: s, onOpenChange: a }),
1219
- /* @__PURE__ */ t(ls, { open: n, onOpenChange: r }),
1220
- /* @__PURE__ */ t(
1221
- gs,
1222
- {
1223
- open: o,
1224
- onOpenChange: l,
1225
- historyData: m
1226
- }
1227
- ),
1228
- /* @__PURE__ */ t(rs, { open: d, onOpenChange: h }),
1229
- /* @__PURE__ */ t("div", { className: "relative", children: /* @__PURE__ */ t("div", { className: "absolute bottom-[-28px] right-[-7px]", children: /* @__PURE__ */ c(
1230
- Ee,
1231
- {
1232
- mode: "dark",
1233
- focusMode: "light",
1234
- trigger: /* @__PURE__ */ t(D, { children: /* @__PURE__ */ t(as, {}) }),
1235
- defaultPlacement: "bottom-end",
1236
- onOpenChange: ne,
1237
- children: [
1238
- /* @__PURE__ */ t(
1239
- O,
1240
- {
1241
- label: "Profile",
1242
- onClick: p,
1243
- icon: /* @__PURE__ */ t(ts, {})
1244
- }
1245
- ),
1246
- /* @__PURE__ */ t(
1247
- O,
1248
- {
1249
- label: Ne,
1250
- onClick: g,
1251
- icon: /* @__PURE__ */ t(qt, {})
1252
- }
1253
- ),
1254
- /* @__PURE__ */ t(
1255
- O,
1256
- {
1257
- label: "History",
1258
- onClick: x,
1259
- icon: /* @__PURE__ */ t(Zt, {})
1260
- }
1261
- ),
1262
- /* @__PURE__ */ t(
1263
- O,
1264
- {
1265
- label: "About",
1266
- onClick: z,
1267
- icon: /* @__PURE__ */ t(es, {})
1268
- }
1269
- ),
1270
- e && e.id && !e.isComponent && /* @__PURE__ */ c(w, { children: [
1271
- /* @__PURE__ */ t(Lt, {}),
1272
- /* @__PURE__ */ t(
1273
- O,
1274
- {
1275
- label: "Log out",
1276
- onClick: W,
1277
- icon: /* @__PURE__ */ t("div", { className: "text-red-700", children: /* @__PURE__ */ t(Jt, { monotone: !0 }) })
1278
- }
1279
- )
1280
- ] })
1281
- ]
1282
- }
1283
- ) }) })
1284
- ] });
1285
- };
1286
- export {
1287
- Es as default
1288
- };