@getauthui/core 0.1.14 → 0.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/{authui-user-button-CV2B_0j5.js → authui-user-button-BltpbIHw.js} +1054 -769
- package/dist/authui.cdn.js +494 -299
- package/dist/authui.cdn.mjs +1755 -1470
- package/dist/authui.js +2 -2
- package/dist/components/authui-account.d.ts +6 -0
- package/dist/components/authui-account.d.ts.map +1 -1
- package/dist/components/authui-sign-in.d.ts +4 -0
- package/dist/components/authui-sign-in.d.ts.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/mfa.d.ts +7 -0
- package/dist/mfa.d.ts.map +1 -0
- package/dist/otp-input.d.ts +23 -0
- package/dist/otp-input.d.ts.map +1 -0
- package/dist/react/index.d.ts +6 -2
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react.js +61 -44
- package/dist/styles/base.d.ts.map +1 -1
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { state as
|
|
2
|
-
import { css as
|
|
3
|
-
import { Client as
|
|
4
|
-
const
|
|
1
|
+
import { state as h, property as b, customElement as z, query as ct } from "lit/decorators.js";
|
|
2
|
+
import { css as D, LitElement as dt, nothing as n, html as r, svg as u } from "lit";
|
|
3
|
+
import { Client as pt, Account as ft, Teams as Et, ID as Y, Avatars as rt } from "appwrite";
|
|
4
|
+
const Mt = {
|
|
5
5
|
signIn: "Sign in",
|
|
6
6
|
dialogSignIn: "Sign in",
|
|
7
7
|
signUp: "Sign up",
|
|
@@ -97,6 +97,9 @@ const At = {
|
|
|
97
97
|
regenerateRecoveryCodes: "Regenerate",
|
|
98
98
|
recoveryCodesWarning: "Store these codes somewhere safe. Each code works once.",
|
|
99
99
|
currentSession: "This device",
|
|
100
|
+
sessionExpires: "Expires {date}",
|
|
101
|
+
sessionCreated: "Created {date}",
|
|
102
|
+
sessionMfaFactors: "MFA: {factors}",
|
|
100
103
|
signOutSession: "Sign out",
|
|
101
104
|
signOutAllSessions: "Sign out everywhere",
|
|
102
105
|
signOutAllSessionsDescription: "End every session, including this one.",
|
|
@@ -175,13 +178,13 @@ const At = {
|
|
|
175
178
|
acceptLegal: "I agree to the",
|
|
176
179
|
errorLegalRequired: "Accept the terms to continue."
|
|
177
180
|
};
|
|
178
|
-
function
|
|
181
|
+
function Ot(e, t = {}) {
|
|
179
182
|
return e.replace(
|
|
180
183
|
/\{(\w+)\}/g,
|
|
181
184
|
(i, s) => s in t ? String(t[s]) : `{${s}}`
|
|
182
185
|
);
|
|
183
186
|
}
|
|
184
|
-
const
|
|
187
|
+
const Ft = {
|
|
185
188
|
amazon: "Amazon",
|
|
186
189
|
apple: "Apple",
|
|
187
190
|
appwrite: "Appwrite",
|
|
@@ -232,10 +235,10 @@ const Ut = {
|
|
|
232
235
|
zoho: "Zoho",
|
|
233
236
|
zoom: "Zoom"
|
|
234
237
|
};
|
|
235
|
-
function
|
|
236
|
-
return
|
|
238
|
+
function N(e) {
|
|
239
|
+
return Ft[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
|
|
237
240
|
}
|
|
238
|
-
const
|
|
241
|
+
const Z = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), I = () => (/* @__PURE__ */ new Date()).toISOString(), O = (e) => new Date(Date.now() - e * 6e4).toISOString(), X = [
|
|
239
242
|
"amber",
|
|
240
243
|
"brave",
|
|
241
244
|
"calm",
|
|
@@ -248,13 +251,13 @@ const K = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }),
|
|
|
248
251
|
"juniper",
|
|
249
252
|
"kite",
|
|
250
253
|
"lumen"
|
|
251
|
-
],
|
|
254
|
+
], mt = () => `${X[Math.floor(Math.random() * X.length)]}-${X[Math.floor(Math.random() * X.length)]}`, _ = () => Math.random().toString(36).slice(2, 12), gt = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), Rt = {
|
|
252
255
|
name: "Ada Lovelace",
|
|
253
256
|
email: "ada@example.com",
|
|
254
257
|
phone: "+15550100"
|
|
255
258
|
};
|
|
256
|
-
class
|
|
257
|
-
constructor(t =
|
|
259
|
+
class Tt {
|
|
260
|
+
constructor(t = Rt) {
|
|
258
261
|
this.seed = t, this.user = null, this.mfaPending = !1, this.mfaEnabled = !1, this.totpEnrolled = !1, this.recoveryCodes = [], this.lastChallenge = 0, this.sessions = [], this.identities = [], this.logs = [], this.tokens = /* @__PURE__ */ new Map(), this.pendingAuthenticator = null;
|
|
259
262
|
}
|
|
260
263
|
// ───────────────────────── helpers ─────────────────────────
|
|
@@ -262,13 +265,13 @@ class Et {
|
|
|
262
265
|
const i = t.anonymous ?? !1;
|
|
263
266
|
return this.user = {
|
|
264
267
|
$id: "preview-user",
|
|
265
|
-
$createdAt:
|
|
266
|
-
$updatedAt:
|
|
268
|
+
$createdAt: O(1440 * 30),
|
|
269
|
+
$updatedAt: I(),
|
|
267
270
|
name: i ? "" : t.name ?? this.seed.name,
|
|
268
|
-
registration:
|
|
271
|
+
registration: O(1440 * 30),
|
|
269
272
|
status: !0,
|
|
270
273
|
labels: [],
|
|
271
|
-
passwordUpdate: i ? "" :
|
|
274
|
+
passwordUpdate: i ? "" : O(1440 * 7),
|
|
272
275
|
email: i ? "" : t.email ?? this.seed.email,
|
|
273
276
|
phone: i ? "" : t.phone ?? this.seed.phone,
|
|
274
277
|
emailVerification: !i,
|
|
@@ -276,14 +279,14 @@ class Et {
|
|
|
276
279
|
mfa: this.mfaEnabled,
|
|
277
280
|
prefs: {},
|
|
278
281
|
targets: [],
|
|
279
|
-
accessedAt:
|
|
282
|
+
accessedAt: I()
|
|
280
283
|
}, this.seedActivity(i ? "anonymous" : "email"), this.user;
|
|
281
284
|
}
|
|
282
285
|
seedActivity(t) {
|
|
283
286
|
if (this.sessions.length > 0) return;
|
|
284
287
|
const i = {
|
|
285
|
-
$createdAt:
|
|
286
|
-
$updatedAt:
|
|
288
|
+
$createdAt: I(),
|
|
289
|
+
$updatedAt: I(),
|
|
287
290
|
userId: "preview-user",
|
|
288
291
|
expire: new Date(Date.now() + 365 * 864e5).toISOString(),
|
|
289
292
|
providerUid: "",
|
|
@@ -318,8 +321,8 @@ class Et {
|
|
|
318
321
|
},
|
|
319
322
|
{
|
|
320
323
|
...i,
|
|
321
|
-
$id:
|
|
322
|
-
$createdAt:
|
|
324
|
+
$id: _(),
|
|
325
|
+
$createdAt: O(300),
|
|
323
326
|
provider: t,
|
|
324
327
|
ip: "198.51.100.7",
|
|
325
328
|
osCode: "IOS",
|
|
@@ -335,8 +338,8 @@ class Et {
|
|
|
335
338
|
},
|
|
336
339
|
{
|
|
337
340
|
...i,
|
|
338
|
-
$id:
|
|
339
|
-
$createdAt:
|
|
341
|
+
$id: _(),
|
|
342
|
+
$createdAt: O(1440 * 3),
|
|
340
343
|
provider: "oauth2",
|
|
341
344
|
ip: "192.0.2.90",
|
|
342
345
|
osCode: "WIN",
|
|
@@ -351,8 +354,8 @@ class Et {
|
|
|
351
354
|
], this.identities = [
|
|
352
355
|
{
|
|
353
356
|
$id: "identity-github",
|
|
354
|
-
$createdAt:
|
|
355
|
-
$updatedAt:
|
|
357
|
+
$createdAt: O(1440 * 20),
|
|
358
|
+
$updatedAt: O(1440 * 20),
|
|
356
359
|
userId: "preview-user",
|
|
357
360
|
provider: "github",
|
|
358
361
|
providerUid: "8675309",
|
|
@@ -364,7 +367,7 @@ class Et {
|
|
|
364
367
|
], this.logs = [
|
|
365
368
|
{
|
|
366
369
|
event: "session.create",
|
|
367
|
-
time:
|
|
370
|
+
time: I(),
|
|
368
371
|
clientName: "Chrome",
|
|
369
372
|
osName: "macOS",
|
|
370
373
|
countryName: "Germany",
|
|
@@ -372,7 +375,7 @@ class Et {
|
|
|
372
375
|
},
|
|
373
376
|
{
|
|
374
377
|
event: "user.update.name",
|
|
375
|
-
time:
|
|
378
|
+
time: O(1440 * 2),
|
|
376
379
|
clientName: "Safari",
|
|
377
380
|
osName: "iOS",
|
|
378
381
|
countryName: "Germany",
|
|
@@ -380,7 +383,7 @@ class Et {
|
|
|
380
383
|
},
|
|
381
384
|
{
|
|
382
385
|
event: "session.create",
|
|
383
|
-
time:
|
|
386
|
+
time: O(1440 * 3),
|
|
384
387
|
clientName: "Firefox",
|
|
385
388
|
osName: "Windows",
|
|
386
389
|
countryName: "United States",
|
|
@@ -390,9 +393,9 @@ class Et {
|
|
|
390
393
|
}
|
|
391
394
|
requireUser() {
|
|
392
395
|
if (!this.user)
|
|
393
|
-
throw
|
|
396
|
+
throw Z("general_unauthorized_scope", "User (role: guests) missing scope (account)");
|
|
394
397
|
if (this.mfaPending)
|
|
395
|
-
throw
|
|
398
|
+
throw Z(
|
|
396
399
|
"user_more_factors_required",
|
|
397
400
|
"More factors are required to complete the sign in process."
|
|
398
401
|
);
|
|
@@ -400,7 +403,7 @@ class Et {
|
|
|
400
403
|
}
|
|
401
404
|
requireRecentChallenge() {
|
|
402
405
|
if (Date.now() - this.lastChallenge > 30 * 6e4)
|
|
403
|
-
throw
|
|
406
|
+
throw Z(
|
|
404
407
|
"user_challenge_required",
|
|
405
408
|
"A recently successful challenge is required to complete this action."
|
|
406
409
|
);
|
|
@@ -436,26 +439,26 @@ class Et {
|
|
|
436
439
|
}
|
|
437
440
|
async createMagicURLToken(t, i) {
|
|
438
441
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
439
|
-
$id:
|
|
440
|
-
$createdAt:
|
|
442
|
+
$id: _(),
|
|
443
|
+
$createdAt: I(),
|
|
441
444
|
userId: t,
|
|
442
445
|
secret: "",
|
|
443
446
|
expire: "",
|
|
444
|
-
phrase:
|
|
447
|
+
phrase: mt()
|
|
445
448
|
});
|
|
446
449
|
}
|
|
447
450
|
async createEmailToken(t, i) {
|
|
448
451
|
return this.tokens.set(t, { email: i }), this.delay({
|
|
449
|
-
$id:
|
|
450
|
-
$createdAt:
|
|
452
|
+
$id: _(),
|
|
453
|
+
$createdAt: I(),
|
|
451
454
|
userId: t,
|
|
452
455
|
secret: "",
|
|
453
456
|
expire: "",
|
|
454
|
-
phrase:
|
|
457
|
+
phrase: mt()
|
|
455
458
|
});
|
|
456
459
|
}
|
|
457
460
|
async createPhoneToken(t, i) {
|
|
458
|
-
return this.tokens.set(t, { phone: i }), this.delay({ $id:
|
|
461
|
+
return this.tokens.set(t, { phone: i }), this.delay({ $id: _(), $createdAt: I(), userId: t, secret: "", expire: "", phrase: "" });
|
|
459
462
|
}
|
|
460
463
|
async createSession(t) {
|
|
461
464
|
return this.delay(() => {
|
|
@@ -496,7 +499,7 @@ class Et {
|
|
|
496
499
|
async updateEmail(t) {
|
|
497
500
|
return this.delay(() => {
|
|
498
501
|
const i = this.requireUser();
|
|
499
|
-
return i.email = t, i.emailVerification = !1, i.passwordUpdate =
|
|
502
|
+
return i.email = t, i.emailVerification = !1, i.passwordUpdate = I(), i;
|
|
500
503
|
});
|
|
501
504
|
}
|
|
502
505
|
async updatePhone(t) {
|
|
@@ -508,7 +511,7 @@ class Et {
|
|
|
508
511
|
async updatePassword() {
|
|
509
512
|
return this.delay(() => {
|
|
510
513
|
const t = this.requireUser();
|
|
511
|
-
return t.passwordUpdate =
|
|
514
|
+
return t.passwordUpdate = I(), t;
|
|
512
515
|
});
|
|
513
516
|
}
|
|
514
517
|
async updateStatus() {
|
|
@@ -547,7 +550,7 @@ class Et {
|
|
|
547
550
|
});
|
|
548
551
|
}
|
|
549
552
|
async createMFAChallenge() {
|
|
550
|
-
return this.delay({ $id:
|
|
553
|
+
return this.delay({ $id: _(), $createdAt: I(), userId: "preview-user", expire: "" });
|
|
551
554
|
}
|
|
552
555
|
async updateMFAChallenge() {
|
|
553
556
|
return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
|
|
@@ -576,35 +579,35 @@ class Et {
|
|
|
576
579
|
async createMFARecoveryCodes() {
|
|
577
580
|
return this.delay(() => {
|
|
578
581
|
if (this.recoveryCodes.length > 0)
|
|
579
|
-
throw
|
|
580
|
-
return this.recoveryCodes = Array.from({ length: 6 },
|
|
582
|
+
throw Z("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
|
|
583
|
+
return this.recoveryCodes = Array.from({ length: 6 }, gt), { recoveryCodes: this.recoveryCodes };
|
|
581
584
|
});
|
|
582
585
|
}
|
|
583
586
|
async getMFARecoveryCodes() {
|
|
584
587
|
return this.delay(() => (this.requireRecentChallenge(), { recoveryCodes: this.recoveryCodes }));
|
|
585
588
|
}
|
|
586
589
|
async updateMFARecoveryCodes() {
|
|
587
|
-
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 },
|
|
590
|
+
return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, gt), { recoveryCodes: this.recoveryCodes }));
|
|
588
591
|
}
|
|
589
592
|
/** Forget everything, as a sign out would. */
|
|
590
593
|
reset() {
|
|
591
594
|
this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
|
|
592
595
|
}
|
|
593
596
|
}
|
|
594
|
-
function
|
|
597
|
+
function Dt(e) {
|
|
595
598
|
let t = 2166136261;
|
|
596
599
|
const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
|
|
597
|
-
for (const
|
|
600
|
+
for (const m of e) t = (t ^ m.charCodeAt(0)) * 16777619;
|
|
598
601
|
const s = 25;
|
|
599
602
|
let a = "";
|
|
600
|
-
const
|
|
601
|
-
for (let
|
|
602
|
-
for (let
|
|
603
|
-
!(
|
|
604
|
-
const d = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${s}" shape-rendering="crispEdges"><rect width="${s}" height="${s}" fill="#fff"/><g fill="#000">${
|
|
603
|
+
const c = (m, v) => `<rect x="${m}" y="${v}" width="7" height="7"/><rect x="${m + 1}" y="${v + 1}" width="5" height="5" fill="#fff"/><rect x="${m + 2}" y="${v + 2}" width="3" height="3"/>`;
|
|
604
|
+
for (let m = 0; m < s; m++)
|
|
605
|
+
for (let v = 0; v < s; v++)
|
|
606
|
+
!(v < 8 && m < 8 || v >= s - 8 && m < 8 || v < 8 && m >= s - 8) && i() < 0.45 && (a += `<rect x="${v}" y="${m}" width="1" height="1"/>`);
|
|
607
|
+
const d = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${s}" shape-rendering="crispEdges"><rect width="${s}" height="${s}" fill="#fff"/><g fill="#000">${c(0, 0)}${c(s - 7, 0)}${c(0, s - 7)}${a}</g></svg>`;
|
|
605
608
|
return `data:image/svg+xml;utf8,${encodeURIComponent(d)}`;
|
|
606
609
|
}
|
|
607
|
-
const
|
|
610
|
+
const y = {
|
|
608
611
|
moreFactorsRequired: "user_more_factors_required",
|
|
609
612
|
invalidCredentials: "user_invalid_credentials",
|
|
610
613
|
userAlreadyExists: "user_already_exists",
|
|
@@ -639,7 +642,7 @@ const v = {
|
|
|
639
642
|
targetAlreadyExists: "user_target_already_exists",
|
|
640
643
|
argumentInvalid: "general_argument_invalid"
|
|
641
644
|
};
|
|
642
|
-
function
|
|
645
|
+
function B(e) {
|
|
643
646
|
if (e && typeof e == "object") {
|
|
644
647
|
const t = e;
|
|
645
648
|
let i = typeof t.message == "string" ? t.message : "Unknown error";
|
|
@@ -651,119 +654,119 @@ function V(e) {
|
|
|
651
654
|
}
|
|
652
655
|
return { message: String(e), type: "", code: 0 };
|
|
653
656
|
}
|
|
654
|
-
function
|
|
655
|
-
return
|
|
657
|
+
function K(e, t) {
|
|
658
|
+
return B(e).type === t;
|
|
656
659
|
}
|
|
657
|
-
function
|
|
658
|
-
const s =
|
|
660
|
+
function J(e, t, i = "link") {
|
|
661
|
+
const s = B(e);
|
|
659
662
|
switch (s.type) {
|
|
660
|
-
case
|
|
663
|
+
case y.invalidCredentials:
|
|
661
664
|
return i === "password" ? t.errorCurrentPassword : t.errorInvalidCredentials;
|
|
662
|
-
case
|
|
663
|
-
case
|
|
664
|
-
case
|
|
665
|
+
case y.userAlreadyExists:
|
|
666
|
+
case y.emailAlreadyExists:
|
|
667
|
+
case y.phoneAlreadyExists:
|
|
665
668
|
return t.errorUserExists;
|
|
666
|
-
case
|
|
669
|
+
case y.userBlocked:
|
|
667
670
|
return t.errorUserBlocked;
|
|
668
|
-
case
|
|
671
|
+
case y.rateLimit:
|
|
669
672
|
return t.errorRateLimit;
|
|
670
|
-
case
|
|
673
|
+
case y.invalidToken:
|
|
671
674
|
return i === "code" ? t.errorInvalidCode : t.errorInvalidToken;
|
|
672
|
-
case
|
|
675
|
+
case y.invalidCode:
|
|
673
676
|
return t.errorInvalidCode;
|
|
674
|
-
case
|
|
677
|
+
case y.passwordMismatch:
|
|
675
678
|
return t.errorPasswordMismatch;
|
|
676
|
-
case
|
|
679
|
+
case y.passwordRecentlyUsed:
|
|
677
680
|
return t.errorPasswordRecentlyUsed;
|
|
678
|
-
case
|
|
681
|
+
case y.passwordPersonalData:
|
|
679
682
|
return t.errorPasswordPersonalData;
|
|
680
|
-
case
|
|
683
|
+
case y.passwordWeak:
|
|
681
684
|
return t.errorPasswordWeak;
|
|
682
|
-
case
|
|
685
|
+
case y.passwordPwned:
|
|
683
686
|
return t.errorPasswordPwned;
|
|
684
|
-
case
|
|
687
|
+
case y.challengeRequired:
|
|
685
688
|
return t.errorChallengeRequired;
|
|
686
|
-
case
|
|
689
|
+
case y.sessionAlreadyExists:
|
|
687
690
|
return t.errorSessionExists;
|
|
688
|
-
case
|
|
689
|
-
case
|
|
691
|
+
case y.oauthUnauthorized:
|
|
692
|
+
case y.oauthBadRequest:
|
|
690
693
|
return t.errorOAuth;
|
|
691
|
-
case
|
|
694
|
+
case y.authMethodUnsupported:
|
|
692
695
|
return t.errorMethodDisabled;
|
|
693
696
|
}
|
|
694
|
-
if (s.type ===
|
|
697
|
+
if (s.type === y.argumentInvalid || /Invalid `\w+` param/i.test(s.message)) {
|
|
695
698
|
const a = s.message.match(/Invalid `([^`]+)` param/i)?.[1]?.toLowerCase();
|
|
696
699
|
return a === "email" ? t.errorInvalidEmail : a === "password" ? t.errorInvalidPassword : a === "phone" ? t.errorInvalidPhone : a === "name" ? t.errorInvalidName : t.errorGeneric;
|
|
697
700
|
}
|
|
698
|
-
return s.type ===
|
|
701
|
+
return s.type === y.projectNotFound || s.type === y.unknownOrigin ? t.errorConfig : s.type === y.routeNotFound ? t.errorConfigEndpoint : s.code === 0 && /fetch|network/i.test(s.message) ? t.errorNetwork : /Invalid `\w+` param/i.test(s.message) ? t.errorGeneric : s.message ? s.message || t.errorGeneric : s.code === 404 || s.type === y.routeNotFound ? t.errorConfigEndpoint : t.errorGeneric;
|
|
699
702
|
}
|
|
700
|
-
function
|
|
701
|
-
const t =
|
|
702
|
-
return !!(t.type ===
|
|
703
|
+
function Lt(e) {
|
|
704
|
+
const t = B(e);
|
|
705
|
+
return !!(t.type === y.projectNotFound || t.type === y.unknownOrigin || t.type === y.routeNotFound || !t.message && t.code === 404 || t.code === 0 && /fetch|network|load failed|failed to fetch/i.test(t.message));
|
|
703
706
|
}
|
|
704
|
-
const
|
|
705
|
-
function
|
|
707
|
+
const at = (e) => `authui:active-team:${e}`;
|
|
708
|
+
function vt(e) {
|
|
706
709
|
if (typeof localStorage > "u" || !e) return null;
|
|
707
710
|
try {
|
|
708
|
-
return localStorage.getItem(
|
|
711
|
+
return localStorage.getItem(at(e));
|
|
709
712
|
} catch {
|
|
710
713
|
return null;
|
|
711
714
|
}
|
|
712
715
|
}
|
|
713
|
-
function
|
|
716
|
+
function zt(e, t) {
|
|
714
717
|
if (!(typeof localStorage > "u" || !e))
|
|
715
718
|
try {
|
|
716
|
-
t ? localStorage.setItem(
|
|
719
|
+
t ? localStorage.setItem(at(e), t) : localStorage.removeItem(at(e));
|
|
717
720
|
} catch {
|
|
718
721
|
}
|
|
719
722
|
}
|
|
720
|
-
const
|
|
721
|
-
function
|
|
723
|
+
const ht = "authui:last-method";
|
|
724
|
+
function V(e) {
|
|
722
725
|
if (!(typeof localStorage > "u")) {
|
|
723
726
|
if (!e || e === "mfa" || e === "sign-up")
|
|
724
727
|
if (e === "sign-up") e = "email-password";
|
|
725
728
|
else return;
|
|
726
729
|
try {
|
|
727
|
-
localStorage.setItem(
|
|
730
|
+
localStorage.setItem(ht, e);
|
|
728
731
|
} catch {
|
|
729
732
|
}
|
|
730
733
|
}
|
|
731
734
|
}
|
|
732
|
-
function
|
|
735
|
+
function q() {
|
|
733
736
|
if (typeof localStorage > "u") return null;
|
|
734
737
|
try {
|
|
735
|
-
return localStorage.getItem(
|
|
738
|
+
return localStorage.getItem(ht);
|
|
736
739
|
} catch {
|
|
737
740
|
return null;
|
|
738
741
|
}
|
|
739
742
|
}
|
|
740
|
-
function
|
|
743
|
+
function ge() {
|
|
741
744
|
if (!(typeof localStorage > "u"))
|
|
742
745
|
try {
|
|
743
|
-
localStorage.removeItem(
|
|
746
|
+
localStorage.removeItem(ht);
|
|
744
747
|
} catch {
|
|
745
748
|
}
|
|
746
749
|
}
|
|
747
|
-
const
|
|
748
|
-
function
|
|
750
|
+
const tt = "authui:pending-oauth";
|
|
751
|
+
function _t(e) {
|
|
749
752
|
if (!(typeof sessionStorage > "u"))
|
|
750
753
|
try {
|
|
751
|
-
sessionStorage.setItem(
|
|
754
|
+
sessionStorage.setItem(tt, e);
|
|
752
755
|
} catch {
|
|
753
756
|
}
|
|
754
757
|
}
|
|
755
|
-
function
|
|
758
|
+
function At() {
|
|
756
759
|
if (!(typeof sessionStorage > "u"))
|
|
757
760
|
try {
|
|
758
|
-
const e = sessionStorage.getItem(
|
|
759
|
-
sessionStorage.removeItem(
|
|
761
|
+
const e = sessionStorage.getItem(tt);
|
|
762
|
+
sessionStorage.removeItem(tt), e && V(`oauth:${e}`);
|
|
760
763
|
} catch {
|
|
761
764
|
}
|
|
762
765
|
}
|
|
763
|
-
function
|
|
766
|
+
function bt() {
|
|
764
767
|
if (!(typeof sessionStorage > "u"))
|
|
765
768
|
try {
|
|
766
|
-
sessionStorage.removeItem(
|
|
769
|
+
sessionStorage.removeItem(tt);
|
|
767
770
|
} catch {
|
|
768
771
|
}
|
|
769
772
|
}
|
|
@@ -777,7 +780,7 @@ function A(e, t, i) {
|
|
|
777
780
|
new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
|
|
778
781
|
);
|
|
779
782
|
}
|
|
780
|
-
const
|
|
783
|
+
const nt = "authui", yt = ["userId", "secret", "expire", "project", "error", nt], wt = () => ({
|
|
781
784
|
status: "loading",
|
|
782
785
|
user: null,
|
|
783
786
|
mfaFactors: null,
|
|
@@ -785,9 +788,9 @@ const st = "authui", gt = ["userId", "secret", "expire", "project", "error", st]
|
|
|
785
788
|
configured: !1,
|
|
786
789
|
configError: null
|
|
787
790
|
});
|
|
788
|
-
class
|
|
791
|
+
class qt {
|
|
789
792
|
constructor() {
|
|
790
|
-
this.client = null, this.account = null, this.config = null, this.state =
|
|
793
|
+
this.client = null, this.account = null, this.config = null, this.state = wt(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null, this.teams = null, this.activeTeamId = null;
|
|
791
794
|
}
|
|
792
795
|
// ───────────────────────────── configuration ─────────────────────────────
|
|
793
796
|
/** Configure the Appwrite client. Safe to call more than once; the last call wins. */
|
|
@@ -795,7 +798,7 @@ class Tt {
|
|
|
795
798
|
const i = t.endpoint.trim().replace(/\/+$/, "");
|
|
796
799
|
i && !i.endsWith("/v1") && console.warn(
|
|
797
800
|
`[authui] endpoint should end with /v1 (got "${t.endpoint}"). Without it Appwrite returns HTML 404 pages.`
|
|
798
|
-
), this.config = t, this.client = new
|
|
801
|
+
), this.config = t, this.client = new pt().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new Tt() : null, this.account = this.preview ? this.preview : new ft(this.client), this.teams = null, this.activeTeamId = vt(t.project), this.setState({ configured: !0, status: "loading", configError: null }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
|
|
799
802
|
}
|
|
800
803
|
/**
|
|
801
804
|
* Called by <authui-config> when it is on the page but missing endpoint or project.
|
|
@@ -841,7 +844,7 @@ class Tt {
|
|
|
841
844
|
/** List teams the signed-in user belongs to. Empty in preview or when signed out. */
|
|
842
845
|
async listTeams() {
|
|
843
846
|
if (this.preview || !this.client || this.state.status !== "signed-in") return [];
|
|
844
|
-
this.teams ??= new
|
|
847
|
+
this.teams ??= new Et(this.client);
|
|
845
848
|
try {
|
|
846
849
|
return (await this.teams.list()).teams ?? [];
|
|
847
850
|
} catch (t) {
|
|
@@ -851,7 +854,7 @@ class Tt {
|
|
|
851
854
|
getActiveTeamId() {
|
|
852
855
|
if (this.activeTeamId) return this.activeTeamId;
|
|
853
856
|
const t = this.config?.project;
|
|
854
|
-
return t ? (this.activeTeamId =
|
|
857
|
+
return t ? (this.activeTeamId = vt(t), this.activeTeamId) : null;
|
|
855
858
|
}
|
|
856
859
|
/**
|
|
857
860
|
* Remember the active team locally and emit `active-team`.
|
|
@@ -859,10 +862,10 @@ class Tt {
|
|
|
859
862
|
*/
|
|
860
863
|
setActiveTeam(t) {
|
|
861
864
|
const i = this.config?.project;
|
|
862
|
-
i &&
|
|
865
|
+
i && zt(i, t?.$id ?? null), this.activeTeamId = t?.$id ?? null, this.emit("active-team", { teamId: this.activeTeamId, team: t });
|
|
863
866
|
}
|
|
864
867
|
getStrings() {
|
|
865
|
-
return { ...
|
|
868
|
+
return { ...Mt, ...this.config?.strings ?? {} };
|
|
866
869
|
}
|
|
867
870
|
getState() {
|
|
868
871
|
return { ...this.state };
|
|
@@ -888,7 +891,7 @@ class Tt {
|
|
|
888
891
|
this.state = { ...this.state, ...t }, this.emit("change", this.getState());
|
|
889
892
|
}
|
|
890
893
|
fail(t) {
|
|
891
|
-
const i =
|
|
894
|
+
const i = B(t);
|
|
892
895
|
throw this.emit("error", i), t;
|
|
893
896
|
}
|
|
894
897
|
acct() {
|
|
@@ -908,7 +911,7 @@ class Tt {
|
|
|
908
911
|
const i = await this.account.get();
|
|
909
912
|
this.setState({ status: "signed-in", user: i, mfaFactors: null, configError: null }), t || this.emit("signed-in", i);
|
|
910
913
|
} catch (i) {
|
|
911
|
-
if (
|
|
914
|
+
if (K(i, y.moreFactorsRequired)) {
|
|
912
915
|
let s = null;
|
|
913
916
|
try {
|
|
914
917
|
s = await A(
|
|
@@ -919,7 +922,7 @@ class Tt {
|
|
|
919
922
|
} catch {
|
|
920
923
|
}
|
|
921
924
|
this.setState({ status: "mfa-required", user: null, mfaFactors: s });
|
|
922
|
-
} else if (
|
|
925
|
+
} else if (K(i, y.userBlocked))
|
|
923
926
|
await this.purgeLocalSession(), this.setState({
|
|
924
927
|
status: "signed-out",
|
|
925
928
|
user: null,
|
|
@@ -930,13 +933,13 @@ class Tt {
|
|
|
930
933
|
message: this.getStrings().errorUserBlocked
|
|
931
934
|
}
|
|
932
935
|
}), t && this.emit("signed-out", void 0);
|
|
933
|
-
else if (!t &&
|
|
934
|
-
const a =
|
|
936
|
+
else if (!t && Lt(i)) {
|
|
937
|
+
const a = J(i, this.getStrings()) || this.getStrings().errorConfig;
|
|
935
938
|
console.warn(
|
|
936
939
|
`[authui] ${a} (endpoint=${this.config?.endpoint ?? "?"}, project=${this.config?.project ?? "?"})`
|
|
937
940
|
);
|
|
938
|
-
const
|
|
939
|
-
this.emit("error", { message: a, type:
|
|
941
|
+
const c = B(i);
|
|
942
|
+
this.emit("error", { message: a, type: c.type, code: c.code }), this.setState({
|
|
940
943
|
status: "signed-out",
|
|
941
944
|
user: null,
|
|
942
945
|
mfaFactors: null,
|
|
@@ -955,7 +958,7 @@ class Tt {
|
|
|
955
958
|
const i = this.state.pending;
|
|
956
959
|
if (i?.type === "notice" && i.tone === "error")
|
|
957
960
|
throw Object.assign(new Error(i.message), {
|
|
958
|
-
type:
|
|
961
|
+
type: y.userBlocked,
|
|
959
962
|
code: 401
|
|
960
963
|
});
|
|
961
964
|
}
|
|
@@ -980,7 +983,7 @@ class Tt {
|
|
|
980
983
|
localStorage.removeItem("cookieFallback");
|
|
981
984
|
} catch {
|
|
982
985
|
}
|
|
983
|
-
this.config && !this.preview && (this.client = new
|
|
986
|
+
this.config && !this.preview && (this.client = new pt().setEndpoint(this.config.endpoint).setProject(this.config.project), this.account = new ft(this.client));
|
|
984
987
|
}
|
|
985
988
|
// ─────────────────────────────── sign in ───────────────────────────────
|
|
986
989
|
async signInWithEmailPassword(t, i) {
|
|
@@ -993,7 +996,7 @@ class Tt {
|
|
|
993
996
|
}
|
|
994
997
|
async signUp(t, i, s) {
|
|
995
998
|
try {
|
|
996
|
-
await this.acct().create(
|
|
999
|
+
await this.acct().create(Y.unique(), t.trim(), i, s?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
|
|
997
1000
|
} catch (a) {
|
|
998
1001
|
this.fail(a);
|
|
999
1002
|
}
|
|
@@ -1036,7 +1039,7 @@ class Tt {
|
|
|
1036
1039
|
async sendMagicUrl(t) {
|
|
1037
1040
|
try {
|
|
1038
1041
|
return await this.acct().createMagicURLToken(
|
|
1039
|
-
|
|
1042
|
+
Y.unique(),
|
|
1040
1043
|
t.trim(),
|
|
1041
1044
|
this.redirectUrl("magic-url"),
|
|
1042
1045
|
this.config?.securityPhrase ?? !0
|
|
@@ -1048,7 +1051,7 @@ class Tt {
|
|
|
1048
1051
|
async sendEmailOtp(t) {
|
|
1049
1052
|
try {
|
|
1050
1053
|
return await this.acct().createEmailToken(
|
|
1051
|
-
|
|
1054
|
+
Y.unique(),
|
|
1052
1055
|
t.trim(),
|
|
1053
1056
|
this.config?.securityPhrase ?? !0
|
|
1054
1057
|
);
|
|
@@ -1058,7 +1061,7 @@ class Tt {
|
|
|
1058
1061
|
}
|
|
1059
1062
|
async sendPhoneOtp(t) {
|
|
1060
1063
|
try {
|
|
1061
|
-
return await this.acct().createPhoneToken(
|
|
1064
|
+
return await this.acct().createPhoneToken(Y.unique(), t.replace(/[\s()-]/g, ""));
|
|
1062
1065
|
} catch (i) {
|
|
1063
1066
|
return this.fail(i);
|
|
1064
1067
|
}
|
|
@@ -1332,8 +1335,8 @@ class Tt {
|
|
|
1332
1335
|
/** Build the URL Appwrite should send the user back to for a given flow. */
|
|
1333
1336
|
redirectUrl(t) {
|
|
1334
1337
|
const i = this.config?.redirectUrl ?? (typeof window < "u" ? window.location.origin + window.location.pathname : ""), s = new URL(i, typeof window < "u" ? window.location.href : void 0);
|
|
1335
|
-
for (const a of
|
|
1336
|
-
return s.searchParams.set(
|
|
1338
|
+
for (const a of yt) s.searchParams.delete(a);
|
|
1339
|
+
return s.searchParams.set(nt, t), s.toString();
|
|
1337
1340
|
}
|
|
1338
1341
|
setPending(t) {
|
|
1339
1342
|
this.setState({ pending: t });
|
|
@@ -1344,11 +1347,11 @@ class Tt {
|
|
|
1344
1347
|
*/
|
|
1345
1348
|
async handleRedirect() {
|
|
1346
1349
|
if (typeof window > "u") return !1;
|
|
1347
|
-
const t = new URLSearchParams(window.location.search), i = t.get(
|
|
1350
|
+
const t = new URLSearchParams(window.location.search), i = t.get(nt);
|
|
1348
1351
|
if (!i) return !1;
|
|
1349
1352
|
const s = t.get("userId") ?? "", a = t.get("secret") ?? "";
|
|
1350
1353
|
this.cleanUrl();
|
|
1351
|
-
const
|
|
1354
|
+
const c = () => {
|
|
1352
1355
|
this.setState({
|
|
1353
1356
|
pending: {
|
|
1354
1357
|
type: "notice",
|
|
@@ -1361,10 +1364,10 @@ class Tt {
|
|
|
1361
1364
|
switch (i) {
|
|
1362
1365
|
case "oauth":
|
|
1363
1366
|
case "magic-url":
|
|
1364
|
-
s && a ? (await this.acct().createSession(s, a), i === "oauth" ?
|
|
1367
|
+
s && a ? (await this.acct().createSession(s, a), i === "oauth" ? At() : V("magic-url")) : (i === "oauth" && bt(), c());
|
|
1365
1368
|
break;
|
|
1366
1369
|
case "oauth-failed":
|
|
1367
|
-
|
|
1370
|
+
bt(), this.setState({
|
|
1368
1371
|
pending: {
|
|
1369
1372
|
type: "notice",
|
|
1370
1373
|
tone: "error",
|
|
@@ -1373,7 +1376,7 @@ class Tt {
|
|
|
1373
1376
|
});
|
|
1374
1377
|
break;
|
|
1375
1378
|
case "recovery":
|
|
1376
|
-
s && a ? this.setState({ pending: { type: "reset-password", userId: s, secret: a } }) :
|
|
1379
|
+
s && a ? this.setState({ pending: { type: "reset-password", userId: s, secret: a } }) : c();
|
|
1377
1380
|
break;
|
|
1378
1381
|
case "verify-email":
|
|
1379
1382
|
s && a ? (await A(
|
|
@@ -1386,27 +1389,27 @@ class Tt {
|
|
|
1386
1389
|
message: this.getStrings().emailVerified,
|
|
1387
1390
|
tone: "success"
|
|
1388
1391
|
}
|
|
1389
|
-
})) :
|
|
1392
|
+
})) : c();
|
|
1390
1393
|
break;
|
|
1391
1394
|
}
|
|
1392
1395
|
} catch (d) {
|
|
1393
|
-
const
|
|
1394
|
-
this.emit("error",
|
|
1396
|
+
const m = B(d), v = J(d, this.getStrings(), "link");
|
|
1397
|
+
this.emit("error", m), this.setState({ pending: { type: "notice", message: v, tone: "error" } });
|
|
1395
1398
|
}
|
|
1396
1399
|
return !0;
|
|
1397
1400
|
}
|
|
1398
1401
|
cleanUrl() {
|
|
1399
1402
|
const t = new URL(window.location.href);
|
|
1400
|
-
for (const i of
|
|
1403
|
+
for (const i of yt) t.searchParams.delete(i);
|
|
1401
1404
|
window.history.replaceState(window.history.state, "", t.toString());
|
|
1402
1405
|
}
|
|
1403
1406
|
/** Test helper. */
|
|
1404
1407
|
reset() {
|
|
1405
|
-
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state =
|
|
1408
|
+
this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state = wt(), this.listeners.clear();
|
|
1406
1409
|
}
|
|
1407
1410
|
}
|
|
1408
|
-
const l = new
|
|
1409
|
-
class
|
|
1411
|
+
const l = new qt();
|
|
1412
|
+
class Vt {
|
|
1410
1413
|
constructor() {
|
|
1411
1414
|
this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
|
|
1412
1415
|
const t = this.isDark("auto");
|
|
@@ -1434,14 +1437,14 @@ class Lt {
|
|
|
1434
1437
|
this.observer?.disconnect(), this.observer = null, this.media?.removeEventListener?.("change", this.notify), this.media = null;
|
|
1435
1438
|
}
|
|
1436
1439
|
}
|
|
1437
|
-
const
|
|
1440
|
+
const $t = new Vt(), xt = {
|
|
1438
1441
|
none: "0px",
|
|
1439
1442
|
sm: "0.25rem",
|
|
1440
1443
|
md: "0.625rem",
|
|
1441
1444
|
lg: "0.875rem",
|
|
1442
1445
|
xl: "1.125rem",
|
|
1443
1446
|
full: "1.5rem"
|
|
1444
|
-
},
|
|
1447
|
+
}, Nt = D`
|
|
1445
1448
|
:host {
|
|
1446
1449
|
/* Light theme (matches :root in the console) */
|
|
1447
1450
|
--authui-background: oklch(1 0 0);
|
|
@@ -1521,7 +1524,7 @@ const bt = new Lt(), yt = {
|
|
|
1521
1524
|
--authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
|
|
1522
1525
|
color-scheme: dark;
|
|
1523
1526
|
}
|
|
1524
|
-
`,
|
|
1527
|
+
`, Bt = D`
|
|
1525
1528
|
*,
|
|
1526
1529
|
*::before,
|
|
1527
1530
|
*::after {
|
|
@@ -1810,6 +1813,94 @@ const bt = new Lt(), yt = {
|
|
|
1810
1813
|
font-size: 18px;
|
|
1811
1814
|
height: 44px;
|
|
1812
1815
|
}
|
|
1816
|
+
|
|
1817
|
+
/* Vibes-style segmented OTP (3 + sep + 3) */
|
|
1818
|
+
.otp {
|
|
1819
|
+
position: relative;
|
|
1820
|
+
display: flex;
|
|
1821
|
+
align-items: center;
|
|
1822
|
+
justify-content: center;
|
|
1823
|
+
gap: 8px;
|
|
1824
|
+
width: 100%;
|
|
1825
|
+
min-height: 52px;
|
|
1826
|
+
}
|
|
1827
|
+
.otp-group {
|
|
1828
|
+
display: flex;
|
|
1829
|
+
flex: 1;
|
|
1830
|
+
gap: 6px;
|
|
1831
|
+
min-width: 0;
|
|
1832
|
+
}
|
|
1833
|
+
.otp-slot {
|
|
1834
|
+
flex: 1;
|
|
1835
|
+
min-width: 0;
|
|
1836
|
+
height: 52px;
|
|
1837
|
+
display: flex;
|
|
1838
|
+
align-items: center;
|
|
1839
|
+
justify-content: center;
|
|
1840
|
+
border: 1px solid var(--authui-input);
|
|
1841
|
+
border-radius: var(--authui-radius-md);
|
|
1842
|
+
background: var(--authui-background);
|
|
1843
|
+
color: var(--authui-foreground);
|
|
1844
|
+
font-family: var(--authui-font-mono);
|
|
1845
|
+
font-size: 22px;
|
|
1846
|
+
font-weight: 600;
|
|
1847
|
+
line-height: 1;
|
|
1848
|
+
box-shadow: var(--authui-shadow-xs);
|
|
1849
|
+
transition:
|
|
1850
|
+
border-color 120ms ease,
|
|
1851
|
+
box-shadow 120ms ease,
|
|
1852
|
+
background-color 120ms ease;
|
|
1853
|
+
}
|
|
1854
|
+
.otp-slot-active {
|
|
1855
|
+
border-color: var(--authui-ring);
|
|
1856
|
+
box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-ring) 40%, transparent);
|
|
1857
|
+
}
|
|
1858
|
+
.otp-invalid .otp-slot {
|
|
1859
|
+
border-color: var(--authui-destructive);
|
|
1860
|
+
}
|
|
1861
|
+
.otp-invalid .otp-slot-active {
|
|
1862
|
+
box-shadow: 0 0 0 3px color-mix(in oklab, var(--authui-destructive) 35%, transparent);
|
|
1863
|
+
}
|
|
1864
|
+
.otp-sep {
|
|
1865
|
+
display: flex;
|
|
1866
|
+
align-items: center;
|
|
1867
|
+
justify-content: center;
|
|
1868
|
+
flex-shrink: 0;
|
|
1869
|
+
width: 12px;
|
|
1870
|
+
}
|
|
1871
|
+
.otp-sep span {
|
|
1872
|
+
display: block;
|
|
1873
|
+
width: 8px;
|
|
1874
|
+
height: 2px;
|
|
1875
|
+
border-radius: 1px;
|
|
1876
|
+
background: var(--authui-muted-foreground);
|
|
1877
|
+
opacity: 0.7;
|
|
1878
|
+
}
|
|
1879
|
+
.otp-native {
|
|
1880
|
+
position: absolute;
|
|
1881
|
+
inset: 0;
|
|
1882
|
+
width: 100%;
|
|
1883
|
+
height: 100%;
|
|
1884
|
+
opacity: 0;
|
|
1885
|
+
margin: 0;
|
|
1886
|
+
border: 0;
|
|
1887
|
+
padding: 0;
|
|
1888
|
+
caret-color: transparent;
|
|
1889
|
+
color: transparent;
|
|
1890
|
+
background: transparent;
|
|
1891
|
+
cursor: text;
|
|
1892
|
+
z-index: 1;
|
|
1893
|
+
}
|
|
1894
|
+
.otp-disabled {
|
|
1895
|
+
opacity: 0.5;
|
|
1896
|
+
pointer-events: none;
|
|
1897
|
+
}
|
|
1898
|
+
@media (max-width: 380px) {
|
|
1899
|
+
.otp-slot {
|
|
1900
|
+
height: 44px;
|
|
1901
|
+
font-size: 18px;
|
|
1902
|
+
}
|
|
1903
|
+
}
|
|
1813
1904
|
.hint {
|
|
1814
1905
|
font-size: 12px;
|
|
1815
1906
|
color: var(--authui-muted-foreground);
|
|
@@ -2574,25 +2665,25 @@ const bt = new Lt(), yt = {
|
|
|
2574
2665
|
}
|
|
2575
2666
|
}
|
|
2576
2667
|
`;
|
|
2577
|
-
var
|
|
2578
|
-
for (var a = void 0,
|
|
2579
|
-
(d = e[
|
|
2580
|
-
return a &&
|
|
2581
|
-
},
|
|
2582
|
-
const
|
|
2668
|
+
var jt = Object.defineProperty, Ht = (e, t, i, s) => {
|
|
2669
|
+
for (var a = void 0, c = e.length - 1, d; c >= 0; c--)
|
|
2670
|
+
(d = e[c]) && (a = d(t, i, a) || a);
|
|
2671
|
+
return a && jt(t, i, a), a;
|
|
2672
|
+
}, F;
|
|
2673
|
+
const Pt = (F = class extends dt {
|
|
2583
2674
|
constructor() {
|
|
2584
2675
|
super(...arguments), this.auth = l.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null, this.stopKeys = (t) => t.stopPropagation();
|
|
2585
2676
|
}
|
|
2586
2677
|
connectedCallback() {
|
|
2587
2678
|
super.connectedCallback();
|
|
2588
|
-
for (const t of
|
|
2679
|
+
for (const t of F.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
|
|
2589
2680
|
this.auth = l.getState(), this.unsubscribeStore = l.on("change", (t) => {
|
|
2590
2681
|
this.auth = t, this.applyBranding();
|
|
2591
|
-
}), this.unsubscribeTheme =
|
|
2682
|
+
}), this.unsubscribeTheme = $t.subscribe(() => this.applyBranding()), this.applyBranding();
|
|
2592
2683
|
}
|
|
2593
2684
|
disconnectedCallback() {
|
|
2594
2685
|
super.disconnectedCallback();
|
|
2595
|
-
for (const t of
|
|
2686
|
+
for (const t of F.KEY_EVENTS) this.removeEventListener(t, this.stopKeys);
|
|
2596
2687
|
this.unsubscribeStore?.(), this.unsubscribeTheme?.(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
|
|
2597
2688
|
}
|
|
2598
2689
|
get strings() {
|
|
@@ -2600,7 +2691,7 @@ const kt = (O = class extends ot {
|
|
|
2600
2691
|
}
|
|
2601
2692
|
/** Translate a string key with optional `{placeholders}`. */
|
|
2602
2693
|
t(t, i) {
|
|
2603
|
-
return
|
|
2694
|
+
return Ot(this.strings[t], i);
|
|
2604
2695
|
}
|
|
2605
2696
|
get config() {
|
|
2606
2697
|
return l.getConfig();
|
|
@@ -2610,27 +2701,27 @@ const kt = (O = class extends ot {
|
|
|
2610
2701
|
}
|
|
2611
2702
|
/** Push theme and branding from config onto the host element. */
|
|
2612
2703
|
applyBranding() {
|
|
2613
|
-
const t = this.config?.branding, i =
|
|
2704
|
+
const t = this.config?.branding, i = $t.isDark(t?.theme ?? "auto");
|
|
2614
2705
|
this.setAttribute("data-theme", i ? "dark" : "light"), t?.primary && (this.style.setProperty("--authui-primary", t.primary), this.style.setProperty(
|
|
2615
2706
|
"--authui-primary-foreground",
|
|
2616
2707
|
t.primaryForeground ?? "#ffffff"
|
|
2617
|
-
)), t?.radius &&
|
|
2708
|
+
)), t?.radius && xt[t.radius] && this.style.setProperty("--authui-radius", xt[t.radius]);
|
|
2618
2709
|
}
|
|
2619
2710
|
/** Emit a composed custom event from this element. */
|
|
2620
2711
|
fire(t, i) {
|
|
2621
2712
|
this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
|
|
2622
2713
|
}
|
|
2623
|
-
},
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
],
|
|
2627
|
-
let
|
|
2628
|
-
var
|
|
2629
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2630
|
-
(d = e[
|
|
2631
|
-
return s && a &&
|
|
2714
|
+
}, F.styles = [Nt, Bt], F.KEY_EVENTS = ["keydown", "keyup", "keypress"], F);
|
|
2715
|
+
Ht([
|
|
2716
|
+
h()
|
|
2717
|
+
], Pt.prototype, "auth");
|
|
2718
|
+
let M = Pt;
|
|
2719
|
+
var Wt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, k = (e, t, i, s) => {
|
|
2720
|
+
for (var a = s > 1 ? void 0 : s ? Kt(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
2721
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
2722
|
+
return s && a && Wt(t, i, a), a;
|
|
2632
2723
|
};
|
|
2633
|
-
let
|
|
2724
|
+
let $ = class extends dt {
|
|
2634
2725
|
constructor() {
|
|
2635
2726
|
super(...arguments), this.endpoint = "", this.project = "", this.redirectUrl = "", this.successUrl = "", this.methods = "email-password", this.signUp = "true", this.requireName = "true", this.mfa = "true", this.securityPhrase = "true", this.name = "", this.logo = "", this.theme = "auto", this.radius = "", this.primary = "", this.primaryForeground = "", this.termsUrl = "", this.privacyUrl = "", this.requireAcceptance = "", this.oauthLayout = "", this.preview = "";
|
|
2636
2727
|
}
|
|
@@ -2681,108 +2772,108 @@ let w = class extends ot {
|
|
|
2681
2772
|
};
|
|
2682
2773
|
}
|
|
2683
2774
|
};
|
|
2684
|
-
|
|
2775
|
+
$.styles = D`
|
|
2685
2776
|
:host {
|
|
2686
2777
|
display: none;
|
|
2687
2778
|
}
|
|
2688
2779
|
`;
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
],
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
],
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
],
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
],
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
],
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
],
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
],
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
],
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
],
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
],
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
],
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
],
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
],
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
],
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
],
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
],
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
],
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
],
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
],
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
],
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
],
|
|
2752
|
-
var
|
|
2753
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
2754
|
-
(d = e[
|
|
2755
|
-
return s && a &&
|
|
2780
|
+
k([
|
|
2781
|
+
b({ type: String })
|
|
2782
|
+
], $.prototype, "endpoint", 2);
|
|
2783
|
+
k([
|
|
2784
|
+
b({ type: String })
|
|
2785
|
+
], $.prototype, "project", 2);
|
|
2786
|
+
k([
|
|
2787
|
+
b({ type: String, attribute: "redirect-url" })
|
|
2788
|
+
], $.prototype, "redirectUrl", 2);
|
|
2789
|
+
k([
|
|
2790
|
+
b({ type: String, attribute: "success-url" })
|
|
2791
|
+
], $.prototype, "successUrl", 2);
|
|
2792
|
+
k([
|
|
2793
|
+
b({ type: String })
|
|
2794
|
+
], $.prototype, "methods", 2);
|
|
2795
|
+
k([
|
|
2796
|
+
b({ type: String, attribute: "sign-up" })
|
|
2797
|
+
], $.prototype, "signUp", 2);
|
|
2798
|
+
k([
|
|
2799
|
+
b({ type: String, attribute: "require-name" })
|
|
2800
|
+
], $.prototype, "requireName", 2);
|
|
2801
|
+
k([
|
|
2802
|
+
b({ type: String })
|
|
2803
|
+
], $.prototype, "mfa", 2);
|
|
2804
|
+
k([
|
|
2805
|
+
b({ type: String, attribute: "security-phrase" })
|
|
2806
|
+
], $.prototype, "securityPhrase", 2);
|
|
2807
|
+
k([
|
|
2808
|
+
b({ type: String })
|
|
2809
|
+
], $.prototype, "name", 2);
|
|
2810
|
+
k([
|
|
2811
|
+
b({ type: String })
|
|
2812
|
+
], $.prototype, "logo", 2);
|
|
2813
|
+
k([
|
|
2814
|
+
b({ type: String })
|
|
2815
|
+
], $.prototype, "theme", 2);
|
|
2816
|
+
k([
|
|
2817
|
+
b({ type: String })
|
|
2818
|
+
], $.prototype, "radius", 2);
|
|
2819
|
+
k([
|
|
2820
|
+
b({ type: String })
|
|
2821
|
+
], $.prototype, "primary", 2);
|
|
2822
|
+
k([
|
|
2823
|
+
b({ type: String, attribute: "primary-foreground" })
|
|
2824
|
+
], $.prototype, "primaryForeground", 2);
|
|
2825
|
+
k([
|
|
2826
|
+
b({ type: String, attribute: "terms-url" })
|
|
2827
|
+
], $.prototype, "termsUrl", 2);
|
|
2828
|
+
k([
|
|
2829
|
+
b({ type: String, attribute: "privacy-url" })
|
|
2830
|
+
], $.prototype, "privacyUrl", 2);
|
|
2831
|
+
k([
|
|
2832
|
+
b({ type: String, attribute: "require-acceptance" })
|
|
2833
|
+
], $.prototype, "requireAcceptance", 2);
|
|
2834
|
+
k([
|
|
2835
|
+
b({ type: String, attribute: "oauth-layout" })
|
|
2836
|
+
], $.prototype, "oauthLayout", 2);
|
|
2837
|
+
k([
|
|
2838
|
+
b({ type: String })
|
|
2839
|
+
], $.prototype, "preview", 2);
|
|
2840
|
+
$ = k([
|
|
2841
|
+
z("authui-config")
|
|
2842
|
+
], $);
|
|
2843
|
+
var Gt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, it = (e, t, i, s) => {
|
|
2844
|
+
for (var a = s > 1 ? void 0 : s ? Yt(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
2845
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
2846
|
+
return s && a && Gt(t, i, a), a;
|
|
2756
2847
|
};
|
|
2757
|
-
const
|
|
2758
|
-
let
|
|
2759
|
-
function
|
|
2760
|
-
if (!(typeof document > "u" ||
|
|
2761
|
-
|
|
2848
|
+
const kt = "authui-show:not([ready]){display:none}", ve = "authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";
|
|
2849
|
+
let Ct = !1;
|
|
2850
|
+
function Zt() {
|
|
2851
|
+
if (!(typeof document > "u" || Ct)) {
|
|
2852
|
+
Ct = !0;
|
|
2762
2853
|
try {
|
|
2763
2854
|
if (typeof CSSStyleSheet < "u" && "adoptedStyleSheets" in Document.prototype) {
|
|
2764
2855
|
const e = new CSSStyleSheet();
|
|
2765
|
-
e.replaceSync(
|
|
2856
|
+
e.replaceSync(kt), document.adoptedStyleSheets = [...document.adoptedStyleSheets, e];
|
|
2766
2857
|
return;
|
|
2767
2858
|
}
|
|
2768
2859
|
} catch {
|
|
2769
2860
|
}
|
|
2770
2861
|
if (!document.getElementById("authui-fouc")) {
|
|
2771
2862
|
const e = document.createElement("style");
|
|
2772
|
-
e.id = "authui-fouc", e.textContent =
|
|
2863
|
+
e.id = "authui-fouc", e.textContent = kt, document.head.appendChild(e);
|
|
2773
2864
|
}
|
|
2774
2865
|
}
|
|
2775
2866
|
}
|
|
2776
|
-
|
|
2777
|
-
const
|
|
2778
|
-
function
|
|
2779
|
-
return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) =>
|
|
2867
|
+
Zt();
|
|
2868
|
+
const Xt = ["loading", "signed-out", "signed-in", "mfa-required"];
|
|
2869
|
+
function ot(e) {
|
|
2870
|
+
return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Xt.includes(t)) : [];
|
|
2780
2871
|
}
|
|
2781
|
-
function
|
|
2782
|
-
const s =
|
|
2872
|
+
function Qt(e, t, i) {
|
|
2873
|
+
const s = ot(t), a = ot(i);
|
|
2783
2874
|
return !(e === "loading" && !s.includes("loading") || s.length > 0 && !s.includes(e) || a.includes(e));
|
|
2784
2875
|
}
|
|
2785
|
-
let
|
|
2876
|
+
let G = class extends dt {
|
|
2786
2877
|
constructor() {
|
|
2787
2878
|
super(...arguments), this.when = "", this.unless = "", this.status = l.getState().status, this.unsubscribe = null;
|
|
2788
2879
|
}
|
|
@@ -2794,28 +2885,28 @@ let W = class extends ot {
|
|
|
2794
2885
|
}
|
|
2795
2886
|
/** Whether the current status satisfies `when` and `unless`. */
|
|
2796
2887
|
get visible() {
|
|
2797
|
-
return
|
|
2888
|
+
return Qt(this.status, this.when, this.unless);
|
|
2798
2889
|
}
|
|
2799
2890
|
updated() {
|
|
2800
|
-
(this.status !== "loading" ||
|
|
2891
|
+
(this.status !== "loading" || ot(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
|
|
2801
2892
|
}
|
|
2802
2893
|
render() {
|
|
2803
2894
|
return this.visible ? r`<slot></slot>` : n;
|
|
2804
2895
|
}
|
|
2805
2896
|
};
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
],
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
],
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
],
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
],
|
|
2818
|
-
const
|
|
2897
|
+
it([
|
|
2898
|
+
b({ type: String })
|
|
2899
|
+
], G.prototype, "when", 2);
|
|
2900
|
+
it([
|
|
2901
|
+
b({ type: String })
|
|
2902
|
+
], G.prototype, "unless", 2);
|
|
2903
|
+
it([
|
|
2904
|
+
h()
|
|
2905
|
+
], G.prototype, "status", 2);
|
|
2906
|
+
G = it([
|
|
2907
|
+
z("authui-show")
|
|
2908
|
+
], G);
|
|
2909
|
+
const Jt = D`
|
|
2819
2910
|
:host {
|
|
2820
2911
|
display: block;
|
|
2821
2912
|
width: 100%;
|
|
@@ -2869,7 +2960,7 @@ const Kt = T`
|
|
|
2869
2960
|
height: 14px;
|
|
2870
2961
|
margin: 0;
|
|
2871
2962
|
}
|
|
2872
|
-
`,
|
|
2963
|
+
`, w = (e) => r`<svg
|
|
2873
2964
|
xmlns="http://www.w3.org/2000/svg"
|
|
2874
2965
|
viewBox="0 0 24 24"
|
|
2875
2966
|
fill="none"
|
|
@@ -2881,88 +2972,88 @@ const Kt = T`
|
|
|
2881
2972
|
>
|
|
2882
2973
|
${e}
|
|
2883
2974
|
</svg>`, o = {
|
|
2884
|
-
mail:
|
|
2975
|
+
mail: w(
|
|
2885
2976
|
u`<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>`
|
|
2886
2977
|
),
|
|
2887
|
-
phone:
|
|
2978
|
+
phone: w(
|
|
2888
2979
|
u`<path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"/>`
|
|
2889
2980
|
),
|
|
2890
|
-
user:
|
|
2981
|
+
user: w(
|
|
2891
2982
|
u`<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>`
|
|
2892
2983
|
),
|
|
2893
|
-
userX:
|
|
2984
|
+
userX: w(
|
|
2894
2985
|
u`<path d="M2 21a8 8 0 0 1 11.873-7"/><circle cx="10" cy="8" r="5"/><path d="m17 17 5 5"/><path d="m22 17-5 5"/>`
|
|
2895
2986
|
),
|
|
2896
|
-
lock:
|
|
2987
|
+
lock: w(
|
|
2897
2988
|
u`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`
|
|
2898
2989
|
),
|
|
2899
|
-
key:
|
|
2990
|
+
key: w(
|
|
2900
2991
|
u`<path d="m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4"/><path d="m21 2-9.6 9.6"/><circle cx="7.5" cy="15.5" r="5.5"/>`
|
|
2901
2992
|
),
|
|
2902
|
-
shield:
|
|
2993
|
+
shield: w(
|
|
2903
2994
|
u`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>`
|
|
2904
2995
|
),
|
|
2905
|
-
shieldCheck:
|
|
2996
|
+
shieldCheck: w(
|
|
2906
2997
|
u`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="m9 12 2 2 4-4"/>`
|
|
2907
2998
|
),
|
|
2908
|
-
smartphone:
|
|
2999
|
+
smartphone: w(
|
|
2909
3000
|
u`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>`
|
|
2910
3001
|
),
|
|
2911
|
-
monitor:
|
|
3002
|
+
monitor: w(
|
|
2912
3003
|
u`<rect width="20" height="14" x="2" y="3" rx="2"/><line x1="8" x2="16" y1="21" y2="21"/><line x1="12" x2="12" y1="17" y2="21"/>`
|
|
2913
3004
|
),
|
|
2914
|
-
globe:
|
|
3005
|
+
globe: w(
|
|
2915
3006
|
u`<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>`
|
|
2916
3007
|
),
|
|
2917
|
-
logOut:
|
|
3008
|
+
logOut: w(
|
|
2918
3009
|
u`<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/><polyline points="16 17 21 12 16 7"/><line x1="21" x2="9" y1="12" y2="12"/>`
|
|
2919
3010
|
),
|
|
2920
|
-
settings:
|
|
3011
|
+
settings: w(
|
|
2921
3012
|
u`<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/><circle cx="12" cy="12" r="3"/>`
|
|
2922
3013
|
),
|
|
2923
|
-
x:
|
|
2924
|
-
check:
|
|
2925
|
-
users:
|
|
3014
|
+
x: w(u`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),
|
|
3015
|
+
check: w(u`<path d="M20 6 9 17l-5-5"/>`),
|
|
3016
|
+
users: w(
|
|
2926
3017
|
u`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>`
|
|
2927
3018
|
),
|
|
2928
|
-
copy:
|
|
3019
|
+
copy: w(
|
|
2929
3020
|
u`<rect width="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>`
|
|
2930
3021
|
),
|
|
2931
|
-
eye:
|
|
3022
|
+
eye: w(
|
|
2932
3023
|
u`<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"/><circle cx="12" cy="12" r="3"/>`
|
|
2933
3024
|
),
|
|
2934
|
-
eyeOff:
|
|
3025
|
+
eyeOff: w(
|
|
2935
3026
|
u`<path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"/><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"/><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"/><path d="m2 2 20 20"/>`
|
|
2936
3027
|
),
|
|
2937
|
-
arrowLeft:
|
|
2938
|
-
alert:
|
|
3028
|
+
arrowLeft: w(u`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),
|
|
3029
|
+
alert: w(
|
|
2939
3030
|
u`<circle cx="12" cy="12" r="10"/><line x1="12" x2="12" y1="8" y2="12"/><line x1="12" x2="12.01" y1="16" y2="16"/>`
|
|
2940
3031
|
),
|
|
2941
|
-
info:
|
|
2942
|
-
checkCircle:
|
|
2943
|
-
link:
|
|
3032
|
+
info: w(u`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),
|
|
3033
|
+
checkCircle: w(u`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),
|
|
3034
|
+
link: w(
|
|
2944
3035
|
u`<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>`
|
|
2945
3036
|
),
|
|
2946
|
-
activity:
|
|
3037
|
+
activity: w(
|
|
2947
3038
|
u`<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>`
|
|
2948
3039
|
),
|
|
2949
|
-
trash:
|
|
3040
|
+
trash: w(
|
|
2950
3041
|
u`<path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/>`
|
|
2951
3042
|
),
|
|
2952
|
-
sparkles:
|
|
3043
|
+
sparkles: w(
|
|
2953
3044
|
u`<path d="M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"/>`
|
|
2954
3045
|
),
|
|
2955
|
-
refresh:
|
|
3046
|
+
refresh: w(
|
|
2956
3047
|
u`<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>`
|
|
2957
3048
|
),
|
|
2958
|
-
chevronDown:
|
|
2959
|
-
ghost:
|
|
3049
|
+
chevronDown: w(u`<path d="m6 9 6 6 6-6"/>`),
|
|
3050
|
+
ghost: w(
|
|
2960
3051
|
u`<path d="M9 10h.01"/><path d="M15 10h.01"/><path d="M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z"/>`
|
|
2961
3052
|
),
|
|
2962
|
-
qr:
|
|
3053
|
+
qr: w(
|
|
2963
3054
|
u`<rect width="5" height="5" x="3" y="3" rx="1"/><rect width="5" height="5" x="16" y="3" rx="1"/><rect width="5" height="5" x="3" y="16" rx="1"/><path d="M21 16h-3a2 2 0 0 0-2 2v3"/><path d="M21 21v.01"/><path d="M12 7v3a2 2 0 0 1-2 2H7"/><path d="M3 12h.01"/><path d="M12 3h.01"/><path d="M12 16v.01"/><path d="M16 12h1"/><path d="M21 12v.01"/><path d="M12 21v-1"/>`
|
|
2964
3055
|
)
|
|
2965
|
-
}, S = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`,
|
|
3056
|
+
}, S = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, te = {
|
|
2966
3057
|
google: S(
|
|
2967
3058
|
u`<path fill="#4285F4" d="M23.49 12.27c0-.79-.07-1.54-.19-2.27H12v4.51h6.47a5.57 5.57 0 0 1-2.4 3.58v3h3.86c2.26-2.09 3.56-5.17 3.56-8.82z"/><path fill="#34A853" d="M12 24c3.24 0 5.95-1.08 7.93-2.91l-3.86-3c-1.08.72-2.45 1.16-4.07 1.16-3.13 0-5.78-2.11-6.73-4.96H1.29v3.09A11.99 11.99 0 0 0 12 24z"/><path fill="#FBBC05" d="M5.27 14.29A7.2 7.2 0 0 1 4.89 12c0-.8.14-1.57.38-2.29V6.62H1.29A11.97 11.97 0 0 0 0 12c0 1.94.46 3.77 1.29 5.38l3.98-3.09z"/><path fill="#EA4335" d="M12 4.75c1.77 0 3.35.61 4.6 1.8l3.42-3.42C17.95 1.19 15.24 0 12 0 7.31 0 3.26 2.69 1.29 6.62l3.98 3.09C6.22 6.86 8.87 4.75 12 4.75z"/>`
|
|
2968
3059
|
),
|
|
@@ -3019,21 +3110,21 @@ const Kt = T`
|
|
|
3019
3110
|
)
|
|
3020
3111
|
};
|
|
3021
3112
|
function j(e) {
|
|
3022
|
-
return
|
|
3113
|
+
return te[e] ?? o.globe;
|
|
3023
3114
|
}
|
|
3024
|
-
function
|
|
3115
|
+
function ut(e) {
|
|
3025
3116
|
const t = (e.trim()[0] ?? "?").toUpperCase();
|
|
3026
3117
|
return /[A-Z0-9]/i.test(t) ? t : o.user;
|
|
3027
3118
|
}
|
|
3028
|
-
function
|
|
3119
|
+
function et(e) {
|
|
3029
3120
|
typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
|
|
3030
3121
|
window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
|
|
3031
3122
|
}));
|
|
3032
3123
|
}
|
|
3033
|
-
function
|
|
3124
|
+
function be() {
|
|
3034
3125
|
typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
|
|
3035
3126
|
}
|
|
3036
|
-
function
|
|
3127
|
+
function lt(e) {
|
|
3037
3128
|
const t = {
|
|
3038
3129
|
length: e.length >= 8,
|
|
3039
3130
|
long: e.length >= 12,
|
|
@@ -3049,25 +3140,87 @@ function at(e) {
|
|
|
3049
3140
|
let s, a;
|
|
3050
3141
|
return !t.length || i <= 1 ? (s = 1, a = "passwordStrengthTooWeak") : i === 2 ? (s = 2, a = "passwordStrengthWeak") : i === 3 ? (s = 3, a = "passwordStrengthFair") : i >= 5 && t.long && t.lower && t.upper && t.number && t.symbol ? (s = 4, a = "passwordStrengthVeryStrong") : (s = 4, a = "passwordStrengthStrong"), { level: s, percent: s * 25, labelKey: a, checks: t };
|
|
3051
3142
|
}
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3143
|
+
function St(e, t) {
|
|
3144
|
+
return e.replace(/\D/g, "").slice(0, t);
|
|
3145
|
+
}
|
|
3146
|
+
function Q(e) {
|
|
3147
|
+
const t = e.length ?? 6, i = St(e.value, t), s = Math.ceil(t / 2), a = Math.min(i.length, t - 1), c = (p) => {
|
|
3148
|
+
const P = p.target, W = St(P.value, t);
|
|
3149
|
+
P.value = W, e.onChange(W);
|
|
3150
|
+
}, d = (p) => {
|
|
3151
|
+
p.ctrlKey || p.metaKey || p.altKey || p.key === "Backspace" || p.key === "Delete" || p.key === "Tab" || p.key === "Enter" || p.key === "Escape" || p.key === "ArrowLeft" || p.key === "ArrowRight" || p.key === "Home" || p.key === "End" || p.key.length === 1 && !/[0-9]/.test(p.key) && p.preventDefault();
|
|
3152
|
+
}, m = (p) => {
|
|
3153
|
+
const P = i[p] ?? "", W = !e.disabled && p === a;
|
|
3154
|
+
return r`<div
|
|
3155
|
+
class="otp-slot ${P ? "otp-slot-filled" : ""} ${W ? "otp-slot-active" : ""}"
|
|
3156
|
+
aria-hidden="true"
|
|
3157
|
+
>
|
|
3158
|
+
${P}
|
|
3159
|
+
</div>`;
|
|
3160
|
+
}, v = (p, P) => r`<div class="otp-group">
|
|
3161
|
+
${Array.from({ length: P - p }, (W, Ut) => m(p + Ut))}
|
|
3162
|
+
</div>`;
|
|
3163
|
+
return r`
|
|
3164
|
+
<div
|
|
3165
|
+
class="otp ${e.invalid ? "otp-invalid" : ""} ${e.disabled ? "otp-disabled" : ""}"
|
|
3166
|
+
data-otp
|
|
3167
|
+
>
|
|
3168
|
+
${v(0, s)}
|
|
3169
|
+
<div class="otp-sep" aria-hidden="true"><span></span></div>
|
|
3170
|
+
${v(s, t)}
|
|
3171
|
+
<input
|
|
3172
|
+
class="otp-native"
|
|
3173
|
+
id=${e.id}
|
|
3174
|
+
type="text"
|
|
3175
|
+
inputmode="numeric"
|
|
3176
|
+
autocomplete=${e.autocomplete ?? "one-time-code"}
|
|
3177
|
+
maxlength=${t}
|
|
3178
|
+
minlength=${t}
|
|
3179
|
+
pattern="[0-9]{${t}}"
|
|
3180
|
+
?required=${e.required !== !1}
|
|
3181
|
+
?disabled=${e.disabled}
|
|
3182
|
+
.value=${i}
|
|
3183
|
+
@input=${c}
|
|
3184
|
+
@keydown=${d}
|
|
3185
|
+
aria-invalid=${e.invalid ? "true" : n}
|
|
3186
|
+
aria-describedby=${e.describedBy ? e.describedBy : n}
|
|
3187
|
+
aria-label=${e.ariaLabel ? e.ariaLabel : n}
|
|
3188
|
+
/>
|
|
3189
|
+
</div>
|
|
3190
|
+
`;
|
|
3191
|
+
}
|
|
3192
|
+
const ee = ["totp", "email", "phone", "recoverycode"];
|
|
3193
|
+
function It(e) {
|
|
3194
|
+
const t = {
|
|
3195
|
+
totp: !!e.totp,
|
|
3196
|
+
email: !!e.email,
|
|
3197
|
+
phone: !!e.phone,
|
|
3198
|
+
recoverycode: !!e.recoveryCode
|
|
3199
|
+
};
|
|
3200
|
+
return ee.filter((i) => t[i]);
|
|
3201
|
+
}
|
|
3202
|
+
function ie(e) {
|
|
3203
|
+
return It(e)[0] ?? null;
|
|
3204
|
+
}
|
|
3205
|
+
var se = Object.defineProperty, re = Object.getOwnPropertyDescriptor, C = (e, t, i, s) => {
|
|
3206
|
+
for (var a = s > 1 ? void 0 : s ? re(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
3207
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
3208
|
+
return s && a && se(t, i, a), a;
|
|
3056
3209
|
};
|
|
3057
|
-
const
|
|
3058
|
-
let
|
|
3210
|
+
const T = "authui-error";
|
|
3211
|
+
let x = class extends M {
|
|
3059
3212
|
constructor() {
|
|
3060
|
-
super(...arguments), this.view = "sign-in", this.embedded = !1, this.step = "sign-in", this.busy = !1, this.error = "", this.notice = null, this.showPassword = !1, this.showPasswordConfirm = !1, this.expandedOAuth = null, this.token = null, this.focusOnStep = !1, this.resendCooldownUntil = 0, this.challenge = null, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, this.onSignIn = (e) => {
|
|
3213
|
+
super(...arguments), this.view = "sign-in", this.embedded = !1, this.step = "sign-in", this.busy = !1, this.error = "", this.notice = null, this.showPassword = !1, this.showPasswordConfirm = !1, this.expandedOAuth = null, this.token = null, this.focusOnStep = !1, this.resendCooldownUntil = 0, this.challenge = null, this.mfaAutoStarted = !1, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, this.onSignIn = (e) => {
|
|
3061
3214
|
e.preventDefault(), this.requireValid(e) && this.run(async () => {
|
|
3062
|
-
await l.signInWithEmailPassword(this.email, this.password), this.password = "",
|
|
3215
|
+
await l.signInWithEmailPassword(this.email, this.password), this.password = "", V("email-password"), this.fire("authui-success", { method: "email-password" });
|
|
3063
3216
|
});
|
|
3064
3217
|
}, this.onSignUp = (e) => {
|
|
3065
3218
|
e.preventDefault(), this.requireValid(e) && (this.legalErrorFromOAuth = !1, this.ensureLegalAccepted() && this.run(async () => {
|
|
3066
|
-
await l.signUp(this.email, this.password, this.name), this.password = "",
|
|
3219
|
+
await l.signUp(this.email, this.password, this.name), this.password = "", V("email-password"), this.fire("authui-success", { method: "sign-up" });
|
|
3067
3220
|
}));
|
|
3068
3221
|
}, this.onGuest = () => {
|
|
3069
3222
|
this.run(async () => {
|
|
3070
|
-
await l.signInAnonymously(),
|
|
3223
|
+
await l.signInAnonymously(), V("anonymous"), this.fire("authui-success", { method: "anonymous" });
|
|
3071
3224
|
});
|
|
3072
3225
|
}, this.onOAuth = (e) => {
|
|
3073
3226
|
if (this.step === "sign-up" && !this.ensureLegalAccepted()) {
|
|
@@ -3075,8 +3228,8 @@ let $ = class extends E {
|
|
|
3075
3228
|
return;
|
|
3076
3229
|
}
|
|
3077
3230
|
this.legalErrorFromOAuth = !1, this.run(async () => {
|
|
3078
|
-
if (
|
|
3079
|
-
|
|
3231
|
+
if (_t(e), await l.signInWithOAuth(e), l.isPreview) {
|
|
3232
|
+
At(), this.fire("authui-success", { method: "oauth" });
|
|
3080
3233
|
return;
|
|
3081
3234
|
}
|
|
3082
3235
|
await new Promise((t) => setTimeout(t, 4e3));
|
|
@@ -3124,7 +3277,7 @@ let $ = class extends E {
|
|
|
3124
3277
|
if (e.preventDefault(), !this.requireValid(e)) return;
|
|
3125
3278
|
const t = this.token;
|
|
3126
3279
|
t && this.run(async () => {
|
|
3127
|
-
await l.signInWithToken(t.userId, this.code), this.code = "", this.token = null,
|
|
3280
|
+
await l.signInWithToken(t.userId, this.code), this.code = "", this.token = null, V(t.kind), this.fire("authui-success", { method: t.kind });
|
|
3128
3281
|
}, "code");
|
|
3129
3282
|
}, this.onChooseFactor = (e) => {
|
|
3130
3283
|
this.run(async () => {
|
|
@@ -3142,7 +3295,7 @@ let $ = class extends E {
|
|
|
3142
3295
|
try {
|
|
3143
3296
|
await l.signOut();
|
|
3144
3297
|
} catch (e) {
|
|
3145
|
-
if (!
|
|
3298
|
+
if (!K(e, y.sessionNotFound)) throw e;
|
|
3146
3299
|
}
|
|
3147
3300
|
this.go("sign-in");
|
|
3148
3301
|
});
|
|
@@ -3157,7 +3310,17 @@ let $ = class extends E {
|
|
|
3157
3310
|
e.has("view") && e.get("view") !== void 0 && this.go(this.view), e.has("auth") && this.syncFromStore();
|
|
3158
3311
|
}
|
|
3159
3312
|
updated(e) {
|
|
3160
|
-
e.has("step") && (this.focusOnStep || this.embedded) && (this.focusOnStep = !1, requestAnimationFrame(() => this.firstInput?.focus()));
|
|
3313
|
+
e.has("step") && (this.focusOnStep || this.embedded) && (this.focusOnStep = !1, requestAnimationFrame(() => this.firstInput?.focus())), this.maybeAutoStartMfa();
|
|
3314
|
+
}
|
|
3315
|
+
/** Vibes-style: pick a default factor once and create its challenge. */
|
|
3316
|
+
maybeAutoStartMfa() {
|
|
3317
|
+
if (this.step !== "mfa" || this.challenge || this.mfaAutoStarted || this.busy) return;
|
|
3318
|
+
const e = this.auth.mfaFactors;
|
|
3319
|
+
if (!e) return;
|
|
3320
|
+
const t = ie(e);
|
|
3321
|
+
t && (this.mfaAutoStarted = !0, queueMicrotask(() => {
|
|
3322
|
+
!this.challenge && this.step === "mfa" && this.onChooseFactor(t);
|
|
3323
|
+
}));
|
|
3161
3324
|
}
|
|
3162
3325
|
/** React to store transitions: MFA pending, redirect results, sign in. */
|
|
3163
3326
|
syncFromStore() {
|
|
@@ -3174,7 +3337,7 @@ let $ = class extends E {
|
|
|
3174
3337
|
this.notice = null, this.auth.pending?.type === "notice" && l.setPending(null);
|
|
3175
3338
|
}
|
|
3176
3339
|
go(e) {
|
|
3177
|
-
e === "sign-up" && this.config?.signUp === !1 && (e = "sign-in"), this.focusOnStep = !0, this.step = e, this.error = "", this.notice = null, this.busy = !1, this.showPassword = !1, this.showPasswordConfirm = !1, this.password = "", this.passwordConfirm = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, e !== "mfa" && (this.challenge = null), e !== "email-otp" && e !== "phone" && e !== "magic-url" && (this.token = null), this.fire("authui-view", { view: e });
|
|
3340
|
+
e === "sign-up" && this.config?.signUp === !1 && (e = "sign-in"), this.focusOnStep = !0, this.step = e, this.error = "", this.notice = null, this.busy = !1, this.showPassword = !1, this.showPasswordConfirm = !1, this.password = "", this.passwordConfirm = "", this.legalAccepted = !1, this.legalErrorFromOAuth = !1, e !== "mfa" && (this.challenge = null, this.mfaAutoStarted = !1), e !== "email-otp" && e !== "phone" && e !== "magic-url" && (this.token = null), this.fire("authui-view", { view: e });
|
|
3178
3341
|
}
|
|
3179
3342
|
// ───────────────────────────── actions ─────────────────────────────
|
|
3180
3343
|
async run(e, t = "link") {
|
|
@@ -3183,7 +3346,7 @@ let $ = class extends E {
|
|
|
3183
3346
|
try {
|
|
3184
3347
|
await e();
|
|
3185
3348
|
} catch (i) {
|
|
3186
|
-
this.error =
|
|
3349
|
+
this.error = J(i, this.strings, t);
|
|
3187
3350
|
} finally {
|
|
3188
3351
|
this.busy = !1;
|
|
3189
3352
|
}
|
|
@@ -3265,7 +3428,7 @@ let $ = class extends E {
|
|
|
3265
3428
|
`;
|
|
3266
3429
|
}
|
|
3267
3430
|
renderError() {
|
|
3268
|
-
return this.error ? r`<div class="alert alert-error" role="alert" id=${
|
|
3431
|
+
return this.error ? r`<div class="alert alert-error" role="alert" id=${T}>
|
|
3269
3432
|
${o.alert}
|
|
3270
3433
|
<div class="alert-body">${this.error}</div>
|
|
3271
3434
|
</div>` : n;
|
|
@@ -3276,7 +3439,7 @@ let $ = class extends E {
|
|
|
3276
3439
|
</button>`;
|
|
3277
3440
|
}
|
|
3278
3441
|
passwordField(e) {
|
|
3279
|
-
const t = this[e.field], i = e.field === "passwordConfirm" ? this.showPasswordConfirm : this.showPassword, s = e.meter ?
|
|
3442
|
+
const t = this[e.field], i = e.field === "passwordConfirm" ? this.showPasswordConfirm : this.showPassword, s = e.meter ? lt(t) : null;
|
|
3280
3443
|
return r`
|
|
3281
3444
|
<div class="field${e.forgot ? " field-with-forgot" : ""}">
|
|
3282
3445
|
<label class="label" for=${e.id}>${e.label}</label>
|
|
@@ -3291,7 +3454,7 @@ let $ = class extends E {
|
|
|
3291
3454
|
.value=${t}
|
|
3292
3455
|
@input=${this.bind(e.field)}
|
|
3293
3456
|
aria-invalid=${this.error ? "true" : n}
|
|
3294
|
-
aria-describedby=${this.error ?
|
|
3457
|
+
aria-describedby=${this.error ? T : n}
|
|
3295
3458
|
/>
|
|
3296
3459
|
<button
|
|
3297
3460
|
type="button"
|
|
@@ -3343,7 +3506,7 @@ let $ = class extends E {
|
|
|
3343
3506
|
.value=${this.email}
|
|
3344
3507
|
@input=${this.bind("email")}
|
|
3345
3508
|
aria-invalid=${this.error ? "true" : n}
|
|
3346
|
-
aria-describedby=${this.error ?
|
|
3509
|
+
aria-describedby=${this.error ? T : n}
|
|
3347
3510
|
/>
|
|
3348
3511
|
</div>
|
|
3349
3512
|
`;
|
|
@@ -3352,20 +3515,16 @@ let $ = class extends E {
|
|
|
3352
3515
|
return r`
|
|
3353
3516
|
<div class="field">
|
|
3354
3517
|
<label class="label" for="authui-code">${this.t("code")}</label>
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
@input=${this.bind("code")}
|
|
3366
|
-
aria-invalid=${this.error ? "true" : n}
|
|
3367
|
-
aria-describedby=${this.error ? R : n}
|
|
3368
|
-
/>
|
|
3518
|
+
${Q({
|
|
3519
|
+
id: "authui-code",
|
|
3520
|
+
value: this.code,
|
|
3521
|
+
invalid: !!this.error,
|
|
3522
|
+
describedBy: this.error ? T : null,
|
|
3523
|
+
disabled: this.busy,
|
|
3524
|
+
onChange: (e) => {
|
|
3525
|
+
this.code = e, this.requestUpdate();
|
|
3526
|
+
}
|
|
3527
|
+
})}
|
|
3369
3528
|
</div>
|
|
3370
3529
|
`;
|
|
3371
3530
|
}
|
|
@@ -3395,7 +3554,7 @@ let $ = class extends E {
|
|
|
3395
3554
|
type="checkbox"
|
|
3396
3555
|
.checked=${this.legalAccepted}
|
|
3397
3556
|
aria-invalid=${e ? "true" : n}
|
|
3398
|
-
aria-describedby=${e ?
|
|
3557
|
+
aria-describedby=${e ? T : n}
|
|
3399
3558
|
@change=${(t) => {
|
|
3400
3559
|
this.legalAccepted = t.target.checked, this.legalAccepted && this.error === this.t("errorLegalRequired") && (this.error = "", this.legalErrorFromOAuth = !1);
|
|
3401
3560
|
}}
|
|
@@ -3449,7 +3608,7 @@ let $ = class extends E {
|
|
|
3449
3608
|
<div class="stack">
|
|
3450
3609
|
<div class="row">
|
|
3451
3610
|
<div class="inline">
|
|
3452
|
-
<span class="avatar">${
|
|
3611
|
+
<span class="avatar">${ut(t)}</span>
|
|
3453
3612
|
<div class="row-main">
|
|
3454
3613
|
<span class="row-title" title=${t}>${t}</span>
|
|
3455
3614
|
${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` : n}
|
|
@@ -3464,7 +3623,7 @@ let $ = class extends E {
|
|
|
3464
3623
|
<button
|
|
3465
3624
|
class="btn btn-outline btn-block"
|
|
3466
3625
|
@click=${() => {
|
|
3467
|
-
this.embedded ? this.fire("authui-open", { view: "account" }) :
|
|
3626
|
+
this.embedded ? this.fire("authui-open", { view: "account" }) : et("account");
|
|
3468
3627
|
}}
|
|
3469
3628
|
>
|
|
3470
3629
|
${o.settings} ${this.t("manageAccount")}
|
|
@@ -3479,56 +3638,56 @@ let $ = class extends E {
|
|
|
3479
3638
|
renderProviders() {
|
|
3480
3639
|
const e = [...this.config?.methods?.oauth ?? []];
|
|
3481
3640
|
if (e.length === 0) return n;
|
|
3482
|
-
const t =
|
|
3641
|
+
const t = q(), i = e.find((d) => t === `oauth:${d}`) ?? null, s = this.config?.methods?.oauthLayout, a = s === "horizontal" || s === "icon" ? "icon" : s === "stack" || s === "accordion" ? s : e.length <= 2 ? "stack" : "accordion";
|
|
3483
3642
|
if (a === "icon") {
|
|
3484
|
-
const d = [...e].sort((
|
|
3485
|
-
const
|
|
3486
|
-
return
|
|
3643
|
+
const d = [...e].sort((m, v) => {
|
|
3644
|
+
const p = t === `oauth:${m}` ? 0 : 1, P = t === `oauth:${v}` ? 0 : 1;
|
|
3645
|
+
return p - P;
|
|
3487
3646
|
});
|
|
3488
3647
|
return r`
|
|
3489
3648
|
<div class="providers icon">
|
|
3490
|
-
${d.map((
|
|
3491
|
-
const
|
|
3649
|
+
${d.map((m) => {
|
|
3650
|
+
const v = t === `oauth:${m}`, p = this.t("continueWith", { provider: N(m) });
|
|
3492
3651
|
return r`<button
|
|
3493
3652
|
type="button"
|
|
3494
|
-
class="btn btn-outline ${
|
|
3495
|
-
@click=${() => this.onOAuth(
|
|
3653
|
+
class="btn btn-outline ${v ? "last-used" : ""}"
|
|
3654
|
+
@click=${() => this.onOAuth(m)}
|
|
3496
3655
|
?disabled=${this.busy}
|
|
3497
|
-
aria-label=${
|
|
3498
|
-
title=${
|
|
3656
|
+
aria-label=${v ? `${p}. ${this.t("lastUsed")}` : p}
|
|
3657
|
+
title=${p}
|
|
3499
3658
|
>
|
|
3500
|
-
${j(
|
|
3501
|
-
${
|
|
3659
|
+
${j(m)}
|
|
3660
|
+
${v ? r`<span class="oauth-last-used-dot" aria-hidden="true"></span>` : n}
|
|
3502
3661
|
</button>`;
|
|
3503
3662
|
})}
|
|
3504
3663
|
</div>
|
|
3505
3664
|
`;
|
|
3506
3665
|
}
|
|
3507
3666
|
if (a === "stack") {
|
|
3508
|
-
const d = [...e].sort((
|
|
3509
|
-
const
|
|
3510
|
-
return
|
|
3667
|
+
const d = [...e].sort((m, v) => {
|
|
3668
|
+
const p = t === `oauth:${m}` ? 0 : 1, P = t === `oauth:${v}` ? 0 : 1;
|
|
3669
|
+
return p - P;
|
|
3511
3670
|
});
|
|
3512
3671
|
return r`
|
|
3513
3672
|
<div class="providers">
|
|
3514
|
-
${d.map((
|
|
3515
|
-
const
|
|
3673
|
+
${d.map((m) => {
|
|
3674
|
+
const v = t === `oauth:${m}`, p = this.t("continueWith", { provider: N(m) });
|
|
3516
3675
|
return r`<button
|
|
3517
3676
|
type="button"
|
|
3518
|
-
class="btn btn-outline ${
|
|
3519
|
-
@click=${() => this.onOAuth(
|
|
3677
|
+
class="btn btn-outline ${v ? "last-used" : ""}"
|
|
3678
|
+
@click=${() => this.onOAuth(m)}
|
|
3520
3679
|
?disabled=${this.busy}
|
|
3521
|
-
aria-label=${
|
|
3680
|
+
aria-label=${v ? `${p}. ${this.t("lastUsed")}` : p}
|
|
3522
3681
|
>
|
|
3523
|
-
${j(
|
|
3524
|
-
<span>${
|
|
3525
|
-
${
|
|
3682
|
+
${j(m)}
|
|
3683
|
+
<span>${p}</span>
|
|
3684
|
+
${v ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3526
3685
|
</button>`;
|
|
3527
3686
|
})}
|
|
3528
3687
|
</div>
|
|
3529
3688
|
`;
|
|
3530
3689
|
}
|
|
3531
|
-
const
|
|
3690
|
+
const c = this.expandedOAuth && e.includes(this.expandedOAuth) ? this.expandedOAuth : i ?? e[0];
|
|
3532
3691
|
return r`
|
|
3533
3692
|
<div
|
|
3534
3693
|
class="providers accordion"
|
|
@@ -3537,9 +3696,9 @@ let $ = class extends E {
|
|
|
3537
3696
|
}}
|
|
3538
3697
|
>
|
|
3539
3698
|
${e.map((d) => {
|
|
3540
|
-
const
|
|
3699
|
+
const m = t === `oauth:${d}`, v = c === d, p = this.t("continueWith", { provider: N(d) });
|
|
3541
3700
|
return r`<div
|
|
3542
|
-
class="provider-slot ${
|
|
3701
|
+
class="provider-slot ${v ? "is-expanded" : ""}"
|
|
3543
3702
|
@mouseenter=${() => {
|
|
3544
3703
|
this.expandedOAuth = d;
|
|
3545
3704
|
}}
|
|
@@ -3552,13 +3711,13 @@ let $ = class extends E {
|
|
|
3552
3711
|
this.expandedOAuth = d;
|
|
3553
3712
|
}}
|
|
3554
3713
|
?disabled=${this.busy}
|
|
3555
|
-
aria-label=${
|
|
3714
|
+
aria-label=${m ? `${p}. ${this.t("lastUsed")}` : p}
|
|
3556
3715
|
>
|
|
3557
3716
|
${j(d)}
|
|
3558
3717
|
<span class="provider-label"
|
|
3559
|
-
><span><span class="provider-label-text">${
|
|
3718
|
+
><span><span class="provider-label-text">${p}</span></span></span
|
|
3560
3719
|
>
|
|
3561
|
-
${
|
|
3720
|
+
${m ? r`<span class="oauth-last-used" data-last-used=${d} aria-hidden="true">
|
|
3562
3721
|
<span class="oauth-last-used-dot"></span>
|
|
3563
3722
|
<span class="oauth-last-used-pill">${this.t("lastUsed")}</span>
|
|
3564
3723
|
</span>` : n}
|
|
@@ -3579,11 +3738,11 @@ let $ = class extends E {
|
|
|
3579
3738
|
${this.renderProviders()}
|
|
3580
3739
|
${i && (t || s.length > 0) ? r`<div class="separator-text">${this.t("or")}</div>` : n}
|
|
3581
3740
|
${t ? r`<form
|
|
3582
|
-
class="form ${
|
|
3741
|
+
class="form ${q() === "email-password" ? "last-used-form" : ""}"
|
|
3583
3742
|
@submit=${this.onSignIn}
|
|
3584
3743
|
novalidate
|
|
3585
3744
|
>
|
|
3586
|
-
${
|
|
3745
|
+
${q() === "email-password" ? r`<p class="hint">
|
|
3587
3746
|
<span class="last-used-badge">${this.t("lastUsed")}</span>
|
|
3588
3747
|
</p>` : n}
|
|
3589
3748
|
${this.emailField()}
|
|
@@ -3592,26 +3751,26 @@ let $ = class extends E {
|
|
|
3592
3751
|
</form>` : this.renderError()}
|
|
3593
3752
|
${s.length > 0 ? r`<div class="stack-sm">
|
|
3594
3753
|
${s.map((a) => {
|
|
3595
|
-
const
|
|
3754
|
+
const c = q() === a.step;
|
|
3596
3755
|
return r`<button
|
|
3597
3756
|
type="button"
|
|
3598
|
-
class="btn btn-secondary btn-block ${
|
|
3757
|
+
class="btn btn-secondary btn-block ${c ? "last-used" : ""}"
|
|
3599
3758
|
@click=${() => this.go(a.step)}
|
|
3600
3759
|
?disabled=${this.busy}
|
|
3601
3760
|
>
|
|
3602
3761
|
${a.icon} ${a.label}
|
|
3603
|
-
${
|
|
3762
|
+
${c ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3604
3763
|
</button>`;
|
|
3605
3764
|
})}
|
|
3606
3765
|
</div>` : n}
|
|
3607
3766
|
${e.anonymous ? r`<button
|
|
3608
3767
|
type="button"
|
|
3609
|
-
class="btn btn-ghost btn-block ${
|
|
3768
|
+
class="btn btn-ghost btn-block ${q() === "anonymous" ? "last-used" : ""}"
|
|
3610
3769
|
@click=${this.onGuest}
|
|
3611
3770
|
?disabled=${this.busy}
|
|
3612
3771
|
>
|
|
3613
3772
|
${o.ghost} ${this.t("continueAsGuest")}
|
|
3614
|
-
${
|
|
3773
|
+
${q() === "anonymous" ? r`<span class="last-used-badge">${this.t("lastUsed")}</span>` : n}
|
|
3615
3774
|
</button>` : n}
|
|
3616
3775
|
${t && this.config?.signUp !== !1 ? r`<div class="links">
|
|
3617
3776
|
<span>${this.t("noAccount")}</span>
|
|
@@ -3641,7 +3800,7 @@ let $ = class extends E {
|
|
|
3641
3800
|
.value=${this.name}
|
|
3642
3801
|
@input=${this.bind("name")}
|
|
3643
3802
|
aria-invalid=${this.error ? "true" : n}
|
|
3644
|
-
aria-describedby=${this.error ?
|
|
3803
|
+
aria-describedby=${this.error ? T : n}
|
|
3645
3804
|
/>
|
|
3646
3805
|
</div>` : n}
|
|
3647
3806
|
${this.emailField()}
|
|
@@ -3811,7 +3970,7 @@ let $ = class extends E {
|
|
|
3811
3970
|
.value=${this.phone}
|
|
3812
3971
|
@input=${this.bind("phone")}
|
|
3813
3972
|
aria-invalid=${this.error ? "true" : n}
|
|
3814
|
-
aria-describedby=${this.error ?
|
|
3973
|
+
aria-describedby=${this.error ? T : n}
|
|
3815
3974
|
/>
|
|
3816
3975
|
</div>
|
|
3817
3976
|
${this.renderError()} ${this.submitButton(this.t("sendCode"))}
|
|
@@ -3822,45 +3981,39 @@ let $ = class extends E {
|
|
|
3822
3981
|
}
|
|
3823
3982
|
renderMfa() {
|
|
3824
3983
|
const e = this.auth.mfaFactors;
|
|
3984
|
+
if (!e)
|
|
3985
|
+
return r`
|
|
3986
|
+
<div class="stack">
|
|
3987
|
+
<div class="empty"><span class="spinner" aria-label=${this.t("loading")}></span></div>
|
|
3988
|
+
${this.renderError()}
|
|
3989
|
+
<div class="links">
|
|
3990
|
+
<button type="button" class="btn btn-link" @click=${this.onCancelMfa}>
|
|
3991
|
+
${this.t("cancel")}
|
|
3992
|
+
</button>
|
|
3993
|
+
</div>
|
|
3994
|
+
</div>
|
|
3995
|
+
`;
|
|
3825
3996
|
if (!this.challenge) {
|
|
3826
3997
|
const i = [
|
|
3827
|
-
{
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
},
|
|
3833
|
-
{
|
|
3834
|
-
factor: "email",
|
|
3835
|
-
icon: o.mail,
|
|
3836
|
-
label: this.t("mfaUseEmail"),
|
|
3837
|
-
available: e?.email ?? !0
|
|
3838
|
-
},
|
|
3839
|
-
{
|
|
3840
|
-
factor: "phone",
|
|
3841
|
-
icon: o.phone,
|
|
3842
|
-
label: this.t("mfaUsePhone"),
|
|
3843
|
-
available: e?.phone ?? !0
|
|
3844
|
-
},
|
|
3845
|
-
{
|
|
3846
|
-
factor: "recoverycode",
|
|
3847
|
-
icon: o.key,
|
|
3848
|
-
label: this.t("mfaUseRecoveryCode"),
|
|
3849
|
-
available: e?.recoveryCode ?? !0
|
|
3850
|
-
}
|
|
3851
|
-
];
|
|
3998
|
+
{ factor: "totp", icon: o.smartphone, label: this.t("mfaUseAuthenticator") },
|
|
3999
|
+
{ factor: "email", icon: o.mail, label: this.t("mfaUseEmail") },
|
|
4000
|
+
{ factor: "phone", icon: o.phone, label: this.t("mfaUsePhone") },
|
|
4001
|
+
{ factor: "recoverycode", icon: o.key, label: this.t("mfaUseRecoveryCode") }
|
|
4002
|
+
], s = new Set(It(e)), a = i.filter((c) => s.has(c.factor));
|
|
3852
4003
|
return r`
|
|
3853
4004
|
<div class="stack">
|
|
3854
4005
|
<div class="stack-sm">
|
|
3855
|
-
${
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
4006
|
+
${a.length === 0 ? r`<div class="empty">
|
|
4007
|
+
<span class="spinner" aria-label=${this.t("loading")}></span>
|
|
4008
|
+
</div>` : a.map(
|
|
4009
|
+
(c) => r`<button
|
|
4010
|
+
type="button"
|
|
4011
|
+
class="choice"
|
|
4012
|
+
@click=${() => this.onChooseFactor(c.factor)}
|
|
4013
|
+
?disabled=${this.busy}
|
|
4014
|
+
>
|
|
4015
|
+
${c.icon}<span class="choice-title">${c.label}</span>
|
|
4016
|
+
</button>`
|
|
3864
4017
|
)}
|
|
3865
4018
|
</div>
|
|
3866
4019
|
${this.renderError()}
|
|
@@ -3887,7 +4040,7 @@ let $ = class extends E {
|
|
|
3887
4040
|
.value=${this.code}
|
|
3888
4041
|
@input=${this.bind("code")}
|
|
3889
4042
|
aria-invalid=${this.error ? "true" : n}
|
|
3890
|
-
aria-describedby=${this.error ?
|
|
4043
|
+
aria-describedby=${this.error ? T : n}
|
|
3891
4044
|
/>
|
|
3892
4045
|
</div>` : this.codeField()}
|
|
3893
4046
|
${this.renderError()} ${this.submitButton(this.t("verifyCode"))}
|
|
@@ -3905,75 +4058,75 @@ let $ = class extends E {
|
|
|
3905
4058
|
`;
|
|
3906
4059
|
}
|
|
3907
4060
|
};
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
],
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
],
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
],
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
],
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
],
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
],
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
],
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
],
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
],
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
],
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
],
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
],
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
],
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
],
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
],
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
],
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
],
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
],
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
],
|
|
3966
|
-
var
|
|
3967
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
3968
|
-
(d = e[
|
|
3969
|
-
return s && a &&
|
|
4061
|
+
x.styles = [...M.styles, Jt];
|
|
4062
|
+
C([
|
|
4063
|
+
b({ type: String })
|
|
4064
|
+
], x.prototype, "view", 2);
|
|
4065
|
+
C([
|
|
4066
|
+
b({ type: Boolean })
|
|
4067
|
+
], x.prototype, "embedded", 2);
|
|
4068
|
+
C([
|
|
4069
|
+
h()
|
|
4070
|
+
], x.prototype, "step", 2);
|
|
4071
|
+
C([
|
|
4072
|
+
h()
|
|
4073
|
+
], x.prototype, "busy", 2);
|
|
4074
|
+
C([
|
|
4075
|
+
h()
|
|
4076
|
+
], x.prototype, "error", 2);
|
|
4077
|
+
C([
|
|
4078
|
+
h()
|
|
4079
|
+
], x.prototype, "notice", 2);
|
|
4080
|
+
C([
|
|
4081
|
+
h()
|
|
4082
|
+
], x.prototype, "showPassword", 2);
|
|
4083
|
+
C([
|
|
4084
|
+
h()
|
|
4085
|
+
], x.prototype, "showPasswordConfirm", 2);
|
|
4086
|
+
C([
|
|
4087
|
+
h()
|
|
4088
|
+
], x.prototype, "expandedOAuth", 2);
|
|
4089
|
+
C([
|
|
4090
|
+
h()
|
|
4091
|
+
], x.prototype, "token", 2);
|
|
4092
|
+
C([
|
|
4093
|
+
h()
|
|
4094
|
+
], x.prototype, "resendCooldownUntil", 2);
|
|
4095
|
+
C([
|
|
4096
|
+
h()
|
|
4097
|
+
], x.prototype, "challenge", 2);
|
|
4098
|
+
C([
|
|
4099
|
+
h()
|
|
4100
|
+
], x.prototype, "recovery", 2);
|
|
4101
|
+
C([
|
|
4102
|
+
ct("form input:not([type=hidden])")
|
|
4103
|
+
], x.prototype, "firstInput", 2);
|
|
4104
|
+
C([
|
|
4105
|
+
h()
|
|
4106
|
+
], x.prototype, "password", 2);
|
|
4107
|
+
C([
|
|
4108
|
+
h()
|
|
4109
|
+
], x.prototype, "passwordConfirm", 2);
|
|
4110
|
+
C([
|
|
4111
|
+
h()
|
|
4112
|
+
], x.prototype, "legalAccepted", 2);
|
|
4113
|
+
C([
|
|
4114
|
+
h()
|
|
4115
|
+
], x.prototype, "legalErrorFromOAuth", 2);
|
|
4116
|
+
x = C([
|
|
4117
|
+
z("authui-sign-in")
|
|
4118
|
+
], x);
|
|
4119
|
+
var ae = Object.defineProperty, ne = Object.getOwnPropertyDescriptor, g = (e, t, i, s) => {
|
|
4120
|
+
for (var a = s > 1 ? void 0 : s ? ne(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
4121
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
4122
|
+
return s && a && ae(t, i, a), a;
|
|
3970
4123
|
};
|
|
3971
|
-
let
|
|
4124
|
+
let f = class extends M {
|
|
3972
4125
|
constructor() {
|
|
3973
|
-
super(...arguments), this.embedded = !1, this.tab = "profile", this.active = "profile", this.busy = "", this.notice = null, this.errors = {}, this.nameInput = "", this.emailInput = "", this.emailPassword = "", this.phoneInput = "", this.phonePassword = "", this.phoneCode = "", this.phoneCodeSent = !1, this.guestName = "", this.oldPassword = "", this.newPassword = "", this.newPasswordConfirm = "", this.showOldPassword = !1, this.showNewPassword = !1, this.showNewPasswordConfirm = !1, this.authenticator = null, this.authenticatorCode = "", this.factors = null, this.recoveryCodes = null, this.stepUp = null, this.stepUpCode = "", this.copied = !1, this.sessions = null, this.identities = null, this.logs = null, this.logsSupported = null, this.logsProbeStarted = !1, this.confirmDelete = !1, this.confirmRegenerate = !1, this.confirmRemoveAuthenticator = !1, this.confirmSignOutAll = !1, this.confirmDisconnectId = null, this.verifyEmailCooldownUntil = 0, this.verifyEmailCooldownTimer = null, this.verifyPhoneCooldownUntil = 0, this.verifyPhoneCooldownTimer = null, this.onTabsKeydown = (e) => {
|
|
4126
|
+
super(...arguments), this.embedded = !1, this.tab = "profile", this.active = "profile", this.busy = "", this.notice = null, this.errors = {}, this.nameInput = "", this.emailInput = "", this.emailPassword = "", this.phoneInput = "", this.phonePassword = "", this.phoneCode = "", this.phoneCodeSent = !1, this.guestName = "", this.oldPassword = "", this.newPassword = "", this.newPasswordConfirm = "", this.showOldPassword = !1, this.showNewPassword = !1, this.showNewPasswordConfirm = !1, this.authenticator = null, this.authenticatorCode = "", this.factors = null, this.recoveryCodes = null, this.stepUp = null, this.stepUpCode = "", this.copied = !1, this.sessions = null, this.browserIconFailed = {}, this.identities = null, this.logs = null, this.logsSupported = null, this.logsProbeStarted = !1, this.confirmDelete = !1, this.confirmRegenerate = !1, this.confirmRemoveAuthenticator = !1, this.confirmSignOutAll = !1, this.confirmDisconnectId = null, this.verifyEmailCooldownUntil = 0, this.verifyEmailCooldownTimer = null, this.verifyPhoneCooldownUntil = 0, this.verifyPhoneCooldownTimer = null, this.onTabsKeydown = (e) => {
|
|
3974
4127
|
const t = [...this.renderRoot?.querySelectorAll('[role="tab"]') ?? []];
|
|
3975
4128
|
if (!t.length) return;
|
|
3976
|
-
const i = t.findIndex((
|
|
4129
|
+
const i = t.findIndex((c) => c.getAttribute("aria-selected") === "true");
|
|
3977
4130
|
let s = i;
|
|
3978
4131
|
if (e.key === "ArrowRight" || e.key === "ArrowDown") s = (i + 1) % t.length;
|
|
3979
4132
|
else if (e.key === "ArrowLeft" || e.key === "ArrowUp")
|
|
@@ -4074,7 +4227,7 @@ let p = class extends E {
|
|
|
4074
4227
|
try {
|
|
4075
4228
|
this.recoveryCodes = await l.createRecoveryCodes();
|
|
4076
4229
|
} catch (e) {
|
|
4077
|
-
if (!
|
|
4230
|
+
if (!K(e, y.recoveryCodesExist)) throw e;
|
|
4078
4231
|
this.recoveryCodes = await l.getRecoveryCodes();
|
|
4079
4232
|
}
|
|
4080
4233
|
await this.loadFactors();
|
|
@@ -4197,9 +4350,9 @@ let p = class extends E {
|
|
|
4197
4350
|
try {
|
|
4198
4351
|
await t(), i && this.setNotice("success", i);
|
|
4199
4352
|
} catch (s) {
|
|
4200
|
-
|
|
4353
|
+
K(s, y.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
|
|
4201
4354
|
...this.errors,
|
|
4202
|
-
[e]:
|
|
4355
|
+
[e]: J(
|
|
4203
4356
|
s,
|
|
4204
4357
|
this.strings,
|
|
4205
4358
|
e.includes("code") ? "code" : e === "password" ? "password" : "link"
|
|
@@ -4354,7 +4507,7 @@ let p = class extends E {
|
|
|
4354
4507
|
return r`
|
|
4355
4508
|
<div class="between">
|
|
4356
4509
|
<div class="identity">
|
|
4357
|
-
<span class="avatar">${
|
|
4510
|
+
<span class="avatar">${ut(t)}</span>
|
|
4358
4511
|
<div class="row-main">
|
|
4359
4512
|
<span class="row-title" title=${t}>
|
|
4360
4513
|
${t}
|
|
@@ -4479,7 +4632,7 @@ let p = class extends E {
|
|
|
4479
4632
|
autocomplete="new-password"
|
|
4480
4633
|
/>
|
|
4481
4634
|
${this.emailPassword ? (() => {
|
|
4482
|
-
const t =
|
|
4635
|
+
const t = lt(this.emailPassword);
|
|
4483
4636
|
return r`<div class="strength" aria-live="polite">
|
|
4484
4637
|
<div
|
|
4485
4638
|
class="strength-meter"
|
|
@@ -4632,20 +4785,15 @@ let p = class extends E {
|
|
|
4632
4785
|
</div>` : n}
|
|
4633
4786
|
${this.phoneCodeSent ? r`<div class="field">
|
|
4634
4787
|
<label class="label" for="acc-phone-code">${this.t("code")}</label>
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
@input=${this.bind("phoneCode")}
|
|
4645
|
-
@keydown=${(t) => {
|
|
4646
|
-
t.key === "Enter" && (t.preventDefault(), this.onConfirmPhoneVerification(t));
|
|
4647
|
-
}}
|
|
4648
|
-
/>
|
|
4788
|
+
|
|
4789
|
+
${Q({
|
|
4790
|
+
id: "acc-phone-code",
|
|
4791
|
+
value: this.phoneCode,
|
|
4792
|
+
disabled: !!this.busy,
|
|
4793
|
+
onChange: (t) => {
|
|
4794
|
+
this.phoneCode = t;
|
|
4795
|
+
}
|
|
4796
|
+
})}
|
|
4649
4797
|
</div>` : n}
|
|
4650
4798
|
${this.error("phone")} ${this.error("verify-phone")} ${this.error("verify-phone-code")}
|
|
4651
4799
|
</form>`,
|
|
@@ -4774,7 +4922,7 @@ let p = class extends E {
|
|
|
4774
4922
|
</button>
|
|
4775
4923
|
</div>
|
|
4776
4924
|
${this.newPassword ? (() => {
|
|
4777
|
-
const i =
|
|
4925
|
+
const i = lt(this.newPassword);
|
|
4778
4926
|
return r`<div class="strength" aria-live="polite">
|
|
4779
4927
|
<div
|
|
4780
4928
|
class="strength-meter"
|
|
@@ -4833,7 +4981,7 @@ let p = class extends E {
|
|
|
4833
4981
|
</div>`;
|
|
4834
4982
|
}
|
|
4835
4983
|
renderMfaCard() {
|
|
4836
|
-
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? l.isPreview ?
|
|
4984
|
+
const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? l.isPreview ? Dt(this.authenticator.uri) : new rt(l.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
|
|
4837
4985
|
return this.card(
|
|
4838
4986
|
this.t("twoFactor"),
|
|
4839
4987
|
this.t("twoFactorDescription"),
|
|
@@ -4931,17 +5079,15 @@ let p = class extends E {
|
|
|
4931
5079
|
</div>
|
|
4932
5080
|
<div class="field">
|
|
4933
5081
|
<label class="label" for="acc-totp">${this.t("code")}</label>
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
@input=${this.bind("authenticatorCode")}
|
|
4944
|
-
/>
|
|
5082
|
+
|
|
5083
|
+
${Q({
|
|
5084
|
+
id: "acc-totp",
|
|
5085
|
+
value: this.authenticatorCode,
|
|
5086
|
+
disabled: !!this.busy,
|
|
5087
|
+
onChange: (s) => {
|
|
5088
|
+
this.authenticatorCode = s;
|
|
5089
|
+
}
|
|
5090
|
+
})}
|
|
4945
5091
|
</div>
|
|
4946
5092
|
${this.error("authenticator-code")}
|
|
4947
5093
|
<div class="inline">
|
|
@@ -5058,17 +5204,23 @@ let p = class extends E {
|
|
|
5058
5204
|
<label class="label" for="acc-stepup"
|
|
5059
5205
|
>${e.challenge.factor === "recoverycode" ? this.t("recoveryCode") : this.t("code")}</label
|
|
5060
5206
|
>
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5207
|
+
${e.challenge.factor === "recoverycode" ? r`<input
|
|
5208
|
+
class="input mono"
|
|
5209
|
+
id="acc-stepup"
|
|
5210
|
+
inputmode="text"
|
|
5211
|
+
maxlength="64"
|
|
5212
|
+
autocomplete="one-time-code"
|
|
5213
|
+
required
|
|
5214
|
+
.value=${this.stepUpCode}
|
|
5215
|
+
@input=${this.bind("stepUpCode")}
|
|
5216
|
+
/>` : Q({
|
|
5217
|
+
id: "acc-stepup",
|
|
5218
|
+
value: this.stepUpCode,
|
|
5219
|
+
disabled: !!this.busy,
|
|
5220
|
+
onChange: (s) => {
|
|
5221
|
+
this.stepUpCode = s;
|
|
5222
|
+
}
|
|
5223
|
+
})}
|
|
5072
5224
|
</div>
|
|
5073
5225
|
<button class="btn btn-primary btn-sm" type="submit" ?disabled=${!!this.busy}>
|
|
5074
5226
|
${this.spinner("stepup-code")} ${this.t("verifyCode")}
|
|
@@ -5093,10 +5245,53 @@ let p = class extends E {
|
|
|
5093
5245
|
);
|
|
5094
5246
|
}
|
|
5095
5247
|
// ── Sessions ──
|
|
5096
|
-
|
|
5248
|
+
formatSessionDate(e) {
|
|
5249
|
+
if (!e) return "";
|
|
5250
|
+
const t = new Date(e);
|
|
5251
|
+
return Number.isNaN(t.getTime()) ? e : t.toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
|
|
5252
|
+
}
|
|
5253
|
+
browserIconUrl(e) {
|
|
5254
|
+
const t = (e.clientCode || "").trim();
|
|
5255
|
+
if (!t || t === "-") return null;
|
|
5256
|
+
const i = l.getClient();
|
|
5257
|
+
if (!i) return null;
|
|
5258
|
+
try {
|
|
5259
|
+
const s = new rt(i).getBrowser(t, 64, 64);
|
|
5260
|
+
return typeof s == "string" ? s : String(s);
|
|
5261
|
+
} catch {
|
|
5262
|
+
return null;
|
|
5263
|
+
}
|
|
5264
|
+
}
|
|
5265
|
+
flagUrl(e) {
|
|
5266
|
+
const t = (e.countryCode || "").trim().toLowerCase();
|
|
5267
|
+
if (!t || t === "--") return null;
|
|
5268
|
+
const i = l.getClient();
|
|
5269
|
+
if (!i) return null;
|
|
5270
|
+
try {
|
|
5271
|
+
const s = new rt(i).getFlag(t, 32, 32);
|
|
5272
|
+
return typeof s == "string" ? s : String(s);
|
|
5273
|
+
} catch {
|
|
5274
|
+
return null;
|
|
5275
|
+
}
|
|
5276
|
+
}
|
|
5277
|
+
deviceKindIcon(e) {
|
|
5097
5278
|
const t = (e.deviceName || "").toLowerCase(), i = (e.osName || e.osCode || "").toLowerCase();
|
|
5098
5279
|
return /phone|tablet|mobile/.test(t) || /ios|android|ipados/.test(i) ? o.smartphone : /desktop|browser/.test(t) || /mac|windows|linux|chrome os/.test(i) ? o.monitor : o.globe;
|
|
5099
5280
|
}
|
|
5281
|
+
deviceIcon(e) {
|
|
5282
|
+
const t = this.browserIconUrl(e), i = !!this.browserIconFailed[e.$id], s = this.deviceKindIcon(e);
|
|
5283
|
+
return !t || i ? r`<span class="device">${s}</span>` : r`<span class="device">
|
|
5284
|
+
<img
|
|
5285
|
+
class="device-img"
|
|
5286
|
+
src=${t}
|
|
5287
|
+
alt=""
|
|
5288
|
+
@error=${() => {
|
|
5289
|
+
this.browserIconFailed = { ...this.browserIconFailed, [e.$id]: !0 };
|
|
5290
|
+
}}
|
|
5291
|
+
/>
|
|
5292
|
+
<span class="device-badge" aria-hidden="true">${s}</span>
|
|
5293
|
+
</span>`;
|
|
5294
|
+
}
|
|
5100
5295
|
renderSessions() {
|
|
5101
5296
|
const e = this.sessions;
|
|
5102
5297
|
return r`<div class="section">
|
|
@@ -5108,34 +5303,52 @@ let p = class extends E {
|
|
|
5108
5303
|
o.monitor,
|
|
5109
5304
|
this.t("noSessions"),
|
|
5110
5305
|
this.t("noSessionsDescription")
|
|
5111
|
-
) : e.map(
|
|
5112
|
-
(t)
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5306
|
+
) : e.map((t) => {
|
|
5307
|
+
const i = this.flagUrl(t), s = Array.isArray(t.factors) && t.factors.length > 0, a = (t.provider || "").trim(), c = !!a && a !== "email" && a !== "anonymous", d = this.formatSessionDate(t.$createdAt), m = this.formatSessionDate(t.expire), v = t.countryName || t.countryCode || "";
|
|
5308
|
+
return r`<div class="row">
|
|
5309
|
+
<div class="inline">
|
|
5310
|
+
${this.deviceIcon(t)}
|
|
5311
|
+
<div class="row-main">
|
|
5312
|
+
<span class="row-title">
|
|
5313
|
+
${t.clientName || a || this.t("sessions")}
|
|
5314
|
+
${t.clientVersion ? r`<span class="muted small">${t.clientVersion}</span>` : n}
|
|
5315
|
+
<span class="session-badges">
|
|
5119
5316
|
${t.current ? r`<span class="badge badge-info">${this.t("currentSession")}</span>` : n}
|
|
5317
|
+
${s ? r`<span
|
|
5318
|
+
class="badge badge-info"
|
|
5319
|
+
title=${this.t("sessionMfaFactors", { factors: t.factors.join(", ") })}
|
|
5320
|
+
>${o.shield} ${this.t("mfaBadge")}</span
|
|
5321
|
+
>` : n}
|
|
5322
|
+
${c ? r`<span class="badge badge-outline"
|
|
5323
|
+
>${j(a)} ${N(a)}</span
|
|
5324
|
+
>` : n}
|
|
5120
5325
|
</span>
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5326
|
+
</span>
|
|
5327
|
+
<span class="row-sub row-sub-meta">
|
|
5328
|
+
${t.osName ? r`<span>${t.osName}</span>` : n}
|
|
5329
|
+
${v ? r`<span
|
|
5330
|
+
>${i ? r`<img class="flag" src=${i} alt="" />` : n}${v}</span
|
|
5331
|
+
>` : n}
|
|
5332
|
+
${t.ip ? r`<span>${t.ip}</span>` : n}
|
|
5333
|
+
</span>
|
|
5334
|
+
${d || m ? r`<span class="session-dates"
|
|
5335
|
+
>${d ? this.t("sessionCreated", { date: d }) : n}${d && m ? " · " : ""}${m ? this.t("sessionExpires", { date: m }) : n}</span
|
|
5336
|
+
>` : n}
|
|
5125
5337
|
</div>
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
</
|
|
5137
|
-
</div
|
|
5138
|
-
|
|
5338
|
+
</div>
|
|
5339
|
+
<div class="row-actions">
|
|
5340
|
+
${this.busy === `session-${t.$id}` ? r`<span class="spinner"></span>` : n}
|
|
5341
|
+
<button
|
|
5342
|
+
class="btn btn-ghost btn-sm"
|
|
5343
|
+
@click=${() => this.onDeleteSession(t.$id)}
|
|
5344
|
+
?disabled=${!!this.busy}
|
|
5345
|
+
aria-label=${this.t("signOutSession")}
|
|
5346
|
+
>
|
|
5347
|
+
${o.logOut}
|
|
5348
|
+
</button>
|
|
5349
|
+
</div>
|
|
5350
|
+
</div>`;
|
|
5351
|
+
})}`
|
|
5139
5352
|
)}
|
|
5140
5353
|
${this.card(
|
|
5141
5354
|
this.t("signOutAllSessions"),
|
|
@@ -5179,7 +5392,7 @@ let p = class extends E {
|
|
|
5179
5392
|
<div class="inline">
|
|
5180
5393
|
<span class="device">${j(i.provider)}</span>
|
|
5181
5394
|
<div class="row-main">
|
|
5182
|
-
<span class="row-title">${
|
|
5395
|
+
<span class="row-title">${N(i.provider)}</span>
|
|
5183
5396
|
<span class="row-sub">${i.providerEmail || i.providerUid}</span>
|
|
5184
5397
|
</div>
|
|
5185
5398
|
</div>
|
|
@@ -5223,7 +5436,7 @@ let p = class extends E {
|
|
|
5223
5436
|
?disabled=${!!this.busy}
|
|
5224
5437
|
>
|
|
5225
5438
|
${this.spinner(`connect-${i}`)} ${j(i)}
|
|
5226
|
-
${this.t("connectProvider", { provider:
|
|
5439
|
+
${this.t("connectProvider", { provider: N(i) })}
|
|
5227
5440
|
</button>`
|
|
5228
5441
|
)}` : void 0
|
|
5229
5442
|
)}
|
|
@@ -5255,9 +5468,9 @@ let p = class extends E {
|
|
|
5255
5468
|
</div>`;
|
|
5256
5469
|
}
|
|
5257
5470
|
};
|
|
5258
|
-
|
|
5259
|
-
...
|
|
5260
|
-
|
|
5471
|
+
f.styles = [
|
|
5472
|
+
...M.styles,
|
|
5473
|
+
D`
|
|
5261
5474
|
:host {
|
|
5262
5475
|
display: block;
|
|
5263
5476
|
width: 100%;
|
|
@@ -5329,6 +5542,7 @@ p.styles = [
|
|
|
5329
5542
|
gap: 16px;
|
|
5330
5543
|
}
|
|
5331
5544
|
.device {
|
|
5545
|
+
position: relative;
|
|
5332
5546
|
width: 36px;
|
|
5333
5547
|
height: 36px;
|
|
5334
5548
|
border-radius: var(--authui-radius-md);
|
|
@@ -5338,11 +5552,79 @@ p.styles = [
|
|
|
5338
5552
|
align-items: center;
|
|
5339
5553
|
justify-content: center;
|
|
5340
5554
|
flex-shrink: 0;
|
|
5555
|
+
overflow: visible;
|
|
5556
|
+
box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--authui-border) 70%, transparent);
|
|
5341
5557
|
}
|
|
5342
5558
|
.device svg {
|
|
5343
5559
|
width: 18px;
|
|
5344
5560
|
height: 18px;
|
|
5345
5561
|
}
|
|
5562
|
+
.device-img {
|
|
5563
|
+
width: 36px;
|
|
5564
|
+
height: 36px;
|
|
5565
|
+
object-fit: contain;
|
|
5566
|
+
padding: 4px;
|
|
5567
|
+
border-radius: var(--authui-radius-md);
|
|
5568
|
+
display: block;
|
|
5569
|
+
}
|
|
5570
|
+
.device-badge {
|
|
5571
|
+
position: absolute;
|
|
5572
|
+
inset-inline-end: -3px;
|
|
5573
|
+
bottom: -3px;
|
|
5574
|
+
width: 16px;
|
|
5575
|
+
height: 16px;
|
|
5576
|
+
border-radius: 999px;
|
|
5577
|
+
background: var(--authui-card);
|
|
5578
|
+
color: var(--authui-muted-foreground);
|
|
5579
|
+
box-shadow: 0 0 0 2px var(--authui-card);
|
|
5580
|
+
display: inline-flex;
|
|
5581
|
+
align-items: center;
|
|
5582
|
+
justify-content: center;
|
|
5583
|
+
}
|
|
5584
|
+
.device-badge svg {
|
|
5585
|
+
width: 10px;
|
|
5586
|
+
height: 10px;
|
|
5587
|
+
}
|
|
5588
|
+
.flag {
|
|
5589
|
+
width: 14px;
|
|
5590
|
+
height: 14px;
|
|
5591
|
+
border-radius: 2px;
|
|
5592
|
+
object-fit: cover;
|
|
5593
|
+
box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--authui-border) 50%, transparent);
|
|
5594
|
+
flex-shrink: 0;
|
|
5595
|
+
vertical-align: middle;
|
|
5596
|
+
}
|
|
5597
|
+
.row-sub-meta {
|
|
5598
|
+
display: flex;
|
|
5599
|
+
flex-wrap: wrap;
|
|
5600
|
+
align-items: center;
|
|
5601
|
+
gap: 6px;
|
|
5602
|
+
}
|
|
5603
|
+
.row-sub-meta .flag {
|
|
5604
|
+
margin-inline-end: 2px;
|
|
5605
|
+
}
|
|
5606
|
+
.session-badges {
|
|
5607
|
+
display: inline-flex;
|
|
5608
|
+
flex-wrap: wrap;
|
|
5609
|
+
gap: 4px;
|
|
5610
|
+
align-items: center;
|
|
5611
|
+
}
|
|
5612
|
+
.session-badges .badge {
|
|
5613
|
+
font-size: 10px;
|
|
5614
|
+
padding: 0 6px;
|
|
5615
|
+
height: 18px;
|
|
5616
|
+
gap: 3px;
|
|
5617
|
+
}
|
|
5618
|
+
.session-badges .badge svg {
|
|
5619
|
+
width: 10px;
|
|
5620
|
+
height: 10px;
|
|
5621
|
+
}
|
|
5622
|
+
.session-dates {
|
|
5623
|
+
display: block;
|
|
5624
|
+
font-size: 11px;
|
|
5625
|
+
color: var(--authui-muted-foreground);
|
|
5626
|
+
margin-top: 2px;
|
|
5627
|
+
}
|
|
5346
5628
|
.log-time {
|
|
5347
5629
|
font-size: 12px;
|
|
5348
5630
|
color: var(--authui-muted-foreground);
|
|
@@ -5353,129 +5635,132 @@ p.styles = [
|
|
|
5353
5635
|
}
|
|
5354
5636
|
`
|
|
5355
5637
|
];
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
],
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
],
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
],
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
],
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
],
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
],
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
],
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
],
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
],
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
],
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
],
|
|
5389
|
-
|
|
5390
|
-
|
|
5391
|
-
],
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
],
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
],
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
],
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
],
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
],
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
],
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
],
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
],
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
],
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
],
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
],
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
],
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
],
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
],
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
],
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
],
|
|
5440
|
-
|
|
5441
|
-
|
|
5442
|
-
],
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
],
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
],
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
],
|
|
5452
|
-
|
|
5453
|
-
|
|
5454
|
-
],
|
|
5455
|
-
|
|
5456
|
-
|
|
5457
|
-
],
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
],
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
],
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
],
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
],
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
],
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5638
|
+
g([
|
|
5639
|
+
b({ type: Boolean })
|
|
5640
|
+
], f.prototype, "embedded", 2);
|
|
5641
|
+
g([
|
|
5642
|
+
b({ type: String })
|
|
5643
|
+
], f.prototype, "tab", 2);
|
|
5644
|
+
g([
|
|
5645
|
+
h()
|
|
5646
|
+
], f.prototype, "active", 2);
|
|
5647
|
+
g([
|
|
5648
|
+
h()
|
|
5649
|
+
], f.prototype, "busy", 2);
|
|
5650
|
+
g([
|
|
5651
|
+
h()
|
|
5652
|
+
], f.prototype, "notice", 2);
|
|
5653
|
+
g([
|
|
5654
|
+
h()
|
|
5655
|
+
], f.prototype, "errors", 2);
|
|
5656
|
+
g([
|
|
5657
|
+
h()
|
|
5658
|
+
], f.prototype, "nameInput", 2);
|
|
5659
|
+
g([
|
|
5660
|
+
h()
|
|
5661
|
+
], f.prototype, "emailInput", 2);
|
|
5662
|
+
g([
|
|
5663
|
+
h()
|
|
5664
|
+
], f.prototype, "emailPassword", 2);
|
|
5665
|
+
g([
|
|
5666
|
+
h()
|
|
5667
|
+
], f.prototype, "phoneInput", 2);
|
|
5668
|
+
g([
|
|
5669
|
+
h()
|
|
5670
|
+
], f.prototype, "phonePassword", 2);
|
|
5671
|
+
g([
|
|
5672
|
+
h()
|
|
5673
|
+
], f.prototype, "phoneCode", 2);
|
|
5674
|
+
g([
|
|
5675
|
+
h()
|
|
5676
|
+
], f.prototype, "phoneCodeSent", 2);
|
|
5677
|
+
g([
|
|
5678
|
+
h()
|
|
5679
|
+
], f.prototype, "guestName", 2);
|
|
5680
|
+
g([
|
|
5681
|
+
h()
|
|
5682
|
+
], f.prototype, "oldPassword", 2);
|
|
5683
|
+
g([
|
|
5684
|
+
h()
|
|
5685
|
+
], f.prototype, "newPassword", 2);
|
|
5686
|
+
g([
|
|
5687
|
+
h()
|
|
5688
|
+
], f.prototype, "newPasswordConfirm", 2);
|
|
5689
|
+
g([
|
|
5690
|
+
h()
|
|
5691
|
+
], f.prototype, "showOldPassword", 2);
|
|
5692
|
+
g([
|
|
5693
|
+
h()
|
|
5694
|
+
], f.prototype, "showNewPassword", 2);
|
|
5695
|
+
g([
|
|
5696
|
+
h()
|
|
5697
|
+
], f.prototype, "showNewPasswordConfirm", 2);
|
|
5698
|
+
g([
|
|
5699
|
+
h()
|
|
5700
|
+
], f.prototype, "authenticator", 2);
|
|
5701
|
+
g([
|
|
5702
|
+
h()
|
|
5703
|
+
], f.prototype, "authenticatorCode", 2);
|
|
5704
|
+
g([
|
|
5705
|
+
h()
|
|
5706
|
+
], f.prototype, "factors", 2);
|
|
5707
|
+
g([
|
|
5708
|
+
h()
|
|
5709
|
+
], f.prototype, "recoveryCodes", 2);
|
|
5710
|
+
g([
|
|
5711
|
+
h()
|
|
5712
|
+
], f.prototype, "stepUp", 2);
|
|
5713
|
+
g([
|
|
5714
|
+
h()
|
|
5715
|
+
], f.prototype, "stepUpCode", 2);
|
|
5716
|
+
g([
|
|
5717
|
+
h()
|
|
5718
|
+
], f.prototype, "copied", 2);
|
|
5719
|
+
g([
|
|
5720
|
+
h()
|
|
5721
|
+
], f.prototype, "sessions", 2);
|
|
5722
|
+
g([
|
|
5723
|
+
h()
|
|
5724
|
+
], f.prototype, "browserIconFailed", 2);
|
|
5725
|
+
g([
|
|
5726
|
+
h()
|
|
5727
|
+
], f.prototype, "identities", 2);
|
|
5728
|
+
g([
|
|
5729
|
+
h()
|
|
5730
|
+
], f.prototype, "logs", 2);
|
|
5731
|
+
g([
|
|
5732
|
+
h()
|
|
5733
|
+
], f.prototype, "logsSupported", 2);
|
|
5734
|
+
g([
|
|
5735
|
+
h()
|
|
5736
|
+
], f.prototype, "confirmDelete", 2);
|
|
5737
|
+
g([
|
|
5738
|
+
h()
|
|
5739
|
+
], f.prototype, "confirmRegenerate", 2);
|
|
5740
|
+
g([
|
|
5741
|
+
h()
|
|
5742
|
+
], f.prototype, "confirmRemoveAuthenticator", 2);
|
|
5743
|
+
g([
|
|
5744
|
+
h()
|
|
5745
|
+
], f.prototype, "confirmSignOutAll", 2);
|
|
5746
|
+
g([
|
|
5747
|
+
h()
|
|
5748
|
+
], f.prototype, "confirmDisconnectId", 2);
|
|
5749
|
+
g([
|
|
5750
|
+
h()
|
|
5751
|
+
], f.prototype, "verifyEmailCooldownUntil", 2);
|
|
5752
|
+
g([
|
|
5753
|
+
h()
|
|
5754
|
+
], f.prototype, "verifyPhoneCooldownUntil", 2);
|
|
5755
|
+
f = g([
|
|
5756
|
+
z("authui-account")
|
|
5757
|
+
], f);
|
|
5758
|
+
var oe = Object.defineProperty, le = Object.getOwnPropertyDescriptor, L = (e, t, i, s) => {
|
|
5759
|
+
for (var a = s > 1 ? void 0 : s ? le(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
5760
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5761
|
+
return s && a && oe(t, i, a), a;
|
|
5477
5762
|
};
|
|
5478
|
-
let
|
|
5763
|
+
let E = class extends M {
|
|
5479
5764
|
constructor() {
|
|
5480
5765
|
super(...arguments), this.open = !1, this.view = "sign-in", this.closeOnSuccess = !0, this.handledPending = null, this.scrollCue = !1, this.bodyResizeObserver = null, this.onOpenEvent = (e) => {
|
|
5481
5766
|
const t = e.detail ?? {};
|
|
@@ -5571,9 +5856,9 @@ let I = class extends E {
|
|
|
5571
5856
|
`;
|
|
5572
5857
|
}
|
|
5573
5858
|
};
|
|
5574
|
-
|
|
5575
|
-
...
|
|
5576
|
-
|
|
5859
|
+
E.styles = [
|
|
5860
|
+
...M.styles,
|
|
5861
|
+
D`
|
|
5577
5862
|
:host {
|
|
5578
5863
|
display: contents;
|
|
5579
5864
|
}
|
|
@@ -5668,13 +5953,13 @@ I.styles = [
|
|
|
5668
5953
|
`
|
|
5669
5954
|
];
|
|
5670
5955
|
L([
|
|
5671
|
-
|
|
5672
|
-
],
|
|
5956
|
+
b({ type: Boolean, reflect: !0 })
|
|
5957
|
+
], E.prototype, "open", 2);
|
|
5673
5958
|
L([
|
|
5674
|
-
|
|
5675
|
-
],
|
|
5959
|
+
b({ type: String })
|
|
5960
|
+
], E.prototype, "view", 2);
|
|
5676
5961
|
L([
|
|
5677
|
-
|
|
5962
|
+
b({
|
|
5678
5963
|
attribute: "close-on-success",
|
|
5679
5964
|
reflect: !0,
|
|
5680
5965
|
converter: {
|
|
@@ -5688,28 +5973,28 @@ L([
|
|
|
5688
5973
|
}
|
|
5689
5974
|
}
|
|
5690
5975
|
})
|
|
5691
|
-
],
|
|
5976
|
+
], E.prototype, "closeOnSuccess", 2);
|
|
5692
5977
|
L([
|
|
5693
|
-
|
|
5694
|
-
],
|
|
5978
|
+
h()
|
|
5979
|
+
], E.prototype, "handledPending", 2);
|
|
5695
5980
|
L([
|
|
5696
|
-
|
|
5697
|
-
],
|
|
5981
|
+
h()
|
|
5982
|
+
], E.prototype, "scrollCue", 2);
|
|
5698
5983
|
L([
|
|
5699
|
-
|
|
5700
|
-
],
|
|
5984
|
+
ct("dialog")
|
|
5985
|
+
], E.prototype, "dialog", 2);
|
|
5701
5986
|
L([
|
|
5702
|
-
|
|
5703
|
-
],
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
],
|
|
5707
|
-
var
|
|
5708
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5709
|
-
(d = e[
|
|
5710
|
-
return s && a &&
|
|
5987
|
+
ct(".body")
|
|
5988
|
+
], E.prototype, "bodyEl", 2);
|
|
5989
|
+
E = L([
|
|
5990
|
+
z("authui-modal")
|
|
5991
|
+
], E);
|
|
5992
|
+
var ce = Object.defineProperty, de = Object.getOwnPropertyDescriptor, st = (e, t, i, s) => {
|
|
5993
|
+
for (var a = s > 1 ? void 0 : s ? de(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
5994
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
5995
|
+
return s && a && ce(t, i, a), a;
|
|
5711
5996
|
};
|
|
5712
|
-
let
|
|
5997
|
+
let H = class extends M {
|
|
5713
5998
|
constructor() {
|
|
5714
5999
|
super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
|
|
5715
6000
|
}
|
|
@@ -5717,7 +6002,7 @@ let N = class extends E {
|
|
|
5717
6002
|
const e = this.size === "md" ? "" : `btn-${this.size}`;
|
|
5718
6003
|
return r`<button
|
|
5719
6004
|
class="btn btn-${this.variant} ${e}"
|
|
5720
|
-
@click=${() =>
|
|
6005
|
+
@click=${() => et(this.view)}
|
|
5721
6006
|
part="button"
|
|
5722
6007
|
>
|
|
5723
6008
|
<slot
|
|
@@ -5726,9 +6011,9 @@ let N = class extends E {
|
|
|
5726
6011
|
</button>`;
|
|
5727
6012
|
}
|
|
5728
6013
|
};
|
|
5729
|
-
|
|
5730
|
-
...
|
|
5731
|
-
|
|
6014
|
+
H.styles = [
|
|
6015
|
+
...M.styles,
|
|
6016
|
+
D`
|
|
5732
6017
|
:host {
|
|
5733
6018
|
display: inline-block;
|
|
5734
6019
|
}
|
|
@@ -5737,24 +6022,24 @@ N.styles = [
|
|
|
5737
6022
|
}
|
|
5738
6023
|
`
|
|
5739
6024
|
];
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
],
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
],
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
],
|
|
5749
|
-
|
|
5750
|
-
|
|
5751
|
-
],
|
|
5752
|
-
var
|
|
5753
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
5754
|
-
(d = e[
|
|
5755
|
-
return s && a &&
|
|
6025
|
+
st([
|
|
6026
|
+
b({ type: String })
|
|
6027
|
+
], H.prototype, "view", 2);
|
|
6028
|
+
st([
|
|
6029
|
+
b({ type: String })
|
|
6030
|
+
], H.prototype, "variant", 2);
|
|
6031
|
+
st([
|
|
6032
|
+
b({ type: String })
|
|
6033
|
+
], H.prototype, "size", 2);
|
|
6034
|
+
H = st([
|
|
6035
|
+
z("authui-button")
|
|
6036
|
+
], H);
|
|
6037
|
+
var he = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, R = (e, t, i, s) => {
|
|
6038
|
+
for (var a = s > 1 ? void 0 : s ? ue(t, i) : t, c = e.length - 1, d; c >= 0; c--)
|
|
6039
|
+
(d = e[c]) && (a = (s ? d(t, i, a) : d(a)) || a);
|
|
6040
|
+
return s && a && he(t, i, a), a;
|
|
5756
6041
|
};
|
|
5757
|
-
let U = class extends
|
|
6042
|
+
let U = class extends M {
|
|
5758
6043
|
constructor() {
|
|
5759
6044
|
super(...arguments), this.showTeams = !1, this.menuItems = [], this.src = "", this.menuOpen = !1, this.menuAbove = !1, this.teams = [], this.teamsLoading = !1, this.activeTeamId = null, this.onReposition = () => {
|
|
5760
6045
|
this.menuOpen && this.placeMenu();
|
|
@@ -5799,10 +6084,10 @@ let U = class extends E {
|
|
|
5799
6084
|
if (!e || !t) return;
|
|
5800
6085
|
const i = e.getBoundingClientRect(), s = 6, a = 8;
|
|
5801
6086
|
t.style.maxHeight = "";
|
|
5802
|
-
const
|
|
5803
|
-
|
|
5804
|
-
const
|
|
5805
|
-
t.style.maxHeight = `${
|
|
6087
|
+
const c = t.offsetHeight + s, d = window.innerHeight - i.bottom, m = i.top, v = d < c && m > d;
|
|
6088
|
+
v !== this.menuAbove && (this.menuAbove = v);
|
|
6089
|
+
const p = Math.max(80, (v ? m : d) - s - a);
|
|
6090
|
+
t.style.maxHeight = `${p}px`;
|
|
5806
6091
|
}
|
|
5807
6092
|
focusMenuItem(e) {
|
|
5808
6093
|
[
|
|
@@ -5829,7 +6114,7 @@ let U = class extends E {
|
|
|
5829
6114
|
if (e === "loading" && i)
|
|
5830
6115
|
return r`<span class="avatar"><span class="spinner"></span></span>`;
|
|
5831
6116
|
if (e !== "signed-in" || !t)
|
|
5832
|
-
return r`<button class="btn btn-primary btn-sm" @click=${() =>
|
|
6117
|
+
return r`<button class="btn btn-primary btn-sm" @click=${() => et("sign-in")}>
|
|
5833
6118
|
<slot>${this.t("signIn")}</slot>
|
|
5834
6119
|
</button>`;
|
|
5835
6120
|
const s = t.name || t.email || t.phone || this.t("guestAccount");
|
|
@@ -5842,7 +6127,7 @@ let U = class extends E {
|
|
|
5842
6127
|
aria-label=${s}
|
|
5843
6128
|
>
|
|
5844
6129
|
<span class="avatar"
|
|
5845
|
-
>${this.src ? r`<img src=${this.src} alt="" />` :
|
|
6130
|
+
>${this.src ? r`<img src=${this.src} alt="" />` : ut(s)}</span
|
|
5846
6131
|
>
|
|
5847
6132
|
</button>
|
|
5848
6133
|
${this.menuOpen ? r`<div class="menu ${this.menuAbove ? "above" : ""}" role="menu">
|
|
@@ -5873,7 +6158,7 @@ let U = class extends E {
|
|
|
5873
6158
|
class="menu-item"
|
|
5874
6159
|
role="menuitem"
|
|
5875
6160
|
@click=${() => {
|
|
5876
|
-
this.menuOpen = !1,
|
|
6161
|
+
this.menuOpen = !1, et("account");
|
|
5877
6162
|
}}
|
|
5878
6163
|
>
|
|
5879
6164
|
${o.settings} ${this.t("manageAccount")}
|
|
@@ -5928,8 +6213,8 @@ let U = class extends E {
|
|
|
5928
6213
|
}
|
|
5929
6214
|
};
|
|
5930
6215
|
U.styles = [
|
|
5931
|
-
...
|
|
5932
|
-
|
|
6216
|
+
...M.styles,
|
|
6217
|
+
D`
|
|
5933
6218
|
:host {
|
|
5934
6219
|
display: inline-block;
|
|
5935
6220
|
position: relative;
|
|
@@ -6049,63 +6334,63 @@ U.styles = [
|
|
|
6049
6334
|
}
|
|
6050
6335
|
`
|
|
6051
6336
|
];
|
|
6052
|
-
|
|
6053
|
-
|
|
6337
|
+
R([
|
|
6338
|
+
b({ type: Boolean, attribute: "show-teams" })
|
|
6054
6339
|
], U.prototype, "showTeams", 2);
|
|
6055
|
-
|
|
6056
|
-
|
|
6340
|
+
R([
|
|
6341
|
+
b({ attribute: !1 })
|
|
6057
6342
|
], U.prototype, "menuItems", 2);
|
|
6058
|
-
|
|
6059
|
-
|
|
6343
|
+
R([
|
|
6344
|
+
b({ type: String })
|
|
6060
6345
|
], U.prototype, "src", 2);
|
|
6061
|
-
|
|
6062
|
-
|
|
6346
|
+
R([
|
|
6347
|
+
h()
|
|
6063
6348
|
], U.prototype, "menuOpen", 2);
|
|
6064
|
-
|
|
6065
|
-
|
|
6349
|
+
R([
|
|
6350
|
+
h()
|
|
6066
6351
|
], U.prototype, "menuAbove", 2);
|
|
6067
|
-
|
|
6068
|
-
|
|
6352
|
+
R([
|
|
6353
|
+
h()
|
|
6069
6354
|
], U.prototype, "teams", 2);
|
|
6070
|
-
|
|
6071
|
-
|
|
6355
|
+
R([
|
|
6356
|
+
h()
|
|
6072
6357
|
], U.prototype, "teamsLoading", 2);
|
|
6073
|
-
|
|
6074
|
-
|
|
6358
|
+
R([
|
|
6359
|
+
h()
|
|
6075
6360
|
], U.prototype, "activeTeamId", 2);
|
|
6076
|
-
U =
|
|
6077
|
-
|
|
6361
|
+
U = R([
|
|
6362
|
+
z("authui-user-button")
|
|
6078
6363
|
], U);
|
|
6079
6364
|
export {
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6365
|
+
qt as A,
|
|
6366
|
+
ve as C,
|
|
6367
|
+
y as E,
|
|
6368
|
+
kt as F,
|
|
6369
|
+
Tt as P,
|
|
6085
6370
|
l as a,
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6371
|
+
f as b,
|
|
6372
|
+
be as c,
|
|
6373
|
+
H as d,
|
|
6374
|
+
$ as e,
|
|
6375
|
+
M as f,
|
|
6376
|
+
E as g,
|
|
6377
|
+
G as h,
|
|
6378
|
+
x as i,
|
|
6094
6379
|
U as j,
|
|
6095
|
-
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6103
|
-
|
|
6104
|
-
|
|
6105
|
-
|
|
6106
|
-
|
|
6107
|
-
|
|
6108
|
-
|
|
6109
|
-
|
|
6110
|
-
|
|
6380
|
+
ge as k,
|
|
6381
|
+
bt as l,
|
|
6382
|
+
Mt as m,
|
|
6383
|
+
J as n,
|
|
6384
|
+
et as o,
|
|
6385
|
+
q as p,
|
|
6386
|
+
vt as q,
|
|
6387
|
+
Lt as r,
|
|
6388
|
+
N as s,
|
|
6389
|
+
V as t,
|
|
6390
|
+
At as u,
|
|
6391
|
+
lt as v,
|
|
6392
|
+
zt as w,
|
|
6393
|
+
_t as x,
|
|
6394
|
+
B as y,
|
|
6395
|
+
Qt as z
|
|
6111
6396
|
};
|