@versini/sassysaint 4.2.0 → 4.3.0

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