@passflow/core 0.48.1 → 0.49.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
@@ -11,7 +11,7 @@ var a = "__passflowAntiBot", o = (e, t) => {
11
11
  if (typeof e != "object" || !e) return;
12
12
  let t = e[a];
13
13
  return typeof t == "object" && t ? t : void 0;
14
- }, c = "0.48.1", l = "X-Passflow-Clientid", u = "Authorization", d = "X-Passflow-DeviceId", f = "X-Passflow-DeviceType", p = "X-Passflow-Anti-Bot", m = "X-Passflow-Agent-Tool", h = "X-Passflow-Device-Proof", g = "X-Passflow-Fingerprint-Event", _ = "X-Passflow-Stytch-Telemetry", v = "passflow_auth", y = c, b = [
14
+ }, c = "0.49.0", l = "X-Passflow-Clientid", u = "Authorization", d = "X-Passflow-DeviceId", f = "X-Passflow-DeviceType", p = "X-Passflow-Anti-Bot", m = "X-Passflow-Agent-Tool", h = "X-Passflow-Device-Proof", g = "X-Passflow-Fingerprint-Event", _ = "X-Passflow-Stytch-Telemetry", v = "passflow_auth", y = c, b = [
15
15
  "id",
16
16
  "offline",
17
17
  "openid"
@@ -6719,39 +6719,52 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
6719
6719
  credential: r
6720
6720
  };
6721
6721
  }
6722
- }, Fo = Object.freeze([
6722
+ }, Fo = (e) => ({
6723
+ type: e,
6724
+ requiresPrepare: !0,
6725
+ input: "code",
6726
+ assert: ({ code: t, prepared: n }) => new Promise((r) => {
6727
+ if (!n?.challengeId) throw new Ao(e, "No verification code has been sent yet");
6728
+ r({
6729
+ challenge_id: n.challengeId,
6730
+ code: jo(e, t)
6731
+ });
6732
+ })
6733
+ }), Io = Fo("email_otp"), Lo = Fo("sms_otp"), Ro = (e) => e.requiresPrepare && e.input === "code", zo = Object.freeze([
6723
6734
  Mo,
6724
6735
  Po,
6736
+ Io,
6737
+ Lo,
6725
6738
  No
6726
- ]), Io = (e = Fo) => new Map(e.map((e) => [e.type, e])), Lo = 3, Ro = {
6739
+ ]), Bo = (e = zo) => new Map(e.map((e) => [e.type, e])), Vo = 3, Ho = {
6727
6740
  totp: 0,
6728
6741
  passkey: 1,
6729
6742
  email_otp: 2,
6730
6743
  sms_otp: 3,
6731
6744
  recovery_codes: 9
6732
- }, zo = (e) => e.requiredLevel ?? je(e.acrValues), Bo = (e, t) => {
6733
- let n = Ro[e.type] ?? 5, r = t !== void 0 && t >= Lo, i = e.type === "passkey";
6745
+ }, Uo = (e) => e.requiredLevel ?? je(e.acrValues), Wo = (e, t) => {
6746
+ let n = Ho[e.type] ?? 5, r = t !== void 0 && t >= Vo, i = e.type === "passkey";
6734
6747
  return (r && !i ? 100 : 0) + n;
6735
- }, Vo = (e, t) => {
6748
+ }, Go = (e, t) => {
6736
6749
  if (t.availableFactors) return t.availableFactors.flatMap((t) => e.find((e) => e.type === t) ?? []);
6737
- let n = zo(t);
6738
- return [...e].sort((e, t) => Bo(e, n) - Bo(t, n));
6739
- }, Ho = class extends Error {
6750
+ let n = Uo(t);
6751
+ return [...e].sort((e, t) => Wo(e, n) - Wo(t, n));
6752
+ }, Ko = class extends Error {
6740
6753
  constructor(e) {
6741
6754
  super("Upgrade authentication was cancelled"), this.code = "upgrade_cancelled", this.name = "UpgradeCancelledError", e !== void 0 && (this.cause = e);
6742
6755
  }
6743
- }, Uo = class extends Error {
6756
+ }, qo = class extends Error {
6744
6757
  constructor(e = "Only a fresh sign-in can meet this challenge") {
6745
6758
  super(e), this.code = "upgrade_sign_in_required", this.name = "UpgradeSignInRequiredError";
6746
6759
  }
6747
- }, Wo = (e) => e?.signInRequired === !0 || e?.signInRequired === void 0 && e?.availableFactors?.length === 0, Go = (e) => e?.signInRequired === !1 && e.availableFactors?.length === 0, Ko = "This account has no factor that reaches the required level (it may need a device-bound passkey)", qo = (e) => {
6748
- if (Wo(e)) return new Uo();
6749
- if (Go(e)) return new Jo(Ko);
6750
- }, Jo = class extends Error {
6760
+ }, Jo = (e) => e?.signInRequired === !0 || e?.signInRequired === void 0 && e?.availableFactors?.length === 0, Yo = (e) => e?.signInRequired === !1 && e.availableFactors?.length === 0, Xo = "This account has no factor that reaches the required level (it may need a device-bound passkey)", Zo = (e) => {
6761
+ if (Jo(e)) return new qo();
6762
+ if (Yo(e)) return new Qo(Xo);
6763
+ }, Qo = class extends Error {
6751
6764
  constructor(e = "No available authentication factor can satisfy this challenge") {
6752
6765
  super(e), this.code = "upgrade_unsatisfiable", this.name = "UpgradeUnsatisfiableError";
6753
6766
  }
6754
- }, Yo = 4, Xo = 3e4, Zo = () => {
6767
+ }, $o = 4, es = 3e4, ts = () => {
6755
6768
  let e = () => void 0, t = () => void 0;
6756
6769
  return {
6757
6770
  promise: new Promise((n, r) => {
@@ -6760,12 +6773,12 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
6760
6773
  resolve: e,
6761
6774
  reject: t
6762
6775
  };
6763
- }, Qo = (e) => ({
6776
+ }, ns = (e) => ({
6764
6777
  acrValues: e.acrValues,
6765
6778
  level: e.requiredLevel,
6766
6779
  maxAge: e.maxAge
6767
- }), $o = (e, t) => t.level === void 0 || e.level !== void 0 && e.level >= t.level, es = (e, t) => {
6768
- 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 ?? []])), { availableFactors: o, signInRequired: s } = ts(t, e) && !ts(e, t) || !t.availableFactors ? e : t;
6780
+ }), rs = (e, t) => t.level === void 0 || e.level !== void 0 && e.level >= t.level, is = (e, t) => {
6781
+ 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 ?? []])), { availableFactors: o, signInRequired: s } = as(t, e) && !as(e, t) || !t.availableFactors ? e : t;
6769
6782
  return {
6770
6783
  acrValues: r,
6771
6784
  requiredLevel: n,
@@ -6775,12 +6788,12 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
6775
6788
  ...o ? { availableFactors: o } : {},
6776
6789
  ...s === void 0 ? {} : { signInRequired: s }
6777
6790
  };
6778
- }, ts = (e, t) => {
6791
+ }, as = (e, t) => {
6779
6792
  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);
6780
6793
  return n || r;
6781
- }, ns = class {
6794
+ }, os = class {
6782
6795
  constructor(e) {
6783
- 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 ?? Fo, this.registry = Io(this.available), this.maxAttempts = e.maxAttempts ?? Yo, this.readObtainedBar = e.readObtainedBar, this.onFlightSettled = e.onFlightSettled, this.settleTimeoutMs = e.replaySettleTimeoutMs ?? Xo;
6796
+ 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.heldCode = null, this.codeSent = null, this.codeSentChallenge = null, this.transport = e.transport, this.prompt = e.prompt, this.platform = e.platform, this.available = e.factors ?? zo, this.registry = Bo(this.available), this.maxAttempts = e.maxAttempts ?? $o, this.readObtainedBar = e.readObtainedBar, this.onFlightSettled = e.onFlightSettled, this.settleTimeoutMs = e.replaySettleTimeoutMs ?? es;
6784
6797
  }
6785
6798
  get currentState() {
6786
6799
  return this.state;
@@ -6800,9 +6813,9 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
6800
6813
  }
6801
6814
  register(e, t) {
6802
6815
  let n = t.kind === "imperative" && t.requested !== void 0, r = {
6803
- demanded: t.kind === "imperative" && t.requested ? t.requested : Qo(e),
6816
+ demanded: t.kind === "imperative" && t.requested ? t.requested : ns(e),
6804
6817
  statedBar: n,
6805
- settlement: Zo(),
6818
+ settlement: ts(),
6806
6819
  reported: !1,
6807
6820
  entry: {
6808
6821
  ...t,
@@ -6818,15 +6831,15 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
6818
6831
  this.requirement = e;
6819
6832
  return;
6820
6833
  }
6821
- let n = ts(t, e);
6822
- this.requirement = es(t, e), qo(this.requirement) ? this.state === "collecting" && this.selected === null && (this.openPrompt?.onClosed?.(), this.closeOpenPrompt?.()) : n && this.state === "collecting" && this.selected === null && this.openPrompt?.onRequirementRaised?.({
6834
+ let n = as(t, e);
6835
+ this.requirement = is(t, e), Zo(this.requirement) ? this.state === "collecting" && this.selected === null && (this.openPrompt?.onClosed?.(), this.closeOpenPrompt?.()) : n && this.state === "collecting" && this.selected === null && this.openPrompt?.onRequirementRaised?.({
6823
6836
  challenge: this.requirement,
6824
6837
  factors: this.offeredFactors()
6825
6838
  });
6826
6839
  }
6827
6840
  offeredFactors() {
6828
6841
  let e = this.available.filter((e) => !this.pruned.has(e.type)), t = this.requirement;
6829
- return t ? Vo(e, t) : e;
6842
+ return t ? Go(e, t) : e;
6830
6843
  }
6831
6844
  receiveReport(e, t) {
6832
6845
  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());
@@ -6857,11 +6870,11 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
6857
6870
  try {
6858
6871
  this.onFlightSettled?.(t);
6859
6872
  } catch {}
6860
- this.state = "done", 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.reportsSettled = void 0, this.state = "idle";
6873
+ this.state = "done", 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.heldCode = null, this.codeSent = null, this.codeSentChallenge = null, this.reportsSettled = void 0, this.state = "idle";
6861
6874
  }
6862
6875
  release(e, t) {
6863
6876
  if (e.entry.kind === "imperative") {
6864
- if (e.statedBar && !$o(t, e.demanded)) {
6877
+ if (e.statedBar && !rs(t, e.demanded)) {
6865
6878
  this.receiveReport(e, {
6866
6879
  outcome: "insufficient",
6867
6880
  obtained: t,
@@ -6936,52 +6949,52 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
6936
6949
  async prove() {
6937
6950
  let e;
6938
6951
  for (let t = 0; t < this.maxAttempts; t++) {
6939
- let t = qo(this.requirement);
6940
- if (t) return {
6952
+ let n = Zo(this.requirement);
6953
+ if (n) return {
6941
6954
  status: "failed",
6942
- reason: t
6955
+ reason: n
6943
6956
  };
6944
- let n = this.offeredFactors();
6945
- if (n.length === 0) return {
6957
+ let r = this.offeredFactors();
6958
+ if (r.length === 0) return {
6946
6959
  status: "failed",
6947
- reason: new Jo()
6960
+ reason: new Qo()
6948
6961
  };
6949
- let r = this.requirement, i;
6962
+ let i = this.requirement, a;
6950
6963
  try {
6951
- i = await this.collect(r, n, e);
6964
+ a = await this.collect(i, r, e);
6952
6965
  } catch (e) {
6953
6966
  return {
6954
6967
  status: "failed",
6955
- reason: new Ho(e)
6968
+ reason: new Ko(e)
6956
6969
  };
6957
6970
  }
6958
- let a = qo(this.requirement);
6959
- if (a) return {
6971
+ let o = Zo(this.requirement);
6972
+ if (o) return {
6960
6973
  status: "failed",
6961
- reason: a
6974
+ reason: o
6962
6975
  };
6963
- if (i.type === "cancel") return {
6976
+ if (a.type === "cancel") return {
6964
6977
  status: "failed",
6965
- reason: new Ho()
6978
+ reason: new Ko()
6966
6979
  };
6967
- let o = this.registry.get(i.factor);
6968
- if (!o) e = new Jo(`Unknown authentication factor: ${i.factor}`), this.state = "collecting", this.selected = null;
6980
+ let s = this.registry.get(a.factor);
6981
+ if (!s) e = new Qo(`Unknown authentication factor: ${a.factor}`), this.state = "collecting", this.selected = null;
6969
6982
  else try {
6970
- return await this.proveAndCommit(o, i.code), {
6983
+ return await this.proveAndCommit(s, a.code, t < this.maxAttempts - 1), {
6971
6984
  status: "proven",
6972
- obtained: this.readObtainedBar?.() ?? Qo(this.rankedRequirement ?? r)
6985
+ obtained: this.readObtainedBar?.() ?? ns(this.rankedRequirement ?? i)
6973
6986
  };
6974
6987
  } catch (t) {
6975
6988
  if (t instanceof Ao && t.cancelled) return {
6976
6989
  status: "failed",
6977
- reason: new Ho()
6990
+ reason: new Ko()
6978
6991
  };
6979
6992
  let n = this.classifyProofFailure(t);
6980
6993
  if (n) return {
6981
6994
  status: "failed",
6982
6995
  reason: n
6983
6996
  };
6984
- t instanceof $ && t.kind === "not_registered" && this.pruned.add(o.type), e = t, this.state = "collecting", this.selected = null;
6997
+ t instanceof $ && t.kind === "not_registered" && this.pruned.add(s.type), e = t, this.state = "collecting", this.selected = null;
6985
6998
  }
6986
6999
  }
6987
7000
  return {
@@ -6997,8 +7010,18 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
6997
7010
  challenge: e,
6998
7011
  factors: t,
6999
7012
  ...n ? { previousError: n } : {},
7013
+ ...this.codeSent ? { codeSent: this.codeSent } : {},
7000
7014
  onFactorSelected: (e) => {
7001
7015
  this.state === "collecting" && (this.state = "proving"), this.selected = e, this.rankedRequirement = this.requirement;
7016
+ let t = this.registry.get(e);
7017
+ this.openPrompt === r && t && Ro(t) && this.heldCode?.factor !== e && this.sendCode(e).catch(() => void 0);
7018
+ },
7019
+ resend: async (e) => {
7020
+ let t = this.registry.get(e);
7021
+ if (!t || !Ro(t)) throw new Ao(e, "This factor does not send a code");
7022
+ if (this.openPrompt !== r) throw new Ao(e, "This step-up has ended");
7023
+ if (await this.sendCode(e, !0), !this.codeSent || this.codeSent.factor !== e) throw new Ao(e, "The server sent no code");
7024
+ return this.codeSent;
7002
7025
  }
7003
7026
  };
7004
7027
  this.openPrompt = r;
@@ -7023,36 +7046,89 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7023
7046
  default: return;
7024
7047
  }
7025
7048
  }
7026
- async proveAndCommit(e, t) {
7027
- let n = e.requiresPrepare ? await this.transport.prepare(e.type) : void 0, r = await e.assert({
7049
+ async proveAndCommit(e, t, n) {
7050
+ if (Ro(e)) {
7051
+ await this.proveSentCode(e, t, n);
7052
+ return;
7053
+ }
7054
+ let r = e.requiresPrepare ? await this.transport.prepare(e.type) : void 0, i = await e.assert({
7028
7055
  code: t,
7029
- prepared: n,
7056
+ prepared: r,
7030
7057
  platform: this.platform
7031
7058
  });
7032
- await this.transport.commit(e.type, r);
7059
+ await this.transport.commit(e.type, i);
7060
+ }
7061
+ async proveSentCode(e, t, n) {
7062
+ this.heldCode?.factor !== e.type && this.sendCode(e.type).catch(() => void 0);
7063
+ let r = this.heldCode, i;
7064
+ try {
7065
+ i = await r.prepared;
7066
+ } catch (e) {
7067
+ throw this.heldCode === r && (this.heldCode = null), e;
7068
+ }
7069
+ let a = await e.assert({
7070
+ code: t,
7071
+ prepared: i,
7072
+ platform: this.platform
7073
+ });
7074
+ try {
7075
+ await this.transport.commit(e.type, a);
7076
+ } catch (t) {
7077
+ if (t instanceof $ && t.kind === "challenge_spent") {
7078
+ if (!n) this.heldCode = null;
7079
+ else {
7080
+ let t = this.sendCode(e.type), n = this.heldCode;
7081
+ try {
7082
+ await t;
7083
+ } catch (e) {
7084
+ throw this.heldCode === n && (this.heldCode = null), e;
7085
+ }
7086
+ }
7087
+ }
7088
+ throw t;
7089
+ }
7090
+ this.heldCode = null, this.codeSent = null, this.codeSentChallenge = null;
7091
+ }
7092
+ sendCode(e, t = !1) {
7093
+ let n = this.heldCode?.factor === e ? {
7094
+ hold: this.heldCode,
7095
+ codeSent: this.codeSent,
7096
+ challenge: this.codeSentChallenge
7097
+ } : null, r = this.transport.prepare(e, t ? { resend: !0 } : void 0), i = {
7098
+ factor: e,
7099
+ prepared: r
7100
+ };
7101
+ return this.heldCode = i, n || (this.codeSent = null, this.codeSentChallenge = null), r.then((t) => (this.heldCode === i && (this.codeSent = t ? {
7102
+ factor: e,
7103
+ expiresAt: t.expiresAt,
7104
+ ...t.codeSentTo ? { codeSentTo: t.codeSentTo } : {},
7105
+ resent: n?.challenge != null && n.challenge !== t.challengeId
7106
+ } : null, this.codeSentChallenge = t?.challengeId ?? null, this.codeSent && this.openPrompt?.onCodeSent?.(this.codeSent)), t), (e) => {
7107
+ throw this.heldCode === i && n && t && (this.heldCode = n.hold, this.codeSent = n.codeSent, this.codeSentChallenge = n.challenge), e;
7108
+ });
7033
7109
  }
7034
- }, rs = (e) => typeof e == "function" ? e() : e, is = (e) => {
7110
+ }, ss = (e) => typeof e == "function" ? e() : e, cs = (e) => {
7035
7111
  try {
7036
7112
  return new URL(e);
7037
7113
  } catch {
7038
7114
  return;
7039
7115
  }
7040
- }, as = (e, t) => {
7116
+ }, ls = (e, t) => {
7041
7117
  if (!t || t === "/") return !0;
7042
7118
  let n = t.replace(/\/+$/, "");
7043
7119
  return e === n || e.startsWith(`${n}/`);
7044
- }, os = (e, t) => !t || e.origin === void 0 ? !1 : e.origin === t.origin && as(e.pathname, t.pathPrefix), ss = (e, t) => {
7120
+ }, us = (e, t) => !t || e.origin === void 0 ? !1 : e.origin === t.origin && ls(e.pathname, t.pathPrefix), ds = (e, t) => {
7045
7121
  for (let n of t) {
7046
7122
  if (n === "") continue;
7047
7123
  if (n.startsWith("/")) {
7048
- if (e.relativeToBase && as(e.pathname, n)) return !0;
7124
+ if (e.relativeToBase && ls(e.pathname, n)) return !0;
7049
7125
  continue;
7050
7126
  }
7051
- let t = is(n) ?? is(`https://${n}`);
7052
- if (t && e.origin !== void 0 && e.origin === t.origin && as(e.pathname, t.pathname)) return !0;
7127
+ let t = cs(n) ?? cs(`https://${n}`);
7128
+ if (t && e.origin !== void 0 && e.origin === t.origin && ls(e.pathname, t.pathname)) return !0;
7053
7129
  }
7054
7130
  return !1;
7055
- }, cs = (e, t, n) => os(e, t.passflow) || ss(e, t.backend) ? !n || n(e.href) !== !1 : !1, ls = (e) => {
7131
+ }, fs = (e, t, n) => us(e, t.passflow) || ds(e, t.backend) ? !n || n(e.href) !== !1 : !1, ps = (e) => {
7056
7132
  let t = e.detail, n = t?.message ?? `[passflow] upgrade challenge not actioned: ${e.reason}`;
7057
7133
  console.warn(n, {
7058
7134
  status: e.status,
@@ -7060,8 +7136,8 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7060
7136
  reason: e.reason,
7061
7137
  detail: t
7062
7138
  });
7063
- }, us = (e, t) => {
7064
- let n = t.onUpgradeDiagnostic ?? ls;
7139
+ }, ms = (e, t) => {
7140
+ let n = t.onUpgradeDiagnostic ?? ps;
7065
7141
  return (t, r) => {
7066
7142
  n({
7067
7143
  status: e.status,
@@ -7073,8 +7149,8 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7073
7149
  }
7074
7150
  });
7075
7151
  };
7076
- }, ds = (e, t, n) => {
7077
- let r = n.onUpgradeDiagnostic ?? ls;
7152
+ }, hs = (e, t, n) => {
7153
+ let r = n.onUpgradeDiagnostic ?? ps;
7078
7154
  for (let n of e) r({
7079
7155
  ...n,
7080
7156
  url: t.request.href,
@@ -7083,8 +7159,8 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7083
7159
  ...n.detail ?? {}
7084
7160
  }
7085
7161
  });
7086
- }, fs = /\bjson\b/i, ps = async (e, t) => {
7087
- let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n && fs.test(r), a;
7162
+ }, gs = /\bjson\b/i, _s = async (e, t) => {
7163
+ let n = t.requireChallengeChannel === "header", r = e.getHeader("content-type") ?? "", i = !n && gs.test(r), a;
7088
7164
  if (i) try {
7089
7165
  a = await e.readBody();
7090
7166
  } catch {
@@ -7098,10 +7174,10 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7098
7174
  status: e.status,
7099
7175
  getHeader: (t) => e.getHeader(t) ?? void 0
7100
7176
  }, { requireChallengeChannel: t.requireChallengeChannel });
7101
- }, ms = (e) => Ue({
7177
+ }, vs = (e) => Ue({
7102
7178
  status: e.status,
7103
7179
  getHeader: (t) => e.getHeader(t) ?? void 0
7104
- }, { requireChallengeChannel: "header" }).challenge, hs = (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.`, gs = (e, t) => e instanceof Ho ? { kind: "cancelled" } : e instanceof Uo ? { kind: "sign-in-required" } : e instanceof Jo ? {
7180
+ }, { requireChallengeChannel: "header" }).challenge, ys = (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.`, bs = (e, t) => e instanceof Ko ? { kind: "cancelled" } : e instanceof qo ? { kind: "sign-in-required" } : e instanceof Qo ? {
7105
7181
  kind: "unsatisfiable",
7106
7182
  error: e
7107
7183
  } : e instanceof Ga ? { kind: "unavailable" } : e instanceof Ka ? { kind: "session-changed" } : e instanceof Wa ? {
@@ -7120,26 +7196,26 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7120
7196
  kind: "transport-failure",
7121
7197
  retryable: !1,
7122
7198
  error: e instanceof Error ? e : Error(String(e))
7123
- }, _s = async (e, t, n, r) => {
7199
+ }, xs = async (e, t, n, r) => {
7124
7200
  if (e.status !== 401 && e.status !== 403) return {
7125
7201
  kind: "replayed",
7126
7202
  response: e
7127
7203
  };
7128
- let { challenge: i, diagnostics: a } = await ps(e, t);
7129
- if (ds(a, e, t), !i) return {
7204
+ let { challenge: i, diagnostics: a } = await _s(e, t);
7205
+ if (hs(a, e, t), !i) return {
7130
7206
  kind: "replayed",
7131
7207
  response: e
7132
7208
  };
7133
- if (Wo(i)) return {
7209
+ if (Jo(i)) return {
7134
7210
  kind: "sign-in-required",
7135
7211
  response: e
7136
7212
  };
7137
- if (Go(i)) return {
7213
+ if (Yo(i)) return {
7138
7214
  kind: "unsatisfiable",
7139
- error: qo(i),
7215
+ error: Zo(i),
7140
7216
  response: e
7141
7217
  };
7142
- let o = Qo(i);
7218
+ let o = ns(i);
7143
7219
  return r("elevated-insufficient", {
7144
7220
  obtained: n,
7145
7221
  required: o
@@ -7149,7 +7225,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7149
7225
  required: o,
7150
7226
  response: e
7151
7227
  };
7152
- }, vs = async (e, t) => {
7228
+ }, Ss = async (e, t) => {
7153
7229
  if (!t) return {
7154
7230
  aborted: !1,
7155
7231
  value: await e
@@ -7176,14 +7252,14 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7176
7252
  } finally {
7177
7253
  n && t.removeEventListener?.("abort", n);
7178
7254
  }
7179
- }, ys = async (e, t) => {
7255
+ }, Cs = async (e, t) => {
7180
7256
  if (e.status !== 401 && e.status !== 403 || e.markers.upgradeTransaction) return { kind: "not-a-challenge" };
7181
- let n = us(e, t);
7257
+ let n = ms(e, t);
7182
7258
  if (e.markers.replayed) {
7183
- if (!cs(e.request, t.scope, t.shouldIntercept)) return { kind: "not-a-challenge" };
7184
- let { challenge: r, diagnostics: i } = await ps(e, t);
7185
- if (ds(i, e, t), !r) return { kind: "not-a-challenge" };
7186
- let a = t.readObtainedBar?.() ?? {}, o = Qo(r);
7259
+ if (!fs(e.request, t.scope, t.shouldIntercept)) return { kind: "not-a-challenge" };
7260
+ let { challenge: r, diagnostics: i } = await _s(e, t);
7261
+ if (hs(i, e, t), !r) return { kind: "not-a-challenge" };
7262
+ let a = t.readObtainedBar?.() ?? {}, o = ns(r);
7187
7263
  return n("elevated-insufficient", {
7188
7264
  obtained: a,
7189
7265
  required: o
@@ -7194,12 +7270,12 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7194
7270
  response: e
7195
7271
  };
7196
7272
  }
7197
- if (!cs(e.request, t.scope, t.shouldIntercept)) return ms(e) ? (n("challenge-out-of-scope", {
7273
+ if (!fs(e.request, t.scope, t.shouldIntercept)) return vs(e) ? (n("challenge-out-of-scope", {
7198
7274
  header: e.getHeader("www-authenticate") ?? void 0,
7199
- message: hs(e.request.href, t.scope)
7275
+ message: ys(e.request.href, t.scope)
7200
7276
  }), { kind: "out-of-scope" }) : { kind: "not-a-challenge" };
7201
- let { challenge: r, diagnostics: i } = await ps(e, t);
7202
- if (ds(i, e, t), !r) {
7277
+ let { challenge: r, diagnostics: i } = await _s(e, t);
7278
+ if (hs(i, e, t), !r) {
7203
7279
  let r = e.getHeader("www-authenticate");
7204
7280
  return t.requireChallengeChannel !== "header" && n("no-channel", {
7205
7281
  ...r ? { header: r } : {},
@@ -7213,9 +7289,9 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7213
7289
  method: e.request.method
7214
7290
  }, s, c;
7215
7291
  try {
7216
- s = Promise.resolve(t.elevate(r, o)), c = await vs(s, e.signal);
7292
+ s = Promise.resolve(t.elevate(r, o)), c = await Ss(s, e.signal);
7217
7293
  } catch (e) {
7218
- return gs(e, void 0);
7294
+ return bs(e, void 0);
7219
7295
  }
7220
7296
  if (c.aborted) return s?.then((e) => e?.waiter.report({ outcome: "failed" }), () => {}), {
7221
7297
  kind: "aborted",
@@ -7226,7 +7302,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7226
7302
  kind: "aborted",
7227
7303
  reason: e.signal.reason
7228
7304
  };
7229
- let u = l?.obtained ?? t.readObtainedBar?.() ?? Qo(r), d = t.authorizationSwap?.(), f = d ? {
7305
+ let u = l?.obtained ?? t.readObtainedBar?.() ?? ns(r), d = t.authorizationSwap?.(), f = d ? {
7230
7306
  from: a?.from ?? d.from,
7231
7307
  to: d.to
7232
7308
  } : void 0;
@@ -7253,7 +7329,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7253
7329
  };
7254
7330
  throw t;
7255
7331
  }
7256
- let m = await _s(p, t, u, n);
7332
+ let m = await xs(p, t, u, n);
7257
7333
  return m.kind === "insufficient" ? l?.waiter.report({
7258
7334
  outcome: "insufficient",
7259
7335
  obtained: m.obtained,
@@ -7262,11 +7338,11 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7262
7338
  outcome: "replayed",
7263
7339
  obtained: u
7264
7340
  }), m;
7265
- }, bs = (e) => {
7341
+ }, ws = (e) => {
7266
7342
  switch (e.kind) {
7267
- case "cancelled": return new Ho();
7268
- case "unsatisfiable": return e.error ?? new Jo();
7269
- case "sign-in-required": return new Uo();
7343
+ case "cancelled": return new Ko();
7344
+ case "unsatisfiable": return e.error ?? new Qo();
7345
+ case "sign-in-required": return new qo();
7270
7346
  case "unavailable": return new Ga();
7271
7347
  case "session-changed": return new Ka();
7272
7348
  case "insufficient": return new Wa(e.obtained, e.required);
@@ -7274,7 +7350,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7274
7350
  case "transport-failure": return e.error;
7275
7351
  default: return;
7276
7352
  }
7277
- }, xs = (e, t, n) => {
7353
+ }, Ts = (e, t, n) => {
7278
7354
  switch (e.kind) {
7279
7355
  case "replayed": return {
7280
7356
  settle: "resolve",
@@ -7292,26 +7368,26 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7292
7368
  };
7293
7369
  case "cancelled": return n.onCancel === "reject" ? {
7294
7370
  settle: "reject",
7295
- error: new Ho()
7371
+ error: new Ko()
7296
7372
  } : {
7297
7373
  settle: "resolve",
7298
- value: js(t, e)
7374
+ value: Fs(t, e)
7299
7375
  };
7300
7376
  case "unsatisfiable":
7301
7377
  case "sign-in-required": return {
7302
7378
  settle: "resolve",
7303
- value: js(e.response?.raw ?? t, e)
7379
+ value: Fs(e.response?.raw ?? t, e)
7304
7380
  };
7305
7381
  case "insufficient": return {
7306
7382
  settle: "resolve",
7307
- value: js(e.response?.raw ?? t, e)
7383
+ value: Fs(e.response?.raw ?? t, e)
7308
7384
  };
7309
7385
  default: return {
7310
7386
  settle: "resolve",
7311
- value: js(t, e)
7387
+ value: Fs(t, e)
7312
7388
  };
7313
7389
  }
7314
- }, Ss = (e, t) => {
7390
+ }, Es = (e, t) => {
7315
7391
  switch (e.kind) {
7316
7392
  case "replayed": return e.response.rejected ? {
7317
7393
  settle: "reject",
@@ -7326,42 +7402,42 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7326
7402
  };
7327
7403
  default: return {
7328
7404
  settle: "reject",
7329
- error: bs(e) ?? t
7405
+ error: ws(e) ?? t
7330
7406
  };
7331
7407
  }
7332
- }, Cs = /* @__PURE__ */ new WeakSet(), ws = /* @__PURE__ */ new WeakSet(), Ts = /* @__PURE__ */ new WeakSet(), Es = /* @__PURE__ */ new WeakSet(), Ds = /* @__PURE__ */ new WeakSet(), Os = /* @__PURE__ */ new WeakSet(), ks = /* @__PURE__ */ new WeakSet(), As = /* @__PURE__ */ new WeakSet(), js = (e, t) => {
7408
+ }, Ds = /* @__PURE__ */ new WeakSet(), Os = /* @__PURE__ */ new WeakSet(), ks = /* @__PURE__ */ new WeakSet(), As = /* @__PURE__ */ new WeakSet(), js = /* @__PURE__ */ new WeakSet(), Ms = /* @__PURE__ */ new WeakSet(), Ns = /* @__PURE__ */ new WeakSet(), Ps = /* @__PURE__ */ new WeakSet(), Fs = (e, t) => {
7333
7409
  switch (t.kind) {
7334
7410
  case "cancelled":
7335
- Cs.add(e);
7411
+ Ds.add(e);
7336
7412
  break;
7337
7413
  case "exhausted":
7338
- ws.add(e);
7414
+ Os.add(e);
7339
7415
  break;
7340
7416
  case "insufficient":
7341
- Ts.add(e);
7417
+ ks.add(e);
7342
7418
  break;
7343
7419
  case "unsatisfiable":
7344
- Es.add(e);
7420
+ As.add(e);
7345
7421
  break;
7346
7422
  case "sign-in-required":
7347
- Ds.add(e);
7423
+ js.add(e);
7348
7424
  break;
7349
7425
  case "unavailable":
7350
- Os.add(e);
7426
+ Ms.add(e);
7351
7427
  break;
7352
7428
  case "session-changed":
7353
- ks.add(e);
7429
+ Ns.add(e);
7354
7430
  break;
7355
- case "transport-failure": As.add(e);
7431
+ case "transport-failure": Ps.add(e);
7356
7432
  }
7357
7433
  return e;
7358
- }, Ms = (e) => Cs.has(e), Ns = (e) => ws.has(e), Ps = (e) => Ts.has(e), Fs = (e) => Es.has(e), Is = (e) => Ds.has(e), Ls = (e) => Os.has(e), Rs = (e) => ks.has(e), zs = (e) => As.has(e), Bs = "https://passflow-relative.invalid", Vs = () => {
7434
+ }, Is = (e) => Ds.has(e), Ls = (e) => Os.has(e), Rs = (e) => ks.has(e), zs = (e) => As.has(e), Bs = (e) => js.has(e), Vs = (e) => Ms.has(e), Hs = (e) => Ns.has(e), Us = (e) => Ps.has(e), Ws = "https://passflow-relative.invalid", Gs = () => {
7359
7435
  let e = globalThis, t = e.document?.baseURI;
7360
7436
  if (typeof t == "string" && t !== "") return t;
7361
7437
  let n = e.location?.href;
7362
- return typeof n == "string" && n !== "" && n !== "about:blank" ? n : Bs;
7363
- }, Hs = (e, t = Vs()) => {
7364
- let n = t === Bs, r;
7438
+ return typeof n == "string" && n !== "" && n !== "about:blank" ? n : Ws;
7439
+ }, Ks = (e, t = Gs()) => {
7440
+ let n = t === Ws, r;
7365
7441
  try {
7366
7442
  r = new URL(t).origin;
7367
7443
  } catch {
@@ -7387,28 +7463,28 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7387
7463
  relativeToBase: !1,
7388
7464
  sentinelBase: n
7389
7465
  };
7390
- }, Us = (e, t) => typeof t == "string" ? [e.toLowerCase(), t] : void 0, Ws = (e) => {
7466
+ }, qs = (e, t) => typeof t == "string" ? [e.toLowerCase(), t] : void 0, Js = (e) => {
7391
7467
  let t = [];
7392
7468
  if (e == null) return Object.freeze(t);
7393
7469
  let n = e;
7394
7470
  if (typeof n.forEach == "function" && typeof n.entries == "function") return e.forEach((e, n) => {
7395
- let r = Us(n, e);
7471
+ let r = qs(n, e);
7396
7472
  r && t.push(r);
7397
7473
  }), Object.freeze(t);
7398
7474
  if (Array.isArray(e)) {
7399
7475
  for (let n of e) if (Array.isArray(n) && n.length >= 2) {
7400
- let e = Us(String(n[0]), n[1]);
7476
+ let e = qs(String(n[0]), n[1]);
7401
7477
  e && t.push(e);
7402
7478
  }
7403
7479
  return Object.freeze(t);
7404
7480
  }
7405
7481
  if (typeof e == "object") for (let [n, r] of Object.entries(e)) {
7406
- let e = Us(n, Array.isArray(r) ? r.join(", ") : r);
7482
+ let e = qs(n, Array.isArray(r) ? r.join(", ") : r);
7407
7483
  e && t.push(e);
7408
7484
  }
7409
7485
  return Object.freeze(t);
7410
- }, Gs = (e) => {
7411
- let t = e.base === void 0 ? Hs(e.url) : Hs(e.url, e.base), n = {
7486
+ }, Ys = (e) => {
7487
+ let t = e.base === void 0 ? Ks(e.url) : Ks(e.url, e.base), n = {
7412
7488
  raw: e.url,
7413
7489
  href: t.href,
7414
7490
  dispatchUrl: t.sentinelBase || !t.resolved ? e.url : t.href,
@@ -7417,29 +7493,29 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7417
7493
  resolved: t.resolved,
7418
7494
  relativeToBase: t.relativeToBase,
7419
7495
  method: (e.method ?? "GET").toUpperCase(),
7420
- headers: Ws(e.headers),
7496
+ headers: Js(e.headers),
7421
7497
  bodyKind: e.bodyKind,
7422
7498
  ..."body" in e ? { body: e.body } : {}
7423
7499
  };
7424
7500
  return Object.freeze(n);
7425
- }, Ks = (e, t) => {
7501
+ }, Xs = (e, t) => {
7426
7502
  if (!t || t.from === t.to) return e;
7427
7503
  let n = !1, r = e.map(([e, r]) => e === "authorization" && r === t.from ? (n = !0, [e, t.to]) : [e, r]);
7428
7504
  return n ? Object.freeze(r) : e;
7429
- }, qs = (e) => {
7505
+ }, Zs = (e) => {
7430
7506
  let t = {};
7431
7507
  for (let [n, r] of e) t[n] = r;
7432
7508
  return t;
7433
- }, Js = /* @__PURE__ */ new Set([
7509
+ }, Qs = /* @__PURE__ */ new Set([
7434
7510
  "GET",
7435
7511
  "HEAD",
7436
7512
  "OPTIONS"
7437
- ]), Ys = (e) => typeof e == "object" && !!e && typeof e.url == "string" && typeof e.clone == "function" && "method" in e, Xs = (e) => typeof e == "string" ? e : Ys(e) ? e.url : String(e), Zs = (e, t) => (t?.method ?? (Ys(e) ? e.method : void 0) ?? "GET").toUpperCase(), Qs = (e) => e == null ? "none" : typeof e == "string" ? "reusable" : typeof e.getReader == "function" ? "one-shot" : "reusable", $s = (e) => {
7513
+ ]), $s = (e) => typeof e == "object" && !!e && typeof e.url == "string" && typeof e.clone == "function" && "method" in e, ec = (e) => typeof e == "string" ? e : $s(e) ? e.url : String(e), tc = (e, t) => (t?.method ?? ($s(e) ? e.method : void 0) ?? "GET").toUpperCase(), nc = (e) => e == null ? "none" : typeof e == "string" ? "reusable" : typeof e.getReader == "function" ? "one-shot" : "reusable", rc = (e) => {
7438
7514
  if (typeof e == "string") return e.length;
7439
7515
  let t = e;
7440
7516
  if (typeof t?.size == "number") return t.size;
7441
7517
  if (typeof t?.byteLength == "number") return t.byteLength;
7442
- }, ec = (e, t, n) => e === void 0 || e === "always" ? !0 : e === "idempotent-only" ? Js.has(t.method) : typeof e == "function" ? e(t) : !(e.maxBodyBytes !== void 0 && n !== void 0 && n > e.maxBodyBytes), tc = (e, t, n, r, i) => ({
7518
+ }, ic = (e, t, n) => e === void 0 || e === "always" ? !0 : e === "idempotent-only" ? Qs.has(t.method) : typeof e == "function" ? e(t) : !(e.maxBodyBytes !== void 0 && n !== void 0 && n > e.maxBodyBytes), ac = (e, t, n, r, i) => ({
7443
7519
  replayable: !1,
7444
7520
  bodyKind: e,
7445
7521
  reason: t,
@@ -7447,11 +7523,11 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7447
7523
  forwardInit: i,
7448
7524
  snapshot: r,
7449
7525
  replay: () => Promise.reject(/* @__PURE__ */ Error(`This request cannot be replayed: ${t}`))
7450
- }), nc = (e, t) => qs(Ks(e.headers, t?.authorizationSwap)), rc = (e) => {
7526
+ }), oc = (e, t) => Zs(Xs(e.headers, t?.authorizationSwap)), sc = (e) => {
7451
7527
  if (!e || !("headers" in e)) return e;
7452
7528
  let { headers: t, ...n } = e;
7453
7529
  return n;
7454
- }, ic = (e, t) => t && "headers" in t && t.headers !== void 0 ? t.headers : Ys(e) ? e.headers : void 0, ac = (e) => {
7530
+ }, cc = (e, t) => t && "headers" in t && t.headers !== void 0 ? t.headers : $s(e) ? e.headers : void 0, lc = (e) => {
7455
7531
  if (e === null || typeof e == "string") return e;
7456
7532
  if (typeof FormData < "u" && e instanceof FormData) {
7457
7533
  let t = new FormData();
@@ -7459,18 +7535,18 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7459
7535
  return t;
7460
7536
  }
7461
7537
  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;
7462
- }, oc = (e, t, n) => new Request(e, { headers: nc(t, n) }), sc = (e, t, n) => {
7463
- let r = Xs(e), i = Zs(e, t), a = ic(e, t), o = (e, t) => Gs({
7538
+ }, uc = (e, t, n) => new Request(e, { headers: oc(t, n) }), dc = (e, t, n) => {
7539
+ let r = ec(e), i = tc(e, t), a = cc(e, t), o = (e, t) => Ys({
7464
7540
  url: r,
7465
7541
  method: i,
7466
7542
  headers: a,
7467
7543
  bodyKind: e,
7468
7544
  ...t === void 0 ? {} : { body: t }
7469
7545
  });
7470
- if (Ys(e)) {
7546
+ if ($s(e)) {
7471
7547
  if (e.body === null || e.body === void 0) {
7472
7548
  let a = o("none");
7473
- return ec(n, {
7549
+ return ic(n, {
7474
7550
  url: r,
7475
7551
  method: i,
7476
7552
  bodyKind: "none"
@@ -7480,20 +7556,20 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7480
7556
  forwardInput: e,
7481
7557
  forwardInit: t,
7482
7558
  snapshot: a,
7483
- replay: (n, r) => n(oc(e, a, r), rc(t))
7484
- } : tc("none", "the replay policy refused this request", e, a, t);
7559
+ replay: (n, r) => n(uc(e, a, r), sc(t))
7560
+ } : ac("none", "the replay policy refused this request", e, a, t);
7485
7561
  }
7486
7562
  let a = o("request-clone");
7487
- if (!ec(n, {
7563
+ if (!ic(n, {
7488
7564
  url: r,
7489
7565
  method: i,
7490
7566
  bodyKind: "request-clone"
7491
- })) return tc("request-clone", "the replay policy refused this request", e, a, t);
7567
+ })) return ac("request-clone", "the replay policy refused this request", e, a, t);
7492
7568
  let s;
7493
7569
  try {
7494
7570
  s = e.clone();
7495
7571
  } catch {
7496
- return tc("one-shot", "the Request body was already consumed and cannot be cloned", e, a, t);
7572
+ return ac("one-shot", "the Request body was already consumed and cannot be cloned", e, a, t);
7497
7573
  }
7498
7574
  return {
7499
7575
  replayable: !0,
@@ -7501,17 +7577,17 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7501
7577
  forwardInput: e,
7502
7578
  forwardInit: t,
7503
7579
  snapshot: a,
7504
- replay: (e, n) => e(oc(s, a, n), rc(t))
7580
+ replay: (e, n) => e(uc(s, a, n), sc(t))
7505
7581
  };
7506
7582
  }
7507
- let s = Qs(t?.body);
7508
- if (s === "one-shot") return tc("one-shot", "a streaming request body is consumed by the first send", e, o("one-shot"), t);
7509
- if (!ec(n, {
7583
+ let s = nc(t?.body);
7584
+ if (s === "one-shot") return ac("one-shot", "a streaming request body is consumed by the first send", e, o("one-shot"), t);
7585
+ if (!ic(n, {
7510
7586
  url: r,
7511
7587
  method: i,
7512
7588
  bodyKind: s
7513
- }, $s(t?.body))) return tc(s, "the replay policy refused this request", e, o(s), t);
7514
- let c = t && "body" in t ? ac(t.body ?? null) : void 0, l = o(s, c);
7589
+ }, rc(t?.body))) return ac(s, "the replay policy refused this request", e, o(s), t);
7590
+ let c = t && "body" in t ? lc(t.body ?? null) : void 0, l = o(s, c);
7515
7591
  return {
7516
7592
  replayable: !0,
7517
7593
  bodyKind: s,
@@ -7519,21 +7595,21 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7519
7595
  forwardInit: t,
7520
7596
  snapshot: l,
7521
7597
  replay: (e, n) => e(l.dispatchUrl, {
7522
- ...rc(t),
7598
+ ...sc(t),
7523
7599
  ...c === void 0 ? {} : { body: c },
7524
- headers: nc(l, n),
7600
+ headers: oc(l, n),
7525
7601
  method: l.method
7526
7602
  })
7527
7603
  };
7528
- }, cc = (e) => typeof e == "object" && !!e, lc = (e) => (t) => {
7529
- if (!cc(e)) return;
7604
+ }, fc = (e) => typeof e == "object" && !!e, pc = (e) => (t) => {
7605
+ if (!fc(e)) return;
7530
7606
  let n = e[t] ?? e[t.toLowerCase()] ?? (typeof e.get == "function" ? e.get(t) : void 0);
7531
7607
  return Array.isArray(n) ? n.join(", ") : typeof n == "string" ? n : void 0;
7532
- }, uc = (e) => {
7608
+ }, mc = (e) => {
7533
7609
  let t = e?.url ?? "", n = e?.baseURL;
7534
7610
  return !n || /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t) ? t : `${n.replace(/\/+$/, "")}/${t.replace(/^\/+/, "")}`;
7535
- }, dc = (e) => (e?.method ?? "GET").toUpperCase(), fc = (e) => e == null ? "none" : cc(e) && (typeof e.pipe == "function" || typeof e.getReader == "function") ? "one-shot" : "reusable", pc = (e, t, n) => {
7536
- let r = qs(Ks(t.headers, n?.authorizationSwap)), i = t.dispatchUrl === t.href && t.resolved;
7611
+ }, hc = (e) => (e?.method ?? "GET").toUpperCase(), gc = (e) => e == null ? "none" : fc(e) && (typeof e.pipe == "function" || typeof e.getReader == "function") ? "one-shot" : "reusable", _c = (e, t, n) => {
7612
+ let r = Zs(Xs(t.headers, n?.authorizationSwap)), i = t.dispatchUrl === t.href && t.resolved;
7537
7613
  return {
7538
7614
  ...e,
7539
7615
  ...i ? { baseURL: void 0 } : {},
@@ -7542,10 +7618,10 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7542
7618
  headers: r,
7543
7619
  ..."body" in t ? { data: t.body } : {}
7544
7620
  };
7545
- }, mc = (e, t, n, r, i, a) => {
7546
- let o = t ?? e?.config, s = fc(o?.data), c = a ?? Gs({
7547
- url: uc(o),
7548
- method: dc(o),
7621
+ }, vc = (e, t, n, r, i, a) => {
7622
+ let o = t ?? e?.config, s = gc(o?.data), c = a ?? Ys({
7623
+ url: mc(o),
7624
+ method: hc(o),
7549
7625
  headers: o?.headers,
7550
7626
  bodyKind: s,
7551
7627
  body: o?.data
@@ -7553,22 +7629,22 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7553
7629
  url: c.href,
7554
7630
  method: c.method,
7555
7631
  bodyKind: s
7556
- }, u = s !== "one-shot" && ec(i.replay, l);
7632
+ }, u = s !== "one-shot" && ic(i.replay, l);
7557
7633
  return {
7558
7634
  status: e?.status ?? 0,
7559
- getHeader: lc(e?.headers),
7635
+ getHeader: pc(e?.headers),
7560
7636
  readBody: async () => e?.data,
7561
7637
  request: c,
7562
7638
  replay: async (e) => {
7563
- let t = Xe(pc(o ?? {}, c, e));
7639
+ let t = Xe(_c(o ?? {}, c, e));
7564
7640
  try {
7565
7641
  let e = await r(t);
7566
- return mc(e, e?.config ?? t, e, r, i, c);
7642
+ return vc(e, e?.config ?? t, e, r, i, c);
7567
7643
  } catch (e) {
7568
- let n = cc(e) ? e : {};
7644
+ let n = fc(e) ? e : {};
7569
7645
  if (!n.response || typeof n.response.status != "number" || Pa(e)) throw e;
7570
7646
  return {
7571
- ...mc(n.response, n.config ?? t, e, r, i, c),
7647
+ ...vc(n.response, n.config ?? t, e, r, i, c),
7572
7648
  rejected: !0
7573
7649
  };
7574
7650
  }
@@ -7582,30 +7658,30 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7582
7658
  replayUnsupportedReason: s === "one-shot" ? "a streaming request body is consumed by the first send" : "the replay policy refused this request",
7583
7659
  signal: o?.signal
7584
7660
  };
7585
- }, hc = (e, t) => async (n) => {
7586
- let r = rs(e), i = cc(n) ? n : {}, a = Ss(await ys(mc(i.response, i.config, i.response, t, r), r), n);
7661
+ }, yc = (e, t) => async (n) => {
7662
+ let r = ss(e), i = fc(n) ? n : {}, a = Es(await Cs(vc(i.response, i.config, i.response, t, r), r), n);
7587
7663
  if (a.settle === "reject") throw a.error;
7588
7664
  return a.value;
7589
- }, gc = (e, t, n) => {
7590
- 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, hc(t, i)), o = !1;
7665
+ }, bc = (e, t, n) => {
7666
+ 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, yc(t, i)), o = !1;
7591
7667
  return () => {
7592
7668
  o || (o = !0, e.interceptors.response.eject(a));
7593
7669
  };
7594
- }, _c = (t, n) => {
7670
+ }, xc = (t, n) => {
7595
7671
  let r = e.create(t);
7596
7672
  return n(r), r;
7597
- }, vc = () => {
7673
+ }, Sc = () => {
7598
7674
  let e = typeof location > "u" ? void 0 : location.origin;
7599
7675
  return e && e !== "null" ? e : void 0;
7600
- }, yc = (e) => {
7676
+ }, Cc = (e) => {
7601
7677
  let t = new URL(e).origin;
7602
7678
  if (t === "null") throw Error(`Passflow: "${e}" has no origin a request can be matched against; list http(s) origins only.`);
7603
7679
  return t;
7604
- }, bc = (e, t) => {
7605
- let n = (t?.origins ?? []).map(yc);
7680
+ }, wc = (e, t) => {
7681
+ let n = (t?.origins ?? []).map(Cc);
7606
7682
  return (t, r) => {
7607
7683
  if (r) return Promise.resolve(void 0);
7608
- let i = vc(), a;
7684
+ let i = Sc(), a;
7609
7685
  try {
7610
7686
  a = new URL(t, i).origin;
7611
7687
  } catch {
@@ -7613,22 +7689,22 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7613
7689
  }
7614
7690
  return a !== i && !n.includes(a) ? Promise.resolve(void 0) : e();
7615
7691
  };
7616
- }, xc = (e) => typeof Request < "u" && e instanceof Request, Sc = (e, t) => new Headers(t?.headers === void 0 ? xc(e) ? e.headers : void 0 : t.headers), Cc = (e, t, n) => {
7617
- let r = bc(t, n);
7692
+ }, Tc = (e) => typeof Request < "u" && e instanceof Request, Ec = (e, t) => new Headers(t?.headers === void 0 ? Tc(e) ? e.headers : void 0 : t.headers), Dc = (e, t, n) => {
7693
+ let r = wc(t, n);
7618
7694
  return async (t, n) => {
7619
- let i = xc(t) ? t.url : t instanceof URL ? t.href : String(t), a = Sc(t, n), o = await r(i, a.has("authorization"));
7695
+ let i = Tc(t) ? t.url : t instanceof URL ? t.href : String(t), a = Ec(t, n), o = await r(i, a.has("authorization"));
7620
7696
  return o ? (a.set("authorization", `Bearer ${o}`), e(t, {
7621
7697
  ...n,
7622
7698
  headers: a
7623
7699
  })) : e(t, n);
7624
7700
  };
7625
- }, wc = (e) => {
7701
+ }, Oc = (e) => {
7626
7702
  let t = e.url ?? "", n = /^([a-z][a-z\d+\-.]*:)?\/\//i.test(t);
7627
7703
  return !e.baseURL || n && e.allowAbsoluteUrls !== !1 ? t : t ? `${e.baseURL.replace(/\/?\/$/, "")}/${t.replace(/^\/+/, "")}` : e.baseURL;
7628
- }, Tc = (e) => e ? typeof e.has == "function" ? e.has("Authorization") : Object.keys(e).some((t) => t.toLowerCase() === "authorization" && e[t] != null) : !1, Ec = (e, t) => {
7629
- let n = bc(e, t);
7704
+ }, kc = (e) => e ? typeof e.has == "function" ? e.has("Authorization") : Object.keys(e).some((t) => t.toLowerCase() === "authorization" && e[t] != null) : !1, Ac = (e, t) => {
7705
+ let n = wc(e, t);
7630
7706
  return async (e) => {
7631
- let t = e.headers, r = await n(wc(e), Tc(t));
7707
+ let t = e.headers, r = await n(Oc(e), kc(t));
7632
7708
  if (!r) return e;
7633
7709
  let i = `Bearer ${r}`;
7634
7710
  return t && typeof t.set == "function" ? t.set("Authorization", i) : e.headers = {
@@ -7636,7 +7712,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7636
7712
  Authorization: i
7637
7713
  }, e;
7638
7714
  };
7639
- }, Dc = 0, Oc = (e, t) => {
7715
+ }, jc = 0, Mc = (e, t) => {
7640
7716
  let n = t?.signal ?? (typeof e == "object" && e ? e.signal : void 0) ?? void 0;
7641
7717
  if (n) return {
7642
7718
  get aborted() {
@@ -7650,34 +7726,34 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7650
7726
  removeEventListener: (e, t) => n.removeEventListener(e, t)
7651
7727
  } : {}
7652
7728
  };
7653
- }, kc = (e) => (t) => e.headers?.get(t), Ac = (e, t, n, r, i) => ({
7729
+ }, Nc = (e) => (t) => e.headers?.get(t), Pc = (e, t, n, r, i) => ({
7654
7730
  status: e.status,
7655
- getHeader: kc(e),
7731
+ getHeader: Nc(e),
7656
7732
  readBody: () => e.clone().json(),
7657
7733
  request: t.snapshot,
7658
- replay: async (e) => Ac(await t.replay(n, e), t, n, r, i),
7734
+ replay: async (e) => Pc(await t.replay(n, e), t, n, r, i),
7659
7735
  markers: r,
7660
7736
  raw: e,
7661
7737
  replayable: t.replayable,
7662
7738
  replayUnsupportedReason: t.reason,
7663
7739
  signal: i,
7664
7740
  responseType: e.type
7665
- }), jc = (e, t) => {
7741
+ }), Fc = (e, t) => {
7666
7742
  let n = (t, n) => {
7667
- Dc += 1;
7743
+ jc += 1;
7668
7744
  try {
7669
7745
  return e(t, n);
7670
7746
  } finally {
7671
- --Dc;
7747
+ --jc;
7672
7748
  }
7673
7749
  };
7674
7750
  return async (e, r) => {
7675
- if (Dc > 0) return n(e, r);
7676
- let i = rs(t), a = sc(e, r, i.replay), o = await n(a.forwardInput, a.forwardInit), s = xs(await ys(Ac(o, a, n, {}, Oc(e, r)), i), o, i);
7751
+ if (jc > 0) return n(e, r);
7752
+ let i = ss(t), a = dc(e, r, i.replay), o = await n(a.forwardInput, a.forwardInit), s = Ts(await Cs(Pc(o, a, n, {}, Mc(e, r)), i), o, i);
7677
7753
  if (s.settle === "reject") throw s.error;
7678
7754
  return s.value;
7679
7755
  };
7680
- }, Mc = new Set(Fo.filter((e) => !e.requiresPrepare).map((e) => e.type)), Nc = (e) => {
7756
+ }, Ic = new Set(zo.filter((e) => !e.requiresPrepare).map((e) => e.type)), Lc = (e) => {
7681
7757
  if (!e || typeof e != "object" || !e.challenge_id || !e.expires_at) throw new $({
7682
7758
  kind: "protocol",
7683
7759
  message: "The upgrade start response is missing challenge_id or expires_at"
@@ -7689,16 +7765,17 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7689
7765
  webauthn: e.webauthn,
7690
7766
  codeSentTo: e.code_sent_to
7691
7767
  };
7692
- }, Pc = (e) => Pa(e) && !Fa(e), Fc = (e) => ({
7693
- async prepare(t) {
7694
- if (!Mc.has(t)) try {
7695
- let n = e.relyingPartyId?.();
7696
- return Nc(await e.startUpgrade(n ? {
7768
+ }, Rc = (e) => Pa(e) && !Fa(e), zc = (e) => ({
7769
+ async prepare(t, n) {
7770
+ if (!Ic.has(t)) try {
7771
+ let r = e.relyingPartyId?.();
7772
+ return Lc(await e.startUpgrade({
7697
7773
  method: t,
7698
- relying_party_id: n
7699
- } : { method: t }));
7774
+ ...r ? { relying_party_id: r } : {},
7775
+ ...n?.resend ? { resend: !0 } : {}
7776
+ }));
7700
7777
  } catch (e) {
7701
- if (Pc(e)) throw e;
7778
+ if (Rc(e)) throw e;
7702
7779
  let t = Va(e, "start");
7703
7780
  if (t.kind === "prepare_not_required") return;
7704
7781
  throw t;
@@ -7716,17 +7793,17 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7716
7793
  assertion: n
7717
7794
  });
7718
7795
  } catch (t) {
7719
- if (Pc(t)) throw t;
7796
+ if (Rc(t)) throw t;
7720
7797
  let n = Va(t, "refresh");
7721
7798
  throw n.status === 401 && Ua(n) && e.markSessionInvalid?.(), n;
7722
7799
  }
7723
7800
  }
7724
- }), Ic = (e) => e === void 0 ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e !== ""), Lc = (e) => {
7801
+ }), Bc = (e) => e === void 0 ? [] : (Array.isArray(e) ? e : [e]).filter((e) => e !== ""), Vc = (e) => {
7725
7802
  let t, n = (e) => e !== void 0 && t === e, r = (r) => {
7726
7803
  let i = () => {
7727
7804
  if (!n(r())) throw new $({ kind: "session_changed" });
7728
7805
  };
7729
- return Fc({
7806
+ return zc({
7730
7807
  ...e,
7731
7808
  relyingPartyId: () => t?.options.relyingPartyId ?? e.relyingPartyId?.(),
7732
7809
  startUpgrade: (t) => (i(), e.startUpgrade(t)),
@@ -7737,7 +7814,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7737
7814
  });
7738
7815
  }, i = (t, n) => {
7739
7816
  let i = {}, a = {
7740
- controller: new ns({
7817
+ controller: new os({
7741
7818
  transport: r(() => i.current),
7742
7819
  prompt: t.prompt,
7743
7820
  platform: e.platform,
@@ -7749,7 +7826,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7749
7826
  options: t,
7750
7827
  scope: {
7751
7828
  passflow: e.passflowDomain,
7752
- backend: Ic(t.backend)
7829
+ backend: Bc(t.backend)
7753
7830
  },
7754
7831
  generation: n
7755
7832
  };
@@ -7759,14 +7836,14 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7759
7836
  s = void 0;
7760
7837
  });
7761
7838
  let c = (e) => {
7762
- if (!s || ts(s.challenge, e)) return;
7839
+ if (!s || as(s.challenge, e)) return;
7763
7840
  let t = Math.min(o, e.maxAge === void 0 ? o : e.maxAge * 1e3);
7764
7841
  if (!(Date.now() - s.at > t)) return s.challenge;
7765
7842
  }, l = async (r, i) => {
7766
7843
  let o = t;
7767
7844
  if (!o) throw new Ga("Step-up verification is not enabled on this Passflow instance");
7768
7845
  let l = e.stopRepeatedElevation ? c(r) : void 0;
7769
- if (l) throw new Wa(Qo(l), Qo(r), "This requirement was already proved and the server still refused it: sign the user in again");
7846
+ if (l) throw new Wa(ns(l), ns(r), "This requirement was already proved and the server still refused it: sign the user in again");
7770
7847
  o.controller.active || (o.pin = e.readSessionPin?.());
7771
7848
  let u = await o.controller.elevate(r, i);
7772
7849
  if (!n(o)) throw new Ka();
@@ -7816,9 +7893,9 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7816
7893
  let r = [];
7817
7894
  if (e.attachInternalSeam) {
7818
7895
  let t = e.attachInternalSeam;
7819
- t((e) => hc(u, e)), r.push(() => t(void 0));
7896
+ t((e) => yc(u, e)), r.push(() => t(void 0));
7820
7897
  }
7821
- n.interceptFetch && r.push(ur((e, t, n) => jc(e, u)(t, n), {
7898
+ n.interceptFetch && r.push(ur((e, t, n) => Fc(e, u)(t, n), {
7822
7899
  priority: 20,
7823
7900
  name: "passflow-upgrade"
7824
7901
  })), e.onSessionChange && r.push(e.onSessionChange(() => {
@@ -7850,8 +7927,8 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7850
7927
  enumerable: !0,
7851
7928
  value: (t, n) => {
7852
7929
  let r = (t) => {
7853
- let r = jc(t, u);
7854
- return e.readAccessToken ? Cc(r, e.readAccessToken, n) : r;
7930
+ let r = Fc(t, u);
7931
+ return e.readAccessToken ? Dc(r, e.readAccessToken, n) : r;
7855
7932
  };
7856
7933
  if (t) return r(t);
7857
7934
  let i = typeof globalThis > "u" ? void 0 : globalThis;
@@ -7862,14 +7939,14 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7862
7939
  attachAuth: {
7863
7940
  enumerable: !0,
7864
7941
  value: (t, n) => {
7865
- let r = e.readAccessToken ? t.interceptors.request : void 0, i = r?.use(Ec(e.readAccessToken, n)), a = gc(t, u);
7942
+ let r = e.readAccessToken ? t.interceptors.request : void 0, i = r?.use(Ac(e.readAccessToken, n)), a = bc(t, u);
7866
7943
  return () => {
7867
7944
  a(), r && i !== void 0 && r.eject(i);
7868
7945
  };
7869
7946
  }
7870
7947
  }
7871
7948
  });
7872
- }, Rc, zc = class {
7949
+ }, Hc, Uc = class {
7873
7950
  get origin() {
7874
7951
  return this.platform.getCurrentUrl()?.origin ?? "";
7875
7952
  }
@@ -7913,7 +7990,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7913
7990
  ...e.antiBotWorkerUrl ? { workerUrl: e.antiBotWorkerUrl } : {}
7914
7991
  }), this.authApi.setAntiBotHandler((e) => this.antiBot.headerFor(e)), this.riskIds = di({ readSettings: () => this.readAppSettings() }), this.authApi.setRiskIdHandler((e) => this.riskIds.headersFor(e)), this.tokenCacheService.attachRefreshController(this.authService.refresh);
7915
7992
  for (let e of this.axiosClients()) e.setRefreshHandler((e) => this.authService.refresh.ensureFresh(e));
7916
- this.userService = new ko(this.userApi, this.deviceService, this.platform), this.tenantService = new Eo(this.tenantApi, this.scopes, void 0, () => this.storageManager.getToken(N.access_token)), this.tenant = this.tenantService, this.invitationService = new Co(this.invitationApi), this.twoFactorService = new Oo(this.twoFactorApi, this.subscribeStore, this.authService), this.twoFactor = this.twoFactorService, this.upgrade = Lc({
7993
+ this.userService = new ko(this.userApi, this.deviceService, this.platform), this.tenantService = new Eo(this.tenantApi, this.scopes, void 0, () => this.storageManager.getToken(N.access_token)), this.tenant = this.tenantService, this.invitationService = new Co(this.invitationApi), this.twoFactorService = new Oo(this.twoFactorApi, this.subscribeStore, this.authService), this.twoFactor = this.twoFactorService, this.upgrade = Vc({
7917
7994
  startUpgrade: (e) => this.upgradeApi.startUpgrade(e),
7918
7995
  commitRefresh: async (e, t) => {
7919
7996
  await this.authService.refreshToken(e, t);
@@ -7942,7 +8019,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7942
8019
  let e = (await this.getTokens(!0))?.access_token;
7943
8020
  return e && !j(M(e)) ? e : void 0;
7944
8021
  }
7945
- }), this.hostedUpgrade = Lc({
8022
+ }), this.hostedUpgrade = Vc({
7946
8023
  startUpgrade: (e) => this.upgradeApi.startHostedUpgrade(e),
7947
8024
  commitRefresh: (e) => this.upgradeApi.commitHostedUpgrade(e),
7948
8025
  canCommit: () => ({ ok: !0 }),
@@ -7979,7 +8056,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
7979
8056
  return this.upgrade.attachAuth(e, t);
7980
8057
  }
7981
8058
  createClient(e, t) {
7982
- return _c(e, (e) => this.upgrade.attachAuth(e, t));
8059
+ return xc(e, (e) => this.upgrade.attachAuth(e, t));
7983
8060
  }
7984
8061
  readAssuranceBar() {
7985
8062
  let e = this.storageManager.getToken(N.access_token);
@@ -8665,7 +8742,7 @@ var _o = 10, vo = "The sign-in answered with a PKCE code, but its verifier is go
8665
8742
  this.twoFactorService.clearMagicLinkSession();
8666
8743
  }
8667
8744
  };
8668
- Rc = zc, Rc.version = y;
8669
- export { bt as ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID, m as AGENT_TOOL_HEADER_KEY, v as ANTI_BOT_ACTION, ot as ANTI_BOT_FAILED_ERROR_ID, p as ANTI_BOT_HEADER_KEY, ut as ANTI_BOT_PROVIDER_FAILED_ERROR_ID, lt as ANTI_BOT_PROVIDER_MISSING_ERROR_ID, at as ANTI_BOT_REQUIRED_ERROR_ID, dt as ANTI_BOT_SOLVE_FAILED_ERROR_ID, ct as ANTI_BOT_UNAVAILABLE_ERROR_ID, l as APP_ID_HEADER_KEY, Dt as APP_SECRET_NAMES, u as AUTHORIZATION_HEADER_KEY, dn as AppAPI, vn as AuthAPI, So as AuthService, yn as CLIAuthAPI, S as DEFAULT_GROUP_NAME, x as DEFAULT_SCOPES, Fo as DEFAULT_UPGRADE_FACTORS, d as DEVICE_ID_HEADER_KEY, h as DEVICE_PROOF_HEADER_KEY, f as DEVICE_TYPE_HEADER_KEY, Yn as DeviceKeyErrorId, ht as ENTERPRISE_CONNECTION_AMBIGUOUS_ERROR_ID, ft as ENTERPRISE_EMAIL_INVALID_ERROR_ID, mt as ENTERPRISE_NO_CONNECTION_ERROR_ID, pt as ENTERPRISE_START_INPUT_ERROR_ID, re as ERROR_MESSAGE_MAX_LENGTH, Zn as FETCH_PRIORITY_OIDC, Qn as FETCH_PRIORITY_UPGRADE, g as FINGERPRINT_EVENT_HEADER_KEY, $n as FetchMiddlewareContractError, Me as INSUFFICIENT_USER_AUTHENTICATION, bn as InvitationAPI, Co as InvitationService, yr as M2MClient, mr as M2MConfigError, H as M2MError, hr as M2MErrorCodes, fr as M2MNetworkError, pr as M2MTokenParseError, gr as M2M_DEFAULTS, Ot as MASKED_SECRET_PREFIX, b as MINIMAL_DEFAULT_SCOPES, L as NativeSignInError, jt as OS, ee as PASSFLOW_CLOUD_URL, it as PASSWORD_CHANGE_REQUIRED_ERROR_ID, w as POPUP_HEIGHT, T as POPUP_POLL_INTERVAL_MS, E as POPUP_TIMEOUT_MS, C as POPUP_WIDTH, zc as Passflow, Tt as PassflowAddressChangeProofRequiredError, $e as PassflowAdminEndpointPaths, wt as PassflowAntiBotChallengeError, R as PassflowEndpointPaths, z as PassflowError, G as PassflowEvent, U as PassflowOidcError, gt as PassflowPasswordChangeRequiredError, Ct as PassflowRecoveryCodesStepUpRequiredError, Y as PassflowRefreshError, St as PassflowSendLimitError, xt as PassflowSmsQuotaExceededError, ge as PopupClosedError, Et as Providers, Oa as RECOVERABLE_COMMIT_ERROR_IDS, yt as RECOVERY_CODES_STEP_UP_REQUIRED_ERROR_ID, Wi as REFRESH_AUTH_FAILURE_IDS, J as RefreshErrorId, Qe as RequestMethod, y as SDK_VERSION, nt as SERVICE_UNAVAILABLE_ERROR_ID, rt as SERVICE_UNAVAILABLE_MESSAGE, ka as SESSION_INVALIDATING_COMMIT_ERROR_IDS, kt as SETTINGS_MASKED_VALUE_UNKNOWN_ERROR_ID, st as SIGN_IN_REFUSED_ERROR_ID, _ as STYTCH_TELEMETRY_HEADER_KEY, F as SessionState, xn as SettingAPI, te as TOKEN_EXPIRY_BUFFER_SECONDS, vt as TWO_FACTOR_SEND_LIMIT_ERROR_ID, _t as TWO_FACTOR_SMS_QUOTA_EXCEEDED_ERROR_ID, Sn as TenantAPI, Eo as TenantService, wo as TenantUserMembership, Do as TokenCacheService, P as TokenDeliveryMode, N as TokenType, Dn as TwoFactorApiClient, Pt as TwoFactorPolicy, Oo as TwoFactorService, Ne as UPGRADE_REQUIRED, D as USERNAME_MAX_LENGTH, ne as USERNAME_MIN_LENGTH, On as UpgradeAPI, Ho as UpgradeCancelledError, ra as UpgradeCommitInterruptedError, ns as UpgradeController, Q as UpgradeErrorIds, Ao as UpgradeFactorError, Wa as UpgradeInsufficientError, Ka as UpgradeSessionChangedError, Uo as UpgradeSignInRequiredError, $ as UpgradeTransportError, Ga as UpgradeUnavailableError, Jo as UpgradeUnsatisfiableError, kn as UserAPI, ko as UserService, Te as WebAdapter, Va as classifyUpgradeError, Io as factorRegistry, dr as fetchRegistryState, Mt as getOSFromDeviceType, Ua as invalidatesSessionOnCommit, tt as isEmailVerificationStep, At as isMaskedSecret, Ha as isRecoverableCommitFailure, ja as isRetryableUpgradeKind, j as isTokenExpired, Ms as isUpgradeCancelled, Ns as isUpgradeExhausted, Ps as isUpgradeInsufficient, Rs as isUpgradeSessionChanged, Is as isUpgradeSignInRequired, Fa as isUpgradeTransportError, zs as isUpgradeTransportFailure, Ls as isUpgradeUnavailable, Fs as isUpgradeUnsatisfiable, Za as isValidEmail, Ya as isValidJWTFormat, Qa as isValidPhoneNumber, $a as isValidUsername, Be as parseChallengeBody, ze as parseChallengeHeader, M as parseToken, We as parseUpgradeChallenge, Po as passkeyFactor, Nt as pathWithParams, In as pushChallengeOf, No as recoveryCodesFactor, ur as registerFetchMiddleware, je as requiredAcrLevel, et as resolveUpgradeDomain, Xa as sanitizeErrorMessage, Vo as selectFactors, Mo as totpFactor, Ee as webAdapter };
8745
+ Hc = Uc, Hc.version = y;
8746
+ export { bt as ADDRESS_CHANGE_PROOF_REQUIRED_ERROR_ID, m as AGENT_TOOL_HEADER_KEY, v as ANTI_BOT_ACTION, ot as ANTI_BOT_FAILED_ERROR_ID, p as ANTI_BOT_HEADER_KEY, ut as ANTI_BOT_PROVIDER_FAILED_ERROR_ID, lt as ANTI_BOT_PROVIDER_MISSING_ERROR_ID, at as ANTI_BOT_REQUIRED_ERROR_ID, dt as ANTI_BOT_SOLVE_FAILED_ERROR_ID, ct as ANTI_BOT_UNAVAILABLE_ERROR_ID, l as APP_ID_HEADER_KEY, Dt as APP_SECRET_NAMES, u as AUTHORIZATION_HEADER_KEY, dn as AppAPI, vn as AuthAPI, So as AuthService, yn as CLIAuthAPI, S as DEFAULT_GROUP_NAME, x as DEFAULT_SCOPES, zo as DEFAULT_UPGRADE_FACTORS, d as DEVICE_ID_HEADER_KEY, h as DEVICE_PROOF_HEADER_KEY, f as DEVICE_TYPE_HEADER_KEY, Yn as DeviceKeyErrorId, ht as ENTERPRISE_CONNECTION_AMBIGUOUS_ERROR_ID, ft as ENTERPRISE_EMAIL_INVALID_ERROR_ID, mt as ENTERPRISE_NO_CONNECTION_ERROR_ID, pt as ENTERPRISE_START_INPUT_ERROR_ID, re as ERROR_MESSAGE_MAX_LENGTH, Zn as FETCH_PRIORITY_OIDC, Qn as FETCH_PRIORITY_UPGRADE, g as FINGERPRINT_EVENT_HEADER_KEY, $n as FetchMiddlewareContractError, Me as INSUFFICIENT_USER_AUTHENTICATION, bn as InvitationAPI, Co as InvitationService, yr as M2MClient, mr as M2MConfigError, H as M2MError, hr as M2MErrorCodes, fr as M2MNetworkError, pr as M2MTokenParseError, gr as M2M_DEFAULTS, Ot as MASKED_SECRET_PREFIX, b as MINIMAL_DEFAULT_SCOPES, L as NativeSignInError, jt as OS, ee as PASSFLOW_CLOUD_URL, it as PASSWORD_CHANGE_REQUIRED_ERROR_ID, w as POPUP_HEIGHT, T as POPUP_POLL_INTERVAL_MS, E as POPUP_TIMEOUT_MS, C as POPUP_WIDTH, Uc as Passflow, Tt as PassflowAddressChangeProofRequiredError, $e as PassflowAdminEndpointPaths, wt as PassflowAntiBotChallengeError, R as PassflowEndpointPaths, z as PassflowError, G as PassflowEvent, U as PassflowOidcError, gt as PassflowPasswordChangeRequiredError, Ct as PassflowRecoveryCodesStepUpRequiredError, Y as PassflowRefreshError, St as PassflowSendLimitError, xt as PassflowSmsQuotaExceededError, ge as PopupClosedError, Et as Providers, Oa as RECOVERABLE_COMMIT_ERROR_IDS, yt as RECOVERY_CODES_STEP_UP_REQUIRED_ERROR_ID, Wi as REFRESH_AUTH_FAILURE_IDS, J as RefreshErrorId, Qe as RequestMethod, y as SDK_VERSION, nt as SERVICE_UNAVAILABLE_ERROR_ID, rt as SERVICE_UNAVAILABLE_MESSAGE, ka as SESSION_INVALIDATING_COMMIT_ERROR_IDS, kt as SETTINGS_MASKED_VALUE_UNKNOWN_ERROR_ID, st as SIGN_IN_REFUSED_ERROR_ID, _ as STYTCH_TELEMETRY_HEADER_KEY, F as SessionState, xn as SettingAPI, te as TOKEN_EXPIRY_BUFFER_SECONDS, vt as TWO_FACTOR_SEND_LIMIT_ERROR_ID, _t as TWO_FACTOR_SMS_QUOTA_EXCEEDED_ERROR_ID, Sn as TenantAPI, Eo as TenantService, wo as TenantUserMembership, Do as TokenCacheService, P as TokenDeliveryMode, N as TokenType, Dn as TwoFactorApiClient, Pt as TwoFactorPolicy, Oo as TwoFactorService, Ne as UPGRADE_REQUIRED, D as USERNAME_MAX_LENGTH, ne as USERNAME_MIN_LENGTH, On as UpgradeAPI, Ko as UpgradeCancelledError, ra as UpgradeCommitInterruptedError, os as UpgradeController, Q as UpgradeErrorIds, Ao as UpgradeFactorError, Wa as UpgradeInsufficientError, Ka as UpgradeSessionChangedError, qo as UpgradeSignInRequiredError, $ as UpgradeTransportError, Ga as UpgradeUnavailableError, Qo as UpgradeUnsatisfiableError, kn as UserAPI, ko as UserService, Te as WebAdapter, Va as classifyUpgradeError, Io as emailOtpFactor, Bo as factorRegistry, dr as fetchRegistryState, Mt as getOSFromDeviceType, Ua as invalidatesSessionOnCommit, tt as isEmailVerificationStep, At as isMaskedSecret, Ha as isRecoverableCommitFailure, ja as isRetryableUpgradeKind, j as isTokenExpired, Is as isUpgradeCancelled, Ls as isUpgradeExhausted, Rs as isUpgradeInsufficient, Hs as isUpgradeSessionChanged, Bs as isUpgradeSignInRequired, Fa as isUpgradeTransportError, Us as isUpgradeTransportFailure, Vs as isUpgradeUnavailable, zs as isUpgradeUnsatisfiable, Za as isValidEmail, Ya as isValidJWTFormat, Qa as isValidPhoneNumber, $a as isValidUsername, Be as parseChallengeBody, ze as parseChallengeHeader, M as parseToken, We as parseUpgradeChallenge, Po as passkeyFactor, Nt as pathWithParams, In as pushChallengeOf, No as recoveryCodesFactor, ur as registerFetchMiddleware, je as requiredAcrLevel, et as resolveUpgradeDomain, Xa as sanitizeErrorMessage, Go as selectFactors, Lo as smsOtpFactor, Mo as totpFactor, Ee as webAdapter };
8670
8747
 
8671
8748
  //# sourceMappingURL=index.mjs.map