@sylphx/auth-solid 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { addEventListener as e, className as t, createComponent as n, delegateEvents as r, effect as i, getNextElement as a, getNextMarker as o, insert as s, memo as c, runHydrationEvents as l, setAttribute as u, setProperty as d, style as f, template as p, use as m } from "solid-js/web";
2
- import { providerDestination as h, providers as g, safeReturnTo as _ } from "@sylphx/auth/client";
3
- import { For as v, Match as y, Show as b, Switch as x, createMemo as S, createSignal as C, createUniqueId as w, onCleanup as ee, onMount as te } from "solid-js";
2
+ import { authRoutePrefix as h, providerDestination as g, providers as _, safeReturnTo as v } from "@sylphx/auth/client";
3
+ import { For as y, Match as b, Show as x, Switch as S, createEffect as ee, createMemo as C, createSignal as w, createUniqueId as T, onCleanup as E, onMount as te } from "solid-js";
4
4
  // src/messages.ts
5
- var T = {
5
+ var D = {
6
6
  en: {
7
7
  signIn: "Sign in",
8
8
  enterPassword: "Enter your password",
@@ -60,6 +60,7 @@ var T = {
60
60
  cancelled: "Sign-in was canceled. You can try again whenever you’re ready.",
61
61
  use_existing: "Try the method you originally used to sign in. This provider couldn’t confirm your email.",
62
62
  invalid_credentials: "That email and password didn’t match. Check both and try again.",
63
+ acceptance_required: "Accept the current terms to continue.",
63
64
  verify_email: "Confirm your email from the link in your inbox before signing in.",
64
65
  verification_failed: "This confirmation link couldn’t be used. Check that you opened the latest link.",
65
66
  invalid_code: "That code didn’t work. Check it and try again.",
@@ -127,6 +128,7 @@ var T = {
127
128
  cancelled: "登入已取消。你可以隨時再試。",
128
129
  use_existing: "這項登入服務未能確認你的電郵地址。請改用原來的登入方式。",
129
130
  invalid_credentials: "電郵地址與密碼不符。請核對後再試。",
131
+ acceptance_required: "請同意現行條款後繼續。",
130
132
  verify_email: "請先開啟確認電郵內的連結,確認電郵地址後再登入。",
131
133
  verification_failed: "此連結無法使用。請開啟最新一封確認電郵內的連結。",
132
134
  invalid_code: "驗證碼無法使用。請核對後再試。",
@@ -194,6 +196,7 @@ var T = {
194
196
  cancelled: "登入已取消。你可以隨時再試。",
195
197
  use_existing: "這項登入服務無法確認你的電子郵件地址。請改用原本的登入方式。",
196
198
  invalid_credentials: "電子郵件地址和密碼不符。請檢查後再試一次。",
199
+ acceptance_required: "請同意目前的條款後繼續。",
197
200
  verify_email: "請先開啟確認信中的連結,確認電子郵件地址後再登入。",
198
201
  verification_failed: "這個確認連結無法使用。請確認你開啟的是最新一封確認信中的連結。",
199
202
  invalid_code: "這組驗證碼無法使用。請檢查後再試一次。",
@@ -261,6 +264,7 @@ var T = {
261
264
  cancelled: "登录已取消。你可以随时重试。",
262
265
  use_existing: "此登录服务无法确认你的邮箱地址。请改用原来的登录方式。",
263
266
  invalid_credentials: "邮箱地址和密码不匹配。请检查后重试。",
267
+ acceptance_required: "请同意当前条款后继续。",
264
268
  verify_email: "请先打开确认邮件中的链接,确认邮箱地址后再登录。",
265
269
  verification_failed: "此链接无法使用。请打开最新一封确认邮件中的链接。",
266
270
  invalid_code: "此验证码无法使用。请检查后重试。",
@@ -328,6 +332,7 @@ var T = {
328
332
  cancelled: "ログインがキャンセルされました。いつでもやり直せます。",
329
333
  use_existing: "このサービスではメールアドレスを確認できませんでした。最初に使った方法でログインしてください。",
330
334
  invalid_credentials: "メールアドレスとパスワードが一致しません。両方を確認して、もう一度お試しください。",
335
+ acceptance_required: "続行するには、現在の利用規約に同意してください。",
331
336
  verify_email: "確認メール内のリンクを開き、メールアドレスを確認してからログインしてください。",
332
337
  verification_failed: "この確認リンクは使えません。最新の確認メールのリンクをお試しください。",
333
338
  invalid_code: "このコードは使えません。入力内容を確認して、もう一度お試しください。",
@@ -395,6 +400,7 @@ var T = {
395
400
  cancelled: "로그인이 취소되었습니다. 언제든지 다시 시도할 수 있습니다.",
396
401
  use_existing: "이 로그인 서비스에서 이메일 주소를 확인할 수 없습니다. 처음 사용한 방법으로 로그인하세요.",
397
402
  invalid_credentials: "이메일 주소 또는 비밀번호가 올바르지 않습니다. 확인한 뒤 다시 시도하세요.",
403
+ acceptance_required: "계속하려면 현재 약관에 동의하세요.",
398
404
  verify_email: "로그인하기 전에 받은 이메일의 링크를 열어 이메일 주소를 확인하세요.",
399
405
  verification_failed: "이 확인 링크를 사용할 수 없습니다. 가장 최근에 받은 링크를 열어 보세요.",
400
406
  invalid_code: "인증 코드가 올바르지 않습니다. 코드를 확인한 뒤 다시 시도하세요.",
@@ -405,7 +411,7 @@ var T = {
405
411
  unavailable: "연결하지 못했습니다. 잠시 후 다시 시도하세요."
406
412
  }
407
413
  }
408
- }, E = {
414
+ }, ne = {
409
415
  en: "English",
410
416
  "zh-Hant-HK": "繁體中文(香港)",
411
417
  "zh-Hant-TW": "繁體中文(台灣)",
@@ -413,7 +419,7 @@ var T = {
413
419
  ja: "日本語",
414
420
  ko: "한국어"
415
421
  };
416
- function D(e) {
422
+ function O(e) {
417
423
  for (let t of e) {
418
424
  let e;
419
425
  try {
@@ -421,7 +427,7 @@ function D(e) {
421
427
  } catch {
422
428
  continue;
423
429
  }
424
- if (Object.hasOwn(T, e.baseName)) return e.baseName;
430
+ if (Object.hasOwn(D, e.baseName)) return e.baseName;
425
431
  if (e.language === "en" || e.language === "ja" || e.language === "ko") return e.language;
426
432
  if (e.language === "zh") {
427
433
  let t = e.maximize().script;
@@ -431,7 +437,7 @@ function D(e) {
431
437
  }
432
438
  return "en";
433
439
  }
434
- function O(e) {
440
+ function k(e) {
435
441
  return new Intl.NumberFormat(e, {
436
442
  style: "unit",
437
443
  unit: "second",
@@ -439,272 +445,305 @@ function O(e) {
439
445
  });
440
446
  }
441
447
  // src/provider-icons.tsx
442
- var k = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\"fill=#4285F4></path><path d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\"fill=#34A853></path><path d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\"fill=#FBBC05></path><path d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\"fill=#EA4335>"), A = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path 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 0024 12c0-6.63-5.37-12-12-12z\">"), j = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path d=\"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701\">"), ne = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path d=\"M0 0h11.377v11.372H0zm12.623 0H24v11.372H12.623zM0 12.623h11.377V24H0zm12.623 0H24V24H12.623\"fill=#00A4EF>"), M = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path 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\">");
448
+ var A = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path d=\"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z\"fill=#4285F4></path><path d=\"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z\"fill=#34A853></path><path d=\"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z\"fill=#FBBC05></path><path d=\"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z\"fill=#EA4335>"), re = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path 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 0024 12c0-6.63-5.37-12-12-12z\">"), ie = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path d=\"M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701\">"), j = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path d=\"M0 0h11.377v11.372H0zm12.623 0H24v11.372H12.623zM0 12.623h11.377V24H0zm12.623 0H24V24H12.623\"fill=#00A4EF>"), M = /*#__PURE__*/ p("<svg aria-hidden=true viewBox=\"0 0 24 24\"fill=currentColor width=19 height=19><path 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\">");
443
449
  function N() {
444
- return a(k);
445
- }
446
- function re() {
447
450
  return a(A);
448
451
  }
449
452
  function P() {
450
- return a(j);
453
+ return a(re);
451
454
  }
452
455
  function F() {
453
- return a(ne);
456
+ return a(ie);
457
+ }
458
+ function ae() {
459
+ return a(j);
454
460
  }
455
461
  function I() {
456
462
  return a(M);
457
463
  }
458
464
  // src/sign-in-controller.ts
459
- var L = T.en.errors;
460
- L.unavailable;
461
- function ie(e) {
462
- return typeof e == "string" && Object.hasOwn(L, e);
465
+ var oe = D.en.errors;
466
+ oe.unavailable;
467
+ function L(e) {
468
+ return typeof e == "string" && Object.hasOwn(oe, e);
463
469
  }
464
- var R = class extends Error {
470
+ var se = class extends Error {
465
471
  code;
466
472
  constructor(e) {
467
473
  super(e), this.code = e;
468
474
  }
469
475
  };
470
- function ae(e) {
476
+ function ce(e) {
471
477
  return Uint8Array.from(atob(e.replace(/-/g, "+").replace(/_/g, "/")), (e) => e.charCodeAt(0));
472
478
  }
473
- function z(e) {
479
+ function R(e) {
474
480
  return btoa(String.fromCharCode(...new Uint8Array(e))).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
475
481
  }
476
- function B(e) {
477
- let t = new URLSearchParams(e.search), n = _(e.next), r = _(e.loginPath, "/login").split(/[?#]/, 1)[0], i = t.get("challenge_id"), a = t.get("token"), o = !!i && !!a && t.get("type") === "email_verification", [s, c] = C(), [l, u] = C(!1), [d, f] = C("choose"), [p, m] = C(""), v = t.get("error"), [y, b] = C(ie(v) ? v : ""), x = () => {
478
- let e = y();
479
- return e ? L[e] : "";
480
- }, [S, w] = C(""), [T, E] = C(!1), [D, O] = C(!1), [k, A] = C(""), [j, ne] = C(""), [M, N] = C(""), [re, P] = C(!1), [F, I] = C(!1), [B, V] = C(0), [oe, se] = C(0), ce = () => Math.max(0, Math.ceil((B() - oe()) / 1e3)), H, U = new AbortController();
481
- async function le() {
482
+ function z(e) {
483
+ let t = new URLSearchParams(e.search), n = v(e.next), r = h(e.routePrefix), i = v(e.loginPath, "/login").split(/[?#]/, 1)[0], a = t.get("challenge_id"), o = t.get("token"), s = !!a && !!o && t.get("type") === "email_verification", [c, l] = w(e.initialConfig), [u, d] = w(!1), [f, p] = w("choose"), [m, y] = w(""), b = t.get("error"), [x, S] = w(L(b) ? b : ""), C = () => {
484
+ let e = x();
485
+ return e ? oe[e] : "";
486
+ }, [T, D] = w(""), [ne, O] = w(!1), [k, A] = w(!1), [re, ie] = w(!1), j, M = !1, [N, P] = w(""), [F, ae] = w(""), [I, z] = w(""), [B, le] = w(!1), [ue, V] = w(!1), [de, H] = w(0), [fe, pe] = w(0), me = () => Math.max(0, Math.ceil((de() - fe()) / 1e3)), he, U = new AbortController();
487
+ async function ge() {
482
488
  if (U.signal.aborted) return;
483
- u(!1), c(void 0), H?.abort();
489
+ d(!1), l(void 0), he?.abort();
484
490
  let e = new AbortController();
485
- H = e;
491
+ he = e;
486
492
  try {
487
- let t = await fetch("/auth/config", {
493
+ let t = await fetch(`${r}/config`, {
488
494
  referrerPolicy: "origin",
489
495
  redirect: "error",
490
496
  signal: AbortSignal.any([e.signal, AbortSignal.timeout(12e3)])
491
497
  });
492
498
  if (!t.ok) throw Error();
493
499
  let n = await t.json();
494
- if (!n || !Array.isArray(n.providers) || !n.providers.every((e) => typeof e == "string" && Object.hasOwn(g, e)) || [
500
+ if (!n || !Array.isArray(n.providers) || !n.providers.every((e) => typeof e == "string" && Object.hasOwn(_, e)) || [
495
501
  n.password,
496
502
  n.signup,
497
503
  n.otp,
498
504
  n.passkey
499
505
  ].some((e) => typeof e != "boolean")) throw Error();
500
- e.signal.aborted || c(n);
506
+ e.signal.aborted || l(n);
501
507
  } catch {
502
- !e.signal.aborted && !U.signal.aborted && u(!0);
508
+ !e.signal.aborted && !U.signal.aborted && d(!0);
503
509
  }
504
510
  }
505
511
  te(() => {
506
- O(window.isSecureContext && typeof PublicKeyCredential < "u"), o && (f("confirm"), window.history.replaceState(window.history.state, "", `${r}?${new URLSearchParams({ next: n })}`)), le();
507
- let e = window.setInterval(() => se(Date.now()), 1e3);
508
- ee(() => {
509
- window.clearInterval(e), H?.abort(), U.abort();
512
+ A(window.isSecureContext && typeof PublicKeyCredential < "u"), s && (p("confirm"), window.history.replaceState(window.history.state, "", `${i}?${new URLSearchParams({ next: n })}`)), c() || ge(), e.conditionalPasskey && k() && PublicKeyCredential.isConditionalMediationAvailable?.().then((e) => {
513
+ U.signal.aborted || ie(e);
514
+ }).catch(() => void 0);
515
+ let t = window.setInterval(() => pe(Date.now()), 1e3);
516
+ E(() => {
517
+ window.clearInterval(t), he?.abort(), W(), U.abort();
510
518
  });
511
519
  });
512
- function W(e) {
513
- b(""), E(!1), f(e);
520
+ function W() {
521
+ j?.abort(), j = void 0;
522
+ }
523
+ function G(e) {
524
+ e !== "choose" && W(), S(""), O(!1), p(e);
514
525
  }
515
- async function ue(e, t) {
516
- let n = await fetch(e, {
526
+ async function _e(t, n, r = U.signal) {
527
+ let i = await fetch(t, {
517
528
  method: "POST",
518
529
  headers: { "Content-Type": "application/json" },
519
530
  referrerPolicy: "origin",
520
531
  redirect: "error",
521
- signal: AbortSignal.any([U.signal, AbortSignal.timeout(45e3)]),
522
- body: JSON.stringify(t)
523
- }), r = await n.json();
524
- if (!n.ok) throw new R(ie(r.error) ? r.error : "unavailable");
525
- return r;
532
+ signal: AbortSignal.any([
533
+ U.signal,
534
+ r,
535
+ AbortSignal.timeout(45e3)
536
+ ]),
537
+ body: JSON.stringify({
538
+ ...n,
539
+ acceptance: e.getAcceptance?.()
540
+ })
541
+ }), a = await i.json();
542
+ if (!i.ok) throw new se(L(a.error) ? a.error : "unavailable");
543
+ return a;
526
544
  }
527
- async function G(e, t = {}) {
528
- let r = await ue("/auth/email", {
545
+ async function K(e, t = {}) {
546
+ let i = await _e(`${r}/email`, {
529
547
  action: e,
530
548
  next: n,
531
549
  ...t
532
550
  });
533
- return !U.signal.aborted && typeof r.next == "string" && window.location.assign(_(r.next, n)), r;
551
+ return !U.signal.aborted && typeof i.next == "string" && window.location.assign(v(i.next, n)), i;
534
552
  }
535
- async function K(e, t) {
536
- if (!(S() || U.signal.aborted)) {
537
- w(e), b("");
553
+ async function q(e, t) {
554
+ if (!(T() || U.signal.aborted)) {
555
+ M = !0, W(), D(e), S("");
538
556
  try {
539
557
  await t();
540
558
  } catch (e) {
541
- U.signal.aborted || b(e instanceof R ? e.code : "unavailable");
559
+ U.signal.aborted || S(e instanceof se ? e.code : "unavailable");
542
560
  } finally {
543
- w("");
561
+ D("");
544
562
  }
545
563
  }
546
564
  }
547
- function de(e) {
548
- if (s()?.providers.includes(e)) return K(g[e][0], async () => {
549
- let { authorize: t } = await ue(`/auth/start/${e}`, { next: n }), r = h(e, t);
550
- if (!r) throw Error();
551
- U.signal.aborted || window.location.assign(r);
565
+ function ve(e) {
566
+ if (c()?.providers.includes(e)) return q(_[e][0], async () => {
567
+ let { authorize: t } = await _e(`${r}/start/${e}`, { next: n }), i = g(e, t);
568
+ if (!i) throw Error();
569
+ U.signal.aborted || window.location.assign(i);
552
570
  });
553
571
  }
554
- function q() {
555
- if (!(!s()?.otp || d() === "otp" && ce() > 0)) return K("email", async () => {
556
- let e = await G("otp_start", { email: p().trim() });
572
+ function ye() {
573
+ if (!(!c()?.otp || f() === "otp" && me() > 0)) return q("email", async () => {
574
+ let e = await K("otp_start", { email: m().trim() });
557
575
  if (!e.flow) throw Error();
558
- ne(e.flow), A("");
576
+ ae(e.flow), P("");
559
577
  let t = Date.now();
560
- se(t), V(t + 3e4), W("otp");
578
+ pe(t), H(t + 3e4), G("otp");
561
579
  });
562
580
  }
563
- function fe(e = k()) {
564
- if (d() === "otp" && !S() && /^\d{6}$/.test(e)) return A(e), K("verify", async () => {
565
- (await G("otp_verify", {
566
- flow: j(),
581
+ function be(e = N()) {
582
+ if (f() === "otp" && !T() && /^\d{6}$/.test(e)) return P(e), q("verify", async () => {
583
+ (await K("otp_verify", {
584
+ flow: F(),
567
585
  code: e
568
- })).step === "mfa" && (N(""), I(!1), W("mfa"));
586
+ })).step === "mfa" && (z(""), V(!1), G("mfa"));
569
587
  });
570
588
  }
571
- function pe() {
572
- if (D() && s()?.passkey) return K("passkey", async () => {
573
- let { challenge: e, challengeId: t, rpId: n, credentials: r } = await G("passkey_start");
574
- if (!e || !t || !n || !r) throw Error();
575
- let i = await navigator.credentials.get({
576
- signal: U.signal,
577
- publicKey: {
578
- challenge: ae(e),
579
- rpId: n,
580
- timeout: 6e4,
581
- userVerification: "required",
582
- allowCredentials: r.map((e) => ({
583
- id: ae(e),
584
- type: "public-key"
585
- }))
586
- }
587
- }).catch((e) => {
588
- if (e instanceof DOMException && e.name === "NotAllowedError") return null;
589
- throw e;
590
- });
591
- if (!(i instanceof PublicKeyCredential) || !(i.response instanceof AuthenticatorAssertionResponse)) throw new R("method_unavailable");
592
- let a = i.response;
593
- await G("passkey_verify", {
594
- challenge_id: t,
595
- credential_id: z(i.rawId),
596
- client_data_json: z(a.clientDataJSON),
597
- authenticator_data: z(a.authenticatorData),
598
- signature: z(a.signature),
599
- user_handle: a.userHandle ? z(a.userHandle) : ""
589
+ async function xe(e, t) {
590
+ let { challenge: i, challengeId: a, rpId: o, credentials: s } = await _e(`${r}/email`, {
591
+ action: "passkey_start",
592
+ next: n
593
+ }, e);
594
+ if (e.aborted || !i || !a || !o || !s || t && s.length) return;
595
+ let c = await navigator.credentials.get({
596
+ signal: e,
597
+ ...t && { mediation: "conditional" },
598
+ publicKey: {
599
+ challenge: ce(i),
600
+ rpId: o,
601
+ ...t ? {} : { timeout: 6e4 },
602
+ userVerification: "required",
603
+ allowCredentials: s.map((e) => ({
604
+ id: ce(e),
605
+ type: "public-key"
606
+ }))
607
+ }
608
+ });
609
+ if (e.aborted || !(c instanceof PublicKeyCredential) || !(c.response instanceof AuthenticatorAssertionResponse)) return;
610
+ let l = c.response;
611
+ return {
612
+ challenge_id: a,
613
+ credential_id: R(c.rawId),
614
+ client_data_json: R(l.clientDataJSON),
615
+ authenticator_data: R(l.authenticatorData),
616
+ signature: R(l.signature),
617
+ user_handle: l.userHandle ? R(l.userHandle) : ""
618
+ };
619
+ }
620
+ function Se() {
621
+ if (k() && c()?.passkey) return q("passkey", async () => {
622
+ let e = await xe(U.signal, !1).catch((e) => {
623
+ if (!(e instanceof DOMException && e.name === "NotAllowedError")) throw e;
600
624
  });
625
+ if (!e) throw new se("method_unavailable");
626
+ await K("passkey_verify", e);
601
627
  });
602
628
  }
603
- function me() {
604
- if (s()?.otp) return q();
605
- s()?.password && !S() && W("password");
629
+ ee(() => {
630
+ if (M || !re() || f() !== "choose" || !c()?.passkey || e.getAcceptance && !e.getAcceptance()) return;
631
+ M = !0;
632
+ let t = new AbortController();
633
+ j = t, xe(t.signal, !0).then((e) => {
634
+ if (e && !t.signal.aborted && !U.signal.aborted) return q("passkey", async () => {
635
+ await K("passkey_verify", e);
636
+ });
637
+ }).catch(() => void 0).finally(() => {
638
+ j === t && (j = void 0);
639
+ });
640
+ });
641
+ function Ce() {
642
+ if (c()?.otp) return ye();
643
+ c()?.password && !T() && G("password");
606
644
  }
607
- function he(e) {
608
- let t = d();
609
- if ((t === "password" || t === "signup" || t === "confirm") && (t !== "confirm" || o)) return K("password", async () => {
610
- let n = await G(t === "confirm" ? "verify_signup" : t, {
611
- email: p().trim(),
645
+ function we(e) {
646
+ let t = f();
647
+ if ((t === "password" || t === "signup" || t === "confirm") && (t !== "confirm" || s)) return q("password", async () => {
648
+ let n = await K(t === "confirm" ? "verify_signup" : t, {
649
+ email: m().trim(),
612
650
  password: e,
613
651
  ...t === "confirm" ? {
614
- challengeId: i,
615
- verification: a
652
+ challengeId: a,
653
+ verification: o
616
654
  } : {}
617
655
  });
618
- n.step === "check_email" && W("check_email"), n.step === "mfa" && n.challenge && (N(n.challenge), P(t === "confirm"), I(!1), W("mfa"));
656
+ n.step === "check_email" && G("check_email"), n.step === "mfa" && n.challenge && (z(n.challenge), le(t === "confirm"), V(!1), G("mfa"));
619
657
  });
620
658
  }
621
- function ge(e) {
622
- if (d() !== "mfa") return;
623
- let t = e.trim(), n = F() ? "recovery_code" : "totp";
624
- return K("verify", async () => {
625
- M() ? await G("mfa", {
626
- challenge: M(),
659
+ function Te(e) {
660
+ if (f() !== "mfa") return;
661
+ let t = e.trim(), n = ue() ? "recovery_code" : "totp";
662
+ return q("verify", async () => {
663
+ I() ? await K("mfa", {
664
+ challenge: I(),
627
665
  code: t,
628
666
  method: n,
629
- ...re() ? {
630
- challengeId: i,
631
- verification: a
667
+ ...B() ? {
668
+ challengeId: a,
669
+ verification: o
632
670
  } : {}
633
- }) : await G("otp_verify", {
634
- flow: j(),
635
- code: k(),
671
+ }) : await K("otp_verify", {
672
+ flow: F(),
673
+ code: N(),
636
674
  factor: t,
637
675
  method: n
638
676
  });
639
677
  });
640
678
  }
641
679
  return {
642
- config: s,
643
- configFailed: l,
644
- loadConfig: le,
645
- step: d,
646
- go: W,
647
- email: p,
648
- setEmail: m,
649
- error: x,
650
- errorCode: y,
651
- busy: S,
652
- showPassword: T,
653
- setShowPassword: E,
654
- canPasskey: D,
655
- code: k,
656
- setCode: A,
657
- recovery: F,
658
- setRecovery: I,
659
- wait: ce,
660
- continueWithEmail: me,
661
- social: de,
662
- sendCode: q,
663
- verifyCode: fe,
664
- passkey: pe,
665
- submitPassword: he,
666
- submitMfa: ge
680
+ emailRoute: `${r}/email`,
681
+ config: c,
682
+ configFailed: u,
683
+ loadConfig: ge,
684
+ step: f,
685
+ go: G,
686
+ email: m,
687
+ setEmail: y,
688
+ error: C,
689
+ errorCode: x,
690
+ busy: T,
691
+ showPassword: ne,
692
+ setShowPassword: O,
693
+ canPasskey: k,
694
+ code: N,
695
+ setCode: P,
696
+ recovery: ue,
697
+ setRecovery: V,
698
+ wait: me,
699
+ continueWithEmail: Ce,
700
+ social: ve,
701
+ sendCode: ye,
702
+ verifyCode: be,
703
+ passkey: Se,
704
+ submitPassword: we,
705
+ submitMfa: Te
667
706
  };
668
707
  }
669
708
  // src/sign-in.tsx
670
- var V = /*#__PURE__*/ p("<p>"), oe = /*#__PURE__*/ p("<p role=alert>"), se = /*#__PURE__*/ p("<label>"), ce = /*#__PURE__*/ p("<input type=email name=username autocomplete=username required maxlength=254>"), H = /*#__PURE__*/ p("<form method=post action=/auth/email><!$><!/><label></label><div><input name=password required maxlength=1024><button type=button></button></div><!$><!/><button type=submit>"), U = /*#__PURE__*/ p("<button type=button>"), le = /*#__PURE__*/ p("<form method=post action=/auth/email><label></label><div><input type=text inputmode=numeric autocomplete=one-time-code><div aria-hidden=true></div></div><button type=submit>"), W = /*#__PURE__*/ p("<div><button type=button></button><button type=button></button><!$><!/>"), ue = /*#__PURE__*/ p("<form method=post action=/auth/email><label></label><input name=code autocomplete=one-time-code required><button type=submit>"), G = /*#__PURE__*/ p("<div><button type=button></button><button type=button>"), K = /*#__PURE__*/ p("<div><label></label><select>"), de = /*#__PURE__*/ p("<section><div><!$><!/><h1></h1><p></p><!$><!/><!$><!/><!$><!/><!$><!/>"), q = /*#__PURE__*/ p("<output>"), fe = /*#__PURE__*/ p("<div>"), pe = /*#__PURE__*/ p("<form method=post action=/auth/email><label></label><input type=email name=email autocomplete=username required maxlength=254><button type=submit>"), me = /*#__PURE__*/ p("<p><!$><!/> <button type=button>"), he = /*#__PURE__*/ p("<button type=button><!$><!/><!$><!/>"), ge = /*#__PURE__*/ p("<input tabindex=-1 hidden name=username autocomplete=username readonly>"), _e = /*#__PURE__*/ p("<span>"), ve = /*#__PURE__*/ p("<option>"), ye = Object.keys(E), be = {
709
+ var B = /*#__PURE__*/ p("<p>"), le = /*#__PURE__*/ p("<p role=alert>"), ue = /*#__PURE__*/ p("<label>"), V = /*#__PURE__*/ p("<input type=email name=username required maxlength=254>"), de = /*#__PURE__*/ p("<form method=post><!$><!/><label></label><div><input name=password required maxlength=1024><button type=button></button></div><!$><!/><button type=submit>"), H = /*#__PURE__*/ p("<button type=button>"), fe = /*#__PURE__*/ p("<form method=post><label></label><div><input type=text inputmode=numeric autocomplete=one-time-code><div aria-hidden=true></div></div><button type=submit>"), pe = /*#__PURE__*/ p("<div><button type=button></button><button type=button></button><!$><!/>"), me = /*#__PURE__*/ p("<form method=post><label></label><input name=code autocomplete=one-time-code required><button type=submit>"), he = /*#__PURE__*/ p("<div><button type=button></button><button type=button>"), U = /*#__PURE__*/ p("<div><label></label><select>"), ge = /*#__PURE__*/ p("<section><div><!$><!/><h1></h1><p></p><!$><!/><!$><!/><!$><!/><!$><!/>"), W = /*#__PURE__*/ p("<output>"), G = /*#__PURE__*/ p("<div>"), _e = /*#__PURE__*/ p("<form method=post><label></label><input type=email name=email required maxlength=254><button type=submit>"), K = /*#__PURE__*/ p("<p><!$><!/> <button type=button>"), q = /*#__PURE__*/ p("<button type=button><!$><!/><!$><!/>"), ve = /*#__PURE__*/ p("<input tabindex=-1 hidden name=username readonly>"), ye = /*#__PURE__*/ p("<span>"), be = /*#__PURE__*/ p("<option>"), xe = Object.keys(ne), Se = {
671
710
  google: N,
672
- github: re,
673
- apple: P,
711
+ github: P,
712
+ apple: F,
674
713
  facebook: I,
675
- microsoft: F
714
+ microsoft: ae
676
715
  };
677
- function xe(r) {
678
- let p = B(r), { config: h, configFailed: _, loadConfig: ee, step: k, email: A, setEmail: j, errorCode: ne, busy: M, showPassword: N, setShowPassword: re, canPasskey: P, code: F, setCode: I, recovery: L, setRecovery: ie, wait: R, continueWithEmail: ae, social: z, sendCode: xe, verifyCode: Se, passkey: Ce, submitPassword: we, submitMfa: Te } = p, [Ee, De] = C(), [Oe, ke] = C(), J = S(() => r.locale === void 0 ? Oe() ?? Ee() ?? D(r.localePreferences ?? []) : D([r.locale, ...r.localePreferences ?? []])), Y = () => T[J()], Ae = S(() => O(J())), je = () => {
679
- let e = ne();
716
+ function Ce(r) {
717
+ let p = z(r), { emailRoute: h, config: g, configFailed: v, loadConfig: ee, step: E, email: A, setEmail: re, errorCode: ie, busy: j, showPassword: M, setShowPassword: N, canPasskey: P, code: F, setCode: ae, recovery: I, setRecovery: oe, wait: L, continueWithEmail: se, social: ce, sendCode: R, verifyCode: Ce, passkey: we, submitPassword: Te, submitMfa: Ee } = p, [De, Oe] = w(), [ke, Ae] = w(), J = C(() => r.locale === void 0 ? ke() ?? De() ?? O(r.localePreferences ?? []) : O([r.locale, ...r.localePreferences ?? []])), Y = () => D[J()], je = C(() => k(J())), Me = () => {
718
+ let e = ie();
680
719
  return e ? Y().errors[e] : "";
681
720
  };
682
721
  te(() => {
683
- r.locale === void 0 && !r.localePreferences?.length && De(D(navigator.languages));
722
+ r.locale === void 0 && !r.localePreferences?.length && Oe(O(navigator.languages));
684
723
  });
685
- let Me = w(), X = (e) => `${Me}-${e}`;
724
+ let Ne = T(), X = (e) => `${Ne}-${e}`;
686
725
  function Z(e) {
687
726
  let t = r.appearance?.classes?.[e];
688
727
  return r.appearance?.unstyled ? t : t ? `auth-sign-in-${e} ${t}` : `auth-sign-in-${e}`;
689
728
  }
690
- let Ne;
729
+ let Pe;
691
730
  function Q(e) {
692
731
  queueMicrotask(() => e.focus());
693
732
  }
694
733
  function $(e) {
695
- p.go(e), e === "choose" && queueMicrotask(() => Ne?.focus());
734
+ p.go(e), e === "choose" && queueMicrotask(() => Pe?.focus());
696
735
  }
697
736
  return (() => {
698
- var p = a(de), S = p.firstChild, C = S.firstChild, [w, te] = o(C.nextSibling), T = w.nextSibling, O = T.nextSibling, ne = O.nextSibling, [B, Ee] = o(ne.nextSibling), De = B.nextSibling, [Oe, Me] = o(De.nextSibling), Pe = Oe.nextSibling, [Fe, Ie] = o(Pe.nextSibling), Le = Fe.nextSibling, [Re, ze] = o(Le.nextSibling);
699
- return s(S, n(b, {
737
+ var p = a(ge), C = p.firstChild, w = C.firstChild, [T, te] = o(w.nextSibling), D = T.nextSibling, k = D.nextSibling, ie = k.nextSibling, [z, De] = o(ie.nextSibling), Oe = z.nextSibling, [ke, Ne] = o(Oe.nextSibling), Fe = ke.nextSibling, [Ie, Le] = o(Fe.nextSibling), Re = Ie.nextSibling, [ze, Be] = o(Re.nextSibling);
738
+ return s(C, n(x, {
700
739
  get when() {
701
740
  return r.kicker;
702
741
  },
703
742
  get children() {
704
- var e = a(V);
743
+ var e = a(B);
705
744
  return s(e, () => r.kicker), i(() => t(e, Z("kicker"))), e;
706
745
  }
707
- }), w, te), s(T, () => ({
746
+ }), T, te), s(D, () => ({
708
747
  choose: r.title ?? Y().signIn,
709
748
  password: Y().enterPassword,
710
749
  signup: Y().createYourAccount,
@@ -712,50 +751,50 @@ function xe(r) {
712
751
  confirm: Y().confirmEmail,
713
752
  otp: Y().checkInbox,
714
753
  mfa: Y().verifyIdentity
715
- })[k()]), s(O, () => ({
754
+ })[E()]), s(k, () => ({
716
755
  choose: r.description ?? Y().chooseMethod,
717
756
  password: A(),
718
757
  signup: Y().startWithEmail,
719
758
  check_email: Y().checkEmailDescription,
720
759
  confirm: Y().confirmEmailDescription,
721
760
  otp: Y().enterEmailCode(A()),
722
- mfa: L() ? Y().enterRecovery : Y().enterAuthenticator
723
- })[k()]), s(S, n(b, {
761
+ mfa: I() ? Y().enterRecovery : Y().enterAuthenticator
762
+ })[E()]), s(C, n(x, {
724
763
  get when() {
725
- return je();
764
+ return Me();
726
765
  },
727
766
  get children() {
728
- var e = a(oe);
729
- return s(e, je), i(() => t(e, Z("error"))), e;
767
+ var e = a(le);
768
+ return s(e, Me), i(() => t(e, Z("error"))), e;
730
769
  }
731
- }), B, Ee), s(S, n(x, { get children() {
770
+ }), z, De), s(C, n(S, { get children() {
732
771
  return [
733
- n(y, {
772
+ n(b, {
734
773
  get when() {
735
- return k() === "choose";
774
+ return E() === "choose";
736
775
  },
737
776
  get children() {
738
- return n(b, {
777
+ return n(x, {
739
778
  get when() {
740
- return h();
779
+ return g();
741
780
  },
742
781
  get fallback() {
743
- return n(b, {
782
+ return n(x, {
744
783
  get when() {
745
- return _();
784
+ return v();
746
785
  },
747
786
  get fallback() {
748
787
  return (() => {
749
- var e = a(q);
788
+ var e = a(W);
750
789
  return s(e, () => Y().loading), i(() => t(e, Z("loading"))), e;
751
790
  })();
752
791
  },
753
792
  get children() {
754
793
  return [(() => {
755
- var e = a(oe);
794
+ var e = a(le);
756
795
  return s(e, () => Y().errors.unavailable), i(() => t(e, Z("error"))), e;
757
796
  })(), (() => {
758
- var n = a(U);
797
+ var n = a(H);
759
798
  return e(n, "click", ee, !0), s(n, () => Y().retry), i(() => t(n, Z("secondary"))), l(), n;
760
799
  })()];
761
800
  }
@@ -763,20 +802,20 @@ function xe(r) {
763
802
  },
764
803
  children: (e) => [
765
804
  (() => {
766
- var r = a(fe);
767
- return s(r, n(v, {
805
+ var r = a(G);
806
+ return s(r, n(y, {
768
807
  get each() {
769
808
  return e().providers;
770
809
  },
771
810
  children: (e) => {
772
- let r = be[e];
811
+ let r = Se[e];
773
812
  return (() => {
774
- var u = a(he), f = u.firstChild, [p, m] = o(f.nextSibling), h = p.nextSibling, [_, v] = o(h.nextSibling);
775
- return u.$$click = () => void z(e), s(u, r && n(r, {}), p, m), s(u, (() => {
776
- var t = c(() => M() === g[e][0]);
777
- return () => t() ? Y().openingProvider(g[e][0]) : Y().continueProvider(g[e][0]);
778
- })(), _, v), i((e) => {
779
- var n = Z("secondary"), r = !!M();
813
+ var u = a(q), f = u.firstChild, [p, m] = o(f.nextSibling), h = p.nextSibling, [g, v] = o(h.nextSibling);
814
+ return u.$$click = () => void ce(e), s(u, r && n(r, {}), p, m), s(u, (() => {
815
+ var t = c(() => j() === _[e][0]);
816
+ return () => t() ? Y().openingProvider(_[e][0]) : Y().continueProvider(_[e][0]);
817
+ })(), g, v), i((e) => {
818
+ var n = Z("secondary"), r = !!j();
780
819
  return n !== e.e && t(u, e.e = n), r !== e.t && d(u, "disabled", e.t = r), e;
781
820
  }, {
782
821
  e: void 0,
@@ -786,52 +825,53 @@ function xe(r) {
786
825
  }
787
826
  })), i(() => t(r, Z("providers"))), r;
788
827
  })(),
789
- n(b, {
828
+ n(x, {
790
829
  get when() {
791
830
  return e().password || e().otp;
792
831
  },
793
832
  get children() {
794
- return [n(b, {
833
+ return [n(x, {
795
834
  get when() {
796
835
  return e().providers.length;
797
836
  },
798
837
  get children() {
799
- var e = a(fe);
838
+ var e = a(G);
800
839
  return s(e, () => Y().orEmail), i(() => t(e, Z("divider"))), e;
801
840
  }
802
841
  }), (() => {
803
- var n = a(pe), r = n.firstChild, o = r.nextSibling, f = o.nextSibling;
842
+ var n = a(_e), r = n.firstChild, o = r.nextSibling, f = o.nextSibling;
804
843
  return n.addEventListener("submit", (e) => {
805
- e.preventDefault(), ae();
806
- }), s(r, () => Y().email), o.$$input = (e) => j(e.currentTarget.value), m((e) => {
807
- Ne = e;
844
+ e.preventDefault(), se();
845
+ }), u(n, "action", h), s(r, () => Y().email), o.$$input = (e) => re(e.currentTarget.value), m((e) => {
846
+ Pe = e;
808
847
  }, o), s(f, (() => {
809
- var t = c(() => M() === "email");
848
+ var t = c(() => j() === "email");
810
849
  return () => t() ? Y().sendingCode : c(() => !!e().otp)() ? Y().emailCodeAction : Y().continueEmail;
811
850
  })()), i((e) => {
812
- var i = Z("form"), a = X("email"), s = X("email"), c = Z("primary"), l = !!M();
813
- return i !== e.e && t(n, e.e = i), a !== e.t && u(r, "for", e.t = a), s !== e.a && u(o, "id", e.a = s), c !== e.o && t(f, e.o = c), l !== e.i && d(f, "disabled", e.i = l), e;
851
+ var i = Z("form"), a = X("email"), s = X("email"), c = g()?.passkey ? "username webauthn" : "username", l = Z("primary"), p = !!j();
852
+ return i !== e.e && t(n, e.e = i), a !== e.t && u(r, "for", e.t = a), s !== e.a && u(o, "id", e.a = s), c !== e.o && u(o, "autocomplete", e.o = c), l !== e.i && t(f, e.i = l), p !== e.n && d(f, "disabled", e.n = p), e;
814
853
  }, {
815
854
  e: void 0,
816
855
  t: void 0,
817
856
  a: void 0,
818
857
  o: void 0,
819
- i: void 0
858
+ i: void 0,
859
+ n: void 0
820
860
  }), i(() => d(o, "value", A())), l(), n;
821
861
  })()];
822
862
  }
823
863
  }),
824
- n(b, {
864
+ n(x, {
825
865
  get when() {
826
866
  return c(() => !!e().passkey)() && P();
827
867
  },
828
868
  get children() {
829
- var e = a(U);
830
- return e.$$click = () => void Ce(), s(e, (() => {
831
- var e = c(() => M() === "passkey");
869
+ var e = a(H);
870
+ return e.$$click = () => void we(), s(e, (() => {
871
+ var e = c(() => j() === "passkey");
832
872
  return () => e() ? Y().waitingPasskey : Y().usePasskey;
833
873
  })()), i((n) => {
834
- var r = Z("link"), i = !!M();
874
+ var r = Z("link"), i = !!j();
835
875
  return r !== n.e && t(e, n.e = r), i !== n.t && d(e, "disabled", n.t = i), n;
836
876
  }, {
837
877
  e: void 0,
@@ -839,14 +879,14 @@ function xe(r) {
839
879
  }), l(), e;
840
880
  }
841
881
  }),
842
- n(b, {
882
+ n(x, {
843
883
  get when() {
844
884
  return e().signup;
845
885
  },
846
886
  get children() {
847
- var e = a(me), n = e.firstChild, [r, c] = o(n.nextSibling), u = r.nextSibling.nextSibling;
887
+ var e = a(K), n = e.firstChild, [r, c] = o(n.nextSibling), u = r.nextSibling.nextSibling;
848
888
  return s(e, () => Y().newHere, r, c), u.$$click = () => $("signup"), s(u, () => Y().createAnAccount), i((n) => {
849
- var r = Z("switch"), i = Z("link"), a = !!M();
889
+ var r = Z("switch"), i = Z("link"), a = !!j();
850
890
  return r !== n.e && t(e, n.e = r), i !== n.t && t(u, n.t = i), a !== n.a && d(u, "disabled", n.a = a), n;
851
891
  }, {
852
892
  e: void 0,
@@ -855,12 +895,12 @@ function xe(r) {
855
895
  }), l(), e;
856
896
  }
857
897
  }),
858
- n(b, {
898
+ n(x, {
859
899
  get when() {
860
900
  return c(() => !(e().password || e().signup || e().otp || e().providers.length))() && !(e().passkey && P());
861
901
  },
862
902
  get children() {
863
- var e = a(q);
903
+ var e = a(W);
864
904
  return s(e, () => Y().noMethods), e;
865
905
  }
866
906
  })
@@ -868,47 +908,53 @@ function xe(r) {
868
908
  });
869
909
  }
870
910
  }),
871
- n(y, {
911
+ n(b, {
872
912
  get when() {
873
- return k() === "password" || k() === "signup" || k() === "confirm";
913
+ return E() === "password" || E() === "signup" || E() === "confirm";
874
914
  },
875
915
  get children() {
876
916
  return [(() => {
877
- var e = a(H), r = e.firstChild, [f, p] = o(r.nextSibling), h = f.nextSibling, g = h.nextSibling, _ = g.firstChild, v = _.nextSibling, y = g.nextSibling, [x, S] = o(y.nextSibling), C = x.nextSibling;
917
+ var e = a(de), r = e.firstChild, [f, p] = o(r.nextSibling), _ = f.nextSibling, v = _.nextSibling, y = v.firstChild, b = y.nextSibling, S = v.nextSibling, [ee, C] = o(S.nextSibling), w = ee.nextSibling;
878
918
  return e.addEventListener("submit", (e) => {
879
- e.preventDefault(), we(String(new FormData(e.currentTarget).get("password") ?? ""));
880
- }), s(e, n(b, {
919
+ e.preventDefault(), Te(String(new FormData(e.currentTarget).get("password") ?? ""));
920
+ }), u(e, "action", h), s(e, n(x, {
881
921
  get when() {
882
- return k() !== "password";
922
+ return E() !== "password";
883
923
  },
884
924
  get fallback() {
885
925
  return (() => {
886
- var e = a(ge);
887
- return i(() => d(e, "value", A())), e;
926
+ var e = a(ve);
927
+ return i(() => u(e, "autocomplete", g()?.passkey ? "username webauthn" : "username")), i(() => d(e, "value", A())), e;
888
928
  })();
889
929
  },
890
930
  get children() {
891
931
  return [(() => {
892
- var e = a(se);
932
+ var e = a(ue);
893
933
  return s(e, () => Y().email), i(() => u(e, "for", X("account-email"))), e;
894
934
  })(), (() => {
895
- var e = a(ce);
896
- e.$$input = (e) => j(e.currentTarget.value);
935
+ var e = a(V);
936
+ e.$$input = (e) => re(e.currentTarget.value);
897
937
  var t = Q;
898
- return typeof t == "function" ? m(t, e) : Q = e, i(() => u(e, "id", X("account-email"))), i(() => d(e, "value", A())), l(), e;
938
+ return typeof t == "function" ? m(t, e) : Q = e, i((t) => {
939
+ var n = X("account-email"), r = g()?.passkey ? "username webauthn" : "username";
940
+ return n !== t.e && u(e, "id", t.e = n), r !== t.t && u(e, "autocomplete", t.t = r), t;
941
+ }, {
942
+ e: void 0,
943
+ t: void 0
944
+ }), i(() => d(e, "value", A())), l(), e;
899
945
  })()];
900
946
  }
901
- }), f, p), s(h, () => Y().password), m((e) => {
902
- k() === "password" && Q(e);
903
- }, _), v.$$click = () => re(!N()), s(v, (() => {
904
- var e = c(() => !!N());
947
+ }), f, p), s(_, () => Y().password), m((e) => {
948
+ E() === "password" && Q(e);
949
+ }, y), b.$$click = () => N(!M()), s(b, (() => {
950
+ var e = c(() => !!M());
905
951
  return () => e() ? Y().hide : Y().show;
906
- })()), s(e, n(b, {
952
+ })()), s(e, n(x, {
907
953
  get when() {
908
- return k() === "signup";
954
+ return E() === "signup";
909
955
  },
910
956
  get children() {
911
- var e = a(V);
957
+ var e = a(B);
912
958
  return s(e, () => Y().minimumPassword), i((n) => {
913
959
  var r = Z("hint"), i = X("password-hint");
914
960
  return r !== n.e && t(e, n.e = r), i !== n.t && u(e, "id", n.t = i), n;
@@ -917,12 +963,12 @@ function xe(r) {
917
963
  t: void 0
918
964
  }), e;
919
965
  }
920
- }), x, S), s(C, (() => {
921
- var e = c(() => !!M());
922
- return () => e() ? Y().working : c(() => k() === "signup")() ? Y().createAccount : c(() => k() === "confirm")() ? Y().confirmAndSignIn : Y().signIn;
966
+ }), ee, C), s(w, (() => {
967
+ var e = c(() => !!j());
968
+ return () => e() ? Y().working : c(() => E() === "signup")() ? Y().createAccount : c(() => E() === "confirm")() ? Y().confirmAndSignIn : Y().signIn;
923
969
  })()), i((n) => {
924
- var r = Z("form"), i = X("password"), a = Z("password"), o = X("password"), s = N() ? "text" : "password", c = k() === "signup" ? "new-password" : "current-password", l = k() === "signup" ? 12 : void 0, f = k() === "signup" ? X("password-hint") : void 0, p = Z("link"), m = N() ? Y().hidePassword : Y().showPassword, y = Z("primary"), b = !!M();
925
- return r !== n.e && t(e, n.e = r), i !== n.t && u(h, "for", n.t = i), a !== n.a && t(g, n.a = a), o !== n.o && u(_, "id", n.o = o), s !== n.i && u(_, "type", n.i = s), c !== n.n && u(_, "autocomplete", n.n = c), l !== n.s && u(_, "minlength", n.s = l), f !== n.h && u(_, "aria-describedby", n.h = f), p !== n.r && t(v, n.r = p), m !== n.d && u(v, "aria-label", n.d = m), y !== n.l && t(C, n.l = y), b !== n.u && d(C, "disabled", n.u = b), n;
970
+ var r = Z("form"), i = X("password"), a = Z("password"), o = X("password"), s = M() ? "text" : "password", c = E() === "signup" ? "new-password" : "current-password", l = E() === "signup" ? 12 : void 0, f = E() === "signup" ? X("password-hint") : void 0, p = Z("link"), m = M() ? Y().hidePassword : Y().showPassword, h = Z("primary"), g = !!j();
971
+ return r !== n.e && t(e, n.e = r), i !== n.t && u(_, "for", n.t = i), a !== n.a && t(v, n.a = a), o !== n.o && u(y, "id", n.o = o), s !== n.i && u(y, "type", n.i = s), c !== n.n && u(y, "autocomplete", n.n = c), l !== n.s && u(y, "minlength", n.s = l), f !== n.h && u(y, "aria-describedby", n.h = f), p !== n.r && t(b, n.r = p), m !== n.d && u(b, "aria-label", n.d = m), h !== n.l && t(w, n.l = h), g !== n.u && d(w, "disabled", n.u = g), n;
926
972
  }, {
927
973
  e: void 0,
928
974
  t: void 0,
@@ -938,12 +984,12 @@ function xe(r) {
938
984
  u: void 0
939
985
  }), l(), e;
940
986
  })(), (() => {
941
- var e = a(U);
987
+ var e = a(H);
942
988
  return e.$$click = () => $("choose"), s(e, (() => {
943
- var e = c(() => k() === "password");
989
+ var e = c(() => E() === "password");
944
990
  return () => e() ? Y().changeEmailOrMethod : Y().backToSignIn;
945
991
  })()), i((n) => {
946
- var r = Z("link"), i = !!M();
992
+ var r = Z("link"), i = !!j();
947
993
  return r !== n.e && t(e, n.e = r), i !== n.t && d(e, "disabled", n.t = i), n;
948
994
  }, {
949
995
  e: void 0,
@@ -952,30 +998,30 @@ function xe(r) {
952
998
  })()];
953
999
  }
954
1000
  }),
955
- n(y, {
1001
+ n(b, {
956
1002
  get when() {
957
- return k() === "check_email";
1003
+ return E() === "check_email";
958
1004
  },
959
1005
  get children() {
960
- var e = a(U);
1006
+ var e = a(H);
961
1007
  return e.$$click = () => $("choose"), s(e, () => Y().backToSignIn), i(() => t(e, Z("secondary"))), l(), e;
962
1008
  }
963
1009
  }),
964
- n(y, {
1010
+ n(b, {
965
1011
  get when() {
966
- return k() === "otp";
1012
+ return E() === "otp";
967
1013
  },
968
1014
  get children() {
969
1015
  return [(() => {
970
- var e = a(le), r = e.firstChild, o = r.nextSibling, f = o.firstChild, p = f.nextSibling, h = o.nextSibling;
1016
+ var e = a(fe), r = e.firstChild, o = r.nextSibling, f = o.firstChild, p = f.nextSibling, g = o.nextSibling;
971
1017
  e.addEventListener("submit", (e) => {
972
- e.preventDefault(), Se(F());
973
- }), s(r, () => Y().emailCode), f.$$input = (e) => {
1018
+ e.preventDefault(), Ce(F());
1019
+ }), u(e, "action", h), s(r, () => Y().emailCode), f.$$input = (e) => {
974
1020
  let t = e.currentTarget.value.replace(/\D/g, "").slice(0, 6);
975
- e.currentTarget.value = t, I(t), Se(t);
1021
+ e.currentTarget.value = t, ae(t), Ce(t);
976
1022
  };
977
- var g = Q;
978
- return typeof g == "function" ? m(g, f) : Q = f, s(p, n(v, {
1023
+ var _ = Q;
1024
+ return typeof _ == "function" ? m(_, f) : Q = f, s(p, n(y, {
979
1025
  each: [
980
1026
  0,
981
1027
  1,
@@ -985,15 +1031,15 @@ function xe(r) {
985
1031
  5
986
1032
  ],
987
1033
  children: (e) => (() => {
988
- var t = a(_e);
1034
+ var t = a(ye);
989
1035
  return s(t, () => F()[e] ?? ""), t;
990
1036
  })()
991
- })), s(h, (() => {
992
- var e = c(() => M() === "verify");
1037
+ })), s(g, (() => {
1038
+ var e = c(() => j() === "verify");
993
1039
  return () => e() ? Y().checkingCode : Y().verifyCode;
994
1040
  })()), i((n) => {
995
- var i = Z("form"), a = X("code"), s = Z("otp"), c = X("code"), l = !!M(), m = Z("cells"), g = Z("primary"), _ = !!M() || F().length !== 6;
996
- return i !== n.e && t(e, n.e = i), a !== n.t && u(r, "for", n.t = a), s !== n.a && t(o, n.a = s), c !== n.o && u(f, "id", n.o = c), l !== n.i && d(f, "readOnly", n.i = l), m !== n.n && t(p, n.n = m), g !== n.s && t(h, n.s = g), _ !== n.h && d(h, "disabled", n.h = _), n;
1041
+ var i = Z("form"), a = X("code"), s = Z("otp"), c = X("code"), l = !!j(), m = Z("cells"), h = Z("primary"), _ = !!j() || F().length !== 6;
1042
+ return i !== n.e && t(e, n.e = i), a !== n.t && u(r, "for", n.t = a), s !== n.a && t(o, n.a = s), c !== n.o && u(f, "id", n.o = c), l !== n.i && d(f, "readOnly", n.i = l), m !== n.n && t(p, n.n = m), h !== n.s && t(g, n.s = h), _ !== n.h && d(g, "disabled", n.h = _), n;
997
1043
  }, {
998
1044
  e: void 0,
999
1045
  t: void 0,
@@ -1005,18 +1051,18 @@ function xe(r) {
1005
1051
  h: void 0
1006
1052
  }), i(() => d(f, "value", F())), l(), e;
1007
1053
  })(), (() => {
1008
- var e = a(W), r = e.firstChild, u = r.nextSibling, f = u.nextSibling, [p, m] = o(f.nextSibling);
1009
- return r.$$click = () => void xe(), s(r, (() => {
1010
- var e = c(() => !!R());
1011
- return () => e() ? Y().resendIn(Ae().format(R())) : Y().resendCode;
1012
- })()), u.$$click = () => $("choose"), s(u, () => Y().changeEmail), s(e, n(b, {
1054
+ var e = a(pe), r = e.firstChild, u = r.nextSibling, f = u.nextSibling, [p, m] = o(f.nextSibling);
1055
+ return r.$$click = () => void R(), s(r, (() => {
1056
+ var e = c(() => !!L());
1057
+ return () => e() ? Y().resendIn(je().format(L())) : Y().resendCode;
1058
+ })()), u.$$click = () => $("choose"), s(u, () => Y().changeEmail), s(e, n(x, {
1013
1059
  get when() {
1014
- return h()?.password;
1060
+ return g()?.password;
1015
1061
  },
1016
1062
  get children() {
1017
- var e = a(U);
1063
+ var e = a(H);
1018
1064
  return e.$$click = () => $("password"), s(e, () => Y().usePassword), i((n) => {
1019
- var r = Z("link"), i = !!M();
1065
+ var r = Z("link"), i = !!j();
1020
1066
  return r !== n.e && t(e, n.e = r), i !== n.t && d(e, "disabled", n.t = i), n;
1021
1067
  }, {
1022
1068
  e: void 0,
@@ -1024,7 +1070,7 @@ function xe(r) {
1024
1070
  }), l(), e;
1025
1071
  }
1026
1072
  }), p, m), i((n) => {
1027
- var i = Z("actions"), a = Z("link"), o = !!M() || R() > 0, s = Z("link"), c = !!M();
1073
+ var i = Z("actions"), a = Z("link"), o = !!j() || L() > 0, s = Z("link"), c = !!j();
1028
1074
  return i !== n.e && t(e, n.e = i), a !== n.t && t(r, n.t = a), o !== n.a && d(r, "disabled", n.a = o), s !== n.o && t(u, n.o = s), c !== n.i && d(u, "disabled", n.i = c), n;
1029
1075
  }, {
1030
1076
  e: void 0,
@@ -1036,25 +1082,25 @@ function xe(r) {
1036
1082
  })()];
1037
1083
  }
1038
1084
  }),
1039
- n(y, {
1085
+ n(b, {
1040
1086
  get when() {
1041
- return k() === "mfa";
1087
+ return E() === "mfa";
1042
1088
  },
1043
1089
  get children() {
1044
1090
  return [(() => {
1045
- var e = a(ue), n = e.firstChild, r = n.nextSibling, o = r.nextSibling;
1091
+ var e = a(me), n = e.firstChild, r = n.nextSibling, o = r.nextSibling;
1046
1092
  e.addEventListener("submit", (e) => {
1047
- e.preventDefault(), Te(String(new FormData(e.currentTarget).get("code") ?? ""));
1048
- }), s(n, (() => {
1049
- var e = c(() => !!L());
1093
+ e.preventDefault(), Ee(String(new FormData(e.currentTarget).get("code") ?? ""));
1094
+ }), u(e, "action", h), s(n, (() => {
1095
+ var e = c(() => !!I());
1050
1096
  return () => e() ? Y().recoveryCode : Y().authenticatorCode;
1051
1097
  })());
1052
1098
  var l = Q;
1053
1099
  return typeof l == "function" ? m(l, r) : Q = r, s(o, (() => {
1054
- var e = c(() => !!M());
1100
+ var e = c(() => !!j());
1055
1101
  return () => e() ? Y().checkingCode : Y().verifyAndSignIn;
1056
1102
  })()), i((i) => {
1057
- var a = Z("form"), s = X("mfa"), c = X("mfa"), l = L() ? "text" : "numeric", f = L() ? 128 : 6, p = Z("primary"), m = !!M();
1103
+ var a = Z("form"), s = X("mfa"), c = X("mfa"), l = I() ? "text" : "numeric", f = I() ? 128 : 6, p = Z("primary"), m = !!j();
1058
1104
  return a !== i.e && t(e, i.e = a), s !== i.t && u(n, "for", i.t = s), c !== i.a && u(r, "id", i.a = c), l !== i.o && u(r, "inputmode", i.o = l), f !== i.i && u(r, "maxlength", i.i = f), p !== i.n && t(o, i.n = p), m !== i.s && d(o, "disabled", i.s = m), i;
1059
1105
  }, {
1060
1106
  e: void 0,
@@ -1066,12 +1112,12 @@ function xe(r) {
1066
1112
  s: void 0
1067
1113
  }), e;
1068
1114
  })(), (() => {
1069
- var e = a(G), n = e.firstChild, r = n.nextSibling;
1070
- return n.$$click = () => ie(!L()), s(n, (() => {
1071
- var e = c(() => !!L());
1115
+ var e = a(he), n = e.firstChild, r = n.nextSibling;
1116
+ return n.$$click = () => oe(!I()), s(n, (() => {
1117
+ var e = c(() => !!I());
1072
1118
  return () => e() ? Y().useAuthenticator : Y().useRecovery;
1073
1119
  })()), r.$$click = () => $("choose"), s(r, () => Y().backToSignIn), i((i) => {
1074
- var a = Z("actions"), o = !!M(), s = Z("link"), c = !!M(), l = Z("link");
1120
+ var a = Z("actions"), o = !!j(), s = Z("link"), c = !!j(), l = Z("link");
1075
1121
  return a !== i.e && t(e, i.e = a), o !== i.t && d(n, "disabled", i.t = o), s !== i.a && t(n, i.a = s), c !== i.o && d(r, "disabled", i.o = c), l !== i.i && t(r, i.i = l), i;
1076
1122
  }, {
1077
1123
  e: void 0,
@@ -1084,20 +1130,20 @@ function xe(r) {
1084
1130
  }
1085
1131
  })
1086
1132
  ];
1087
- } }), Oe, Me), s(S, n(b, {
1133
+ } }), ke, Ne), s(C, n(x, {
1088
1134
  get when() {
1089
1135
  return c(() => r.showLocaleSelector !== !1)() && (r.locale === void 0 || r.onLocaleChange);
1090
1136
  },
1091
1137
  get children() {
1092
- var e = a(K), o = e.firstChild, c = o.nextSibling;
1138
+ var e = a(U), o = e.firstChild, c = o.nextSibling;
1093
1139
  return s(o, () => Y().language), c.addEventListener("change", (e) => {
1094
- let t = D([e.currentTarget.value]);
1095
- r.locale === void 0 && ke(t), r.onLocaleChange?.(t);
1096
- }), s(c, n(v, {
1097
- each: ye,
1140
+ let t = O([e.currentTarget.value]);
1141
+ r.locale === void 0 && Ae(t), r.onLocaleChange?.(t);
1142
+ }), s(c, n(y, {
1143
+ each: xe,
1098
1144
  children: (e) => (() => {
1099
- var t = a(ve);
1100
- return d(t, "value", e), u(t, "lang", e), s(t, () => E[e]), i(() => d(t, "selected", J() === e)), t;
1145
+ var t = a(be);
1146
+ return d(t, "value", e), u(t, "lang", e), s(t, () => ne[e]), i(() => d(t, "selected", J() === e)), t;
1101
1147
  })()
1102
1148
  })), i((n) => {
1103
1149
  var r = Z("locale"), i = X("locale"), a = X("locale");
@@ -1108,17 +1154,17 @@ function xe(r) {
1108
1154
  a: void 0
1109
1155
  }), i(() => d(c, "value", J())), e;
1110
1156
  }
1111
- }), Fe, Ie), s(S, n(b, {
1157
+ }), Ie, Le), s(C, n(x, {
1112
1158
  get when() {
1113
1159
  return r.agreement;
1114
1160
  },
1115
1161
  get children() {
1116
- var e = a(V);
1162
+ var e = a(B);
1117
1163
  return s(e, () => r.agreement), i(() => t(e, Z("agreement"))), e;
1118
1164
  }
1119
- }), Re, ze), i((e) => {
1165
+ }), ze, Be), i((e) => {
1120
1166
  var n = Z("panel"), i = r.appearance?.tokens, a = X("title"), o = J(), s = Z("content"), c = X("title"), l = Z("title"), d = Z("sub");
1121
- return n !== e.e && t(p, e.e = n), e.t = f(p, i, e.t), a !== e.a && u(p, "aria-labelledby", e.a = a), o !== e.o && u(p, "lang", e.o = o), s !== e.i && t(S, e.i = s), c !== e.n && u(T, "id", e.n = c), l !== e.s && t(T, e.s = l), d !== e.h && t(O, e.h = d), e;
1167
+ return n !== e.e && t(p, e.e = n), e.t = f(p, i, e.t), a !== e.a && u(p, "aria-labelledby", e.a = a), o !== e.o && u(p, "lang", e.o = o), s !== e.i && t(C, e.i = s), c !== e.n && u(D, "id", e.n = c), l !== e.s && t(D, e.s = l), d !== e.h && t(k, e.h = d), e;
1122
1168
  }, {
1123
1169
  e: void 0,
1124
1170
  t: void 0,
@@ -1132,4 +1178,4 @@ function xe(r) {
1132
1178
  })();
1133
1179
  }
1134
1180
  r(["input", "click"]);
1135
- export { xe as SylphxSignIn, B as createSignInController, E as localeNames, D as resolveAuthLocale, T as signInMessages };
1181
+ export { Ce as SylphxSignIn, z as createSignInController, ne as localeNames, O as resolveAuthLocale, D as signInMessages };