@versini/sassysaint 5.0.1 → 5.1.2

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.
@@ -1,1016 +0,0 @@
1
- import { jsxs as x, Fragment as ke, jsx as c } from "react/jsx-runtime";
2
- import i from "clsx";
3
- import H, { useContext as A, useRef as N, useState as z, useLayoutEffect as L, useEffect as ae, useSyncExternalStore as _e, useCallback as j } from "react";
4
- import { A as xe, i as we, f as Ne, S as Te, f$1 as ve, V as Se, j as Ce, F as Ie, r as Ee, o as He, n as se, l as Ae, a as J, MODEL_GPT4 as Oe } from "./index.CMDql_8l.js";
5
- const Be = (e) => {
6
- let r = "";
7
- if (typeof e == "number" || typeof e == "string")
8
- r = "m-" + e;
9
- else {
10
- const t = [];
11
- (e == null ? void 0 : e.t) !== void 0 && t.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && t.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && t.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && t.push(`ml-${e.l}`), r = t.join(" ");
12
- }
13
- return r;
14
- }, Q = ({
15
- children: e,
16
- fill: r,
17
- viewBox: t,
18
- className: a,
19
- defaultViewBox: s,
20
- defaultClassName: o,
21
- spacing: d,
22
- title: l,
23
- semantic: n = !1,
24
- ...m
25
- }) => {
26
- const u = Be(d), y = i(
27
- u,
28
- a || o
29
- );
30
- return /* @__PURE__ */ x(ke, { children: [
31
- /* @__PURE__ */ c(
32
- "svg",
33
- {
34
- xmlns: "http://www.w3.org/2000/svg",
35
- className: y,
36
- viewBox: t || s,
37
- fill: r || "currentColor",
38
- role: "img",
39
- "aria-hidden": !n,
40
- focusable: !1,
41
- ...m,
42
- children: e
43
- }
44
- ),
45
- l && n && /* @__PURE__ */ c("span", { className: "sr-only", children: l })
46
- ] });
47
- };
48
- /*!
49
- @versini/ui-private v1.4.8
50
- © 2024 gizmette.com
51
- */
52
- try {
53
- window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
54
- version: "1.4.8",
55
- buildTime: "09/09/2024 06:39 PM EDT",
56
- homepage: "https://github.com/aversini/ui-components",
57
- license: "MIT"
58
- });
59
- } catch {
60
- }
61
- /*!
62
- @versini/ui-icons v1.12.0
63
- © 2024 gizmette.com
64
- */
65
- try {
66
- window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
67
- version: "1.12.0",
68
- buildTime: "09/09/2024 06:39 PM EDT",
69
- homepage: "https://github.com/aversini/ui-components",
70
- license: "MIT"
71
- });
72
- } catch {
73
- }
74
- const Me = ({
75
- className: e,
76
- viewBox: r,
77
- spacing: t,
78
- title: a,
79
- monotone: s,
80
- ...o
81
- }) => /* @__PURE__ */ x(
82
- Q,
83
- {
84
- defaultViewBox: "0 0 576 512",
85
- defaultClassName: "size-5",
86
- viewBox: r,
87
- className: e,
88
- spacing: t,
89
- title: a || "Sort",
90
- ...o,
91
- children: [
92
- /* @__PURE__ */ c(
93
- "path",
94
- {
95
- opacity: s ? "1" : "0.4",
96
- d: "M393.4 41.4c12.5-12.5 32.8-12.5 45.3 0l96 96c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L448 141.3V448c0 17.7-14.3 32-32 32s-32-14.3-32-32V141.3l-41.4 41.4c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l96-96z"
97
- }
98
- ),
99
- /* @__PURE__ */ c("path", { d: "M137.4 470.6c12.5 12.5 32.8 12.5 45.3 0l96-96c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 370.7V64c0-17.7-14.3-32-32-32s-32 14.3-32 32V370.7L86.6 329.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l96 96z" })
100
- ]
101
- }
102
- ), $e = ({
103
- className: e,
104
- viewBox: r,
105
- spacing: t,
106
- title: a,
107
- monotone: s,
108
- ...o
109
- }) => /* @__PURE__ */ x(
110
- Q,
111
- {
112
- defaultViewBox: "0 0 576 512",
113
- defaultClassName: "size-5",
114
- viewBox: r,
115
- className: e,
116
- spacing: t,
117
- title: a || "Sort Down",
118
- ...o,
119
- children: [
120
- /* @__PURE__ */ c(
121
- "path",
122
- {
123
- opacity: s ? "1" : "0.4",
124
- d: "M288 448c0 17.7 14.3 32 32 32h32c17.7 0 32-14.3 32-32s-14.3-32-32-32H320c-17.7 0-32 14.3-32 32zm0-128c0 17.7 14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H320c-17.7 0-32 14.3-32 32zm0-128c0 17.7 14.3 32 32 32H480c17.7 0 32-14.3 32-32s-14.3-32-32-32H320c-17.7 0-32 14.3-32 32zm0-128c0 17.7 14.3 32 32 32H544c17.7 0 32-14.3 32-32s-14.3-32-32-32H320c-17.7 0-32 14.3-32 32z"
125
- }
126
- ),
127
- /* @__PURE__ */ c("path", { d: "M128 480c9 0 17.5-3.8 23.6-10.4l88-96c11.9-13 11.1-33.3-2-45.2s-33.3-11.1-45.2 2L160 365.7V64c0-17.7-14.3-32-32-32s-32 14.3-32 32V365.7L63.6 330.4c-11.9-13-32.2-13.9-45.2-2s-13.9 32.2-2 45.2l88 96C110.5 476.2 119 480 128 480z" })
128
- ]
129
- }
130
- ), Le = ({
131
- className: e,
132
- viewBox: r,
133
- spacing: t,
134
- title: a,
135
- monotone: s,
136
- ...o
137
- }) => /* @__PURE__ */ x(
138
- Q,
139
- {
140
- defaultViewBox: "0 0 576 512",
141
- defaultClassName: "size-5",
142
- viewBox: r,
143
- className: e,
144
- spacing: t,
145
- title: a || "Sort Up",
146
- ...o,
147
- children: [
148
- /* @__PURE__ */ c(
149
- "path",
150
- {
151
- opacity: s ? "1" : "0.4",
152
- d: "M288 64c0-17.7 14.3-32 32-32h32c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32zm0 128c0-17.7 14.3-32 32-32h96c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32zm0 128c0-17.7 14.3-32 32-32H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32zm0 128c0-17.7 14.3-32 32-32H544c17.7 0 32 14.3 32 32s-14.3 32-32 32H320c-17.7 0-32-14.3-32-32z"
153
- }
154
- ),
155
- /* @__PURE__ */ c("path", { d: "M128 32c9 0 17.5 3.8 23.6 10.4l88 96c11.9 13 11.1 33.3-2 45.2s-33.3 11.1-45.2-2L160 146.3V448c0 17.7-14.3 32-32 32s-32-14.3-32-32V146.3L63.6 181.6c-11.9 13-32.2 13.9-45.2 2s-13.9-32.2-2-45.2l88-96C110.5 35.8 119 32 128 32z" })
156
- ]
157
- }
158
- ), oe = H.forwardRef(
159
- ({
160
- children: e,
161
- disabled: r = !1,
162
- mode: t = "system",
163
- focusMode: a = "system",
164
- fullWidth: s = !1,
165
- className: o,
166
- type: d = "button",
167
- raw: l = !1,
168
- noBorder: n = !1,
169
- "aria-label": m,
170
- label: u,
171
- size: y = "medium",
172
- labelRight: p,
173
- labelLeft: _,
174
- spacing: g,
175
- noBackground: S = !1,
176
- align: C = "center",
177
- active: O = !1,
178
- ...B
179
- }, M) => {
180
- const U = xe({
181
- type: Ne,
182
- mode: t,
183
- focusMode: a,
184
- fullWidth: s,
185
- disabled: r,
186
- raw: l,
187
- className: o,
188
- noBorder: n,
189
- size: y,
190
- labelRight: p,
191
- labelLeft: _,
192
- spacing: g,
193
- noBackground: S,
194
- align: C
195
- }), G = i({
196
- "text-copy-accent-dark": t === "light" && !l,
197
- "text-copy-light": t === "dark" && !l,
198
- "text-copy-accent-dark dark:text-copy-light": t === "alt-system" && !l,
199
- "text-copy-light dark:text-copy-accent-dark": t === "system" && !l
200
- }), D = O ? i(
201
- "relative",
202
- "focus-within:static",
203
- "focus-within:after:border-transparent",
204
- "after:absolute",
205
- "after:content-['']",
206
- "after:border-b-2",
207
- "after:bottom-[-4px]",
208
- "after:left-0",
209
- "after:right-0",
210
- {
211
- "after:border-table-dark": t === "dark",
212
- "after:border-table-light": t === "light",
213
- "after:border-table-dark dark:after:border-table-light": t === "system",
214
- "after:border-table-light dark:after:border-table-dark": t === "alt-system"
215
- }
216
- ) : "";
217
- return /* @__PURE__ */ c("div", { className: D, children: /* @__PURE__ */ x(
218
- we,
219
- {
220
- ref: M,
221
- className: U,
222
- disabled: r,
223
- type: d,
224
- "aria-label": m || u,
225
- ...B,
226
- children: [
227
- _ && /* @__PURE__ */ c("span", { className: "pr-2", children: _ }),
228
- /* @__PURE__ */ c("div", { className: G, children: e }),
229
- p && /* @__PURE__ */ c("span", { className: "pl-2", children: p })
230
- ]
231
- }
232
- ) });
233
- }
234
- );
235
- oe.displayName = "ButtonSort";
236
- const v = H.createContext({
237
- mode: "light",
238
- cellWrapper: "thead",
239
- stickyHeader: !1,
240
- stickyFooter: !1,
241
- compact: !1
242
- }), R = "thead", Y = "tfoot", T = "tbody", V = {
243
- ASC: "asc",
244
- DESC: "desc"
245
- }, Ve = ({
246
- mode: e,
247
- className: r,
248
- wrapperClassName: t,
249
- stickyHeader: a,
250
- stickyFooter: s,
251
- spacing: o
252
- }) => ({
253
- wrapper: i(
254
- "not-prose relative w-full rounded-lg shadow-md",
255
- Te(o),
256
- {
257
- "overflow-x-auto": !a && !s,
258
- "overflow-y-scroll": a || s,
259
- "bg-surface-darker text-copy-light": e === "dark",
260
- "bg-surface-light text-copy-dark": e === "light",
261
- "bg-surface-darker text-copy-light dark:bg-surface-light dark:text-copy-dark": e === "system",
262
- "bg-surface-light text-copy-dark dark:bg-surface-darker dark:text-copy-light": e === "alt-system"
263
- },
264
- t
265
- ),
266
- table: i("my-0 w-full text-left text-sm", r, {
267
- "text-copy-light": e === "dark",
268
- "text-copy-dark": e === "light",
269
- "text-copy-light dark:text-copy-dark": e === "system",
270
- "text-copy-dark dark:text-copy-light": e === "alt-system"
271
- }),
272
- caption: i("py-2 text-sm font-bold", {
273
- "text-copy-light": e === "dark",
274
- "text-copy-dark": e === "light",
275
- "text-copy-light dark:text-copy-dark": e === "system",
276
- "text-copy-dark dark:text-copy-light": e === "alt-system"
277
- })
278
- }), ze = ({
279
- className: e,
280
- stickyHeader: r,
281
- mode: t
282
- }) => i(e, {
283
- "sticky top-0 z-10": r,
284
- "shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem]": r && t === "dark",
285
- "shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem]": r && t === "system",
286
- "shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem]": r && t === "light",
287
- "shadow-[rgb(65_65_65_/30%)_0_0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_0.5rem_1rem]": r && t === "alt-system"
288
- }), Re = ({
289
- className: e,
290
- stickyFooter: r,
291
- mode: t
292
- }) => i(e, {
293
- "sticky bottom-0 z-10": r,
294
- "shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": r && t === "dark",
295
- "shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem] dark:shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": r && t === "system",
296
- "shadow-[rgb(65_65_65_/30%)_0_-0.5rem_1rem]": r && t === "light",
297
- "shadow-[rgb(65_65_65_/30%)_-0_0.5rem_1rem] dark:shadow-[rgb(190_190_190_/20%)_0_-0.5rem_1rem]": r && t === "alt-system"
298
- }), Ue = ({
299
- mode: e,
300
- className: r,
301
- cellWrapper: t
302
- }) => t === R || t === Y ? i({
303
- "bg-table-head-dark": e === "dark",
304
- "bg-table-head-light": e === "light",
305
- "bg-table-head-dark dark:bg-table-head-light": e === "system",
306
- "bg-table-head-light dark:bg-table-head-dark": e === "alt-system"
307
- }) : i("border-b last:border-0", r, {
308
- "border-table-dark": e === "dark",
309
- "odd:bg-table-dark-odd even:bg-table-dark-even": t === T && e === "dark",
310
- "border-table-light": e === "light",
311
- "odd:bg-table-light-odd even:bg-table-light-even": t === T && e === "light",
312
- "border-table-dark dark:border-table-light": e === "system",
313
- "odd:bg-table-dark-odd even:bg-table-dark-even dark:odd:bg-table-light-odd dark:even:bg-table-light-even": t === T && e === "system",
314
- "border-table-light dark:border-table-dark": e === "alt-system",
315
- "odd:bg-table-light-odd even:bg-table-light-even dark:odd:bg-table-dark-odd dark:even:bg-table-dark-even": t === T && e === "alt-system"
316
- }), Ge = ({
317
- cellWrapper: e,
318
- className: r,
319
- compact: t,
320
- mode: a
321
- }) => i(r, {
322
- "text-copy-light": a === "dark",
323
- "text-copy-dark": a === "light",
324
- "text-copy-light dark:text-copy-dark": a === "system",
325
- "text-copy-dark dark:text-copy-light": a === "alt-system",
326
- "px-4 py-3": !t && (e === R || e === Y),
327
- "p-4": !t && e === T,
328
- "px-4 py-1": t
329
- }), lt = ({
330
- children: e,
331
- mode: r = "system",
332
- caption: t,
333
- compact: a,
334
- summary: s,
335
- className: o,
336
- wrapperClassName: d,
337
- maxHeight: l,
338
- stickyHeader: n,
339
- stickyFooter: m,
340
- spacing: u,
341
- ...y
342
- }) => {
343
- const p = Ve({
344
- mode: r,
345
- className: o,
346
- wrapperClassName: d,
347
- stickyHeader: n,
348
- stickyFooter: m,
349
- spacing: u
350
- });
351
- return /* @__PURE__ */ c(
352
- v.Provider,
353
- {
354
- value: { mode: r, stickyHeader: n, stickyFooter: m, compact: a },
355
- children: /* @__PURE__ */ c(
356
- "div",
357
- {
358
- className: p.wrapper,
359
- ...l && {
360
- style: { maxHeight: l }
361
- },
362
- children: /* @__PURE__ */ x("table", { className: p.table, summary: s, ...y, children: [
363
- t && /* @__PURE__ */ c("caption", { className: p.caption, children: t }),
364
- e
365
- ] })
366
- }
367
- )
368
- }
369
- );
370
- }, ct = ({
371
- children: e,
372
- className: r,
373
- ...t
374
- }) => {
375
- const a = A(v);
376
- a.cellWrapper = R;
377
- const s = ze({
378
- className: r,
379
- mode: a.mode,
380
- stickyHeader: a.stickyHeader
381
- });
382
- return /* @__PURE__ */ c("thead", { className: s, ...t, children: e });
383
- }, dt = ({
384
- children: e,
385
- className: r,
386
- ...t
387
- }) => {
388
- const a = A(v);
389
- a.cellWrapper = Y;
390
- const s = Re({
391
- className: r,
392
- mode: a.mode,
393
- stickyFooter: a.stickyFooter
394
- });
395
- return /* @__PURE__ */ c("tfoot", { className: s, ...t, children: e });
396
- }, it = ({ children: e, ...r }) => {
397
- const t = A(v);
398
- return t.cellWrapper = T, /* @__PURE__ */ c("tbody", { ...r, children: e });
399
- }, nt = ({
400
- children: e,
401
- className: r,
402
- ...t
403
- }) => {
404
- const a = A(v), s = Ue({
405
- mode: a.mode,
406
- cellWrapper: a.cellWrapper,
407
- className: r
408
- });
409
- return /* @__PURE__ */ c("tr", { className: s, ...t, children: e });
410
- }, De = ({
411
- children: e,
412
- component: r,
413
- className: t,
414
- ...a
415
- }) => {
416
- const s = A(v), o = r || (s.cellWrapper === R ? "th" : "td"), d = Ge({
417
- cellWrapper: s.cellWrapper,
418
- className: t,
419
- mode: s.mode,
420
- compact: s.compact
421
- });
422
- return /* @__PURE__ */ c(o, { className: d, ...a, children: e });
423
- }, mt = ({
424
- align: e,
425
- children: r,
426
- className: t,
427
- component: a,
428
- focusMode: s = "alt-system",
429
- mode: o = "alt-system",
430
- onClick: d,
431
- sortDirection: l,
432
- sortedCell: n,
433
- cellId: m,
434
- ...u
435
- }) => /* @__PURE__ */ c(
436
- De,
437
- {
438
- component: a,
439
- className: t,
440
- role: "columnheader",
441
- "aria-sort": l === V.ASC && n === m ? "ascending" : l === V.DESC && n === m ? "descending" : "other",
442
- ...u,
443
- children: /* @__PURE__ */ c(
444
- oe,
445
- {
446
- active: n === m,
447
- className: "rounded-none text-sm",
448
- onClick: d,
449
- align: e,
450
- noBorder: !0,
451
- focusMode: s,
452
- mode: o,
453
- fullWidth: !0,
454
- labelRight: r,
455
- children: l === V.ASC && n === m ? /* @__PURE__ */ c(Le, { className: "size-4", monotone: !0 }) : l === V.DESC && n === m ? /* @__PURE__ */ c($e, { className: "size-4", monotone: !0 }) : /* @__PURE__ */ c(Me, { className: "size-4", monotone: !0 })
456
- }
457
- )
458
- }
459
- );
460
- function Fe({
461
- value: e,
462
- defaultValue: r,
463
- finalValue: t,
464
- onChange: a = () => {
465
- },
466
- initialControlledDelay: s = 0
467
- }) {
468
- const [o, d] = z(!1), [l, n] = z(
469
- r !== void 0 ? r : t
470
- ), m = (u) => {
471
- n(u), a == null || a(u);
472
- };
473
- return ae(() => {
474
- (async () => e !== void 0 && !o && s > 0 && (await new Promise(
475
- (u) => setTimeout(u, s)
476
- ), d(!0)))();
477
- }, [e, s, o]), e !== void 0 ? !o && s > 0 ? ["", a, !0] : [e, a, !0] : [l, m, !1];
478
- }
479
- const Pe = () => "rounded-md text-base h-20 min-h-[80px] resize-none overflow-hidden px-4 py-7", We = ({
480
- mode: e
481
- }) => i({
482
- "bg-surface-darker text-copy-lighter caret-copy-light": e === "dark",
483
- "bg-surface-lighter text-copy-dark caret-copy-dark": e === "light",
484
- "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": e === "system",
485
- "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": e === "alt-system"
486
- }), qe = ({
487
- focusMode: e
488
- }) => i("focus:outline focus:outline-2 focus:outline-offset-2", {
489
- "focus:outline-focus-dark": e === "dark",
490
- "focus:outline-focus-light": e === "light",
491
- "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
492
- "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
493
- }), je = ({
494
- noBorder: e,
495
- error: r
496
- }) => i("border-2", {
497
- "border-border-dark": !e && !r,
498
- "focus:border-border-dark": !e && r,
499
- "border-border-error-dark": !e && r,
500
- "border-transparent": e
501
- }), Je = ({
502
- disabled: e,
503
- raw: r,
504
- error: t,
505
- mode: a
506
- }) => {
507
- if (r)
508
- return "";
509
- if (e)
510
- return i("absolute px-2 cursor-not-allowed opacity-50 font-medium");
511
- if (!t)
512
- return i("absolute px-2 cursor-text font-medium", {
513
- "text-copy-medium": a === "dark",
514
- "text-copy-dark": a === "light",
515
- "text-copy-dark dark:text-copy-medium": a === "system",
516
- "text-copy-medium dark:text-copy-dark": a === "alt-system"
517
- });
518
- if (t)
519
- return i("absolute px-2 cursor-text font-medium", {
520
- "text-copy-medium": a === "dark",
521
- "text-copy-error-dark": a === "light",
522
- "text-copy-error-dark dark:text-copy-error-light": a === "system",
523
- "text-copy-medium dark:text-copy-error-dark": a === "alt-system"
524
- });
525
- }, Qe = ({
526
- error: e,
527
- raw: r,
528
- mode: t,
529
- disabled: a
530
- }) => {
531
- if (r)
532
- return "";
533
- if (a)
534
- return i(
535
- J,
536
- "absolute px-2 cursor-not-allowed opacity-50 font-medium"
537
- );
538
- if (!e)
539
- return i(J, "absolute px-2 font-medium", {
540
- "text-copy-medium": t === "dark",
541
- "text-copy-dark": t === "light",
542
- "text-copy-dark dark:text-copy-medium": t === "system",
543
- "text-copy-medium dark:text-copy-dark": t === "alt-system"
544
- });
545
- if (e)
546
- return i(J, "absolute px-2 font-medium", {
547
- "text-copy-error-light": t === "dark",
548
- "text-copy-error-dark": t === "light",
549
- "text-copy-error-dark dark:text-copy-error-light": t === "system",
550
- "dark:text-copy-error-dark text-copy-error-light": t === "alt-system"
551
- });
552
- }, Ye = ({
553
- className: e,
554
- textAreaClassName: r,
555
- raw: t,
556
- focusMode: a,
557
- disabled: s,
558
- noBorder: o,
559
- error: d,
560
- spacing: l,
561
- mode: n
562
- }) => {
563
- const m = t ? e : i(
564
- "relative flex w-full flex-col justify-center",
565
- Ee,
566
- e,
567
- He(l)
568
- ), u = t ? i(r) : i(
569
- se,
570
- r,
571
- Pe(),
572
- We({ mode: n }),
573
- qe({ focusMode: a }),
574
- je({
575
- noBorder: o,
576
- error: d
577
- }),
578
- {
579
- "disabled:cursor-not-allowed disabled:opacity-50": s
580
- }
581
- ), y = t ? void 0 : "sr-only", p = Je({
582
- disabled: s,
583
- raw: t,
584
- error: d,
585
- mode: n
586
- }), _ = Qe({
587
- error: d,
588
- raw: t,
589
- mode: n,
590
- disabled: s
591
- }), g = t ? void 0 : i(Ae, "absolute");
592
- return {
593
- wrapper: m,
594
- textArea: u,
595
- accessibleLabel: y,
596
- visibleLabel: p,
597
- helperText: _,
598
- rightElement: g
599
- };
600
- }, Ke = ({
601
- scrollHeight: e,
602
- currentHeight: r,
603
- currentLabelOffset: t = 0,
604
- currentHelperTextOffset: a = 0
605
- }) => {
606
- let s, o;
607
- if (e > 0 && e !== r) {
608
- const d = e - r, l = Math.abs(d / 24);
609
- s = t + -1 * Math.sign(d) * (12 * l), o = a + Math.sign(d) * (12 * l);
610
- }
611
- return {
612
- labelOffset: s,
613
- helperTextOffset: o,
614
- scrollHeight: e
615
- };
616
- }, Xe = H.forwardRef(
617
- ({
618
- id: e,
619
- name: r,
620
- label: t,
621
- error: a = !1,
622
- raw: s = !1,
623
- className: o,
624
- textAreaClassName: d,
625
- mode: l = "system",
626
- focusMode: n = "system",
627
- value: m,
628
- defaultValue: u,
629
- disabled: y = !1,
630
- noBorder: p = !1,
631
- labelId: _,
632
- helperText: g = "",
633
- helperTextOnFocus: S = !1,
634
- rightElement: C,
635
- onChange: O,
636
- onFocus: B,
637
- onBlur: M,
638
- spacing: U,
639
- ...G
640
- }, D) => {
641
- const b = N(null), de = ve([D, b]), [ie, $] = Se(), F = N(80), K = N(-25), I = N(null), X = N(30), P = N(null), E = Ce({ id: e, prefix: `${se}-` }), [ne, me] = z(0), [ue, Z] = z(
642
- !!(!S && g)
643
- ), he = `${r} error, ${g}`, w = Ye({
644
- className: o,
645
- textAreaClassName: d,
646
- error: a,
647
- raw: s,
648
- focusMode: n,
649
- disabled: y,
650
- noBorder: p,
651
- spacing: U,
652
- mode: l
653
- }), [f, pe] = Fe({
654
- value: m,
655
- initialControlledDelay: 20,
656
- defaultValue: u,
657
- onChange: (h) => {
658
- O && O({
659
- target: {
660
- value: h
661
- }
662
- });
663
- }
664
- }), ge = (h) => {
665
- pe(h.target.value);
666
- }, ye = (h) => {
667
- S && g && Z(!0), B && B(h);
668
- }, be = (h) => {
669
- S && g && !f && Z(!1), M && M(h);
670
- };
671
- return L(() => {
672
- $ && $.width && me($.width + 18 + 10);
673
- }, [$]), L(() => {
674
- s || b && b.current && f !== void 0 && (b.current.style.height = "inherit", b.current.style.height = b.current.scrollHeight + "px");
675
- }, [f, s]), L(() => {
676
- s || setTimeout(() => {
677
- var h;
678
- (h = I == null ? void 0 : I.current) == null || h.style.setProperty(
679
- "--av-text-area-wrapper-transition",
680
- f ? "none" : "all 0.2s ease-out"
681
- );
682
- }, 0);
683
- }, [f, s]), L(() => {
684
- var h, ee;
685
- if (!s && b && b.current && f !== void 0) {
686
- const { labelOffset: W, helperTextOffset: q, scrollHeight: fe } = Ke({
687
- scrollHeight: b.current.scrollHeight,
688
- currentHeight: F.current,
689
- currentLabelOffset: K.current,
690
- currentHelperTextOffset: X.current
691
- });
692
- W && (K.current = W, (h = I == null ? void 0 : I.current) == null || h.style.setProperty(
693
- "--av-text-area-label",
694
- `${W}px`
695
- )), q && (X.current = q, (ee = P == null ? void 0 : P.current) == null || ee.style.setProperty(
696
- "--av-text-area-helper-text",
697
- `${q}px`
698
- )), F.current = fe || F.current;
699
- }
700
- }, [f, s]), /* @__PURE__ */ x("div", { className: w.wrapper, children: [
701
- /* @__PURE__ */ c(
702
- "label",
703
- {
704
- htmlFor: E,
705
- id: _,
706
- className: w.accessibleLabel,
707
- children: t
708
- }
709
- ),
710
- /* @__PURE__ */ c(
711
- "textarea",
712
- {
713
- ref: de,
714
- id: E,
715
- name: r,
716
- disabled: y,
717
- placeholder: s ? void 0 : " ",
718
- className: w.textArea,
719
- rows: 1,
720
- ...g && { "aria-describedby": `${E}-helper` },
721
- ...a && { "aria-invalid": "true" },
722
- ...C && !s && { style: { paddingRight: ne } },
723
- value: f,
724
- onChange: ge,
725
- onFocus: ye,
726
- onBlur: be,
727
- ...G
728
- }
729
- ),
730
- !s && /* @__PURE__ */ c(
731
- "label",
732
- {
733
- ref: I,
734
- "aria-hidden": !0,
735
- htmlFor: E,
736
- className: w.visibleLabel,
737
- children: t
738
- }
739
- ),
740
- ue && /* @__PURE__ */ c(
741
- "div",
742
- {
743
- ref: P,
744
- id: `${E}-helper`,
745
- className: w.helperText,
746
- children: g
747
- }
748
- ),
749
- C && /* @__PURE__ */ c(
750
- "div",
751
- {
752
- ref: ie,
753
- className: w.rightElement,
754
- children: C
755
- }
756
- ),
757
- a && g && /* @__PURE__ */ c(Ie, { politeness: "polite", clearAnnouncementDelay: 500, children: he })
758
- ] });
759
- }
760
- );
761
- Xe.displayName = "TextArea";
762
- const k = {
763
- GET_LOCATION: `query GetLocation($latitude: Float!, $longitude: Float!) {
764
- location(latitude: $latitude, longitude: $longitude) {
765
- country
766
- state
767
- city
768
- displayName
769
- }
770
- }`,
771
- GET_CHATS: `query GetChats($userId: String!) {
772
- chats(user: $userId) {
773
- timestamp
774
- id
775
- messages {
776
- content
777
- }
778
- }
779
- }`,
780
- GET_CHATS_STATS: `query GetChatsStats($userId: String!) {
781
- chatsStats(user: $userId) {
782
- totalChats
783
- averageProcessingTimes
784
- }
785
- }`,
786
- GET_CHAT: `query GetChatById($id: String!) {
787
- chatById(id: $id) {
788
- model
789
- usage
790
- messages {
791
- content
792
- role
793
- name
794
- processingTime
795
- }
796
- }
797
- }`,
798
- DELETE_CHAT: `mutation DeleteChat($id: String!, $userId: String!) {
799
- deleteChat(id: $id, user: $userId) {
800
- timestamp
801
- id
802
- messages {
803
- content
804
- }
805
- }
806
- }`,
807
- ABOUT: `query About {
808
- about {
809
- version
810
- models
811
- plugins
812
- }
813
- }`,
814
- GET_CUSTOM_INSTRUCTIONS: `query GetCustomInstructions($user: String!) {
815
- getCustomInstructions(user: $user) {
816
- instructions
817
- location
818
- }
819
- }`,
820
- SET_CUSTOM_INSTRUCTIONS: `mutation SetCustomInstructions(
821
- $user: String!,
822
- $instructions: String!,
823
- $location: String) {
824
- setCustomInstructions(
825
- user: $user,
826
- instructions: $instructions,
827
- location: $location)
828
- }`
829
- }, ut = {
830
- GET_LOCATION: {
831
- schema: k.GET_LOCATION,
832
- method: "location",
833
- data: (e) => ({
834
- latitude: e.latitude,
835
- longitude: e.longitude
836
- })
837
- },
838
- GET_CHATS: {
839
- schema: k.GET_CHATS,
840
- method: "chats",
841
- data: (e) => ({
842
- userId: e.userId
843
- })
844
- },
845
- GET_CHATS_STATS: {
846
- schema: k.GET_CHATS_STATS,
847
- method: "chatsStats",
848
- data: (e) => ({
849
- userId: e.userId
850
- })
851
- },
852
- GET_CHAT: {
853
- schema: k.GET_CHAT,
854
- method: "chatById",
855
- data: (e) => ({
856
- id: e.id
857
- })
858
- },
859
- DELETE_CHAT: {
860
- schema: k.DELETE_CHAT,
861
- method: "deleteChat",
862
- data: (e) => ({
863
- id: e.id,
864
- userId: e.userId
865
- })
866
- },
867
- ABOUT: {
868
- schema: k.ABOUT,
869
- method: "about",
870
- data: () => ({})
871
- },
872
- GET_CUSTOM_INSTRUCTIONS: {
873
- schema: k.GET_CUSTOM_INSTRUCTIONS,
874
- method: "getCustomInstructions",
875
- data: (e) => ({
876
- user: e.user
877
- })
878
- },
879
- SET_CUSTOM_INSTRUCTIONS: {
880
- schema: k.SET_CUSTOM_INSTRUCTIONS,
881
- method: "setCustomInstructions",
882
- data: (e) => ({
883
- user: e.user,
884
- instructions: e.instructions,
885
- location: e.location
886
- })
887
- }
888
- }, le = process.env.PUBLIC_SASSY_API_SERVER_URL, Ze = async ({
889
- query: e,
890
- data: r,
891
- headers: t = {}
892
- }) => await fetch(`${le}/graphql`, {
893
- method: "POST",
894
- credentials: "include",
895
- headers: {
896
- ...t,
897
- "Content-Type": "application/json",
898
- Accept: "application/json"
899
- },
900
- body: JSON.stringify({
901
- query: e,
902
- variables: r
903
- })
904
- }), ht = async ({
905
- accessToken: e,
906
- type: r,
907
- params: t = {}
908
- }) => {
909
- const a = r != null && r.data ? r.data(t) : t;
910
- try {
911
- const s = `Bearer ${e}`, o = await Ze({
912
- headers: {
913
- authorization: s
914
- },
915
- query: r.schema,
916
- data: a
917
- });
918
- if (o.status !== 200)
919
- return { status: o.status, data: [] };
920
- const { data: d, errors: l } = await o.json();
921
- return {
922
- status: o.status,
923
- data: d[r.method],
924
- errors: l
925
- };
926
- } catch (s) {
927
- return console.error(s), { status: 500, data: [] };
928
- }
929
- }, pt = async ({
930
- accessToken: e,
931
- name: r,
932
- data: t,
933
- method: a = "POST"
934
- }) => {
935
- const s = `Bearer ${e}`;
936
- return await fetch(`${le}/api/${r}`, {
937
- method: a,
938
- credentials: "include",
939
- headers: {
940
- "Content-Type": "application/json",
941
- authorization: s
942
- },
943
- body: JSON.stringify(t)
944
- });
945
- }, gt = H.createContext({
946
- state: {
947
- id: "",
948
- model: Oe,
949
- usage: 0,
950
- messages: [],
951
- isComponent: !1
952
- },
953
- dispatch: () => {
954
- },
955
- serverStats: { version: "", models: [], plugins: [] }
956
- }), yt = H.createContext({
957
- state: { searchString: "", sortedCell: "", sortDirection: "" },
958
- dispatch: () => {
959
- }
960
- });
961
- function ce(e, r) {
962
- window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: r }));
963
- }
964
- const te = (e, r) => {
965
- const t = JSON.stringify(
966
- typeof r == "function" ? r() : r
967
- );
968
- window.localStorage.setItem(e, t), ce(e, t);
969
- }, et = (e) => {
970
- window.localStorage.removeItem(e), ce(e, null);
971
- }, re = (e) => window.localStorage.getItem(e), tt = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
972
- function bt({
973
- key: e,
974
- initialValue: r
975
- }) {
976
- const t = _e(tt, () => re(e)), a = j(
977
- (d) => {
978
- try {
979
- const l = typeof d == "function" ? d(JSON.parse(t)) : d;
980
- l == null ? et(e) : te(e, l);
981
- } catch (l) {
982
- console.warn(l);
983
- }
984
- },
985
- [e, t]
986
- ), s = j(() => {
987
- a(r);
988
- }, [r, a]), o = j(() => {
989
- a(null);
990
- }, [a]);
991
- return ae(() => {
992
- try {
993
- re(e) === null && typeof r < "u" && te(e, r);
994
- } catch (d) {
995
- console.warn(d);
996
- }
997
- }, [e, r]), [t ? JSON.parse(t) : null, a, s, o];
998
- }
999
- export {
1000
- gt as AppContext,
1001
- bt as E,
1002
- yt as HistoryContext,
1003
- De as J,
1004
- ut as SERVICE_TYPES,
1005
- Xe as Tt,
1006
- ct as at,
1007
- mt as ct,
1008
- lt as et,
1009
- Q as g,
1010
- V as k,
1011
- nt as lt,
1012
- pt as restCall,
1013
- dt as rt,
1014
- ht as serviceCall,
1015
- it as st
1016
- };