@skylabs-digital/react-identity-access 2.20.0 → 2.21.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.es.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as s, Fragment as _, jsxs as d } from "react/jsx-runtime";
2
- import { createContext as fe, useMemo as J, useState as T, useCallback as se, useEffect as ee, useContext as ae, useRef as Qe } from "react";
3
- import { useLocation as Te, Navigate as be, useNavigate as ft, useSearchParams as gt } from "react-router-dom";
4
- class le {
2
+ import { createContext as fe, useMemo as Z, useState as T, useCallback as se, useEffect as ee, useContext as le, useRef as Ke } from "react";
3
+ import { useLocation as ke, Navigate as Se, useNavigate as gt, useSearchParams as mt } from "react-router-dom";
4
+ class ce {
5
5
  constructor(e, t = 1e4) {
6
6
  this.baseUrl = e.replace(/\/$/, ""), this.timeout = t;
7
7
  }
@@ -50,7 +50,7 @@ class le {
50
50
  return this.executeRequest("DELETE", e, void 0, t);
51
51
  }
52
52
  }
53
- class Oe {
53
+ class ze {
54
54
  constructor(e, t) {
55
55
  this.httpService = e, this.sessionManager = t;
56
56
  }
@@ -109,9 +109,9 @@ class Oe {
109
109
  })).data;
110
110
  }
111
111
  }
112
- const Le = fe(null);
113
- function mr({ config: n, children: e }) {
114
- const t = J(
112
+ const Fe = fe(null);
113
+ function yr({ config: n, children: e }) {
114
+ const t = Z(
115
115
  () => {
116
116
  var p, x, R;
117
117
  return {
@@ -132,7 +132,7 @@ function mr({ config: n, children: e }) {
132
132
  } catch {
133
133
  return null;
134
134
  }
135
- }), [o, a] = T(!r), [f, g] = T(null), w = J(() => {
135
+ }), [o, a] = T(!r), [f, g] = T(null), w = Z(() => {
136
136
  const p = () => {
137
137
  c();
138
138
  };
@@ -150,7 +150,7 @@ function mr({ config: n, children: e }) {
150
150
  if (!(!p && t.enabled && r))
151
151
  try {
152
152
  a(!0), g(null);
153
- const x = new le(n.baseUrl), F = await new Oe(x, {}).getPublicAppInfo(n.appId);
153
+ const x = new ce(n.baseUrl), F = await new ze(x, {}).getPublicAppInfo(n.appId);
154
154
  if (i(F), t.enabled)
155
155
  try {
156
156
  const E = {
@@ -177,7 +177,7 @@ function mr({ config: n, children: e }) {
177
177
  if (!p) return;
178
178
  const x = JSON.parse(p);
179
179
  if (Date.now() - x.timestamp > t.ttl * 0.5) {
180
- const F = new le(n.baseUrl), A = await new Oe(F, {}).getPublicAppInfo(n.appId);
180
+ const F = new ce(n.baseUrl), A = await new ze(F, {}).getPublicAppInfo(n.appId);
181
181
  i(A);
182
182
  const u = {
183
183
  data: A,
@@ -192,18 +192,18 @@ function mr({ config: n, children: e }) {
192
192
  }, [n, t, r]);
193
193
  return ee(() => {
194
194
  r ? I() : c();
195
- }, []), /* @__PURE__ */ s(Le.Provider, { value: w, children: e });
195
+ }, []), /* @__PURE__ */ s(Fe.Provider, { value: w, children: e });
196
196
  }
197
- function Se() {
198
- const n = ae(Le);
197
+ function ve() {
198
+ const n = le(Fe);
199
199
  if (!n)
200
200
  throw new Error("useApp must be used within an AppProvider");
201
201
  return n;
202
202
  }
203
203
  function Ze() {
204
- return ae(Le);
204
+ return le(Fe);
205
205
  }
206
- const yr = Se;
206
+ const wr = ve;
207
207
  class ie extends Error {
208
208
  constructor(e, t) {
209
209
  const r = {
@@ -214,22 +214,47 @@ class ie extends Error {
214
214
  super(t || r[e]), this.name = "SessionExpiredError", this.reason = e;
215
215
  }
216
216
  }
217
- class mt extends Error {
217
+ class yt extends Error {
218
218
  constructor(e) {
219
219
  super(`Token refresh timed out after ${e}ms`), this.name = "TokenRefreshTimeoutError", this.timeoutMs = e;
220
220
  }
221
221
  }
222
- class yt extends Error {
222
+ class wt extends Error {
223
223
  constructor(e, t) {
224
224
  super(
225
225
  `Token refresh failed after ${e} attempts: ${(t == null ? void 0 : t.message) || "Unknown error"}`
226
226
  ), this.name = "TokenRefreshError", this.attempts = e, this.lastError = t;
227
227
  }
228
228
  }
229
- class pe {
229
+ const oe = class oe {
230
230
  constructor(e = {}) {
231
231
  this.refreshPromise = null, this.refreshQueue = [], this.proactiveTimerId = null, this.backgroundRetryTimerId = null, this.isDestroyed = !1, e.tenantSlug !== void 0 ? this.storageKey = e.tenantSlug ? `auth_tokens_${e.tenantSlug}` : "auth_tokens" : this.storageKey = e.storageKey || "auth_tokens", this.autoRefresh = e.autoRefresh ?? !0, this.refreshThreshold = e.refreshThreshold || 3e5, this.onRefreshFailed = e.onRefreshFailed, this.onSessionExpired = e.onSessionExpired, this.baseUrl = e.baseUrl || "", this.proactiveRefreshMargin = e.proactiveRefreshMargin ?? 6e4, this.refreshQueueTimeout = e.refreshQueueTimeout ?? 1e4, this.maxRefreshRetries = e.maxRefreshRetries ?? 3, this.retryBackoffBase = e.retryBackoffBase ?? 1e3, this.tokenStorage = e.tokenStorage || this.createTokenStorage(this.storageKey), this.scheduleProactiveRefresh();
232
232
  }
233
+ /**
234
+ * Get or create a SessionManager instance for the given config.
235
+ * Returns the same instance when called with the same storageKey/tenantSlug.
236
+ * Mutable config (callbacks, baseUrl) is updated on the existing instance.
237
+ */
238
+ static getInstance(e = {}) {
239
+ const t = oe.resolveStorageKey(e), r = oe.instances.get(t);
240
+ if (r)
241
+ return r.updateConfig(e), r;
242
+ const i = new oe(e);
243
+ return oe.instances.set(t, i), i;
244
+ }
245
+ /** Reset all singleton instances. For testing only. */
246
+ static resetAllInstances() {
247
+ for (const e of oe.instances.values())
248
+ e.destroy();
249
+ oe.instances.clear();
250
+ }
251
+ static resolveStorageKey(e) {
252
+ return e.storageKey ? e.storageKey : e.tenantSlug !== void 0 && e.tenantSlug ? `auth_tokens_${e.tenantSlug}` : "auth_tokens";
253
+ }
254
+ /** Update mutable config (callbacks, baseUrl) on an existing instance. */
255
+ updateConfig(e) {
256
+ e.onSessionExpired !== void 0 && (this.onSessionExpired = e.onSessionExpired), e.onRefreshFailed !== void 0 && (this.onRefreshFailed = e.onRefreshFailed), e.baseUrl && (this.baseUrl = e.baseUrl);
257
+ }
233
258
  // --- Storage helpers ---
234
259
  createTokenStorage(e) {
235
260
  return {
@@ -271,7 +296,7 @@ class pe {
271
296
  }
272
297
  }
273
298
  setTokens(e) {
274
- const t = e.expiresAt || (e.expiresIn ? Date.now() + e.expiresIn * 1e3 : void 0) || pe.extractJwtExpiry(e.accessToken), r = {
299
+ const t = e.expiresAt || (e.expiresIn ? Date.now() + e.expiresIn * 1e3 : void 0) || oe.extractJwtExpiry(e.accessToken), r = {
275
300
  ...e,
276
301
  expiresAt: t
277
302
  };
@@ -281,7 +306,7 @@ class pe {
281
306
  const { accessToken: e, refreshToken: t, expiresAt: r, expiresIn: i, tokenType: o } = this.tokenStorage.get() || {};
282
307
  if (!e)
283
308
  return null;
284
- const a = r || pe.extractJwtExpiry(e);
309
+ const a = r || oe.extractJwtExpiry(e);
285
310
  return {
286
311
  accessToken: e,
287
312
  refreshToken: t,
@@ -312,9 +337,7 @@ class pe {
312
337
  if (!(e != null && e.expiresAt) || !e.refreshToken) return;
313
338
  const r = e.expiresAt - this.proactiveRefreshMargin - Date.now();
314
339
  if (r <= 0) {
315
- this.proactiveTimerId = setTimeout(() => {
316
- this.backgroundRefresh();
317
- }, 0);
340
+ this.backgroundRefresh();
318
341
  return;
319
342
  }
320
343
  this.proactiveTimerId = setTimeout(() => {
@@ -374,7 +397,7 @@ class pe {
374
397
  return new Promise((e, t) => {
375
398
  const r = setTimeout(() => {
376
399
  const i = this.refreshQueue.findIndex((o) => o.timeoutId === r);
377
- i !== -1 && this.refreshQueue.splice(i, 1), t(new mt(this.refreshQueueTimeout));
400
+ i !== -1 && this.refreshQueue.splice(i, 1), t(new yt(this.refreshQueueTimeout));
378
401
  }, this.refreshQueueTimeout);
379
402
  this.refreshQueue.push({ resolve: e, reject: t, timeoutId: r });
380
403
  });
@@ -420,7 +443,7 @@ class pe {
420
443
  await this.sleep(a);
421
444
  }
422
445
  }
423
- throw new yt(this.maxRefreshRetries + 1, t);
446
+ throw new wt(this.maxRefreshRetries + 1, t);
424
447
  }
425
448
  /**
426
449
  * Single refresh attempt with error classification.
@@ -486,7 +509,7 @@ class pe {
486
509
  * Cancels all timers and rejects pending queue entries.
487
510
  */
488
511
  destroy() {
489
- this.isDestroyed = !0, this.cancelProactiveTimer();
512
+ this.isDestroyed = !0, oe.instances.delete(this.storageKey), this.cancelProactiveTimer();
490
513
  const e = new ie("token_invalid", "SessionManager destroyed");
491
514
  this.rejectQueue(e);
492
515
  }
@@ -524,8 +547,10 @@ class pe {
524
547
  sleep(e) {
525
548
  return new Promise((t) => setTimeout(t, e));
526
549
  }
527
- }
528
- class wt {
550
+ };
551
+ oe.instances = /* @__PURE__ */ new Map();
552
+ let we = oe;
553
+ class bt {
529
554
  constructor(e) {
530
555
  this.httpService = e;
531
556
  }
@@ -581,7 +606,7 @@ class wt {
581
606
  });
582
607
  }
583
608
  }
584
- class ze {
609
+ class _e {
585
610
  constructor(e, t) {
586
611
  this.httpService = e, this.sessionManager = t;
587
612
  }
@@ -657,7 +682,7 @@ class ze {
657
682
  };
658
683
  }
659
684
  }
660
- class bt {
685
+ class St {
661
686
  constructor(e, t) {
662
687
  this.httpService = e, this.sessionManager = t;
663
688
  }
@@ -697,7 +722,7 @@ class bt {
697
722
  });
698
723
  }
699
724
  }
700
- class we {
725
+ class be {
701
726
  constructor(e, t, r) {
702
727
  this.httpService = e, this.appId = t, this.sessionManager = r;
703
728
  }
@@ -775,7 +800,7 @@ class we {
775
800
  )).data;
776
801
  }
777
802
  }
778
- function St(n, e) {
803
+ function vt(n, e) {
779
804
  if (n === "localhost" || n.startsWith("127.") || n.startsWith("192.168."))
780
805
  return null;
781
806
  if (e) {
@@ -791,26 +816,26 @@ function St(n, e) {
791
816
  const r = n.split(".");
792
817
  return r.length >= 3 && r[0] !== "www" ? r[0] : null;
793
818
  }
794
- function vt(n, e = "tenant", t) {
819
+ function Tt(n, e = "tenant", t) {
795
820
  const i = new URLSearchParams(n).get(e);
796
821
  return i ? (t && t.setItem("tenant", i), i) : t ? t.getItem("tenant") : null;
797
822
  }
798
- function Tt(n, e, t) {
823
+ function kt(n, e, t) {
799
824
  const { tenantMode: r, baseDomain: i, selectorParam: o, fixedTenantSlug: a } = n;
800
- return r === "fixed" ? a || null : r === "subdomain" ? St(e.hostname, i) : r === "selector" ? vt(e.search, o, t) : null;
825
+ return r === "fixed" ? a || null : r === "subdomain" ? vt(e.hostname, i) : r === "selector" ? Tt(e.search, o, t) : null;
801
826
  }
802
- function kt(n, e, t) {
827
+ function xt(n, e, t) {
803
828
  if (t)
804
829
  return `${n}.${t}`;
805
830
  const r = e.split(".");
806
831
  return r.length === 2 ? `${n}.${e}` : r.length >= 3 ? (r[0] = n, r.join(".")) : null;
807
832
  }
808
- const he = "_auth";
809
- function _e(n) {
833
+ const pe = "_auth";
834
+ function We(n) {
810
835
  const e = JSON.stringify(n);
811
836
  return btoa(e).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
812
837
  }
813
- function xt(n) {
838
+ function At(n) {
814
839
  try {
815
840
  let e = n.replace(/-/g, "+").replace(/_/g, "/");
816
841
  for (; e.length % 4; )
@@ -821,16 +846,16 @@ function xt(n) {
821
846
  return null;
822
847
  }
823
848
  }
824
- function At() {
849
+ function Pt() {
825
850
  if (typeof window > "u")
826
851
  return console.log("[CrossDomainAuth] SSR environment, skipping URL token extraction"), null;
827
- const e = new URLSearchParams(window.location.search).get(he);
852
+ const e = new URLSearchParams(window.location.search).get(pe);
828
853
  if (console.log("[CrossDomainAuth] extractAuthTokensFromUrl called", {
829
854
  hasAuthParam: !!e,
830
855
  searchParams: window.location.search,
831
856
  encodedLength: e == null ? void 0 : e.length
832
857
  }), !e) return null;
833
- const t = xt(e);
858
+ const t = At(e);
834
859
  return console.log("[CrossDomainAuth] Token decode result:", {
835
860
  success: !!t,
836
861
  hasAccessToken: !!(t != null && t.accessToken),
@@ -838,17 +863,17 @@ function At() {
838
863
  expiresIn: t == null ? void 0 : t.expiresIn
839
864
  }), t;
840
865
  }
841
- function Pt() {
866
+ function Rt() {
842
867
  if (typeof window > "u") return;
843
868
  const n = new URL(window.location.href);
844
- n.searchParams.delete(he), console.log("[CrossDomainAuth] Clearing auth tokens from URL", {
869
+ n.searchParams.delete(pe), console.log("[CrossDomainAuth] Clearing auth tokens from URL", {
845
870
  oldUrl: window.location.href,
846
871
  newUrl: n.toString()
847
872
  }), window.history.replaceState({}, "", n.toString());
848
873
  }
849
- const Fe = fe(null);
850
- function wr({ config: n, children: e }) {
851
- const { baseUrl: t, appInfo: r, appId: i } = Se(), o = se(() => typeof window > "u" ? null : Tt(
874
+ const De = fe(null);
875
+ function br({ config: n, children: e }) {
876
+ const { baseUrl: t, appInfo: r, appId: i } = ve(), o = se(() => typeof window > "u" ? null : kt(
852
877
  {
853
878
  tenantMode: n.tenantMode || "selector",
854
879
  baseDomain: n.baseDomain,
@@ -860,7 +885,7 @@ function wr({ config: n, children: e }) {
860
885
  search: window.location.search
861
886
  },
862
887
  window.localStorage
863
- ), [n.tenantMode, n.baseDomain, n.selectorParam, n.fixedTenantSlug]), [a, f] = T(() => o()), g = J(
888
+ ), [n.tenantMode, n.baseDomain, n.selectorParam, n.fixedTenantSlug]), [a, f] = T(() => o()), g = Z(
864
889
  () => {
865
890
  var h, C, S;
866
891
  return {
@@ -893,7 +918,7 @@ function wr({ config: n, children: e }) {
893
918
  if (!(!C && g.enabled && w && w.domain === h))
894
919
  try {
895
920
  p(!0), R(null);
896
- const S = new le(t), y = await new we(S, i).getPublicTenantInfo(h);
921
+ const S = new ce(t), y = await new be(S, i).getPublicTenantInfo(h);
897
922
  if (c(y), g.enabled)
898
923
  try {
899
924
  const v = {
@@ -920,7 +945,7 @@ function wr({ config: n, children: e }) {
920
945
  if (!h) return;
921
946
  const C = JSON.parse(h);
922
947
  if (Date.now() - C.timestamp > g.ttl * 0.5) {
923
- const b = new le(t), v = await new we(b, i).getPublicTenantInfo(a);
948
+ const b = new ce(t), v = await new be(b, i).getPublicTenantInfo(a);
924
949
  c(v);
925
950
  const j = {
926
951
  data: v,
@@ -936,7 +961,7 @@ function wr({ config: n, children: e }) {
936
961
  if (w != null && w.id)
937
962
  try {
938
963
  u(!0), m(null);
939
- const h = new le(t), S = await new we(h, w.appId).getTenantSettings(w.id);
964
+ const h = new ce(t), S = await new be(h, w.appId).getTenantSettings(w.id);
940
965
  E(S);
941
966
  } catch (h) {
942
967
  const C = h instanceof Error ? h : new Error("Failed to load tenant settings");
@@ -999,7 +1024,7 @@ function wr({ config: n, children: e }) {
999
1024
  return;
1000
1025
  }
1001
1026
  if (localStorage.setItem("tenant", h), v === "subdomain") {
1002
- const j = window.location.hostname, Q = kt(
1027
+ const j = window.location.hostname, Q = xt(
1003
1028
  h,
1004
1029
  j,
1005
1030
  n.baseDomain
@@ -1013,11 +1038,11 @@ function wr({ config: n, children: e }) {
1013
1038
  }
1014
1039
  const O = y || window.location.pathname, q = new URL(`${window.location.protocol}//${Q}${O}`);
1015
1040
  new URLSearchParams(window.location.search).forEach((B, X) => {
1016
- X !== he && q.searchParams.set(X, B);
1017
- }), b && q.searchParams.set(he, _e(b)), window.location.href = q.toString();
1041
+ X !== pe && q.searchParams.set(X, B);
1042
+ }), b && q.searchParams.set(pe, We(b)), window.location.href = q.toString();
1018
1043
  } else if (v === "selector") {
1019
1044
  const j = y || window.location.pathname, Q = new URLSearchParams(window.location.search);
1020
- if (Q.set(n.selectorParam || "tenant", h), Q.delete(he), b && Q.set(he, _e(b)), S === "reload") {
1045
+ if (Q.set(n.selectorParam || "tenant", h), Q.delete(pe), b && Q.set(pe, We(b)), S === "reload") {
1021
1046
  const O = `${j}?${Q.toString()}${window.location.hash}`;
1022
1047
  window.location.href = O;
1023
1048
  } else {
@@ -1027,7 +1052,7 @@ function wr({ config: n, children: e }) {
1027
1052
  }
1028
1053
  },
1029
1054
  [n.tenantMode, n.selectorParam, n.baseDomain, L]
1030
- ), $ = J(() => ({
1055
+ ), $ = Z(() => ({
1031
1056
  // Tenant info
1032
1057
  tenant: w,
1033
1058
  tenantSlug: a,
@@ -1059,19 +1084,19 @@ function wr({ config: n, children: e }) {
1059
1084
  N,
1060
1085
  l
1061
1086
  ]);
1062
- return /* @__PURE__ */ s(Fe.Provider, { value: $, children: e });
1087
+ return /* @__PURE__ */ s(De.Provider, { value: $, children: e });
1063
1088
  }
1064
1089
  function ge() {
1065
- const n = ae(Fe);
1090
+ const n = le(De);
1066
1091
  if (!n)
1067
1092
  throw new Error("useTenant must be used within a TenantProvider");
1068
1093
  return n;
1069
1094
  }
1070
- function ke() {
1071
- return ae(Fe);
1095
+ function xe() {
1096
+ return le(De);
1072
1097
  }
1073
- const br = ge;
1074
- function Sr() {
1098
+ const Sr = ge;
1099
+ function vr() {
1075
1100
  const { settings: n, settingsSchema: e, isSettingsLoading: t, settingsError: r, validateSettings: i } = ge();
1076
1101
  return {
1077
1102
  settings: n,
@@ -1091,35 +1116,35 @@ function me() {
1091
1116
  retry: i
1092
1117
  };
1093
1118
  }
1094
- const De = fe(null);
1095
- function vr({ config: n = {}, children: e }) {
1096
- const { appId: t, baseUrl: r } = Se(), { tenant: i, tenantSlug: o, switchTenant: a } = ge(), [f, g] = T(n.initialRoles || []), [w, c] = T(!n.initialRoles), [I, p] = T(null), [x, R] = T(!1), [F, E] = T(null), [A, u] = T(0), [k, m] = T(() => {
1119
+ const Ne = fe(null);
1120
+ function Tr({ config: n = {}, children: e }) {
1121
+ const { appId: t, baseUrl: r } = ve(), { tenant: i, tenantSlug: o, switchTenant: a } = ge(), [f, g] = T(n.initialRoles || []), [w, c] = T(!n.initialRoles), [I, p] = T(null), [x, R] = T(!1), [F, E] = T(null), [A, u] = T(0), [k, m] = T(() => {
1097
1122
  try {
1098
1123
  const G = localStorage.getItem("userTenants");
1099
1124
  return G ? JSON.parse(G) : [];
1100
1125
  } catch {
1101
1126
  return [];
1102
1127
  }
1103
- }), [M, L] = T(!1), D = Qe({ done: !1, urlTokens: null });
1104
- D.current.done || (D.current.done = !0, D.current.urlTokens = At(), D.current.urlTokens && console.log(
1128
+ }), [M, L] = T(!1), D = Ke({ done: !1, urlTokens: null });
1129
+ D.current.done || (D.current.done = !0, D.current.urlTokens = Pt(), D.current.urlTokens && console.log(
1105
1130
  "[AuthProvider] SYNC: URL tokens found, will block isAuthReady until user loaded"
1106
1131
  ));
1107
1132
  const [P, U] = T(() => {
1108
1133
  const G = D.current.urlTokens !== null;
1109
1134
  return console.log("[AuthProvider] SYNC: isLoadingAfterUrlTokens initial:", G), G;
1110
- }), l = J(() => {
1111
- const G = new pe({
1135
+ }), l = Z(() => {
1136
+ const G = we.getInstance({
1112
1137
  tenantSlug: o,
1113
1138
  baseUrl: r,
1114
1139
  refreshQueueTimeout: n.refreshQueueTimeout,
1115
1140
  proactiveRefreshMargin: n.proactiveRefreshMargin,
1116
- onSessionExpired: (ue) => {
1141
+ onSessionExpired: (he) => {
1117
1142
  p(null), E(null), m([]), L(!1);
1118
1143
  try {
1119
1144
  localStorage.removeItem("userTenants");
1120
1145
  } catch {
1121
1146
  }
1122
- n.onSessionExpired ? n.onSessionExpired(ue) : n.onRefreshFailed && n.onRefreshFailed();
1147
+ n.onSessionExpired ? n.onSessionExpired(he) : n.onRefreshFailed && n.onRefreshFailed();
1123
1148
  }
1124
1149
  });
1125
1150
  return D.current.urlTokens && (console.log("[AuthProvider] SYNC: Saving URL tokens to session manager"), G.setTokens({
@@ -1127,10 +1152,10 @@ function vr({ config: n = {}, children: e }) {
1127
1152
  refreshToken: D.current.urlTokens.refreshToken,
1128
1153
  expiresIn: D.current.urlTokens.expiresIn
1129
1154
  }), console.log("[AuthProvider] SYNC: Session valid:", G.hasValidSession())), G;
1130
- }, [o, r, n.refreshQueueTimeout, n.proactiveRefreshMargin]), [N, $] = T(() => D.current.urlTokens ? !1 : l.hasValidSession()), h = D.current.done && !P && !N, C = J(() => {
1131
- const G = new le(r);
1155
+ }, [o, r, n.refreshQueueTimeout, n.proactiveRefreshMargin]), [N, $] = T(() => D.current.urlTokens ? !1 : l.hasValidSession()), h = D.current.done && !P && !N, C = Z(() => {
1156
+ const G = new ce(r);
1132
1157
  return G.setSessionManager(l), G;
1133
- }, [r, l]), S = J(() => new wt(new le(r)), [r]), b = J(() => new bt(C, l), [C, l]), y = J(() => new ze(new le(r)), [r]), v = J(() => I || l.getUser(), [I, l]), j = J(() => v != null && v.roleId && f.find((G) => G.id === v.roleId) || null, [v, f]), Q = J(() => (j == null ? void 0 : j.permissions) || [], [j]), O = J(() => l.hasValidSession() && I !== null, [l, I]), q = 5 * 60 * 1e3, W = J(() => {
1158
+ }, [r, l]), S = Z(() => new bt(new ce(r)), [r]), b = Z(() => new St(C, l), [C, l]), y = Z(() => new _e(new ce(r)), [r]), v = Z(() => I || l.getUser(), [I, l]), j = Z(() => v != null && v.roleId && f.find((G) => G.id === v.roleId) || null, [v, f]), Q = Z(() => (j == null ? void 0 : j.permissions) || [], [j]), O = Z(() => l.hasValidSession() && I !== null, [l, I]), q = 5 * 60 * 1e3, W = Z(() => {
1134
1159
  const G = async (H = !1) => {
1135
1160
  try {
1136
1161
  if (!l.hasValidSession())
@@ -1144,112 +1169,112 @@ function vr({ config: n = {}, children: e }) {
1144
1169
  return;
1145
1170
  }
1146
1171
  R(!0), E(null);
1147
- const K = await b.getUserById(V);
1148
- p(K), l.setUser(K), u(Date.now());
1172
+ const J = await b.getUserById(V);
1173
+ p(J), l.setUser(J), u(Date.now());
1149
1174
  } catch (z) {
1150
1175
  const Y = z instanceof Error ? z : new Error("Failed to load user data");
1151
1176
  E(Y), console.error("[AuthProvider] Failed to load user data:", Y);
1152
1177
  } finally {
1153
1178
  R(!1);
1154
1179
  }
1155
- }, ue = async () => {
1180
+ }, he = async () => {
1156
1181
  await G();
1157
- }, xe = async (H) => {
1158
- var Be;
1159
- const { username: z, password: Y, tenantSlug: V, redirectPath: K } = H;
1182
+ }, Ae = async (H) => {
1183
+ var qe;
1184
+ const { username: z, password: Y, tenantSlug: V, redirectPath: J } = H;
1160
1185
  let te = i == null ? void 0 : i.id, re = o, ne = l;
1161
- V && (te = (await new we(C, t).getPublicTenantInfo(V)).id, re = V);
1162
- const Z = await S.login({
1186
+ V && (te = (await new be(C, t).getPublicTenantInfo(V)).id, re = V);
1187
+ const K = await S.login({
1163
1188
  username: z,
1164
1189
  password: Y,
1165
1190
  appId: t,
1166
1191
  tenantId: te
1167
1192
  }), ye = V && V !== o;
1168
- if (ye && (ne = new pe({
1193
+ if (ye && (ne = new we({
1169
1194
  tenantSlug: re,
1170
1195
  baseUrl: r
1171
1196
  })), ne.setTokens({
1172
- accessToken: Z.accessToken,
1173
- refreshToken: Z.refreshToken,
1174
- expiresIn: Z.expiresIn
1175
- }), Z.user) {
1176
- ne.setUser(Z.user), p(Z.user);
1197
+ accessToken: K.accessToken,
1198
+ refreshToken: K.refreshToken,
1199
+ expiresIn: K.expiresIn
1200
+ }), K.user) {
1201
+ ne.setUser(K.user), p(K.user);
1177
1202
  try {
1178
1203
  await G();
1179
- } catch (ve) {
1180
- console.warn("Failed to load complete user data after login:", ve);
1204
+ } catch (Te) {
1205
+ console.warn("Failed to load complete user data after login:", Te);
1181
1206
  }
1182
1207
  }
1183
- if (Z.tenants && Z.tenants.length > 0) {
1184
- m(Z.tenants);
1208
+ if (K.tenants && K.tenants.length > 0) {
1209
+ m(K.tenants);
1185
1210
  try {
1186
- localStorage.setItem("userTenants", JSON.stringify(Z.tenants));
1211
+ localStorage.setItem("userTenants", JSON.stringify(K.tenants));
1187
1212
  } catch {
1188
1213
  }
1189
1214
  }
1190
- const Re = ((Be = Z.user) == null ? void 0 : Be.tenantId) !== null;
1191
- L(Re);
1192
- const Ie = {
1193
- accessToken: Z.accessToken,
1194
- refreshToken: Z.refreshToken,
1195
- expiresIn: Z.expiresIn
1215
+ const Ie = ((qe = K.user) == null ? void 0 : qe.tenantId) !== null;
1216
+ L(Ie);
1217
+ const Ee = {
1218
+ accessToken: K.accessToken,
1219
+ refreshToken: K.refreshToken,
1220
+ expiresIn: K.expiresIn
1196
1221
  };
1197
1222
  if (ye && re)
1198
- return a(re, { tokens: Ie, redirectPath: K }), Z;
1199
- if (K && K !== window.location.pathname)
1200
- return a(re || o || "", { tokens: Ie, redirectPath: K }), Z;
1201
- if (!Re && Z.tenants && Z.tenants.length > 0) {
1202
- const ve = H.autoSwitch !== !1 && n.autoSwitchSingleTenant !== !1;
1203
- if (Z.tenants.length === 1 && ve) {
1204
- const qe = Z.tenants[0];
1205
- return a(qe.subdomain, { tokens: Ie, redirectPath: K }), Z;
1206
- } else Z.tenants.length > 1 && n.onTenantSelectionRequired && n.onTenantSelectionRequired(Z.tenants);
1223
+ return a(re, { tokens: Ee, redirectPath: J }), K;
1224
+ if (J && J !== window.location.pathname)
1225
+ return a(re || o || "", { tokens: Ee, redirectPath: J }), K;
1226
+ if (!Ie && K.tenants && K.tenants.length > 0) {
1227
+ const Te = H.autoSwitch !== !1 && n.autoSwitchSingleTenant !== !1;
1228
+ if (K.tenants.length === 1 && Te) {
1229
+ const Oe = K.tenants[0];
1230
+ return a(Oe.subdomain, { tokens: Ee, redirectPath: J }), K;
1231
+ } else K.tenants.length > 1 && n.onTenantSelectionRequired && n.onTenantSelectionRequired(K.tenants);
1207
1232
  }
1208
- return Z;
1209
- }, Ae = async (H) => {
1210
- const { email: z, phoneNumber: Y, name: V, password: K, lastName: te, tenantId: re } = H;
1233
+ return K;
1234
+ }, Pe = async (H) => {
1235
+ const { email: z, phoneNumber: Y, name: V, password: J, lastName: te, tenantId: re } = H;
1211
1236
  if (!z && !Y)
1212
1237
  throw new Error("Either email or phoneNumber is required");
1213
- if (!V || !K)
1238
+ if (!V || !J)
1214
1239
  throw new Error("Name and password are required");
1215
1240
  const ne = re ?? (i == null ? void 0 : i.id);
1216
1241
  return await S.signup({
1217
1242
  email: z,
1218
1243
  phoneNumber: Y,
1219
1244
  name: V,
1220
- password: K,
1245
+ password: J,
1221
1246
  tenantId: ne,
1222
1247
  lastName: te,
1223
1248
  appId: t
1224
1249
  });
1225
- }, tt = async (H) => {
1226
- const { email: z, phoneNumber: Y, name: V, password: K, tenantName: te, lastName: re } = H;
1250
+ }, rt = async (H) => {
1251
+ const { email: z, phoneNumber: Y, name: V, password: J, tenantName: te, lastName: re } = H;
1227
1252
  if (!z && !Y)
1228
1253
  throw new Error("Either email or phoneNumber is required");
1229
- if (!V || !K || !te)
1254
+ if (!V || !J || !te)
1230
1255
  throw new Error("Name, password, and tenantName are required");
1231
1256
  return await S.signupTenantAdmin({
1232
1257
  email: z,
1233
1258
  phoneNumber: Y,
1234
1259
  name: V,
1235
- password: K,
1260
+ password: J,
1236
1261
  tenantName: te,
1237
1262
  appId: t,
1238
1263
  lastName: re
1239
1264
  });
1240
- }, rt = async (H) => {
1265
+ }, nt = async (H) => {
1241
1266
  const { currentPassword: z, newPassword: Y } = H, V = await l.getAuthHeaders();
1242
1267
  await S.changePassword({ currentPassword: z, newPassword: Y }, V);
1243
- }, nt = async (H) => {
1268
+ }, st = async (H) => {
1244
1269
  const { email: z, tenantId: Y } = H, V = Y ?? (i == null ? void 0 : i.id);
1245
1270
  if (!V)
1246
1271
  throw new Error("tenantId is required for password reset");
1247
1272
  await S.requestPasswordReset({ email: z, tenantId: V });
1248
- }, st = async (H) => {
1273
+ }, it = async (H) => {
1249
1274
  const { token: z, newPassword: Y } = H;
1250
1275
  await S.confirmPasswordReset({ token: z, newPassword: Y });
1251
- }, it = async (H) => {
1252
- const { email: z, frontendUrl: Y, name: V, lastName: K, tenantId: te } = H, re = te ?? (i == null ? void 0 : i.id);
1276
+ }, ot = async (H) => {
1277
+ const { email: z, frontendUrl: Y, name: V, lastName: J, tenantId: te } = H, re = te ?? (i == null ? void 0 : i.id);
1253
1278
  if (!re)
1254
1279
  throw new Error("tenantId is required for magic link authentication");
1255
1280
  return await S.sendMagicLink({
@@ -1257,20 +1282,20 @@ function vr({ config: n = {}, children: e }) {
1257
1282
  tenantId: re,
1258
1283
  frontendUrl: Y,
1259
1284
  name: V,
1260
- lastName: K,
1285
+ lastName: J,
1261
1286
  appId: t
1262
1287
  });
1263
- }, ot = async (H) => {
1288
+ }, at = async (H) => {
1264
1289
  const { token: z, email: Y, tenantSlug: V } = H;
1265
- let K = i == null ? void 0 : i.id, te = o, re = l;
1266
- V && (K = (await new we(C, t).getPublicTenantInfo(V)).id, te = V);
1290
+ let J = i == null ? void 0 : i.id, te = o, re = l;
1291
+ V && (J = (await new be(C, t).getPublicTenantInfo(V)).id, te = V);
1267
1292
  const ne = await S.verifyMagicLink({
1268
1293
  token: z,
1269
1294
  email: Y,
1270
1295
  appId: t,
1271
- tenantId: K
1272
- }), Z = V && V !== o;
1273
- if (Z && (re = new pe({
1296
+ tenantId: J
1297
+ }), K = V && V !== o;
1298
+ if (K && (re = new we({
1274
1299
  tenantSlug: te,
1275
1300
  baseUrl: r
1276
1301
  })), re.setTokens({
@@ -1285,14 +1310,14 @@ function vr({ config: n = {}, children: e }) {
1285
1310
  console.warn("Failed to load complete user data after magic link login:", ye);
1286
1311
  }
1287
1312
  }
1288
- return Z && te && te !== o && a(te, {
1313
+ return K && te && te !== o && a(te, {
1289
1314
  tokens: {
1290
1315
  accessToken: ne.accessToken,
1291
1316
  refreshToken: ne.refreshToken,
1292
1317
  expiresIn: ne.expiresIn
1293
1318
  }
1294
1319
  }), ne;
1295
- }, at = async () => {
1320
+ }, lt = async () => {
1296
1321
  const H = l.getTokens();
1297
1322
  if (!(H != null && H.refreshToken))
1298
1323
  throw new Error("No refresh token available");
@@ -1304,17 +1329,17 @@ function vr({ config: n = {}, children: e }) {
1304
1329
  refreshToken: z.refreshToken || H.refreshToken,
1305
1330
  expiresIn: z.expiresIn
1306
1331
  });
1307
- }, lt = () => {
1332
+ }, ct = () => {
1308
1333
  l.clearSession(), p(null), E(null), m([]), L(!1);
1309
1334
  try {
1310
1335
  localStorage.removeItem("userTenants");
1311
1336
  } catch {
1312
1337
  }
1313
- }, ct = (H) => {
1338
+ }, dt = (H) => {
1314
1339
  l.setTokens(H);
1315
- }, dt = () => l.hasValidSession(), ut = () => {
1340
+ }, ut = () => l.hasValidSession(), ht = () => {
1316
1341
  l.clearSession(), p(null), E(null);
1317
- }, ht = async () => {
1342
+ }, pt = async () => {
1318
1343
  if (t)
1319
1344
  try {
1320
1345
  c(!0);
@@ -1325,9 +1350,9 @@ function vr({ config: n = {}, children: e }) {
1325
1350
  } finally {
1326
1351
  c(!1);
1327
1352
  }
1328
- }, pt = async () => {
1329
- await ht();
1330
- }, Pe = (H) => {
1353
+ }, ft = async () => {
1354
+ await pt();
1355
+ }, Re = (H) => {
1331
1356
  if (!Q || Q.length === 0)
1332
1357
  return !1;
1333
1358
  if (typeof H == "string")
@@ -1340,35 +1365,35 @@ function vr({ config: n = {}, children: e }) {
1340
1365
  isAuthenticated: O,
1341
1366
  sessionManager: l,
1342
1367
  authenticatedHttpService: C,
1343
- login: xe,
1344
- signup: Ae,
1345
- signupTenantAdmin: tt,
1346
- sendMagicLink: it,
1347
- verifyMagicLink: ot,
1348
- changePassword: rt,
1349
- requestPasswordReset: nt,
1350
- confirmPasswordReset: st,
1351
- refreshToken: at,
1352
- logout: lt,
1353
- setTokens: ct,
1354
- hasValidSession: dt,
1355
- clearSession: ut,
1368
+ login: Ae,
1369
+ signup: Pe,
1370
+ signupTenantAdmin: rt,
1371
+ sendMagicLink: ot,
1372
+ verifyMagicLink: at,
1373
+ changePassword: nt,
1374
+ requestPasswordReset: st,
1375
+ confirmPasswordReset: it,
1376
+ refreshToken: lt,
1377
+ logout: ct,
1378
+ setTokens: dt,
1379
+ hasValidSession: ut,
1380
+ clearSession: ht,
1356
1381
  currentUser: I,
1357
1382
  isUserLoading: x,
1358
1383
  userError: F,
1359
1384
  loadUserData: G,
1360
- refreshUser: ue,
1385
+ refreshUser: he,
1361
1386
  isAuthInitializing: !h,
1362
1387
  isAuthReady: h,
1363
1388
  userRole: j,
1364
1389
  userPermissions: Q,
1365
1390
  availableRoles: f,
1366
1391
  rolesLoading: w,
1367
- hasPermission: Pe,
1368
- hasAnyPermission: (H) => H.some((z) => Pe(z)),
1369
- hasAllPermissions: (H) => H.every((z) => Pe(z)),
1392
+ hasPermission: Re,
1393
+ hasAnyPermission: (H) => H.some((z) => Re(z)),
1394
+ hasAllPermissions: (H) => H.every((z) => Re(z)),
1370
1395
  getUserPermissionStrings: () => Q || [],
1371
- refreshRoles: pt,
1396
+ refreshRoles: ft,
1372
1397
  // RFC-004: Multi-tenant user membership
1373
1398
  userTenants: k,
1374
1399
  hasTenantContext: M,
@@ -1376,22 +1401,22 @@ function vr({ config: n = {}, children: e }) {
1376
1401
  const { redirectPath: Y } = z || {}, V = l.getTokens();
1377
1402
  if (!(V != null && V.refreshToken))
1378
1403
  throw new Error("No refresh token available for tenant switch");
1379
- const K = await S.switchTenant({
1404
+ const J = await S.switchTenant({
1380
1405
  refreshToken: V.refreshToken,
1381
1406
  tenantId: H
1382
1407
  });
1383
1408
  l.setTokens({
1384
- accessToken: K.accessToken,
1409
+ accessToken: J.accessToken,
1385
1410
  refreshToken: V.refreshToken,
1386
1411
  // Keep the same refresh token
1387
- expiresIn: K.expiresIn
1388
- }), p(K.user), l.setUser(K.user), L(!0);
1412
+ expiresIn: J.expiresIn
1413
+ }), p(J.user), l.setUser(J.user), L(!0);
1389
1414
  const te = k.find((re) => re.id === H);
1390
1415
  te && a(te.subdomain, {
1391
1416
  tokens: {
1392
- accessToken: K.accessToken,
1417
+ accessToken: J.accessToken,
1393
1418
  refreshToken: V.refreshToken,
1394
- expiresIn: K.expiresIn
1419
+ expiresIn: J.expiresIn
1395
1420
  },
1396
1421
  redirectPath: Y
1397
1422
  });
@@ -1429,16 +1454,14 @@ function vr({ config: n = {}, children: e }) {
1429
1454
  A,
1430
1455
  q
1431
1456
  ]);
1432
- ee(() => () => {
1433
- l.destroy();
1434
- }, [l]), ee(() => {
1457
+ ee(() => {
1435
1458
  !n.initialRoles && t && (async () => {
1436
1459
  try {
1437
1460
  c(!0);
1438
- const ue = new le(r), xe = new ze(ue), { roles: Ae } = await xe.getRolesByApp(t);
1439
- g(Ae);
1440
- } catch (ue) {
1441
- console.error("Failed to fetch roles:", ue);
1461
+ const he = new ce(r), Ae = new _e(he), { roles: Pe } = await Ae.getRolesByApp(t);
1462
+ g(Pe);
1463
+ } catch (he) {
1464
+ console.error("Failed to fetch roles:", he);
1442
1465
  } finally {
1443
1466
  c(!1);
1444
1467
  }
@@ -1446,7 +1469,7 @@ function vr({ config: n = {}, children: e }) {
1446
1469
  }, [t, r, n.initialRoles]);
1447
1470
  const [B, X] = T(!1);
1448
1471
  return ee(() => {
1449
- B || (X(!0), D.current.urlTokens && (console.log("[AuthProvider] EFFECT: Cleaning up URL after sync token processing"), Pt(), U(!0), console.log("[AuthProvider] EFFECT: Loading user data (blocking isAuthReady)..."), W.loadUserData().catch((G) => {
1472
+ B || (X(!0), D.current.urlTokens && (console.log("[AuthProvider] EFFECT: Cleaning up URL after sync token processing"), Rt(), U(!0), console.log("[AuthProvider] EFFECT: Loading user data (blocking isAuthReady)..."), W.loadUserData().catch((G) => {
1450
1473
  console.error("[AuthProvider] Failed to load user data:", G);
1451
1474
  }).finally(() => {
1452
1475
  console.log("[AuthProvider] EFFECT: User data loaded, releasing isAuthReady"), U(!1);
@@ -1467,18 +1490,18 @@ function vr({ config: n = {}, children: e }) {
1467
1490
  });
1468
1491
  }, q);
1469
1492
  return () => clearInterval(G);
1470
- }, [l, I, W, q]), /* @__PURE__ */ s(De.Provider, { value: W, children: e });
1493
+ }, [l, I, W, q]), /* @__PURE__ */ s(Ne.Provider, { value: W, children: e });
1471
1494
  }
1472
- function de() {
1473
- const n = ae(De);
1495
+ function ue() {
1496
+ const n = le(Ne);
1474
1497
  if (!n)
1475
1498
  throw new Error("useAuth must be used within an AuthProvider");
1476
1499
  return n;
1477
1500
  }
1478
- function Ne() {
1479
- return ae(De);
1501
+ function Ce() {
1502
+ return le(Ne);
1480
1503
  }
1481
- class Rt {
1504
+ class It {
1482
1505
  constructor(e, t) {
1483
1506
  this.httpService = e, this.sessionManager = t;
1484
1507
  }
@@ -1558,11 +1581,11 @@ class Rt {
1558
1581
  })).data;
1559
1582
  }
1560
1583
  }
1561
- const Ce = fe(null);
1562
- function Tr({ config: n = {}, children: e }) {
1563
- const t = Ze(), r = ke(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (t == null ? void 0 : t.appId) ?? "", a = (r == null ? void 0 : r.tenant) ?? null, [f, g] = T([]), [w, c] = T(!1), [I, p] = T(null), [x, R] = T(!1), F = J(() => {
1564
- const u = new le(i);
1565
- return new Rt(u);
1584
+ const Ue = fe(null);
1585
+ function kr({ config: n = {}, children: e }) {
1586
+ const t = Ze(), r = xe(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (t == null ? void 0 : t.appId) ?? "", a = (r == null ? void 0 : r.tenant) ?? null, [f, g] = T([]), [w, c] = T(!1), [I, p] = T(null), [x, R] = T(!1), F = Z(() => {
1587
+ const u = new ce(i);
1588
+ return new It(u);
1566
1589
  }, [i]), E = async () => {
1567
1590
  if (!(a != null && a.id)) {
1568
1591
  g([]);
@@ -1585,7 +1608,7 @@ function Tr({ config: n = {}, children: e }) {
1585
1608
  const u = n.refreshInterval || 5 * 60 * 1e3, k = setInterval(E, u);
1586
1609
  return () => clearInterval(k);
1587
1610
  }, [a == null ? void 0 : a.id, i, o, n.refreshInterval]);
1588
- const A = J(() => {
1611
+ const A = Z(() => {
1589
1612
  const u = (D) => {
1590
1613
  const P = f.find((U) => U.key === D);
1591
1614
  return (P == null ? void 0 : P.value) === !0;
@@ -1606,18 +1629,18 @@ function Tr({ config: n = {}, children: e }) {
1606
1629
  refresh: M
1607
1630
  };
1608
1631
  }, [f, w, I, i, o, a == null ? void 0 : a.id, x]);
1609
- return /* @__PURE__ */ s(Ce.Provider, { value: A, children: e });
1632
+ return /* @__PURE__ */ s(Ue.Provider, { value: A, children: e });
1610
1633
  }
1611
- function It() {
1612
- const n = ae(Ce);
1634
+ function Et() {
1635
+ const n = le(Ue);
1613
1636
  if (!n)
1614
1637
  throw new Error("useFeatureFlags must be used within a FeatureFlagProvider");
1615
1638
  return n;
1616
1639
  }
1617
1640
  function Je() {
1618
- return ae(Ce);
1641
+ return le(Ue);
1619
1642
  }
1620
- class Et {
1643
+ class Mt {
1621
1644
  constructor(e, t) {
1622
1645
  this.httpService = e, this.sessionManager = t;
1623
1646
  }
@@ -1683,11 +1706,11 @@ class Et {
1683
1706
  )).data;
1684
1707
  }
1685
1708
  }
1686
- const Ue = fe(void 0);
1687
- function kr({ config: n = {}, children: e }) {
1688
- const t = Ze(), r = ke(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (r == null ? void 0 : r.tenant) ?? null, [a, f] = T(null), [g, w] = T(!1), [c, I] = T(null), [p, x] = T(!1), R = J(() => {
1689
- const A = new le(i);
1690
- return new Et(A);
1709
+ const $e = fe(void 0);
1710
+ function xr({ config: n = {}, children: e }) {
1711
+ const t = Ze(), r = xe(), i = (t == null ? void 0 : t.baseUrl) ?? "", o = (r == null ? void 0 : r.tenant) ?? null, [a, f] = T(null), [g, w] = T(!1), [c, I] = T(null), [p, x] = T(!1), R = Z(() => {
1712
+ const A = new ce(i);
1713
+ return new Mt(A);
1691
1714
  }, [i]), F = async () => {
1692
1715
  if (!(o != null && o.id)) {
1693
1716
  f(null);
@@ -1709,7 +1732,7 @@ function kr({ config: n = {}, children: e }) {
1709
1732
  const A = n.refreshInterval || 10 * 60 * 1e3, u = setInterval(F, A);
1710
1733
  return () => clearInterval(u);
1711
1734
  }, [o == null ? void 0 : o.id, i, n.refreshInterval]);
1712
- const E = J(() => {
1735
+ const E = Z(() => {
1713
1736
  const A = (a == null ? void 0 : a.features) || [], u = (P) => {
1714
1737
  const U = A.find((l) => l.key === P);
1715
1738
  return U ? U.type === "BOOLEAN" || U.type === "boolean" ? U.value === !0 : !!U.value : !1;
@@ -1732,19 +1755,19 @@ function kr({ config: n = {}, children: e }) {
1732
1755
  refresh: L
1733
1756
  };
1734
1757
  }, [a, g, c, i, o == null ? void 0 : o.id, p]);
1735
- return /* @__PURE__ */ s(Ue.Provider, { value: E, children: e });
1758
+ return /* @__PURE__ */ s($e.Provider, { value: E, children: e });
1736
1759
  }
1737
- function Mt() {
1738
- const n = ae(Ue);
1760
+ function Lt() {
1761
+ const n = le($e);
1739
1762
  if (n === void 0)
1740
1763
  throw new Error("useSubscription must be used within a SubscriptionProvider");
1741
1764
  return n;
1742
1765
  }
1743
- function Ke() {
1744
- return ae(Ue) ?? null;
1766
+ function Ye() {
1767
+ return le($e) ?? null;
1745
1768
  }
1746
- var oe = /* @__PURE__ */ ((n) => (n.SUPERUSER = "SUPERUSER", n.TENANT_ADMIN = "TENANT_ADMIN", n.USER = "USER", n))(oe || {});
1747
- const $e = {
1769
+ var ae = /* @__PURE__ */ ((n) => (n.SUPERUSER = "SUPERUSER", n.TENANT_ADMIN = "TENANT_ADMIN", n.USER = "USER", n))(ae || {});
1770
+ const He = {
1748
1771
  publicGuest: "/",
1749
1772
  publicUser: "/account",
1750
1773
  publicAdmin: "/admin",
@@ -1752,7 +1775,7 @@ const $e = {
1752
1775
  tenantUser: "/dashboard",
1753
1776
  tenantAdmin: "/admin/dashboard",
1754
1777
  default: "/"
1755
- }, Ye = {
1778
+ }, Xe = {
1756
1779
  // Public/Landing zones
1757
1780
  landing: { tenant: "forbidden", auth: "optional" },
1758
1781
  publicOnly: { tenant: "forbidden", auth: "forbidden" },
@@ -1765,18 +1788,18 @@ const $e = {
1765
1788
  tenantOpen: { tenant: "required", auth: "optional" },
1766
1789
  tenantAuth: { tenant: "required", auth: "required" },
1767
1790
  // User type zones
1768
- user: { tenant: "required", auth: "required", userType: oe.USER },
1769
- admin: { tenant: "required", auth: "required", userType: oe.TENANT_ADMIN },
1791
+ user: { tenant: "required", auth: "required", userType: ae.USER },
1792
+ admin: { tenant: "required", auth: "required", userType: ae.TENANT_ADMIN },
1770
1793
  // Fully open
1771
1794
  open: { tenant: "optional", auth: "optional" }
1772
- }, He = fe(null);
1773
- function xr({ config: n = {}, children: e }) {
1774
- const t = J(() => {
1795
+ }, Be = fe(null);
1796
+ function Ar({ config: n = {}, children: e }) {
1797
+ const t = Z(() => {
1775
1798
  const r = {
1776
- ...$e,
1799
+ ...He,
1777
1800
  ...n.zoneRoots
1778
1801
  }, i = {
1779
- ...Ye,
1802
+ ...Xe,
1780
1803
  ...n.presets
1781
1804
  };
1782
1805
  return {
@@ -1789,19 +1812,19 @@ function xr({ config: n = {}, children: e }) {
1789
1812
  returnToStorage: n.returnToStorage ?? "url"
1790
1813
  };
1791
1814
  }, [n]);
1792
- return /* @__PURE__ */ s(He.Provider, { value: t, children: e });
1815
+ return /* @__PURE__ */ s(Be.Provider, { value: t, children: e });
1793
1816
  }
1794
- function Ar() {
1795
- const n = ae(He);
1817
+ function Pr() {
1818
+ const n = le(Be);
1796
1819
  if (!n)
1797
1820
  throw new Error("useRouting must be used within a RoutingProvider");
1798
1821
  return n;
1799
1822
  }
1800
- function Lt() {
1801
- const n = ae(He);
1823
+ function Ft() {
1824
+ const n = le(Be);
1802
1825
  return n || {
1803
- zoneRoots: $e,
1804
- presets: Ye,
1826
+ zoneRoots: He,
1827
+ presets: Xe,
1805
1828
  loadingFallback: null,
1806
1829
  accessDeniedFallback: null,
1807
1830
  onAccessDenied: void 0,
@@ -1809,7 +1832,7 @@ function Lt() {
1809
1832
  returnToStorage: "url"
1810
1833
  };
1811
1834
  }
1812
- const We = () => /* @__PURE__ */ d(
1835
+ const Ve = () => /* @__PURE__ */ d(
1813
1836
  "div",
1814
1837
  {
1815
1838
  style: {
@@ -1846,7 +1869,7 @@ const We = () => /* @__PURE__ */ d(
1846
1869
  )
1847
1870
  ]
1848
1871
  }
1849
- ), Ve = ({
1872
+ ), je = ({
1850
1873
  userType: n,
1851
1874
  minUserType: e,
1852
1875
  missingPermissions: t
@@ -1887,36 +1910,36 @@ const We = () => /* @__PURE__ */ d(
1887
1910
  ] })
1888
1911
  ]
1889
1912
  }
1890
- ), Ft = (n, e) => {
1913
+ ), Dt = (n, e) => {
1891
1914
  const t = {
1892
- [oe.USER]: 1,
1893
- [oe.TENANT_ADMIN]: 2,
1894
- [oe.SUPERUSER]: 3
1915
+ [ae.USER]: 1,
1916
+ [ae.TENANT_ADMIN]: 2,
1917
+ [ae.SUPERUSER]: 3
1895
1918
  };
1896
1919
  return t[n] >= t[e];
1897
1920
  };
1898
- function Pr({
1921
+ function Rr({
1899
1922
  children: n,
1900
1923
  fallback: e,
1901
1924
  minUserType: t,
1902
1925
  requiredPermissions: r,
1903
1926
  requireAllPermissions: i = !1
1904
1927
  }) {
1905
- const { hasValidSession: o, sessionManager: a, hasPermission: f, hasAnyPermission: g, hasAllPermissions: w } = de();
1928
+ const { hasValidSession: o, sessionManager: a, hasPermission: f, hasAnyPermission: g, hasAllPermissions: w } = ue();
1906
1929
  if (!o())
1907
- return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(We, {}) });
1930
+ return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(Ve, {}) });
1908
1931
  const c = a.getUser();
1909
1932
  if (!c)
1910
- return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(We, {}) });
1911
- if (t && !Ft(c.userType, t))
1912
- return /* @__PURE__ */ s(Ve, { userType: c.userType, minUserType: t });
1933
+ return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(Ve, {}) });
1934
+ if (t && !Dt(c.userType, t))
1935
+ return /* @__PURE__ */ s(je, { userType: c.userType, minUserType: t });
1913
1936
  if (r && r.length > 0 && !(i ? w(r) : g(r))) {
1914
1937
  const p = r.filter((x) => !f(x)).map((x) => typeof x == "string" ? x : x.name);
1915
- return /* @__PURE__ */ s(Ve, { missingPermissions: p });
1938
+ return /* @__PURE__ */ s(je, { missingPermissions: p });
1916
1939
  }
1917
1940
  return /* @__PURE__ */ s(_, { children: n });
1918
1941
  }
1919
- const Dt = ({ redirectPath: n }) => /* @__PURE__ */ s(
1942
+ const Nt = ({ redirectPath: n }) => /* @__PURE__ */ s(
1920
1943
  "div",
1921
1944
  {
1922
1945
  style: {
@@ -1952,7 +1975,7 @@ const Dt = ({ redirectPath: n }) => /* @__PURE__ */ s(
1952
1975
  }
1953
1976
  )
1954
1977
  }
1955
- ), je = ({
1978
+ ), Ge = ({
1956
1979
  userType: n,
1957
1980
  requiredUserType: e,
1958
1981
  missingPermissions: t
@@ -2003,8 +2026,8 @@ const Dt = ({ redirectPath: n }) => /* @__PURE__ */ s(
2003
2026
  }
2004
2027
  )
2005
2028
  }
2006
- ), Nt = (n, e) => n === e;
2007
- function Rr({
2029
+ ), Ct = (n, e) => n === e;
2030
+ function Ir({
2008
2031
  children: n,
2009
2032
  redirectTo: e = "/login",
2010
2033
  requiredUserType: t,
@@ -2012,22 +2035,22 @@ function Rr({
2012
2035
  requireAllPermissions: i = !1,
2013
2036
  fallback: o
2014
2037
  }) {
2015
- const { hasValidSession: a, sessionManager: f, hasPermission: g, hasAnyPermission: w, hasAllPermissions: c } = de(), I = Te();
2038
+ const { hasValidSession: a, sessionManager: f, hasPermission: g, hasAnyPermission: w, hasAllPermissions: c } = ue(), I = ke();
2016
2039
  if (ee(() => {
2017
2040
  process.env.NODE_ENV === "development" && console.warn(
2018
2041
  "[react-identity-access] ProtectedRoute is deprecated. Use AuthenticatedZone or AdminZone from ZoneRoute instead."
2019
2042
  );
2020
2043
  }, []), !a())
2021
2044
  return o ? /* @__PURE__ */ s(_, { children: o }) : /* @__PURE__ */ d(_, { children: [
2022
- /* @__PURE__ */ s(Dt, { redirectPath: e }),
2023
- /* @__PURE__ */ s(be, { to: e, state: { from: I.pathname }, replace: !0 })
2045
+ /* @__PURE__ */ s(Nt, { redirectPath: e }),
2046
+ /* @__PURE__ */ s(Se, { to: e, state: { from: I.pathname }, replace: !0 })
2024
2047
  ] });
2025
2048
  const p = f.getUser();
2026
2049
  if (!p)
2027
- return /* @__PURE__ */ s(be, { to: e, state: { from: I.pathname }, replace: !0 });
2028
- if (t && !Nt(p.userType, t))
2050
+ return /* @__PURE__ */ s(Se, { to: e, state: { from: I.pathname }, replace: !0 });
2051
+ if (t && !Ct(p.userType, t))
2029
2052
  return /* @__PURE__ */ s(
2030
- je,
2053
+ Ge,
2031
2054
  {
2032
2055
  userType: p.userType,
2033
2056
  requiredUserType: t
@@ -2035,11 +2058,11 @@ function Rr({
2035
2058
  );
2036
2059
  if (r && r.length > 0 && !(i ? c(r) : w(r))) {
2037
2060
  const R = r.filter((F) => !g(F)).map((F) => typeof F == "string" ? F : F.name);
2038
- return /* @__PURE__ */ s(je, { missingPermissions: R });
2061
+ return /* @__PURE__ */ s(Ge, { missingPermissions: R });
2039
2062
  }
2040
2063
  return /* @__PURE__ */ s(_, { children: n });
2041
2064
  }
2042
- const Ct = ({ redirectPath: n }) => /* @__PURE__ */ s(
2065
+ const Ut = ({ redirectPath: n }) => /* @__PURE__ */ s(
2043
2066
  "div",
2044
2067
  {
2045
2068
  style: {
@@ -2076,18 +2099,18 @@ const Ct = ({ redirectPath: n }) => /* @__PURE__ */ s(
2076
2099
  )
2077
2100
  }
2078
2101
  );
2079
- function Ir({ children: n, redirectTo: e = "/", fallback: t }) {
2080
- const { tenant: r, isLoading: i, error: o } = me(), a = Te();
2102
+ function Er({ children: n, redirectTo: e = "/", fallback: t }) {
2103
+ const { tenant: r, isLoading: i, error: o } = me(), a = ke();
2081
2104
  return ee(() => {
2082
2105
  process.env.NODE_ENV === "development" && console.warn(
2083
2106
  "[react-identity-access] TenantRoute is deprecated. Use TenantZone from ZoneRoute instead."
2084
2107
  );
2085
2108
  }, []), i || o ? null : r ? /* @__PURE__ */ s(_, { children: n }) : t ? /* @__PURE__ */ s(_, { children: t }) : /* @__PURE__ */ d(_, { children: [
2086
- /* @__PURE__ */ s(Ct, { redirectPath: e }),
2087
- /* @__PURE__ */ s(be, { to: e, state: { from: a.pathname }, replace: !0 })
2109
+ /* @__PURE__ */ s(Ut, { redirectPath: e }),
2110
+ /* @__PURE__ */ s(Se, { to: e, state: { from: a.pathname }, replace: !0 })
2088
2111
  ] });
2089
2112
  }
2090
- const Ut = ({ redirectPath: n }) => /* @__PURE__ */ s(
2113
+ const $t = ({ redirectPath: n }) => /* @__PURE__ */ s(
2091
2114
  "div",
2092
2115
  {
2093
2116
  style: {
@@ -2124,41 +2147,41 @@ const Ut = ({ redirectPath: n }) => /* @__PURE__ */ s(
2124
2147
  )
2125
2148
  }
2126
2149
  );
2127
- function Er({ children: n, redirectTo: e = "/dashboard", fallback: t }) {
2128
- const { tenant: r, isLoading: i, error: o } = me(), a = Te();
2150
+ function Mr({ children: n, redirectTo: e = "/dashboard", fallback: t }) {
2151
+ const { tenant: r, isLoading: i, error: o } = me(), a = ke();
2129
2152
  return ee(() => {
2130
2153
  process.env.NODE_ENV === "development" && console.warn(
2131
2154
  "[react-identity-access] LandingRoute is deprecated. Use PublicZone from ZoneRoute instead."
2132
2155
  );
2133
2156
  }, []), i || o ? null : r ? t ? /* @__PURE__ */ s(_, { children: t }) : /* @__PURE__ */ d(_, { children: [
2134
- /* @__PURE__ */ s(Ut, { redirectPath: e }),
2135
- /* @__PURE__ */ s(be, { to: e, state: { from: a.pathname }, replace: !0 })
2157
+ /* @__PURE__ */ s($t, { redirectPath: e }),
2158
+ /* @__PURE__ */ s(Se, { to: e, state: { from: a.pathname }, replace: !0 })
2136
2159
  ] }) : /* @__PURE__ */ s(_, { children: n });
2137
2160
  }
2138
- function $t(n, e) {
2161
+ function Ht(n, e) {
2139
2162
  return e ? n ? Array.isArray(e) ? e.includes(n) : n === e : !1 : !0;
2140
2163
  }
2141
- function Ge(n, e) {
2164
+ function Qe(n, e) {
2142
2165
  return !n || n === "optional" ? "skip" : n === "required" ? e ? "pass" : "fail" : n === "forbidden" ? e ? "fail" : "pass" : "skip";
2143
2166
  }
2144
- function Ht(n, e) {
2145
- return Ge(n.tenant, e.hasTenant) === "fail" ? e.hasTenant ? "has_tenant" : "no_tenant" : Ge(n.auth, e.isAuthenticated) === "fail" ? e.isAuthenticated ? "already_authenticated" : "not_authenticated" : n.userType && e.isAuthenticated && !$t(e.userType, n.userType) ? "wrong_user_type" : n.permissions && n.permissions.length > 0 && !(n.requireAllPermissions !== !1 ? (o) => o.every((a) => e.permissions.includes(a)) : (o) => o.some((a) => e.permissions.includes(a)))(n.permissions) ? "missing_permissions" : null;
2146
- }
2147
2167
  function Bt(n, e) {
2148
- return n.hasTenant ? n.isAuthenticated ? n.userType === oe.TENANT_ADMIN ? e.tenantAdmin : e.tenantUser : e.tenantGuest : n.isAuthenticated ? n.userType === oe.TENANT_ADMIN ? e.publicAdmin : e.publicUser : e.publicGuest;
2168
+ return Qe(n.tenant, e.hasTenant) === "fail" ? e.hasTenant ? "has_tenant" : "no_tenant" : Qe(n.auth, e.isAuthenticated) === "fail" ? e.isAuthenticated ? "already_authenticated" : "not_authenticated" : n.userType && e.isAuthenticated && !Ht(e.userType, n.userType) ? "wrong_user_type" : n.permissions && n.permissions.length > 0 && !(n.requireAllPermissions !== !1 ? (o) => o.every((a) => e.permissions.includes(a)) : (o) => o.some((a) => e.permissions.includes(a)))(n.permissions) ? "missing_permissions" : null;
2149
2169
  }
2150
- function qt(n, e, t, r, i) {
2170
+ function qt(n, e) {
2171
+ return n.hasTenant ? n.isAuthenticated ? n.userType === ae.TENANT_ADMIN ? e.tenantAdmin : e.tenantUser : e.tenantGuest : n.isAuthenticated ? n.userType === ae.TENANT_ADMIN ? e.publicAdmin : e.publicUser : e.publicGuest;
2172
+ }
2173
+ function Ot(n, e, t, r, i) {
2151
2174
  if (!e || i !== "url")
2152
2175
  return n;
2153
2176
  const o = typeof e == "string" ? e : t, a = n.includes("?") ? "&" : "?";
2154
2177
  return `${n}${a}${r}=${encodeURIComponent(o)}`;
2155
2178
  }
2156
- function Ot(n, e, t) {
2179
+ function zt(n, e, t) {
2157
2180
  if (!n || t === "url") return;
2158
2181
  const r = typeof n == "string" ? n : e, i = "zone_return_to";
2159
2182
  t === "session" ? sessionStorage.setItem(i, r) : t === "local" && localStorage.setItem(i, r);
2160
2183
  }
2161
- const ce = ({
2184
+ const de = ({
2162
2185
  children: n,
2163
2186
  preset: e,
2164
2187
  tenant: t,
@@ -2172,10 +2195,10 @@ const ce = ({
2172
2195
  loadingFallback: c,
2173
2196
  accessDeniedFallback: I
2174
2197
  }) => {
2175
- const p = Te(), { isAuthenticated: x, isAuthInitializing: R, currentUser: F, userPermissions: E } = de(), { tenant: A, isTenantLoading: u } = ge(), k = Lt(), m = J(() => {
2198
+ const p = ke(), { isAuthenticated: x, isAuthInitializing: R, currentUser: F, userPermissions: E } = ue(), { tenant: A, isTenantLoading: u } = ge(), k = Ft(), m = Z(() => {
2176
2199
  if (e)
2177
2200
  return k.presets[e];
2178
- }, [e, k.presets]), M = J(
2201
+ }, [e, k.presets]), M = Z(
2179
2202
  () => ({
2180
2203
  tenant: t ?? (m == null ? void 0 : m.tenant),
2181
2204
  auth: r ?? (m == null ? void 0 : m.auth),
@@ -2184,7 +2207,7 @@ const ce = ({
2184
2207
  requireAllPermissions: a
2185
2208
  }),
2186
2209
  [t, r, i, o, m, a]
2187
- ), L = J(
2210
+ ), L = Z(
2188
2211
  () => ({
2189
2212
  hasTenant: !!A,
2190
2213
  isAuthenticated: x,
@@ -2200,7 +2223,7 @@ const ce = ({
2200
2223
  R,
2201
2224
  u
2202
2225
  ]
2203
- ), D = J(() => L.isLoading ? null : Ht(M, L), [M, L]), P = J(() => D ? w || Bt(L, k.zoneRoots) : null, [D, w, L, k.zoneRoots]), U = J(() => !D || !P ? null : {
2226
+ ), D = Z(() => L.isLoading ? null : Bt(M, L), [M, L]), P = Z(() => D ? w || qt(L, k.zoneRoots) : null, [D, w, L, k.zoneRoots]), U = Z(() => !D || !P ? null : {
2204
2227
  type: D,
2205
2228
  required: {
2206
2229
  tenant: M.tenant,
@@ -2219,7 +2242,7 @@ const ce = ({
2219
2242
  if (ee(() => {
2220
2243
  U && (g ? g(U) : k.onAccessDenied && k.onAccessDenied(U));
2221
2244
  }, [U, g, k]), ee(() => {
2222
- U && f && Ot(f, p.pathname + p.search, k.returnToStorage);
2245
+ U && f && zt(f, p.pathname + p.search, k.returnToStorage);
2223
2246
  }, [
2224
2247
  U,
2225
2248
  f,
@@ -2232,17 +2255,17 @@ const ce = ({
2232
2255
  const l = I ?? k.accessDeniedFallback;
2233
2256
  if (l)
2234
2257
  return /* @__PURE__ */ s(_, { children: l });
2235
- const N = qt(
2258
+ const N = Ot(
2236
2259
  P,
2237
2260
  f,
2238
2261
  p.pathname + p.search,
2239
2262
  k.returnToParam,
2240
2263
  k.returnToStorage
2241
2264
  );
2242
- return /* @__PURE__ */ s(be, { to: N, replace: !0 });
2265
+ return /* @__PURE__ */ s(Se, { to: N, replace: !0 });
2243
2266
  }
2244
2267
  return /* @__PURE__ */ s(_, { children: n });
2245
- }, Mr = (n) => /* @__PURE__ */ s(ce, { tenant: "required", ...n }), Lr = (n) => /* @__PURE__ */ s(ce, { tenant: "forbidden", ...n }), Fr = (n) => /* @__PURE__ */ s(ce, { auth: "required", ...n }), Dr = (n) => /* @__PURE__ */ s(ce, { auth: "forbidden", ...n }), Nr = (n) => /* @__PURE__ */ s(ce, { auth: "required", userType: oe.TENANT_ADMIN, ...n }), Cr = (n) => /* @__PURE__ */ s(ce, { auth: "required", userType: oe.USER, ...n }), Ur = (n) => /* @__PURE__ */ s(ce, { tenant: "optional", auth: "optional", ...n }), $r = (n) => /* @__PURE__ */ s(ce, { tenant: "required", auth: "required", ...n }), Hr = (n) => /* @__PURE__ */ s(ce, { tenant: "required", auth: "optional", ...n }), Br = (n) => /* @__PURE__ */ s(ce, { tenant: "required", auth: "forbidden", ...n }), zt = () => /* @__PURE__ */ d(
2268
+ }, Lr = (n) => /* @__PURE__ */ s(de, { tenant: "required", ...n }), Fr = (n) => /* @__PURE__ */ s(de, { tenant: "forbidden", ...n }), Dr = (n) => /* @__PURE__ */ s(de, { auth: "required", ...n }), Nr = (n) => /* @__PURE__ */ s(de, { auth: "forbidden", ...n }), Cr = (n) => /* @__PURE__ */ s(de, { auth: "required", userType: ae.TENANT_ADMIN, ...n }), Ur = (n) => /* @__PURE__ */ s(de, { auth: "required", userType: ae.USER, ...n }), $r = (n) => /* @__PURE__ */ s(de, { tenant: "optional", auth: "optional", ...n }), Hr = (n) => /* @__PURE__ */ s(de, { tenant: "required", auth: "required", ...n }), Br = (n) => /* @__PURE__ */ s(de, { tenant: "required", auth: "optional", ...n }), qr = (n) => /* @__PURE__ */ s(de, { tenant: "required", auth: "forbidden", ...n }), _t = () => /* @__PURE__ */ d(
2246
2269
  "div",
2247
2270
  {
2248
2271
  style: {
@@ -2259,13 +2282,13 @@ const ce = ({
2259
2282
  ]
2260
2283
  }
2261
2284
  );
2262
- function qr({
2285
+ function Or({
2263
2286
  children: n,
2264
- fallback: e = /* @__PURE__ */ s(zt, {}),
2287
+ fallback: e = /* @__PURE__ */ s(_t, {}),
2265
2288
  allowedPlans: t,
2266
2289
  requiredFeature: r
2267
2290
  }) {
2268
- const { subscription: i, hasAllowedPlan: o, isFeatureEnabled: a, loading: f } = Mt();
2291
+ const { subscription: i, hasAllowedPlan: o, isFeatureEnabled: a, loading: f } = Lt();
2269
2292
  return f ? /* @__PURE__ */ s(
2270
2293
  "div",
2271
2294
  {
@@ -2278,7 +2301,7 @@ function qr({
2278
2301
  }
2279
2302
  ) : i ? i.isActive ? t && t.length > 0 && !o(t) ? /* @__PURE__ */ s(_, { children: e }) : r && !a(r) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: n }) : /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: e });
2280
2303
  }
2281
- const _t = ({ flagName: n }) => /* @__PURE__ */ d(
2304
+ const Wt = ({ flagName: n }) => /* @__PURE__ */ d(
2282
2305
  "div",
2283
2306
  {
2284
2307
  style: {
@@ -2305,8 +2328,8 @@ const _t = ({ flagName: n }) => /* @__PURE__ */ d(
2305
2328
  ]
2306
2329
  }
2307
2330
  );
2308
- function Or({ name: n, children: e, fallback: t }) {
2309
- const { isEnabled: r, loading: i } = It();
2331
+ function zr({ name: n, children: e, fallback: t }) {
2332
+ const { isEnabled: r, loading: i } = Et();
2310
2333
  return i ? /* @__PURE__ */ s(
2311
2334
  "div",
2312
2335
  {
@@ -2320,9 +2343,9 @@ function Or({ name: n, children: e, fallback: t }) {
2320
2343
  },
2321
2344
  children: "Loading feature flags..."
2322
2345
  }
2323
- ) : r(n) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: t || /* @__PURE__ */ s(_t, { flagName: n }) });
2346
+ ) : r(n) ? /* @__PURE__ */ s(_, { children: e }) : /* @__PURE__ */ s(_, { children: t || /* @__PURE__ */ s(Wt, { flagName: n }) });
2324
2347
  }
2325
- const Wt = () => /* @__PURE__ */ d(
2348
+ const Vt = () => /* @__PURE__ */ d(
2326
2349
  "svg",
2327
2350
  {
2328
2351
  width: "16",
@@ -2339,7 +2362,7 @@ const Wt = () => /* @__PURE__ */ d(
2339
2362
  /* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "3" })
2340
2363
  ]
2341
2364
  }
2342
- ), Vt = () => /* @__PURE__ */ d(
2365
+ ), jt = () => /* @__PURE__ */ d(
2343
2366
  "svg",
2344
2367
  {
2345
2368
  width: "16",
@@ -2356,10 +2379,10 @@ const Wt = () => /* @__PURE__ */ d(
2356
2379
  /* @__PURE__ */ s("line", { x1: "1", y1: "1", x2: "23", y2: "23" })
2357
2380
  ]
2358
2381
  }
2359
- ), jt = {
2360
- showPassword: /* @__PURE__ */ s(Wt, {}),
2361
- hidePassword: /* @__PURE__ */ s(Vt, {})
2362
- }, Gt = {
2382
+ ), Gt = {
2383
+ showPassword: /* @__PURE__ */ s(Vt, {}),
2384
+ hidePassword: /* @__PURE__ */ s(jt, {})
2385
+ }, Qt = {
2363
2386
  title: "Sign In",
2364
2387
  usernameLabel: "Email or Phone",
2365
2388
  usernamePlaceholder: "Enter your email or phone number",
@@ -2373,7 +2396,7 @@ const Wt = () => /* @__PURE__ */ d(
2373
2396
  magicLinkLink: "Use Magic Link",
2374
2397
  errorMessage: "Invalid credentials",
2375
2398
  loadingText: "Signing in..."
2376
- }, Qt = {
2399
+ }, Kt = {
2377
2400
  container: {
2378
2401
  maxWidth: "400px",
2379
2402
  width: "100%",
@@ -2480,7 +2503,7 @@ const Wt = () => /* @__PURE__ */ d(
2480
2503
  fontSize: "0.875rem"
2481
2504
  }
2482
2505
  };
2483
- function zr({
2506
+ function _r({
2484
2507
  copy: n = {},
2485
2508
  styles: e = {},
2486
2509
  icons: t = {},
@@ -2494,7 +2517,7 @@ function zr({
2494
2517
  showMagicLinkOption: c = !0,
2495
2518
  className: I
2496
2519
  }) {
2497
- const [p, x] = T(""), [R, F] = T(""), [E, A] = T(!1), [u, k] = T(!1), [m, M] = T(""), [L, D] = T({}), { login: P } = de(), { tenant: U } = me(), l = { ...Gt, ...n }, N = { ...Qt, ...e }, $ = { ...jt, ...t }, h = () => {
2520
+ const [p, x] = T(""), [R, F] = T(""), [E, A] = T(!1), [u, k] = T(!1), [m, M] = T(""), [L, D] = T({}), { login: P } = ue(), { tenant: U } = me(), l = { ...Qt, ...n }, N = { ...Kt, ...e }, $ = { ...Gt, ...t }, h = () => {
2498
2521
  const y = {};
2499
2522
  return p.trim() || (y.username = !0), R.trim() || (y.password = !0), D(y), Object.keys(y).length === 0;
2500
2523
  }, C = async (y) => {
@@ -2731,7 +2754,7 @@ const Zt = {
2731
2754
  fontSize: "0.875rem"
2732
2755
  }
2733
2756
  };
2734
- function _r({
2757
+ function Wr({
2735
2758
  copy: n = {},
2736
2759
  styles: e = {},
2737
2760
  signupType: t = "user",
@@ -2743,7 +2766,7 @@ function _r({
2743
2766
  showMagicLinkOption: g = !0,
2744
2767
  className: w
2745
2768
  }) {
2746
- const [c, I] = T(""), [p, x] = T(""), [R, F] = T(""), [E, A] = T(""), [u, k] = T(""), [m, M] = T(""), [L, D] = T(""), [P, U] = T(!1), [l, N] = T(""), [$, h] = T({}), { signup: C, signupTenantAdmin: S } = de(), { tenant: b } = me(), y = { ...Zt, ...n }, v = { ...Jt, ...e }, j = () => {
2769
+ const [c, I] = T(""), [p, x] = T(""), [R, F] = T(""), [E, A] = T(""), [u, k] = T(""), [m, M] = T(""), [L, D] = T(""), [P, U] = T(!1), [l, N] = T(""), [$, h] = T({}), { signup: C, signupTenantAdmin: S } = ue(), { tenant: b } = me(), y = { ...Zt, ...n }, v = { ...Jt, ...e }, j = () => {
2747
2770
  const B = {};
2748
2771
  return c.trim() || (B.name = !0), !R.trim() && !E.trim() && (B.email = !0, B.phoneNumber = !0), u.trim() || (B.password = !0), m.trim() || (B.confirmPassword = !0), t === "tenant" && !L.trim() && (B.tenantName = !0), h(B), Object.keys(B).length === 0;
2749
2772
  }, Q = async (B) => {
@@ -2950,7 +2973,7 @@ function _r({
2950
2973
  ] })
2951
2974
  ] });
2952
2975
  }
2953
- const Kt = {
2976
+ const Yt = {
2954
2977
  title: "Sign In with Magic Link",
2955
2978
  emailLabel: "Email",
2956
2979
  emailPlaceholder: "Enter your email",
@@ -2968,7 +2991,7 @@ const Kt = {
2968
2991
  loadingText: "Sending magic link...",
2969
2992
  verifyingText: "Verifying magic link...",
2970
2993
  description: "Enter your email to receive a magic link. If you don't have an account, we'll create one for you."
2971
- }, Yt = {
2994
+ }, Xt = {
2972
2995
  container: {
2973
2996
  maxWidth: "400px",
2974
2997
  width: "100%",
@@ -3071,7 +3094,7 @@ const Kt = {
3071
3094
  fontSize: "0.875rem"
3072
3095
  }
3073
3096
  };
3074
- function Wr({
3097
+ function Vr({
3075
3098
  copy: n = {},
3076
3099
  styles: e = {},
3077
3100
  onSuccess: t,
@@ -3083,7 +3106,7 @@ function Wr({
3083
3106
  verifyToken: g,
3084
3107
  frontendUrl: w
3085
3108
  }) {
3086
- const [c, I] = T(""), [p, x] = T(""), [R, F] = T(""), [E, A] = T(!1), [u, k] = T(!1), [m, M] = T(""), [L, D] = T(""), [P, U] = T({}), [l, N] = T(!1), { sendMagicLink: $, verifyMagicLink: h } = de(), { tenant: C } = me(), S = { ...Kt, ...n }, b = { ...Yt, ...e };
3109
+ const [c, I] = T(""), [p, x] = T(""), [R, F] = T(""), [E, A] = T(!1), [u, k] = T(!1), [m, M] = T(""), [L, D] = T(""), [P, U] = T({}), [l, N] = T(!1), { sendMagicLink: $, verifyMagicLink: h } = ue(), { tenant: C } = me(), S = { ...Yt, ...n }, b = { ...Xt, ...e };
3087
3110
  ee(() => {
3088
3111
  g && y(g);
3089
3112
  }, [g]);
@@ -3258,7 +3281,7 @@ function Wr({
3258
3281
  ] })
3259
3282
  ] });
3260
3283
  }
3261
- const Xt = {
3284
+ const er = {
3262
3285
  title: "Verifying Magic Link",
3263
3286
  verifyingMessage: "Please wait while we verify your magic link...",
3264
3287
  successMessage: "Magic link verified successfully! You are now logged in.",
@@ -3266,7 +3289,7 @@ const Xt = {
3266
3289
  redirectingMessage: "Redirecting you to the dashboard...",
3267
3290
  retryButton: "Try Again",
3268
3291
  backToLoginButton: "Back to Login"
3269
- }, Xe = {
3292
+ }, et = {
3270
3293
  container: {
3271
3294
  maxWidth: "400px",
3272
3295
  width: "100%",
@@ -3353,7 +3376,7 @@ const Xt = {
3353
3376
  cursor: "pointer",
3354
3377
  transition: "all 0.15s ease-in-out"
3355
3378
  }
3356
- }, er = () => /* @__PURE__ */ s("div", { style: Xe.spinner }), tr = () => /* @__PURE__ */ d(
3379
+ }, tr = () => /* @__PURE__ */ s("div", { style: et.spinner }), rr = () => /* @__PURE__ */ d(
3357
3380
  "svg",
3358
3381
  {
3359
3382
  width: "48",
@@ -3370,7 +3393,7 @@ const Xt = {
3370
3393
  /* @__PURE__ */ s("polyline", { points: "22,4 12,14.01 9,11.01" })
3371
3394
  ]
3372
3395
  }
3373
- ), rr = () => /* @__PURE__ */ d(
3396
+ ), nr = () => /* @__PURE__ */ d(
3374
3397
  "svg",
3375
3398
  {
3376
3399
  width: "48",
@@ -3388,12 +3411,12 @@ const Xt = {
3388
3411
  /* @__PURE__ */ s("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
3389
3412
  ]
3390
3413
  }
3391
- ), nr = {
3392
- loading: /* @__PURE__ */ s(er, {}),
3393
- success: /* @__PURE__ */ s(tr, {}),
3394
- error: /* @__PURE__ */ s(rr, {})
3414
+ ), sr = {
3415
+ loading: /* @__PURE__ */ s(tr, {}),
3416
+ success: /* @__PURE__ */ s(rr, {}),
3417
+ error: /* @__PURE__ */ s(nr, {})
3395
3418
  };
3396
- function Vr({
3419
+ function jr({
3397
3420
  copy: n = {},
3398
3421
  styles: e = {},
3399
3422
  icons: t = {},
@@ -3408,7 +3431,7 @@ function Vr({
3408
3431
  tenantSlug: I,
3409
3432
  autoRedirectDelay: p = 3e3
3410
3433
  }) {
3411
- const [x, R] = T("verifying"), [F, E] = T(""), { verifyMagicLink: A } = de(), u = { ...Xt, ...n }, k = { ...Xe, ...e }, m = { ...nr, ...t }, M = () => {
3434
+ const [x, R] = T("verifying"), [F, E] = T(""), { verifyMagicLink: A } = ue(), u = { ...er, ...n }, k = { ...et, ...e }, m = { ...sr, ...t }, M = () => {
3412
3435
  if (typeof window > "u") return {};
3413
3436
  const l = new URLSearchParams(window.location.search);
3414
3437
  return {
@@ -3510,7 +3533,7 @@ function Vr({
3510
3533
  U()
3511
3534
  ] });
3512
3535
  }
3513
- const sr = {
3536
+ const ir = {
3514
3537
  title: "Reset Password",
3515
3538
  subtitle: "Enter your email address and we'll send you a link to reset your password.",
3516
3539
  emailLabel: "Email",
@@ -3532,7 +3555,7 @@ const sr = {
3532
3555
  resetLoadingText: "Resetting...",
3533
3556
  resetSuccessMessage: "Password reset successfully!",
3534
3557
  passwordMismatchError: "Passwords do not match"
3535
- }, ir = {
3558
+ }, or = {
3536
3559
  container: {
3537
3560
  maxWidth: "400px",
3538
3561
  margin: "0 auto",
@@ -3624,7 +3647,7 @@ const sr = {
3624
3647
  cursor: "pointer"
3625
3648
  }
3626
3649
  };
3627
- function jr({
3650
+ function Gr({
3628
3651
  copy: n = {},
3629
3652
  styles: e = {},
3630
3653
  mode: t = "request",
@@ -3635,7 +3658,7 @@ function jr({
3635
3658
  onModeChange: f,
3636
3659
  className: g
3637
3660
  }) {
3638
- const [w, c] = T(""), [I, p] = T(r), [x, R] = T(""), [F, E] = T(""), [A, u] = T(!1), [k, m] = T(""), [M, L] = T(""), [D, P] = T({}), { requestPasswordReset: U, confirmPasswordReset: l } = de(), { tenant: N } = me(), $ = { ...sr, ...n }, h = { ...ir, ...e }, C = () => {
3661
+ const [w, c] = T(""), [I, p] = T(r), [x, R] = T(""), [F, E] = T(""), [A, u] = T(!1), [k, m] = T(""), [M, L] = T(""), [D, P] = T({}), { requestPasswordReset: U, confirmPasswordReset: l } = ue(), { tenant: N } = me(), $ = { ...ir, ...n }, h = { ...or, ...e }, C = () => {
3639
3662
  const O = {};
3640
3663
  return w.trim() || (O.email = !0), P(O), Object.keys(O).length === 0;
3641
3664
  }, S = () => {
@@ -3803,7 +3826,7 @@ function jr({
3803
3826
  ] })
3804
3827
  ] });
3805
3828
  }
3806
- const or = () => /* @__PURE__ */ s(
3829
+ const ar = () => /* @__PURE__ */ s(
3807
3830
  "div",
3808
3831
  {
3809
3832
  style: {
@@ -3815,7 +3838,7 @@ const or = () => /* @__PURE__ */ s(
3815
3838
  },
3816
3839
  children: /* @__PURE__ */ s("div", { children: "Loading..." })
3817
3840
  }
3818
- ), ar = ({ error: n, retry: e }) => /* @__PURE__ */ d(
3841
+ ), lr = ({ error: n, retry: e }) => /* @__PURE__ */ d(
3819
3842
  "div",
3820
3843
  {
3821
3844
  style: {
@@ -3849,26 +3872,26 @@ const or = () => /* @__PURE__ */ s(
3849
3872
  ]
3850
3873
  }
3851
3874
  );
3852
- function Gr({
3875
+ function Qr({
3853
3876
  children: n,
3854
3877
  loadingFallback: e,
3855
3878
  errorFallback: t,
3856
3879
  requireTenant: r = !0
3857
3880
  }) {
3858
- const { isAppLoading: i, appError: o, retryApp: a } = Se(), f = ke(), g = Ne(), w = Je(), c = Ke(), I = (f == null ? void 0 : f.isTenantLoading) ?? !1, p = (f == null ? void 0 : f.tenantError) ?? null, x = (f == null ? void 0 : f.tenantSlug) ?? null, R = (f == null ? void 0 : f.retryTenant) ?? (() => {
3881
+ const { isAppLoading: i, appError: o, retryApp: a } = ve(), f = xe(), g = Ce(), w = Je(), c = Ye(), I = (f == null ? void 0 : f.isTenantLoading) ?? !1, p = (f == null ? void 0 : f.tenantError) ?? null, x = (f == null ? void 0 : f.tenantSlug) ?? null, R = (f == null ? void 0 : f.retryTenant) ?? (() => {
3859
3882
  }), F = (g == null ? void 0 : g.isAuthReady) ?? !0, E = (w == null ? void 0 : w.isReady) ?? !0, A = (c == null ? void 0 : c.isReady) ?? !0, u = r && f && x, L = i || u && I || g && !F || w && !E || c && !A, D = o || (u ? p : null), P = () => {
3860
3883
  o && a(), p && f && R();
3861
3884
  };
3862
3885
  if (L)
3863
- return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(or, {}) });
3886
+ return /* @__PURE__ */ s(_, { children: e || /* @__PURE__ */ s(ar, {}) });
3864
3887
  if (D) {
3865
- const U = typeof t == "function" ? t(D, P) : t || /* @__PURE__ */ s(ar, { error: D, retry: P });
3888
+ const U = typeof t == "function" ? t(D, P) : t || /* @__PURE__ */ s(lr, { error: D, retry: P });
3866
3889
  return /* @__PURE__ */ s(_, { children: U });
3867
3890
  }
3868
3891
  return /* @__PURE__ */ s(_, { children: n });
3869
3892
  }
3870
- function Qr(n = !0) {
3871
- const { isAppLoading: e, appError: t, retryApp: r, appInfo: i } = Se(), o = ke(), a = Ne(), f = Je(), g = Ke(), w = (o == null ? void 0 : o.isTenantLoading) ?? !1, c = (o == null ? void 0 : o.tenantError) ?? null, I = (o == null ? void 0 : o.tenant) ?? null, p = (o == null ? void 0 : o.tenantSlug) ?? null, x = (o == null ? void 0 : o.retryTenant) ?? (() => {
3893
+ function Kr(n = !0) {
3894
+ const { isAppLoading: e, appError: t, retryApp: r, appInfo: i } = ve(), o = xe(), a = Ce(), f = Je(), g = Ye(), w = (o == null ? void 0 : o.isTenantLoading) ?? !1, c = (o == null ? void 0 : o.tenantError) ?? null, I = (o == null ? void 0 : o.tenant) ?? null, p = (o == null ? void 0 : o.tenantSlug) ?? null, x = (o == null ? void 0 : o.retryTenant) ?? (() => {
3872
3895
  }), R = (a == null ? void 0 : a.isAuthReady) ?? !0, F = (f == null ? void 0 : f.isReady) ?? !0, E = (g == null ? void 0 : g.isReady) ?? !0, A = n && o && p, M = e || A && w || a && !R || f && !F || g && !E, L = t || (A ? c : null);
3873
3896
  return {
3874
3897
  isLoading: M,
@@ -3898,7 +3921,7 @@ function Zr({
3898
3921
  showCurrentTenant: w = !0
3899
3922
  }) {
3900
3923
  var k;
3901
- const c = Ne(), [I, p] = T(!1), x = Qe(null), R = n ?? (c == null ? void 0 : c.userTenants) ?? [], F = e ?? ((k = c == null ? void 0 : c.currentUser) == null ? void 0 : k.tenantId) ?? null, E = async (m) => {
3924
+ const c = Ce(), [I, p] = T(!1), x = Ke(null), R = n ?? (c == null ? void 0 : c.userTenants) ?? [], F = e ?? ((k = c == null ? void 0 : c.currentUser) == null ? void 0 : k.tenantId) ?? null, E = async (m) => {
3902
3925
  p(!1), t ? t(m) : c != null && c.switchToTenant && await c.switchToTenant(m);
3903
3926
  };
3904
3927
  ee(() => {
@@ -4049,7 +4072,7 @@ class Jr {
4049
4072
  };
4050
4073
  }
4051
4074
  }
4052
- class Kr {
4075
+ class Yr {
4053
4076
  constructor(e, t) {
4054
4077
  this.httpService = e, this.sessionManager = t;
4055
4078
  }
@@ -4100,7 +4123,7 @@ class Kr {
4100
4123
  });
4101
4124
  }
4102
4125
  }
4103
- class Yr {
4126
+ class Xr {
4104
4127
  constructor(e) {
4105
4128
  this.httpService = e;
4106
4129
  }
@@ -4109,7 +4132,7 @@ class Yr {
4109
4132
  return await this.httpService.get("/health");
4110
4133
  }
4111
4134
  }
4112
- class Xr {
4135
+ class en {
4113
4136
  // Date string to Date object
4114
4137
  static toDate(e) {
4115
4138
  return new Date(e);
@@ -4231,20 +4254,20 @@ class Xr {
4231
4254
  }), t;
4232
4255
  }
4233
4256
  }
4234
- const et = "returnTo", Ee = "zone_return_to", Me = "zone_return_to";
4235
- function en(n = {}) {
4257
+ const tt = "returnTo", Me = "zone_return_to", Le = "zone_return_to";
4258
+ function tn(n = {}) {
4236
4259
  const {
4237
4260
  zoneRoots: e = {},
4238
- returnToParam: t = et,
4261
+ returnToParam: t = tt,
4239
4262
  returnToStorage: r = "url"
4240
- } = n, i = ft(), [o, a] = gt(), { isAuthenticated: f, currentUser: g } = de(), { tenant: w } = ge(), c = J(() => ({ ...$e, ...e }), [e]), I = !!w, p = g == null ? void 0 : g.userType, x = J(() => {
4263
+ } = n, i = gt(), [o, a] = mt(), { isAuthenticated: f, currentUser: g } = ue(), { tenant: w } = ge(), c = Z(() => ({ ...He, ...e }), [e]), I = !!w, p = g == null ? void 0 : g.userType, x = Z(() => {
4241
4264
  switch (r) {
4242
4265
  case "url":
4243
4266
  return o.get(t);
4244
4267
  case "session":
4245
- return sessionStorage.getItem(Ee);
4268
+ return sessionStorage.getItem(Me);
4246
4269
  case "local":
4247
- return localStorage.getItem(Me);
4270
+ return localStorage.getItem(Le);
4248
4271
  default:
4249
4272
  return null;
4250
4273
  }
@@ -4256,10 +4279,10 @@ function en(n = {}) {
4256
4279
  break;
4257
4280
  }
4258
4281
  case "session":
4259
- sessionStorage.removeItem(Ee);
4282
+ sessionStorage.removeItem(Me);
4260
4283
  break;
4261
4284
  case "local":
4262
- localStorage.removeItem(Me);
4285
+ localStorage.removeItem(Le);
4263
4286
  break;
4264
4287
  }
4265
4288
  }, [r, o, t, a]), F = se(
@@ -4271,10 +4294,10 @@ function en(n = {}) {
4271
4294
  break;
4272
4295
  }
4273
4296
  case "session":
4274
- sessionStorage.setItem(Ee, u);
4297
+ sessionStorage.setItem(Me, u);
4275
4298
  break;
4276
4299
  case "local":
4277
- localStorage.setItem(Me, u);
4300
+ localStorage.setItem(Le, u);
4278
4301
  break;
4279
4302
  }
4280
4303
  },
@@ -4285,7 +4308,7 @@ function en(n = {}) {
4285
4308
  i(k);
4286
4309
  },
4287
4310
  [i, c]
4288
- ), A = se(() => I ? f ? p === oe.TENANT_ADMIN ? c.tenantAdmin : c.tenantUser : c.tenantGuest : f ? p === oe.TENANT_ADMIN ? c.publicAdmin : c.publicUser : c.publicGuest, [I, f, p, c]);
4311
+ ), A = se(() => I ? f ? p === ae.TENANT_ADMIN ? c.tenantAdmin : c.tenantUser : c.tenantGuest : f ? p === ae.TENANT_ADMIN ? c.publicAdmin : c.publicUser : c.publicGuest, [I, f, p, c]);
4289
4312
  return {
4290
4313
  returnToUrl: x,
4291
4314
  clearReturnTo: R,
@@ -4294,76 +4317,76 @@ function en(n = {}) {
4294
4317
  getSmartRedirect: A
4295
4318
  };
4296
4319
  }
4297
- function tn(n, e, t = et, r = "url") {
4320
+ function rn(n, e, t = tt, r = "url") {
4298
4321
  if (!e || r !== "url")
4299
4322
  return n;
4300
4323
  const i = new URL(n, window.location.origin);
4301
4324
  return i.searchParams.set(t, e), i.pathname + i.search;
4302
4325
  }
4303
4326
  export {
4304
- Nr as AdminZone,
4305
- Xr as ApiMappers,
4306
- Oe as AppApiService,
4307
- Gr as AppLoader,
4308
- mr as AppProvider,
4309
- wt as AuthApiService,
4310
- vr as AuthProvider,
4311
- Fr as AuthenticatedZone,
4312
- Ye as DEFAULT_ZONE_PRESETS,
4313
- $e as DEFAULT_ZONE_ROOTS,
4314
- Or as FeatureFlag,
4315
- Rt as FeatureFlagApiService,
4316
- Tr as FeatureFlagProvider,
4317
- Dr as GuestZone,
4318
- Yr as HealthApiService,
4319
- le as HttpService,
4320
- Er as LandingRoute,
4321
- zr as LoginForm,
4322
- Wr as MagicLinkForm,
4323
- Vr as MagicLinkVerify,
4324
- Ur as OpenZone,
4325
- jr as PasswordRecoveryForm,
4327
+ Cr as AdminZone,
4328
+ en as ApiMappers,
4329
+ ze as AppApiService,
4330
+ Qr as AppLoader,
4331
+ yr as AppProvider,
4332
+ bt as AuthApiService,
4333
+ Tr as AuthProvider,
4334
+ Dr as AuthenticatedZone,
4335
+ Xe as DEFAULT_ZONE_PRESETS,
4336
+ He as DEFAULT_ZONE_ROOTS,
4337
+ zr as FeatureFlag,
4338
+ It as FeatureFlagApiService,
4339
+ kr as FeatureFlagProvider,
4340
+ Nr as GuestZone,
4341
+ Xr as HealthApiService,
4342
+ ce as HttpService,
4343
+ Mr as LandingRoute,
4344
+ _r as LoginForm,
4345
+ Vr as MagicLinkForm,
4346
+ jr as MagicLinkVerify,
4347
+ $r as OpenZone,
4348
+ Gr as PasswordRecoveryForm,
4326
4349
  Jr as PermissionApiService,
4327
- Pr as Protected,
4328
- Rr as ProtectedRoute,
4329
- Lr as PublicZone,
4330
- ze as RoleApiService,
4331
- xr as RoutingProvider,
4350
+ Rr as Protected,
4351
+ Ir as ProtectedRoute,
4352
+ Fr as PublicZone,
4353
+ _e as RoleApiService,
4354
+ Ar as RoutingProvider,
4332
4355
  ie as SessionExpiredError,
4333
- pe as SessionManager,
4334
- _r as SignupForm,
4335
- Et as SubscriptionApiService,
4336
- qr as SubscriptionGuard,
4337
- Kr as SubscriptionPlanApiService,
4338
- kr as SubscriptionProvider,
4339
- we as TenantApiService,
4340
- $r as TenantAuthenticatedZone,
4341
- Br as TenantGuestZone,
4342
- Hr as TenantOpenZone,
4343
- wr as TenantProvider,
4344
- Ir as TenantRoute,
4356
+ we as SessionManager,
4357
+ Wr as SignupForm,
4358
+ Mt as SubscriptionApiService,
4359
+ Or as SubscriptionGuard,
4360
+ Yr as SubscriptionPlanApiService,
4361
+ xr as SubscriptionProvider,
4362
+ be as TenantApiService,
4363
+ Hr as TenantAuthenticatedZone,
4364
+ qr as TenantGuestZone,
4365
+ Br as TenantOpenZone,
4366
+ br as TenantProvider,
4367
+ Er as TenantRoute,
4345
4368
  Zr as TenantSelector,
4346
- Mr as TenantZone,
4347
- yt as TokenRefreshError,
4348
- mt as TokenRefreshTimeoutError,
4349
- bt as UserApiService,
4350
- oe as UserType,
4351
- Cr as UserZone,
4352
- ce as ZoneRoute,
4353
- tn as buildRedirectUrl,
4354
- yr as useApi,
4355
- Se as useApp,
4356
- Qr as useAppLoaderState,
4357
- de as useAuth,
4358
- It as useFeatureFlags,
4359
- Ar as useRouting,
4360
- Lt as useRoutingOptional,
4361
- Sr as useSettings,
4362
- Mt as useSubscription,
4369
+ Lr as TenantZone,
4370
+ wt as TokenRefreshError,
4371
+ yt as TokenRefreshTimeoutError,
4372
+ St as UserApiService,
4373
+ ae as UserType,
4374
+ Ur as UserZone,
4375
+ de as ZoneRoute,
4376
+ rn as buildRedirectUrl,
4377
+ wr as useApi,
4378
+ ve as useApp,
4379
+ Kr as useAppLoaderState,
4380
+ ue as useAuth,
4381
+ Et as useFeatureFlags,
4382
+ Pr as useRouting,
4383
+ Ft as useRoutingOptional,
4384
+ vr as useSettings,
4385
+ Lt as useSubscription,
4363
4386
  ge as useTenant,
4364
4387
  me as useTenantInfo,
4365
- ke as useTenantOptional,
4366
- br as useTenantSettings,
4367
- en as useZoneNavigation
4388
+ xe as useTenantOptional,
4389
+ Sr as useTenantSettings,
4390
+ tn as useZoneNavigation
4368
4391
  };
4369
4392
  //# sourceMappingURL=index.es.js.map