@versini/sassysaint 1.0.12 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3536 @@
1
+ import { jsx as c, jsxs as I, Fragment as ce } from "react/jsx-runtime";
2
+ import V, { createContext as nr, useReducer as ft, useRef as W, useCallback as z, useEffect as j, useContext as yt, useSyncExternalStore as or, useId as bt, useMemo as Et, useState as F, useLayoutEffect as sr, lazy as wt, Suspense as Tt } from "react";
3
+ import g from "clsx";
4
+ var ir = Object.defineProperty, cr = (e, t, r) => t in e ? ir(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, Le = (e, t, r) => cr(e, typeof t != "symbol" ? t + "" : t, r);
5
+ /*!
6
+ @versini/auth-provider v7.0.0
7
+ © 2024 gizmette.com
8
+ */
9
+ try {
10
+ window.__VERSINI_AUTH_CLIENT__ || (window.__VERSINI_AUTH_CLIENT__ = {
11
+ version: "7.0.0",
12
+ buildTime: "08/19/2024 06:11 PM EDT",
13
+ homepage: "https://github.com/aversini/auth-client",
14
+ license: "MIT"
15
+ });
16
+ } catch {
17
+ }
18
+ function L(e) {
19
+ const t = new Uint8Array(e);
20
+ let r = "";
21
+ for (const a of t)
22
+ r += String.fromCharCode(a);
23
+ return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
24
+ }
25
+ function Ie(e) {
26
+ const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = (4 - t.length % 4) % 4, a = t.padEnd(t.length + r, "="), n = atob(a), o = new ArrayBuffer(n.length), s = new Uint8Array(o);
27
+ for (let i = 0; i < n.length; i++)
28
+ s[i] = n.charCodeAt(i);
29
+ return o;
30
+ }
31
+ function ze() {
32
+ return (window == null ? void 0 : window.PublicKeyCredential) !== void 0 && typeof window.PublicKeyCredential == "function";
33
+ }
34
+ function It(e) {
35
+ const { id: t } = e;
36
+ return {
37
+ ...e,
38
+ id: Ie(t),
39
+ transports: e.transports
40
+ };
41
+ }
42
+ function St(e) {
43
+ return e === "localhost" || /^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e);
44
+ }
45
+ let k = class extends Error {
46
+ constructor({ message: t, code: r, cause: a, name: n }) {
47
+ super(t, { cause: a }), this.name = n ?? a.name, this.code = r;
48
+ }
49
+ };
50
+ function lr({ error: e, options: t }) {
51
+ var a, n;
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 k({
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 (((a = r.authenticatorSelection) == null ? void 0 : a.requireResidentKey) === !0)
64
+ return new k({
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 (((n = r.authenticatorSelection) == null ? void 0 : n.userVerification) === "required")
70
+ return new k({
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 k({
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 k({
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 k({
90
+ message: 'No entry in pubKeyCredParams was of type "public-key"',
91
+ code: "ERROR_MALFORMED_PUBKEYCREDPARAMS",
92
+ cause: e
93
+ }) : new k({
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 (St(o)) {
101
+ if (r.rp.id !== o)
102
+ return new k({
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 k({
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 k({
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 k({
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 dr {
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 At = new dr(), ur = ["cross-platform", "platform"];
145
+ function vt(e) {
146
+ if (e && !(ur.indexOf(e) < 0))
147
+ return e;
148
+ }
149
+ async function mr(e) {
150
+ var m;
151
+ if (!ze())
152
+ throw new Error("WebAuthn is not supported in this browser");
153
+ const t = { publicKey: {
154
+ ...e,
155
+ challenge: Ie(e.challenge),
156
+ user: {
157
+ ...e.user,
158
+ id: Ie(e.user.id)
159
+ },
160
+ excludeCredentials: (m = e.excludeCredentials) == null ? void 0 : m.map(It)
161
+ } };
162
+ t.signal = At.createNewAbortSignal();
163
+ let r;
164
+ try {
165
+ r = await navigator.credentials.create(t);
166
+ } catch (l) {
167
+ throw lr({ error: l, options: t });
168
+ }
169
+ if (!r)
170
+ throw new Error("Registration was not completed");
171
+ const { id: a, rawId: n, response: o, type: s } = r;
172
+ let i;
173
+ typeof o.getTransports == "function" && (i = o.getTransports());
174
+ let u;
175
+ if (typeof o.getPublicKeyAlgorithm == "function")
176
+ try {
177
+ u = o.getPublicKeyAlgorithm();
178
+ } catch (l) {
179
+ Me("getPublicKeyAlgorithm()", l);
180
+ }
181
+ let p;
182
+ if (typeof o.getPublicKey == "function")
183
+ try {
184
+ const l = o.getPublicKey();
185
+ l !== null && (p = L(l));
186
+ } catch (l) {
187
+ Me("getPublicKey()", l);
188
+ }
189
+ let h;
190
+ if (typeof o.getAuthenticatorData == "function")
191
+ try {
192
+ h = L(o.getAuthenticatorData());
193
+ } catch (l) {
194
+ Me("getAuthenticatorData()", l);
195
+ }
196
+ return {
197
+ id: a,
198
+ rawId: L(n),
199
+ response: {
200
+ attestationObject: L(o.attestationObject),
201
+ clientDataJSON: L(o.clientDataJSON),
202
+ transports: i,
203
+ publicKeyAlgorithm: u,
204
+ publicKey: p,
205
+ authenticatorData: h
206
+ },
207
+ type: s,
208
+ clientExtensionResults: r.getClientExtensionResults(),
209
+ authenticatorAttachment: vt(r.authenticatorAttachment)
210
+ };
211
+ }
212
+ function Me(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 hr() {
217
+ if (!ze())
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 pr({ 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 k({
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 k({
236
+ message: e.message,
237
+ code: "ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",
238
+ cause: e
239
+ });
240
+ if (e.name === "SecurityError") {
241
+ const a = window.location.hostname;
242
+ if (St(a)) {
243
+ if (r.rpId !== a)
244
+ return new k({
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 k({
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 k({
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 gr(e, t = !1) {
264
+ var m, l;
265
+ if (!ze())
266
+ throw new Error("WebAuthn is not supported in this browser");
267
+ let r;
268
+ ((m = e.allowCredentials) == null ? void 0 : m.length) !== 0 && (r = (l = e.allowCredentials) == null ? void 0 : l.map(It));
269
+ const a = {
270
+ ...e,
271
+ challenge: Ie(e.challenge),
272
+ allowCredentials: r
273
+ }, n = {};
274
+ if (t) {
275
+ if (!await hr())
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
+ n.mediation = "conditional", a.allowCredentials = [];
280
+ }
281
+ n.publicKey = a, n.signal = At.createNewAbortSignal();
282
+ let o;
283
+ try {
284
+ o = await navigator.credentials.get(n);
285
+ } catch (d) {
286
+ throw pr({ error: d, options: n });
287
+ }
288
+ if (!o)
289
+ throw new Error("Authentication was not completed");
290
+ const { id: s, rawId: i, response: u, type: p } = o;
291
+ let h;
292
+ return u.userHandle && (h = L(u.userHandle)), {
293
+ id: s,
294
+ rawId: L(i),
295
+ response: {
296
+ authenticatorData: L(u.authenticatorData),
297
+ clientDataJSON: L(u.clientDataJSON),
298
+ signature: L(u.signature),
299
+ userHandle: h
300
+ },
301
+ type: p,
302
+ clientExtensionResults: o.getClientExtensionResults(),
303
+ authenticatorAttachment: vt(o.authenticatorAttachment)
304
+ };
305
+ }
306
+ /*!
307
+ @versini/auth-common v4.0.0
308
+ © 2024 gizmette.com
309
+ */
310
+ try {
311
+ window.__VERSINI_AUTH_COMMON__ || (window.__VERSINI_AUTH_COMMON__ = {
312
+ version: "4.0.0",
313
+ buildTime: "08/19/2024 06:11 PM EDT",
314
+ homepage: "https://github.com/aversini/auth-client",
315
+ license: "MIT"
316
+ });
317
+ } catch {
318
+ }
319
+ const _e = {
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
+ }, kt = {
327
+ CLIENT_ID: "X-Auth-ClientId"
328
+ }, R = {
329
+ ALG: "RS256",
330
+ USER_ID_KEY: "sub",
331
+ TOKEN_ID_KEY: "__raw",
332
+ NONCE_KEY: "_nonce",
333
+ USERNAME_KEY: "username",
334
+ AUTH_TYPE_KEY: "auth_type",
335
+ EXPIRES_AT_KEY: "exp",
336
+ CREATED_AT_KEY: "iat",
337
+ SCOPES_KEY: "scopes",
338
+ CLIENT_ID_KEY: "aud",
339
+ ISSUER: "gizmette.com"
340
+ }, fr = `-----BEGIN PUBLIC KEY-----
341
+ MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsF6i3Jd9fY/3COqCw/m7
342
+ w5PKyTYLGAI2I6SIIdpe6i6DOCbEkmDz7LdVsBqwNtVi8gvWYIj+8ol6rU3qu1v5
343
+ i1Jd45GSK4kzkVdgCmQZbM5ak0KI99q5wsrAIzUd+LRJ2HRvWtr5IYdsIiXaQjle
344
+ aMwPFOIcJH+rKfFgNcHLcaS5syp7zU1ANwZ+trgR+DifBr8TLVkBynmNeTyhDm2+
345
+ l0haqjMk0UoNPPE8iYBWUHQJJE1Dqstj65d6Eh5g64Pao25y4cmYJbKjiblIGEkE
346
+ sjqybA9mARAqh9k/eiIopecWSiffNQTwVQVd2I9ZH3BalhEXHlqFgrjz51kFqg81
347
+ awIDAQAB
348
+ -----END PUBLIC KEY-----`, Re = {
349
+ CODE: "code",
350
+ LOGOUT: "logout",
351
+ LOGIN: "login",
352
+ REFRESH: "refresh"
353
+ }, Ne = crypto, _t = (e) => e instanceof CryptoKey, ue = new TextEncoder(), le = new TextDecoder();
354
+ function yr(...e) {
355
+ const t = e.reduce((n, { length: o }) => n + o, 0), r = new Uint8Array(t);
356
+ let a = 0;
357
+ for (const n of e)
358
+ r.set(n, a), a += n.length;
359
+ return r;
360
+ }
361
+ const br = (e) => {
362
+ const t = atob(e), r = new Uint8Array(t.length);
363
+ for (let a = 0; a < t.length; a++)
364
+ r[a] = t.charCodeAt(a);
365
+ return r;
366
+ }, se = (e) => {
367
+ let t = e;
368
+ t instanceof Uint8Array && (t = le.decode(t)), t = t.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
369
+ try {
370
+ return br(t);
371
+ } catch {
372
+ throw new TypeError("The input to be decoded is not correctly encoded.");
373
+ }
374
+ };
375
+ let q = class extends Error {
376
+ static get code() {
377
+ return "ERR_JOSE_GENERIC";
378
+ }
379
+ constructor(t) {
380
+ var r;
381
+ super(t), this.code = "ERR_JOSE_GENERIC", this.name = this.constructor.name, (r = Error.captureStackTrace) == null || r.call(Error, this, this.constructor);
382
+ }
383
+ };
384
+ class $ extends q {
385
+ static get code() {
386
+ return "ERR_JWT_CLAIM_VALIDATION_FAILED";
387
+ }
388
+ constructor(t, r, a = "unspecified", n = "unspecified") {
389
+ super(t), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = a, this.reason = n, this.payload = r;
390
+ }
391
+ }
392
+ class tt extends q {
393
+ static get code() {
394
+ return "ERR_JWT_EXPIRED";
395
+ }
396
+ constructor(t, r, a = "unspecified", n = "unspecified") {
397
+ super(t), this.code = "ERR_JWT_EXPIRED", this.claim = a, this.reason = n, this.payload = r;
398
+ }
399
+ }
400
+ class Er extends q {
401
+ constructor() {
402
+ super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
403
+ }
404
+ static get code() {
405
+ return "ERR_JOSE_ALG_NOT_ALLOWED";
406
+ }
407
+ }
408
+ class Y extends q {
409
+ constructor() {
410
+ super(...arguments), this.code = "ERR_JOSE_NOT_SUPPORTED";
411
+ }
412
+ static get code() {
413
+ return "ERR_JOSE_NOT_SUPPORTED";
414
+ }
415
+ }
416
+ let v = class extends q {
417
+ constructor() {
418
+ super(...arguments), this.code = "ERR_JWS_INVALID";
419
+ }
420
+ static get code() {
421
+ return "ERR_JWS_INVALID";
422
+ }
423
+ }, G = class extends q {
424
+ constructor() {
425
+ super(...arguments), this.code = "ERR_JWT_INVALID";
426
+ }
427
+ static get code() {
428
+ return "ERR_JWT_INVALID";
429
+ }
430
+ };
431
+ class wr extends q {
432
+ constructor() {
433
+ super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
434
+ }
435
+ static get code() {
436
+ return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
437
+ }
438
+ }
439
+ function B(e, t = "algorithm.name") {
440
+ return new TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`);
441
+ }
442
+ function me(e, t) {
443
+ return e.name === t;
444
+ }
445
+ function Ue(e) {
446
+ return parseInt(e.name.slice(4), 10);
447
+ }
448
+ function Tr(e) {
449
+ switch (e) {
450
+ case "ES256":
451
+ return "P-256";
452
+ case "ES384":
453
+ return "P-384";
454
+ case "ES512":
455
+ return "P-521";
456
+ default:
457
+ throw new Error("unreachable");
458
+ }
459
+ }
460
+ function Ir(e, t) {
461
+ if (t.length && !t.some((r) => e.usages.includes(r))) {
462
+ let r = "CryptoKey does not support this operation, its usages must include ";
463
+ if (t.length > 2) {
464
+ const a = t.pop();
465
+ r += `one of ${t.join(", ")}, or ${a}.`;
466
+ } else t.length === 2 ? r += `one of ${t[0]} or ${t[1]}.` : r += `${t[0]}.`;
467
+ throw new TypeError(r);
468
+ }
469
+ }
470
+ function Sr(e, t, ...r) {
471
+ switch (t) {
472
+ case "HS256":
473
+ case "HS384":
474
+ case "HS512": {
475
+ if (!me(e.algorithm, "HMAC"))
476
+ throw B("HMAC");
477
+ const a = parseInt(t.slice(2), 10);
478
+ if (Ue(e.algorithm.hash) !== a)
479
+ throw B(`SHA-${a}`, "algorithm.hash");
480
+ break;
481
+ }
482
+ case "RS256":
483
+ case "RS384":
484
+ case "RS512": {
485
+ if (!me(e.algorithm, "RSASSA-PKCS1-v1_5"))
486
+ throw B("RSASSA-PKCS1-v1_5");
487
+ const a = parseInt(t.slice(2), 10);
488
+ if (Ue(e.algorithm.hash) !== a)
489
+ throw B(`SHA-${a}`, "algorithm.hash");
490
+ break;
491
+ }
492
+ case "PS256":
493
+ case "PS384":
494
+ case "PS512": {
495
+ if (!me(e.algorithm, "RSA-PSS"))
496
+ throw B("RSA-PSS");
497
+ const a = parseInt(t.slice(2), 10);
498
+ if (Ue(e.algorithm.hash) !== a)
499
+ throw B(`SHA-${a}`, "algorithm.hash");
500
+ break;
501
+ }
502
+ case "EdDSA": {
503
+ if (e.algorithm.name !== "Ed25519" && e.algorithm.name !== "Ed448")
504
+ throw B("Ed25519 or Ed448");
505
+ break;
506
+ }
507
+ case "ES256":
508
+ case "ES384":
509
+ case "ES512": {
510
+ if (!me(e.algorithm, "ECDSA"))
511
+ throw B("ECDSA");
512
+ const a = Tr(t);
513
+ if (e.algorithm.namedCurve !== a)
514
+ throw B(a, "algorithm.namedCurve");
515
+ break;
516
+ }
517
+ default:
518
+ throw new TypeError("CryptoKey does not support this operation");
519
+ }
520
+ Ir(e, r);
521
+ }
522
+ function Rt(e, t, ...r) {
523
+ var a;
524
+ if (r.length > 2) {
525
+ const n = r.pop();
526
+ e += `one of type ${r.join(", ")}, or ${n}.`;
527
+ } else r.length === 2 ? e += `one of type ${r[0]} or ${r[1]}.` : e += `of type ${r[0]}.`;
528
+ return t == null ? e += ` Received ${t}` : typeof t == "function" && t.name ? e += ` Received function ${t.name}` : typeof t == "object" && t != null && (a = t.constructor) != null && a.name && (e += ` Received an instance of ${t.constructor.name}`), e;
529
+ }
530
+ const rt = (e, ...t) => Rt("Key must be ", e, ...t);
531
+ function Nt(e, t, ...r) {
532
+ return Rt(`Key for the ${e} algorithm must be `, t, ...r);
533
+ }
534
+ const xt = (e) => _t(e) ? !0 : (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Se = ["CryptoKey"], Ar = (...e) => {
535
+ const t = e.filter(Boolean);
536
+ if (t.length === 0 || t.length === 1)
537
+ return !0;
538
+ let r;
539
+ for (const a of t) {
540
+ const n = Object.keys(a);
541
+ if (!r || r.size === 0) {
542
+ r = new Set(n);
543
+ continue;
544
+ }
545
+ for (const o of n) {
546
+ if (r.has(o))
547
+ return !1;
548
+ r.add(o);
549
+ }
550
+ }
551
+ return !0;
552
+ };
553
+ function vr(e) {
554
+ return typeof e == "object" && e !== null;
555
+ }
556
+ function Ae(e) {
557
+ if (!vr(e) || Object.prototype.toString.call(e) !== "[object Object]")
558
+ return !1;
559
+ if (Object.getPrototypeOf(e) === null)
560
+ return !0;
561
+ let t = e;
562
+ for (; Object.getPrototypeOf(t) !== null; )
563
+ t = Object.getPrototypeOf(t);
564
+ return Object.getPrototypeOf(e) === t;
565
+ }
566
+ const kr = (e, t) => {
567
+ if (e.startsWith("RS") || e.startsWith("PS")) {
568
+ const { modulusLength: r } = t.algorithm;
569
+ if (typeof r != "number" || r < 2048)
570
+ throw new TypeError(`${e} requires key modulusLength to be 2048 bits or larger`);
571
+ }
572
+ };
573
+ function _r(e) {
574
+ let t, r;
575
+ switch (e.kty) {
576
+ case "RSA": {
577
+ switch (e.alg) {
578
+ case "PS256":
579
+ case "PS384":
580
+ case "PS512":
581
+ t = { name: "RSA-PSS", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
582
+ break;
583
+ case "RS256":
584
+ case "RS384":
585
+ case "RS512":
586
+ t = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${e.alg.slice(-3)}` }, r = e.d ? ["sign"] : ["verify"];
587
+ break;
588
+ case "RSA-OAEP":
589
+ case "RSA-OAEP-256":
590
+ case "RSA-OAEP-384":
591
+ case "RSA-OAEP-512":
592
+ t = {
593
+ name: "RSA-OAEP",
594
+ hash: `SHA-${parseInt(e.alg.slice(-3), 10) || 1}`
595
+ }, r = e.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
596
+ break;
597
+ default:
598
+ throw new Y('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
599
+ }
600
+ break;
601
+ }
602
+ case "EC": {
603
+ switch (e.alg) {
604
+ case "ES256":
605
+ t = { name: "ECDSA", namedCurve: "P-256" }, r = e.d ? ["sign"] : ["verify"];
606
+ break;
607
+ case "ES384":
608
+ t = { name: "ECDSA", namedCurve: "P-384" }, r = e.d ? ["sign"] : ["verify"];
609
+ break;
610
+ case "ES512":
611
+ t = { name: "ECDSA", namedCurve: "P-521" }, r = e.d ? ["sign"] : ["verify"];
612
+ break;
613
+ case "ECDH-ES":
614
+ case "ECDH-ES+A128KW":
615
+ case "ECDH-ES+A192KW":
616
+ case "ECDH-ES+A256KW":
617
+ t = { name: "ECDH", namedCurve: e.crv }, r = e.d ? ["deriveBits"] : [];
618
+ break;
619
+ default:
620
+ throw new Y('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
621
+ }
622
+ break;
623
+ }
624
+ case "OKP": {
625
+ switch (e.alg) {
626
+ case "EdDSA":
627
+ t = { name: e.crv }, r = e.d ? ["sign"] : ["verify"];
628
+ break;
629
+ case "ECDH-ES":
630
+ case "ECDH-ES+A128KW":
631
+ case "ECDH-ES+A192KW":
632
+ case "ECDH-ES+A256KW":
633
+ t = { name: e.crv }, r = e.d ? ["deriveBits"] : [];
634
+ break;
635
+ default:
636
+ throw new Y('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
637
+ }
638
+ break;
639
+ }
640
+ default:
641
+ throw new Y('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
642
+ }
643
+ return { algorithm: t, keyUsages: r };
644
+ }
645
+ const Rr = async (e) => {
646
+ if (!e.alg)
647
+ throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
648
+ const { algorithm: t, keyUsages: r } = _r(e), a = [
649
+ t,
650
+ e.ext ?? !1,
651
+ e.key_ops ?? r
652
+ ], n = { ...e };
653
+ return delete n.alg, delete n.use, Ne.subtle.importKey("jwk", n, ...a);
654
+ }, Ct = (e) => se(e);
655
+ let He, Ke;
656
+ const Ot = (e) => (e == null ? void 0 : e[Symbol.toStringTag]) === "KeyObject", Pt = async (e, t, r, a) => {
657
+ let n = e.get(t);
658
+ if (n != null && n[a])
659
+ return n[a];
660
+ const o = await Rr({ ...r, alg: a });
661
+ return n ? n[a] = o : e.set(t, { [a]: o }), o;
662
+ }, Nr = (e, t) => {
663
+ if (Ot(e)) {
664
+ let r = e.export({ format: "jwk" });
665
+ return delete r.d, delete r.dp, delete r.dq, delete r.p, delete r.q, delete r.qi, r.k ? Ct(r.k) : (Ke || (Ke = /* @__PURE__ */ new WeakMap()), Pt(Ke, e, r, t));
666
+ }
667
+ return e;
668
+ }, xr = (e, t) => {
669
+ if (Ot(e)) {
670
+ let r = e.export({ format: "jwk" });
671
+ return r.k ? Ct(r.k) : (He || (He = /* @__PURE__ */ new WeakMap()), Pt(He, e, r, t));
672
+ }
673
+ return e;
674
+ }, Cr = { normalizePublicKey: Nr, normalizePrivateKey: xr }, J = (e, t, r = 0) => {
675
+ r === 0 && (t.unshift(t.length), t.unshift(6));
676
+ const a = e.indexOf(t[0], r);
677
+ if (a === -1)
678
+ return !1;
679
+ const n = e.subarray(a, a + t.length);
680
+ return n.length !== t.length ? !1 : n.every((o, s) => o === t[s]) || J(e, t, a + 1);
681
+ }, at = (e) => {
682
+ switch (!0) {
683
+ case J(e, [42, 134, 72, 206, 61, 3, 1, 7]):
684
+ return "P-256";
685
+ case J(e, [43, 129, 4, 0, 34]):
686
+ return "P-384";
687
+ case J(e, [43, 129, 4, 0, 35]):
688
+ return "P-521";
689
+ case J(e, [43, 101, 110]):
690
+ return "X25519";
691
+ case J(e, [43, 101, 111]):
692
+ return "X448";
693
+ case J(e, [43, 101, 112]):
694
+ return "Ed25519";
695
+ case J(e, [43, 101, 113]):
696
+ return "Ed448";
697
+ default:
698
+ throw new Y("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
699
+ }
700
+ }, Or = async (e, t, r, a, n) => {
701
+ let o, s;
702
+ const i = new Uint8Array(atob(r.replace(e, "")).split("").map((u) => u.charCodeAt(0)));
703
+ switch (a) {
704
+ case "PS256":
705
+ case "PS384":
706
+ case "PS512":
707
+ o = { name: "RSA-PSS", hash: `SHA-${a.slice(-3)}` }, s = ["verify"];
708
+ break;
709
+ case "RS256":
710
+ case "RS384":
711
+ case "RS512":
712
+ o = { name: "RSASSA-PKCS1-v1_5", hash: `SHA-${a.slice(-3)}` }, s = ["verify"];
713
+ break;
714
+ case "RSA-OAEP":
715
+ case "RSA-OAEP-256":
716
+ case "RSA-OAEP-384":
717
+ case "RSA-OAEP-512":
718
+ o = {
719
+ name: "RSA-OAEP",
720
+ hash: `SHA-${parseInt(a.slice(-3), 10) || 1}`
721
+ }, s = ["encrypt", "wrapKey"];
722
+ break;
723
+ case "ES256":
724
+ o = { name: "ECDSA", namedCurve: "P-256" }, s = ["verify"];
725
+ break;
726
+ case "ES384":
727
+ o = { name: "ECDSA", namedCurve: "P-384" }, s = ["verify"];
728
+ break;
729
+ case "ES512":
730
+ o = { name: "ECDSA", namedCurve: "P-521" }, s = ["verify"];
731
+ break;
732
+ case "ECDH-ES":
733
+ case "ECDH-ES+A128KW":
734
+ case "ECDH-ES+A192KW":
735
+ case "ECDH-ES+A256KW": {
736
+ const u = at(i);
737
+ o = u.startsWith("P-") ? { name: "ECDH", namedCurve: u } : { name: u }, s = [];
738
+ break;
739
+ }
740
+ case "EdDSA":
741
+ o = { name: at(i) }, s = ["verify"];
742
+ break;
743
+ default:
744
+ throw new Y('Invalid or unsupported "alg" (Algorithm) value');
745
+ }
746
+ return Ne.subtle.importKey(t, i, o, !1, s);
747
+ }, Pr = (e, t, r) => Or(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", e, t);
748
+ async function Dr(e, t, r) {
749
+ if (e.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
750
+ throw new TypeError('"spki" must be SPKI formatted string');
751
+ return Pr(e, t);
752
+ }
753
+ const Ee = (e) => e == null ? void 0 : e[Symbol.toStringTag], $r = (e, t) => {
754
+ if (!(t instanceof Uint8Array)) {
755
+ if (!xt(t))
756
+ throw new TypeError(Nt(e, t, ...Se, "Uint8Array"));
757
+ if (t.type !== "secret")
758
+ throw new TypeError(`${Ee(t)} instances for symmetric algorithms must be of type "secret"`);
759
+ }
760
+ }, Lr = (e, t, r) => {
761
+ if (!xt(t))
762
+ throw new TypeError(Nt(e, t, ...Se));
763
+ if (t.type === "secret")
764
+ throw new TypeError(`${Ee(t)} instances for asymmetric algorithms must not be of type "secret"`);
765
+ if (t.algorithm && r === "verify" && t.type === "private")
766
+ throw new TypeError(`${Ee(t)} instances for asymmetric algorithm verifying must be of type "public"`);
767
+ if (t.algorithm && r === "encrypt" && t.type === "private")
768
+ throw new TypeError(`${Ee(t)} instances for asymmetric algorithm encryption must be of type "public"`);
769
+ }, Mr = (e, t, r) => {
770
+ e.startsWith("HS") || e === "dir" || e.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(e) ? $r(e, t) : Lr(e, t, r);
771
+ };
772
+ function Ur(e, t, r, a, n) {
773
+ if (n.crit !== void 0 && (a == null ? void 0 : a.crit) === void 0)
774
+ throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');
775
+ if (!a || a.crit === void 0)
776
+ return /* @__PURE__ */ new Set();
777
+ if (!Array.isArray(a.crit) || a.crit.length === 0 || a.crit.some((s) => typeof s != "string" || s.length === 0))
778
+ throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
779
+ let o;
780
+ r !== void 0 ? o = new Map([...Object.entries(r), ...t.entries()]) : o = t;
781
+ for (const s of a.crit) {
782
+ if (!o.has(s))
783
+ throw new Y(`Extension Header Parameter "${s}" is not recognized`);
784
+ if (n[s] === void 0)
785
+ throw new e(`Extension Header Parameter "${s}" is missing`);
786
+ if (o.get(s) && a[s] === void 0)
787
+ throw new e(`Extension Header Parameter "${s}" MUST be integrity protected`);
788
+ }
789
+ return new Set(a.crit);
790
+ }
791
+ const Hr = (e, t) => {
792
+ if (t !== void 0 && (!Array.isArray(t) || t.some((r) => typeof r != "string")))
793
+ throw new TypeError(`"${e}" option must be an array of strings`);
794
+ if (t)
795
+ return new Set(t);
796
+ };
797
+ function Kr(e, t) {
798
+ const r = `SHA-${e.slice(-3)}`;
799
+ switch (e) {
800
+ case "HS256":
801
+ case "HS384":
802
+ case "HS512":
803
+ return { hash: r, name: "HMAC" };
804
+ case "PS256":
805
+ case "PS384":
806
+ case "PS512":
807
+ return { hash: r, name: "RSA-PSS", saltLength: e.slice(-3) >> 3 };
808
+ case "RS256":
809
+ case "RS384":
810
+ case "RS512":
811
+ return { hash: r, name: "RSASSA-PKCS1-v1_5" };
812
+ case "ES256":
813
+ case "ES384":
814
+ case "ES512":
815
+ return { hash: r, name: "ECDSA", namedCurve: t.namedCurve };
816
+ case "EdDSA":
817
+ return { name: t.name };
818
+ default:
819
+ throw new Y(`alg ${e} is not supported either by JOSE or your javascript runtime`);
820
+ }
821
+ }
822
+ async function Br(e, t, r) {
823
+ if (t = await Cr.normalizePublicKey(t, e), _t(t))
824
+ return Sr(t, e, r), t;
825
+ if (t instanceof Uint8Array) {
826
+ if (!e.startsWith("HS"))
827
+ throw new TypeError(rt(t, ...Se));
828
+ return Ne.subtle.importKey("raw", t, { hash: `SHA-${e.slice(-3)}`, name: "HMAC" }, !1, [r]);
829
+ }
830
+ throw new TypeError(rt(t, ...Se, "Uint8Array"));
831
+ }
832
+ const Gr = async (e, t, r, a) => {
833
+ const n = await Br(e, t, "verify");
834
+ kr(e, n);
835
+ const o = Kr(e, n.algorithm);
836
+ try {
837
+ return await Ne.subtle.verify(o, n, r, a);
838
+ } catch {
839
+ return !1;
840
+ }
841
+ };
842
+ async function Wr(e, t, r) {
843
+ if (!Ae(e))
844
+ throw new v("Flattened JWS must be an object");
845
+ if (e.protected === void 0 && e.header === void 0)
846
+ throw new v('Flattened JWS must have either of the "protected" or "header" members');
847
+ if (e.protected !== void 0 && typeof e.protected != "string")
848
+ throw new v("JWS Protected Header incorrect type");
849
+ if (e.payload === void 0)
850
+ throw new v("JWS Payload missing");
851
+ if (typeof e.signature != "string")
852
+ throw new v("JWS Signature missing or incorrect type");
853
+ if (e.header !== void 0 && !Ae(e.header))
854
+ throw new v("JWS Unprotected Header incorrect type");
855
+ let a = {};
856
+ if (e.protected)
857
+ try {
858
+ const f = se(e.protected);
859
+ a = JSON.parse(le.decode(f));
860
+ } catch {
861
+ throw new v("JWS Protected Header is invalid");
862
+ }
863
+ if (!Ar(a, e.header))
864
+ throw new v("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
865
+ const n = {
866
+ ...a,
867
+ ...e.header
868
+ }, o = Ur(v, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, a, n);
869
+ let s = !0;
870
+ if (o.has("b64") && (s = a.b64, typeof s != "boolean"))
871
+ throw new v('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
872
+ const { alg: i } = n;
873
+ if (typeof i != "string" || !i)
874
+ throw new v('JWS "alg" (Algorithm) Header Parameter missing or invalid');
875
+ const u = r && Hr("algorithms", r.algorithms);
876
+ if (u && !u.has(i))
877
+ throw new Er('"alg" (Algorithm) Header Parameter value not allowed');
878
+ if (s) {
879
+ if (typeof e.payload != "string")
880
+ throw new v("JWS Payload must be a string");
881
+ } else if (typeof e.payload != "string" && !(e.payload instanceof Uint8Array))
882
+ throw new v("JWS Payload must be a string or an Uint8Array instance");
883
+ let p = !1;
884
+ typeof t == "function" && (t = await t(a, e), p = !0), Mr(i, t, "verify");
885
+ const h = yr(ue.encode(e.protected ?? ""), ue.encode("."), typeof e.payload == "string" ? ue.encode(e.payload) : e.payload);
886
+ let m;
887
+ try {
888
+ m = se(e.signature);
889
+ } catch {
890
+ throw new v("Failed to base64url decode the signature");
891
+ }
892
+ if (!await Gr(i, t, m, h))
893
+ throw new wr();
894
+ let l;
895
+ if (s)
896
+ try {
897
+ l = se(e.payload);
898
+ } catch {
899
+ throw new v("Failed to base64url decode the payload");
900
+ }
901
+ else typeof e.payload == "string" ? l = ue.encode(e.payload) : l = e.payload;
902
+ const d = { payload: l };
903
+ return e.protected !== void 0 && (d.protectedHeader = a), e.header !== void 0 && (d.unprotectedHeader = e.header), p ? { ...d, key: t } : d;
904
+ }
905
+ async function Vr(e, t, r) {
906
+ if (e instanceof Uint8Array && (e = le.decode(e)), typeof e != "string")
907
+ throw new v("Compact JWS must be a string or Uint8Array");
908
+ const { 0: a, 1: n, 2: o, length: s } = e.split(".");
909
+ if (s !== 3)
910
+ throw new v("Invalid Compact JWS");
911
+ const i = await Wr({ payload: n, protected: a, signature: o }, t, r), u = { payload: i.payload, protectedHeader: i.protectedHeader };
912
+ return typeof t == "function" ? { ...u, key: i.key } : u;
913
+ }
914
+ const Jr = (e) => Math.floor(e.getTime() / 1e3), Dt = 60, $t = Dt * 60, je = $t * 24, Fr = je * 7, Yr = je * 365.25, zr = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i, nt = (e) => {
915
+ const t = zr.exec(e);
916
+ if (!t || t[4] && t[1])
917
+ throw new TypeError("Invalid time period format");
918
+ const r = parseFloat(t[2]), a = t[3].toLowerCase();
919
+ let n;
920
+ switch (a) {
921
+ case "sec":
922
+ case "secs":
923
+ case "second":
924
+ case "seconds":
925
+ case "s":
926
+ n = Math.round(r);
927
+ break;
928
+ case "minute":
929
+ case "minutes":
930
+ case "min":
931
+ case "mins":
932
+ case "m":
933
+ n = Math.round(r * Dt);
934
+ break;
935
+ case "hour":
936
+ case "hours":
937
+ case "hr":
938
+ case "hrs":
939
+ case "h":
940
+ n = Math.round(r * $t);
941
+ break;
942
+ case "day":
943
+ case "days":
944
+ case "d":
945
+ n = Math.round(r * je);
946
+ break;
947
+ case "week":
948
+ case "weeks":
949
+ case "w":
950
+ n = Math.round(r * Fr);
951
+ break;
952
+ default:
953
+ n = Math.round(r * Yr);
954
+ break;
955
+ }
956
+ return t[1] === "-" || t[4] === "ago" ? -n : n;
957
+ }, ot = (e) => e.toLowerCase().replace(/^application\//, ""), jr = (e, t) => typeof e == "string" ? t.includes(e) : Array.isArray(e) ? t.some(Set.prototype.has.bind(new Set(e))) : !1, qr = (e, t, r = {}) => {
958
+ let a;
959
+ try {
960
+ a = JSON.parse(le.decode(t));
961
+ } catch {
962
+ }
963
+ if (!Ae(a))
964
+ throw new G("JWT Claims Set must be a top-level JSON object");
965
+ const { typ: n } = r;
966
+ if (n && (typeof e.typ != "string" || ot(e.typ) !== ot(n)))
967
+ throw new $('unexpected "typ" JWT header value', a, "typ", "check_failed");
968
+ const { requiredClaims: o = [], issuer: s, subject: i, audience: u, maxTokenAge: p } = r, h = [...o];
969
+ p !== void 0 && h.push("iat"), u !== void 0 && h.push("aud"), i !== void 0 && h.push("sub"), s !== void 0 && h.push("iss");
970
+ for (const f of new Set(h.reverse()))
971
+ if (!(f in a))
972
+ throw new $(`missing required "${f}" claim`, a, f, "missing");
973
+ if (s && !(Array.isArray(s) ? s : [s]).includes(a.iss))
974
+ throw new $('unexpected "iss" claim value', a, "iss", "check_failed");
975
+ if (i && a.sub !== i)
976
+ throw new $('unexpected "sub" claim value', a, "sub", "check_failed");
977
+ if (u && !jr(a.aud, typeof u == "string" ? [u] : u))
978
+ throw new $('unexpected "aud" claim value', a, "aud", "check_failed");
979
+ let m;
980
+ switch (typeof r.clockTolerance) {
981
+ case "string":
982
+ m = nt(r.clockTolerance);
983
+ break;
984
+ case "number":
985
+ m = r.clockTolerance;
986
+ break;
987
+ case "undefined":
988
+ m = 0;
989
+ break;
990
+ default:
991
+ throw new TypeError("Invalid clockTolerance option type");
992
+ }
993
+ const { currentDate: l } = r, d = Jr(l || /* @__PURE__ */ new Date());
994
+ if ((a.iat !== void 0 || p) && typeof a.iat != "number")
995
+ throw new $('"iat" claim must be a number', a, "iat", "invalid");
996
+ if (a.nbf !== void 0) {
997
+ if (typeof a.nbf != "number")
998
+ throw new $('"nbf" claim must be a number', a, "nbf", "invalid");
999
+ if (a.nbf > d + m)
1000
+ throw new $('"nbf" claim timestamp check failed', a, "nbf", "check_failed");
1001
+ }
1002
+ if (a.exp !== void 0) {
1003
+ if (typeof a.exp != "number")
1004
+ throw new $('"exp" claim must be a number', a, "exp", "invalid");
1005
+ if (a.exp <= d - m)
1006
+ throw new tt('"exp" claim timestamp check failed', a, "exp", "check_failed");
1007
+ }
1008
+ if (p) {
1009
+ const f = d - a.iat, E = typeof p == "number" ? p : nt(p);
1010
+ if (f - m > E)
1011
+ throw new tt('"iat" claim timestamp check failed (too far in the past)', a, "iat", "check_failed");
1012
+ if (f < 0 - m)
1013
+ throw new $('"iat" claim timestamp check failed (it should be in the past)', a, "iat", "check_failed");
1014
+ }
1015
+ return a;
1016
+ };
1017
+ async function Qr(e, t, r) {
1018
+ var a;
1019
+ const n = await Vr(e, t, r);
1020
+ if ((a = n.protectedHeader.crit) != null && a.includes("b64") && n.protectedHeader.b64 === !1)
1021
+ throw new G("JWTs MUST NOT use unencoded payload");
1022
+ const o = { payload: qr(n.protectedHeader, n.payload, r), protectedHeader: n.protectedHeader };
1023
+ return typeof t == "function" ? { ...o, key: n.key } : o;
1024
+ }
1025
+ const Xr = se;
1026
+ function Zr(e) {
1027
+ if (typeof e != "string")
1028
+ throw new G("JWTs must use Compact JWS serialization, JWT must be a string");
1029
+ const { 1: t, length: r } = e.split(".");
1030
+ if (r === 5)
1031
+ throw new G("Only JWTs using Compact JWS serialization can be decoded");
1032
+ if (r !== 3)
1033
+ throw new G("Invalid JWT");
1034
+ if (!t)
1035
+ throw new G("JWTs must contain a payload");
1036
+ let a;
1037
+ try {
1038
+ a = Xr(t);
1039
+ } catch {
1040
+ throw new G("Failed to base64url decode the payload");
1041
+ }
1042
+ let n;
1043
+ try {
1044
+ n = JSON.parse(le.decode(a));
1045
+ } catch {
1046
+ throw new G("Failed to parse the decoded payload as JSON");
1047
+ }
1048
+ if (!Ae(n))
1049
+ throw new G("Invalid JWT Claims Set");
1050
+ return n;
1051
+ }
1052
+ const ie = async (e) => {
1053
+ try {
1054
+ const t = R.ALG, r = await Dr(fr, t);
1055
+ return await Qr(e, r, {
1056
+ issuer: R.ISSUER
1057
+ });
1058
+ } catch {
1059
+ return;
1060
+ }
1061
+ }, ea = (e) => {
1062
+ try {
1063
+ return Zr(e);
1064
+ } catch {
1065
+ return;
1066
+ }
1067
+ };
1068
+ var S = [];
1069
+ for (var Be = 0; Be < 256; ++Be)
1070
+ S.push((Be + 256).toString(16).slice(1));
1071
+ function ta(e, t = 0) {
1072
+ return (S[e[t + 0]] + S[e[t + 1]] + S[e[t + 2]] + S[e[t + 3]] + "-" + S[e[t + 4]] + S[e[t + 5]] + "-" + S[e[t + 6]] + S[e[t + 7]] + "-" + S[e[t + 8]] + S[e[t + 9]] + "-" + S[e[t + 10]] + S[e[t + 11]] + S[e[t + 12]] + S[e[t + 13]] + S[e[t + 14]] + S[e[t + 15]]).toLowerCase();
1073
+ }
1074
+ var he, ra = new Uint8Array(16);
1075
+ function aa() {
1076
+ if (!he && (he = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !he))
1077
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1078
+ return he(ra);
1079
+ }
1080
+ var na = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1081
+ const st = {
1082
+ randomUUID: na
1083
+ };
1084
+ function it(e, t, r) {
1085
+ if (st.randomUUID && !t && !e)
1086
+ return st.randomUUID();
1087
+ e = e || {};
1088
+ var a = e.random || (e.rng || aa)();
1089
+ return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, ta(a);
1090
+ }
1091
+ const ct = globalThis.crypto, oa = (e) => `${it()}${it()}`.slice(0, e), sa = (e) => btoa(
1092
+ [...new Uint8Array(e)].map((t) => String.fromCharCode(t)).join("")
1093
+ );
1094
+ async function ia(e) {
1095
+ if (!ct.subtle)
1096
+ throw new Error(
1097
+ "crypto.subtle is available only in secure contexts (HTTPS)."
1098
+ );
1099
+ const t = new TextEncoder().encode(e), r = await ct.subtle.digest("SHA-256", t);
1100
+ return sa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
1101
+ }
1102
+ async function ca(e) {
1103
+ const t = oa(43), r = await ia(t);
1104
+ return {
1105
+ code_verifier: t,
1106
+ code_challenge: r
1107
+ };
1108
+ }
1109
+ function Lt(e, t) {
1110
+ window.dispatchEvent(new StorageEvent("storage", { key: e, newValue: t }));
1111
+ }
1112
+ const lt = (e, t) => {
1113
+ const r = JSON.stringify(
1114
+ typeof t == "function" ? t() : t
1115
+ );
1116
+ window.localStorage.setItem(e, r), Lt(e, r);
1117
+ }, la = (e) => {
1118
+ window.localStorage.removeItem(e), Lt(e, null);
1119
+ }, dt = (e) => window.localStorage.getItem(e), da = (e) => (window.addEventListener("storage", e), () => window.removeEventListener("storage", e));
1120
+ function pe({
1121
+ key: e,
1122
+ initialValue: t
1123
+ }) {
1124
+ const r = or(da, () => dt(e)), a = z(
1125
+ (s) => {
1126
+ try {
1127
+ const i = typeof s == "function" ? s(JSON.parse(r)) : s;
1128
+ i == null ? la(e) : lt(e, i);
1129
+ } catch (i) {
1130
+ console.warn(i);
1131
+ }
1132
+ },
1133
+ [e, r]
1134
+ ), n = z(() => {
1135
+ a(t);
1136
+ }, [t, a]), o = z(() => {
1137
+ a(null);
1138
+ }, [a]);
1139
+ return j(() => {
1140
+ try {
1141
+ dt(e) === null && typeof t < "u" && lt(e, t);
1142
+ } catch (s) {
1143
+ console.warn(s);
1144
+ }
1145
+ }, [e, t]), [r ? JSON.parse(r) : null, a, n, o];
1146
+ }
1147
+ var A = [];
1148
+ for (var Ge = 0; Ge < 256; ++Ge)
1149
+ A.push((Ge + 256).toString(16).slice(1));
1150
+ function ua(e, t = 0) {
1151
+ return (A[e[t + 0]] + A[e[t + 1]] + A[e[t + 2]] + A[e[t + 3]] + "-" + A[e[t + 4]] + A[e[t + 5]] + "-" + A[e[t + 6]] + A[e[t + 7]] + "-" + A[e[t + 8]] + A[e[t + 9]] + "-" + A[e[t + 10]] + A[e[t + 11]] + A[e[t + 12]] + A[e[t + 13]] + A[e[t + 14]] + A[e[t + 15]]).toLowerCase();
1152
+ }
1153
+ var ge, ma = new Uint8Array(16);
1154
+ function ha() {
1155
+ if (!ge && (ge = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !ge))
1156
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
1157
+ return ge(ma);
1158
+ }
1159
+ var pa = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
1160
+ const ut = {
1161
+ randomUUID: pa
1162
+ };
1163
+ function We(e, t, r) {
1164
+ if (ut.randomUUID && !t && !e)
1165
+ return ut.randomUUID();
1166
+ e = e || {};
1167
+ var a = e.random || (e.rng || ha)();
1168
+ return a[6] = a[6] & 15 | 64, a[8] = a[8] & 63 | 128, ua(a);
1169
+ }
1170
+ const X = "Your session has expired. For your security, please log in again to continue.", ga = "Your session has been successfully terminated.", Ve = "Login failed. Please try again.", fa = "Error getting access token, please re-authenticate.", ya = "You forgot to wrap your component in <AuthProvider>.", ve = {
1171
+ dev: "https://auth.gizmette.local.com:3003",
1172
+ prod: "https://mylogin.gizmette.com/auth"
1173
+ }, fe = "@@auth@@", oe = "LOADING", we = "LOGIN", Mt = "LOGOUT", de = "success", M = "failure", Ut = "include", Ht = "POST", Kt = "application/json", ye = {
1174
+ GET_REGISTRATION_OPTIONS: `mutation GetPasskeyRegistrationOptions(
1175
+ $clientId: String!,
1176
+ $username: String!,
1177
+ $id: String!) {
1178
+ getPasskeyRegistrationOptions(clientId: $clientId, username: $username, id: $id) {
1179
+ challenge
1180
+ rp {
1181
+ id
1182
+ name
1183
+ }
1184
+ user {
1185
+ id
1186
+ name
1187
+ displayName
1188
+ }
1189
+ pubKeyCredParams {
1190
+ type
1191
+ alg
1192
+ }
1193
+ timeout
1194
+ attestation
1195
+ }
1196
+ }`,
1197
+ VERIFY_REGISTRATION: `mutation VerifyPasskeyRegistration(
1198
+ $clientId: String!,
1199
+ $username: String!,
1200
+ $id: String!,
1201
+ $registration: RegistrationOptionsInput!) {
1202
+ verifyPasskeyRegistration(
1203
+ clientId: $clientId,
1204
+ username: $username,
1205
+ id: $id,
1206
+ registration: $registration) {
1207
+ status
1208
+ message
1209
+ }
1210
+ }`,
1211
+ GET_AUTHENTICATION_OPTIONS: `mutation GetPasskeyAuthenticationOptions(
1212
+ $id: String!,
1213
+ $clientId: String!,
1214
+ ) {
1215
+ getPasskeyAuthenticationOptions(
1216
+ id: $id,
1217
+ clientId: $clientId) {
1218
+ rpId,
1219
+ challenge,
1220
+ allowCredentials {
1221
+ id,
1222
+ type,
1223
+ transports
1224
+ }
1225
+ timeout,
1226
+ userVerification,
1227
+ }
1228
+ }`,
1229
+ VERIFY_AUTHENTICATION: `mutation VerifyPasskeyAuthentication(
1230
+ $clientId: String!,
1231
+ $id: String!,
1232
+ $authentication: AuthenticationOptionsInput!,
1233
+ $nonce: String!,
1234
+ $domain: String,
1235
+ $sessionExpiration: String) {
1236
+ verifyPasskeyAuthentication(
1237
+ clientId: $clientId,
1238
+ id: $id,
1239
+ authentication: $authentication,
1240
+ nonce: $nonce,
1241
+ domain: $domain,
1242
+ sessionExpiration: $sessionExpiration) {
1243
+ status,
1244
+ idToken,
1245
+ accessToken,
1246
+ refreshToken,
1247
+ userId,
1248
+ username,
1249
+ }
1250
+ }`
1251
+ }, Z = {
1252
+ GET_REGISTRATION_OPTIONS: {
1253
+ schema: ye.GET_REGISTRATION_OPTIONS,
1254
+ method: "getPasskeyRegistrationOptions"
1255
+ },
1256
+ VERIFY_REGISTRATION: {
1257
+ schema: ye.VERIFY_REGISTRATION,
1258
+ method: "verifyPasskeyRegistration"
1259
+ },
1260
+ GET_AUTHENTICATION_OPTIONS: {
1261
+ schema: ye.GET_AUTHENTICATION_OPTIONS,
1262
+ method: "getPasskeyAuthenticationOptions"
1263
+ },
1264
+ VERIFY_AUTHENTICATION: {
1265
+ schema: ye.VERIFY_AUTHENTICATION,
1266
+ method: "verifyPasskeyAuthentication"
1267
+ }
1268
+ }, ee = async ({
1269
+ accessToken: e,
1270
+ type: t,
1271
+ clientId: r,
1272
+ params: a = {}
1273
+ }) => {
1274
+ try {
1275
+ const n = a, o = `Bearer ${e}`, s = await fetch(
1276
+ Bt ? `${ve.dev}/graphql` : `${ve.prod}/graphql`,
1277
+ {
1278
+ credentials: Ut,
1279
+ method: Ht,
1280
+ headers: {
1281
+ authorization: o,
1282
+ "Content-Type": Kt,
1283
+ [kt.CLIENT_ID]: `${r}`
1284
+ },
1285
+ body: JSON.stringify({
1286
+ query: t.schema,
1287
+ variables: n
1288
+ })
1289
+ }
1290
+ );
1291
+ if (s.status !== 200)
1292
+ return { status: M, data: [] };
1293
+ const { data: i } = await s.json();
1294
+ return {
1295
+ status: de,
1296
+ data: i[t.method]
1297
+ };
1298
+ } catch (n) {
1299
+ return console.error(n), { status: M, data: [] };
1300
+ }
1301
+ }, xe = async ({
1302
+ type: e,
1303
+ clientId: t,
1304
+ params: r = {}
1305
+ }) => {
1306
+ try {
1307
+ const a = await fetch(
1308
+ Bt ? `${ve.dev}/${e}` : `${ve.prod}/${e}`,
1309
+ {
1310
+ credentials: Ut,
1311
+ method: Ht,
1312
+ headers: {
1313
+ "Content-Type": Kt,
1314
+ [kt.CLIENT_ID]: `${t}`
1315
+ },
1316
+ body: JSON.stringify(r)
1317
+ }
1318
+ );
1319
+ if (a.status !== 200)
1320
+ return { status: M, data: [] };
1321
+ const { data: n } = await a.json();
1322
+ return {
1323
+ status: de,
1324
+ data: n || []
1325
+ };
1326
+ } catch (a) {
1327
+ return console.error(a), { status: M, data: [] };
1328
+ }
1329
+ }, ba = process.env.NODE_ENV === "production", Bt = !ba, Gt = {
1330
+ isLoading: !0,
1331
+ isAuthenticated: !1,
1332
+ user: void 0,
1333
+ logoutReason: "",
1334
+ debug: !1
1335
+ }, Ea = (e) => {
1336
+ try {
1337
+ const t = ea(e);
1338
+ return t ? t[R.USER_ID_KEY] : "";
1339
+ } catch {
1340
+ return "";
1341
+ }
1342
+ }, wa = async ({
1343
+ userId: e,
1344
+ clientId: t,
1345
+ domain: r
1346
+ }) => {
1347
+ var a;
1348
+ try {
1349
+ return {
1350
+ status: ((a = await xe({
1351
+ type: Re.LOGOUT,
1352
+ clientId: t,
1353
+ params: {
1354
+ userId: e,
1355
+ domain: r
1356
+ }
1357
+ })) == null ? void 0 : a.status) || M
1358
+ };
1359
+ } catch {
1360
+ return {
1361
+ status: M
1362
+ };
1363
+ }
1364
+ }, Ta = async ({
1365
+ username: e,
1366
+ password: t,
1367
+ clientId: r,
1368
+ nonce: a,
1369
+ type: n,
1370
+ sessionExpiration: o,
1371
+ code: s,
1372
+ code_verifier: i,
1373
+ domain: u
1374
+ }) => {
1375
+ var p;
1376
+ try {
1377
+ const h = await xe({
1378
+ type: Re.LOGIN,
1379
+ clientId: r,
1380
+ params: {
1381
+ type: n || _e.ID_AND_ACCESS_TOKEN,
1382
+ username: e,
1383
+ password: t,
1384
+ sessionExpiration: o,
1385
+ nonce: a,
1386
+ code: s,
1387
+ code_verifier: i,
1388
+ domain: u
1389
+ }
1390
+ }), m = await ie((p = h == null ? void 0 : h.data) == null ? void 0 : p.idToken);
1391
+ return m && m.payload[R.USER_ID_KEY] !== "" && m.payload[R.NONCE_KEY] === a ? {
1392
+ idToken: h.data.idToken,
1393
+ accessToken: h.data.accessToken,
1394
+ refreshToken: h.data.refreshToken,
1395
+ userId: m.payload[R.USER_ID_KEY],
1396
+ status: !0
1397
+ } : {
1398
+ status: !1
1399
+ };
1400
+ } catch {
1401
+ return {
1402
+ status: !1
1403
+ };
1404
+ }
1405
+ }, Ia = async ({
1406
+ nonce: e,
1407
+ clientId: t,
1408
+ code_challenge: r
1409
+ }) => {
1410
+ var a;
1411
+ try {
1412
+ const n = await xe({
1413
+ type: Re.CODE,
1414
+ clientId: t,
1415
+ params: {
1416
+ type: _e.CODE,
1417
+ nonce: e,
1418
+ code_challenge: r
1419
+ }
1420
+ });
1421
+ return (a = n == null ? void 0 : n.data) != null && a.code ? {
1422
+ status: de,
1423
+ data: n.data.code
1424
+ } : {
1425
+ status: M,
1426
+ data: ""
1427
+ };
1428
+ } catch {
1429
+ return {
1430
+ status: M,
1431
+ data: ""
1432
+ };
1433
+ }
1434
+ }, Sa = async ({
1435
+ clientId: e,
1436
+ userId: t,
1437
+ nonce: r,
1438
+ refreshToken: a,
1439
+ accessToken: n,
1440
+ domain: o
1441
+ }) => {
1442
+ var s;
1443
+ try {
1444
+ const i = await xe({
1445
+ type: Re.REFRESH,
1446
+ clientId: e,
1447
+ params: {
1448
+ type: _e.REFRESH_TOKEN,
1449
+ userId: t,
1450
+ nonce: r,
1451
+ refreshToken: a,
1452
+ accessToken: n,
1453
+ domain: o
1454
+ }
1455
+ }), u = await ie((s = i == null ? void 0 : i.data) == null ? void 0 : s.accessToken);
1456
+ return u && u.payload[R.USER_ID_KEY] !== "" && u.payload[R.NONCE_KEY] === r ? {
1457
+ accessToken: i.data.accessToken,
1458
+ refreshToken: i.data.refreshToken,
1459
+ userId: u.payload[R.USER_ID_KEY],
1460
+ status: !0
1461
+ } : {
1462
+ status: !1
1463
+ };
1464
+ } catch {
1465
+ return {
1466
+ status: !1
1467
+ };
1468
+ }
1469
+ };
1470
+ class Aa {
1471
+ constructor(t = null, r = null) {
1472
+ Le(this, "refreshTokenPromise", null), Le(this, "accessToken"), Le(this, "refreshToken"), this.accessToken = t || "", this.refreshToken = r || "";
1473
+ }
1474
+ async refreshtoken({
1475
+ clientId: t,
1476
+ userId: r,
1477
+ nonce: a,
1478
+ domain: n
1479
+ }) {
1480
+ this.refreshTokenPromise || (this.refreshTokenPromise = this._refreshToken({
1481
+ clientId: t,
1482
+ userId: r,
1483
+ nonce: a,
1484
+ domain: n
1485
+ }));
1486
+ try {
1487
+ return await this.refreshTokenPromise;
1488
+ } finally {
1489
+ this.refreshTokenPromise = null;
1490
+ }
1491
+ }
1492
+ async _refreshToken({
1493
+ clientId: t,
1494
+ userId: r,
1495
+ nonce: a,
1496
+ domain: n
1497
+ }) {
1498
+ const o = await ie(this.refreshToken);
1499
+ if (o && o.payload[R.USER_ID_KEY] !== "") {
1500
+ const s = await Sa({
1501
+ clientId: t,
1502
+ userId: r,
1503
+ nonce: a,
1504
+ refreshToken: this.refreshToken,
1505
+ accessToken: this.accessToken,
1506
+ domain: n
1507
+ });
1508
+ return s.status ? (this.accessToken = s.accessToken, this.refreshToken = s.refreshToken, {
1509
+ status: de,
1510
+ newAccessToken: s.accessToken,
1511
+ newRefreshToken: s.refreshToken
1512
+ }) : {
1513
+ status: M
1514
+ };
1515
+ } else
1516
+ return {
1517
+ status: M
1518
+ };
1519
+ }
1520
+ }
1521
+ const va = (e) => z(
1522
+ (...t) => {
1523
+ e && console.info(`==> [Auth ${Date.now()}]: `, ...t);
1524
+ },
1525
+ [e]
1526
+ ), te = () => {
1527
+ throw new Error(ya);
1528
+ }, Wt = nr({
1529
+ isAuthenticated: !1,
1530
+ isLoading: !1,
1531
+ login: te,
1532
+ logout: te,
1533
+ getAccessToken: te,
1534
+ getIdToken: te,
1535
+ registeringForPasskey: te,
1536
+ loginWithPasskey: te,
1537
+ logoutReason: ""
1538
+ }), ka = V.createContext({
1539
+ state: Gt,
1540
+ dispatch: () => {
1541
+ }
1542
+ }), _a = (e, t) => (t == null ? void 0 : t.type) === oe ? {
1543
+ ...e,
1544
+ isLoading: t.payload.isLoading
1545
+ } : (t == null ? void 0 : t.type) === we ? {
1546
+ ...e,
1547
+ isLoading: !1,
1548
+ isAuthenticated: !0,
1549
+ user: t.payload.user,
1550
+ logoutReason: ""
1551
+ } : (t == null ? void 0 : t.type) === Mt ? {
1552
+ ...e,
1553
+ isLoading: !1,
1554
+ isAuthenticated: !1,
1555
+ user: void 0,
1556
+ logoutReason: t.payload.logoutReason
1557
+ } : e, Ra = ({
1558
+ children: e,
1559
+ sessionExpiration: t,
1560
+ clientId: r,
1561
+ domain: a = "",
1562
+ debug: n = !1
1563
+ }) => {
1564
+ const [o, s] = ft(_a, {
1565
+ ...Gt,
1566
+ debug: n
1567
+ }), i = va(n), u = W(!1), [p, h, , m] = pe({
1568
+ key: `${fe}::${r}::@@user@@`
1569
+ }), [l, d, , f] = pe({
1570
+ key: `${fe}::${r}::@@access@@`
1571
+ }), [E, _, , w] = pe(
1572
+ {
1573
+ key: `${fe}::${r}::@@refresh@@`
1574
+ }
1575
+ ), [U, H, , O] = pe({
1576
+ key: `${fe}::${r}::@@nonce@@`
1577
+ }), ae = new Aa(l, E), P = z(() => {
1578
+ i("removeLocalStorage: removing local storage"), m(), f(), w(), O();
1579
+ }, [
1580
+ f,
1581
+ m,
1582
+ O,
1583
+ w,
1584
+ i
1585
+ ]), N = z(
1586
+ (y) => {
1587
+ i(
1588
+ "removeStateAndLocalStorage: removing state and local storage with reason: ",
1589
+ y
1590
+ ), s({
1591
+ type: Mt,
1592
+ payload: {
1593
+ logoutReason: y || X
1594
+ }
1595
+ }), P(), s({ type: oe, payload: { isLoading: !1 } });
1596
+ },
1597
+ [P, i]
1598
+ ), x = z(
1599
+ async (y) => {
1600
+ i("invalidateAndLogout: invalidating and logging out");
1601
+ const { user: T } = o, b = (T == null ? void 0 : T.userId) || Ea(p);
1602
+ b || i(
1603
+ "invalidateAndLogout: user cannot be identified, logging out without userId"
1604
+ ), await wa({
1605
+ userId: b,
1606
+ clientId: r,
1607
+ domain: a
1608
+ }), N(y || X);
1609
+ },
1610
+ [p, o, r, a, N, i]
1611
+ );
1612
+ j(() => {
1613
+ if (!u.current)
1614
+ return o.isLoading && p !== null ? (async () => {
1615
+ try {
1616
+ const y = await ie(p);
1617
+ y && y.payload[R.USER_ID_KEY] !== "" ? (i("useEffect: setting the authentication state"), s({
1618
+ type: we,
1619
+ payload: {
1620
+ user: {
1621
+ userId: y.payload[R.USER_ID_KEY],
1622
+ username: y.payload[R.USERNAME_KEY]
1623
+ }
1624
+ }
1625
+ })) : (i("useEffect: invalid JWT, invalidating and logging out"), await x(X));
1626
+ } catch {
1627
+ i(
1628
+ "useEffect: exception validating JWT, invalidating and logging out"
1629
+ ), await x(X);
1630
+ }
1631
+ })() : (i("useEffect: setting the loading state to false"), s({ type: oe, payload: { isLoading: !1 } })), () => {
1632
+ u.current = !0;
1633
+ };
1634
+ }, [o.isLoading, p, x, i]);
1635
+ const D = async (y, T) => {
1636
+ s({ type: oe, payload: { isLoading: !0 } }), P();
1637
+ const b = We();
1638
+ H(b), i("login: Logging in with password");
1639
+ const Q = _e.CODE, { code_verifier: rr, code_challenge: ar } = await ca(), et = await Ia({
1640
+ nonce: b,
1641
+ clientId: r,
1642
+ code_challenge: ar
1643
+ });
1644
+ if (et.status) {
1645
+ const ne = await Ta({
1646
+ username: y,
1647
+ password: T,
1648
+ clientId: r,
1649
+ sessionExpiration: t,
1650
+ nonce: b,
1651
+ type: Q,
1652
+ code: et.data,
1653
+ code_verifier: rr,
1654
+ domain: a
1655
+ });
1656
+ return ne.status ? (h(ne.idToken), d(ne.accessToken), _(ne.refreshToken), s({
1657
+ type: we,
1658
+ payload: {
1659
+ user: {
1660
+ userId: ne.userId,
1661
+ username: y
1662
+ }
1663
+ }
1664
+ }), !0) : (N(Ve), !1);
1665
+ }
1666
+ return !1;
1667
+ }, Pe = async (y) => {
1668
+ y == null || y.preventDefault(), await x(ga);
1669
+ }, De = async () => {
1670
+ const { isAuthenticated: y, user: T } = o;
1671
+ try {
1672
+ if (y && T && T.userId) {
1673
+ if (l) {
1674
+ i("getAccessToken");
1675
+ const Q = await ie(l);
1676
+ if (Q && Q.payload[R.USER_ID_KEY] !== "")
1677
+ return l;
1678
+ }
1679
+ i("getAccessToken: invalid access token, trying to refresh it");
1680
+ const b = await ae.refreshtoken({
1681
+ clientId: r,
1682
+ userId: T.userId,
1683
+ nonce: U,
1684
+ domain: a
1685
+ });
1686
+ return b.status && b.status === "success" && b.newAccessToken ? (d(b.newAccessToken), _(b.newRefreshToken), b.newAccessToken) : (i(
1687
+ "getAccessToken: invalid refresh token, need to re-authenticate"
1688
+ ), await x(X), "");
1689
+ }
1690
+ return i(
1691
+ "getAccessToken: user is not authenticated, cannot get access token"
1692
+ ), await x(X), "";
1693
+ } catch {
1694
+ return i(
1695
+ "getAccessToken: exception occurred, invalidating and logging out"
1696
+ ), await x(fa), "";
1697
+ }
1698
+ }, C = () => o.isAuthenticated && p ? p : "", K = async () => {
1699
+ const { user: y } = o;
1700
+ let T = await ee({
1701
+ accessToken: l,
1702
+ clientId: r,
1703
+ type: Z.GET_REGISTRATION_OPTIONS,
1704
+ params: {
1705
+ clientId: r,
1706
+ id: y == null ? void 0 : y.userId,
1707
+ username: y == null ? void 0 : y.username
1708
+ }
1709
+ });
1710
+ if (T.status)
1711
+ try {
1712
+ const b = await mr(T.data);
1713
+ return T = await ee({
1714
+ accessToken: l,
1715
+ clientId: r,
1716
+ type: Z.VERIFY_REGISTRATION,
1717
+ params: {
1718
+ clientId: r,
1719
+ id: y == null ? void 0 : y.userId,
1720
+ username: y == null ? void 0 : y.username,
1721
+ registration: b
1722
+ }
1723
+ }), !!(T.status && T.data.length > 0);
1724
+ } catch {
1725
+ return await ee({
1726
+ accessToken: l,
1727
+ clientId: r,
1728
+ type: Z.VERIFY_REGISTRATION,
1729
+ params: {
1730
+ clientId: r,
1731
+ id: y == null ? void 0 : y.userId,
1732
+ username: y == null ? void 0 : y.username,
1733
+ registration: {}
1734
+ }
1735
+ }), !1;
1736
+ }
1737
+ return !1;
1738
+ }, $e = async () => {
1739
+ s({ type: oe, payload: { isLoading: !0 } }), P();
1740
+ const y = We();
1741
+ H(y), i("loginWithPasskey");
1742
+ const T = We();
1743
+ let b = await ee({
1744
+ accessToken: l,
1745
+ clientId: r,
1746
+ type: Z.GET_AUTHENTICATION_OPTIONS,
1747
+ params: {
1748
+ id: T,
1749
+ clientId: r
1750
+ }
1751
+ });
1752
+ if (b.status)
1753
+ try {
1754
+ const Q = await gr(b.data);
1755
+ return b = await ee({
1756
+ accessToken: l,
1757
+ clientId: r,
1758
+ type: Z.VERIFY_AUTHENTICATION,
1759
+ params: {
1760
+ clientId: r,
1761
+ id: T,
1762
+ authentication: Q,
1763
+ nonce: y,
1764
+ domain: a,
1765
+ sessionExpiration: t
1766
+ }
1767
+ }), b.data.status === de ? (h(b.data.idToken), d(b.data.accessToken), _(b.data.refreshToken), s({
1768
+ type: we,
1769
+ payload: {
1770
+ user: {
1771
+ userId: b.data.userId,
1772
+ username: b.data.username
1773
+ }
1774
+ }
1775
+ }), !0) : (N(Ve), !1);
1776
+ } catch {
1777
+ return await ee({
1778
+ accessToken: l,
1779
+ clientId: r,
1780
+ type: Z.VERIFY_AUTHENTICATION,
1781
+ params: {
1782
+ clientId: r,
1783
+ id: T,
1784
+ authentication: {},
1785
+ nonce: y,
1786
+ domain: a,
1787
+ sessionExpiration: t
1788
+ }
1789
+ }), N(Ve), !1;
1790
+ }
1791
+ return !1;
1792
+ };
1793
+ return /* @__PURE__ */ c(ka.Provider, { value: { state: o, dispatch: s }, children: /* @__PURE__ */ c(
1794
+ Wt.Provider,
1795
+ {
1796
+ value: {
1797
+ ...o,
1798
+ login: D,
1799
+ logout: Pe,
1800
+ getAccessToken: De,
1801
+ getIdToken: C,
1802
+ registeringForPasskey: K,
1803
+ loginWithPasskey: $e
1804
+ },
1805
+ children: e
1806
+ }
1807
+ ) });
1808
+ }, qe = (e = Wt) => yt(e), to = "user", ro = "assistant", ao = "system", no = "internal", oo = "hidden", so = "I'm having trouble right now. Please try again later.", io = "gpt-4", co = 128e3, lo = "action-message", uo = "action-reset", mo = "action-model", ho = "action-restore", po = "action-location", go = "action-streaming", fo = "action-search", yo = "action-sort", bo = "sassy-saint-", Eo = "details", wo = "search", To = "sort", Io = "location", So = "==stats==", Na = "b44c68f0-e5b3-4a1d-a3e3-df8632b0223b", mt = (e) => Number.isFinite(e) ? e : 0;
1809
+ function xa(e) {
1810
+ return {
1811
+ days: Math.trunc(e / 864e5),
1812
+ hours: Math.trunc(e / 36e5 % 24),
1813
+ minutes: Math.trunc(e / 6e4 % 60),
1814
+ seconds: Math.trunc(e / 1e3 % 60),
1815
+ milliseconds: Math.trunc(e % 1e3),
1816
+ microseconds: Math.trunc(mt(e * 1e3) % 1e3),
1817
+ nanoseconds: Math.trunc(mt(e * 1e6) % 1e3)
1818
+ };
1819
+ }
1820
+ function Ca(e) {
1821
+ return {
1822
+ days: e / 86400000n,
1823
+ hours: e / 3600000n % 24n,
1824
+ minutes: e / 60000n % 60n,
1825
+ seconds: e / 1000n % 60n,
1826
+ milliseconds: e % 1000n,
1827
+ microseconds: 0n,
1828
+ nanoseconds: 0n
1829
+ };
1830
+ }
1831
+ function Oa(e) {
1832
+ switch (typeof e) {
1833
+ case "number": {
1834
+ if (Number.isFinite(e))
1835
+ return xa(e);
1836
+ break;
1837
+ }
1838
+ case "bigint":
1839
+ return Ca(e);
1840
+ }
1841
+ throw new TypeError("Expected a finite number or bigint");
1842
+ }
1843
+ const Pa = (e) => e === 0 || e === 0n, Da = (e, t) => t === 1 || t === 1n ? e : `${e}s`, $a = 1e-7, La = 24n * 60n * 60n * 1000n;
1844
+ function Ma(e, t) {
1845
+ const r = typeof e == "bigint";
1846
+ if (!r && !Number.isFinite(e))
1847
+ throw new TypeError("Expected a finite number or bigint");
1848
+ t = { ...t };
1849
+ const a = e < 0 ? "-" : "";
1850
+ 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);
1851
+ let n = [];
1852
+ const o = (h, m) => {
1853
+ const l = Math.floor(h * 10 ** m + $a);
1854
+ return (Math.round(l) / 10 ** m).toFixed(m);
1855
+ }, s = (h, m, l, d) => {
1856
+ if (!((n.length === 0 || !t.colonNotation) && Pa(h) && !(t.colonNotation && l === "m"))) {
1857
+ if (d ?? (d = String(h)), t.colonNotation) {
1858
+ const f = d.includes(".") ? d.split(".")[0].length : d.length, E = n.length > 0 ? 2 : 1;
1859
+ d = "0".repeat(Math.max(0, E - f)) + d;
1860
+ } else
1861
+ d += t.verbose ? " " + Da(m, h) : l;
1862
+ n.push(d);
1863
+ }
1864
+ }, i = Oa(e), u = BigInt(i.days);
1865
+ if (s(u / 365n, "year", "y"), s(u % 365n, "day", "d"), s(Number(i.hours), "hour", "h"), s(Number(i.minutes), "minute", "m"), t.separateMilliseconds || t.formatSubMilliseconds || !t.colonNotation && e < 1e3) {
1866
+ const h = Number(i.seconds), m = Number(i.milliseconds), l = Number(i.microseconds), d = Number(i.nanoseconds);
1867
+ if (s(h, "second", "s"), t.formatSubMilliseconds)
1868
+ s(m, "millisecond", "ms"), s(l, "microsecond", "µs"), s(d, "nanosecond", "ns");
1869
+ else {
1870
+ const f = m + l / 1e3 + d / 1e6, E = typeof t.millisecondsDecimalDigits == "number" ? t.millisecondsDecimalDigits : 0, _ = f >= 1 ? Math.round(f) : Math.ceil(f), w = E ? f.toFixed(E) : _;
1871
+ s(
1872
+ Number.parseFloat(w),
1873
+ "millisecond",
1874
+ "ms",
1875
+ w
1876
+ );
1877
+ }
1878
+ } else {
1879
+ const h = (r ? Number(e % La) : e) / 1e3 % 60, m = typeof t.secondsDecimalDigits == "number" ? t.secondsDecimalDigits : 1, l = o(h, m), d = t.keepDecimalsOnWholeSeconds ? l : l.replace(/\.0+$/, "");
1880
+ s(Number.parseFloat(d), "second", "s", d);
1881
+ }
1882
+ if (n.length === 0)
1883
+ return a + "0" + (t.verbose ? " milliseconds" : "ms");
1884
+ const p = t.colonNotation ? ":" : " ";
1885
+ return typeof t.unitCount == "number" && (n = n.slice(0, Math.max(t.unitCount, 1))), a + n.join(p);
1886
+ }
1887
+ const Ua = process.env.NODE_ENV === "production", Qe = !Ua, Ha = Qe ? "gizmette.local.com" : "gizmette.com", Ao = (e, t) => e.length > t ? e.substring(0, t) + "..." : e, Vt = (e, t) => {
1888
+ const r = e < 0 ? t ? "W" : "S" : t ? "E" : "N", a = 0 | Math.abs(e), n = 0 | Math.abs(e) * 60 % 60, o = (0 | Math.abs(e) * 60 % 1 * 6e3) / 100;
1889
+ return {
1890
+ dir: r,
1891
+ deg: a,
1892
+ min: n,
1893
+ sec: o
1894
+ };
1895
+ }, vo = (e) => {
1896
+ if (!e && e !== 0)
1897
+ return "N/A";
1898
+ const t = Vt(e, !1);
1899
+ return `${t.deg}° ${t.min}' ${t.sec}" ${t.dir}`;
1900
+ }, ko = (e) => {
1901
+ if (!e && e !== 0)
1902
+ return "N/A";
1903
+ const t = Vt(e, !0);
1904
+ return `${t.deg}° ${t.min}' ${t.sec}" ${t.dir}`;
1905
+ }, _o = async () => {
1906
+ const e = {
1907
+ /**
1908
+ * A boolean value that indicates the application would
1909
+ * like to receive the best possible results. If true
1910
+ * and if the device is able to provide a more accurate
1911
+ * position, it will do so. Note that this can result in
1912
+ * slower response times or increased power consumption
1913
+ * (with a GPS chip on a mobile device for example). On
1914
+ * the other hand, if false, the device can take the
1915
+ * liberty to save resources by responding more quickly
1916
+ * and/or using less power. Default: false.
1917
+ */
1918
+ enableHighAccuracy: !1,
1919
+ /**
1920
+ * A positive long value representing the maximum length
1921
+ * of time (in milliseconds) the device is allowed to
1922
+ * take in order to return a position. The default value
1923
+ * is Infinity, meaning that getCurrentPosition() won't
1924
+ * return until the position is available.
1925
+ */
1926
+ timeout: 1e4,
1927
+ /**
1928
+ * A positive long value indicating the maximum age in
1929
+ * milliseconds of a possible cached position that is
1930
+ * acceptable to return. If set to 0, it means that the
1931
+ * device cannot use a cached position and must attempt
1932
+ * to retrieve the real current position. If set to
1933
+ * Infinity the device must return a cached position
1934
+ * regardless of its age. Default: 0.
1935
+ */
1936
+ maximumAge: 6e4
1937
+ };
1938
+ return new Promise((t, r) => {
1939
+ var a;
1940
+ (a = navigator == null ? void 0 : navigator.geolocation) == null || a.getCurrentPosition(
1941
+ (n) => {
1942
+ t({
1943
+ latitude: n.coords.latitude,
1944
+ longitude: n.coords.longitude,
1945
+ accuracy: n.coords.accuracy
1946
+ });
1947
+ },
1948
+ (n) => {
1949
+ r(n);
1950
+ },
1951
+ e
1952
+ );
1953
+ });
1954
+ }, Ro = (e, t) => t ? Object.keys(t).map((r) => /* @__PURE__ */ c("dl", { className: "my-0", children: /* @__PURE__ */ I("div", { className: "flex items-center justify-between", children: [
1955
+ /* @__PURE__ */ c("dt", { className: "inline-block font-bold text-copy-dark dark:text-copy-lighter", children: r }),
1956
+ /* @__PURE__ */ c("dd", { className: "inline-block", children: t[r] })
1957
+ ] }) }, `${e}-${r}`)) : null;
1958
+ function No({
1959
+ data: e,
1960
+ formatter: t = (r) => r
1961
+ }) {
1962
+ const r = e.filter(
1963
+ (n) => typeof n == "number" && n > 0
1964
+ ), a = r.reduce(
1965
+ (n, o) => (n || 0) + (o || 0),
1966
+ 0
1967
+ );
1968
+ return t(a ? a / r.length : 0);
1969
+ }
1970
+ const xo = (e, t) => t && t.messages.length > 0 && t.messages[t.messages.length - 1].message.role === e, Co = new Intl.NumberFormat("en", {
1971
+ style: "decimal",
1972
+ signDisplay: "never",
1973
+ minimumFractionDigits: 0,
1974
+ maximumFractionDigits: 0
1975
+ }), Oo = (e) => e > 0 ? Ma(e, {
1976
+ secondsDecimalDigits: 2,
1977
+ unitCount: 2
1978
+ }) : "N/A", Ka = (e) => g(
1979
+ "flex-1 space-y-6 overflow-y-auto rounded-md bg-slate-900 px-4 pb-10 text-base leading-6 text-slate-300 shadow-sm sm:text-base sm:leading-7",
1980
+ e || Qe ? "pt-4" : "pt-10"
1981
+ ), Po = (e, t) => t === 1 ? e : `${e}s`, Ce = (e) => {
1982
+ let t = "";
1983
+ if (typeof e == "number" || typeof e == "string")
1984
+ t = "m-" + e;
1985
+ else {
1986
+ const r = [];
1987
+ (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
1988
+ }
1989
+ return t;
1990
+ }, Do = "av-bubble", ht = "av-button", Te = "av-card", Ba = "av-footer", Ga = "av-main", $o = "av-messagebox", Lo = "av-panel", Mo = "av-spinner", Jt = "icon", Ft = "button", Wa = "link", Va = ({
1991
+ type: e,
1992
+ size: t,
1993
+ labelRight: r,
1994
+ labelLeft: a,
1995
+ align: n
1996
+ }) => {
1997
+ const o = "text-sm font-medium max-h-8 py-0", s = "text-base font-medium max-h-9 py-1", i = "text-lg font-medium max-h-12 py-2";
1998
+ switch (e) {
1999
+ case Ft:
2000
+ return g("px-4", {
2001
+ [o]: t === "small",
2002
+ [s]: t === "medium",
2003
+ [i]: t === "large"
2004
+ });
2005
+ case Wa:
2006
+ return g("px-4 text-center", {
2007
+ [o]: t === "small",
2008
+ [s]: t === "medium",
2009
+ [i]: t === "large"
2010
+ });
2011
+ case Jt:
2012
+ return g("inline-flex items-center", {
2013
+ "justify-center": n === "center",
2014
+ "justify-start": n === "left",
2015
+ "justify-end": n === "right",
2016
+ "h-6 w-6 p-0": t === "small" && !(r || a),
2017
+ "h-6 px-4 text-sm font-medium": t === "small" && (r || a),
2018
+ "h-8 w-8 p-1": t === "medium" && !(r || a),
2019
+ "h-8 px-4 text-base font-medium": t === "medium" && (r || a),
2020
+ "h-12 w-12 p-2": t === "large" && !(r || a),
2021
+ "h-12 px-4 text-lg font-medium": t === "large" && (r || a)
2022
+ });
2023
+ }
2024
+ }, Ja = ({
2025
+ mode: e,
2026
+ noBackground: t,
2027
+ noTruncate: r,
2028
+ variant: a
2029
+ }) => {
2030
+ if (t)
2031
+ return "not-prose rounded-full";
2032
+ if (a === "primary")
2033
+ return g("not-prose rounded-full", {
2034
+ truncate: !r,
2035
+ "bg-action-dark text-copy-light": e === "dark",
2036
+ "bg-action-light text-copy-lighter": e === "light",
2037
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "system",
2038
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "alt-system"
2039
+ });
2040
+ if (a === "secondary")
2041
+ return g("not-prose rounded-full", {
2042
+ truncate: !r,
2043
+ "bg-action-dark text-copy-light": e === "light",
2044
+ "bg-action-light text-copy-lighter": e === "dark",
2045
+ "bg-action-dark text-copy-light dark:bg-action-light dark:text-copy-lighter": e === "alt-system",
2046
+ "bg-action-light text-copy-lighter dark:bg-action-dark dark:text-copy-light": e === "system"
2047
+ });
2048
+ if (a === "danger")
2049
+ return g("not-prose rounded-full", {
2050
+ truncate: !r,
2051
+ "bg-action-danger-dark text-copy-light": e === "dark",
2052
+ "bg-action-danger-light text-copy-lighter": e === "light",
2053
+ "bg-action-danger-dark text-copy-light dark:bg-action-danger-light dark:text-copy-lighter": e === "system",
2054
+ "bg-action-danger-light text-copy-lighter dark:bg-action-danger-dark dark:text-copy-light": e === "alt-system"
2055
+ });
2056
+ }, Fa = ({
2057
+ mode: e,
2058
+ disabled: t,
2059
+ variant: r
2060
+ }) => {
2061
+ if (t)
2062
+ return "";
2063
+ if (r === "primary")
2064
+ return g("hover:text-copy-light-hover", {
2065
+ "hover:bg-action-dark-hover": e === "dark",
2066
+ "hover:bg-action-light-hover": e === "light",
2067
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "system",
2068
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "alt-system"
2069
+ });
2070
+ if (r === "secondary")
2071
+ return g("hover:text-copy-light-hover", {
2072
+ "hover:bg-action-dark-hover": e === "light",
2073
+ "hover:bg-action-light-hover": e === "dark",
2074
+ "hover:bg-action-dark-hover dark:hover:bg-action-light-hover": e === "alt-system",
2075
+ "hover:bg-action-light-hover dark:hover:bg-action-dark-hover": e === "system"
2076
+ });
2077
+ if (r === "danger")
2078
+ return g("hover:text-copy-light-hover", {
2079
+ "hover:bg-action-danger-dark-hover": e === "dark",
2080
+ "hover:bg-action-danger-light-hover": e === "light",
2081
+ "hover:bg-action-danger-dark-hover dark:hover:bg-action-danger-light-hover": e === "system",
2082
+ "hover:bg-action-danger-light-hover dark:hover:bg-action-danger-dark-hover": e === "alt-system"
2083
+ });
2084
+ }, Ya = ({
2085
+ mode: e,
2086
+ disabled: t,
2087
+ variant: r
2088
+ }) => {
2089
+ if (t)
2090
+ return "";
2091
+ if (r === "primary")
2092
+ return g("active:text-copy-light-active", {
2093
+ "active:bg-action-dark-active": e === "dark",
2094
+ "active:bg-action-light-active": e === "light",
2095
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "system",
2096
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "alt-system"
2097
+ });
2098
+ if (r === "secondary")
2099
+ return g("active:text-copy-light-active", {
2100
+ "active:bg-action-dark-active": e === "light",
2101
+ "active:bg-action-light-active": e === "dark",
2102
+ "active:bg-action-dark-active dark:active:bg-action-light-active": e === "alt-system",
2103
+ "active:bg-action-light-active dark:active:bg-action-dark-active": e === "system"
2104
+ });
2105
+ if (r === "danger")
2106
+ return g("active:text-copy-lighter-active", {
2107
+ "active:bg-action-danger-dark-active": e === "dark",
2108
+ "active:bg-action-danger-light-active": e === "light",
2109
+ "active:bg-action-danger-dark-active dark:active:bg-action-danger-light-active": e === "system",
2110
+ "active:bg-action-danger-light-active dark:active:bg-action-danger-dark-active": e === "alt-system"
2111
+ });
2112
+ }, za = ({
2113
+ mode: e,
2114
+ noBorder: t,
2115
+ variant: r
2116
+ }) => {
2117
+ if (t)
2118
+ return "border border-transparent";
2119
+ if (r === "primary")
2120
+ return g("border", {
2121
+ "border-border-dark": e === "dark",
2122
+ "border-border-accent": e === "light",
2123
+ "border-border-dark dark:border-border-accent": e === "system",
2124
+ "border-border-accent dark:border-border-dark": e === "alt-system"
2125
+ });
2126
+ if (r === "secondary")
2127
+ return g("border", {
2128
+ "border-border-dark": e === "light",
2129
+ "border-border-accent": e === "dark",
2130
+ "border-border-dark dark:border-border-accent": e === "alt-system",
2131
+ "border-border-accent dark:border-border-dark": e === "system"
2132
+ });
2133
+ if (r === "danger")
2134
+ return g("border", {
2135
+ "border-border-danger-dark": e === "dark",
2136
+ "border-border-danger-medium": e === "light",
2137
+ "border-border-danger-dark dark:border-border-danger-medium": e === "system",
2138
+ "border-border-danger-medium dark:border-border-danger-dark": e === "alt-system"
2139
+ });
2140
+ }, ja = ({ focusMode: e }) => g("focus:outline", "focus:outline-2", "focus:outline-offset-2", {
2141
+ "focus:outline-focus-dark": e === "dark",
2142
+ "focus:outline-focus-light": e === "light",
2143
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
2144
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
2145
+ }), Yt = ({
2146
+ type: e,
2147
+ className: t,
2148
+ raw: r,
2149
+ mode: a,
2150
+ focusMode: n,
2151
+ disabled: o,
2152
+ fullWidth: s,
2153
+ size: i,
2154
+ noBorder: u,
2155
+ labelRight: p,
2156
+ labelLeft: h,
2157
+ spacing: m,
2158
+ noBackground: l,
2159
+ variant: d,
2160
+ noTruncate: f,
2161
+ align: E
2162
+ }) => (d || (d = "primary"), r ? g(ht, t) : g(
2163
+ ht,
2164
+ t,
2165
+ Ce(m),
2166
+ Ja({ mode: a, variant: d, noBackground: l, noTruncate: f }),
2167
+ Va({ type: e, size: i, labelRight: p, labelLeft: h, align: E }),
2168
+ za({ mode: a, variant: d, noBorder: u }),
2169
+ ja({ focusMode: n }),
2170
+ Fa({ mode: a, variant: d, disabled: o }),
2171
+ Ya({ mode: a, variant: d, disabled: o }),
2172
+ {
2173
+ "w-full": s,
2174
+ "disabled:cursor-not-allowed disabled:opacity-50": o
2175
+ }
2176
+ )), qa = (e, t, r) => {
2177
+ var a;
2178
+ !t && (!document.activeElement || document.activeElement !== e.currentTarget) && typeof ((a = e == null ? void 0 : e.currentTarget) == null ? void 0 : a.focus) == "function" && e.currentTarget.focus(), typeof r == "function" && r(e);
2179
+ }, Xe = V.forwardRef(
2180
+ (e, t) => {
2181
+ const { onClick: r, noInternalClick: a = !1, ...n } = e;
2182
+ return /* @__PURE__ */ c(
2183
+ "button",
2184
+ {
2185
+ ref: t,
2186
+ onClick: (o) => {
2187
+ qa(o, a, r);
2188
+ },
2189
+ ...n
2190
+ }
2191
+ );
2192
+ }
2193
+ );
2194
+ Xe.displayName = "BaseButton";
2195
+ const Ye = V.forwardRef(
2196
+ ({
2197
+ children: e,
2198
+ disabled: t = !1,
2199
+ mode: r = "system",
2200
+ focusMode: a = "system",
2201
+ fullWidth: n = !1,
2202
+ className: o,
2203
+ type: s = "button",
2204
+ raw: i = !1,
2205
+ noBorder: u = !1,
2206
+ "aria-label": p,
2207
+ label: h,
2208
+ size: m = "medium",
2209
+ labelRight: l,
2210
+ labelLeft: d,
2211
+ spacing: f,
2212
+ noBackground: E = !1,
2213
+ align: _ = "center",
2214
+ ...w
2215
+ }, U) => {
2216
+ const H = Yt({
2217
+ type: Jt,
2218
+ mode: r,
2219
+ focusMode: a,
2220
+ fullWidth: n,
2221
+ disabled: t,
2222
+ raw: i,
2223
+ className: o,
2224
+ noBorder: u,
2225
+ size: m,
2226
+ labelRight: l,
2227
+ labelLeft: d,
2228
+ spacing: f,
2229
+ noBackground: E,
2230
+ align: _
2231
+ }), O = g({
2232
+ "text-copy-accent-dark": r === "light" && !i,
2233
+ "text-copy-light": r === "dark" && !i,
2234
+ "text-copy-accent-dark dark:text-copy-light": r === "alt-system" && !i,
2235
+ "text-copy-light dark:text-copy-accent-dark": r === "system" && !i
2236
+ });
2237
+ return /* @__PURE__ */ I(
2238
+ Xe,
2239
+ {
2240
+ ref: U,
2241
+ className: H,
2242
+ disabled: t,
2243
+ type: s,
2244
+ "aria-label": p || h,
2245
+ ...w,
2246
+ children: [
2247
+ d && /* @__PURE__ */ c("span", { className: "pr-2", children: d }),
2248
+ /* @__PURE__ */ c("div", { className: O, children: e }),
2249
+ l && /* @__PURE__ */ c("span", { className: "pl-2", children: l })
2250
+ ]
2251
+ }
2252
+ );
2253
+ }
2254
+ );
2255
+ Ye.displayName = "ButtonIcon";
2256
+ const zt = V.forwardRef(
2257
+ ({
2258
+ children: e,
2259
+ disabled: t = !1,
2260
+ mode: r = "system",
2261
+ focusMode: a = "system",
2262
+ fullWidth: n = !1,
2263
+ className: o,
2264
+ size: s = "medium",
2265
+ raw: i = !1,
2266
+ noBorder: u = !1,
2267
+ spacing: p,
2268
+ variant: h = "primary",
2269
+ noTruncate: m = !1,
2270
+ ...l
2271
+ }, d) => {
2272
+ const f = Yt({
2273
+ type: Ft,
2274
+ mode: r,
2275
+ focusMode: a,
2276
+ fullWidth: n,
2277
+ disabled: t,
2278
+ raw: i,
2279
+ className: o,
2280
+ size: s,
2281
+ noBorder: u,
2282
+ spacing: p,
2283
+ variant: h,
2284
+ noTruncate: m
2285
+ });
2286
+ return /* @__PURE__ */ c(
2287
+ Xe,
2288
+ {
2289
+ ref: d,
2290
+ className: f,
2291
+ disabled: t,
2292
+ ...l,
2293
+ children: e
2294
+ }
2295
+ );
2296
+ }
2297
+ );
2298
+ zt.displayName = "Button";
2299
+ function Qa(e) {
2300
+ const t = bt();
2301
+ return `${e}${t}`;
2302
+ }
2303
+ const Xa = ({
2304
+ className: e,
2305
+ headerClassName: t,
2306
+ bodyClassName: r,
2307
+ footerClassName: a,
2308
+ spacing: n,
2309
+ mode: o,
2310
+ compact: s,
2311
+ noBorder: i
2312
+ }) => {
2313
+ const u = g(
2314
+ Te,
2315
+ e,
2316
+ "rounded-md",
2317
+ Ce(n),
2318
+ {
2319
+ "border-none": i,
2320
+ "border-2": !i,
2321
+ "p-4": !s,
2322
+ "p-1 sm:p-2": s,
2323
+ "border-border-accent bg-surface-darker text-copy-light": o === "darker",
2324
+ "border-border-accent bg-surface-dark text-copy-light": o === "dark",
2325
+ "border-border-dark bg-surface-lighter text-copy-dark": o === "light",
2326
+ "border-border-dark bg-surface-lighter text-copy-dark dark:border-border-accent dark:bg-surface-dark dark:text-copy-light": o === "system",
2327
+ "border-border-accent bg-surface-dark text-copy-light dark:border-border-dark dark:bg-surface-lighter dark:text-copy-dark": o === "alt-system"
2328
+ }
2329
+ ), p = t || g(`${Te}__header mt-0 border-b-2`, {
2330
+ "text-copy-light border-border-accent": o === "darker",
2331
+ "border-border-accent": o === "dark",
2332
+ "border-border-medium": o === "light",
2333
+ "border-border-medium dark:border-border-accent": o === "system",
2334
+ "border-border-accent dark:border-border-medium": o === "alt-system",
2335
+ "mb-4": !s,
2336
+ "mb-2": s
2337
+ }), h = g(r), m = a || g(`${Te}__footer pt-2`);
2338
+ return {
2339
+ wrapper: u,
2340
+ header: p,
2341
+ body: h,
2342
+ footer: m
2343
+ };
2344
+ };
2345
+ function Za({
2346
+ id: e,
2347
+ content: t,
2348
+ userAriaLabelledby: r,
2349
+ className: a
2350
+ }) {
2351
+ return typeof t == "string" ? /* @__PURE__ */ c("h2", { id: e, className: a, children: t }) : r ? /* @__PURE__ */ c("div", { className: a, children: t }) : t ? /* @__PURE__ */ c("div", { className: a, id: e, children: t }) : null;
2352
+ }
2353
+ const en = ({
2354
+ header: e,
2355
+ headerClassName: t,
2356
+ footer: r,
2357
+ footerClassName: a,
2358
+ children: n,
2359
+ className: o,
2360
+ bodyClassName: s,
2361
+ "aria-labelledby": i,
2362
+ spacing: u,
2363
+ mode: p = "system",
2364
+ compact: h = !1,
2365
+ noBorder: m = !1,
2366
+ ...l
2367
+ }) => {
2368
+ let d = null, f = null;
2369
+ const E = typeof e == "string", _ = Qa(Te), w = Xa({
2370
+ className: o,
2371
+ headerClassName: t,
2372
+ bodyClassName: s,
2373
+ footerClassName: a,
2374
+ spacing: u,
2375
+ mode: p,
2376
+ compact: h,
2377
+ noBorder: m
2378
+ });
2379
+ return E ? (d = _, f = d) : !E && e && i ? (d = null, f = i) : !E && e && !i ? (d = _, f = d) : (d = null, f = i || null), /* @__PURE__ */ c("div", { className: w.wrapper, children: /* @__PURE__ */ I(
2380
+ "section",
2381
+ {
2382
+ ...f && {
2383
+ "aria-labelledby": f
2384
+ },
2385
+ className: w.body,
2386
+ ...l,
2387
+ children: [
2388
+ /* @__PURE__ */ c(
2389
+ Za,
2390
+ {
2391
+ ...d && { id: d },
2392
+ content: e,
2393
+ className: w.header,
2394
+ userAriaLabelledby: i
2395
+ }
2396
+ ),
2397
+ /* @__PURE__ */ c("div", { children: n }),
2398
+ r ? /* @__PURE__ */ c("div", { className: w.footer, children: r }) : null
2399
+ ]
2400
+ }
2401
+ ) });
2402
+ }, tn = ({
2403
+ className: e,
2404
+ mode: t = "system",
2405
+ row1: r,
2406
+ row2: a,
2407
+ noMargins: n = !1,
2408
+ spacing: o,
2409
+ raw: s = !1
2410
+ }) => {
2411
+ const i = g(Ba, e, Ce(o), {
2412
+ "text-copy-dark": !s && t === "dark",
2413
+ "text-copy-lighter": !s && t === "light",
2414
+ "text-copy-dark dark:text-copy-lighter": !s && t === "system",
2415
+ "text-copy-lighter dark:text-copy-dark": !s && t === "alt-system",
2416
+ "mb-[100px]": !n && !s,
2417
+ "mt-0 flex w-full flex-col p-2 text-center text-xs sm:mt-3 md:mx-auto md:max-w-4xl": !s
2418
+ });
2419
+ return /* @__PURE__ */ I("footer", { className: i, children: [
2420
+ r && /* @__PURE__ */ c("div", { children: r }),
2421
+ a && /* @__PURE__ */ c("div", { children: a })
2422
+ ] });
2423
+ }, rn = ({
2424
+ children: e,
2425
+ className: t,
2426
+ raw: r = !1,
2427
+ spacing: a
2428
+ }) => {
2429
+ const n = g(t, Ga, Ce(a), {
2430
+ "mt-2 flex w-full flex-col p-2 sm:mt-3 md:mx-auto md:max-w-4xl": !r
2431
+ });
2432
+ return /* @__PURE__ */ c("main", { className: n, children: e });
2433
+ };
2434
+ /*!
2435
+ @versini/ui-components v5.21.1
2436
+ © 2024 gizmette.com
2437
+ */
2438
+ try {
2439
+ window.__VERSINI_UI_GLOBAL__ || (window.__VERSINI_UI_GLOBAL__ = {
2440
+ version: "5.21.1",
2441
+ buildTime: "08/07/2024 09:49 AM EDT",
2442
+ homepage: "https://github.com/aversini/ui-components",
2443
+ license: "MIT"
2444
+ });
2445
+ } catch {
2446
+ }
2447
+ function an(e) {
2448
+ return Et(() => e.every((t) => t == null) ? () => {
2449
+ } : (t) => {
2450
+ e.forEach((r) => {
2451
+ typeof r == "function" ? r(t) : r != null && (r.current = t);
2452
+ });
2453
+ }, e);
2454
+ }
2455
+ function nn(e) {
2456
+ const t = bt();
2457
+ if (!e)
2458
+ return t;
2459
+ if (typeof e == "number" || typeof e == "string")
2460
+ return `${e}${t}`;
2461
+ if (typeof e == "object") {
2462
+ const { id: r, prefix: a = "" } = e;
2463
+ return typeof r == "number" || typeof r == "string" ? `${a}${r}` : `${a}${t}`;
2464
+ }
2465
+ }
2466
+ const jt = "SET_ANNOUNCEMENT", qt = "CLEAR_ANNOUNCEMENT", on = {
2467
+ alert: null,
2468
+ alertdialog: null,
2469
+ log: "polite",
2470
+ marquee: null,
2471
+ progressbar: null,
2472
+ status: "polite",
2473
+ timer: "assertive"
2474
+ }, sn = (e, t) => {
2475
+ switch (t == null ? void 0 : t.type) {
2476
+ case jt:
2477
+ return {
2478
+ ...e,
2479
+ announcement: t.payload
2480
+ };
2481
+ case qt:
2482
+ return {
2483
+ ...e,
2484
+ announcement: null
2485
+ };
2486
+ default:
2487
+ return e;
2488
+ }
2489
+ }, cn = ({
2490
+ onAnnouncementClear: e,
2491
+ dispatch: t
2492
+ }) => {
2493
+ t({
2494
+ type: qt
2495
+ }), typeof e == "function" && e();
2496
+ }, pt = ({
2497
+ children: e,
2498
+ clearAnnouncementDelay: t,
2499
+ clearAnnouncementTimeoutRef: r,
2500
+ onAnnouncementClear: a,
2501
+ dispatch: n
2502
+ }) => {
2503
+ (r == null ? void 0 : r.current) !== null && clearTimeout(r.current), e !== null && n({
2504
+ type: jt,
2505
+ payload: e
2506
+ }), t && (r.current = setTimeout(
2507
+ () => cn({
2508
+ onAnnouncementClear: a,
2509
+ dispatch: n
2510
+ }),
2511
+ t
2512
+ ));
2513
+ }, ln = ({
2514
+ children: e,
2515
+ announcementTimeoutRef: t,
2516
+ announcementDelay: r,
2517
+ clearAnnouncementDelay: a,
2518
+ clearAnnouncementTimeoutRef: n,
2519
+ onAnnouncementClear: o,
2520
+ dispatch: s
2521
+ }) => {
2522
+ clearTimeout(t.current), r ? t.current = setTimeout(pt, r, {
2523
+ children: e,
2524
+ clearAnnouncementDelay: a,
2525
+ clearAnnouncementTimeoutRef: n,
2526
+ onAnnouncementClear: o,
2527
+ dispatch: s
2528
+ }) : pt({
2529
+ children: e,
2530
+ clearAnnouncementDelay: a,
2531
+ clearAnnouncementTimeoutRef: n,
2532
+ onAnnouncementClear: o,
2533
+ dispatch: s
2534
+ });
2535
+ };
2536
+ function Qt({
2537
+ children: e,
2538
+ className: t,
2539
+ politeness: r,
2540
+ role: a = null,
2541
+ announcementDelay: n,
2542
+ clearAnnouncementDelay: o,
2543
+ onAnnouncementClear: s,
2544
+ visible: i,
2545
+ ...u
2546
+ }) {
2547
+ const p = W(), h = W(), [m, l] = ft(sn, {
2548
+ announcement: null
2549
+ });
2550
+ let d = r;
2551
+ typeof d > "u" && (d = a ? on[a] : "assertive"), j(() => {
2552
+ ln({
2553
+ announcementTimeoutRef: p,
2554
+ announcementDelay: n,
2555
+ children: e,
2556
+ clearAnnouncementDelay: o,
2557
+ clearAnnouncementTimeoutRef: h,
2558
+ onAnnouncementClear: s,
2559
+ dispatch: l
2560
+ });
2561
+ }, [
2562
+ e,
2563
+ n,
2564
+ o,
2565
+ s
2566
+ ]);
2567
+ const f = g(t, {
2568
+ "sr-only": !i
2569
+ });
2570
+ return /* @__PURE__ */ c(
2571
+ "div",
2572
+ {
2573
+ "aria-live": d,
2574
+ ...a && { role: a },
2575
+ className: f,
2576
+ ...u,
2577
+ children: m.announcement
2578
+ }
2579
+ );
2580
+ }
2581
+ /*!
2582
+ @versini/ui-private v1.4.7
2583
+ © 2024 gizmette.com
2584
+ */
2585
+ try {
2586
+ window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
2587
+ version: "1.4.7",
2588
+ buildTime: "08/07/2024 12:36 PM EDT",
2589
+ homepage: "https://github.com/aversini/ui-components",
2590
+ license: "MIT"
2591
+ });
2592
+ } catch {
2593
+ }
2594
+ const dn = (e) => {
2595
+ let t = "";
2596
+ if (typeof e == "number" || typeof e == "string")
2597
+ t = "m-" + e;
2598
+ else {
2599
+ const r = [];
2600
+ (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
2601
+ }
2602
+ return t;
2603
+ }, Xt = "av-text-input", un = "av-text-input-wrapper", Je = "av-text-input-helper-text", Uo = "av-text-area", Ho = "av-text-area-wrapper", Ko = "av-text-area-helper-text", Bo = "av-text-area__control--right", Go = "av-toggle";
2604
+ function mn() {
2605
+ const e = W(!1);
2606
+ return j(() => (e.current = !0, () => {
2607
+ e.current = !1;
2608
+ }), []), z(() => e.current, []);
2609
+ }
2610
+ const hn = {
2611
+ x: 0,
2612
+ y: 0,
2613
+ width: 0,
2614
+ height: 0,
2615
+ top: 0,
2616
+ left: 0,
2617
+ bottom: 0,
2618
+ right: 0
2619
+ };
2620
+ function pn(e) {
2621
+ const t = mn(), r = W(0), a = W(null), [n, o] = F(hn), s = Et(
2622
+ () => typeof window < "u" ? new ResizeObserver((i) => {
2623
+ const u = i[0];
2624
+ u && (cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
2625
+ a.current && t() && o(u.contentRect);
2626
+ }));
2627
+ }) : null,
2628
+ [t]
2629
+ );
2630
+ return j(() => (a.current && (s == null || s.observe(a.current, e)), () => {
2631
+ s == null || s.disconnect(), r.current && cancelAnimationFrame(r.current);
2632
+ }), [s, e]), [a, n];
2633
+ }
2634
+ const gn = ({
2635
+ mode: e
2636
+ }) => g({
2637
+ "bg-surface-darker text-copy-lighter caret-copy-light": e === "dark",
2638
+ "bg-surface-lighter text-copy-dark caret-copy-dark": e === "light",
2639
+ "bg-surface-lighter text-copy-dark caret-copy-dark dark:bg-surface-darker dark:text-copy-lighter dark:caret-copy-light": e === "system",
2640
+ "bg-surface-darker text-copy-lighter caret-copy-light dark:bg-surface-lighter dark:text-copy-dark dark:caret-copy-dark": e === "alt-system"
2641
+ }), fn = ({
2642
+ focusMode: e
2643
+ }) => g("focus:outline focus:outline-2 focus:outline-offset-2", {
2644
+ "focus:outline-focus-dark": e === "dark",
2645
+ "focus:outline-focus-light": e === "light",
2646
+ "focus:outline-focus-light dark:focus:outline-focus-dark": e === "alt-system",
2647
+ "focus:outline-focus-dark dark:focus:outline-focus-light": e === "system"
2648
+ }), yn = ({
2649
+ noBorder: e,
2650
+ error: t
2651
+ }) => g("border-2", {
2652
+ "border-border-dark": !e && !t,
2653
+ "focus:border-border-dark": !e && t,
2654
+ "border-border-error-dark": !e && t,
2655
+ "border-transparent": e
2656
+ }), bn = ({
2657
+ disabled: e,
2658
+ raw: t,
2659
+ error: r,
2660
+ mode: a
2661
+ }) => {
2662
+ if (t)
2663
+ return "";
2664
+ if (e)
2665
+ return g("absolute px-2 cursor-not-allowed opacity-50 font-medium");
2666
+ if (!r)
2667
+ return g("absolute px-2 cursor-text font-medium", {
2668
+ "text-copy-lighter": a === "dark",
2669
+ "text-copy-dark": a === "light",
2670
+ "text-copy-dark dark:text-copy-lighter": a === "system",
2671
+ "text-copy-lighter dark:text-copy-dark": a === "alt-system"
2672
+ });
2673
+ if (r)
2674
+ return g("absolute px-2 cursor-text font-medium", {
2675
+ "text-copy-lighter": a === "dark",
2676
+ "text-copy-error-dark": a === "light",
2677
+ "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": a === "system",
2678
+ "text-copy-lighter dark:text-copy-error-dark": a === "alt-system"
2679
+ });
2680
+ }, En = ({
2681
+ error: e,
2682
+ raw: t,
2683
+ mode: r,
2684
+ disabled: a
2685
+ }) => {
2686
+ if (t)
2687
+ return "";
2688
+ if (a)
2689
+ return g(
2690
+ Je,
2691
+ "absolute px-2 cursor-not-allowed opacity-50 font-medium"
2692
+ );
2693
+ if (!e)
2694
+ return g(Je, "absolute px-2 font-medium", {
2695
+ "text-copy-lighter": r === "dark",
2696
+ "text-copy-dark": r === "light",
2697
+ "text-copy-dark dark:text-copy-lighter": r === "system",
2698
+ "text-copy-lighter dark:text-copy-dark": r === "alt-system"
2699
+ });
2700
+ if (e)
2701
+ return g(Je, "absolute px-2 font-medium", {
2702
+ "text-copy-error-light bg-surface-darker": r === "dark",
2703
+ "text-copy-error-dark": r === "light",
2704
+ "text-copy-error-dark dark:text-copy-error-light dark:bg-surface-darker": r === "system",
2705
+ "dark:text-copy-error-dark text-copy-error-light bg-surface-darker": r === "alt-system"
2706
+ });
2707
+ }, wn = ({
2708
+ className: e,
2709
+ inputClassName: t,
2710
+ raw: r,
2711
+ disabled: a,
2712
+ noBorder: n,
2713
+ error: o,
2714
+ spacing: s,
2715
+ mode: i,
2716
+ focusMode: u
2717
+ }) => {
2718
+ const p = r ? e : g(
2719
+ "relative flex w-full flex-col justify-center",
2720
+ un,
2721
+ e,
2722
+ dn(s)
2723
+ ), h = r ? g(t) : g(
2724
+ Xt,
2725
+ t,
2726
+ "h-12 rounded-md px-4 text-base",
2727
+ gn({ mode: i }),
2728
+ fn({ focusMode: u }),
2729
+ yn({ noBorder: n, error: o }),
2730
+ {
2731
+ "disabled:cursor-not-allowed disabled:opacity-50": a
2732
+ }
2733
+ ), m = r ? void 0 : "sr-only", l = bn({
2734
+ disabled: a,
2735
+ raw: r,
2736
+ error: o,
2737
+ mode: i
2738
+ }), d = En({
2739
+ error: o,
2740
+ raw: r,
2741
+ mode: i,
2742
+ disabled: a
2743
+ });
2744
+ return {
2745
+ wrapper: p,
2746
+ input: h,
2747
+ accessibleLabel: m,
2748
+ visibleLabel: l,
2749
+ helperText: d,
2750
+ rightElement: r ? void 0 : "absolute right-3"
2751
+ };
2752
+ }, Ze = V.forwardRef(
2753
+ ({
2754
+ id: e,
2755
+ name: t,
2756
+ label: r,
2757
+ error: a = !1,
2758
+ raw: n = !1,
2759
+ className: o,
2760
+ inputClassName: s,
2761
+ mode: i = "system",
2762
+ focusMode: u = "system",
2763
+ disabled: p = !1,
2764
+ noBorder: h = !1,
2765
+ labelId: m,
2766
+ labelHidden: l = !1,
2767
+ type: d = "text",
2768
+ helperText: f = "",
2769
+ rightElement: E,
2770
+ spacing: _,
2771
+ ...w
2772
+ }, U) => {
2773
+ const [H, O] = pn(), [ae, P] = F(0), N = nn({ id: e, prefix: `${Xt}-` }), x = `${t} error, ${f}`, D = wn({
2774
+ className: o,
2775
+ inputClassName: s,
2776
+ error: a,
2777
+ raw: n,
2778
+ focusMode: u,
2779
+ disabled: p,
2780
+ noBorder: h,
2781
+ spacing: _,
2782
+ mode: i
2783
+ });
2784
+ return sr(() => {
2785
+ O && O.width && P(O.width + 18 + 10);
2786
+ }, [O]), /* @__PURE__ */ I("div", { className: D.wrapper, children: [
2787
+ /* @__PURE__ */ c(
2788
+ "label",
2789
+ {
2790
+ htmlFor: N,
2791
+ id: m,
2792
+ className: D.accessibleLabel,
2793
+ children: r
2794
+ }
2795
+ ),
2796
+ /* @__PURE__ */ c(
2797
+ "input",
2798
+ {
2799
+ ref: U,
2800
+ id: N,
2801
+ name: t,
2802
+ type: d,
2803
+ disabled: p,
2804
+ placeholder: n ? void 0 : " ",
2805
+ className: D.input,
2806
+ ...f && { "aria-describedby": `${N}-helper` },
2807
+ ...a && { "aria-invalid": "true" },
2808
+ ...E && !n && { style: { paddingRight: ae } },
2809
+ ...w
2810
+ }
2811
+ ),
2812
+ !n && !l && /* @__PURE__ */ c(
2813
+ "label",
2814
+ {
2815
+ "aria-hidden": !0,
2816
+ htmlFor: N,
2817
+ className: D.visibleLabel,
2818
+ children: r
2819
+ }
2820
+ ),
2821
+ f && /* @__PURE__ */ c(
2822
+ "div",
2823
+ {
2824
+ id: `${N}-helper`,
2825
+ className: D.helperText,
2826
+ children: f
2827
+ }
2828
+ ),
2829
+ E && /* @__PURE__ */ c(
2830
+ "div",
2831
+ {
2832
+ ref: H,
2833
+ className: D.rightElement,
2834
+ children: E
2835
+ }
2836
+ ),
2837
+ a && f && /* @__PURE__ */ c(Qt, { politeness: "polite", clearAnnouncementDelay: 500, children: x })
2838
+ ] });
2839
+ }
2840
+ );
2841
+ Ze.displayName = "TextInput";
2842
+ const Tn = 500, In = 5e3, Sn = 2e4, Zt = V.forwardRef(
2843
+ ({
2844
+ name: e,
2845
+ disabled: t,
2846
+ label: r,
2847
+ labelHidden: a,
2848
+ onMaskChange: n,
2849
+ onChange: o,
2850
+ onBlur: s,
2851
+ onFocus: i,
2852
+ onTextInputMaskBlur: u,
2853
+ rightElement: p,
2854
+ spacing: h,
2855
+ ...m
2856
+ }, l) => {
2857
+ const [d, f] = F(!0), [E, _] = F({
2858
+ message: null,
2859
+ politeness: null
2860
+ }), w = W(!0), U = W(), H = W(null), O = an([l, H]), ae = d ? "Show" : "Hide", P = () => {
2861
+ clearTimeout(U.current), w.current || (U.current = window.setTimeout(() => {
2862
+ w.current = !0, f(!0), _({
2863
+ announcementTimeout: In,
2864
+ politeness: "polite",
2865
+ message: `${r} hiding characters`
2866
+ }), n && n(!0);
2867
+ }, Sn));
2868
+ }, N = (C) => {
2869
+ C.preventDefault();
2870
+ const K = !w.current;
2871
+ w.current = K, P(), f(K), _({
2872
+ announcementTimeout: Tn,
2873
+ politeness: "assertive",
2874
+ message: K ? "Characters hidden" : "Characters showing"
2875
+ }), n && n(K);
2876
+ }, x = (C) => {
2877
+ var K;
2878
+ const { relatedTarget: $e } = C, y = (K = H.current) == null ? void 0 : K.parentElement;
2879
+ y != null && y.contains($e) || u && u();
2880
+ }, D = (C) => {
2881
+ P(), s && s(C), x(C);
2882
+ }, Pe = (C) => {
2883
+ P(), i && i(C);
2884
+ }, De = (C) => {
2885
+ P(), o && o(C);
2886
+ };
2887
+ return j(() => () => {
2888
+ clearTimeout(U.current);
2889
+ }, []), /* @__PURE__ */ I(ce, { children: [
2890
+ /* @__PURE__ */ c(
2891
+ Ze,
2892
+ {
2893
+ ref: O,
2894
+ name: e,
2895
+ label: r,
2896
+ labelHidden: a,
2897
+ type: d ? "password" : "text",
2898
+ disabled: t,
2899
+ spacing: h,
2900
+ onBlur: D,
2901
+ onFocus: Pe,
2902
+ onChange: De,
2903
+ rightElement: V.cloneElement(p, {
2904
+ ref: l,
2905
+ label: ae,
2906
+ onClick: N,
2907
+ onBlur: x,
2908
+ disabled: t
2909
+ }),
2910
+ ...m
2911
+ }
2912
+ ),
2913
+ /* @__PURE__ */ c(
2914
+ Qt,
2915
+ {
2916
+ role: "status",
2917
+ politeness: E.politeness,
2918
+ clearAnnouncementDelay: E.announcementTimeout,
2919
+ children: E.message
2920
+ }
2921
+ )
2922
+ ] });
2923
+ }
2924
+ );
2925
+ Zt.displayName = "TextInputMask";
2926
+ /*!
2927
+ @versini/ui-form v1.3.7
2928
+ © 2024 gizmette.com
2929
+ */
2930
+ try {
2931
+ window.__VERSINI_UI_FORM__ || (window.__VERSINI_UI_FORM__ = {
2932
+ version: "1.3.7",
2933
+ buildTime: "08/07/2024 12:37 PM EDT",
2934
+ homepage: "https://github.com/aversini/ui-components",
2935
+ license: "MIT"
2936
+ });
2937
+ } catch {
2938
+ }
2939
+ const An = (e) => {
2940
+ let t = "";
2941
+ if (typeof e == "number" || typeof e == "string")
2942
+ t = "m-" + e;
2943
+ else {
2944
+ const r = [];
2945
+ (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
2946
+ }
2947
+ return t;
2948
+ }, Oe = ({
2949
+ children: e,
2950
+ fill: t,
2951
+ viewBox: r,
2952
+ className: a,
2953
+ defaultViewBox: n,
2954
+ defaultClassName: o,
2955
+ spacing: s,
2956
+ title: i,
2957
+ semantic: u = !1,
2958
+ ...p
2959
+ }) => {
2960
+ const h = An(s), m = g(
2961
+ h,
2962
+ a || o
2963
+ );
2964
+ return /* @__PURE__ */ I(ce, { children: [
2965
+ /* @__PURE__ */ c(
2966
+ "svg",
2967
+ {
2968
+ xmlns: "http://www.w3.org/2000/svg",
2969
+ className: m,
2970
+ viewBox: r || n,
2971
+ fill: t || "currentColor",
2972
+ role: "img",
2973
+ "aria-hidden": !u,
2974
+ focusable: !1,
2975
+ ...p,
2976
+ children: e
2977
+ }
2978
+ ),
2979
+ i && u && /* @__PURE__ */ c("span", { className: "sr-only", children: i })
2980
+ ] });
2981
+ };
2982
+ /*!
2983
+ @versini/ui-private v1.4.6
2984
+ © 2024 gizmette.com
2985
+ */
2986
+ try {
2987
+ window.__VERSINI_UI_PRIVATE__ || (window.__VERSINI_UI_PRIVATE__ = {
2988
+ version: "1.4.6",
2989
+ buildTime: "07/14/2024 07:45 PM EDT",
2990
+ homepage: "https://github.com/aversini/ui-components",
2991
+ license: "MIT"
2992
+ });
2993
+ } catch {
2994
+ }
2995
+ const vn = ({
2996
+ className: e,
2997
+ viewBox: t,
2998
+ spacing: r,
2999
+ ...a
3000
+ }) => /* @__PURE__ */ c(
3001
+ Oe,
3002
+ {
3003
+ defaultViewBox: "0 0 1200 500",
3004
+ defaultClassName: "w-full",
3005
+ viewBox: t,
3006
+ className: e,
3007
+ spacing: r,
3008
+ title: "Sassy Dog",
3009
+ ...a,
3010
+ children: /* @__PURE__ */ c("g", { transform: "matrix(11.9092 0 0 11.9092 470.0017 250.0009)", id: "879221", children: /* @__PURE__ */ c(
3011
+ "path",
3012
+ {
3013
+ vectorEffect: "non-scaling-stroke",
3014
+ transform: " translate(-50.7473, -45.4051)",
3015
+ d: "M 89.2 27 c 0 -0.2 -0.1 -0.5 -0.3 -0.6 c -0.6 -0.4 -1.6 -0.1 -2.2 0 c -1.5 0.2 -2.9 0.4 -4.5 0.4 c -2.2 0 -4.5 -0.1 -6.7 -0.4 c -2 -0.3 -3.7 -0.9 -5.8 -0.3 c -3 0.8 -4.9 3.2 -4.8 6.3 c 0.1 1.8 -0.2 3.2 -0.8 4.8 c -0.6 1.5 -1.3 1.7 -2.7 1.7 c -9.7 0 -19.3 -0.1 -29 0 c -1.7 0 -3.5 0 -5.3 0 c -2.5 0 -5 0.5 -7.5 0 c -1.8 -0.4 -3.6 -1.3 -4.9 -2.6 c -0.3 -0.3 -0.9 -1.2 -1.2 -1.2 c -0.4 0.1 -0.4 1.3 -0.4 1.6 c 0 1.3 0.5 2.6 0.5 3.9 c 0 1.3 -0.6 2.4 -1 3.6 c -0.4 1.4 -0.4 2.8 -0.2 4.2 c 0.4 2.3 0.8 4.7 1 7.1 c 0.2 2.1 0.2 4.1 0.4 6.2 c 0.2 1.7 0.3 2.5 2.5 2.8 c 2.6 0.4 2.6 -0.5 3.2 -2.2 c 0.8 -2.1 1.5 -4.3 2.3 -6.4 c 0.7 -1.6 1.3 -5.1 5.7 -3.4 c 2.4 0.9 4.9 1.4 7.4 2.1 c 2.7 0.7 5.5 1.4 8.2 1.9 c 5.5 1.1 11.1 1.7 16.8 2 c 0.6 0 1 0 1.4 0.5 c 1.5 1.9 -0.3 5.3 3.5 5.9 c 3.4 0.5 3.4 -1.9 3.8 -4 c 0.2 -1.2 0.4 -2.3 0.7 -3.4 c 0.1 -0.5 0.5 -1 0.9 -1.3 c 4.7 -2.8 7.4 -8.3 6.6 -13.8 c -0.1 -0.9 -0.4 -1.8 -0.3 -2.8 c 0.2 -2 2.7 -2.8 4.2 -3.6 c 1.9 -1.1 4 -2.1 5.6 -3.6 c 1.1 -1 2 -2.3 2.5 -3.7 C 89.1 28.2 89.3 27.5 89.2 27 z M 73.2 40.4 c -0.2 2.1 -1.1 3.1 -3 3.5 c -3.4 0.7 -5.6 -1.6 -4.6 -4.9 c 0.7 -2.2 1.5 -4.3 2.5 -6.3 c 1 -2 1.9 -2 3.1 -0.1 C 72.7 35 73.5 37.6 73.2 40.4 z M 76.4 31.2 c -0.6 0 -1.1 -0.5 -1.1 -1.1 c 0 -0.6 0.5 -1.1 1.1 -1.1 c 0.6 0 1.1 0.5 1.1 1.1 C 77.5 30.7 77 31.2 76.4 31.2 z",
3016
+ strokeLinecap: "round"
3017
+ }
3018
+ ) })
3019
+ }
3020
+ ), kn = ({
3021
+ className: e,
3022
+ viewBox: t,
3023
+ spacing: r,
3024
+ title: a,
3025
+ monotone: n,
3026
+ ...o
3027
+ }) => /* @__PURE__ */ I(
3028
+ Oe,
3029
+ {
3030
+ defaultViewBox: "0 0 640 512",
3031
+ defaultClassName: "size-5",
3032
+ viewBox: t,
3033
+ className: e,
3034
+ spacing: r,
3035
+ title: a || "Hide",
3036
+ ...o,
3037
+ children: [
3038
+ /* @__PURE__ */ c(
3039
+ "path",
3040
+ {
3041
+ opacity: n ? "1" : "0.4",
3042
+ d: "M360.8 380.3C339.4 392.8 314.6 400 288 400c-79.5 0-144-64.5-144-144c0-14.5 2.1-28.5 6.1-41.7L63.5 146c-29.4 34.7-49.9 70.8-61.1 97.6c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480c56.1 0 104.4-17.8 144.5-43.2l-71.7-56.5zM198.5 252.4c-3.7 .8-6.7 3.7-6.5 7.7c.3 6.9 1.3 13.8 3.2 20.7c13.7 51.2 66.4 81.6 117.6 67.9c1.9-.5 3.9-1.1 5.7-1.7l-120-94.6zm89-52.4l94.8 74.3c2.7-13.9 2.4-28.6-1.5-43.2c-11.1-41.5-47.8-69.4-88.6-71.1c-5.8-.2-9.2 6.1-7.4 11.7c2.1 6.4 3.3 13.2 3.3 20.3c0 2.7-.2 5.4-.5 8zM432 256c0 17.7-3.2 34.6-9 50.2l84.1 65.9c32.3-36.6 54.6-75.4 66.4-103.9c3.3-7.9 3.3-16.7 0-24.6c-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.7L207 136.9c23.1-15.7 51-24.9 81-24.9c79.5 0 144 64.5 144 144z"
3043
+ }
3044
+ ),
3045
+ /* @__PURE__ */ c("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.1L9.2 42.9C-1.2 34.7-3.1 19.6 5.1 9.2z" })
3046
+ ]
3047
+ }
3048
+ ), _n = ({
3049
+ className: e,
3050
+ viewBox: t,
3051
+ spacing: r,
3052
+ title: a,
3053
+ monotone: n,
3054
+ ...o
3055
+ }) => /* @__PURE__ */ I(
3056
+ Oe,
3057
+ {
3058
+ defaultViewBox: "0 0 512 512",
3059
+ defaultClassName: "size-5",
3060
+ viewBox: t,
3061
+ className: e,
3062
+ spacing: r,
3063
+ title: a || "Key",
3064
+ ...o,
3065
+ children: [
3066
+ /* @__PURE__ */ c(
3067
+ "path",
3068
+ {
3069
+ className: "fa-secondary",
3070
+ opacity: n ? "1" : "0.4",
3071
+ d: "M168.3 229.7L282.3 343.7l0 0s0 0 0 0L249 377c-4.5 4.5-10.6 7-17 7H192v40c0 13.3-10.7 24-24 24H128v40c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V408c0-6.4 2.5-12.5 7-17L168.3 229.7s0 0 0 0l0 0z"
3072
+ }
3073
+ ),
3074
+ /* @__PURE__ */ c(
3075
+ "path",
3076
+ {
3077
+ className: "fa-primary",
3078
+ d: "M168.3 229.7L282.3 343.7l0 0c16.9 5.4 35 8.3 53.7 8.3c97.2 0 176-78.8 176-176S433.2 0 336 0S160 78.8 160 176c0 18.7 2.9 36.8 8.3 53.7l0 0zM336 136a40 40 0 1 1 80 0 40 40 0 1 1 -80 0z"
3079
+ }
3080
+ )
3081
+ ]
3082
+ }
3083
+ ), Rn = ({
3084
+ className: e,
3085
+ viewBox: t,
3086
+ spacing: r,
3087
+ title: a,
3088
+ monotone: n,
3089
+ ...o
3090
+ }) => /* @__PURE__ */ I(
3091
+ Oe,
3092
+ {
3093
+ defaultViewBox: "0 0 576 512",
3094
+ defaultClassName: "size-5",
3095
+ viewBox: t,
3096
+ className: e,
3097
+ spacing: r,
3098
+ title: a || "Show",
3099
+ ...o,
3100
+ children: [
3101
+ /* @__PURE__ */ c(
3102
+ "path",
3103
+ {
3104
+ opacity: n ? "1" : "0.4",
3105
+ d: "M95.4 112.6C142.5 68.8 207.2 32 288 32s145.5 36.8 192.6 80.6c46.8 43.5 78.1 95.4 93 131.1c3.3 7.9 3.3 16.7 0 24.6c-14.9 35.7-46.2 87.7-93 131.1C433.5 443.2 368.8 480 288 480s-145.5-36.8-192.6-80.6C48.6 356 17.3 304 2.5 268.3c-3.3-7.9-3.3-16.7 0-24.6C17.3 208 48.6 156 95.4 112.6zM288 400a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"
3106
+ }
3107
+ ),
3108
+ /* @__PURE__ */ c("path", { d: "M224 256c35.3 0 64-28.7 64-64c0-7.1-1.2-13.9-3.3-20.3c-1.8-5.5 1.6-11.9 7.4-11.7c40.8 1.7 77.5 29.6 88.6 71.1c13.7 51.2-16.7 103.9-67.9 117.6s-103.9-16.7-117.6-67.9c-1.9-6.9-2.9-13.9-3.2-20.7c-.3-5.8 6.1-9.2 11.7-7.4c6.4 2.1 13.2 3.3 20.3 3.3z" })
3109
+ ]
3110
+ }
3111
+ );
3112
+ /*!
3113
+ @versini/ui-icons v1.11.0
3114
+ © 2024 gizmette.com
3115
+ */
3116
+ try {
3117
+ window.__VERSINI_UI_ICONS__ || (window.__VERSINI_UI_ICONS__ = {
3118
+ version: "1.11.0",
3119
+ buildTime: "07/14/2024 07:45 PM EDT",
3120
+ homepage: "https://github.com/aversini/ui-components",
3121
+ license: "MIT"
3122
+ });
3123
+ } catch {
3124
+ }
3125
+ const Nn = (e) => {
3126
+ let t = "";
3127
+ if (typeof e == "number" || typeof e == "string")
3128
+ t = "m-" + e;
3129
+ else {
3130
+ const r = [];
3131
+ (e == null ? void 0 : e.t) !== void 0 && r.push(`mt-${e.t}`), (e == null ? void 0 : e.r) !== void 0 && r.push(`mr-${e.r}`), (e == null ? void 0 : e.b) !== void 0 && r.push(`mb-${e.b}`), (e == null ? void 0 : e.l) !== void 0 && r.push(`ml-${e.l}`), t = r.join(" ");
3132
+ }
3133
+ return t;
3134
+ }, xn = "av-flexgrid", be = "av-flexgrid-item", ke = 0.25, er = V.createContext({
3135
+ columnGap: 0,
3136
+ rowGap: 0
3137
+ }), gt = ({
3138
+ children: e,
3139
+ className: t,
3140
+ columnGap: r = 1,
3141
+ rowGap: a = 0,
3142
+ height: n = "auto",
3143
+ width: o = "auto",
3144
+ direction: s = "row",
3145
+ alignHorizontal: i = "normal",
3146
+ alignVertical: u = "normal",
3147
+ spacing: p,
3148
+ ...h
3149
+ }) => {
3150
+ const m = {
3151
+ flexDirection: s,
3152
+ justifyContent: i,
3153
+ alignItems: u,
3154
+ height: n,
3155
+ width: o,
3156
+ /**
3157
+ * Trick to account for the extra space taken
3158
+ * by the columnGap and rowGap that will be applied
3159
+ * to all FlexgridItems (see context and paddings).
3160
+ */
3161
+ marginLeft: r * -1 * ke + "rem",
3162
+ marginTop: a * -1 * ke + "rem"
3163
+ }, l = g(
3164
+ xn,
3165
+ t,
3166
+ "box-border flex flex-wrap"
3167
+ ), d = { columnGap: r, rowGap: a }, f = p ? "div" : V.Fragment;
3168
+ return /* @__PURE__ */ c(f, { ...p ? { className: Nn(p) } : {}, children: /* @__PURE__ */ c("div", { className: l, style: m, ...h, children: /* @__PURE__ */ c(er.Provider, { value: d, children: e }) }) });
3169
+ }, Fe = (e, t) => g({
3170
+ "basis-1/12": e === 1 && !t,
3171
+ "sm:basis-1/12": e === 1 && t === "sm",
3172
+ "md:basis-1/12": e === 1 && t === "md",
3173
+ "lg:basis-1/12": e === 1 && t === "lg",
3174
+ "xl:basis-1/12": e === 1 && t === "xl",
3175
+ "2xl:basis-1/12": e === 1 && t === "2xl",
3176
+ "basis-2/12": e === 2 && !t,
3177
+ "sm:basis-2/12": e === 2 && t === "sm",
3178
+ "md:basis-2/12": e === 2 && t === "md",
3179
+ "lg:basis-2/12": e === 2 && t === "lg",
3180
+ "xl:basis-2/12": e === 2 && t === "xl",
3181
+ "2xl:basis-2/12": e === 2 && t === "2xl",
3182
+ "basis-3/12": e === 3 && !t,
3183
+ "sm:basis-3/12": e === 3 && t === "sm",
3184
+ "md:basis-3/12": e === 3 && t === "md",
3185
+ "lg:basis-3/12": e === 3 && t === "lg",
3186
+ "xl:basis-3/12": e === 3 && t === "xl",
3187
+ "2xl:basis-3/12": e === 3 && t === "2xl",
3188
+ "basis-4/12": e === 4 && !t,
3189
+ "sm:basis-4/12": e === 4 && t === "sm",
3190
+ "md:basis-4/12": e === 4 && t === "md",
3191
+ "lg:basis-4/12": e === 4 && t === "lg",
3192
+ "xl:basis-4/12": e === 4 && t === "xl",
3193
+ "2xl:basis-4/12": e === 4 && t === "2xl",
3194
+ "basis-5/12": e === 5 && !t,
3195
+ "sm:basis-5/12": e === 5 && t === "sm",
3196
+ "md:basis-5/12": e === 5 && t === "md",
3197
+ "lg:basis-5/12": e === 5 && t === "lg",
3198
+ "xl:basis-5/12": e === 5 && t === "xl",
3199
+ "2xl:basis-5/12": e === 5 && t === "2xl",
3200
+ "basis-6/12": e === 6 && !t,
3201
+ "sm:basis-6/12": e === 6 && t === "sm",
3202
+ "md:basis-6/12": e === 6 && t === "md",
3203
+ "lg:basis-6/12": e === 6 && t === "lg",
3204
+ "xl:basis-6/12": e === 6 && t === "xl",
3205
+ "2xl:basis-6/12": e === 6 && t === "2xl",
3206
+ "basis-7/12": e === 7 && !t,
3207
+ "sm:basis-7/12": e === 7 && t === "sm",
3208
+ "md:basis-7/12": e === 7 && t === "md",
3209
+ "lg:basis-7/12": e === 7 && t === "lg",
3210
+ "xl:basis-7/12": e === 7 && t === "xl",
3211
+ "2xl:basis-7/12": e === 7 && t === "2xl",
3212
+ "basis-8/12": e === 8 && !t,
3213
+ "sm:basis-8/12": e === 8 && t === "sm",
3214
+ "md:basis-8/12": e === 8 && t === "md",
3215
+ "lg:basis-8/12": e === 8 && t === "lg",
3216
+ "xl:basis-8/12": e === 8 && t === "xl",
3217
+ "2xl:basis-8/12": e === 8 && t === "2xl",
3218
+ "basis-9/12": e === 9 && !t,
3219
+ "sm:basis-9/12": e === 9 && t === "sm",
3220
+ "md:basis-9/12": e === 9 && t === "md",
3221
+ "lg:basis-9/12": e === 9 && t === "lg",
3222
+ "xl:basis-9/12": e === 9 && t === "xl",
3223
+ "2xl:basis-9/12": e === 9 && t === "2xl",
3224
+ "basis-10/12": e === 10 && !t,
3225
+ "sm:basis-10/12": e === 10 && t === "sm",
3226
+ "md:basis-10/12": e === 10 && t === "md",
3227
+ "lg:basis-10/12": e === 10 && t === "lg",
3228
+ "xl:basis-10/12": e === 10 && t === "xl",
3229
+ "2xl:basis-10/12": e === 10 && t === "2xl",
3230
+ "basis-11/12": e === 11 && !t,
3231
+ "sm:basis-11/12": e === 11 && t === "sm",
3232
+ "md:basis-11/12": e === 11 && t === "md",
3233
+ "lg:basis-11/12": e === 11 && t === "lg",
3234
+ "xl:basis-11/12": e === 11 && t === "xl",
3235
+ "2xl:basis-11/12": e === 11 && t === "2xl",
3236
+ "basis-full": e === 12 && !t,
3237
+ "sm:basis-full": e === 12 && t === "sm",
3238
+ "md:basis-full": e === 12 && t === "md",
3239
+ "lg:basis-full": e === 12 && t === "lg",
3240
+ "xl:basis-full": e === 12 && t === "xl",
3241
+ "2xl:basis-full": e === 12 && t === "2xl"
3242
+ }), Cn = ({
3243
+ className: e,
3244
+ span: t
3245
+ }) => {
3246
+ if (!t)
3247
+ return g(e, be, "box-border basis-auto");
3248
+ if (typeof t == "number")
3249
+ return g(e, be, "box-border max-w-full", {
3250
+ [`${Fe(t)}`]: !0
3251
+ });
3252
+ if (typeof t == "string")
3253
+ return g(e, be, "box-border basis-auto", {
3254
+ "max-w-full grow": t === "auto"
3255
+ });
3256
+ if (typeof t == "object") {
3257
+ const r = Object.entries(t).map(([a, n]) => a === "fallback" ? Fe(n) : Fe(n, a));
3258
+ return g(
3259
+ e,
3260
+ be,
3261
+ "box-border",
3262
+ r
3263
+ );
3264
+ }
3265
+ }, re = ({
3266
+ children: e,
3267
+ className: t,
3268
+ span: r,
3269
+ ...a
3270
+ }) => {
3271
+ const { columnGap: n, rowGap: o } = yt(er), s = {
3272
+ paddingLeft: n * ke + "rem",
3273
+ paddingTop: o * ke + "rem"
3274
+ }, i = Cn({
3275
+ className: t,
3276
+ span: r
3277
+ });
3278
+ return /* @__PURE__ */ c("div", { className: i, style: s, ...a, children: e });
3279
+ };
3280
+ /*!
3281
+ @versini/ui-system v1.4.3
3282
+ © 2024 gizmette.com
3283
+ */
3284
+ try {
3285
+ window.__VERSINI_UI_SYSTEM__ || (window.__VERSINI_UI_SYSTEM__ = {
3286
+ version: "1.4.3",
3287
+ buildTime: "08/07/2024 09:49 AM EDT",
3288
+ homepage: "https://github.com/aversini/ui-components",
3289
+ license: "MIT"
3290
+ });
3291
+ } catch {
3292
+ }
3293
+ const On = "ASK! ME! ANYTHING!", tr = "Sassy Saint", Pn = "gizmette.com", Dn = "Log in", $n = "Sign in with a Passkey", Wo = "Log out", Ln = "Password", Mn = "Powered by OpenAI", Vo = "Send", Jo = "Profile", Fo = "Statistics", Yo = "Chat history", zo = "About", jo = "Type your question here", qo = "Clear chat", Qo = "Cancel chat", Xo = "N/A", Zo = {
3294
+ PREFERENCES: {
3295
+ TITLE: "User preferences",
3296
+ NAME: "Name",
3297
+ EMAIL: "Email",
3298
+ ENGINE_DETAILS: "Show message statistics",
3299
+ LOCATION: "Location",
3300
+ MODEL_TYPE: "Use GPT model 4"
3301
+ },
3302
+ CURRENT_STATISTICS: {
3303
+ TITLE: "Current chat statistics",
3304
+ MODEL_NAME: "GPT model",
3305
+ TOKENS_USED: "Tokens used",
3306
+ REMAINING_TOKENS: "Remaining tokens",
3307
+ PROCESSING_TIME: "Average response time"
3308
+ },
3309
+ MAIN_STATISTICS: {
3310
+ TITLE: "Lifetime statistics",
3311
+ TOTAL: "Total chat session",
3312
+ PROCESSING_TIME: "Average response time"
3313
+ },
3314
+ HISTORY: {
3315
+ TITLE: "Chat history"
3316
+ },
3317
+ ABOUT: {
3318
+ TITLE_CLIENT: "Client details",
3319
+ TITLE_SERVER: "Server details",
3320
+ VERSION: "Version",
3321
+ BUILD_TIMESTAMP: "Build date",
3322
+ ENGINE: "OpenAI model",
3323
+ PLUGIN: "Plugin"
3324
+ }
3325
+ }, Un = ({
3326
+ serverStats: e
3327
+ }) => /* @__PURE__ */ c(
3328
+ tn,
3329
+ {
3330
+ mode: "light",
3331
+ row1: /* @__PURE__ */ I("div", { children: [
3332
+ tr,
3333
+ " v",
3334
+ "4.0.0",
3335
+ " - ",
3336
+ Mn,
3337
+ Qe && e && e.models.length > 0 && e.models[0] === "development" ? " - Development Mode" : ""
3338
+ ] }),
3339
+ row2: /* @__PURE__ */ I("div", { children: [
3340
+ "© ",
3341
+ (/* @__PURE__ */ new Date()).getFullYear(),
3342
+ " ",
3343
+ Pn
3344
+ ] })
3345
+ }
3346
+ ), Hn = wt(() => import("./LazyHeader.kRDKzfpE.js")), Kn = () => {
3347
+ const { isAuthenticated: e } = qe();
3348
+ return /* @__PURE__ */ I(ce, { children: [
3349
+ e && /* @__PURE__ */ c(Tt, { fallback: /* @__PURE__ */ c("div", {}), children: /* @__PURE__ */ c(Hn, {}) }),
3350
+ /* @__PURE__ */ I("div", { className: "flex items-center justify-center", children: [
3351
+ /* @__PURE__ */ c("div", { className: "basis-1/4", children: /* @__PURE__ */ c(vn, {}) }),
3352
+ /* @__PURE__ */ I("div", { className: "prose prose-sm prose-light md:prose-base prose-h1:mb-0 prose-h2:mt-0", children: [
3353
+ /* @__PURE__ */ c("h1", { children: tr }),
3354
+ /* @__PURE__ */ c("h2", { children: On })
3355
+ ] })
3356
+ ] })
3357
+ ] });
3358
+ }, Bn = () => {
3359
+ const { login: e, logoutReason: t, loginWithPasskey: r } = qe(), [a, n] = F(""), [o, s] = F(""), [i, u] = F(!0), [p, h] = F({
3360
+ username: "",
3361
+ password: ""
3362
+ }), m = async (l) => {
3363
+ l.preventDefault(), await e(p.username, p.password) || (s(""), n("Invalid username or password"));
3364
+ };
3365
+ return j(() => {
3366
+ var l;
3367
+ (l = document.getElementById("logo")) == null || l.classList.add("fadeOut"), setTimeout(() => {
3368
+ var d;
3369
+ (d = document.getElementById("root")) == null || d.classList.replace("app-hidden", "fadeIn");
3370
+ }, 500);
3371
+ }), j(() => {
3372
+ t && s(t);
3373
+ }, [t]), /* @__PURE__ */ I(ce, { children: [
3374
+ /* @__PURE__ */ I(rn, { children: [
3375
+ /* @__PURE__ */ c("div", { className: Ka(), children: /* @__PURE__ */ c(Kn, {}) }),
3376
+ /* @__PURE__ */ I("form", { className: "mt-5", onSubmit: m, children: [
3377
+ /* @__PURE__ */ c(gt, { alignHorizontal: "center", rowGap: 7, children: /* @__PURE__ */ c(re, { span: 6, children: /* @__PURE__ */ I(en, { mode: "dark", children: [
3378
+ /* @__PURE__ */ c(re, { span: 12, children: o && /* @__PURE__ */ c("div", { className: "p-2 text-sm text-center text-copy-error-light bg-surface-darker", children: o }) }),
3379
+ /* @__PURE__ */ c(re, { span: 12, children: /* @__PURE__ */ c(
3380
+ Ze,
3381
+ {
3382
+ required: !0,
3383
+ autoCapitalize: "off",
3384
+ autoComplete: "off",
3385
+ autoCorrect: "off",
3386
+ mode: "dark",
3387
+ focusMode: "light",
3388
+ name: "username",
3389
+ label: "Username",
3390
+ onChange: (l) => {
3391
+ h({
3392
+ ...p,
3393
+ username: l.target.value
3394
+ }), n("");
3395
+ },
3396
+ error: a !== ""
3397
+ }
3398
+ ) }),
3399
+ /* @__PURE__ */ c(re, { span: 12, children: /* @__PURE__ */ c(
3400
+ Zt,
3401
+ {
3402
+ required: !0,
3403
+ autoCapitalize: "off",
3404
+ autoComplete: "off",
3405
+ autoCorrect: "off",
3406
+ mode: "dark",
3407
+ focusMode: "light",
3408
+ name: "password",
3409
+ label: Ln,
3410
+ rightElement: /* @__PURE__ */ c(Ye, { focusMode: "light", mode: "dark", children: i ? /* @__PURE__ */ c(Rn, {}) : /* @__PURE__ */ c(kn, {}) }),
3411
+ onMaskChange: u,
3412
+ onChange: (l) => {
3413
+ h({
3414
+ ...p,
3415
+ password: l.target.value
3416
+ }), n("");
3417
+ },
3418
+ error: a !== "",
3419
+ helperText: a
3420
+ }
3421
+ ) }),
3422
+ /* @__PURE__ */ c(re, { span: 12, children: /* @__PURE__ */ c(
3423
+ zt,
3424
+ {
3425
+ mode: "light",
3426
+ focusMode: "light",
3427
+ fullWidth: !0,
3428
+ noBorder: !0,
3429
+ type: "submit",
3430
+ className: "mb-4 mt-6",
3431
+ children: Dn
3432
+ }
3433
+ ) })
3434
+ ] }) }) }),
3435
+ /* @__PURE__ */ c("div", { className: "text-center text-copy-light", children: "or" }),
3436
+ /* @__PURE__ */ c(gt, { alignHorizontal: "center", children: /* @__PURE__ */ c(re, { span: 6, children: /* @__PURE__ */ c(
3437
+ Ye,
3438
+ {
3439
+ mode: "dark",
3440
+ focusMode: "light",
3441
+ fullWidth: !0,
3442
+ noBorder: !0,
3443
+ className: "mb-4 mt-1",
3444
+ labelRight: $n,
3445
+ onClick: r,
3446
+ children: /* @__PURE__ */ c(_n, { className: "size-4" })
3447
+ }
3448
+ ) }) })
3449
+ ] })
3450
+ ] }),
3451
+ /* @__PURE__ */ c(Un, {})
3452
+ ] });
3453
+ }, Gn = new URL(document.location.href).searchParams, Wn = !!Gn.get("debug") || !1, Vn = wt(() => import("./App.B5-6f2Kg.js").then((e) => e.App)), Jn = ({ isComponent: e }) => {
3454
+ const { isAuthenticated: t } = qe();
3455
+ return t ? /* @__PURE__ */ c(Tt, { fallback: /* @__PURE__ */ c("div", {}), children: /* @__PURE__ */ c(Vn, { isComponent: e }) }) : /* @__PURE__ */ c(Bn, {});
3456
+ }, Fn = ({
3457
+ isComponent: e = !1,
3458
+ domain: t = Ha
3459
+ }) => /* @__PURE__ */ c(ce, { children: /* @__PURE__ */ c(Ra, { clientId: Na, domain: t, debug: Wn, children: /* @__PURE__ */ c(Jn, { isComponent: e }) }) }), Yn = ({ domain: e }) => /* @__PURE__ */ c(Fn, { isComponent: !0, domain: e });
3460
+ Yn.displayName = "SassySaint-3.4.8";
3461
+ export {
3462
+ Yt as A,
3463
+ zo as ABOUT_TITLE,
3464
+ po as ACTION_LOCATION,
3465
+ lo as ACTION_MESSAGE,
3466
+ mo as ACTION_MODEL,
3467
+ uo as ACTION_RESET,
3468
+ ho as ACTION_RESTORE,
3469
+ fo as ACTION_SEARCH,
3470
+ yo as ACTION_SORT,
3471
+ go as ACTION_STREAMING,
3472
+ Un as AppFooter,
3473
+ Qo as CANCEL,
3474
+ Zo as CARDS,
3475
+ qo as CLEAR,
3476
+ so as ERROR_MESSAGE,
3477
+ co as GPT4_MAX_TOKENS,
3478
+ Yo as HISTORY_TITLE,
3479
+ Eo as LOCAL_STORAGE_CHAT_DETAILS,
3480
+ Io as LOCAL_STORAGE_LOCATION,
3481
+ bo as LOCAL_STORAGE_PREFIX,
3482
+ wo as LOCAL_STORAGE_SEARCH,
3483
+ To as LOCAL_STORAGE_SORT,
3484
+ Wo as LOG_OUT,
3485
+ nn as M,
3486
+ io as MODEL_GPT4,
3487
+ Kn as MessagesContainerHeader,
3488
+ $o as N,
3489
+ en as N$1,
3490
+ Xo as NA,
3491
+ Ye as O,
3492
+ Jo as PROFILE_TITLE,
3493
+ ro as ROLE_ASSISTANT,
3494
+ oo as ROLE_HIDDEN,
3495
+ no as ROLE_INTERNAL,
3496
+ ao as ROLE_SYSTEM,
3497
+ to as ROLE_USER,
3498
+ Ce as S,
3499
+ Vo as SEND,
3500
+ Fo as STATS,
3501
+ So as STATS_SEPARATOR,
3502
+ Yn as SassySaint,
3503
+ jo as TYPE_QUESTION,
3504
+ Qt as U,
3505
+ Ze as Y,
3506
+ Ko as a,
3507
+ gt as b,
3508
+ rn as c,
3509
+ Mo as c$1,
3510
+ vo as convertLatitudeToDMS,
3511
+ ko as convertLongitudeToDMS,
3512
+ Oo as durationFormatter,
3513
+ No as extractAverage,
3514
+ Jt as f,
3515
+ an as f$1,
3516
+ _n as f$2,
3517
+ Oe as g,
3518
+ _o as getCurrentGeoLocation,
3519
+ Ka as getMessageContaintWrapperClass,
3520
+ Xe as i,
3521
+ Lo as i$1,
3522
+ xo as isLastMessageFromRole,
3523
+ re as j,
3524
+ Bo as l,
3525
+ Uo as n,
3526
+ Co as numberFormatter,
3527
+ dn as o,
3528
+ Go as p,
3529
+ Po as pluralize,
3530
+ Ho as r,
3531
+ Ro as renderDataAsList,
3532
+ Do as s,
3533
+ Ao as truncate,
3534
+ zt as x,
3535
+ qe as zr
3536
+ };