@versini/sassysaint 8.73.1 → 8.73.3

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.2b2DI_SN.js → AboutChangelog.661DKCgk.js} +2 -2
  2. package/dist/chunks/{AboutEntry.BHq7KBa1.js → AboutEntry.DiCPTiLj.js} +5 -5
  3. package/dist/chunks/{App.DcQF9Hq9.js → App.5gxvd-4-.js} +699 -681
  4. package/dist/chunks/{Chart.DAdepX81.js → Chart.DTAX5Zd_.js} +2 -2
  5. package/dist/chunks/{ChatBubbleAssistant.BF3Bj7JJ.js → ChatBubbleAssistant.C-aLHVG0.js} +4 -4
  6. package/dist/chunks/{ChatBubbleUser.B5uyfOKG.js → ChatBubbleUser.Cb2OzGt2.js} +3 -3
  7. package/dist/chunks/{ChatHistoryTable.BwjPu3FF.js → ChatHistoryTable.DodhSBf9.js} +63 -62
  8. package/dist/chunks/HistoryEntry.BHKiSJYf.js +333 -0
  9. package/dist/chunks/{ProfileEntry.Ce801i2m.js → ProfileEntry.A_AoGwYv.js} +2 -2
  10. package/dist/chunks/{SettingsEntry.fNHoX42W.js → SettingsEntry.D4RhlncR.js} +3 -3
  11. package/dist/chunks/{Table.J1RcsDNn.js → Table.Uvq7uGxR.js} +2 -2
  12. package/dist/chunks/{UsageEntry.k-Ljpdg9.js → UsageEntry.DrVVPYLQ.js} +3 -3
  13. package/dist/chunks/{UserMemoriesPanel.C0BI-Pbv.js → UserMemoriesPanel.kh9_pfi_.js} +4 -4
  14. package/dist/chunks/{index.C_OZL-ky.js → index.B6va7ILw.js} +1 -1
  15. package/dist/chunks/{index.CauWbyr8.js → index.CCW8q5W5.js} +3 -3
  16. package/dist/chunks/{index.RnO-M1tm.js → index.CJZ4xgED.js} +2 -2
  17. package/dist/chunks/{index.uzB9FupG.js → index.DB7deAkb.js} +10 -5
  18. package/dist/chunks/{index.FbsVqChk.js → index.Dfe22wCV.js} +1 -1
  19. package/dist/chunks/{index.nSgn5ZFo.js → index.Dq4WBOGA.js} +1 -1
  20. package/dist/chunks/{index.CmXD-yP7.js → index.DtuEQYZN.js} +1 -1
  21. package/dist/chunks/{index.BqnKf1sr.js → index.O2zfzZcM.js} +1 -1
  22. package/dist/chunks/{useMarkdown.rLeRHXfb.js → useMarkdown.DpoGjOrf.js} +6 -6
  23. package/dist/components/SassySaint/SassySaint.js +1 -1
  24. package/dist/index.js +4 -4
  25. package/dist/style.css +1 -1
  26. package/package.json +3 -3
  27. package/dist/chunks/HistoryEntry.Cj5Hwpkx.js +0 -327
@@ -1,7 +1,7 @@
1
1
  import { jsx as Ap } from "react/jsx-runtime";
2
- import { getDefaultExportFromCjs as ln } from "./App.DcQF9Hq9.js";
2
+ import { getDefaultExportFromCjs as ln } from "./App.5gxvd-4-.js";
3
3
  import Cp, { useState as Pp, useEffect as Op } from "react";
4
- import { TRIMESTERS as rn, TRIMESTERS_SHORT as Lp, isProbablyMobile as Ep } from "./index.uzB9FupG.js";
4
+ import { TRIMESTERS as rn, TRIMESTERS_SHORT as Lp, isProbablyMobile as Ep } from "./index.DB7deAkb.js";
5
5
  var ls = { exports: {} }, Ip = ls.exports, on;
6
6
  function Dp() {
7
7
  return on || (on = 1, (function(we, he) {
@@ -1,10 +1,10 @@
1
1
  import { jsx as g } from "react/jsx-runtime";
2
- import { n as N, useUserPreferences as O, convertCamelCaseToReadable as P, numberFormatter as R, pluralize as y, b as L } from "./index.uzB9FupG.js";
3
- import { BUBBLE_FOOTER_EMPTY as _ } from "./index.BqnKf1sr.js";
2
+ import { n as N, useUserPreferences as O, convertCamelCaseToReadable as P, numberFormatter as R, pluralize as y, b as L } from "./index.DB7deAkb.js";
3
+ import { BUBBLE_FOOTER_EMPTY as _ } from "./index.O2zfzZcM.js";
4
4
  import w from "clsx";
5
5
  import v, { useState as x, useRef as A, useEffect as U, useContext as B } from "react";
6
- import { ChatContext as G, AsyncBubble as E } from "./App.DcQF9Hq9.js";
7
- import { useMarkdown as D } from "./useMarkdown.rLeRHXfb.js";
6
+ import { ChatContext as G, AsyncBubble as E } from "./App.5gxvd-4-.js";
7
+ import { useMarkdown as D } from "./useMarkdown.DpoGjOrf.js";
8
8
  const j = 2, q = j * 1e3, M = "", I = (e) => e * (2 - e);
9
9
  function W(e, n = !0) {
10
10
  const [a, p] = x(0), [i, C] = x(0), [t, T] = x(e), r = A(0), s = A(0);
@@ -1,8 +1,8 @@
1
1
  import { jsx as n, Fragment as b, jsxs as A } from "react/jsx-runtime";
2
2
  import { useState as C, useMemo as u, isValidElement as p, useEffect as I } from "react";
3
- import { AsyncBubble as w } from "./App.DcQF9Hq9.js";
4
- import { useMarkdown as _ } from "./useMarkdown.rLeRHXfb.js";
5
- import { C as M } from "./index.uzB9FupG.js";
3
+ import { AsyncBubble as w } from "./App.5gxvd-4-.js";
4
+ import { useMarkdown as _ } from "./useMarkdown.DpoGjOrf.js";
5
+ import { C as M } from "./index.DB7deAkb.js";
6
6
  const R = 200, N = ({
7
7
  string: e,
8
8
  idealLength: r = R
@@ -1,24 +1,24 @@
1
1
  import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import { I as g, J as N, Q as C, INFINITE_SCROLL_THRESHOLD as A, CARDS as E, pluralize as y, te as p, numberFormatter as k, st as b, isProbablyMobile as D, c as U, r as B, O as I } from "./index.uzB9FupG.js";
3
- import { st as u, p$1 as P, z as L, p$2 as V } from "./App.DcQF9Hq9.js";
2
+ import { I as C, J as N, Q as g, INFINITE_SCROLL_THRESHOLD as E, CARDS as k, pluralize as y, te as u, numberFormatter as b, st as D, isProbablyMobile as U, c as B, r as I, O as P } from "./index.DB7deAkb.js";
3
+ import { st as M, p$1 as L, z as V, p$2 as $ } from "./App.5gxvd-4-.js";
4
4
  import h from "clsx";
5
- import { Fragment as $ } from "react";
6
- import { j as _, D as H, G as M, H as Y, U as F, M as a, F as f, l as G } from "./Table.J1RcsDNn.js";
7
- const K = ({
5
+ import { Fragment as _ } from "react";
6
+ import { j as H, D as Y, G as x, H as F, M as a, U as G, F as S, l as K } from "./Table.Uvq7uGxR.js";
7
+ const W = ({
8
8
  className: l,
9
9
  viewBox: c,
10
- title: o,
10
+ title: n,
11
11
  monotone: i,
12
- ...n
12
+ ...o
13
13
  }) => /* @__PURE__ */ m(
14
- g,
14
+ C,
15
15
  {
16
16
  defaultViewBox: "0 0 512 512",
17
17
  size: "size-5",
18
18
  viewBox: c,
19
19
  className: l,
20
- title: o || "Restore",
21
- ...n,
20
+ title: n || "Restore",
21
+ ...o,
22
22
  children: [
23
23
  /* @__PURE__ */ e(
24
24
  "path",
@@ -30,21 +30,21 @@ const K = ({
30
30
  /* @__PURE__ */ e("path", { d: "M64 128c-35.3 0-64 28.7-64 64v256c0 35.3 28.7 64 64 64h256c35.3 0 64-28.7 64-64V192c0-35.3-28.7-64-64-64zm32 64h192c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32-14.3-32-32s14.3-32 32-32" })
31
31
  ]
32
32
  }
33
- ), W = ({
33
+ ), j = ({
34
34
  className: l,
35
35
  viewBox: c,
36
- title: o,
36
+ title: n,
37
37
  monotone: i,
38
- ...n
38
+ ...o
39
39
  }) => /* @__PURE__ */ m(
40
- g,
40
+ C,
41
41
  {
42
42
  defaultViewBox: "0 0 512 512",
43
43
  size: "size-5",
44
44
  viewBox: c,
45
45
  className: l,
46
- title: o || "Star in Circle",
47
- ...n,
46
+ title: n || "Star in Circle",
47
+ ...o,
48
48
  children: [
49
49
  /* @__PURE__ */ e(
50
50
  "path",
@@ -56,21 +56,21 @@ const K = ({
56
56
  /* @__PURE__ */ e("path", { d: "M270.3 112.9c-2.7-5.5-8.3-8.9-14.3-8.9s-11.7 3.5-14.3 8.9l-36.2 73.4-81.1 11.8c-6 .9-11 5.1-12.9 10.9s-.3 12.2 4 16.4l58.6 57.2-13.8 80.7c-1 6 1.4 12.1 6.4 15.6s11.5 4.1 16.9 1.2l72.4-38 72.5 38.1c5.4 2.8 11.9 2.4 16.9-1.2s7.4-9.6 6.4-15.6L338 282.7l58.6-57.2c4.4-4.3 5.9-10.6 4-16.4s-6.9-10-12.9-10.9l-81-11.8-36.2-73.4z" })
57
57
  ]
58
58
  }
59
- ), j = ({
59
+ ), J = ({
60
60
  className: l,
61
61
  viewBox: c,
62
- title: o,
62
+ title: n,
63
63
  monotone: i,
64
- ...n
64
+ ...o
65
65
  }) => /* @__PURE__ */ m(
66
- g,
66
+ C,
67
67
  {
68
68
  defaultViewBox: "0 0 512 512",
69
69
  size: "size-5",
70
70
  viewBox: c,
71
71
  className: l,
72
- title: o || "Star in Circle",
73
- ...n,
72
+ title: n || "Star in Circle",
73
+ ...o,
74
74
  children: [
75
75
  /* @__PURE__ */ e(
76
76
  "path",
@@ -82,23 +82,23 @@ const K = ({
82
82
  /* @__PURE__ */ e("path", { d: "M256 32a224 224 0 1 1 0 448 224 224 0 1 1 0-448m0 480a256 256 0 1 0 0-512 256 256 0 1 0 0 512m14.3-399.1c-2.7-5.5-8.3-8.9-14.3-8.9s-11.7 3.5-14.3 8.9l-36.2 73.4-81 11.8c-6 .9-11 5.1-12.9 10.9s-.3 12.2 4 16.4l58.6 57.2-13.8 80.7c-1 6 1.4 12.1 6.4 15.6s11.5 4.1 16.8 1.2l72.4-38 72.5 38.1c5.4 2.8 11.9 2.4 16.9-1.2s7.4-9.6 6.4-15.6L338 282.7l58.6-57.2c4.4-4.3 5.9-10.6 4-16.4s-6.9-10-12.9-10.9l-81.1-11.8-36.2-73.4zm-40 95.1 25.7-51.8 25.6 51.9c2.3 4.7 6.8 8 12 8.8l57.3 8.3-41.5 40.4c-3.8 3.7-5.5 9-4.6 14.2l9.8 57.1-51.2-26.9c-4.7-2.5-10.2-2.5-14.9 0l-51.2 26.9 9.8-57.1c.9-5.2-.8-10.5-4.6-14.2L161 225.1l57.3-8.3c5.2-.8 9.7-4 12-8.8" })
83
83
  ]
84
84
  }
85
- ), J = {
85
+ ), Q = {
86
+ [P]: $,
86
87
  [I]: V,
87
- [B]: L,
88
- [U]: P
88
+ [B]: L
89
89
  }, t = {
90
90
  ROW: "row",
91
91
  TIMESTAMP: N,
92
92
  SUMMARY: "summary",
93
93
  PROVIDER: "provider",
94
- TOKEN_USAGE: C,
94
+ TOKEN_USAGE: g,
95
95
  ACTIONS: "actions"
96
- }, Q = [
96
+ }, q = [
97
97
  t.ROW,
98
98
  t.TIMESTAMP,
99
99
  t.SUMMARY,
100
100
  t.ACTIONS
101
- ], q = [
101
+ ], X = [
102
102
  t.ROW,
103
103
  t.SUMMARY,
104
104
  t.TIMESTAMP,
@@ -108,20 +108,21 @@ const K = ({
108
108
  ], ce = ({
109
109
  filteredHistory: l,
110
110
  historyState: c,
111
- lastEntryToLoad: o,
111
+ lastEntryToLoad: n,
112
112
  onClickSort: i,
113
- onClickRestore: n,
114
- onClickDelete: w,
115
- onClickFavorite: O,
116
- infinityScrollMarkerRef: S
113
+ onClickRestore: o,
114
+ onClickDelete: f,
115
+ onClickFavorite: w,
116
+ infinityScrollMarkerRef: O,
117
+ isLoading: T = !1
117
118
  }) => {
118
- const v = D() ? Q : q, T = (s) => {
119
+ const v = U() ? q : X, z = (s) => {
119
120
  switch (s) {
120
121
  case t.ROW:
121
122
  return /* @__PURE__ */ e(a, { className: "sr-only", children: "Row" }, s);
122
123
  case t.TIMESTAMP:
123
124
  return /* @__PURE__ */ e(
124
- f,
125
+ S,
125
126
  {
126
127
  focusMode: "system",
127
128
  buttonClassName: "text-xs sm:text-sm",
@@ -142,16 +143,16 @@ const K = ({
142
143
  return /* @__PURE__ */ e(a, { className: "text-xs sm:text-sm", children: "Provider" }, s);
143
144
  case t.TOKEN_USAGE:
144
145
  return /* @__PURE__ */ e(
145
- f,
146
+ S,
146
147
  {
147
148
  focusMode: "system",
148
149
  buttonClassName: "text-xs sm:text-sm",
149
- cellId: C,
150
+ cellId: g,
150
151
  align: "right",
151
152
  sortDirection: c.sortDirection,
152
153
  sortedCell: c.sortedCell,
153
154
  onClick: () => {
154
- i(C);
155
+ i(g);
155
156
  },
156
157
  children: "Tokens"
157
158
  },
@@ -162,10 +163,10 @@ const K = ({
162
163
  default:
163
164
  return null;
164
165
  }
165
- }, z = (s, r, x) => {
166
+ }, A = (s, r, p) => {
166
167
  switch (s) {
167
168
  case t.ROW:
168
- return /* @__PURE__ */ e(a, { children: x + 1 }, s);
169
+ return /* @__PURE__ */ e(a, { children: p + 1 }, s);
169
170
  case t.TIMESTAMP:
170
171
  return /* @__PURE__ */ e(
171
172
  a,
@@ -198,7 +199,7 @@ const K = ({
198
199
  );
199
200
  }
200
201
  case t.PROVIDER: {
201
- const d = r.model ? b(r.model) : null, R = d ? J[d] : null;
202
+ const d = r.model ? D(r.model) : null, R = d ? Q[d] : null;
202
203
  return /* @__PURE__ */ e(
203
204
  a,
204
205
  {
@@ -224,67 +225,67 @@ const K = ({
224
225
  {
225
226
  className: h("dark:text-gray-400", "text-xs sm:text-sm"),
226
227
  align: "right",
227
- children: r.tokenUsage ? k.format(r.tokenUsage) : "0"
228
+ children: r.tokenUsage ? b.format(r.tokenUsage) : "0"
228
229
  },
229
230
  s
230
231
  );
231
232
  case t.ACTIONS:
232
233
  return /* @__PURE__ */ e(a, { children: /* @__PURE__ */ m("div", { className: "flex flex-col items-end sm:flex-row gap-2", children: [
233
234
  /* @__PURE__ */ e(
234
- u,
235
+ M,
235
236
  {
236
237
  label: "Restore chat",
237
238
  placement: "top",
238
239
  trigger: /* @__PURE__ */ e(
239
- p,
240
+ u,
240
241
  {
241
242
  noBorder: !0,
242
243
  label: "Restore chat",
243
244
  variant: "primary",
244
245
  iconClassName: "text-green-800 dark:text-green-500",
245
246
  onClick: async () => {
246
- await n(r);
247
+ await o(r);
247
248
  },
248
- children: /* @__PURE__ */ e(K, { size: "size-3", monotone: !0 })
249
+ children: /* @__PURE__ */ e(W, { size: "size-3", monotone: !0 })
249
250
  }
250
251
  )
251
252
  }
252
253
  ),
253
254
  /* @__PURE__ */ e(
254
- u,
255
+ M,
255
256
  {
256
257
  label: r.favoriteChat ? "Remove from favorites" : "Add to favorites",
257
258
  placement: "top",
258
259
  trigger: /* @__PURE__ */ e(
259
- p,
260
+ u,
260
261
  {
261
262
  noBorder: !0,
262
263
  label: r.favoriteChat ? "Remove from favorites" : "Add to favorites",
263
264
  variant: "primary",
264
265
  onClick: async () => {
265
- await O(r);
266
+ await w(r);
266
267
  },
267
- children: r.favoriteChat ? /* @__PURE__ */ e(W, { size: "size-4", monotone: !0 }) : /* @__PURE__ */ e(j, { size: "size-4", monotone: !0 })
268
+ children: r.favoriteChat ? /* @__PURE__ */ e(j, { size: "size-4", monotone: !0 }) : /* @__PURE__ */ e(J, { size: "size-4", monotone: !0 })
268
269
  }
269
270
  )
270
271
  }
271
272
  ),
272
273
  /* @__PURE__ */ e(
273
- u,
274
+ M,
274
275
  {
275
276
  label: "Delete chat",
276
277
  placement: "top",
277
278
  trigger: /* @__PURE__ */ e(
278
- p,
279
+ u,
279
280
  {
280
281
  noBorder: !0,
281
282
  label: "Delete chat",
282
283
  variant: "primary",
283
284
  iconClassName: "text-red-700 dark:text-red-500",
284
285
  onClick: () => {
285
- w(r);
286
+ f(r);
286
287
  },
287
- children: /* @__PURE__ */ e(G, { size: "size-3", monotone: !0 })
288
+ children: /* @__PURE__ */ e(K, { size: "size-3", monotone: !0 })
288
289
  }
289
290
  )
290
291
  }
@@ -294,15 +295,15 @@ const K = ({
294
295
  return null;
295
296
  }
296
297
  };
297
- return /* @__PURE__ */ m(_, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
298
- /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(M, { children: v.map((s) => T(s)) }) }),
299
- /* @__PURE__ */ e(Y, { children: l.slice(0, o).map((s, r) => s?.messages?.length > 0 ? /* @__PURE__ */ m($, { children: [
300
- r === o - A && /* @__PURE__ */ e("tr", { ref: S }),
301
- /* @__PURE__ */ e(M, { children: v.map(
302
- (x) => z(x, s, r)
298
+ return /* @__PURE__ */ m(H, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
299
+ /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ e(x, { children: v.map((s) => z(s)) }) }),
300
+ /* @__PURE__ */ e(F, { children: T && l.length === 0 ? /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(a, { colSpan: 1e3, children: /* @__PURE__ */ e("div", { children: "Loading..." }) }) }) : l.slice(0, n).map((s, r) => s?.messages?.length > 0 ? /* @__PURE__ */ m(_, { children: [
301
+ r === n - E && /* @__PURE__ */ e("tr", { ref: O }),
302
+ /* @__PURE__ */ e(x, { children: v.map(
303
+ (p) => A(p, s, r)
303
304
  ) })
304
- ] }, `${E.HISTORY.TITLE}-${s.id}-${r}`) : null) }),
305
- /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(a, { colSpan: 1e3, children: /* @__PURE__ */ e("div", { children: y(
305
+ ] }, `${k.HISTORY.TITLE}-${s.id}-${r}`) : null) }),
306
+ /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(x, { children: /* @__PURE__ */ e(a, { colSpan: 1e3, children: /* @__PURE__ */ e("div", { children: y(
306
307
  `${l.length} chat`,
307
308
  l.length
308
309
  ) }) }) }) })
@@ -0,0 +1,333 @@
1
+ import { jsxs as n, jsx as t, Fragment as ee } from "react/jsx-runtime";
2
+ import { I as te, n as z, INFINITE_SCROLL_LIMIT as P, INFINITE_SCROLL_THRESHOLD as re, LOCAL_STORAGE_PREFIX as T, LOCAL_STORAGE_SORT_TIMESTAMP as ae, LOCAL_STORAGE_SORT_TOKEN_USAGE as se, LOCAL_STORAGE_SORT as oe, J as D, useUserPreferences as ie, useDeleteChat as ne, useToggleFavoriteChat as ce, APP_CLASSNAME as le, TOAST_CHAT_DELETED as de, graphQLRequest as he, SERVICE_TYPES as me, setNewProvider as ue, ACTION_SORT as Ce, Q as Se, TOAST_PROVIDER_CHANGED as fe, useChatsHistory as pe, LOCAL_STORAGE_SEARCH as ye, LOCAL_STORAGE_FAVORITES_ONLY as Te, HISTORY_TITLE as ge, S as Ae, Y as Ee, debounce as ve, C as _e, ACTION_SEARCH as De } from "./index.DB7deAkb.js";
3
+ import { HistoryContext as G, ChatContext as M, useAiChat as Oe, E as g, e as u, ConfirmationPanel as Re, LazyToastContainerWrapper as Le, showErrorToast as Ie, CHAT_SET_PROVIDER as ke, showSuccessToast as be, CHAT_SET_STATUS as we, oe as Ne, G as xe } from "./App.5gxvd-4-.js";
4
+ import { useRef as N, useState as x, useContext as O, useCallback as V, Suspense as He, lazy as Fe, useEffect as Pe } from "react";
5
+ const Ve = ({
6
+ className: c,
7
+ viewBox: d,
8
+ title: f,
9
+ monotone: C,
10
+ ...p
11
+ }) => /* @__PURE__ */ n(
12
+ te,
13
+ {
14
+ defaultViewBox: "0 0 512 512",
15
+ size: "size-5",
16
+ viewBox: d,
17
+ className: c,
18
+ title: f || "Search",
19
+ ...p,
20
+ children: [
21
+ /* @__PURE__ */ t(
22
+ "path",
23
+ {
24
+ d: "M0 208a208 208 0 1 0 416 0 208 208 0 1 0-416 0m352 0a144 144 0 1 1-288 0 144 144 0 1 1 288 0",
25
+ opacity: C ? "1" : "0.4"
26
+ }
27
+ ),
28
+ /* @__PURE__ */ t("path", { d: "m330.7 376 126.7 126.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L376 330.7c-12.7 17.3-28 32.6-45.3 45.3" })
29
+ ]
30
+ }
31
+ ), ze = Fe(
32
+ () => import(
33
+ /* webpackChunkName: "history-table" */
34
+ "./ChatHistoryTable.DodhSBf9.js"
35
+ ).then((c) => ({ default: c.ChatHistoryTable }))
36
+ ), Ge = ({
37
+ filteredHistory: c,
38
+ dispatch: d,
39
+ onOpenChange: f,
40
+ mutate: C,
41
+ isLoading: p = !1
42
+ }) => {
43
+ const { user: S, getAccessToken: h } = z(), l = N(null), s = N({
44
+ id: "",
45
+ timestamp: "",
46
+ message: ""
47
+ }), [A, m] = x(!1), [R, L] = x(
48
+ P + re
49
+ ), { state: i, dispatch: I } = O(G), y = {
50
+ searchString: i.searchString || "",
51
+ sortDirection: i.sortDirection || u.DESC,
52
+ sortedCell: i.sortedCell || D
53
+ }, {
54
+ state: { provider: k },
55
+ setChatId: E,
56
+ setInitialMessages: b
57
+ } = O(M), { setInput: w } = Oe(), [v, a] = g({
58
+ key: T + ae,
59
+ initialValue: u.DESC
60
+ }), [U, B] = g({
61
+ key: T + se,
62
+ initialValue: u.ASC
63
+ }), [, Y] = g({
64
+ key: T + oe,
65
+ initialValue: D
66
+ }), { refetch: j } = ie({
67
+ user: S?.username,
68
+ getAccessToken: h
69
+ }), { mutateAsync: $ } = ne({ getAccessToken: h }), { mutateAsync: Q } = ce({
70
+ getAccessToken: h
71
+ }), q = (e) => {
72
+ const o = i.sortedCell === e;
73
+ let r, _;
74
+ switch (e) {
75
+ case D:
76
+ _ = a, r = o ? i.sortDirection : v;
77
+ break;
78
+ case Se:
79
+ _ = B, r = o ? i.sortDirection : U;
80
+ break;
81
+ default:
82
+ _ = a, r = o ? i.sortDirection : v;
83
+ break;
84
+ }
85
+ const F = r === u.ASC ? u.DESC : u.ASC;
86
+ _(F), Y(e), I({
87
+ type: Ce,
88
+ payload: {
89
+ sortedCell: e,
90
+ sortDirection: F
91
+ }
92
+ });
93
+ }, J = async () => {
94
+ const e = s.current;
95
+ try {
96
+ await $({
97
+ userId: S?.username || "",
98
+ id: e.id
99
+ }), C(""), await Ie(de, {
100
+ autoClose: 2e3,
101
+ containerId: "history-table"
102
+ });
103
+ } catch {
104
+ }
105
+ }, K = async (e) => {
106
+ try {
107
+ const o = await h(), r = await he({
108
+ accessToken: o,
109
+ type: me.GET_CHAT,
110
+ params: {
111
+ id: e.id
112
+ }
113
+ });
114
+ r.data.provider !== k && (await ue({
115
+ provider: r.data.provider,
116
+ model: r.data.model,
117
+ accessToken: o,
118
+ username: S?.username || ""
119
+ }), d({
120
+ type: ke,
121
+ payload: {
122
+ provider: r.data.provider
123
+ }
124
+ }), j(), await be(
125
+ `${fe} ${r.data.provider}`,
126
+ {
127
+ containerId: "toggle-provider"
128
+ }
129
+ )), d({
130
+ type: we,
131
+ payload: {
132
+ restoring: !0,
133
+ restoredModel: r.data?.model || "",
134
+ restoredUsage: r.data?.tokenUsage || 0
135
+ }
136
+ }), w(""), E(e.id), b(r.data.messages), f(!1);
137
+ } catch {
138
+ }
139
+ }, W = (e) => {
140
+ s.current = {
141
+ id: e.id,
142
+ timestamp: e.timestamp,
143
+ message: e.messages.length > 0 ? e.messages[0]?.content : ""
144
+ }, m(!A);
145
+ }, X = async (e) => {
146
+ try {
147
+ await Q({
148
+ userId: S?.username || "",
149
+ id: e.id
150
+ }), C("");
151
+ } catch {
152
+ }
153
+ }, H = V((e) => {
154
+ e[0].isIntersecting && L((r) => r + P);
155
+ }, []), Z = V(
156
+ (e) => {
157
+ if (l.current && l.current.disconnect(), e) {
158
+ const o = {
159
+ rootMargin: "20px"
160
+ }, r = new IntersectionObserver(H, o);
161
+ r.observe(e), l.current = r;
162
+ }
163
+ },
164
+ [H]
165
+ );
166
+ return /* @__PURE__ */ n(ee, { children: [
167
+ /* @__PURE__ */ n(
168
+ Re,
169
+ {
170
+ showConfirmation: A,
171
+ setShowConfirmation: m,
172
+ action: J,
173
+ customStrings: {
174
+ confirmAction: "Delete",
175
+ cancelAction: "Cancel",
176
+ title: "Delete chat"
177
+ },
178
+ children: [
179
+ /* @__PURE__ */ t("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
180
+ /* @__PURE__ */ n("ul", { className: "m-0", children: [
181
+ /* @__PURE__ */ n("li", { children: [
182
+ "Timestamp:",
183
+ " ",
184
+ /* @__PURE__ */ t("span", { className: "text-lg", children: s.current && s.current.timestamp })
185
+ ] }),
186
+ /* @__PURE__ */ n("li", { children: [
187
+ "First message:",
188
+ " ",
189
+ /* @__PURE__ */ t("span", { className: "text-lg", children: s.current?.message })
190
+ ] })
191
+ ] })
192
+ ]
193
+ }
194
+ ),
195
+ /* @__PURE__ */ t("div", { className: le, children: /* @__PURE__ */ t(Le, { containerId: "history-table" }) }),
196
+ /* @__PURE__ */ t(He, { fallback: /* @__PURE__ */ t("div", {}), children: /* @__PURE__ */ t(
197
+ ze,
198
+ {
199
+ filteredHistory: c,
200
+ historyState: y,
201
+ lastEntryToLoad: R,
202
+ onClickSort: q,
203
+ onClickRestore: K,
204
+ onClickDelete: W,
205
+ onClickFavorite: X,
206
+ infinityScrollMarkerRef: Z,
207
+ isLoading: p
208
+ }
209
+ ) })
210
+ ] });
211
+ }, je = ({
212
+ open: c,
213
+ onOpenChange: d
214
+ }) => {
215
+ const { getAccessToken: f, user: C } = z(), { dispatch: p } = O(M), [S, h] = x([]), l = N(null), { state: s, dispatch: A } = O(G), {
216
+ data: m,
217
+ refetch: R,
218
+ isLoading: L,
219
+ isError: i
220
+ } = pe({
221
+ enabled: c,
222
+ user: C?.username || "",
223
+ searchString: s.searchString || "",
224
+ sortDirection: s.sortDirection || u.DESC,
225
+ sortedCell: s.sortedCell || D,
226
+ getAccessToken: f
227
+ }), [, I] = g({
228
+ key: T + ye,
229
+ initialValue: s.searchString
230
+ }), [y, k] = g({
231
+ key: T + Te,
232
+ initialValue: !1
233
+ });
234
+ Pe(() => {
235
+ m && h(
236
+ y ? m.filter((a) => a.favoriteChat === !0) : m
237
+ );
238
+ }, [m, y]);
239
+ const E = async (a) => {
240
+ I(a), A({
241
+ type: De,
242
+ payload: { searchString: a }
243
+ });
244
+ }, b = ve((a) => {
245
+ E(a.target.value.trim());
246
+ }, 500), w = async (a) => {
247
+ a.preventDefault();
248
+ }, v = (a) => {
249
+ k(a);
250
+ };
251
+ return /* @__PURE__ */ n(
252
+ Ne,
253
+ {
254
+ open: c,
255
+ onOpenChange: d,
256
+ title: ge,
257
+ animation: !0,
258
+ animationType: "fade",
259
+ children: [
260
+ /* @__PURE__ */ t(
261
+ Ae,
262
+ {
263
+ header: "Filters",
264
+ className: "prose-dark dark:prose-lighter mb-4",
265
+ noBorder: !0,
266
+ compact: !0,
267
+ children: /* @__PURE__ */ n("form", { autoComplete: "off", onSubmit: w, children: [
268
+ /* @__PURE__ */ t(
269
+ Ee,
270
+ {
271
+ placeholder: "Search",
272
+ labelHidden: !0,
273
+ noBorder: !0,
274
+ autoCapitalize: "off",
275
+ autoComplete: "off",
276
+ autoCorrect: "off",
277
+ ref: l,
278
+ defaultValue: s.searchString,
279
+ mode: "alt-system",
280
+ name: "Search",
281
+ label: "Search",
282
+ onChange: b,
283
+ className: "my-2",
284
+ rightElement: /* @__PURE__ */ t("div", { className: "dark:text-copy-dark text-copy-light", children: /* @__PURE__ */ t(Ve, { monotone: !0, size: "size-3" }) })
285
+ }
286
+ ),
287
+ /* @__PURE__ */ n("div", { className: "flex flex-col justify-between sm:flex-row gap-2 sm:mb-0 mb-1", children: [
288
+ /* @__PURE__ */ t("div", { className: "order-1 sm:order-0", children: /* @__PURE__ */ t(
289
+ xe,
290
+ {
291
+ name: "favorites-only",
292
+ checked: y,
293
+ onChange: v,
294
+ label: "Show favorites only",
295
+ narrow: !0,
296
+ noBorder: !0
297
+ }
298
+ ) }),
299
+ /* @__PURE__ */ t(
300
+ _e,
301
+ {
302
+ size: "small",
303
+ disabled: s.searchString === "",
304
+ onClick: () => {
305
+ E(""), l.current?.value && (l.current.value = "", l.current.focus());
306
+ },
307
+ children: "Reset Search"
308
+ }
309
+ )
310
+ ] })
311
+ ] })
312
+ }
313
+ ),
314
+ /* @__PURE__ */ n("div", { className: "flex flex-col sm:flex-row max-h-[65vh] sm:max-h-[75vh] min-h-[60vh]", children: [
315
+ i && /* @__PURE__ */ t("p", { className: "m-0 text-red-500", children: "Failed to load history." }),
316
+ !i && /* @__PURE__ */ t(
317
+ Ge,
318
+ {
319
+ mutate: R,
320
+ filteredHistory: S,
321
+ dispatch: p,
322
+ onOpenChange: d,
323
+ isLoading: L
324
+ }
325
+ )
326
+ ] })
327
+ ]
328
+ }
329
+ );
330
+ };
331
+ export {
332
+ je as HistoryPanel
333
+ };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as t, Fragment as $, jsx as e } from "react/jsx-runtime";
2
- import { preloadToast as D, showSuccessToast as K, showErrorToast as W, ConfirmationPanel as Y, LazyToastContainerWrapper as H, oe as V } from "./App.DcQF9Hq9.js";
3
- import { n as q, i as J, useUserPreferences as Q, useServerCapabilities as X, j$1 as Z, setUserPlan as ee, S as d, renderDataAsList as ae, CARDS as s, L as f, j as c, C as se, it as ne, isTauri as re, te, l as b, PROFILE_TITLE as le } from "./index.uzB9FupG.js";
2
+ import { preloadToast as D, showSuccessToast as K, showErrorToast as W, ConfirmationPanel as Y, LazyToastContainerWrapper as H, oe as V } from "./App.5gxvd-4-.js";
3
+ import { n as q, i as J, useUserPreferences as Q, useServerCapabilities as X, j$1 as Z, setUserPlan as ee, S as d, renderDataAsList as ae, CARDS as s, L as f, j as c, C as se, it as ne, isTauri as re, te, l as b, PROFILE_TITLE as le } from "./index.DB7deAkb.js";
4
4
  import ie from "clsx";
5
5
  import { useState as m, useMemo as ce, useCallback as P } from "react";
6
6
  const oe = () => {