@versini/sassysaint 8.87.0 → 8.88.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.DkbFYL2t.js → AboutChangelog.D7aQ3yNn.js} +3 -3
  2. package/dist/chunks/{AboutEntry.DendBA43.js → AboutEntry.CnCxYnL_.js} +5 -5
  3. package/dist/chunks/{App.QSOXgzIH.js → App.BP6R5ShT.js} +16 -16
  4. package/dist/chunks/{Chart.C9bHvy2K.js → Chart.3BnmAUFZ.js} +2 -2
  5. package/dist/chunks/{ChatBubbleAssistant.Btz9UWKo.js → ChatBubbleAssistant.D8fDaVAX.js} +4 -4
  6. package/dist/chunks/{ChatBubbleUser.DS4Vvpe1.js → ChatBubbleUser.DvGLUvJD.js} +3 -3
  7. package/dist/chunks/{ChatHistoryTable.FldPAY_P.js → ChatHistoryTable.DGnHbyHe.js} +3 -3
  8. package/dist/chunks/{HistoryEntry.BvKANXld.js → HistoryEntry.B__DZCu8.js} +3 -3
  9. package/dist/chunks/{ProfileEntry.ShOqkzsc.js → ProfileEntry.BsWrvAtz.js} +2 -2
  10. package/dist/chunks/{SettingsEntry.CN-udzD7.js → SettingsEntry.7cEFtg_0.js} +3 -3
  11. package/dist/chunks/UsageEntry.D2ug5HeG.js +150 -0
  12. package/dist/chunks/UserMemoriesPanel.S5107xYq.js +756 -0
  13. package/dist/chunks/{index.CoKtiw-a.js → index.5eJh6P0y.js} +2 -2
  14. package/dist/chunks/{index.tCwYhDIF.js → index.Bnc2_qab.js} +3 -3
  15. package/dist/chunks/{index.Cw_qwY4i.js → index.ByAefkkb.js} +1 -1
  16. package/dist/chunks/{index.CwcDgCgg.js → index.CJbIm0Z4.js} +1 -1
  17. package/dist/chunks/{index.rTT6Fa2A.js → index.CdXZBNtC.js} +1 -1
  18. package/dist/chunks/{index.C2dcBo5d.js → index.CoLzqnos.js} +1 -1
  19. package/dist/chunks/{index.DXPR93d9.js → index.DwOoD2V-.js} +1 -1
  20. package/dist/chunks/{index.s8wrxGpV.js → index.TmgOWqTS.js} +1 -1
  21. package/dist/chunks/{index.BOTqIliq.js → index.cjUqp69v.js} +1 -1
  22. package/dist/chunks/{useMarkdown.BkKfGoyx.js → useMarkdown.DrPCmE-F.js} +279 -280
  23. package/dist/components/SassySaint/SassySaint.js +1 -1
  24. package/dist/index.js +4 -4
  25. package/package.json +3 -3
  26. package/dist/chunks/UsageEntry.DQM0kwWT.js +0 -131
  27. package/dist/chunks/UserMemoriesPanel.a4D47pAN.js +0 -745
@@ -1,745 +0,0 @@
1
- import { jsx as e, jsxs as r, Fragment as b } from "react/jsx-runtime";
2
- import { L as R, j$1 as A, Button as M, n as Ne, useLocalStorage as K, LOCAL_STORAGE_PREFIX as Q, LOCAL_STORAGE_SORT_MEMORY_DIRECTION as we, e$1 as l, LOCAL_STORAGE_SORT_MEMORY_COLUMN as ke, useUserMemories as Se, useExpiredMemories as Te, useDeleteMemory as ve, useDeleteAllActiveMemories as De, useDeleteAllExpiredMemories as Me, useUpdateMemory as Ee, useRestoreMemory as be, ButtonIcon as O, IconEdit as Re, IconDelete as Z, IconRestore as Ie } from "./index.BOTqIliq.js";
3
- import { Panel as le, Toggle as _, ConfirmationPanel as ee, Tooltip as z } from "./App.QSOXgzIH.js";
4
- import { W as te, j as re, G as D, M as s, F as B, H as ie, D as ne } from "./index.s8wrxGpV.js";
5
- import y from "clsx";
6
- import { useState as C, useEffect as Le, useRef as oe } from "react";
7
- import { TextArea as Oe } from "./index.CwcDgCgg.js";
8
- const _e = ({
9
- open: N,
10
- onOpenChange: E,
11
- initialText: a,
12
- metadata: n,
13
- onSave: I,
14
- isSaving: m = !1
15
- }) => {
16
- const [p, L] = C(a), [h, w] = C("none");
17
- Le(() => {
18
- if (N) {
19
- L(a);
20
- const o = n?.expiration || "none";
21
- w(o);
22
- }
23
- }, [N, a, n?.expiration]);
24
- const S = () => {
25
- if (p.trim().length >= 3) {
26
- const o = h === "none" ? null : h;
27
- I(p.trim(), o);
28
- }
29
- }, u = p.trim().length >= 3, T = p.trim() !== a.trim() || h !== (n?.expiration || "none");
30
- return /* @__PURE__ */ e(
31
- le,
32
- {
33
- open: N,
34
- onOpenChange: E,
35
- title: "Edit Memory",
36
- animation: !0,
37
- animationType: "fade",
38
- footer: /* @__PURE__ */ r(R, { columnGap: 2, alignHorizontal: "flex-end", children: [
39
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
40
- M,
41
- {
42
- mode: "dark",
43
- variant: "secondary",
44
- noBorder: !0,
45
- focusMode: "light",
46
- onClick: () => E(!1),
47
- disabled: m,
48
- children: "Cancel"
49
- }
50
- ) }),
51
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
52
- M,
53
- {
54
- mode: "dark",
55
- focusMode: "light",
56
- disabled: m || !u || !T,
57
- onClick: S,
58
- children: m ? "Saving..." : "Save"
59
- }
60
- ) })
61
- ] }),
62
- children: /* @__PURE__ */ r("div", { className: "flex flex-col pt-2 gap-4", children: [
63
- /* @__PURE__ */ e(
64
- Oe,
65
- {
66
- mode: "dark",
67
- focusMode: "light",
68
- label: "Memory text",
69
- name: "memoryText",
70
- value: p,
71
- onChange: (o) => L(o.target.value),
72
- autoFocus: !0,
73
- helperText: p.trim().length < 3 ? "Memory text must be at least 3 characters" : `${p.length} characters`
74
- }
75
- ),
76
- /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 p-4 bg-slate-800/50 rounded-md border border-slate-700/50", children: [
77
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-slate-300 m-0", children: "Memory Expiration" }),
78
- /* @__PURE__ */ e("p", { className: "text-xs text-slate-400 m-0", children: "Set when this memory should expire and be automatically removed." }),
79
- /* @__PURE__ */ r("div", { className: "flex flex-col gap-2", children: [
80
- /* @__PURE__ */ e(
81
- _,
82
- {
83
- mode: "dark",
84
- focusMode: "light",
85
- noBorder: !0,
86
- narrow: !0,
87
- label: "Never expire",
88
- name: "expiration-none",
89
- checked: h === "none",
90
- onChange: (o) => {
91
- o && w("none");
92
- }
93
- }
94
- ),
95
- /* @__PURE__ */ e(
96
- _,
97
- {
98
- mode: "dark",
99
- focusMode: "light",
100
- noBorder: !0,
101
- narrow: !0,
102
- label: "Short (1 month)",
103
- name: "expiration-short",
104
- checked: h === "short",
105
- onChange: (o) => {
106
- o && w("short");
107
- }
108
- }
109
- ),
110
- /* @__PURE__ */ e(
111
- _,
112
- {
113
- mode: "dark",
114
- focusMode: "light",
115
- noBorder: !0,
116
- narrow: !0,
117
- label: "Medium (6 months)",
118
- name: "expiration-medium",
119
- checked: h === "medium",
120
- onChange: (o) => {
121
- o && w("medium");
122
- }
123
- }
124
- ),
125
- /* @__PURE__ */ e(
126
- _,
127
- {
128
- mode: "dark",
129
- focusMode: "light",
130
- noBorder: !0,
131
- narrow: !0,
132
- label: "Long (1 year)",
133
- name: "expiration-long",
134
- checked: h === "long",
135
- onChange: (o) => {
136
- o && w("long");
137
- }
138
- }
139
- )
140
- ] })
141
- ] }),
142
- n && /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 p-4 bg-slate-800/50 rounded-md border border-slate-700/50", children: [
143
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold text-slate-300 m-0", children: "Memory Details" }),
144
- n.categories && n.categories.length > 0 && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
145
- /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Category" }),
146
- /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: n.categories.map((o, v) => /* @__PURE__ */ e(
147
- "span",
148
- {
149
- className: "text-xs px-2 py-1 bg-slate-700/50 text-slate-200 rounded",
150
- children: o
151
- },
152
- `${o}-${v}`
153
- )) })
154
- ] }),
155
- /* @__PURE__ */ r("div", { className: "flex flex-col sm:flex-row gap-4", children: [
156
- /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 sm:flex-1", children: [
157
- n.confidence !== void 0 && n.confidence !== null && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
158
- /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Confidence" }),
159
- /* @__PURE__ */ r("span", { className: "text-sm text-slate-200", children: [
160
- (n.confidence * 100).toFixed(0),
161
- "%"
162
- ] })
163
- ] }),
164
- n.status && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
165
- /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Status" }),
166
- /* @__PURE__ */ e("span", { className: "text-sm text-slate-200 capitalize", children: n.status })
167
- ] }),
168
- n.sourceType && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
169
- /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Source Type" }),
170
- /* @__PURE__ */ e("span", { className: "text-sm text-slate-200 capitalize", children: n.sourceType })
171
- ] })
172
- ] }),
173
- /* @__PURE__ */ r("div", { className: "flex flex-col gap-3 sm:flex-1", children: [
174
- n.quote && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
175
- /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Original Prompt" }),
176
- /* @__PURE__ */ r("p", { className: "text-sm text-slate-200 m-0 italic", children: [
177
- '"',
178
- n.quote,
179
- '"'
180
- ] })
181
- ] }),
182
- n.canonicalText && /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
183
- /* @__PURE__ */ e("span", { className: "text-xs text-slate-400 uppercase", children: "Canonical Text" }),
184
- /* @__PURE__ */ e("p", { className: "text-sm text-slate-200 m-0 font-mono", children: n.canonicalText })
185
- ] })
186
- ] })
187
- ] })
188
- ] })
189
- ] })
190
- }
191
- );
192
- }, He = ({
193
- open: N,
194
- onOpenChange: E,
195
- user: a
196
- }) => {
197
- const { getAccessToken: n } = Ne(), [I] = C(void 0), [m, p] = C("active"), [L, h] = K({
198
- key: Q + we,
199
- initialValue: l.DESC
200
- }), [w, S] = K({
201
- key: Q + ke,
202
- initialValue: "createdAt"
203
- }), [u, T] = C(L || l.DESC), [o, v] = C(
204
- w || "createdAt"
205
- ), { data: g, isLoading: U, isError: q } = Se({
206
- user: a,
207
- query: I,
208
- getAccessToken: n,
209
- enabled: N && m === "active"
210
- }), {
211
- data: f,
212
- isLoading: H,
213
- isError: j
214
- } = Te({
215
- user: a,
216
- query: I,
217
- getAccessToken: n,
218
- enabled: N && m === "expired"
219
- }), P = ve({ getAccessToken: n }), $ = De({ getAccessToken: n }), X = Me({ getAccessToken: n }), F = Ee({ getAccessToken: n }), V = be({ getAccessToken: n }), [se, Y] = C(!1), k = oe(null), [ae, W] = C(!1), [ce, G] = C(!1), x = oe(null), J = (t, i, c, d) => {
220
- k.current = { id: t, text: i, description: c, createdAt: d }, Y(!0);
221
- }, de = () => {
222
- k.current && P.mutate({ user: a, memoryId: k.current.id });
223
- }, me = (t, i, c, d, ue, ge, fe, Ae, ye, Ce) => {
224
- x.current = {
225
- id: t,
226
- description: i,
227
- categories: c,
228
- quote: d,
229
- canonicalText: ue,
230
- confidence: ge,
231
- status: fe,
232
- sourceType: Ae,
233
- expiration: ye,
234
- expiresAt: Ce
235
- }, G(!0);
236
- }, xe = (t, i) => {
237
- x.current && a && F.mutate(
238
- {
239
- user: a,
240
- memoryId: x.current.id,
241
- description: t,
242
- expiration: i || void 0
243
- },
244
- {
245
- onSuccess: () => {
246
- G(!1);
247
- }
248
- }
249
- );
250
- }, he = () => {
251
- a && W(!0);
252
- }, pe = () => {
253
- a && (m === "active" ? $.mutate({ user: a }) : X.mutate({ user: a }));
254
- };
255
- return /* @__PURE__ */ r(b, { children: [
256
- /* @__PURE__ */ e(
257
- _e,
258
- {
259
- open: ce,
260
- onOpenChange: G,
261
- initialText: x.current?.description || "",
262
- metadata: x.current ? {
263
- categories: x.current.categories,
264
- quote: x.current.quote,
265
- canonicalText: x.current.canonicalText,
266
- confidence: x.current.confidence,
267
- status: x.current.status,
268
- sourceType: x.current.sourceType,
269
- expiration: x.current.expiration,
270
- expiresAt: x.current.expiresAt
271
- } : void 0,
272
- onSave: xe,
273
- isSaving: F.isPending
274
- }
275
- ),
276
- /* @__PURE__ */ r(
277
- ee,
278
- {
279
- showConfirmation: se,
280
- setShowConfirmation: Y,
281
- action: de,
282
- customStrings: {
283
- title: "Delete memory",
284
- confirmAction: "Delete",
285
- cancelAction: "Cancel"
286
- },
287
- children: [
288
- /* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete this memory?" }),
289
- /* @__PURE__ */ r("ul", { className: "m-0 mt-2 list-disc list-inside text-xs opacity-80", children: [
290
- /* @__PURE__ */ r("li", { children: [
291
- "Excerpt:",
292
- " ",
293
- (k.current?.description || k.current?.text || "").slice(0, 80)
294
- ] }),
295
- /* @__PURE__ */ r("li", { children: [
296
- "Created:",
297
- " ",
298
- k.current?.createdAt ? new Date(k.current.createdAt).toLocaleString() : "-"
299
- ] })
300
- ] })
301
- ]
302
- }
303
- ),
304
- /* @__PURE__ */ e(
305
- ee,
306
- {
307
- showConfirmation: ae,
308
- setShowConfirmation: W,
309
- action: pe,
310
- customStrings: {
311
- title: m === "active" ? "Delete all active memories" : "Delete all expired memories",
312
- confirmAction: "Delete all",
313
- cancelAction: "Cancel"
314
- },
315
- children: /* @__PURE__ */ e("p", { className: "m-0", children: m === "active" ? "This will permanently delete all active memories for this user. This action cannot be undone." : "This will permanently delete all expired memories for this user. This action cannot be undone." })
316
- }
317
- ),
318
- /* @__PURE__ */ e(
319
- le,
320
- {
321
- open: N,
322
- onOpenChange: (t) => E(t),
323
- title: "User Memories",
324
- animation: !0,
325
- animationType: "fade",
326
- footer: /* @__PURE__ */ r(R, { columnGap: 2, alignHorizontal: "flex-end", children: [
327
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
328
- M,
329
- {
330
- mode: "dark",
331
- variant: "secondary",
332
- noBorder: !0,
333
- focusMode: "light",
334
- onClick: () => E(!1),
335
- children: "Close"
336
- }
337
- ) }),
338
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
339
- M,
340
- {
341
- mode: "dark",
342
- focusMode: "light",
343
- variant: "danger",
344
- disabled: (m === "active" ? $.isPending : X.isPending) || (m === "active" ? (g?.total ?? 0) === 0 : (f?.total ?? 0) === 0),
345
- onClick: he,
346
- children: "Delete All"
347
- }
348
- ) })
349
- ] }),
350
- children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-4 @container/editmemoriespanel", children: [
351
- /* @__PURE__ */ r(R, { columnGap: 2, alignHorizontal: "center", children: [
352
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
353
- M,
354
- {
355
- focusMode: "light",
356
- mode: m === "active" ? "dark" : "light",
357
- size: "small",
358
- noBorder: !0,
359
- onClick: () => p("active"),
360
- children: "Active Memories"
361
- }
362
- ) }),
363
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
364
- M,
365
- {
366
- focusMode: "light",
367
- mode: m === "expired" ? "dark" : "light",
368
- size: "small",
369
- noBorder: !0,
370
- onClick: () => p("expired"),
371
- children: "Expired Memories"
372
- }
373
- ) })
374
- ] }),
375
- /* @__PURE__ */ e(
376
- "div",
377
- {
378
- className: y(
379
- "flex flex-col sm:flex-row",
380
- "max-h-[75vh]",
381
- "sm:max-h-[75vh]",
382
- "min-h-[70vh]"
383
- ),
384
- children: m === "active" ? /* @__PURE__ */ r(b, { children: [
385
- U && /* @__PURE__ */ e("p", { className: "m-0", children: "Loading memories..." }),
386
- q && /* @__PURE__ */ e("p", { className: "m-0 text-red-500", children: "Failed to load memories." }),
387
- !U && !q && (g && g.items.length > 0 ? /* @__PURE__ */ r(te, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
388
- /* @__PURE__ */ e(re, { children: /* @__PURE__ */ r(D, { children: [
389
- /* @__PURE__ */ e(s, { className: "sr-only", children: "Row" }),
390
- /* @__PURE__ */ e(s, { children: "Memory" }),
391
- /* @__PURE__ */ e(
392
- B,
393
- {
394
- focusMode: "system",
395
- buttonClassName: "text-xs sm:text-sm",
396
- cellId: "createdAt",
397
- align: "left",
398
- sortDirection: u,
399
- sortedCell: o,
400
- onClick: () => {
401
- v("createdAt"), S("createdAt"), T((t) => {
402
- const i = t === l.ASC ? l.DESC : l.ASC;
403
- return h(i), i;
404
- });
405
- },
406
- children: "Date"
407
- }
408
- ),
409
- /* @__PURE__ */ e(
410
- B,
411
- {
412
- focusMode: "system",
413
- buttonClassName: "text-xs sm:text-sm",
414
- cellId: "expiresAt",
415
- align: "left",
416
- sortDirection: u,
417
- sortedCell: o,
418
- onClick: () => {
419
- v("expiresAt"), S("expiresAt"), T((t) => {
420
- const i = t === l.ASC ? l.DESC : l.ASC;
421
- return h(i), i;
422
- });
423
- },
424
- children: "Expires"
425
- }
426
- ),
427
- /* @__PURE__ */ e(s, { align: "right", children: "Actions" })
428
- ] }) }),
429
- /* @__PURE__ */ e(ie, { children: [...g.items].sort((t, i) => {
430
- if (o === "createdAt") {
431
- const c = t.createdAt ? new Date(t.createdAt).getTime() : 0, d = i.createdAt ? new Date(i.createdAt).getTime() : 0;
432
- return u === l.ASC ? c - d : d - c;
433
- }
434
- if (o === "expiresAt") {
435
- const c = t.expiresAt ? new Date(t.expiresAt).getTime() : Number.MAX_SAFE_INTEGER, d = i.expiresAt ? new Date(i.expiresAt).getTime() : Number.MAX_SAFE_INTEGER;
436
- return u === l.ASC ? c - d : d - c;
437
- }
438
- return 0;
439
- }).map((t, i) => /* @__PURE__ */ r(D, { children: [
440
- /* @__PURE__ */ e(s, { className: y("dark:text-gray-400"), children: i + 1 }),
441
- /* @__PURE__ */ e(
442
- s,
443
- {
444
- className: y(
445
- "dark:text-white",
446
- "max-w-[100px] sm:max-w-[400px]",
447
- "text-xs sm:text-sm"
448
- ),
449
- style: {
450
- wordBreak: "break-word"
451
- },
452
- children: t.description || t.text
453
- }
454
- ),
455
- /* @__PURE__ */ e(
456
- s,
457
- {
458
- component: "th",
459
- scope: "row",
460
- className: y(
461
- "dark:text-gray-400",
462
- "sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none"
463
- ),
464
- children: t.createdAt ? new Date(t.createdAt).toLocaleDateString() : "-"
465
- }
466
- ),
467
- /* @__PURE__ */ e(
468
- s,
469
- {
470
- className: y(
471
- "dark:text-gray-400",
472
- "sm:whitespace-nowrap text-xs sm:text-sm"
473
- ),
474
- children: t.expiresAt ? new Date(t.expiresAt).toLocaleDateString() : "Never"
475
- }
476
- ),
477
- /* @__PURE__ */ e(s, { className: "align-top", align: "right", children: /* @__PURE__ */ r(
478
- R,
479
- {
480
- columnGap: 2,
481
- alignHorizontal: "flex-end",
482
- children: [
483
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
484
- z,
485
- {
486
- label: "Edit memory",
487
- mode: "system",
488
- placement: "top",
489
- trigger: /* @__PURE__ */ e(
490
- O,
491
- {
492
- focusMode: "system",
493
- noBorder: !0,
494
- label: "Edit memory",
495
- variant: "primary",
496
- disabled: F.isPending,
497
- onClick: () => me(
498
- t.memoryId,
499
- t.description || t.text,
500
- t.categories,
501
- t.quote,
502
- t.canonicalText,
503
- t.confidence,
504
- t.status,
505
- t.sourceType,
506
- t.expiration,
507
- t.expiresAt
508
- ),
509
- children: /* @__PURE__ */ e(Re, { size: "size-3", monotone: !0 })
510
- }
511
- )
512
- }
513
- ) }),
514
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
515
- z,
516
- {
517
- label: "Delete memory",
518
- mode: "system",
519
- placement: "top",
520
- trigger: /* @__PURE__ */ e(
521
- O,
522
- {
523
- focusMode: "system",
524
- noBorder: !0,
525
- label: "Delete memory",
526
- variant: "primary",
527
- iconClassName: "text-red-700 dark:text-red-500",
528
- disabled: P.isPending,
529
- onClick: () => J(
530
- t.memoryId,
531
- t.text,
532
- t.description,
533
- t.createdAt
534
- ),
535
- children: /* @__PURE__ */ e(Z, { size: "size-3", monotone: !0 })
536
- }
537
- )
538
- }
539
- ) })
540
- ]
541
- }
542
- ) })
543
- ] }, t.memoryId)) }),
544
- /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(D, { children: /* @__PURE__ */ r(s, { colSpan: 5, children: [
545
- g.total,
546
- " memor",
547
- g.total === 1 ? "y" : "ies",
548
- g.totalTokenUsage !== void 0 && g.totalTokenUsage > 0 && /* @__PURE__ */ r(b, { children: [
549
- " ",
550
- "(approximately",
551
- " ",
552
- Math.round(
553
- g.totalTokenUsage
554
- ).toLocaleString(),
555
- " ",
556
- "token",
557
- Math.round(g.totalTokenUsage) === 1 ? "" : "s",
558
- ")"
559
- ] })
560
- ] }) }) })
561
- ] }) : /* @__PURE__ */ e("p", { className: "m-0 italic opacity-70", children: "No memories stored." }))
562
- ] }) : /* @__PURE__ */ r(b, { children: [
563
- H && /* @__PURE__ */ e("p", { className: "m-0", children: "Loading expired memories..." }),
564
- j && /* @__PURE__ */ e("p", { className: "m-0 text-red-500", children: "Failed to load expired memories." }),
565
- !H && !j && (f && f.items.length > 0 ? /* @__PURE__ */ r(te, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
566
- /* @__PURE__ */ e(re, { children: /* @__PURE__ */ r(D, { children: [
567
- /* @__PURE__ */ e(s, { className: "sr-only", children: "Row" }),
568
- /* @__PURE__ */ e(s, { children: "Memory" }),
569
- /* @__PURE__ */ e(
570
- B,
571
- {
572
- focusMode: "system",
573
- buttonClassName: "text-xs sm:text-sm",
574
- cellId: "createdAt",
575
- align: "left",
576
- sortDirection: u,
577
- sortedCell: o,
578
- onClick: () => {
579
- v("createdAt"), S("createdAt"), T((t) => {
580
- const i = t === l.ASC ? l.DESC : l.ASC;
581
- return h(i), i;
582
- });
583
- },
584
- children: "Date"
585
- }
586
- ),
587
- /* @__PURE__ */ e(
588
- B,
589
- {
590
- focusMode: "system",
591
- buttonClassName: "text-xs sm:text-sm",
592
- cellId: "expiresAt",
593
- align: "left",
594
- sortDirection: u,
595
- sortedCell: o,
596
- onClick: () => {
597
- v("expiresAt"), S("expiresAt"), T((t) => {
598
- const i = t === l.ASC ? l.DESC : l.ASC;
599
- return h(i), i;
600
- });
601
- },
602
- children: "Expired"
603
- }
604
- ),
605
- /* @__PURE__ */ e(s, { align: "right", children: "Actions" })
606
- ] }) }),
607
- /* @__PURE__ */ e(ie, { children: [...f.items].sort((t, i) => {
608
- if (o === "createdAt") {
609
- const c = t.createdAt ? new Date(t.createdAt).getTime() : 0, d = i.createdAt ? new Date(i.createdAt).getTime() : 0;
610
- return u === l.ASC ? c - d : d - c;
611
- }
612
- if (o === "expiresAt") {
613
- const c = t.expiresAt ? new Date(t.expiresAt).getTime() : Number.MAX_SAFE_INTEGER, d = i.expiresAt ? new Date(i.expiresAt).getTime() : Number.MAX_SAFE_INTEGER;
614
- return u === l.ASC ? c - d : d - c;
615
- }
616
- return 0;
617
- }).map((t, i) => /* @__PURE__ */ r(D, { children: [
618
- /* @__PURE__ */ e(s, { className: y("dark:text-gray-400"), children: i + 1 }),
619
- /* @__PURE__ */ e(
620
- s,
621
- {
622
- className: y(
623
- "dark:text-white",
624
- "max-w-[100px] sm:max-w-[400px]",
625
- "text-xs sm:text-sm"
626
- ),
627
- style: {
628
- wordBreak: "break-word"
629
- },
630
- children: t.description || t.text
631
- }
632
- ),
633
- /* @__PURE__ */ e(
634
- s,
635
- {
636
- component: "th",
637
- scope: "row",
638
- className: y(
639
- "dark:text-gray-400",
640
- "sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none"
641
- ),
642
- children: t.createdAt ? new Date(t.createdAt).toLocaleDateString() : "-"
643
- }
644
- ),
645
- /* @__PURE__ */ e(
646
- s,
647
- {
648
- className: y(
649
- "dark:text-gray-400",
650
- "sm:whitespace-nowrap text-xs sm:text-sm"
651
- ),
652
- children: t.expiresAt ? new Date(t.expiresAt).toLocaleDateString() : "-"
653
- }
654
- ),
655
- /* @__PURE__ */ e(s, { className: "align-top", align: "right", children: /* @__PURE__ */ r(
656
- R,
657
- {
658
- columnGap: 2,
659
- alignHorizontal: "flex-end",
660
- children: [
661
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
662
- z,
663
- {
664
- label: "Restore memory",
665
- mode: "system",
666
- placement: "top",
667
- trigger: /* @__PURE__ */ e(
668
- O,
669
- {
670
- focusMode: "system",
671
- noBorder: !0,
672
- label: "Restore memory",
673
- variant: "primary",
674
- disabled: V.isPending,
675
- onClick: () => {
676
- a && V.mutate({
677
- user: a,
678
- memoryId: t.memoryId
679
- });
680
- },
681
- children: /* @__PURE__ */ e(Ie, { size: "size-3", monotone: !0 })
682
- }
683
- )
684
- }
685
- ) }),
686
- /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(
687
- z,
688
- {
689
- label: "Delete memory",
690
- mode: "system",
691
- placement: "top",
692
- trigger: /* @__PURE__ */ e(
693
- O,
694
- {
695
- focusMode: "system",
696
- noBorder: !0,
697
- label: "Delete memory",
698
- variant: "primary",
699
- iconClassName: "text-red-700 dark:text-red-500",
700
- disabled: P.isPending,
701
- onClick: () => J(
702
- t.memoryId,
703
- t.text,
704
- t.description,
705
- t.createdAt
706
- ),
707
- children: /* @__PURE__ */ e(Z, { size: "size-3", monotone: !0 })
708
- }
709
- )
710
- }
711
- ) })
712
- ]
713
- }
714
- ) })
715
- ] }, t.memoryId)) }),
716
- /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(D, { children: /* @__PURE__ */ r(s, { colSpan: 5, children: [
717
- f.total,
718
- " expired memor",
719
- f.total === 1 ? "y" : "ies",
720
- f.totalTokenUsage !== void 0 && f.totalTokenUsage > 0 && /* @__PURE__ */ r(b, { children: [
721
- " ",
722
- "(approximately",
723
- " ",
724
- Math.round(
725
- f.totalTokenUsage
726
- ).toLocaleString(),
727
- " ",
728
- "token",
729
- Math.round(f.totalTokenUsage) === 1 ? "" : "s",
730
- ")"
731
- ] })
732
- ] }) }) })
733
- ] }) : /* @__PURE__ */ e("p", { className: "m-0 italic opacity-70", children: "No expired memories." }))
734
- ] })
735
- }
736
- )
737
- ] })
738
- }
739
- )
740
- ] });
741
- };
742
- export {
743
- He as UserMemoriesPanel,
744
- He as default
745
- };