@versini/sassysaint 5.4.7 → 5.4.9

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.
@@ -0,0 +1,2974 @@
1
+ import { jsx as o, jsxs as y, Fragment as _ } from "react/jsx-runtime";
2
+ import { g as B, R as P, CARDS as T, renderDataAsList as oe, pluralize as he, AppContext as se, ABOUT_TITLE as Dt, DEFAULT_AI_ENGINE as te, numberFormatter as $t, durationFormatter as Qe, NA as Vt, ROLE_ASSISTANT as Ft, extractAverage as Ht, GPT4_MAX_TOKENS as Gt, un as W, STATS as Xe, L as q, j as L, C as F, HistoryContext as Je, LOCAL_STORAGE_PREFIX as ie, LOCAL_STORAGE_SORT as Ut, O as j, ACTION_RESET as et, ACTION_RESTORE as jt, ACTION_SORT as $e, LOCAL_STORAGE_SEARCH as Kt, ye as xe, ACTION_SEARCH as Wt, debounce as Yt, HISTORY_TITLE as qt, LOCAL_STORAGE_ENGINE_TOGGLE as tt, ENGINE_OPENAI as Ne, ENGINE_ANTHROPIC as me, APP_NAME as Zt, ACTION_ENGINE as rt, getCurrentGeoLocation as Qt, TagsContext as Xt, TAGS_DESCRIPTION as Jt, ACTION_SET_TAGS as er, LOCAL_STORAGE_CHAT_DETAILS as tr, M as rr, i as Ve, PROFILE_TITLE as or, LOG_OUT as Fe } from "./index.CzNemj1t.js";
3
+ import { serviceCall as D, SERVICE_TYPES as $, E as le, ce as ar, se as nr, he as we, be as sr, oe as V, ge as ir, ne as lr, f as U, Le as He, h as Ge } from "./index.CPH8aJ8U.js";
4
+ import * as f from "react";
5
+ import E, { useId as Ae, forwardRef as ot, useState as I, useRef as Z, useContext as O, useEffect as H } from "react";
6
+ import k from "clsx";
7
+ import { useFloatingTree as at, useFloatingNodeId as cr, useListItem as nt, useFloating as st, offset as dr, flip as ur, shift as mr, autoUpdate as hr, useClick as it, useRole as lt, useDismiss as ct, useListNavigation as gr, useTypeahead as fr, useInteractions as dt, useMergeRefs as Me, FloatingNode as pr, FloatingList as br, FloatingPortal as ut, FloatingFocusManager as mt, FloatingTree as vr, FloatingOverlay as yr } from "@floating-ui/react";
8
+ const ht = ({
9
+ className: e,
10
+ viewBox: t,
11
+ title: r,
12
+ monotone: a,
13
+ ...n
14
+ }) => /* @__PURE__ */ o(
15
+ B,
16
+ {
17
+ defaultViewBox: "0 0 256 176",
18
+ defaultClassName: "size-5",
19
+ viewBox: t,
20
+ className: e,
21
+ title: r || "Anthropic",
22
+ ...n,
23
+ children: /* @__PURE__ */ o("path", { d: "m147.487 0l70.081 175.78H256L185.919 0zM66.183 106.221l23.98-61.774l23.98 61.774zM70.07 0L0 175.78h39.18l14.33-36.914h73.308l14.328 36.914h39.179L110.255 0z" })
24
+ }
25
+ ), kr = ({
26
+ className: e,
27
+ viewBox: t,
28
+ title: r,
29
+ monotone: a,
30
+ ...n
31
+ }) => /* @__PURE__ */ y(
32
+ B,
33
+ {
34
+ defaultViewBox: "0 0 512 512",
35
+ defaultClassName: "size-5",
36
+ viewBox: t,
37
+ className: e,
38
+ title: r || "Back",
39
+ ...n,
40
+ children: [
41
+ /* @__PURE__ */ o(
42
+ "path",
43
+ {
44
+ opacity: a ? "1" : "0.4",
45
+ d: "M288.4 93.4c2.9-17.4 19.4-29.2 36.9-26.3C431.3 84.9 512 177 512 288c0 123.7-100.3 224-224 224C177 512 84.9 431.3 67.1 325.3c-2.9-17.4 8.8-33.9 26.3-36.9s33.9 8.8 36.9 26.3C142.9 390.4 208.8 448 288 448c88.4 0 160-71.6 160-160c0-79.2-57.6-145.1-133.3-157.8c-17.4-2.9-29.2-19.4-26.3-36.9z"
46
+ }
47
+ ),
48
+ /* @__PURE__ */ o("path", { d: "M32 0H192c17.7 0 32 14.3 32 32s-14.3 32-32 32H109.3L342.6 297.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L64 109.3V192c0 17.7-14.3 32-32 32s-32-14.3-32-32V32C0 14.3 14.3 0 32 0z" })
49
+ ]
50
+ }
51
+ ), Cr = ({
52
+ className: e,
53
+ viewBox: t,
54
+ title: r,
55
+ monotone: a,
56
+ ...n
57
+ }) => /* @__PURE__ */ y(
58
+ B,
59
+ {
60
+ defaultViewBox: "0 0 448 512",
61
+ defaultClassName: "size-5",
62
+ viewBox: t,
63
+ className: e,
64
+ title: r || "Chart",
65
+ ...n,
66
+ children: [
67
+ /* @__PURE__ */ o(
68
+ "path",
69
+ {
70
+ opacity: a ? "1" : "0.4",
71
+ d: "M160 80c0-26.5 21.5-48 48-48h32c26.5 0 48 21.5 48 48V432c0 26.5-21.5 48-48 48H208c-26.5 0-48-21.5-48-48V80z"
72
+ }
73
+ ),
74
+ /* @__PURE__ */ o("path", { d: "M368 96c-26.5 0-48 21.5-48 48V432c0 26.5 21.5 48 48 48h32c26.5 0 48-21.5 48-48V144c0-26.5-21.5-48-48-48H368zM48 224c-26.5 0-48 21.5-48 48V432c0 26.5 21.5 48 48 48H80c26.5 0 48-21.5 48-48V272c0-26.5-21.5-48-48-48H48z" })
75
+ ]
76
+ }
77
+ ), Nr = ({
78
+ className: e,
79
+ viewBox: t,
80
+ title: r,
81
+ monotone: a,
82
+ ...n
83
+ }) => /* @__PURE__ */ y(
84
+ B,
85
+ {
86
+ defaultViewBox: "0 0 448 512",
87
+ defaultClassName: "size-5",
88
+ viewBox: t,
89
+ className: e,
90
+ title: r || "Delete",
91
+ ...n,
92
+ children: [
93
+ /* @__PURE__ */ o(
94
+ "path",
95
+ {
96
+ opacity: a ? "1" : "0.4",
97
+ d: "M416 96H32V448c0 35.3 28.7 64 64 64H352c35.3 0 64-28.7 64-64V96zM144 176V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V176c0-8.8 7.2-16 16-16s16 7.2 16 16zm96 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V176c0-8.8 7.2-16 16-16s16 7.2 16 16zm96 0V400c0 8.8-7.2 16-16 16s-16-7.2-16-16V176c0-8.8 7.2-16 16-16s16 7.2 16 16z"
98
+ }
99
+ ),
100
+ /* @__PURE__ */ o("path", { d: "M163.8 0c-12.1 0-23.2 6.8-28.6 17.7L128 32H32C14.3 32 0 46.3 0 64S14.3 96 32 96H416c17.7 0 32-14.3 32-32s-14.3-32-32-32H320l-7.2-14.3C307.4 6.8 296.3 0 284.2 0H163.8z" })
101
+ ]
102
+ }
103
+ ), wr = ({
104
+ className: e,
105
+ viewBox: t,
106
+ title: r,
107
+ monotone: a,
108
+ ...n
109
+ }) => /* @__PURE__ */ y(
110
+ B,
111
+ {
112
+ defaultViewBox: "0 0 512 512",
113
+ defaultClassName: "size-5",
114
+ viewBox: t,
115
+ className: e,
116
+ title: r || "History",
117
+ ...n,
118
+ children: [
119
+ /* @__PURE__ */ o(
120
+ "path",
121
+ {
122
+ opacity: a ? "1" : "0.4",
123
+ d: "M120.2 120.2C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8z"
124
+ }
125
+ ),
126
+ /* @__PURE__ */ o("path", { d: "M256 128c13.3 0 24 10.7 24 24v94.1l65 65c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0l-72-72c-4.5-4.5-7-10.6-7-17V152c0-13.3 10.7-24 24-24z" })
127
+ ]
128
+ }
129
+ ), Tr = ({
130
+ className: e,
131
+ viewBox: t,
132
+ title: r,
133
+ monotone: a,
134
+ ...n
135
+ }) => /* @__PURE__ */ y(
136
+ B,
137
+ {
138
+ defaultViewBox: "0 0 512 512",
139
+ defaultClassName: "size-5",
140
+ viewBox: t,
141
+ className: e,
142
+ title: r || "Info",
143
+ ...n,
144
+ children: [
145
+ /* @__PURE__ */ o(
146
+ "path",
147
+ {
148
+ opacity: "0.4",
149
+ d: "M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zM216 336h24V272H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24zm40-208a32 32 0 1 1 0 64 32 32 0 1 1 0-64z"
150
+ }
151
+ ),
152
+ /* @__PURE__ */ o("path", { d: "M256 128a32 32 0 1 1 0 64 32 32 0 1 1 0-64zM192 248c0-13.3 10.7-24 24-24h48c13.3 0 24 10.7 24 24v88h8c13.3 0 24 10.7 24 24s-10.7 24-24 24H216c-13.3 0-24-10.7-24-24s10.7-24 24-24h24V272H216c-13.3 0-24-10.7-24-24z" })
153
+ ]
154
+ }
155
+ ), gt = ({
156
+ className: e,
157
+ viewBox: t,
158
+ title: r,
159
+ monotone: a,
160
+ ...n
161
+ }) => /* @__PURE__ */ o(
162
+ B,
163
+ {
164
+ defaultViewBox: "0 0 24 24",
165
+ defaultClassName: "size-5",
166
+ viewBox: t,
167
+ className: e,
168
+ title: r || "OpenAI",
169
+ ...n,
170
+ children: /* @__PURE__ */ o(
171
+ "path",
172
+ {
173
+ fill: "currentColor",
174
+ d: "M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z"
175
+ }
176
+ )
177
+ }
178
+ ), xr = ({
179
+ className: e,
180
+ viewBox: t,
181
+ title: r,
182
+ monotone: a,
183
+ ...n
184
+ }) => /* @__PURE__ */ y(
185
+ B,
186
+ {
187
+ defaultViewBox: "0 0 576 512",
188
+ defaultClassName: "size-5",
189
+ viewBox: t,
190
+ className: e,
191
+ title: r || "Profile",
192
+ ...n,
193
+ children: [
194
+ /* @__PURE__ */ o(
195
+ "path",
196
+ {
197
+ opacity: "0.4",
198
+ d: "M64 32C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H512c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm80 256h64c44.2 0 80 35.8 80 80c0 8.8-7.2 16-16 16H80c-8.8 0-16-7.2-16-16c0-44.2 35.8-80 80-80zm-32-96a64 64 0 1 1 128 0 64 64 0 1 1 -128 0zm256-32H496c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H496c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s7.2-16 16-16zm0 64H496c8.8 0 16 7.2 16 16s-7.2 16-16 16H368c-8.8 0-16-7.2-16-16s7.2-16 16-16z"
199
+ }
200
+ ),
201
+ /* @__PURE__ */ o("path", { d: "M176 256a64 64 0 1 0 0-128 64 64 0 1 0 0 128zm-32 32c-44.2 0-80 35.8-80 80c0 8.8 7.2 16 16 16H272c8.8 0 16-7.2 16-16c0-44.2-35.8-80-80-80H144z" })
202
+ ]
203
+ }
204
+ ), Er = ({
205
+ className: e,
206
+ viewBox: t,
207
+ title: r,
208
+ monotone: a,
209
+ ...n
210
+ }) => /* @__PURE__ */ y(
211
+ B,
212
+ {
213
+ defaultViewBox: "0 0 512 512",
214
+ defaultClassName: "size-5",
215
+ viewBox: t,
216
+ className: e,
217
+ title: r || "Restore",
218
+ ...n,
219
+ children: [
220
+ /* @__PURE__ */ o(
221
+ "path",
222
+ {
223
+ opacity: a ? "1" : "0.4",
224
+ d: "M208 64H432c8.8 0 16 7.2 16 16V304c0 8.8-7.2 16-16 16H416v64h16c44.2 0 80-35.8 80-80V80c0-44.2-35.8-80-80-80H208c-44.2 0-80 35.8-80 80V96h64V80c0-8.8 7.2-16 16-16z"
225
+ }
226
+ ),
227
+ /* @__PURE__ */ o("path", { d: "M64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H320c35.3 0 64-28.7 64-64V192c0-35.3-28.7-64-64-64H64zm32 64H288c17.7 0 32 14.3 32 32s-14.3 32-32 32H96c-17.7 0-32-14.3-32-32s14.3-32 32-32z" })
228
+ ]
229
+ }
230
+ ), Ir = ({
231
+ className: e,
232
+ viewBox: t,
233
+ title: r,
234
+ monotone: a,
235
+ ...n
236
+ }) => /* @__PURE__ */ o(
237
+ B,
238
+ {
239
+ defaultViewBox: "0 0 448 512",
240
+ defaultClassName: "size-5",
241
+ viewBox: t,
242
+ className: e,
243
+ title: r || "Settings",
244
+ ...n,
245
+ children: /* @__PURE__ */ o("path", { d: "M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z" })
246
+ }
247
+ );
248
+ function ae(e) {
249
+ return Ae();
250
+ }
251
+ const Ee = f.createContext({
252
+ getItemProps: () => ({}),
253
+ activeIndex: null,
254
+ /* v8 ignore next 2 */
255
+ setActiveIndex: () => {
256
+ },
257
+ setHasFocusInside: () => {
258
+ },
259
+ isOpen: !1
260
+ }), Ue = (e) => {
261
+ if (typeof e == "string")
262
+ return e;
263
+ if (typeof e == "function")
264
+ return e.displayName || e.name || "Component";
265
+ if (typeof e == "object" && e !== null && "type" in e) {
266
+ const t = e.type;
267
+ if (typeof t == "function" || typeof t == "object")
268
+ return t.displayName || t.name || "Component";
269
+ }
270
+ return "Element";
271
+ }, ft = ot(
272
+ ({
273
+ trigger: e,
274
+ children: t,
275
+ label: r = "Open menu",
276
+ defaultPlacement: a = "bottom-start",
277
+ onOpenChange: n,
278
+ mode: i = "system",
279
+ focusMode: s = "system",
280
+ ...l
281
+ }, g) => {
282
+ const [c, u] = I(!1), [p, b] = I(!1), [h, m] = I(null), d = Z([]), v = Z([]), N = O(Ee), C = at(), w = cr(), S = nt(), { floatingStyles: A, refs: M, context: R } = st({
283
+ nodeId: w,
284
+ open: c,
285
+ onOpenChange: (J) => {
286
+ u(J), n == null || n(J);
287
+ },
288
+ placement: a,
289
+ strategy: "fixed",
290
+ middleware: [dr({ mainAxis: 10 }), ur(), mr()],
291
+ whileElementsMounted: hr
292
+ }), x = it(R, {
293
+ event: "mousedown",
294
+ toggle: !0,
295
+ ignoreMouse: !1
296
+ }), ce = lt(R, { role: "menu" }), de = ct(R, { bubbles: !0 }), X = gr(R, {
297
+ listRef: d,
298
+ activeIndex: h,
299
+ nested: !1,
300
+ onNavigate: m,
301
+ loop: !0
302
+ }), ye = fr(R, {
303
+ listRef: v,
304
+ onMatch: c ? m : void 0,
305
+ activeIndex: h
306
+ }), { getReferenceProps: ke, getFloatingProps: Ce, getItemProps: z } = dt([x, ce, de, X, ye]), De = Ue(e) === "Button" || Ue(e) === "ButtonIcon", Bt = De ? {
307
+ noInternalClick: De,
308
+ focusMode: s,
309
+ mode: i
310
+ } : {}, zt = E.cloneElement(
311
+ e,
312
+ {
313
+ ...Bt,
314
+ "aria-label": r,
315
+ "data-open": c ? "" : void 0,
316
+ "data-focus-inside": p ? "" : void 0,
317
+ ref: Me([M.setReference, S.ref, g]),
318
+ ...ke(
319
+ N.getItemProps({
320
+ ...l
321
+ })
322
+ )
323
+ }
324
+ );
325
+ return H(() => {
326
+ if (!C)
327
+ return;
328
+ function J() {
329
+ u(!1), n == null || n(!1);
330
+ }
331
+ return C.events.on("click", J), () => {
332
+ C.events.off("click", J);
333
+ };
334
+ }, [C, n]), H(() => {
335
+ c && C && C.events.emit("menuopen", { nodeId: w });
336
+ }, [C, c, w]), /* @__PURE__ */ y(pr, { id: w, children: [
337
+ zt,
338
+ /* @__PURE__ */ o(
339
+ Ee.Provider,
340
+ {
341
+ value: {
342
+ activeIndex: h,
343
+ setActiveIndex: m,
344
+ getItemProps: z,
345
+ setHasFocusInside: b,
346
+ isOpen: c
347
+ },
348
+ children: /* @__PURE__ */ o(br, { elementsRef: d, labelsRef: v, children: c && /* @__PURE__ */ o(ut, { children: /* @__PURE__ */ o(
349
+ mt,
350
+ {
351
+ context: R,
352
+ modal: !1,
353
+ initialFocus: 0,
354
+ returnFocus: !0,
355
+ children: /* @__PURE__ */ o(
356
+ "div",
357
+ {
358
+ ref: M.setFloating,
359
+ className: "rounded-md bg-surface-light p-4 shadow-sm shadow-border-dark outline-none sm:p-2",
360
+ style: A,
361
+ ...Ce(),
362
+ children: t
363
+ }
364
+ )
365
+ }
366
+ ) }) })
367
+ }
368
+ )
369
+ ] });
370
+ }
371
+ ), Ie = ot((e, t) => /* @__PURE__ */ o(vr, { children: /* @__PURE__ */ o(ft, { ...e, ref: t }) }));
372
+ Ie.displayName = "Menu";
373
+ ft.displayName = "MenuComponent";
374
+ const G = f.forwardRef(
375
+ ({
376
+ label: e,
377
+ disabled: t,
378
+ icon: r,
379
+ raw: a = !1,
380
+ children: n,
381
+ ignoreClick: i = !1,
382
+ ...s
383
+ }, l) => {
384
+ let g = "";
385
+ const c = f.useContext(Ee), u = nt({ label: t ? null : e }), p = at(), b = Me([u.ref, l]);
386
+ return a && n ? /* @__PURE__ */ o(
387
+ "div",
388
+ {
389
+ role: "menuitem",
390
+ ...c.getItemProps({
391
+ onClick(h) {
392
+ var m;
393
+ i || ((m = s.onClick) == null || m.call(s, h), p == null || p.events.emit("click"));
394
+ }
395
+ }),
396
+ children: n
397
+ }
398
+ ) : (r && (g = "pl-2"), /* @__PURE__ */ y(
399
+ "button",
400
+ {
401
+ ...s,
402
+ ref: b,
403
+ role: "menuitem",
404
+ className: "m-0 flex w-full rounded-md border border-transparent bg-none px-2 py-2 text-left text-base outline-none focus:border focus:border-border-medium focus:bg-surface-lighter focus:underline disabled:cursor-not-allowed disabled:text-copy-medium sm:py-1",
405
+ tabIndex: 0,
406
+ disabled: t,
407
+ ...c.getItemProps({
408
+ onClick(h) {
409
+ var m;
410
+ i || ((m = s.onClick) == null || m.call(s, h), p == null || p.events.emit("click"));
411
+ },
412
+ onFocus(h) {
413
+ var m;
414
+ (m = s.onFocus) == null || m.call(s, h), c.setHasFocusInside(!0);
415
+ }
416
+ }),
417
+ children: [
418
+ r,
419
+ e && /* @__PURE__ */ o("span", { className: g, children: e })
420
+ ]
421
+ }
422
+ ));
423
+ }
424
+ );
425
+ G.displayName = "MenuItem";
426
+ const Sr = ({ className: e, ...t }) => {
427
+ const r = k(e, "my-1 border-t border-border-medium");
428
+ return /* @__PURE__ */ o("div", { className: r, ...t });
429
+ };
430
+ /*!
431
+ @versini/ui-menu v2.0.0
432
+ © 2024 gizmette.com
433
+ */
434
+ try {
435
+ window.__VERSINI_UI_MENU__ || (window.__VERSINI_UI_MENU__ = {
436
+ version: "2.0.0",
437
+ buildTime: "12/29/2024 04:16 PM EST",
438
+ homepage: "https://github.com/aversini/ui-components",
439
+ license: "MIT"
440
+ });
441
+ } catch {
442
+ }
443
+ /*!
444
+ @versini/ui-togglegroup v2.0.0
445
+ © 2024 gizmette.com
446
+ */
447
+ try {
448
+ window.__VERSINI_UI_TOGGLEGROUP__ || (window.__VERSINI_UI_TOGGLEGROUP__ = {
449
+ version: "2.0.0",
450
+ buildTime: "12/29/2024 04:16 PM EST",
451
+ homepage: "https://github.com/aversini/ui-components",
452
+ license: "MIT"
453
+ });
454
+ } catch {
455
+ }
456
+ const _r = "av-togglegroup", Rr = "av-togglegroup-item-wrapper", Ar = "av-togglegroup-item";
457
+ function Le(e, t = []) {
458
+ let r = [];
459
+ function a(i, s) {
460
+ const l = f.createContext(s), g = r.length;
461
+ r = [...r, s];
462
+ const c = (p) => {
463
+ var b;
464
+ const { scope: h, children: m, ...d } = p, v = ((b = h == null ? void 0 : h[e]) == null ? void 0 : b[g]) || l, N = f.useMemo(() => d, Object.values(d));
465
+ return /* @__PURE__ */ o(v.Provider, { value: N, children: m });
466
+ };
467
+ c.displayName = i + "Provider";
468
+ function u(p, b) {
469
+ var h;
470
+ const m = ((h = b == null ? void 0 : b[e]) == null ? void 0 : h[g]) || l, d = f.useContext(m);
471
+ if (d) return d;
472
+ if (s !== void 0) return s;
473
+ throw new Error(`\`${p}\` must be used within \`${i}\``);
474
+ }
475
+ return [c, u];
476
+ }
477
+ const n = () => {
478
+ const i = r.map((s) => f.createContext(s));
479
+ return function(s) {
480
+ const l = (s == null ? void 0 : s[e]) || i;
481
+ return f.useMemo(
482
+ () => ({ [`__scope${e}`]: { ...s, [e]: l } }),
483
+ [s, l]
484
+ );
485
+ };
486
+ };
487
+ return n.scopeName = e, [a, Mr(n, ...t)];
488
+ }
489
+ function Mr(...e) {
490
+ const t = e[0];
491
+ if (e.length === 1) return t;
492
+ const r = () => {
493
+ const a = e.map((n) => ({
494
+ useScope: n(),
495
+ scopeName: n.scopeName
496
+ }));
497
+ return function(n) {
498
+ const i = a.reduce((s, { useScope: l, scopeName: g }) => {
499
+ const c = l(n)[`__scope${g}`];
500
+ return { ...s, ...c };
501
+ }, {});
502
+ return f.useMemo(() => ({ [`__scope${t.scopeName}`]: i }), [i]);
503
+ };
504
+ };
505
+ return r.scopeName = t.scopeName, r;
506
+ }
507
+ function je(e, t) {
508
+ if (typeof e == "function")
509
+ return e(t);
510
+ e != null && (e.current = t);
511
+ }
512
+ function pt(...e) {
513
+ return (t) => {
514
+ let r = !1;
515
+ const a = e.map((n) => {
516
+ const i = je(n, t);
517
+ return !r && typeof i == "function" && (r = !0), i;
518
+ });
519
+ if (r)
520
+ return () => {
521
+ for (let n = 0; n < a.length; n++) {
522
+ const i = a[n];
523
+ typeof i == "function" ? i() : je(e[n], null);
524
+ }
525
+ };
526
+ };
527
+ }
528
+ function Se(...e) {
529
+ return f.useCallback(pt(...e), e);
530
+ }
531
+ var ge = f.forwardRef((e, t) => {
532
+ const { children: r, ...a } = e, n = f.Children.toArray(r), i = n.find(Pr);
533
+ if (i) {
534
+ const s = i.props.children, l = n.map((g) => g === i ? f.Children.count(s) > 1 ? f.Children.only(null) : f.isValidElement(s) ? s.props.children : null : g);
535
+ return /* @__PURE__ */ o(_e, { ...a, ref: t, children: f.isValidElement(s) ? f.cloneElement(s, void 0, l) : null });
536
+ }
537
+ return /* @__PURE__ */ o(_e, { ...a, ref: t, children: r });
538
+ });
539
+ ge.displayName = "Slot";
540
+ var _e = f.forwardRef((e, t) => {
541
+ const { children: r, ...a } = e;
542
+ if (f.isValidElement(r)) {
543
+ const n = Br(r);
544
+ return f.cloneElement(r, {
545
+ ...Or(a, r.props),
546
+ // @ts-ignore
547
+ ref: t ? pt(t, n) : n
548
+ });
549
+ }
550
+ return f.Children.count(r) > 1 ? f.Children.only(null) : null;
551
+ });
552
+ _e.displayName = "SlotClone";
553
+ var Lr = ({ children: e }) => /* @__PURE__ */ o(_, { children: e });
554
+ function Pr(e) {
555
+ return f.isValidElement(e) && e.type === Lr;
556
+ }
557
+ function Or(e, t) {
558
+ const r = { ...t };
559
+ for (const a in t) {
560
+ const n = e[a], i = t[a];
561
+ /^on[A-Z]/.test(a) ? n && i ? r[a] = (...s) => {
562
+ i(...s), n(...s);
563
+ } : n && (r[a] = n) : a === "style" ? r[a] = { ...n, ...i } : a === "className" && (r[a] = [n, i].filter(Boolean).join(" "));
564
+ }
565
+ return { ...e, ...r };
566
+ }
567
+ function Br(e) {
568
+ var t, r;
569
+ let a = (t = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : t.get, n = a && "isReactWarning" in a && a.isReactWarning;
570
+ return n ? e.ref : (a = (r = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : r.get, n = a && "isReactWarning" in a && a.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
571
+ }
572
+ var zr = [
573
+ "a",
574
+ "button",
575
+ "div",
576
+ "form",
577
+ "h2",
578
+ "h3",
579
+ "img",
580
+ "input",
581
+ "label",
582
+ "li",
583
+ "nav",
584
+ "ol",
585
+ "p",
586
+ "span",
587
+ "svg",
588
+ "ul"
589
+ ], ne = zr.reduce((e, t) => {
590
+ const r = f.forwardRef((a, n) => {
591
+ const { asChild: i, ...s } = a, l = i ? ge : t;
592
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ o(l, { ...s, ref: n });
593
+ });
594
+ return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
595
+ }, {});
596
+ function K(e, t, { checkForDefaultPrevented: r = !0 } = {}) {
597
+ return function(a) {
598
+ if (e == null || e(a), r === !1 || !a.defaultPrevented)
599
+ return t == null ? void 0 : t(a);
600
+ };
601
+ }
602
+ function Dr(e) {
603
+ const t = e + "CollectionProvider", [r, a] = Le(t), [n, i] = r(
604
+ t,
605
+ { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
606
+ ), s = (h) => {
607
+ const { scope: m, children: d } = h, v = E.useRef(null), N = E.useRef(/* @__PURE__ */ new Map()).current;
608
+ return /* @__PURE__ */ o(n, { scope: m, itemMap: N, collectionRef: v, children: d });
609
+ };
610
+ s.displayName = t;
611
+ const l = e + "CollectionSlot", g = E.forwardRef(
612
+ (h, m) => {
613
+ const { scope: d, children: v } = h, N = i(l, d), C = Se(m, N.collectionRef);
614
+ return /* @__PURE__ */ o(ge, { ref: C, children: v });
615
+ }
616
+ );
617
+ g.displayName = l;
618
+ const c = e + "CollectionItemSlot", u = "data-radix-collection-item", p = E.forwardRef(
619
+ (h, m) => {
620
+ const { scope: d, children: v, ...N } = h, C = E.useRef(null), w = Se(m, C), S = i(c, d);
621
+ return E.useEffect(() => (S.itemMap.set(C, { ref: C, ...N }), () => void S.itemMap.delete(C))), /* @__PURE__ */ o(ge, { [u]: "", ref: w, children: v });
622
+ }
623
+ );
624
+ p.displayName = c;
625
+ function b(h) {
626
+ const m = i(e + "CollectionConsumer", h);
627
+ return E.useCallback(() => {
628
+ const d = m.collectionRef.current;
629
+ if (!d) return [];
630
+ const v = Array.from(d.querySelectorAll(`[${u}]`));
631
+ return Array.from(m.itemMap.values()).sort(
632
+ (N, C) => v.indexOf(N.ref.current) - v.indexOf(C.ref.current)
633
+ );
634
+ }, [m.collectionRef, m.itemMap]);
635
+ }
636
+ return [
637
+ { Provider: s, Slot: g, ItemSlot: p },
638
+ b,
639
+ a
640
+ ];
641
+ }
642
+ var $r = globalThis != null && globalThis.document ? f.useLayoutEffect : () => {
643
+ }, Vr = f.useId || (() => {
644
+ }), Fr = 0;
645
+ function Hr(e) {
646
+ const [t, r] = f.useState(Vr());
647
+ return $r(() => {
648
+ r((a) => a ?? String(Fr++));
649
+ }, [e]), t ? `radix-${t}` : "";
650
+ }
651
+ function Pe(e) {
652
+ const t = f.useRef(e);
653
+ return f.useEffect(() => {
654
+ t.current = e;
655
+ }), f.useMemo(() => (...r) => {
656
+ var a;
657
+ return (a = t.current) == null ? void 0 : a.call(t, ...r);
658
+ }, []);
659
+ }
660
+ function pe({
661
+ prop: e,
662
+ defaultProp: t,
663
+ onChange: r = () => {
664
+ }
665
+ }) {
666
+ const [a, n] = Gr({ defaultProp: t, onChange: r }), i = e !== void 0, s = i ? e : a, l = Pe(r), g = f.useCallback(
667
+ (c) => {
668
+ if (i) {
669
+ const u = typeof c == "function" ? c(e) : c;
670
+ u !== e && l(u);
671
+ } else
672
+ n(c);
673
+ },
674
+ [i, e, n, l]
675
+ );
676
+ return [s, g];
677
+ }
678
+ function Gr({
679
+ defaultProp: e,
680
+ onChange: t
681
+ }) {
682
+ const r = f.useState(e), [a] = r, n = f.useRef(a), i = Pe(t);
683
+ return f.useEffect(() => {
684
+ n.current !== a && (i(a), n.current = a);
685
+ }, [a, n, i]), r;
686
+ }
687
+ var Ur = f.createContext(void 0);
688
+ function bt(e) {
689
+ const t = f.useContext(Ur);
690
+ return e || t || "ltr";
691
+ }
692
+ var Te = "rovingFocusGroup.onEntryFocus", jr = { bubbles: !1, cancelable: !0 }, be = "RovingFocusGroup", [Re, vt, Kr] = Dr(be), [Wr, yt] = Le(
693
+ be,
694
+ [Kr]
695
+ ), [Yr, qr] = Wr(be), kt = f.forwardRef(
696
+ (e, t) => /* @__PURE__ */ o(Re.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ o(Re.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ o(Zr, { ...e, ref: t }) }) })
697
+ );
698
+ kt.displayName = be;
699
+ var Zr = f.forwardRef((e, t) => {
700
+ const {
701
+ __scopeRovingFocusGroup: r,
702
+ orientation: a,
703
+ loop: n = !1,
704
+ dir: i,
705
+ currentTabStopId: s,
706
+ defaultCurrentTabStopId: l,
707
+ onCurrentTabStopIdChange: g,
708
+ onEntryFocus: c,
709
+ preventScrollOnEntryFocus: u = !1,
710
+ ...p
711
+ } = e, b = f.useRef(null), h = Se(t, b), m = bt(i), [d = null, v] = pe({
712
+ prop: s,
713
+ defaultProp: l,
714
+ onChange: g
715
+ }), [N, C] = f.useState(!1), w = Pe(c), S = vt(r), A = f.useRef(!1), [M, R] = f.useState(0);
716
+ return f.useEffect(() => {
717
+ const x = b.current;
718
+ if (x)
719
+ return x.addEventListener(Te, w), () => x.removeEventListener(Te, w);
720
+ }, [w]), /* @__PURE__ */ o(
721
+ Yr,
722
+ {
723
+ scope: r,
724
+ orientation: a,
725
+ dir: m,
726
+ loop: n,
727
+ currentTabStopId: d,
728
+ onItemFocus: f.useCallback(
729
+ (x) => v(x),
730
+ [v]
731
+ ),
732
+ onItemShiftTab: f.useCallback(() => C(!0), []),
733
+ onFocusableItemAdd: f.useCallback(
734
+ () => R((x) => x + 1),
735
+ []
736
+ ),
737
+ onFocusableItemRemove: f.useCallback(
738
+ () => R((x) => x - 1),
739
+ []
740
+ ),
741
+ children: /* @__PURE__ */ o(
742
+ ne.div,
743
+ {
744
+ tabIndex: N || M === 0 ? -1 : 0,
745
+ "data-orientation": a,
746
+ ...p,
747
+ ref: h,
748
+ style: { outline: "none", ...e.style },
749
+ onMouseDown: K(e.onMouseDown, () => {
750
+ A.current = !0;
751
+ }),
752
+ onFocus: K(e.onFocus, (x) => {
753
+ const ce = !A.current;
754
+ if (x.target === x.currentTarget && ce && !N) {
755
+ const de = new CustomEvent(Te, jr);
756
+ if (x.currentTarget.dispatchEvent(de), !de.defaultPrevented) {
757
+ const X = S().filter((z) => z.focusable), ye = X.find((z) => z.active), ke = X.find((z) => z.id === d), Ce = [ye, ke, ...X].filter(
758
+ Boolean
759
+ ).map((z) => z.ref.current);
760
+ wt(Ce, u);
761
+ }
762
+ }
763
+ A.current = !1;
764
+ }),
765
+ onBlur: K(e.onBlur, () => C(!1))
766
+ }
767
+ )
768
+ }
769
+ );
770
+ }), Ct = "RovingFocusGroupItem", Nt = f.forwardRef(
771
+ (e, t) => {
772
+ const {
773
+ __scopeRovingFocusGroup: r,
774
+ focusable: a = !0,
775
+ active: n = !1,
776
+ tabStopId: i,
777
+ ...s
778
+ } = e, l = Hr(), g = i || l, c = qr(Ct, r), u = c.currentTabStopId === g, p = vt(r), { onFocusableItemAdd: b, onFocusableItemRemove: h } = c;
779
+ return f.useEffect(() => {
780
+ if (a)
781
+ return b(), () => h();
782
+ }, [a, b, h]), /* @__PURE__ */ o(
783
+ Re.ItemSlot,
784
+ {
785
+ scope: r,
786
+ id: g,
787
+ focusable: a,
788
+ active: n,
789
+ children: /* @__PURE__ */ o(
790
+ ne.span,
791
+ {
792
+ tabIndex: u ? 0 : -1,
793
+ "data-orientation": c.orientation,
794
+ ...s,
795
+ ref: t,
796
+ onMouseDown: K(e.onMouseDown, (m) => {
797
+ a ? c.onItemFocus(g) : m.preventDefault();
798
+ }),
799
+ onFocus: K(e.onFocus, () => c.onItemFocus(g)),
800
+ onKeyDown: K(e.onKeyDown, (m) => {
801
+ if (m.key === "Tab" && m.shiftKey) {
802
+ c.onItemShiftTab();
803
+ return;
804
+ }
805
+ if (m.target !== m.currentTarget) return;
806
+ const d = Jr(m, c.orientation, c.dir);
807
+ if (d !== void 0) {
808
+ if (m.metaKey || m.ctrlKey || m.altKey || m.shiftKey) return;
809
+ m.preventDefault();
810
+ let v = p().filter((N) => N.focusable).map((N) => N.ref.current);
811
+ if (d === "last") v.reverse();
812
+ else if (d === "prev" || d === "next") {
813
+ d === "prev" && v.reverse();
814
+ const N = v.indexOf(m.currentTarget);
815
+ v = c.loop ? eo(v, N + 1) : v.slice(N + 1);
816
+ }
817
+ setTimeout(() => wt(v));
818
+ }
819
+ })
820
+ }
821
+ )
822
+ }
823
+ );
824
+ }
825
+ );
826
+ Nt.displayName = Ct;
827
+ var Qr = {
828
+ ArrowLeft: "prev",
829
+ ArrowUp: "prev",
830
+ ArrowRight: "next",
831
+ ArrowDown: "next",
832
+ PageUp: "first",
833
+ Home: "first",
834
+ PageDown: "last",
835
+ End: "last"
836
+ };
837
+ function Xr(e, t) {
838
+ return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
839
+ }
840
+ function Jr(e, t, r) {
841
+ const a = Xr(e.key, r);
842
+ if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(a)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(a)))
843
+ return Qr[a];
844
+ }
845
+ function wt(e, t = !1) {
846
+ const r = document.activeElement;
847
+ for (const a of e)
848
+ if (a === r || (a.focus({ preventScroll: t }), document.activeElement !== r)) return;
849
+ }
850
+ function eo(e, t) {
851
+ return e.map((r, a) => e[(t + a) % e.length]);
852
+ }
853
+ var to = kt, ro = Nt, oo = "Toggle", Tt = f.forwardRef((e, t) => {
854
+ const { pressed: r, defaultPressed: a = !1, onPressedChange: n, ...i } = e, [s = !1, l] = pe({
855
+ prop: r,
856
+ onChange: n,
857
+ defaultProp: a
858
+ });
859
+ return /* @__PURE__ */ o(
860
+ ne.button,
861
+ {
862
+ type: "button",
863
+ "aria-pressed": s,
864
+ "data-state": s ? "on" : "off",
865
+ "data-disabled": e.disabled ? "" : void 0,
866
+ ...i,
867
+ ref: t,
868
+ onClick: K(e.onClick, () => {
869
+ e.disabled || l(!s);
870
+ })
871
+ }
872
+ );
873
+ });
874
+ Tt.displayName = oo;
875
+ var Q = "ToggleGroup", [xt, ha] = Le(Q, [
876
+ yt
877
+ ]), Et = yt(), Oe = E.forwardRef((e, t) => {
878
+ const { type: r, ...a } = e;
879
+ if (r === "single")
880
+ return /* @__PURE__ */ o(ao, { ...a, ref: t });
881
+ if (r === "multiple")
882
+ return /* @__PURE__ */ o(no, { ...a, ref: t });
883
+ throw new Error(`Missing prop \`type\` expected on \`${Q}\``);
884
+ });
885
+ Oe.displayName = Q;
886
+ var [It, St] = xt(Q), ao = E.forwardRef((e, t) => {
887
+ const {
888
+ value: r,
889
+ defaultValue: a,
890
+ onValueChange: n = () => {
891
+ },
892
+ ...i
893
+ } = e, [s, l] = pe({
894
+ prop: r,
895
+ defaultProp: a,
896
+ onChange: n
897
+ });
898
+ return /* @__PURE__ */ o(
899
+ It,
900
+ {
901
+ scope: e.__scopeToggleGroup,
902
+ type: "single",
903
+ value: s ? [s] : [],
904
+ onItemActivate: l,
905
+ onItemDeactivate: E.useCallback(() => l(""), [l]),
906
+ children: /* @__PURE__ */ o(_t, { ...i, ref: t })
907
+ }
908
+ );
909
+ }), no = E.forwardRef((e, t) => {
910
+ const {
911
+ value: r,
912
+ defaultValue: a,
913
+ onValueChange: n = () => {
914
+ },
915
+ ...i
916
+ } = e, [s = [], l] = pe({
917
+ prop: r,
918
+ defaultProp: a,
919
+ onChange: n
920
+ }), g = E.useCallback(
921
+ (u) => l((p = []) => [...p, u]),
922
+ [l]
923
+ ), c = E.useCallback(
924
+ (u) => l((p = []) => p.filter((b) => b !== u)),
925
+ [l]
926
+ );
927
+ return /* @__PURE__ */ o(
928
+ It,
929
+ {
930
+ scope: e.__scopeToggleGroup,
931
+ type: "multiple",
932
+ value: s,
933
+ onItemActivate: g,
934
+ onItemDeactivate: c,
935
+ children: /* @__PURE__ */ o(_t, { ...i, ref: t })
936
+ }
937
+ );
938
+ });
939
+ Oe.displayName = Q;
940
+ var [so, io] = xt(Q), _t = E.forwardRef(
941
+ (e, t) => {
942
+ const {
943
+ __scopeToggleGroup: r,
944
+ disabled: a = !1,
945
+ rovingFocus: n = !0,
946
+ orientation: i,
947
+ dir: s,
948
+ loop: l = !0,
949
+ ...g
950
+ } = e, c = Et(r), u = bt(s), p = { role: "group", dir: u, ...g };
951
+ return /* @__PURE__ */ o(so, { scope: r, rovingFocus: n, disabled: a, children: n ? /* @__PURE__ */ o(
952
+ to,
953
+ {
954
+ asChild: !0,
955
+ ...c,
956
+ orientation: i,
957
+ dir: u,
958
+ loop: l,
959
+ children: /* @__PURE__ */ o(ne.div, { ...p, ref: t })
960
+ }
961
+ ) : /* @__PURE__ */ o(ne.div, { ...p, ref: t }) });
962
+ }
963
+ ), fe = "ToggleGroupItem", Rt = E.forwardRef(
964
+ (e, t) => {
965
+ const r = St(fe, e.__scopeToggleGroup), a = io(fe, e.__scopeToggleGroup), n = Et(e.__scopeToggleGroup), i = r.value.includes(e.value), s = a.disabled || e.disabled, l = { ...e, pressed: i, disabled: s }, g = E.useRef(null);
966
+ return a.rovingFocus ? /* @__PURE__ */ o(
967
+ ro,
968
+ {
969
+ asChild: !0,
970
+ ...n,
971
+ focusable: !s,
972
+ active: i,
973
+ ref: g,
974
+ children: /* @__PURE__ */ o(Ke, { ...l, ref: t })
975
+ }
976
+ ) : /* @__PURE__ */ o(Ke, { ...l, ref: t });
977
+ }
978
+ );
979
+ Rt.displayName = fe;
980
+ var Ke = E.forwardRef(
981
+ (e, t) => {
982
+ const { __scopeToggleGroup: r, value: a, ...n } = e, i = St(fe, r), s = { role: "radio", "aria-checked": e.pressed, "aria-pressed": void 0 }, l = i.type === "single" ? s : void 0;
983
+ return /* @__PURE__ */ o(
984
+ Tt,
985
+ {
986
+ ...l,
987
+ ...n,
988
+ ref: t,
989
+ onPressedChange: (g) => {
990
+ g ? i.onItemActivate(a) : i.onItemDeactivate(a);
991
+ }
992
+ }
993
+ );
994
+ }
995
+ ), lo = Oe, co = Rt;
996
+ const At = E.createContext({
997
+ size: "medium",
998
+ focusMode: "system",
999
+ mode: "system"
1000
+ }), uo = ({ focusMode: e }) => k("focus:outline", "focus:outline-2", "focus:outline-offset", {
1001
+ "focus:outline-focus-light": e === "light",
1002
+ "focus:outline-focus-dark": e === "dark",
1003
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
1004
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
1005
+ }), mo = ({ mode: e }) => k({
1006
+ "data-[state=on]:bg-surface-medium": e === "dark",
1007
+ "data-[state=on]:bg-surface-lightest": e === "light",
1008
+ "data-[state=on]:bg-surface-lightest dark:data-[state=on]:bg-surface-medium": e === "system",
1009
+ "data-[state=on]:bg-surface-medium dark:data-[state=on]:bg-surface-lightest": e === "alt-system"
1010
+ }), ho = ({ size: e }) => k({
1011
+ "h-5 px-2": e === "small",
1012
+ "h-6 px-3": e === "medium",
1013
+ "h-7 px-4": e === "large"
1014
+ }), go = ({ mode: e }) => k(
1015
+ Rr,
1016
+ "px-1",
1017
+ "relative",
1018
+ "border-r",
1019
+ "last:border-transparent",
1020
+ "has-[button[aria-checked='true']]:border-transparent",
1021
+ "has-[+_*_button[aria-checked='false']]:border-border-medium",
1022
+ {
1023
+ "border-surface-light": e === "light",
1024
+ "border-surface-darker": e === "dark",
1025
+ "border-surface-light dark:border-surface-darker": e === "system",
1026
+ "border-surface-darker dark:border-surface-light": e === "alt-system"
1027
+ }
1028
+ ), fo = ({
1029
+ focusMode: e,
1030
+ mode: t,
1031
+ size: r
1032
+ }) => ({
1033
+ wrapperClass: go({ mode: t }),
1034
+ itemClass: k(
1035
+ Ar,
1036
+ "flex items-center justify-center bg-transparent",
1037
+ "rounded-sm",
1038
+ "transition duration-200 ease",
1039
+ ho({ size: r }),
1040
+ uo({ focusMode: e }),
1041
+ mo({ mode: t })
1042
+ )
1043
+ }), po = ({
1044
+ mode: e,
1045
+ className: t
1046
+ }) => k(
1047
+ _r,
1048
+ "inline-flex p-1",
1049
+ "rounded-sm",
1050
+ {
1051
+ "bg-surface-light text-copy-dark": e === "light",
1052
+ "bg-surface-darker text-copy-lighter": e === "dark",
1053
+ "bg-surface-light text-copy-dark dark:bg-surface-darker dark:text-copy-lighter": e === "system",
1054
+ "bg-surface-darker text-copy-lighter dark:bg-surface-light dark:text-copy-dark": e === "alt-system"
1055
+ },
1056
+ t
1057
+ ), bo = ({
1058
+ children: e,
1059
+ value: t,
1060
+ onValueChange: r,
1061
+ disabled: a,
1062
+ mode: n = "system",
1063
+ focusMode: i = "system",
1064
+ size: s = "medium",
1065
+ defaultValue: l,
1066
+ className: g,
1067
+ ...c
1068
+ }) => {
1069
+ const u = po({ mode: n, className: g }), p = { size: s, focusMode: i, mode: n };
1070
+ return /* @__PURE__ */ o(At.Provider, { value: p, children: /* @__PURE__ */ o(
1071
+ lo,
1072
+ {
1073
+ disabled: a,
1074
+ className: u,
1075
+ value: t,
1076
+ defaultValue: l,
1077
+ onValueChange: r,
1078
+ ...c,
1079
+ type: "single",
1080
+ children: e
1081
+ }
1082
+ ) });
1083
+ }, vo = ({ value: e, disabled: t }) => {
1084
+ const { size: r, focusMode: a, mode: n } = O(At), { itemClass: i, wrapperClass: s } = fo({
1085
+ focusMode: a,
1086
+ mode: n,
1087
+ size: r
1088
+ });
1089
+ return /* @__PURE__ */ o("div", { className: s, children: /* @__PURE__ */ o(
1090
+ co,
1091
+ {
1092
+ disabled: t,
1093
+ className: i,
1094
+ value: e,
1095
+ children: e
1096
+ }
1097
+ ) });
1098
+ };
1099
+ /*!
1100
+ @versini/ui-panel v1.2.5
1101
+ © 2024 gizmette.com
1102
+ */
1103
+ try {
1104
+ window.__VERSINI_UI_PANEL__ || (window.__VERSINI_UI_PANEL__ = {
1105
+ version: "1.2.5",
1106
+ buildTime: "12/29/2024 04:16 PM EST",
1107
+ homepage: "https://github.com/aversini/ui-components",
1108
+ license: "MIT"
1109
+ });
1110
+ } catch {
1111
+ }
1112
+ const We = "av-messagebox", Ye = "av-panel", qe = "av-button", Be = "icon", yo = "button", ko = "link", Co = ({
1113
+ type: e,
1114
+ size: t,
1115
+ labelRight: r,
1116
+ labelLeft: a,
1117
+ align: n
1118
+ }) => {
1119
+ const i = "text-sm font-medium max-h-8 py-0", s = "text-base font-medium max-h-9 py-1", l = "text-lg font-medium max-h-12 py-2";
1120
+ switch (e) {
1121
+ case yo:
1122
+ return k("px-4", {
1123
+ [i]: t === "small",
1124
+ [s]: t === "medium",
1125
+ [l]: t === "large"
1126
+ });
1127
+ case ko:
1128
+ return k("px-4 text-center", {
1129
+ [i]: t === "small",
1130
+ [s]: t === "medium",
1131
+ [l]: t === "large"
1132
+ });
1133
+ case Be:
1134
+ return k("inline-flex items-center", {
1135
+ "justify-center": n === "center",
1136
+ "justify-start": n === "left",
1137
+ "justify-end": n === "right",
1138
+ "h-6 w-6 p-0": t === "small" && !(r || a),
1139
+ "h-6 px-4 text-sm font-medium": t === "small" && (r || a),
1140
+ "h-8 w-8 p-1": t === "medium" && !(r || a),
1141
+ "h-8 px-4 text-base font-medium": t === "medium" && (r || a),
1142
+ "h-12 w-12 p-2": t === "large" && !(r || a),
1143
+ "h-12 px-4 text-lg font-medium": t === "large" && (r || a)
1144
+ });
1145
+ }
1146
+ }, No = ({
1147
+ mode: e,
1148
+ noBackground: t,
1149
+ noTruncate: r,
1150
+ variant: a,
1151
+ radius: n
1152
+ }) => {
1153
+ if (t)
1154
+ return k("not-prose", {
1155
+ "rounded-full": n === "large",
1156
+ "rounded-md": n === "medium",
1157
+ "rounded-sm": n === "small"
1158
+ });
1159
+ if (a === "primary")
1160
+ return k("not-prose", {
1161
+ "rounded-full": n === "large",
1162
+ "rounded-md": n === "medium",
1163
+ "rounded-sm": n === "small",
1164
+ truncate: !r,
1165
+ "bg-action-dark text-copy-light": e === "dark",
1166
+ "bg-action-light text-copy-lighter": e === "light",
1167
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
1168
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "alt-system"
1169
+ });
1170
+ if (a === "secondary")
1171
+ return k("not-prose", {
1172
+ "rounded-full": n === "large",
1173
+ "rounded-md": n === "medium",
1174
+ "rounded-sm": n === "small",
1175
+ truncate: !r,
1176
+ "bg-action-dark text-copy-light": e === "light",
1177
+ "bg-action-light text-copy-lighter": e === "dark",
1178
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
1179
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "system"
1180
+ });
1181
+ if (a === "danger")
1182
+ return k("not-prose", {
1183
+ "rounded-full": n === "large",
1184
+ "rounded-md": n === "medium",
1185
+ "rounded-sm": n === "small",
1186
+ truncate: !r,
1187
+ "bg-action-danger-dark text-copy-light": e === "dark",
1188
+ "bg-action-danger-light text-copy-lighter": e === "light",
1189
+ "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
1190
+ "bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
1191
+ });
1192
+ if (a === "selected")
1193
+ return k("not-prose", {
1194
+ "rounded-full": n === "large",
1195
+ "rounded-md": n === "medium",
1196
+ "rounded-sm": n === "small",
1197
+ truncate: !r,
1198
+ "bg-action-selected-dark text-copy-light": e === "dark",
1199
+ "bg-action-selected-light text-copy-lighter": e === "light",
1200
+ "bg-action-selected-dark text-copy-light dark:bg-action-selected-light dark:text-copy-lighter": e === "system",
1201
+ "bg-action-selected-light text-copy-lighter dark:bg-action-selected-dark dark:text-copy-light": e === "alt-system"
1202
+ });
1203
+ }, wo = ({
1204
+ mode: e,
1205
+ disabled: t,
1206
+ variant: r
1207
+ }) => {
1208
+ if (t)
1209
+ return "";
1210
+ if (r === "primary")
1211
+ return k("hover:text-copy-light-hover", {
1212
+ "hover:bg-action-dark-hover": e === "dark",
1213
+ "hover:bg-action-light-hover": e === "light",
1214
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
1215
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
1216
+ });
1217
+ if (r === "secondary")
1218
+ return k("hover:text-copy-light-hover", {
1219
+ "hover:bg-action-dark-hover": e === "light",
1220
+ "hover:bg-action-light-hover": e === "dark",
1221
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
1222
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
1223
+ });
1224
+ if (r === "danger")
1225
+ return k("hover:text-copy-light-hover", {
1226
+ "hover:bg-action-danger-dark-hover": e === "dark",
1227
+ "hover:bg-action-danger-light-hover": e === "light",
1228
+ "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
1229
+ "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
1230
+ });
1231
+ if (r === "selected")
1232
+ return k("hover:text-copy-light-hover", {
1233
+ "hover:bg-action-selected-dark-hover": e === "dark",
1234
+ "hover:bg-action-selected-light-hover": e === "light",
1235
+ "hover:bg-action-selected-dark-hover dark:hover:bg-action-selected-light-hover": e === "system",
1236
+ "hover:bg-action-selected-light-hover dark:hover:bg-action-selected-dark-hover": e === "alt-system"
1237
+ });
1238
+ }, To = ({
1239
+ mode: e,
1240
+ disabled: t,
1241
+ variant: r
1242
+ }) => {
1243
+ if (t)
1244
+ return "";
1245
+ if (r === "primary")
1246
+ return k("active:text-copy-light-active", {
1247
+ "active:bg-action-dark-active": e === "dark",
1248
+ "active:bg-action-light-active": e === "light",
1249
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
1250
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
1251
+ });
1252
+ if (r === "secondary")
1253
+ return k("active:text-copy-light-active", {
1254
+ "active:bg-action-dark-active": e === "light",
1255
+ "active:bg-action-light-active": e === "dark",
1256
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
1257
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
1258
+ });
1259
+ if (r === "danger")
1260
+ return k("active:text-copy-lighter-active", {
1261
+ "active:bg-action-danger-dark-active": e === "dark",
1262
+ "active:bg-action-danger-light-active": e === "light",
1263
+ "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
1264
+ "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
1265
+ });
1266
+ if (r === "selected")
1267
+ return k("active:text-copy-lighter-active", {
1268
+ "active:bg-action-selected-dark-active": e === "dark",
1269
+ "active:bg-action-selected-light-active": e === "light",
1270
+ "active:bg-action-selected-dark-active dark:active:bg-action-selected-light-active": e === "system",
1271
+ "active:bg-action-selected-light-active dark:active:bg-action-selected-dark-active": e === "alt-system"
1272
+ });
1273
+ }, xo = ({
1274
+ mode: e,
1275
+ noBorder: t,
1276
+ variant: r
1277
+ }) => {
1278
+ if (t)
1279
+ return "border border-transparent";
1280
+ if (r === "primary")
1281
+ return k("border", {
1282
+ "border-border-dark": e === "dark",
1283
+ "border-border-accent": e === "light",
1284
+ "border-border-dark dark:border-border-accent": e === "system",
1285
+ "border-border-accent dark:border-border-dark": e === "alt-system"
1286
+ });
1287
+ if (r === "secondary")
1288
+ return k("border", {
1289
+ "border-border-dark": e === "light",
1290
+ "border-border-accent": e === "dark",
1291
+ "border-border-dark dark:border-border-accent": e === "alt-system",
1292
+ "border-border-accent dark:border-border-dark": e === "system"
1293
+ });
1294
+ if (r === "danger")
1295
+ return k("border", {
1296
+ "border-border-danger-dark": e === "dark",
1297
+ "border-border-danger-medium": e === "light",
1298
+ "border-border-danger-dark dark:border-border-danger-medium": e === "system",
1299
+ "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
1300
+ });
1301
+ if (r === "selected")
1302
+ return k("border", {
1303
+ "border-border-selected-dark": e === "dark",
1304
+ "border-border-selected-medium": e === "light",
1305
+ "border-border-selected-dark dark:border-border-selected-medium": e === "system",
1306
+ "border-border-selected-medium dark:border-border-selected-dark": e === "alt-system"
1307
+ });
1308
+ }, Eo = ({
1309
+ focusMode: e
1310
+ }) => k("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
1311
+ "focus:outline-focus-dark": e === "dark",
1312
+ "focus:outline-focus-light": e === "light",
1313
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
1314
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
1315
+ }), Mt = ({
1316
+ type: e,
1317
+ className: t,
1318
+ raw: r,
1319
+ mode: a,
1320
+ focusMode: n,
1321
+ disabled: i,
1322
+ fullWidth: s,
1323
+ size: l,
1324
+ noBorder: g,
1325
+ labelRight: c,
1326
+ labelLeft: u,
1327
+ noBackground: p,
1328
+ variant: b,
1329
+ noTruncate: h,
1330
+ align: m,
1331
+ radius: d
1332
+ }) => (b || (b = "primary"), r ? k(qe, t) : k(
1333
+ qe,
1334
+ No({
1335
+ mode: a,
1336
+ variant: b,
1337
+ noBackground: p,
1338
+ noTruncate: h,
1339
+ radius: d
1340
+ }),
1341
+ Co({ type: e, size: l, labelRight: c, labelLeft: u, align: m }),
1342
+ xo({ mode: a, variant: b, noBorder: g }),
1343
+ Eo({ focusMode: n }),
1344
+ wo({ mode: a, variant: b, disabled: i }),
1345
+ To({ mode: a, variant: b, disabled: i }),
1346
+ {
1347
+ "w-full": s,
1348
+ "disabled:cursor-not-allowed disabled:opacity-50": i
1349
+ },
1350
+ t
1351
+ )), Io = (e, t, r) => {
1352
+ var a;
1353
+ !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((a = e == null ? void 0 : e.currentTarget) == null ? void 0 : a.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
1354
+ }, ze = E.forwardRef((e, t) => {
1355
+ const { onClick: r, noInternalClick: a = !1, ...n } = e;
1356
+ return /* @__PURE__ */ o(
1357
+ "button",
1358
+ {
1359
+ ref: t,
1360
+ onClick: (i) => {
1361
+ Io(i, a, r);
1362
+ },
1363
+ ...n
1364
+ }
1365
+ );
1366
+ });
1367
+ ze.displayName = "BaseButton";
1368
+ const Lt = E.forwardRef(
1369
+ ({
1370
+ children: e,
1371
+ disabled: t = !1,
1372
+ mode: r = "system",
1373
+ focusMode: a = "system",
1374
+ fullWidth: n = !1,
1375
+ className: i,
1376
+ type: s = "button",
1377
+ raw: l = !1,
1378
+ noBorder: g = !1,
1379
+ "aria-label": c,
1380
+ label: u,
1381
+ size: p = "medium",
1382
+ labelRight: b,
1383
+ labelLeft: h,
1384
+ noBackground: m = !1,
1385
+ align: d = "center",
1386
+ radius: v = "large",
1387
+ ...N
1388
+ }, C) => {
1389
+ const w = Mt({
1390
+ type: Be,
1391
+ mode: r,
1392
+ focusMode: a,
1393
+ fullWidth: n,
1394
+ disabled: t,
1395
+ raw: l,
1396
+ className: i,
1397
+ noBorder: g,
1398
+ size: p,
1399
+ labelRight: b,
1400
+ labelLeft: h,
1401
+ noBackground: m,
1402
+ align: d,
1403
+ radius: v
1404
+ }), S = k({
1405
+ "text-copy-accent-dark": r === "light" && !l,
1406
+ "text-copy-light": r === "dark" && !l,
1407
+ "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !l,
1408
+ "text-copy-light dark:text-copy-accent-dark": r === "system" && !l
1409
+ });
1410
+ return /* @__PURE__ */ y(
1411
+ ze,
1412
+ {
1413
+ ref: C,
1414
+ className: w,
1415
+ disabled: t,
1416
+ type: s,
1417
+ "aria-label": c || u,
1418
+ ...N,
1419
+ children: [
1420
+ h && /* @__PURE__ */ o("span", { className: "pr-2", children: h }),
1421
+ /* @__PURE__ */ o("div", { className: S, children: e }),
1422
+ b && /* @__PURE__ */ o("span", { className: "pl-2", children: b })
1423
+ ]
1424
+ }
1425
+ );
1426
+ }
1427
+ );
1428
+ Lt.displayName = "ButtonIcon";
1429
+ /*!
1430
+ @versini/ui-button v2.0.0
1431
+ © 2024 gizmette.com
1432
+ */
1433
+ try {
1434
+ window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
1435
+ version: "2.0.0",
1436
+ buildTime: "12/29/2024 04:16 PM EST",
1437
+ homepage: "https://github.com/aversini/ui-components",
1438
+ license: "MIT"
1439
+ });
1440
+ } catch {
1441
+ }
1442
+ const So = E.forwardRef(
1443
+ ({
1444
+ children: e,
1445
+ disabled: t = !1,
1446
+ mode: r = "system",
1447
+ focusMode: a = "system",
1448
+ fullWidth: n = !1,
1449
+ className: i,
1450
+ type: s = "button",
1451
+ raw: l = !1,
1452
+ noBorder: g = !1,
1453
+ "aria-label": c,
1454
+ label: u,
1455
+ size: p = "medium",
1456
+ labelRight: b,
1457
+ labelLeft: h,
1458
+ noBackground: m = !1,
1459
+ align: d = "center",
1460
+ active: v = !1,
1461
+ radius: N = "large",
1462
+ ...C
1463
+ }, w) => {
1464
+ const S = Mt({
1465
+ type: Be,
1466
+ mode: r,
1467
+ focusMode: a,
1468
+ fullWidth: n,
1469
+ disabled: t,
1470
+ raw: l,
1471
+ className: i,
1472
+ noBorder: g,
1473
+ size: p,
1474
+ labelRight: b,
1475
+ labelLeft: h,
1476
+ noBackground: m,
1477
+ align: d,
1478
+ radius: N
1479
+ }), A = k({
1480
+ "text-copy-accent-dark": r === "light" && !l,
1481
+ "text-copy-light": r === "dark" && !l,
1482
+ "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !l,
1483
+ "text-copy-light dark:text-copy-accent-dark": r === "system" && !l
1484
+ }), M = v ? k(
1485
+ "relative",
1486
+ "focus-within:static",
1487
+ "focus-within:after:border-transparent",
1488
+ "after:absolute",
1489
+ "after:content-['']",
1490
+ "after:border-b-2",
1491
+ "after:bottom-[-4px]",
1492
+ "after:left-0",
1493
+ "after:right-0",
1494
+ {
1495
+ "after:border-table-dark": r === "dark",
1496
+ "after:border-table-light": r === "light",
1497
+ "after:border-table-dark dark:after:border-table-light": r === "system",
1498
+ "after:border-table-light dark:after:border-table-dark": r === "alt-system"
1499
+ }
1500
+ ) : "";
1501
+ return /* @__PURE__ */ o("div", { className: M, children: /* @__PURE__ */ y(
1502
+ ze,
1503
+ {
1504
+ ref: w,
1505
+ className: S,
1506
+ disabled: t,
1507
+ type: s,
1508
+ "aria-label": c || u,
1509
+ ...C,
1510
+ children: [
1511
+ h && /* @__PURE__ */ o("span", { className: "pr-2", children: h }),
1512
+ /* @__PURE__ */ o("div", { className: A, children: e }),
1513
+ b && /* @__PURE__ */ o("span", { className: "pl-2", children: b })
1514
+ ]
1515
+ }
1516
+ ) });
1517
+ }
1518
+ );
1519
+ So.displayName = "ButtonSort";
1520
+ const _o = ({
1521
+ children: e,
1522
+ fill: t,
1523
+ viewBox: r,
1524
+ className: a,
1525
+ defaultViewBox: n,
1526
+ defaultClassName: i,
1527
+ title: s,
1528
+ semantic: l = !1,
1529
+ ...g
1530
+ }) => {
1531
+ const c = k(a || i);
1532
+ return /* @__PURE__ */ y(_, { children: [
1533
+ /* @__PURE__ */ o(
1534
+ "svg",
1535
+ {
1536
+ xmlns: "http://www.w3.org/2000/svg",
1537
+ className: c,
1538
+ viewBox: r || n,
1539
+ fill: t || "currentColor",
1540
+ role: "img",
1541
+ "aria-hidden": !l,
1542
+ focusable: !1,
1543
+ ...g,
1544
+ children: e
1545
+ }
1546
+ ),
1547
+ s && l && /* @__PURE__ */ o("span", { className: "sr-only", children: s })
1548
+ ] });
1549
+ };
1550
+ /*!
1551
+ @versini/ui-svgicon v2.0.0
1552
+ © 2024 gizmette.com
1553
+ */
1554
+ try {
1555
+ window.__VERSINI_UI_SVGICON__ || (window.__VERSINI_UI_SVGICON__ = {
1556
+ version: "2.0.0",
1557
+ buildTime: "12/29/2024 04:16 PM EST",
1558
+ homepage: "https://github.com/aversini/ui-components",
1559
+ license: "MIT"
1560
+ });
1561
+ } catch {
1562
+ }
1563
+ const Ro = ({
1564
+ className: e,
1565
+ viewBox: t,
1566
+ title: r,
1567
+ monotone: a,
1568
+ ...n
1569
+ }) => /* @__PURE__ */ o(
1570
+ _o,
1571
+ {
1572
+ defaultViewBox: "0 0 384 512",
1573
+ defaultClassName: "size-5",
1574
+ viewBox: t,
1575
+ className: e,
1576
+ title: r || "Close",
1577
+ ...n,
1578
+ children: /* @__PURE__ */ o("path", { d: "M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3l105.4 105.3c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256l105.3-105.4z" })
1579
+ }
1580
+ );
1581
+ /*!
1582
+ @versini/ui-icons v2.0.0
1583
+ © 2024 gizmette.com
1584
+ */
1585
+ try {
1586
+ window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
1587
+ version: "2.0.0",
1588
+ buildTime: "12/29/2024 04:16 PM EST",
1589
+ homepage: "https://github.com/aversini/ui-components",
1590
+ license: "MIT"
1591
+ });
1592
+ } catch {
1593
+ }
1594
+ const Pt = f.createContext(null);
1595
+ function Ao({
1596
+ initialOpen: e = !1,
1597
+ open: t,
1598
+ onOpenChange: r
1599
+ } = {}) {
1600
+ const [a, n] = f.useState(e), [i, s] = f.useState(), [l, g] = f.useState(), c = t ?? a, u = r ?? n, p = st({
1601
+ open: c,
1602
+ onOpenChange: u
1603
+ }), b = p.context, h = it(b, {
1604
+ enabled: t == null
1605
+ }), m = ct(b, {
1606
+ outsidePress: !1,
1607
+ outsidePressEvent: "mousedown"
1608
+ }), d = lt(b), v = dt([h, m, d]);
1609
+ return f.useMemo(
1610
+ () => ({
1611
+ open: c,
1612
+ setOpen: u,
1613
+ ...v,
1614
+ ...p,
1615
+ labelId: i,
1616
+ descriptionId: l,
1617
+ setLabelId: s,
1618
+ setDescriptionId: g
1619
+ }),
1620
+ [c, u, v, p, i, l]
1621
+ );
1622
+ }
1623
+ const ve = () => {
1624
+ const e = f.useContext(Pt);
1625
+ if (e == null)
1626
+ throw new Error("Modal components must be wrapped in <Modal />");
1627
+ return e;
1628
+ };
1629
+ function Mo({
1630
+ children: e,
1631
+ ...t
1632
+ }) {
1633
+ const r = Ao(t);
1634
+ return /* @__PURE__ */ o(Pt.Provider, { value: r, children: e });
1635
+ }
1636
+ const Lo = f.forwardRef(function(e, t) {
1637
+ const { context: r, ...a } = ve(), n = Me([a.refs.setFloating, t]);
1638
+ if (!r.open)
1639
+ return null;
1640
+ const { overlayBackground: i, ...s } = e, l = k("grid place-items-center", {
1641
+ [`${i}`]: i,
1642
+ "bg-black sm:bg-black/[.8]": !i
1643
+ });
1644
+ return /* @__PURE__ */ o(ut, { children: /* @__PURE__ */ o(yr, { className: l, lockScroll: !0, children: /* @__PURE__ */ o(mt, { context: r, children: /* @__PURE__ */ o(
1645
+ "div",
1646
+ {
1647
+ ref: n,
1648
+ "aria-labelledby": a.labelId,
1649
+ "aria-describedby": a.descriptionId,
1650
+ ...a.getFloatingProps(s),
1651
+ children: s.children
1652
+ }
1653
+ ) }) }) });
1654
+ }), Po = f.forwardRef(function({ children: e, ...t }, r) {
1655
+ const { setLabelId: a } = ve(), n = Ae();
1656
+ return f.useLayoutEffect(() => (a(n), () => a(void 0)), [n, a]), /* @__PURE__ */ o("h1", { ...t, ref: r, id: n, children: e });
1657
+ }), Oo = f.forwardRef(function({ children: e, ...t }, r) {
1658
+ const { setDescriptionId: a } = ve(), n = Ae();
1659
+ return f.useLayoutEffect(() => (a(n), () => a(void 0)), [n, a]), /* @__PURE__ */ o("div", { ...t, ref: r, id: n, children: e });
1660
+ }), Bo = f.forwardRef(function(e, t) {
1661
+ const { setOpen: r } = ve(), { trigger: a, className: n, ...i } = e, s = f.useCallback(() => r(!1), [r]);
1662
+ return /* @__PURE__ */ o("div", { className: n, children: f.cloneElement(a, {
1663
+ ref: t,
1664
+ onClick: s,
1665
+ ...i
1666
+ }) });
1667
+ });
1668
+ /*!
1669
+ @versini/ui-modal v1.1.2
1670
+ © 2024 gizmette.com
1671
+ */
1672
+ try {
1673
+ window.__VERSINI_UI_MODAL__ || (window.__VERSINI_UI_MODAL__ = {
1674
+ version: "1.1.2",
1675
+ buildTime: "12/29/2024 04:16 PM EST",
1676
+ homepage: "https://github.com/aversini/ui-components",
1677
+ license: "MIT"
1678
+ });
1679
+ } catch {
1680
+ }
1681
+ const ee = "panel", ue = "messagebox", zo = ({
1682
+ className: e,
1683
+ kind: t,
1684
+ borderMode: r
1685
+ }) => ({
1686
+ main: k("prose prose-lighter flex flex-col bg-surface-medium", {
1687
+ [`${Ye} max-h-full sm:max-h-[95%] min-h-full sm:min-h-[10rem] sm:rounded-lg sm:border-2`]: t === ee,
1688
+ [`${Ye} w-full sm:w-[95%] md:max-w-2xl`]: t === ee && !e,
1689
+ [`${We} rounded-lg border-2`]: t === ue,
1690
+ [`${We} w-[95%] sm:w-[50%] md:max-w-2xl`]: t === ue && !e,
1691
+ [`${e}`]: !!e,
1692
+ "sm:border-border-dark": r === "dark" && t === ee,
1693
+ "sm:border-border-accent": r === "light" && t === ee,
1694
+ "border-border-dark": r === "dark" && t === ue,
1695
+ "border-border-accent": r === "light" && t === ue
1696
+ }),
1697
+ content: "flex flex-col py-2 sm:py-4 sm:px-4 px-2 overflow-y-auto",
1698
+ footer: "flex flex-grow flex-col sm:p-4 p-2",
1699
+ header: "sm:p-4 mb-0 p-2",
1700
+ close: "sm:p-4 p-2"
1701
+ }), Y = ({
1702
+ open: e,
1703
+ onOpenChange: t,
1704
+ title: r,
1705
+ children: a,
1706
+ footer: n,
1707
+ borderMode: i = "light",
1708
+ kind: s = ee,
1709
+ className: l
1710
+ }) => {
1711
+ const g = Z(""), c = zo({ className: l, kind: s, borderMode: i });
1712
+ return H(() => (e && (g.current = document.title, document.title = `${r} | ${g.current}`), () => {
1713
+ e && (document.title = g.current);
1714
+ }), [r, e]), /* @__PURE__ */ o(_, { children: e && /* @__PURE__ */ o(Mo, { open: e, onOpenChange: t, children: /* @__PURE__ */ y(Lo, { className: c.main, children: [
1715
+ /* @__PURE__ */ y("div", { className: "flex flex-row-reverse items-center justify-between", children: [
1716
+ /* @__PURE__ */ o(
1717
+ Bo,
1718
+ {
1719
+ className: c.close,
1720
+ trigger: /* @__PURE__ */ o(
1721
+ Lt,
1722
+ {
1723
+ mode: "dark",
1724
+ focusMode: "light",
1725
+ noBorder: !0,
1726
+ label: "Close",
1727
+ children: /* @__PURE__ */ o(Ro, {})
1728
+ }
1729
+ )
1730
+ }
1731
+ ),
1732
+ /* @__PURE__ */ o(Po, { className: c.header, children: r })
1733
+ ] }),
1734
+ /* @__PURE__ */ o(Oo, { className: c.content, children: a }),
1735
+ n && /* @__PURE__ */ o("div", { className: c.footer, children: n })
1736
+ ] }) }) });
1737
+ }, Do = ({ stats: e }) => {
1738
+ const t = (e == null ? void 0 : e.plugins) || [], r = (e == null ? void 0 : e.version) || "", a = (e == null ? void 0 : e.models) || [], n = ae(), i = ae();
1739
+ return /* @__PURE__ */ y(_, { children: [
1740
+ /* @__PURE__ */ o("div", { className: "mb-4", children: /* @__PURE__ */ o(
1741
+ P,
1742
+ {
1743
+ header: T.ABOUT.TITLE_CLIENT,
1744
+ className: "prose-dark dark:prose-lighter",
1745
+ children: oe(n, {
1746
+ [T.ABOUT.VERSION]: "5.10.2",
1747
+ [T.ABOUT.BUILD_TIMESTAMP]: "12/29/2024 07:54 PM EST"
1748
+ })
1749
+ }
1750
+ ) }),
1751
+ /* @__PURE__ */ o(
1752
+ P,
1753
+ {
1754
+ header: T.ABOUT.TITLE_SERVER,
1755
+ className: "prose-dark dark:prose-lighter",
1756
+ children: oe(i, {
1757
+ [T.ABOUT.VERSION]: r,
1758
+ [he(T.ABOUT.ENGINE, a.length)]: /* @__PURE__ */ o(_, { children: a.map((s) => /* @__PURE__ */ o("div", { className: "text-right", children: s }, s)) }),
1759
+ [he(T.ABOUT.PLUGIN, t.length)]: /* @__PURE__ */ o(_, { children: t.map((s) => /* @__PURE__ */ o("div", { className: "text-right", children: s }, s)) })
1760
+ })
1761
+ }
1762
+ )
1763
+ ] });
1764
+ }, $o = ({
1765
+ open: e,
1766
+ onOpenChange: t
1767
+ }) => {
1768
+ const { serverStats: r } = O(se);
1769
+ return /* @__PURE__ */ o(Y, { open: e, onOpenChange: t, title: Dt, children: /* @__PURE__ */ o(Do, { stats: r }) });
1770
+ }, Vo = (e) => Qe(e), Fo = (e) => {
1771
+ if (!e || e.length === 0)
1772
+ return Vt;
1773
+ const t = e.filter(
1774
+ (r) => {
1775
+ var a, n;
1776
+ return ((a = r == null ? void 0 : r.message) == null ? void 0 : a.role) === Ft && typeof ((n = r == null ? void 0 : r.message) == null ? void 0 : n.processingTime) == "number";
1777
+ }
1778
+ ).map((r) => r.message.processingTime);
1779
+ return Ht({
1780
+ data: t,
1781
+ formatter: Vo
1782
+ });
1783
+ }, Ho = ({
1784
+ isAuthenticated: e,
1785
+ stats: t
1786
+ }) => {
1787
+ const { state: r } = O(se), a = Gt - Number(r == null ? void 0 : r.usage), n = ae(), i = ae();
1788
+ return e ? /* @__PURE__ */ y(_, { children: [
1789
+ r && r.messages.length > 0 && /* @__PURE__ */ o("div", { className: "mb-4", children: /* @__PURE__ */ o(
1790
+ P,
1791
+ {
1792
+ header: T.CURRENT_STATISTICS.TITLE,
1793
+ className: "prose-dark dark:prose-lighter",
1794
+ children: oe(n, {
1795
+ [T.CURRENT_STATISTICS.MODEL_NAME]: (r == null ? void 0 : r.model) || te,
1796
+ [T.CURRENT_STATISTICS.TOKENS_USED]: r == null ? void 0 : r.usage,
1797
+ [T.CURRENT_STATISTICS.REMAINING_TOKENS]: $t.format(a),
1798
+ [T.CURRENT_STATISTICS.PROCESSING_TIME]: Fo(r == null ? void 0 : r.messages)
1799
+ })
1800
+ }
1801
+ ) }),
1802
+ /* @__PURE__ */ o(
1803
+ P,
1804
+ {
1805
+ header: T.MAIN_STATISTICS.TITLE,
1806
+ className: "prose-dark dark:prose-lighter",
1807
+ children: oe(i, {
1808
+ [he(T.MAIN_STATISTICS.TOTAL, t.totalChats)]: t.totalChats,
1809
+ [T.MAIN_STATISTICS.PROCESSING_TIME]: Qe(
1810
+ t.averageProcessingTimes
1811
+ )
1812
+ })
1813
+ }
1814
+ )
1815
+ ] }) : null;
1816
+ }, Go = ({
1817
+ open: e,
1818
+ onOpenChange: t
1819
+ }) => {
1820
+ const [r, a] = I({
1821
+ averageProcessingTimes: 0,
1822
+ totalChats: 0
1823
+ }), { isAuthenticated: n, getAccessToken: i, user: s } = W();
1824
+ return H(() => {
1825
+ !e || !s || (async () => {
1826
+ try {
1827
+ const l = await D({
1828
+ accessToken: await i(),
1829
+ type: $.GET_CHATS_STATS,
1830
+ params: {
1831
+ userId: s.username
1832
+ }
1833
+ });
1834
+ l.status === 200 && a(l.data);
1835
+ } catch {
1836
+ }
1837
+ })();
1838
+ }, [e, i, s]), /* @__PURE__ */ o(Y, { open: e, onOpenChange: t, title: Xe, children: /* @__PURE__ */ o(Ho, { isAuthenticated: n, stats: r }) });
1839
+ }, Ot = ({
1840
+ showConfirmation: e,
1841
+ setShowConfirmation: t,
1842
+ action: r,
1843
+ children: a,
1844
+ customStrings: n
1845
+ }) => /* @__PURE__ */ o(
1846
+ Y,
1847
+ {
1848
+ kind: "messagebox",
1849
+ open: e,
1850
+ onOpenChange: t,
1851
+ title: n.title,
1852
+ footer: /* @__PURE__ */ y(q, { columnGap: 2, alignHorizontal: "flex-end", children: [
1853
+ /* @__PURE__ */ o(L, { children: /* @__PURE__ */ o(
1854
+ F,
1855
+ {
1856
+ mode: "dark",
1857
+ variant: "secondary",
1858
+ focusMode: "light",
1859
+ onClick: () => {
1860
+ t(!1);
1861
+ },
1862
+ children: n.cancelAction
1863
+ }
1864
+ ) }),
1865
+ /* @__PURE__ */ o(L, { children: /* @__PURE__ */ o(
1866
+ F,
1867
+ {
1868
+ mode: "dark",
1869
+ variant: "danger",
1870
+ focusMode: "light",
1871
+ onClick: () => {
1872
+ t(!1), r();
1873
+ },
1874
+ children: n.confirmAction
1875
+ }
1876
+ ) })
1877
+ ] }),
1878
+ children: a
1879
+ }
1880
+ ), Uo = async (e, t, r, a) => {
1881
+ try {
1882
+ const n = await D({
1883
+ accessToken: a,
1884
+ type: $.GET_CHAT,
1885
+ params: {
1886
+ id: e.id
1887
+ }
1888
+ });
1889
+ n.status === 200 && (t({
1890
+ type: et
1891
+ }), t({
1892
+ type: jt,
1893
+ payload: {
1894
+ id: e.id,
1895
+ model: n.data.model,
1896
+ usage: n.data.usage,
1897
+ messages: n.data.messages
1898
+ }
1899
+ }), r(!1));
1900
+ } catch {
1901
+ }
1902
+ }, jo = ({
1903
+ filteredHistory: e,
1904
+ setFilteredHistory: t,
1905
+ dispatch: r,
1906
+ onOpenChange: a
1907
+ }) => {
1908
+ var m;
1909
+ const { user: n, getAccessToken: i } = W(), s = Z({
1910
+ id: 0,
1911
+ timestamp: "",
1912
+ message: ""
1913
+ }), [l, g] = I(!1), { state: c, dispatch: u } = O(Je), [, p] = le({
1914
+ key: ie + Ut,
1915
+ initialValue: c.sortDirection
1916
+ }), b = (d) => {
1917
+ switch (c.sortDirection) {
1918
+ case U.ASC:
1919
+ p(U.DESC), u({
1920
+ type: $e,
1921
+ payload: {
1922
+ sortedCell: d,
1923
+ sortDirection: U.DESC
1924
+ }
1925
+ });
1926
+ break;
1927
+ default:
1928
+ p(U.ASC), u({
1929
+ type: $e,
1930
+ payload: {
1931
+ sortedCell: d,
1932
+ sortDirection: U.ASC
1933
+ }
1934
+ });
1935
+ break;
1936
+ }
1937
+ };
1938
+ return /* @__PURE__ */ y(_, { children: [
1939
+ /* @__PURE__ */ y(
1940
+ Ot,
1941
+ {
1942
+ showConfirmation: l,
1943
+ setShowConfirmation: g,
1944
+ action: async () => {
1945
+ const d = s.current;
1946
+ try {
1947
+ const v = await D({
1948
+ accessToken: await i(),
1949
+ type: $.DELETE_CHAT,
1950
+ params: {
1951
+ userId: (n == null ? void 0 : n.username) || "",
1952
+ id: d.id,
1953
+ limit: 1,
1954
+ searchString: c.searchString,
1955
+ direction: c.sortDirection,
1956
+ truncateSize: 100
1957
+ }
1958
+ });
1959
+ v.status === 200 && t({ data: v.data });
1960
+ } catch {
1961
+ }
1962
+ },
1963
+ customStrings: {
1964
+ confirmAction: "Delete",
1965
+ cancelAction: "Cancel",
1966
+ title: "Delete chat"
1967
+ },
1968
+ children: [
1969
+ /* @__PURE__ */ o("p", { className: "m-0", children: "Are you sure you want to delete the following chat:" }),
1970
+ /* @__PURE__ */ y("ul", { className: "m-0", children: [
1971
+ /* @__PURE__ */ y("li", { children: [
1972
+ "Timestamp:",
1973
+ " ",
1974
+ /* @__PURE__ */ o("span", { className: "text-lg", children: s.current && s.current.timestamp })
1975
+ ] }),
1976
+ /* @__PURE__ */ y("li", { children: [
1977
+ "First message:",
1978
+ " ",
1979
+ /* @__PURE__ */ o("span", { className: "text-lg", children: (m = s.current) == null ? void 0 : m.message })
1980
+ ] })
1981
+ ] })
1982
+ ]
1983
+ }
1984
+ ),
1985
+ /* @__PURE__ */ y(
1986
+ ar,
1987
+ {
1988
+ stickyHeader: !0,
1989
+ stickyFooter: !0,
1990
+ compact: !0,
1991
+ wrapperClassName: "max-h-[60vh] min-h-[60vh]",
1992
+ children: [
1993
+ /* @__PURE__ */ o(nr, { children: /* @__PURE__ */ y(we, { children: [
1994
+ /* @__PURE__ */ o(
1995
+ sr,
1996
+ {
1997
+ buttonClassName: "text-xs sm:text-sm",
1998
+ cellId: "timestamp",
1999
+ align: "left",
2000
+ sortDirection: c.sortDirection,
2001
+ sortedCell: c.sortedCell,
2002
+ onClick: () => {
2003
+ b("timestamp");
2004
+ },
2005
+ children: "Date"
2006
+ }
2007
+ ),
2008
+ /* @__PURE__ */ o(V, { className: "text-xs sm:text-sm", children: "First message" }),
2009
+ /* @__PURE__ */ o(V, { className: "text-xs sm:text-sm", children: "Model" }),
2010
+ /* @__PURE__ */ o(V, { className: "text-xs sm:text-sm text-right", children: "Actions" })
2011
+ ] }) }),
2012
+ /* @__PURE__ */ o(ir, { children: e.data.map((d, v) => {
2013
+ var N, C;
2014
+ return ((N = d == null ? void 0 : d.messages) == null ? void 0 : N.length) > 0 ? /* @__PURE__ */ y(we, { children: [
2015
+ /* @__PURE__ */ o(
2016
+ V,
2017
+ {
2018
+ component: "th",
2019
+ scope: "row",
2020
+ className: "text-gray-400 sm:whitespace-nowrap text-xs sm:text-sm max-w-20 sm:max-w-none",
2021
+ children: d.timestamp
2022
+ }
2023
+ ),
2024
+ /* @__PURE__ */ o(
2025
+ V,
2026
+ {
2027
+ className: "max-w-[100px] text-white sm:max-w-full text-xs sm:text-sm",
2028
+ style: {
2029
+ wordBreak: "break-word"
2030
+ },
2031
+ children: d.messages.length > 0 ? (C = d.messages[0]) == null ? void 0 : C.content : ""
2032
+ }
2033
+ ),
2034
+ /* @__PURE__ */ o(V, { component: "th", scope: "row", className: "text-gray-400", children: /* @__PURE__ */ y(q, { alignHorizontal: "center", children: [
2035
+ d.model && d.model.startsWith("claude") && /* @__PURE__ */ o(ht, { className: "size-4 sm:size-5" }),
2036
+ d.model && d.model.startsWith("gpt") && /* @__PURE__ */ o(gt, { className: "size-4 sm:size-5" })
2037
+ ] }) }),
2038
+ /* @__PURE__ */ o(V, { className: "px-2", children: /* @__PURE__ */ y("div", { className: "flex justify-end gap-2", children: [
2039
+ /* @__PURE__ */ o(
2040
+ j,
2041
+ {
2042
+ focusMode: "alt-system",
2043
+ noBorder: !0,
2044
+ label: "Restore chat",
2045
+ onClick: async () => {
2046
+ const w = await i();
2047
+ Uo(
2048
+ d,
2049
+ r,
2050
+ a,
2051
+ w
2052
+ );
2053
+ },
2054
+ children: /* @__PURE__ */ o(Er, { className: "h-3 w-3", monotone: !0 })
2055
+ }
2056
+ ),
2057
+ /* @__PURE__ */ o(
2058
+ j,
2059
+ {
2060
+ focusMode: "alt-system",
2061
+ noBorder: !0,
2062
+ label: "Delete chat",
2063
+ onClick: () => {
2064
+ var w;
2065
+ s.current = {
2066
+ id: d.id,
2067
+ timestamp: d.timestamp,
2068
+ message: d.messages.length > 0 ? (w = d.messages[0]) == null ? void 0 : w.content : ""
2069
+ }, g(!l);
2070
+ },
2071
+ children: /* @__PURE__ */ o("div", { className: "text-red-400", children: /* @__PURE__ */ o(Nr, { className: "h-3 w-3", monotone: !0 }) })
2072
+ }
2073
+ )
2074
+ ] }) })
2075
+ ] }, `${T.HISTORY.TITLE}-${d.id}-${v}`) : null;
2076
+ }) }),
2077
+ /* @__PURE__ */ o(lr, { children: /* @__PURE__ */ o(we, { children: /* @__PURE__ */ o(V, { colSpan: 4, children: /* @__PURE__ */ o("div", { children: he(
2078
+ `${e.data.length} chat`,
2079
+ e.data.length
2080
+ ) }) }) }) })
2081
+ ]
2082
+ }
2083
+ )
2084
+ ] });
2085
+ }, Ze = async ({
2086
+ searchString: e,
2087
+ username: t,
2088
+ accessToken: r,
2089
+ direction: a = U.ASC
2090
+ }) => {
2091
+ if (!t)
2092
+ return [];
2093
+ try {
2094
+ const n = await D({
2095
+ accessToken: r,
2096
+ type: $.GET_CHATS,
2097
+ params: {
2098
+ userId: t,
2099
+ searchString: e,
2100
+ limit: 1,
2101
+ direction: a,
2102
+ truncateSize: 100
2103
+ }
2104
+ });
2105
+ if (n.status === 200)
2106
+ return n.data;
2107
+ } catch {
2108
+ return [];
2109
+ }
2110
+ return [];
2111
+ }, Ko = ({ onOpenChange: e }) => {
2112
+ const { isAuthenticated: t, getAccessToken: r, user: a } = W(), n = Z(null), i = Z(!1), { dispatch: s } = O(se), { state: l, dispatch: g } = O(Je), [, c] = le({
2113
+ key: ie + Kt,
2114
+ initialValue: l.searchString
2115
+ }), [u, p] = I({
2116
+ data: [],
2117
+ sortedDirection: l.sortDirection
2118
+ }), b = async (d) => {
2119
+ const v = await r(), N = await Ze({
2120
+ searchString: d,
2121
+ username: a == null ? void 0 : a.username,
2122
+ accessToken: v,
2123
+ direction: l.sortDirection
2124
+ });
2125
+ p({
2126
+ data: N,
2127
+ sortedDirection: l.sortDirection
2128
+ }), c(d), g({
2129
+ type: Wt,
2130
+ payload: { searchString: d }
2131
+ });
2132
+ }, h = Yt((d) => {
2133
+ b(d.target.value);
2134
+ }, 500), m = async (d) => {
2135
+ d.preventDefault();
2136
+ };
2137
+ return H(() => {
2138
+ i.current || (async () => {
2139
+ i.current = !0;
2140
+ const d = await r(), v = await Ze({
2141
+ searchString: l.searchString,
2142
+ username: a == null ? void 0 : a.username,
2143
+ accessToken: d,
2144
+ direction: l.sortDirection
2145
+ });
2146
+ p({
2147
+ data: v,
2148
+ sortedDirection: l.sortDirection
2149
+ });
2150
+ })();
2151
+ }), H(() => {
2152
+ if (l.sortDirection !== u.sortedDirection) {
2153
+ const d = [...u.data].sort((v, N) => {
2154
+ if (l.sortedCell === "timestamp") {
2155
+ const C = new Date(v[l.sortedCell]).getTime(), w = new Date(N[l.sortedCell]).getTime();
2156
+ return l.sortDirection === U.ASC ? C - w : w - C;
2157
+ }
2158
+ return 0;
2159
+ });
2160
+ p({
2161
+ data: d,
2162
+ sortedDirection: l.sortDirection
2163
+ });
2164
+ }
2165
+ }, [u, l]), t ? u && u.data && /* @__PURE__ */ y(_, { children: [
2166
+ /* @__PURE__ */ o("form", { autoComplete: "off", onSubmit: m, children: /* @__PURE__ */ o(
2167
+ xe,
2168
+ {
2169
+ autoComplete: "off",
2170
+ autoCorrect: "off",
2171
+ ref: n,
2172
+ defaultValue: l.searchString,
2173
+ focusMode: "light",
2174
+ mode: "dark",
2175
+ name: "Search",
2176
+ label: "Search",
2177
+ onChange: h,
2178
+ className: "mt-2 mb-2",
2179
+ ...l.searchString && {
2180
+ rightElement: /* @__PURE__ */ o(
2181
+ F,
2182
+ {
2183
+ disabled: !l.searchString,
2184
+ mode: "light",
2185
+ focusMode: "light",
2186
+ noBorder: !0,
2187
+ size: "small",
2188
+ onClick: () => {
2189
+ var d;
2190
+ b(""), (d = n.current) != null && d.value && (n.current.value = "", n.current.focus());
2191
+ },
2192
+ children: "Reset"
2193
+ }
2194
+ )
2195
+ }
2196
+ }
2197
+ ) }),
2198
+ /* @__PURE__ */ o("div", { className: "flex flex-col gap-2 sm:flex-row", children: /* @__PURE__ */ o(
2199
+ jo,
2200
+ {
2201
+ filteredHistory: u,
2202
+ setFilteredHistory: p,
2203
+ dispatch: s,
2204
+ onOpenChange: e
2205
+ }
2206
+ ) })
2207
+ ] }) : null;
2208
+ }, Wo = ({
2209
+ open: e,
2210
+ onOpenChange: t
2211
+ }) => /* @__PURE__ */ o(Y, { open: e, onOpenChange: t, title: qt, children: /* @__PURE__ */ o(Ko, { onOpenChange: t }) });
2212
+ /*!
2213
+ @versini/ui-toggle v2.0.0
2214
+ © 2024 gizmette.com
2215
+ */
2216
+ try {
2217
+ window.__VERSINI_UI_TOGGLE__ || (window.__VERSINI_UI_TOGGLE__ = {
2218
+ version: "2.0.0",
2219
+ buildTime: "12/29/2024 04:16 PM EST",
2220
+ homepage: "https://github.com/aversini/ui-components",
2221
+ license: "MIT"
2222
+ });
2223
+ } catch {
2224
+ }
2225
+ const Yo = "av-toggle", qo = () => k("peer", "h-6", "w-11", "rounded-full"), Zo = ({
2226
+ focusMode: e
2227
+ }) => k(
2228
+ "peer-focus:outline",
2229
+ "peer-focus:outline-2",
2230
+ "peer-focus:outline-offset-2",
2231
+ {
2232
+ "peer-focus:outline-focus-dark": e === "dark",
2233
+ "peer-focus:outline-focus-light": e === "light",
2234
+ "peer-focus:outline-focus-light dark:peer-focus:outline-focus-dark": e === "alt-system",
2235
+ "peer-focus:outline-focus-dark dark:peer-focus:outline-focus-light": e === "system"
2236
+ }
2237
+ ), Qo = () => k(
2238
+ "peer-checked:after:translate-x-full",
2239
+ // background color when checked
2240
+ "peer-checked:bg-violet-500",
2241
+ // knob circle and border color when checked
2242
+ "peer-checked:after:bg-white",
2243
+ "peer-checked:after:border-white"
2244
+ ), Xo = () => k(
2245
+ "after:left-[2px]",
2246
+ "after:top-[2px]",
2247
+ "after:border",
2248
+ "after:border-surface-light dark:after:border-surface-medium",
2249
+ "after:bg-surface-light dark:after:bg-surface-medium",
2250
+ "after:absolute",
2251
+ "after:h-5",
2252
+ "after:w-5",
2253
+ "after:rounded-full",
2254
+ "after:transition-all",
2255
+ "after:content-['']"
2256
+ ), Jo = ({
2257
+ mode: e,
2258
+ noBorder: t
2259
+ }) => k({
2260
+ border: !t,
2261
+ "border-border-dark bg-surface-medium": e === "light",
2262
+ "border-border-light bg-surface-darker": e === "dark",
2263
+ "border-border-light bg-surface-darker dark:border-border-dark dark:bg-surface-medium": e === "alt-system",
2264
+ "border-border-dark bg-surface-medium dark:border-border-light dark:bg-surface-darker": e === "system"
2265
+ }), ea = ({
2266
+ mode: e,
2267
+ labelHidden: t
2268
+ }) => t ? "sr-only" : k("ml-2 text-sm", {
2269
+ "text-copy-dark": e === "light",
2270
+ "text-copy-lighter": e === "dark",
2271
+ "text-copy-lighter dark:text-copy-dark": e === "alt-system",
2272
+ "text-copy-dark dark:text-copy-lighter": e === "system"
2273
+ }), ta = ({ className: e }) => k(
2274
+ Yo,
2275
+ "relative flex cursor-pointer items-center",
2276
+ e
2277
+ ), ra = ({
2278
+ mode: e,
2279
+ focusMode: t,
2280
+ labelHidden: r,
2281
+ className: a,
2282
+ noBorder: n
2283
+ }) => ({
2284
+ toggle: k(
2285
+ qo(),
2286
+ Jo({ mode: e, noBorder: n }),
2287
+ Zo({ focusMode: t }),
2288
+ Xo(),
2289
+ Qo()
2290
+ ),
2291
+ label: ea({ mode: e, labelHidden: r }),
2292
+ input: "peer sr-only",
2293
+ wrapper: ta({ className: a })
2294
+ }), re = ({
2295
+ checked: e = !1,
2296
+ onChange: t,
2297
+ label: r,
2298
+ labelHidden: a = !1,
2299
+ name: n,
2300
+ mode: i = "system",
2301
+ focusMode: s = "system",
2302
+ className: l,
2303
+ noBorder: g = !1
2304
+ }) => {
2305
+ const c = ra({
2306
+ mode: i,
2307
+ focusMode: s,
2308
+ labelHidden: a,
2309
+ className: l,
2310
+ noBorder: g
2311
+ }), u = (p) => {
2312
+ t == null || t(p.target.checked);
2313
+ };
2314
+ return /* @__PURE__ */ y("label", { className: c.wrapper, children: [
2315
+ /* @__PURE__ */ o(
2316
+ "input",
2317
+ {
2318
+ name: n,
2319
+ checked: e,
2320
+ type: "checkbox",
2321
+ className: c.input,
2322
+ onChange: u
2323
+ }
2324
+ ),
2325
+ /* @__PURE__ */ o("div", { className: c.toggle }),
2326
+ /* @__PURE__ */ o("span", { className: c.label, children: r })
2327
+ ] });
2328
+ }, oa = ({
2329
+ open: e,
2330
+ onOpenChange: t
2331
+ }) => {
2332
+ const { dispatch: r } = O(se), { getAccessToken: a, user: n } = W(), [i, s] = I({
2333
+ loaded: !1,
2334
+ instructions: "",
2335
+ loadingLocation: !1,
2336
+ location: "",
2337
+ engine: te
2338
+ }), [l, g] = le({
2339
+ key: ie + tt,
2340
+ initialValue: !1
2341
+ }), c = async (h) => {
2342
+ h.preventDefault();
2343
+ try {
2344
+ await D({
2345
+ accessToken: await a(),
2346
+ type: $.SET_USER_PREFERENCES,
2347
+ params: {
2348
+ user: n == null ? void 0 : n.username,
2349
+ instructions: i.instructions,
2350
+ location: i.location,
2351
+ engine: i.engine
2352
+ }
2353
+ }), r({
2354
+ type: rt,
2355
+ payload: {
2356
+ engine: i.engine
2357
+ }
2358
+ });
2359
+ } catch {
2360
+ }
2361
+ }, u = async () => {
2362
+ s((h) => ({
2363
+ ...h,
2364
+ location: "...",
2365
+ loadingLocation: !0
2366
+ }));
2367
+ try {
2368
+ const h = Date.now(), m = await Qt(), d = await D({
2369
+ accessToken: await a(),
2370
+ type: $.GET_LOCATION,
2371
+ params: {
2372
+ latitude: m.latitude,
2373
+ longitude: m.longitude
2374
+ }
2375
+ }), N = Date.now() - h;
2376
+ if (N < 2e3 && await new Promise((C) => setTimeout(C, 2e3 - N)), d.status === 200) {
2377
+ const { city: C, state: w, country: S, displayName: A } = d.data, M = C && w && S ? `${C}, ${w}, ${S}` : A;
2378
+ s((R) => ({
2379
+ ...R,
2380
+ loaded: !0,
2381
+ location: M,
2382
+ loadingLocation: !1
2383
+ }));
2384
+ } else
2385
+ s((C) => ({
2386
+ ...C,
2387
+ loaded: !0,
2388
+ location: "",
2389
+ loadingLocation: !1
2390
+ }));
2391
+ } catch {
2392
+ }
2393
+ }, p = (h) => {
2394
+ s((m) => ({
2395
+ ...m,
2396
+ engine: h ? Ne : me
2397
+ }));
2398
+ }, b = (h) => {
2399
+ s((m) => ({
2400
+ ...m,
2401
+ engine: h ? me : Ne
2402
+ }));
2403
+ };
2404
+ return H(() => {
2405
+ if (!e || !n) {
2406
+ s({
2407
+ loaded: !1,
2408
+ loadingLocation: !1,
2409
+ instructions: "",
2410
+ location: "",
2411
+ engine: te
2412
+ });
2413
+ return;
2414
+ }
2415
+ (async () => {
2416
+ try {
2417
+ const h = await D({
2418
+ accessToken: await a(),
2419
+ type: $.GET_USER_PREFERENCES,
2420
+ params: {
2421
+ user: n.username
2422
+ }
2423
+ });
2424
+ h.status === 200 && s((m) => ({
2425
+ ...m,
2426
+ loaded: !0,
2427
+ instructions: h.data.instructions || "",
2428
+ location: h.data.location || "",
2429
+ engine: h.data.engine || te
2430
+ }));
2431
+ } catch {
2432
+ }
2433
+ })();
2434
+ }, [n, e]), /* @__PURE__ */ o(_, { children: i.loaded && /* @__PURE__ */ o(
2435
+ Y,
2436
+ {
2437
+ open: e,
2438
+ onOpenChange: t,
2439
+ title: "Engine Fine Tuning",
2440
+ footer: /* @__PURE__ */ y(
2441
+ q,
2442
+ {
2443
+ columnGap: 2,
2444
+ alignHorizontal: "flex-end",
2445
+ className: "pb-8 sm:pb-0",
2446
+ children: [
2447
+ /* @__PURE__ */ o(L, { children: /* @__PURE__ */ o(
2448
+ F,
2449
+ {
2450
+ mode: "dark",
2451
+ variant: "secondary",
2452
+ focusMode: "light",
2453
+ onClick: () => {
2454
+ t(!1);
2455
+ },
2456
+ children: "Cancel"
2457
+ }
2458
+ ) }),
2459
+ /* @__PURE__ */ o(L, { children: /* @__PURE__ */ o(
2460
+ F,
2461
+ {
2462
+ mode: "dark",
2463
+ variant: "danger",
2464
+ focusMode: "light",
2465
+ onClick: async (h) => {
2466
+ t(!1), await c(h);
2467
+ },
2468
+ children: "Save"
2469
+ }
2470
+ ) })
2471
+ ]
2472
+ }
2473
+ ),
2474
+ children: /* @__PURE__ */ y(_, { children: [
2475
+ /* @__PURE__ */ y(
2476
+ P,
2477
+ {
2478
+ header: "AI Engine",
2479
+ className: "prose-dark dark:prose-lighter",
2480
+ children: [
2481
+ /* @__PURE__ */ o("p", { children: "Select the AI engine that will be used to generate responses." }),
2482
+ /* @__PURE__ */ o(
2483
+ re,
2484
+ {
2485
+ noBorder: !0,
2486
+ label: "OpenAI",
2487
+ name: "OpenAI",
2488
+ onChange: p,
2489
+ checked: i.engine === Ne
2490
+ }
2491
+ ),
2492
+ /* @__PURE__ */ o(
2493
+ re,
2494
+ {
2495
+ className: "mt-2",
2496
+ noBorder: !0,
2497
+ label: "Anthropic",
2498
+ name: "Anthropic",
2499
+ onChange: b,
2500
+ checked: i.engine === me
2501
+ }
2502
+ ),
2503
+ /* @__PURE__ */ o("p", { className: "text-xs", children: "NOTE: Anthropic is currently in beta and may not be as accurate as OpenAI." }),
2504
+ /* @__PURE__ */ o(
2505
+ re,
2506
+ {
2507
+ className: "mt-2",
2508
+ noBorder: !0,
2509
+ label: "Show Quick Engine Toggle",
2510
+ name: "show-toggle-engine-menu",
2511
+ onChange: g,
2512
+ checked: l
2513
+ }
2514
+ ),
2515
+ /* @__PURE__ */ o("p", { className: "text-xs", children: "This option introduces a new menu on the left side of the screen, enabling you to quickly switch between engines." })
2516
+ ]
2517
+ }
2518
+ ),
2519
+ /* @__PURE__ */ y(
2520
+ P,
2521
+ {
2522
+ header: "Custom Instructions",
2523
+ className: "prose-dark dark:prose-lighter mt-4",
2524
+ children: [
2525
+ /* @__PURE__ */ y("p", { children: [
2526
+ "What would you like ",
2527
+ /* @__PURE__ */ o("em", { children: Zt }),
2528
+ " to know about you to provide better responses?"
2529
+ ] }),
2530
+ /* @__PURE__ */ o(
2531
+ He,
2532
+ {
2533
+ mode: "alt-system",
2534
+ autoCapitalize: "off",
2535
+ autoComplete: "off",
2536
+ autoCorrect: "off",
2537
+ name: "customInstructions",
2538
+ label: "Custom Instructions",
2539
+ value: i.instructions,
2540
+ onChange: (h) => {
2541
+ s((m) => ({
2542
+ ...m,
2543
+ loaded: !0,
2544
+ instructions: h.target.value
2545
+ }));
2546
+ },
2547
+ helperText: "Press ENTER to add a new line."
2548
+ }
2549
+ )
2550
+ ]
2551
+ }
2552
+ ),
2553
+ /* @__PURE__ */ y(
2554
+ P,
2555
+ {
2556
+ header: "Location",
2557
+ className: "prose-dark dark:prose-lighter mt-4",
2558
+ children: [
2559
+ /* @__PURE__ */ o("p", { children: "You can share your location to receive customized responses based on your area." }),
2560
+ /* @__PURE__ */ o(
2561
+ He,
2562
+ {
2563
+ mode: "alt-system",
2564
+ name: "location",
2565
+ label: "Location",
2566
+ value: i.location,
2567
+ onChange: (h) => {
2568
+ s((m) => ({
2569
+ ...m,
2570
+ loaded: !0,
2571
+ location: h.target.value
2572
+ }));
2573
+ },
2574
+ helperText: "Enter your location or press auto-detect."
2575
+ }
2576
+ ),
2577
+ /* @__PURE__ */ o(
2578
+ F,
2579
+ {
2580
+ className: "mt-2",
2581
+ size: "small",
2582
+ noBorder: !0,
2583
+ disabled: i.loadingLocation,
2584
+ onClick: u,
2585
+ children: i.loadingLocation ? "Detecting..." : "Auto-detect"
2586
+ }
2587
+ )
2588
+ ]
2589
+ }
2590
+ )
2591
+ ] })
2592
+ }
2593
+ ) });
2594
+ }, aa = ({
2595
+ open: e,
2596
+ onOpenChange: t
2597
+ }) => {
2598
+ const { state: r, dispatch: a } = O(Xt), { getAccessToken: n, user: i } = W(), [s, l] = I({
2599
+ tags: [...r.tags]
2600
+ }), g = ({
2601
+ slot: u,
2602
+ checked: p,
2603
+ label: b,
2604
+ content: h
2605
+ }) => {
2606
+ l((m) => {
2607
+ const d = m.tags, v = {
2608
+ slot: u,
2609
+ label: b,
2610
+ content: h,
2611
+ enabled: p
2612
+ }, N = d.findIndex((C) => C.slot === u);
2613
+ return N === -1 ? {
2614
+ ...m,
2615
+ tags: [...d, { ...v, slot: u }]
2616
+ } : (d[N] = v, {
2617
+ ...m,
2618
+ tags: [...d]
2619
+ });
2620
+ });
2621
+ }, c = async (u) => {
2622
+ u.preventDefault();
2623
+ try {
2624
+ await D({
2625
+ accessToken: await n(),
2626
+ type: $.SET_USER_PREFERENCES,
2627
+ params: {
2628
+ user: i == null ? void 0 : i.username,
2629
+ tags: s.tags
2630
+ }
2631
+ }), a({
2632
+ type: er,
2633
+ payload: {
2634
+ tags: s.tags
2635
+ }
2636
+ });
2637
+ } catch {
2638
+ }
2639
+ };
2640
+ return /* @__PURE__ */ y(
2641
+ Y,
2642
+ {
2643
+ open: e,
2644
+ onOpenChange: t,
2645
+ title: "Tags",
2646
+ footer: /* @__PURE__ */ y(
2647
+ q,
2648
+ {
2649
+ columnGap: 2,
2650
+ alignHorizontal: "flex-end",
2651
+ className: "pb-8 sm:pb-0",
2652
+ children: [
2653
+ /* @__PURE__ */ o(L, { children: /* @__PURE__ */ o(
2654
+ F,
2655
+ {
2656
+ mode: "dark",
2657
+ variant: "secondary",
2658
+ focusMode: "light",
2659
+ onClick: () => {
2660
+ t(!1);
2661
+ },
2662
+ children: "Cancel"
2663
+ }
2664
+ ) }),
2665
+ /* @__PURE__ */ o(L, { children: /* @__PURE__ */ o(
2666
+ F,
2667
+ {
2668
+ mode: "dark",
2669
+ variant: "danger",
2670
+ focusMode: "light",
2671
+ onClick: async (u) => {
2672
+ t(!1), await c(u);
2673
+ },
2674
+ children: "Save"
2675
+ }
2676
+ ) })
2677
+ ]
2678
+ }
2679
+ ),
2680
+ children: [
2681
+ /* @__PURE__ */ o("p", { children: Jt }),
2682
+ s.tags && s.tags.map((u) => /* @__PURE__ */ y(
2683
+ P,
2684
+ {
2685
+ header: `Tag ${u.slot + 1}`,
2686
+ className: "prose-dark dark:prose-lighter mb-2",
2687
+ children: [
2688
+ /* @__PURE__ */ y(q, { className: "mt-8 mb-6", columnGap: 2, rowGap: 6, children: [
2689
+ /* @__PURE__ */ o(L, { span: { fallback: 12, sm: 6 }, children: /* @__PURE__ */ o(
2690
+ xe,
2691
+ {
2692
+ label: "Label",
2693
+ name: `tag${u.slot}-label`,
2694
+ value: u.label,
2695
+ onChange: (p) => {
2696
+ g({
2697
+ slot: u.slot,
2698
+ checked: u.enabled,
2699
+ label: p.target.value,
2700
+ content: u.content
2701
+ });
2702
+ }
2703
+ }
2704
+ ) }),
2705
+ /* @__PURE__ */ o(L, { span: { fallback: 12, sm: 6 }, children: /* @__PURE__ */ o(
2706
+ xe,
2707
+ {
2708
+ label: "Content",
2709
+ name: `tag${u.slot}-content`,
2710
+ value: u.content,
2711
+ onChange: (p) => {
2712
+ g({
2713
+ slot: u.slot,
2714
+ checked: u.enabled,
2715
+ label: u.label,
2716
+ content: p.target.value
2717
+ });
2718
+ }
2719
+ }
2720
+ ) })
2721
+ ] }),
2722
+ /* @__PURE__ */ o(
2723
+ re,
2724
+ {
2725
+ className: "mt-2",
2726
+ noBorder: !0,
2727
+ label: "Enabled",
2728
+ name: u.slot.toString(),
2729
+ onChange: (p) => {
2730
+ g({
2731
+ slot: u.slot,
2732
+ checked: p,
2733
+ label: u.label,
2734
+ content: u.content
2735
+ });
2736
+ },
2737
+ checked: u.enabled
2738
+ }
2739
+ )
2740
+ ]
2741
+ },
2742
+ `tag-slot-${u.slot}`
2743
+ ))
2744
+ ]
2745
+ }
2746
+ );
2747
+ }, na = () => {
2748
+ const { isAuthenticated: e, user: t, registeringForPasskey: r, authenticationType: a } = W(), [n, i] = le({
2749
+ key: ie + tr,
2750
+ initialValue: !1
2751
+ }), [s, l] = I(!1), [g, c] = I(!1), u = ae(), p = (t == null ? void 0 : t.username) || "", b = (d) => {
2752
+ i(d);
2753
+ }, h = () => {
2754
+ l(!s);
2755
+ }, m = () => {
2756
+ c(!g);
2757
+ };
2758
+ return e && p ? /* @__PURE__ */ y(_, { children: [
2759
+ s && /* @__PURE__ */ o(
2760
+ oa,
2761
+ {
2762
+ open: s,
2763
+ onOpenChange: l
2764
+ }
2765
+ ),
2766
+ g && /* @__PURE__ */ o(aa, { open: g, onOpenChange: c }),
2767
+ /* @__PURE__ */ y(
2768
+ P,
2769
+ {
2770
+ header: T.PREFERENCES.TITLE,
2771
+ className: "prose-dark dark:prose-lighter",
2772
+ children: [
2773
+ oe(u, {
2774
+ [T.PREFERENCES.NAME]: p,
2775
+ [T.PREFERENCES.EMAIL]: (t == null ? void 0 : t.email) || "",
2776
+ [T.PREFERENCES.ENGINE_DETAILS]: /* @__PURE__ */ o(
2777
+ re,
2778
+ {
2779
+ noBorder: !0,
2780
+ labelHidden: !0,
2781
+ label: T.PREFERENCES.ENGINE_DETAILS,
2782
+ name: T.PREFERENCES.ENGINE_DETAILS,
2783
+ onChange: b,
2784
+ checked: n
2785
+ }
2786
+ )
2787
+ }),
2788
+ /* @__PURE__ */ o(
2789
+ j,
2790
+ {
2791
+ className: "mt-2",
2792
+ size: "small",
2793
+ onClick: h,
2794
+ labelLeft: "Engine Fine Tuning",
2795
+ children: /* @__PURE__ */ o(Ge, { className: "size-3", monotone: !0 })
2796
+ }
2797
+ ),
2798
+ /* @__PURE__ */ o(
2799
+ j,
2800
+ {
2801
+ className: "mt-2 ml-2",
2802
+ size: "small",
2803
+ onClick: m,
2804
+ labelLeft: "Tags",
2805
+ children: /* @__PURE__ */ o(Ge, { className: "size-3", monotone: !0 })
2806
+ }
2807
+ )
2808
+ ]
2809
+ }
2810
+ ),
2811
+ a !== rr.PASSKEY && /* @__PURE__ */ y(
2812
+ P,
2813
+ {
2814
+ className: "prose-dark dark:prose-lighter mt-4",
2815
+ header: /* @__PURE__ */ o("h2", { className: "m-0", children: /* @__PURE__ */ y(q, { columnGap: 3, alignVertical: "center", children: [
2816
+ /* @__PURE__ */ o(L, { children: /* @__PURE__ */ o(Ve, { className: "size-8" }) }),
2817
+ /* @__PURE__ */ o(L, { children: /* @__PURE__ */ o("div", { children: T.PREFERENCES.PASSKEY_TITLE }) })
2818
+ ] }) }),
2819
+ children: [
2820
+ /* @__PURE__ */ o("p", { children: T.PREFERENCES.PASSKEY_INSTRUCTIONS }),
2821
+ /* @__PURE__ */ o(
2822
+ j,
2823
+ {
2824
+ size: "small",
2825
+ className: "mt-2",
2826
+ onClick: r,
2827
+ labelLeft: T.PREFERENCES.PASSKEY_BUTTON,
2828
+ children: /* @__PURE__ */ o(Ve, { className: "size-5", monotone: !0 })
2829
+ }
2830
+ )
2831
+ ]
2832
+ }
2833
+ )
2834
+ ] }) : null;
2835
+ }, sa = ({
2836
+ open: e,
2837
+ onOpenChange: t
2838
+ }) => /* @__PURE__ */ o(Y, { open: e, onOpenChange: t, title: or, children: /* @__PURE__ */ o(na, {}) }), ga = () => {
2839
+ const { state: e, dispatch: t, serverStats: r } = O(se), [a, n] = I((e == null ? void 0 : e.engine) || te), [i, s] = I(!1), [l, g] = I(!1), [c, u] = I(!1), [p, b] = I(!1), [h, m] = I(!1), [d] = le({
2840
+ key: ie + tt,
2841
+ initialValue: !1
2842
+ }), { logout: v, getAccessToken: N, user: C } = W(), w = () => {
2843
+ s(!i);
2844
+ }, S = () => {
2845
+ g(!l);
2846
+ }, A = () => {
2847
+ u(!c);
2848
+ }, M = () => {
2849
+ b(!p);
2850
+ }, R = () => {
2851
+ m(!h);
2852
+ };
2853
+ return H(() => {
2854
+ e && e.engine && e.engine !== a && n(e.engine);
2855
+ }, [e, a]), /* @__PURE__ */ y(_, { children: [
2856
+ /* @__PURE__ */ o(
2857
+ Ot,
2858
+ {
2859
+ showConfirmation: h,
2860
+ setShowConfirmation: m,
2861
+ action: v,
2862
+ customStrings: {
2863
+ confirmAction: Fe,
2864
+ cancelAction: "Cancel",
2865
+ title: Fe
2866
+ },
2867
+ children: /* @__PURE__ */ o("p", { children: "Are you sure you want to log out?" })
2868
+ }
2869
+ ),
2870
+ /* @__PURE__ */ o(sa, { open: i, onOpenChange: s }),
2871
+ /* @__PURE__ */ o(Go, { open: l, onOpenChange: g }),
2872
+ /* @__PURE__ */ o(Wo, { open: c, onOpenChange: u }),
2873
+ /* @__PURE__ */ o($o, { open: p, onOpenChange: b }),
2874
+ /* @__PURE__ */ y("div", { className: "relative", children: [
2875
+ d && r && /* @__PURE__ */ o("div", { className: "absolute bottom-[-28px] left-[-7px]", children: /* @__PURE__ */ o(
2876
+ Ie,
2877
+ {
2878
+ mode: "dark",
2879
+ focusMode: "light",
2880
+ trigger: /* @__PURE__ */ o(j, { children: e && e.engine === me ? /* @__PURE__ */ o(ht, {}) : /* @__PURE__ */ o(gt, {}) }),
2881
+ defaultPlacement: "bottom-start",
2882
+ children: /* @__PURE__ */ o(G, { raw: !0, ignoreClick: !0, children: /* @__PURE__ */ o(
2883
+ bo,
2884
+ {
2885
+ size: "small",
2886
+ mode: "dark",
2887
+ focusMode: "light",
2888
+ value: a,
2889
+ onValueChange: async (x) => {
2890
+ if (x)
2891
+ try {
2892
+ await D({
2893
+ accessToken: await N(),
2894
+ type: $.SET_USER_PREFERENCES,
2895
+ params: {
2896
+ user: C == null ? void 0 : C.username,
2897
+ engine: x
2898
+ }
2899
+ }), t({
2900
+ type: rt,
2901
+ payload: {
2902
+ engine: x
2903
+ }
2904
+ }), t({
2905
+ type: et
2906
+ });
2907
+ } catch {
2908
+ }
2909
+ },
2910
+ children: r && r.engines.map((x) => /* @__PURE__ */ o(vo, { value: x }, x))
2911
+ }
2912
+ ) })
2913
+ }
2914
+ ) }),
2915
+ /* @__PURE__ */ o("div", { className: "absolute bottom-[-28px] right-[-7px]", children: /* @__PURE__ */ y(
2916
+ Ie,
2917
+ {
2918
+ mode: "dark",
2919
+ focusMode: "light",
2920
+ trigger: /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(Ir, {}) }),
2921
+ defaultPlacement: "bottom-end",
2922
+ children: [
2923
+ /* @__PURE__ */ o(
2924
+ G,
2925
+ {
2926
+ label: "Profile",
2927
+ onClick: w,
2928
+ icon: /* @__PURE__ */ o(xr, {})
2929
+ }
2930
+ ),
2931
+ /* @__PURE__ */ o(
2932
+ G,
2933
+ {
2934
+ label: Xe,
2935
+ onClick: S,
2936
+ icon: /* @__PURE__ */ o(Cr, {})
2937
+ }
2938
+ ),
2939
+ /* @__PURE__ */ o(
2940
+ G,
2941
+ {
2942
+ label: "History",
2943
+ onClick: A,
2944
+ icon: /* @__PURE__ */ o(wr, {})
2945
+ }
2946
+ ),
2947
+ /* @__PURE__ */ o(
2948
+ G,
2949
+ {
2950
+ label: "About",
2951
+ onClick: M,
2952
+ icon: /* @__PURE__ */ o(Tr, {})
2953
+ }
2954
+ ),
2955
+ e && e.id && !e.isComponent && /* @__PURE__ */ y(_, { children: [
2956
+ /* @__PURE__ */ o(Sr, {}),
2957
+ /* @__PURE__ */ o(
2958
+ G,
2959
+ {
2960
+ label: "Log out",
2961
+ onClick: R,
2962
+ icon: /* @__PURE__ */ o("div", { className: "text-red-700", children: /* @__PURE__ */ o(kr, { monotone: !0 }) })
2963
+ }
2964
+ )
2965
+ ] })
2966
+ ]
2967
+ }
2968
+ ) })
2969
+ ] })
2970
+ ] });
2971
+ };
2972
+ export {
2973
+ ga as default
2974
+ };