cauthy-auth 0.24.0 → 0.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/svelte.mjs CHANGED
@@ -74,6 +74,13 @@ function ceremonyError(e) {
74
74
  return { code: "passkey_failed", message: "The passkey could not be used. Try again, or sign in another way." };
75
75
  }
76
76
 
77
+ // src/url.ts
78
+ function withoutTrailingSlashes(s) {
79
+ let end = s.length;
80
+ while (end > 0 && s.charCodeAt(end - 1) === 47) end--;
81
+ return s.slice(0, end);
82
+ }
83
+
77
84
  // src/theme.ts
78
85
  function fromWire(wire) {
79
86
  const names = {
@@ -168,7 +175,7 @@ function loadGoogleIdentity() {
168
175
  var PASSKEY_SECONDS = 300;
169
176
  var UNAVAILABLE = { code: "unavailable", message: "Sign-in is unavailable right now. Try again in a moment." };
170
177
  function createAuthClient(options = {}) {
171
- const base = (options.basePath ?? "/api/auth").replace(/\/+$/, "");
178
+ const base = withoutTrailingSlashes(options.basePath ?? "/api/auth");
172
179
  const doFetch = (...args) => (options.fetch ?? fetch)(...args);
173
180
  const locale = () => {
174
181
  const said = typeof options.locale === "function" ? options.locale() : options.locale;
@@ -461,7 +468,7 @@ function createAuthClient(options = {}) {
461
468
  // src/store.ts
462
469
  var AHEAD_MS = 6e4;
463
470
  function createSessionStore(options = {}) {
464
- const base = (options.basePath ?? "/api/auth").replace(/\/+$/, "");
471
+ const base = withoutTrailingSlashes(options.basePath ?? "/api/auth");
465
472
  const doFetch = (...args) => (options.fetch ?? fetch)(...args);
466
473
  const first = options.initialSession;
467
474
  let state = { session: first ?? null, status: first === void 0 ? "loading" : first === null ? "unauthenticated" : "authenticated" };