@versini/sassysaint 8.53.0 → 8.55.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.BRYsGtBY.js → AboutChangelog.5VfZIj9p.js} +2 -2
  2. package/dist/chunks/{AboutEntry.Dbhaf-VP.js → AboutEntry.dO_oMKfh.js} +7 -7
  3. package/dist/chunks/{App.BQH2Wmtd.js → App.w6_jLyPE.js} +1460 -1404
  4. package/dist/chunks/{Chart.3fOYewQg.js → Chart.C7nKW8WX.js} +2 -2
  5. package/dist/chunks/{ChatBubbleAssistant.BP8YviQp.js → ChatBubbleAssistant.Bk03cDqK.js} +4 -4
  6. package/dist/chunks/{ChatBubbleUser.DiRFVYRm.js → ChatBubbleUser.CDNqDcYA.js} +3 -3
  7. package/dist/chunks/{ChatHistoryTable.BEG5lXsw.js → ChatHistoryTable.Xi9Mfvf4.js} +3 -3
  8. package/dist/chunks/HistoryEntry.1-RwtIjk.js +291 -0
  9. package/dist/chunks/{ProfileEntry.DCYv91ms.js → ProfileEntry.i8nP_-yc.js} +2 -2
  10. package/dist/chunks/SettingsEntry.Bl5OwncD.js +777 -0
  11. package/dist/chunks/{Table.DrJ2gUQm.js → Table.DqF6iZRq.js} +2 -2
  12. package/dist/chunks/{UsageEntry.Bhzo6gzh.js → UsageEntry.BDiutgbn.js} +3 -3
  13. package/dist/chunks/UserMemoriesPanel.BXJmOUIb.js +197 -0
  14. package/dist/chunks/{index.CYSNaM4J.js → index.B4ADsXSu.js} +5 -5
  15. package/dist/chunks/{index.BB9bYKdy.js → index.BV5DU2jx.js} +2 -2
  16. package/dist/chunks/{index.7kLmHDKd.js → index.CQCqlvg2.js} +1 -1
  17. package/dist/chunks/{index.DEmU-2wd.js → index.Czo97DsJ.js} +1 -1
  18. package/dist/chunks/{index.BJoXUuen.js → index.DCWKShPd.js} +1 -1
  19. package/dist/chunks/{index.C4W5Hfeo.js → index.Ddic88Dj.js} +1 -1
  20. package/dist/chunks/{index.B5vAQtga.js → index.Dy81-Yet.js} +3 -3
  21. package/dist/chunks/{useMarkdown.CMlnPnYz.js → useMarkdown.mJBa7hMR.js} +6 -6
  22. package/dist/components/SassySaint/SassySaint.js +1 -1
  23. package/dist/index.js +4 -4
  24. package/package.json +3 -3
  25. package/dist/chunks/HistoryEntry.D1z7kvRb.js +0 -282
  26. package/dist/chunks/SettingsEntry.B-O4KsHm.js +0 -964
@@ -1,964 +0,0 @@
1
- import { jsxs as l, 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 ne, 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, le as He, getCurrentGeoLocation as $e, mutateCall as ye, handleServiceWorkerToggle as Ve, SERVICE_TYPES as xe } from "./index.CYSNaM4J.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.BQH2Wmtd.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.DrJ2gUQm.js";
6
- import k from "clsx";
7
- function Ze({
8
- value: a,
9
- defaultValue: n,
10
- finalValue: o,
11
- onChange: s = () => {
12
- },
13
- initialControlledDelay: t = 0
14
- }) {
15
- const [d, g] = c(!1), [y, N] = c(
16
- n !== void 0 ? n : 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
- }), lt = ({
39
- noBorder: a,
40
- error: n
41
- }) => k("border-2", {
42
- "border-border-dark": !a && !n,
43
- "focus:border-border-dark": !a && n,
44
- "border-border-error-dark": !a && n,
45
- "border-transparent": a
46
- }), nt = ({
47
- disabled: a,
48
- raw: n,
49
- error: o,
50
- mode: s,
51
- leftElement: t,
52
- rightElement: d
53
- }) => {
54
- if (n)
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: n,
88
- mode: o,
89
- disabled: s
90
- }) => {
91
- if (n)
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: n,
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(n) : k(
129
- Ne,
130
- n,
131
- at(),
132
- ot({ mode: y }),
133
- st({ focusMode: s }),
134
- lt({
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 = nt({
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: n,
166
- currentLabelOffset: o = 0,
167
- currentHelperTextOffset: s = 0
168
- }) => {
169
- let t, d;
170
- if (a > 0 && a !== n) {
171
- const g = a - n, 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: n,
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, le] = c(0), [Q, Z] = c(
205
- !!(!v && h)
206
- ), r = `${n} 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 && le(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__ */ l("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: n,
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: n,
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__ */ l(ue, { children: [
385
- /* @__PURE__ */ l(
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__ */ l("ul", { className: "m-0 mt-2 list-disc list-inside text-xs opacity-80", children: [
399
- /* @__PURE__ */ l("li", { children: [
400
- "Excerpt: ",
401
- S.current?.text?.slice(0, 80) || ""
402
- ] }),
403
- /* @__PURE__ */ l("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) => n(m),
431
- title: "User Memories",
432
- animation: !0,
433
- animationType: "fade",
434
- footer: /* @__PURE__ */ l(Ce, { columnGap: 2, alignHorizontal: "flex-end", children: [
435
- /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(
436
- K,
437
- {
438
- mode: "dark",
439
- variant: "secondary",
440
- noBorder: !0,
441
- focusMode: "light",
442
- onClick: () => n(!1),
443
- children: "Close"
444
- }
445
- ) }),
446
- /* @__PURE__ */ e(ne, { 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__ */ l("div", { className: "flex flex-col sm:flex-row max-h-[75vh] min-h-[60vh] 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__ */ l(Ye, { compact: !0, stickyHeader: !0, stickyFooter: !0, children: [
462
- /* @__PURE__ */ e(qe, { children: /* @__PURE__ */ l(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__ */ l(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__ */ l(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: n
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
- }, le = () => {
613
- g(), n(!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__ */ l(ue, { children: [
656
- /* @__PURE__ */ l(
657
- Ee,
658
- {
659
- open: a,
660
- onOpenChange: le,
661
- title: Be,
662
- animation: !0,
663
- animationType: "fade",
664
- footer: /* @__PURE__ */ l(
665
- Ce,
666
- {
667
- columnGap: 2,
668
- alignHorizontal: "flex-end",
669
- className: "pb-8 sm:pb-0",
670
- children: [
671
- /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(
672
- K,
673
- {
674
- mode: "dark",
675
- variant: "secondary",
676
- focusMode: "light",
677
- noBorder: !0,
678
- onClick: le,
679
- children: "Cancel"
680
- }
681
- ) }),
682
- /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(
683
- K,
684
- {
685
- mode: "dark",
686
- focusMode: "light",
687
- onClick: async (r) => {
688
- n(!1), await ie(r);
689
- },
690
- children: "Save"
691
- }
692
- ) })
693
- ]
694
- }
695
- ),
696
- children: [
697
- /* @__PURE__ */ l(
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__ */ l(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__ */ l(
757
- X,
758
- {
759
- header: "Custom Instructions",
760
- className: "prose-dark dark:prose-lighter mt-4",
761
- noBorder: !0,
762
- children: [
763
- /* @__PURE__ */ l("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__ */ l(
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__ */ l(
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__ */ l(
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__ */ l(
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__ */ l("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__ */ l("div", { className: "text-xs space-y-2", children: [
926
- /* @__PURE__ */ l("p", { className: "m-0", children: [
927
- "Version: ",
928
- /* @__PURE__ */ e("strong", { children: p.version })
929
- ] }),
930
- /* @__PURE__ */ l("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
- };