@versini/sassysaint 8.50.0 → 8.51.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.
Files changed (26) hide show
  1. package/dist/chunks/{AboutChangelog.DubyT8tA.js → AboutChangelog.WNM37aeI.js} +2 -2
  2. package/dist/chunks/{AboutEntry.Byc5GXwY.js → AboutEntry.DsEQiX_E.js} +7 -7
  3. package/dist/chunks/{App.5pNjlAbr.js → App.Bu-CJnKe.js} +684 -709
  4. package/dist/chunks/{Chart.CJr5SEfd.js → Chart.BdBKxHIA.js} +2 -2
  5. package/dist/chunks/{ChatBubbleAssistant.CxkyQIaL.js → ChatBubbleAssistant.B-vRFZBE.js} +4 -4
  6. package/dist/chunks/{ChatBubbleUser.DuagpPMM.js → ChatBubbleUser.B5gHBtWt.js} +3 -3
  7. package/dist/chunks/ChatHistoryTable.Dlabwern.js +236 -0
  8. package/dist/chunks/{HistoryEntry.Do9b3mI3.js → HistoryEntry.DRtSTHsn.js} +3 -3
  9. package/dist/chunks/{ProfileEntry.BuZL2tf0.js → ProfileEntry.BSSHn4EU.js} +2 -2
  10. package/dist/chunks/SettingsEntry.DwwFKKy7.js +964 -0
  11. package/dist/chunks/Table.D-giOzeS.js +429 -0
  12. package/dist/chunks/{UsageEntry.Cg_6TYnM.js → UsageEntry.CShAiRZX.js} +3 -3
  13. package/dist/chunks/{index.CvtbvwLy.js → index.BHp59-sT.js} +1 -1
  14. package/dist/chunks/{index.BfJ5XNTd.js → index.Bp_XB-o3.js} +2 -2
  15. package/dist/chunks/{index.BgObOSYj.js → index.CHVF-o0F.js} +1472 -1287
  16. package/dist/chunks/{index.CtrE2M7d.js → index.CrGSvvJa.js} +1 -1
  17. package/dist/chunks/{index.dUieB3Yz.js → index.DMEz-UrM.js} +1 -1
  18. package/dist/chunks/{index.DcCZNjYW.js → index.aQpIhFBj.js} +1 -1
  19. package/dist/chunks/{index.xGaexEHV.js → index.wxtgxm6M.js} +3 -3
  20. package/dist/chunks/{useMarkdown.Blw_Xs-O.js → useMarkdown.CW97u9fP.js} +6 -6
  21. package/dist/components/SassySaint/SassySaint.js +1 -1
  22. package/dist/index.js +4 -4
  23. package/dist/style.css +1 -1
  24. package/package.json +3 -3
  25. package/dist/chunks/ChatHistoryTable.DJWfMixM.js +0 -649
  26. package/dist/chunks/SettingsEntry.DLsBdG9c.js +0 -755
@@ -0,0 +1,964 @@
1
+ import { jsxs as n, jsx as e, Fragment as ue } from "react/jsx-runtime";
2
+ import { o as Te, h as fe, i as Se, x as ve, n as we, LOCAL_STORAGE_PREFIX as ge, LOCAL_STORAGE_SORT_MEMORY_DIRECTION as Ae, LOCAL_STORAGE_SORT_MEMORY_COLUMN as De, useUserMemories as Ie, useDeleteMemory as Le, useDeleteAllMemories as Me, te as _e, L as Ce, j as le, C as K, useUserPreferences as Oe, getCacheInfo as Re, isServiceWorkerEnabled as Pe, SETTINGS_TITLE as Be, S as X, CARDS as F, de as Ge, PROMPTS_DESCRIPTION as Ue, pe as He, getCurrentGeoLocation as $e, mutateCall as ye, handleServiceWorkerToggle as Ve, SERVICE_TYPES as xe } from "./index.CHVF-o0F.js";
3
+ import { E as be, e as J, ConfirmationPanel as ke, se as Ee, st as ze, useCapability as Fe, L as W } from "./App.Bu-CJnKe.js";
4
+ import We, { useState as c, useEffect as he, useRef as j, useLayoutEffect as te, useCallback as je } from "react";
5
+ import { j as Ye, D as qe, G as de, M as G, F as Xe, H as Je, l as Ke, U as Qe } from "./Table.D-giOzeS.js";
6
+ import k from "clsx";
7
+ function Ze({
8
+ value: a,
9
+ defaultValue: l,
10
+ finalValue: o,
11
+ onChange: s = () => {
12
+ },
13
+ initialControlledDelay: t = 0
14
+ }) {
15
+ const [d, g] = c(!1), [y, N] = c(
16
+ l !== void 0 ? l : o
17
+ ), T = (w) => {
18
+ N(w), s?.(w);
19
+ };
20
+ return he(() => {
21
+ (async () => a !== void 0 && !d && t > 0 && (await new Promise(
22
+ (w) => setTimeout(w, t)
23
+ ), g(!0)))();
24
+ }, [a, t, d]), a !== void 0 ? !d && t > 0 ? ["", s, !0] : [a, s, !0] : [y, T, !1];
25
+ }
26
+ const Ne = "av-text-area", et = "av-text-area-wrapper", me = "av-text-area-helper-text", tt = "av-text-area__control--right", rt = "av-text-area__control--left", at = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hidden px-4 py-7", ot = ({ mode: a }) => k({
27
+ "bg-surface-darker text-copy-lighter caret-copy-light": a === "dark",
28
+ "bg-surface-lighter text-copy-dark caret-copy-dark": a === "light",
29
+ "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": a === "system",
30
+ "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": a === "alt-system"
31
+ }), st = ({
32
+ focusMode: a
33
+ }) => k("focus:outline focus:outline-2 focus:outline-offset-2", {
34
+ "focus:outline-focus-dark": a === "dark",
35
+ "focus:outline-focus-light": a === "light",
36
+ "focus:outline-focus-light dark:focus:outline-focus-dark": a === "alt-system",
37
+ "focus:outline-focus-dark dark:focus:outline-focus-light": a === "system"
38
+ }), nt = ({
39
+ noBorder: a,
40
+ error: l
41
+ }) => k("border-2", {
42
+ "border-border-dark": !a && !l,
43
+ "focus:border-border-dark": !a && l,
44
+ "border-border-error-dark": !a && l,
45
+ "border-transparent": a
46
+ }), lt = ({
47
+ disabled: a,
48
+ raw: l,
49
+ error: o,
50
+ mode: s,
51
+ leftElement: t,
52
+ rightElement: d
53
+ }) => {
54
+ if (l)
55
+ return "";
56
+ if (a)
57
+ return k(
58
+ "transform translate-y-0 scale-100 absolute px-2 cursor-not-allowed opacity-50 font-medium",
59
+ {
60
+ "translate-x-[12px]": d === !0 && !t || !d && !t
61
+ }
62
+ );
63
+ if (!o)
64
+ return k(
65
+ "absolute px-2 cursor-text font-medium transform translate-y-0 scale-100",
66
+ {
67
+ "translate-x-[12px]": d === !0 && !t || !d && !t,
68
+ "text-copy-medium": s === "dark",
69
+ "text-copy-dark": s === "light",
70
+ "text-copy-dark dark:text-copy-medium": s === "system",
71
+ "text-copy-medium dark:text-copy-dark": s === "alt-system"
72
+ }
73
+ );
74
+ if (o)
75
+ return k(
76
+ "absolute px-2 cursor-text font-medium transform translate-y-0 scale-100",
77
+ {
78
+ "translate-x-[12px]": d === !0 && !t || !d && !t,
79
+ "text-copy-medium": s === "dark",
80
+ "text-copy-error-dark": s === "light",
81
+ "text-copy-error-dark dark:text-copy-error-light": s === "system",
82
+ "text-copy-medium dark:text-copy-error-dark": s === "alt-system"
83
+ }
84
+ );
85
+ }, it = ({
86
+ error: a,
87
+ raw: l,
88
+ mode: o,
89
+ disabled: s
90
+ }) => {
91
+ if (l)
92
+ return "";
93
+ if (s)
94
+ return k(
95
+ me,
96
+ "absolute px-2 cursor-not-allowed opacity-50 font-medium"
97
+ );
98
+ if (!a)
99
+ return k(me, "absolute px-2 font-medium", {
100
+ "text-copy-medium": o === "dark",
101
+ "text-copy-dark": o === "light",
102
+ "text-copy-dark dark:text-copy-medium": o === "system",
103
+ "text-copy-medium dark:text-copy-dark": o === "alt-system"
104
+ });
105
+ if (a)
106
+ return k(me, "absolute px-2 font-medium", {
107
+ "text-copy-error-light": o === "dark",
108
+ "text-copy-error-dark": o === "light",
109
+ "text-copy-error-dark dark:text-copy-error-light": o === "system",
110
+ "dark:text-copy-error-dark text-copy-error-light": o === "alt-system"
111
+ });
112
+ }, ct = ({
113
+ className: a,
114
+ textAreaClassName: l,
115
+ raw: o,
116
+ focusMode: s,
117
+ disabled: t,
118
+ noBorder: d,
119
+ error: g,
120
+ mode: y,
121
+ leftElement: N,
122
+ rightElement: T
123
+ }) => {
124
+ const w = o ? a : k(
125
+ "relative flex w-full flex-col justify-center",
126
+ et,
127
+ a
128
+ ), M = o ? k(l) : k(
129
+ Ne,
130
+ l,
131
+ at(),
132
+ ot({ mode: y }),
133
+ st({ focusMode: s }),
134
+ nt({
135
+ noBorder: d,
136
+ error: g
137
+ }),
138
+ {
139
+ "disabled:cursor-not-allowed disabled:opacity-50": t
140
+ }
141
+ ), O = o ? void 0 : "sr-only", C = lt({
142
+ disabled: t,
143
+ raw: o,
144
+ error: g,
145
+ mode: y,
146
+ rightElement: T,
147
+ leftElement: N
148
+ }), h = it({
149
+ error: g,
150
+ raw: o,
151
+ mode: y,
152
+ disabled: t
153
+ }), v = o ? void 0 : k(tt, "absolute"), x = o ? void 0 : k(rt, "absolute");
154
+ return {
155
+ wrapper: w,
156
+ textArea: M,
157
+ accessibleLabel: O,
158
+ visibleLabel: C,
159
+ helperText: h,
160
+ rightElement: v,
161
+ leftElement: x
162
+ };
163
+ }, dt = ({
164
+ scrollHeight: a,
165
+ currentHeight: l,
166
+ currentLabelOffset: o = 0,
167
+ currentHelperTextOffset: s = 0
168
+ }) => {
169
+ let t, d;
170
+ if (a > 0 && a !== l) {
171
+ const g = a - l, y = Math.abs(g / 24);
172
+ t = o + -1 * Math.sign(g) * (12 * y), d = s + Math.sign(g) * (12 * y);
173
+ }
174
+ return {
175
+ labelOffset: t,
176
+ helperTextOffset: d,
177
+ scrollHeight: a
178
+ };
179
+ }, pe = We.forwardRef(
180
+ ({
181
+ id: a,
182
+ name: l,
183
+ label: o,
184
+ error: s = !1,
185
+ raw: t = !1,
186
+ className: d,
187
+ textAreaClassName: g,
188
+ mode: y = "system",
189
+ focusMode: N = "system",
190
+ value: T,
191
+ defaultValue: w,
192
+ disabled: M = !1,
193
+ noBorder: O = !1,
194
+ labelId: C,
195
+ helperText: h = "",
196
+ helperTextOnFocus: v = !1,
197
+ rightElement: x,
198
+ leftElement: E,
199
+ onChange: U,
200
+ onFocus: I,
201
+ onBlur: S,
202
+ ...R
203
+ }, H) => {
204
+ const p = j(null), Y = Te([H, p]), [q, _] = fe(), [m, u] = fe(), L = j(80), P = j(-25), $ = j(null), re = j(30), ae = j(null), V = Se({ id: a, prefix: `${Ne}-` }), [oe, ie] = c(0), [se, ne] = c(0), [Q, Z] = c(
205
+ !!(!v && h)
206
+ ), r = `${l} error, ${h}`, i = ct({
207
+ className: d,
208
+ textAreaClassName: g,
209
+ error: s,
210
+ raw: t,
211
+ focusMode: N,
212
+ disabled: M,
213
+ noBorder: O,
214
+ mode: y,
215
+ rightElement: !!x,
216
+ leftElement: !!E
217
+ }), [b, ee] = Ze({
218
+ value: T,
219
+ initialControlledDelay: 20,
220
+ defaultValue: w,
221
+ onChange: (f) => {
222
+ U && U({
223
+ target: {
224
+ value: f
225
+ }
226
+ });
227
+ }
228
+ }), B = (f) => {
229
+ ee(f.target.value);
230
+ }, A = (f) => {
231
+ v && h && Z(!0), I && I(f);
232
+ }, D = (f) => {
233
+ v && h && !b && Z(!1), S && S(f);
234
+ };
235
+ return te(() => {
236
+ _ && _.width && ie(_.width + 18 + 10);
237
+ }, [_]), te(() => {
238
+ u && u.width && ne(u.width + 18 + 10);
239
+ }, [u]), te(() => {
240
+ t || p && p.current && b !== void 0 && (p.current.style.height = "inherit", p.current.style.height = p.current.scrollHeight + "px");
241
+ }, [b, t]), te(() => {
242
+ t || setTimeout(() => {
243
+ $?.current?.style.setProperty(
244
+ "--av-text-area-wrapper-transition",
245
+ b ? "none" : "all 0.2s ease-out"
246
+ );
247
+ }, 0);
248
+ }, [b, t]), te(() => {
249
+ if (!t && p && p.current && b !== void 0) {
250
+ const { labelOffset: f, helperTextOffset: z, scrollHeight: ce } = dt({
251
+ scrollHeight: p.current.scrollHeight,
252
+ currentHeight: L.current,
253
+ currentLabelOffset: P.current,
254
+ currentHelperTextOffset: re.current
255
+ });
256
+ f && (P.current = f, $?.current?.style.setProperty(
257
+ "--av-text-area-label",
258
+ `${f}px`
259
+ )), z && (re.current = z, ae?.current?.style.setProperty(
260
+ "--av-text-area-helper-text",
261
+ `${z}px`
262
+ )), L.current = ce || L.current;
263
+ }
264
+ }, [b, t]), u.width > 0 && $?.current?.style.setProperty(
265
+ "--tw-translate-x",
266
+ `${12 + u.width + 5}px`
267
+ ), /* @__PURE__ */ n("div", { className: i.wrapper, children: [
268
+ /* @__PURE__ */ e(
269
+ "label",
270
+ {
271
+ htmlFor: V,
272
+ id: C,
273
+ className: i.accessibleLabel,
274
+ children: o
275
+ }
276
+ ),
277
+ E && /* @__PURE__ */ e(
278
+ "div",
279
+ {
280
+ ref: m,
281
+ className: i.leftElement,
282
+ children: E
283
+ }
284
+ ),
285
+ /* @__PURE__ */ e(
286
+ "textarea",
287
+ {
288
+ ref: Y,
289
+ id: V,
290
+ name: l,
291
+ disabled: M,
292
+ placeholder: t ? void 0 : " ",
293
+ className: i.textArea,
294
+ rows: 1,
295
+ ...h && { "aria-describedby": `${V}-helper` },
296
+ ...s && { "aria-invalid": "true" },
297
+ ...x && !E && !t && { style: { paddingRight: oe } },
298
+ ...E && !x && !t && { style: { paddingLeft: se } },
299
+ ...x && E && !t && {
300
+ style: {
301
+ paddingRight: oe,
302
+ paddingLeft: se
303
+ }
304
+ },
305
+ value: b,
306
+ onChange: B,
307
+ onFocus: A,
308
+ onBlur: D,
309
+ ...R
310
+ }
311
+ ),
312
+ !t && /* @__PURE__ */ e(
313
+ "label",
314
+ {
315
+ ref: $,
316
+ "aria-hidden": !0,
317
+ htmlFor: V,
318
+ className: `${i.visibleLabel}`,
319
+ children: o
320
+ }
321
+ ),
322
+ Q && /* @__PURE__ */ e(
323
+ "div",
324
+ {
325
+ ref: ae,
326
+ id: `${V}-helper`,
327
+ className: i.helperText,
328
+ children: h
329
+ }
330
+ ),
331
+ x && /* @__PURE__ */ e(
332
+ "div",
333
+ {
334
+ ref: q,
335
+ className: i.rightElement,
336
+ children: x
337
+ }
338
+ ),
339
+ s && h && /* @__PURE__ */ e(ve, { politeness: "polite", clearAnnouncementDelay: 500, children: r })
340
+ ] });
341
+ }
342
+ );
343
+ pe.displayName = "TextArea";
344
+ /*!
345
+ @versini/ui-textarea v5.0.1
346
+ © 2025 gizmette.com
347
+ */
348
+ try {
349
+ window.__VERSINI_UI_TEXTAREA__ || (window.__VERSINI_UI_TEXTAREA__ = {
350
+ version: "5.0.1",
351
+ buildTime: "09/01/2025 04:01 PM EDT",
352
+ homepage: "https://github.com/aversini/ui-components",
353
+ license: "MIT"
354
+ });
355
+ } catch {
356
+ }
357
+ const mt = ({
358
+ open: a,
359
+ onOpenChange: l,
360
+ user: o
361
+ }) => {
362
+ const { getAccessToken: s } = we(), [t] = c(void 0), [d, g] = be({
363
+ key: ge + Ae,
364
+ initialValue: J.DESC
365
+ }), [y, N] = be({
366
+ key: ge + De,
367
+ initialValue: "createdAt"
368
+ }), [T, w] = c(d || J.DESC), [M, O] = c(
369
+ y || "createdAt"
370
+ ), { data: C, isLoading: h, isError: v } = Ie({
371
+ user: o,
372
+ query: t,
373
+ getAccessToken: s,
374
+ enabled: a
375
+ }), x = Le({ getAccessToken: s }), E = Me({ getAccessToken: s }), [U, I] = c(!1), S = j(null), [R, H] = c(!1), p = (m, u, L) => {
376
+ S.current = { id: m, text: u, createdAt: L }, I(!0);
377
+ }, Y = () => {
378
+ S.current && x.mutate({ user: o, memoryId: S.current.id });
379
+ }, q = () => {
380
+ o && H(!0);
381
+ }, _ = () => {
382
+ o && E.mutate({ user: o });
383
+ };
384
+ return /* @__PURE__ */ n(ue, { children: [
385
+ /* @__PURE__ */ n(
386
+ ke,
387
+ {
388
+ showConfirmation: U,
389
+ setShowConfirmation: I,
390
+ action: Y,
391
+ customStrings: {
392
+ title: "Delete memory",
393
+ confirmAction: "Delete",
394
+ cancelAction: "Cancel"
395
+ },
396
+ children: [
397
+ /* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete this memory?" }),
398
+ /* @__PURE__ */ n("ul", { className: "m-0 mt-2 list-disc list-inside text-xs opacity-80", children: [
399
+ /* @__PURE__ */ n("li", { children: [
400
+ "Excerpt: ",
401
+ S.current?.text?.slice(0, 80) || ""
402
+ ] }),
403
+ /* @__PURE__ */ n("li", { children: [
404
+ "Created:",
405
+ " ",
406
+ S.current?.createdAt ? new Date(S.current.createdAt).toLocaleString() : "-"
407
+ ] })
408
+ ] })
409
+ ]
410
+ }
411
+ ),
412
+ /* @__PURE__ */ e(
413
+ ke,
414
+ {
415
+ showConfirmation: R,
416
+ setShowConfirmation: H,
417
+ action: _,
418
+ customStrings: {
419
+ title: "Delete all memories",
420
+ confirmAction: "Delete all",
421
+ cancelAction: "Cancel"
422
+ },
423
+ children: /* @__PURE__ */ e("p", { className: "m-0", children: "This will permanently delete all memories for this user. This action cannot be undone." })
424
+ }
425
+ ),
426
+ /* @__PURE__ */ e(
427
+ Ee,
428
+ {
429
+ open: a,
430
+ onOpenChange: (m) => l(m),
431
+ title: "User Memories",
432
+ animation: !0,
433
+ animationType: "fade",
434
+ footer: /* @__PURE__ */ n(Ce, { columnGap: 2, alignHorizontal: "flex-end", children: [
435
+ /* @__PURE__ */ e(le, { children: /* @__PURE__ */ e(
436
+ K,
437
+ {
438
+ mode: "dark",
439
+ variant: "secondary",
440
+ noBorder: !0,
441
+ focusMode: "light",
442
+ onClick: () => l(!1),
443
+ children: "Close"
444
+ }
445
+ ) }),
446
+ /* @__PURE__ */ e(le, { children: /* @__PURE__ */ e(
447
+ K,
448
+ {
449
+ mode: "dark",
450
+ focusMode: "light",
451
+ variant: "danger",
452
+ disabled: E.isPending || (C?.total ?? 0) === 0,
453
+ onClick: q,
454
+ children: "Delete All"
455
+ }
456
+ ) })
457
+ ] }),
458
+ children: /* @__PURE__ */ n("div", { className: "pt-2", children: [
459
+ h && /* @__PURE__ */ e("p", { className: "m-0", children: "Loading memories..." }),
460
+ v && /* @__PURE__ */ e("p", { className: "m-0 text-red-500", children: "Failed to load memories." }),
461
+ !h && !v && (C && C.items.length > 0 ? /* @__PURE__ */ n(Ye, { compact: !0, stickyHeader: !0, children: [
462
+ /* @__PURE__ */ e(qe, { children: /* @__PURE__ */ n(de, { children: [
463
+ /* @__PURE__ */ e(G, { className: "sr-only", children: "Row" }),
464
+ /* @__PURE__ */ e(G, { children: "Memory" }),
465
+ /* @__PURE__ */ e(
466
+ Xe,
467
+ {
468
+ buttonClassName: "text-xs sm:text-sm",
469
+ cellId: "createdAt",
470
+ align: "left",
471
+ sortDirection: T,
472
+ sortedCell: M,
473
+ onClick: () => {
474
+ O("createdAt"), N("createdAt"), w((m) => {
475
+ const u = m === J.ASC ? J.DESC : J.ASC;
476
+ return g(u), u;
477
+ });
478
+ },
479
+ children: "Date"
480
+ }
481
+ ),
482
+ /* @__PURE__ */ e(G, { align: "right", children: "Actions" })
483
+ ] }) }),
484
+ /* @__PURE__ */ e(Je, { children: [...C.items].sort((m, u) => {
485
+ const L = m.createdAt ? new Date(m.createdAt).getTime() : 0, P = u.createdAt ? new Date(u.createdAt).getTime() : 0;
486
+ return T === J.ASC ? L - P : P - L;
487
+ }).map((m, u) => /* @__PURE__ */ n(de, { children: [
488
+ /* @__PURE__ */ e(G, { className: "text-gray-400", children: u + 1 }),
489
+ /* @__PURE__ */ e(
490
+ G,
491
+ {
492
+ className: "max-w-[100px] text-white sm:max-w-full text-xs sm:text-sm",
493
+ style: {
494
+ wordBreak: "break-word"
495
+ },
496
+ children: m.text
497
+ }
498
+ ),
499
+ /* @__PURE__ */ e(
500
+ G,
501
+ {
502
+ component: "th",
503
+ scope: "row",
504
+ className: "text-gray-400 sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none",
505
+ children: m.createdAt ? new Date(m.createdAt).toLocaleDateString() : "-"
506
+ }
507
+ ),
508
+ /* @__PURE__ */ e(G, { className: "align-top", align: "right", children: /* @__PURE__ */ e(
509
+ ze,
510
+ {
511
+ label: "Delete memory",
512
+ mode: "alt-system",
513
+ placement: "top",
514
+ trigger: /* @__PURE__ */ e(
515
+ _e,
516
+ {
517
+ focusMode: "alt-system",
518
+ noBorder: !0,
519
+ label: "Delete memory",
520
+ variant: "primary",
521
+ iconClassName: "text-red-700 dark:text-red-500",
522
+ disabled: x.isPending,
523
+ onClick: () => p(
524
+ m.memoryId,
525
+ m.text,
526
+ m.createdAt
527
+ ),
528
+ children: /* @__PURE__ */ e(Ke, { size: "size-3", monotone: !0 })
529
+ }
530
+ )
531
+ }
532
+ ) })
533
+ ] }, m.memoryId)) }),
534
+ /* @__PURE__ */ e(Qe, { children: /* @__PURE__ */ e(de, { children: /* @__PURE__ */ n(G, { colSpan: 4, children: [
535
+ C.total,
536
+ " memor",
537
+ C.total === 1 ? "y" : "ies"
538
+ ] }) }) })
539
+ ] }) : /* @__PURE__ */ e("p", { className: "m-0 italic opacity-70", children: "No memories stored." }))
540
+ ] })
541
+ }
542
+ )
543
+ ] });
544
+ }, xt = ({
545
+ open: a,
546
+ onOpenChange: l
547
+ }) => {
548
+ const { getAccessToken: o, user: s } = we(), {
549
+ data: t,
550
+ isSuccess: d,
551
+ refetch: g
552
+ } = Oe({
553
+ user: s?.username,
554
+ getAccessToken: o
555
+ }), [y, N] = c({
556
+ loadingLocation: !1
557
+ }), [T, w] = c({
558
+ prompts: []
559
+ }), [M, O] = c(""), [C, h] = c(""), [v, x] = c(!1), [E, U] = c(!1), [I, S] = c(!1), [R, H] = c(!1), [p, Y] = c(null), [q, _] = c(!1), [m, u] = c(!1), [L, P] = c(!1), $ = Fe(He.TOOL.MEMORIES), re = (r) => {
560
+ u(r);
561
+ }, ae = (r) => {
562
+ x(r);
563
+ }, V = (r) => {
564
+ $ && U(r);
565
+ }, oe = (r) => {
566
+ H(r);
567
+ }, ie = async (r) => {
568
+ r.preventDefault();
569
+ try {
570
+ await ye({
571
+ accessToken: await o(),
572
+ type: xe.SET_USER_PREFERENCES,
573
+ params: {
574
+ user: s?.username,
575
+ instructions: M,
576
+ location: C,
577
+ provider: t?.provider,
578
+ tags: T.prompts,
579
+ sendOnEnter: v,
580
+ useMemory: E,
581
+ showDetails: m
582
+ }
583
+ }), R !== I && (await Ve(R), S(R)), g(), N({
584
+ loadingLocation: !1
585
+ });
586
+ } catch {
587
+ }
588
+ }, se = async () => {
589
+ N({
590
+ loadingLocation: !0
591
+ }), h("...");
592
+ try {
593
+ const r = Date.now(), i = await $e(), b = await ye({
594
+ accessToken: await o(),
595
+ type: xe.GET_LOCATION,
596
+ params: {
597
+ latitude: i.latitude,
598
+ longitude: i.longitude
599
+ }
600
+ }), B = Date.now() - r;
601
+ if (B < 2e3 && await new Promise((A) => setTimeout(A, 2e3 - B)), b.status === 200) {
602
+ const { city: A, state: D, country: f, displayName: z } = b.data, ce = A && D && f ? `${A}, ${D}, ${f}` : z;
603
+ N({
604
+ loadingLocation: !1
605
+ }), h(ce);
606
+ } else
607
+ N({
608
+ loadingLocation: !1
609
+ });
610
+ } catch {
611
+ }
612
+ }, ne = () => {
613
+ g(), l(!1);
614
+ }, Q = ({
615
+ enabled: r = !1,
616
+ privateChat: i = !1,
617
+ clipboardAccess: b = !1,
618
+ ...ee
619
+ }) => {
620
+ w((B) => {
621
+ const A = B.prompts, D = {
622
+ ...ee,
623
+ enabled: r,
624
+ privateChat: i,
625
+ clipboardAccess: b
626
+ };
627
+ b ? D.content = D.content.replace(/{{clipboard}}/g, "") + " {{clipboard}}" : D.content = D.content.replace(/{{clipboard}}/g, "");
628
+ const f = A.findIndex((z) => z.slot === ee.slot);
629
+ return f === -1 ? {
630
+ ...B,
631
+ prompts: [...A, { ...D }]
632
+ } : (A[f] = D, {
633
+ ...B,
634
+ prompts: [...A]
635
+ });
636
+ });
637
+ }, Z = je(async () => {
638
+ try {
639
+ _(!0);
640
+ const r = await Re();
641
+ Y(r);
642
+ } catch {
643
+ } finally {
644
+ _(!1);
645
+ }
646
+ }, []);
647
+ return he(() => {
648
+ if (!t)
649
+ return;
650
+ t.instructions && O(t.instructions), t.location && h(t.location), t.tags && w({ prompts: t.tags }), t.sendOnEnter !== void 0 && x(t.sendOnEnter), t.useMemory !== void 0 && U(t.useMemory), t.showDetails !== void 0 && u(t.showDetails);
651
+ const r = Pe();
652
+ S(r), H(r);
653
+ }, [t]), he(() => {
654
+ I ? Z() : Y(null);
655
+ }, [I, Z]), d ? /* @__PURE__ */ n(ue, { children: [
656
+ /* @__PURE__ */ n(
657
+ Ee,
658
+ {
659
+ open: a,
660
+ onOpenChange: ne,
661
+ title: Be,
662
+ animation: !0,
663
+ animationType: "fade",
664
+ footer: /* @__PURE__ */ n(
665
+ Ce,
666
+ {
667
+ columnGap: 2,
668
+ alignHorizontal: "flex-end",
669
+ className: "pb-8 sm:pb-0",
670
+ children: [
671
+ /* @__PURE__ */ e(le, { children: /* @__PURE__ */ e(
672
+ K,
673
+ {
674
+ mode: "dark",
675
+ variant: "secondary",
676
+ focusMode: "light",
677
+ noBorder: !0,
678
+ onClick: ne,
679
+ children: "Cancel"
680
+ }
681
+ ) }),
682
+ /* @__PURE__ */ e(le, { children: /* @__PURE__ */ e(
683
+ K,
684
+ {
685
+ mode: "dark",
686
+ focusMode: "light",
687
+ onClick: async (r) => {
688
+ l(!1), await ie(r);
689
+ },
690
+ children: "Save"
691
+ }
692
+ ) })
693
+ ]
694
+ }
695
+ ),
696
+ children: [
697
+ /* @__PURE__ */ n(
698
+ X,
699
+ {
700
+ header: F.SETTINGS_DETAILS.TITLE,
701
+ className: "prose-dark dark:prose-lighter",
702
+ noBorder: !0,
703
+ children: [
704
+ /* @__PURE__ */ e("p", { className: "text-sm", children: F.SETTINGS_DETAILS.DETAILS }),
705
+ /* @__PURE__ */ e(
706
+ W,
707
+ {
708
+ narrow: !0,
709
+ className: "mt-2",
710
+ label: "Show Message Statistics",
711
+ name: "show-message-statistics",
712
+ onChange: re,
713
+ checked: m
714
+ }
715
+ ),
716
+ /* @__PURE__ */ e("p", { className: "text-sm mt-5", children: F.SETTINGS_DETAILS.SEND_ON_ENTER }),
717
+ /* @__PURE__ */ e(
718
+ W,
719
+ {
720
+ narrow: !0,
721
+ className: "mt-2",
722
+ label: "Send Message on Enter",
723
+ name: "send-message-on-enter",
724
+ onChange: ae,
725
+ checked: v
726
+ }
727
+ ),
728
+ $ && /* @__PURE__ */ n(ue, { children: [
729
+ /* @__PURE__ */ e("p", { className: "text-sm mt-5", children: F.SETTINGS_DETAILS.USE_MEMORY }),
730
+ /* @__PURE__ */ e(
731
+ W,
732
+ {
733
+ narrow: !0,
734
+ className: "mt-2",
735
+ label: "Use Memory",
736
+ name: "use-memory",
737
+ onChange: V,
738
+ checked: E
739
+ }
740
+ ),
741
+ E && /* @__PURE__ */ e(
742
+ K,
743
+ {
744
+ variant: "secondary",
745
+ noBorder: !0,
746
+ size: "small",
747
+ className: "mt-3",
748
+ onClick: () => P(!0),
749
+ children: "Manage Memories"
750
+ }
751
+ )
752
+ ] })
753
+ ]
754
+ }
755
+ ),
756
+ /* @__PURE__ */ n(
757
+ X,
758
+ {
759
+ header: "Custom Instructions",
760
+ className: "prose-dark dark:prose-lighter mt-4",
761
+ noBorder: !0,
762
+ children: [
763
+ /* @__PURE__ */ n("p", { className: "text-sm", children: [
764
+ "What would you like ",
765
+ /* @__PURE__ */ e("em", { children: Ge }),
766
+ " to know about you to provide better responses?"
767
+ ] }),
768
+ /* @__PURE__ */ e(
769
+ pe,
770
+ {
771
+ mode: "alt-system",
772
+ autoCapitalize: "off",
773
+ autoComplete: "off",
774
+ autoCorrect: "off",
775
+ name: "customInstructions",
776
+ label: "Custom Instructions",
777
+ value: M,
778
+ onChange: (r) => {
779
+ O(r.target.value);
780
+ },
781
+ helperText: "Press ENTER to add a new line."
782
+ }
783
+ )
784
+ ]
785
+ }
786
+ ),
787
+ /* @__PURE__ */ n(
788
+ X,
789
+ {
790
+ header: "Location",
791
+ className: "prose-dark dark:prose-lighter mt-4",
792
+ noBorder: !0,
793
+ children: [
794
+ /* @__PURE__ */ e("p", { className: "text-sm", children: "You can share your location to receive customized responses based on your area." }),
795
+ /* @__PURE__ */ e(
796
+ pe,
797
+ {
798
+ mode: "alt-system",
799
+ name: "location",
800
+ label: "Location",
801
+ value: C,
802
+ onChange: (r) => {
803
+ h(r.target.value);
804
+ },
805
+ helperText: "Enter your location or press auto-detect."
806
+ }
807
+ ),
808
+ /* @__PURE__ */ e(
809
+ K,
810
+ {
811
+ className: "mt-2",
812
+ size: "small",
813
+ noBorder: !0,
814
+ variant: "secondary",
815
+ disabled: y.loadingLocation,
816
+ onClick: se,
817
+ children: y.loadingLocation ? "Detecting..." : "Auto-detect"
818
+ }
819
+ )
820
+ ]
821
+ }
822
+ ),
823
+ /* @__PURE__ */ n(
824
+ X,
825
+ {
826
+ header: F.SETTINGS_PROMPTS.TITLE,
827
+ className: "prose-dark dark:prose-lighter mt-4",
828
+ noBorder: !0,
829
+ children: [
830
+ /* @__PURE__ */ e("p", { className: "text-sm", children: Ue }),
831
+ T.prompts && T.prompts.slice(0, 3).map((r) => /* @__PURE__ */ n(
832
+ X,
833
+ {
834
+ mode: "dark",
835
+ noBorder: !0,
836
+ header: r.label.replace("...", ""),
837
+ className: "prose-light mb-2",
838
+ children: [
839
+ /* @__PURE__ */ e("p", { className: "text-sm", children: r.description }),
840
+ /* @__PURE__ */ e(
841
+ W,
842
+ {
843
+ narrow: !0,
844
+ mode: "dark",
845
+ focusMode: "light",
846
+ className: "mt-2",
847
+ noBorder: !0,
848
+ label: "Enabled",
849
+ name: r.slot.toString(),
850
+ onChange: (i) => {
851
+ Q({
852
+ ...r,
853
+ enabled: i
854
+ });
855
+ },
856
+ checked: r.enabled
857
+ }
858
+ ),
859
+ /* @__PURE__ */ e(
860
+ W,
861
+ {
862
+ narrow: !0,
863
+ mode: "dark",
864
+ focusMode: "light",
865
+ className: "mt-2",
866
+ noBorder: !0,
867
+ label: "Private Chat",
868
+ name: `private-${r.slot.toString()}`,
869
+ onChange: (i) => {
870
+ Q({
871
+ ...r,
872
+ privateChat: i
873
+ });
874
+ },
875
+ checked: r.privateChat
876
+ }
877
+ ),
878
+ /* @__PURE__ */ e(
879
+ W,
880
+ {
881
+ narrow: !0,
882
+ mode: "dark",
883
+ focusMode: "light",
884
+ className: "mt-2",
885
+ noBorder: !0,
886
+ label: "Use Clipboard",
887
+ name: `clipboard-${r.slot.toString()}`,
888
+ onChange: (i) => {
889
+ Q({
890
+ ...r,
891
+ clipboardAccess: i
892
+ });
893
+ },
894
+ checked: r.clipboardAccess
895
+ }
896
+ )
897
+ ]
898
+ },
899
+ `prompt-slot-${r.slot}`
900
+ ))
901
+ ]
902
+ }
903
+ ),
904
+ /* @__PURE__ */ n(
905
+ X,
906
+ {
907
+ header: F.SETTINGS_CACHING.TITLE,
908
+ className: "prose-dark dark:prose-lighter mt-4 ",
909
+ noBorder: !0,
910
+ children: [
911
+ /* @__PURE__ */ e("p", { className: "text-sm", children: F.SETTINGS_CACHING.DESCRIPTION }),
912
+ /* @__PURE__ */ e(
913
+ W,
914
+ {
915
+ narrow: !0,
916
+ className: "mt-2",
917
+ label: "Enable Assets Caching",
918
+ name: "enable-service-worker",
919
+ onChange: oe,
920
+ checked: R
921
+ }
922
+ ),
923
+ I && /* @__PURE__ */ n("div", { className: "mt-4 p-3 border border-dashed border-neutral-700 dark:border-neutral-400 rounded @container/optimizations", children: [
924
+ /* @__PURE__ */ e("h3", { className: "m-0 mb-2 text-xs uppercase opacity-70", children: "Cache Info" }),
925
+ p ? /* @__PURE__ */ n("div", { className: "text-xs space-y-2", children: [
926
+ /* @__PURE__ */ n("p", { className: "m-0", children: [
927
+ "Version: ",
928
+ /* @__PURE__ */ e("strong", { children: p.version })
929
+ ] }),
930
+ /* @__PURE__ */ n("p", { className: "m-0", children: [
931
+ "Total Items: ",
932
+ /* @__PURE__ */ e("strong", { children: p.totalItems })
933
+ ] }),
934
+ p.caches.map((r) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("ul", { className: "not-prose font-mono mt-2 list-none w-[95cqw]", children: r.urls.map((i) => /* @__PURE__ */ e(
935
+ "li",
936
+ {
937
+ className: "truncate text-xs text-copy-dark dark:text-copy-light overflow-hidden text-ellipsis",
938
+ title: i,
939
+ children: new URL(i).pathname
940
+ },
941
+ i
942
+ )) }) }, r.name)),
943
+ p.totalItems === 0 && !q && /* @__PURE__ */ e("p", { className: "italic m-0 opacity-70", children: "No cached assets yet." })
944
+ ] }) : /* @__PURE__ */ e("p", { className: "text-xs opacity-70 m-0", children: q ? "Loading cache info..." : "No cache info available." })
945
+ ] })
946
+ ]
947
+ }
948
+ )
949
+ ]
950
+ }
951
+ ),
952
+ /* @__PURE__ */ e(
953
+ mt,
954
+ {
955
+ open: L,
956
+ onOpenChange: P,
957
+ user: s?.username
958
+ }
959
+ )
960
+ ] }) : null;
961
+ };
962
+ export {
963
+ xt as SettingsPanel
964
+ };