@versini/sassysaint 8.117.0 → 8.118.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 (84) hide show
  1. package/dist/chunks/{AboutChangelog.Bn_KfUZc.js → AboutChangelog.NMMfTbp4.js} +2 -2
  2. package/dist/chunks/{AboutEntry.GETrm77g.js → AboutEntry.8kXGiBKr.js} +7 -7
  3. package/dist/chunks/{App.BzCbkgv8.js → App.MBikKP52.js} +618 -615
  4. package/dist/chunks/{BubbleActions.CbQ9BHWl.js → BubbleActions.u9muFBXv.js} +3 -3
  5. package/dist/chunks/{ButtonIconDelete.B5IpSZrD.js → ButtonIconDelete.UIDZwKOu.js} +2 -2
  6. package/dist/chunks/{Chart.Czhhtzdx.js → Chart.IEDLbK1M.js} +2 -2
  7. package/dist/chunks/{ChatBubbleAssistant.DESMaXGq.js → ChatBubbleAssistant.Cn1keoow.js} +5 -5
  8. package/dist/chunks/{ChatBubbleUser.B_Sniupu.js → ChatBubbleUser.DUizsIIv.js} +4 -4
  9. package/dist/chunks/{ChatHistoryTable.LPF05gFQ.js → ChatHistoryTable.DIT1MlOO.js} +4 -4
  10. package/dist/chunks/HistoryEntry.sZ_AMeUu.js +341 -0
  11. package/dist/chunks/InlineFilter.1dVMRTxM.js +58 -0
  12. package/dist/chunks/{LoginEntry.Bf8vuUIL.js → LoginEntry.BnHprT7f.js} +4 -4
  13. package/dist/chunks/{LogoEntry.yn5_B-fa.js → LogoEntry.uN5foS5i.js} +1 -1
  14. package/dist/chunks/MemoriesEntry.CpxdE30v.js +698 -0
  15. package/dist/chunks/{ProfileEntry.DitROf-m.js → ProfileEntry.BMpJic5U.js} +4 -4
  16. package/dist/chunks/{SettingsEntry.DUMuo462.js → SettingsEntry.B8xGufV0.js} +5 -5
  17. package/dist/chunks/{UsageEntry.CFMWYodz.js → UsageEntry.B1zVYUBb.js} +5 -5
  18. package/dist/chunks/{_baseUniq.D6y3dh-S.js → _baseUniq.BeocMcb-.js} +1 -1
  19. package/dist/chunks/{arc.CitIvzp8.js → arc.C-CDR6Sz.js} +1 -1
  20. package/dist/chunks/{architecture-U656AL7Q.IEP3vDFZ.js → architecture-U656AL7Q.DQ7Jtm55.js} +1 -1
  21. package/dist/chunks/{architectureDiagram-VXUJARFQ.BhDBUrYi.js → architectureDiagram-VXUJARFQ.Ceo3pgxm.js} +4 -4
  22. package/dist/chunks/{blockDiagram-VD42YOAC.BFTM8GAn.js → blockDiagram-VD42YOAC.BvjaUl_a.js} +5 -5
  23. package/dist/chunks/{browser.DK_o_vwl.js → browser.DvUqvHKQ.js} +1 -1
  24. package/dist/chunks/{c4Diagram-YG6GDRKO.B1vLaqvZ.js → c4Diagram-YG6GDRKO.D8dful9J.js} +2 -2
  25. package/dist/chunks/{channel.PCRnhDz7.js → channel.B6Qvl469.js} +1 -1
  26. package/dist/chunks/{chunk-4BX2VUAB.C6rU7w6S.js → chunk-4BX2VUAB.CtVNPH4N.js} +1 -1
  27. package/dist/chunks/{chunk-55IACEB6.BpJZHN1o.js → chunk-55IACEB6.C0X4Jue2.js} +1 -1
  28. package/dist/chunks/{chunk-B4BG7PRW.F4PL3cMr.js → chunk-B4BG7PRW.Conu6DQr.js} +4 -4
  29. package/dist/chunks/{chunk-DI55MBZ5.BF8GKejt.js → chunk-DI55MBZ5.Dg38hF9_.js} +3 -3
  30. package/dist/chunks/{chunk-FMBD7UC4.B1OYwU0R.js → chunk-FMBD7UC4.BsUH0rhB.js} +1 -1
  31. package/dist/chunks/{chunk-QN33PNHL.BD5brt5t.js → chunk-QN33PNHL.0RjA_wXX.js} +1 -1
  32. package/dist/chunks/{chunk-QZHKN3VN.D5WYYv36.js → chunk-QZHKN3VN.Dz6HmVZY.js} +1 -1
  33. package/dist/chunks/{chunk-TZMSLE5B.C-MZAsEe.js → chunk-TZMSLE5B.Dxuv9zIm.js} +1 -1
  34. package/dist/chunks/{classDiagram-2ON5EDUG.C5vYqJ4o.js → classDiagram-2ON5EDUG.CRdX6xMs.js} +2 -2
  35. package/dist/chunks/{classDiagram-v2-WZHVMYZB.C5vYqJ4o.js → classDiagram-v2-WZHVMYZB.CRdX6xMs.js} +2 -2
  36. package/dist/chunks/{clone.REJ_Pnlj.js → clone.ByaUA-r2.js} +1 -1
  37. package/dist/chunks/{cose-bilkent-S5V4N54A.DXqAwGZ0.js → cose-bilkent-S5V4N54A.B5YgIJoQ.js} +2 -2
  38. package/dist/chunks/{dagre-6UL2VRFP.CoGy5JIV.js → dagre-6UL2VRFP.uIiQ6FUj.js} +5 -5
  39. package/dist/chunks/{diagram-PSM6KHXK.D9vCcidT.js → diagram-PSM6KHXK.Bv8fX1RC.js} +4 -4
  40. package/dist/chunks/{diagram-QEK2KX5R.6csREdR0.js → diagram-QEK2KX5R.CY_Rq5A7.js} +3 -3
  41. package/dist/chunks/{diagram-S2PKOQOG.YPf4qVIj.js → diagram-S2PKOQOG.BfXCT4NH.js} +3 -3
  42. package/dist/chunks/{erDiagram-Q2GNP2WA.CGV8xXOX.js → erDiagram-Q2GNP2WA.BQrPmQkr.js} +4 -4
  43. package/dist/chunks/{flowDiagram-NV44I4VS.eQKIimm7.js → flowDiagram-NV44I4VS.DZwCRz8X.js} +5 -5
  44. package/dist/chunks/{ganttDiagram-JELNMOA3.BazHhqv4.js → ganttDiagram-JELNMOA3.CpqB-Lco.js} +2 -2
  45. package/dist/chunks/{gitGraph-F6HP7TQM.Cb-fQXsF.js → gitGraph-F6HP7TQM.HmdqWT9j.js} +1 -1
  46. package/dist/chunks/{gitGraphDiagram-NY62KEGX.Dvqk5LX3.js → gitGraphDiagram-NY62KEGX.i87uZR96.js} +4 -4
  47. package/dist/chunks/{graph.CgbRK_Pv.js → graph.C_jA5HK0.js} +2 -2
  48. package/dist/chunks/{index.CX_kqcF4.js → index.BHwQBUwd.js} +1 -1
  49. package/dist/chunks/{index.Bzms2RRF.js → index.BaE2Lbfd.js} +1 -1
  50. package/dist/chunks/{index.DzZEadJV.js → index.BggKJCTP.js} +1 -1
  51. package/dist/chunks/{index.BMJ9q_CF.js → index.Bm1g0K7E.js} +3 -3
  52. package/dist/chunks/{index.OAZ5W9VH.js → index.BrfxZy3k.js} +2 -2
  53. package/dist/chunks/{index.BkPtehbe.js → index.C5piY5Ss.js} +1 -1
  54. package/dist/chunks/{index.BEg4_Utt.js → index.Y9mwgfBs.js} +1 -1
  55. package/dist/chunks/{index.BkL02aS1.js → index.cXGGRddQ.js} +3 -3
  56. package/dist/chunks/{index.hL-ju5aR.js → index.g3S1xCER.js} +1 -1
  57. package/dist/chunks/{info-NVLQJR56.53x0eQWW.js → info-NVLQJR56.ITJfPEdI.js} +1 -1
  58. package/dist/chunks/{infoDiagram-WHAUD3N6.BlrSZ-3e.js → infoDiagram-WHAUD3N6.fkRhLS2k.js} +2 -2
  59. package/dist/chunks/{journeyDiagram-XKPGCS4Q.CJqy8tkA.js → journeyDiagram-XKPGCS4Q.BtGrOEeN.js} +4 -4
  60. package/dist/chunks/{kanban-definition-3W4ZIXB7.CRKN0s6T.js → kanban-definition-3W4ZIXB7.B5uNw32c.js} +2 -2
  61. package/dist/chunks/{layout.B3vPW_pZ.js → layout.CqkuHUdu.js} +4 -4
  62. package/dist/chunks/{mermaid-parser.core.ChRIRaJW.js → mermaid-parser.core.Ci-ITaRl.js} +10 -10
  63. package/dist/chunks/{min.CnRvIY0R.js → min.ZkscJwva.js} +2 -2
  64. package/dist/chunks/{mindmap-definition-VGOIOE7T.D_ABLFPV.js → mindmap-definition-VGOIOE7T.B6kzhC94.js} +4 -4
  65. package/dist/chunks/{packet-BFZMPI3H.CxGfStzw.js → packet-BFZMPI3H.BMbAoa6x.js} +1 -1
  66. package/dist/chunks/{pie-7BOR55EZ.DNt3EJ4F.js → pie-7BOR55EZ.BMdBvM8R.js} +1 -1
  67. package/dist/chunks/{pieDiagram-ADFJNKIX.DIQfkreO.js → pieDiagram-ADFJNKIX.-lbBXtjO.js} +4 -4
  68. package/dist/chunks/{quadrantDiagram-AYHSOK5B.CiwquW9n.js → quadrantDiagram-AYHSOK5B.Davn6069.js} +1 -1
  69. package/dist/chunks/{radar-NHE76QYJ.BjalOWfU.js → radar-NHE76QYJ.DYto8RZU.js} +1 -1
  70. package/dist/chunks/{rehype-mermaid.DiVW4LDn.js → rehype-mermaid.CSGNYSn9.js} +33 -33
  71. package/dist/chunks/{requirementDiagram-UZGBJVZJ.zxucHbPP.js → requirementDiagram-UZGBJVZJ.FMUxUq0R.js} +3 -3
  72. package/dist/chunks/{sankeyDiagram-TZEHDZUN.DD-PyOn-.js → sankeyDiagram-TZEHDZUN.DTIl9DDr.js} +1 -1
  73. package/dist/chunks/{sequenceDiagram-WL72ISMW.DR9lsGWA.js → sequenceDiagram-WL72ISMW.Bc9ucdVx.js} +3 -3
  74. package/dist/chunks/{stateDiagram-FKZM4ZOC.CsNkAXRg.js → stateDiagram-FKZM4ZOC.DiBSTbjk.js} +4 -4
  75. package/dist/chunks/{stateDiagram-v2-4FDKWEC3.8NFC4sNp.js → stateDiagram-v2-4FDKWEC3.C3xcoMwn.js} +2 -2
  76. package/dist/chunks/{timeline-definition-IT6M3QCI.KVweqk-o.js → timeline-definition-IT6M3QCI.BC01Xx8r.js} +2 -2
  77. package/dist/chunks/{treemap-KMMF4GRG.VQYaLH7h.js → treemap-KMMF4GRG.oysg6M_i.js} +1 -1
  78. package/dist/chunks/{useMarkdown.BwBe50mc.js → useMarkdown.D8WEecQ3.js} +8 -8
  79. package/dist/chunks/{xychartDiagram-PRI3JC2R.DLJNhHkJ.js → xychartDiagram-PRI3JC2R.C3TO2yCs.js} +1 -1
  80. package/dist/components/SassySaint/SassySaint.js +1 -1
  81. package/dist/index.js +3 -3
  82. package/package.json +3 -3
  83. package/dist/chunks/HistoryEntry.CbyRX9rD.js +0 -375
  84. package/dist/chunks/MemoriesEntry.Bljvi6W9.js +0 -649
@@ -0,0 +1,698 @@
1
+ import { jsx as e, jsxs as o, Fragment as k } from "react/jsx-runtime";
2
+ import { n as Ae, LOCAL_STORAGE_PREFIX as Q, 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.BrfxZy3k.js";
3
+ import { Button as L, TableCellSortDirections as C, ButtonIcon as F, IconEdit as Ie, IconRestore as Oe, IconDelete as Pe } from "./LogoEntry.uN5foS5i.js";
4
+ import { Panel as te, Toggle as M, ButtonCancel as re, ResponsiveTooltip as z, useLocalStorage as Y, debounce as Be, ConfirmationPanel as K } from "./App.MBikKP52.js";
5
+ import w from "clsx";
6
+ import { useState as f, useEffect as _e, useRef as R, useMemo as J, useCallback as Fe } from "react";
7
+ import { TextArea as ze } from "./index.C5piY5Ss.js";
8
+ import { InlineFilter as qe } from "./InlineFilter.1dVMRTxM.js";
9
+ import { TableHead as $e, TableRow as q, TableCell as g, TableCellSort as W, ButtonIconDelete as je, Table as Ge, TableBody as Ue, TableFooter as Ve } from "./ButtonIconDelete.UIDZwKOu.js";
10
+ const He = ({
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 y = () => {
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
+ te,
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(re, { onOpenChange: a, label: "Cancel" }) }),
42
+ /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ e(
43
+ L,
44
+ {
45
+ mode: "dark",
46
+ focusMode: "light",
47
+ disabled: s || !b || !A,
48
+ onClick: y,
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
+ M,
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
+ M,
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
+ M,
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
+ M,
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 Xe({
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 Qe({ 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 Ye({
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(q, { children: [
213
+ /* @__PURE__ */ e(g, { className: "sr-only", children: "Row" }),
214
+ /* @__PURE__ */ e(g, { children: "Memory" }),
215
+ /* @__PURE__ */ e(
216
+ W,
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
+ W,
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(g, { align: "right", children: "Actions" })
242
+ ] }) });
243
+ }
244
+ function Ke(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 Z(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 ee(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 Je({
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, y = r.createdAt ? new Date(r.createdAt).toLocaleDateString() : "-", b = r.expiresAt ? new Date(r.expiresAt).toLocaleDateString() : i === "active" ? "Never" : "-";
287
+ return /* @__PURE__ */ o(q, { children: [
288
+ /* @__PURE__ */ e(g, { className: w(S.rowNumber), children: a + 1 }),
289
+ /* @__PURE__ */ e(
290
+ g,
291
+ {
292
+ className: w(S.memoryText),
293
+ style: { wordBreak: "break-word" },
294
+ children: x
295
+ }
296
+ ),
297
+ /* @__PURE__ */ e(g, { className: w(S.date), children: y }),
298
+ /* @__PURE__ */ e(g, { className: w(S.dateCompact), children: b }),
299
+ /* @__PURE__ */ e(g, { 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 We({
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: y,
383
+ onSortChange: b,
384
+ onEdit: A,
385
+ onDelete: d,
386
+ onRestore: T
387
+ }) {
388
+ const I = /* @__PURE__ */ e(
389
+ Xe,
390
+ {
391
+ isLoading: a,
392
+ isError: i,
393
+ viewMode: t
394
+ }
395
+ );
396
+ if (a || i)
397
+ return I;
398
+ if (!r || r.items.length === 0)
399
+ return /* @__PURE__ */ e(Qe, { viewMode: t });
400
+ const O = Ke(r.items, s, c), D = x && y !== void 0 ? `Showing ${r.items.length} of ${Z(y, r.totalTokenUsage)}` : Z(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" ? D : void 0,
409
+ children: [
410
+ /* @__PURE__ */ e(
411
+ Ye,
412
+ {
413
+ sortDirection: c,
414
+ sortedCell: s,
415
+ viewMode: t,
416
+ onSortChange: b
417
+ }
418
+ ),
419
+ /* @__PURE__ */ e(Ue, { children: O.map((h, E) => /* @__PURE__ */ e(
420
+ Je,
421
+ {
422
+ memory: h,
423
+ index: E,
424
+ viewMode: t,
425
+ isEditPending: n,
426
+ isDeletePending: p,
427
+ isRestorePending: l,
428
+ onEdit: A,
429
+ onDelete: d,
430
+ onRestore: T
431
+ },
432
+ h.memoryId
433
+ )) }),
434
+ /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(q, { children: /* @__PURE__ */ e(g, { colSpan: 5, children: D }) }) })
435
+ ]
436
+ }
437
+ );
438
+ }
439
+ const ct = ({ open: r, onOpenChange: a, user: i }) => {
440
+ const t = R(null), c = R(null), { getAccessToken: s } = Ae(), [n, p] = f(""), [l, x] = f("active"), [y, b] = Y({
441
+ key: Q + Te,
442
+ initialValue: C.DESC
443
+ }), [A, d] = Y({
444
+ key: Q + Se,
445
+ initialValue: "createdAt"
446
+ }), [T, I] = f(
447
+ y || C.DESC
448
+ ), [O, D] = f(
449
+ A || "createdAt"
450
+ ), { data: h, isLoading: E, isError: ie } = we({
451
+ user: i,
452
+ getAccessToken: s,
453
+ enabled: r && l === "active"
454
+ }), {
455
+ data: N,
456
+ isLoading: oe,
457
+ isError: ne
458
+ } = De({
459
+ user: i,
460
+ getAccessToken: s,
461
+ enabled: r && l === "expired"
462
+ }), le = J(() => {
463
+ if (!h)
464
+ return;
465
+ const m = ee(h.items, n);
466
+ return {
467
+ ...h,
468
+ items: m,
469
+ filteredTotal: m.length
470
+ };
471
+ }, [h, n]), se = J(() => {
472
+ if (!N)
473
+ return;
474
+ const m = ee(
475
+ N.items,
476
+ n
477
+ );
478
+ return {
479
+ ...N,
480
+ items: m,
481
+ filteredTotal: m.length
482
+ };
483
+ }, [N, n]), ae = Fe(
484
+ Be((m) => {
485
+ p(m.target.value.trim());
486
+ }, 300),
487
+ []
488
+ ), ce = () => {
489
+ p(""), c.current && (c.current.value = "", c.current.focus());
490
+ }, $ = Ee({ getAccessToken: s }), j = ke({ getAccessToken: s }), G = Me({ getAccessToken: s }), P = Re({ getAccessToken: s }), U = Le({ getAccessToken: s }), [de, V] = f(!1), v = R(null), [me, H] = f(!1), [ue, B] = f(!1), u = R(null), xe = (m) => {
491
+ D(m), d(m), I((_) => {
492
+ const X = _ === C.ASC ? C.DESC : C.ASC;
493
+ return b(X), X;
494
+ });
495
+ }, pe = (m) => {
496
+ v.current = m, V(!0);
497
+ }, he = () => {
498
+ v.current && i && $.mutate({ user: i, memoryId: v.current.memoryId });
499
+ }, fe = (m) => {
500
+ u.current = m, B(!0);
501
+ }, ge = (m, _) => {
502
+ u.current && i && P.mutate(
503
+ {
504
+ user: i,
505
+ memoryId: u.current.memoryId,
506
+ description: m,
507
+ expiration: _ || void 0
508
+ },
509
+ {
510
+ onSuccess: () => {
511
+ B(!1);
512
+ }
513
+ }
514
+ );
515
+ }, ye = (m) => {
516
+ i && U.mutate({ user: i, memoryId: m });
517
+ }, be = () => {
518
+ i && H(!0);
519
+ }, ve = () => {
520
+ i && (l === "active" ? j.mutate({ user: i }) : G.mutate({ user: i }));
521
+ }, Ce = l === "active" ? h : N, Ne = (l === "active" ? j.isPending : G.isPending) || (Ce?.total ?? 0) === 0;
522
+ return /* @__PURE__ */ o(k, { children: [
523
+ /* @__PURE__ */ e(
524
+ He,
525
+ {
526
+ open: ue,
527
+ onOpenChange: B,
528
+ initialText: u.current?.description || "",
529
+ metadata: u.current ? {
530
+ categories: u.current.categories,
531
+ quote: u.current.quote,
532
+ canonicalText: u.current.canonicalText,
533
+ confidence: u.current.confidence,
534
+ status: u.current.status,
535
+ sourceType: u.current.sourceType,
536
+ expiration: u.current.expiration,
537
+ expiresAt: u.current.expiresAt
538
+ } : void 0,
539
+ onSave: ge,
540
+ isSaving: P.isPending
541
+ }
542
+ ),
543
+ /* @__PURE__ */ o(
544
+ K,
545
+ {
546
+ showConfirmation: de,
547
+ setShowConfirmation: V,
548
+ action: he,
549
+ customStrings: {
550
+ title: "Delete memory",
551
+ confirmAction: "Delete",
552
+ cancelAction: "Cancel"
553
+ },
554
+ children: [
555
+ /* @__PURE__ */ e("p", { className: "m-0", children: "Are you sure you want to delete this memory?" }),
556
+ /* @__PURE__ */ o("ul", { className: "m-0 mt-2 list-disc list-inside text-xs opacity-80", children: [
557
+ /* @__PURE__ */ o("li", { children: [
558
+ "Excerpt:",
559
+ " ",
560
+ (v.current?.description || v.current?.text || "").slice(0, 80)
561
+ ] }),
562
+ /* @__PURE__ */ o("li", { children: [
563
+ "Created:",
564
+ " ",
565
+ v.current?.createdAt ? new Date(v.current.createdAt).toLocaleString() : "-"
566
+ ] })
567
+ ] })
568
+ ]
569
+ }
570
+ ),
571
+ /* @__PURE__ */ e(
572
+ K,
573
+ {
574
+ showConfirmation: me,
575
+ setShowConfirmation: H,
576
+ action: ve,
577
+ customStrings: {
578
+ title: "Delete memories",
579
+ confirmAction: "Delete all",
580
+ cancelAction: "Cancel"
581
+ },
582
+ children: /* @__PURE__ */ e("p", { className: "m-0", children: l === "active" ? /* @__PURE__ */ o(k, { children: [
583
+ "This will permanently delete all ",
584
+ /* @__PURE__ */ e("em", { children: "active memories" }),
585
+ " for this user. This action cannot be undone."
586
+ ] }) : /* @__PURE__ */ o(k, { children: [
587
+ "This will permanently delete all ",
588
+ /* @__PURE__ */ e("em", { children: "expired memories" }),
589
+ " for this user. This action cannot be undone."
590
+ ] }) })
591
+ }
592
+ ),
593
+ /* @__PURE__ */ e(
594
+ te,
595
+ {
596
+ open: r,
597
+ onOpenChange: (m) => a(m),
598
+ title: "User Memories",
599
+ animation: !0,
600
+ animationType: "fade",
601
+ blurEffect: "large",
602
+ initialFocus: t,
603
+ footer: /* @__PURE__ */ o("div", { className: "flex flex-wrap justify-end gap-x-2", children: [
604
+ /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ e(
605
+ re,
606
+ {
607
+ onOpenChange: a,
608
+ label: "Close",
609
+ ref: t
610
+ }
611
+ ) }),
612
+ /* @__PURE__ */ e("div", { className: "box-border max-w-full basis-auto", children: /* @__PURE__ */ e(
613
+ L,
614
+ {
615
+ mode: "dark",
616
+ focusMode: "light",
617
+ variant: "danger",
618
+ disabled: Ne,
619
+ onClick: be,
620
+ children: "Delete All"
621
+ }
622
+ ) })
623
+ ] }),
624
+ children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-4 @container/editmemoriespanel", children: [
625
+ /* @__PURE__ */ e(
626
+ qe,
627
+ {
628
+ header: E && n ? "Loading..." : n ? "Filters applied" : "Filters",
629
+ toggles: /* @__PURE__ */ o(k, { children: [
630
+ /* @__PURE__ */ e(
631
+ L,
632
+ {
633
+ focusMode: "light",
634
+ mode: l === "active" ? "light" : "dark",
635
+ size: "small",
636
+ noBorder: !0,
637
+ onClick: () => x("active"),
638
+ children: "Active Memories"
639
+ }
640
+ ),
641
+ /* @__PURE__ */ e(
642
+ L,
643
+ {
644
+ focusMode: "light",
645
+ mode: l === "expired" ? "light" : "dark",
646
+ size: "small",
647
+ noBorder: !0,
648
+ onClick: () => x("expired"),
649
+ children: "Expired Memories"
650
+ }
651
+ )
652
+ ] }),
653
+ inputSearchRef: c,
654
+ onSearchChange: ae,
655
+ onResetSearch: ce,
656
+ defaultValue: n,
657
+ resetDisabled: n === ""
658
+ }
659
+ ),
660
+ /* @__PURE__ */ e(
661
+ "div",
662
+ {
663
+ className: w(
664
+ "flex flex-col sm:flex-row",
665
+ "max-h-[75vh]",
666
+ "sm:max-h-[75vh]",
667
+ "min-h-[70vh]"
668
+ ),
669
+ children: /* @__PURE__ */ e(
670
+ We,
671
+ {
672
+ data: l === "active" ? le : se,
673
+ isLoading: l === "active" ? E : oe,
674
+ isError: l === "active" ? ie : ne,
675
+ viewMode: l,
676
+ sortDirection: T,
677
+ sortedCell: O,
678
+ isEditPending: P.isPending,
679
+ isDeletePending: $.isPending,
680
+ isRestorePending: U.isPending,
681
+ isFiltered: n !== "",
682
+ totalCount: l === "active" ? h?.total : N?.total,
683
+ onSortChange: xe,
684
+ onEdit: l === "active" ? fe : void 0,
685
+ onDelete: pe,
686
+ onRestore: l === "expired" ? ye : void 0
687
+ }
688
+ )
689
+ }
690
+ )
691
+ ] })
692
+ }
693
+ )
694
+ ] });
695
+ };
696
+ export {
697
+ ct as default
698
+ };