@versini/sassysaint 8.4.7 → 8.4.8

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,4895 +0,0 @@
1
- import { jsx as h, jsxs as Q, Fragment as at } from "react/jsx-runtime";
2
- import Z, { createContext as Vr, useReducer as Wr, useRef as x, useCallback as re, useEffect as oe, useContext as Zt, useSyncExternalStore as Mn, useLayoutEffect as Ue, useMemo as Ke, useDebugValue as Hn, useState as Ee, useId as Gr, lazy as Kn, Suspense as Vn } from "react";
3
- import E from "clsx";
4
- var Wn = Object.defineProperty, Gn = (e, t, r) => t in e ? Wn(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Tt = (e, t, r) => Gn(e, typeof t != "symbol" ? t + "" : t, r);
5
- /*!
6
- @versini/auth-provider v7.5.0
7
- © 2025 gizmette.com
8
- */
9
- try {
10
- window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
11
- version: "7.5.0",
12
- buildTime: "02/09/2025 07:44 PM EST",
13
- homepage: "https://github.com/aversini/auth-client",
14
- license: "MIT"
15
- });
16
- } catch {
17
- }
18
- function ce(e) {
19
- const t = new Uint8Array(e);
20
- let r = "";
21
- for (const n of t)
22
- r += String.fromCharCode(n);
23
- return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
24
- }
25
- function ot(e) {
26
- const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, n = t.padEnd(t.length + r, "="), a = atob(n), o = new ArrayBuffer(a.length), s = new Uint8Array(o);
27
- for (let i = 0; i < a.length; i++)
28
- s[i] = a.charCodeAt(i);
29
- return o;
30
- }
31
- function er() {
32
- return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
33
- }
34
- function Br(e) {
35
- const { id: t } = e;
36
- return {
37
- ...e,
38
- id: ot(t),
39
- transports: e.transports
40
- };
41
- }
42
- function Fr(e) {
43
- return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
44
- }
45
- let Y = class extends Error {
46
- constructor({ message: t, code: r, cause: n, name: a }) {
47
- super(t, { cause: n }), this.name = a ?? n.name, this.code = r;
48
- }
49
- };
50
- function Bn({ error: e, options: t }) {
51
- var n, a;
52
- const { publicKey: r } = t;
53
- if (!r)
54
- throw Error("options was missing required publicKey property");
55
- if (e.name === "AbortError") {
56
- if (t.signal instanceof AbortSignal)
57
- return new Y({
58
- message: "Registration ceremony was sent an abort signal",
59
- code: "ERROR_CEREMONY_ABORTED",
60
- cause: e
61
- });
62
- } else if (e.name === "ConstraintError") {
63
- if (((n = r.authenticatorSelection) == null ? void 0 : n.requireResidentKey) === !0)
64
- return new Y({
65
- message: "Discoverable credentials were required but no available authenticator supported it",
66
- code: "ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",
67
- cause: e
68
- });
69
- if (((a = r.authenticatorSelection) == null ? void 0 : a.userVerification) === "required")
70
- return new Y({
71
- message: "User verification was required but no available authenticator supported it",
72
- code: "ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",
73
- cause: e
74
- });
75
- } else {
76
- if (e.name === "InvalidStateError")
77
- return new Y({
78
- message: "The authenticator was previously registered",
79
- code: "ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",
80
- cause: e
81
- });
82
- if (e.name === "NotAllowedError")
83
- return new Y({
84
- message: e.message,
85
- code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
86
- cause: e
87
- });
88
- if (e.name === "NotSupportedError")
89
- return r.pubKeyCredParams.filter((o) => o.type === "public-key").length === 0 ? new Y({
90
- message: 'No entry in pubKeyCredParams was of type "public-key"',
91
- code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
92
- cause: e
93
- }) : new Y({
94
- message: "No available authenticator supported any of the specified pubKeyCredParams algorithms",
95
- code: "ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",
96
- cause: e
97
- });
98
- if (e.name === "SecurityError") {
99
- const o = window.location.hostname;
100
- if (Fr(o)) {
101
- if (r.rp.id !== o)
102
- return new Y({
103
- message: `The RP ID "${r.rp.id}" is invalid for this domain`,
104
- code: "ERROR_INVALID_RP_ID",
105
- cause: e
106
- });
107
- } else return new Y({
108
- message: `${window.location.hostname} is an invalid domain`,
109
- code: "ERROR_INVALID_DOMAIN",
110
- cause: e
111
- });
112
- } else if (e.name === "TypeError") {
113
- if (r.user.id.byteLength < 1 || r.user.id.byteLength > 64)
114
- return new Y({
115
- message: "User ID was not between 1 and 64 characters",
116
- code: "ERROR_INVALID_USER_ID_LENGTH",
117
- cause: e
118
- });
119
- } else if (e.name === "UnknownError")
120
- return new Y({
121
- message: "The authenticator was unable to process the specified options, or could not create a new credential",
122
- code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
123
- cause: e
124
- });
125
- }
126
- return e;
127
- }
128
- class Fn {
129
- createNewAbortSignal() {
130
- if (this.controller) {
131
- const r = new Error("Cancelling existing WebAuthn API call for new one");
132
- r.name = "AbortError", this.controller.abort(r);
133
- }
134
- const t = new AbortController();
135
- return this.controller = t, t.signal;
136
- }
137
- cancelCeremony() {
138
- if (this.controller) {
139
- const t = new Error("Manually cancelling existing WebAuthn API call");
140
- t.name = "AbortError", this.controller.abort(t), this.controller = void 0;
141
- }
142
- }
143
- }
144
- const Jr = new Fn(), Jn = ["cross-platform", "platform"];
145
- function Yr(e) {
146
- if (e && !(Jn.indexOf(e) < 0))
147
- return e;
148
- }
149
- async function Yn(e) {
150
- var u;
151
- if (!er())
152
- throw new Error("WebAuthn is not supported in this browser");
153
- const t = { publicKey: {
154
- ...e,
155
- challenge: ot(e.challenge),
156
- user: {
157
- ...e.user,
158
- id: ot(e.user.id)
159
- },
160
- excludeCredentials: (u = e.excludeCredentials) == null ? void 0 : u.map(Br)
161
- } };
162
- t.signal = Jr.createNewAbortSignal();
163
- let r;
164
- try {
165
- r = await navigator.credentials.create(t);
166
- } catch (l) {
167
- throw Bn({ error: l, options: t });
168
- }
169
- if (!r)
170
- throw new Error("Registration was not completed");
171
- const { id: n, rawId: a, response: o, type: s } = r;
172
- let i;
173
- typeof o.getTransports == "function" && (i = o.getTransports());
174
- let c;
175
- if (typeof o.getPublicKeyAlgorithm == "function")
176
- try {
177
- c = o.getPublicKeyAlgorithm();
178
- } catch (l) {
179
- _t("getPublicKeyAlgorithm()", l);
180
- }
181
- let m;
182
- if (typeof o.getPublicKey == "function")
183
- try {
184
- const l = o.getPublicKey();
185
- l !== null && (m = ce(l));
186
- } catch (l) {
187
- _t("getPublicKey()", l);
188
- }
189
- let f;
190
- if (typeof o.getAuthenticatorData == "function")
191
- try {
192
- f = ce(o.getAuthenticatorData());
193
- } catch (l) {
194
- _t("getAuthenticatorData()", l);
195
- }
196
- return {
197
- id: n,
198
- rawId: ce(a),
199
- response: {
200
- attestationObject: ce(o.attestationObject),
201
- clientDataJSON: ce(o.clientDataJSON),
202
- transports: i,
203
- publicKeyAlgorithm: c,
204
- publicKey: m,
205
- authenticatorData: f
206
- },
207
- type: s,
208
- clientExtensionResults: r.getClientExtensionResults(),
209
- authenticatorAttachment: Yr(r.authenticatorAttachment)
210
- };
211
- }
212
- function _t(e, t) {
213
- console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.
214
- `, t);
215
- }
216
- function jn() {
217
- if (!er())
218
- return new Promise((t) => t(!1));
219
- const e = window.PublicKeyCredential;
220
- return e.isConditionalMediationAvailable === void 0 ? new Promise((t) => t(!1)) : e.isConditionalMediationAvailable();
221
- }
222
- function qn({ error: e, options: t }) {
223
- const { publicKey: r } = t;
224
- if (!r)
225
- throw Error("options was missing required publicKey property");
226
- if (e.name === "AbortError") {
227
- if (t.signal instanceof AbortSignal)
228
- return new Y({
229
- message: "Authentication ceremony was sent an abort signal",
230
- code: "ERROR_CEREMONY_ABORTED",
231
- cause: e
232
- });
233
- } else {
234
- if (e.name === "NotAllowedError")
235
- return new Y({
236
- message: e.message,
237
- code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
238
- cause: e
239
- });
240
- if (e.name === "SecurityError") {
241
- const n = window.location.hostname;
242
- if (Fr(n)) {
243
- if (r.rpId !== n)
244
- return new Y({
245
- message: `The RP ID "${r.rpId}" is invalid for this domain`,
246
- code: "ERROR_INVALID_RP_ID",
247
- cause: e
248
- });
249
- } else return new Y({
250
- message: `${window.location.hostname} is an invalid domain`,
251
- code: "ERROR_INVALID_DOMAIN",
252
- cause: e
253
- });
254
- } else if (e.name === "UnknownError")
255
- return new Y({
256
- message: "The authenticator was unable to process the specified options, or could not create a new assertion signature",
257
- code: "ERROR_AUTHENTICATOR_GENERAL_ERROR",
258
- cause: e
259
- });
260
- }
261
- return e;
262
- }
263
- async function zn(e, t = !1) {
264
- var u, l;
265
- if (!er())
266
- throw new Error("WebAuthn is not supported in this browser");
267
- let r;
268
- ((u = e.allowCredentials) == null ? void 0 : u.length) !== 0 && (r = (l = e.allowCredentials) == null ? void 0 : l.map(Br));
269
- const n = {
270
- ...e,
271
- challenge: ot(e.challenge),
272
- allowCredentials: r
273
- }, a = {};
274
- if (t) {
275
- if (!await jn())
276
- throw Error("Browser does not support WebAuthn autofill");
277
- if (document.querySelectorAll("input[autocomplete$='webauthn']").length < 1)
278
- throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');
279
- a.mediation = "conditional", n.allowCredentials = [];
280
- }
281
- a.publicKey = n, a.signal = Jr.createNewAbortSignal();
282
- let o;
283
- try {
284
- o = await navigator.credentials.get(a);
285
- } catch (d) {
286
- throw qn({ error: d, options: a });
287
- }
288
- if (!o)
289
- throw new Error("Authentication was not completed");
290
- const { id: s, rawId: i, response: c, type: m } = o;
291
- let f;
292
- return c.userHandle && (f = ce(c.userHandle)), {
293
- id: s,
294
- rawId: ce(i),
295
- response: {
296
- authenticatorData: ce(c.authenticatorData),
297
- clientDataJSON: ce(c.clientDataJSON),
298
- signature: ce(c.signature),
299
- userHandle: f
300
- },
301
- type: m,
302
- clientExtensionResults: o.getClientExtensionResults(),
303
- authenticatorAttachment: Yr(o.authenticatorAttachment)
304
- };
305
- }
306
- /*!
307
- @versini/auth-common v4.2.0
308
- © 2025 gizmette.com
309
- */
310
- try {
311
- window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
312
- version: "4.2.0",
313
- buildTime: "02/09/2025 07:44 PM EST",
314
- homepage: "https://github.com/aversini/auth-client",
315
- license: "MIT"
316
- });
317
- } catch {
318
- }
319
- const xe = {
320
- ID_TOKEN: "id_token",
321
- ACCESS_TOKEN: "token",
322
- ID_AND_ACCESS_TOKEN: "id_token token",
323
- CODE: "code",
324
- REFRESH_TOKEN: "refresh_token",
325
- PASSKEY: "passkey"
326
- }, jr = {
327
- CLIENT_ID: "X-Auth-ClientId"
328
- }, F = {
329
- ALG: "RS256",
330
- USER_ID_KEY: "sub",
331
- USERNAME_KEY: "username",
332
- EMAIL_KEY: "email",
333
- TOKEN_ID_KEY: "__raw",
334
- NONCE_KEY: "_nonce",
335
- AUTH_TYPE_KEY: "auth_type",
336
- EXPIRES_AT_KEY: "exp",
337
- CREATED_AT_KEY: "iat",
338
- SCOPES_KEY: "scopes",
339
- CLIENT_ID_KEY: "aud",
340
- ISSUER: "gizmette.com"
341
- }, Xn = `-----BEGIN PUBLIC KEY-----
342
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
343
- w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
344
- i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
345
- aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
346
- l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
347
- sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
348
- awIDAQAB
349
- -----END PUBLIC KEY-----`, dt = {
350
- CODE: "code",
351
- LOGOUT: "logout",
352
- LOGIN: "login",
353
- REFRESH: "refresh"
354
- }, ut = crypto, qr = (e) => e instanceof CryptoKey, Ye = new TextEncoder(), Ve = new TextDecoder();
355
- function Qn(...e) {
356
- const t = e.reduce((a, { length: o }) => a + o, 0), r = new Uint8Array(t);
357
- let n = 0;
358
- for (const a of e)
359
- r.set(a, n), n += a.length;
360
- return r;
361
- }
362
- const Zn = (e) => {
363
- const t = atob(e), r = new Uint8Array(t.length);
364
- for (let n = 0; n < t.length; n++)
365
- r[n] = t.charCodeAt(n);
366
- return r;
367
- }, we = (e) => {
368
- let t = e;
369
- t instanceof Uint8Array && (t = Ve.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
370
- try {
371
- return Zn(t);
372
- } catch {
373
- throw new TypeError("The input to be decoded is not correctly encoded.");
374
- }
375
- };
376
- let z = class extends Error {
377
- constructor(t, r) {
378
- var n;
379
- super(t, r), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (n = Error.captureStackTrace) == null || n.call(Error, this, this.constructor);
380
- }
381
- };
382
- z.code = "ERR_JOSE_GENERIC";
383
- let ne = class extends z {
384
- constructor(t, r, n = "unspecified", a = "unspecified") {
385
- super(t, { cause: { claim: n, reason: a, payload: r } }), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = n, this.reason = a, this.payload = r;
386
- }
387
- };
388
- ne.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
389
- class Kt extends z {
390
- constructor(t, r, n = "unspecified", a = "unspecified") {
391
- super(t, { cause: { claim: n, reason: a, payload: r } }), this.code = "ERR_JWT_EXPIRED", this.claim = n, this.reason = a, this.payload = r;
392
- }
393
- }
394
- Kt.code = "ERR_JWT_EXPIRED";
395
- class zr extends z {
396
- constructor() {
397
- super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
398
- }
399
- }
400
- zr.code = "ERR_JOSE_ALG_NOT_ALLOWED";
401
- let ae = class extends z {
402
- constructor() {
403
- super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
404
- }
405
- };
406
- ae.code = "ERR_JOSE_NOT_SUPPORTED";
407
- class ea extends z {
408
- constructor(t = "decryption operation failed", r) {
409
- super(t, r), this.code = "ERR_JWE_DECRYPTION_FAILED";
410
- }
411
- }
412
- ea.code = "ERR_JWE_DECRYPTION_FAILED";
413
- class ta extends z {
414
- constructor() {
415
- super(...arguments), this.code = "ERR_JWE_INVALID";
416
- }
417
- }
418
- ta.code = "ERR_JWE_INVALID";
419
- let H = class extends z {
420
- constructor() {
421
- super(...arguments), this.code = "ERR_JWS_INVALID";
422
- }
423
- };
424
- H.code = "ERR_JWS_INVALID";
425
- let ie = class extends z {
426
- constructor() {
427
- super(...arguments), this.code = "ERR_JWT_INVALID";
428
- }
429
- };
430
- ie.code = "ERR_JWT_INVALID";
431
- class ra extends z {
432
- constructor() {
433
- super(...arguments), this.code = "ERR_JWK_INVALID";
434
- }
435
- }
436
- ra.code = "ERR_JWK_INVALID";
437
- class na extends z {
438
- constructor() {
439
- super(...arguments), this.code = "ERR_JWKS_INVALID";
440
- }
441
- }
442
- na.code = "ERR_JWKS_INVALID";
443
- class aa extends z {
444
- constructor(t = "no applicable key found in the JSON Web Key Set", r) {
445
- super(t, r), this.code = "ERR_JWKS_NO_MATCHING_KEY";
446
- }
447
- }
448
- aa.code = "ERR_JWKS_NO_MATCHING_KEY";
449
- class oa extends z {
450
- constructor(t = "multiple matching keys found in the JSON Web Key Set", r) {
451
- super(t, r), this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
452
- }
453
- }
454
- oa.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
455
- class sa extends z {
456
- constructor(t = "request timed out", r) {
457
- super(t, r), this.code = "ERR_JWKS_TIMEOUT";
458
- }
459
- }
460
- sa.code = "ERR_JWKS_TIMEOUT";
461
- class Xr extends z {
462
- constructor(t = "signature verification failed", r) {
463
- super(t, r), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
464
- }
465
- }
466
- Xr.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
467
- function ge(e, t = "algorithm.name") {
468
- return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
469
- }
470
- function je(e, t) {
471
- return e.name === t;
472
- }
473
- function It(e) {
474
- return parseInt(e.name.slice(4), 10);
475
- }
476
- function ia(e) {
477
- switch (e) {
478
- case "ES256":
479
- return "P-256";
480
- case "ES384":
481
- return "P-384";
482
- case "ES512":
483
- return "P-521";
484
- default:
485
- throw new Error("unreachable");
486
- }
487
- }
488
- function ca(e, t) {
489
- if (t.length && !t.some((r) => e.usages.includes(r))) {
490
- let r = "CryptoKey does not support this operation, its usages must include ";
491
- if (t.length > 2) {
492
- const n = t.pop();
493
- r += `one of ${t.join(", ")}, or ${n}.`;
494
- } else t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
495
- throw new TypeError(r);
496
- }
497
- }
498
- function la(e, t, ...r) {
499
- switch (t) {
500
- case "HS256":
501
- case "HS384":
502
- case "HS512": {
503
- if (!je(e.algorithm, "HMAC"))
504
- throw ge("HMAC");
505
- const n = parseInt(t.slice(2), 10);
506
- if (It(e.algorithm.hash) !== n)
507
- throw ge(`SHA-${n}`, "algorithm.hash");
508
- break;
509
- }
510
- case "RS256":
511
- case "RS384":
512
- case "RS512": {
513
- if (!je(e.algorithm, "RSASSA-PKCS1-v1_5"))
514
- throw ge("RSASSA-PKCS1-v1_5");
515
- const n = parseInt(t.slice(2), 10);
516
- if (It(e.algorithm.hash) !== n)
517
- throw ge(`SHA-${n}`, "algorithm.hash");
518
- break;
519
- }
520
- case "PS256":
521
- case "PS384":
522
- case "PS512": {
523
- if (!je(e.algorithm, "RSA-PSS"))
524
- throw ge("RSA-PSS");
525
- const n = parseInt(t.slice(2), 10);
526
- if (It(e.algorithm.hash) !== n)
527
- throw ge(`SHA-${n}`, "algorithm.hash");
528
- break;
529
- }
530
- case "EdDSA": {
531
- if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
532
- throw ge("Ed25519 or Ed448");
533
- break;
534
- }
535
- case "ES256":
536
- case "ES384":
537
- case "ES512": {
538
- if (!je(e.algorithm, "ECDSA"))
539
- throw ge("ECDSA");
540
- const n = ia(t);
541
- if (e.algorithm.namedCurve !== n)
542
- throw ge(n, "algorithm.namedCurve");
543
- break;
544
- }
545
- default:
546
- throw new TypeError("CryptoKey does not support this operation");
547
- }
548
- ca(e, r);
549
- }
550
- function Qr(e, t, ...r) {
551
- var n;
552
- if (r = r.filter(Boolean), r.length > 2) {
553
- const a = r.pop();
554
- e += `one of type ${r.join(", ")}, or ${a}.`;
555
- } else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
556
- return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (n = t.constructor) != null && n.name && (e += ` Received an instance of ${t.constructor.name}`), e;
557
- }
558
- const hr = (e, ...t) => Qr("Key must be ", e, ...t);
559
- function Zr(e, t, ...r) {
560
- return Qr(`Key for the ${e} algorithm must be `, t, ...r);
561
- }
562
- const en = (e) => qr(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", st = ["CryptoKey"], da = (...e) => {
563
- const t = e.filter(Boolean);
564
- if (t.length === 0 || t.length === 1)
565
- return !0;
566
- let r;
567
- for (const n of t) {
568
- const a = Object.keys(n);
569
- if (!r || r.size === 0) {
570
- r = new Set(a);
571
- continue;
572
- }
573
- for (const o of a) {
574
- if (r.has(o))
575
- return !1;
576
- r.add(o);
577
- }
578
- }
579
- return !0;
580
- };
581
- function ua(e) {
582
- return typeof e == "object" && e !== null;
583
- }
584
- function Pe(e) {
585
- if (!ua(e) || Object.prototype.toString.call(e) !== "[object Object]")
586
- return !1;
587
- if (Object.getPrototypeOf(e) === null)
588
- return !0;
589
- let t = e;
590
- for (; Object.getPrototypeOf(t) !== null; )
591
- t = Object.getPrototypeOf(t);
592
- return Object.getPrototypeOf(e) === t;
593
- }
594
- const fa = (e, t) => {
595
- if (e.startsWith("RS") || e.startsWith("PS")) {
596
- const { modulusLength: r } = t.algorithm;
597
- if (typeof r != "number" || r < 2048)
598
- throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
599
- }
600
- };
601
- function De(e) {
602
- return Pe(e) && typeof e.kty == "string";
603
- }
604
- function ha(e) {
605
- return e.kty !== "oct" && typeof e.d == "string";
606
- }
607
- function ma(e) {
608
- return e.kty !== "oct" && typeof e.d > "u";
609
- }
610
- function pa(e) {
611
- return De(e) && e.kty === "oct" && typeof e.k == "string";
612
- }
613
- function ga(e) {
614
- let t, r;
615
- switch (e.kty) {
616
- case "RSA": {
617
- switch (e.alg) {
618
- case "PS256":
619
- case "PS384":
620
- case "PS512":
621
- t = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
622
- break;
623
- case "RS256":
624
- case "RS384":
625
- case "RS512":
626
- t = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
627
- break;
628
- case "RSA-OAEP":
629
- case "RSA-OAEP-256":
630
- case "RSA-OAEP-384":
631
- case "RSA-OAEP-512":
632
- t = {
633
- name: "RSA-OAEP",
634
- hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
635
- }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
636
- break;
637
- default:
638
- throw new ae('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
639
- }
640
- break;
641
- }
642
- case "EC": {
643
- switch (e.alg) {
644
- case "ES256":
645
- t = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
646
- break;
647
- case "ES384":
648
- t = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
649
- break;
650
- case "ES512":
651
- t = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
652
- break;
653
- case "ECDH-ES":
654
- case "ECDH-ES+A128KW":
655
- case "ECDH-ES+A192KW":
656
- case "ECDH-ES+A256KW":
657
- t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
658
- break;
659
- default:
660
- throw new ae('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
661
- }
662
- break;
663
- }
664
- case "OKP": {
665
- switch (e.alg) {
666
- case "EdDSA":
667
- t = { name: e.crv }, r = e.d ? ["sign"] : ["verify"];
668
- break;
669
- case "ECDH-ES":
670
- case "ECDH-ES+A128KW":
671
- case "ECDH-ES+A192KW":
672
- case "ECDH-ES+A256KW":
673
- t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
674
- break;
675
- default:
676
- throw new ae('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
677
- }
678
- break;
679
- }
680
- default:
681
- throw new ae('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
682
- }
683
- return { algorithm: t, keyUsages: r };
684
- }
685
- const tn = async (e) => {
686
- if (!e.alg)
687
- throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
688
- const { algorithm: t, keyUsages: r } = ga(e), n = [
689
- t,
690
- e.ext ?? !1,
691
- e.key_ops ?? r
692
- ], a = { ...e };
693
- return delete a.alg, delete a.use, ut.subtle.importKey("jwk", a, ...n);
694
- }, rn = (e) => we(e);
695
- let Ae, Re;
696
- const nn = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", it = async (e, t, r, n, a = !1) => {
697
- let o = e.get(t);
698
- if (o != null && o[n])
699
- return o[n];
700
- const s = await tn({ ...r, alg: n });
701
- return a && Object.freeze(t), o ? o[n] = s : e.set(t, { [n]: s }), s;
702
- }, ya = (e, t) => {
703
- if (nn(e)) {
704
- let r = e.export({ format: "jwk" });
705
- return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? rn(r.k) : (Re || (Re = /* @__PURE__ */ new WeakMap()), it(Re, e, r, t));
706
- }
707
- return De(e) ? e.k ? we(e.k) : (Re || (Re = /* @__PURE__ */ new WeakMap()), it(Re, e, e, t, !0)) : e;
708
- }, Ea = (e, t) => {
709
- if (nn(e)) {
710
- let r = e.export({ format: "jwk" });
711
- return r.k ? rn(r.k) : (Ae || (Ae = /* @__PURE__ */ new WeakMap()), it(Ae, e, r, t));
712
- }
713
- return De(e) ? e.k ? we(e.k) : (Ae || (Ae = /* @__PURE__ */ new WeakMap()), it(Ae, e, e, t, !0)) : e;
714
- }, ba = { normalizePublicKey: ya, normalizePrivateKey: Ea }, be = (e, t, r = 0) => {
715
- r === 0 && (t.unshift(t.length), t.unshift(6));
716
- const n = e.indexOf(t[0], r);
717
- if (n === -1)
718
- return !1;
719
- const a = e.subarray(n, n + t.length);
720
- return a.length !== t.length ? !1 : a.every((o, s) => o === t[s]) || be(e, t, n + 1);
721
- }, mr = (e) => {
722
- switch (!0) {
723
- case be(e, [42, 134, 72, 206, 61, 3, 1, 7]):
724
- return "P-256";
725
- case be(e, [43, 129, 4, 0, 34]):
726
- return "P-384";
727
- case be(e, [43, 129, 4, 0, 35]):
728
- return "P-521";
729
- case be(e, [43, 101, 110]):
730
- return "X25519";
731
- case be(e, [43, 101, 111]):
732
- return "X448";
733
- case be(e, [43, 101, 112]):
734
- return "Ed25519";
735
- case be(e, [43, 101, 113]):
736
- return "Ed448";
737
- default:
738
- throw new ae("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
739
- }
740
- }, Sa = async (e, t, r, n, a) => {
741
- let o, s;
742
- const i = new Uint8Array(atob(r.replace(e, "")).split("").map((c) => c.charCodeAt(0)));
743
- switch (n) {
744
- case "PS256":
745
- case "PS384":
746
- case "PS512":
747
- o = { name: "RSA-PSS", hash: `SHA-${n.slice(-3)}` }, s = ["verify"];
748
- break;
749
- case "RS256":
750
- case "RS384":
751
- case "RS512":
752
- o = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${n.slice(-3)}` }, s = ["verify"];
753
- break;
754
- case "RSA-OAEP":
755
- case "RSA-OAEP-256":
756
- case "RSA-OAEP-384":
757
- case "RSA-OAEP-512":
758
- o = {
759
- name: "RSA-OAEP",
760
- hash: `SHA-${parseInt(n.slice(-3), 10) || 1}`
761
- }, s = ["encrypt", "wrapKey"];
762
- break;
763
- case "ES256":
764
- o = { name: "ECDSA", namedCurve: "P-256" }, s = ["verify"];
765
- break;
766
- case "ES384":
767
- o = { name: "ECDSA", namedCurve: "P-384" }, s = ["verify"];
768
- break;
769
- case "ES512":
770
- o = { name: "ECDSA", namedCurve: "P-521" }, s = ["verify"];
771
- break;
772
- case "ECDH-ES":
773
- case "ECDH-ES+A128KW":
774
- case "ECDH-ES+A192KW":
775
- case "ECDH-ES+A256KW": {
776
- const c = mr(i);
777
- o = c.startsWith("P-") ? { name: "ECDH", namedCurve: c } : { name: c }, s = [];
778
- break;
779
- }
780
- case "EdDSA":
781
- o = { name: mr(i) }, s = ["verify"];
782
- break;
783
- default:
784
- throw new ae('Invalid or unsupported "alg" (Algorithm) value');
785
- }
786
- return ut.subtle.importKey(t, i, o, !1, s);
787
- }, wa = (e, t, r) => Sa(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
788
- async function Ta(e, t, r) {
789
- if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
790
- throw new TypeError('"spki" must be SPKI formatted string');
791
- return wa(e, t);
792
- }
793
- async function _a(e, t) {
794
- if (!Pe(e))
795
- throw new TypeError("JWK must be an object");
796
- switch (t || (t = e.alg), e.kty) {
797
- case "oct":
798
- if (typeof e.k != "string" || !e.k)
799
- throw new TypeError('missing "k" (Key Value) Parameter value');
800
- return we(e.k);
801
- case "RSA":
802
- if (e.oth !== void 0)
803
- throw new ae('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
804
- case "EC":
805
- case "OKP":
806
- return tn({ ...e, alg: t });
807
- default:
808
- throw new ae('Unsupported "kty" (Key Type) Parameter value');
809
- }
810
- }
811
- const Oe = (e) => e == null ? void 0 : e[Symbol.toStringTag], Vt = (e, t, r) => {
812
- var n, a;
813
- if (t.use !== void 0 && t.use !== "sig")
814
- throw new TypeError("Invalid key for this operation, when present its use must be sig");
815
- if (t.key_ops !== void 0 && ((a = (n = t.key_ops).includes) == null ? void 0 : a.call(n, r)) !== !0)
816
- throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${r}`);
817
- if (t.alg !== void 0 && t.alg !== e)
818
- throw new TypeError(`Invalid key for this operation, when present its alg must be ${e}`);
819
- return !0;
820
- }, Ia = (e, t, r, n) => {
821
- if (!(t instanceof Uint8Array)) {
822
- if (n && De(t)) {
823
- if (pa(t) && Vt(e, t, r))
824
- return;
825
- throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present');
826
- }
827
- if (!en(t))
828
- throw new TypeError(Zr(e, t, ...st, "Uint8Array", n ? "JSON Web Key" : null));
829
- if (t.type !== "secret")
830
- throw new TypeError(`${Oe(t)} instances for symmetric algorithms must be of type "secret"`);
831
- }
832
- }, Aa = (e, t, r, n) => {
833
- if (n && De(t))
834
- switch (r) {
835
- case "sign":
836
- if (ha(t) && Vt(e, t, r))
837
- return;
838
- throw new TypeError("JSON Web Key for this operation be a private JWK");
839
- case "verify":
840
- if (ma(t) && Vt(e, t, r))
841
- return;
842
- throw new TypeError("JSON Web Key for this operation be a public JWK");
843
- }
844
- if (!en(t))
845
- throw new TypeError(Zr(e, t, ...st, n ? "JSON Web Key" : null));
846
- if (t.type === "secret")
847
- throw new TypeError(`${Oe(t)} instances for asymmetric algorithms must not be of type "secret"`);
848
- if (r === "sign" && t.type === "public")
849
- throw new TypeError(`${Oe(t)} instances for asymmetric algorithm signing must be of type "private"`);
850
- if (r === "decrypt" && t.type === "public")
851
- throw new TypeError(`${Oe(t)} instances for asymmetric algorithm decryption must be of type "private"`);
852
- if (t.algorithm && r === "verify" && t.type === "private")
853
- throw new TypeError(`${Oe(t)} instances for asymmetric algorithm verifying must be of type "public"`);
854
- if (t.algorithm && r === "encrypt" && t.type === "private")
855
- throw new TypeError(`${Oe(t)} instances for asymmetric algorithm encryption must be of type "public"`);
856
- };
857
- function an(e, t, r, n) {
858
- t.startsWith("HS") || t === "dir" || t.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(t) ? Ia(t, r, n, e) : Aa(t, r, n, e);
859
- }
860
- an.bind(void 0, !1);
861
- const pr = an.bind(void 0, !0);
862
- function Ra(e, t, r, n, a) {
863
- if (a.crit !== void 0 && (n == null ? void 0 : n.crit) === void 0)
864
- throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
865
- if (!n || n.crit === void 0)
866
- return /* @__PURE__ */ new Set();
867
- if (!Array.isArray(n.crit) || n.crit.length === 0 || n.crit.some((s) => typeof s != "string" || s.length === 0))
868
- throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
869
- let o;
870
- r !== void 0 ? o = new Map([...Object.entries(r), ...t.entries()]) : o = t;
871
- for (const s of n.crit) {
872
- if (!o.has(s))
873
- throw new ae(`Extension Header Parameter "${s}" is not recognized`);
874
- if (a[s] === void 0)
875
- throw new e(`Extension Header Parameter "${s}" is missing`);
876
- if (o.get(s) && n[s] === void 0)
877
- throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`);
878
- }
879
- return new Set(n.crit);
880
- }
881
- const va = (e, t) => {
882
- if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
883
- throw new TypeError(`"${e}" option must be an array of strings`);
884
- if (t)
885
- return new Set(t);
886
- };
887
- function ka(e, t) {
888
- const r = `SHA-${e.slice(-3)}`;
889
- switch (e) {
890
- case "HS256":
891
- case "HS384":
892
- case "HS512":
893
- return { hash: r, name: "HMAC" };
894
- case "PS256":
895
- case "PS384":
896
- case "PS512":
897
- return { hash: r, name: "RSA-PSS", saltLength: e.slice(-3) >> 3 };
898
- case "RS256":
899
- case "RS384":
900
- case "RS512":
901
- return { hash: r, name: "RSASSA-PKCS1-v1_5" };
902
- case "ES256":
903
- case "ES384":
904
- case "ES512":
905
- return { hash: r, name: "ECDSA", namedCurve: t.namedCurve };
906
- case "EdDSA":
907
- return { name: t.name };
908
- default:
909
- throw new ae(`alg ${e} is not supported either by JOSE or your javascript runtime`);
910
- }
911
- }
912
- async function Ca(e, t, r) {
913
- if (t = await ba.normalizePublicKey(t, e), qr(t))
914
- return la(t, e, r), t;
915
- if (t instanceof Uint8Array) {
916
- if (!e.startsWith("HS"))
917
- throw new TypeError(hr(t, ...st));
918
- return ut.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
919
- }
920
- throw new TypeError(hr(t, ...st, "Uint8Array", "JSON Web Key"));
921
- }
922
- const Na = async (e, t, r, n) => {
923
- const a = await Ca(e, t, "verify");
924
- fa(e, a);
925
- const o = ka(e, a.algorithm);
926
- try {
927
- return await ut.subtle.verify(o, a, r, n);
928
- } catch {
929
- return !1;
930
- }
931
- };
932
- async function Oa(e, t, r) {
933
- if (!Pe(e))
934
- throw new H("Flattened JWS must be an object");
935
- if (e.protected === void 0 && e.header === void 0)
936
- throw new H('Flattened JWS must have either of the "protected" or "header" members');
937
- if (e.protected !== void 0 && typeof e.protected != "string")
938
- throw new H("JWS Protected Header incorrect type");
939
- if (e.payload === void 0)
940
- throw new H("JWS Payload missing");
941
- if (typeof e.signature != "string")
942
- throw new H("JWS Signature missing or incorrect type");
943
- if (e.header !== void 0 && !Pe(e.header))
944
- throw new H("JWS Unprotected Header incorrect type");
945
- let n = {};
946
- if (e.protected)
947
- try {
948
- const p = we(e.protected);
949
- n = JSON.parse(Ve.decode(p));
950
- } catch {
951
- throw new H("JWS Protected Header is invalid");
952
- }
953
- if (!da(n, e.header))
954
- throw new H("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
955
- const a = {
956
- ...n,
957
- ...e.header
958
- }, o = Ra(H, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, n, a);
959
- let s = !0;
960
- if (o.has("b64") && (s = n.b64, typeof s != "boolean"))
961
- throw new H('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
962
- const { alg: i } = a;
963
- if (typeof i != "string" || !i)
964
- throw new H('JWS "alg" (Algorithm) Header Parameter missing or invalid');
965
- const c = va("algorithms", r.algorithms);
966
- if (c && !c.has(i))
967
- throw new zr('"alg" (Algorithm) Header Parameter value not allowed');
968
- if (s) {
969
- if (typeof e.payload != "string")
970
- throw new H("JWS Payload must be a string");
971
- } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
972
- throw new H("JWS Payload must be a string or an Uint8Array instance");
973
- let m = !1;
974
- typeof t == "function" ? (t = await t(n, e), m = !0, pr(i, t, "verify"), De(t) && (t = await _a(t, i))) : pr(i, t, "verify");
975
- const f = Qn(Ye.encode(e.protected ?? ""), Ye.encode("."), typeof e.payload == "string" ? Ye.encode(e.payload) : e.payload);
976
- let u;
977
- try {
978
- u = we(e.signature);
979
- } catch {
980
- throw new H("Failed to base64url decode the signature");
981
- }
982
- if (!await Na(i, t, u, f))
983
- throw new Xr();
984
- let l;
985
- if (s)
986
- try {
987
- l = we(e.payload);
988
- } catch {
989
- throw new H("Failed to base64url decode the payload");
990
- }
991
- else typeof e.payload == "string" ? l = Ye.encode(e.payload) : l = e.payload;
992
- const d = { payload: l };
993
- return e.protected !== void 0 && (d.protectedHeader = n), e.header !== void 0 && (d.unprotectedHeader = e.header), m ? { ...d, key: t } : d;
994
- }
995
- async function xa(e, t, r) {
996
- if (e instanceof Uint8Array && (e = Ve.decode(e)), typeof e != "string")
997
- throw new H("Compact JWS must be a string or Uint8Array");
998
- const { 0: n, 1: a, 2: o, length: s } = e.split(".");
999
- if (s !== 3)
1000
- throw new H("Invalid Compact JWS");
1001
- const i = await Oa({ payload: a, protected: n, signature: o }, t, r), c = { payload: i.payload, protectedHeader: i.protectedHeader };
1002
- return typeof t == "function" ? { ...c, key: i.key } : c;
1003
- }
1004
- const Pa = (e) => Math.floor(e.getTime() / 1e3), on = 60, sn = on * 60, tr = sn * 24, Da = tr * 7, La = tr * 365.25, $a = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, gr = (e) => {
1005
- const t = $a.exec(e);
1006
- if (!t || t[4] && t[1])
1007
- throw new TypeError("Invalid time period format");
1008
- const r = parseFloat(t[2]), n = t[3].toLowerCase();
1009
- let a;
1010
- switch (n) {
1011
- case "sec":
1012
- case "secs":
1013
- case "second":
1014
- case "seconds":
1015
- case "s":
1016
- a = Math.round(r);
1017
- break;
1018
- case "minute":
1019
- case "minutes":
1020
- case "min":
1021
- case "mins":
1022
- case "m":
1023
- a = Math.round(r * on);
1024
- break;
1025
- case "hour":
1026
- case "hours":
1027
- case "hr":
1028
- case "hrs":
1029
- case "h":
1030
- a = Math.round(r * sn);
1031
- break;
1032
- case "day":
1033
- case "days":
1034
- case "d":
1035
- a = Math.round(r * tr);
1036
- break;
1037
- case "week":
1038
- case "weeks":
1039
- case "w":
1040
- a = Math.round(r * Da);
1041
- break;
1042
- default:
1043
- a = Math.round(r * La);
1044
- break;
1045
- }
1046
- return t[1] === "-" || t[4] === "ago" ? -a : a;
1047
- }, yr = (e) => e.toLowerCase().replace(/^application\//, ""), Ua = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, Ma = (e, t, r = {}) => {
1048
- let n;
1049
- try {
1050
- n = JSON.parse(Ve.decode(t));
1051
- } catch {
1052
- }
1053
- if (!Pe(n))
1054
- throw new ie("JWT Claims Set must be a top-level JSON object");
1055
- const { typ: a } = r;
1056
- if (a && (typeof e.typ != "string" || yr(e.typ) !== yr(a)))
1057
- throw new ne('unexpected "typ" JWT header value', n, "typ", "check_failed");
1058
- const { requiredClaims: o = [], issuer: s, subject: i, audience: c, maxTokenAge: m } = r, f = [...o];
1059
- m !== void 0 && f.push("iat"), c !== void 0 && f.push("aud"), i !== void 0 && f.push("sub"), s !== void 0 && f.push("iss");
1060
- for (const p of new Set(f.reverse()))
1061
- if (!(p in n))
1062
- throw new ne(`missing required "${p}" claim`, n, p, "missing");
1063
- if (s && !(Array.isArray(s) ? s : [s]).includes(n.iss))
1064
- throw new ne('unexpected "iss" claim value', n, "iss", "check_failed");
1065
- if (i && n.sub !== i)
1066
- throw new ne('unexpected "sub" claim value', n, "sub", "check_failed");
1067
- if (c && !Ua(n.aud, typeof c == "string" ? [c] : c))
1068
- throw new ne('unexpected "aud" claim value', n, "aud", "check_failed");
1069
- let u;
1070
- switch (typeof r.clockTolerance) {
1071
- case "string":
1072
- u = gr(r.clockTolerance);
1073
- break;
1074
- case "number":
1075
- u = r.clockTolerance;
1076
- break;
1077
- case "undefined":
1078
- u = 0;
1079
- break;
1080
- default:
1081
- throw new TypeError("Invalid clockTolerance option type");
1082
- }
1083
- const { currentDate: l } = r, d = Pa(l || /* @__PURE__ */ new Date());
1084
- if ((n.iat !== void 0 || m) && typeof n.iat != "number")
1085
- throw new ne('"iat" claim must be a number', n, "iat", "invalid");
1086
- if (n.nbf !== void 0) {
1087
- if (typeof n.nbf != "number")
1088
- throw new ne('"nbf" claim must be a number', n, "nbf", "invalid");
1089
- if (n.nbf > d + u)
1090
- throw new ne('"nbf" claim timestamp check failed', n, "nbf", "check_failed");
1091
- }
1092
- if (n.exp !== void 0) {
1093
- if (typeof n.exp != "number")
1094
- throw new ne('"exp" claim must be a number', n, "exp", "invalid");
1095
- if (n.exp <= d - u)
1096
- throw new Kt('"exp" claim timestamp check failed', n, "exp", "check_failed");
1097
- }
1098
- if (m) {
1099
- const p = d - n.iat, y = typeof m == "number" ? m : gr(m);
1100
- if (p - u > y)
1101
- throw new Kt('"iat" claim timestamp check failed (too far in the past)', n, "iat", "check_failed");
1102
- if (p < 0 - u)
1103
- throw new ne('"iat" claim timestamp check failed (it should be in the past)', n, "iat", "check_failed");
1104
- }
1105
- return n;
1106
- };
1107
- async function Ha(e, t, r) {
1108
- var n;
1109
- const a = await xa(e, t, r);
1110
- if ((n = a.protectedHeader.crit) != null && n.includes("b64") && a.protectedHeader.b64 === !1)
1111
- throw new ie("JWTs MUST NOT use unencoded payload");
1112
- const o = { payload: Ma(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
1113
- return typeof t == "function" ? { ...o, key: a.key } : o;
1114
- }
1115
- const Ka = we;
1116
- function Va(e) {
1117
- if (typeof e != "string")
1118
- throw new ie("JWTs must use Compact JWS serialization, JWT must be a string");
1119
- const { 1: t, length: r } = e.split(".");
1120
- if (r === 5)
1121
- throw new ie("Only JWTs using Compact JWS serialization can be decoded");
1122
- if (r !== 3)
1123
- throw new ie("Invalid JWT");
1124
- if (!t)
1125
- throw new ie("JWTs must contain a payload");
1126
- let n;
1127
- try {
1128
- n = Ka(t);
1129
- } catch {
1130
- throw new ie("Failed to base64url decode the payload");
1131
- }
1132
- let a;
1133
- try {
1134
- a = JSON.parse(Ve.decode(n));
1135
- } catch {
1136
- throw new ie("Failed to parse the decoded payload as JSON");
1137
- }
1138
- if (!Pe(a))
1139
- throw new ie("Invalid JWT Claims Set");
1140
- return a;
1141
- }
1142
- const Me = async (e) => {
1143
- try {
1144
- const t = F.ALG, r = await Ta(Xn, t);
1145
- return await Ha(e, r, {
1146
- issuer: F.ISSUER
1147
- });
1148
- } catch {
1149
- return;
1150
- }
1151
- }, Wa = (e) => {
1152
- try {
1153
- return Va(e);
1154
- } catch {
1155
- return;
1156
- }
1157
- }, G = [];
1158
- for (let e = 0; e < 256; ++e)
1159
- G.push((e + 256).toString(16).slice(1));
1160
- function Ga(e, t = 0) {
1161
- return (G[e[t + 0]] + G[e[t + 1]] + G[e[t + 2]] + G[e[t + 3]] + "-" + G[e[t + 4]] + G[e[t + 5]] + "-" + G[e[t + 6]] + G[e[t + 7]] + "-" + G[e[t + 8]] + G[e[t + 9]] + "-" + G[e[t + 10]] + G[e[t + 11]] + G[e[t + 12]] + G[e[t + 13]] + G[e[t + 14]] + G[e[t + 15]]).toLowerCase();
1162
- }
1163
- let At;
1164
- const Ba = new Uint8Array(16);
1165
- function Fa() {
1166
- if (!At) {
1167
- if (typeof crypto > "u" || !crypto.getRandomValues)
1168
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1169
- At = crypto.getRandomValues.bind(crypto);
1170
- }
1171
- return At(Ba);
1172
- }
1173
- const Ja = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), Er = { randomUUID: Ja };
1174
- function br(e, t, r) {
1175
- if (Er.randomUUID && !e)
1176
- return Er.randomUUID();
1177
- e = e || {};
1178
- const n = e.random || (e.rng || Fa)();
1179
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Ga(n);
1180
- }
1181
- const Sr = globalThis.crypto, Ya = (e) => `${br()}${br()}`.slice(0, e), ja = (e) => btoa(
1182
- [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1183
- );
1184
- async function qa(e) {
1185
- if (!Sr.subtle)
1186
- throw new Error(
1187
- "crypto.subtle is available only in secure contexts (HTTPS)."
1188
- );
1189
- const t = new TextEncoder().encode(e), r = await Sr.subtle.digest("SHA-256", t);
1190
- return ja(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1191
- }
1192
- async function za(e) {
1193
- const t = Ya(43), r = await qa(t);
1194
- return {
1195
- code_verifier: t,
1196
- code_challenge: r
1197
- };
1198
- }
1199
- function cn(e, t) {
1200
- window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1201
- }
1202
- const wr = (e, t) => {
1203
- const r = JSON.stringify(
1204
- typeof t == "function" ? t() : t
1205
- );
1206
- window.localStorage.setItem(e, r), cn(e, r);
1207
- }, Xa = (e) => {
1208
- window.localStorage.removeItem(e), cn(e, null);
1209
- }, Tr = (e) => window.localStorage.getItem(e), Qa = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1210
- function qe({
1211
- key: e,
1212
- initialValue: t
1213
- }) {
1214
- const r = Mn(Qa, () => Tr(e)), n = re(
1215
- (s) => {
1216
- try {
1217
- const i = typeof s == "function" ? s(JSON.parse(r)) : s;
1218
- i == null ? Xa(e) : wr(e, i);
1219
- } catch (i) {
1220
- console.warn(i);
1221
- }
1222
- },
1223
- [e, r]
1224
- ), a = re(() => {
1225
- n(t);
1226
- }, [t, n]), o = re(() => {
1227
- n(null);
1228
- }, [n]);
1229
- return oe(() => {
1230
- try {
1231
- Tr(e) === null && typeof t < "u" && wr(e, t);
1232
- } catch (s) {
1233
- console.warn(s);
1234
- }
1235
- }, [e, t]), [r ? JSON.parse(r) : null, n, a, o];
1236
- }
1237
- const B = [];
1238
- for (let e = 0; e < 256; ++e)
1239
- B.push((e + 256).toString(16).slice(1));
1240
- function Za(e, t = 0) {
1241
- return (B[e[t + 0]] + B[e[t + 1]] + B[e[t + 2]] + B[e[t + 3]] + "-" + B[e[t + 4]] + B[e[t + 5]] + "-" + B[e[t + 6]] + B[e[t + 7]] + "-" + B[e[t + 8]] + B[e[t + 9]] + "-" + B[e[t + 10]] + B[e[t + 11]] + B[e[t + 12]] + B[e[t + 13]] + B[e[t + 14]] + B[e[t + 15]]).toLowerCase();
1242
- }
1243
- let Rt;
1244
- const eo = new Uint8Array(16);
1245
- function to() {
1246
- if (!Rt) {
1247
- if (typeof crypto > "u" || !crypto.getRandomValues)
1248
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1249
- Rt = crypto.getRandomValues.bind(crypto);
1250
- }
1251
- return Rt(eo);
1252
- }
1253
- const ro = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), _r = { randomUUID: ro };
1254
- function vt(e, t, r) {
1255
- if (_r.randomUUID && !e)
1256
- return _r.randomUUID();
1257
- e = e || {};
1258
- const n = e.random || (e.rng || to)();
1259
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, Za(n);
1260
- }
1261
- const ve = "Your session has expired. For your security, please log in again to continue.", no = "Your session has been successfully terminated.", kt = "Login failed. Please try again.", ao = "Error getting access token, please re-authenticate.", oo = "You forgot to wrap your component in <AuthProvider>.", ze = "@@auth@@", $e = "LOADING", rt = "LOGIN", ln = "LOGOUT", We = "success", ue = "failure", dn = "include", un = "POST", fn = "application/json", Xe = {
1262
- GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1263
- $clientId: String!,
1264
- $username: String!,
1265
- $id: String!) {
1266
- getPasskeyRegistrationOptions(clientId: $clientId, username: $username, id: $id) {
1267
- challenge
1268
- rp {
1269
- id
1270
- name
1271
- }
1272
- user {
1273
- id
1274
- name
1275
- displayName
1276
- }
1277
- pubKeyCredParams {
1278
- type
1279
- alg
1280
- }
1281
- timeout
1282
- attestation
1283
- }
1284
- }`,
1285
- VERIFY_REGISTRATION: `mutation VerifyPasskeyRegistration(
1286
- $clientId: String!,
1287
- $username: String!,
1288
- $id: String!,
1289
- $registration: RegistrationOptionsInput!) {
1290
- verifyPasskeyRegistration(
1291
- clientId: $clientId,
1292
- username: $username,
1293
- id: $id,
1294
- registration: $registration) {
1295
- status
1296
- message
1297
- }
1298
- }`,
1299
- GET_AUTHENTICATION_OPTIONS: `mutation GetPasskeyAuthenticationOptions(
1300
- $id: String!,
1301
- $clientId: String!,
1302
- ) {
1303
- getPasskeyAuthenticationOptions(
1304
- id: $id,
1305
- clientId: $clientId) {
1306
- rpId,
1307
- challenge,
1308
- allowCredentials {
1309
- id,
1310
- type,
1311
- transports
1312
- }
1313
- timeout,
1314
- userVerification,
1315
- }
1316
- }`,
1317
- VERIFY_AUTHENTICATION: `mutation VerifyPasskeyAuthentication(
1318
- $clientId: String!,
1319
- $id: String!,
1320
- $authentication: AuthenticationOptionsInput!,
1321
- $nonce: String!,
1322
- $domain: String,
1323
- $sessionExpiration: String,
1324
- $ua: String) {
1325
- verifyPasskeyAuthentication(
1326
- clientId: $clientId,
1327
- id: $id,
1328
- authentication: $authentication,
1329
- nonce: $nonce,
1330
- domain: $domain,
1331
- sessionExpiration: $sessionExpiration,
1332
- ua: $ua) {
1333
- status,
1334
- idToken,
1335
- accessToken,
1336
- refreshToken,
1337
- userId,
1338
- username,
1339
- email
1340
- }
1341
- }`
1342
- }, ke = {
1343
- GET_REGISTRATION_OPTIONS: {
1344
- schema: Xe.GET_REGISTRATION_OPTIONS,
1345
- method: "getPasskeyRegistrationOptions"
1346
- },
1347
- VERIFY_REGISTRATION: {
1348
- schema: Xe.VERIFY_REGISTRATION,
1349
- method: "verifyPasskeyRegistration"
1350
- },
1351
- GET_AUTHENTICATION_OPTIONS: {
1352
- schema: Xe.GET_AUTHENTICATION_OPTIONS,
1353
- method: "getPasskeyAuthenticationOptions"
1354
- },
1355
- VERIFY_AUTHENTICATION: {
1356
- schema: Xe.VERIFY_AUTHENTICATION,
1357
- method: "verifyPasskeyAuthentication"
1358
- }
1359
- }, Ce = async ({
1360
- accessToken: e,
1361
- type: t,
1362
- clientId: r,
1363
- params: n = {},
1364
- endpoint: a
1365
- }) => {
1366
- try {
1367
- const o = `Bearer ${e}`, s = await fetch(`${a}/graphql`, {
1368
- credentials: dn,
1369
- method: un,
1370
- headers: {
1371
- authorization: o,
1372
- "Content-Type": fn,
1373
- [jr.CLIENT_ID]: `${r}`
1374
- },
1375
- body: JSON.stringify({
1376
- query: t.schema,
1377
- variables: n
1378
- })
1379
- });
1380
- if (s.status !== 200)
1381
- return { status: ue, data: [] };
1382
- const { data: i } = await s.json();
1383
- return {
1384
- status: We,
1385
- data: i[t.method]
1386
- };
1387
- } catch (o) {
1388
- return console.error(o), { status: ue, data: [] };
1389
- }
1390
- }, ft = async ({
1391
- type: e,
1392
- clientId: t,
1393
- params: r = {},
1394
- endpoint: n
1395
- }) => {
1396
- try {
1397
- const a = await fetch(`${n}/${e}`, {
1398
- credentials: dn,
1399
- method: un,
1400
- headers: {
1401
- "Content-Type": fn,
1402
- [jr.CLIENT_ID]: `${t}`
1403
- },
1404
- body: JSON.stringify(r)
1405
- });
1406
- if (a.status !== 200)
1407
- return { status: ue, data: [] };
1408
- const { data: o } = await a.json();
1409
- return {
1410
- status: We,
1411
- data: o || []
1412
- };
1413
- } catch (a) {
1414
- return console.error(a), { status: ue, data: [] };
1415
- }
1416
- }, so = process.env.NODE_ENV === "production", io = !so, hn = {
1417
- isLoading: !0,
1418
- isAuthenticated: !1,
1419
- user: void 0,
1420
- logoutReason: "",
1421
- debug: !1,
1422
- authenticationType: ""
1423
- }, co = (e) => {
1424
- try {
1425
- const t = Wa(e);
1426
- return t ? t[F.USER_ID_KEY] : "";
1427
- } catch {
1428
- return "";
1429
- }
1430
- }, lo = async ({
1431
- userId: e,
1432
- clientId: t,
1433
- domain: r,
1434
- idToken: n = "",
1435
- endpoint: a
1436
- }) => {
1437
- var o;
1438
- try {
1439
- return {
1440
- status: ((o = await ft({
1441
- endpoint: a,
1442
- type: dt.LOGOUT,
1443
- clientId: t,
1444
- params: {
1445
- userId: e,
1446
- domain: r,
1447
- idToken: n
1448
- }
1449
- })) == null ? void 0 : o.status) || ue
1450
- };
1451
- } catch {
1452
- return {
1453
- status: ue
1454
- };
1455
- }
1456
- }, uo = async ({
1457
- username: e,
1458
- password: t,
1459
- clientId: r,
1460
- nonce: n,
1461
- type: a,
1462
- sessionExpiration: o,
1463
- code: s,
1464
- code_verifier: i,
1465
- domain: c,
1466
- ua: m,
1467
- endpoint: f
1468
- }) => {
1469
- var u;
1470
- try {
1471
- const l = await ft({
1472
- endpoint: f,
1473
- type: dt.LOGIN,
1474
- clientId: r,
1475
- params: {
1476
- type: a || xe.ID_AND_ACCESS_TOKEN,
1477
- username: e,
1478
- password: t,
1479
- sessionExpiration: o,
1480
- nonce: n,
1481
- code: s,
1482
- code_verifier: i,
1483
- domain: c,
1484
- ua: m
1485
- }
1486
- }), d = await Me((u = l == null ? void 0 : l.data) == null ? void 0 : u.idToken);
1487
- return d && d.payload[F.USER_ID_KEY] !== "" && d.payload[F.NONCE_KEY] === n ? {
1488
- idToken: l.data.idToken,
1489
- accessToken: l.data.accessToken,
1490
- refreshToken: l.data.refreshToken,
1491
- userId: d.payload[F.USER_ID_KEY],
1492
- email: d.payload[F.EMAIL_KEY],
1493
- status: !0
1494
- } : {
1495
- status: !1
1496
- };
1497
- } catch {
1498
- return {
1499
- status: !1
1500
- };
1501
- }
1502
- }, fo = async ({
1503
- nonce: e,
1504
- clientId: t,
1505
- code_challenge: r,
1506
- endpoint: n
1507
- }) => {
1508
- var a;
1509
- try {
1510
- const o = await ft({
1511
- endpoint: n,
1512
- type: dt.CODE,
1513
- clientId: t,
1514
- params: {
1515
- type: xe.CODE,
1516
- nonce: e,
1517
- code_challenge: r
1518
- }
1519
- });
1520
- return (a = o == null ? void 0 : o.data) != null && a.code ? {
1521
- status: We,
1522
- data: o.data.code
1523
- } : {
1524
- status: ue,
1525
- data: ""
1526
- };
1527
- } catch {
1528
- return {
1529
- status: ue,
1530
- data: ""
1531
- };
1532
- }
1533
- }, ho = async ({
1534
- clientId: e,
1535
- userId: t,
1536
- nonce: r,
1537
- refreshToken: n,
1538
- accessToken: a,
1539
- domain: o,
1540
- endpoint: s
1541
- }) => {
1542
- var i;
1543
- try {
1544
- const c = await ft({
1545
- endpoint: s,
1546
- type: dt.REFRESH,
1547
- clientId: e,
1548
- params: {
1549
- type: xe.REFRESH_TOKEN,
1550
- userId: t,
1551
- nonce: r,
1552
- refreshToken: n,
1553
- accessToken: a,
1554
- domain: o
1555
- }
1556
- }), m = await Me((i = c == null ? void 0 : c.data) == null ? void 0 : i.accessToken);
1557
- return m && m.payload[F.USER_ID_KEY] !== "" && m.payload[F.NONCE_KEY] === r ? {
1558
- accessToken: c.data.accessToken,
1559
- refreshToken: c.data.refreshToken,
1560
- userId: m.payload[F.USER_ID_KEY],
1561
- status: !0
1562
- } : {
1563
- status: !1
1564
- };
1565
- } catch {
1566
- return {
1567
- status: !1
1568
- };
1569
- }
1570
- };
1571
- class mo {
1572
- constructor(t = null, r = null) {
1573
- Tt(this, "refreshTokenPromise", null), Tt(this, "accessToken"), Tt(this, "refreshToken"), this.accessToken = t || "", this.refreshToken = r || "";
1574
- }
1575
- async refreshtoken({
1576
- clientId: t,
1577
- userId: r,
1578
- nonce: n,
1579
- domain: a,
1580
- endpoint: o
1581
- }) {
1582
- this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
1583
- endpoint: o,
1584
- clientId: t,
1585
- userId: r,
1586
- nonce: n,
1587
- domain: a
1588
- }));
1589
- try {
1590
- return await this.refreshTokenPromise;
1591
- } finally {
1592
- this.refreshTokenPromise = null;
1593
- }
1594
- }
1595
- async _refreshToken({
1596
- endpoint: t,
1597
- clientId: r,
1598
- userId: n,
1599
- nonce: a,
1600
- domain: o
1601
- }) {
1602
- const s = await Me(this.refreshToken);
1603
- if (s && s.payload[F.USER_ID_KEY] !== "") {
1604
- const i = await ho({
1605
- endpoint: t,
1606
- clientId: r,
1607
- userId: n,
1608
- nonce: a,
1609
- refreshToken: this.refreshToken,
1610
- accessToken: this.accessToken,
1611
- domain: o
1612
- });
1613
- return i.status ? (this.accessToken = i.accessToken, this.refreshToken = i.refreshToken, {
1614
- status: We,
1615
- newAccessToken: i.accessToken,
1616
- newRefreshToken: i.refreshToken
1617
- }) : {
1618
- status: ue
1619
- };
1620
- } else
1621
- return {
1622
- status: ue
1623
- };
1624
- }
1625
- }
1626
- const po = (e) => re(
1627
- (...t) => {
1628
- e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1629
- },
1630
- [e]
1631
- ), Ne = () => {
1632
- throw new Error(oo);
1633
- }, mn = Vr({
1634
- isAuthenticated: !1,
1635
- isLoading: !1,
1636
- login: Ne,
1637
- logout: Ne,
1638
- getAccessToken: Ne,
1639
- getIdToken: Ne,
1640
- registeringForPasskey: Ne,
1641
- loginWithPasskey: Ne,
1642
- logoutReason: "",
1643
- authenticationType: ""
1644
- }), go = Z.createContext({
1645
- state: hn,
1646
- dispatch: () => {
1647
- }
1648
- }), yo = (e, t) => (t == null ? void 0 : t.type) === $e ? {
1649
- ...e,
1650
- isLoading: t.payload.isLoading
1651
- } : (t == null ? void 0 : t.type) === rt ? {
1652
- ...e,
1653
- isLoading: !1,
1654
- isAuthenticated: !0,
1655
- user: t.payload.user,
1656
- authenticationType: t.payload.authenticationType,
1657
- logoutReason: ""
1658
- } : (t == null ? void 0 : t.type) === ln ? {
1659
- ...e,
1660
- isLoading: !1,
1661
- isAuthenticated: !1,
1662
- user: void 0,
1663
- authenticationType: "",
1664
- logoutReason: t.payload.logoutReason
1665
- } : e, Ir = ({
1666
- children: e,
1667
- sessionExpiration: t,
1668
- clientId: r,
1669
- domain: n = "",
1670
- debug: a = !1,
1671
- endpoint: o = io ? "https://auth.gizmette.local.com:3003" : "https://mylogin.gizmette.com/auth"
1672
- }) => {
1673
- const [s, i] = Wr(yo, {
1674
- ...hn,
1675
- debug: a
1676
- }), c = po(a), m = x(!1), [f, u, , l] = qe({
1677
- key: `${ze}::${r}::@@user@@`
1678
- }), [d, p, , y] = qe({
1679
- key: `${ze}::${r}::@@access@@`
1680
- }), [w, g, , $] = qe(
1681
- {
1682
- key: `${ze}::${r}::@@refresh@@`
1683
- }
1684
- ), [U, K, , I] = qe({
1685
- key: `${ze}::${r}::@@nonce@@`
1686
- }), D = new mo(d, w), M = re(() => {
1687
- c("removeLocalStorage: removing local storage"), l(), y(), $(), I();
1688
- }, [
1689
- y,
1690
- l,
1691
- I,
1692
- $,
1693
- c
1694
- ]), S = re(
1695
- (b) => {
1696
- c(
1697
- "removeStateAndLocalStorage: removing state and local storage with reason: ",
1698
- b
1699
- ), i({
1700
- type: ln,
1701
- payload: {
1702
- logoutReason: b || ve
1703
- }
1704
- }), M(), i({ type: $e, payload: { isLoading: !1 } });
1705
- },
1706
- [M, c]
1707
- ), v = re(
1708
- async (b) => {
1709
- c("invalidateAndLogout: invalidating and logging out");
1710
- const { user: k } = s, T = (k == null ? void 0 : k.userId) || co(f);
1711
- T || c(
1712
- "invalidateAndLogout: user cannot be identified, logging out without userId"
1713
- ), await lo({
1714
- userId: T,
1715
- clientId: r,
1716
- domain: n,
1717
- idToken: f,
1718
- endpoint: o
1719
- }), S(b || ve);
1720
- },
1721
- [
1722
- f,
1723
- s,
1724
- r,
1725
- n,
1726
- S,
1727
- c,
1728
- o
1729
- ]
1730
- );
1731
- oe(() => {
1732
- if (!m.current)
1733
- return s.isLoading && f !== null ? (async () => {
1734
- try {
1735
- const b = await Me(f);
1736
- b && b.payload[F.USER_ID_KEY] !== "" ? (c("useEffect: setting the authentication state"), i({
1737
- type: rt,
1738
- payload: {
1739
- authenticationType: b.payload[F.AUTH_TYPE_KEY],
1740
- user: {
1741
- userId: b.payload[F.USER_ID_KEY],
1742
- username: b.payload[F.USERNAME_KEY],
1743
- email: b.payload[F.EMAIL_KEY]
1744
- }
1745
- }
1746
- })) : (c("useEffect: invalid JWT, invalidating and logging out"), await v(ve));
1747
- } catch {
1748
- c(
1749
- "useEffect: exception validating JWT, invalidating and logging out"
1750
- ), await v(ve);
1751
- }
1752
- })() : (c("useEffect: setting the loading state to false"), i({ type: $e, payload: { isLoading: !1 } })), () => {
1753
- m.current = !0;
1754
- };
1755
- }, [s.isLoading, f, v, c]);
1756
- const P = async (b, k) => {
1757
- i({ type: $e, payload: { isLoading: !0 } }), M();
1758
- const T = vt();
1759
- K(T), c("login: Logging in with password");
1760
- const { code_verifier: fe, code_challenge: Et } = await za(), he = await fo({
1761
- endpoint: o,
1762
- nonce: T,
1763
- clientId: r,
1764
- code_challenge: Et
1765
- });
1766
- if (he.status) {
1767
- const X = await uo({
1768
- endpoint: o,
1769
- username: b,
1770
- password: k,
1771
- clientId: r,
1772
- sessionExpiration: t,
1773
- nonce: T,
1774
- type: xe.CODE,
1775
- code: he.data,
1776
- code_verifier: fe,
1777
- domain: n,
1778
- ua: navigator.userAgent
1779
- });
1780
- return X.status ? (u(X.idToken), p(X.accessToken), g(X.refreshToken), i({
1781
- type: rt,
1782
- payload: {
1783
- authenticationType: xe.CODE,
1784
- user: {
1785
- userId: X.userId,
1786
- username: b,
1787
- email: X.email
1788
- }
1789
- }
1790
- }), !0) : (S(kt), !1);
1791
- }
1792
- return !1;
1793
- }, A = async (b) => {
1794
- b == null || b.preventDefault(), await v(no);
1795
- }, O = async () => {
1796
- const { isAuthenticated: b, user: k } = s;
1797
- try {
1798
- if (b && k && k.userId) {
1799
- if (d) {
1800
- c("getAccessToken");
1801
- const fe = await Me(d);
1802
- if (fe && fe.payload[F.USER_ID_KEY] !== "")
1803
- return d;
1804
- }
1805
- c("getAccessToken: invalid access token, trying to refresh it");
1806
- const T = await D.refreshtoken({
1807
- endpoint: o,
1808
- clientId: r,
1809
- userId: k.userId,
1810
- nonce: U,
1811
- domain: n
1812
- });
1813
- return T.status && T.status === "success" && T.newAccessToken ? (p(T.newAccessToken), g(T.newRefreshToken), T.newAccessToken) : (c(
1814
- "getAccessToken: invalid refresh token, need to re-authenticate"
1815
- ), await v(ve), "");
1816
- }
1817
- return c(
1818
- "getAccessToken: user is not authenticated, cannot get access token"
1819
- ), await v(ve), "";
1820
- } catch {
1821
- return c(
1822
- "getAccessToken: exception occurred, invalidating and logging out"
1823
- ), await v(ao), "";
1824
- }
1825
- }, R = () => s.isAuthenticated && f ? f : "", V = async () => {
1826
- const { user: b } = s;
1827
- let k = await Ce({
1828
- endpoint: o,
1829
- accessToken: d,
1830
- clientId: r,
1831
- type: ke.GET_REGISTRATION_OPTIONS,
1832
- params: {
1833
- clientId: r,
1834
- id: b == null ? void 0 : b.userId,
1835
- username: b == null ? void 0 : b.username
1836
- }
1837
- });
1838
- if (k.status)
1839
- try {
1840
- const T = await Yn(k.data);
1841
- return k = await Ce({
1842
- endpoint: o,
1843
- accessToken: d,
1844
- clientId: r,
1845
- type: ke.VERIFY_REGISTRATION,
1846
- params: {
1847
- clientId: r,
1848
- id: b == null ? void 0 : b.userId,
1849
- username: b == null ? void 0 : b.username,
1850
- registration: T
1851
- }
1852
- }), !!(k.status && k.data.length > 0);
1853
- } catch {
1854
- return await Ce({
1855
- endpoint: o,
1856
- accessToken: d,
1857
- clientId: r,
1858
- type: ke.VERIFY_REGISTRATION,
1859
- params: {
1860
- clientId: r,
1861
- id: b == null ? void 0 : b.userId,
1862
- username: b == null ? void 0 : b.username,
1863
- registration: {}
1864
- }
1865
- }), !1;
1866
- }
1867
- return !1;
1868
- }, ee = async () => {
1869
- i({ type: $e, payload: { isLoading: !0 } }), M();
1870
- const b = vt();
1871
- K(b), c("loginWithPasskey");
1872
- const k = vt();
1873
- let T = await Ce({
1874
- endpoint: o,
1875
- accessToken: d,
1876
- clientId: r,
1877
- type: ke.GET_AUTHENTICATION_OPTIONS,
1878
- params: {
1879
- id: k,
1880
- clientId: r
1881
- }
1882
- });
1883
- if (T.status)
1884
- try {
1885
- const fe = await zn(T.data);
1886
- return T = await Ce({
1887
- endpoint: o,
1888
- accessToken: d,
1889
- clientId: r,
1890
- type: ke.VERIFY_AUTHENTICATION,
1891
- params: {
1892
- clientId: r,
1893
- id: k,
1894
- authentication: fe,
1895
- nonce: b,
1896
- domain: n,
1897
- sessionExpiration: t,
1898
- ua: navigator.userAgent
1899
- }
1900
- }), T.data.status === We ? (u(T.data.idToken), p(T.data.accessToken), g(T.data.refreshToken), i({
1901
- type: rt,
1902
- payload: {
1903
- authenticationType: xe.PASSKEY,
1904
- user: {
1905
- userId: T.data.userId,
1906
- username: T.data.username,
1907
- email: T.data.email
1908
- }
1909
- }
1910
- }), !0) : (S(kt), !1);
1911
- } catch {
1912
- return await Ce({
1913
- endpoint: o,
1914
- accessToken: d,
1915
- clientId: r,
1916
- type: ke.VERIFY_AUTHENTICATION,
1917
- params: {
1918
- clientId: r,
1919
- id: k,
1920
- authentication: {},
1921
- nonce: b,
1922
- domain: n,
1923
- sessionExpiration: t
1924
- }
1925
- }), S(kt), !1;
1926
- }
1927
- return !1;
1928
- };
1929
- return /* @__PURE__ */ h(go.Provider, { value: { state: s, dispatch: i }, children: /* @__PURE__ */ h(
1930
- mn.Provider,
1931
- {
1932
- value: {
1933
- ...s,
1934
- login: P,
1935
- logout: A,
1936
- getAccessToken: O,
1937
- getIdToken: R,
1938
- registeringForPasskey: V,
1939
- loginWithPasskey: ee
1940
- },
1941
- children: e
1942
- }
1943
- ) });
1944
- }, pn = (e = mn) => Zt(e), Oi = "user", xi = "assistant", Pi = "data", Di = "I'm having trouble right now. Please try again later.", Li = "OpenAI", $i = "OpenAI", Ui = "Anthropic", Mi = "action-search", Hi = "action-sort", Ki = "action-toggle-prompt", Vi = "action-reset-prompt", Wi = "sassy-saint-", Gi = "details", Bi = "search", Fi = "sort", Ji = "private-disclosure", Ar = "b44c68f0-e5b3-4a1d-a3e3-df8632b0223b", Yi = 10, ji = 30, qi = "av-prompt", zi = "av-prompt-editable", Xi = "size-5 sm:size-4", Qi = 30, Zi = 10, ec = 130;
1945
- var Qe = { exports: {} }, Ct = {};
1946
- /**
1947
- * @license React
1948
- * use-sync-external-store-shim.production.js
1949
- *
1950
- * Copyright (c) Meta Platforms, Inc. and affiliates.
1951
- *
1952
- * This source code is licensed under the MIT license found in the
1953
- * LICENSE file in the root directory of this source tree.
1954
- */
1955
- var Rr;
1956
- function Eo() {
1957
- if (Rr) return Ct;
1958
- Rr = 1;
1959
- var e = Z;
1960
- function t(u, l) {
1961
- return u === l && (u !== 0 || 1 / u === 1 / l) || u !== u && l !== l;
1962
- }
1963
- var r = typeof Object.is == "function" ? Object.is : t, n = e.useState, a = e.useEffect, o = e.useLayoutEffect, s = e.useDebugValue;
1964
- function i(u, l) {
1965
- var d = l(), p = n({ inst: { value: d, getSnapshot: l } }), y = p[0].inst, w = p[1];
1966
- return o(
1967
- function() {
1968
- y.value = d, y.getSnapshot = l, c(y) && w({ inst: y });
1969
- },
1970
- [u, d, l]
1971
- ), a(
1972
- function() {
1973
- return c(y) && w({ inst: y }), u(function() {
1974
- c(y) && w({ inst: y });
1975
- });
1976
- },
1977
- [u]
1978
- ), s(d), d;
1979
- }
1980
- function c(u) {
1981
- var l = u.getSnapshot;
1982
- u = u.value;
1983
- try {
1984
- var d = l();
1985
- return !r(u, d);
1986
- } catch {
1987
- return !0;
1988
- }
1989
- }
1990
- function m(u, l) {
1991
- return l();
1992
- }
1993
- var f = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? m : i;
1994
- return Ct.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : f, Ct;
1995
- }
1996
- var Nt = {};
1997
- /**
1998
- * @license React
1999
- * use-sync-external-store-shim.development.js
2000
- *
2001
- * Copyright (c) Meta Platforms, Inc. and affiliates.
2002
- *
2003
- * This source code is licensed under the MIT license found in the
2004
- * LICENSE file in the root directory of this source tree.
2005
- */
2006
- var vr;
2007
- function bo() {
2008
- return vr || (vr = 1, process.env.NODE_ENV !== "production" && function() {
2009
- function e(d, p) {
2010
- return d === p && (d !== 0 || 1 / d === 1 / p) || d !== d && p !== p;
2011
- }
2012
- function t(d, p) {
2013
- f || a.startTransition === void 0 || (f = !0, console.error(
2014
- "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
2015
- ));
2016
- var y = p();
2017
- if (!u) {
2018
- var w = p();
2019
- o(y, w) || (console.error(
2020
- "The result of getSnapshot should be cached to avoid an infinite loop"
2021
- ), u = !0);
2022
- }
2023
- w = s({
2024
- inst: { value: y, getSnapshot: p }
2025
- });
2026
- var g = w[0].inst, $ = w[1];
2027
- return c(
2028
- function() {
2029
- g.value = y, g.getSnapshot = p, r(g) && $({ inst: g });
2030
- },
2031
- [d, y, p]
2032
- ), i(
2033
- function() {
2034
- return r(g) && $({ inst: g }), d(function() {
2035
- r(g) && $({ inst: g });
2036
- });
2037
- },
2038
- [d]
2039
- ), m(y), y;
2040
- }
2041
- function r(d) {
2042
- var p = d.getSnapshot;
2043
- d = d.value;
2044
- try {
2045
- var y = p();
2046
- return !o(d, y);
2047
- } catch {
2048
- return !0;
2049
- }
2050
- }
2051
- function n(d, p) {
2052
- return p();
2053
- }
2054
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
2055
- var a = Z, o = typeof Object.is == "function" ? Object.is : e, s = a.useState, i = a.useEffect, c = a.useLayoutEffect, m = a.useDebugValue, f = !1, u = !1, l = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? n : t;
2056
- Nt.useSyncExternalStore = a.useSyncExternalStore !== void 0 ? a.useSyncExternalStore : l, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
2057
- }()), Nt;
2058
- }
2059
- var kr;
2060
- function So() {
2061
- return kr || (kr = 1, process.env.NODE_ENV === "production" ? Qe.exports = /* @__PURE__ */ Eo() : Qe.exports = /* @__PURE__ */ bo()), Qe.exports;
2062
- }
2063
- var wo = /* @__PURE__ */ So();
2064
- const gn = 0, yn = 1, En = 2, Cr = 3;
2065
- var Nr = Object.prototype.hasOwnProperty;
2066
- function Wt(e, t) {
2067
- var r, n;
2068
- if (e === t) return !0;
2069
- if (e && t && (r = e.constructor) === t.constructor) {
2070
- if (r === Date) return e.getTime() === t.getTime();
2071
- if (r === RegExp) return e.toString() === t.toString();
2072
- if (r === Array) {
2073
- if ((n = e.length) === t.length)
2074
- for (; n-- && Wt(e[n], t[n]); ) ;
2075
- return n === -1;
2076
- }
2077
- if (!r || typeof e == "object") {
2078
- n = 0;
2079
- for (r in e)
2080
- if (Nr.call(e, r) && ++n && !Nr.call(t, r) || !(r in t) || !Wt(e[r], t[r])) return !1;
2081
- return Object.keys(t).length === n;
2082
- }
2083
- }
2084
- return e !== e && t !== t;
2085
- }
2086
- const le = /* @__PURE__ */ new WeakMap(), Se = () => {
2087
- }, q = (
2088
- /*#__NOINLINE__*/
2089
- Se()
2090
- ), Gt = Object, _ = (e) => e === q, de = (e) => typeof e == "function", Te = (e, t) => ({
2091
- ...e,
2092
- ...t
2093
- }), bn = (e) => de(e.then), Ot = {}, Ze = {}, rr = "undefined", Ge = typeof window != rr, Bt = typeof document != rr, To = Ge && "Deno" in window, _o = () => Ge && typeof window.requestAnimationFrame != rr, Sn = (e, t) => {
2094
- const r = le.get(e);
2095
- return [
2096
- // Getter
2097
- () => !_(t) && e.get(t) || Ot,
2098
- // Setter
2099
- (n) => {
2100
- if (!_(t)) {
2101
- const a = e.get(t);
2102
- t in Ze || (Ze[t] = a), r[5](t, Te(a, n), a || Ot);
2103
- }
2104
- },
2105
- // Subscriber
2106
- r[6],
2107
- // Get server cache snapshot
2108
- () => !_(t) && t in Ze ? Ze[t] : !_(t) && e.get(t) || Ot
2109
- ];
2110
- };
2111
- let Ft = !0;
2112
- const Io = () => Ft, [Jt, Yt] = Ge && window.addEventListener ? [
2113
- window.addEventListener.bind(window),
2114
- window.removeEventListener.bind(window)
2115
- ] : [
2116
- Se,
2117
- Se
2118
- ], Ao = () => {
2119
- const e = Bt && document.visibilityState;
2120
- return _(e) || e !== "hidden";
2121
- }, Ro = (e) => (Bt && document.addEventListener("visibilitychange", e), Jt("focus", e), () => {
2122
- Bt && document.removeEventListener("visibilitychange", e), Yt("focus", e);
2123
- }), vo = (e) => {
2124
- const t = () => {
2125
- Ft = !0, e();
2126
- }, r = () => {
2127
- Ft = !1;
2128
- };
2129
- return Jt("online", t), Jt("offline", r), () => {
2130
- Yt("online", t), Yt("offline", r);
2131
- };
2132
- }, ko = {
2133
- isOnline: Io,
2134
- isVisible: Ao
2135
- }, Co = {
2136
- initFocus: Ro,
2137
- initReconnect: vo
2138
- }, Or = !Z.useId, He = !Ge || To, No = (e) => _o() ? window.requestAnimationFrame(e) : setTimeout(e, 1), xt = He ? oe : Ue, Pt = typeof navigator < "u" && navigator.connection, xr = !He && Pt && ([
2139
- "slow-2g",
2140
- "2g"
2141
- ].includes(Pt.effectiveType) || Pt.saveData), et = /* @__PURE__ */ new WeakMap(), Dt = (e, t) => Gt.prototype.toString.call(e) === `[object ${t}]`;
2142
- let Oo = 0;
2143
- const jt = (e) => {
2144
- const t = typeof e, r = Dt(e, "Date"), n = Dt(e, "RegExp"), a = Dt(e, "Object");
2145
- let o, s;
2146
- if (Gt(e) === e && !r && !n) {
2147
- if (o = et.get(e), o) return o;
2148
- if (o = ++Oo + "~", et.set(e, o), Array.isArray(e)) {
2149
- for (o = "@", s = 0; s < e.length; s++)
2150
- o += jt(e[s]) + ",";
2151
- et.set(e, o);
2152
- }
2153
- if (a) {
2154
- o = "#";
2155
- const i = Gt.keys(e).sort();
2156
- for (; !_(s = i.pop()); )
2157
- _(e[s]) || (o += s + ":" + jt(e[s]) + ",");
2158
- et.set(e, o);
2159
- }
2160
- } else
2161
- o = r ? e.toJSON() : t == "symbol" ? e.toString() : t == "string" ? JSON.stringify(e) : "" + e;
2162
- return o;
2163
- }, ht = (e) => {
2164
- if (de(e))
2165
- try {
2166
- e = e();
2167
- } catch {
2168
- e = "";
2169
- }
2170
- const t = e;
2171
- return e = typeof e == "string" ? e : (Array.isArray(e) ? e.length : e) ? jt(e) : "", [
2172
- e,
2173
- t
2174
- ];
2175
- };
2176
- let xo = 0;
2177
- const qt = () => ++xo;
2178
- async function wn(...e) {
2179
- const [t, r, n, a] = e, o = Te({
2180
- populateCache: !0,
2181
- throwOnError: !0
2182
- }, typeof a == "boolean" ? {
2183
- revalidate: a
2184
- } : a || {});
2185
- let s = o.populateCache;
2186
- const i = o.rollbackOnError;
2187
- let c = o.optimisticData;
2188
- const m = (l) => typeof i == "function" ? i(l) : i !== !1, f = o.throwOnError;
2189
- if (de(r)) {
2190
- const l = r, d = [], p = t.keys();
2191
- for (const y of p)
2192
- // Skip the special useSWRInfinite and useSWRSubscription keys.
2193
- !/^\$(inf|sub)\$/.test(y) && l(t.get(y)._k) && d.push(y);
2194
- return Promise.all(d.map(u));
2195
- }
2196
- return u(r);
2197
- async function u(l) {
2198
- const [d] = ht(l);
2199
- if (!d) return;
2200
- const [p, y] = Sn(t, d), [w, g, $, U] = le.get(t), K = () => {
2201
- const R = w[d];
2202
- return (de(o.revalidate) ? o.revalidate(p().data, l) : o.revalidate !== !1) && (delete $[d], delete U[d], R && R[0]) ? R[0](En).then(() => p().data) : p().data;
2203
- };
2204
- if (e.length < 3)
2205
- return K();
2206
- let I = n, D;
2207
- const M = qt();
2208
- g[d] = [
2209
- M,
2210
- 0
2211
- ];
2212
- const S = !_(c), v = p(), P = v.data, A = v._c, O = _(A) ? P : A;
2213
- if (S && (c = de(c) ? c(O, P) : c, y({
2214
- data: c,
2215
- _c: O
2216
- })), de(I))
2217
- try {
2218
- I = I(O);
2219
- } catch (R) {
2220
- D = R;
2221
- }
2222
- if (I && bn(I))
2223
- if (I = await I.catch((R) => {
2224
- D = R;
2225
- }), M !== g[d][0]) {
2226
- if (D) throw D;
2227
- return I;
2228
- } else D && S && m(D) && (s = !0, y({
2229
- data: O,
2230
- _c: q
2231
- }));
2232
- if (s && !D)
2233
- if (de(s)) {
2234
- const R = s(I, O);
2235
- y({
2236
- data: R,
2237
- error: q,
2238
- _c: q
2239
- });
2240
- } else
2241
- y({
2242
- data: I,
2243
- error: q,
2244
- _c: q
2245
- });
2246
- if (g[d][1] = qt(), Promise.resolve(K()).then(() => {
2247
- y({
2248
- _c: q
2249
- });
2250
- }), D) {
2251
- if (f) throw D;
2252
- return;
2253
- }
2254
- return I;
2255
- }
2256
- }
2257
- const Pr = (e, t) => {
2258
- for (const r in e)
2259
- e[r][0] && e[r][0](t);
2260
- }, Po = (e, t) => {
2261
- if (!le.has(e)) {
2262
- const r = Te(Co, t), n = {}, a = wn.bind(q, e);
2263
- let o = Se;
2264
- const s = {}, i = (f, u) => {
2265
- const l = s[f] || [];
2266
- return s[f] = l, l.push(u), () => l.splice(l.indexOf(u), 1);
2267
- }, c = (f, u, l) => {
2268
- e.set(f, u);
2269
- const d = s[f];
2270
- if (d)
2271
- for (const p of d)
2272
- p(u, l);
2273
- }, m = () => {
2274
- if (!le.has(e) && (le.set(e, [
2275
- n,
2276
- {},
2277
- {},
2278
- {},
2279
- a,
2280
- c,
2281
- i
2282
- ]), !He)) {
2283
- const f = r.initFocus(setTimeout.bind(q, Pr.bind(q, n, gn))), u = r.initReconnect(setTimeout.bind(q, Pr.bind(q, n, yn)));
2284
- o = () => {
2285
- f && f(), u && u(), le.delete(e);
2286
- };
2287
- }
2288
- };
2289
- return m(), [
2290
- e,
2291
- a,
2292
- m,
2293
- o
2294
- ];
2295
- }
2296
- return [
2297
- e,
2298
- le.get(e)[4]
2299
- ];
2300
- }, Do = (e, t, r, n, a) => {
2301
- const o = r.errorRetryCount, s = a.retryCount, i = ~~((Math.random() + 0.5) * (1 << (s < 8 ? s : 8))) * r.errorRetryInterval;
2302
- !_(o) && s > o || setTimeout(n, i, a);
2303
- }, Lo = Wt, [nr, $o] = Po(/* @__PURE__ */ new Map()), Uo = Te(
2304
- {
2305
- // events
2306
- onLoadingSlow: Se,
2307
- onSuccess: Se,
2308
- onError: Se,
2309
- onErrorRetry: Do,
2310
- onDiscarded: Se,
2311
- // switches
2312
- revalidateOnFocus: !0,
2313
- revalidateOnReconnect: !0,
2314
- revalidateIfStale: !0,
2315
- shouldRetryOnError: !0,
2316
- // timeouts
2317
- errorRetryInterval: xr ? 1e4 : 5e3,
2318
- focusThrottleInterval: 5 * 1e3,
2319
- dedupingInterval: 2 * 1e3,
2320
- loadingTimeout: xr ? 5e3 : 3e3,
2321
- // providers
2322
- compare: Lo,
2323
- isPaused: () => !1,
2324
- cache: nr,
2325
- mutate: $o,
2326
- fallback: {}
2327
- },
2328
- // use web preset by default
2329
- ko
2330
- ), Mo = (e, t) => {
2331
- const r = Te(e, t);
2332
- if (t) {
2333
- const { use: n, fallback: a } = e, { use: o, fallback: s } = t;
2334
- n && o && (r.use = n.concat(o)), a && s && (r.fallback = Te(a, s));
2335
- }
2336
- return r;
2337
- }, Ho = Vr({}), Ko = "$inf$", Tn = Ge && window.__SWR_DEVTOOLS_USE__, Vo = Tn ? window.__SWR_DEVTOOLS_USE__ : [], Wo = () => {
2338
- Tn && (window.__SWR_DEVTOOLS_REACT__ = Z);
2339
- }, Go = (e) => de(e[1]) ? [
2340
- e[0],
2341
- e[1],
2342
- e[2] || {}
2343
- ] : [
2344
- e[0],
2345
- null,
2346
- (e[1] === null ? e[2] : e[1]) || {}
2347
- ], Bo = () => Te(Uo, Zt(Ho)), _n = (e, t) => {
2348
- const [r, n] = ht(e), [, , , a] = le.get(nr);
2349
- if (a[r]) return a[r];
2350
- const o = t(n);
2351
- return a[r] = o, o;
2352
- }, Fo = (e) => (t, r, n) => e(t, r && ((...o) => {
2353
- const [s] = ht(t), [, , , i] = le.get(nr);
2354
- if (s.startsWith(Ko))
2355
- return r(...o);
2356
- const c = i[s];
2357
- return _(c) ? r(...o) : (delete i[s], c);
2358
- }), n), Jo = Vo.concat(Fo), Yo = (e) => function(...r) {
2359
- const n = Bo(), [a, o, s] = Go(r), i = Mo(n, s);
2360
- let c = e;
2361
- const { use: m } = i, f = (m || []).concat(Jo);
2362
- for (let u = f.length; u--; )
2363
- c = f[u](c);
2364
- return c(a, o || i.fetcher || null, i);
2365
- }, jo = (e, t, r) => {
2366
- const n = t[e] || (t[e] = []);
2367
- return n.push(r), () => {
2368
- const a = n.indexOf(r);
2369
- a >= 0 && (n[a] = n[n.length - 1], n.pop());
2370
- };
2371
- };
2372
- Wo();
2373
- const Lt = Z.use || // This extra generic is to avoid TypeScript mixing up the generic and JSX sytax
2374
- // and emitting an error.
2375
- // We assume that this is only for the `use(thenable)` case, not `use(context)`.
2376
- // https://github.com/facebook/react/blob/aed00dacfb79d17c53218404c52b1c7aa59c4a89/packages/react-server/src/ReactFizzThenable.js#L45
2377
- ((e) => {
2378
- switch (e.status) {
2379
- case "pending":
2380
- throw e;
2381
- case "fulfilled":
2382
- return e.value;
2383
- case "rejected":
2384
- throw e.reason;
2385
- default:
2386
- throw e.status = "pending", e.then((t) => {
2387
- e.status = "fulfilled", e.value = t;
2388
- }, (t) => {
2389
- e.status = "rejected", e.reason = t;
2390
- }), e;
2391
- }
2392
- }), $t = {
2393
- dedupe: !0
2394
- }, qo = (e, t, r) => {
2395
- const { cache: n, compare: a, suspense: o, fallbackData: s, revalidateOnMount: i, revalidateIfStale: c, refreshInterval: m, refreshWhenHidden: f, refreshWhenOffline: u, keepPreviousData: l } = r, [d, p, y, w] = le.get(n), [g, $] = ht(e), U = x(!1), K = x(!1), I = x(g), D = x(t), M = x(r), S = () => M.current, v = () => S().isVisible() && S().isOnline(), [P, A, O, R] = Sn(n, g), V = x({}).current, ee = _(s) ? _(r.fallback) ? q : r.fallback[g] : s, b = (C, N) => {
2396
- for (const J in V) {
2397
- const L = J;
2398
- if (L === "data") {
2399
- if (!a(C[L], N[L]) && (!_(C[L]) || !a(Je, N[L])))
2400
- return !1;
2401
- } else if (N[L] !== C[L])
2402
- return !1;
2403
- }
2404
- return !0;
2405
- }, k = Ke(() => {
2406
- const C = !g || !t ? !1 : _(i) ? S().isPaused() || o ? !1 : c !== !1 : i, N = (j) => {
2407
- const me = Te(j);
2408
- return delete me._k, C ? {
2409
- isValidating: !0,
2410
- isLoading: !0,
2411
- ...me
2412
- } : me;
2413
- }, J = P(), L = R(), se = N(J), Ie = J === L ? se : N(L);
2414
- let W = se;
2415
- return [
2416
- () => {
2417
- const j = N(P());
2418
- return b(j, W) ? (W.data = j.data, W.isLoading = j.isLoading, W.isValidating = j.isValidating, W.error = j.error, W) : (W = j, j);
2419
- },
2420
- () => Ie
2421
- ];
2422
- }, [
2423
- n,
2424
- g
2425
- ]), T = wo.useSyncExternalStore(re(
2426
- (C) => O(g, (N, J) => {
2427
- b(J, N) || C();
2428
- }),
2429
- // eslint-disable-next-line react-hooks/exhaustive-deps
2430
- [
2431
- n,
2432
- g
2433
- ]
2434
- ), k[0], k[1]), fe = !U.current, Et = d[g] && d[g].length > 0, he = T.data, X = _(he) ? ee && bn(ee) ? Lt(ee) : ee : he, Fe = T.error, bt = x(X), Je = l ? _(he) ? _(bt.current) ? X : bt.current : he : X, ir = Et && !_(Fe) ? !1 : fe && !_(i) ? i : S().isPaused() ? !1 : o ? _(X) ? !1 : c : _(X) || c, cr = !!(g && t && fe && ir), Ln = _(T.isValidating) ? cr : T.isValidating, $n = _(T.isLoading) ? cr : T.isLoading, Le = re(
2435
- async (C) => {
2436
- const N = D.current;
2437
- if (!g || !N || K.current || S().isPaused())
2438
- return !1;
2439
- let J, L, se = !0;
2440
- const Ie = C || {}, W = !y[g] || !Ie.dedupe, j = () => Or ? !K.current && g === I.current && U.current : g === I.current, me = {
2441
- isValidating: !1,
2442
- isLoading: !1
2443
- }, dr = () => {
2444
- A(me);
2445
- }, ur = () => {
2446
- const te = y[g];
2447
- te && te[1] === L && delete y[g];
2448
- }, fr = {
2449
- isValidating: !0
2450
- };
2451
- _(P().data) && (fr.isLoading = !0);
2452
- try {
2453
- if (W && (A(fr), r.loadingTimeout && _(P().data) && setTimeout(() => {
2454
- se && j() && S().onLoadingSlow(g, r);
2455
- }, r.loadingTimeout), y[g] = [
2456
- N($),
2457
- qt()
2458
- ]), [J, L] = y[g], J = await J, W && setTimeout(ur, r.dedupingInterval), !y[g] || y[g][1] !== L)
2459
- return W && j() && S().onDiscarded(g), !1;
2460
- me.error = q;
2461
- const te = p[g];
2462
- if (!_(te) && // case 1
2463
- (L <= te[0] || // case 2
2464
- L <= te[1] || // case 3
2465
- te[1] === 0))
2466
- return dr(), W && j() && S().onDiscarded(g), !1;
2467
- const pe = P().data;
2468
- me.data = a(pe, J) ? pe : J, W && j() && S().onSuccess(J, g, r);
2469
- } catch (te) {
2470
- ur();
2471
- const pe = S(), { shouldRetryOnError: St } = pe;
2472
- pe.isPaused() || (me.error = te, W && j() && (pe.onError(te, g, pe), (St === !0 || de(St) && St(te)) && (!S().revalidateOnFocus || !S().revalidateOnReconnect || v()) && pe.onErrorRetry(te, g, pe, (Un) => {
2473
- const wt = d[g];
2474
- wt && wt[0] && wt[0](Cr, Un);
2475
- }, {
2476
- retryCount: (Ie.retryCount || 0) + 1,
2477
- dedupe: !0
2478
- })));
2479
- }
2480
- return se = !1, dr(), !0;
2481
- },
2482
- // `setState` is immutable, and `eventsCallback`, `fnArg`, and
2483
- // `keyValidating` are depending on `key`, so we can exclude them from
2484
- // the deps array.
2485
- //
2486
- // FIXME:
2487
- // `fn` and `config` might be changed during the lifecycle,
2488
- // but they might be changed every render like this.
2489
- // `useSWR('key', () => fetch('/api/'), { suspense: true })`
2490
- // So we omit the values from the deps array
2491
- // even though it might cause unexpected behaviors.
2492
- // eslint-disable-next-line react-hooks/exhaustive-deps
2493
- [
2494
- g,
2495
- n
2496
- ]
2497
- ), lr = re(
2498
- // Use callback to make sure `keyRef.current` returns latest result every time
2499
- (...C) => wn(n, I.current, ...C),
2500
- // eslint-disable-next-line react-hooks/exhaustive-deps
2501
- []
2502
- );
2503
- if (xt(() => {
2504
- D.current = t, M.current = r, _(he) || (bt.current = he);
2505
- }), xt(() => {
2506
- if (!g) return;
2507
- const C = Le.bind(q, $t);
2508
- let N = 0;
2509
- const L = jo(g, d, (se, Ie = {}) => {
2510
- if (se == gn) {
2511
- const W = Date.now();
2512
- S().revalidateOnFocus && W > N && v() && (N = W + S().focusThrottleInterval, C());
2513
- } else if (se == yn)
2514
- S().revalidateOnReconnect && v() && C();
2515
- else {
2516
- if (se == En)
2517
- return Le();
2518
- if (se == Cr)
2519
- return Le(Ie);
2520
- }
2521
- });
2522
- return K.current = !1, I.current = g, U.current = !0, A({
2523
- _k: $
2524
- }), ir && (_(X) || He ? C() : No(C)), () => {
2525
- K.current = !0, L();
2526
- };
2527
- }, [
2528
- g
2529
- ]), xt(() => {
2530
- let C;
2531
- function N() {
2532
- const L = de(m) ? m(P().data) : m;
2533
- L && C !== -1 && (C = setTimeout(J, L));
2534
- }
2535
- function J() {
2536
- !P().error && (f || S().isVisible()) && (u || S().isOnline()) ? Le($t).then(N) : N();
2537
- }
2538
- return N(), () => {
2539
- C && (clearTimeout(C), C = -1);
2540
- };
2541
- }, [
2542
- m,
2543
- f,
2544
- u,
2545
- g
2546
- ]), Hn(Je), o && _(X) && g) {
2547
- if (!Or && He)
2548
- throw new Error("Fallback data is required when using Suspense in SSR.");
2549
- D.current = t, M.current = r, K.current = !1;
2550
- const C = w[g];
2551
- if (!_(C)) {
2552
- const N = lr(C);
2553
- Lt(N);
2554
- }
2555
- if (_(Fe)) {
2556
- const N = Le($t);
2557
- _(Je) || (N.status = "fulfilled", N.value = !0), Lt(N);
2558
- } else
2559
- throw Fe;
2560
- }
2561
- return {
2562
- mutate: lr,
2563
- get data() {
2564
- return V.data = !0, Je;
2565
- },
2566
- get error() {
2567
- return V.error = !0, Fe;
2568
- },
2569
- get isValidating() {
2570
- return V.isValidating = !0, Ln;
2571
- },
2572
- get isLoading() {
2573
- return V.isLoading = !0, $n;
2574
- }
2575
- };
2576
- }, zo = Yo(qo), ye = {
2577
- GET_LOCATION: `query GetLocation($latitude: Float!, $longitude: Float!) {
2578
- location(latitude: $latitude, longitude: $longitude) {
2579
- country
2580
- state
2581
- city
2582
- displayName
2583
- }
2584
- }`,
2585
- GET_CHATS: `query GetChats(
2586
- $user: String!,
2587
- $searchString: String,
2588
- $limit: Float,
2589
- $direction: String,
2590
- $truncateSize: Float) {
2591
- chats(
2592
- user: $user,
2593
- searchString: $searchString,
2594
- limit: $limit,
2595
- direction: $direction,
2596
- truncateSize: $truncateSize) {
2597
- timestamp
2598
- id
2599
- model
2600
- summary
2601
- messages {
2602
- content
2603
- }
2604
- }
2605
- }`,
2606
- GET_CHATS_STATS: `query GetChatsStats($user: String!) {
2607
- chatsStats(user: $user) {
2608
- totalChats
2609
- averageProcessingTimes
2610
- }
2611
- }`,
2612
- GET_CHAT: `query GetChatById($id: String!) {
2613
- chatById(id: $id) {
2614
- model
2615
- provider
2616
- summary
2617
- messages {
2618
- content
2619
- role
2620
- }
2621
- }
2622
- }`,
2623
- DELETE_CHAT: `mutation DeleteChat(
2624
- $id: String!,
2625
- $userId: String!) {
2626
- deleteChat(
2627
- id: $id,
2628
- user: $userId) {
2629
- id
2630
- }
2631
- }`,
2632
- SAVE_CHAT: `mutation SaveChat(
2633
- $id: String!,
2634
- $userId: String!,
2635
- $messages: [MessageIn],
2636
- $provider: String,
2637
- $usage: Float,
2638
- ) {
2639
- saveChat(
2640
- id: $id,
2641
- user: $userId,
2642
- messages: $messages,
2643
- provider: $provider,
2644
- usage: $usage) {
2645
- id
2646
- }
2647
- }`,
2648
- GET_SERVER_CAPABILITIES: `query GetServerCapabilities {
2649
- getServerCapabilities {
2650
- version
2651
- models
2652
- providers
2653
- runningMode
2654
- plans {
2655
- name
2656
- description
2657
- }
2658
- }
2659
- }`,
2660
- GET_USER_PREFERENCES: `query GetUserPreferences($user: String!) {
2661
- getUserPreferences(user: $user) {
2662
- instructions
2663
- location
2664
- provider
2665
- plan
2666
- tags {
2667
- enabled
2668
- slot
2669
- label
2670
- content
2671
- privateChat
2672
- clipboardAccess
2673
- description
2674
- }
2675
- }
2676
- }`,
2677
- SET_USER_PREFERENCES: `mutation SetUserPreferences(
2678
- $user: String!,
2679
- $instructions: String,
2680
- $location: String,
2681
- $provider: String,
2682
- $plan: String,
2683
- $tags: [TagIn]) {
2684
- setUserPreferences(
2685
- user: $user,
2686
- instructions: $instructions,
2687
- location: $location,
2688
- provider: $provider,
2689
- plan: $plan,
2690
- tags: $tags)
2691
- }`
2692
- }, Be = {
2693
- GET_LOCATION: {
2694
- schema: ye.GET_LOCATION,
2695
- method: "location"
2696
- },
2697
- GET_CHATS: {
2698
- schema: ye.GET_CHATS,
2699
- method: "chats"
2700
- },
2701
- GET_CHATS_STATS: {
2702
- schema: ye.GET_CHATS_STATS,
2703
- method: "chatsStats"
2704
- },
2705
- GET_CHAT: {
2706
- schema: ye.GET_CHAT,
2707
- method: "chatById"
2708
- },
2709
- DELETE_CHAT: {
2710
- schema: ye.DELETE_CHAT,
2711
- method: "deleteChat"
2712
- },
2713
- SAVE_CHAT: {
2714
- schema: ye.SAVE_CHAT,
2715
- method: "saveChat"
2716
- },
2717
- GET_SERVER_CAPABILITIES: {
2718
- schema: ye.GET_SERVER_CAPABILITIES,
2719
- method: "getServerCapabilities"
2720
- },
2721
- GET_USER_PREFERENCES: {
2722
- schema: ye.GET_USER_PREFERENCES,
2723
- method: "getUserPreferences"
2724
- },
2725
- SET_USER_PREFERENCES: {
2726
- schema: ye.SET_USER_PREFERENCES,
2727
- method: "setUserPreferences"
2728
- }
2729
- }, Xo = process.env.PUBLIC_SASSY_API_SERVER_URL, Dr = async ({
2730
- query: e,
2731
- data: t,
2732
- headers: r = {}
2733
- }) => await fetch(`${Xo}/graphql`, {
2734
- method: "POST",
2735
- credentials: "include",
2736
- headers: {
2737
- ...r,
2738
- "Content-Type": "application/json",
2739
- Accept: "application/json"
2740
- },
2741
- body: JSON.stringify({
2742
- query: e,
2743
- variables: t
2744
- })
2745
- }), zt = async (e) => {
2746
- var r;
2747
- const t = (r = e.type) != null && r.data ? e.type.data(e.params) : e.params;
2748
- try {
2749
- let n;
2750
- if (e.noAuth === !0)
2751
- n = await Dr({
2752
- query: e.type.schema,
2753
- data: t
2754
- });
2755
- else {
2756
- const s = `Bearer ${e.accessToken}`;
2757
- n = await Dr({
2758
- headers: {
2759
- authorization: s
2760
- },
2761
- query: e.type.schema,
2762
- data: t
2763
- });
2764
- }
2765
- if (n.status !== 200)
2766
- return { status: n.status, data: [] };
2767
- const { data: a, errors: o } = await n.json();
2768
- return {
2769
- status: n.status,
2770
- data: a[e.type.method],
2771
- errors: o
2772
- };
2773
- } catch (n) {
2774
- return console.error(n), { status: 500, data: [] };
2775
- }
2776
- }, tc = async ({
2777
- provider: e,
2778
- accessToken: t,
2779
- username: r
2780
- }) => {
2781
- try {
2782
- await zt({
2783
- accessToken: t,
2784
- type: Be.SET_USER_PREFERENCES,
2785
- params: {
2786
- user: r,
2787
- provider: e
2788
- }
2789
- });
2790
- } catch {
2791
- }
2792
- }, mt = ({
2793
- fetcher: e,
2794
- scope: t,
2795
- keys: r,
2796
- swrOptions: n,
2797
- getAccessToken: a
2798
- }) => {
2799
- const { data: o, error: s, isLoading: i, mutate: c } = zo(
2800
- [t, ...r],
2801
- (m) => e(m, a),
2802
- { ...n }
2803
- );
2804
- return { data: o, error: s, isLoading: i, mutate: c };
2805
- }, pt = async (e) => {
2806
- let t;
2807
- if (e.noAuth === !0)
2808
- t = await zt({
2809
- noAuth: !0,
2810
- type: e.type,
2811
- params: e.params
2812
- });
2813
- else {
2814
- const r = await e.getAccessToken();
2815
- t = await zt({
2816
- accessToken: r,
2817
- type: e.type,
2818
- params: e.params
2819
- });
2820
- }
2821
- if (t.status === 200 && t.errors === void 0)
2822
- return t.data;
2823
- throw new Error("An error occurred while fetching the data.");
2824
- }, Qo = async ([e, t], r) => pt({
2825
- getAccessToken: r,
2826
- type: Be.GET_USER_PREFERENCES,
2827
- params: {
2828
- user: t
2829
- }
2830
- }), rc = ({
2831
- keys: e,
2832
- getAccessToken: t,
2833
- isPaused: r = !1
2834
- }) => mt({
2835
- fetcher: Qo,
2836
- scope: "/preferences",
2837
- keys: e,
2838
- swrOptions: {
2839
- keepPreviousData: !0,
2840
- revalidateIfStale: r,
2841
- revalidateOnFocus: r,
2842
- revalidateOnReconnect: r
2843
- },
2844
- getAccessToken: t
2845
- }), Zo = async ([e, t], r) => pt({
2846
- getAccessToken: r,
2847
- type: Be.GET_CHATS_STATS,
2848
- params: {
2849
- user: t
2850
- }
2851
- }), nc = ({
2852
- keys: e,
2853
- getAccessToken: t
2854
- }) => mt({
2855
- fetcher: Zo,
2856
- scope: "/stats",
2857
- keys: e,
2858
- swrOptions: {
2859
- keepPreviousData: !0,
2860
- dedupingInterval: 1e4,
2861
- revalidateIfStale: !0,
2862
- revalidateOnFocus: !1,
2863
- revalidateOnReconnect: !0
2864
- },
2865
- getAccessToken: t
2866
- }), In = async ([e, t, r, n], a) => pt({
2867
- getAccessToken: a,
2868
- type: Be.GET_CHATS,
2869
- params: {
2870
- user: t,
2871
- searchString: r,
2872
- direction: n,
2873
- limit: 1,
2874
- truncateSize: 100
2875
- }
2876
- }), ac = ({
2877
- keys: e,
2878
- getAccessToken: t
2879
- }) => mt({
2880
- fetcher: In,
2881
- scope: "/history",
2882
- keys: e,
2883
- getAccessToken: t,
2884
- swrOptions: {
2885
- keepPreviousData: !0,
2886
- dedupingInterval: 5e3,
2887
- revalidateIfStale: !0,
2888
- revalidateOnFocus: !0,
2889
- revalidateOnReconnect: !0
2890
- }
2891
- }), oc = ({
2892
- keys: e,
2893
- getAccessToken: t
2894
- }) => {
2895
- _n(["/history", ...e], (r) => In(r, t));
2896
- }, An = async ([e]) => pt({
2897
- noAuth: !0,
2898
- type: Be.GET_SERVER_CAPABILITIES
2899
- }), sc = () => mt({
2900
- fetcher: An,
2901
- scope: "/capabilities",
2902
- keys: [],
2903
- getAccessToken: () => Promise.resolve("")
2904
- // No auth required
2905
- }), es = () => {
2906
- _n(["/capabilities"], (e) => An(e));
2907
- }, Lr = (e) => Number.isFinite(e) ? e : 0;
2908
- function ts(e) {
2909
- return {
2910
- days: Math.trunc(e / 864e5),
2911
- hours: Math.trunc(e / 36e5 % 24),
2912
- minutes: Math.trunc(e / 6e4 % 60),
2913
- seconds: Math.trunc(e / 1e3 % 60),
2914
- milliseconds: Math.trunc(e % 1e3),
2915
- microseconds: Math.trunc(Lr(e * 1e3) % 1e3),
2916
- nanoseconds: Math.trunc(Lr(e * 1e6) % 1e3)
2917
- };
2918
- }
2919
- function rs(e) {
2920
- return {
2921
- days: e / 86400000n,
2922
- hours: e / 3600000n % 24n,
2923
- minutes: e / 60000n % 60n,
2924
- seconds: e / 1000n % 60n,
2925
- milliseconds: e % 1000n,
2926
- microseconds: 0n,
2927
- nanoseconds: 0n
2928
- };
2929
- }
2930
- function ns(e) {
2931
- switch (typeof e) {
2932
- case "number": {
2933
- if (Number.isFinite(e))
2934
- return ts(e);
2935
- break;
2936
- }
2937
- case "bigint":
2938
- return rs(e);
2939
- }
2940
- throw new TypeError("Expected a finite number or bigint");
2941
- }
2942
- const as = (e) => e === 0 || e === 0n, os = (e, t) => t === 1 || t === 1n ? e : `${e}s`, ss = 1e-7, is = 24n * 60n * 60n * 1000n;
2943
- function cs(e, t) {
2944
- const r = typeof e == "bigint";
2945
- if (!r && !Number.isFinite(e))
2946
- throw new TypeError("Expected a finite number or bigint");
2947
- t = { ...t };
2948
- const n = e < 0 ? "-" : "";
2949
- e = e < 0 ? -e : e, t.colonNotation && (t.compact = !1, t.formatSubMilliseconds = !1, t.separateMilliseconds = !1, t.verbose = !1), t.compact && (t.unitCount = 1, t.secondsDecimalDigits = 0, t.millisecondsDecimalDigits = 0);
2950
- let a = [];
2951
- const o = (f, u) => {
2952
- const l = Math.floor(f * 10 ** u + ss);
2953
- return (Math.round(l) / 10 ** u).toFixed(u);
2954
- }, s = (f, u, l, d) => {
2955
- if (!((a.length === 0 || !t.colonNotation) && as(f) && !(t.colonNotation && l === "m"))) {
2956
- if (d ?? (d = String(f)), t.colonNotation) {
2957
- const p = d.includes(".") ? d.split(".")[0].length : d.length, y = a.length > 0 ? 2 : 1;
2958
- d = "0".repeat(Math.max(0, y - p)) + d;
2959
- } else
2960
- d += t.verbose ? " " + os(u, f) : l;
2961
- a.push(d);
2962
- }
2963
- }, i = ns(e), c = BigInt(i.days);
2964
- if (t.hideYearAndDays ? s(BigInt(c) * 24n + BigInt(i.hours), "hour", "h") : (t.hideYear ? s(c, "day", "d") : (s(c / 365n, "year", "y"), s(c % 365n, "day", "d")), s(Number(i.hours), "hour", "h")), s(Number(i.minutes), "minute", "m"), !t.hideSeconds)
2965
- if (t.separateMilliseconds || t.formatSubMilliseconds || !t.colonNotation && e < 1e3) {
2966
- const f = Number(i.seconds), u = Number(i.milliseconds), l = Number(i.microseconds), d = Number(i.nanoseconds);
2967
- if (s(f, "second", "s"), t.formatSubMilliseconds)
2968
- s(u, "millisecond", "ms"), s(l, "microsecond", "µs"), s(d, "nanosecond", "ns");
2969
- else {
2970
- const p = u + l / 1e3 + d / 1e6, y = typeof t.millisecondsDecimalDigits == "number" ? t.millisecondsDecimalDigits : 0, w = p >= 1 ? Math.round(p) : Math.ceil(p), g = y ? p.toFixed(y) : w;
2971
- s(
2972
- Number.parseFloat(g),
2973
- "millisecond",
2974
- "ms",
2975
- g
2976
- );
2977
- }
2978
- } else {
2979
- const f = (r ? Number(e % is) : e) / 1e3 % 60, u = typeof t.secondsDecimalDigits == "number" ? t.secondsDecimalDigits : 1, l = o(f, u), d = t.keepDecimalsOnWholeSeconds ? l : l.replace(/\.0+$/, "");
2980
- s(Number.parseFloat(d), "second", "s", d);
2981
- }
2982
- if (a.length === 0)
2983
- return n + "0" + (t.verbose ? " milliseconds" : "ms");
2984
- const m = t.colonNotation ? ":" : " ";
2985
- return typeof t.unitCount == "number" && (a = a.slice(0, Math.max(t.unitCount, 1))), n + a.join(m);
2986
- }
2987
- const ls = process.env.NODE_ENV === "production", Rn = !ls, ds = Rn ? "gizmette.local.com" : "gizmette.com", ic = async () => {
2988
- const e = {
2989
- /**
2990
- * A boolean value that indicates the application would
2991
- * like to receive the best possible results. If true
2992
- * and if the device is able to provide a more accurate
2993
- * position, it will do so. Note that this can result in
2994
- * slower response times or increased power consumption
2995
- * (with a GPS chip on a mobile device for example). On
2996
- * the other hand, if false, the device can take the
2997
- * liberty to save resources by responding more quickly
2998
- * and/or using less power. Default: false.
2999
- */
3000
- enableHighAccuracy: !1,
3001
- /**
3002
- * A positive long value representing the maximum length
3003
- * of time (in milliseconds) the device is allowed to
3004
- * take in order to return a position. The default value
3005
- * is Infinity, meaning that getCurrentPosition() won't
3006
- * return until the position is available.
3007
- */
3008
- timeout: 1e4,
3009
- /**
3010
- * A positive long value indicating the maximum age in
3011
- * milliseconds of a possible cached position that is
3012
- * acceptable to return. If set to 0, it means that the
3013
- * device cannot use a cached position and must attempt
3014
- * to retrieve the real current position. If set to
3015
- * Infinity the device must return a cached position
3016
- * regardless of its age. Default: 0.
3017
- */
3018
- maximumAge: 6e4
3019
- };
3020
- return new Promise((t, r) => {
3021
- var n;
3022
- (n = navigator == null ? void 0 : navigator.geolocation) == null || n.getCurrentPosition(
3023
- (a) => {
3024
- t({
3025
- latitude: a.coords.latitude,
3026
- longitude: a.coords.longitude,
3027
- accuracy: a.coords.accuracy
3028
- });
3029
- },
3030
- (a) => {
3031
- r(a);
3032
- },
3033
- e
3034
- );
3035
- });
3036
- }, cc = (e) => window.btoa(
3037
- encodeURIComponent(e).replace(
3038
- /%([0-9A-F]{2})/g,
3039
- function(r, n) {
3040
- return String.fromCharCode(+`0x${n}`);
3041
- }
3042
- )
3043
- ), lc = (e) => decodeURIComponent(
3044
- window.atob(e).split("").map(function(t) {
3045
- return `%${`00${t.charCodeAt(0).toString(16)}`.slice(-2)}`;
3046
- }).join("")
3047
- ), dc = (e, t) => t ? Object.keys(t).map((r) => /* @__PURE__ */ h("dl", { className: "my-0", children: /* @__PURE__ */ Q("div", { className: "flex items-center justify-between", children: [
3048
- /* @__PURE__ */ h("dt", { className: "my-1 inline-block font-bold text-copy-dark dark:text-copy-lighter", children: r }),
3049
- /* @__PURE__ */ h("dd", { className: "my-1 inline-block", children: t[r] })
3050
- ] }) }, `${e}-${r}`)) : null, uc = (e) => e > 0 ? cs(e, {
3051
- secondsDecimalDigits: 2,
3052
- unitCount: 2
3053
- }) : "N/A", us = ({
3054
- isAuthenticated: e,
3055
- extraClass: t
3056
- }) => E(
3057
- "px-4 pb-10",
3058
- "bg-slate-900",
3059
- "flex-1 overflow-y-auto",
3060
- e ? "pt-0" : "pt-10",
3061
- t
3062
- ), fs = ({
3063
- extraClass: e
3064
- } = {}) => E("px-2 sm:px-0", e), fc = (e, t) => t === 1 ? e : `${e}s`, hc = (e, t) => {
3065
- let r;
3066
- return (...n) => {
3067
- window.clearTimeout(r), r = window.setTimeout(() => e(...n), t);
3068
- };
3069
- }, hs = () => !!(window != null && window.__VERSINI_CALLISTO_ELECTRON__), ms = () => window.innerWidth < 403, mc = () => {
3070
- const e = ["iPhone Simulator", "iPhone"].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document || window.indexedDB !== null, t = /iPhone/.test(navigator.userAgent), r = ms(), n = navigator.maxTouchPoints > 1;
3071
- return e && t && r && n;
3072
- }, pc = (e) => {
3073
- const t = e.replace(/([A-Z])/g, " $1");
3074
- return t.charAt(0).toUpperCase() + t.slice(1);
3075
- }, gc = ({
3076
- autoClose: e = 3e3,
3077
- containerId: t,
3078
- position: r = "top-center",
3079
- hideProgressBar: n = !1,
3080
- closeOnClick: a = !1,
3081
- pauseOnHover: o = !0,
3082
- draggable: s = !0,
3083
- progress: i = void 0,
3084
- theme: c = "colored",
3085
- transition: m,
3086
- icon: f = !1
3087
- } = {}) => ({
3088
- autoClose: e,
3089
- containerId: t,
3090
- position: r,
3091
- hideProgressBar: n,
3092
- closeOnClick: a,
3093
- pauseOnHover: o,
3094
- draggable: s,
3095
- progress: i,
3096
- theme: c,
3097
- transition: m,
3098
- icon: f
3099
- }), $r = "av-button", gt = "icon", ar = "button", Xt = "link", ps = ({
3100
- type: e,
3101
- size: t,
3102
- labelRight: r,
3103
- labelLeft: n,
3104
- align: a,
3105
- animated: o
3106
- }) => {
3107
- const s = "max-h-8 py-0 px-2", i = "max-h-9 h-8 px-3", c = "max-h-12 py-2 px-4";
3108
- switch (e) {
3109
- case ar:
3110
- case Xt:
3111
- return E({
3112
- [s]: t === "small",
3113
- [i]: t === "medium",
3114
- [c]: t === "large"
3115
- });
3116
- case gt:
3117
- return E("flex items-center", {
3118
- "justify-center": a === "center",
3119
- "justify-start": a === "left",
3120
- "justify-end": a === "right",
3121
- "h-6 w-6 p-0": t === "small" && !o && !(r || n),
3122
- "h-6 px-2": t === "small" && !o && (r || n),
3123
- "h-8 w-8 p-1": t === "medium" && !o && !(r || n),
3124
- "h-8 px-3": t === "medium" && !o && (r || n),
3125
- "h-12 w-12 p-2": t === "large" && !o && !(r || n),
3126
- "h-12 px-4": t === "large" && !o && (r || n),
3127
- "h-6 py-0": t === "small" && o && !(r || n),
3128
- "h-6": t === "small" && o && (r || n),
3129
- "h-8 py-1": t === "medium" && o && !(r || n),
3130
- "h-8": t === "medium" && o && (r || n),
3131
- "h-12 py-2": t === "large" && o && !(r || n),
3132
- "h-12": t === "large" && o && (r || n)
3133
- });
3134
- }
3135
- }, gs = ({
3136
- type: e,
3137
- size: t,
3138
- labelRight: r,
3139
- labelLeft: n
3140
- }) => {
3141
- const a = "text-sm font-medium", o = "text-base font-medium", s = "text-lg font-medium";
3142
- switch (e) {
3143
- case ar:
3144
- case Xt:
3145
- return E({
3146
- "text-center": e === Xt,
3147
- [a]: t === "small",
3148
- [o]: t === "medium",
3149
- [s]: t === "large"
3150
- });
3151
- case gt:
3152
- return E({
3153
- [a]: t === "small" && (r || n),
3154
- [o]: t === "medium" && (r || n),
3155
- [s]: t === "large" && (r || n)
3156
- });
3157
- }
3158
- }, ys = ({
3159
- mode: e,
3160
- noBackground: t,
3161
- noTruncate: r,
3162
- variant: n
3163
- }) => {
3164
- if (t)
3165
- return "not-prose";
3166
- if (n === "primary")
3167
- return E("not-prose", {
3168
- truncate: !r,
3169
- "text-copy-light": e === "dark" || e === "system",
3170
- "text-copy-lighter": e === "light" || e === "alt-system",
3171
- "dark:text-copy-lighter": e === "system",
3172
- "dark:text-copy-light": e === "alt-system"
3173
- });
3174
- if (n === "secondary")
3175
- return E("not-prose", {
3176
- truncate: !r,
3177
- "text-copy-light": e === "light" || e === "system",
3178
- "text-copy-lighter": e === "dark" || e === "alt-system",
3179
- "dark:text-copy-lighter": e === "alt-system",
3180
- "dark:text-copy-light": e === "system"
3181
- });
3182
- if (n === "danger")
3183
- return E("not-prose", {
3184
- truncate: !r,
3185
- "text-copy-light": e === "dark" || e === "system",
3186
- "text-copy-lighter": e === "light" || e === "alt-system",
3187
- "dark:text-copy-lighter": e === "system",
3188
- "dark:text-copy-light": e === "alt-system"
3189
- });
3190
- if (n === "selected")
3191
- return E("not-prose text-copy-lighter", {
3192
- truncate: !r
3193
- });
3194
- }, Es = ({
3195
- mode: e,
3196
- noBackground: t,
3197
- variant: r
3198
- }) => {
3199
- if (!t) {
3200
- if (r === "primary")
3201
- return E({
3202
- "bg-action-dark": e === "dark",
3203
- "bg-action-light": e === "light",
3204
- "bg-action-dark dark:bg-action-light": e === "system",
3205
- "bg-action-light dark:bg-action-dark": e === "alt-system"
3206
- });
3207
- if (r === "secondary")
3208
- return E({
3209
- "bg-action-dark": e === "light",
3210
- "bg-action-light": e === "dark",
3211
- "bg-action-dark dark:bg-action-light": e === "alt-system",
3212
- "bg-action-light dark:bg-action-dark": e === "system"
3213
- });
3214
- if (r === "danger")
3215
- return E({
3216
- "bg-action-danger-dark": e === "dark",
3217
- "bg-action-danger-light": e === "light",
3218
- "bg-action-danger-dark dark:bg-action-danger-light": e === "system",
3219
- "bg-action-danger-light dark:bg-action-danger-dark": e === "alt-system"
3220
- });
3221
- if (r === "selected")
3222
- return "bg-action-selected-dark";
3223
- }
3224
- }, bs = ({
3225
- radius: e
3226
- }) => E({
3227
- "rounded-full": e === "large",
3228
- "rounded-md": e === "medium",
3229
- "rounded-sm": e === "small"
3230
- }), Ss = ({
3231
- mode: e,
3232
- disabled: t,
3233
- variant: r
3234
- }) => {
3235
- if (t)
3236
- return "";
3237
- if (r === "primary")
3238
- return E("hover:text-copy-light-hover", {
3239
- "hover:bg-action-dark-hover": e === "dark",
3240
- "hover:bg-action-light-hover": e === "light",
3241
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
3242
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
3243
- });
3244
- if (r === "secondary")
3245
- return E("hover:text-copy-light-hover", {
3246
- "hover:bg-action-dark-hover": e === "light",
3247
- "hover:bg-action-light-hover": e === "dark",
3248
- "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
3249
- "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
3250
- });
3251
- if (r === "danger")
3252
- return E("hover:text-copy-light-hover", {
3253
- "hover:bg-action-danger-dark-hover": e === "dark",
3254
- "hover:bg-action-danger-light-hover": e === "light",
3255
- "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
3256
- "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
3257
- });
3258
- if (r === "selected")
3259
- return "hover:text-copy-light-hover hover:bg-action-selected-dark-hover";
3260
- }, ws = ({
3261
- mode: e,
3262
- disabled: t,
3263
- variant: r
3264
- }) => {
3265
- if (t)
3266
- return "";
3267
- if (r === "primary")
3268
- return E("active:text-copy-light-active", {
3269
- "active:bg-action-dark-active": e === "dark",
3270
- "active:bg-action-light-active": e === "light",
3271
- "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
3272
- "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
3273
- });
3274
- if (r === "secondary")
3275
- return E("active:text-copy-light-active", {
3276
- "active:bg-action-dark-active": e === "light",
3277
- "active:bg-action-light-active": e === "dark",
3278
- "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
3279
- "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
3280
- });
3281
- if (r === "danger")
3282
- return E("active:text-copy-lighter-active", {
3283
- "active:bg-action-danger-dark-active": e === "dark",
3284
- "active:bg-action-danger-light-active": e === "light",
3285
- "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
3286
- "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
3287
- });
3288
- if (r === "selected")
3289
- return "active:text-copy-lighter-active active:bg-action-selected-dark-active";
3290
- }, Ts = ({
3291
- mode: e,
3292
- noBorder: t,
3293
- variant: r
3294
- }) => {
3295
- if (t)
3296
- return "border border-transparent";
3297
- if (r === "primary")
3298
- return E("border", {
3299
- "border-border-dark": e === "dark",
3300
- "border-border-accent": e === "light",
3301
- "border-border-dark dark:border-border-accent": e === "system",
3302
- "border-border-accent dark:border-border-dark": e === "alt-system"
3303
- });
3304
- if (r === "secondary")
3305
- return E("border", {
3306
- "border-border-dark": e === "light",
3307
- "border-border-accent": e === "dark",
3308
- "border-border-dark dark:border-border-accent": e === "alt-system",
3309
- "border-border-accent dark:border-border-dark": e === "system"
3310
- });
3311
- if (r === "danger")
3312
- return E("border", {
3313
- "border-border-danger-dark": e === "dark",
3314
- "border-border-danger-medium": e === "light",
3315
- "border-border-danger-dark dark:border-border-danger-medium": e === "system",
3316
- "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
3317
- });
3318
- if (r === "selected")
3319
- return "border border-border-selected-dark";
3320
- }, _s = ({
3321
- focusMode: e
3322
- }) => E("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
3323
- "focus:outline-focus-dark": e === "dark",
3324
- "focus:outline-focus-light": e === "light",
3325
- "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
3326
- "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
3327
- }), Is = ({
3328
- mode: e,
3329
- raw: t,
3330
- iconClassName: r
3331
- }) => t ? "" : E(
3332
- {
3333
- "text-copy-accent-dark": e === "light" || e === "alt-system",
3334
- "text-copy-light": e === "dark" || e === "system",
3335
- "dark:text-copy-light": e === "alt-system",
3336
- "dark:text-copy-accent-dark": e === "system"
3337
- },
3338
- r
3339
- ), As = ({
3340
- animated: e
3341
- }) => E({
3342
- "transition-opacity duration-300 ease-in": e
3343
- }), vn = ({
3344
- type: e,
3345
- className: t,
3346
- raw: r,
3347
- mode: n,
3348
- focusMode: a,
3349
- disabled: o,
3350
- fullWidth: s,
3351
- size: i,
3352
- noBorder: c,
3353
- labelRight: m,
3354
- labelLeft: f,
3355
- noBackground: u,
3356
- variant: l,
3357
- noTruncate: d,
3358
- align: p,
3359
- radius: y,
3360
- animated: w
3361
- }) => (l || (l = "primary"), r ? E($r, t) : E(
3362
- $r,
3363
- ys({
3364
- mode: n,
3365
- variant: l,
3366
- noBackground: u,
3367
- noTruncate: d
3368
- }),
3369
- Es({ mode: n, noBackground: u, variant: l }),
3370
- bs({ radius: y }),
3371
- ps({
3372
- type: e,
3373
- size: i,
3374
- labelRight: m,
3375
- labelLeft: f,
3376
- align: p,
3377
- animated: w
3378
- }),
3379
- gs({ type: e, size: i, labelRight: m, labelLeft: f }),
3380
- Ts({ mode: n, variant: l, noBorder: c }),
3381
- _s({ focusMode: a }),
3382
- Ss({ mode: n, variant: l, disabled: o }),
3383
- ws({ mode: n, variant: l, disabled: o }),
3384
- {
3385
- "w-full": s,
3386
- "disabled:cursor-not-allowed disabled:opacity-50": o
3387
- },
3388
- E({
3389
- "transition-[width] duration-300 ease-in-out": e === gt && w
3390
- }),
3391
- t
3392
- )), Rs = (e, t, r) => {
3393
- var n;
3394
- !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((n = e == null ? void 0 : e.currentTarget) == null ? void 0 : n.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
3395
- }, or = Z.forwardRef((e, t) => {
3396
- const { onClick: r, noInternalClick: n = !1, ...a } = e;
3397
- return /* @__PURE__ */ h(
3398
- "button",
3399
- {
3400
- ref: t,
3401
- onClick: (o) => {
3402
- Rs(o, n, r);
3403
- },
3404
- ...a
3405
- }
3406
- );
3407
- });
3408
- or.displayName = "BaseButton";
3409
- const kn = Z.forwardRef(
3410
- ({
3411
- children: e,
3412
- disabled: t = !1,
3413
- mode: r = "system",
3414
- focusMode: n = "system",
3415
- fullWidth: a = !1,
3416
- className: o,
3417
- size: s = "medium",
3418
- raw: i = !1,
3419
- noBorder: c = !1,
3420
- variant: m = "primary",
3421
- noTruncate: f = !1,
3422
- radius: u = "large",
3423
- ...l
3424
- }, d) => {
3425
- const p = vn({
3426
- type: ar,
3427
- mode: r,
3428
- focusMode: n,
3429
- fullWidth: a,
3430
- disabled: t,
3431
- raw: i,
3432
- className: o,
3433
- size: s,
3434
- noBorder: c,
3435
- variant: m,
3436
- noTruncate: f,
3437
- radius: u
3438
- });
3439
- return /* @__PURE__ */ h(
3440
- or,
3441
- {
3442
- ref: d,
3443
- className: p,
3444
- disabled: t,
3445
- ...l,
3446
- children: e
3447
- }
3448
- );
3449
- }
3450
- );
3451
- kn.displayName = "Button";
3452
- function vs() {
3453
- const e = x(!1);
3454
- return oe(() => (e.current = !0, () => {
3455
- e.current = !1;
3456
- }), []), re(() => e.current, []);
3457
- }
3458
- function ks(e) {
3459
- return Ke(() => e.every((t) => t == null) ? () => {
3460
- } : (t) => {
3461
- e.forEach((r) => {
3462
- typeof r == "function" ? r(t) : r != null && (r.current = t);
3463
- });
3464
- }, e);
3465
- }
3466
- const Cs = {
3467
- x: 0,
3468
- y: 0,
3469
- width: 0,
3470
- height: 0,
3471
- top: 0,
3472
- left: 0,
3473
- bottom: 0,
3474
- right: 0
3475
- };
3476
- function Ut(e) {
3477
- const t = vs(), r = x(0), n = x(null), [a, o] = Ee(Cs), s = Ke(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((i) => {
3478
- const c = i[0];
3479
- c && (cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
3480
- n.current && t() && o(c.contentRect);
3481
- }));
3482
- }), [t]);
3483
- return oe(() => (n.current && (s == null || s.observe(n.current, e)), () => {
3484
- s == null || s.disconnect(), r.current && cancelAnimationFrame(r.current);
3485
- }), [s, e]), [n, a];
3486
- }
3487
- const Ns = {
3488
- small: 24,
3489
- // w-6
3490
- medium: 32,
3491
- // w-8
3492
- large: 48
3493
- // w-12
3494
- }, Os = {
3495
- small: 8 * 2,
3496
- // px-2 x 2
3497
- medium: 12 * 2,
3498
- // px-3 x 2
3499
- large: 16 * 2
3500
- // px-4 x 2
3501
- }, xs = 2, ct = Z.forwardRef(
3502
- ({
3503
- children: e,
3504
- disabled: t = !1,
3505
- mode: r = "system",
3506
- focusMode: n = "system",
3507
- fullWidth: a = !1,
3508
- className: o,
3509
- type: s = "button",
3510
- raw: i = !1,
3511
- noBorder: c = !1,
3512
- "aria-label": m,
3513
- label: f,
3514
- size: u = "medium",
3515
- labelRight: l,
3516
- labelLeft: d,
3517
- noBackground: p = !1,
3518
- align: y = "center",
3519
- radius: w = "large",
3520
- variant: g = "primary",
3521
- iconClassName: $,
3522
- animated: U = !1,
3523
- ...K
3524
- }, I) => {
3525
- const D = vn({
3526
- type: gt,
3527
- mode: r,
3528
- focusMode: n,
3529
- fullWidth: a,
3530
- disabled: t,
3531
- raw: i,
3532
- className: o,
3533
- noBorder: c,
3534
- size: u,
3535
- labelRight: l,
3536
- labelLeft: d,
3537
- noBackground: p,
3538
- align: y,
3539
- radius: w,
3540
- variant: g,
3541
- animated: U
3542
- }), M = Is({ mode: r, raw: i, iconClassName: $ }), S = As({ animated: U }), [v, P] = Ut(), [A, O] = Ut(), [R, V] = Ut(), ee = x(0), b = x(null), k = ks([I, b]);
3543
- return Ue(() => {
3544
- R && R.current && U && (ee.current = V.width + Os[u] + (c ? 0 : xs));
3545
- }, [V, R, u, c, U]), Ue(() => {
3546
- b && b.current && U && (l && v && P.width > 0 ? (v.current && (v.current.style.opacity = "100"), b.current.style.width = `${P.width + ee.current}px`) : d && O.width > 0 ? (A.current && (A.current.style.opacity = "100"), b.current.style.width = `${O.width + ee.current}px`) : (v.current && (v.current.style.opacity = "0"), A.current && (A.current.style.opacity = "0"), b.current.style.width = `${Ns[u]}px`));
3547
- }, [
3548
- P,
3549
- l,
3550
- v,
3551
- O,
3552
- d,
3553
- A,
3554
- u,
3555
- U
3556
- ]), /* @__PURE__ */ Q(
3557
- or,
3558
- {
3559
- ref: k,
3560
- className: D,
3561
- disabled: t,
3562
- type: s,
3563
- "aria-label": m || f,
3564
- ...K,
3565
- children: [
3566
- /* @__PURE__ */ h(
3567
- Ur,
3568
- {
3569
- label: d,
3570
- labelRef: A,
3571
- labelClass: S,
3572
- labelInnerClass: "pr-2"
3573
- }
3574
- ),
3575
- /* @__PURE__ */ h("span", { ref: R, className: M, children: e }),
3576
- /* @__PURE__ */ h(
3577
- Ur,
3578
- {
3579
- label: l,
3580
- labelRef: v,
3581
- labelClass: S,
3582
- labelInnerClass: "pl-2"
3583
- }
3584
- )
3585
- ]
3586
- }
3587
- );
3588
- }
3589
- ), Ur = ({
3590
- labelRef: e,
3591
- labelClass: t,
3592
- label: r,
3593
- labelInnerClass: n
3594
- }) => /* @__PURE__ */ h("span", { ref: e, className: t, children: r && /* @__PURE__ */ h("span", { className: n, children: r }) });
3595
- ct.displayName = "ButtonIcon";
3596
- /*!
3597
- @versini/ui-button v4.2.10
3598
- © 2025 gizmette.com
3599
- */
3600
- try {
3601
- window.__VERSINI_UI_BUTTON__ || (window.__VERSINI_UI_BUTTON__ = {
3602
- version: "4.2.10",
3603
- buildTime: "03/05/2025 01:30 PM EST",
3604
- homepage: "https://github.com/aversini/ui-components",
3605
- license: "MIT"
3606
- });
3607
- } catch {
3608
- }
3609
- const Ps = Z.forwardRef(
3610
- ({
3611
- children: e,
3612
- mode: t = "system",
3613
- className: r,
3614
- active: n = !1,
3615
- ...a
3616
- }, o) => {
3617
- const s = n ? E(
3618
- "relative",
3619
- "focus-within:static",
3620
- "focus-within:after:border-transparent",
3621
- "after:absolute",
3622
- "after:content-['']",
3623
- "after:border-b-2",
3624
- "after:bottom-[-4px]",
3625
- "after:left-0",
3626
- "after:right-0",
3627
- {
3628
- "after:border-table-dark": t === "dark",
3629
- "after:border-table-light": t === "light",
3630
- "after:border-table-dark dark:after:border-table-light": t === "system",
3631
- "after:border-table-light dark:after:border-table-dark": t === "alt-system"
3632
- }
3633
- ) : "";
3634
- return /* @__PURE__ */ h("div", { className: s, children: /* @__PURE__ */ h(
3635
- ct,
3636
- {
3637
- className: E("justify-center", r),
3638
- ref: o,
3639
- mode: t,
3640
- radius: "small",
3641
- ...a,
3642
- children: e
3643
- }
3644
- ) });
3645
- }
3646
- );
3647
- Ps.displayName = "ButtonSort";
3648
- /*!
3649
- @versini/ui-card v3.0.19
3650
- © 2025 gizmette.com
3651
- */
3652
- try {
3653
- window.__VERSINI_UI_CARD__ || (window.__VERSINI_UI_CARD__ = {
3654
- version: "3.0.19",
3655
- buildTime: "03/05/2025 01:31 PM EST",
3656
- homepage: "https://github.com/aversini/ui-components",
3657
- license: "MIT"
3658
- });
3659
- } catch {
3660
- }
3661
- const nt = "av-card";
3662
- function Ds(e) {
3663
- const t = Gr();
3664
- return `${e}${t}`;
3665
- }
3666
- const Ls = ({
3667
- className: e,
3668
- headerClassName: t,
3669
- bodyClassName: r,
3670
- footerClassName: n,
3671
- mode: a,
3672
- compact: o,
3673
- noBorder: s
3674
- }) => {
3675
- const i = E(
3676
- nt,
3677
- "rounded-md",
3678
- {
3679
- "border-none": s,
3680
- "border-2": !s,
3681
- "p-4": !o,
3682
- "p-1 sm:p-2": o,
3683
- "border-border-accent bg-surface-darker text-copy-light": a === "darker",
3684
- "border-border-accent bg-surface-dark text-copy-light": a === "dark",
3685
- "border-border-dark bg-surface-lighter text-copy-dark": a === "light",
3686
- "border-border-dark bg-surface-lighter text-copy-dark dark:border-border-accent dark:bg-surface-dark dark:text-copy-light": a === "system",
3687
- "border-border-accent bg-surface-dark text-copy-light dark:border-border-dark dark:bg-surface-lighter dark:text-copy-dark": a === "alt-system"
3688
- },
3689
- e
3690
- ), c = t || E(`${nt}__header mt-0 border-b-2`, {
3691
- "text-copy-light border-border-accent": a === "darker",
3692
- "border-border-accent": a === "dark",
3693
- "border-border-medium": a === "light",
3694
- "border-border-medium dark:border-border-accent": a === "system",
3695
- "border-border-accent dark:border-border-medium": a === "alt-system",
3696
- "mb-4": !o,
3697
- "mb-2": o
3698
- }), m = E(r), f = n || E(`${nt}__footer pt-2`);
3699
- return {
3700
- wrapper: i,
3701
- header: c,
3702
- body: m,
3703
- footer: f
3704
- };
3705
- };
3706
- function $s({
3707
- id: e,
3708
- content: t,
3709
- userAriaLabelledby: r,
3710
- className: n
3711
- }) {
3712
- return typeof t == "string" ? /* @__PURE__ */ h("h2", { id: e, className: n, children: t }) : r ? /* @__PURE__ */ h("div", { className: n, children: t }) : t ? /* @__PURE__ */ h("div", { className: n, id: e, children: t }) : null;
3713
- }
3714
- const Us = ({
3715
- header: e,
3716
- headerClassName: t,
3717
- footer: r,
3718
- footerClassName: n,
3719
- children: a,
3720
- className: o,
3721
- bodyClassName: s,
3722
- "aria-labelledby": i,
3723
- mode: c = "system",
3724
- compact: m = !1,
3725
- noBorder: f = !1,
3726
- ...u
3727
- }) => {
3728
- let l = null, d = null;
3729
- const p = typeof e == "string", y = Ds(nt), w = Ls({
3730
- className: o,
3731
- headerClassName: t,
3732
- bodyClassName: s,
3733
- footerClassName: n,
3734
- mode: c,
3735
- compact: m,
3736
- noBorder: f
3737
- });
3738
- return p ? (l = y, d = l) : !p && e && i ? (l = null, d = i) : !p && e && !i ? (l = y, d = l) : (l = null, d = i || null), /* @__PURE__ */ h("div", { className: w.wrapper, children: /* @__PURE__ */ Q(
3739
- "section",
3740
- {
3741
- ...d && {
3742
- "aria-labelledby": d
3743
- },
3744
- className: w.body,
3745
- ...u,
3746
- children: [
3747
- /* @__PURE__ */ h(
3748
- $s,
3749
- {
3750
- ...l && { id: l },
3751
- content: e,
3752
- className: w.header,
3753
- userAriaLabelledby: i
3754
- }
3755
- ),
3756
- /* @__PURE__ */ h("div", { children: a }),
3757
- r ? /* @__PURE__ */ h("div", { className: w.footer, children: r }) : null
3758
- ]
3759
- }
3760
- ) });
3761
- }, yt = ({
3762
- children: e,
3763
- fill: t,
3764
- viewBox: r,
3765
- className: n,
3766
- defaultViewBox: a,
3767
- size: o,
3768
- title: s,
3769
- semantic: i = !1,
3770
- ...c
3771
- }) => {
3772
- const m = E(o, n);
3773
- return /* @__PURE__ */ h(at, { children: /* @__PURE__ */ Q(
3774
- "svg",
3775
- {
3776
- xmlns: "http://www.w3.org/2000/svg",
3777
- className: m,
3778
- viewBox: r || a,
3779
- fill: t || "currentColor",
3780
- role: "img",
3781
- "aria-hidden": !i,
3782
- focusable: !1,
3783
- ...c,
3784
- children: [
3785
- s && i && /* @__PURE__ */ h("title", { children: s }),
3786
- e
3787
- ]
3788
- }
3789
- ) });
3790
- };
3791
- /*!
3792
- @versini/ui-svgicon v4.1.1
3793
- © 2025 gizmette.com
3794
- */
3795
- try {
3796
- window.__VERSINI_UI_SVGICON__ || (window.__VERSINI_UI_SVGICON__ = {
3797
- version: "4.1.1",
3798
- buildTime: "02/27/2025 03:46 PM EST",
3799
- homepage: "https://github.com/aversini/ui-components",
3800
- license: "MIT"
3801
- });
3802
- } catch {
3803
- }
3804
- const Ms = ({
3805
- className: e,
3806
- viewBox: t,
3807
- title: r,
3808
- monotone: n,
3809
- ...a
3810
- }) => /* @__PURE__ */ h(
3811
- yt,
3812
- {
3813
- defaultViewBox: "0 0 1200 500",
3814
- size: "w-full",
3815
- viewBox: t,
3816
- className: e,
3817
- title: r || "Dog",
3818
- ...a,
3819
- children: /* @__PURE__ */ h("path", { d: "M927.943 30.81c0-2.381-1.191-5.954-3.573-7.145-7.146-4.763-19.055-1.19-26.2 0-17.864 2.382-34.537 4.764-53.592 4.764-26.2 0-53.591-1.19-79.791-4.764-23.819-3.572-44.064-10.718-69.074-3.572-35.727 9.527-58.355 38.109-57.164 75.028 1.191 21.436-2.382 38.109-9.527 57.164-7.146 17.864-15.482 20.245-32.155 20.245-115.52 0-229.848-1.19-345.367 0h-63.119c-29.773 0-59.546 5.955-89.319 0-21.436-4.763-42.873-15.482-58.355-30.964-3.573-3.572-10.718-14.29-14.29-14.29-4.765 1.19-4.765 15.481-4.765 19.054 0 15.482 5.955 30.964 5.955 46.446s-7.145 28.582-11.91 42.873c-4.763 16.673-4.763 33.346-2.381 50.019 4.764 27.39 9.527 55.973 11.91 84.555 2.381 25.01 2.381 48.828 4.763 73.837 2.382 20.246 3.573 29.773 29.773 33.346 30.964 4.764 30.964-5.955 38.11-26.2 9.527-25.01 17.863-51.21 27.39-76.22 8.337-19.054 15.482-60.736 67.883-40.49 28.582 10.718 58.355 16.672 88.128 25.009 32.155 8.336 65.5 16.673 97.655 22.627 65.501 13.1 132.193 20.246 200.075 23.819 7.146 0 11.91 0 16.673 5.954 17.864 22.628-3.573 63.119 41.682 70.265 40.491 5.954 40.491-22.628 45.255-47.637 2.382-14.291 4.764-27.391 8.337-40.492 1.19-5.954 5.954-11.909 10.718-15.481 55.973-33.346 88.128-98.847 78.6-164.347-1.19-10.719-4.763-21.437-3.572-33.346 2.382-23.819 32.155-33.346 50.018-42.873 22.628-13.1 47.637-25.01 66.692-42.873 13.1-11.91 23.818-27.392 29.773-44.064 3.573-5.955 5.955-14.292 4.764-20.246M737.395 190.395c-2.381 25.01-13.1 36.919-35.727 41.682-40.491 8.337-66.692-19.054-54.783-58.355 8.337-26.2 17.864-51.21 29.773-75.028 11.91-23.818 22.628-23.818 36.919-1.19 17.864 28.581 27.391 59.545 23.818 92.891m38.11-109.564c-7.146 0-13.1-5.955-13.1-13.1 0-7.146 5.954-13.1 13.1-13.1 7.145 0 13.1 5.954 13.1 13.1 0 7.145-5.955 13.1-13.1 13.1" })
3820
- }
3821
- ), Hs = ({
3822
- className: e,
3823
- viewBox: t,
3824
- title: r,
3825
- monotone: n,
3826
- ...a
3827
- }) => /* @__PURE__ */ Q(
3828
- yt,
3829
- {
3830
- defaultViewBox: "0 0 640 512",
3831
- size: "size-5",
3832
- viewBox: t,
3833
- className: e,
3834
- title: r || "Hide",
3835
- ...a,
3836
- children: [
3837
- /* @__PURE__ */ h(
3838
- "path",
3839
- {
3840
- d: "M0 256c0 4.2.8 8.4 2.5 12.3C17.3 304 48.6 356 95.4 399.4 142.5 443.2 207.2 480 288 480c56.1 0 104.4-17.8 144.5-43.2l-71.7-56.5C339.4 392.8 314.6 400 288 400c-79.5 0-144-64.5-144-144 0-14.5 2.1-28.5 6.1-41.7L63.5 146c-29.4 34.7-49.9 70.8-61.1 97.6-1.6 4-2.4 8.2-2.4 12.4M135.2 80.7l71.8 56.2c23.1-15.7 51-24.9 81-24.9 79.5 0 144 64.5 144 144 0 17.7-3.2 34.6-9 50.2 28 22 56.1 44 84.1 65.9 32.3-36.6 54.6-75.4 66.4-103.9 1.6-3.9 2.5-8.1 2.5-12.3s-.8-8.4-2.5-12.3c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32c-60 0-111.1 20.3-152.8 48.7M192 260.1c.3 6.9 1.3 13.8 3.2 20.7 13.7 51.2 66.4 81.6 117.6 67.9 1.9-.5 3.9-1.1 5.7-1.7l-120-94.6c-3.7.8-6.7 3.7-6.5 7.7m92.7-88.4c2.1 6.4 3.3 13.2 3.3 20.3 0 2.7-.2 5.4-.5 8 31.6 24.8 63.2 49.5 94.8 74.3 2.7-13.9 2.4-28.6-1.5-43.2-11.1-41.5-47.8-69.4-88.6-71.1-5.8-.2-9.2 6.1-7.4 11.7z",
3841
- opacity: n ? "1" : "0.4"
3842
- }
3843
- ),
3844
- /* @__PURE__ */ h("path", { d: "M5.1 9.2C13.3-1.2 28.4-3.1 38.8 5.1l592 464c10.4 8.2 12.3 23.3 4.1 33.7s-23.3 12.3-33.7 4.1l-592-464C-1.2 34.7-3.1 19.6 5.1 9.2" })
3845
- ]
3846
- }
3847
- ), Ks = ({
3848
- className: e,
3849
- viewBox: t,
3850
- title: r,
3851
- monotone: n,
3852
- ...a
3853
- }) => {
3854
- const o = n ? "1" : "0.4";
3855
- return /* @__PURE__ */ Q(
3856
- yt,
3857
- {
3858
- defaultViewBox: "0 0 190 190",
3859
- size: "size-5",
3860
- viewBox: t,
3861
- className: e,
3862
- title: r || "Passkey",
3863
- ...a,
3864
- children: [
3865
- /* @__PURE__ */ h(
3866
- "path",
3867
- {
3868
- d: "M172.32 96.79c0 13.78-8.48 25.5-20.29 29.78l7.14 11.83-10.57 13 10.57 12.71-17.04 22.87-12.01-12.82V125.7c-10.68-4.85-18.15-15.97-18.15-28.91 0-17.4 13.51-31.51 30.18-31.51 16.66 0 30.17 14.11 30.17 31.51m-30.18 4.82c4.02 0 7.28-3.4 7.28-7.6s-3.26-7.61-7.28-7.61-7.28 3.4-7.28 7.61c-.01 4.2 3.26 7.6 7.28 7.6",
3869
- opacity: o
3870
- }
3871
- ),
3872
- /* @__PURE__ */ h(
3873
- "path",
3874
- {
3875
- d: "M172.41 96.88c0 13.62-8.25 25.23-19.83 29.67l6.58 11.84-9.73 13 9.73 12.71-17.03 23.05v-85.54c4.02 0 7.28-3.41 7.28-7.6 0-4.2-3.26-7.61-7.28-7.61V65.28c16.73 0 30.28 14.15 30.28 31.6",
3876
- opacity: o
3877
- }
3878
- ),
3879
- /* @__PURE__ */ h("path", { d: "M120.24 131.43c-9.75-8-16.3-20.3-17.2-34.27H50.8c-10.96 0-19.84 9.01-19.84 20.13v25.17c0 5.56 4.44 10.07 9.92 10.07h69.44c5.48 0 9.92-4.51 9.92-10.07zM73.16 91.13c-2.42-.46-4.82-.89-7.11-1.86-8.65-3.63-13.69-10.32-15.32-19.77-1.12-6.47-.59-12.87 2.03-18.92 3.72-8.6 10.39-13.26 19.15-14.84 5.24-.94 10.46-.73 15.5 1.15 7.59 2.82 12.68 8.26 15.03 16.24 2.38 8.05 2.03 16.1-1.56 23.72-3.72 7.96-10.21 12.23-18.42 13.9-.68.14-1.37.27-2.05.41-2.41-.03-4.83-.03-7.25-.03" })
3880
- ]
3881
- }
3882
- );
3883
- }, Vs = ({
3884
- className: e,
3885
- viewBox: t,
3886
- title: r,
3887
- monotone: n,
3888
- ...a
3889
- }) => /* @__PURE__ */ Q(
3890
- yt,
3891
- {
3892
- defaultViewBox: "0 0 576 512",
3893
- size: "size-5",
3894
- viewBox: t,
3895
- className: e,
3896
- title: r || "Show",
3897
- ...a,
3898
- children: [
3899
- /* @__PURE__ */ h(
3900
- "path",
3901
- {
3902
- d: "M0 256c0 4.2.8 8.4 2.5 12.3C17.3 304 48.6 356 95.4 399.4 142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1 1.6-3.9 2.5-8.1 2.5-12.3s-.8-8.4-2.5-12.3c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32S142.5 68.8 95.4 112.6C48.6 156 17.3 208 2.5 243.7.8 247.6 0 251.8 0 256m432 0a144 144 0 1 1-288 0 144 144 0 1 1 288 0",
3903
- opacity: n ? "1" : "0.4"
3904
- }
3905
- ),
3906
- /* @__PURE__ */ h("path", { d: "M224 256c35.3 0 64-28.7 64-64 0-7.1-1.2-13.9-3.3-20.3-1.8-5.5 1.6-11.9 7.4-11.7 40.8 1.7 77.5 29.6 88.6 71.1 13.7 51.2-16.7 103.9-67.9 117.6S208.9 332 195.2 280.8c-1.9-6.9-2.9-13.9-3.2-20.7-.3-5.8 6.1-9.2 11.7-7.4 6.4 2.1 13.2 3.3 20.3 3.3" })
3907
- ]
3908
- }
3909
- );
3910
- /*!
3911
- @versini/ui-icons v4.8.1
3912
- © 2025 gizmette.com
3913
- */
3914
- try {
3915
- window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
3916
- version: "4.8.1",
3917
- buildTime: "02/27/2025 03:46 PM EST",
3918
- homepage: "https://github.com/aversini/ui-components",
3919
- license: "MIT"
3920
- });
3921
- } catch {
3922
- }
3923
- /*!
3924
- @versini/ui-main v3.0.13
3925
- © 2025 gizmette.com
3926
- */
3927
- try {
3928
- window.__VERSINI_UI_MAIN__ || (window.__VERSINI_UI_MAIN__ = {
3929
- version: "3.0.13",
3930
- buildTime: "02/27/2025 06:37 PM EST",
3931
- homepage: "https://github.com/aversini/ui-components",
3932
- license: "MIT"
3933
- });
3934
- } catch {
3935
- }
3936
- const Ws = "av-main", Gs = ({
3937
- children: e,
3938
- className: t,
3939
- raw: r = !1,
3940
- noMargin: n = !1,
3941
- noPadding: a = !1,
3942
- ...o
3943
- }) => {
3944
- const s = E(
3945
- Ws,
3946
- {
3947
- "mt-2 sm:mt-3": !r && !n,
3948
- "p-2": !r && !a,
3949
- "flex w-full flex-col md:mx-auto md:max-w-4xl": !r
3950
- },
3951
- t
3952
- );
3953
- return /* @__PURE__ */ h("main", { className: s, ...o, children: e });
3954
- }, Bs = "av-flexgrid", tt = "av-flexgrid-item", lt = 0.25, Qt = Z.createContext({
3955
- columnGap: 0,
3956
- rowGap: 0
3957
- }), Fs = ({
3958
- children: e,
3959
- className: t,
3960
- columnGap: r = 1,
3961
- rowGap: n = 0,
3962
- height: a = "auto",
3963
- width: o = "auto",
3964
- direction: s = "row",
3965
- alignHorizontal: i = "normal",
3966
- alignVertical: c = "normal",
3967
- ...m
3968
- }) => {
3969
- const f = {
3970
- flexDirection: s,
3971
- justifyContent: i,
3972
- alignItems: c,
3973
- height: a,
3974
- width: o,
3975
- /**
3976
- * Trick to account for the extra space taken
3977
- * by the columnGap and rowGap that will be applied
3978
- * to all FlexgridItems (see context and paddings).
3979
- */
3980
- marginLeft: r * -1 * lt + "rem",
3981
- marginTop: n * -1 * lt + "rem"
3982
- }, u = E(
3983
- Bs,
3984
- "box-border flex flex-wrap"
3985
- ), l = { columnGap: r, rowGap: n };
3986
- return t ? /* @__PURE__ */ h("div", { className: t, children: /* @__PURE__ */ h("div", { className: u, style: f, ...m, children: /* @__PURE__ */ h(Qt.Provider, { value: l, children: e }) }) }) : /* @__PURE__ */ h("div", { className: u, style: f, ...m, children: /* @__PURE__ */ h(Qt.Provider, { value: l, children: e }) });
3987
- }, Mt = (e, t) => E({
3988
- "basis-1/12": e === 1 && !t,
3989
- "sm:basis-1/12": e === 1 && t === "sm",
3990
- "md:basis-1/12": e === 1 && t === "md",
3991
- "lg:basis-1/12": e === 1 && t === "lg",
3992
- "xl:basis-1/12": e === 1 && t === "xl",
3993
- "2xl:basis-1/12": e === 1 && t === "2xl",
3994
- "basis-2/12": e === 2 && !t,
3995
- "sm:basis-2/12": e === 2 && t === "sm",
3996
- "md:basis-2/12": e === 2 && t === "md",
3997
- "lg:basis-2/12": e === 2 && t === "lg",
3998
- "xl:basis-2/12": e === 2 && t === "xl",
3999
- "2xl:basis-2/12": e === 2 && t === "2xl",
4000
- "basis-3/12": e === 3 && !t,
4001
- "sm:basis-3/12": e === 3 && t === "sm",
4002
- "md:basis-3/12": e === 3 && t === "md",
4003
- "lg:basis-3/12": e === 3 && t === "lg",
4004
- "xl:basis-3/12": e === 3 && t === "xl",
4005
- "2xl:basis-3/12": e === 3 && t === "2xl",
4006
- "basis-4/12": e === 4 && !t,
4007
- "sm:basis-4/12": e === 4 && t === "sm",
4008
- "md:basis-4/12": e === 4 && t === "md",
4009
- "lg:basis-4/12": e === 4 && t === "lg",
4010
- "xl:basis-4/12": e === 4 && t === "xl",
4011
- "2xl:basis-4/12": e === 4 && t === "2xl",
4012
- "basis-5/12": e === 5 && !t,
4013
- "sm:basis-5/12": e === 5 && t === "sm",
4014
- "md:basis-5/12": e === 5 && t === "md",
4015
- "lg:basis-5/12": e === 5 && t === "lg",
4016
- "xl:basis-5/12": e === 5 && t === "xl",
4017
- "2xl:basis-5/12": e === 5 && t === "2xl",
4018
- "basis-6/12": e === 6 && !t,
4019
- "sm:basis-6/12": e === 6 && t === "sm",
4020
- "md:basis-6/12": e === 6 && t === "md",
4021
- "lg:basis-6/12": e === 6 && t === "lg",
4022
- "xl:basis-6/12": e === 6 && t === "xl",
4023
- "2xl:basis-6/12": e === 6 && t === "2xl",
4024
- "basis-7/12": e === 7 && !t,
4025
- "sm:basis-7/12": e === 7 && t === "sm",
4026
- "md:basis-7/12": e === 7 && t === "md",
4027
- "lg:basis-7/12": e === 7 && t === "lg",
4028
- "xl:basis-7/12": e === 7 && t === "xl",
4029
- "2xl:basis-7/12": e === 7 && t === "2xl",
4030
- "basis-8/12": e === 8 && !t,
4031
- "sm:basis-8/12": e === 8 && t === "sm",
4032
- "md:basis-8/12": e === 8 && t === "md",
4033
- "lg:basis-8/12": e === 8 && t === "lg",
4034
- "xl:basis-8/12": e === 8 && t === "xl",
4035
- "2xl:basis-8/12": e === 8 && t === "2xl",
4036
- "basis-9/12": e === 9 && !t,
4037
- "sm:basis-9/12": e === 9 && t === "sm",
4038
- "md:basis-9/12": e === 9 && t === "md",
4039
- "lg:basis-9/12": e === 9 && t === "lg",
4040
- "xl:basis-9/12": e === 9 && t === "xl",
4041
- "2xl:basis-9/12": e === 9 && t === "2xl",
4042
- "basis-10/12": e === 10 && !t,
4043
- "sm:basis-10/12": e === 10 && t === "sm",
4044
- "md:basis-10/12": e === 10 && t === "md",
4045
- "lg:basis-10/12": e === 10 && t === "lg",
4046
- "xl:basis-10/12": e === 10 && t === "xl",
4047
- "2xl:basis-10/12": e === 10 && t === "2xl",
4048
- "basis-11/12": e === 11 && !t,
4049
- "sm:basis-11/12": e === 11 && t === "sm",
4050
- "md:basis-11/12": e === 11 && t === "md",
4051
- "lg:basis-11/12": e === 11 && t === "lg",
4052
- "xl:basis-11/12": e === 11 && t === "xl",
4053
- "2xl:basis-11/12": e === 11 && t === "2xl",
4054
- "basis-full": e === 12 && !t,
4055
- "sm:basis-full": e === 12 && t === "sm",
4056
- "md:basis-full": e === 12 && t === "md",
4057
- "lg:basis-full": e === 12 && t === "lg",
4058
- "xl:basis-full": e === 12 && t === "xl",
4059
- "2xl:basis-full": e === 12 && t === "2xl"
4060
- }), Js = ({
4061
- className: e,
4062
- span: t
4063
- }) => {
4064
- if (!t)
4065
- return E(e, tt, "box-border basis-auto");
4066
- if (typeof t == "number")
4067
- return E(e, tt, "box-border max-w-full", {
4068
- [`${Mt(t)}`]: !0
4069
- });
4070
- if (typeof t == "string")
4071
- return E(e, tt, "box-border basis-auto", {
4072
- "max-w-full grow": t === "auto"
4073
- });
4074
- if (typeof t == "object") {
4075
- const r = Object.entries(t).map(([n, a]) => n === "fallback" ? Mt(a) : Mt(a, n));
4076
- return E(
4077
- e,
4078
- tt,
4079
- "box-border",
4080
- r
4081
- );
4082
- }
4083
- }, _e = ({
4084
- children: e,
4085
- className: t,
4086
- span: r,
4087
- ...n
4088
- }) => {
4089
- const { columnGap: a, rowGap: o } = Zt(Qt), s = {
4090
- paddingLeft: a * lt + "rem",
4091
- paddingTop: o * lt + "rem"
4092
- }, i = Js({
4093
- className: t,
4094
- span: r
4095
- });
4096
- return /* @__PURE__ */ h("div", { className: i, style: s, ...n, children: e });
4097
- };
4098
- /*!
4099
- @versini/ui-system v3.0.10
4100
- © 2025 gizmette.com
4101
- */
4102
- try {
4103
- window.__VERSINI_UI_SYSTEM__ || (window.__VERSINI_UI_SYSTEM__ = {
4104
- version: "3.0.10",
4105
- buildTime: "02/27/2025 06:37 PM EST",
4106
- homepage: "https://github.com/aversini/ui-components",
4107
- license: "MIT"
4108
- });
4109
- } catch {
4110
- }
4111
- const Cn = "av-text-input", Ys = "av-text-input-wrapper", Ht = "av-text-input-helper-text";
4112
- function js() {
4113
- const e = x(!1);
4114
- return oe(() => (e.current = !0, () => {
4115
- e.current = !1;
4116
- }), []), re(() => e.current, []);
4117
- }
4118
- const qs = {
4119
- x: 0,
4120
- y: 0,
4121
- width: 0,
4122
- height: 0,
4123
- top: 0,
4124
- left: 0,
4125
- bottom: 0,
4126
- right: 0
4127
- };
4128
- function zs(e) {
4129
- const t = js(), r = x(0), n = x(null), [a, o] = Ee(qs), s = Ke(() => typeof ResizeObserver > "u" ? null : new ResizeObserver((i) => {
4130
- const c = i[0];
4131
- c && (cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
4132
- n.current && t() && o(c.contentRect);
4133
- }));
4134
- }), [t]);
4135
- return oe(() => (n.current && (s == null || s.observe(n.current, e)), () => {
4136
- s == null || s.disconnect(), r.current && cancelAnimationFrame(r.current);
4137
- }), [s, e]), [n, a];
4138
- }
4139
- function Xs(e) {
4140
- const t = Gr();
4141
- if (!e)
4142
- return t;
4143
- if (typeof e == "number" || typeof e == "string")
4144
- return `${e}${t}`;
4145
- if (typeof e == "object") {
4146
- const { id: r, prefix: n = "" } = e;
4147
- return typeof r == "number" || typeof r == "string" ? `${n}${r}` : `${n}${t}`;
4148
- }
4149
- }
4150
- const Nn = "SET_ANNOUNCEMENT", On = "CLEAR_ANNOUNCEMENT", Qs = {
4151
- alert: null,
4152
- alertdialog: null,
4153
- log: "polite",
4154
- marquee: null,
4155
- progressbar: null,
4156
- status: "polite",
4157
- timer: "assertive"
4158
- }, Zs = (e, t) => {
4159
- switch (t == null ? void 0 : t.type) {
4160
- case Nn:
4161
- return {
4162
- ...e,
4163
- announcement: t.payload
4164
- };
4165
- case On:
4166
- return {
4167
- ...e,
4168
- announcement: null
4169
- };
4170
- default:
4171
- return e;
4172
- }
4173
- }, ei = ({
4174
- onAnnouncementClear: e,
4175
- dispatch: t
4176
- }) => {
4177
- t({
4178
- type: On
4179
- }), typeof e == "function" && e();
4180
- }, Mr = ({
4181
- children: e,
4182
- clearAnnouncementDelay: t,
4183
- clearAnnouncementTimeoutRef: r,
4184
- onAnnouncementClear: n,
4185
- dispatch: a
4186
- }) => {
4187
- clearTimeout(r.current), e !== null && a({
4188
- type: Nn,
4189
- payload: e
4190
- }), t && (r.current = setTimeout(
4191
- () => ei({
4192
- onAnnouncementClear: n,
4193
- dispatch: a
4194
- }),
4195
- t
4196
- ));
4197
- }, ti = ({
4198
- children: e,
4199
- announcementTimeoutRef: t,
4200
- announcementDelay: r,
4201
- clearAnnouncementDelay: n,
4202
- clearAnnouncementTimeoutRef: a,
4203
- onAnnouncementClear: o,
4204
- dispatch: s
4205
- }) => {
4206
- clearTimeout(t.current), r ? t.current = setTimeout(Mr, r, {
4207
- children: e,
4208
- clearAnnouncementDelay: n,
4209
- clearAnnouncementTimeoutRef: a,
4210
- onAnnouncementClear: o,
4211
- dispatch: s
4212
- }) : Mr({
4213
- children: e,
4214
- clearAnnouncementDelay: n,
4215
- clearAnnouncementTimeoutRef: a,
4216
- onAnnouncementClear: o,
4217
- dispatch: s
4218
- });
4219
- };
4220
- function xn({
4221
- children: e,
4222
- className: t,
4223
- politeness: r,
4224
- role: n = null,
4225
- announcementDelay: a,
4226
- clearAnnouncementDelay: o,
4227
- onAnnouncementClear: s,
4228
- visible: i,
4229
- ...c
4230
- }) {
4231
- const m = x(null), f = x(null), [u, l] = Wr(Zs, {
4232
- announcement: null
4233
- });
4234
- let d = r;
4235
- typeof d > "u" && (d = n ? Qs[n] : "assertive"), oe(() => {
4236
- ti({
4237
- announcementTimeoutRef: m,
4238
- announcementDelay: a,
4239
- children: e,
4240
- clearAnnouncementDelay: o,
4241
- clearAnnouncementTimeoutRef: f,
4242
- onAnnouncementClear: s,
4243
- dispatch: l
4244
- });
4245
- }, [
4246
- e,
4247
- a,
4248
- o,
4249
- s
4250
- ]);
4251
- const p = E(t, {
4252
- "sr-only": !i
4253
- });
4254
- return /* @__PURE__ */ h(
4255
- "div",
4256
- {
4257
- "aria-live": d,
4258
- ...n && { role: n },
4259
- className: p,
4260
- ...c,
4261
- children: u.announcement
4262
- }
4263
- );
4264
- }
4265
- /*!
4266
- @versini/ui-liveregion v1.3.10
4267
- © 2025 gizmette.com
4268
- */
4269
- try {
4270
- window.__VERSINI_UI_LIVEREGION__ || (window.__VERSINI_UI_LIVEREGION__ = {
4271
- version: "1.3.10",
4272
- buildTime: "03/05/2025 01:30 PM EST",
4273
- homepage: "https://github.com/aversini/ui-components",
4274
- license: "MIT"
4275
- });
4276
- } catch {
4277
- }
4278
- const ri = ({
4279
- mode: e
4280
- }) => E({
4281
- "bg-surface-darker text-copy-lighter caret-copy-light": e === "dark",
4282
- "bg-surface-lighter text-copy-dark caret-copy-dark": e === "light",
4283
- "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": e === "system",
4284
- "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": e === "alt-system"
4285
- }), ni = ({
4286
- focusMode: e
4287
- }) => E("focus:outline focus:outline-2 focus:outline-offset-2", {
4288
- "focus:outline-focus-dark": e === "dark",
4289
- "focus:outline-focus-light": e === "light",
4290
- "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
4291
- "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
4292
- }), ai = ({
4293
- noBorder: e,
4294
- error: t
4295
- }) => E("border-2", {
4296
- "border-border-dark": !e && !t,
4297
- "focus:border-border-dark": !e && t,
4298
- "border-border-error-dark": !e && t,
4299
- "border-transparent": e
4300
- }), oi = ({
4301
- disabled: e,
4302
- raw: t,
4303
- error: r,
4304
- mode: n
4305
- }) => {
4306
- if (t)
4307
- return "";
4308
- if (e)
4309
- return E("absolute px-2 cursor-not-allowed opacity-50 font-medium");
4310
- if (!r)
4311
- return E("absolute px-2 cursor-text font-medium", {
4312
- "text-copy-lighter": n === "dark",
4313
- "text-copy-dark": n === "light",
4314
- "text-copy-dark dark:text-copy-lighter": n === "system",
4315
- "text-copy-lighter dark:text-copy-dark": n === "alt-system"
4316
- });
4317
- if (r)
4318
- return E("absolute px-2 cursor-text font-medium", {
4319
- "text-copy-lighter": n === "dark",
4320
- "text-copy-error-dark": n === "light",
4321
- "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": n === "system",
4322
- "text-copy-lighter dark:text-copy-error-dark": n === "alt-system"
4323
- });
4324
- }, si = ({
4325
- error: e,
4326
- raw: t,
4327
- mode: r,
4328
- disabled: n
4329
- }) => {
4330
- if (t)
4331
- return "";
4332
- if (n)
4333
- return E(
4334
- Ht,
4335
- "absolute px-2 cursor-not-allowed opacity-50 font-medium"
4336
- );
4337
- if (!e)
4338
- return E(Ht, "absolute px-2 font-medium", {
4339
- "text-copy-lighter": r === "dark",
4340
- "text-copy-dark": r === "light",
4341
- "text-copy-dark dark:text-copy-lighter": r === "system",
4342
- "text-copy-lighter dark:text-copy-dark": r === "alt-system"
4343
- });
4344
- if (e)
4345
- return E(Ht, "absolute px-2 font-medium", {
4346
- "text-copy-error-light bg-surface-darker": r === "dark",
4347
- "text-copy-error-dark": r === "light",
4348
- "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": r === "system",
4349
- "dark:text-copy-error-dark text-copy-error-light bg-surface-darker": r === "alt-system"
4350
- });
4351
- }, ii = ({
4352
- className: e,
4353
- inputClassName: t,
4354
- raw: r,
4355
- disabled: n,
4356
- noBorder: a,
4357
- error: o,
4358
- mode: s,
4359
- focusMode: i,
4360
- size: c,
4361
- rightElementClassName: m
4362
- }) => {
4363
- const f = r ? e : E(
4364
- "relative flex w-full flex-col justify-center",
4365
- Ys,
4366
- e
4367
- );
4368
- let u = "";
4369
- switch (c) {
4370
- case "xs":
4371
- u = "h-8";
4372
- break;
4373
- case "sm":
4374
- u = "h-10";
4375
- break;
4376
- case "lg":
4377
- u = "h-14";
4378
- break;
4379
- case "xl":
4380
- u = "h-16";
4381
- break;
4382
- default:
4383
- u = "h-12";
4384
- break;
4385
- }
4386
- const l = r ? E(t) : E(
4387
- Cn,
4388
- u,
4389
- "rounded-md text-base px-4",
4390
- ri({ mode: s }),
4391
- ni({ focusMode: i }),
4392
- ai({ noBorder: a, error: o }),
4393
- {
4394
- "disabled:cursor-not-allowed disabled:opacity-50": n
4395
- },
4396
- t
4397
- ), d = r ? void 0 : "sr-only", p = oi({
4398
- disabled: n,
4399
- raw: r,
4400
- error: o,
4401
- mode: s
4402
- }), y = si({
4403
- error: o,
4404
- raw: r,
4405
- mode: s,
4406
- disabled: n
4407
- }), w = r ? void 0 : E("absolute right-3", m);
4408
- return {
4409
- wrapper: f,
4410
- input: l,
4411
- accessibleLabel: d,
4412
- visibleLabel: p,
4413
- helperText: y,
4414
- rightElement: w
4415
- };
4416
- }, sr = Z.forwardRef(
4417
- ({
4418
- id: e,
4419
- name: t,
4420
- label: r,
4421
- error: n = !1,
4422
- raw: a = !1,
4423
- className: o,
4424
- inputClassName: s,
4425
- mode: i = "system",
4426
- focusMode: c = "system",
4427
- disabled: m = !1,
4428
- noBorder: f = !1,
4429
- labelId: u,
4430
- labelHidden: l = !1,
4431
- type: d = "text",
4432
- helperText: p = "",
4433
- rightElement: y,
4434
- rightElementClassName: w,
4435
- size: g = "md",
4436
- ...$
4437
- }, U) => {
4438
- const [K, I] = zs(), [D, M] = Ee(0), S = Xs({ id: e, prefix: `${Cn}-` }), v = `${t} error, ${p}`, P = x(null), A = x(null), O = {
4439
- xs: { label: "-25px", helperText: "30px" },
4440
- sm: { label: "-29px", helperText: "34px" },
4441
- md: { label: "-33px", helperText: "38px" },
4442
- lg: { label: "-15px", helperText: "22px" },
4443
- xl: { label: "-19px", helperText: "25px" }
4444
- }, R = ii({
4445
- className: o,
4446
- inputClassName: s,
4447
- error: n,
4448
- raw: a,
4449
- focusMode: c,
4450
- disabled: m,
4451
- noBorder: f,
4452
- mode: i,
4453
- size: g,
4454
- rightElementClassName: w
4455
- });
4456
- return Ue(() => {
4457
- I && I.width && M(I.width + 18 + 10);
4458
- }, [I]), Ue(() => {
4459
- var V, ee;
4460
- const { label: b, helperText: k } = O[g];
4461
- (V = P == null ? void 0 : P.current) == null || V.style.setProperty("--av-text-input-label", b), (ee = A == null ? void 0 : A.current) == null || ee.style.setProperty(
4462
- "--av-text-input-helper-text",
4463
- k
4464
- );
4465
- }, [g]), /* @__PURE__ */ Q("div", { className: R.wrapper, children: [
4466
- /* @__PURE__ */ h(
4467
- "label",
4468
- {
4469
- htmlFor: S,
4470
- id: u,
4471
- className: R.accessibleLabel,
4472
- children: r
4473
- }
4474
- ),
4475
- /* @__PURE__ */ h(
4476
- "input",
4477
- {
4478
- ref: U,
4479
- id: S,
4480
- name: t,
4481
- type: d,
4482
- disabled: m,
4483
- placeholder: a ? void 0 : " ",
4484
- className: R.input,
4485
- ...p && { "aria-describedby": `${S}-helper` },
4486
- ...n && { "aria-invalid": "true" },
4487
- ...y && !a && { style: { paddingRight: D } },
4488
- ...$
4489
- }
4490
- ),
4491
- !a && !l && /* @__PURE__ */ h(
4492
- "label",
4493
- {
4494
- ref: P,
4495
- "aria-hidden": !0,
4496
- htmlFor: S,
4497
- className: R.visibleLabel,
4498
- children: r
4499
- }
4500
- ),
4501
- p && /* @__PURE__ */ h(
4502
- "div",
4503
- {
4504
- ref: A,
4505
- id: `${S}-helper`,
4506
- className: R.helperText,
4507
- children: p
4508
- }
4509
- ),
4510
- y && /* @__PURE__ */ h(
4511
- "div",
4512
- {
4513
- ref: K,
4514
- className: R.rightElement,
4515
- children: y
4516
- }
4517
- ),
4518
- n && p && /* @__PURE__ */ h(xn, { politeness: "polite", clearAnnouncementDelay: 500, children: v })
4519
- ] });
4520
- }
4521
- );
4522
- sr.displayName = "TextInput";
4523
- function ci(e) {
4524
- return Ke(() => e.every((t) => t == null) ? () => {
4525
- } : (t) => {
4526
- e.forEach((r) => {
4527
- typeof r == "function" ? r(t) : r != null && (r.current = t);
4528
- });
4529
- }, e);
4530
- }
4531
- const li = 500, di = 5e3, ui = 2e4, Pn = Z.forwardRef(
4532
- ({
4533
- name: e,
4534
- disabled: t,
4535
- label: r,
4536
- labelHidden: n,
4537
- onMaskChange: a,
4538
- onChange: o,
4539
- onBlur: s,
4540
- onFocus: i,
4541
- onTextInputMaskBlur: c,
4542
- rightElement: m,
4543
- ...f
4544
- }, u) => {
4545
- const [l, d] = Ee(!0), [p, y] = Ee({
4546
- message: null,
4547
- politeness: null
4548
- }), w = x(!0), g = x(null), $ = x(null), U = ci([u, $]), K = l ? "Show" : "Hide", I = () => {
4549
- g.current && clearTimeout(g.current), w.current || (g.current = setTimeout(() => {
4550
- w.current = !0, d(!0), y({
4551
- announcementTimeout: di,
4552
- politeness: "polite",
4553
- message: `${r} hiding characters`
4554
- }), a && a(!0);
4555
- }, ui));
4556
- }, D = (A) => {
4557
- A.preventDefault();
4558
- const O = !w.current;
4559
- w.current = O, I(), d(O), y({
4560
- announcementTimeout: li,
4561
- politeness: "assertive",
4562
- message: O ? "Characters hidden" : "Characters showing"
4563
- }), a && a(O);
4564
- }, M = (A) => {
4565
- var O;
4566
- const { relatedTarget: R } = A, V = (O = $.current) == null ? void 0 : O.parentElement;
4567
- V != null && V.contains(R) || c && c();
4568
- }, S = (A) => {
4569
- I(), s && s(A), M(A);
4570
- }, v = (A) => {
4571
- I(), i && i(A);
4572
- }, P = (A) => {
4573
- I(), o && o(A);
4574
- };
4575
- return oe(() => () => {
4576
- g.current && clearTimeout(g.current);
4577
- }, []), /* @__PURE__ */ Q(at, { children: [
4578
- /* @__PURE__ */ h(
4579
- sr,
4580
- {
4581
- ref: U,
4582
- name: e,
4583
- label: r,
4584
- labelHidden: n,
4585
- type: l ? "password" : "text",
4586
- disabled: t,
4587
- onBlur: S,
4588
- onFocus: v,
4589
- onChange: P,
4590
- rightElement: Z.cloneElement(m, {
4591
- ref: u,
4592
- label: K,
4593
- onClick: D,
4594
- onBlur: M,
4595
- disabled: t
4596
- }),
4597
- ...f
4598
- }
4599
- ),
4600
- /* @__PURE__ */ h(
4601
- xn,
4602
- {
4603
- role: "status",
4604
- politeness: p.politeness,
4605
- clearAnnouncementDelay: p.announcementTimeout,
4606
- children: p.message
4607
- }
4608
- )
4609
- ] });
4610
- }
4611
- );
4612
- Pn.displayName = "TextInputMask";
4613
- /*!
4614
- @versini/ui-textinput v3.0.19
4615
- © 2025 gizmette.com
4616
- */
4617
- try {
4618
- window.__VERSINI_UI_TEXTINPUT__ || (window.__VERSINI_UI_TEXTINPUT__ = {
4619
- version: "3.0.19",
4620
- buildTime: "03/05/2025 01:30 PM EST",
4621
- homepage: "https://github.com/aversini/ui-components",
4622
- license: "MIT"
4623
- });
4624
- } catch {
4625
- }
4626
- const fi = "ASK! ME! ANYTHING!", Dn = "Callisto", hi = "Log in", mi = "Sign in with a Passkey", yc = "Log out", pi = "Password", Ec = "Profile", bc = "Settings", Sc = "Chat history", wc = "About", Tc = "Type your question here", _c = "{{clipboard}}", Ic = `Sometimes, ${Dn} hallucinates. Review important details.`, Ac = "Prompts are pre-filled menus available on the main screen, to help you quickly start requests. If you select the 'Temporary Chat' checkbox, the corresponding chat will not be saved. If you select the 'Clipboard Access' checkbox, your clipboard content (if any) will be provided to the request.", Rc = "Default provider set to", vc = "Chat successfully deleted!", kc = {
4627
- PREFERENCES: {
4628
- TITLE: "User profile",
4629
- NAME: "Name",
4630
- EMAIL: "Email",
4631
- LOCATION: "Location",
4632
- PASSKEY_TITLE: "Passkey",
4633
- PASSKEY_INSTRUCTIONS: "Log in password-free with a passkey (facial recognition or fingerprint authentication).",
4634
- PASSKEY_BUTTON: "Create a Passkey"
4635
- },
4636
- CURRENT_STATISTICS: {
4637
- TITLE: "Current chat statistics",
4638
- MODEL_NAME: "GPT model",
4639
- TOKENS_USED: "Tokens used",
4640
- REMAINING_TOKENS: "Remaining tokens",
4641
- PROCESSING_TIME: "Average response time"
4642
- },
4643
- MAIN_STATISTICS: {
4644
- TITLE: "Lifetime statistics",
4645
- TOTAL: "Total chat session",
4646
- PROCESSING_TIME: "Average response time"
4647
- },
4648
- HISTORY: {
4649
- TITLE: "Chat history"
4650
- },
4651
- ABOUT: {
4652
- TITLE_CLIENT: "Client details",
4653
- TITLE_SERVER: "Server details",
4654
- VERSION: "Version",
4655
- BUILD_TIMESTAMP: "Build date",
4656
- PROVIDER: "Available AI model"
4657
- },
4658
- SETTINGS_PROMPTS: {
4659
- TITLE: "Prompts"
4660
- },
4661
- SETTINGS_DETAILS: {
4662
- TITLE: "Chat Details",
4663
- INSTRUCTION: "This option adds individual statistics for each messages under their respective bubbles, such as model name, and more."
4664
- }
4665
- }, gi = () => /* @__PURE__ */ Q("div", { className: "flex items-center justify-center text-slate-300", children: [
4666
- /* @__PURE__ */ h("div", { className: "basis-1/4", children: /* @__PURE__ */ h(Ms, {}) }),
4667
- /* @__PURE__ */ Q("div", { className: "prose prose-sm prose-light md:prose-base prose-h1:mb-0 prose-h2:mt-0", children: [
4668
- /* @__PURE__ */ h("h1", { children: Dn }),
4669
- /* @__PURE__ */ h("h2", { children: fi })
4670
- ] })
4671
- ] }), yi = () => {
4672
- const { login: e, logoutReason: t, loginWithPasskey: r } = pn(), [n, a] = Ee(""), [o, s] = Ee(""), [i, c] = Ee(!0), [m, f] = Ee({
4673
- username: "",
4674
- password: ""
4675
- }), u = async (l) => {
4676
- l.preventDefault(), await e(m.username, m.password) || (s(""), a("Invalid username or password"));
4677
- };
4678
- return oe(() => {
4679
- var l;
4680
- (l = document.getElementById("logo")) == null || l.classList.add("fadeOut"), setTimeout(() => {
4681
- var d;
4682
- (d = document.getElementById("root")) == null || d.classList.replace("app-hidden", "fadeIn");
4683
- }, 500);
4684
- }), oe(() => {
4685
- t && s(t);
4686
- }, [t]), /* @__PURE__ */ h(at, { children: /* @__PURE__ */ Q(
4687
- Gs,
4688
- {
4689
- className: fs({
4690
- extraClass: "mt-5"
4691
- }),
4692
- noMargin: !0,
4693
- noPadding: !0,
4694
- children: [
4695
- /* @__PURE__ */ h(
4696
- "div",
4697
- {
4698
- className: us({
4699
- extraClass: "rounded-md"
4700
- }),
4701
- children: /* @__PURE__ */ h(gi, {})
4702
- }
4703
- ),
4704
- /* @__PURE__ */ h("form", { className: "mt-5", onSubmit: u, children: /* @__PURE__ */ h(Fs, { alignHorizontal: "center", children: /* @__PURE__ */ h(_e, { span: 6, children: /* @__PURE__ */ Q(Us, { mode: "dark", children: [
4705
- /* @__PURE__ */ h(_e, { span: 12, className: "mt-7", children: o && /* @__PURE__ */ h("div", { className: "p-2 text-sm text-center text-copy-error-light bg-surface-darker", children: o }) }),
4706
- /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h(
4707
- sr,
4708
- {
4709
- className: "mt-7",
4710
- required: !0,
4711
- autoCapitalize: "off",
4712
- autoComplete: "off",
4713
- autoCorrect: "off",
4714
- mode: "dark",
4715
- focusMode: "light",
4716
- name: "username",
4717
- label: "Username",
4718
- onChange: (l) => {
4719
- f({
4720
- ...m,
4721
- username: l.target.value
4722
- }), a("");
4723
- },
4724
- error: n !== ""
4725
- }
4726
- ) }),
4727
- /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h(
4728
- Pn,
4729
- {
4730
- className: "mt-7",
4731
- required: !0,
4732
- autoCapitalize: "off",
4733
- autoComplete: "off",
4734
- autoCorrect: "off",
4735
- mode: "dark",
4736
- focusMode: "light",
4737
- name: "password",
4738
- label: pi,
4739
- rightElement: /* @__PURE__ */ h(
4740
- ct,
4741
- {
4742
- focusMode: "light",
4743
- mode: "dark",
4744
- label: i ? "Show" : "Hide",
4745
- children: i ? /* @__PURE__ */ h(Vs, {}) : /* @__PURE__ */ h(Hs, {})
4746
- }
4747
- ),
4748
- onMaskChange: c,
4749
- onChange: (l) => {
4750
- f({
4751
- ...m,
4752
- password: l.target.value
4753
- }), a("");
4754
- },
4755
- error: n !== "",
4756
- helperText: n
4757
- }
4758
- ) }),
4759
- /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h(
4760
- kn,
4761
- {
4762
- mode: "light",
4763
- focusMode: "light",
4764
- fullWidth: !0,
4765
- noBorder: !0,
4766
- type: "submit",
4767
- className: "mt-7",
4768
- children: hi
4769
- }
4770
- ) }),
4771
- !hs() && /* @__PURE__ */ Q(at, { children: [
4772
- /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h("div", { className: "text-center text-copy-light mt-2 mb-2", children: "or" }) }),
4773
- /* @__PURE__ */ h(_e, { span: 12, children: /* @__PURE__ */ h(
4774
- ct,
4775
- {
4776
- variant: "selected",
4777
- mode: "dark",
4778
- focusMode: "light",
4779
- fullWidth: !0,
4780
- className: "mb-4",
4781
- labelRight: mi,
4782
- onClick: r,
4783
- children: /* @__PURE__ */ h(Ks, { size: "size-7" })
4784
- }
4785
- ) })
4786
- ] })
4787
- ] }) }) }) })
4788
- ]
4789
- }
4790
- ) });
4791
- }, Ei = new URL(document.location.href).searchParams, Hr = !!Ei.get("debug") || !1, bi = Kn(() => import(
4792
- /* webpackChunkName: "LazyApp" */
4793
- "./App.C-VQczE3.js"
4794
- ).then((e) => e.App)), Kr = ({
4795
- isComponent: e,
4796
- headerHeight: t
4797
- }) => {
4798
- const { isAuthenticated: r } = pn();
4799
- return r ? /* @__PURE__ */ h(Vn, { fallback: /* @__PURE__ */ h("div", {}), children: /* @__PURE__ */ h(bi, { isComponent: e, headerHeight: t }) }) : /* @__PURE__ */ h(yi, {});
4800
- }, Si = ({
4801
- isComponent: e = !1,
4802
- headerHeight: t = 0,
4803
- domain: r = ds
4804
- }) => (es(), Rn ? /* @__PURE__ */ h(
4805
- Ir,
4806
- {
4807
- clientId: Ar,
4808
- domain: r,
4809
- debug: Hr,
4810
- endpoint: process.env.PUBLIC_AUTH_SERVER_URL,
4811
- children: /* @__PURE__ */ h(Kr, { isComponent: e, headerHeight: t })
4812
- }
4813
- ) : /* @__PURE__ */ h(Ir, { clientId: Ar, domain: r, debug: Hr, children: /* @__PURE__ */ h(Kr, { isComponent: e, headerHeight: t }) })), Cc = ({ domain: e, headerHeight: t }) => /* @__PURE__ */ h(
4814
- Si,
4815
- {
4816
- isComponent: !0,
4817
- domain: e,
4818
- headerHeight: t
4819
- }
4820
- );
4821
- export {
4822
- wc as ABOUT_TITLE,
4823
- Vi as ACTION_RESET_PROMPT,
4824
- Mi as ACTION_SEARCH,
4825
- Hi as ACTION_SORT,
4826
- Ki as ACTION_TOGGLE_PROMPT,
4827
- Dn as APP_NAME,
4828
- kn as C,
4829
- kc as CARDS,
4830
- _c as CLIPBOARD_PROMPT,
4831
- Li as DEFAULT_AI_PROVIDER,
4832
- Xi as DEFAULT_ICON_ACTION_SIZE,
4833
- Di as ERROR_MESSAGE,
4834
- Ic as FOOTER_DISCLAIMER,
4835
- Sc as HISTORY_TITLE,
4836
- yt as I,
4837
- Gs as I$1,
4838
- ji as INFINITE_SCROLL_LIMIT,
4839
- Yi as INFINITE_SCROLL_THRESHOLD,
4840
- Tc as INPUT_PLACEHOLDER_TEXT,
4841
- Fs as L,
4842
- Gi as LOCAL_STORAGE_CHAT_DETAILS,
4843
- Wi as LOCAL_STORAGE_PREFIX,
4844
- Ji as LOCAL_STORAGE_PRIVATE_DISCLOSURE,
4845
- Bi as LOCAL_STORAGE_SEARCH,
4846
- Fi as LOCAL_STORAGE_SORT,
4847
- yc as LOG_OUT,
4848
- gi as Logo,
4849
- xe as M,
4850
- Ec as PROFILE_TITLE,
4851
- Ac as PROMPTS_DESCRIPTION,
4852
- qi as PROMPT_CLASSNAME,
4853
- zi as PROMPT_EDITABLE_AREA_CLASSNAME,
4854
- Ui as PROVIDER_ANTHROPIC,
4855
- $i as PROVIDER_OPENAI,
4856
- Us as R,
4857
- xi as ROLE_ASSISTANT,
4858
- Pi as ROLE_INTERNAL,
4859
- Oi as ROLE_USER,
4860
- Be as SERVICE_TYPES,
4861
- bc as SETTINGS_TITLE,
4862
- Cc as SassySaint,
4863
- vc as TOAST_CHAT_DELETED,
4864
- Rc as TOAST_PROVIDER_CHANGED,
4865
- Zi as UI_BUTTON_SCROLL_BUFFER,
4866
- ec as UI_DEFAULT_MAIN_HEIGHT,
4867
- Qi as UI_FOOTER_BUFFER,
4868
- pc as convertCamelCaseToReadable,
4869
- hc as debounce,
4870
- uc as durationFormatter,
4871
- sr as fe,
4872
- ic as getCurrentGeoLocation,
4873
- fs as getMainPaddingClass,
4874
- us as getMessageContaintWrapperClass,
4875
- hs as isElectron,
4876
- mc as isProbablyiPhone,
4877
- _e as j,
4878
- Ks as l,
4879
- cc as obfuscate,
4880
- fc as pluralize,
4881
- ct as re,
4882
- dc as renderDataAsList,
4883
- Xo as serverUrl,
4884
- zt as serviceCall,
4885
- tc as setNewProvider,
4886
- gc as toastOptions,
4887
- pn as un,
4888
- lc as unObfuscate,
4889
- ac as useChatsHistory,
4890
- oc as usePreloadChatsHistory,
4891
- zo as useSWR,
4892
- sc as useServerCapabilities,
4893
- nc as useUserChatStats,
4894
- rc as useUserPreferences
4895
- };