@versini/sassysaint 8.62.3 → 8.63.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.
- package/dist/chunks/{AboutChangelog.DGB_6XWF.js → AboutChangelog.CcpXjtz2.js} +2 -2
- package/dist/chunks/{AboutEntry.Bi3Rtvax.js → AboutEntry.D-K-8suU.js} +9 -9
- package/dist/chunks/{App.cuOjKevV.js → App.BUHkBnAs.js} +1551 -1540
- package/dist/chunks/{Chart.D8o0MX15.js → Chart.f_78Yn-S.js} +2 -2
- package/dist/chunks/{ChatBubbleAssistant.BsGW6-uz.js → ChatBubbleAssistant.BMzfA5pX.js} +16 -16
- package/dist/chunks/{ChatBubbleUser.5klvBcRZ.js → ChatBubbleUser.BkwIMaLA.js} +3 -3
- package/dist/chunks/{ChatHistoryTable.Btl5R3g_.js → ChatHistoryTable.z1gXvLbS.js} +15 -15
- package/dist/chunks/{HistoryEntry.Dd9wepcS.js → HistoryEntry.6LhEmpQ3.js} +30 -30
- package/dist/chunks/ProfileEntry.BVd9oy8m.js +158 -0
- package/dist/chunks/{SettingsEntry.DJ6HHl3_.js → SettingsEntry.BITLpN9E.js} +104 -105
- package/dist/chunks/{Table.B9Dh8yT5.js → Table.BuN5VZQJ.js} +8 -8
- package/dist/chunks/{UsageEntry.BBHtbgZr.js → UsageEntry.B5xt2ba5.js} +3 -3
- package/dist/chunks/{UserMemoriesPanel.B2rrpuxL.js → UserMemoriesPanel.DU82nD6K.js} +3 -3
- package/dist/chunks/{index.BwP0kG4H.js → index.790ujKXR.js} +15 -15
- package/dist/chunks/{index.C1SMMUJo.js → index.BCvnlzn1.js} +1009 -947
- package/dist/chunks/{index.Chm9CISa.js → index.Bmi4qytW.js} +2 -2
- package/dist/chunks/{index.BWJ8ML3P.js → index.Cq79kge7.js} +1 -1
- package/dist/chunks/{index.EtY2KRYo.js → index.DEwRELHl.js} +3 -3
- package/dist/chunks/{index.DJTHwROE.js → index.TsLNeuu8.js} +1 -1
- package/dist/chunks/{index.BoS9FOuX.js → index.W_JEPkEx.js} +1 -1
- package/dist/chunks/{index.CXN6Kb5s.js → index.hfGQXbdH.js} +1 -1
- package/dist/chunks/{useMarkdown.Bw-tEpSM.js → useMarkdown.D7Tx0mAO.js} +6 -6
- package/dist/components/SassySaint/SassySaint.js +1 -1
- package/dist/index.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +3 -3
- package/dist/chunks/ProfileEntry.y2zGAvLi.js +0 -60
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as Ap } from "react/jsx-runtime";
|
|
2
|
-
import { getDefaultExportFromCjs as ln } from "./App.
|
|
2
|
+
import { getDefaultExportFromCjs as ln } from "./App.BUHkBnAs.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.
|
|
4
|
+
import { TRIMESTERS as rn, TRIMESTERS_SHORT as Lp, isProbablyMobile as Ep } from "./index.BCvnlzn1.js";
|
|
5
5
|
var ls = { exports: {} }, Ip = ls.exports, on;
|
|
6
6
|
function Dp() {
|
|
7
7
|
return on || (on = 1, (function(ke, ne) {
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { n as N, useUserPreferences as O, convertCamelCaseToReadable as P, numberFormatter as R, pluralize as y,
|
|
3
|
-
import { BUBBLE_FOOTER_EMPTY as _ } from "./index.
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { n as N, useUserPreferences as O, convertCamelCaseToReadable as P, numberFormatter as R, pluralize as y, re as L } from "./index.BCvnlzn1.js";
|
|
3
|
+
import { BUBBLE_FOOTER_EMPTY as _ } from "./index.TsLNeuu8.js";
|
|
4
4
|
import w from "clsx";
|
|
5
|
-
import v, { useState as
|
|
6
|
-
import { ChatContext as G, AsyncBubble as E } from "./App.
|
|
7
|
-
import { useMarkdown as D } from "./useMarkdown.
|
|
8
|
-
const
|
|
9
|
-
function
|
|
10
|
-
const [a, p] =
|
|
5
|
+
import v, { useState as M, useRef as A, useEffect as U, useContext as B } from "react";
|
|
6
|
+
import { ChatContext as G, AsyncBubble as E } from "./App.BUHkBnAs.js";
|
|
7
|
+
import { useMarkdown as D } from "./useMarkdown.D7Tx0mAO.js";
|
|
8
|
+
const j = 2, q = j * 1e3, b = "", I = (e) => e * (2 - e);
|
|
9
|
+
function W(e, n = !0) {
|
|
10
|
+
const [a, p] = M(0), [i, C] = M(0), [t, T] = M(e), r = A(0), s = A(0);
|
|
11
11
|
return t !== e && (T(e), C(e.startsWith(t) ? a : 0)), U(() => {
|
|
12
12
|
if (!n)
|
|
13
13
|
return;
|
|
14
|
-
const u = e.split(
|
|
14
|
+
const u = e.split(b).length, o = (c) => {
|
|
15
15
|
s.current || (s.current = c);
|
|
16
|
-
const l = c - s.current, m = Math.min(l /
|
|
16
|
+
const l = c - s.current, m = Math.min(l / q, 1), h = I(m), g = i + (u - i) * h;
|
|
17
17
|
p(Math.floor(g)), m < 1 && (r.current = requestAnimationFrame(o));
|
|
18
18
|
};
|
|
19
19
|
return s.current = 0, r.current = requestAnimationFrame(o), () => {
|
|
20
20
|
r.current && cancelAnimationFrame(r.current);
|
|
21
21
|
};
|
|
22
|
-
}, [i, e, n]), n ? e.split(
|
|
22
|
+
}, [i, e, n]), n ? e.split(b).slice(0, a).join(b) : e;
|
|
23
23
|
}
|
|
24
24
|
const d = {
|
|
25
25
|
MODEL: "Model",
|
|
@@ -34,7 +34,7 @@ const d = {
|
|
|
34
34
|
smooth: i = !1,
|
|
35
35
|
isLastAssistantMessage: C = !1
|
|
36
36
|
}) => {
|
|
37
|
-
const t =
|
|
37
|
+
const t = W(e, i), {
|
|
38
38
|
state: { streaming: T, restoredModel: r, tokenUsage: s }
|
|
39
39
|
} = B(G), u = n?.model || r, o = s, [c, l] = D(), { user: m, getAccessToken: h } = N(), { data: g } = O({
|
|
40
40
|
user: m?.username,
|
|
@@ -46,16 +46,16 @@ const d = {
|
|
|
46
46
|
[d.PLUGIN]: a ? P(a) : null
|
|
47
47
|
}, o && (C ? f[d.USAGE] = `${R.format(o)} ${y("token", o)}` : f[d.USAGE] = _)), U(() => {
|
|
48
48
|
t && l(t);
|
|
49
|
-
}, [t, l]), p === L ? /* @__PURE__ */
|
|
49
|
+
}, [t, l]), p === L ? /* @__PURE__ */ x(
|
|
50
50
|
E,
|
|
51
51
|
{
|
|
52
52
|
tail: !0,
|
|
53
53
|
className: k,
|
|
54
54
|
contentClassName: S,
|
|
55
55
|
noMaxWidth: !0,
|
|
56
|
-
children: /* @__PURE__ */
|
|
56
|
+
children: /* @__PURE__ */ x("div", { className: "flex items-center justify-center italic text-copy-error-dark dark:text-red-300", children: c })
|
|
57
57
|
}
|
|
58
|
-
) : /* @__PURE__ */
|
|
58
|
+
) : /* @__PURE__ */ x(
|
|
59
59
|
E,
|
|
60
60
|
{
|
|
61
61
|
tail: !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.
|
|
4
|
-
import { useMarkdown as _ } from "./useMarkdown.
|
|
5
|
-
import { C as M } from "./index.
|
|
3
|
+
import { AsyncBubble as w } from "./App.BUHkBnAs.js";
|
|
4
|
+
import { useMarkdown as _ } from "./useMarkdown.D7Tx0mAO.js";
|
|
5
|
+
import { C as M } from "./index.BCvnlzn1.js";
|
|
6
6
|
const R = 200, N = ({
|
|
7
7
|
string: e,
|
|
8
8
|
idealLength: r = R
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsxs as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { I as g,
|
|
3
|
-
import { st as u, p$1 as P, z as L, p$2 as V } from "./App.
|
|
2
|
+
import { I as g, pe as N, fe as C, INFINITE_SCROLL_THRESHOLD as A, CARDS as E, pluralize as y, te as p, numberFormatter as k, le as b, isProbablyMobile as D, d as U, c as B, y as I } from "./index.BCvnlzn1.js";
|
|
3
|
+
import { st as u, p$1 as P, z as L, p$2 as V } from "./App.BUHkBnAs.js";
|
|
4
4
|
import h from "clsx";
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { j as
|
|
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 R, l as G } from "./Table.BuN5VZQJ.js";
|
|
7
7
|
const K = ({
|
|
8
8
|
className: c,
|
|
9
9
|
viewBox: l,
|
|
@@ -112,8 +112,8 @@ const K = ({
|
|
|
112
112
|
onClickSort: i,
|
|
113
113
|
onClickRestore: n,
|
|
114
114
|
onClickDelete: w,
|
|
115
|
-
onClickFavorite:
|
|
116
|
-
infinityScrollMarkerRef:
|
|
115
|
+
onClickFavorite: S,
|
|
116
|
+
infinityScrollMarkerRef: O
|
|
117
117
|
}) => {
|
|
118
118
|
const v = D() ? J : Q, T = (s) => {
|
|
119
119
|
switch (s) {
|
|
@@ -121,7 +121,7 @@ const K = ({
|
|
|
121
121
|
return /* @__PURE__ */ e(a, { className: "sr-only", children: "Row" }, s);
|
|
122
122
|
case t.TIMESTAMP:
|
|
123
123
|
return /* @__PURE__ */ e(
|
|
124
|
-
|
|
124
|
+
R,
|
|
125
125
|
{
|
|
126
126
|
focusMode: "system",
|
|
127
127
|
buttonClassName: "text-xs sm:text-sm",
|
|
@@ -142,7 +142,7 @@ const K = ({
|
|
|
142
142
|
return /* @__PURE__ */ e(a, { className: "text-xs sm:text-sm", children: "Provider" }, s);
|
|
143
143
|
case t.TOKEN_USAGE:
|
|
144
144
|
return /* @__PURE__ */ e(
|
|
145
|
-
|
|
145
|
+
R,
|
|
146
146
|
{
|
|
147
147
|
focusMode: "system",
|
|
148
148
|
buttonClassName: "text-xs sm:text-sm",
|
|
@@ -198,7 +198,7 @@ const K = ({
|
|
|
198
198
|
);
|
|
199
199
|
}
|
|
200
200
|
case t.PROVIDER: {
|
|
201
|
-
const d = r.model ? b(r.model) : null,
|
|
201
|
+
const d = r.model ? b(r.model) : null, f = d ? q[d] : null;
|
|
202
202
|
return /* @__PURE__ */ e(
|
|
203
203
|
a,
|
|
204
204
|
{
|
|
@@ -206,8 +206,8 @@ const K = ({
|
|
|
206
206
|
scope: "row",
|
|
207
207
|
className: h("dark:text-gray-400"),
|
|
208
208
|
align: "center",
|
|
209
|
-
children:
|
|
210
|
-
|
|
209
|
+
children: f ? /* @__PURE__ */ e(
|
|
210
|
+
f,
|
|
211
211
|
{
|
|
212
212
|
size: "size-4 sm:size-5",
|
|
213
213
|
semantic: !0,
|
|
@@ -262,7 +262,7 @@ const K = ({
|
|
|
262
262
|
label: r.favoriteChat ? "Remove from favorites" : "Add to favorites",
|
|
263
263
|
variant: "primary",
|
|
264
264
|
onClick: async () => {
|
|
265
|
-
await
|
|
265
|
+
await S(r);
|
|
266
266
|
},
|
|
267
267
|
children: r.favoriteChat ? /* @__PURE__ */ e(W, { size: "size-4", monotone: !0 }) : /* @__PURE__ */ e(j, { size: "size-4", monotone: !0 })
|
|
268
268
|
}
|
|
@@ -294,10 +294,10 @@ const K = ({
|
|
|
294
294
|
return null;
|
|
295
295
|
}
|
|
296
296
|
};
|
|
297
|
-
return /* @__PURE__ */ m(
|
|
297
|
+
return /* @__PURE__ */ m($, { stickyHeader: !0, stickyFooter: !0, compact: !0, mode: "alt-system", children: [
|
|
298
298
|
/* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(M, { children: v.map((s) => T(s)) }) }),
|
|
299
|
-
/* @__PURE__ */ e(Y, { children: c.slice(0, o).map((s, r) => s?.messages?.length > 0 ? /* @__PURE__ */ m(
|
|
300
|
-
r === o - A && /* @__PURE__ */ e("tr", { ref:
|
|
299
|
+
/* @__PURE__ */ e(Y, { children: c.slice(0, o).map((s, r) => s?.messages?.length > 0 ? /* @__PURE__ */ m(_, { children: [
|
|
300
|
+
r === o - A && /* @__PURE__ */ e("tr", { ref: O }),
|
|
301
301
|
/* @__PURE__ */ e(M, { children: v.map(
|
|
302
302
|
(x) => z(x, s, r)
|
|
303
303
|
) })
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as n, jsx as t, Fragment as Q } from "react/jsx-runtime";
|
|
2
|
-
import { I as Z, n as P, INFINITE_SCROLL_LIMIT as G, INFINITE_SCROLL_THRESHOLD as ee, LOCAL_STORAGE_PREFIX as y, LOCAL_STORAGE_SORT_TIMESTAMP as te, LOCAL_STORAGE_SORT_TOKEN_USAGE as re, LOCAL_STORAGE_SORT as ae,
|
|
3
|
-
import { HistoryContext as z, ChatContext as M, useAiChat as Ee, E, e as m, ConfirmationPanel as ge, LazyToastContainerWrapper as Ae, showErrorToast as _e, CHAT_SET_PROVIDER as Oe, showSuccessToast as ve, CHAT_SET_STATUS as De, oe as Le, O as Re } from "./App.
|
|
2
|
+
import { I as Z, n as P, INFINITE_SCROLL_LIMIT as G, INFINITE_SCROLL_THRESHOLD as ee, LOCAL_STORAGE_PREFIX as y, LOCAL_STORAGE_SORT_TIMESTAMP as te, LOCAL_STORAGE_SORT_TOKEN_USAGE as re, LOCAL_STORAGE_SORT as ae, pe as L, useUserPreferences as se, APP_CLASSNAME as oe, mutateCall as b, SERVICE_TYPES as x, TOAST_CHAT_DELETED as ie, setNewProvider as ne, ACTION_SORT as ce, fe as le, TOAST_PROVIDER_CHANGED as de, useChatsHistory as he, LOCAL_STORAGE_SEARCH as me, LOCAL_STORAGE_FAVORITES_ONLY as ue, HISTORY_TITLE as Ce, S as Se, Y as pe, debounce as Te, C as fe, ACTION_SEARCH as ye } from "./index.BCvnlzn1.js";
|
|
3
|
+
import { HistoryContext as z, ChatContext as M, useAiChat as Ee, E, e as m, ConfirmationPanel as ge, LazyToastContainerWrapper as Ae, showErrorToast as _e, CHAT_SET_PROVIDER as Oe, showSuccessToast as ve, CHAT_SET_STATUS as De, oe as Le, O as Re } from "./App.BUHkBnAs.js";
|
|
4
4
|
import { useRef as H, useState as F, useContext as R, useCallback as ke, useEffect as U, Suspense as Ie, lazy as we } from "react";
|
|
5
5
|
const Ne = ({
|
|
6
6
|
className: l,
|
|
@@ -31,7 +31,7 @@ const Ne = ({
|
|
|
31
31
|
), be = we(
|
|
32
32
|
() => import(
|
|
33
33
|
/* webpackChunkName: "history-table" */
|
|
34
|
-
"./ChatHistoryTable.
|
|
34
|
+
"./ChatHistoryTable.z1gXvLbS.js"
|
|
35
35
|
).then((l) => ({ default: l.ChatHistoryTable }))
|
|
36
36
|
), xe = ({
|
|
37
37
|
filteredHistory: l,
|
|
@@ -56,7 +56,7 @@ const Ne = ({
|
|
|
56
56
|
} = R(M), { setInput: N } = Ee(), [O, v] = E({
|
|
57
57
|
key: y + te,
|
|
58
58
|
initialValue: m.DESC
|
|
59
|
-
}), [
|
|
59
|
+
}), [a, B] = E({
|
|
60
60
|
key: y + re,
|
|
61
61
|
initialValue: m.ASC
|
|
62
62
|
}), [, Y] = E({
|
|
@@ -66,22 +66,22 @@ const Ne = ({
|
|
|
66
66
|
user: d?.username,
|
|
67
67
|
getAccessToken: C
|
|
68
68
|
}), $ = (e) => {
|
|
69
|
-
const
|
|
69
|
+
const s = i.sortedCell === e;
|
|
70
70
|
let r, D;
|
|
71
71
|
switch (e) {
|
|
72
72
|
case L:
|
|
73
|
-
D = v, r =
|
|
73
|
+
D = v, r = s ? i.sortDirection : O;
|
|
74
74
|
break;
|
|
75
|
-
case
|
|
76
|
-
D = B, r =
|
|
75
|
+
case le:
|
|
76
|
+
D = B, r = s ? i.sortDirection : a;
|
|
77
77
|
break;
|
|
78
78
|
default:
|
|
79
|
-
D = v, r =
|
|
79
|
+
D = v, r = s ? i.sortDirection : O;
|
|
80
80
|
break;
|
|
81
81
|
}
|
|
82
82
|
const V = r === m.ASC ? m.DESC : m.ASC;
|
|
83
83
|
D(V), Y(e), A({
|
|
84
|
-
type:
|
|
84
|
+
type: ce,
|
|
85
85
|
payload: {
|
|
86
86
|
sortedCell: e,
|
|
87
87
|
sortDirection: V
|
|
@@ -97,7 +97,7 @@ const Ne = ({
|
|
|
97
97
|
userId: d?.username || "",
|
|
98
98
|
id: e.id
|
|
99
99
|
}
|
|
100
|
-
}), u(""), await _e(
|
|
100
|
+
}), u(""), await _e(ie, {
|
|
101
101
|
autoClose: 2e3,
|
|
102
102
|
containerId: "history-table"
|
|
103
103
|
});
|
|
@@ -105,16 +105,16 @@ const Ne = ({
|
|
|
105
105
|
}
|
|
106
106
|
}, W = async (e) => {
|
|
107
107
|
try {
|
|
108
|
-
const
|
|
109
|
-
accessToken:
|
|
108
|
+
const s = await C(), r = await b({
|
|
109
|
+
accessToken: s,
|
|
110
110
|
type: x.GET_CHAT,
|
|
111
111
|
params: {
|
|
112
112
|
id: e.id
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
|
-
r.
|
|
115
|
+
r.data.provider !== f && (await ne({
|
|
116
116
|
provider: r.data.provider,
|
|
117
|
-
accessToken:
|
|
117
|
+
accessToken: s,
|
|
118
118
|
username: d?.username || ""
|
|
119
119
|
}), h({
|
|
120
120
|
type: Oe,
|
|
@@ -133,7 +133,7 @@ const Ne = ({
|
|
|
133
133
|
restoredModel: r.data?.model || "",
|
|
134
134
|
restoredUsage: r.data?.tokenUsage || 0
|
|
135
135
|
}
|
|
136
|
-
}), N(""), w(e.id), _(r.data.messages), T(!1)
|
|
136
|
+
}), N(""), w(e.id), _(r.data.messages), T(!1);
|
|
137
137
|
} catch {
|
|
138
138
|
}
|
|
139
139
|
}, X = (e) => {
|
|
@@ -144,14 +144,14 @@ const Ne = ({
|
|
|
144
144
|
}, g(!c);
|
|
145
145
|
}, q = async (e) => {
|
|
146
146
|
try {
|
|
147
|
-
|
|
147
|
+
await b({
|
|
148
148
|
accessToken: await C(),
|
|
149
149
|
type: x.TOGGLE_FAVORITE_CHAT,
|
|
150
150
|
params: {
|
|
151
151
|
userId: d?.username || "",
|
|
152
152
|
id: e.id
|
|
153
153
|
}
|
|
154
|
-
})
|
|
154
|
+
}), u("");
|
|
155
155
|
} catch {
|
|
156
156
|
}
|
|
157
157
|
}, J = ke((e) => {
|
|
@@ -161,8 +161,8 @@ const Ne = ({
|
|
|
161
161
|
const e = {
|
|
162
162
|
// root: null,
|
|
163
163
|
rootMargin: "20px"
|
|
164
|
-
},
|
|
165
|
-
S.current &&
|
|
164
|
+
}, s = new IntersectionObserver(J, e);
|
|
165
|
+
S.current && s.observe(S.current);
|
|
166
166
|
}), /* @__PURE__ */ n(Q, { children: [
|
|
167
167
|
/* @__PURE__ */ n(
|
|
168
168
|
ge,
|
|
@@ -232,20 +232,20 @@ const Ne = ({
|
|
|
232
232
|
});
|
|
233
233
|
U(() => {
|
|
234
234
|
p && S(
|
|
235
|
-
f ? p.filter((
|
|
235
|
+
f ? p.filter((a) => a.favoriteChat === !0) : p
|
|
236
236
|
);
|
|
237
237
|
}, [p, f]);
|
|
238
|
-
const _ = async (
|
|
239
|
-
I(
|
|
238
|
+
const _ = async (a) => {
|
|
239
|
+
I(a), g({
|
|
240
240
|
type: ye,
|
|
241
|
-
payload: { searchString:
|
|
241
|
+
payload: { searchString: a }
|
|
242
242
|
});
|
|
243
|
-
}, N = Te((
|
|
244
|
-
_(
|
|
245
|
-
}, 500), O = async (
|
|
246
|
-
|
|
247
|
-
}, v = (
|
|
248
|
-
w(
|
|
243
|
+
}, N = Te((a) => {
|
|
244
|
+
_(a.target.value.trim());
|
|
245
|
+
}, 500), O = async (a) => {
|
|
246
|
+
a.preventDefault();
|
|
247
|
+
}, v = (a) => {
|
|
248
|
+
w(a);
|
|
249
249
|
};
|
|
250
250
|
return /* @__PURE__ */ n(
|
|
251
251
|
Le,
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { jsxs as t, Fragment as M, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { preloadToast as B, showSuccessToast as G, showErrorToast as O, LazyToastContainerWrapper as j, oe as D } from "./App.BUHkBnAs.js";
|
|
3
|
+
import { n as K, i as W, useUserPreferences as Y, useServerCapabilities as H, Ee as $, setUserPlan as V, S as o, renderDataAsList as q, CARDS as r, L as E, j as l, C as J, it as Q, isTauri as X, te as Z, l as I, PROFILE_TITLE as ee } from "./index.BCvnlzn1.js";
|
|
4
|
+
import se from "clsx";
|
|
5
|
+
import { useState as L, useMemo as re, useCallback as k } from "react";
|
|
6
|
+
const ae = () => {
|
|
7
|
+
const {
|
|
8
|
+
isAuthenticated: d,
|
|
9
|
+
user: a,
|
|
10
|
+
registeringForPasskey: g,
|
|
11
|
+
authenticationType: w,
|
|
12
|
+
getAccessToken: m
|
|
13
|
+
} = K(), [y, S] = L(null), [N, b] = L(!1), v = W(), P = a?.username || "", {
|
|
14
|
+
data: h,
|
|
15
|
+
isSuccess: F,
|
|
16
|
+
refetch: f
|
|
17
|
+
} = Y({
|
|
18
|
+
user: a?.username,
|
|
19
|
+
getAccessToken: m
|
|
20
|
+
}), { data: p, isSuccess: u } = H(), T = re(() => !u || !p?.plans ? [] : p.plans.map((s) => ({
|
|
21
|
+
id: s.name,
|
|
22
|
+
label: s.label,
|
|
23
|
+
description: s.description,
|
|
24
|
+
features: s.features,
|
|
25
|
+
models: s.allowedModels.map(
|
|
26
|
+
(n) => $[n] || n
|
|
27
|
+
)
|
|
28
|
+
})), [u, p?.plans]), C = k(() => {
|
|
29
|
+
N || (B(), b(!0));
|
|
30
|
+
}, [N]), x = k(
|
|
31
|
+
async (s, n) => {
|
|
32
|
+
if (!(!a?.username || s === h?.plan))
|
|
33
|
+
try {
|
|
34
|
+
S(s), await V({
|
|
35
|
+
plan: s,
|
|
36
|
+
accessToken: await m(),
|
|
37
|
+
username: a.username
|
|
38
|
+
}), await f(), await G(`${r.PLANS.SWITCH_SUCCESS} ${n}`, {
|
|
39
|
+
containerId: "profile-plan-selection"
|
|
40
|
+
});
|
|
41
|
+
} catch {
|
|
42
|
+
await O(r.PLANS.SWITCH_ERROR, {
|
|
43
|
+
containerId: "profile-plan-selection"
|
|
44
|
+
});
|
|
45
|
+
} finally {
|
|
46
|
+
S(null);
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
[m, h?.plan, f, a?.username]
|
|
50
|
+
);
|
|
51
|
+
return d && P ? /* @__PURE__ */ t(M, { children: [
|
|
52
|
+
/* @__PURE__ */ e("div", { className: "av-sassy", children: /* @__PURE__ */ e(j, { containerId: "profile-plan-selection" }) }),
|
|
53
|
+
/* @__PURE__ */ e(
|
|
54
|
+
o,
|
|
55
|
+
{
|
|
56
|
+
header: r.PREFERENCES.TITLE,
|
|
57
|
+
className: "prose-dark dark:prose-lighter",
|
|
58
|
+
noBorder: !0,
|
|
59
|
+
children: q(v, {
|
|
60
|
+
[r.PREFERENCES.USERNAME]: P,
|
|
61
|
+
[r.PREFERENCES.EMAIL]: a?.email || ""
|
|
62
|
+
})
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
F && u && T.length > 0 && /* @__PURE__ */ t(
|
|
66
|
+
o,
|
|
67
|
+
{
|
|
68
|
+
header: r.PLANS.TITLE,
|
|
69
|
+
className: "prose-dark dark:prose-lighter mt-4",
|
|
70
|
+
noBorder: !0,
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ e("p", { className: "text-sm", children: r.PLANS.DESCRIPTION }),
|
|
73
|
+
/* @__PURE__ */ e(E, { columnGap: 3, rowGap: 3, className: "mt-4", children: T.map(({ id: s, label: n, description: R, features: U, models: _ }) => {
|
|
74
|
+
const c = h?.plan === s, z = c ? r.PLANS.ACTIVE_BADGE : `Get ${n}`, A = y === s;
|
|
75
|
+
return /* @__PURE__ */ e(l, { span: { fallback: 12, md: 4 }, children: /* @__PURE__ */ e(o, { mode: "darker", className: "prose-lighter h-full", children: /* @__PURE__ */ t(E, { direction: "column", children: [
|
|
76
|
+
/* @__PURE__ */ t(l, { children: [
|
|
77
|
+
/* @__PURE__ */ e("div", { className: "flex items-start justify-between gap-2", children: /* @__PURE__ */ t("div", { children: [
|
|
78
|
+
/* @__PURE__ */ e(
|
|
79
|
+
"h3",
|
|
80
|
+
{
|
|
81
|
+
className: se("m-0", {
|
|
82
|
+
"text-emerald-400": c
|
|
83
|
+
}),
|
|
84
|
+
children: n
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ e("p", { className: "mb-0 text-sm opacity-80", children: R })
|
|
88
|
+
] }) }),
|
|
89
|
+
/* @__PURE__ */ e("h4", { children: "Features" }),
|
|
90
|
+
/* @__PURE__ */ e("ul", { className: "prose-li:text-sm", children: U.map((i) => /* @__PURE__ */ e("li", { children: i }, i)) }),
|
|
91
|
+
/* @__PURE__ */ e("h4", { children: "Models" }),
|
|
92
|
+
/* @__PURE__ */ e("ul", { className: "prose-li:text-sm", children: _.map((i) => /* @__PURE__ */ e("li", { children: i }, i)) })
|
|
93
|
+
] }),
|
|
94
|
+
/* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(
|
|
95
|
+
J,
|
|
96
|
+
{
|
|
97
|
+
mode: "dark",
|
|
98
|
+
size: "small",
|
|
99
|
+
variant: c ? "selected" : "secondary",
|
|
100
|
+
className: "mt-4",
|
|
101
|
+
fullWidth: !0,
|
|
102
|
+
disabled: c || A,
|
|
103
|
+
onClick: async () => {
|
|
104
|
+
await x(s, n);
|
|
105
|
+
},
|
|
106
|
+
onMouseEnter: C,
|
|
107
|
+
onFocus: C,
|
|
108
|
+
children: A ? "Updating..." : z
|
|
109
|
+
}
|
|
110
|
+
) })
|
|
111
|
+
] }) }) }, s);
|
|
112
|
+
}) })
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
w !== Q.PASSKEY && !X() && /* @__PURE__ */ t(
|
|
117
|
+
o,
|
|
118
|
+
{
|
|
119
|
+
className: "prose-dark dark:prose-lighter mt-4",
|
|
120
|
+
noBorder: !0,
|
|
121
|
+
header: /* @__PURE__ */ e("h2", { className: "m-0", children: /* @__PURE__ */ t(E, { columnGap: 3, alignVertical: "center", children: [
|
|
122
|
+
/* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(I, { size: "size-8" }) }),
|
|
123
|
+
/* @__PURE__ */ e(l, { children: /* @__PURE__ */ e("div", { children: r.PREFERENCES.PASSKEY_TITLE }) })
|
|
124
|
+
] }) }),
|
|
125
|
+
children: [
|
|
126
|
+
/* @__PURE__ */ e("p", { children: r.PREFERENCES.PASSKEY_INSTRUCTIONS }),
|
|
127
|
+
/* @__PURE__ */ e(
|
|
128
|
+
Z,
|
|
129
|
+
{
|
|
130
|
+
variant: "selected",
|
|
131
|
+
size: "small",
|
|
132
|
+
className: "mt-2",
|
|
133
|
+
onClick: g,
|
|
134
|
+
labelLeft: r.PREFERENCES.PASSKEY_BUTTON,
|
|
135
|
+
children: /* @__PURE__ */ e(I, { size: "size-5", monotone: !0 })
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
] }) : null;
|
|
142
|
+
}, oe = ({
|
|
143
|
+
open: d,
|
|
144
|
+
onOpenChange: a
|
|
145
|
+
}) => /* @__PURE__ */ e(
|
|
146
|
+
D,
|
|
147
|
+
{
|
|
148
|
+
open: d,
|
|
149
|
+
onOpenChange: a,
|
|
150
|
+
title: ee,
|
|
151
|
+
animation: !0,
|
|
152
|
+
animationType: "fade",
|
|
153
|
+
children: /* @__PURE__ */ e(ae, {})
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
export {
|
|
157
|
+
oe as Profile
|
|
158
|
+
};
|