@versini/sassysaint 8.117.1 → 8.118.1

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 (85) hide show
  1. package/dist/chunks/{AboutChangelog.C5D0TvzV.js → AboutChangelog.Dd-lJxFP.js} +2 -2
  2. package/dist/chunks/{AboutEntry.BH9puKiR.js → AboutEntry.B76hyRlF.js} +7 -7
  3. package/dist/chunks/{App.e-vnwYiT.js → App.CDmH0G0j.js} +24 -25
  4. package/dist/chunks/{BubbleActions.CZIq3NyO.js → BubbleActions.B4DdmpLt.js} +3 -3
  5. package/dist/chunks/{ButtonIconDelete.CXKvnkV9.js → ButtonIconDelete.BIQ0mdyX.js} +92 -112
  6. package/dist/chunks/{Chart.Crdej200.js → Chart.CjoR0Wd0.js} +2 -2
  7. package/dist/chunks/{ChatBubbleAssistant.BsPP4scU.js → ChatBubbleAssistant.DyYIdEm4.js} +5 -5
  8. package/dist/chunks/{ChatBubbleUser.CXbMpU0u.js → ChatBubbleUser.Ba27Y6M8.js} +4 -4
  9. package/dist/chunks/{ChatHistoryTable.WYPAqhPD.js → ChatHistoryTable.BQowENY6.js} +93 -89
  10. package/dist/chunks/HistoryEntry.Cn3jxdK8.js +328 -0
  11. package/dist/chunks/InlineFilter.C6W5hEeI.js +58 -0
  12. package/dist/chunks/{LoginEntry.DsfSv0HE.js → LoginEntry.CxIKfVlN.js} +4 -4
  13. package/dist/chunks/{LogoEntry.BaAKDAky.js → LogoEntry.CxkQlFwX.js} +1 -1
  14. package/dist/chunks/MemoriesEntry.D0KEXfwY.js +691 -0
  15. package/dist/chunks/{ProfileEntry.CbejkrAa.js → ProfileEntry.C1IhZsXL.js} +4 -4
  16. package/dist/chunks/{SettingsEntry.BMdkik84.js → SettingsEntry.B0fEZDDy.js} +5 -5
  17. package/dist/chunks/{UsageEntry.3T7jnx48.js → UsageEntry.Di2hXsKE.js} +5 -5
  18. package/dist/chunks/{_baseUniq.BfuOPl3s.js → _baseUniq.RtcyTVD3.js} +1 -1
  19. package/dist/chunks/{arc.Yt3LnN9o.js → arc.B2UgXHCR.js} +1 -1
  20. package/dist/chunks/{architecture-U656AL7Q.BXTYW3Rc.js → architecture-U656AL7Q.C7CI7QkV.js} +1 -1
  21. package/dist/chunks/{architectureDiagram-VXUJARFQ.FCDARRR_.js → architectureDiagram-VXUJARFQ.B9CZxGrg.js} +4 -4
  22. package/dist/chunks/{blockDiagram-VD42YOAC.C_rofYcs.js → blockDiagram-VD42YOAC.DPHK0nPj.js} +5 -5
  23. package/dist/chunks/{browser.D2KgtpfJ.js → browser.DNveIME9.js} +1 -1
  24. package/dist/chunks/{c4Diagram-YG6GDRKO.HzZGAApo.js → c4Diagram-YG6GDRKO.CzhFF3ka.js} +2 -2
  25. package/dist/chunks/{channel.DG7G3U7-.js → channel.DiQSGDER.js} +1 -1
  26. package/dist/chunks/{chunk-4BX2VUAB.B4e3aO1D.js → chunk-4BX2VUAB.DYJkaNUO.js} +1 -1
  27. package/dist/chunks/{chunk-55IACEB6.CESo1NrJ.js → chunk-55IACEB6.5Fa2WO_6.js} +1 -1
  28. package/dist/chunks/{chunk-B4BG7PRW.BBGa7Umf.js → chunk-B4BG7PRW.BwVppCji.js} +4 -4
  29. package/dist/chunks/{chunk-DI55MBZ5.Z9MLFT29.js → chunk-DI55MBZ5.DsOsqUyd.js} +3 -3
  30. package/dist/chunks/{chunk-FMBD7UC4.D4_NSJjG.js → chunk-FMBD7UC4.B2zbt4RX.js} +1 -1
  31. package/dist/chunks/{chunk-QN33PNHL.CWfoXUts.js → chunk-QN33PNHL.C4uUbvHm.js} +1 -1
  32. package/dist/chunks/{chunk-QZHKN3VN.CGQnP_Cf.js → chunk-QZHKN3VN.zom9Gu7S.js} +1 -1
  33. package/dist/chunks/{chunk-TZMSLE5B.BQIgZqgJ.js → chunk-TZMSLE5B.D37BJ9DQ.js} +1 -1
  34. package/dist/chunks/{classDiagram-2ON5EDUG.0mnXbc7I.js → classDiagram-2ON5EDUG.B38y8yzM.js} +2 -2
  35. package/dist/chunks/{classDiagram-v2-WZHVMYZB.0mnXbc7I.js → classDiagram-v2-WZHVMYZB.B38y8yzM.js} +2 -2
  36. package/dist/chunks/{clone.D47cjfdo.js → clone.C_dmGnmF.js} +1 -1
  37. package/dist/chunks/{cose-bilkent-S5V4N54A.mmkQB9Pa.js → cose-bilkent-S5V4N54A.B-IUzWpy.js} +2 -2
  38. package/dist/chunks/{dagre-6UL2VRFP.qd2wkZfB.js → dagre-6UL2VRFP.BVThCwwl.js} +5 -5
  39. package/dist/chunks/{diagram-PSM6KHXK.ck1CH-jB.js → diagram-PSM6KHXK.BXF6T9pt.js} +4 -4
  40. package/dist/chunks/{diagram-QEK2KX5R.CM3dUUt_.js → diagram-QEK2KX5R.CjKjCcWB.js} +3 -3
  41. package/dist/chunks/{diagram-S2PKOQOG.Bjpg3WXB.js → diagram-S2PKOQOG.BNknxY1p.js} +3 -3
  42. package/dist/chunks/{erDiagram-Q2GNP2WA.DQ7Zb7Yt.js → erDiagram-Q2GNP2WA.CFtxVaj1.js} +4 -4
  43. package/dist/chunks/{flowDiagram-NV44I4VS.Dd5E61BX.js → flowDiagram-NV44I4VS.QJyYNjO0.js} +5 -5
  44. package/dist/chunks/{ganttDiagram-JELNMOA3.D7NjdCpC.js → ganttDiagram-JELNMOA3.Bw3qGwGv.js} +2 -2
  45. package/dist/chunks/{gitGraph-F6HP7TQM.IaH3QLVX.js → gitGraph-F6HP7TQM.wJT1XvUI.js} +1 -1
  46. package/dist/chunks/{gitGraphDiagram-NY62KEGX.u0rUsMj1.js → gitGraphDiagram-NY62KEGX.Df8Hj879.js} +4 -4
  47. package/dist/chunks/{graph.wajwIKpE.js → graph.FrpT6ZL7.js} +2 -2
  48. package/dist/chunks/{index.CLoMSp2_.js → index.BCG13ez4.js} +1 -1
  49. package/dist/chunks/{index.ilaSLj1g.js → index.BbWF4ahv.js} +1 -1
  50. package/dist/chunks/{index.DtA4hmwf.js → index.BcxzV___.js} +1 -1
  51. package/dist/chunks/{index.DlOTeedC.js → index.BnhrWTfG.js} +1 -1
  52. package/dist/chunks/{index.BKWi9yvY.js → index.Ckw06Qre.js} +3 -3
  53. package/dist/chunks/{index.CDo0UzaU.js → index.D__OOf7L.js} +1 -1
  54. package/dist/chunks/{index.BZr0bEQg.js → index.DniyWjdG.js} +2 -2
  55. package/dist/chunks/{index.D4894ZsY.js → index.QUMWKPPg.js} +3 -3
  56. package/dist/chunks/{index.D5kSEkHn.js → index.cFkBRRtk.js} +1 -1
  57. package/dist/chunks/{info-NVLQJR56.B6lxthJ9.js → info-NVLQJR56.DY6KbgQZ.js} +1 -1
  58. package/dist/chunks/{infoDiagram-WHAUD3N6.BJncMSgg.js → infoDiagram-WHAUD3N6.CxU07Uaz.js} +2 -2
  59. package/dist/chunks/{journeyDiagram-XKPGCS4Q.Xc47puZv.js → journeyDiagram-XKPGCS4Q.BfIAVQwZ.js} +4 -4
  60. package/dist/chunks/{kanban-definition-3W4ZIXB7.DdnGsCVe.js → kanban-definition-3W4ZIXB7.CHNGSFPQ.js} +2 -2
  61. package/dist/chunks/{layout.BT5I7f25.js → layout.MEArWR4j.js} +4 -4
  62. package/dist/chunks/{mermaid-parser.core.Dy_1GmtD.js → mermaid-parser.core.Bm2PPbtx.js} +10 -10
  63. package/dist/chunks/{min.DvTOJyYm.js → min.D_Z3VpiR.js} +2 -2
  64. package/dist/chunks/{mindmap-definition-VGOIOE7T.Dd-3BZIu.js → mindmap-definition-VGOIOE7T.CFgPuXql.js} +4 -4
  65. package/dist/chunks/{packet-BFZMPI3H.Ch8ArXr6.js → packet-BFZMPI3H.5xnkqXMg.js} +1 -1
  66. package/dist/chunks/{pie-7BOR55EZ.EutZi19A.js → pie-7BOR55EZ.TJXn9PA3.js} +1 -1
  67. package/dist/chunks/{pieDiagram-ADFJNKIX.Bomp215d.js → pieDiagram-ADFJNKIX.Cl0OmnJC.js} +4 -4
  68. package/dist/chunks/{quadrantDiagram-AYHSOK5B.DpUG7iX4.js → quadrantDiagram-AYHSOK5B.BsCn9ZBZ.js} +1 -1
  69. package/dist/chunks/{radar-NHE76QYJ.WIkHtCoi.js → radar-NHE76QYJ.DPl1x_mG.js} +1 -1
  70. package/dist/chunks/{rehype-mermaid.D2XFy4HS.js → rehype-mermaid.CK2xcX8n.js} +33 -33
  71. package/dist/chunks/{requirementDiagram-UZGBJVZJ.C65oMSNO.js → requirementDiagram-UZGBJVZJ.D24MdwEw.js} +3 -3
  72. package/dist/chunks/{sankeyDiagram-TZEHDZUN.BPouA2z9.js → sankeyDiagram-TZEHDZUN.DN8E1Yma.js} +1 -1
  73. package/dist/chunks/{sequenceDiagram-WL72ISMW.DA-eSQtC.js → sequenceDiagram-WL72ISMW.CdAf_myJ.js} +3 -3
  74. package/dist/chunks/{stateDiagram-FKZM4ZOC.GNpavprD.js → stateDiagram-FKZM4ZOC.Dxcn59aw.js} +4 -4
  75. package/dist/chunks/{stateDiagram-v2-4FDKWEC3.DdUIinRt.js → stateDiagram-v2-4FDKWEC3.CYEBXfGv.js} +2 -2
  76. package/dist/chunks/{timeline-definition-IT6M3QCI.DlJeBBE7.js → timeline-definition-IT6M3QCI.Z4vaoiTd.js} +2 -2
  77. package/dist/chunks/{treemap-KMMF4GRG.BfQklqDu.js → treemap-KMMF4GRG.CnpNvY26.js} +1 -1
  78. package/dist/chunks/{useMarkdown.Sp_znZOD.js → useMarkdown.DPT1eeX6.js} +8 -8
  79. package/dist/chunks/{xychartDiagram-PRI3JC2R.e686B23N.js → xychartDiagram-PRI3JC2R.7mSrywd2.js} +1 -1
  80. package/dist/components/SassySaint/SassySaint.js +1 -1
  81. package/dist/index.js +3 -3
  82. package/dist/style.css +1 -1
  83. package/package.json +3 -3
  84. package/dist/chunks/HistoryEntry.BhWdD0eP.js +0 -375
  85. package/dist/chunks/MemoriesEntry.B86jHTrW.js +0 -649
@@ -0,0 +1,691 @@
1
+ import { jsx as e, jsxs as o, Fragment as E } from "react/jsx-runtime";
2
+ import { n as Ae, LOCAL_STORAGE_PREFIX as X, LOCAL_STORAGE_SORT_MEMORY_DIRECTION as Te, LOCAL_STORAGE_SORT_MEMORY_COLUMN as Se, useUserMemories as we, useExpiredMemories as De, useDeleteMemory as Ee, useDeleteAllActiveMemories as ke, useDeleteAllExpiredMemories as Me, useUpdateMemory as Re, useRestoreMemory as Le } from "./index.DniyWjdG.js";
3
+ import { Button as R, TableCellSortDirections as C, ButtonIcon as F, IconEdit as Ie, IconRestore as Oe, IconDelete as Pe } from "./LogoEntry.CxkQlFwX.js";
4
+ import { Panel as ee, Toggle as k, ButtonCancel as te, ResponsiveTooltip as z, useLocalStorage as Q, debounce as Be, ConfirmationPanel as Y } from "./App.CDmH0G0j.js";
5
+ import { useState as f, useEffect as _e, useRef as M, useMemo as K, useCallback as Fe } from "react";
6
+ import { TextArea as ze } from "./index.BCG13ez4.js";
7
+ import { InlineFilter as qe } from "./InlineFilter.C6W5hEeI.js";
8
+ import { TableHead as $e, TableRow as re, TableCell as y, TableCellSort as J, ButtonIconDelete as je, Table as Ge, TableBody as Ue } from "./ButtonIconDelete.BIQ0mdyX.js";
9
+ import w from "clsx";
10
+ const Ve = ({
11
+ open: r,
12
+ onOpenChange: a,
13
+ initialText: i,
14
+ metadata: t,
15
+ onSave: c,
16
+ isSaving: s = !1
17
+ }) => {
18
+ const [n, p] = f(i), [l, x] = f("none");
19
+ _e(() => {
20
+ if (r) {
21
+ p(i);
22
+ const d = t?.expiration || "none";
23
+ x(d);
24
+ }
25
+ }, [r, i, t?.expiration]);
26
+ const g = () => {
27
+ if (n.trim().length >= 3) {
28
+ const d = l === "none" ? null : l;
29
+ c(n.trim(), d);
30
+ }
31
+ }, b = n.trim().length >= 3, A = n.trim() !== i.trim() || l !== (t?.expiration || "none");
32
+ return /* @__PURE__ */ e(
33
+ ee,
34
+ {
35
+ open: r,
36
+ onOpenChange: a,
37
+ title: "Edit Memory",
38
+ animation: !0,
39
+ animationType: "fade",
40
+ footer: /* @__PURE__ */ o("div", { className: "flex flex-wrap justify-end gap-x-2", children: [
41
+ /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ e(te, { onOpenChange: a, label: "Cancel" }) }),
42
+ /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ e(
43
+ R,
44
+ {
45
+ mode: "dark",
46
+ focusMode: "light",
47
+ disabled: s || !b || !A,
48
+ onClick: g,
49
+ children: s ? "Saving..." : "Save"
50
+ }
51
+ ) })
52
+ ] }),
53
+ children: /* @__PURE__ */ o("div", { className: "flex flex-col pt-2 gap-4", children: [
54
+ /* @__PURE__ */ e(
55
+ ze,
56
+ {
57
+ mode: "dark",
58
+ focusMode: "light",
59
+ label: "Memory text",
60
+ name: "memoryText",
61
+ value: n,
62
+ onChange: (d) => p(d.target.value),
63
+ autoFocus: !0,
64
+ helperText: n.trim().length < 3 ? "Memory text must be at least 3 characters" : `${n.length} characters`
65
+ }
66
+ ),
67
+ /* @__PURE__ */ o("div", { className: "flex flex-col gap-3 p-4 bg-surface-darker rounded-md", children: [
68
+ /* @__PURE__ */ e("h3", { className: "text-sm m-0", children: "Memory Expiration" }),
69
+ /* @__PURE__ */ e("p", { className: "text-xs text-copy-medium m-0", children: "Set when this memory should expire and be automatically removed." }),
70
+ /* @__PURE__ */ o("div", { className: "flex flex-col gap-2", children: [
71
+ /* @__PURE__ */ e(
72
+ k,
73
+ {
74
+ mode: "dark",
75
+ focusMode: "light",
76
+ noBorder: !0,
77
+ narrow: !0,
78
+ label: "Never expire",
79
+ name: "expiration-none",
80
+ checked: l === "none",
81
+ onChange: (d) => {
82
+ d && x("none");
83
+ }
84
+ }
85
+ ),
86
+ /* @__PURE__ */ e(
87
+ k,
88
+ {
89
+ mode: "dark",
90
+ focusMode: "light",
91
+ noBorder: !0,
92
+ narrow: !0,
93
+ label: "Short (1 month)",
94
+ name: "expiration-short",
95
+ checked: l === "short",
96
+ onChange: (d) => {
97
+ d && x("short");
98
+ }
99
+ }
100
+ ),
101
+ /* @__PURE__ */ e(
102
+ k,
103
+ {
104
+ mode: "dark",
105
+ focusMode: "light",
106
+ noBorder: !0,
107
+ narrow: !0,
108
+ label: "Medium (6 months)",
109
+ name: "expiration-medium",
110
+ checked: l === "medium",
111
+ onChange: (d) => {
112
+ d && x("medium");
113
+ }
114
+ }
115
+ ),
116
+ /* @__PURE__ */ e(
117
+ k,
118
+ {
119
+ mode: "dark",
120
+ focusMode: "light",
121
+ noBorder: !0,
122
+ narrow: !0,
123
+ label: "Long (1 year)",
124
+ name: "expiration-long",
125
+ checked: l === "long",
126
+ onChange: (d) => {
127
+ d && x("long");
128
+ }
129
+ }
130
+ )
131
+ ] })
132
+ ] }),
133
+ t && /* @__PURE__ */ o("div", { className: "flex flex-col gap-3 p-4 bg-surface-darker rounded-md", children: [
134
+ /* @__PURE__ */ e("h3", { className: "text-sm m-0", children: "Memory Details" }),
135
+ t.categories && t.categories.length > 0 && /* @__PURE__ */ o("div", { className: "flex flex-col gap-1", children: [
136
+ /* @__PURE__ */ e("span", { className: "text-xs text-copy-medium uppercase", children: "Category" }),
137
+ /* @__PURE__ */ e("div", { className: "flex flex-wrap gap-1", children: t.categories.map((d, T) => /* @__PURE__ */ e(
138
+ "span",
139
+ {
140
+ className: "text-xs px-2 py-1 text-copy-light rounded",
141
+ children: d
142
+ },
143
+ `${d}-${T}`
144
+ )) })
145
+ ] }),
146
+ /* @__PURE__ */ o("div", { className: "flex flex-col sm:flex-row gap-4", children: [
147
+ /* @__PURE__ */ o("div", { className: "flex flex-col gap-3 sm:flex-1", children: [
148
+ t.confidence !== void 0 && t.confidence !== null && /* @__PURE__ */ o("div", { className: "flex flex-col gap-1", children: [
149
+ /* @__PURE__ */ e("span", { className: "text-xs text-copy-medium uppercase", children: "Confidence" }),
150
+ /* @__PURE__ */ o("span", { className: "text-sm text-copy-light", children: [
151
+ (t.confidence * 100).toFixed(0),
152
+ "%"
153
+ ] })
154
+ ] }),
155
+ t.status && /* @__PURE__ */ o("div", { className: "flex flex-col gap-1", children: [
156
+ /* @__PURE__ */ e("span", { className: "text-xs text-copy-medium uppercase", children: "Status" }),
157
+ /* @__PURE__ */ e("span", { className: "text-sm text-copy-light capitalize", children: t.status })
158
+ ] }),
159
+ t.sourceType && /* @__PURE__ */ o("div", { className: "flex flex-col gap-1", children: [
160
+ /* @__PURE__ */ e("span", { className: "text-xs text-copy-medium uppercase", children: "Source Type" }),
161
+ /* @__PURE__ */ e("span", { className: "text-sm text-copy-light capitalize", children: t.sourceType })
162
+ ] })
163
+ ] }),
164
+ /* @__PURE__ */ o("div", { className: "flex flex-col gap-3 sm:flex-1", children: [
165
+ t.quote && /* @__PURE__ */ o("div", { className: "flex flex-col gap-1", children: [
166
+ /* @__PURE__ */ e("span", { className: "text-xs text-copy-medium uppercase", children: "Original Prompt" }),
167
+ /* @__PURE__ */ o("p", { className: "text-sm text-copy-light m-0 italic", children: [
168
+ '"',
169
+ t.quote,
170
+ '"'
171
+ ] })
172
+ ] }),
173
+ t.canonicalText && /* @__PURE__ */ o("div", { className: "flex flex-col gap-1", children: [
174
+ /* @__PURE__ */ e("span", { className: "text-xs text-copy-medium uppercase", children: "Canonical Text" }),
175
+ /* @__PURE__ */ e("p", { className: "text-sm text-copy-light m-0 font-mono", children: t.canonicalText })
176
+ ] })
177
+ ] })
178
+ ] })
179
+ ] })
180
+ ] })
181
+ }
182
+ );
183
+ };
184
+ function He({
185
+ isLoading: r,
186
+ isError: a,
187
+ viewMode: i
188
+ }) {
189
+ const t = i === "expired" ? "expired memories" : "memories";
190
+ return r ? /* @__PURE__ */ o("p", { className: "m-0", children: [
191
+ "Loading ",
192
+ t,
193
+ "..."
194
+ ] }) : a ? /* @__PURE__ */ o("p", { className: "m-0 text-copy-error-light", children: [
195
+ "Failed to load ",
196
+ t,
197
+ "."
198
+ ] }) : null;
199
+ }
200
+ function Xe({ viewMode: r }) {
201
+ return /* @__PURE__ */ e("p", { className: "m-0 italic opacity-70", children: r === "expired" ? "No expired memories." : "No memories stored." });
202
+ }
203
+ function Qe({
204
+ sortDirection: r,
205
+ sortedCell: a,
206
+ viewMode: i,
207
+ onSortChange: t
208
+ }) {
209
+ const c = (s) => {
210
+ t(s);
211
+ };
212
+ return /* @__PURE__ */ e($e, { children: /* @__PURE__ */ o(re, { children: [
213
+ /* @__PURE__ */ e(y, { className: "sr-only", children: "Row" }),
214
+ /* @__PURE__ */ e(y, { children: "Memory" }),
215
+ /* @__PURE__ */ e(
216
+ J,
217
+ {
218
+ focusMode: "system",
219
+ buttonClassName: "text-xs sm:text-sm",
220
+ cellId: "createdAt",
221
+ align: "left",
222
+ sortDirection: r,
223
+ sortedCell: a,
224
+ onClick: () => c("createdAt"),
225
+ children: "Date"
226
+ }
227
+ ),
228
+ /* @__PURE__ */ e(
229
+ J,
230
+ {
231
+ focusMode: "system",
232
+ buttonClassName: "text-xs sm:text-sm",
233
+ cellId: "expiresAt",
234
+ align: "left",
235
+ sortDirection: r,
236
+ sortedCell: a,
237
+ onClick: () => c("expiresAt"),
238
+ children: i === "active" ? "Expires" : "Expired"
239
+ }
240
+ ),
241
+ /* @__PURE__ */ e(y, { align: "right", children: "Actions" })
242
+ ] }) });
243
+ }
244
+ function Ye(r, a, i) {
245
+ return [...r].sort((t, c) => {
246
+ if (a === "createdAt") {
247
+ const s = t.createdAt ? new Date(t.createdAt).getTime() : 0, n = c.createdAt ? new Date(c.createdAt).getTime() : 0;
248
+ return i === C.ASC ? s - n : n - s;
249
+ }
250
+ if (a === "expiresAt") {
251
+ const s = t.expiresAt ? new Date(t.expiresAt).getTime() : Number.MAX_SAFE_INTEGER, n = c.expiresAt ? new Date(c.expiresAt).getTime() : Number.MAX_SAFE_INTEGER;
252
+ return i === C.ASC ? s - n : n - s;
253
+ }
254
+ return 0;
255
+ });
256
+ }
257
+ function W(r, a) {
258
+ const i = `${r} memor${r === 1 ? "y" : "ies"}`, t = a ? ` (~${a} tokens)` : "";
259
+ return i + t;
260
+ }
261
+ const S = {
262
+ rowNumber: "dark:text-copy-medium",
263
+ memoryText: "dark:text-copy-lighter max-w-25 sm:max-w-100 text-xs sm:text-sm",
264
+ date: "dark:text-copy-medium sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none",
265
+ dateCompact: "dark:text-copy-medium sm:whitespace-nowrap text-xs sm:text-sm",
266
+ actions: "align-top border-l border-table-light dark:border-table-dark"
267
+ };
268
+ function Z(r, a) {
269
+ const i = a.trim().toLowerCase();
270
+ return i ? r.filter((t) => {
271
+ const c = (t.description || "").toLowerCase(), s = (t.text || "").toLowerCase(), n = (t.categories || []).join(" ").toLowerCase();
272
+ return c.includes(i) || s.includes(i) || n.includes(i);
273
+ }) : r;
274
+ }
275
+ function Ke({
276
+ memory: r,
277
+ index: a,
278
+ viewMode: i,
279
+ isEditPending: t = !1,
280
+ isDeletePending: c = !1,
281
+ isRestorePending: s = !1,
282
+ onEdit: n,
283
+ onDelete: p,
284
+ onRestore: l
285
+ }) {
286
+ const x = r.description || r.text, g = r.createdAt ? new Date(r.createdAt).toLocaleDateString() : "-", b = r.expiresAt ? new Date(r.expiresAt).toLocaleDateString() : i === "active" ? "Never" : "-";
287
+ return /* @__PURE__ */ o(re, { children: [
288
+ /* @__PURE__ */ e(y, { className: w(S.rowNumber), children: a + 1 }),
289
+ /* @__PURE__ */ e(
290
+ y,
291
+ {
292
+ className: w(S.memoryText),
293
+ style: { wordBreak: "break-word" },
294
+ children: x
295
+ }
296
+ ),
297
+ /* @__PURE__ */ e(y, { className: w(S.date), children: g }),
298
+ /* @__PURE__ */ e(y, { className: w(S.dateCompact), children: b }),
299
+ /* @__PURE__ */ e(y, { className: S.actions, align: "right", children: /* @__PURE__ */ o("div", { className: "flex flex-wrap justify-end gap-x-2", children: [
300
+ i === "active" && n && /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ e(
301
+ z,
302
+ {
303
+ label: "Edit memory",
304
+ mode: "system",
305
+ placement: "top",
306
+ trigger: /* @__PURE__ */ e(
307
+ F,
308
+ {
309
+ focusMode: "system",
310
+ noBorder: !0,
311
+ label: "Edit memory",
312
+ variant: "primary",
313
+ disabled: t,
314
+ onClick: () => n(r),
315
+ children: /* @__PURE__ */ e(Ie, { size: "size-3", monotone: !0 })
316
+ }
317
+ )
318
+ }
319
+ ) }),
320
+ i === "expired" && l && /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ e(
321
+ z,
322
+ {
323
+ label: "Restore memory",
324
+ mode: "system",
325
+ placement: "top",
326
+ trigger: /* @__PURE__ */ e(
327
+ F,
328
+ {
329
+ focusMode: "system",
330
+ noBorder: !0,
331
+ label: "Restore memory",
332
+ variant: "primary",
333
+ disabled: s,
334
+ onClick: () => l(r.memoryId),
335
+ children: /* @__PURE__ */ e(Oe, { size: "size-3", monotone: !0 })
336
+ }
337
+ )
338
+ }
339
+ ) }),
340
+ /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: i === "active" ? /* @__PURE__ */ e(
341
+ je,
342
+ {
343
+ label: "Delete memory",
344
+ disabled: c,
345
+ onClick: () => p(r)
346
+ }
347
+ ) : /* @__PURE__ */ e(
348
+ z,
349
+ {
350
+ label: "Delete memory",
351
+ mode: "system",
352
+ placement: "top",
353
+ trigger: /* @__PURE__ */ e(
354
+ F,
355
+ {
356
+ focusMode: "system",
357
+ noBorder: !0,
358
+ label: "Delete memory",
359
+ variant: "primary",
360
+ iconClassName: "text-copy-error-dark dark:text-copy-error-light",
361
+ disabled: c,
362
+ onClick: () => p(r),
363
+ children: /* @__PURE__ */ e(Pe, { size: "size-3", monotone: !0 })
364
+ }
365
+ )
366
+ }
367
+ ) })
368
+ ] }) })
369
+ ] }, r.memoryId);
370
+ }
371
+ function Je({
372
+ data: r,
373
+ isLoading: a,
374
+ isError: i,
375
+ viewMode: t,
376
+ sortDirection: c,
377
+ sortedCell: s,
378
+ isEditPending: n = !1,
379
+ isDeletePending: p = !1,
380
+ isRestorePending: l = !1,
381
+ isFiltered: x = !1,
382
+ totalCount: g,
383
+ onSortChange: b,
384
+ onEdit: A,
385
+ onDelete: d,
386
+ onRestore: T
387
+ }) {
388
+ const L = /* @__PURE__ */ e(
389
+ He,
390
+ {
391
+ isLoading: a,
392
+ isError: i,
393
+ viewMode: t
394
+ }
395
+ );
396
+ if (a || i)
397
+ return L;
398
+ if (!r || r.items.length === 0)
399
+ return /* @__PURE__ */ e(Xe, { viewMode: t });
400
+ const I = Ye(r.items, s, c), O = x && g !== void 0 ? `Showing ${r.items.length} of ${W(g, r.totalTokenUsage)}` : W(r.total, r.totalTokenUsage);
401
+ return /* @__PURE__ */ o(
402
+ Ge,
403
+ {
404
+ stickyHeader: !0,
405
+ stickyFooter: !0,
406
+ compact: !0,
407
+ mode: "alt-system",
408
+ caption: t === "active" ? O : void 0,
409
+ wrapperClassName: w(
410
+ "max-h-[clamp(12rem,calc(100dvh-24rem),60dvh)]",
411
+ "sm:max-h-[clamp(12rem,calc(100dvh-24rem),60dvh)]"
412
+ ),
413
+ children: [
414
+ /* @__PURE__ */ e(
415
+ Qe,
416
+ {
417
+ sortDirection: c,
418
+ sortedCell: s,
419
+ viewMode: t,
420
+ onSortChange: b
421
+ }
422
+ ),
423
+ /* @__PURE__ */ e(Ue, { children: I.map((h, D) => /* @__PURE__ */ e(
424
+ Ke,
425
+ {
426
+ memory: h,
427
+ index: D,
428
+ viewMode: t,
429
+ isEditPending: n,
430
+ isDeletePending: p,
431
+ isRestorePending: l,
432
+ onEdit: A,
433
+ onDelete: d,
434
+ onRestore: T
435
+ },
436
+ h.memoryId
437
+ )) })
438
+ ]
439
+ }
440
+ );
441
+ }
442
+ const at = ({ open: r, onOpenChange: a, user: i }) => {
443
+ const t = M(null), c = M(null), { getAccessToken: s } = Ae(), [n, p] = f(""), [l, x] = f("active"), [g, b] = Q({
444
+ key: X + Te,
445
+ initialValue: C.DESC
446
+ }), [A, d] = Q({
447
+ key: X + Se,
448
+ initialValue: "createdAt"
449
+ }), [T, L] = f(
450
+ g || C.DESC
451
+ ), [I, O] = f(
452
+ A || "createdAt"
453
+ ), { data: h, isLoading: D, isError: ie } = we({
454
+ user: i,
455
+ getAccessToken: s,
456
+ enabled: r && l === "active"
457
+ }), {
458
+ data: N,
459
+ isLoading: oe,
460
+ isError: ne
461
+ } = De({
462
+ user: i,
463
+ getAccessToken: s,
464
+ enabled: r && l === "expired"
465
+ }), le = K(() => {
466
+ if (!h)
467
+ return;
468
+ const m = Z(h.items, n);
469
+ return {
470
+ ...h,
471
+ items: m,
472
+ filteredTotal: m.length
473
+ };
474
+ }, [h, n]), se = K(() => {
475
+ if (!N)
476
+ return;
477
+ const m = Z(
478
+ N.items,
479
+ n
480
+ );
481
+ return {
482
+ ...N,
483
+ items: m,
484
+ filteredTotal: m.length
485
+ };
486
+ }, [N, n]), ae = Fe(
487
+ Be((m) => {
488
+ p(m.target.value.trim());
489
+ }, 300),
490
+ []
491
+ ), ce = () => {
492
+ p(""), c.current && (c.current.value = "", c.current.focus());
493
+ }, q = Ee({ getAccessToken: s }), $ = ke({ getAccessToken: s }), j = Me({ getAccessToken: s }), P = Re({ getAccessToken: s }), G = Le({ getAccessToken: s }), [de, U] = f(!1), v = M(null), [me, V] = f(!1), [ue, B] = f(!1), u = M(null), xe = (m) => {
494
+ O(m), d(m), L((_) => {
495
+ const H = _ === C.ASC ? C.DESC : C.ASC;
496
+ return b(H), H;
497
+ });
498
+ }, pe = (m) => {
499
+ v.current = m, U(!0);
500
+ }, he = () => {
501
+ v.current && i && q.mutate({ user: i, memoryId: v.current.memoryId });
502
+ }, fe = (m) => {
503
+ u.current = m, B(!0);
504
+ }, ge = (m, _) => {
505
+ u.current && i && P.mutate(
506
+ {
507
+ user: i,
508
+ memoryId: u.current.memoryId,
509
+ description: m,
510
+ expiration: _ || void 0
511
+ },
512
+ {
513
+ onSuccess: () => {
514
+ B(!1);
515
+ }
516
+ }
517
+ );
518
+ }, ye = (m) => {
519
+ i && G.mutate({ user: i, memoryId: m });
520
+ }, be = () => {
521
+ i && V(!0);
522
+ }, ve = () => {
523
+ i && (l === "active" ? $.mutate({ user: i }) : j.mutate({ user: i }));
524
+ }, Ce = l === "active" ? h : N, Ne = (l === "active" ? $.isPending : j.isPending) || (Ce?.total ?? 0) === 0;
525
+ return /* @__PURE__ */ o(E, { children: [
526
+ /* @__PURE__ */ e(
527
+ Ve,
528
+ {
529
+ open: ue,
530
+ onOpenChange: B,
531
+ initialText: u.current?.description || "",
532
+ metadata: u.current ? {
533
+ categories: u.current.categories,
534
+ quote: u.current.quote,
535
+ canonicalText: u.current.canonicalText,
536
+ confidence: u.current.confidence,
537
+ status: u.current.status,
538
+ sourceType: u.current.sourceType,
539
+ expiration: u.current.expiration,
540
+ expiresAt: u.current.expiresAt
541
+ } : void 0,
542
+ onSave: ge,
543
+ isSaving: P.isPending
544
+ }
545
+ ),
546
+ /* @__PURE__ */ o(
547
+ Y,
548
+ {
549
+ showConfirmation: de,
550
+ setShowConfirmation: U,
551
+ action: he,
552
+ customStrings: {
553
+ title: "Delete memory",
554
+ confirmAction: "Delete",
555
+ cancelAction: "Cancel"
556
+ },
557
+ children: [
558
+ /* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete this memory?" }),
559
+ /* @__PURE__ */ o("ul", { className: "m-0 mt-2 list-disc list-inside text-xs opacity-80", children: [
560
+ /* @__PURE__ */ o("li", { children: [
561
+ "Excerpt:",
562
+ " ",
563
+ (v.current?.description || v.current?.text || "").slice(0, 80)
564
+ ] }),
565
+ /* @__PURE__ */ o("li", { children: [
566
+ "Created:",
567
+ " ",
568
+ v.current?.createdAt ? new Date(v.current.createdAt).toLocaleString() : "-"
569
+ ] })
570
+ ] })
571
+ ]
572
+ }
573
+ ),
574
+ /* @__PURE__ */ e(
575
+ Y,
576
+ {
577
+ showConfirmation: me,
578
+ setShowConfirmation: V,
579
+ action: ve,
580
+ customStrings: {
581
+ title: "Delete memories",
582
+ confirmAction: "Delete all",
583
+ cancelAction: "Cancel"
584
+ },
585
+ children: /* @__PURE__ */ e("p", { className: "m-0", children: l === "active" ? /* @__PURE__ */ o(E, { children: [
586
+ "This will permanently delete all ",
587
+ /* @__PURE__ */ e("em", { children: "active memories" }),
588
+ " for this user. This action cannot be undone."
589
+ ] }) : /* @__PURE__ */ o(E, { children: [
590
+ "This will permanently delete all ",
591
+ /* @__PURE__ */ e("em", { children: "expired memories" }),
592
+ " for this user. This action cannot be undone."
593
+ ] }) })
594
+ }
595
+ ),
596
+ /* @__PURE__ */ e(
597
+ ee,
598
+ {
599
+ open: r,
600
+ onOpenChange: (m) => a(m),
601
+ title: "User Memories",
602
+ animation: !0,
603
+ animationType: "fade",
604
+ blurEffect: "large",
605
+ initialFocus: t,
606
+ className: "h-full sm:h-max",
607
+ footer: /* @__PURE__ */ o("div", { className: "flex flex-wrap justify-end gap-x-2", children: [
608
+ /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ e(
609
+ te,
610
+ {
611
+ onOpenChange: a,
612
+ label: "Close",
613
+ ref: t
614
+ }
615
+ ) }),
616
+ /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ e(
617
+ R,
618
+ {
619
+ mode: "dark",
620
+ focusMode: "light",
621
+ variant: "danger",
622
+ disabled: Ne,
623
+ onClick: be,
624
+ children: "Delete All"
625
+ }
626
+ ) })
627
+ ] }),
628
+ children: /* @__PURE__ */ o("div", { className: "flex h-full flex-col gap-4", children: [
629
+ /* @__PURE__ */ e(
630
+ qe,
631
+ {
632
+ header: D && n ? "Loading..." : n ? "Filters applied" : "Filters",
633
+ toggles: /* @__PURE__ */ o(E, { children: [
634
+ /* @__PURE__ */ e(
635
+ R,
636
+ {
637
+ focusMode: "light",
638
+ mode: l === "active" ? "light" : "dark",
639
+ size: "small",
640
+ noBorder: !0,
641
+ onClick: () => x("active"),
642
+ children: "Active Memories"
643
+ }
644
+ ),
645
+ /* @__PURE__ */ e(
646
+ R,
647
+ {
648
+ focusMode: "light",
649
+ mode: l === "expired" ? "light" : "dark",
650
+ size: "small",
651
+ noBorder: !0,
652
+ onClick: () => x("expired"),
653
+ children: "Expired Memories"
654
+ }
655
+ )
656
+ ] }),
657
+ inputSearchRef: c,
658
+ onSearchChange: ae,
659
+ onResetSearch: ce,
660
+ defaultValue: n,
661
+ resetDisabled: n === ""
662
+ }
663
+ ),
664
+ /* @__PURE__ */ e(
665
+ Je,
666
+ {
667
+ data: l === "active" ? le : se,
668
+ isLoading: l === "active" ? D : oe,
669
+ isError: l === "active" ? ie : ne,
670
+ viewMode: l,
671
+ sortDirection: T,
672
+ sortedCell: I,
673
+ isEditPending: P.isPending,
674
+ isDeletePending: q.isPending,
675
+ isRestorePending: G.isPending,
676
+ isFiltered: n !== "",
677
+ totalCount: l === "active" ? h?.total : N?.total,
678
+ onSortChange: xe,
679
+ onEdit: l === "active" ? fe : void 0,
680
+ onDelete: pe,
681
+ onRestore: l === "expired" ? ye : void 0
682
+ }
683
+ )
684
+ ] })
685
+ }
686
+ )
687
+ ] });
688
+ };
689
+ export {
690
+ at as default
691
+ };