@getauthui/core 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
- import { state as h, property as g, customElement as O, query as gt } from "lit/decorators.js";
2
- import { css as F, LitElement as it, nothing as o, html as r, svg as d } from "lit";
3
- import { Client as at, Account as nt, Teams as bt, ID as j, Avatars as yt } from "appwrite";
4
- const wt = {
1
+ import { state as h, property as g, customElement as O, query as bt } from "lit/decorators.js";
2
+ import { css as F, LitElement as st, nothing as o, html as r, svg as d } from "lit";
3
+ import { Client as nt, Account as ot, Teams as $t, ID as j, Avatars as xt } from "appwrite";
4
+ const kt = {
5
5
  signIn: "Sign in",
6
6
  dialogSignIn: "Sign in",
7
7
  signUp: "Sign up",
@@ -169,13 +169,13 @@ const wt = {
169
169
  guestAccountDescription: "Add an email and password to keep your data.",
170
170
  preview: "Preview"
171
171
  };
172
- function $t(e, t = {}) {
172
+ function Ct(e, t = {}) {
173
173
  return e.replace(
174
174
  /\{(\w+)\}/g,
175
175
  (i, s) => s in t ? String(t[s]) : `{${s}}`
176
176
  );
177
177
  }
178
- const xt = {
178
+ const St = {
179
179
  amazon: "Amazon",
180
180
  apple: "Apple",
181
181
  appwrite: "Appwrite",
@@ -227,9 +227,9 @@ const xt = {
227
227
  zoom: "Zoom"
228
228
  };
229
229
  function q(e) {
230
- return xt[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
230
+ return St[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
231
231
  }
232
- const H = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), P = () => (/* @__PURE__ */ new Date()).toISOString(), U = (e) => new Date(Date.now() - e * 6e4).toISOString(), W = [
232
+ const H = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), A = () => (/* @__PURE__ */ new Date()).toISOString(), I = (e) => new Date(Date.now() - e * 6e4).toISOString(), W = [
233
233
  "amber",
234
234
  "brave",
235
235
  "calm",
@@ -242,13 +242,13 @@ const H = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }),
242
242
  "juniper",
243
243
  "kite",
244
244
  "lumen"
245
- ], ot = () => `${W[Math.floor(Math.random() * W.length)]}-${W[Math.floor(Math.random() * W.length)]}`, T = () => Math.random().toString(36).slice(2, 12), ct = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), kt = {
245
+ ], ct = () => `${W[Math.floor(Math.random() * W.length)]}-${W[Math.floor(Math.random() * W.length)]}`, T = () => Math.random().toString(36).slice(2, 12), lt = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), At = {
246
246
  name: "Ada Lovelace",
247
247
  email: "ada@example.com",
248
248
  phone: "+15550100"
249
249
  };
250
- class Ct {
251
- constructor(t = kt) {
250
+ class Pt {
251
+ constructor(t = At) {
252
252
  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;
253
253
  }
254
254
  // ───────────────────────── helpers ─────────────────────────
@@ -256,13 +256,13 @@ class Ct {
256
256
  const i = t.anonymous ?? !1;
257
257
  return this.user = {
258
258
  $id: "preview-user",
259
- $createdAt: U(1440 * 30),
260
- $updatedAt: P(),
259
+ $createdAt: I(1440 * 30),
260
+ $updatedAt: A(),
261
261
  name: i ? "" : t.name ?? this.seed.name,
262
- registration: U(1440 * 30),
262
+ registration: I(1440 * 30),
263
263
  status: !0,
264
264
  labels: [],
265
- passwordUpdate: i ? "" : U(1440 * 7),
265
+ passwordUpdate: i ? "" : I(1440 * 7),
266
266
  email: i ? "" : t.email ?? this.seed.email,
267
267
  phone: i ? "" : t.phone ?? this.seed.phone,
268
268
  emailVerification: !i,
@@ -270,14 +270,14 @@ class Ct {
270
270
  mfa: this.mfaEnabled,
271
271
  prefs: {},
272
272
  targets: [],
273
- accessedAt: P()
273
+ accessedAt: A()
274
274
  }, this.seedActivity(i ? "anonymous" : "email"), this.user;
275
275
  }
276
276
  seedActivity(t) {
277
277
  if (this.sessions.length > 0) return;
278
278
  const i = {
279
- $createdAt: P(),
280
- $updatedAt: P(),
279
+ $createdAt: A(),
280
+ $updatedAt: A(),
281
281
  userId: "preview-user",
282
282
  expire: new Date(Date.now() + 365 * 864e5).toISOString(),
283
283
  providerUid: "",
@@ -313,7 +313,7 @@ class Ct {
313
313
  {
314
314
  ...i,
315
315
  $id: T(),
316
- $createdAt: U(300),
316
+ $createdAt: I(300),
317
317
  provider: t,
318
318
  ip: "198.51.100.7",
319
319
  osCode: "IOS",
@@ -330,7 +330,7 @@ class Ct {
330
330
  {
331
331
  ...i,
332
332
  $id: T(),
333
- $createdAt: U(1440 * 3),
333
+ $createdAt: I(1440 * 3),
334
334
  provider: "oauth2",
335
335
  ip: "192.0.2.90",
336
336
  osCode: "WIN",
@@ -345,8 +345,8 @@ class Ct {
345
345
  ], this.identities = [
346
346
  {
347
347
  $id: "identity-github",
348
- $createdAt: U(1440 * 20),
349
- $updatedAt: U(1440 * 20),
348
+ $createdAt: I(1440 * 20),
349
+ $updatedAt: I(1440 * 20),
350
350
  userId: "preview-user",
351
351
  provider: "github",
352
352
  providerUid: "8675309",
@@ -358,7 +358,7 @@ class Ct {
358
358
  ], this.logs = [
359
359
  {
360
360
  event: "session.create",
361
- time: P(),
361
+ time: A(),
362
362
  clientName: "Chrome",
363
363
  osName: "macOS",
364
364
  countryName: "Germany",
@@ -366,7 +366,7 @@ class Ct {
366
366
  },
367
367
  {
368
368
  event: "user.update.name",
369
- time: U(1440 * 2),
369
+ time: I(1440 * 2),
370
370
  clientName: "Safari",
371
371
  osName: "iOS",
372
372
  countryName: "Germany",
@@ -374,7 +374,7 @@ class Ct {
374
374
  },
375
375
  {
376
376
  event: "session.create",
377
- time: U(1440 * 3),
377
+ time: I(1440 * 3),
378
378
  clientName: "Firefox",
379
379
  osName: "Windows",
380
380
  countryName: "United States",
@@ -431,25 +431,25 @@ class Ct {
431
431
  async createMagicURLToken(t, i) {
432
432
  return this.tokens.set(t, { email: i }), this.delay({
433
433
  $id: T(),
434
- $createdAt: P(),
434
+ $createdAt: A(),
435
435
  userId: t,
436
436
  secret: "",
437
437
  expire: "",
438
- phrase: ot()
438
+ phrase: ct()
439
439
  });
440
440
  }
441
441
  async createEmailToken(t, i) {
442
442
  return this.tokens.set(t, { email: i }), this.delay({
443
443
  $id: T(),
444
- $createdAt: P(),
444
+ $createdAt: A(),
445
445
  userId: t,
446
446
  secret: "",
447
447
  expire: "",
448
- phrase: ot()
448
+ phrase: ct()
449
449
  });
450
450
  }
451
451
  async createPhoneToken(t, i) {
452
- return this.tokens.set(t, { phone: i }), this.delay({ $id: T(), $createdAt: P(), userId: t, secret: "", expire: "", phrase: "" });
452
+ return this.tokens.set(t, { phone: i }), this.delay({ $id: T(), $createdAt: A(), userId: t, secret: "", expire: "", phrase: "" });
453
453
  }
454
454
  async createSession(t) {
455
455
  return this.delay(() => {
@@ -490,7 +490,7 @@ class Ct {
490
490
  async updateEmail(t) {
491
491
  return this.delay(() => {
492
492
  const i = this.requireUser();
493
- return i.email = t, i.emailVerification = !1, i.passwordUpdate = P(), i;
493
+ return i.email = t, i.emailVerification = !1, i.passwordUpdate = A(), i;
494
494
  });
495
495
  }
496
496
  async updatePhone(t) {
@@ -502,7 +502,7 @@ class Ct {
502
502
  async updatePassword() {
503
503
  return this.delay(() => {
504
504
  const t = this.requireUser();
505
- return t.passwordUpdate = P(), t;
505
+ return t.passwordUpdate = A(), t;
506
506
  });
507
507
  }
508
508
  async updateStatus() {
@@ -541,7 +541,7 @@ class Ct {
541
541
  });
542
542
  }
543
543
  async createMFAChallenge() {
544
- return this.delay({ $id: T(), $createdAt: P(), userId: "preview-user", expire: "" });
544
+ return this.delay({ $id: T(), $createdAt: A(), userId: "preview-user", expire: "" });
545
545
  }
546
546
  async updateMFAChallenge() {
547
547
  return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
@@ -571,21 +571,21 @@ class Ct {
571
571
  return this.delay(() => {
572
572
  if (this.recoveryCodes.length > 0)
573
573
  throw H("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
574
- return this.recoveryCodes = Array.from({ length: 6 }, ct), { recoveryCodes: this.recoveryCodes };
574
+ return this.recoveryCodes = Array.from({ length: 6 }, lt), { recoveryCodes: this.recoveryCodes };
575
575
  });
576
576
  }
577
577
  async getMFARecoveryCodes() {
578
578
  return this.delay(() => (this.requireRecentChallenge(), { recoveryCodes: this.recoveryCodes }));
579
579
  }
580
580
  async updateMFARecoveryCodes() {
581
- return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, ct), { recoveryCodes: this.recoveryCodes }));
581
+ return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, lt), { recoveryCodes: this.recoveryCodes }));
582
582
  }
583
583
  /** Forget everything, as a sign out would. */
584
584
  reset() {
585
585
  this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
586
586
  }
587
587
  }
588
- function St(e) {
588
+ function It(e) {
589
589
  let t = 2166136261;
590
590
  const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
591
591
  for (const x of e) t = (t ^ x.charCodeAt(0)) * 16777619;
@@ -691,23 +691,73 @@ function K(e, t, i = "link") {
691
691
  }
692
692
  return s.type === f.projectNotFound || s.type === f.unknownOrigin ? t.errorConfig : s.type === f.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 === f.routeNotFound ? t.errorConfigEndpoint : t.errorGeneric;
693
693
  }
694
- function Pt(e) {
694
+ function Ut(e) {
695
695
  const t = R(e);
696
696
  return !!(t.type === f.projectNotFound || t.type === f.unknownOrigin || t.type === f.routeNotFound || !t.message && t.code === 404 || t.code === 0 && /fetch|network|load failed|failed to fetch/i.test(t.message));
697
697
  }
698
- const Q = (e) => `authui:active-team:${e}`;
699
- function lt(e) {
698
+ const J = (e) => `authui:active-team:${e}`;
699
+ function dt(e) {
700
700
  if (typeof localStorage > "u" || !e) return null;
701
701
  try {
702
- return localStorage.getItem(Q(e));
702
+ return localStorage.getItem(J(e));
703
703
  } catch {
704
704
  return null;
705
705
  }
706
706
  }
707
- function At(e, t) {
707
+ function Et(e, t) {
708
708
  if (!(typeof localStorage > "u" || !e))
709
709
  try {
710
- t ? localStorage.setItem(Q(e), t) : localStorage.removeItem(Q(e));
710
+ t ? localStorage.setItem(J(e), t) : localStorage.removeItem(J(e));
711
+ } catch {
712
+ }
713
+ }
714
+ const rt = "authui:last-method";
715
+ function V(e) {
716
+ if (!(typeof localStorage > "u")) {
717
+ if (!e || e === "mfa" || e === "sign-up")
718
+ if (e === "sign-up") e = "email-password";
719
+ else return;
720
+ try {
721
+ localStorage.setItem(rt, e);
722
+ } catch {
723
+ }
724
+ }
725
+ }
726
+ function D() {
727
+ if (typeof localStorage > "u") return null;
728
+ try {
729
+ return localStorage.getItem(rt);
730
+ } catch {
731
+ return null;
732
+ }
733
+ }
734
+ function ne() {
735
+ if (!(typeof localStorage > "u"))
736
+ try {
737
+ localStorage.removeItem(rt);
738
+ } catch {
739
+ }
740
+ }
741
+ const G = "authui:pending-oauth";
742
+ function Mt(e) {
743
+ if (!(typeof sessionStorage > "u"))
744
+ try {
745
+ sessionStorage.setItem(G, e);
746
+ } catch {
747
+ }
748
+ }
749
+ function yt() {
750
+ if (!(typeof sessionStorage > "u"))
751
+ try {
752
+ const e = sessionStorage.getItem(G);
753
+ sessionStorage.removeItem(G), e && V(`oauth:${e}`);
754
+ } catch {
755
+ }
756
+ }
757
+ function ht() {
758
+ if (!(typeof sessionStorage > "u"))
759
+ try {
760
+ sessionStorage.removeItem(G);
711
761
  } catch {
712
762
  }
713
763
  }
@@ -721,7 +771,7 @@ function S(e, t, i) {
721
771
  new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
722
772
  );
723
773
  }
724
- const J = "authui", dt = ["userId", "secret", "expire", "project", "error", J], ht = () => ({
774
+ const tt = "authui", ut = ["userId", "secret", "expire", "project", "error", tt], pt = () => ({
725
775
  status: "loading",
726
776
  user: null,
727
777
  mfaFactors: null,
@@ -729,9 +779,9 @@ const J = "authui", dt = ["userId", "secret", "expire", "project", "error", J],
729
779
  configured: !1,
730
780
  configError: null
731
781
  });
732
- class Ut {
782
+ class Ft {
733
783
  constructor() {
734
- this.client = null, this.account = null, this.config = null, this.state = ht(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null, this.teams = null, this.activeTeamId = null;
784
+ this.client = null, this.account = null, this.config = null, this.state = pt(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null, this.teams = null, this.activeTeamId = null;
735
785
  }
736
786
  // ───────────────────────────── configuration ─────────────────────────────
737
787
  /** Configure the Appwrite client. Safe to call more than once; the last call wins. */
@@ -739,7 +789,7 @@ class Ut {
739
789
  const i = t.endpoint.trim().replace(/\/+$/, "");
740
790
  i && !i.endsWith("/v1") && console.warn(
741
791
  `[authui] endpoint should end with /v1 (got "${t.endpoint}"). Without it Appwrite returns HTML 404 pages.`
742
- ), this.config = t, this.client = new at().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new Ct() : null, this.account = this.preview ? this.preview : new nt(this.client), this.teams = null, this.activeTeamId = lt(t.project), this.setState({ configured: !0, status: "loading", configError: null }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
792
+ ), this.config = t, this.client = new nt().setEndpoint(t.endpoint).setProject(t.project), this.preview = t.preview ? new Pt() : null, this.account = this.preview ? this.preview : new ot(this.client), this.teams = null, this.activeTeamId = dt(t.project), this.setState({ configured: !0, status: "loading", configError: null }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
743
793
  }
744
794
  /**
745
795
  * Called by <authui-config> when it is on the page but missing endpoint or project.
@@ -785,7 +835,7 @@ class Ut {
785
835
  /** List teams the signed-in user belongs to. Empty in preview or when signed out. */
786
836
  async listTeams() {
787
837
  if (this.preview || !this.client || this.state.status !== "signed-in") return [];
788
- this.teams ??= new bt(this.client);
838
+ this.teams ??= new $t(this.client);
789
839
  try {
790
840
  return (await this.teams.list()).teams ?? [];
791
841
  } catch (t) {
@@ -795,7 +845,7 @@ class Ut {
795
845
  getActiveTeamId() {
796
846
  if (this.activeTeamId) return this.activeTeamId;
797
847
  const t = this.config?.project;
798
- return t ? (this.activeTeamId = lt(t), this.activeTeamId) : null;
848
+ return t ? (this.activeTeamId = dt(t), this.activeTeamId) : null;
799
849
  }
800
850
  /**
801
851
  * Remember the active team locally and emit `active-team`.
@@ -803,10 +853,10 @@ class Ut {
803
853
  */
804
854
  setActiveTeam(t) {
805
855
  const i = this.config?.project;
806
- i && At(i, t?.$id ?? null), this.activeTeamId = t?.$id ?? null, this.emit("active-team", { teamId: this.activeTeamId, team: t });
856
+ i && Et(i, t?.$id ?? null), this.activeTeamId = t?.$id ?? null, this.emit("active-team", { teamId: this.activeTeamId, team: t });
807
857
  }
808
858
  getStrings() {
809
- return { ...wt, ...this.config?.strings ?? {} };
859
+ return { ...kt, ...this.config?.strings ?? {} };
810
860
  }
811
861
  getState() {
812
862
  return { ...this.state };
@@ -874,7 +924,7 @@ class Ut {
874
924
  message: this.getStrings().errorUserBlocked
875
925
  }
876
926
  }), t && this.emit("signed-out", void 0);
877
- else if (!t && Pt(i)) {
927
+ else if (!t && Ut(i)) {
878
928
  const a = K(i, this.getStrings()) || this.getStrings().errorConfig;
879
929
  console.warn(
880
930
  `[authui] ${a} (endpoint=${this.config?.endpoint ?? "?"}, project=${this.config?.project ?? "?"})`
@@ -924,7 +974,7 @@ class Ut {
924
974
  localStorage.removeItem("cookieFallback");
925
975
  } catch {
926
976
  }
927
- this.config && !this.preview && (this.client = new at().setEndpoint(this.config.endpoint).setProject(this.config.project), this.account = new nt(this.client));
977
+ this.config && !this.preview && (this.client = new nt().setEndpoint(this.config.endpoint).setProject(this.config.project), this.account = new ot(this.client));
928
978
  }
929
979
  // ─────────────────────────────── sign in ───────────────────────────────
930
980
  async signInWithEmailPassword(t, i) {
@@ -1276,8 +1326,8 @@ class Ut {
1276
1326
  /** Build the URL Appwrite should send the user back to for a given flow. */
1277
1327
  redirectUrl(t) {
1278
1328
  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);
1279
- for (const a of dt) s.searchParams.delete(a);
1280
- return s.searchParams.set(J, t), s.toString();
1329
+ for (const a of ut) s.searchParams.delete(a);
1330
+ return s.searchParams.set(tt, t), s.toString();
1281
1331
  }
1282
1332
  setPending(t) {
1283
1333
  this.setState({ pending: t });
@@ -1288,7 +1338,7 @@ class Ut {
1288
1338
  */
1289
1339
  async handleRedirect() {
1290
1340
  if (typeof window > "u") return !1;
1291
- const t = new URLSearchParams(window.location.search), i = t.get(J);
1341
+ const t = new URLSearchParams(window.location.search), i = t.get(tt);
1292
1342
  if (!i) return !1;
1293
1343
  const s = t.get("userId") ?? "", a = t.get("secret") ?? "";
1294
1344
  this.cleanUrl();
@@ -1305,10 +1355,16 @@ class Ut {
1305
1355
  switch (i) {
1306
1356
  case "oauth":
1307
1357
  case "magic-url":
1308
- s && a ? await this.acct().createSession(s, a) : l();
1358
+ s && a ? (await this.acct().createSession(s, a), i === "oauth" && yt()) : (i === "oauth" && ht(), l());
1309
1359
  break;
1310
1360
  case "oauth-failed":
1311
- this.setState({ pending: { type: "oauth-failed" } });
1361
+ ht(), this.setState({
1362
+ pending: {
1363
+ type: "notice",
1364
+ tone: "error",
1365
+ message: this.getStrings().errorOAuth
1366
+ }
1367
+ });
1312
1368
  break;
1313
1369
  case "recovery":
1314
1370
  s && a ? this.setState({ pending: { type: "reset-password", userId: s, secret: a } }) : l();
@@ -1335,16 +1391,16 @@ class Ut {
1335
1391
  }
1336
1392
  cleanUrl() {
1337
1393
  const t = new URL(window.location.href);
1338
- for (const i of dt) t.searchParams.delete(i);
1394
+ for (const i of ut) t.searchParams.delete(i);
1339
1395
  window.history.replaceState(window.history.state, "", t.toString());
1340
1396
  }
1341
1397
  /** Test helper. */
1342
1398
  reset() {
1343
- this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state = ht(), this.listeners.clear();
1399
+ this.client = null, this.account = null, this.teams = null, this.activeTeamId = null, this.preview = null, this.config = null, this.state = pt(), this.listeners.clear();
1344
1400
  }
1345
1401
  }
1346
- const n = new Ut();
1347
- class It {
1402
+ const n = new Ft();
1403
+ class Ot {
1348
1404
  constructor() {
1349
1405
  this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
1350
1406
  const t = this.isDark("auto");
@@ -1372,14 +1428,14 @@ class It {
1372
1428
  this.observer?.disconnect(), this.observer = null, this.media?.removeEventListener?.("change", this.notify), this.media = null;
1373
1429
  }
1374
1430
  }
1375
- const ut = new It(), pt = {
1431
+ const mt = new Ot(), ft = {
1376
1432
  none: "0px",
1377
1433
  sm: "0.25rem",
1378
1434
  md: "0.625rem",
1379
1435
  lg: "0.875rem",
1380
1436
  xl: "1.125rem",
1381
1437
  full: "1.5rem"
1382
- }, Et = F`
1438
+ }, _t = F`
1383
1439
  :host {
1384
1440
  /* Light theme (matches :root in the console) */
1385
1441
  --authui-background: oklch(1 0 0);
@@ -1457,7 +1513,7 @@ const ut = new It(), pt = {
1457
1513
  --authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
1458
1514
  color-scheme: dark;
1459
1515
  }
1460
- `, Mt = F`
1516
+ `, Tt = F`
1461
1517
  *,
1462
1518
  *::before,
1463
1519
  *::after {
@@ -2262,25 +2318,25 @@ const ut = new It(), pt = {
2262
2318
  }
2263
2319
  }
2264
2320
  `;
2265
- var Ft = Object.defineProperty, Ot = (e, t, i, s) => {
2321
+ var Dt = Object.defineProperty, Rt = (e, t, i, s) => {
2266
2322
  for (var a = void 0, l = e.length - 1, u; l >= 0; l--)
2267
2323
  (u = e[l]) && (a = u(t, i, a) || a);
2268
- return a && Ft(t, i, a), a;
2269
- }, I;
2270
- const vt = (I = class extends it {
2324
+ return a && Dt(t, i, a), a;
2325
+ }, U;
2326
+ const wt = (U = class extends st {
2271
2327
  constructor() {
2272
2328
  super(...arguments), this.auth = n.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null, this.stopKeys = (t) => t.stopPropagation();
2273
2329
  }
2274
2330
  connectedCallback() {
2275
2331
  super.connectedCallback();
2276
- for (const t of I.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
2332
+ for (const t of U.KEY_EVENTS) this.addEventListener(t, this.stopKeys);
2277
2333
  this.auth = n.getState(), this.unsubscribeStore = n.on("change", (t) => {
2278
2334
  this.auth = t, this.applyBranding();
2279
- }), this.unsubscribeTheme = ut.subscribe(() => this.applyBranding()), this.applyBranding();
2335
+ }), this.unsubscribeTheme = mt.subscribe(() => this.applyBranding()), this.applyBranding();
2280
2336
  }
2281
2337
  disconnectedCallback() {
2282
2338
  super.disconnectedCallback();
2283
- for (const t of I.KEY_EVENTS) this.removeEventListener(t, this.stopKeys);
2339
+ for (const t of U.KEY_EVENTS) this.removeEventListener(t, this.stopKeys);
2284
2340
  this.unsubscribeStore?.(), this.unsubscribeTheme?.(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
2285
2341
  }
2286
2342
  get strings() {
@@ -2288,7 +2344,7 @@ const vt = (I = class extends it {
2288
2344
  }
2289
2345
  /** Translate a string key with optional `{placeholders}`. */
2290
2346
  t(t, i) {
2291
- return $t(this.strings[t], i);
2347
+ return Ct(this.strings[t], i);
2292
2348
  }
2293
2349
  get config() {
2294
2350
  return n.getConfig();
@@ -2298,27 +2354,27 @@ const vt = (I = class extends it {
2298
2354
  }
2299
2355
  /** Push theme and branding from config onto the host element. */
2300
2356
  applyBranding() {
2301
- const t = this.config?.branding, i = ut.isDark(t?.theme ?? "auto");
2357
+ const t = this.config?.branding, i = mt.isDark(t?.theme ?? "auto");
2302
2358
  this.setAttribute("data-theme", i ? "dark" : "light"), t?.primary && (this.style.setProperty("--authui-primary", t.primary), this.style.setProperty(
2303
2359
  "--authui-primary-foreground",
2304
2360
  t.primaryForeground ?? "#ffffff"
2305
- )), t?.radius && pt[t.radius] && this.style.setProperty("--authui-radius", pt[t.radius]);
2361
+ )), t?.radius && ft[t.radius] && this.style.setProperty("--authui-radius", ft[t.radius]);
2306
2362
  }
2307
2363
  /** Emit a composed custom event from this element. */
2308
2364
  fire(t, i) {
2309
2365
  this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
2310
2366
  }
2311
- }, I.styles = [Et, Mt], I.KEY_EVENTS = ["keydown", "keyup", "keypress"], I);
2312
- Ot([
2367
+ }, U.styles = [_t, Tt], U.KEY_EVENTS = ["keydown", "keyup", "keypress"], U);
2368
+ Rt([
2313
2369
  h()
2314
- ], vt.prototype, "auth");
2315
- let A = vt;
2316
- var _t = Object.defineProperty, Tt = Object.getOwnPropertyDescriptor, y = (e, t, i, s) => {
2317
- for (var a = s > 1 ? void 0 : s ? Tt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
2370
+ ], wt.prototype, "auth");
2371
+ let P = wt;
2372
+ var zt = Object.defineProperty, Lt = Object.getOwnPropertyDescriptor, y = (e, t, i, s) => {
2373
+ for (var a = s > 1 ? void 0 : s ? Lt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
2318
2374
  (u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
2319
- return s && a && _t(t, i, a), a;
2375
+ return s && a && zt(t, i, a), a;
2320
2376
  };
2321
- let b = class extends it {
2377
+ let b = class extends st {
2322
2378
  constructor() {
2323
2379
  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.preview = "";
2324
2380
  }
@@ -2430,36 +2486,36 @@ y([
2430
2486
  b = y([
2431
2487
  O("authui-config")
2432
2488
  ], b);
2433
- var Dt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, Y = (e, t, i, s) => {
2434
- for (var a = s > 1 ? void 0 : s ? Rt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
2489
+ var Vt = Object.defineProperty, qt = Object.getOwnPropertyDescriptor, Z = (e, t, i, s) => {
2490
+ for (var a = s > 1 ? void 0 : s ? qt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
2435
2491
  (u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
2436
- return s && a && Dt(t, i, a), a;
2492
+ return s && a && Vt(t, i, a), a;
2437
2493
  };
2438
- const mt = "authui-show:not([ready]){display:none}", ie = "authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";
2439
- let ft = !1;
2440
- function zt() {
2441
- if (!(typeof document > "u" || ft)) {
2442
- ft = !0;
2494
+ const gt = "authui-show:not([ready]){display:none}", oe = "authui-show:not([ready]){display:none}authui-button:not(:defined),authui-user-button:not(:defined){visibility:hidden}";
2495
+ let vt = !1;
2496
+ function Nt() {
2497
+ if (!(typeof document > "u" || vt)) {
2498
+ vt = !0;
2443
2499
  try {
2444
2500
  if (typeof CSSStyleSheet < "u" && "adoptedStyleSheets" in Document.prototype) {
2445
2501
  const e = new CSSStyleSheet();
2446
- e.replaceSync(mt), document.adoptedStyleSheets = [...document.adoptedStyleSheets, e];
2502
+ e.replaceSync(gt), document.adoptedStyleSheets = [...document.adoptedStyleSheets, e];
2447
2503
  return;
2448
2504
  }
2449
2505
  } catch {
2450
2506
  }
2451
2507
  if (!document.getElementById("authui-fouc")) {
2452
2508
  const e = document.createElement("style");
2453
- e.id = "authui-fouc", e.textContent = mt, document.head.appendChild(e);
2509
+ e.id = "authui-fouc", e.textContent = gt, document.head.appendChild(e);
2454
2510
  }
2455
2511
  }
2456
2512
  }
2457
- zt();
2458
- const Lt = ["loading", "signed-out", "signed-in", "mfa-required"];
2459
- function X(e) {
2460
- return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Lt.includes(t)) : [];
2513
+ Nt();
2514
+ const Bt = ["loading", "signed-out", "signed-in", "mfa-required"];
2515
+ function Q(e) {
2516
+ return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Bt.includes(t)) : [];
2461
2517
  }
2462
- let B = class extends it {
2518
+ let B = class extends st {
2463
2519
  constructor() {
2464
2520
  super(...arguments), this.when = "", this.unless = "", this.status = n.getState().status, this.unsubscribe = null;
2465
2521
  }
@@ -2471,29 +2527,29 @@ let B = class extends it {
2471
2527
  }
2472
2528
  /** Whether the current status satisfies `when` and `unless`. */
2473
2529
  get visible() {
2474
- const e = X(this.when), t = X(this.unless);
2530
+ const e = Q(this.when), t = Q(this.unless);
2475
2531
  return !(this.status === "loading" && !e.includes("loading") || e.length > 0 && !e.includes(this.status) || t.includes(this.status));
2476
2532
  }
2477
2533
  updated() {
2478
- (this.status !== "loading" || X(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
2534
+ (this.status !== "loading" || Q(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
2479
2535
  }
2480
2536
  render() {
2481
2537
  return this.visible ? r`<slot></slot>` : o;
2482
2538
  }
2483
2539
  };
2484
- Y([
2540
+ Z([
2485
2541
  g({ type: String })
2486
2542
  ], B.prototype, "when", 2);
2487
- Y([
2543
+ Z([
2488
2544
  g({ type: String })
2489
2545
  ], B.prototype, "unless", 2);
2490
- Y([
2546
+ Z([
2491
2547
  h()
2492
2548
  ], B.prototype, "status", 2);
2493
- B = Y([
2549
+ B = Z([
2494
2550
  O("authui-show")
2495
2551
  ], B);
2496
- const Vt = F`
2552
+ const jt = F`
2497
2553
  :host {
2498
2554
  display: block;
2499
2555
  width: 100%;
@@ -2640,7 +2696,7 @@ const Vt = F`
2640
2696
  qr: v(
2641
2697
  d`<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"/>`
2642
2698
  )
2643
- }, w = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, qt = {
2699
+ }, w = (e, t = "0 0 24 24") => r`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, Ht = {
2644
2700
  google: w(
2645
2701
  d`<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"/>`
2646
2702
  ),
@@ -2696,22 +2752,22 @@ const Vt = F`
2696
2752
  d`<path fill="#003087" d="M7.076 21.337H2.47a.641.641 0 0 1-.633-.74L4.944.901C5.026.382 5.474 0 5.998 0h7.46c2.57 0 4.578.543 5.69 1.81 1.01 1.15 1.304 2.42 1.012 4.287-.023.143-.047.288-.077.437-.983 5.05-4.349 6.797-8.647 6.797h-2.19c-.524 0-.968.382-1.05.9l-1.12 7.106zm14.146-14.42a3.35 3.35 0 0 0-.607-.541c-.013.076-.026.175-.041.254-.93 4.778-4.005 7.201-9.138 7.201h-2.19a.563.563 0 0 0-.556.479l-1.187 7.527h-.506l-.24 1.516a.56.56 0 0 0 .554.647h3.882c.46 0 .85-.334.922-.788.06-.26.76-4.852.816-5.09a.932.932 0 0 1 .923-.788h.58c3.76 0 6.705-1.528 7.565-5.946.36-1.847.174-3.388-.777-4.471z"/>`
2697
2753
  )
2698
2754
  };
2699
- function tt(e) {
2700
- return qt[e] ?? c.globe;
2755
+ function et(e) {
2756
+ return Ht[e] ?? c.globe;
2701
2757
  }
2702
- function st(e) {
2758
+ function at(e) {
2703
2759
  const t = (e.trim()[0] ?? "?").toUpperCase();
2704
2760
  return /[A-Z0-9]/i.test(t) ? t : c.user;
2705
2761
  }
2706
- function G(e) {
2762
+ function Y(e) {
2707
2763
  typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
2708
2764
  window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
2709
2765
  }));
2710
2766
  }
2711
- function se() {
2767
+ function ce() {
2712
2768
  typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
2713
2769
  }
2714
- function et(e) {
2770
+ function it(e) {
2715
2771
  const t = {
2716
2772
  length: e.length >= 8,
2717
2773
  long: e.length >= 12,
@@ -2727,39 +2783,12 @@ function et(e) {
2727
2783
  let s, a;
2728
2784
  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 };
2729
2785
  }
2730
- const rt = "authui:last-method";
2731
- function V(e) {
2732
- if (!(typeof localStorage > "u")) {
2733
- if (!e || e === "mfa" || e === "sign-up")
2734
- if (e === "sign-up") e = "email-password";
2735
- else return;
2736
- try {
2737
- localStorage.setItem(rt, e);
2738
- } catch {
2739
- }
2740
- }
2741
- }
2742
- function D() {
2743
- if (typeof localStorage > "u") return null;
2744
- try {
2745
- return localStorage.getItem(rt);
2746
- } catch {
2747
- return null;
2748
- }
2749
- }
2750
- function re() {
2751
- if (!(typeof localStorage > "u"))
2752
- try {
2753
- localStorage.removeItem(rt);
2754
- } catch {
2755
- }
2756
- }
2757
- var Nt = Object.defineProperty, Bt = Object.getOwnPropertyDescriptor, k = (e, t, i, s) => {
2758
- for (var a = s > 1 ? void 0 : s ? Bt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
2786
+ var Wt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, k = (e, t, i, s) => {
2787
+ for (var a = s > 1 ? void 0 : s ? Kt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
2759
2788
  (u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
2760
- return s && a && Nt(t, i, a), a;
2789
+ return s && a && Wt(t, i, a), a;
2761
2790
  };
2762
- let $ = class extends A {
2791
+ let $ = class extends P {
2763
2792
  constructor() {
2764
2793
  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.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.onSignIn = (e) => {
2765
2794
  e.preventDefault(), this.requireValid(e) && this.run(async () => {
@@ -2775,8 +2804,8 @@ let $ = class extends A {
2775
2804
  });
2776
2805
  }, this.onOAuth = (e) => {
2777
2806
  this.run(async () => {
2778
- if (V(`oauth:${e}`), await n.signInWithOAuth(e), n.isPreview) {
2779
- this.fire("authui-success", { method: "oauth" });
2807
+ if (Mt(e), await n.signInWithOAuth(e), n.isPreview) {
2808
+ yt(), this.fire("authui-success", { method: "oauth" });
2780
2809
  return;
2781
2810
  }
2782
2811
  await new Promise((t) => setTimeout(t, 4e3));
@@ -2793,7 +2822,7 @@ let $ = class extends A {
2793
2822
  }
2794
2823
  const t = this.recovery;
2795
2824
  t && this.run(async () => {
2796
- await n.completePasswordRecovery(t.userId, t.secret, this.password), this.password = "", this.passwordConfirm = "", this.recovery = null, this.auth.pending?.type === "reset-password" && n.setPending(null), this.notice = { tone: "success", message: this.t("passwordUpdated") }, this.go("sign-in");
2825
+ await n.completePasswordRecovery(t.userId, t.secret, this.password), this.password = "", this.passwordConfirm = "", this.recovery = null, this.auth.pending?.type === "reset-password" && n.setPending(null), this.go("sign-in"), this.notice = { tone: "success", message: this.t("passwordUpdated") };
2797
2826
  });
2798
2827
  }, this.onMagicUrl = (e) => {
2799
2828
  e.preventDefault(), this.requireValid(e) && this.run(async () => {
@@ -2864,7 +2893,7 @@ let $ = class extends A {
2864
2893
  const { status: e, pending: t } = this.auth;
2865
2894
  e === "mfa-required" && this.step !== "mfa" && this.go("mfa");
2866
2895
  const i = this.step === "reset-password" || t?.type === "reset-password" || this.recovery !== null;
2867
- (e === "signed-in" || e === "signed-out") && !i && (this.step === "mfa" || this.step === "phone" || this.step === "email-otp" || this.step === "magic-url" || this.step === "forgot-password" || this.token !== null || this.challenge !== null || e === "signed-out") && (this.token = null, this.challenge = null, this.code = "", this.password = "", this.notice = null, this.go(this.view === "sign-up" ? "sign-up" : "sign-in")), t?.type === "reset-password" && this.step !== "reset-password" && (this.recovery = { userId: t.userId, secret: t.secret }, this.go("reset-password")), t?.type === "oauth-failed" && (this.notice = { tone: "error", message: this.t("errorOAuth") }, n.setPending(null)), t?.type === "notice" && !this.notice && (this.notice = {
2896
+ (e === "signed-in" || e === "signed-out") && !i && (this.step === "mfa" || this.step === "phone" || this.step === "email-otp" || this.step === "magic-url" || this.step === "forgot-password" || this.token !== null || this.challenge !== null || e === "signed-out") && (this.token = null, this.challenge = null, this.code = "", this.password = "", this.notice = null, this.go(this.view === "sign-up" ? "sign-up" : "sign-in")), t?.type === "reset-password" && this.step !== "reset-password" && (this.recovery = { userId: t.userId, secret: t.secret }, this.go("reset-password")), t?.type === "oauth-failed" && (this.notice = { tone: "error", message: this.t("errorOAuth") }), t?.type === "notice" && !this.notice && (this.notice = {
2868
2897
  tone: t.tone === "error" ? "error" : t.tone,
2869
2898
  message: t.message
2870
2899
  });
@@ -2874,7 +2903,7 @@ let $ = class extends A {
2874
2903
  this.notice = null, this.auth.pending?.type === "notice" && n.setPending(null);
2875
2904
  }
2876
2905
  go(e) {
2877
- e === "sign-up" && this.config?.signUp === !1 && (e = "sign-in"), this.focusOnStep = !0, this.step = e, this.error = "", this.notice = null, this.auth.pending?.type === "notice" && n.setPending(null), this.busy = !1, this.showPassword = !1, this.password = "", this.passwordConfirm = "", e !== "mfa" && (this.challenge = null), e !== "email-otp" && e !== "phone" && e !== "magic-url" && (this.token = null), this.fire("authui-view", { view: e });
2906
+ 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.password = "", this.passwordConfirm = "", e !== "mfa" && (this.challenge = null), e !== "email-otp" && e !== "phone" && e !== "magic-url" && (this.token = null), this.fire("authui-view", { view: e });
2878
2907
  }
2879
2908
  // ───────────────────────────── actions ─────────────────────────────
2880
2909
  async run(e, t = "link") {
@@ -2976,7 +3005,7 @@ let $ = class extends A {
2976
3005
  </button>`;
2977
3006
  }
2978
3007
  passwordField(e) {
2979
- const t = this[e.field], i = e.meter ? et(t) : null;
3008
+ const t = this[e.field], i = e.meter ? it(t) : null;
2980
3009
  return r`
2981
3010
  <div class="field">
2982
3011
  <label class="label" for=${e.id}>
@@ -3119,7 +3148,7 @@ let $ = class extends A {
3119
3148
  <div class="stack">
3120
3149
  <div class="row">
3121
3150
  <div class="inline">
3122
- <span class="avatar">${st(t)}</span>
3151
+ <span class="avatar">${at(t)}</span>
3123
3152
  <div class="row-main">
3124
3153
  <span class="row-title" title=${t}>${t}</span>
3125
3154
  ${e.email && e.name ? r`<span class="row-sub" title=${e.email}>${e.email}</span>` : o}
@@ -3134,7 +3163,7 @@ let $ = class extends A {
3134
3163
  <button
3135
3164
  class="btn btn-outline btn-block"
3136
3165
  @click=${() => {
3137
- this.embedded ? this.fire("authui-open", { view: "account" }) : G("account");
3166
+ this.embedded ? this.fire("authui-open", { view: "account" }) : Y("account");
3138
3167
  }}
3139
3168
  >
3140
3169
  ${c.settings} ${this.t("manageAccount")}
@@ -3166,7 +3195,7 @@ let $ = class extends A {
3166
3195
  ?disabled=${this.busy}
3167
3196
  aria-label=${this.t("continueWith", { provider: q(s) })}
3168
3197
  >
3169
- ${tt(s)}
3198
+ ${et(s)}
3170
3199
  <span
3171
3200
  >${i ? q(s) : this.t("continueWith", { provider: q(s) })}</span
3172
3201
  >
@@ -3504,7 +3533,7 @@ let $ = class extends A {
3504
3533
  `;
3505
3534
  }
3506
3535
  };
3507
- $.styles = [...A.styles, Vt];
3536
+ $.styles = [...P.styles, jt];
3508
3537
  k([
3509
3538
  g({ type: String })
3510
3539
  ], $.prototype, "view", 2);
@@ -3539,17 +3568,17 @@ k([
3539
3568
  h()
3540
3569
  ], $.prototype, "recovery", 2);
3541
3570
  k([
3542
- gt("form input:not([type=hidden])")
3571
+ bt("form input:not([type=hidden])")
3543
3572
  ], $.prototype, "firstInput", 2);
3544
3573
  $ = k([
3545
3574
  O("authui-sign-in")
3546
3575
  ], $);
3547
- var jt = Object.defineProperty, Ht = Object.getOwnPropertyDescriptor, m = (e, t, i, s) => {
3548
- for (var a = s > 1 ? void 0 : s ? Ht(t, i) : t, l = e.length - 1, u; l >= 0; l--)
3576
+ var Gt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, m = (e, t, i, s) => {
3577
+ for (var a = s > 1 ? void 0 : s ? Yt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
3549
3578
  (u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
3550
- return s && a && jt(t, i, a), a;
3579
+ return s && a && Gt(t, i, a), a;
3551
3580
  };
3552
- let p = class extends A {
3581
+ let p = class extends P {
3553
3582
  constructor() {
3554
3583
  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.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.onTabsKeydown = (e) => {
3555
3584
  const t = [...this.renderRoot?.querySelectorAll('[role="tab"]') ?? []];
@@ -3909,7 +3938,7 @@ let p = class extends A {
3909
3938
  return r`
3910
3939
  <div class="between">
3911
3940
  <div class="identity">
3912
- <span class="avatar">${st(t)}</span>
3941
+ <span class="avatar">${at(t)}</span>
3913
3942
  <div class="row-main">
3914
3943
  <span class="row-title" title=${t}>
3915
3944
  ${t}
@@ -4005,7 +4034,7 @@ let p = class extends A {
4005
4034
  autocomplete="new-password"
4006
4035
  />
4007
4036
  ${this.emailPassword ? (() => {
4008
- const t = et(this.emailPassword);
4037
+ const t = it(this.emailPassword);
4009
4038
  return r`<div class="strength" aria-live="polite">
4010
4039
  <div
4011
4040
  class="strength-meter"
@@ -4271,7 +4300,7 @@ let p = class extends A {
4271
4300
  autocomplete="new-password"
4272
4301
  />
4273
4302
  ${this.newPassword ? (() => {
4274
- const i = et(this.newPassword);
4303
+ const i = it(this.newPassword);
4275
4304
  return r`<div class="strength" aria-live="polite">
4276
4305
  <div
4277
4306
  class="strength-meter"
@@ -4320,7 +4349,7 @@ let p = class extends A {
4320
4349
  </div>`;
4321
4350
  }
4322
4351
  renderMfaCard() {
4323
- const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? n.isPreview ? St(this.authenticator.uri) : new yt(n.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
4352
+ const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? n.isPreview ? It(this.authenticator.uri) : new xt(n.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
4324
4353
  return this.card(
4325
4354
  this.t("twoFactor"),
4326
4355
  this.t("twoFactorDescription"),
@@ -4652,7 +4681,7 @@ let p = class extends A {
4652
4681
  ${e === null ? r`<div class="empty"><span class="spinner"></span></div>` : e.length === 0 ? r`<div class="empty">${this.t("noConnections")}</div>` : e.map(
4653
4682
  (i) => r`<div class="row">
4654
4683
  <div class="inline">
4655
- <span class="device">${tt(i.provider)}</span>
4684
+ <span class="device">${et(i.provider)}</span>
4656
4685
  <div class="row-main">
4657
4686
  <span class="row-title">${q(i.provider)}</span>
4658
4687
  <span class="row-sub">${i.providerEmail || i.providerUid}</span>
@@ -4693,7 +4722,7 @@ let p = class extends A {
4693
4722
  }}
4694
4723
  ?disabled=${!!this.busy}
4695
4724
  >
4696
- ${this.spinner(`connect-${i}`)} ${tt(i)}
4725
+ ${this.spinner(`connect-${i}`)} ${et(i)}
4697
4726
  ${this.t("connectProvider", { provider: q(i) })}
4698
4727
  </button>`
4699
4728
  )}` : void 0
@@ -4723,7 +4752,7 @@ let p = class extends A {
4723
4752
  }
4724
4753
  };
4725
4754
  p.styles = [
4726
- ...A.styles,
4755
+ ...P.styles,
4727
4756
  F`
4728
4757
  :host {
4729
4758
  display: block;
@@ -4925,12 +4954,12 @@ m([
4925
4954
  p = m([
4926
4955
  O("authui-account")
4927
4956
  ], p);
4928
- var Wt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, L = (e, t, i, s) => {
4929
- for (var a = s > 1 ? void 0 : s ? Kt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
4957
+ var Zt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, L = (e, t, i, s) => {
4958
+ for (var a = s > 1 ? void 0 : s ? Xt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
4930
4959
  (u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
4931
- return s && a && Wt(t, i, a), a;
4960
+ return s && a && Zt(t, i, a), a;
4932
4961
  };
4933
- let M = class extends A {
4962
+ let M = class extends P {
4934
4963
  constructor() {
4935
4964
  super(...arguments), this.open = !1, this.view = "sign-in", this.closeOnSuccess = !0, this.handledPending = null, this.onOpenEvent = (e) => {
4936
4965
  const t = e.detail ?? {};
@@ -5002,7 +5031,7 @@ let M = class extends A {
5002
5031
  }
5003
5032
  };
5004
5033
  M.styles = [
5005
- ...A.styles,
5034
+ ...P.styles,
5006
5035
  F`
5007
5036
  :host {
5008
5037
  display: contents;
@@ -5076,17 +5105,17 @@ L([
5076
5105
  h()
5077
5106
  ], M.prototype, "handledPending", 2);
5078
5107
  L([
5079
- gt("dialog")
5108
+ bt("dialog")
5080
5109
  ], M.prototype, "dialog", 2);
5081
5110
  M = L([
5082
5111
  O("authui-modal")
5083
5112
  ], M);
5084
- var Gt = Object.defineProperty, Yt = Object.getOwnPropertyDescriptor, Z = (e, t, i, s) => {
5085
- for (var a = s > 1 ? void 0 : s ? Yt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
5113
+ var Qt = Object.defineProperty, Jt = Object.getOwnPropertyDescriptor, X = (e, t, i, s) => {
5114
+ for (var a = s > 1 ? void 0 : s ? Jt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
5086
5115
  (u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
5087
- return s && a && Gt(t, i, a), a;
5116
+ return s && a && Qt(t, i, a), a;
5088
5117
  };
5089
- let z = class extends A {
5118
+ let z = class extends P {
5090
5119
  constructor() {
5091
5120
  super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
5092
5121
  }
@@ -5094,7 +5123,7 @@ let z = class extends A {
5094
5123
  const e = this.size === "md" ? "" : `btn-${this.size}`;
5095
5124
  return r`<button
5096
5125
  class="btn btn-${this.variant} ${e}"
5097
- @click=${() => G(this.view)}
5126
+ @click=${() => Y(this.view)}
5098
5127
  part="button"
5099
5128
  >
5100
5129
  <slot
@@ -5104,7 +5133,7 @@ let z = class extends A {
5104
5133
  }
5105
5134
  };
5106
5135
  z.styles = [
5107
- ...A.styles,
5136
+ ...P.styles,
5108
5137
  F`
5109
5138
  :host {
5110
5139
  display: inline-block;
@@ -5114,24 +5143,24 @@ z.styles = [
5114
5143
  }
5115
5144
  `
5116
5145
  ];
5117
- Z([
5146
+ X([
5118
5147
  g({ type: String })
5119
5148
  ], z.prototype, "view", 2);
5120
- Z([
5149
+ X([
5121
5150
  g({ type: String })
5122
5151
  ], z.prototype, "variant", 2);
5123
- Z([
5152
+ X([
5124
5153
  g({ type: String })
5125
5154
  ], z.prototype, "size", 2);
5126
- z = Z([
5155
+ z = X([
5127
5156
  O("authui-button")
5128
5157
  ], z);
5129
- var Zt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, _ = (e, t, i, s) => {
5130
- for (var a = s > 1 ? void 0 : s ? Xt(t, i) : t, l = e.length - 1, u; l >= 0; l--)
5158
+ var te = Object.defineProperty, ee = Object.getOwnPropertyDescriptor, _ = (e, t, i, s) => {
5159
+ for (var a = s > 1 ? void 0 : s ? ee(t, i) : t, l = e.length - 1, u; l >= 0; l--)
5131
5160
  (u = e[l]) && (a = (s ? u(t, i, a) : u(a)) || a);
5132
- return s && a && Zt(t, i, a), a;
5161
+ return s && a && te(t, i, a), a;
5133
5162
  };
5134
- let E = class extends A {
5163
+ let E = class extends P {
5135
5164
  constructor() {
5136
5165
  super(...arguments), this.showTeams = !1, this.src = "", this.menuOpen = !1, this.teams = [], this.teamsLoading = !1, this.activeTeamId = null, this.onDocumentClick = (e) => {
5137
5166
  e.composedPath().includes(this) || (this.menuOpen = !1);
@@ -5191,7 +5220,7 @@ let E = class extends A {
5191
5220
  if (e === "loading" && i)
5192
5221
  return r`<span class="avatar"><span class="spinner"></span></span>`;
5193
5222
  if (e !== "signed-in" || !t)
5194
- return r`<button class="btn btn-primary btn-sm" @click=${() => G("sign-in")}>
5223
+ return r`<button class="btn btn-primary btn-sm" @click=${() => Y("sign-in")}>
5195
5224
  <slot>${this.t("signIn")}</slot>
5196
5225
  </button>`;
5197
5226
  const s = t.name || t.email || t.phone || this.t("guestAccount");
@@ -5204,7 +5233,7 @@ let E = class extends A {
5204
5233
  aria-label=${s}
5205
5234
  >
5206
5235
  <span class="avatar"
5207
- >${this.src ? r`<img src=${this.src} alt="" />` : st(s)}</span
5236
+ >${this.src ? r`<img src=${this.src} alt="" />` : at(s)}</span
5208
5237
  >
5209
5238
  </button>
5210
5239
  ${this.menuOpen ? r`<div class="menu" role="menu">
@@ -5233,7 +5262,7 @@ let E = class extends A {
5233
5262
  class="menu-item"
5234
5263
  role="menuitem"
5235
5264
  @click=${() => {
5236
- this.menuOpen = !1, G("account");
5265
+ this.menuOpen = !1, Y("account");
5237
5266
  }}
5238
5267
  >
5239
5268
  ${c.settings} ${this.t("manageAccount")}
@@ -5252,7 +5281,7 @@ let E = class extends A {
5252
5281
  }
5253
5282
  };
5254
5283
  E.styles = [
5255
- ...A.styles,
5284
+ ...P.styles,
5256
5285
  F`
5257
5286
  :host {
5258
5287
  display: inline-block;
@@ -5384,31 +5413,34 @@ E = _([
5384
5413
  O("authui-user-button")
5385
5414
  ], E);
5386
5415
  export {
5387
- Ut as A,
5388
- ie as C,
5416
+ Ft as A,
5417
+ oe as C,
5389
5418
  f as E,
5390
- mt as F,
5391
- Ct as P,
5419
+ gt as F,
5420
+ Pt as P,
5392
5421
  n as a,
5393
5422
  p as b,
5394
- se as c,
5423
+ ce as c,
5395
5424
  z as d,
5396
5425
  b as e,
5397
- A as f,
5426
+ P as f,
5398
5427
  M as g,
5399
5428
  B as h,
5400
5429
  $ as i,
5401
5430
  E as j,
5402
- re as k,
5403
- wt as l,
5404
- K as m,
5405
- D as n,
5406
- G as o,
5407
- lt as p,
5408
- Pt as q,
5409
- q as r,
5410
- V as s,
5411
- et as t,
5412
- At as u,
5413
- R as v
5431
+ ne as k,
5432
+ ht as l,
5433
+ kt as m,
5434
+ K as n,
5435
+ Y as o,
5436
+ D as p,
5437
+ dt as q,
5438
+ Ut as r,
5439
+ q as s,
5440
+ V as t,
5441
+ yt as u,
5442
+ it as v,
5443
+ Et as w,
5444
+ Mt as x,
5445
+ R as y
5414
5446
  };