@passflow/core 0.26.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import e from "axios";
2
2
  import { startAuthentication as t, startRegistration as n } from "@simplewebauthn/browser";
3
3
  // package.json
4
- var r = "0.26.0", i = "X-Passflow-Clientid", a = "Authorization", o = "X-Passflow-DeviceId", s = "X-Passflow-DeviceType", c = r, l = [
4
+ var r = "0.27.0", i = "X-Passflow-Clientid", a = "Authorization", o = "X-Passflow-DeviceId", s = "X-Passflow-DeviceType", c = r, l = [
5
5
  "id",
6
6
  "offline",
7
7
  "openid"
@@ -3430,7 +3430,68 @@ var Z = /* @__PURE__ */ function(e) {
3430
3430
  notifyError(e) {
3431
3431
  return U(this, e);
3432
3432
  }
3433
- }, Q = {
3433
+ }, ar = {
3434
+ ES256: {
3435
+ kty: "EC",
3436
+ key: (e) => ({
3437
+ kty: e.kty,
3438
+ crv: e.crv,
3439
+ x: e.x,
3440
+ y: e.y
3441
+ }),
3442
+ imported: {
3443
+ name: "ECDSA",
3444
+ namedCurve: "P-256"
3445
+ },
3446
+ signature: {
3447
+ name: "ECDSA",
3448
+ hash: "SHA-256"
3449
+ }
3450
+ },
3451
+ RS256: {
3452
+ kty: "RSA",
3453
+ key: (e) => ({
3454
+ kty: e.kty,
3455
+ n: e.n,
3456
+ e: e.e
3457
+ }),
3458
+ imported: {
3459
+ name: "RSASSA-PKCS1-v1_5",
3460
+ hash: "SHA-256"
3461
+ },
3462
+ signature: { name: "RSASSA-PKCS1-v1_5" }
3463
+ }
3464
+ }, or = (e) => {
3465
+ let t = e.replace(/-/g, "+").replace(/_/g, "/"), n = globalThis.atob(t + "=".repeat((4 - t.length % 4) % 4));
3466
+ return Uint8Array.from(n, (e) => e.charCodeAt(0));
3467
+ }, sr = () => {
3468
+ let e = globalThis.crypto;
3469
+ if (!e?.subtle) throw Error("Verifying tokens needs the Web Crypto API, available only in a secure context (https or localhost)");
3470
+ return e;
3471
+ };
3472
+ async function cr(e, t, n, r, i) {
3473
+ let [a = "", o = "", s = ""] = e.split("."), c = JSON.parse(new TextDecoder().decode(or(a))), l = c.alg === "ES256" || c.alg === "RS256" ? ar[c.alg] : void 0;
3474
+ if (!l) throw Error(`Token signing algorithm ${String(c.alg)} is not accepted`);
3475
+ let u = t.find((e) => e.kid === c.kid && e.kty === l.kty && (e.kty !== "EC" || e.crv === "P-256"));
3476
+ if (!u) throw Error("Token signing key is not published by the server");
3477
+ let d = sr().subtle, f = await d.importKey("jwk", l.key(u), l.imported, !1, ["verify"]), p = new TextEncoder().encode(`${a}.${o}`);
3478
+ if (!await d.verify(l.signature, f, or(s), p)) throw Error("Token signature is not valid");
3479
+ let m = A(e), h = Array.isArray(m.aud) ? m.aud : [m.aud];
3480
+ if (m.iss !== n) throw Error("Token issuer does not match the server");
3481
+ if (!h.includes(r)) throw Error("Token is not issued for this app");
3482
+ if (typeof m.exp != "number" || k(m, 0)) throw Error("Token has expired");
3483
+ if (i && m.type !== i) throw Error("Token type is not valid");
3484
+ }
3485
+ async function lr(t, n, r) {
3486
+ if (!n) throw Error("An app id is required to accept tokens from the URL");
3487
+ if (!r.access_token) throw Error("No access token received");
3488
+ sr();
3489
+ let i = t.replace(/\/+$/, ""), [a, o] = await Promise.all([e.get(`${i}/.well-known/openid-configuration`), e.get(`${i}/.well-known/jwks.json`)]), s = a.data?.issuer, c = o.data?.keys ?? [];
3490
+ if (!s) throw Error("The server did not publish an issuer");
3491
+ await cr(r.access_token, c, s, n, j.access_token), r.refresh_token && await cr(r.refresh_token, c, s, n, j.refresh_token), r.id_token && await cr(r.id_token, c, s, n);
3492
+ }
3493
+ // lib/upgrade/errors.ts
3494
+ var Q = {
3434
3495
  twoFactorCodeInvalid: "error.api.request.2fa_code.invalid",
3435
3496
  challengeInvalid: "error.upgrade.challenge_invalid",
3436
3497
  challengeSessionMismatch: "error.upgrade.challenge_session_mismatch",
@@ -3444,18 +3505,18 @@ var Z = /* @__PURE__ */ function(e) {
3444
3505
  twoFactorNotEnabled: "error.2fa.not_enabled",
3445
3506
  notImplemented: "error.not.implemented",
3446
3507
  tokenInvalid: "error.api.request.token.invalid"
3447
- }, ar = Object.freeze([
3508
+ }, ur = Object.freeze([
3448
3509
  Q.twoFactorCodeInvalid,
3449
3510
  Q.twoFactorNotEnabled,
3450
3511
  Q.challengeInvalid,
3451
3512
  Q.challengeSessionMismatch,
3452
3513
  Q.challengeTooManyAttempts
3453
- ]), or = Object.freeze([Q.tokenInvalid]), sr = Object.freeze([
3514
+ ]), dr = Object.freeze([Q.tokenInvalid]), fr = Object.freeze([
3454
3515
  "wrong_code",
3455
3516
  "challenge_spent",
3456
3517
  "not_registered",
3457
3518
  "prepare_not_required"
3458
- ]), cr = (e) => sr.includes(e), lr = {
3519
+ ]), pr = (e) => fr.includes(e), mr = {
3459
3520
  wrong_code: "That code was not accepted. Try again.",
3460
3521
  challenge_spent: "That verification challenge is no longer valid. Start again.",
3461
3522
  exhausted: "Too many attempts. Try again later.",
@@ -3469,16 +3530,16 @@ var Z = /* @__PURE__ */ function(e) {
3469
3530
  session_changed: "The session ended during verification."
3470
3531
  }, $ = class extends Error {
3471
3532
  constructor(e) {
3472
- super(e.message || lr[e.kind]), this.name = "UpgradeTransportError", this.code = "upgrade_transport", this.kind = e.kind, this.status = e.status, this.errorId = e.errorId, this.retryable = cr(e.kind), e.cause !== void 0 && (this.cause = e.cause);
3533
+ super(e.message || mr[e.kind]), this.name = "UpgradeTransportError", this.code = "upgrade_transport", this.kind = e.kind, this.status = e.status, this.errorId = e.errorId, this.retryable = pr(e.kind), e.cause !== void 0 && (this.cause = e.cause);
3473
3534
  }
3474
- }, ur = Object.freeze([
3535
+ }, hr = Object.freeze([
3475
3536
  "upgrade_transport",
3476
3537
  "upgrade_insufficient",
3477
3538
  "upgrade_unavailable",
3478
3539
  "upgrade_session_changed",
3479
3540
  "upgrade_cancelled",
3480
3541
  "upgrade_unsatisfiable"
3481
- ]), dr = (e) => typeof e == "object" && !!e && typeof e.code == "string" && ur.includes(e.code), fr = (e) => e instanceof $ || typeof e == "object" && !!e && e.code === "upgrade_transport", pr = (e) => {
3542
+ ]), gr = (e) => typeof e == "object" && !!e && typeof e.code == "string" && hr.includes(e.code), _r = (e) => e instanceof $ || typeof e == "object" && !!e && e.code === "upgrade_transport", vr = (e) => {
3482
3543
  if (typeof e != "object" || !e) return {
3483
3544
  hasResponse: !1,
3484
3545
  message: typeof e == "string" ? e : void 0
@@ -3490,7 +3551,7 @@ var Z = /* @__PURE__ */ function(e) {
3490
3551
  message: typeof t.message == "string" ? t.message : void 0,
3491
3552
  hasResponse: n !== void 0 || typeof t.status == "number"
3492
3553
  };
3493
- }, mr = (e, t) => {
3554
+ }, yr = (e, t) => {
3494
3555
  switch (e) {
3495
3556
  case Q.twoFactorCodeInvalid: return "wrong_code";
3496
3557
  case Q.challengeInvalid:
@@ -3507,11 +3568,11 @@ var Z = /* @__PURE__ */ function(e) {
3507
3568
  case Q.tokenInvalid: return t === "refresh" ? "session_changed" : "fatal";
3508
3569
  default: return;
3509
3570
  }
3510
- }, hr = (e, t) => e === void 0 ? "network" : e === 501 ? "unavailable" : e === 400 ? "fatal" : e === 401 || e === 403 ? t === "start" ? "challenge_spent" : "session_changed" : e >= 500 ? "network" : "fatal", gr = (e, t) => {
3571
+ }, br = (e, t) => e === void 0 ? "network" : e === 501 ? "unavailable" : e === 400 ? "fatal" : e === 401 || e === 403 ? t === "start" ? "challenge_spent" : "session_changed" : e >= 500 ? "network" : "fatal", xr = (e, t) => {
3511
3572
  if (e instanceof $) return e;
3512
- let n = pr(e);
3573
+ let n = vr(e);
3513
3574
  return n.hasResponse ? new $({
3514
- kind: mr(n.errorId, t) ?? hr(n.status, t),
3575
+ kind: yr(n.errorId, t) ?? br(n.status, t),
3515
3576
  message: n.message,
3516
3577
  status: n.status,
3517
3578
  errorId: n.errorId,
@@ -3521,60 +3582,60 @@ var Z = /* @__PURE__ */ function(e) {
3521
3582
  message: n.message,
3522
3583
  cause: e
3523
3584
  });
3524
- }, _r = (e) => e.errorId !== void 0 && ar.includes(e.errorId), vr = (e) => e.errorId !== void 0 && or.includes(e.errorId), yr = class extends Error {
3585
+ }, Sr = (e) => e.errorId !== void 0 && ur.includes(e.errorId), Cr = (e) => e.errorId !== void 0 && dr.includes(e.errorId), wr = class extends Error {
3525
3586
  constructor(e, t, n) {
3526
3587
  super(n ?? "The session was elevated, but this action requires a higher assurance level"), this.name = "UpgradeInsufficientError", this.code = "upgrade_insufficient", this.obtained = e, this.required = t;
3527
3588
  }
3528
- }, br = class extends Error {
3589
+ }, Tr = class extends Error {
3529
3590
  constructor(e = "Step-up verification is not available on this deployment") {
3530
3591
  super(e), this.name = "UpgradeUnavailableError", this.code = "upgrade_unavailable";
3531
3592
  }
3532
- }, xr = class extends Error {
3593
+ }, Er = class extends Error {
3533
3594
  constructor(e = "The session changed during verification") {
3534
3595
  super(e), this.name = "UpgradeSessionChangedError", this.code = "upgrade_session_changed";
3535
3596
  }
3536
- }, Sr = (e) => {
3597
+ }, Dr = (e) => {
3537
3598
  if (e && typeof e.sub == "string" && e.sub !== "") return typeof e.sid == "string" && e.sid !== "" ? {
3538
3599
  sub: e.sub,
3539
3600
  sid: e.sid
3540
3601
  } : { sub: e.sub };
3541
- }, Cr = (e, t) => !t || t.sub !== e.sub ? !1 : e.sid !== void 0 && t.sid !== void 0 ? e.sid === t.sid : !0;
3602
+ }, Or = (e, t) => !t || t.sub !== e.sub ? !1 : e.sid !== void 0 && t.sid !== void 0 ? e.sid === t.sid : !0;
3542
3603
  // lib/utils/validation.ts
3543
- function wr(e) {
3604
+ function kr(e) {
3544
3605
  if (!e || typeof e != "string") return !1;
3545
3606
  let t = e.split(".");
3546
3607
  if (t.length !== 3) return !1;
3547
3608
  let n = /^[A-Za-z0-9_-]+$/;
3548
3609
  return t.every((e) => n.test(e) && e.length > 0);
3549
3610
  }
3550
- function Tr(e) {
3611
+ function Ar(e) {
3551
3612
  return e.replace(/<[^>]*>/g, "").substring(0, 200);
3552
3613
  }
3553
- function Er(e) {
3614
+ function jr(e) {
3554
3615
  if (!e || typeof e != "string") return !1;
3555
3616
  let t = e.trim();
3556
3617
  return t.length !== 0 && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t);
3557
3618
  }
3558
- function Dr(e) {
3619
+ function Mr(e) {
3559
3620
  if (!e || typeof e != "string") return !1;
3560
3621
  let t = e.trim();
3561
3622
  return /^\+[1-9]\d{1,14}$/.test(t);
3562
3623
  }
3563
- function Or(e) {
3624
+ function Nr(e) {
3564
3625
  if (!e || typeof e != "string") return !1;
3565
3626
  let t = e.trim();
3566
3627
  return t.length < 3 || t.length > 30 ? !1 : /^[a-zA-Z0-9_-]+$/.test(t);
3567
3628
  }
3568
- function kr(e, t = 6) {
3629
+ function Pr(e, t = 6) {
3569
3630
  return !e || typeof e != "string" ? !1 : (t === 8 ? /^\d{8}$/ : /^\d{6}$/).test(e);
3570
3631
  }
3571
- function Ar(e) {
3632
+ function Fr(e) {
3572
3633
  if (!e || typeof e != "string") return null;
3573
3634
  let t = e.toUpperCase().replace(/\s+/g, "");
3574
3635
  return /^[A-Z0-9-]{4,16}$/.test(t) ? t : null;
3575
3636
  }
3576
3637
  // lib/services/auth-service.ts
3577
- var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3, Fr = "passflow_federated_pkce", Ir = 6e5, Lr = "AppId is required for federated auth", Rr = 10, zr = "The sign-in answered with a PKCE code, but its verifier is gone", Br = (e, t) => new Promise((n, r) => {
3638
+ var Ir = "passflow_2fa_pkce", Lr = 3e5, Rr = "passflow_pwless_pending", zr = 3e3, Br = "passflow_federated_pkce", Vr = 6e5, Hr = "AppId is required for federated auth", Ur = 10, Wr = "The sign-in answered with a PKCE code, but its verifier is gone", Gr = (e, t) => new Promise((n, r) => {
3578
3639
  if (t?.aborted) {
3579
3640
  r(t.reason);
3580
3641
  return;
@@ -3585,19 +3646,19 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3585
3646
  t?.removeEventListener("abort", i), n();
3586
3647
  }, e);
3587
3648
  t?.addEventListener("abort", i, { once: !0 });
3588
- }), Vr = (e) => {
3649
+ }), Kr = (e) => {
3589
3650
  if (!e) return;
3590
3651
  let t = new URLSearchParams(e.search).get("token");
3591
3652
  if (t) return t;
3592
3653
  let n = e.hash.indexOf("?");
3593
3654
  return n < 0 ? void 0 : new URLSearchParams(e.hash.slice(n + 1)).get("token") ?? void 0;
3594
- }, Hr = (e) => {
3655
+ }, qr = (e) => {
3595
3656
  if (e) try {
3596
3657
  return A(e).email;
3597
3658
  } catch {
3598
3659
  return;
3599
3660
  }
3600
- }, Ur = class {
3661
+ }, Jr = class {
3601
3662
  constructor(e, t, n, r, i, a, o, s, c, l, u, d = P, f, p = { coordination: _n() }) {
3602
3663
  this.authApi = e, this.deviceService = t, this.storageManager = n, this.subscribeStore = r, this.tokenCacheService = i, this.scopes = a, this.createTenantForNewUser = o, this.url = s, this.sessionCallbacks = c, this.appId = l, this.platform = d, this.readPkceEnabled = f, this.emailChallenges = /* @__PURE__ */ new Map(), this.tokenExchangeConfig = u, this.tokenDeliveryManager = new ne(n), u?.enabled && this.tokenDeliveryManager.setMode(M.BFF), this.refresh = rr({
3603
3664
  emit: this.createRefreshEmit(),
@@ -3662,7 +3723,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3662
3723
  rememberEmailChallenge(e, t) {
3663
3724
  this.emailChallenges.delete(e), this.emailChallenges.set(e, t);
3664
3725
  for (let e of this.emailChallenges.keys()) {
3665
- if (this.emailChallenges.size <= Rr) break;
3726
+ if (this.emailChallenges.size <= Ur) break;
3666
3727
  this.emailChallenges.delete(e);
3667
3728
  }
3668
3729
  }
@@ -3670,14 +3731,14 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3670
3731
  if (this.pendingPkce = {
3671
3732
  verifier: e,
3672
3733
  scopes: t,
3673
- expiresAt: Date.now() + Mr
3734
+ expiresAt: Date.now() + Lr
3674
3735
  }, typeof sessionStorage < "u") try {
3675
- sessionStorage.setItem(jr, JSON.stringify(this.pendingPkce));
3736
+ sessionStorage.setItem(Ir, JSON.stringify(this.pendingPkce));
3676
3737
  } catch {}
3677
3738
  }
3678
3739
  readPendingPkce() {
3679
3740
  if (!this.pendingPkce && typeof sessionStorage < "u") try {
3680
- let e = sessionStorage.getItem(jr);
3741
+ let e = sessionStorage.getItem(Ir);
3681
3742
  this.pendingPkce = e ? JSON.parse(e) : void 0;
3682
3743
  } catch {
3683
3744
  this.pendingPkce = void 0;
@@ -3689,17 +3750,17 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3689
3750
  }
3690
3751
  forgetPkceSignIn() {
3691
3752
  if (this.pendingPkce = void 0, typeof sessionStorage < "u") try {
3692
- sessionStorage.removeItem(jr);
3753
+ sessionStorage.removeItem(Ir);
3693
3754
  } catch {}
3694
3755
  }
3695
3756
  rememberPendingPasswordless(e) {
3696
3757
  if (this.pendingPasswordless = e, typeof sessionStorage < "u") try {
3697
- sessionStorage.setItem(Nr, JSON.stringify(e));
3758
+ sessionStorage.setItem(Rr, JSON.stringify(e));
3698
3759
  } catch {}
3699
3760
  }
3700
3761
  readPendingPasswordless() {
3701
3762
  if (!this.pendingPasswordless && typeof sessionStorage < "u") try {
3702
- let e = sessionStorage.getItem(Nr);
3763
+ let e = sessionStorage.getItem(Rr);
3703
3764
  this.pendingPasswordless = e ? JSON.parse(e) : void 0;
3704
3765
  } catch {
3705
3766
  this.pendingPasswordless = void 0;
@@ -3708,21 +3769,21 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3708
3769
  }
3709
3770
  forgetPendingPasswordless() {
3710
3771
  if (this.pendingPasswordless = void 0, typeof sessionStorage < "u") try {
3711
- sessionStorage.removeItem(Nr);
3772
+ sessionStorage.removeItem(Rr);
3712
3773
  } catch {}
3713
3774
  }
3714
3775
  rememberFederatedSlot(e, t) {
3715
3776
  if (this.federatedSlot = {
3716
3777
  verifier: e,
3717
3778
  scopes: t,
3718
- expiresAt: Date.now() + Ir
3779
+ expiresAt: Date.now() + Vr
3719
3780
  }, typeof sessionStorage < "u") try {
3720
- sessionStorage.setItem(Fr, JSON.stringify(this.federatedSlot));
3781
+ sessionStorage.setItem(Br, JSON.stringify(this.federatedSlot));
3721
3782
  } catch {}
3722
3783
  }
3723
3784
  readFederatedSlot() {
3724
3785
  if (!this.federatedSlot && typeof sessionStorage < "u") try {
3725
- let e = sessionStorage.getItem(Fr);
3786
+ let e = sessionStorage.getItem(Br);
3726
3787
  this.federatedSlot = e ? JSON.parse(e) : void 0;
3727
3788
  } catch {
3728
3789
  this.federatedSlot = void 0;
@@ -3731,7 +3792,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3731
3792
  }
3732
3793
  forgetFederatedSlot() {
3733
3794
  if (this.federatedSlot = void 0, typeof sessionStorage < "u") try {
3734
- sessionStorage.removeItem(Fr);
3795
+ sessionStorage.removeItem(Br);
3735
3796
  } catch {}
3736
3797
  }
3737
3798
  async startPkce() {
@@ -3749,7 +3810,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3749
3810
  }
3750
3811
  async completePkceSignIn(e) {
3751
3812
  let t = this.readPendingPkce();
3752
- if (!t) throw Error(zr);
3813
+ if (!t) throw Error(Wr);
3753
3814
  let n = await this.authApi.pkceExchange(e, t.verifier);
3754
3815
  return await this.processAuthResponse(n, t.scopes ?? this.scopes), n;
3755
3816
  }
@@ -3773,7 +3834,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3773
3834
  if (!t.ok) throw Error(`BFF token storage failed: ${t.status}`);
3774
3835
  }
3775
3836
  async signIn(e) {
3776
- if ("email" in e && e.email && !Er(e.email)) {
3837
+ if ("email" in e && e.email && !jr(e.email)) {
3777
3838
  let e = /* @__PURE__ */ Error("Invalid email format"), t = {
3778
3839
  operation: "sign-in",
3779
3840
  message: "Invalid email format",
@@ -3782,7 +3843,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3782
3843
  };
3783
3844
  throw U(this.subscribeStore, t), e;
3784
3845
  }
3785
- if ("username" in e && e.username && !Or(e.username)) {
3846
+ if ("username" in e && e.username && !Nr(e.username)) {
3786
3847
  let e = /* @__PURE__ */ Error("Invalid username format. Username must be 3-30 characters and contain only letters, numbers, underscores, and hyphens"), t = {
3787
3848
  operation: "sign-in",
3788
3849
  message: "Invalid username format. Username must be 3-30 characters and contain only letters, numbers, underscores, and hyphens",
@@ -3791,7 +3852,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3791
3852
  };
3792
3853
  throw U(this.subscribeStore, t), e;
3793
3854
  }
3794
- if ("phone" in e && e.phone && !Dr(e.phone)) {
3855
+ if ("phone" in e && e.phone && !Mr(e.phone)) {
3795
3856
  let e = /* @__PURE__ */ Error("Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)"), t = {
3796
3857
  operation: "sign-in",
3797
3858
  message: "Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)",
@@ -3825,7 +3886,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3825
3886
  }
3826
3887
  }
3827
3888
  async signUp(e) {
3828
- if (e.user.email && !Er(e.user.email)) {
3889
+ if (e.user.email && !jr(e.user.email)) {
3829
3890
  let e = /* @__PURE__ */ Error("Invalid email format"), t = {
3830
3891
  operation: "sign-up",
3831
3892
  message: "Invalid email format",
@@ -3834,7 +3895,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3834
3895
  };
3835
3896
  throw U(this.subscribeStore, t), e;
3836
3897
  }
3837
- if (e.user.phone_number && !Dr(e.user.phone_number)) {
3898
+ if (e.user.phone_number && !Mr(e.user.phone_number)) {
3838
3899
  let e = /* @__PURE__ */ Error("Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)"), t = {
3839
3900
  operation: "sign-up",
3840
3901
  message: "Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)",
@@ -3866,7 +3927,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3866
3927
  }
3867
3928
  }
3868
3929
  async passwordlessSignIn(e) {
3869
- if (e.email && !Er(e.email)) {
3930
+ if (e.email && !jr(e.email)) {
3870
3931
  let e = /* @__PURE__ */ Error("Invalid email format"), t = {
3871
3932
  operation: "passwordless.start",
3872
3933
  message: "Invalid email format",
@@ -3875,7 +3936,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3875
3936
  };
3876
3937
  throw U(this.subscribeStore, t), e;
3877
3938
  }
3878
- if (e.phone && !Dr(e.phone)) {
3939
+ if (e.phone && !Mr(e.phone)) {
3879
3940
  let e = /* @__PURE__ */ Error("Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)"), t = {
3880
3941
  operation: "passwordless.start",
3881
3942
  message: "Invalid phone number format. Phone must be in E.164 format (e.g., +12345678901)",
@@ -3919,7 +3980,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3919
3980
  if (r = !0, this.handlePendingSecondFactor(t, n?.email, n && { verifier: n.verifier }, n?.scopes)) return this.forgetPendingPasswordless(), t;
3920
3981
  let i = t;
3921
3982
  if (t.code) {
3922
- if (!n) throw Error(zr);
3983
+ if (!n) throw Error(Wr);
3923
3984
  if (i = await this.authApi.pkceExchange(t.code, n.verifier), this.handlePendingSecondFactor(i)) return this.forgetPendingPasswordless(), {
3924
3985
  ...i,
3925
3986
  redirect_url: t.redirect_url ?? ""
@@ -3951,11 +4012,11 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3951
4012
  let n = t?.signal;
3952
4013
  try {
3953
4014
  let t = this.readPendingPasswordless();
3954
- if (t?.challengeId !== e) throw Error(zr);
4015
+ if (t?.challengeId !== e) throw Error(Wr);
3955
4016
  for (;;) {
3956
4017
  if (n?.aborted) throw n.reason;
3957
4018
  if (Date.now() >= t.expiresAt) return this.forgetPendingPasswordless(), { status: "expired" };
3958
- if (this.readPendingPasswordless()?.challengeId !== e) throw Error(zr);
4019
+ if (this.readPendingPasswordless()?.challengeId !== e) throw Error(Wr);
3959
4020
  let r;
3960
4021
  try {
3961
4022
  r = await this.authApi.passwordlessStatus({
@@ -3968,7 +4029,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
3968
4029
  }
3969
4030
  if (r?.status === "denied" || r?.status === "expired" || r?.status === "completed") return this.forgetPendingPasswordless(), { status: r.status };
3970
4031
  if (r?.status === "approved" && r.code) return await this.finishApprovedPasswordless(r.code, t);
3971
- await Br(Pr, n);
4032
+ await Gr(zr, n);
3972
4033
  }
3973
4034
  } catch (e) {
3974
4035
  if (n?.aborted && e === n.reason) throw e;
@@ -4037,14 +4098,14 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4037
4098
  let t = this.emailChallenges.get(e.challenge_id), n = t?.email;
4038
4099
  try {
4039
4100
  let r = t?.pkce === !1 ? void 0 : this.readPendingPkce();
4040
- if (t?.pkce && !r) throw Error(zr);
4101
+ if (t?.pkce && !r) throw Error(Wr);
4041
4102
  let i = await this.authApi.validateEmailCode(e);
4042
4103
  this.emailChallenges.delete(e.challenge_id);
4043
4104
  let a = r?.scopes ?? t?.scopes ?? this.scopes;
4044
4105
  if (this.handleEmailVerificationStep(i, t?.operation ?? "sign-in", n, r, a) || this.handlePendingSecondFactor(i, n, r, a)) return i;
4045
4106
  let o = i;
4046
4107
  if (i.code) {
4047
- if (!r) throw Error(zr);
4108
+ if (!r) throw Error(Wr);
4048
4109
  if (o = await this.authApi.pkceExchange(i.code, r.verifier), this.handlePendingSecondFactor(o, n)) return o;
4049
4110
  }
4050
4111
  let s = i.redirect_url ? {
@@ -4098,13 +4159,13 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4098
4159
  readSessionPin() {
4099
4160
  try {
4100
4161
  let e = this.storageManager.getToken(j.access_token);
4101
- return e ? Sr(A(e)) : void 0;
4162
+ return e ? Dr(A(e)) : void 0;
4102
4163
  } catch {
4103
4164
  return;
4104
4165
  }
4105
4166
  }
4106
4167
  assertSessionPin(e) {
4107
- if (e && !Cr(e, this.readSessionPin())) throw console.warn("[passflow] the session or user changed while a step-up upgrade was in flight; the elevated tokens were discarded and the live session was left untouched."), new xr("The session changed during verification, so the elevated tokens were discarded");
4168
+ if (e && !Or(e, this.readSessionPin())) throw console.warn("[passflow] the session or user changed while a step-up upgrade was in flight; the elevated tokens were discarded and the live session was left untouched."), new Er("The session changed during verification, so the elevated tokens were discarded");
4108
4169
  }
4109
4170
  refreshMode() {
4110
4171
  return this.tokenDeliveryManager.isBFFMode() && this.tokenExchangeConfig?.refreshUrl ? "bff" : this.tokenDeliveryManager.isCookieMode() ? "cookie" : "json";
@@ -4238,10 +4299,10 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4238
4299
  }
4239
4300
  async resetPassword(e, t, n) {
4240
4301
  this.subscribeStore.notify(Z.SignInStart, {});
4241
- let r = n ?? Vr(this.platform.getCurrentUrl()), i = t ?? this.scopes;
4302
+ let r = n ?? Kr(this.platform.getCurrentUrl()), i = t ?? this.scopes;
4242
4303
  try {
4243
4304
  let t = await this.startPkce(), n = t ? await this.authApi.resetPassword(e, i, r, t.challenge) : await this.authApi.resetPassword(e, i, r);
4244
- if (this.handleEmailVerificationStep(n, "reset-password", Hr(r), t, i) || this.handlePendingSecondFactor(n, void 0, t, i)) return n;
4305
+ if (this.handleEmailVerificationStep(n, "reset-password", qr(r), t, i) || this.handlePendingSecondFactor(n, void 0, t, i)) return n;
4245
4306
  let a = await this.exchangeCode(n, t);
4246
4307
  if (this.handlePendingSecondFactor(a)) return a;
4247
4308
  let o = n.redirect_url ? {
@@ -4322,7 +4383,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4322
4383
  }
4323
4384
  createFederatedAuthUrl(e) {
4324
4385
  let t = `/auth/federated/start/${e.provider}`;
4325
- if (!this.appId) throw Error(Lr);
4386
+ if (!this.appId) throw Error(Hr);
4326
4387
  let n = {
4327
4388
  scopes: (e.scopes ?? this.scopes).join(" "),
4328
4389
  redirect_url: e.redirect_url ?? this.platform.getCurrentUrl()?.origin ?? "",
@@ -4336,7 +4397,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4336
4397
  return r.search = new URLSearchParams(n).toString(), r.toString();
4337
4398
  }
4338
4399
  async federatedAuthWithPopup(e) {
4339
- if (this.subscribeStore.notify(Z.SignInStart, { provider: e.provider }), !this.appId) throw Error(Lr);
4400
+ if (this.subscribeStore.notify(Z.SignInStart, { provider: e.provider }), !this.appId) throw Error(Hr);
4340
4401
  let t = e.scopes ?? this.scopes, n = this.deviceService.getDeviceId();
4341
4402
  try {
4342
4403
  this.forgetFederatedSlot();
@@ -4363,7 +4424,9 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4363
4424
  id_token: f || void 0,
4364
4425
  scopes: t
4365
4426
  };
4366
- if (l && r && (p = await this.authApi.pkceExchange(l, r.verifier), this.handlePendingSecondFactor(p))) return;
4427
+ if (l && r) {
4428
+ if (p = await this.authApi.pkceExchange(l, r.verifier), this.handlePendingSecondFactor(p)) return;
4429
+ } else await lr(this.url, this.appId, p);
4367
4430
  await this.processAuthResponse(p, t), this.subscribeStore.notify(Z.SignIn, {
4368
4431
  tokens: p,
4369
4432
  parsedTokens: this.tokenCacheService.getParsedTokens()
@@ -4380,7 +4443,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4380
4443
  }
4381
4444
  }
4382
4445
  federatedAuthWithRedirect(e) {
4383
- if (this.subscribeStore.notify(Z.SignInStart, { provider: e.provider }), !this.appId) throw Error(Lr);
4446
+ if (this.subscribeStore.notify(Z.SignInStart, { provider: e.provider }), !this.appId) throw Error(Hr);
4384
4447
  let t = e.scopes ?? this.scopes, n = this.deviceService.getDeviceId();
4385
4448
  this.startPkce().then((r) => {
4386
4449
  let i = this.createFederatedAuthUrl({
@@ -4510,7 +4573,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4510
4573
  return;
4511
4574
  }
4512
4575
  }
4513
- }, Wr = class {
4576
+ }, Yr = class {
4514
4577
  constructor(e) {
4515
4578
  this.invitationApi = e;
4516
4579
  }
@@ -4529,7 +4592,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4529
4592
  getInvitationLink(e) {
4530
4593
  return this.invitationApi.getInvitationLink(e);
4531
4594
  }
4532
- }, Gr = class {
4595
+ }, Xr = class {
4533
4596
  constructor(e) {
4534
4597
  this.data = this.normalize(e);
4535
4598
  }
@@ -4586,7 +4649,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4586
4649
  getData() {
4587
4650
  return this.data;
4588
4651
  }
4589
- }, Kr = class {
4652
+ }, Zr = class {
4590
4653
  constructor(e, t, n) {
4591
4654
  this.tenantApi = e, this.scopes = t, this.logger = n || En();
4592
4655
  }
@@ -4624,7 +4687,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4624
4687
  }
4625
4688
  async getTenantUserMembership(e) {
4626
4689
  try {
4627
- return new Gr(await this.tenantApi.getTenantDetails(e));
4690
+ return new Xr(await this.tenantApi.getTenantDetails(e));
4628
4691
  } catch (t) {
4629
4692
  this.handlePassflowError(t, `Get tenant user membership failed for tenant ID ${e}`);
4630
4693
  }
@@ -4769,7 +4832,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4769
4832
  this.handlePassflowError(r, `Invalidate invite by email failed for tenant ID ${e}, group ID ${t}, email ${n}`);
4770
4833
  }
4771
4834
  }
4772
- }, qr = class {
4835
+ }, Qr = class {
4773
4836
  constructor(e, t, n, r = P) {
4774
4837
  this.storageManager = e, this.subscribeStore = n, this.platform = r, this.checkInterval = null, this.CHECK_INTERVAL = 6e4, this.unsubscribeForeground = null, this.unsubscribeUnload = null, this.tokenExpiredFlag = !1, this.storageManager = e, this.setupLifecycleListeners();
4775
4838
  }
@@ -4849,7 +4912,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4849
4912
  isExpired() {
4850
4913
  return this.tokensCache ? this.tokensCache.access_token ? k(A(this.tokensCache.access_token)) : !1 : !0;
4851
4914
  }
4852
- }, Jr = class {
4915
+ }, $r = class {
4853
4916
  constructor(e, t, n) {
4854
4917
  this.twoFactorApi = e, this.subscribeStore = t, this.signInCompleter = n, this.PARTIAL_AUTH_TIMEOUT_MS = 3e5, this.SESSION_STORAGE_KEY = "passflow_2fa_challenge", this.totpDigits = 6, this.subscribeStore.subscribe({ onAuthChange: (e, t) => {
4855
4918
  if (e === Z.TwoFactorRequired) {
@@ -4926,7 +4989,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4926
4989
  }
4927
4990
  }
4928
4991
  assertTotpCode(e) {
4929
- if (!kr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
4992
+ if (!Pr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
4930
4993
  }
4931
4994
  requirePendingTfaToken() {
4932
4995
  let e = this.pendingTfaToken();
@@ -4945,7 +5008,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4945
5008
  }), e;
4946
5009
  }
4947
5010
  async verify(e, t) {
4948
- if (!kr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
5011
+ if (!Pr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
4949
5012
  if (this.recoverPartialAuthState(), !this.isVerificationRequired()) throw Error("2FA verification expired or not required. User must sign in first.");
4950
5013
  if (!this.partialAuthState?.tfaToken) throw Error("No TFA token found. User must sign in first.");
4951
5014
  try {
@@ -4961,7 +5024,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4961
5024
  }
4962
5025
  async useRecoveryCode(e, t) {
4963
5026
  try {
4964
- let n = Ar(e);
5027
+ let n = Fr(e);
4965
5028
  if (!n) throw Error("Invalid recovery code format. Expected format: XXXX-XXXX or XXXXXXXX (alphanumeric).");
4966
5029
  if (this.recoverPartialAuthState(), !this.isVerificationRequired()) throw Error("2FA verification expired or not required. User must sign in first.");
4967
5030
  if (!this.partialAuthState?.tfaToken) throw Error("No TFA token found. User must sign in first.");
@@ -4982,7 +5045,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4982
5045
  }
4983
5046
  }
4984
5047
  async disable(e) {
4985
- if (!kr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
5048
+ if (!Pr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
4986
5049
  try {
4987
5050
  let t = await this.twoFactorApi.disable({ code: e });
4988
5051
  return this.subscribeStore.notify(Z.TwoFactorDisabled, {}), t;
@@ -4991,7 +5054,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
4991
5054
  }
4992
5055
  }
4993
5056
  async regenerateRecoveryCodes(e) {
4994
- if (!kr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
5057
+ if (!Pr(e, this.totpDigits)) throw Error(`Invalid TOTP code format. Code must be exactly ${this.totpDigits} digits.`);
4995
5058
  try {
4996
5059
  let t = await this.twoFactorApi.regenerateRecoveryCodes({ code: e }), n = [...t.recovery_codes];
4997
5060
  return t.recovery_codes = [], t.recovery_codes = n, t;
@@ -5175,7 +5238,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5175
5238
  this.emitErrorAndThrow(e, "2fa.trusted-devices.revoke", "Revoke trusted device");
5176
5239
  }
5177
5240
  }
5178
- }, Yr = class {
5241
+ }, ei = class {
5179
5242
  constructor(e, t, n = P) {
5180
5243
  this.userAPI = e, this.deviceService = t, this.platform = n;
5181
5244
  }
@@ -5202,69 +5265,69 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5202
5265
  if (!s) throw Error("Passkey registration was not completed");
5203
5266
  return await this.userAPI.addUserPasskeyComplete(s, r, a);
5204
5267
  }
5205
- }, Xr = class extends Error {
5268
+ }, ti = class extends Error {
5206
5269
  constructor(e, t, n = !1) {
5207
5270
  super(t), this.name = "UpgradeFactorError", this.factor = e, this.cancelled = n;
5208
5271
  }
5209
- }, Zr = (e, t) => {
5272
+ }, ni = (e, t) => {
5210
5273
  let n = t?.trim();
5211
- if (!n) throw new Xr(e, "A verification code is required");
5274
+ if (!n) throw new ti(e, "A verification code is required");
5212
5275
  return n;
5213
- }, Qr = {
5276
+ }, ri = {
5214
5277
  type: "totp",
5215
5278
  requiresPrepare: !1,
5216
5279
  input: "code",
5217
- assert: async ({ code: e }) => ({ code: Zr("totp", e) })
5218
- }, $r = {
5280
+ assert: async ({ code: e }) => ({ code: ni("totp", e) })
5281
+ }, ii = {
5219
5282
  type: "recovery_codes",
5220
5283
  requiresPrepare: !1,
5221
5284
  input: "code",
5222
- assert: async ({ code: e }) => ({ code: Zr("recovery_codes", e) })
5223
- }, ei = {
5285
+ assert: async ({ code: e }) => ({ code: ni("recovery_codes", e) })
5286
+ }, ai = {
5224
5287
  type: "passkey",
5225
5288
  requiresPrepare: !0,
5226
5289
  input: "none",
5227
5290
  assert: async ({ prepared: e, platform: t }) => {
5228
- if (!e?.webauthn) throw new Xr("passkey", "The upgrade challenge carried no WebAuthn options");
5291
+ if (!e?.webauthn) throw new ti("passkey", "The upgrade challenge carried no WebAuthn options");
5229
5292
  let n = t.passkeys;
5230
- if (!n) throw new Xr("passkey", "This platform does not support passkeys");
5293
+ if (!n) throw new ti("passkey", "This platform does not support passkeys");
5231
5294
  let r;
5232
5295
  try {
5233
5296
  r = await n.startAuthentication(e.webauthn);
5234
5297
  } catch (e) {
5235
- throw new Xr("passkey", e?.message || "Passkey verification was cancelled", !0);
5298
+ throw new ti("passkey", e?.message || "Passkey verification was cancelled", !0);
5236
5299
  }
5237
- if (!r) throw new Xr("passkey", "Passkey verification was cancelled", !0);
5300
+ if (!r) throw new ti("passkey", "Passkey verification was cancelled", !0);
5238
5301
  return {
5239
5302
  challenge_id: e.challengeId,
5240
5303
  credential: r
5241
5304
  };
5242
5305
  }
5243
- }, ti = Object.freeze([
5244
- Qr,
5245
- ei,
5246
- $r
5247
- ]), ni = (e = ti) => new Map(e.map((e) => [e.type, e])), ri = 3, ii = {
5306
+ }, oi = Object.freeze([
5307
+ ri,
5308
+ ai,
5309
+ ii
5310
+ ]), si = (e = oi) => new Map(e.map((e) => [e.type, e])), ci = 3, li = {
5248
5311
  passkey: 0,
5249
5312
  totp: 1,
5250
5313
  email_otp: 2,
5251
5314
  sms_otp: 3,
5252
5315
  recovery_codes: 9
5253
- }, ai = (e) => e.requiredLevel ?? L(e.acrValues), oi = (e, t) => {
5254
- let n = ii[e.type] ?? 5, r = t !== void 0 && t >= ri, i = e.type === "passkey";
5316
+ }, ui = (e) => e.requiredLevel ?? L(e.acrValues), di = (e, t) => {
5317
+ let n = li[e.type] ?? 5, r = t !== void 0 && t >= ci, i = e.type === "passkey";
5255
5318
  return (r && !i ? 100 : 0) + n;
5256
- }, si = (e, t) => {
5257
- let n = ai(t);
5258
- return [...e].sort((e, t) => oi(e, n) - oi(t, n));
5259
- }, ci = class extends Error {
5319
+ }, fi = (e, t) => {
5320
+ let n = ui(t);
5321
+ return [...e].sort((e, t) => di(e, n) - di(t, n));
5322
+ }, pi = class extends Error {
5260
5323
  constructor(e) {
5261
5324
  super("Upgrade authentication was cancelled"), this.code = "upgrade_cancelled", this.name = "UpgradeCancelledError", e !== void 0 && (this.cause = e);
5262
5325
  }
5263
- }, li = class extends Error {
5326
+ }, mi = class extends Error {
5264
5327
  constructor(e = "No available authentication factor can satisfy this challenge") {
5265
5328
  super(e), this.code = "upgrade_unsatisfiable", this.name = "UpgradeUnsatisfiableError";
5266
5329
  }
5267
- }, ui = 4, di = 3e4, fi = () => {
5330
+ }, hi = 4, gi = 3e4, _i = () => {
5268
5331
  let e = () => void 0, t = () => void 0;
5269
5332
  return {
5270
5333
  promise: new Promise((n, r) => {
@@ -5273,11 +5336,11 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5273
5336
  resolve: e,
5274
5337
  reject: t
5275
5338
  };
5276
- }, pi = (e) => ({
5339
+ }, vi = (e) => ({
5277
5340
  acrValues: e.acrValues,
5278
5341
  level: e.requiredLevel,
5279
5342
  maxAge: e.maxAge
5280
- }), mi = (e, t) => t.level === void 0 || e.level !== void 0 && e.level >= t.level, hi = (e, t) => {
5343
+ }), yi = (e, t) => t.level === void 0 || e.level !== void 0 && e.level >= t.level, bi = (e, t) => {
5281
5344
  let n = e.requiredLevel === void 0 ? t.requiredLevel : t.requiredLevel === void 0 ? e.requiredLevel : Math.max(e.requiredLevel, t.requiredLevel), r = n === void 0 ? e.acrValues ?? t.acrValues : n === e.requiredLevel ? e.acrValues : t.acrValues, i = e.maxAge === void 0 ? t.maxAge : t.maxAge === void 0 ? e.maxAge : Math.min(e.maxAge, t.maxAge), a = Array.from(/* @__PURE__ */ new Set([...e.channels ?? [], ...t.channels ?? []]));
5282
5345
  return {
5283
5346
  acrValues: r,
@@ -5286,12 +5349,12 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5286
5349
  status: e.status,
5287
5350
  ...a.length > 0 ? { channels: a } : {}
5288
5351
  };
5289
- }, gi = (e, t) => {
5352
+ }, xi = (e, t) => {
5290
5353
  let n = t.requiredLevel !== void 0 && (e.requiredLevel === void 0 || t.requiredLevel > e.requiredLevel), r = t.maxAge !== void 0 && (e.maxAge === void 0 || t.maxAge < e.maxAge);
5291
5354
  return n || r;
5292
- }, _i = class {
5355
+ }, Si = class {
5293
5356
  constructor(e) {
5294
- this.state = "idle", this.inFlight = null, this.requirement = null, this.selected = null, this.rankedRequirement = null, this.registrations = [], this.proof = null, this.pruned = /* @__PURE__ */ new Set(), this.openPrompt = null, this.transport = e.transport, this.prompt = e.prompt, this.platform = e.platform, this.available = e.factors ?? ti, this.registry = ni(this.available), this.maxAttempts = e.maxAttempts ?? ui, this.readObtainedBar = e.readObtainedBar, this.onFlightSettled = e.onFlightSettled, this.settleTimeoutMs = e.replaySettleTimeoutMs ?? di;
5357
+ this.state = "idle", this.inFlight = null, this.requirement = null, this.selected = null, this.rankedRequirement = null, this.registrations = [], this.proof = null, this.pruned = /* @__PURE__ */ new Set(), this.openPrompt = null, this.transport = e.transport, this.prompt = e.prompt, this.platform = e.platform, this.available = e.factors ?? oi, this.registry = si(this.available), this.maxAttempts = e.maxAttempts ?? hi, this.readObtainedBar = e.readObtainedBar, this.onFlightSettled = e.onFlightSettled, this.settleTimeoutMs = e.replaySettleTimeoutMs ?? gi;
5295
5358
  }
5296
5359
  get currentState() {
5297
5360
  return this.state;
@@ -5311,9 +5374,9 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5311
5374
  }
5312
5375
  register(e, t) {
5313
5376
  let n = t.kind === "imperative" && t.requested !== void 0, r = {
5314
- demanded: t.kind === "imperative" && t.requested ? t.requested : pi(e),
5377
+ demanded: t.kind === "imperative" && t.requested ? t.requested : vi(e),
5315
5378
  statedBar: n,
5316
- settlement: fi(),
5379
+ settlement: _i(),
5317
5380
  reported: !1,
5318
5381
  entry: {
5319
5382
  ...t,
@@ -5329,15 +5392,15 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5329
5392
  this.requirement = e;
5330
5393
  return;
5331
5394
  }
5332
- let n = gi(t, e);
5333
- this.requirement = hi(t, e), n && this.state === "collecting" && this.selected === null && this.openPrompt?.onRequirementRaised?.({
5395
+ let n = xi(t, e);
5396
+ this.requirement = bi(t, e), n && this.state === "collecting" && this.selected === null && this.openPrompt?.onRequirementRaised?.({
5334
5397
  challenge: this.requirement,
5335
5398
  factors: this.offeredFactors()
5336
5399
  });
5337
5400
  }
5338
5401
  offeredFactors() {
5339
5402
  let e = this.available.filter((e) => !this.pruned.has(e.type)), t = this.requirement;
5340
- return t ? si(e, t) : e;
5403
+ return t ? fi(e, t) : e;
5341
5404
  }
5342
5405
  receiveReport(e, t) {
5343
5406
  e.reported || (e.reported = !0, e.entry.outcome = t.outcome, t.obtained && (e.entry.obtained = t.obtained), t.required && (e.entry.required = t.required), this.notifyReportsSettled());
@@ -5372,12 +5435,12 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5372
5435
  }
5373
5436
  release(e, t) {
5374
5437
  if (e.entry.kind === "imperative") {
5375
- if (e.statedBar && !mi(t, e.demanded)) {
5438
+ if (e.statedBar && !yi(t, e.demanded)) {
5376
5439
  this.receiveReport(e, {
5377
5440
  outcome: "insufficient",
5378
5441
  obtained: t,
5379
5442
  required: e.demanded
5380
- }), e.settlement.reject(new yr(t, e.demanded));
5443
+ }), e.settlement.reject(new wr(t, e.demanded));
5381
5444
  return;
5382
5445
  }
5383
5446
  this.receiveReport(e, {
@@ -5450,7 +5513,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5450
5513
  let t = this.offeredFactors();
5451
5514
  if (t.length === 0) return {
5452
5515
  status: "failed",
5453
- reason: new li()
5516
+ reason: new mi()
5454
5517
  };
5455
5518
  let n = this.requirement, r;
5456
5519
  try {
@@ -5458,24 +5521,24 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5458
5521
  } catch (e) {
5459
5522
  return {
5460
5523
  status: "failed",
5461
- reason: new ci(e)
5524
+ reason: new pi(e)
5462
5525
  };
5463
5526
  }
5464
5527
  if (r.type === "cancel") return {
5465
5528
  status: "failed",
5466
- reason: new ci()
5529
+ reason: new pi()
5467
5530
  };
5468
5531
  let i = this.registry.get(r.factor);
5469
- if (!i) e = new li(`Unknown authentication factor: ${r.factor}`), this.state = "collecting", this.selected = null;
5532
+ if (!i) e = new mi(`Unknown authentication factor: ${r.factor}`), this.state = "collecting", this.selected = null;
5470
5533
  else try {
5471
5534
  return await this.proveAndCommit(i, r.code), {
5472
5535
  status: "proven",
5473
- obtained: this.readObtainedBar?.() ?? pi(this.rankedRequirement ?? n)
5536
+ obtained: this.readObtainedBar?.() ?? vi(this.rankedRequirement ?? n)
5474
5537
  };
5475
5538
  } catch (t) {
5476
- if (t instanceof Xr && t.cancelled) return {
5539
+ if (t instanceof ti && t.cancelled) return {
5477
5540
  status: "failed",
5478
- reason: new ci()
5541
+ reason: new pi()
5479
5542
  };
5480
5543
  let n = this.classifyProofFailure(t);
5481
5544
  if (n) return {
@@ -5505,15 +5568,15 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5505
5568
  return this.openPrompt = r, this.prompt(r);
5506
5569
  }
5507
5570
  classifyProofFailure(e) {
5508
- if (e instanceof yr || e instanceof br || e instanceof xr) return e;
5571
+ if (e instanceof wr || e instanceof Tr || e instanceof Er) return e;
5509
5572
  if (e instanceof $) switch (e.kind) {
5510
- case "unavailable": return new br(e.message);
5573
+ case "unavailable": return new Tr(e.message);
5511
5574
  case "exhausted":
5512
5575
  case "attempts_exhausted":
5513
5576
  case "fatal":
5514
5577
  case "protocol":
5515
5578
  case "network": return e;
5516
- case "session_changed": return new xr(e.message);
5579
+ case "session_changed": return new Er(e.message);
5517
5580
  default: return;
5518
5581
  }
5519
5582
  }
@@ -5525,28 +5588,28 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5525
5588
  });
5526
5589
  await this.transport.commit(e.type, r);
5527
5590
  }
5528
- }, vi = (e) => typeof e == "function" ? e() : e, yi = (e) => {
5591
+ }, Ci = (e) => typeof e == "function" ? e() : e, wi = (e) => {
5529
5592
  try {
5530
5593
  return new URL(e);
5531
5594
  } catch {
5532
5595
  return;
5533
5596
  }
5534
- }, bi = (e, t) => {
5597
+ }, Ti = (e, t) => {
5535
5598
  if (!t || t === "/") return !0;
5536
5599
  let n = t.replace(/\/+$/, "");
5537
5600
  return e === n || e.startsWith(`${n}/`);
5538
- }, xi = (e, t) => !t || e.origin === void 0 ? !1 : e.origin === t.origin && bi(e.pathname, t.pathPrefix), Si = (e, t) => {
5601
+ }, Ei = (e, t) => !t || e.origin === void 0 ? !1 : e.origin === t.origin && Ti(e.pathname, t.pathPrefix), Di = (e, t) => {
5539
5602
  for (let n of t) {
5540
5603
  if (n === "") continue;
5541
5604
  if (n.startsWith("/")) {
5542
- if (e.relativeToBase && bi(e.pathname, n)) return !0;
5605
+ if (e.relativeToBase && Ti(e.pathname, n)) return !0;
5543
5606
  continue;
5544
5607
  }
5545
- let t = yi(n) ?? yi(`https://${n}`);
5546
- if (t && e.origin !== void 0 && e.origin === t.origin && bi(e.pathname, t.pathname)) return !0;
5608
+ let t = wi(n) ?? wi(`https://${n}`);
5609
+ if (t && e.origin !== void 0 && e.origin === t.origin && Ti(e.pathname, t.pathname)) return !0;
5547
5610
  }
5548
5611
  return !1;
5549
- }, Ci = (e, t, n) => xi(e, t.passflow) || Si(e, t.backend) ? !n || n(e.href) !== !1 : !1, wi = (e) => {
5612
+ }, Oi = (e, t, n) => Ei(e, t.passflow) || Di(e, t.backend) ? !n || n(e.href) !== !1 : !1, ki = (e) => {
5550
5613
  let t = e.detail, n = t?.message ?? `[passflow] upgrade challenge not actioned: ${e.reason}`;
5551
5614
  console.warn(n, {
5552
5615
  status: e.status,
@@ -5554,8 +5617,8 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5554
5617
  reason: e.reason,
5555
5618
  detail: t
5556
5619
  });
5557
- }, Ti = (e, t) => {
5558
- let n = t.onUpgradeDiagnostic ?? wi;
5620
+ }, Ai = (e, t) => {
5621
+ let n = t.onUpgradeDiagnostic ?? ki;
5559
5622
  return (t, r) => {
5560
5623
  n({
5561
5624
  status: e.status,
@@ -5567,8 +5630,8 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5567
5630
  }
5568
5631
  });
5569
5632
  };
5570
- }, Ei = (e, t, n) => {
5571
- let r = n.onUpgradeDiagnostic ?? wi;
5633
+ }, ji = (e, t, n) => {
5634
+ let r = n.onUpgradeDiagnostic ?? ki;
5572
5635
  for (let n of e) r({
5573
5636
  ...n,
5574
5637
  url: t.request.href,
@@ -5577,8 +5640,8 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5577
5640
  ...n.detail ?? {}
5578
5641
  }
5579
5642
  });
5580
- }, Di = /\bjson\b/i, Oi = async (e, t) => {
5581
- let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n && Di.test(r), a;
5643
+ }, Mi = /\bjson\b/i, Ni = async (e, t) => {
5644
+ let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n && Mi.test(r), a;
5582
5645
  if (i) try {
5583
5646
  a = await e.readBody();
5584
5647
  } catch {
@@ -5592,10 +5655,10 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5592
5655
  status: e.status,
5593
5656
  getHeader: (t) => e.getHeader(t) ?? void 0
5594
5657
  }, { requireChallengeChannel: t.requireChallengeChannel });
5595
- }, ki = (e) => ve({
5658
+ }, Pi = (e) => ve({
5596
5659
  status: e.status,
5597
5660
  getHeader: (t) => e.getHeader(t) ?? void 0
5598
- }, { requireChallengeChannel: "header" }).challenge, Ai = (e, t) => t.passflow === null ? `[passflow] a 401/403 from ${e} carried an upgrade challenge, but no Passflow endpoint is configured — set \`url\` on the Passflow config.` : `[passflow] a 401/403 from ${e} carried an upgrade challenge, but that URL is not covered by the provider's \`backend\` prop — add it there to enable step-up for this API.`, ji = (e, t) => e instanceof ci ? { kind: "cancelled" } : e instanceof li ? { kind: "unsatisfiable" } : e instanceof br ? { kind: "unavailable" } : e instanceof xr ? { kind: "session-changed" } : e instanceof yr ? {
5661
+ }, { requireChallengeChannel: "header" }).challenge, Fi = (e, t) => t.passflow === null ? `[passflow] a 401/403 from ${e} carried an upgrade challenge, but no Passflow endpoint is configured — set \`url\` on the Passflow config.` : `[passflow] a 401/403 from ${e} carried an upgrade challenge, but that URL is not covered by the provider's \`backend\` prop — add it there to enable step-up for this API.`, Ii = (e, t) => e instanceof pi ? { kind: "cancelled" } : e instanceof mi ? { kind: "unsatisfiable" } : e instanceof Tr ? { kind: "unavailable" } : e instanceof Er ? { kind: "session-changed" } : e instanceof wr ? {
5599
5662
  kind: "insufficient",
5600
5663
  obtained: e.obtained,
5601
5664
  required: e.required
@@ -5611,17 +5674,17 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5611
5674
  kind: "transport-failure",
5612
5675
  retryable: !1,
5613
5676
  error: e instanceof Error ? e : Error(String(e))
5614
- }, Mi = async (e, t, n, r) => {
5677
+ }, Li = async (e, t, n, r) => {
5615
5678
  if (e.status !== 401 && e.status !== 403) return {
5616
5679
  kind: "replayed",
5617
5680
  response: e
5618
5681
  };
5619
- let { challenge: i, diagnostics: a } = await Oi(e, t);
5620
- if (Ei(a, e, t), !i) return {
5682
+ let { challenge: i, diagnostics: a } = await Ni(e, t);
5683
+ if (ji(a, e, t), !i) return {
5621
5684
  kind: "replayed",
5622
5685
  response: e
5623
5686
  };
5624
- let o = pi(i);
5687
+ let o = vi(i);
5625
5688
  return r("elevated-insufficient", {
5626
5689
  obtained: n,
5627
5690
  required: o
@@ -5631,7 +5694,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5631
5694
  required: o,
5632
5695
  response: e
5633
5696
  };
5634
- }, Ni = async (e, t) => {
5697
+ }, Ri = async (e, t) => {
5635
5698
  if (!t) return {
5636
5699
  aborted: !1,
5637
5700
  value: await e
@@ -5658,14 +5721,14 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5658
5721
  } finally {
5659
5722
  n && t.removeEventListener?.("abort", n);
5660
5723
  }
5661
- }, Pi = async (e, t) => {
5724
+ }, zi = async (e, t) => {
5662
5725
  if (e.status !== 401 && e.status !== 403 || e.markers.upgradeTransaction) return { kind: "not-a-challenge" };
5663
- let n = Ti(e, t);
5726
+ let n = Ai(e, t);
5664
5727
  if (e.markers.replayed) {
5665
- if (!Ci(e.request, t.scope, t.shouldIntercept)) return { kind: "not-a-challenge" };
5666
- let { challenge: r, diagnostics: i } = await Oi(e, t);
5667
- if (Ei(i, e, t), !r) return { kind: "not-a-challenge" };
5668
- let a = t.readObtainedBar?.() ?? {}, o = pi(r);
5728
+ if (!Oi(e.request, t.scope, t.shouldIntercept)) return { kind: "not-a-challenge" };
5729
+ let { challenge: r, diagnostics: i } = await Ni(e, t);
5730
+ if (ji(i, e, t), !r) return { kind: "not-a-challenge" };
5731
+ let a = t.readObtainedBar?.() ?? {}, o = vi(r);
5669
5732
  return n("elevated-insufficient", {
5670
5733
  obtained: a,
5671
5734
  required: o
@@ -5676,12 +5739,12 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5676
5739
  response: e
5677
5740
  };
5678
5741
  }
5679
- if (!Ci(e.request, t.scope, t.shouldIntercept)) return ki(e) ? (n("challenge-out-of-scope", {
5742
+ if (!Oi(e.request, t.scope, t.shouldIntercept)) return Pi(e) ? (n("challenge-out-of-scope", {
5680
5743
  header: e.getHeader("www-authenticate") ?? void 0,
5681
- message: Ai(e.request.href, t.scope)
5744
+ message: Fi(e.request.href, t.scope)
5682
5745
  }), { kind: "out-of-scope" }) : { kind: "not-a-challenge" };
5683
- let { challenge: r, diagnostics: i } = await Oi(e, t);
5684
- if (Ei(i, e, t), !r) {
5746
+ let { challenge: r, diagnostics: i } = await Ni(e, t);
5747
+ if (ji(i, e, t), !r) {
5685
5748
  let r = e.getHeader("www-authenticate");
5686
5749
  return t.requireChallengeChannel !== "header" && n("no-channel", {
5687
5750
  ...r ? { header: r } : {},
@@ -5695,9 +5758,9 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5695
5758
  method: e.request.method
5696
5759
  }, s, c;
5697
5760
  try {
5698
- s = Promise.resolve(t.elevate(r, o)), c = await Ni(s, e.signal);
5761
+ s = Promise.resolve(t.elevate(r, o)), c = await Ri(s, e.signal);
5699
5762
  } catch (e) {
5700
- return ji(e, void 0);
5763
+ return Ii(e, void 0);
5701
5764
  }
5702
5765
  if (c.aborted) return s?.then((e) => e?.waiter.report({ outcome: "failed" }), () => {}), {
5703
5766
  kind: "aborted",
@@ -5708,7 +5771,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5708
5771
  kind: "aborted",
5709
5772
  reason: e.signal.reason
5710
5773
  };
5711
- let u = l?.obtained ?? t.readObtainedBar?.() ?? pi(r), d = t.authorizationSwap?.(), f = d ? {
5774
+ let u = l?.obtained ?? t.readObtainedBar?.() ?? vi(r), d = t.authorizationSwap?.(), f = d ? {
5712
5775
  from: a?.from ?? d.from,
5713
5776
  to: d.to
5714
5777
  } : void 0;
@@ -5717,7 +5780,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5717
5780
  try {
5718
5781
  p = await e.replay(f ? { authorizationSwap: f } : void 0);
5719
5782
  } catch (t) {
5720
- if (t instanceof yr) return l?.waiter.report({
5783
+ if (t instanceof wr) return l?.waiter.report({
5721
5784
  outcome: "insufficient",
5722
5785
  obtained: t.obtained,
5723
5786
  required: t.required
@@ -5735,7 +5798,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5735
5798
  };
5736
5799
  throw t;
5737
5800
  }
5738
- let m = await Mi(p, t, u, n);
5801
+ let m = await Li(p, t, u, n);
5739
5802
  return m.kind === "insufficient" ? l?.waiter.report({
5740
5803
  outcome: "insufficient",
5741
5804
  obtained: m.obtained,
@@ -5744,18 +5807,18 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5744
5807
  outcome: "replayed",
5745
5808
  obtained: u
5746
5809
  }), m;
5747
- }, Fi = (e) => {
5810
+ }, Bi = (e) => {
5748
5811
  switch (e.kind) {
5749
- case "cancelled": return new ci();
5750
- case "unsatisfiable": return new li();
5751
- case "unavailable": return new br();
5752
- case "session-changed": return new xr();
5753
- case "insufficient": return new yr(e.obtained, e.required);
5812
+ case "cancelled": return new pi();
5813
+ case "unsatisfiable": return new mi();
5814
+ case "unavailable": return new Tr();
5815
+ case "session-changed": return new Er();
5816
+ case "insufficient": return new wr(e.obtained, e.required);
5754
5817
  case "exhausted": return e.error;
5755
5818
  case "transport-failure": return e.error;
5756
5819
  default: return;
5757
5820
  }
5758
- }, Ii = (e, t, n) => {
5821
+ }, Vi = (e, t, n) => {
5759
5822
  switch (e.kind) {
5760
5823
  case "replayed": return {
5761
5824
  settle: "resolve",
@@ -5773,21 +5836,21 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5773
5836
  };
5774
5837
  case "cancelled": return n.onCancel === "reject" ? {
5775
5838
  settle: "reject",
5776
- error: new ci()
5839
+ error: new pi()
5777
5840
  } : {
5778
5841
  settle: "resolve",
5779
- value: Gi(t, e)
5842
+ value: Xi(t, e)
5780
5843
  };
5781
5844
  case "insufficient": return {
5782
5845
  settle: "resolve",
5783
- value: Gi(e.response?.raw ?? t, e)
5846
+ value: Xi(e.response?.raw ?? t, e)
5784
5847
  };
5785
5848
  default: return {
5786
5849
  settle: "resolve",
5787
- value: Gi(t, e)
5850
+ value: Xi(t, e)
5788
5851
  };
5789
5852
  }
5790
- }, Li = (e, t) => {
5853
+ }, Hi = (e, t) => {
5791
5854
  switch (e.kind) {
5792
5855
  case "replayed": return e.response.rejected ? {
5793
5856
  settle: "reject",
@@ -5802,39 +5865,39 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5802
5865
  };
5803
5866
  default: return {
5804
5867
  settle: "reject",
5805
- error: Fi(e) ?? t
5868
+ error: Bi(e) ?? t
5806
5869
  };
5807
5870
  }
5808
- }, Ri = /* @__PURE__ */ new WeakSet(), zi = /* @__PURE__ */ new WeakSet(), Bi = /* @__PURE__ */ new WeakSet(), Vi = /* @__PURE__ */ new WeakSet(), Hi = /* @__PURE__ */ new WeakSet(), Ui = /* @__PURE__ */ new WeakSet(), Wi = /* @__PURE__ */ new WeakSet(), Gi = (e, t) => {
5871
+ }, Ui = /* @__PURE__ */ new WeakSet(), Wi = /* @__PURE__ */ new WeakSet(), Gi = /* @__PURE__ */ new WeakSet(), Ki = /* @__PURE__ */ new WeakSet(), qi = /* @__PURE__ */ new WeakSet(), Ji = /* @__PURE__ */ new WeakSet(), Yi = /* @__PURE__ */ new WeakSet(), Xi = (e, t) => {
5809
5872
  switch (t.kind) {
5810
5873
  case "cancelled":
5811
- Ri.add(e);
5874
+ Ui.add(e);
5812
5875
  break;
5813
5876
  case "exhausted":
5814
- zi.add(e);
5877
+ Wi.add(e);
5815
5878
  break;
5816
5879
  case "insufficient":
5817
- Bi.add(e);
5880
+ Gi.add(e);
5818
5881
  break;
5819
5882
  case "unsatisfiable":
5820
- Vi.add(e);
5883
+ Ki.add(e);
5821
5884
  break;
5822
5885
  case "unavailable":
5823
- Hi.add(e);
5886
+ qi.add(e);
5824
5887
  break;
5825
5888
  case "session-changed":
5826
- Ui.add(e);
5889
+ Ji.add(e);
5827
5890
  break;
5828
- case "transport-failure": Wi.add(e);
5891
+ case "transport-failure": Yi.add(e);
5829
5892
  }
5830
5893
  return e;
5831
- }, Ki = (e) => Ri.has(e), qi = (e) => zi.has(e), Ji = (e) => Bi.has(e), Yi = (e) => Vi.has(e), Xi = (e) => Hi.has(e), Zi = (e) => Ui.has(e), Qi = (e) => Wi.has(e), $i = "https://passflow-relative.invalid", ea = () => {
5894
+ }, Zi = (e) => Ui.has(e), Qi = (e) => Wi.has(e), $i = (e) => Gi.has(e), ea = (e) => Ki.has(e), ta = (e) => qi.has(e), na = (e) => Ji.has(e), ra = (e) => Yi.has(e), ia = "https://passflow-relative.invalid", aa = () => {
5832
5895
  let e = globalThis, t = e.document?.baseURI;
5833
5896
  if (typeof t == "string" && t !== "") return t;
5834
5897
  let n = e.location?.href;
5835
- return typeof n == "string" && n !== "" && n !== "about:blank" ? n : $i;
5836
- }, ta = (e, t = ea()) => {
5837
- let n = t === $i, r;
5898
+ return typeof n == "string" && n !== "" && n !== "about:blank" ? n : ia;
5899
+ }, oa = (e, t = aa()) => {
5900
+ let n = t === ia, r;
5838
5901
  try {
5839
5902
  r = new URL(t).origin;
5840
5903
  } catch {
@@ -5860,28 +5923,28 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5860
5923
  relativeToBase: !1,
5861
5924
  sentinelBase: n
5862
5925
  };
5863
- }, na = (e, t) => typeof t == "string" ? [e.toLowerCase(), t] : void 0, ra = (e) => {
5926
+ }, sa = (e, t) => typeof t == "string" ? [e.toLowerCase(), t] : void 0, ca = (e) => {
5864
5927
  let t = [];
5865
5928
  if (e == null) return Object.freeze(t);
5866
5929
  let n = e;
5867
5930
  if (typeof n.forEach == "function" && typeof n.entries == "function") return e.forEach((e, n) => {
5868
- let r = na(n, e);
5931
+ let r = sa(n, e);
5869
5932
  r && t.push(r);
5870
5933
  }), Object.freeze(t);
5871
5934
  if (Array.isArray(e)) {
5872
5935
  for (let n of e) if (Array.isArray(n) && n.length >= 2) {
5873
- let e = na(String(n[0]), n[1]);
5936
+ let e = sa(String(n[0]), n[1]);
5874
5937
  e && t.push(e);
5875
5938
  }
5876
5939
  return Object.freeze(t);
5877
5940
  }
5878
5941
  if (typeof e == "object") for (let [n, r] of Object.entries(e)) {
5879
- let e = na(n, Array.isArray(r) ? r.join(", ") : r);
5942
+ let e = sa(n, Array.isArray(r) ? r.join(", ") : r);
5880
5943
  e && t.push(e);
5881
5944
  }
5882
5945
  return Object.freeze(t);
5883
- }, ia = (e) => {
5884
- let t = e.base === void 0 ? ta(e.url) : ta(e.url, e.base), n = {
5946
+ }, la = (e) => {
5947
+ let t = e.base === void 0 ? oa(e.url) : oa(e.url, e.base), n = {
5885
5948
  raw: e.url,
5886
5949
  href: t.href,
5887
5950
  dispatchUrl: t.sentinelBase || !t.resolved ? e.url : t.href,
@@ -5890,29 +5953,29 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5890
5953
  resolved: t.resolved,
5891
5954
  relativeToBase: t.relativeToBase,
5892
5955
  method: (e.method ?? "GET").toUpperCase(),
5893
- headers: ra(e.headers),
5956
+ headers: ca(e.headers),
5894
5957
  bodyKind: e.bodyKind,
5895
5958
  ..."body" in e ? { body: e.body } : {}
5896
5959
  };
5897
5960
  return Object.freeze(n);
5898
- }, aa = (e, t) => {
5961
+ }, ua = (e, t) => {
5899
5962
  if (!t || t.from === t.to) return e;
5900
5963
  let n = !1, r = e.map(([e, r]) => e === "authorization" && r === t.from ? (n = !0, [e, t.to]) : [e, r]);
5901
5964
  return n ? Object.freeze(r) : e;
5902
- }, oa = (e) => {
5965
+ }, da = (e) => {
5903
5966
  let t = {};
5904
5967
  for (let [n, r] of e) t[n] = r;
5905
5968
  return t;
5906
- }, sa = /* @__PURE__ */ new Set([
5969
+ }, fa = /* @__PURE__ */ new Set([
5907
5970
  "GET",
5908
5971
  "HEAD",
5909
5972
  "OPTIONS"
5910
- ]), ca = (e) => typeof e == "object" && !!e && typeof e.url == "string" && typeof e.clone == "function" && "method" in e, la = (e) => typeof e == "string" ? e : ca(e) ? e.url : String(e), ua = (e, t) => (t?.method ?? (ca(e) ? e.method : void 0) ?? "GET").toUpperCase(), da = (e) => e == null ? "none" : typeof e == "string" ? "reusable" : typeof e.getReader == "function" ? "one-shot" : "reusable", fa = (e) => {
5973
+ ]), pa = (e) => typeof e == "object" && !!e && typeof e.url == "string" && typeof e.clone == "function" && "method" in e, ma = (e) => typeof e == "string" ? e : pa(e) ? e.url : String(e), ha = (e, t) => (t?.method ?? (pa(e) ? e.method : void 0) ?? "GET").toUpperCase(), ga = (e) => e == null ? "none" : typeof e == "string" ? "reusable" : typeof e.getReader == "function" ? "one-shot" : "reusable", _a = (e) => {
5911
5974
  if (typeof e == "string") return e.length;
5912
5975
  let t = e;
5913
5976
  if (typeof t?.size == "number") return t.size;
5914
5977
  if (typeof t?.byteLength == "number") return t.byteLength;
5915
- }, pa = (e, t, n) => e === void 0 || e === "always" ? !0 : e === "idempotent-only" ? sa.has(t.method) : typeof e == "function" ? e(t) : !(e.maxBodyBytes !== void 0 && n !== void 0 && n > e.maxBodyBytes), ma = (e, t, n, r, i) => ({
5978
+ }, va = (e, t, n) => e === void 0 || e === "always" ? !0 : e === "idempotent-only" ? fa.has(t.method) : typeof e == "function" ? e(t) : !(e.maxBodyBytes !== void 0 && n !== void 0 && n > e.maxBodyBytes), ya = (e, t, n, r, i) => ({
5916
5979
  replayable: !1,
5917
5980
  bodyKind: e,
5918
5981
  reason: t,
@@ -5920,11 +5983,11 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5920
5983
  forwardInit: i,
5921
5984
  snapshot: r,
5922
5985
  replay: () => Promise.reject(/* @__PURE__ */ Error(`This request cannot be replayed: ${t}`))
5923
- }), ha = (e, t) => oa(aa(e.headers, t?.authorizationSwap)), ga = (e) => {
5986
+ }), ba = (e, t) => da(ua(e.headers, t?.authorizationSwap)), xa = (e) => {
5924
5987
  if (!e || !("headers" in e)) return e;
5925
5988
  let { headers: t, ...n } = e;
5926
5989
  return n;
5927
- }, _a = (e, t) => t && "headers" in t && t.headers !== void 0 ? t.headers : ca(e) ? e.headers : void 0, va = (e) => {
5990
+ }, Sa = (e, t) => t && "headers" in t && t.headers !== void 0 ? t.headers : pa(e) ? e.headers : void 0, Ca = (e) => {
5928
5991
  if (e === null || typeof e == "string") return e;
5929
5992
  if (typeof FormData < "u" && e instanceof FormData) {
5930
5993
  let t = new FormData();
@@ -5932,18 +5995,18 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5932
5995
  return t;
5933
5996
  }
5934
5997
  return typeof URLSearchParams < "u" && e instanceof URLSearchParams ? new URLSearchParams(e) : e instanceof ArrayBuffer ? e.slice(0) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength).slice() : e;
5935
- }, ya = (e, t, n) => new Request(e, { headers: ha(t, n) }), ba = (e, t, n) => {
5936
- let r = la(e), i = ua(e, t), a = _a(e, t), o = (e, t) => ia({
5998
+ }, wa = (e, t, n) => new Request(e, { headers: ba(t, n) }), Ta = (e, t, n) => {
5999
+ let r = ma(e), i = ha(e, t), a = Sa(e, t), o = (e, t) => la({
5937
6000
  url: r,
5938
6001
  method: i,
5939
6002
  headers: a,
5940
6003
  bodyKind: e,
5941
6004
  ...t === void 0 ? {} : { body: t }
5942
6005
  });
5943
- if (ca(e)) {
6006
+ if (pa(e)) {
5944
6007
  if (e.body === null || e.body === void 0) {
5945
6008
  let a = o("none");
5946
- return pa(n, {
6009
+ return va(n, {
5947
6010
  url: r,
5948
6011
  method: i,
5949
6012
  bodyKind: "none"
@@ -5953,20 +6016,20 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5953
6016
  forwardInput: e,
5954
6017
  forwardInit: t,
5955
6018
  snapshot: a,
5956
- replay: (n, r) => n(ya(e, a, r), ga(t))
5957
- } : ma("none", "the replay policy refused this request", e, a, t);
6019
+ replay: (n, r) => n(wa(e, a, r), xa(t))
6020
+ } : ya("none", "the replay policy refused this request", e, a, t);
5958
6021
  }
5959
6022
  let a = o("request-clone");
5960
- if (!pa(n, {
6023
+ if (!va(n, {
5961
6024
  url: r,
5962
6025
  method: i,
5963
6026
  bodyKind: "request-clone"
5964
- })) return ma("request-clone", "the replay policy refused this request", e, a, t);
6027
+ })) return ya("request-clone", "the replay policy refused this request", e, a, t);
5965
6028
  let s;
5966
6029
  try {
5967
6030
  s = e.clone();
5968
6031
  } catch {
5969
- return ma("one-shot", "the Request body was already consumed and cannot be cloned", e, a, t);
6032
+ return ya("one-shot", "the Request body was already consumed and cannot be cloned", e, a, t);
5970
6033
  }
5971
6034
  return {
5972
6035
  replayable: !0,
@@ -5974,17 +6037,17 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5974
6037
  forwardInput: e,
5975
6038
  forwardInit: t,
5976
6039
  snapshot: a,
5977
- replay: (e, n) => e(ya(s, a, n), ga(t))
6040
+ replay: (e, n) => e(wa(s, a, n), xa(t))
5978
6041
  };
5979
6042
  }
5980
- let s = da(t?.body);
5981
- if (s === "one-shot") return ma("one-shot", "a streaming request body is consumed by the first send", e, o("one-shot"), t);
5982
- if (!pa(n, {
6043
+ let s = ga(t?.body);
6044
+ if (s === "one-shot") return ya("one-shot", "a streaming request body is consumed by the first send", e, o("one-shot"), t);
6045
+ if (!va(n, {
5983
6046
  url: r,
5984
6047
  method: i,
5985
6048
  bodyKind: s
5986
- }, fa(t?.body))) return ma(s, "the replay policy refused this request", e, o(s), t);
5987
- let c = t && "body" in t ? va(t.body ?? null) : void 0, l = o(s, c);
6049
+ }, _a(t?.body))) return ya(s, "the replay policy refused this request", e, o(s), t);
6050
+ let c = t && "body" in t ? Ca(t.body ?? null) : void 0, l = o(s, c);
5988
6051
  return {
5989
6052
  replayable: !0,
5990
6053
  bodyKind: s,
@@ -5992,21 +6055,21 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
5992
6055
  forwardInit: t,
5993
6056
  snapshot: l,
5994
6057
  replay: (e, n) => e(l.dispatchUrl, {
5995
- ...ga(t),
6058
+ ...xa(t),
5996
6059
  ...c === void 0 ? {} : { body: c },
5997
- headers: ha(l, n),
6060
+ headers: ba(l, n),
5998
6061
  method: l.method
5999
6062
  })
6000
6063
  };
6001
- }, xa = (e) => typeof e == "object" && !!e, Sa = (e) => (t) => {
6002
- if (!xa(e)) return;
6064
+ }, Ea = (e) => typeof e == "object" && !!e, Da = (e) => (t) => {
6065
+ if (!Ea(e)) return;
6003
6066
  let n = e[t] ?? e[t.toLowerCase()] ?? (typeof e.get == "function" ? e.get(t) : void 0);
6004
6067
  return Array.isArray(n) ? n.join(", ") : typeof n == "string" ? n : void 0;
6005
- }, Ca = (e) => {
6068
+ }, Oa = (e) => {
6006
6069
  let t = e?.url ?? "", n = e?.baseURL;
6007
6070
  return !n || /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t) ? t : `${n.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}`;
6008
- }, wa = (e) => (e?.method ?? "GET").toUpperCase(), Ta = (e) => e == null ? "none" : xa(e) && (typeof e.pipe == "function" || typeof e.getReader == "function") ? "one-shot" : "reusable", Ea = (e, t, n) => {
6009
- let r = oa(aa(t.headers, n?.authorizationSwap)), i = t.dispatchUrl === t.href && t.resolved;
6071
+ }, ka = (e) => (e?.method ?? "GET").toUpperCase(), Aa = (e) => e == null ? "none" : Ea(e) && (typeof e.pipe == "function" || typeof e.getReader == "function") ? "one-shot" : "reusable", ja = (e, t, n) => {
6072
+ let r = da(ua(t.headers, n?.authorizationSwap)), i = t.dispatchUrl === t.href && t.resolved;
6010
6073
  return {
6011
6074
  ...e,
6012
6075
  ...i ? { baseURL: void 0 } : {},
@@ -6015,10 +6078,10 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6015
6078
  headers: r,
6016
6079
  ..."body" in t ? { data: t.body } : {}
6017
6080
  };
6018
- }, Da = (e, t, n, r, i, a) => {
6019
- let o = t ?? e?.config, s = Ta(o?.data), c = a ?? ia({
6020
- url: Ca(o),
6021
- method: wa(o),
6081
+ }, Ma = (e, t, n, r, i, a) => {
6082
+ let o = t ?? e?.config, s = Aa(o?.data), c = a ?? la({
6083
+ url: Oa(o),
6084
+ method: ka(o),
6022
6085
  headers: o?.headers,
6023
6086
  bodyKind: s,
6024
6087
  body: o?.data
@@ -6026,22 +6089,22 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6026
6089
  url: c.href,
6027
6090
  method: c.method,
6028
6091
  bodyKind: s
6029
- }, u = s !== "one-shot" && pa(i.replay, l);
6092
+ }, u = s !== "one-shot" && va(i.replay, l);
6030
6093
  return {
6031
6094
  status: e?.status ?? 0,
6032
- getHeader: Sa(e?.headers),
6095
+ getHeader: Da(e?.headers),
6033
6096
  readBody: async () => e?.data,
6034
6097
  request: c,
6035
6098
  replay: async (e) => {
6036
- let t = Te(Ea(o ?? {}, c, e));
6099
+ let t = Te(ja(o ?? {}, c, e));
6037
6100
  try {
6038
6101
  let e = await r(t);
6039
- return Da(e, e?.config ?? t, e, r, i, c);
6102
+ return Ma(e, e?.config ?? t, e, r, i, c);
6040
6103
  } catch (e) {
6041
- let n = xa(e) ? e : {};
6042
- if (!n.response || typeof n.response.status != "number" || dr(e)) throw e;
6104
+ let n = Ea(e) ? e : {};
6105
+ if (!n.response || typeof n.response.status != "number" || gr(e)) throw e;
6043
6106
  return {
6044
- ...Da(n.response, n.config ?? t, e, r, i, c),
6107
+ ...Ma(n.response, n.config ?? t, e, r, i, c),
6045
6108
  rejected: !0
6046
6109
  };
6047
6110
  }
@@ -6055,19 +6118,19 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6055
6118
  replayUnsupportedReason: s === "one-shot" ? "a streaming request body is consumed by the first send" : "the replay policy refused this request",
6056
6119
  signal: o?.signal
6057
6120
  };
6058
- }, Oa = (e, t) => async (n) => {
6059
- let r = vi(e), i = xa(n) ? n : {}, a = Li(await Pi(Da(i.response, i.config, i.response, t, r), r), n);
6121
+ }, Na = (e, t) => async (n) => {
6122
+ let r = Ci(e), i = Ea(n) ? n : {}, a = Hi(await zi(Ma(i.response, i.config, i.response, t, r), r), n);
6060
6123
  if (a.settle === "reject") throw a.error;
6061
6124
  return a.value;
6062
- }, ka = (e, t, n) => {
6063
- let r = e.request, i = n ?? (typeof r == "function" ? (t) => r.call(e, t) : () => Promise.reject(/* @__PURE__ */ Error("Passflow: this client exposes no request() to replay through."))), a = e.interceptors.response.use(void 0, Oa(t, i)), o = !1;
6125
+ }, Pa = (e, t, n) => {
6126
+ let r = e.request, i = n ?? (typeof r == "function" ? (t) => r.call(e, t) : () => Promise.reject(/* @__PURE__ */ Error("Passflow: this client exposes no request() to replay through."))), a = e.interceptors.response.use(void 0, Na(t, i)), o = !1;
6064
6127
  return () => {
6065
6128
  o || (o = !0, e.interceptors.response.eject(a));
6066
6129
  };
6067
- }, Aa = (t, n) => {
6130
+ }, Fa = (t, n) => {
6068
6131
  let r = e.create(t);
6069
6132
  return n(r), r;
6070
- }, ja = 0, Ma = (e, t) => {
6133
+ }, Ia = 0, La = (e, t) => {
6071
6134
  let n = t?.signal ?? (typeof e == "object" && e ? e.signal : void 0) ?? void 0;
6072
6135
  if (n) return {
6073
6136
  get aborted() {
@@ -6081,34 +6144,34 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6081
6144
  removeEventListener: (e, t) => n.removeEventListener(e, t)
6082
6145
  } : {}
6083
6146
  };
6084
- }, Na = (e) => (t) => e.headers?.get(t), Pa = (e, t, n, r, i) => ({
6147
+ }, Ra = (e) => (t) => e.headers?.get(t), za = (e, t, n, r, i) => ({
6085
6148
  status: e.status,
6086
- getHeader: Na(e),
6149
+ getHeader: Ra(e),
6087
6150
  readBody: () => e.clone().json(),
6088
6151
  request: t.snapshot,
6089
- replay: async (e) => Pa(await t.replay(n, e), t, n, r, i),
6152
+ replay: async (e) => za(await t.replay(n, e), t, n, r, i),
6090
6153
  markers: r,
6091
6154
  raw: e,
6092
6155
  replayable: t.replayable,
6093
6156
  replayUnsupportedReason: t.reason,
6094
6157
  signal: i,
6095
6158
  responseType: e.type
6096
- }), Fa = (e, t) => {
6159
+ }), Ba = (e, t) => {
6097
6160
  let n = (t, n) => {
6098
- ja += 1;
6161
+ Ia += 1;
6099
6162
  try {
6100
6163
  return e(t, n);
6101
6164
  } finally {
6102
- --ja;
6165
+ --Ia;
6103
6166
  }
6104
6167
  };
6105
6168
  return async (e, r) => {
6106
- if (ja > 0) return n(e, r);
6107
- let i = vi(t), a = ba(e, r, i.replay), o = await n(a.forwardInput, a.forwardInit), s = Ii(await Pi(Pa(o, a, n, {}, Ma(e, r)), i), o, i);
6169
+ if (Ia > 0) return n(e, r);
6170
+ let i = Ci(t), a = Ta(e, r, i.replay), o = await n(a.forwardInput, a.forwardInit), s = Vi(await zi(za(o, a, n, {}, La(e, r)), i), o, i);
6108
6171
  if (s.settle === "reject") throw s.error;
6109
6172
  return s.value;
6110
6173
  };
6111
- }, Ia = new Set(ti.filter((e) => !e.requiresPrepare).map((e) => e.type)), La = (e) => {
6174
+ }, Va = new Set(oi.filter((e) => !e.requiresPrepare).map((e) => e.type)), Ha = (e) => {
6112
6175
  if (!e || typeof e != "object" || !e.challenge_id || !e.expires_at) throw new $({
6113
6176
  kind: "protocol",
6114
6177
  message: "The upgrade start response is missing challenge_id or expires_at"
@@ -6120,17 +6183,17 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6120
6183
  webauthn: e.webauthn,
6121
6184
  codeSentTo: e.code_sent_to
6122
6185
  };
6123
- }, Ra = (e) => dr(e) && !fr(e), za = (e) => ({
6186
+ }, Ua = (e) => gr(e) && !_r(e), Wa = (e) => ({
6124
6187
  async prepare(t) {
6125
- if (!Ia.has(t)) try {
6188
+ if (!Va.has(t)) try {
6126
6189
  let n = e.relyingPartyId?.();
6127
- return La(await e.startUpgrade(n ? {
6190
+ return Ha(await e.startUpgrade(n ? {
6128
6191
  method: t,
6129
6192
  relying_party_id: n
6130
6193
  } : { method: t }));
6131
6194
  } catch (e) {
6132
- if (Ra(e)) throw e;
6133
- let t = gr(e, "start");
6195
+ if (Ua(e)) throw e;
6196
+ let t = xr(e, "start");
6134
6197
  if (t.kind === "prepare_not_required") return;
6135
6198
  throw t;
6136
6199
  }
@@ -6147,17 +6210,17 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6147
6210
  assertion: n
6148
6211
  });
6149
6212
  } catch (t) {
6150
- if (Ra(t)) throw t;
6151
- let n = gr(t, "refresh");
6152
- throw n.status === 401 && vr(n) && e.markSessionInvalid?.(), n;
6213
+ if (Ua(t)) throw t;
6214
+ let n = xr(t, "refresh");
6215
+ throw n.status === 401 && Cr(n) && e.markSessionInvalid?.(), n;
6153
6216
  }
6154
6217
  }
6155
- }), Ba = (e) => e === void 0 ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e !== ""), Va = (e) => {
6218
+ }), Ga = (e) => e === void 0 ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e !== ""), Ka = (e) => {
6156
6219
  let t, n = (e) => e !== void 0 && t === e, r = (r) => {
6157
6220
  let i = () => {
6158
6221
  if (!n(r())) throw new $({ kind: "session_changed" });
6159
6222
  };
6160
- return za({
6223
+ return Wa({
6161
6224
  ...e,
6162
6225
  relyingPartyId: () => t?.options.relyingPartyId ?? e.relyingPartyId?.(),
6163
6226
  startUpgrade: (t) => (i(), e.startUpgrade(t)),
@@ -6168,7 +6231,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6168
6231
  });
6169
6232
  }, i = (t, n) => {
6170
6233
  let i = {}, a = {
6171
- controller: new _i({
6234
+ controller: new Si({
6172
6235
  transport: r(() => i.current),
6173
6236
  prompt: t.prompt,
6174
6237
  platform: e.platform,
@@ -6180,17 +6243,17 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6180
6243
  options: t,
6181
6244
  scope: {
6182
6245
  passflow: e.passflowDomain,
6183
- backend: Ba(t.backend)
6246
+ backend: Ga(t.backend)
6184
6247
  },
6185
6248
  generation: n
6186
6249
  };
6187
6250
  return i.current = a, a;
6188
6251
  }, a = async (r, i) => {
6189
6252
  let a = t;
6190
- if (!a) throw new br("Step-up verification is not enabled on this Passflow instance");
6253
+ if (!a) throw new Tr("Step-up verification is not enabled on this Passflow instance");
6191
6254
  a.controller.active || (a.pin = e.readSessionPin?.());
6192
6255
  let o = await a.controller.elevate(r, i);
6193
- if (!n(a)) throw new xr();
6256
+ if (!n(a)) throw new Er();
6194
6257
  return o;
6195
6258
  }, o = () => {
6196
6259
  let n = t, r = n?.scope ?? {
@@ -6234,9 +6297,9 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6234
6297
  let r = [];
6235
6298
  if (e.attachInternalSeam) {
6236
6299
  let t = e.attachInternalSeam;
6237
- t((e) => Oa(o, e)), r.push(() => t(void 0));
6300
+ t((e) => Na(o, e)), r.push(() => t(void 0));
6238
6301
  }
6239
- n.interceptFetch && r.push(Dt((e, t, n) => Fa(e, o)(t, n), {
6302
+ n.interceptFetch && r.push(Dt((e, t, n) => Ba(e, o)(t, n), {
6240
6303
  priority: 20,
6241
6304
  name: "passflow-upgrade"
6242
6305
  })), e.onSessionChange && r.push(e.onSessionChange(() => {
@@ -6267,18 +6330,18 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6267
6330
  withAuth: {
6268
6331
  enumerable: !0,
6269
6332
  value: (e) => {
6270
- if (e) return Fa(e, o);
6333
+ if (e) return Ba(e, o);
6271
6334
  let t = typeof globalThis > "u" ? void 0 : globalThis;
6272
6335
  if (!t || typeof t.fetch != "function") throw Error("Passflow: withAuth() needs a fetch to wrap — this runtime has none.");
6273
- return Fa(t.fetch.bind(t), o);
6336
+ return Ba(t.fetch.bind(t), o);
6274
6337
  }
6275
6338
  },
6276
6339
  attachAuth: {
6277
6340
  enumerable: !0,
6278
- value: (e) => ka(e, o)
6341
+ value: (e) => Pa(e, o)
6279
6342
  }
6280
6343
  });
6281
- }, Ha, Ua = class {
6344
+ }, qa, Ja = class {
6282
6345
  get origin() {
6283
6346
  return this.platform.getCurrentUrl()?.origin ?? "";
6284
6347
  }
@@ -6290,9 +6353,9 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6290
6353
  this.url = t || "https://auth.passflow.cloud", this.appId = n, this.platform = e.platform ?? P, this.deferFederatedLanding = e.deferFederatedLanding ?? !1, this.storageManager = new N({
6291
6354
  prefix: e.keyStoragePrefix ?? "",
6292
6355
  storage: this.platform.storage
6293
- }), this.deviceService = new re(this.storageManager), this.authApi = new nt(e, this.storageManager, this.deviceService), this.appApi = new Xe(e, this.storageManager, this.deviceService), this.userApi = new pt(e, this.storageManager, this.deviceService), this.settingApi = new at(e, this.storageManager, this.deviceService), this.tenantApi = new ot(e, this.storageManager, this.deviceService), this.invitationApi = new it(e, this.storageManager, this.deviceService), this.twoFactorApi = new dt(e, this.storageManager, this.deviceService), this.upgradeApi = new ft(e, this.storageManager, this.deviceService), this.upgradeDomain = ke(e.url), this.subscribeStore = new ir(), this.tokenCacheService = new qr(this.storageManager, this.authApi, this.subscribeStore, this.platform), this.scopes = r ?? u, this.createTenantForNewUser = e.createTenantForNewUser ?? !1;
6356
+ }), this.deviceService = new re(this.storageManager), this.authApi = new nt(e, this.storageManager, this.deviceService), this.appApi = new Xe(e, this.storageManager, this.deviceService), this.userApi = new pt(e, this.storageManager, this.deviceService), this.settingApi = new at(e, this.storageManager, this.deviceService), this.tenantApi = new ot(e, this.storageManager, this.deviceService), this.invitationApi = new it(e, this.storageManager, this.deviceService), this.twoFactorApi = new dt(e, this.storageManager, this.deviceService), this.upgradeApi = new ft(e, this.storageManager, this.deviceService), this.upgradeDomain = ke(e.url), this.subscribeStore = new ir(), this.tokenCacheService = new Qr(this.storageManager, this.authApi, this.subscribeStore, this.platform), this.scopes = r ?? u, this.createTenantForNewUser = e.createTenantForNewUser ?? !1;
6294
6357
  let i = vn(e.refreshCoordination, this.platform, e.keyStoragePrefix, { tokenKeys: () => this.storageManager.tokenKeys() });
6295
- this.authService = new Ur(this.authApi, this.deviceService, this.storageManager, this.subscribeStore, this.tokenCacheService, this.scopes, this.createTenantForNewUser, this.url, {
6358
+ this.authService = new Jr(this.authApi, this.deviceService, this.storageManager, this.subscribeStore, this.tokenCacheService, this.scopes, this.createTenantForNewUser, this.url, {
6296
6359
  createSession: this.createSessionCallback,
6297
6360
  expiredSession: this.expiredSessionCallback
6298
6361
  }, this.appId ?? "", e.tokenExchange, this.platform, () => this.readPkceEnabled(), {
@@ -6300,7 +6363,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6300
6363
  ...e.refreshStrikes === void 0 ? {} : { strikes: e.refreshStrikes }
6301
6364
  }), this.tokenCacheService.attachRefreshController(this.authService.refresh);
6302
6365
  for (let e of this.axiosClients()) e.setRefreshHandler((e) => this.authService.refresh.ensureFresh(e));
6303
- this.userService = new Yr(this.userApi, this.deviceService, this.platform), this.tenantService = new Kr(this.tenantApi, this.scopes), this.tenant = this.tenantService, this.invitationService = new Wr(this.invitationApi), this.twoFactorService = new Jr(this.twoFactorApi, this.subscribeStore, this.authService), this.twoFactor = this.twoFactorService, this.upgrade = Va({
6366
+ this.userService = new ei(this.userApi, this.deviceService, this.platform), this.tenantService = new Zr(this.tenantApi, this.scopes), this.tenant = this.tenantService, this.invitationService = new Yr(this.invitationApi), this.twoFactorService = new $r(this.twoFactorApi, this.subscribeStore, this.authService), this.twoFactor = this.twoFactorService, this.upgrade = Ka({
6304
6367
  startUpgrade: (e) => this.upgradeApi.startUpgrade(e),
6305
6368
  commitRefresh: async (e, t) => {
6306
6369
  await this.authService.refreshToken(e, t);
@@ -6347,7 +6410,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6347
6410
  return this.upgrade.attachAuth(e);
6348
6411
  }
6349
6412
  createClient(e) {
6350
- return Aa(e, (e) => this.upgrade.attachAuth(e));
6413
+ return Fa(e, (e) => this.upgrade.attachAuth(e));
6351
6414
  }
6352
6415
  readAssuranceBar() {
6353
6416
  let e = this.storageManager.getToken(j.access_token);
@@ -6413,58 +6476,66 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6413
6476
  this.subscribeStore.unsubscribe(e, t);
6414
6477
  }
6415
6478
  handleTokensRedirect() {
6416
- return this.checkAndSetTokens();
6479
+ this.checkAndSetTokens();
6417
6480
  }
6418
6481
  completeFederatedLanding() {
6419
6482
  return this.takeFederatedLanding();
6420
6483
  }
6421
6484
  checkAndSetTokens() {
6422
- let e = this.platform.getCurrentUrl(), t = new URLSearchParams(e?.search ?? ""), n = !1;
6485
+ let e = this.platform.getCurrentUrl(), t = new URLSearchParams(e?.search ?? "");
6423
6486
  if (!t.get("access_token") && e?.hash) {
6424
- let r = new URLSearchParams(e.hash.substring(1));
6425
- r.get("access_token") && (t = r, n = !0);
6487
+ let n = new URLSearchParams(e.hash.substring(1));
6488
+ n.get("access_token") && (t = n);
6426
6489
  }
6427
6490
  if (!t.get("access_token") && this.adoptTwoFactorTokenFromUrl(e)) {
6428
6491
  this.error = void 0;
6429
6492
  return;
6430
6493
  }
6431
- let r = t.get("access_token"), i = t.get("refresh_token"), a = t.get("id_token"), o = t.get("scopes")?.split(",") ?? this.scopes, s;
6432
- if (r) {
6433
- if (!wr(r)) {
6494
+ let n = t.get("access_token"), r = t.get("refresh_token"), i = t.get("id_token"), a = t.get("scopes")?.split(",") ?? this.scopes;
6495
+ if (n) {
6496
+ if (!kr(n)) {
6434
6497
  U(this.subscribeStore, {
6435
6498
  operation: "tokens.from-url",
6436
6499
  message: "Invalid access token format received",
6437
6500
  code: "INVALID_TOKEN_FORMAT"
6438
- }), this.cleanupUrlParams(n, e);
6501
+ }), this.cleanupUrlParams(e);
6439
6502
  return;
6440
6503
  }
6441
- if (i && !wr(i)) {
6504
+ if (r && !kr(r)) {
6442
6505
  U(this.subscribeStore, {
6443
6506
  operation: "tokens.from-url",
6444
6507
  message: "Invalid refresh token format received",
6445
6508
  code: "INVALID_TOKEN_FORMAT"
6446
- }), this.cleanupUrlParams(n, e);
6509
+ }), this.cleanupUrlParams(e);
6447
6510
  return;
6448
6511
  }
6449
- if (a && !wr(a)) {
6512
+ if (i && !kr(i)) {
6450
6513
  U(this.subscribeStore, {
6451
6514
  operation: "tokens.from-url",
6452
6515
  message: "Invalid ID token format received",
6453
6516
  code: "INVALID_TOKEN_FORMAT"
6454
- }), this.cleanupUrlParams(n, e);
6517
+ }), this.cleanupUrlParams(e);
6455
6518
  return;
6456
6519
  }
6457
- return s = {
6458
- access_token: r,
6459
- refresh_token: i ?? void 0,
6460
- id_token: a ?? void 0,
6461
- scopes: o
6462
- }, this.storageManager.clearDeliveryMode(), this.storageManager.saveTokens(s), this.tokenCacheService.setTokensCache(s), this.authService.refresh.sessionStarted(), this.subscribeStore.notify(Z.SignIn, {
6463
- tokens: s,
6464
- parsedTokens: this.getParsedTokens()
6465
- }), this.submitSessionCheck(), this.cleanupUrlParams(n, e), this.error = void 0, s;
6466
- }
6467
- this.deferFederatedLanding || this.takeFederatedLanding(), this.error = this.checkErrorsFromURL();
6520
+ let t = {
6521
+ access_token: n,
6522
+ refresh_token: r ?? void 0,
6523
+ id_token: i ?? void 0,
6524
+ scopes: a
6525
+ };
6526
+ this.cleanupUrlParams(e), this.error = void 0, lr(this.url, this.appId, t).then(() => {
6527
+ this.storageManager.clearDeliveryMode(), this.storageManager.saveTokens(t), this.tokenCacheService.setTokensCache(t), this.authService.refresh.sessionStarted();
6528
+ }).then(() => (this.subscribeStore.notify(Z.SignIn, {
6529
+ tokens: t,
6530
+ parsedTokens: this.getParsedTokens(),
6531
+ source: "tokens-in-url"
6532
+ }), this.submitSessionCheck()), (e) => U(this.subscribeStore, {
6533
+ operation: "tokens.from-url",
6534
+ message: e instanceof Error ? e.message : "Tokens in the URL could not be verified",
6535
+ code: "TOKEN_NOT_VERIFIED",
6536
+ originalError: e
6537
+ }));
6538
+ } else this.cleanupUrlParams(e), this.deferFederatedLanding || this.takeFederatedLanding(), this.error = this.checkErrorsFromURL();
6468
6539
  }
6469
6540
  takeFederatedLanding() {
6470
6541
  let e = this.platform.getCurrentUrl();
@@ -6481,7 +6552,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6481
6552
  if (!n) return !1;
6482
6553
  t.delete("tfa_token");
6483
6554
  let r = t.toString();
6484
- return this.platform.replaceUrl(e.pathname + e.search + (r ? `#${r}` : "")), wr(n) ? (this.subscribeStore.notify(Z.TwoFactorRequired, {
6555
+ return this.platform.replaceUrl(e.pathname + e.search + (r ? `#${r}` : "")), kr(n) ? (this.subscribeStore.notify(Z.TwoFactorRequired, {
6485
6556
  email: "",
6486
6557
  challengeId: "",
6487
6558
  tfaToken: n
@@ -6494,19 +6565,21 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6494
6565
  checkErrorsFromURL() {
6495
6566
  let e = new URLSearchParams(this.platform.getCurrentUrl()?.search ?? "").get("error");
6496
6567
  if (e) {
6497
- let t = Tr(e);
6568
+ let t = Ar(e);
6498
6569
  return Error(t);
6499
6570
  }
6500
6571
  }
6501
- cleanupUrlParams(e = !1, t = null) {
6502
- let n = t ?? this.platform.getCurrentUrl();
6503
- if (n) {
6504
- if (e) this.platform.replaceUrl(n.pathname + n.search);
6505
- else {
6506
- let e = new URLSearchParams(n.search);
6507
- e.delete("access_token"), e.delete("refresh_token"), e.delete("id_token"), e.delete("client_challenge"), e.size > 0 ? this.platform.replaceUrl(`${n.pathname}?${e.toString()}`) : this.platform.replaceUrl(n.pathname);
6508
- }
6509
- }
6572
+ cleanupUrlParams(e) {
6573
+ if (!e) return;
6574
+ let t = [
6575
+ "access_token",
6576
+ "refresh_token",
6577
+ "id_token"
6578
+ ], n = new URLSearchParams(e.search), r = new URLSearchParams(e.hash?.substring(1)), i = t.some((e) => r.get(e));
6579
+ if (!i && !t.some((e) => n.get(e))) return;
6580
+ for (let e of [...t, "client_challenge"]) n.delete(e);
6581
+ let a = n.toString();
6582
+ this.platform.replaceUrl(e.pathname + (a ? `?${a}` : "") + (i ? "" : e.hash ?? ""));
6510
6583
  }
6511
6584
  setTokensToCacheFromLocalStorage() {
6512
6585
  let e = this.storageManager.getTokens();
@@ -6885,7 +6958,7 @@ var jr = "passflow_2fa_pkce", Mr = 3e5, Nr = "passflow_pwless_pending", Pr = 3e3
6885
6958
  this.twoFactorService.clearMagicLinkSession();
6886
6959
  }
6887
6960
  };
6888
- Ha = Ua, Ha.version = c;
6889
- export { i as APP_ID_HEADER_KEY, Me as APP_SECRET_NAMES, a as AUTHORIZATION_HEADER_KEY, Xe as AppAPI, nt as AuthAPI, Ur as AuthService, rt as CLIAuthAPI, f as DEFAULT_GROUP_NAME, u as DEFAULT_SCOPES, ti as DEFAULT_UPGRADE_FACTORS, o as DEVICE_ID_HEADER_KEY, s as DEVICE_TYPE_HEADER_KEY, b as ERROR_MESSAGE_MAX_LENGTH, mt as FETCH_PRIORITY_OIDC, ht as FETCH_PRIORITY_UPGRADE, gt as FetchMiddlewareContractError, ce as INSUFFICIENT_USER_AUTHENTICATION, it as InvitationAPI, Wr as InvitationService, It as M2MClient, jt as M2MConfigError, H as M2MError, Mt as M2MErrorCodes, kt as M2MNetworkError, At as M2MTokenParseError, Nt as M2M_DEFAULTS, Ne as MASKED_SECRET_PREFIX, l as MINIMAL_DEFAULT_SCOPES, Ie as OS, d as PASSFLOW_CLOUD_URL, m as POPUP_HEIGHT, h as POPUP_POLL_INTERVAL_MS, g as POPUP_TIMEOUT_MS, p as POPUP_WIDTH, Ua as Passflow, Oe as PassflowAdminEndpointPaths, z as PassflowEndpointPaths, B as PassflowError, Z as PassflowEvent, q as PassflowRefreshError, ie as PopupClosedError, je as Providers, ar as RECOVERABLE_COMMIT_ERROR_IDS, Dn as REFRESH_AUTH_FAILURE_IDS, K as RefreshErrorId, De as RequestMethod, c as SDK_VERSION, or as SESSION_INVALIDATING_COMMIT_ERROR_IDS, Pe as SETTINGS_MASKED_VALUE_UNKNOWN_ERROR_ID, te as SessionState, at as SettingAPI, _ as TOKEN_EXPIRY_BUFFER_SECONDS, ot as TenantAPI, Kr as TenantService, Gr as TenantUserMembership, qr as TokenCacheService, M as TokenDeliveryMode, j as TokenType, dt as TwoFactorApiClient, Re as TwoFactorPolicy, Jr as TwoFactorService, le as UPGRADE_REQUIRED, y as USERNAME_MAX_LENGTH, v as USERNAME_MIN_LENGTH, ft as UpgradeAPI, ci as UpgradeCancelledError, zn as UpgradeCommitInterruptedError, _i as UpgradeController, Q as UpgradeErrorIds, Xr as UpgradeFactorError, yr as UpgradeInsufficientError, xr as UpgradeSessionChangedError, $ as UpgradeTransportError, br as UpgradeUnavailableError, li as UpgradeUnsatisfiableError, pt as UserAPI, Yr as UserService, ae as WebAdapter, gr as classifyUpgradeError, ni as factorRegistry, Ot as fetchRegistryState, Le as getOSFromDeviceType, vr as invalidatesSessionOnCommit, Ae as isEmailVerificationStep, Fe as isMaskedSecret, _r as isRecoverableCommitFailure, cr as isRetryableUpgradeKind, k as isTokenExpired, Ki as isUpgradeCancelled, qi as isUpgradeExhausted, Ji as isUpgradeInsufficient, Zi as isUpgradeSessionChanged, fr as isUpgradeTransportError, Qi as isUpgradeTransportFailure, Xi as isUpgradeUnavailable, Yi as isUpgradeUnsatisfiable, Er as isValidEmail, wr as isValidJWTFormat, Dr as isValidPhoneNumber, Or as isValidUsername, he as parseChallengeBody, me as parseChallengeHeader, A as parseToken, ye as parseUpgradeChallenge, ei as passkeyFactor, V as pathWithParams, $r as recoveryCodesFactor, Dt as registerFetchMiddleware, L as requiredAcrLevel, ke as resolveUpgradeDomain, Tr as sanitizeErrorMessage, si as selectFactors, Qr as totpFactor, P as webAdapter };
6961
+ qa = Ja, qa.version = c;
6962
+ export { i as APP_ID_HEADER_KEY, Me as APP_SECRET_NAMES, a as AUTHORIZATION_HEADER_KEY, Xe as AppAPI, nt as AuthAPI, Jr as AuthService, rt as CLIAuthAPI, f as DEFAULT_GROUP_NAME, u as DEFAULT_SCOPES, oi as DEFAULT_UPGRADE_FACTORS, o as DEVICE_ID_HEADER_KEY, s as DEVICE_TYPE_HEADER_KEY, b as ERROR_MESSAGE_MAX_LENGTH, mt as FETCH_PRIORITY_OIDC, ht as FETCH_PRIORITY_UPGRADE, gt as FetchMiddlewareContractError, ce as INSUFFICIENT_USER_AUTHENTICATION, it as InvitationAPI, Yr as InvitationService, It as M2MClient, jt as M2MConfigError, H as M2MError, Mt as M2MErrorCodes, kt as M2MNetworkError, At as M2MTokenParseError, Nt as M2M_DEFAULTS, Ne as MASKED_SECRET_PREFIX, l as MINIMAL_DEFAULT_SCOPES, Ie as OS, d as PASSFLOW_CLOUD_URL, m as POPUP_HEIGHT, h as POPUP_POLL_INTERVAL_MS, g as POPUP_TIMEOUT_MS, p as POPUP_WIDTH, Ja as Passflow, Oe as PassflowAdminEndpointPaths, z as PassflowEndpointPaths, B as PassflowError, Z as PassflowEvent, q as PassflowRefreshError, ie as PopupClosedError, je as Providers, ur as RECOVERABLE_COMMIT_ERROR_IDS, Dn as REFRESH_AUTH_FAILURE_IDS, K as RefreshErrorId, De as RequestMethod, c as SDK_VERSION, dr as SESSION_INVALIDATING_COMMIT_ERROR_IDS, Pe as SETTINGS_MASKED_VALUE_UNKNOWN_ERROR_ID, te as SessionState, at as SettingAPI, _ as TOKEN_EXPIRY_BUFFER_SECONDS, ot as TenantAPI, Zr as TenantService, Xr as TenantUserMembership, Qr as TokenCacheService, M as TokenDeliveryMode, j as TokenType, dt as TwoFactorApiClient, Re as TwoFactorPolicy, $r as TwoFactorService, le as UPGRADE_REQUIRED, y as USERNAME_MAX_LENGTH, v as USERNAME_MIN_LENGTH, ft as UpgradeAPI, pi as UpgradeCancelledError, zn as UpgradeCommitInterruptedError, Si as UpgradeController, Q as UpgradeErrorIds, ti as UpgradeFactorError, wr as UpgradeInsufficientError, Er as UpgradeSessionChangedError, $ as UpgradeTransportError, Tr as UpgradeUnavailableError, mi as UpgradeUnsatisfiableError, pt as UserAPI, ei as UserService, ae as WebAdapter, xr as classifyUpgradeError, si as factorRegistry, Ot as fetchRegistryState, Le as getOSFromDeviceType, Cr as invalidatesSessionOnCommit, Ae as isEmailVerificationStep, Fe as isMaskedSecret, Sr as isRecoverableCommitFailure, pr as isRetryableUpgradeKind, k as isTokenExpired, Zi as isUpgradeCancelled, Qi as isUpgradeExhausted, $i as isUpgradeInsufficient, na as isUpgradeSessionChanged, _r as isUpgradeTransportError, ra as isUpgradeTransportFailure, ta as isUpgradeUnavailable, ea as isUpgradeUnsatisfiable, jr as isValidEmail, kr as isValidJWTFormat, Mr as isValidPhoneNumber, Nr as isValidUsername, he as parseChallengeBody, me as parseChallengeHeader, A as parseToken, ye as parseUpgradeChallenge, ai as passkeyFactor, V as pathWithParams, ii as recoveryCodesFactor, Dt as registerFetchMiddleware, L as requiredAcrLevel, ke as resolveUpgradeDomain, Ar as sanitizeErrorMessage, fi as selectFactors, ri as totpFactor, P as webAdapter };
6890
6963
 
6891
6964
  //# sourceMappingURL=index.mjs.map