@versini/sassysaint 8.58.1 → 8.59.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 (27) hide show
  1. package/dist/chunks/{AboutChangelog.BM1-zFZM.js → AboutChangelog.VIMWfrJ2.js} +2 -2
  2. package/dist/chunks/{AboutEntry.DfLsDzG1.js → AboutEntry.HhBVaghX.js} +10 -10
  3. package/dist/chunks/{App.Balhn4jc.js → App.DFkumxrG.js} +1798 -1780
  4. package/dist/chunks/{Chart.B4r5Joie.js → Chart.DyiU5Qev.js} +2 -2
  5. package/dist/chunks/{ChatBubbleAssistant.B3aLcyR7.js → ChatBubbleAssistant.a1OalMkY.js} +4 -4
  6. package/dist/chunks/{ChatBubbleUser.L2nrTTCp.js → ChatBubbleUser.DP50erQL.js} +3 -3
  7. package/dist/chunks/{ChatHistoryTable.BY5_43Ex.js → ChatHistoryTable.9NfCFVTm.js} +5 -8
  8. package/dist/chunks/{HistoryEntry.vZ-0q0SU.js → HistoryEntry.Dz-6Alzn.js} +14 -14
  9. package/dist/chunks/{ProfileEntry.CWyib1bA.js → ProfileEntry.DJ4q6KoG.js} +2 -2
  10. package/dist/chunks/SettingsEntry.Cc0vofff.js +430 -0
  11. package/dist/chunks/{Table.BP4ZK6Pk.js → Table.CGJz3l0P.js} +2 -2
  12. package/dist/chunks/{UsageEntry.D7MV-eCu.js → UsageEntry.B6zt1DS_.js} +3 -3
  13. package/dist/chunks/UserMemoriesPanel.C2262GRv.js +693 -0
  14. package/dist/chunks/{index.BeBixuPU.js → index.6QVNoWZY.js} +616 -584
  15. package/dist/chunks/{index.Bc-X18su.js → index.BlzmTlvN.js} +2 -2
  16. package/dist/chunks/{index.CBnN5_87.js → index.CGcokH1z.js} +3 -3
  17. package/dist/chunks/{index.DbpavyRg.js → index.CV96FPnP.js} +1 -1
  18. package/dist/chunks/{index.CLbzehfM.js → index.D69nnw0C.js} +1 -1
  19. package/dist/chunks/{index.B5p62t9I.js → index.DXesyWpt.js} +1 -1
  20. package/dist/chunks/{index.C6J55Ybr.js → index.en8Vui5r.js} +1 -1
  21. package/dist/chunks/{useMarkdown.BaYRZB8J.js → useMarkdown.DRQL-Q_k.js} +6 -6
  22. package/dist/components/SassySaint/SassySaint.js +1 -1
  23. package/dist/index.js +4 -4
  24. package/dist/style.css +1 -1
  25. package/package.json +3 -3
  26. package/dist/chunks/SettingsEntry.cDiKWcA-.js +0 -777
  27. package/dist/chunks/UserMemoriesPanel.CGv5qTeN.js +0 -197
@@ -0,0 +1,693 @@
1
+ import { jsxs as m, jsx as e, Fragment as we } from "react/jsx-runtime";
2
+ import { I as ve, o as Ce, h as re, i as Ae, x as Ee, L as $, j as H, C as X, n as Me, LOCAL_STORAGE_PREFIX as oe, LOCAL_STORAGE_SORT_MEMORY_DIRECTION as Te, LOCAL_STORAGE_SORT_MEMORY_COLUMN as De, useUserMemories as Ne, useDeleteMemory as Se, useDeleteAllMemories as _e, useUpdateMemory as Oe, te as ae } from "./index.6QVNoWZY.js";
3
+ import { oe as ce, E as le, e as P, ConfirmationPanel as ie, st as ne } from "./App.DFkumxrG.js";
4
+ import c from "clsx";
5
+ import Re, { useState as x, useEffect as de, useRef as N, useLayoutEffect as F } from "react";
6
+ import { j as Le, D as Pe, G as W, M as D, F as He, H as Ie, l as Be, U as ze } from "./Table.CGJz3l0P.js";
7
+ function Ve({
8
+ value: t,
9
+ defaultValue: l,
10
+ finalValue: r,
11
+ onChange: a = () => {
12
+ },
13
+ initialControlledDelay: o = 0
14
+ }) {
15
+ const [i, d] = x(!1), [u, w] = x(
16
+ l !== void 0 ? l : r
17
+ ), b = (h) => {
18
+ w(h), a?.(h);
19
+ };
20
+ return de(() => {
21
+ (async () => t !== void 0 && !i && o > 0 && (await new Promise(
22
+ (h) => setTimeout(h, o)
23
+ ), d(!0)))();
24
+ }, [t, o, i]), t !== void 0 ? !i && o > 0 ? ["", a, !0] : [t, a, !0] : [u, b, !1];
25
+ }
26
+ const Fe = ({
27
+ className: t,
28
+ viewBox: l,
29
+ title: r,
30
+ monotone: a,
31
+ ...o
32
+ }) => /* @__PURE__ */ m(
33
+ ve,
34
+ {
35
+ defaultViewBox: "0 0 512 512",
36
+ size: "size-5",
37
+ viewBox: l,
38
+ className: t,
39
+ title: r || "Edit",
40
+ ...o,
41
+ children: [
42
+ /* @__PURE__ */ e(
43
+ "path",
44
+ {
45
+ 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 32v256c0 17.7 14.3 32 32 32h256c17.7 0 32-14.3 32-32v-96c0-17.7 14.3-32 32-32s32 14.3 32 32v96c0 53-43 96-96 96H96c-53 0-96-43-96-96z",
46
+ opacity: a ? "1" : "0.4"
47
+ }
48
+ ),
49
+ /* @__PURE__ */ e("path", { d: "m392.4 21.7-30.1 30 97.9 97.9 30.1-30.1c21.9-21.9 21.9-57.3 0-79.2l-18.7-18.6c-21.9-21.9-57.3-21.9-79.2 0m-52.7 52.6L172.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.5l167.3-167.4z" })
50
+ ]
51
+ }
52
+ ), me = "av-text-area", je = "av-text-area-wrapper", Z = "av-text-area-helper-text", Ue = "av-text-area__control--right", Ge = "av-text-area__control--left", qe = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hidden px-4 py-7", Xe = ({ mode: t }) => c({
53
+ "bg-surface-darker text-copy-lighter caret-copy-light": t === "dark",
54
+ "bg-surface-lighter text-copy-dark caret-copy-dark": t === "light",
55
+ "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": t === "system",
56
+ "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": t === "alt-system"
57
+ }), Ye = ({
58
+ focusMode: t
59
+ }) => c("focus:outline focus:outline-2 focus:outline-offset-2", {
60
+ "focus:outline-focus-dark": t === "dark",
61
+ "focus:outline-focus-light": t === "light",
62
+ "focus:outline-focus-light dark:focus:outline-focus-dark": t === "alt-system",
63
+ "focus:outline-focus-dark dark:focus:outline-focus-light": t === "system"
64
+ }), Je = ({
65
+ noBorder: t,
66
+ error: l
67
+ }) => c("border-2", {
68
+ "border-border-dark": !t && !l,
69
+ "focus:border-border-dark": !t && l,
70
+ "border-border-error-dark": !t && l,
71
+ "border-transparent": t
72
+ }), Ke = ({
73
+ disabled: t,
74
+ raw: l,
75
+ error: r,
76
+ mode: a,
77
+ leftElement: o,
78
+ rightElement: i
79
+ }) => {
80
+ if (l)
81
+ return "";
82
+ if (t)
83
+ return c(
84
+ "transform translate-y-0 scale-100 absolute px-2 cursor-not-allowed opacity-50 font-medium",
85
+ {
86
+ "translate-x-[12px]": i === !0 && !o || !i && !o
87
+ }
88
+ );
89
+ if (!r)
90
+ return c(
91
+ "absolute px-2 cursor-text font-medium transform translate-y-0 scale-100",
92
+ {
93
+ "translate-x-[12px]": i === !0 && !o || !i && !o,
94
+ "text-copy-medium": a === "dark",
95
+ "text-copy-dark": a === "light",
96
+ "text-copy-dark dark:text-copy-medium": a === "system",
97
+ "text-copy-medium dark:text-copy-dark": a === "alt-system"
98
+ }
99
+ );
100
+ if (r)
101
+ return c(
102
+ "absolute px-2 cursor-text font-medium transform translate-y-0 scale-100",
103
+ {
104
+ "translate-x-[12px]": i === !0 && !o || !i && !o,
105
+ "text-copy-medium": a === "dark",
106
+ "text-copy-error-dark": a === "light",
107
+ "text-copy-error-dark dark:text-copy-error-light": a === "system",
108
+ "text-copy-medium dark:text-copy-error-dark": a === "alt-system"
109
+ }
110
+ );
111
+ }, Qe = ({
112
+ error: t,
113
+ raw: l,
114
+ mode: r,
115
+ disabled: a
116
+ }) => {
117
+ if (l)
118
+ return "";
119
+ if (a)
120
+ return c(
121
+ Z,
122
+ "absolute px-2 cursor-not-allowed opacity-50 font-medium"
123
+ );
124
+ if (!t)
125
+ return c(Z, "absolute px-2 font-medium", {
126
+ "text-copy-medium": r === "dark",
127
+ "text-copy-dark": r === "light",
128
+ "text-copy-dark dark:text-copy-medium": r === "system",
129
+ "text-copy-medium dark:text-copy-dark": r === "alt-system"
130
+ });
131
+ if (t)
132
+ return c(Z, "absolute px-2 font-medium", {
133
+ "text-copy-error-light": r === "dark",
134
+ "text-copy-error-dark": r === "light",
135
+ "text-copy-error-dark dark:text-copy-error-light": r === "system",
136
+ "dark:text-copy-error-dark text-copy-error-light": r === "alt-system"
137
+ });
138
+ }, We = ({
139
+ className: t,
140
+ textAreaClassName: l,
141
+ raw: r,
142
+ focusMode: a,
143
+ disabled: o,
144
+ noBorder: i,
145
+ error: d,
146
+ mode: u,
147
+ leftElement: w,
148
+ rightElement: b
149
+ }) => {
150
+ const h = r ? t : c(
151
+ "relative flex w-full flex-col justify-center",
152
+ je,
153
+ t
154
+ ), O = r ? c(l) : c(
155
+ me,
156
+ l,
157
+ qe(),
158
+ Xe({ mode: u }),
159
+ Ye({ focusMode: a }),
160
+ Je({
161
+ noBorder: i,
162
+ error: d
163
+ }),
164
+ {
165
+ "disabled:cursor-not-allowed disabled:opacity-50": o
166
+ }
167
+ ), I = r ? void 0 : "sr-only", k = Ke({
168
+ disabled: o,
169
+ raw: r,
170
+ error: d,
171
+ mode: u,
172
+ rightElement: b,
173
+ leftElement: w
174
+ }), f = Qe({
175
+ error: d,
176
+ raw: r,
177
+ mode: u,
178
+ disabled: o
179
+ }), A = r ? void 0 : c(Ue, "absolute"), y = r ? void 0 : c(Ge, "absolute");
180
+ return {
181
+ wrapper: h,
182
+ textArea: O,
183
+ accessibleLabel: I,
184
+ visibleLabel: k,
185
+ helperText: f,
186
+ rightElement: A,
187
+ leftElement: y
188
+ };
189
+ }, Ze = ({
190
+ scrollHeight: t,
191
+ currentHeight: l,
192
+ currentLabelOffset: r = 0,
193
+ currentHelperTextOffset: a = 0
194
+ }) => {
195
+ let o, i;
196
+ if (t > 0 && t !== l) {
197
+ const d = t - l, u = Math.abs(d / 24);
198
+ o = r + -1 * Math.sign(d) * (12 * u), i = a + Math.sign(d) * (12 * u);
199
+ }
200
+ return {
201
+ labelOffset: o,
202
+ helperTextOffset: i,
203
+ scrollHeight: t
204
+ };
205
+ }, ue = Re.forwardRef(
206
+ ({
207
+ id: t,
208
+ name: l,
209
+ label: r,
210
+ error: a = !1,
211
+ raw: o = !1,
212
+ className: i,
213
+ textAreaClassName: d,
214
+ mode: u = "system",
215
+ focusMode: w = "system",
216
+ value: b,
217
+ defaultValue: h,
218
+ disabled: O = !1,
219
+ noBorder: I = !1,
220
+ labelId: k,
221
+ helperText: f = "",
222
+ helperTextOnFocus: A = !1,
223
+ rightElement: y,
224
+ leftElement: v,
225
+ onChange: R,
226
+ onFocus: j,
227
+ onBlur: B,
228
+ ...E
229
+ }, Y) => {
230
+ const p = N(null), J = Ce([Y, p]), [z, C] = re(), [K, M] = re(), V = N(80), U = N(-25), L = N(null), G = N(30), n = N(null), s = Ae({ id: t, prefix: `${me}-` }), [S, q] = x(0), [ee, he] = x(0), [fe, te] = x(
231
+ !!(!A && f)
232
+ ), pe = `${l} error, ${f}`, _ = We({
233
+ className: i,
234
+ textAreaClassName: d,
235
+ error: a,
236
+ raw: o,
237
+ focusMode: w,
238
+ disabled: O,
239
+ noBorder: I,
240
+ mode: u,
241
+ rightElement: !!y,
242
+ leftElement: !!v
243
+ }), [T, xe] = Ve({
244
+ value: b,
245
+ initialControlledDelay: 20,
246
+ defaultValue: h,
247
+ onChange: (g) => {
248
+ R && R({
249
+ target: {
250
+ value: g
251
+ }
252
+ });
253
+ }
254
+ }), ye = (g) => {
255
+ xe(g.target.value);
256
+ }, ge = (g) => {
257
+ A && f && te(!0), j && j(g);
258
+ }, be = (g) => {
259
+ A && f && !T && te(!1), B && B(g);
260
+ };
261
+ return F(() => {
262
+ C && C.width && q(C.width + 18 + 10);
263
+ }, [C]), F(() => {
264
+ M && M.width && he(M.width + 18 + 10);
265
+ }, [M]), F(() => {
266
+ o || p && p.current && T !== void 0 && (p.current.style.height = "inherit", p.current.style.height = p.current.scrollHeight + "px");
267
+ }, [T, o]), F(() => {
268
+ o || setTimeout(() => {
269
+ L?.current?.style.setProperty(
270
+ "--av-text-area-wrapper-transition",
271
+ T ? "none" : "all 0.2s ease-out"
272
+ );
273
+ }, 0);
274
+ }, [T, o]), F(() => {
275
+ if (!o && p && p.current && T !== void 0) {
276
+ const { labelOffset: g, helperTextOffset: Q, scrollHeight: ke } = Ze({
277
+ scrollHeight: p.current.scrollHeight,
278
+ currentHeight: V.current,
279
+ currentLabelOffset: U.current,
280
+ currentHelperTextOffset: G.current
281
+ });
282
+ g && (U.current = g, L?.current?.style.setProperty(
283
+ "--av-text-area-label",
284
+ `${g}px`
285
+ )), Q && (G.current = Q, n?.current?.style.setProperty(
286
+ "--av-text-area-helper-text",
287
+ `${Q}px`
288
+ )), V.current = ke || V.current;
289
+ }
290
+ }, [T, o]), M.width > 0 && L?.current?.style.setProperty(
291
+ "--tw-translate-x",
292
+ `${12 + M.width + 5}px`
293
+ ), /* @__PURE__ */ m("div", { className: _.wrapper, children: [
294
+ /* @__PURE__ */ e(
295
+ "label",
296
+ {
297
+ htmlFor: s,
298
+ id: k,
299
+ className: _.accessibleLabel,
300
+ children: r
301
+ }
302
+ ),
303
+ v && /* @__PURE__ */ e(
304
+ "div",
305
+ {
306
+ ref: K,
307
+ className: _.leftElement,
308
+ children: v
309
+ }
310
+ ),
311
+ /* @__PURE__ */ e(
312
+ "textarea",
313
+ {
314
+ ref: J,
315
+ id: s,
316
+ name: l,
317
+ disabled: O,
318
+ placeholder: o ? void 0 : " ",
319
+ className: _.textArea,
320
+ rows: 1,
321
+ ...f && { "aria-describedby": `${s}-helper` },
322
+ ...a && { "aria-invalid": "true" },
323
+ ...y && !v && !o && { style: { paddingRight: S } },
324
+ ...v && !y && !o && { style: { paddingLeft: ee } },
325
+ ...y && v && !o && {
326
+ style: {
327
+ paddingRight: S,
328
+ paddingLeft: ee
329
+ }
330
+ },
331
+ value: T,
332
+ onChange: ye,
333
+ onFocus: ge,
334
+ onBlur: be,
335
+ ...E
336
+ }
337
+ ),
338
+ !o && /* @__PURE__ */ e(
339
+ "label",
340
+ {
341
+ ref: L,
342
+ "aria-hidden": !0,
343
+ htmlFor: s,
344
+ className: `${_.visibleLabel}`,
345
+ children: r
346
+ }
347
+ ),
348
+ fe && /* @__PURE__ */ e(
349
+ "div",
350
+ {
351
+ ref: n,
352
+ id: `${s}-helper`,
353
+ className: _.helperText,
354
+ children: f
355
+ }
356
+ ),
357
+ y && /* @__PURE__ */ e(
358
+ "div",
359
+ {
360
+ ref: z,
361
+ className: _.rightElement,
362
+ children: y
363
+ }
364
+ ),
365
+ a && f && /* @__PURE__ */ e(Ee, { politeness: "polite", clearAnnouncementDelay: 500, children: pe })
366
+ ] });
367
+ }
368
+ );
369
+ ue.displayName = "TextArea";
370
+ /*!
371
+ @versini/ui-textarea v5.0.1
372
+ © 2025 gizmette.com
373
+ */
374
+ try {
375
+ window.__VERSINI_UI_TEXTAREA__ || (window.__VERSINI_UI_TEXTAREA__ = {
376
+ version: "5.0.1",
377
+ buildTime: "09/01/2025 04:01 PM EDT",
378
+ homepage: "https://github.com/aversini/ui-components",
379
+ license: "MIT"
380
+ });
381
+ } catch {
382
+ }
383
+ const $e = ({
384
+ open: t,
385
+ onOpenChange: l,
386
+ initialText: r,
387
+ onSave: a,
388
+ isSaving: o = !1
389
+ }) => {
390
+ const [i, d] = x(r);
391
+ de(() => {
392
+ t && d(r);
393
+ }, [t, r]);
394
+ const u = () => {
395
+ i.trim().length >= 3 && a(i.trim());
396
+ }, w = i.trim().length >= 3, b = i.trim() !== r.trim();
397
+ return /* @__PURE__ */ e(
398
+ ce,
399
+ {
400
+ maxHeight: "small",
401
+ kind: "messagebox",
402
+ open: t,
403
+ onOpenChange: l,
404
+ title: "Edit Memory",
405
+ animation: !0,
406
+ animationType: "fade",
407
+ footer: /* @__PURE__ */ m($, { columnGap: 2, alignHorizontal: "flex-end", children: [
408
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(
409
+ X,
410
+ {
411
+ mode: "dark",
412
+ variant: "secondary",
413
+ noBorder: !0,
414
+ focusMode: "light",
415
+ onClick: () => l(!1),
416
+ disabled: o,
417
+ children: "Cancel"
418
+ }
419
+ ) }),
420
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(
421
+ X,
422
+ {
423
+ mode: "dark",
424
+ focusMode: "light",
425
+ disabled: o || !w || !b,
426
+ onClick: u,
427
+ children: o ? "Saving..." : "Save"
428
+ }
429
+ ) })
430
+ ] }),
431
+ children: /* @__PURE__ */ e("div", { className: "flex flex-col max-h-[75vh] min-h-[40vh] pt-2", children: /* @__PURE__ */ e(
432
+ ue,
433
+ {
434
+ mode: "dark",
435
+ focusMode: "light",
436
+ label: "Memory text",
437
+ name: "memoryText",
438
+ value: i,
439
+ onChange: (h) => d(h.target.value),
440
+ rows: 2,
441
+ autoFocus: !0,
442
+ helperText: i.trim().length < 3 ? "Memory text must be at least 3 characters" : `${i.length} characters`
443
+ }
444
+ ) })
445
+ }
446
+ );
447
+ }, se = ({
448
+ open: t,
449
+ onOpenChange: l,
450
+ user: r
451
+ }) => {
452
+ const { getAccessToken: a } = Me(), [o] = x(void 0), [i, d] = le({
453
+ key: oe + Te,
454
+ initialValue: P.DESC
455
+ }), [u, w] = le({
456
+ key: oe + De,
457
+ initialValue: "createdAt"
458
+ }), [b, h] = x(i || P.DESC), [O, I] = x(
459
+ u || "createdAt"
460
+ ), { data: k, isLoading: f, isError: A } = Ne({
461
+ user: r,
462
+ query: o,
463
+ getAccessToken: a,
464
+ enabled: t
465
+ }), y = Se({ getAccessToken: a }), v = _e({ getAccessToken: a }), R = Oe({ getAccessToken: a }), [j, B] = x(!1), E = N(null), [Y, p] = x(!1), [J, z] = x(!1), C = N(null), K = (n, s, S) => {
466
+ E.current = { id: n, text: s, createdAt: S }, B(!0);
467
+ }, M = () => {
468
+ E.current && y.mutate({ user: r, memoryId: E.current.id });
469
+ }, V = () => {
470
+ r && p(!0);
471
+ }, U = () => {
472
+ r && v.mutate({ user: r });
473
+ }, L = (n, s) => {
474
+ C.current = { id: n, text: s }, z(!0);
475
+ }, G = (n) => {
476
+ C.current && r && R.mutate(
477
+ {
478
+ user: r,
479
+ memoryId: C.current.id,
480
+ text: n
481
+ },
482
+ {
483
+ onSuccess: () => {
484
+ z(!1);
485
+ }
486
+ }
487
+ );
488
+ };
489
+ return /* @__PURE__ */ m(we, { children: [
490
+ /* @__PURE__ */ m(
491
+ ie,
492
+ {
493
+ showConfirmation: j,
494
+ setShowConfirmation: B,
495
+ action: M,
496
+ customStrings: {
497
+ title: "Delete memory",
498
+ confirmAction: "Delete",
499
+ cancelAction: "Cancel"
500
+ },
501
+ children: [
502
+ /* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete this memory?" }),
503
+ /* @__PURE__ */ m("ul", { className: "m-0 mt-2 list-disc list-inside text-xs opacity-80", children: [
504
+ /* @__PURE__ */ m("li", { children: [
505
+ "Excerpt: ",
506
+ E.current?.text?.slice(0, 80) || ""
507
+ ] }),
508
+ /* @__PURE__ */ m("li", { children: [
509
+ "Created:",
510
+ " ",
511
+ E.current?.createdAt ? new Date(E.current.createdAt).toLocaleString() : "-"
512
+ ] })
513
+ ] })
514
+ ]
515
+ }
516
+ ),
517
+ /* @__PURE__ */ e(
518
+ ie,
519
+ {
520
+ showConfirmation: Y,
521
+ setShowConfirmation: p,
522
+ action: U,
523
+ customStrings: {
524
+ title: "Delete all memories",
525
+ confirmAction: "Delete all",
526
+ cancelAction: "Cancel"
527
+ },
528
+ children: /* @__PURE__ */ e("p", { className: "m-0", children: "This will permanently delete all memories for this user. This action cannot be undone." })
529
+ }
530
+ ),
531
+ /* @__PURE__ */ e(
532
+ $e,
533
+ {
534
+ open: J,
535
+ onOpenChange: z,
536
+ initialText: C.current?.text || "",
537
+ onSave: G,
538
+ isSaving: R.isPending
539
+ }
540
+ ),
541
+ /* @__PURE__ */ e(
542
+ ce,
543
+ {
544
+ open: t,
545
+ onOpenChange: (n) => l(n),
546
+ title: "User Memories",
547
+ animation: !0,
548
+ animationType: "fade",
549
+ footer: /* @__PURE__ */ m($, { columnGap: 2, alignHorizontal: "flex-end", children: [
550
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(
551
+ X,
552
+ {
553
+ mode: "dark",
554
+ variant: "secondary",
555
+ noBorder: !0,
556
+ focusMode: "light",
557
+ onClick: () => l(!1),
558
+ children: "Close"
559
+ }
560
+ ) }),
561
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(
562
+ X,
563
+ {
564
+ mode: "dark",
565
+ focusMode: "light",
566
+ variant: "danger",
567
+ disabled: v.isPending || (k?.total ?? 0) === 0,
568
+ onClick: V,
569
+ children: "Delete All"
570
+ }
571
+ ) })
572
+ ] }),
573
+ children: /* @__PURE__ */ m("div", { className: "flex flex-col sm:flex-row max-h-[75vh] min-h-[60vh] pt-2", children: [
574
+ f && /* @__PURE__ */ e("p", { className: "m-0", children: "Loading memories..." }),
575
+ A && /* @__PURE__ */ e("p", { className: "m-0 text-red-500", children: "Failed to load memories." }),
576
+ !f && !A && (k && k.items.length > 0 ? /* @__PURE__ */ m(Le, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
577
+ /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ m(W, { children: [
578
+ /* @__PURE__ */ e(D, { className: "sr-only", children: "Row" }),
579
+ /* @__PURE__ */ e(D, { children: "Memory" }),
580
+ /* @__PURE__ */ e(
581
+ He,
582
+ {
583
+ focusMode: "system",
584
+ buttonClassName: "text-xs sm:text-sm",
585
+ cellId: "createdAt",
586
+ align: "left",
587
+ sortDirection: b,
588
+ sortedCell: O,
589
+ onClick: () => {
590
+ I("createdAt"), w("createdAt"), h((n) => {
591
+ const s = n === P.ASC ? P.DESC : P.ASC;
592
+ return d(s), s;
593
+ });
594
+ },
595
+ children: "Date"
596
+ }
597
+ ),
598
+ /* @__PURE__ */ e(D, { align: "right", children: "Actions" })
599
+ ] }) }),
600
+ /* @__PURE__ */ e(Ie, { children: [...k.items].sort((n, s) => {
601
+ const S = n.createdAt ? new Date(n.createdAt).getTime() : 0, q = s.createdAt ? new Date(s.createdAt).getTime() : 0;
602
+ return b === P.ASC ? S - q : q - S;
603
+ }).map((n, s) => /* @__PURE__ */ m(W, { children: [
604
+ /* @__PURE__ */ e(D, { className: c("dark:text-gray-400"), children: s + 1 }),
605
+ /* @__PURE__ */ e(
606
+ D,
607
+ {
608
+ className: c(
609
+ "dark:text-white",
610
+ "max-w-[100px] sm:max-w-full text-xs sm:text-sm"
611
+ ),
612
+ style: {
613
+ wordBreak: "break-word"
614
+ },
615
+ children: n.text
616
+ }
617
+ ),
618
+ /* @__PURE__ */ e(
619
+ D,
620
+ {
621
+ component: "th",
622
+ scope: "row",
623
+ className: c(
624
+ "dark:text-gray-400",
625
+ "sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none"
626
+ ),
627
+ children: n.createdAt ? new Date(n.createdAt).toLocaleDateString() : "-"
628
+ }
629
+ ),
630
+ /* @__PURE__ */ e(D, { className: "align-top", align: "right", children: /* @__PURE__ */ m($, { columnGap: 1, alignHorizontal: "flex-end", children: [
631
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(
632
+ ne,
633
+ {
634
+ label: "Edit memory",
635
+ mode: "system",
636
+ placement: "top",
637
+ trigger: /* @__PURE__ */ e(
638
+ ae,
639
+ {
640
+ focusMode: "system",
641
+ noBorder: !0,
642
+ label: "Edit memory",
643
+ variant: "primary",
644
+ disabled: R.isPending,
645
+ onClick: () => L(n.memoryId, n.text),
646
+ children: /* @__PURE__ */ e(Fe, { size: "size-3", monotone: !0 })
647
+ }
648
+ )
649
+ }
650
+ ) }),
651
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(
652
+ ne,
653
+ {
654
+ label: "Delete memory",
655
+ mode: "system",
656
+ placement: "top",
657
+ trigger: /* @__PURE__ */ e(
658
+ ae,
659
+ {
660
+ focusMode: "system",
661
+ noBorder: !0,
662
+ label: "Delete memory",
663
+ variant: "primary",
664
+ iconClassName: "text-red-700 dark:text-red-500",
665
+ disabled: y.isPending,
666
+ onClick: () => K(
667
+ n.memoryId,
668
+ n.text,
669
+ n.createdAt
670
+ ),
671
+ children: /* @__PURE__ */ e(Be, { size: "size-3", monotone: !0 })
672
+ }
673
+ )
674
+ }
675
+ ) })
676
+ ] }) })
677
+ ] }, n.memoryId)) }),
678
+ /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(W, { children: /* @__PURE__ */ m(D, { colSpan: 4, children: [
679
+ k.total,
680
+ " memor",
681
+ k.total === 1 ? "y" : "ies"
682
+ ] }) }) })
683
+ ] }) : /* @__PURE__ */ e("p", { className: "m-0 italic opacity-70", children: "No memories stored." }))
684
+ ] })
685
+ }
686
+ )
687
+ ] });
688
+ }, it = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, UserMemoriesPanel: se, default: se }, Symbol.toStringTag, { value: "Module" }));
689
+ export {
690
+ se as UserMemoriesPanel,
691
+ it as UserMemoriesPanel$1,
692
+ ue as me
693
+ };