@getauthui/core 0.1.0 → 0.1.1

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.
Files changed (51) hide show
  1. package/README.md +15 -15
  2. package/dist/{authui-user-button-3yi-kvES.js → authui-user-button-BRfrh3si.js} +901 -485
  3. package/dist/authui.cdn.js +227 -215
  4. package/dist/authui.cdn.mjs +6721 -3340
  5. package/dist/authui.js +46 -34
  6. package/dist/components/authui-account.d.ts +102 -0
  7. package/dist/components/authui-account.d.ts.map +1 -0
  8. package/dist/components/authui-button.d.ts +21 -0
  9. package/dist/components/authui-button.d.ts.map +1 -0
  10. package/dist/components/authui-config.d.ts +40 -0
  11. package/dist/components/authui-config.d.ts.map +1 -0
  12. package/dist/components/authui-modal.d.ts +38 -0
  13. package/dist/components/authui-modal.d.ts.map +1 -0
  14. package/dist/components/authui-show.d.ts +33 -0
  15. package/dist/components/authui-show.d.ts.map +1 -0
  16. package/dist/components/authui-sign-in.d.ts +83 -0
  17. package/dist/components/authui-sign-in.d.ts.map +1 -0
  18. package/dist/components/authui-user-button.d.ts +22 -0
  19. package/dist/components/authui-user-button.d.ts.map +1 -0
  20. package/dist/components/element.d.ts +24 -0
  21. package/dist/components/element.d.ts.map +1 -0
  22. package/dist/components/sign-in.styles.d.ts +2 -0
  23. package/dist/components/sign-in.styles.d.ts.map +1 -0
  24. package/dist/errors.d.ts +48 -0
  25. package/dist/errors.d.ts.map +1 -0
  26. package/dist/i18n.d.ts +8 -0
  27. package/dist/i18n.d.ts.map +1 -0
  28. package/dist/icons.d.ts +38 -0
  29. package/dist/icons.d.ts.map +1 -0
  30. package/dist/index.d.ts +62 -0
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/modal-controller.d.ts +7 -0
  33. package/dist/modal-controller.d.ts.map +1 -0
  34. package/dist/preview.d.ts +107 -0
  35. package/dist/preview.d.ts.map +1 -0
  36. package/dist/react/index.d.ts +53 -0
  37. package/dist/react/index.d.ts.map +1 -0
  38. package/dist/react.js +21 -25
  39. package/dist/store.d.ts +105 -0
  40. package/dist/store.d.ts.map +1 -0
  41. package/dist/styles/base.d.ts +7 -0
  42. package/dist/styles/base.d.ts.map +1 -0
  43. package/dist/styles/tokens.d.ts +7 -0
  44. package/dist/styles/tokens.d.ts.map +1 -0
  45. package/dist/theme.d.ts +21 -0
  46. package/dist/theme.d.ts.map +1 -0
  47. package/dist/types.d.ts +233 -0
  48. package/dist/types.d.ts.map +1 -0
  49. package/package.json +4 -4
  50. package/dist/authui.d.ts +0 -743
  51. package/dist/react.d.ts +0 -395
@@ -1,7 +1,7 @@
1
- import { state as d, property as g, customElement as S, query as X } from "lit/decorators.js";
2
- import { css as A, LitElement as V, nothing as n, html as s, svg as l } from "lit";
3
- import { Client as Q, Account as J, ID as z, Avatars as tt } from "appwrite";
4
- const et = {
1
+ import { state as d, property as f, customElement as I, query as rt } from "lit/decorators.js";
2
+ import { css as E, LitElement as K, nothing as o, html as s, svg as l } from "lit";
3
+ import { Client as nt, Account as ot, ID as L, Avatars as ct } from "appwrite";
4
+ const lt = {
5
5
  signIn: "Sign in",
6
6
  signUp: "Sign up",
7
7
  signOut: "Sign out",
@@ -120,15 +120,16 @@ const et = {
120
120
  provider: "Provider",
121
121
  lastActive: "Last active",
122
122
  guestAccount: "Guest account",
123
- guestAccountDescription: "Add an email and password to keep your data."
123
+ guestAccountDescription: "Add an email and password to keep your data.",
124
+ preview: "Preview"
124
125
  };
125
- function it(e, t = {}) {
126
+ function dt(e, t = {}) {
126
127
  return e.replace(
127
128
  /\{(\w+)\}/g,
128
129
  (i, r) => r in t ? String(t[r]) : `{${r}}`
129
130
  );
130
131
  }
131
- const st = {
132
+ const ht = {
132
133
  amazon: "Amazon",
133
134
  apple: "Apple",
134
135
  appwrite: "Appwrite",
@@ -179,10 +180,376 @@ const st = {
179
180
  zoho: "Zoho",
180
181
  zoom: "Zoom"
181
182
  };
182
- function E(e) {
183
- return st[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
183
+ function O(e) {
184
+ return ht[e] ?? e.charAt(0).toUpperCase() + e.slice(1);
184
185
  }
185
- const b = {
186
+ const V = (e, t, i = 401) => Object.assign(new Error(t), { type: e, code: i }), S = () => (/* @__PURE__ */ new Date()).toISOString(), M = (e) => new Date(Date.now() - e * 6e4).toISOString(), q = [
187
+ "amber",
188
+ "brave",
189
+ "calm",
190
+ "delta",
191
+ "ember",
192
+ "fable",
193
+ "glide",
194
+ "harbor",
195
+ "ivory",
196
+ "juniper",
197
+ "kite",
198
+ "lumen"
199
+ ], Z = () => `${q[Math.floor(Math.random() * q.length)]}-${q[Math.floor(Math.random() * q.length)]}`, _ = () => Math.random().toString(36).slice(2, 12), J = () => Array.from({ length: 2 }, () => Math.random().toString(36).slice(2, 7)).join("-"), ut = {
200
+ name: "Ada Lovelace",
201
+ email: "ada@example.com",
202
+ phone: "+15550100"
203
+ };
204
+ class pt {
205
+ constructor(t = ut) {
206
+ 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;
207
+ }
208
+ // ───────────────────────── helpers ─────────────────────────
209
+ makeUser(t = {}) {
210
+ const i = t.anonymous ?? !1;
211
+ return this.user = {
212
+ $id: "preview-user",
213
+ $createdAt: M(1440 * 30),
214
+ $updatedAt: S(),
215
+ name: i ? "" : t.name ?? this.seed.name,
216
+ registration: M(1440 * 30),
217
+ status: !0,
218
+ labels: [],
219
+ passwordUpdate: i ? "" : M(1440 * 7),
220
+ email: i ? "" : t.email ?? this.seed.email,
221
+ phone: i ? "" : t.phone ?? this.seed.phone,
222
+ emailVerification: !i,
223
+ phoneVerification: !1,
224
+ mfa: this.mfaEnabled,
225
+ prefs: {},
226
+ targets: [],
227
+ accessedAt: S()
228
+ }, this.seedActivity(i ? "anonymous" : "email"), this.user;
229
+ }
230
+ seedActivity(t) {
231
+ if (this.sessions.length > 0) return;
232
+ const i = {
233
+ $createdAt: S(),
234
+ $updatedAt: S(),
235
+ userId: "preview-user",
236
+ expire: new Date(Date.now() + 365 * 864e5).toISOString(),
237
+ providerUid: "",
238
+ providerAccessToken: "",
239
+ providerAccessTokenExpiry: "",
240
+ providerRefreshToken: "",
241
+ clientType: "browser",
242
+ clientCode: "CH",
243
+ clientEngine: "Blink",
244
+ clientEngineVersion: "128",
245
+ deviceName: "desktop",
246
+ deviceBrand: "",
247
+ deviceModel: "",
248
+ factors: ["password"],
249
+ secret: "",
250
+ mfaUpdatedAt: ""
251
+ };
252
+ this.sessions = [
253
+ {
254
+ ...i,
255
+ $id: "current",
256
+ provider: t,
257
+ ip: "203.0.113.24",
258
+ osCode: "MAC",
259
+ osName: "macOS",
260
+ osVersion: "15",
261
+ clientName: "Chrome",
262
+ clientVersion: "128",
263
+ countryCode: "de",
264
+ countryName: "Germany",
265
+ current: !0
266
+ },
267
+ {
268
+ ...i,
269
+ $id: _(),
270
+ $createdAt: M(300),
271
+ provider: t,
272
+ ip: "198.51.100.7",
273
+ osCode: "IOS",
274
+ osName: "iOS",
275
+ osVersion: "18",
276
+ clientName: "Safari",
277
+ clientVersion: "18",
278
+ clientType: "browser",
279
+ deviceName: "smartphone",
280
+ countryCode: "de",
281
+ countryName: "Germany",
282
+ current: !1
283
+ },
284
+ {
285
+ ...i,
286
+ $id: _(),
287
+ $createdAt: M(1440 * 3),
288
+ provider: "oauth2",
289
+ ip: "192.0.2.90",
290
+ osCode: "WIN",
291
+ osName: "Windows",
292
+ osVersion: "11",
293
+ clientName: "Firefox",
294
+ clientVersion: "130",
295
+ countryCode: "us",
296
+ countryName: "United States",
297
+ current: !1
298
+ }
299
+ ], this.identities = [
300
+ {
301
+ $id: "identity-github",
302
+ $createdAt: M(1440 * 20),
303
+ $updatedAt: M(1440 * 20),
304
+ userId: "preview-user",
305
+ provider: "github",
306
+ providerUid: "8675309",
307
+ providerEmail: this.seed.email,
308
+ providerAccessToken: "",
309
+ providerAccessTokenExpiry: "",
310
+ providerRefreshToken: ""
311
+ }
312
+ ], this.logs = [
313
+ {
314
+ event: "session.create",
315
+ time: S(),
316
+ clientName: "Chrome",
317
+ osName: "macOS",
318
+ countryName: "Germany",
319
+ ip: "203.0.113.24"
320
+ },
321
+ {
322
+ event: "user.update.name",
323
+ time: M(1440 * 2),
324
+ clientName: "Safari",
325
+ osName: "iOS",
326
+ countryName: "Germany",
327
+ ip: "198.51.100.7"
328
+ },
329
+ {
330
+ event: "session.create",
331
+ time: M(1440 * 3),
332
+ clientName: "Firefox",
333
+ osName: "Windows",
334
+ countryName: "United States",
335
+ ip: "192.0.2.90"
336
+ }
337
+ ];
338
+ }
339
+ requireUser() {
340
+ if (!this.user)
341
+ throw V("general_unauthorized_scope", "User (role: guests) missing scope (account)");
342
+ if (this.mfaPending)
343
+ throw V(
344
+ "user_more_factors_required",
345
+ "More factors are required to complete the sign in process."
346
+ );
347
+ return this.user;
348
+ }
349
+ requireRecentChallenge() {
350
+ if (Date.now() - this.lastChallenge > 30 * 6e4)
351
+ throw V(
352
+ "user_challenge_required",
353
+ "A recently successful challenge is required to complete this action."
354
+ );
355
+ }
356
+ afterPrimarySignIn() {
357
+ const t = this.totpEnrolled || this.user?.emailVerification;
358
+ this.mfaPending = !!(this.user?.mfa && t);
359
+ }
360
+ async delay(t, i = 150) {
361
+ return await new Promise((r) => setTimeout(r, i)), typeof t == "function" ? t() : t;
362
+ }
363
+ /** Sign the preview user in directly (used by the playground). */
364
+ signInDirectly() {
365
+ this.user || this.makeUser(), this.mfaPending = !1;
366
+ }
367
+ // ───────────────────────── account ─────────────────────────
368
+ async get() {
369
+ return this.delay(() => this.requireUser(), 120);
370
+ }
371
+ async create(t, i, r, a) {
372
+ return this.delay(() => this.makeUser({ email: i, name: a || i.split("@")[0] }));
373
+ }
374
+ async createEmailPasswordSession(t) {
375
+ return this.delay(() => ((!this.user || this.user.email !== t) && this.makeUser({ email: t, name: this.user?.name || this.seed.name }), this.afterPrimarySignIn(), this.sessions[0]));
376
+ }
377
+ async createAnonymousSession() {
378
+ return this.delay(() => (this.makeUser({ anonymous: !0 }), this.mfaPending = !1, this.sessions[0]));
379
+ }
380
+ async createOAuth2Token(t) {
381
+ return this.delay(() => {
382
+ this.makeUser({ email: `ada@${t}.example`, name: this.seed.name }), this.afterPrimarySignIn();
383
+ }, 800);
384
+ }
385
+ async createMagicURLToken(t, i) {
386
+ return this.tokens.set(t, { email: i }), this.delay({
387
+ $id: _(),
388
+ $createdAt: S(),
389
+ userId: t,
390
+ secret: "",
391
+ expire: "",
392
+ phrase: Z()
393
+ });
394
+ }
395
+ async createEmailToken(t, i) {
396
+ return this.tokens.set(t, { email: i }), this.delay({
397
+ $id: _(),
398
+ $createdAt: S(),
399
+ userId: t,
400
+ secret: "",
401
+ expire: "",
402
+ phrase: Z()
403
+ });
404
+ }
405
+ async createPhoneToken(t, i) {
406
+ return this.tokens.set(t, { phone: i }), this.delay({ $id: _(), $createdAt: S(), userId: t, secret: "", expire: "", phrase: "" });
407
+ }
408
+ async createSession(t) {
409
+ return this.delay(() => {
410
+ const i = this.tokens.get(t) ?? {};
411
+ return this.makeUser({ email: i.email ?? this.seed.email, phone: i.phone ?? this.seed.phone }), i.phone && (this.user.phoneVerification = !0), this.afterPrimarySignIn(), this.sessions[0];
412
+ });
413
+ }
414
+ async createRecovery() {
415
+ return this.delay({});
416
+ }
417
+ async updateRecovery() {
418
+ return this.delay({});
419
+ }
420
+ async createEmailVerification() {
421
+ return this.delay({});
422
+ }
423
+ async updateEmailVerification() {
424
+ return this.delay(() => (this.user && (this.user.emailVerification = !0), {}));
425
+ }
426
+ async createPhoneVerification() {
427
+ return this.delay({});
428
+ }
429
+ async updatePhoneVerification() {
430
+ return this.delay(() => (this.user && (this.user.phoneVerification = !0), {}));
431
+ }
432
+ async getPrefs() {
433
+ return this.delay(() => ({ ...this.requireUser().prefs }));
434
+ }
435
+ async updatePrefs(t) {
436
+ return this.delay(() => {
437
+ const i = this.requireUser();
438
+ return i.prefs = { ...t }, i;
439
+ });
440
+ }
441
+ async updateName(t) {
442
+ return this.delay(() => (this.requireUser().name = t, this.user));
443
+ }
444
+ async updateEmail(t) {
445
+ return this.delay(() => {
446
+ const i = this.requireUser();
447
+ return i.email = t, i.emailVerification = !1, i.passwordUpdate = S(), i;
448
+ });
449
+ }
450
+ async updatePhone(t) {
451
+ return this.delay(() => {
452
+ const i = this.requireUser();
453
+ return i.phone = t, i.phoneVerification = !1, i;
454
+ });
455
+ }
456
+ async updatePassword() {
457
+ return this.delay(() => {
458
+ const t = this.requireUser();
459
+ return t.passwordUpdate = S(), t;
460
+ });
461
+ }
462
+ async updateStatus() {
463
+ return this.delay(() => (this.requireUser(), this.reset(), this.mfaEnabled = !1, this.totpEnrolled = !1, this.recoveryCodes = [], {}));
464
+ }
465
+ // ───────────────────────── sessions ─────────────────────────
466
+ async listSessions() {
467
+ return this.delay(() => (this.requireUser(), { total: this.sessions.length, sessions: this.sessions }));
468
+ }
469
+ async deleteSession(t = "current") {
470
+ return this.delay(() => (t === "current" ? this.reset() : this.sessions = this.sessions.filter((i) => i.$id !== t), {}));
471
+ }
472
+ async deleteSessions() {
473
+ return this.delay(() => (this.reset(), {}));
474
+ }
475
+ async listIdentities() {
476
+ return this.delay(() => (this.requireUser(), { total: this.identities.length, identities: this.identities }));
477
+ }
478
+ async deleteIdentity(t) {
479
+ return this.delay(() => (this.identities = this.identities.filter((i) => i.$id !== t), {}));
480
+ }
481
+ async listLogs() {
482
+ return this.delay(() => (this.requireUser(), { total: this.logs.length, logs: this.logs }));
483
+ }
484
+ // ───────────────────────── MFA ─────────────────────────
485
+ async listMFAFactors() {
486
+ return this.delay({
487
+ totp: this.totpEnrolled,
488
+ email: !!this.user?.emailVerification,
489
+ phone: !!this.user?.phoneVerification,
490
+ recoveryCode: this.recoveryCodes.length > 0,
491
+ custom: !1
492
+ });
493
+ }
494
+ async createMFAChallenge() {
495
+ return this.delay({ $id: _(), $createdAt: S(), userId: "preview-user", expire: "" });
496
+ }
497
+ async updateMFAChallenge() {
498
+ return this.delay(() => (this.mfaPending = !1, this.lastChallenge = Date.now(), this.sessions[0]));
499
+ }
500
+ async updateMFA(t) {
501
+ return this.delay(() => {
502
+ const i = this.requireUser();
503
+ return this.mfaEnabled = t, i.mfa = t, i;
504
+ });
505
+ }
506
+ async createMFAAuthenticator() {
507
+ return this.delay(() => {
508
+ const t = "JBSWY3DPEHPK3PXP";
509
+ return this.pendingAuthenticator = {
510
+ secret: t,
511
+ uri: `otpauth://totp/Preview:${encodeURIComponent(this.user?.email ?? "user")}?secret=${t}&issuer=Preview`
512
+ }, this.pendingAuthenticator;
513
+ });
514
+ }
515
+ async updateMFAAuthenticator() {
516
+ return this.delay(() => (this.totpEnrolled = !0, this.pendingAuthenticator = null, this.lastChallenge = Date.now(), this.requireUser()));
517
+ }
518
+ async deleteMFAAuthenticator() {
519
+ return this.delay(() => (this.requireRecentChallenge(), this.totpEnrolled = !1, {}));
520
+ }
521
+ async createMFARecoveryCodes() {
522
+ return this.delay(() => {
523
+ if (this.recoveryCodes.length > 0)
524
+ throw V("user_recovery_codes_already_exists", "Recovery codes already generated.", 409);
525
+ return this.recoveryCodes = Array.from({ length: 6 }, J), { recoveryCodes: this.recoveryCodes };
526
+ });
527
+ }
528
+ async getMFARecoveryCodes() {
529
+ return this.delay(() => (this.requireRecentChallenge(), { recoveryCodes: this.recoveryCodes }));
530
+ }
531
+ async updateMFARecoveryCodes() {
532
+ return this.delay(() => (this.requireRecentChallenge(), this.recoveryCodes = Array.from({ length: 6 }, J), { recoveryCodes: this.recoveryCodes }));
533
+ }
534
+ /** Forget everything, as a sign out would. */
535
+ reset() {
536
+ this.user = null, this.mfaPending = !1, this.sessions = [], this.identities = [], this.logs = [], this.tokens.clear();
537
+ }
538
+ }
539
+ function ft(e) {
540
+ let t = 2166136261;
541
+ const i = () => (t ^= t << 13, t ^= t >>> 17, t ^= t << 5, (t >>> 0) / 4294967296);
542
+ for (const k of e) t = (t ^ k.charCodeAt(0)) * 16777619;
543
+ const r = 25;
544
+ let a = "";
545
+ const h = (k, A) => `<rect x="${k}" y="${A}" width="7" height="7"/><rect x="${k + 1}" y="${A + 1}" width="5" height="5" fill="#fff"/><rect x="${k + 2}" y="${A + 2}" width="3" height="3"/>`;
546
+ for (let k = 0; k < r; k++)
547
+ for (let A = 0; A < r; A++)
548
+ !(A < 8 && k < 8 || A >= r - 8 && k < 8 || A < 8 && k >= r - 8) && i() < 0.45 && (a += `<rect x="${A}" y="${k}" width="1" height="1"/>`);
549
+ const u = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${r} ${r}" shape-rendering="crispEdges"><rect width="${r}" height="${r}" fill="#fff"/><g fill="#000">${h(0, 0)}${h(r - 7, 0)}${h(0, r - 7)}${a}</g></svg>`;
550
+ return `data:image/svg+xml;utf8,${encodeURIComponent(u)}`;
551
+ }
552
+ const v = {
186
553
  moreFactorsRequired: "user_more_factors_required",
187
554
  invalidCredentials: "user_invalid_credentials",
188
555
  userAlreadyExists: "user_already_exists",
@@ -214,7 +581,7 @@ const b = {
214
581
  countMaxExceeded: "user_count_exceeded",
215
582
  targetAlreadyExists: "user_target_already_exists"
216
583
  };
217
- function _(e) {
584
+ function T(e) {
218
585
  if (e && typeof e == "object") {
219
586
  const t = e;
220
587
  return {
@@ -225,49 +592,49 @@ function _(e) {
225
592
  }
226
593
  return { message: String(e), type: "", code: 0 };
227
594
  }
228
- function F(e, t) {
229
- return _(e).type === t;
595
+ function N(e, t) {
596
+ return T(e).type === t;
230
597
  }
231
- function Z(e, t, i = "link") {
232
- const r = _(e);
598
+ function at(e, t, i = "link") {
599
+ const r = T(e);
233
600
  switch (r.type) {
234
- case b.invalidCredentials:
601
+ case v.invalidCredentials:
235
602
  return t.errorInvalidCredentials;
236
- case b.userAlreadyExists:
237
- case b.emailAlreadyExists:
238
- case b.phoneAlreadyExists:
603
+ case v.userAlreadyExists:
604
+ case v.emailAlreadyExists:
605
+ case v.phoneAlreadyExists:
239
606
  return t.errorUserExists;
240
- case b.userBlocked:
607
+ case v.userBlocked:
241
608
  return t.errorUserBlocked;
242
- case b.rateLimit:
609
+ case v.rateLimit:
243
610
  return t.errorRateLimit;
244
- case b.invalidToken:
611
+ case v.invalidToken:
245
612
  return i === "code" ? t.errorInvalidCode : t.errorInvalidToken;
246
- case b.invalidCode:
613
+ case v.invalidCode:
247
614
  return t.errorInvalidCode;
248
- case b.passwordMismatch:
615
+ case v.passwordMismatch:
249
616
  return t.errorPasswordMismatch;
250
- case b.passwordRecentlyUsed:
617
+ case v.passwordRecentlyUsed:
251
618
  return t.errorPasswordRecentlyUsed;
252
- case b.passwordPersonalData:
619
+ case v.passwordPersonalData:
253
620
  return t.errorPasswordPersonalData;
254
- case b.passwordWeak:
621
+ case v.passwordWeak:
255
622
  return t.errorPasswordWeak;
256
- case b.passwordPwned:
623
+ case v.passwordPwned:
257
624
  return t.errorPasswordPwned;
258
- case b.challengeRequired:
625
+ case v.challengeRequired:
259
626
  return t.errorChallengeRequired;
260
- case b.sessionAlreadyExists:
627
+ case v.sessionAlreadyExists:
261
628
  return t.errorSessionExists;
262
- case b.oauthUnauthorized:
263
- case b.oauthBadRequest:
629
+ case v.oauthUnauthorized:
630
+ case v.oauthBadRequest:
264
631
  return t.errorOAuth;
265
- case b.authMethodUnsupported:
632
+ case v.authMethodUnsupported:
266
633
  return t.errorMethodDisabled;
267
634
  }
268
635
  return r.code === 0 && /fetch|network/i.test(r.message) ? t.errorNetwork : r.message || t.errorGeneric;
269
636
  }
270
- function k(e, t, i) {
637
+ function C(e, t, i) {
271
638
  for (const r of t) {
272
639
  const a = e[r];
273
640
  if (typeof a == "function")
@@ -277,25 +644,33 @@ function k(e, t, i) {
277
644
  new Error(`Appwrite SDK is missing ${t[0]}(). Update the appwrite package.`)
278
645
  );
279
646
  }
280
- const D = "authui", N = ["userId", "secret", "expire", "project", "error", D], j = () => ({
647
+ const W = "authui", tt = ["userId", "secret", "expire", "project", "error", W], et = () => ({
281
648
  status: "loading",
282
649
  user: null,
283
650
  mfaFactors: null,
284
651
  pending: null,
285
652
  configured: !1
286
653
  });
287
- class rt {
654
+ class mt {
288
655
  constructor() {
289
- this.client = null, this.account = null, this.config = null, this.state = j(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null;
656
+ this.client = null, this.account = null, this.config = null, this.state = et(), this.listeners = /* @__PURE__ */ new Map(), this.refreshPromise = null, this.preview = null;
290
657
  }
291
658
  // ───────────────────────────── configuration ─────────────────────────────
292
659
  /** Configure the Appwrite client. Safe to call more than once; the last call wins. */
293
660
  configure(t) {
294
- this.config = t, this.client = new Q().setEndpoint(t.endpoint).setProject(t.project), this.account = new J(this.client), this.setState({ configured: !0, status: "loading" }), typeof window < "u" && this.handleRedirect().then(() => this.refresh());
661
+ 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.setState({ configured: !0, status: "loading" }), this.preview ? this.refresh() : typeof window < "u" && this.handleRedirect().then(() => this.refresh());
295
662
  }
296
663
  get isConfigured() {
297
664
  return this.config !== null;
298
665
  }
666
+ /** True when running against the in-memory preview account. */
667
+ get isPreview() {
668
+ return this.preview !== null;
669
+ }
670
+ /** Preview only: sign the sample user in without any form. */
671
+ async previewSignIn() {
672
+ this.preview && (this.preview.signInDirectly(), await this.refresh());
673
+ }
299
674
  getConfig() {
300
675
  return this.config;
301
676
  }
@@ -303,8 +678,15 @@ class rt {
303
678
  getClient() {
304
679
  return this.client;
305
680
  }
681
+ /**
682
+ * The Account service Auth UI talks to. Reuse it for prefs, JWTs or anything else
683
+ * on the signed-in account. In preview mode this is the in-memory stand-in.
684
+ */
685
+ getAccount() {
686
+ return this.account;
687
+ }
306
688
  getStrings() {
307
- return { ...et, ...this.config?.strings ?? {} };
689
+ return { ...lt, ...this.config?.strings ?? {} };
308
690
  }
309
691
  getState() {
310
692
  return { ...this.state };
@@ -330,7 +712,7 @@ class rt {
330
712
  this.state = { ...this.state, ...t }, this.emit("change", this.getState());
331
713
  }
332
714
  fail(t) {
333
- const i = _(t);
715
+ const i = T(t);
334
716
  throw this.emit("error", i), t;
335
717
  }
336
718
  acct() {
@@ -350,10 +732,10 @@ class rt {
350
732
  const i = await this.account.get();
351
733
  this.setState({ status: "signed-in", user: i, mfaFactors: null }), t || this.emit("signed-in", i);
352
734
  } catch (i) {
353
- if (F(i, b.moreFactorsRequired)) {
735
+ if (N(i, v.moreFactorsRequired)) {
354
736
  let r = null;
355
737
  try {
356
- r = await k(
738
+ r = await C(
357
739
  this.account,
358
740
  ["listMFAFactors", "listMfaFactors"],
359
741
  []
@@ -384,7 +766,7 @@ class rt {
384
766
  }
385
767
  async signUp(t, i, r) {
386
768
  try {
387
- await this.acct().create(z.unique(), t.trim(), i, r?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
769
+ await this.acct().create(L.unique(), t.trim(), i, r?.trim() || void 0), await this.acct().createEmailPasswordSession(t.trim(), i);
388
770
  } catch (a) {
389
771
  this.fail(a);
390
772
  }
@@ -398,24 +780,36 @@ class rt {
398
780
  }
399
781
  await this.afterSignIn();
400
782
  }
401
- /** Redirects the browser to the provider. Never resolves in a browser. */
402
- signInWithOAuth(t) {
783
+ /**
784
+ * Redirects the browser to the provider; the returned promise only resolves in
785
+ * preview mode, where the sign in completes in place.
786
+ */
787
+ async signInWithOAuth(t) {
403
788
  const i = this.config?.oauthScopes?.[t];
789
+ let r;
404
790
  try {
405
- this.acct().createOAuth2Token(
791
+ r = this.acct().createOAuth2Token(
406
792
  t,
407
793
  this.redirectUrl("oauth"),
408
794
  this.redirectUrl("oauth-failed"),
409
795
  i
410
796
  );
411
- } catch (r) {
412
- this.fail(r);
797
+ } catch (a) {
798
+ this.fail(a);
799
+ }
800
+ if (r && typeof r.then == "function") {
801
+ try {
802
+ await r;
803
+ } catch (a) {
804
+ this.fail(a);
805
+ }
806
+ await this.afterSignIn();
413
807
  }
414
808
  }
415
809
  async sendMagicUrl(t) {
416
810
  try {
417
811
  return await this.acct().createMagicURLToken(
418
- z.unique(),
812
+ L.unique(),
419
813
  t.trim(),
420
814
  this.redirectUrl("magic-url"),
421
815
  this.config?.securityPhrase ?? !0
@@ -427,7 +821,7 @@ class rt {
427
821
  async sendEmailOtp(t) {
428
822
  try {
429
823
  return await this.acct().createEmailToken(
430
- z.unique(),
824
+ L.unique(),
431
825
  t.trim(),
432
826
  this.config?.securityPhrase ?? !0
433
827
  );
@@ -437,7 +831,7 @@ class rt {
437
831
  }
438
832
  async sendPhoneOtp(t) {
439
833
  try {
440
- return await this.acct().createPhoneToken(z.unique(), t.replace(/[\s()-]/g, ""));
834
+ return await this.acct().createPhoneToken(L.unique(), t.replace(/[\s()-]/g, ""));
441
835
  } catch (i) {
442
836
  return this.fail(i);
443
837
  }
@@ -454,7 +848,7 @@ class rt {
454
848
  // ─────────────────────────────── MFA ───────────────────────────────
455
849
  async createMfaChallenge(t) {
456
850
  try {
457
- return await k(
851
+ return await C(
458
852
  this.acct(),
459
853
  ["createMFAChallenge", "createMfaChallenge"],
460
854
  [t]
@@ -466,7 +860,7 @@ class rt {
466
860
  /** Verify a challenge. Completes a pending sign in, or acts as a step-up for protected actions. */
467
861
  async completeMfaChallenge(t, i, r = {}) {
468
862
  try {
469
- await k(
863
+ await C(
470
864
  this.acct(),
471
865
  ["updateMFAChallenge", "updateMfaChallenge"],
472
866
  [t, i.trim()]
@@ -478,7 +872,7 @@ class rt {
478
872
  }
479
873
  async listMfaFactors() {
480
874
  try {
481
- return await k(this.acct(), ["listMFAFactors", "listMfaFactors"], []);
875
+ return await C(this.acct(), ["listMFAFactors", "listMfaFactors"], []);
482
876
  } catch (t) {
483
877
  return this.fail(t);
484
878
  }
@@ -493,7 +887,7 @@ class rt {
493
887
  }
494
888
  async addAuthenticator() {
495
889
  try {
496
- return await k(
890
+ return await C(
497
891
  this.acct(),
498
892
  ["createMFAAuthenticator", "createMfaAuthenticator"],
499
893
  ["totp"]
@@ -504,7 +898,7 @@ class rt {
504
898
  }
505
899
  async verifyAuthenticator(t) {
506
900
  try {
507
- await k(
901
+ await C(
508
902
  this.acct(),
509
903
  ["updateMFAAuthenticator", "updateMfaAuthenticator"],
510
904
  ["totp", t.trim()]
@@ -517,7 +911,7 @@ class rt {
517
911
  /** Requires a recent MFA challenge (server rejects with user_challenge_required otherwise). */
518
912
  async removeAuthenticator() {
519
913
  try {
520
- await k(this.acct(), ["deleteMFAAuthenticator", "deleteMfaAuthenticator"], ["totp"]);
914
+ await C(this.acct(), ["deleteMFAAuthenticator", "deleteMfaAuthenticator"], ["totp"]);
521
915
  } catch (t) {
522
916
  this.fail(t);
523
917
  }
@@ -525,7 +919,7 @@ class rt {
525
919
  }
526
920
  async createRecoveryCodes() {
527
921
  try {
528
- return (await k(
922
+ return (await C(
529
923
  this.acct(),
530
924
  ["createMFARecoveryCodes", "createMfaRecoveryCodes"],
531
925
  []
@@ -537,7 +931,7 @@ class rt {
537
931
  /** Requires a recent MFA challenge. */
538
932
  async regenerateRecoveryCodes() {
539
933
  try {
540
- return (await k(
934
+ return (await C(
541
935
  this.acct(),
542
936
  ["updateMFARecoveryCodes", "updateMfaRecoveryCodes"],
543
937
  []
@@ -549,7 +943,7 @@ class rt {
549
943
  /** Requires a recent MFA challenge. */
550
944
  async getRecoveryCodes() {
551
945
  try {
552
- return (await k(
946
+ return (await C(
553
947
  this.acct(),
554
948
  ["getMFARecoveryCodes", "getMfaRecoveryCodes"],
555
949
  []
@@ -663,7 +1057,7 @@ class rt {
663
1057
  }
664
1058
  async sendEmailVerification() {
665
1059
  try {
666
- await k(
1060
+ await C(
667
1061
  this.acct(),
668
1062
  ["createEmailVerification", "createVerification"],
669
1063
  [this.redirectUrl("verify-email")]
@@ -703,8 +1097,8 @@ class rt {
703
1097
  /** Build the URL Appwrite should send the user back to for a given flow. */
704
1098
  redirectUrl(t) {
705
1099
  const i = this.config?.redirectUrl ?? (typeof window < "u" ? window.location.origin + window.location.pathname : ""), r = new URL(i, typeof window < "u" ? window.location.href : void 0);
706
- for (const a of N) r.searchParams.delete(a);
707
- return r.searchParams.set(D, t), r.toString();
1100
+ for (const a of tt) r.searchParams.delete(a);
1101
+ return r.searchParams.set(W, t), r.toString();
708
1102
  }
709
1103
  setPending(t) {
710
1104
  this.setState({ pending: t });
@@ -715,7 +1109,7 @@ class rt {
715
1109
  */
716
1110
  async handleRedirect() {
717
1111
  if (typeof window > "u") return !1;
718
- const t = new URLSearchParams(window.location.search), i = t.get(D);
1112
+ const t = new URLSearchParams(window.location.search), i = t.get(W);
719
1113
  if (!i) return !1;
720
1114
  const r = t.get("userId") ?? "", a = t.get("secret") ?? "";
721
1115
  this.cleanUrl();
@@ -732,7 +1126,7 @@ class rt {
732
1126
  r && a && this.setState({ pending: { type: "reset-password", userId: r, secret: a } });
733
1127
  break;
734
1128
  case "verify-email":
735
- r && a && (await k(
1129
+ r && a && (await C(
736
1130
  this.acct(),
737
1131
  ["updateEmailVerification", "updateVerification"],
738
1132
  [r, a]
@@ -745,24 +1139,24 @@ class rt {
745
1139
  }));
746
1140
  break;
747
1141
  }
748
- } catch (u) {
749
- const h = _(u);
750
- this.emit("error", h), this.setState({ pending: { type: "notice", message: h.message, tone: "error" } });
1142
+ } catch (h) {
1143
+ const u = T(h);
1144
+ this.emit("error", u), this.setState({ pending: { type: "notice", message: u.message, tone: "error" } });
751
1145
  }
752
1146
  return !0;
753
1147
  }
754
1148
  cleanUrl() {
755
1149
  const t = new URL(window.location.href);
756
- for (const i of N) t.searchParams.delete(i);
1150
+ for (const i of tt) t.searchParams.delete(i);
757
1151
  window.history.replaceState(window.history.state, "", t.toString());
758
1152
  }
759
1153
  /** Test helper. */
760
1154
  reset() {
761
- this.client = null, this.account = null, this.config = null, this.state = j(), this.listeners.clear();
1155
+ this.client = null, this.account = null, this.preview = null, this.config = null, this.state = et(), this.listeners.clear();
762
1156
  }
763
1157
  }
764
- const o = new rt();
765
- class at {
1158
+ const n = new mt();
1159
+ class gt {
766
1160
  constructor() {
767
1161
  this.listeners = /* @__PURE__ */ new Set(), this.observer = null, this.media = null, this.notify = () => {
768
1162
  const t = this.isDark("auto");
@@ -790,14 +1184,14 @@ class at {
790
1184
  this.observer?.disconnect(), this.observer = null, this.media?.removeEventListener?.("change", this.notify), this.media = null;
791
1185
  }
792
1186
  }
793
- const W = new at(), G = {
1187
+ const it = new gt(), st = {
794
1188
  none: "0px",
795
1189
  sm: "0.25rem",
796
1190
  md: "0.625rem",
797
1191
  lg: "0.875rem",
798
1192
  xl: "1.125rem",
799
1193
  full: "1.5rem"
800
- }, ot = A`
1194
+ }, vt = E`
801
1195
  :host {
802
1196
  /* Light theme (matches :root in the console) */
803
1197
  --authui-background: oklch(1 0 0);
@@ -875,7 +1269,7 @@ const W = new at(), G = {
875
1269
  --authui-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
876
1270
  color-scheme: dark;
877
1271
  }
878
- `, nt = A`
1272
+ `, bt = E`
879
1273
  *,
880
1274
  *::before,
881
1275
  *::after {
@@ -1378,6 +1772,12 @@ const W = new at(), G = {
1378
1772
  gap: 8px;
1379
1773
  flex-wrap: wrap;
1380
1774
  }
1775
+ .row-title svg {
1776
+ width: 16px;
1777
+ height: 16px;
1778
+ color: var(--authui-muted-foreground);
1779
+ flex-shrink: 0;
1780
+ }
1381
1781
  .row-sub {
1382
1782
  font-size: 12px;
1383
1783
  color: var(--authui-muted-foreground);
@@ -1612,62 +2012,62 @@ const W = new at(), G = {
1612
2012
  }
1613
2013
  }
1614
2014
  `;
1615
- var ct = Object.defineProperty, lt = (e, t, i, r) => {
1616
- for (var a = void 0, u = e.length - 1, h; u >= 0; u--)
1617
- (h = e[u]) && (a = h(t, i, a) || a);
1618
- return a && ct(t, i, a), a;
2015
+ var yt = Object.defineProperty, wt = (e, t, i, r) => {
2016
+ for (var a = void 0, h = e.length - 1, u; h >= 0; h--)
2017
+ (u = e[h]) && (a = u(t, i, a) || a);
2018
+ return a && yt(t, i, a), a;
1619
2019
  };
1620
- const H = class H extends V {
2020
+ const Q = class Q extends K {
1621
2021
  constructor() {
1622
- super(...arguments), this.auth = o.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
2022
+ super(...arguments), this.auth = n.getState(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
1623
2023
  }
1624
2024
  connectedCallback() {
1625
- super.connectedCallback(), this.auth = o.getState(), this.unsubscribeStore = o.on("change", (t) => {
2025
+ super.connectedCallback(), this.auth = n.getState(), this.unsubscribeStore = n.on("change", (t) => {
1626
2026
  this.auth = t, this.applyBranding();
1627
- }), this.unsubscribeTheme = W.subscribe(() => this.applyBranding()), this.applyBranding();
2027
+ }), this.unsubscribeTheme = it.subscribe(() => this.applyBranding()), this.applyBranding();
1628
2028
  }
1629
2029
  disconnectedCallback() {
1630
2030
  super.disconnectedCallback(), this.unsubscribeStore?.(), this.unsubscribeTheme?.(), this.unsubscribeStore = null, this.unsubscribeTheme = null;
1631
2031
  }
1632
2032
  get strings() {
1633
- return o.getStrings();
2033
+ return n.getStrings();
1634
2034
  }
1635
2035
  /** Translate a string key with optional `{placeholders}`. */
1636
2036
  t(t, i) {
1637
- return it(this.strings[t], i);
2037
+ return dt(this.strings[t], i);
1638
2038
  }
1639
2039
  get config() {
1640
- return o.getConfig();
2040
+ return n.getConfig();
1641
2041
  }
1642
2042
  get productName() {
1643
2043
  return this.config?.branding?.name ?? "";
1644
2044
  }
1645
2045
  /** Push theme and branding from config onto the host element. */
1646
2046
  applyBranding() {
1647
- const t = this.config?.branding, i = W.isDark(t?.theme ?? "auto");
2047
+ const t = this.config?.branding, i = it.isDark(t?.theme ?? "auto");
1648
2048
  this.setAttribute("data-theme", i ? "dark" : "light"), t?.primary && (this.style.setProperty("--authui-primary", t.primary), this.style.setProperty(
1649
2049
  "--authui-primary-foreground",
1650
2050
  t.primaryForeground ?? "#ffffff"
1651
- )), t?.radius && G[t.radius] && this.style.setProperty("--authui-radius", G[t.radius]);
2051
+ )), t?.radius && st[t.radius] && this.style.setProperty("--authui-radius", st[t.radius]);
1652
2052
  }
1653
2053
  /** Emit a composed custom event from this element. */
1654
2054
  fire(t, i) {
1655
2055
  this.dispatchEvent(new CustomEvent(t, { detail: i, bubbles: !0, composed: !0 }));
1656
2056
  }
1657
2057
  };
1658
- H.styles = [ot, nt];
1659
- let x = H;
1660
- lt([
2058
+ Q.styles = [vt, bt];
2059
+ let x = Q;
2060
+ wt([
1661
2061
  d()
1662
2062
  ], x.prototype, "auth");
1663
- var dt = Object.defineProperty, ut = Object.getOwnPropertyDescriptor, w = (e, t, i, r) => {
1664
- for (var a = r > 1 ? void 0 : r ? ut(t, i) : t, u = e.length - 1, h; u >= 0; u--)
1665
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
1666
- return r && a && dt(t, i, a), a;
2063
+ var $t = Object.defineProperty, xt = Object.getOwnPropertyDescriptor, y = (e, t, i, r) => {
2064
+ for (var a = r > 1 ? void 0 : r ? xt(t, i) : t, h = e.length - 1, u; h >= 0; h--)
2065
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
2066
+ return r && a && $t(t, i, a), a;
1667
2067
  };
1668
- let v = class extends V {
2068
+ let b = class extends K {
1669
2069
  constructor() {
1670
- 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 = "";
2070
+ 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 = "";
1671
2071
  }
1672
2072
  connectedCallback() {
1673
2073
  super.connectedCallback(), this.configure();
@@ -1677,8 +2077,8 @@ let v = class extends V {
1677
2077
  }
1678
2078
  configure() {
1679
2079
  if (!this.endpoint || !this.project) return;
1680
- const e = this.toConfig(), t = o.getConfig();
1681
- t && JSON.stringify(t) === JSON.stringify(e) || o.configure(e);
2080
+ const e = this.toConfig(), t = n.getConfig();
2081
+ t && JSON.stringify(t) === JSON.stringify(e) || n.configure(e);
1682
2082
  }
1683
2083
  toConfig() {
1684
2084
  const e = { oauth: [] };
@@ -1705,115 +2105,121 @@ let v = class extends V {
1705
2105
  legal: {
1706
2106
  termsUrl: this.termsUrl || void 0,
1707
2107
  privacyUrl: this.privacyUrl || void 0
1708
- }
2108
+ },
2109
+ preview: this.preview === "" || this.preview === "false" ? void 0 : !0
1709
2110
  };
1710
2111
  }
1711
2112
  };
1712
- v.styles = A`
2113
+ b.styles = E`
1713
2114
  :host {
1714
2115
  display: none;
1715
2116
  }
1716
2117
  `;
1717
- w([
1718
- g({ type: String })
1719
- ], v.prototype, "endpoint", 2);
1720
- w([
1721
- g({ type: String })
1722
- ], v.prototype, "project", 2);
1723
- w([
1724
- g({ type: String, attribute: "redirect-url" })
1725
- ], v.prototype, "redirectUrl", 2);
1726
- w([
1727
- g({ type: String, attribute: "success-url" })
1728
- ], v.prototype, "successUrl", 2);
1729
- w([
1730
- g({ type: String })
1731
- ], v.prototype, "methods", 2);
1732
- w([
1733
- g({ type: String, attribute: "sign-up" })
1734
- ], v.prototype, "signUp", 2);
1735
- w([
1736
- g({ type: String, attribute: "require-name" })
1737
- ], v.prototype, "requireName", 2);
1738
- w([
1739
- g({ type: String })
1740
- ], v.prototype, "mfa", 2);
1741
- w([
1742
- g({ type: String, attribute: "security-phrase" })
1743
- ], v.prototype, "securityPhrase", 2);
1744
- w([
1745
- g({ type: String })
1746
- ], v.prototype, "name", 2);
1747
- w([
1748
- g({ type: String })
1749
- ], v.prototype, "logo", 2);
1750
- w([
1751
- g({ type: String })
1752
- ], v.prototype, "theme", 2);
1753
- w([
1754
- g({ type: String })
1755
- ], v.prototype, "radius", 2);
1756
- w([
1757
- g({ type: String })
1758
- ], v.prototype, "primary", 2);
1759
- w([
1760
- g({ type: String, attribute: "primary-foreground" })
1761
- ], v.prototype, "primaryForeground", 2);
1762
- w([
1763
- g({ type: String, attribute: "terms-url" })
1764
- ], v.prototype, "termsUrl", 2);
1765
- w([
1766
- g({ type: String, attribute: "privacy-url" })
1767
- ], v.prototype, "privacyUrl", 2);
1768
- v = w([
1769
- S("authui-config")
1770
- ], v);
1771
- var ht = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, B = (e, t, i, r) => {
1772
- for (var a = r > 1 ? void 0 : r ? pt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
1773
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
1774
- return r && a && ht(t, i, a), a;
2118
+ y([
2119
+ f({ type: String })
2120
+ ], b.prototype, "endpoint", 2);
2121
+ y([
2122
+ f({ type: String })
2123
+ ], b.prototype, "project", 2);
2124
+ y([
2125
+ f({ type: String, attribute: "redirect-url" })
2126
+ ], b.prototype, "redirectUrl", 2);
2127
+ y([
2128
+ f({ type: String, attribute: "success-url" })
2129
+ ], b.prototype, "successUrl", 2);
2130
+ y([
2131
+ f({ type: String })
2132
+ ], b.prototype, "methods", 2);
2133
+ y([
2134
+ f({ type: String, attribute: "sign-up" })
2135
+ ], b.prototype, "signUp", 2);
2136
+ y([
2137
+ f({ type: String, attribute: "require-name" })
2138
+ ], b.prototype, "requireName", 2);
2139
+ y([
2140
+ f({ type: String })
2141
+ ], b.prototype, "mfa", 2);
2142
+ y([
2143
+ f({ type: String, attribute: "security-phrase" })
2144
+ ], b.prototype, "securityPhrase", 2);
2145
+ y([
2146
+ f({ type: String })
2147
+ ], b.prototype, "name", 2);
2148
+ y([
2149
+ f({ type: String })
2150
+ ], b.prototype, "logo", 2);
2151
+ y([
2152
+ f({ type: String })
2153
+ ], b.prototype, "theme", 2);
2154
+ y([
2155
+ f({ type: String })
2156
+ ], b.prototype, "radius", 2);
2157
+ y([
2158
+ f({ type: String })
2159
+ ], b.prototype, "primary", 2);
2160
+ y([
2161
+ f({ type: String, attribute: "primary-foreground" })
2162
+ ], b.prototype, "primaryForeground", 2);
2163
+ y([
2164
+ f({ type: String, attribute: "terms-url" })
2165
+ ], b.prototype, "termsUrl", 2);
2166
+ y([
2167
+ f({ type: String, attribute: "privacy-url" })
2168
+ ], b.prototype, "privacyUrl", 2);
2169
+ y([
2170
+ f({ type: String })
2171
+ ], b.prototype, "preview", 2);
2172
+ b = y([
2173
+ I("authui-config")
2174
+ ], b);
2175
+ var kt = Object.defineProperty, Ct = Object.getOwnPropertyDescriptor, B = (e, t, i, r) => {
2176
+ for (var a = r > 1 ? void 0 : r ? Ct(t, i) : t, h = e.length - 1, u; h >= 0; h--)
2177
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
2178
+ return r && a && kt(t, i, a), a;
1775
2179
  };
1776
2180
  if (typeof document < "u" && !document.getElementById("authui-fouc")) {
1777
2181
  const e = document.createElement("style");
1778
- e.id = "authui-fouc", e.textContent = "authui-signed-in:not([ready]),authui-signed-out:not([ready]){display:none}", document.head.appendChild(e);
2182
+ e.id = "authui-fouc", e.textContent = "authui-show:not([ready]){display:none}", document.head.appendChild(e);
2183
+ }
2184
+ const Pt = ["loading", "signed-out", "signed-in", "mfa-required"];
2185
+ function j(e) {
2186
+ return e ? e.split(/[\s,]+/).map((t) => t.trim()).filter((t) => Pt.includes(t)) : [];
1779
2187
  }
1780
- class T extends V {
2188
+ let D = class extends K {
1781
2189
  constructor() {
1782
- super(...arguments), this.show = !1, this.unsubscribe = null;
2190
+ super(...arguments), this.when = "", this.unless = "", this.status = n.getState().status, this.unsubscribe = null;
1783
2191
  }
1784
2192
  connectedCallback() {
1785
- super.connectedCallback(), this.evaluate(o.getState().status), this.unsubscribe = o.on("change", (t) => this.evaluate(t.status));
2193
+ super.connectedCallback(), this.status = n.getState().status, this.unsubscribe = n.on("change", (e) => this.status = e.status);
1786
2194
  }
1787
2195
  disconnectedCallback() {
1788
- super.disconnectedCallback(), this.unsubscribe?.();
2196
+ super.disconnectedCallback(), this.unsubscribe?.(), this.unsubscribe = null;
1789
2197
  }
1790
- evaluate(t) {
1791
- t !== "loading" && (this.show = this.shouldShow(t), this.setAttribute("ready", ""), this.style.display = "contents");
2198
+ /** Whether the current status satisfies `when` and `unless`. */
2199
+ get visible() {
2200
+ const e = j(this.when), t = j(this.unless);
2201
+ return !(this.status === "loading" && !e.includes("loading") || e.length > 0 && !e.includes(this.status) || t.includes(this.status));
2202
+ }
2203
+ updated() {
2204
+ (this.status !== "loading" || j(this.when).includes("loading")) && (this.setAttribute("ready", ""), this.style.display = "contents");
1792
2205
  }
1793
2206
  render() {
1794
- return this.show ? s`<slot></slot>` : n;
2207
+ return this.visible ? s`<slot></slot>` : o;
1795
2208
  }
1796
- }
2209
+ };
2210
+ B([
2211
+ f({ type: String })
2212
+ ], D.prototype, "when", 2);
2213
+ B([
2214
+ f({ type: String })
2215
+ ], D.prototype, "unless", 2);
1797
2216
  B([
1798
2217
  d()
1799
- ], T.prototype, "show", 2);
1800
- let Y = class extends T {
1801
- shouldShow(e) {
1802
- return e === "signed-in";
1803
- }
1804
- };
1805
- Y = B([
1806
- S("authui-signed-in")
1807
- ], Y);
1808
- let K = class extends T {
1809
- shouldShow(e) {
1810
- return e !== "signed-in";
1811
- }
1812
- };
1813
- K = B([
1814
- S("authui-signed-out")
1815
- ], K);
1816
- const ft = A`
2218
+ ], D.prototype, "status", 2);
2219
+ D = B([
2220
+ I("authui-show")
2221
+ ], D);
2222
+ const St = E`
1817
2223
  :host {
1818
2224
  display: block;
1819
2225
  width: 100%;
@@ -1845,6 +2251,10 @@ const ft = A`
1845
2251
  .header:empty {
1846
2252
  display: none;
1847
2253
  }
2254
+ .header .preview {
2255
+ align-self: center;
2256
+ margin-bottom: 4px;
2257
+ }
1848
2258
  .alert .dismiss {
1849
2259
  position: absolute;
1850
2260
  top: 4px;
@@ -1857,7 +2267,7 @@ const ft = A`
1857
2267
  height: 14px;
1858
2268
  margin: 0;
1859
2269
  }
1860
- `, f = (e) => s`<svg
2270
+ `, m = (e) => s`<svg
1861
2271
  xmlns="http://www.w3.org/2000/svg"
1862
2272
  viewBox="0 0 24 24"
1863
2273
  fill="none"
@@ -1869,169 +2279,173 @@ const ft = A`
1869
2279
  >
1870
2280
  ${e}
1871
2281
  </svg>`, c = {
1872
- mail: f(
2282
+ mail: m(
1873
2283
  l`<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"/>`
1874
2284
  ),
1875
- phone: f(
2285
+ phone: m(
1876
2286
  l`<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"/>`
1877
2287
  ),
1878
- user: f(
2288
+ user: m(
1879
2289
  l`<path d="M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/>`
1880
2290
  ),
1881
- userX: f(
2291
+ userX: m(
1882
2292
  l`<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"/>`
1883
2293
  ),
1884
- lock: f(
2294
+ lock: m(
1885
2295
  l`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`
1886
2296
  ),
1887
- key: f(
2297
+ key: m(
1888
2298
  l`<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"/>`
1889
2299
  ),
1890
- shield: f(
2300
+ shield: m(
1891
2301
  l`<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"/>`
1892
2302
  ),
1893
- shieldCheck: f(
2303
+ shieldCheck: m(
1894
2304
  l`<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"/>`
1895
2305
  ),
1896
- smartphone: f(
2306
+ smartphone: m(
1897
2307
  l`<rect width="14" height="20" x="5" y="2" rx="2" ry="2"/><path d="M12 18h.01"/>`
1898
2308
  ),
1899
- monitor: f(
2309
+ monitor: m(
1900
2310
  l`<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"/>`
1901
2311
  ),
1902
- globe: f(
2312
+ globe: m(
1903
2313
  l`<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"/>`
1904
2314
  ),
1905
- logOut: f(
2315
+ logOut: m(
1906
2316
  l`<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"/>`
1907
2317
  ),
1908
- settings: f(
2318
+ settings: m(
1909
2319
  l`<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"/>`
1910
2320
  ),
1911
- x: f(l`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),
1912
- check: f(l`<path d="M20 6 9 17l-5-5"/>`),
1913
- copy: f(
2321
+ x: m(l`<path d="M18 6 6 18"/><path d="m6 6 12 12"/>`),
2322
+ check: m(l`<path d="M20 6 9 17l-5-5"/>`),
2323
+ copy: m(
1914
2324
  l`<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"/>`
1915
2325
  ),
1916
- eye: f(
2326
+ eye: m(
1917
2327
  l`<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"/>`
1918
2328
  ),
1919
- eyeOff: f(
2329
+ eyeOff: m(
1920
2330
  l`<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"/>`
1921
2331
  ),
1922
- arrowLeft: f(l`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),
1923
- alert: f(
2332
+ arrowLeft: m(l`<path d="m12 19-7-7 7-7"/><path d="M19 12H5"/>`),
2333
+ alert: m(
1924
2334
  l`<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"/>`
1925
2335
  ),
1926
- info: f(l`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),
1927
- checkCircle: f(l`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),
1928
- link: f(
2336
+ info: m(l`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`),
2337
+ checkCircle: m(l`<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>`),
2338
+ link: m(
1929
2339
  l`<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"/>`
1930
2340
  ),
1931
- activity: f(
2341
+ activity: m(
1932
2342
  l`<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"/>`
1933
2343
  ),
1934
- trash: f(
2344
+ trash: m(
1935
2345
  l`<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"/>`
1936
2346
  ),
1937
- sparkles: f(
2347
+ sparkles: m(
1938
2348
  l`<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"/>`
1939
2349
  ),
1940
- refresh: f(
2350
+ refresh: m(
1941
2351
  l`<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"/>`
1942
2352
  ),
1943
- chevronDown: f(l`<path d="m6 9 6 6 6-6"/>`),
1944
- ghost: f(
2353
+ chevronDown: m(l`<path d="m6 9 6 6 6-6"/>`),
2354
+ ghost: m(
1945
2355
  l`<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"/>`
1946
2356
  ),
1947
- qr: f(
2357
+ qr: m(
1948
2358
  l`<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"/>`
1949
2359
  )
1950
- }, y = (e, t = "0 0 24 24") => s`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, mt = {
1951
- google: y(
2360
+ }, w = (e, t = "0 0 24 24") => s`<svg xmlns="http://www.w3.org/2000/svg" viewBox=${t} aria-hidden="true">${e}</svg>`, At = {
2361
+ google: w(
1952
2362
  l`<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"/>`
1953
2363
  ),
1954
- github: y(
2364
+ github: w(
1955
2365
  l`<path fill="currentColor" d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"/>`
1956
2366
  ),
1957
- apple: y(
2367
+ apple: w(
1958
2368
  l`<path fill="currentColor" d="M17.05 20.28c-.98.95-2.05.8-3.08.35-1.09-.46-2.09-.48-3.24 0-1.44.62-2.2.44-3.06-.35C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"/>`
1959
2369
  ),
1960
- facebook: y(
2370
+ facebook: w(
1961
2371
  l`<path fill="#1877F2" d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/>`
1962
2372
  ),
1963
- x: y(
2373
+ x: w(
1964
2374
  l`<path fill="currentColor" d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>`
1965
2375
  ),
1966
- microsoft: y(
2376
+ microsoft: w(
1967
2377
  l`<path fill="#F25022" d="M1 1h10v10H1z"/><path fill="#7FBA00" d="M13 1h10v10H13z"/><path fill="#00A4EF" d="M1 13h10v10H1z"/><path fill="#FFB900" d="M13 13h10v10H13z"/>`
1968
2378
  ),
1969
- discord: y(
2379
+ discord: w(
1970
2380
  l`<path fill="#5865F2" d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z"/>`
1971
2381
  ),
1972
- gitlab: y(
2382
+ gitlab: w(
1973
2383
  l`<path fill="#FC6D26" d="m23.6 9.593-.033-.086L20.3.98a.851.851 0 0 0-.336-.405.876.876 0 0 0-1.001.054.874.874 0 0 0-.29.44l-2.205 6.748H7.535L5.33 1.069a.857.857 0 0 0-.29-.441.876.876 0 0 0-1.001-.054.86.86 0 0 0-.336.405L.436 9.502l-.032.086a6.066 6.066 0 0 0 2.012 7.01l.011.009.03.021 4.976 3.727 2.462 1.863 1.5 1.132a1.009 1.009 0 0 0 1.22 0l1.5-1.132 2.461-1.863 5.006-3.75.013-.01a6.068 6.068 0 0 0 2.006-7.002z"/>`
1974
2384
  ),
1975
- linkedin: y(
2385
+ linkedin: w(
1976
2386
  l`<path fill="#0A66C2" d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/>`
1977
2387
  ),
1978
- slack: y(
2388
+ slack: w(
1979
2389
  l`<path fill="#E01E5A" d="M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zm1.271 0a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313z"/><path fill="#36C5F0" d="M8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zm0 1.271a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312z"/><path fill="#2EB67D" d="M18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zm-1.27 0a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.163 0a2.528 2.528 0 0 1 2.523 2.522v6.312z"/><path fill="#ECB22E" d="M15.163 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.163 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zm0-1.27a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.315A2.527 2.527 0 0 1 24 15.163a2.528 2.528 0 0 1-2.522 2.523h-6.315z"/>`
1980
2390
  ),
1981
- twitch: y(
2391
+ twitch: w(
1982
2392
  l`<path fill="#9146FF" d="M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0 1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z"/>`
1983
2393
  ),
1984
- spotify: y(
2394
+ spotify: w(
1985
2395
  l`<path fill="#1DB954" d="M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z"/>`
1986
2396
  ),
1987
- notion: y(
2397
+ notion: w(
1988
2398
  l`<path fill="currentColor" d="M4.459 4.208c.746.606 1.026.56 2.428.466l13.215-.793c.28 0 .047-.28-.046-.326L17.86 1.968c-.42-.326-.981-.7-2.055-.607L3.01 2.295c-.466.046-.56.28-.374.466zm.793 3.08v13.904c0 .747.373 1.027 1.214.98l14.523-.84c.841-.046.935-.56.935-1.167V6.354c0-.606-.233-.933-.748-.887l-15.177.887c-.56.047-.747.327-.747.933zm14.337.745c.093.42 0 .84-.42.888l-.7.14v10.264c-.608.327-1.168.514-1.635.514-.748 0-.935-.234-1.495-.933l-4.577-7.186v6.952L12.21 19s0 .84-1.168.84l-3.222.186c-.093-.186 0-.653.327-.746l.84-.233V9.854L7.822 9.76c-.094-.42.14-1.026.793-1.073l3.456-.233 4.764 7.279v-6.44l-1.215-.139c-.093-.514.28-.887.747-.933zM1.936 1.035l13.31-.98c1.634-.14 2.055-.047 3.082.7l4.249 2.986c.7.513.934.653.934 1.213v16.378c0 1.026-.373 1.634-1.68 1.726l-15.458.934c-.98.047-1.448-.093-1.962-.747l-3.129-4.06c-.56-.747-.793-1.306-.793-1.96V2.667c0-.839.374-1.54 1.447-1.632z"/>`
1989
2399
  ),
1990
- dropbox: y(
2400
+ dropbox: w(
1991
2401
  l`<path fill="#0061FF" d="M6 1.807 0 5.629l6 3.822 6.001-3.822L6 1.807zm12 0-6 3.822 6 3.822 6-3.822-6-3.822zM0 13.274l6 3.822 6.001-3.822L6 9.452l-6 3.822zm18-3.822-6 3.822 6 3.822 6-3.822-6-3.822zM6 18.371l6.001 3.822 6-3.822-6-3.822L6 18.371z"/>`
1992
2402
  ),
1993
- figma: y(
2403
+ figma: w(
1994
2404
  l`<path fill="#F24E1E" d="M8 24a4 4 0 0 0 4-4v-4H8a4 4 0 0 0 0 8z"/><path fill="#A259FF" d="M4 12a4 4 0 0 1 4-4h4v8H8a4 4 0 0 1-4-4z"/><path fill="#FF7262" d="M4 4a4 4 0 0 1 4-4h4v8H8a4 4 0 0 1-4-4z"/><path fill="#1ABCFE" d="M12 0h4a4 4 0 0 1 0 8h-4V0z"/><path fill="#0ACF83" d="M20 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0z"/>`
1995
2405
  ),
1996
- bitbucket: y(
2406
+ bitbucket: w(
1997
2407
  l`<path fill="#2684FF" d="M.778 1.213a.768.768 0 0 0-.768.892l3.263 19.81c.084.5.515.868 1.022.873H19.95a.772.772 0 0 0 .77-.646l3.27-20.03a.768.768 0 0 0-.768-.891zM14.52 15.53H9.522L8.17 8.466h7.561z"/>`
1998
2408
  ),
1999
- amazon: y(
2409
+ amazon: w(
2000
2410
  l`<path fill="currentColor" d="M.045 18.02c.072-.116.187-.124.348-.022 3.636 2.11 7.594 3.166 11.87 3.166 2.852 0 5.668-.533 8.447-1.595l.315-.14c.138-.06.234-.1.293-.13.226-.088.39-.046.525.13.12.174.09.336-.12.48-.256.19-.6.41-1.006.654-1.244.743-2.64 1.316-4.185 1.726a17.617 17.617 0 0 1-10.951-.577 17.88 17.88 0 0 1-5.43-3.35c-.1-.074-.151-.15-.151-.22 0-.047.021-.09.051-.13zm6.565-6.218c0-1.005.247-1.863.743-2.577.495-.71 1.17-1.25 2.04-1.615.796-.335 1.756-.575 2.912-.72.39-.046 1.033-.103 1.92-.174v-.37c0-.93-.105-1.558-.3-1.875-.302-.43-.78-.65-1.44-.65h-.182c-.48.046-.896.196-1.246.46-.35.27-.575.63-.675 1.096-.06.3-.206.465-.435.51l-2.52-.315c-.248-.06-.372-.18-.372-.39 0-.046.007-.09.022-.15.247-1.29.855-2.25 1.82-2.88.976-.616 2.1-.975 3.39-1.05h.54c1.65 0 2.957.434 3.888 1.29.135.15.27.3.405.48.12.165.224.314.283.45.075.134.15.33.195.57.06.254.105.42.135.51.03.104.062.3.076.615.01.313.02.493.02.553v5.28c0 .376.06.72.165 1.036.105.313.21.54.315.674l.51.674c.09.136.136.256.136.36 0 .12-.06.226-.18.314-1.2 1.05-1.86 1.62-1.963 1.71-.165.135-.373.15-.61.045a6.62 6.62 0 0 1-.526-.496l-.31-.347a9.858 9.858 0 0 1-.317-.42l-.3-.435c-.81.886-1.603 1.44-2.4 1.665-.494.15-1.093.227-1.83.227-1.11 0-2.04-.343-2.76-1.034-.72-.69-1.08-1.665-1.08-2.94l-.05-.076zm3.753-.438c0 .566.14 1.02.425 1.364.285.34.675.512 1.155.512.045 0 .106-.007.195-.02.09-.016.134-.023.166-.023.614-.16 1.08-.553 1.424-1.178.165-.28.285-.58.36-.91.09-.32.12-.59.135-.8.015-.195.015-.54.015-1.005v-.54c-.84 0-1.484.06-1.92.18-1.275.36-1.92 1.17-1.92 2.43l-.035-.01zm9.162 7.027c.03-.06.075-.11.132-.17.362-.243.714-.41 1.05-.5a8.094 8.094 0 0 1 1.612-.24c.14-.012.28 0 .41.03.65.06 1.05.168 1.172.33.063.09.099.228.099.39v.15c0 .51-.149 1.11-.424 1.8-.278.69-.664 1.248-1.156 1.68-.073.06-.14.09-.197.09-.03 0-.06 0-.09-.012-.09-.044-.107-.12-.064-.24.54-1.26.806-2.143.806-2.64 0-.15-.03-.27-.087-.344-.145-.166-.55-.257-1.224-.257-.243 0-.533.016-.87.045-.363.045-.7.09-1 .135-.09 0-.148-.014-.18-.044-.03-.03-.036-.06-.02-.106 0-.014.007-.03.02-.06z"/>`
2001
2411
  ),
2002
- paypal: y(
2412
+ paypal: w(
2003
2413
  l`<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"/>`
2004
2414
  )
2005
2415
  };
2006
- function L(e) {
2007
- return mt[e] ?? c.globe;
2416
+ function G(e) {
2417
+ return At[e] ?? c.globe;
2008
2418
  }
2009
- var gt = Object.defineProperty, bt = Object.getOwnPropertyDescriptor, C = (e, t, i, r) => {
2010
- for (var a = r > 1 ? void 0 : r ? bt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
2011
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
2012
- return r && a && gt(t, i, a), a;
2419
+ var Mt = Object.defineProperty, Ut = Object.getOwnPropertyDescriptor, P = (e, t, i, r) => {
2420
+ for (var a = r > 1 ? void 0 : r ? Ut(t, i) : t, h = e.length - 1, u; h >= 0; h--)
2421
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
2422
+ return r && a && Mt(t, i, a), a;
2013
2423
  };
2014
2424
  let $ = class extends x {
2015
2425
  constructor() {
2016
2426
  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.challenge = null, this.recovery = null, this.email = "", this.password = "", this.passwordConfirm = "", this.name = "", this.phone = "", this.code = "", this.onSignIn = (e) => {
2017
2427
  e.preventDefault(), this.run(async () => {
2018
- await o.signInWithEmailPassword(this.email, this.password), this.password = "", this.fire("authui-success", { method: "email-password" });
2428
+ await n.signInWithEmailPassword(this.email, this.password), this.password = "", this.fire("authui-success", { method: "email-password" });
2019
2429
  });
2020
2430
  }, this.onSignUp = (e) => {
2021
2431
  e.preventDefault(), this.run(async () => {
2022
- await o.signUp(this.email, this.password, this.name), this.password = "", this.fire("authui-success", { method: "sign-up" });
2432
+ await n.signUp(this.email, this.password, this.name), this.password = "", this.fire("authui-success", { method: "sign-up" });
2023
2433
  });
2024
2434
  }, this.onGuest = () => {
2025
2435
  this.run(async () => {
2026
- await o.signInAnonymously(), this.fire("authui-success", { method: "anonymous" });
2436
+ await n.signInAnonymously(), this.fire("authui-success", { method: "anonymous" });
2027
2437
  });
2028
2438
  }, this.onOAuth = (e) => {
2029
2439
  this.run(async () => {
2030
- o.signInWithOAuth(e), await new Promise((t) => setTimeout(t, 4e3));
2440
+ if (await n.signInWithOAuth(e), n.isPreview) {
2441
+ this.fire("authui-success", { method: "oauth" });
2442
+ return;
2443
+ }
2444
+ await new Promise((t) => setTimeout(t, 4e3));
2031
2445
  });
2032
2446
  }, this.onForgot = (e) => {
2033
2447
  e.preventDefault(), this.run(async () => {
2034
- await o.sendPasswordRecovery(this.email), this.notice = { tone: "success", message: this.t("resetLinkSent", { email: this.email }) };
2448
+ await n.sendPasswordRecovery(this.email), this.notice = { tone: "success", message: this.t("resetLinkSent", { email: this.email }) };
2035
2449
  });
2036
2450
  }, this.onReset = (e) => {
2037
2451
  if (e.preventDefault(), this.password !== this.passwordConfirm) {
@@ -2040,11 +2454,11 @@ let $ = class extends x {
2040
2454
  }
2041
2455
  const t = this.recovery;
2042
2456
  t && this.run(async () => {
2043
- await o.completePasswordRecovery(t.userId, t.secret, this.password), this.password = "", this.passwordConfirm = "", this.recovery = null, this.notice = { tone: "success", message: this.t("passwordUpdated") }, this.go("sign-in");
2457
+ await n.completePasswordRecovery(t.userId, t.secret, this.password), this.password = "", this.passwordConfirm = "", this.recovery = null, this.notice = { tone: "success", message: this.t("passwordUpdated") }, this.go("sign-in");
2044
2458
  });
2045
2459
  }, this.onMagicUrl = (e) => {
2046
2460
  e.preventDefault(), this.run(async () => {
2047
- const t = await o.sendMagicUrl(this.email);
2461
+ const t = await n.sendMagicUrl(this.email);
2048
2462
  this.token = {
2049
2463
  userId: t.userId,
2050
2464
  kind: "magic-url",
@@ -2054,7 +2468,7 @@ let $ = class extends x {
2054
2468
  });
2055
2469
  }, this.onEmailOtp = (e) => {
2056
2470
  e.preventDefault(), this.run(async () => {
2057
- const t = await o.sendEmailOtp(this.email);
2471
+ const t = await n.sendEmailOtp(this.email);
2058
2472
  this.token = {
2059
2473
  userId: t.userId,
2060
2474
  kind: "email-otp",
@@ -2064,37 +2478,37 @@ let $ = class extends x {
2064
2478
  });
2065
2479
  }, this.onPhoneOtp = (e) => {
2066
2480
  e.preventDefault(), this.run(async () => {
2067
- const t = await o.sendPhoneOtp(this.phone);
2481
+ const t = await n.sendPhoneOtp(this.phone);
2068
2482
  this.token = { userId: t.userId, kind: "phone", target: this.phone }, this.code = "";
2069
2483
  });
2070
2484
  }, this.onVerifyCode = (e) => {
2071
2485
  e.preventDefault();
2072
2486
  const t = this.token;
2073
2487
  t && this.run(async () => {
2074
- await o.signInWithToken(t.userId, this.code), this.code = "", this.fire("authui-success", { method: t.kind });
2488
+ await n.signInWithToken(t.userId, this.code), this.code = "", this.fire("authui-success", { method: t.kind });
2075
2489
  }, "code");
2076
2490
  }, this.onChooseFactor = (e) => {
2077
2491
  this.run(async () => {
2078
- const t = await o.createMfaChallenge(e);
2492
+ const t = await n.createMfaChallenge(e);
2079
2493
  this.challenge = { id: t.$id, factor: e }, this.code = "";
2080
2494
  });
2081
2495
  }, this.onVerifyFactor = (e) => {
2082
2496
  e.preventDefault();
2083
2497
  const t = this.challenge;
2084
2498
  t && this.run(async () => {
2085
- await o.completeMfaChallenge(t.id, this.code), this.code = "", this.challenge = null, this.fire("authui-success", { method: "mfa" });
2499
+ await n.completeMfaChallenge(t.id, this.code), this.code = "", this.challenge = null, this.fire("authui-success", { method: "mfa" });
2086
2500
  }, "code");
2087
2501
  }, this.onCancelMfa = () => {
2088
2502
  this.run(async () => {
2089
2503
  try {
2090
- await o.signOut();
2504
+ await n.signOut();
2091
2505
  } catch (e) {
2092
- if (!F(e, b.sessionNotFound)) throw e;
2506
+ if (!N(e, v.sessionNotFound)) throw e;
2093
2507
  }
2094
2508
  this.go("sign-in");
2095
2509
  });
2096
2510
  }, this.onSignOut = () => {
2097
- this.run(() => o.signOut());
2511
+ this.run(() => n.signOut());
2098
2512
  };
2099
2513
  }
2100
2514
  connectedCallback() {
@@ -2109,10 +2523,10 @@ let $ = class extends x {
2109
2523
  /** React to store transitions: MFA pending, redirect results, sign in. */
2110
2524
  syncFromStore() {
2111
2525
  const { status: e, pending: t } = this.auth;
2112
- e === "mfa-required" && this.step !== "mfa" && this.go("mfa"), 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") }, o.setPending(null)), t?.type === "notice" && (this.notice = {
2526
+ e === "mfa-required" && this.step !== "mfa" && this.go("mfa"), 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 = {
2113
2527
  tone: t.tone === "error" ? "error" : t.tone,
2114
2528
  message: t.message
2115
- }, o.setPending(null));
2529
+ }, n.setPending(null));
2116
2530
  }
2117
2531
  /** Navigate between screens and reset transient state. */
2118
2532
  go(e) {
@@ -2125,7 +2539,7 @@ let $ = class extends x {
2125
2539
  try {
2126
2540
  await e();
2127
2541
  } catch (i) {
2128
- this.error = Z(i, this.strings, t);
2542
+ this.error = at(i, this.strings, t);
2129
2543
  } finally {
2130
2544
  this.busy = !1;
2131
2545
  }
@@ -2152,7 +2566,7 @@ let $ = class extends x {
2152
2566
  >
2153
2567
  ${c.x}
2154
2568
  </button>
2155
- </div>` : n}
2569
+ </div>` : o}
2156
2570
  ${e}
2157
2571
  </div>
2158
2572
  `;
@@ -2184,9 +2598,10 @@ let $ = class extends x {
2184
2598
  }
2185
2599
  return s`
2186
2600
  <header class="header">
2187
- ${e ? s`<img class="logo" src=${e} alt=${t || "Logo"} />` : n}
2601
+ ${e ? s`<img class="logo" src=${e} alt=${t || "Logo"} />` : o}
2602
+ ${n.isPreview ? s`<span class="badge badge-info preview">${this.t("preview")}</span>` : o}
2188
2603
  <h2 class="title" id="authui-title">${i}</h2>
2189
- ${r ? s`<p class="description">${r}</p>` : n}
2604
+ ${r ? s`<p class="description">${r}</p>` : o}
2190
2605
  </header>
2191
2606
  `;
2192
2607
  }
@@ -2194,11 +2609,11 @@ let $ = class extends x {
2194
2609
  return this.error ? s`<div class="alert alert-error" role="alert">
2195
2610
  ${c.alert}
2196
2611
  <div class="alert-body">${this.error}</div>
2197
- </div>` : n;
2612
+ </div>` : o;
2198
2613
  }
2199
2614
  submitButton(e, t = "btn-primary") {
2200
2615
  return s`<button class="btn ${t} btn-block" type="submit" ?disabled=${this.busy}>
2201
- ${this.busy ? s`<span class="spinner" aria-hidden="true"></span>` : n} ${e}
2616
+ ${this.busy ? s`<span class="spinner" aria-hidden="true"></span>` : o} ${e}
2202
2617
  </button>`;
2203
2618
  }
2204
2619
  passwordField(e) {
@@ -2212,7 +2627,7 @@ let $ = class extends x {
2212
2627
  @click=${() => this.go("forgot-password")}
2213
2628
  >
2214
2629
  ${this.t("forgotPassword")}
2215
- </button>` : n}
2630
+ </button>` : o}
2216
2631
  </label>
2217
2632
  <div class="input-wrap">
2218
2633
  <input
@@ -2235,7 +2650,7 @@ let $ = class extends x {
2235
2650
  ${this.showPassword ? c.eyeOff : c.eye}
2236
2651
  </button>
2237
2652
  </div>
2238
- ${e.hint ? s`<p class="hint">${e.hint}</p>` : n}
2653
+ ${e.hint ? s`<p class="hint">${e.hint}</p>` : o}
2239
2654
  </div>
2240
2655
  `;
2241
2656
  }
@@ -2275,11 +2690,11 @@ let $ = class extends x {
2275
2690
  }
2276
2691
  legal() {
2277
2692
  const e = this.config?.legal;
2278
- return !e?.termsUrl && !e?.privacyUrl ? n : s`<p class="legal">
2693
+ return !e?.termsUrl && !e?.privacyUrl ? o : s`<p class="legal">
2279
2694
  ${this.t("agreeTo")}
2280
- ${e.termsUrl ? s`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>` : n}
2281
- ${e.termsUrl && e.privacyUrl ? s` ${this.t("and")} ` : n}
2282
- ${e.privacyUrl ? s`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>` : n}.
2695
+ ${e.termsUrl ? s`<a href=${e.termsUrl} target="_blank" rel="noopener">${this.t("terms")}</a>` : o}
2696
+ ${e.termsUrl && e.privacyUrl ? s` ${this.t("and")} ` : o}
2697
+ ${e.privacyUrl ? s`<a href=${e.privacyUrl} target="_blank" rel="noopener">${this.t("privacy")}</a>` : o}.
2283
2698
  </p>`;
2284
2699
  }
2285
2700
  backLink(e = "sign-in") {
@@ -2326,7 +2741,7 @@ let $ = class extends x {
2326
2741
  <span class="avatar">${t[0] ?? "?"}</span>
2327
2742
  <div class="row-main">
2328
2743
  <span class="row-title">${t}</span>
2329
- ${e.email && e.name ? s`<span class="row-sub">${e.email}</span>` : n}
2744
+ ${e.email && e.name ? s`<span class="row-sub">${e.email}</span>` : o}
2330
2745
  </div>
2331
2746
  </div>
2332
2747
  </div>
@@ -2334,7 +2749,7 @@ let $ = class extends x {
2334
2749
  <div class="stack-sm">
2335
2750
  ${this.config?.successUrl ? s`<a class="btn btn-primary btn-block" href=${this.config.successUrl}
2336
2751
  >${this.t("continue")}</a
2337
- >` : n}
2752
+ >` : o}
2338
2753
  <button
2339
2754
  class="btn btn-outline btn-block"
2340
2755
  @click=${() => this.fire("authui-open", { view: "account" })}
@@ -2350,7 +2765,7 @@ let $ = class extends x {
2350
2765
  }
2351
2766
  renderProviders() {
2352
2767
  const e = this.config?.methods?.oauth ?? [];
2353
- if (e.length === 0) return n;
2768
+ if (e.length === 0) return o;
2354
2769
  const t = e.length > 2;
2355
2770
  return s`
2356
2771
  <div class="providers ${t ? "two" : ""}">
@@ -2360,11 +2775,11 @@ let $ = class extends x {
2360
2775
  class="btn btn-outline"
2361
2776
  @click=${() => this.onOAuth(i)}
2362
2777
  ?disabled=${this.busy}
2363
- aria-label=${this.t("continueWith", { provider: E(i) })}
2778
+ aria-label=${this.t("continueWith", { provider: O(i) })}
2364
2779
  >
2365
- ${L(i)}
2780
+ ${G(i)}
2366
2781
  <span
2367
- >${t ? E(i) : this.t("continueWith", { provider: E(i) })}</span
2782
+ >${t ? O(i) : this.t("continueWith", { provider: O(i) })}</span
2368
2783
  >
2369
2784
  </button>`
2370
2785
  )}
@@ -2380,7 +2795,7 @@ let $ = class extends x {
2380
2795
  return s`
2381
2796
  <div class="stack">
2382
2797
  ${this.renderProviders()}
2383
- ${i && (t || r.length > 0) ? s`<div class="separator-text">${this.t("or")}</div>` : n}
2798
+ ${i && (t || r.length > 0) ? s`<div class="separator-text">${this.t("or")}</div>` : o}
2384
2799
  ${t ? s`<form class="form" @submit=${this.onSignIn} novalidate>
2385
2800
  ${this.emailField()}
2386
2801
  ${this.passwordField({ label: this.t("password"), autocomplete: "current-password", id: "authui-password", field: "password", forgot: !0 })}
@@ -2396,7 +2811,7 @@ let $ = class extends x {
2396
2811
  ${a.icon} ${a.label}
2397
2812
  </button>`
2398
2813
  )}
2399
- </div>` : n}
2814
+ </div>` : o}
2400
2815
  ${e.anonymous ? s`<button
2401
2816
  type="button"
2402
2817
  class="btn btn-ghost btn-block"
@@ -2404,13 +2819,13 @@ let $ = class extends x {
2404
2819
  ?disabled=${this.busy}
2405
2820
  >
2406
2821
  ${c.ghost} ${this.t("continueAsGuest")}
2407
- </button>` : n}
2822
+ </button>` : o}
2408
2823
  ${t && this.config?.signUp !== !1 ? s`<div class="links">
2409
2824
  <span>${this.t("noAccount")}</span>
2410
2825
  <button type="button" class="btn btn-link" @click=${() => this.go("sign-up")}>
2411
2826
  ${this.t("signUp")}
2412
2827
  </button>
2413
- </div>` : n}
2828
+ </div>` : o}
2414
2829
  ${this.legal()}
2415
2830
  </div>
2416
2831
  `;
@@ -2419,7 +2834,7 @@ let $ = class extends x {
2419
2834
  return s`
2420
2835
  <div class="stack">
2421
2836
  ${this.renderProviders()}
2422
- ${(this.config?.methods?.oauth?.length ?? 0) > 0 ? s`<div class="separator-text">${this.t("or")}</div>` : n}
2837
+ ${(this.config?.methods?.oauth?.length ?? 0) > 0 ? s`<div class="separator-text">${this.t("or")}</div>` : o}
2423
2838
  <form class="form" @submit=${this.onSignUp} novalidate>
2424
2839
  ${this.config?.requireName !== !1 ? s`<div class="field">
2425
2840
  <label class="label" for="authui-name">${this.t("name")}</label>
@@ -2432,7 +2847,7 @@ let $ = class extends x {
2432
2847
  .value=${this.name}
2433
2848
  @input=${this.bind("name")}
2434
2849
  />
2435
- </div>` : n}
2850
+ </div>` : o}
2436
2851
  ${this.emailField()}
2437
2852
  ${this.passwordField({ label: this.t("password"), autocomplete: "new-password", id: "authui-password", field: "password", hint: this.t("passwordHint") })}
2438
2853
  ${this.renderError()} ${this.submitButton(this.t("createAccount"))}
@@ -2482,7 +2897,7 @@ let $ = class extends x {
2482
2897
  ${this.t("securityPhrase")}: <span class="code">${e}</span>
2483
2898
  </div>
2484
2899
  <div class="alert-body">${this.t("securityPhraseHint")}</div>
2485
- </div>` : n;
2900
+ </div>` : o;
2486
2901
  }
2487
2902
  renderMagicUrl() {
2488
2903
  return this.token ? s`<div class="stack">
@@ -2637,57 +3052,57 @@ let $ = class extends x {
2637
3052
  `;
2638
3053
  }
2639
3054
  };
2640
- $.styles = [...x.styles, ft];
2641
- C([
2642
- g({ type: String })
3055
+ $.styles = [...x.styles, St];
3056
+ P([
3057
+ f({ type: String })
2643
3058
  ], $.prototype, "view", 2);
2644
- C([
2645
- g({ type: Boolean })
3059
+ P([
3060
+ f({ type: Boolean })
2646
3061
  ], $.prototype, "embedded", 2);
2647
- C([
3062
+ P([
2648
3063
  d()
2649
3064
  ], $.prototype, "step", 2);
2650
- C([
3065
+ P([
2651
3066
  d()
2652
3067
  ], $.prototype, "busy", 2);
2653
- C([
3068
+ P([
2654
3069
  d()
2655
3070
  ], $.prototype, "error", 2);
2656
- C([
3071
+ P([
2657
3072
  d()
2658
3073
  ], $.prototype, "notice", 2);
2659
- C([
3074
+ P([
2660
3075
  d()
2661
3076
  ], $.prototype, "showPassword", 2);
2662
- C([
3077
+ P([
2663
3078
  d()
2664
3079
  ], $.prototype, "token", 2);
2665
- C([
3080
+ P([
2666
3081
  d()
2667
3082
  ], $.prototype, "challenge", 2);
2668
- C([
3083
+ P([
2669
3084
  d()
2670
3085
  ], $.prototype, "recovery", 2);
2671
- C([
2672
- X("form input:not([type=hidden])")
3086
+ P([
3087
+ rt("form input:not([type=hidden])")
2673
3088
  ], $.prototype, "firstInput", 2);
2674
- $ = C([
2675
- S("authui-sign-in")
3089
+ $ = P([
3090
+ I("authui-sign-in")
2676
3091
  ], $);
2677
- var vt = Object.defineProperty, yt = Object.getOwnPropertyDescriptor, m = (e, t, i, r) => {
2678
- for (var a = r > 1 ? void 0 : r ? yt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
2679
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
2680
- return r && a && vt(t, i, a), a;
3092
+ var Et = Object.defineProperty, It = Object.getOwnPropertyDescriptor, g = (e, t, i, r) => {
3093
+ for (var a = r > 1 ? void 0 : r ? It(t, i) : t, h = e.length - 1, u; h >= 0; h--)
3094
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
3095
+ return r && a && Et(t, i, a), a;
2681
3096
  };
2682
3097
  let p = class extends x {
2683
3098
  constructor() {
2684
3099
  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 = !0, this.confirmDelete = !1, this.factorsLoading = !1, this.onUpdateName = (e) => {
2685
- e.preventDefault(), this.run("name", () => o.updateName(this.nameInput), this.t("done"));
3100
+ e.preventDefault(), this.run("name", () => n.updateName(this.nameInput), this.t("done"));
2686
3101
  }, this.onUpdateEmail = (e) => {
2687
3102
  e.preventDefault(), this.run(
2688
3103
  "email",
2689
3104
  async () => {
2690
- await o.updateEmail(this.emailInput, this.emailPassword), this.emailPassword = "";
3105
+ await n.updateEmail(this.emailInput, this.emailPassword), this.emailPassword = "";
2691
3106
  },
2692
3107
  this.t("done")
2693
3108
  );
@@ -2695,7 +3110,7 @@ let p = class extends x {
2695
3110
  e.preventDefault(), this.run(
2696
3111
  "phone",
2697
3112
  async () => {
2698
- await o.updatePhone(this.phoneInput, this.phonePassword), this.phonePassword = "";
3113
+ await n.updatePhone(this.phoneInput, this.phonePassword), this.phonePassword = "";
2699
3114
  },
2700
3115
  this.t("done")
2701
3116
  );
@@ -2703,21 +3118,21 @@ let p = class extends x {
2703
3118
  e.preventDefault(), this.run(
2704
3119
  "guest",
2705
3120
  async () => {
2706
- await o.convertGuest(this.emailInput, this.emailPassword, this.guestName), this.emailPassword = "";
3121
+ await n.convertGuest(this.emailInput, this.emailPassword, this.guestName), this.emailPassword = "";
2707
3122
  },
2708
3123
  this.t("done")
2709
3124
  );
2710
3125
  }, this.onSendVerification = () => {
2711
- this.run("verify", () => o.sendEmailVerification(), this.t("verificationSent"));
3126
+ this.run("verify", () => n.sendEmailVerification(), this.t("verificationSent"));
2712
3127
  }, this.onSendPhoneVerification = () => {
2713
3128
  this.run("verify-phone", async () => {
2714
- await o.sendPhoneVerification(), this.phoneCodeSent = !0;
3129
+ await n.sendPhoneVerification(), this.phoneCodeSent = !0;
2715
3130
  });
2716
3131
  }, this.onConfirmPhoneVerification = (e) => {
2717
3132
  e.preventDefault(), this.run(
2718
3133
  "verify-phone-code",
2719
3134
  async () => {
2720
- await o.confirmPhoneVerification(this.phoneCode), this.phoneCode = "", this.phoneCodeSent = !1;
3135
+ await n.confirmPhoneVerification(this.phoneCode), this.phoneCode = "", this.phoneCodeSent = !1;
2721
3136
  },
2722
3137
  this.t("done")
2723
3138
  );
@@ -2729,44 +3144,44 @@ let p = class extends x {
2729
3144
  this.run(
2730
3145
  "password",
2731
3146
  async () => {
2732
- await o.updatePassword(this.newPassword, this.oldPassword), this.oldPassword = this.newPassword = this.newPasswordConfirm = "";
3147
+ await n.updatePassword(this.newPassword, this.oldPassword), this.oldPassword = this.newPassword = this.newPasswordConfirm = "";
2733
3148
  },
2734
3149
  this.t("passwordUpdated")
2735
3150
  );
2736
3151
  }, this.onToggleMfa = () => {
2737
3152
  const e = !this.user?.mfa;
2738
3153
  this.run("mfa", async () => {
2739
- await o.setMfaEnabled(e), await this.loadFactors();
3154
+ await n.setMfaEnabled(e), await this.loadFactors();
2740
3155
  });
2741
3156
  }, this.onAddAuthenticator = () => {
2742
3157
  this.run("authenticator", async () => {
2743
- this.authenticator = await o.addAuthenticator(), this.authenticatorCode = "";
3158
+ this.authenticator = await n.addAuthenticator(), this.authenticatorCode = "";
2744
3159
  });
2745
3160
  }, this.onVerifyAuthenticator = (e) => {
2746
3161
  e.preventDefault(), this.run(
2747
3162
  "authenticator-code",
2748
3163
  async () => {
2749
- await o.verifyAuthenticator(this.authenticatorCode), this.authenticator = null, this.authenticatorCode = "", await this.loadFactors();
3164
+ await n.verifyAuthenticator(this.authenticatorCode), this.authenticator = null, this.authenticatorCode = "", await this.loadFactors();
2750
3165
  },
2751
3166
  this.t("done")
2752
3167
  );
2753
3168
  }, this.onRemoveAuthenticator = () => {
2754
3169
  this.run("remove-authenticator", async () => {
2755
- await o.removeAuthenticator(), await this.loadFactors();
3170
+ await n.removeAuthenticator(), await this.loadFactors();
2756
3171
  });
2757
3172
  }, this.onRecoveryCodes = () => {
2758
3173
  this.run("recovery", async () => {
2759
3174
  try {
2760
- this.recoveryCodes = await o.createRecoveryCodes();
3175
+ this.recoveryCodes = await n.createRecoveryCodes();
2761
3176
  } catch (e) {
2762
- if (!F(e, b.recoveryCodesExist)) throw e;
2763
- this.recoveryCodes = await o.getRecoveryCodes();
3177
+ if (!N(e, v.recoveryCodesExist)) throw e;
3178
+ this.recoveryCodes = await n.getRecoveryCodes();
2764
3179
  }
2765
3180
  await this.loadFactors();
2766
3181
  });
2767
3182
  }, this.onRegenerateRecoveryCodes = () => {
2768
3183
  this.run("recovery", async () => {
2769
- this.recoveryCodes = await o.regenerateRecoveryCodes();
3184
+ this.recoveryCodes = await n.regenerateRecoveryCodes();
2770
3185
  });
2771
3186
  }, this.onCopyCodes = async () => {
2772
3187
  if (this.recoveryCodes)
@@ -2777,27 +3192,27 @@ let p = class extends x {
2777
3192
  }
2778
3193
  }, this.onStepUpFactor = (e) => {
2779
3194
  this.run("stepup", async () => {
2780
- const t = await o.createMfaChallenge(e);
3195
+ const t = await n.createMfaChallenge(e);
2781
3196
  this.stepUp = { ...this.stepUp, challenge: { id: t.$id, factor: e } }, this.stepUpCode = "";
2782
3197
  });
2783
3198
  }, this.onStepUpVerify = (e) => {
2784
3199
  e.preventDefault();
2785
3200
  const t = this.stepUp;
2786
3201
  t?.challenge && this.run("stepup-code", async () => {
2787
- await o.completeMfaChallenge(t.challenge.id, this.stepUpCode, { signIn: !1 }), this.stepUp = null, this.stepUpCode = "", await t.retry();
3202
+ await n.completeMfaChallenge(t.challenge.id, this.stepUpCode, { signIn: !1 }), this.stepUp = null, this.stepUpCode = "", await t.retry();
2788
3203
  });
2789
3204
  }, this.onDeleteSession = (e) => {
2790
3205
  this.run(`session-${e}`, async () => {
2791
- await o.signOut(e), this.sessions = (this.sessions ?? []).filter((t) => t.$id !== e);
3206
+ await n.signOut(e), this.sessions = (this.sessions ?? []).filter((t) => t.$id !== e);
2792
3207
  });
2793
3208
  }, this.onSignOutAll = () => {
2794
- this.run("sessions-all", () => o.signOutEverywhere());
3209
+ this.run("sessions-all", () => n.signOutEverywhere());
2795
3210
  }, this.onDeleteIdentity = (e) => {
2796
3211
  this.run(`identity-${e}`, async () => {
2797
- await o.deleteIdentity(e), this.identities = (this.identities ?? []).filter((t) => t.$id !== e);
3212
+ await n.deleteIdentity(e), this.identities = (this.identities ?? []).filter((t) => t.$id !== e);
2798
3213
  });
2799
3214
  }, this.onDeleteAccount = () => {
2800
- this.run("delete", () => o.deleteAccount());
3215
+ this.run("delete", () => n.deleteAccount());
2801
3216
  };
2802
3217
  }
2803
3218
  connectedCallback() {
@@ -2831,9 +3246,9 @@ let p = class extends x {
2831
3246
  try {
2832
3247
  await t(), i && (this.notice = { tone: "success", message: i });
2833
3248
  } catch (r) {
2834
- F(r, b.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
3249
+ N(r, v.challengeRequired) ? this.stepUp = { retry: () => this.run(e, t, i) } : this.errors = {
2835
3250
  ...this.errors,
2836
- [e]: Z(r, this.strings, e.includes("code") ? "code" : "link")
3251
+ [e]: at(r, this.strings, e.includes("code") ? "code" : "link")
2837
3252
  };
2838
3253
  } finally {
2839
3254
  this.busy = "";
@@ -2843,18 +3258,18 @@ let p = class extends x {
2843
3258
  // ─────────────────────────── loaders ───────────────────────────
2844
3259
  async loadSessions() {
2845
3260
  await this.run("sessions", async () => {
2846
- this.sessions = await o.listSessions();
3261
+ this.sessions = await n.listSessions();
2847
3262
  });
2848
3263
  }
2849
3264
  async loadIdentities() {
2850
3265
  await this.run("identities", async () => {
2851
- this.identities = await o.listIdentities();
3266
+ this.identities = await n.listIdentities();
2852
3267
  });
2853
3268
  }
2854
3269
  async loadLogs() {
2855
3270
  this.busy = "logs";
2856
3271
  try {
2857
- this.logs = await o.listLogs();
3272
+ this.logs = await n.listLogs();
2858
3273
  } catch {
2859
3274
  this.logsSupported = !1, this.logs = [];
2860
3275
  } finally {
@@ -2865,7 +3280,7 @@ let p = class extends x {
2865
3280
  if (!this.factorsLoading) {
2866
3281
  this.factorsLoading = !0;
2867
3282
  try {
2868
- this.factors = await o.listMfaFactors();
3283
+ this.factors = await n.listMfaFactors();
2869
3284
  } catch {
2870
3285
  this.factors = {
2871
3286
  totp: !1,
@@ -2922,7 +3337,7 @@ let p = class extends x {
2922
3337
  ${this.notice ? s`<div class="alert alert-${this.notice.tone}" role="status">
2923
3338
  ${this.notice.tone === "success" ? c.checkCircle : c.info}
2924
3339
  <div class="alert-body">${this.notice.message}</div>
2925
- </div>` : n}
3340
+ </div>` : o}
2926
3341
  ${this.stepUp ? this.renderStepUp() : this.renderTab()}
2927
3342
  </div>
2928
3343
  `;
@@ -2936,12 +3351,13 @@ let p = class extends x {
2936
3351
  <div class="row-main">
2937
3352
  <span class="row-title">
2938
3353
  ${t}
2939
- ${e.mfa ? s`<span class="badge badge-success">${c.shieldCheck} MFA</span>` : n}
3354
+ ${e.mfa ? s`<span class="badge badge-success">${c.shieldCheck} MFA</span>` : o}
3355
+ ${n.isPreview ? s`<span class="badge badge-info">${this.t("preview")}</span>` : o}
2940
3356
  </span>
2941
- ${e.email && e.name ? s`<span class="row-sub">${e.email}</span>` : n}
3357
+ ${e.email && e.name ? s`<span class="row-sub">${e.email}</span>` : o}
2942
3358
  </div>
2943
3359
  </div>
2944
- <button class="btn btn-outline btn-sm" @click=${() => o.signOut()}>
3360
+ <button class="btn btn-outline btn-sm" @click=${() => n.signOut()}>
2945
3361
  ${c.logOut} ${this.t("signOut")}
2946
3362
  </button>
2947
3363
  </div>
@@ -2966,19 +3382,19 @@ let p = class extends x {
2966
3382
  return t ? s`<div class="alert alert-error" role="alert">
2967
3383
  ${c.alert}
2968
3384
  <div class="alert-body">${t}</div>
2969
- </div>` : n;
3385
+ </div>` : o;
2970
3386
  }
2971
3387
  spinner(e) {
2972
- return this.busy === e ? s`<span class="spinner" aria-hidden="true"></span>` : n;
3388
+ return this.busy === e ? s`<span class="spinner" aria-hidden="true"></span>` : o;
2973
3389
  }
2974
3390
  card(e, t, i, r, a = !1) {
2975
3391
  return s`<section class="card ${a ? "card-danger" : ""}">
2976
3392
  <div class="card-header">
2977
3393
  <h3 class="card-title">${e}</h3>
2978
- ${t ? s`<p class="card-description">${t}</p>` : n}
3394
+ ${t ? s`<p class="card-description">${t}</p>` : o}
2979
3395
  </div>
2980
3396
  <div class="card-body">${i}</div>
2981
- ${r ? s`<div class="card-footer">${r}</div>` : n}
3397
+ ${r ? s`<div class="card-footer">${r}</div>` : o}
2982
3398
  </section>`;
2983
3399
  }
2984
3400
  verifiedBadge(e) {
@@ -3073,7 +3489,7 @@ let p = class extends x {
3073
3489
  <div class="field">
3074
3490
  <label class="label" for="acc-email"
3075
3491
  >${this.t("email")}
3076
- ${e.email ? this.verifiedBadge(e.emailVerification) : n}</label
3492
+ ${e.email ? this.verifiedBadge(e.emailVerification) : o}</label
3077
3493
  >
3078
3494
  <input
3079
3495
  class="input"
@@ -3096,7 +3512,7 @@ let p = class extends x {
3096
3512
  autocomplete="current-password"
3097
3513
  required
3098
3514
  />
3099
- </div>` : n}
3515
+ </div>` : o}
3100
3516
  ${this.error("email")} ${this.error("verify")}
3101
3517
  </form>`,
3102
3518
  s`
@@ -3107,7 +3523,7 @@ let p = class extends x {
3107
3523
  ?disabled=${!!this.busy}
3108
3524
  >
3109
3525
  ${this.spinner("verify")} ${this.t("verifyEmail")}
3110
- </button>` : n}
3526
+ </button>` : o}
3111
3527
  <button
3112
3528
  class="btn btn-primary btn-sm"
3113
3529
  type="submit"
@@ -3125,7 +3541,7 @@ let p = class extends x {
3125
3541
  <div class="field">
3126
3542
  <label class="label" for="acc-phone"
3127
3543
  >${this.t("phone")}
3128
- ${e.phone ? this.verifiedBadge(e.phoneVerification) : n}</label
3544
+ ${e.phone ? this.verifiedBadge(e.phoneVerification) : o}</label
3129
3545
  >
3130
3546
  <input
3131
3547
  class="input"
@@ -3148,7 +3564,7 @@ let p = class extends x {
3148
3564
  autocomplete="current-password"
3149
3565
  required
3150
3566
  />
3151
- </div>` : n}
3567
+ </div>` : o}
3152
3568
  ${this.phoneCodeSent ? s`<div class="field">
3153
3569
  <label class="label" for="acc-phone-code">${this.t("code")}</label>
3154
3570
  <input
@@ -3159,7 +3575,7 @@ let p = class extends x {
3159
3575
  .value=${this.phoneCode}
3160
3576
  @input=${this.bind("phoneCode")}
3161
3577
  />
3162
- </div>` : n}
3578
+ </div>` : o}
3163
3579
  ${this.error("phone")} ${this.error("verify-phone")} ${this.error("verify-phone-code")}
3164
3580
  </form>`,
3165
3581
  s`
@@ -3170,7 +3586,7 @@ let p = class extends x {
3170
3586
  ?disabled=${!!this.busy}
3171
3587
  >
3172
3588
  ${this.spinner("verify-phone")} ${this.t("sendCode")}
3173
- </button>` : n}
3589
+ </button>` : o}
3174
3590
  ${this.phoneCodeSent ? s`<button
3175
3591
  class="btn btn-outline btn-sm"
3176
3592
  type="button"
@@ -3178,7 +3594,7 @@ let p = class extends x {
3178
3594
  ?disabled=${!!this.busy}
3179
3595
  >
3180
3596
  ${this.spinner("verify-phone-code")} ${this.t("verifyCode")}
3181
- </button>` : n}
3597
+ </button>` : o}
3182
3598
  <button
3183
3599
  class="btn btn-primary btn-sm"
3184
3600
  type="submit"
@@ -3222,7 +3638,7 @@ let p = class extends x {
3222
3638
  renderSecurity() {
3223
3639
  const e = this.user, t = this.config?.mfa !== !1;
3224
3640
  return s`<div class="section">
3225
- ${this.isGuest ? n : this.card(
3641
+ ${this.isGuest ? o : this.card(
3226
3642
  this.t("changePassword"),
3227
3643
  void 0,
3228
3644
  s`<form
@@ -3243,7 +3659,7 @@ let p = class extends x {
3243
3659
  @input=${this.bind("oldPassword")}
3244
3660
  autocomplete="current-password"
3245
3661
  />
3246
- </div>` : n}
3662
+ </div>` : o}
3247
3663
  <div class="field">
3248
3664
  <label class="label" for="acc-new-password">${this.t("newPassword")}</label>
3249
3665
  <input
@@ -3284,12 +3700,12 @@ let p = class extends x {
3284
3700
  ${this.spinner("password")} ${this.t("update")}
3285
3701
  </button>`
3286
3702
  )}
3287
- ${t ? this.renderMfaCard() : n}
3288
- ${t ? this.renderRecoveryCard() : n}
3703
+ ${t ? this.renderMfaCard() : o}
3704
+ ${t ? this.renderRecoveryCard() : o}
3289
3705
  </div>`;
3290
3706
  }
3291
3707
  renderMfaCard() {
3292
- const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? new tt(o.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
3708
+ const e = this.user, t = this.factors?.totp ?? !1, i = this.authenticator ? n.isPreview ? ft(this.authenticator.uri) : new ct(n.getClient()).getQR(this.authenticator.uri, 400, 1).toString() : "";
3293
3709
  return this.card(
3294
3710
  this.t("twoFactor"),
3295
3711
  this.t("twoFactorDescription"),
@@ -3314,7 +3730,7 @@ let p = class extends x {
3314
3730
  <div class="row-main">
3315
3731
  <span class="row-title"
3316
3732
  >${c.smartphone} ${this.t("authenticatorApp")}
3317
- ${t ? this.verifiedBadge(!0) : n}</span
3733
+ ${t ? this.verifiedBadge(!0) : o}</span
3318
3734
  >
3319
3735
  </div>
3320
3736
  ${t ? s`<button
@@ -3323,7 +3739,7 @@ let p = class extends x {
3323
3739
  ?disabled=${!!this.busy}
3324
3740
  >
3325
3741
  ${this.spinner("remove-authenticator")} ${this.t("remove")}
3326
- </button>` : this.authenticator ? n : s`<button
3742
+ </button>` : this.authenticator ? o : s`<button
3327
3743
  class="btn btn-outline btn-sm"
3328
3744
  @click=${this.onAddAuthenticator}
3329
3745
  ?disabled=${!!this.busy}
@@ -3364,7 +3780,7 @@ let p = class extends x {
3364
3780
  ${this.t("cancel")}
3365
3781
  </button>
3366
3782
  </div>
3367
- </form>` : n}
3783
+ </form>` : o}
3368
3784
  </div>`
3369
3785
  );
3370
3786
  }
@@ -3398,7 +3814,7 @@ let p = class extends x {
3398
3814
  ${this.spinner("recovery")} ${c.key}
3399
3815
  ${e ? this.t("recoveryCodes") : this.t("generateRecoveryCodes")}
3400
3816
  </button>
3401
- ${e ? s`<button class="btn btn-ghost btn-sm" @click=${this.onRegenerateRecoveryCodes} ?disabled=${!!this.busy}>${c.refresh} ${this.t("regenerateRecoveryCodes")}</button>` : n}
3817
+ ${e ? s`<button class="btn btn-ghost btn-sm" @click=${this.onRegenerateRecoveryCodes} ?disabled=${!!this.busy}>${c.refresh} ${this.t("regenerateRecoveryCodes")}</button>` : o}
3402
3818
  </div>`}
3403
3819
  ${this.error("recovery")}
3404
3820
  </div>`
@@ -3474,8 +3890,8 @@ let p = class extends x {
3474
3890
  }
3475
3891
  // ── Sessions ──
3476
3892
  deviceIcon(e) {
3477
- const t = (e.clientType || e.deviceName || "").toLowerCase();
3478
- return t.includes("smartphone") || t.includes("phone") || t.includes("tablet") ? c.smartphone : t.includes("browser") || t.includes("desktop") ? c.monitor : c.globe;
3893
+ const t = (e.deviceName || "").toLowerCase(), i = (e.osName || e.osCode || "").toLowerCase();
3894
+ return /phone|tablet|mobile/.test(t) || /ios|android|ipados/.test(i) ? c.smartphone : /desktop|browser/.test(t) || /mac|windows|linux|chrome os/.test(i) ? c.monitor : c.globe;
3479
3895
  }
3480
3896
  renderSessions() {
3481
3897
  const e = this.sessions;
@@ -3491,8 +3907,8 @@ let p = class extends x {
3491
3907
  <div class="row-main">
3492
3908
  <span class="row-title">
3493
3909
  ${t.clientName || t.provider}
3494
- ${t.clientVersion ? s`<span class="muted small">${t.clientVersion}</span>` : n}
3495
- ${t.current ? s`<span class="badge badge-info">${this.t("currentSession")}</span>` : n}
3910
+ ${t.clientVersion ? s`<span class="muted small">${t.clientVersion}</span>` : o}
3911
+ ${t.current ? s`<span class="badge badge-info">${this.t("currentSession")}</span>` : o}
3496
3912
  </span>
3497
3913
  <span class="row-sub"
3498
3914
  >${[t.osName, t.countryName || t.countryCode, t.ip].filter(Boolean).join(" · ")}</span
@@ -3500,7 +3916,7 @@ let p = class extends x {
3500
3916
  </div>
3501
3917
  </div>
3502
3918
  <div class="row-actions">
3503
- ${this.busy === `session-${t.$id}` ? s`<span class="spinner"></span>` : n}
3919
+ ${this.busy === `session-${t.$id}` ? s`<span class="spinner"></span>` : o}
3504
3920
  <button
3505
3921
  class="btn btn-ghost btn-sm"
3506
3922
  @click=${() => this.onDeleteSession(t.$id)}
@@ -3540,9 +3956,9 @@ let p = class extends x {
3540
3956
  ${e === null ? s`<div class="empty"><span class="spinner"></span></div>` : e.length === 0 ? s`<div class="empty">${this.t("noConnections")}</div>` : e.map(
3541
3957
  (i) => s`<div class="row">
3542
3958
  <div class="inline">
3543
- <span class="device">${L(i.provider)}</span>
3959
+ <span class="device">${G(i.provider)}</span>
3544
3960
  <div class="row-main">
3545
- <span class="row-title">${E(i.provider)}</span>
3961
+ <span class="row-title">${O(i.provider)}</span>
3546
3962
  <span class="row-sub">${i.providerEmail || i.providerUid}</span>
3547
3963
  </div>
3548
3964
  </div>
@@ -3552,7 +3968,7 @@ let p = class extends x {
3552
3968
  @click=${() => this.onDeleteIdentity(i.$id)}
3553
3969
  ?disabled=${!!this.busy}
3554
3970
  >
3555
- ${this.busy === `identity-${i.$id}` ? s`<span class="spinner"></span>` : n}
3971
+ ${this.busy === `identity-${i.$id}` ? s`<span class="spinner"></span>` : o}
3556
3972
  ${this.t("disconnect")}
3557
3973
  </button>
3558
3974
  </div>
@@ -3561,9 +3977,9 @@ let p = class extends x {
3561
3977
  t.length > 0 ? s`${t.filter((i) => !(e ?? []).some((r) => r.provider === i)).map(
3562
3978
  (i) => s`<button
3563
3979
  class="btn btn-outline btn-sm"
3564
- @click=${() => o.signInWithOAuth(i)}
3980
+ @click=${() => n.signInWithOAuth(i)}
3565
3981
  >
3566
- ${L(i)} ${E(i)}
3982
+ ${G(i)} ${O(i)}
3567
3983
  </button>`
3568
3984
  )}` : void 0
3569
3985
  )}
@@ -3593,7 +4009,7 @@ let p = class extends x {
3593
4009
  };
3594
4010
  p.styles = [
3595
4011
  ...x.styles,
3596
- A`
4012
+ E`
3597
4013
  :host {
3598
4014
  display: block;
3599
4015
  width: 100%;
@@ -3670,102 +4086,102 @@ p.styles = [
3670
4086
  }
3671
4087
  `
3672
4088
  ];
3673
- m([
3674
- g({ type: Boolean })
4089
+ g([
4090
+ f({ type: Boolean })
3675
4091
  ], p.prototype, "embedded", 2);
3676
- m([
3677
- g({ type: String })
4092
+ g([
4093
+ f({ type: String })
3678
4094
  ], p.prototype, "tab", 2);
3679
- m([
4095
+ g([
3680
4096
  d()
3681
4097
  ], p.prototype, "active", 2);
3682
- m([
4098
+ g([
3683
4099
  d()
3684
4100
  ], p.prototype, "busy", 2);
3685
- m([
4101
+ g([
3686
4102
  d()
3687
4103
  ], p.prototype, "notice", 2);
3688
- m([
4104
+ g([
3689
4105
  d()
3690
4106
  ], p.prototype, "errors", 2);
3691
- m([
4107
+ g([
3692
4108
  d()
3693
4109
  ], p.prototype, "nameInput", 2);
3694
- m([
4110
+ g([
3695
4111
  d()
3696
4112
  ], p.prototype, "emailInput", 2);
3697
- m([
4113
+ g([
3698
4114
  d()
3699
4115
  ], p.prototype, "emailPassword", 2);
3700
- m([
4116
+ g([
3701
4117
  d()
3702
4118
  ], p.prototype, "phoneInput", 2);
3703
- m([
4119
+ g([
3704
4120
  d()
3705
4121
  ], p.prototype, "phonePassword", 2);
3706
- m([
4122
+ g([
3707
4123
  d()
3708
4124
  ], p.prototype, "phoneCode", 2);
3709
- m([
4125
+ g([
3710
4126
  d()
3711
4127
  ], p.prototype, "phoneCodeSent", 2);
3712
- m([
4128
+ g([
3713
4129
  d()
3714
4130
  ], p.prototype, "guestName", 2);
3715
- m([
4131
+ g([
3716
4132
  d()
3717
4133
  ], p.prototype, "oldPassword", 2);
3718
- m([
4134
+ g([
3719
4135
  d()
3720
4136
  ], p.prototype, "newPassword", 2);
3721
- m([
4137
+ g([
3722
4138
  d()
3723
4139
  ], p.prototype, "newPasswordConfirm", 2);
3724
- m([
4140
+ g([
3725
4141
  d()
3726
4142
  ], p.prototype, "authenticator", 2);
3727
- m([
4143
+ g([
3728
4144
  d()
3729
4145
  ], p.prototype, "authenticatorCode", 2);
3730
- m([
4146
+ g([
3731
4147
  d()
3732
4148
  ], p.prototype, "factors", 2);
3733
- m([
4149
+ g([
3734
4150
  d()
3735
4151
  ], p.prototype, "recoveryCodes", 2);
3736
- m([
4152
+ g([
3737
4153
  d()
3738
4154
  ], p.prototype, "stepUp", 2);
3739
- m([
4155
+ g([
3740
4156
  d()
3741
4157
  ], p.prototype, "stepUpCode", 2);
3742
- m([
4158
+ g([
3743
4159
  d()
3744
4160
  ], p.prototype, "copied", 2);
3745
- m([
4161
+ g([
3746
4162
  d()
3747
4163
  ], p.prototype, "sessions", 2);
3748
- m([
4164
+ g([
3749
4165
  d()
3750
4166
  ], p.prototype, "identities", 2);
3751
- m([
4167
+ g([
3752
4168
  d()
3753
4169
  ], p.prototype, "logs", 2);
3754
- m([
4170
+ g([
3755
4171
  d()
3756
4172
  ], p.prototype, "logsSupported", 2);
3757
- m([
4173
+ g([
3758
4174
  d()
3759
4175
  ], p.prototype, "confirmDelete", 2);
3760
- p = m([
3761
- S("authui-account")
4176
+ p = g([
4177
+ I("authui-account")
3762
4178
  ], p);
3763
- var wt = Object.defineProperty, $t = Object.getOwnPropertyDescriptor, U = (e, t, i, r) => {
3764
- for (var a = r > 1 ? void 0 : r ? $t(t, i) : t, u = e.length - 1, h; u >= 0; u--)
3765
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
3766
- return r && a && wt(t, i, a), a;
4179
+ var _t = Object.defineProperty, Ft = Object.getOwnPropertyDescriptor, z = (e, t, i, r) => {
4180
+ for (var a = r > 1 ? void 0 : r ? Ft(t, i) : t, h = e.length - 1, u; h >= 0; h--)
4181
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
4182
+ return r && a && _t(t, i, a), a;
3767
4183
  };
3768
- let P = class extends x {
4184
+ let U = class extends x {
3769
4185
  constructor() {
3770
4186
  super(...arguments), this.open = !1, this.view = "sign-in", this.closeOnSuccess = !0, this.handledPending = null, this.onOpenEvent = (e) => {
3771
4187
  const t = e.detail ?? {};
@@ -3822,15 +4238,15 @@ let P = class extends x {
3822
4238
  embedded
3823
4239
  .view=${this.view}
3824
4240
  @authui-success=${this.onSuccess}
3825
- ></authui-sign-in>` : n}
4241
+ ></authui-sign-in>` : o}
3826
4242
  </div>
3827
4243
  </dialog>
3828
4244
  `;
3829
4245
  }
3830
4246
  };
3831
- P.styles = [
4247
+ U.styles = [
3832
4248
  ...x.styles,
3833
- A`
4249
+ E`
3834
4250
  :host {
3835
4251
  display: contents;
3836
4252
  }
@@ -3890,38 +4306,38 @@ P.styles = [
3890
4306
  }
3891
4307
  `
3892
4308
  ];
3893
- U([
3894
- g({ type: Boolean, reflect: !0 })
3895
- ], P.prototype, "open", 2);
3896
- U([
3897
- g({ type: String })
3898
- ], P.prototype, "view", 2);
3899
- U([
3900
- g({ type: Boolean, attribute: "close-on-success" })
3901
- ], P.prototype, "closeOnSuccess", 2);
3902
- U([
4309
+ z([
4310
+ f({ type: Boolean, reflect: !0 })
4311
+ ], U.prototype, "open", 2);
4312
+ z([
4313
+ f({ type: String })
4314
+ ], U.prototype, "view", 2);
4315
+ z([
4316
+ f({ type: Boolean, attribute: "close-on-success" })
4317
+ ], U.prototype, "closeOnSuccess", 2);
4318
+ z([
3903
4319
  d()
3904
- ], P.prototype, "handledPending", 2);
3905
- U([
3906
- X("dialog")
3907
- ], P.prototype, "dialog", 2);
3908
- P = U([
3909
- S("authui-modal")
3910
- ], P);
3911
- function R(e) {
4320
+ ], U.prototype, "handledPending", 2);
4321
+ z([
4322
+ rt("dialog")
4323
+ ], U.prototype, "dialog", 2);
4324
+ U = z([
4325
+ I("authui-modal")
4326
+ ], U);
4327
+ function Y(e) {
3912
4328
  typeof document > "u" || (document.querySelector("authui-modal") || document.body.appendChild(document.createElement("authui-modal")), queueMicrotask(() => {
3913
4329
  window.dispatchEvent(new CustomEvent("authui:open", { detail: { view: e } }));
3914
4330
  }));
3915
4331
  }
3916
- function Ut() {
4332
+ function Nt() {
3917
4333
  typeof window > "u" || window.dispatchEvent(new CustomEvent("authui:close"));
3918
4334
  }
3919
- var xt = Object.defineProperty, kt = Object.getOwnPropertyDescriptor, O = (e, t, i, r) => {
3920
- for (var a = r > 1 ? void 0 : r ? kt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
3921
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
3922
- return r && a && xt(t, i, a), a;
4335
+ var zt = Object.defineProperty, Ot = Object.getOwnPropertyDescriptor, H = (e, t, i, r) => {
4336
+ for (var a = r > 1 ? void 0 : r ? Ot(t, i) : t, h = e.length - 1, u; h >= 0; h--)
4337
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
4338
+ return r && a && zt(t, i, a), a;
3923
4339
  };
3924
- let M = class extends x {
4340
+ let F = class extends x {
3925
4341
  constructor() {
3926
4342
  super(...arguments), this.view = "sign-in", this.variant = "primary", this.size = "md";
3927
4343
  }
@@ -3929,7 +4345,7 @@ let M = class extends x {
3929
4345
  const e = this.size === "md" ? "" : `btn-${this.size}`;
3930
4346
  return s`<button
3931
4347
  class="btn btn-${this.variant} ${e}"
3932
- @click=${() => R(this.view)}
4348
+ @click=${() => Y(this.view)}
3933
4349
  part="button"
3934
4350
  >
3935
4351
  <slot
@@ -3938,9 +4354,9 @@ let M = class extends x {
3938
4354
  </button>`;
3939
4355
  }
3940
4356
  };
3941
- M.styles = [
4357
+ F.styles = [
3942
4358
  ...x.styles,
3943
- A`
4359
+ E`
3944
4360
  :host {
3945
4361
  display: inline-block;
3946
4362
  }
@@ -3949,24 +4365,24 @@ M.styles = [
3949
4365
  }
3950
4366
  `
3951
4367
  ];
3952
- O([
3953
- g({ type: String })
3954
- ], M.prototype, "view", 2);
3955
- O([
3956
- g({ type: String })
3957
- ], M.prototype, "variant", 2);
3958
- O([
3959
- g({ type: String })
3960
- ], M.prototype, "size", 2);
3961
- M = O([
3962
- S("authui-button")
3963
- ], M);
3964
- var Ct = Object.defineProperty, Pt = Object.getOwnPropertyDescriptor, q = (e, t, i, r) => {
3965
- for (var a = r > 1 ? void 0 : r ? Pt(t, i) : t, u = e.length - 1, h; u >= 0; u--)
3966
- (h = e[u]) && (a = (r ? h(t, i, a) : h(a)) || a);
3967
- return r && a && Ct(t, i, a), a;
4368
+ H([
4369
+ f({ type: String })
4370
+ ], F.prototype, "view", 2);
4371
+ H([
4372
+ f({ type: String })
4373
+ ], F.prototype, "variant", 2);
4374
+ H([
4375
+ f({ type: String })
4376
+ ], F.prototype, "size", 2);
4377
+ F = H([
4378
+ I("authui-button")
4379
+ ], F);
4380
+ var Dt = Object.defineProperty, Rt = Object.getOwnPropertyDescriptor, X = (e, t, i, r) => {
4381
+ for (var a = r > 1 ? void 0 : r ? Rt(t, i) : t, h = e.length - 1, u; h >= 0; h--)
4382
+ (u = e[h]) && (a = (r ? u(t, i, a) : u(a)) || a);
4383
+ return r && a && Dt(t, i, a), a;
3968
4384
  };
3969
- let I = class extends x {
4385
+ let R = class extends x {
3970
4386
  constructor() {
3971
4387
  super(...arguments), this.src = "", this.menuOpen = !1, this.onDocumentClick = (e) => {
3972
4388
  e.composedPath().includes(this) || (this.menuOpen = !1);
@@ -3985,7 +4401,7 @@ let I = class extends x {
3985
4401
  if (e === "loading")
3986
4402
  return s`<span class="avatar"><span class="spinner"></span></span>`;
3987
4403
  if (e !== "signed-in" || !t)
3988
- return s`<button class="btn btn-primary btn-sm" @click=${() => R("sign-in")}>
4404
+ return s`<button class="btn btn-primary btn-sm" @click=${() => Y("sign-in")}>
3989
4405
  <slot>${this.t("signIn")}</slot>
3990
4406
  </button>`;
3991
4407
  const i = t.name || t.email || t.phone || this.t("guestAccount");
@@ -4004,13 +4420,13 @@ let I = class extends x {
4004
4420
  ${this.menuOpen ? s`<div class="menu" role="menu">
4005
4421
  <div class="menu-header">
4006
4422
  <span class="row-title">${i}</span>
4007
- ${t.email && t.name ? s`<span class="row-sub">${t.email}</span>` : n}
4423
+ ${t.email && t.name ? s`<span class="row-sub">${t.email}</span>` : o}
4008
4424
  </div>
4009
4425
  <button
4010
4426
  class="menu-item"
4011
4427
  role="menuitem"
4012
4428
  @click=${() => {
4013
- this.menuOpen = !1, R("account");
4429
+ this.menuOpen = !1, Y("account");
4014
4430
  }}
4015
4431
  >
4016
4432
  ${c.settings} ${this.t("manageAccount")}
@@ -4019,18 +4435,18 @@ let I = class extends x {
4019
4435
  class="menu-item"
4020
4436
  role="menuitem"
4021
4437
  @click=${() => {
4022
- this.menuOpen = !1, o.signOut();
4438
+ this.menuOpen = !1, n.signOut();
4023
4439
  }}
4024
4440
  >
4025
4441
  ${c.logOut} ${this.t("signOut")}
4026
4442
  </button>
4027
- </div>` : n}
4443
+ </div>` : o}
4028
4444
  `;
4029
4445
  }
4030
4446
  };
4031
- I.styles = [
4447
+ R.styles = [
4032
4448
  ...x.styles,
4033
- A`
4449
+ E`
4034
4450
  :host {
4035
4451
  display: inline-block;
4036
4452
  position: relative;
@@ -4108,32 +4524,32 @@ I.styles = [
4108
4524
  }
4109
4525
  `
4110
4526
  ];
4111
- q([
4112
- g({ type: String })
4113
- ], I.prototype, "src", 2);
4114
- q([
4527
+ X([
4528
+ f({ type: String })
4529
+ ], R.prototype, "src", 2);
4530
+ X([
4115
4531
  d()
4116
- ], I.prototype, "menuOpen", 2);
4117
- I = q([
4118
- S("authui-user-button")
4119
- ], I);
4532
+ ], R.prototype, "menuOpen", 2);
4533
+ R = X([
4534
+ I("authui-user-button")
4535
+ ], R);
4120
4536
  export {
4121
- rt as A,
4122
- b as E,
4123
- o as a,
4537
+ mt as A,
4538
+ v as E,
4539
+ pt as P,
4540
+ n as a,
4124
4541
  p as b,
4125
- Ut as c,
4126
- M as d,
4127
- v as e,
4542
+ Nt as c,
4543
+ F as d,
4544
+ b as e,
4128
4545
  x as f,
4129
- P as g,
4130
- $ as h,
4131
- Y as i,
4132
- K as j,
4133
- I as k,
4134
- et as l,
4135
- Z as m,
4136
- R as o,
4137
- E as p,
4138
- _ as t
4546
+ U as g,
4547
+ D as h,
4548
+ $ as i,
4549
+ R as j,
4550
+ lt as k,
4551
+ at as l,
4552
+ Y as o,
4553
+ O as p,
4554
+ T as t
4139
4555
  };