@ciscode/ui-authentication-kit 1.0.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.
Files changed (97) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +44 -0
  3. package/dist/components/InlineError.d.ts +8 -0
  4. package/dist/components/InlineError.d.ts.map +1 -0
  5. package/dist/components/InlineError.js +31 -0
  6. package/dist/components/InlineError.js.map +1 -0
  7. package/dist/components/ProfilePage.d.ts +3 -0
  8. package/dist/components/ProfilePage.d.ts.map +1 -0
  9. package/dist/components/ProfilePage.js +151 -0
  10. package/dist/components/ProfilePage.js.map +1 -0
  11. package/dist/components/RequirePermissions.d.ts +15 -0
  12. package/dist/components/RequirePermissions.d.ts.map +1 -0
  13. package/dist/components/RequirePermissions.js +20 -0
  14. package/dist/components/RequirePermissions.js.map +1 -0
  15. package/dist/components/SessionExpiredModal.d.ts +7 -0
  16. package/dist/components/SessionExpiredModal.d.ts.map +1 -0
  17. package/dist/components/SessionExpiredModal.js +26 -0
  18. package/dist/components/SessionExpiredModal.js.map +1 -0
  19. package/dist/components/actions/InputField.d.ts +10 -0
  20. package/dist/components/actions/InputField.d.ts.map +1 -0
  21. package/dist/components/actions/InputField.js +22 -0
  22. package/dist/components/actions/InputField.js.map +1 -0
  23. package/dist/components/actions/SocialButton.d.ts +4 -0
  24. package/dist/components/actions/SocialButton.d.ts.map +1 -0
  25. package/dist/components/actions/SocialButton.js +10 -0
  26. package/dist/components/actions/SocialButton.js.map +1 -0
  27. package/dist/context/AuthConfigContext.d.ts +12 -0
  28. package/dist/context/AuthConfigContext.d.ts.map +1 -0
  29. package/dist/context/AuthConfigContext.js +18 -0
  30. package/dist/context/AuthConfigContext.js.map +1 -0
  31. package/dist/context/AuthStateContext.d.ts +17 -0
  32. package/dist/context/AuthStateContext.d.ts.map +1 -0
  33. package/dist/context/AuthStateContext.js +9 -0
  34. package/dist/context/AuthStateContext.js.map +1 -0
  35. package/dist/context/RbacContext.d.ts +12 -0
  36. package/dist/context/RbacContext.d.ts.map +1 -0
  37. package/dist/context/RbacContext.js +21 -0
  38. package/dist/context/RbacContext.js.map +1 -0
  39. package/dist/hooks/useAbility.d.ts +8 -0
  40. package/dist/hooks/useAbility.d.ts.map +1 -0
  41. package/dist/hooks/useAbility.js +24 -0
  42. package/dist/hooks/useAbility.js.map +1 -0
  43. package/dist/index.d.ts +3 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +3 -0
  46. package/dist/index.js.map +1 -0
  47. package/dist/index.mjs +2596 -0
  48. package/dist/index.umd.js +49 -0
  49. package/dist/main/app.d.ts +6 -0
  50. package/dist/main/app.d.ts.map +1 -0
  51. package/dist/main/app.js +7 -0
  52. package/dist/main/app.js.map +1 -0
  53. package/dist/models/AuthConfig.d.ts +17 -0
  54. package/dist/models/AuthConfig.d.ts.map +1 -0
  55. package/dist/models/AuthConfig.js +2 -0
  56. package/dist/models/AuthConfig.js.map +1 -0
  57. package/dist/models/ColorTheme.d.ts +8 -0
  58. package/dist/models/ColorTheme.d.ts.map +1 -0
  59. package/dist/models/ColorTheme.js +2 -0
  60. package/dist/models/ColorTheme.js.map +1 -0
  61. package/dist/models/Type.d.ts +13 -0
  62. package/dist/models/Type.d.ts.map +1 -0
  63. package/dist/models/Type.js +2 -0
  64. package/dist/models/Type.js.map +1 -0
  65. package/dist/models/User.d.ts +15 -0
  66. package/dist/models/User.d.ts.map +1 -0
  67. package/dist/models/User.js +2 -0
  68. package/dist/models/User.js.map +1 -0
  69. package/dist/pages/auth/GoogleCallbackPage.d.ts +3 -0
  70. package/dist/pages/auth/GoogleCallbackPage.d.ts.map +1 -0
  71. package/dist/pages/auth/GoogleCallbackPage.js +20 -0
  72. package/dist/pages/auth/GoogleCallbackPage.js.map +1 -0
  73. package/dist/pages/auth/SignInPage.d.ts +4 -0
  74. package/dist/pages/auth/SignInPage.d.ts.map +1 -0
  75. package/dist/pages/auth/SignInPage.js +152 -0
  76. package/dist/pages/auth/SignInPage.js.map +1 -0
  77. package/dist/pages/auth/SignUpPage.d.ts +3 -0
  78. package/dist/pages/auth/SignUpPage.d.ts.map +1 -0
  79. package/dist/pages/auth/SignUpPage.js +177 -0
  80. package/dist/pages/auth/SignUpPage.js.map +1 -0
  81. package/dist/providers/AuthProvider.d.ts +9 -0
  82. package/dist/providers/AuthProvider.d.ts.map +1 -0
  83. package/dist/providers/AuthProvider.js +160 -0
  84. package/dist/providers/AuthProvider.js.map +1 -0
  85. package/dist/utils/attachAuthInterceptor.d.ts +12 -0
  86. package/dist/utils/attachAuthInterceptor.d.ts.map +1 -0
  87. package/dist/utils/attachAuthInterceptor.js +73 -0
  88. package/dist/utils/attachAuthInterceptor.js.map +1 -0
  89. package/dist/utils/colorHelpers.d.ts +32 -0
  90. package/dist/utils/colorHelpers.d.ts.map +1 -0
  91. package/dist/utils/colorHelpers.js +44 -0
  92. package/dist/utils/colorHelpers.js.map +1 -0
  93. package/dist/utils/jwtHelpers.d.ts +3 -0
  94. package/dist/utils/jwtHelpers.d.ts.map +1 -0
  95. package/dist/utils/jwtHelpers.js +14 -0
  96. package/dist/utils/jwtHelpers.js.map +1 -0
  97. package/package.json +47 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,2596 @@
1
+ import * as Y from "react";
2
+ import l, { createContext as He, useContext as Ke, useState as j, useRef as We, useEffect as K, useCallback as ut, forwardRef as Ge, createElement as me, useMemo as ae } from "react";
3
+ import pe from "axios";
4
+ import { jwtDecode as dt } from "jwt-decode";
5
+ import ft from "react-dom";
6
+ import { useNavigate as Ee, useLocation as Se, Routes as ht, Route as _, Navigate as ie } from "react-router";
7
+ const Ze = l.createContext(null);
8
+ function Ye() {
9
+ const r = l.useContext(Ze);
10
+ if (!r)
11
+ throw new Error("useAuthConfig must be used within an AuthConfigProvider");
12
+ return r;
13
+ }
14
+ const Je = He(null);
15
+ function G() {
16
+ const r = Ke(Je);
17
+ if (!r)
18
+ throw new Error("useAuthState must be inside <AuthProvider>");
19
+ return r;
20
+ }
21
+ function de(r) {
22
+ const e = dt(r);
23
+ return {
24
+ id: e.sub,
25
+ email: e.email ?? "",
26
+ roles: e.roles ?? [],
27
+ permissions: e.permissions ?? [],
28
+ modules: e.modules ?? [],
29
+ tenantId: e.tenantId ?? ""
30
+ };
31
+ }
32
+ let xe = !1;
33
+ function gt() {
34
+ xe = !1;
35
+ }
36
+ function mt(r, e) {
37
+ r.defaults.withCredentials = !0;
38
+ const t = `${e.baseUrl}${e.refreshEndpoint ?? "/auth/refresh-token"}`;
39
+ r.interceptors.request.use((a) => {
40
+ const i = e.getAccessToken();
41
+ return i && (a.headers.Authorization = `Bearer ${i}`), a;
42
+ });
43
+ let s = !1, n = [];
44
+ return r.interceptors.response.use(
45
+ (a) => a,
46
+ async (a) => {
47
+ var o;
48
+ const i = a.config;
49
+ if (((o = a.response) == null ? void 0 : o.status) !== 401 || !i || i._retry)
50
+ return Promise.reject(a);
51
+ if (i._retry = !0, !s) {
52
+ s = !0;
53
+ try {
54
+ const { data: u } = await pe.post(t, {}, { withCredentials: !0 });
55
+ return e.setAccessToken(u.accessToken), n.forEach((c) => c(u.accessToken)), n = [], r.request(i);
56
+ } catch (u) {
57
+ return !!e.getAccessToken() && !xe && (xe = !0, e.logout()), n.forEach((d) => d(null)), n = [], Promise.reject(u);
58
+ } finally {
59
+ s = !1;
60
+ }
61
+ }
62
+ return new Promise((u, c) => {
63
+ n.push((d) => {
64
+ if (!d)
65
+ return c(a);
66
+ (i.headers ?? (i.headers = {})).Authorization = `Bearer ${d}`, u(r.request(i));
67
+ });
68
+ });
69
+ }
70
+ ), r;
71
+ }
72
+ const x = (r) => typeof r == "string", X = () => {
73
+ let r, e;
74
+ const t = new Promise((s, n) => {
75
+ r = s, e = n;
76
+ });
77
+ return t.resolve = r, t.reject = e, t;
78
+ }, ke = (r) => r == null ? "" : "" + r, pt = (r, e, t) => {
79
+ r.forEach((s) => {
80
+ e[s] && (t[s] = e[s]);
81
+ });
82
+ }, xt = /###/g, Ie = (r) => r && r.indexOf("###") > -1 ? r.replace(xt, ".") : r, Oe = (r) => !r || x(r), ee = (r, e, t) => {
83
+ const s = x(e) ? e.split(".") : e;
84
+ let n = 0;
85
+ for (; n < s.length - 1; ) {
86
+ if (Oe(r))
87
+ return {};
88
+ const a = Ie(s[n]);
89
+ !r[a] && t && (r[a] = new t()), Object.prototype.hasOwnProperty.call(r, a) ? r = r[a] : r = {}, ++n;
90
+ }
91
+ return Oe(r) ? {} : {
92
+ obj: r,
93
+ k: Ie(s[n])
94
+ };
95
+ }, je = (r, e, t) => {
96
+ const {
97
+ obj: s,
98
+ k: n
99
+ } = ee(r, e, Object);
100
+ if (s !== void 0 || e.length === 1) {
101
+ s[n] = t;
102
+ return;
103
+ }
104
+ let a = e[e.length - 1], i = e.slice(0, e.length - 1), o = ee(r, i, Object);
105
+ for (; o.obj === void 0 && i.length; )
106
+ a = `${i[i.length - 1]}.${a}`, i = i.slice(0, i.length - 1), o = ee(r, i, Object), o != null && o.obj && typeof o.obj[`${o.k}.${a}`] < "u" && (o.obj = void 0);
107
+ o.obj[`${o.k}.${a}`] = t;
108
+ }, yt = (r, e, t, s) => {
109
+ const {
110
+ obj: n,
111
+ k: a
112
+ } = ee(r, e, Object);
113
+ n[a] = n[a] || [], n[a].push(t);
114
+ }, oe = (r, e) => {
115
+ const {
116
+ obj: t,
117
+ k: s
118
+ } = ee(r, e);
119
+ if (t && Object.prototype.hasOwnProperty.call(t, s))
120
+ return t[s];
121
+ }, bt = (r, e, t) => {
122
+ const s = oe(r, t);
123
+ return s !== void 0 ? s : oe(e, t);
124
+ }, Qe = (r, e, t) => {
125
+ for (const s in e)
126
+ s !== "__proto__" && s !== "constructor" && (s in r ? x(r[s]) || r[s] instanceof String || x(e[s]) || e[s] instanceof String ? t && (r[s] = e[s]) : Qe(r[s], e[s], t) : r[s] = e[s]);
127
+ return r;
128
+ }, Z = (r) => r.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
129
+ var wt = {
130
+ "&": "&amp;",
131
+ "<": "&lt;",
132
+ ">": "&gt;",
133
+ '"': "&quot;",
134
+ "'": "&#39;",
135
+ "/": "&#x2F;"
136
+ };
137
+ const Nt = (r) => x(r) ? r.replace(/[&<>"'\/]/g, (e) => wt[e]) : r;
138
+ class vt {
139
+ constructor(e) {
140
+ this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
141
+ }
142
+ getRegExp(e) {
143
+ const t = this.regExpMap.get(e);
144
+ if (t !== void 0)
145
+ return t;
146
+ const s = new RegExp(e);
147
+ return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
148
+ }
149
+ }
150
+ const Et = [" ", ",", "?", "!", ";"], St = new vt(20), Lt = (r, e, t) => {
151
+ e = e || "", t = t || "";
152
+ const s = Et.filter((i) => e.indexOf(i) < 0 && t.indexOf(i) < 0);
153
+ if (s.length === 0)
154
+ return !0;
155
+ const n = St.getRegExp(`(${s.map((i) => i === "?" ? "\\?" : i).join("|")})`);
156
+ let a = !n.test(r);
157
+ if (!a) {
158
+ const i = r.indexOf(t);
159
+ i > 0 && !n.test(r.substring(0, i)) && (a = !0);
160
+ }
161
+ return a;
162
+ }, ye = (r, e, t = ".") => {
163
+ if (!r)
164
+ return;
165
+ if (r[e])
166
+ return Object.prototype.hasOwnProperty.call(r, e) ? r[e] : void 0;
167
+ const s = e.split(t);
168
+ let n = r;
169
+ for (let a = 0; a < s.length; ) {
170
+ if (!n || typeof n != "object")
171
+ return;
172
+ let i, o = "";
173
+ for (let u = a; u < s.length; ++u)
174
+ if (u !== a && (o += t), o += s[u], i = n[o], i !== void 0) {
175
+ if (["string", "number", "boolean"].indexOf(typeof i) > -1 && u < s.length - 1)
176
+ continue;
177
+ a += u - a + 1;
178
+ break;
179
+ }
180
+ n = i;
181
+ }
182
+ return n;
183
+ }, ne = (r) => r == null ? void 0 : r.replace("_", "-"), Ct = {
184
+ type: "logger",
185
+ log(r) {
186
+ this.output("log", r);
187
+ },
188
+ warn(r) {
189
+ this.output("warn", r);
190
+ },
191
+ error(r) {
192
+ this.output("error", r);
193
+ },
194
+ output(r, e) {
195
+ var t, s;
196
+ (s = (t = console == null ? void 0 : console[r]) == null ? void 0 : t.apply) == null || s.call(t, console, e);
197
+ }
198
+ };
199
+ class le {
200
+ constructor(e, t = {}) {
201
+ this.init(e, t);
202
+ }
203
+ init(e, t = {}) {
204
+ this.prefix = t.prefix || "i18next:", this.logger = e || Ct, this.options = t, this.debug = t.debug;
205
+ }
206
+ log(...e) {
207
+ return this.forward(e, "log", "", !0);
208
+ }
209
+ warn(...e) {
210
+ return this.forward(e, "warn", "", !0);
211
+ }
212
+ error(...e) {
213
+ return this.forward(e, "error", "");
214
+ }
215
+ deprecate(...e) {
216
+ return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
217
+ }
218
+ forward(e, t, s, n) {
219
+ return n && !this.debug ? null : (x(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
220
+ }
221
+ create(e) {
222
+ return new le(this.logger, {
223
+ prefix: `${this.prefix}:${e}:`,
224
+ ...this.options
225
+ });
226
+ }
227
+ clone(e) {
228
+ return e = e || this.options, e.prefix = e.prefix || this.prefix, new le(this.logger, e);
229
+ }
230
+ }
231
+ var B = new le();
232
+ class ue {
233
+ constructor() {
234
+ this.observers = {};
235
+ }
236
+ on(e, t) {
237
+ return e.split(" ").forEach((s) => {
238
+ this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
239
+ const n = this.observers[s].get(t) || 0;
240
+ this.observers[s].set(t, n + 1);
241
+ }), this;
242
+ }
243
+ off(e, t) {
244
+ if (this.observers[e]) {
245
+ if (!t) {
246
+ delete this.observers[e];
247
+ return;
248
+ }
249
+ this.observers[e].delete(t);
250
+ }
251
+ }
252
+ emit(e, ...t) {
253
+ this.observers[e] && Array.from(this.observers[e].entries()).forEach(([n, a]) => {
254
+ for (let i = 0; i < a; i++)
255
+ n(...t);
256
+ }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, a]) => {
257
+ for (let i = 0; i < a; i++)
258
+ n.apply(n, [e, ...t]);
259
+ });
260
+ }
261
+ }
262
+ class Pe extends ue {
263
+ constructor(e, t = {
264
+ ns: ["translation"],
265
+ defaultNS: "translation"
266
+ }) {
267
+ super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
268
+ }
269
+ addNamespaces(e) {
270
+ this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
271
+ }
272
+ removeNamespaces(e) {
273
+ const t = this.options.ns.indexOf(e);
274
+ t > -1 && this.options.ns.splice(t, 1);
275
+ }
276
+ getResource(e, t, s, n = {}) {
277
+ var c, d;
278
+ const a = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, i = n.ignoreJSONStructure !== void 0 ? n.ignoreJSONStructure : this.options.ignoreJSONStructure;
279
+ let o;
280
+ e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], s && (Array.isArray(s) ? o.push(...s) : x(s) && a ? o.push(...s.split(a)) : o.push(s)));
281
+ const u = oe(this.data, o);
282
+ return !u && !t && !s && e.indexOf(".") > -1 && (e = o[0], t = o[1], s = o.slice(2).join(".")), u || !i || !x(s) ? u : ye((d = (c = this.data) == null ? void 0 : c[e]) == null ? void 0 : d[t], s, a);
283
+ }
284
+ addResource(e, t, s, n, a = {
285
+ silent: !1
286
+ }) {
287
+ const i = a.keySeparator !== void 0 ? a.keySeparator : this.options.keySeparator;
288
+ let o = [e, t];
289
+ s && (o = o.concat(i ? s.split(i) : s)), e.indexOf(".") > -1 && (o = e.split("."), n = t, t = o[1]), this.addNamespaces(t), je(this.data, o, n), a.silent || this.emit("added", e, t, s, n);
290
+ }
291
+ addResources(e, t, s, n = {
292
+ silent: !1
293
+ }) {
294
+ for (const a in s)
295
+ (x(s[a]) || Array.isArray(s[a])) && this.addResource(e, t, a, s[a], {
296
+ silent: !0
297
+ });
298
+ n.silent || this.emit("added", e, t, s);
299
+ }
300
+ addResourceBundle(e, t, s, n, a, i = {
301
+ silent: !1,
302
+ skipCopy: !1
303
+ }) {
304
+ let o = [e, t];
305
+ e.indexOf(".") > -1 && (o = e.split("."), n = s, s = t, t = o[1]), this.addNamespaces(t);
306
+ let u = oe(this.data, o) || {};
307
+ i.skipCopy || (s = JSON.parse(JSON.stringify(s))), n ? Qe(u, s, a) : u = {
308
+ ...u,
309
+ ...s
310
+ }, je(this.data, o, u), i.silent || this.emit("added", e, t, s);
311
+ }
312
+ removeResourceBundle(e, t) {
313
+ this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
314
+ }
315
+ hasResourceBundle(e, t) {
316
+ return this.getResource(e, t) !== void 0;
317
+ }
318
+ getResourceBundle(e, t) {
319
+ return t || (t = this.options.defaultNS), this.getResource(e, t);
320
+ }
321
+ getDataByLanguage(e) {
322
+ return this.data[e];
323
+ }
324
+ hasLanguageSomeTranslations(e) {
325
+ const t = this.getDataByLanguage(e);
326
+ return !!(t && Object.keys(t) || []).find((n) => t[n] && Object.keys(t[n]).length > 0);
327
+ }
328
+ toJSON() {
329
+ return this.data;
330
+ }
331
+ }
332
+ var _e = {
333
+ processors: {},
334
+ addPostProcessor(r) {
335
+ this.processors[r.name] = r;
336
+ },
337
+ handle(r, e, t, s, n) {
338
+ return r.forEach((a) => {
339
+ var i;
340
+ e = ((i = this.processors[a]) == null ? void 0 : i.process(e, t, s, n)) ?? e;
341
+ }), e;
342
+ }
343
+ };
344
+ const Xe = Symbol("i18next/PATH_KEY");
345
+ function kt() {
346
+ const r = [], e = /* @__PURE__ */ Object.create(null);
347
+ let t;
348
+ return e.get = (s, n) => {
349
+ var a;
350
+ return (a = t == null ? void 0 : t.revoke) == null || a.call(t), n === Xe ? r : (r.push(n), t = Proxy.revocable(s, e), t.proxy);
351
+ }, Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
352
+ }
353
+ function be(r, e) {
354
+ const {
355
+ [Xe]: t
356
+ } = r(kt());
357
+ return t.join((e == null ? void 0 : e.keySeparator) ?? ".");
358
+ }
359
+ const Me = {}, fe = (r) => !x(r) && typeof r != "boolean" && typeof r != "number";
360
+ class ce extends ue {
361
+ constructor(e, t = {}) {
362
+ super(), pt(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = B.create("translator");
363
+ }
364
+ changeLanguage(e) {
365
+ e && (this.language = e);
366
+ }
367
+ exists(e, t = {
368
+ interpolation: {}
369
+ }) {
370
+ const s = {
371
+ ...t
372
+ };
373
+ if (e == null)
374
+ return !1;
375
+ const n = this.resolve(e, s);
376
+ if ((n == null ? void 0 : n.res) === void 0)
377
+ return !1;
378
+ const a = fe(n.res);
379
+ return !(s.returnObjects === !1 && a);
380
+ }
381
+ extractFromKey(e, t) {
382
+ let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
383
+ s === void 0 && (s = ":");
384
+ const n = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
385
+ let a = t.ns || this.options.defaultNS || [];
386
+ const i = s && e.indexOf(s) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Lt(e, s, n);
387
+ if (i && !o) {
388
+ const u = e.match(this.interpolator.nestingRegexp);
389
+ if (u && u.length > 0)
390
+ return {
391
+ key: e,
392
+ namespaces: x(a) ? [a] : a
393
+ };
394
+ const c = e.split(s);
395
+ (s !== n || s === n && this.options.ns.indexOf(c[0]) > -1) && (a = c.shift()), e = c.join(n);
396
+ }
397
+ return {
398
+ key: e,
399
+ namespaces: x(a) ? [a] : a
400
+ };
401
+ }
402
+ translate(e, t, s) {
403
+ let n = typeof t == "object" ? {
404
+ ...t
405
+ } : t;
406
+ if (typeof n != "object" && this.options.overloadTranslationOptionHandler && (n = this.options.overloadTranslationOptionHandler(arguments)), typeof n == "object" && (n = {
407
+ ...n
408
+ }), n || (n = {}), e == null)
409
+ return "";
410
+ typeof e == "function" && (e = be(e, {
411
+ ...this.options,
412
+ ...n
413
+ })), Array.isArray(e) || (e = [String(e)]);
414
+ const a = n.returnDetails !== void 0 ? n.returnDetails : this.options.returnDetails, i = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, {
415
+ key: o,
416
+ namespaces: u
417
+ } = this.extractFromKey(e[e.length - 1], n), c = u[u.length - 1];
418
+ let d = n.nsSeparator !== void 0 ? n.nsSeparator : this.options.nsSeparator;
419
+ d === void 0 && (d = ":");
420
+ const f = n.lng || this.language, m = n.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
421
+ if ((f == null ? void 0 : f.toLowerCase()) === "cimode")
422
+ return m ? a ? {
423
+ res: `${c}${d}${o}`,
424
+ usedKey: o,
425
+ exactUsedKey: o,
426
+ usedLng: f,
427
+ usedNS: c,
428
+ usedParams: this.getUsedParamsDetails(n)
429
+ } : `${c}${d}${o}` : a ? {
430
+ res: o,
431
+ usedKey: o,
432
+ exactUsedKey: o,
433
+ usedLng: f,
434
+ usedNS: c,
435
+ usedParams: this.getUsedParamsDetails(n)
436
+ } : o;
437
+ const g = this.resolve(e, n);
438
+ let h = g == null ? void 0 : g.res;
439
+ const p = (g == null ? void 0 : g.usedKey) || o, y = (g == null ? void 0 : g.exactUsedKey) || o, L = ["[object Number]", "[object Function]", "[object RegExp]"], b = n.joinArrays !== void 0 ? n.joinArrays : this.options.joinArrays, S = !this.i18nFormat || this.i18nFormat.handleAsObject, w = n.count !== void 0 && !x(n.count), C = ce.hasDefaultValue(n), A = w ? this.pluralResolver.getSuffix(f, n.count, n) : "", P = n.ordinal && w ? this.pluralResolver.getSuffix(f, n.count, {
440
+ ordinal: !1
441
+ }) : "", E = w && !n.ordinal && n.count === 0, v = E && n[`defaultValue${this.options.pluralSeparator}zero`] || n[`defaultValue${A}`] || n[`defaultValue${P}`] || n.defaultValue;
442
+ let N = h;
443
+ S && !h && C && (N = v);
444
+ const U = fe(N), M = Object.prototype.toString.apply(N);
445
+ if (S && N && U && L.indexOf(M) < 0 && !(x(b) && Array.isArray(N))) {
446
+ if (!n.returnObjects && !this.options.returnObjects) {
447
+ this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
448
+ const R = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(p, N, {
449
+ ...n,
450
+ ns: u
451
+ }) : `key '${o} (${this.language})' returned an object instead of string.`;
452
+ return a ? (g.res = R, g.usedParams = this.getUsedParamsDetails(n), g) : R;
453
+ }
454
+ if (i) {
455
+ const R = Array.isArray(N), I = R ? [] : {}, k = R ? y : p;
456
+ for (const $ in N)
457
+ if (Object.prototype.hasOwnProperty.call(N, $)) {
458
+ const T = `${k}${i}${$}`;
459
+ C && !h ? I[$] = this.translate(T, {
460
+ ...n,
461
+ defaultValue: fe(v) ? v[$] : void 0,
462
+ joinArrays: !1,
463
+ ns: u
464
+ }) : I[$] = this.translate(T, {
465
+ ...n,
466
+ joinArrays: !1,
467
+ ns: u
468
+ }), I[$] === T && (I[$] = N[$]);
469
+ }
470
+ h = I;
471
+ }
472
+ } else if (S && x(b) && Array.isArray(h))
473
+ h = h.join(b), h && (h = this.extendTranslation(h, e, n, s));
474
+ else {
475
+ let R = !1, I = !1;
476
+ !this.isValidLookup(h) && C && (R = !0, h = v), this.isValidLookup(h) || (I = !0, h = o);
477
+ const $ = (n.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && I ? void 0 : h, T = C && v !== h && this.options.updateMissing;
478
+ if (I || R || T) {
479
+ if (this.logger.log(T ? "updateKey" : "missingKey", f, c, o, T ? v : h), i) {
480
+ const D = this.resolve(o, {
481
+ ...n,
482
+ keySeparator: !1
483
+ });
484
+ D && D.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
485
+ }
486
+ let F = [];
487
+ const O = this.languageUtils.getFallbackCodes(this.options.fallbackLng, n.lng || this.language);
488
+ if (this.options.saveMissingTo === "fallback" && O && O[0])
489
+ for (let D = 0; D < O.length; D++)
490
+ F.push(O[D]);
491
+ else
492
+ this.options.saveMissingTo === "all" ? F = this.languageUtils.toResolveHierarchy(n.lng || this.language) : F.push(n.lng || this.language);
493
+ const H = (D, V, Q) => {
494
+ var Ce;
495
+ const Le = C && Q !== h ? Q : $;
496
+ this.options.missingKeyHandler ? this.options.missingKeyHandler(D, c, V, Le, T, n) : (Ce = this.backendConnector) != null && Ce.saveMissing && this.backendConnector.saveMissing(D, c, V, Le, T, n), this.emit("missingKey", D, c, V, h);
497
+ };
498
+ this.options.saveMissing && (this.options.saveMissingPlurals && w ? F.forEach((D) => {
499
+ const V = this.pluralResolver.getSuffixes(D, n);
500
+ E && n[`defaultValue${this.options.pluralSeparator}zero`] && V.indexOf(`${this.options.pluralSeparator}zero`) < 0 && V.push(`${this.options.pluralSeparator}zero`), V.forEach((Q) => {
501
+ H([D], o + Q, n[`defaultValue${Q}`] || v);
502
+ });
503
+ }) : H(F, o, v));
504
+ }
505
+ h = this.extendTranslation(h, e, n, g, s), I && h === o && this.options.appendNamespaceToMissingKey && (h = `${c}${d}${o}`), (I || R) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${c}${d}${o}` : o, R ? h : void 0, n));
506
+ }
507
+ return a ? (g.res = h, g.usedParams = this.getUsedParamsDetails(n), g) : h;
508
+ }
509
+ extendTranslation(e, t, s, n, a) {
510
+ var u, c;
511
+ if ((u = this.i18nFormat) != null && u.parse)
512
+ e = this.i18nFormat.parse(e, {
513
+ ...this.options.interpolation.defaultVariables,
514
+ ...s
515
+ }, s.lng || this.language || n.usedLng, n.usedNS, n.usedKey, {
516
+ resolved: n
517
+ });
518
+ else if (!s.skipInterpolation) {
519
+ s.interpolation && this.interpolator.init({
520
+ ...s,
521
+ interpolation: {
522
+ ...this.options.interpolation,
523
+ ...s.interpolation
524
+ }
525
+ });
526
+ const d = x(e) && (((c = s == null ? void 0 : s.interpolation) == null ? void 0 : c.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
527
+ let f;
528
+ if (d) {
529
+ const g = e.match(this.interpolator.nestingRegexp);
530
+ f = g && g.length;
531
+ }
532
+ let m = s.replace && !x(s.replace) ? s.replace : s;
533
+ if (this.options.interpolation.defaultVariables && (m = {
534
+ ...this.options.interpolation.defaultVariables,
535
+ ...m
536
+ }), e = this.interpolator.interpolate(e, m, s.lng || this.language || n.usedLng, s), d) {
537
+ const g = e.match(this.interpolator.nestingRegexp), h = g && g.length;
538
+ f < h && (s.nest = !1);
539
+ }
540
+ !s.lng && n && n.res && (s.lng = this.language || n.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, (...g) => (a == null ? void 0 : a[0]) === g[0] && !s.context ? (this.logger.warn(`It seems you are nesting recursively key: ${g[0]} in key: ${t[0]}`), null) : this.translate(...g, t), s)), s.interpolation && this.interpolator.reset();
541
+ }
542
+ const i = s.postProcess || this.options.postProcess, o = x(i) ? [i] : i;
543
+ return e != null && (o != null && o.length) && s.applyPostProcessor !== !1 && (e = _e.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
544
+ i18nResolved: {
545
+ ...n,
546
+ usedParams: this.getUsedParamsDetails(s)
547
+ },
548
+ ...s
549
+ } : s, this)), e;
550
+ }
551
+ resolve(e, t = {}) {
552
+ let s, n, a, i, o;
553
+ return x(e) && (e = [e]), e.forEach((u) => {
554
+ if (this.isValidLookup(s))
555
+ return;
556
+ const c = this.extractFromKey(u, t), d = c.key;
557
+ n = d;
558
+ let f = c.namespaces;
559
+ this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
560
+ const m = t.count !== void 0 && !x(t.count), g = m && !t.ordinal && t.count === 0, h = t.context !== void 0 && (x(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
561
+ f.forEach((y) => {
562
+ var L, b;
563
+ this.isValidLookup(s) || (o = y, !Me[`${p[0]}-${y}`] && ((L = this.utils) != null && L.hasLoadedNamespace) && !((b = this.utils) != null && b.hasLoadedNamespace(o)) && (Me[`${p[0]}-${y}`] = !0, this.logger.warn(`key "${n}" for languages "${p.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), p.forEach((S) => {
564
+ var A;
565
+ if (this.isValidLookup(s))
566
+ return;
567
+ i = S;
568
+ const w = [d];
569
+ if ((A = this.i18nFormat) != null && A.addLookupKeys)
570
+ this.i18nFormat.addLookupKeys(w, d, S, y, t);
571
+ else {
572
+ let P;
573
+ m && (P = this.pluralResolver.getSuffix(S, t.count, t));
574
+ const E = `${this.options.pluralSeparator}zero`, v = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
575
+ if (m && (t.ordinal && P.indexOf(v) === 0 && w.push(d + P.replace(v, this.options.pluralSeparator)), w.push(d + P), g && w.push(d + E)), h) {
576
+ const N = `${d}${this.options.contextSeparator || "_"}${t.context}`;
577
+ w.push(N), m && (t.ordinal && P.indexOf(v) === 0 && w.push(N + P.replace(v, this.options.pluralSeparator)), w.push(N + P), g && w.push(N + E));
578
+ }
579
+ }
580
+ let C;
581
+ for (; C = w.pop(); )
582
+ this.isValidLookup(s) || (a = C, s = this.getResource(S, y, C, t));
583
+ }));
584
+ });
585
+ }), {
586
+ res: s,
587
+ usedKey: n,
588
+ exactUsedKey: a,
589
+ usedLng: i,
590
+ usedNS: o
591
+ };
592
+ }
593
+ isValidLookup(e) {
594
+ return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
595
+ }
596
+ getResource(e, t, s, n = {}) {
597
+ var a;
598
+ return (a = this.i18nFormat) != null && a.getResource ? this.i18nFormat.getResource(e, t, s, n) : this.resourceStore.getResource(e, t, s, n);
599
+ }
600
+ getUsedParamsDetails(e = {}) {
601
+ const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !x(e.replace);
602
+ let n = s ? e.replace : e;
603
+ if (s && typeof e.count < "u" && (n.count = e.count), this.options.interpolation.defaultVariables && (n = {
604
+ ...this.options.interpolation.defaultVariables,
605
+ ...n
606
+ }), !s) {
607
+ n = {
608
+ ...n
609
+ };
610
+ for (const a of t)
611
+ delete n[a];
612
+ }
613
+ return n;
614
+ }
615
+ static hasDefaultValue(e) {
616
+ const t = "defaultValue";
617
+ for (const s in e)
618
+ if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
619
+ return !0;
620
+ return !1;
621
+ }
622
+ }
623
+ class Te {
624
+ constructor(e) {
625
+ this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = B.create("languageUtils");
626
+ }
627
+ getScriptPartFromCode(e) {
628
+ if (e = ne(e), !e || e.indexOf("-") < 0)
629
+ return null;
630
+ const t = e.split("-");
631
+ return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
632
+ }
633
+ getLanguagePartFromCode(e) {
634
+ if (e = ne(e), !e || e.indexOf("-") < 0)
635
+ return e;
636
+ const t = e.split("-");
637
+ return this.formatLanguageCode(t[0]);
638
+ }
639
+ formatLanguageCode(e) {
640
+ if (x(e) && e.indexOf("-") > -1) {
641
+ let t;
642
+ try {
643
+ t = Intl.getCanonicalLocales(e)[0];
644
+ } catch {
645
+ }
646
+ return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
647
+ }
648
+ return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
649
+ }
650
+ isSupportedCode(e) {
651
+ return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
652
+ }
653
+ getBestMatchFromCodes(e) {
654
+ if (!e)
655
+ return null;
656
+ let t;
657
+ return e.forEach((s) => {
658
+ if (t)
659
+ return;
660
+ const n = this.formatLanguageCode(s);
661
+ (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
662
+ }), !t && this.options.supportedLngs && e.forEach((s) => {
663
+ if (t)
664
+ return;
665
+ const n = this.getScriptPartFromCode(s);
666
+ if (this.isSupportedCode(n))
667
+ return t = n;
668
+ const a = this.getLanguagePartFromCode(s);
669
+ if (this.isSupportedCode(a))
670
+ return t = a;
671
+ t = this.options.supportedLngs.find((i) => {
672
+ if (i === a)
673
+ return i;
674
+ if (!(i.indexOf("-") < 0 && a.indexOf("-") < 0) && (i.indexOf("-") > 0 && a.indexOf("-") < 0 && i.substring(0, i.indexOf("-")) === a || i.indexOf(a) === 0 && a.length > 1))
675
+ return i;
676
+ });
677
+ }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
678
+ }
679
+ getFallbackCodes(e, t) {
680
+ if (!e)
681
+ return [];
682
+ if (typeof e == "function" && (e = e(t)), x(e) && (e = [e]), Array.isArray(e))
683
+ return e;
684
+ if (!t)
685
+ return e.default || [];
686
+ let s = e[t];
687
+ return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
688
+ }
689
+ toResolveHierarchy(e, t) {
690
+ const s = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), n = [], a = (i) => {
691
+ i && (this.isSupportedCode(i) ? n.push(i) : this.logger.warn(`rejecting language code not found in supportedLngs: ${i}`));
692
+ };
693
+ return x(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && a(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && a(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && a(this.getLanguagePartFromCode(e))) : x(e) && a(this.formatLanguageCode(e)), s.forEach((i) => {
694
+ n.indexOf(i) < 0 && a(this.formatLanguageCode(i));
695
+ }), n;
696
+ }
697
+ }
698
+ const $e = {
699
+ zero: 0,
700
+ one: 1,
701
+ two: 2,
702
+ few: 3,
703
+ many: 4,
704
+ other: 5
705
+ }, Re = {
706
+ select: (r) => r === 1 ? "one" : "other",
707
+ resolvedOptions: () => ({
708
+ pluralCategories: ["one", "other"]
709
+ })
710
+ };
711
+ class It {
712
+ constructor(e, t = {}) {
713
+ this.languageUtils = e, this.options = t, this.logger = B.create("pluralResolver"), this.pluralRulesCache = {};
714
+ }
715
+ clearCache() {
716
+ this.pluralRulesCache = {};
717
+ }
718
+ getRule(e, t = {}) {
719
+ const s = ne(e === "dev" ? "en" : e), n = t.ordinal ? "ordinal" : "cardinal", a = JSON.stringify({
720
+ cleanedCode: s,
721
+ type: n
722
+ });
723
+ if (a in this.pluralRulesCache)
724
+ return this.pluralRulesCache[a];
725
+ let i;
726
+ try {
727
+ i = new Intl.PluralRules(s, {
728
+ type: n
729
+ });
730
+ } catch {
731
+ if (!Intl)
732
+ return this.logger.error("No Intl support, please use an Intl polyfill!"), Re;
733
+ if (!e.match(/-|_/))
734
+ return Re;
735
+ const u = this.languageUtils.getLanguagePartFromCode(e);
736
+ i = this.getRule(u, t);
737
+ }
738
+ return this.pluralRulesCache[a] = i, i;
739
+ }
740
+ needsPlural(e, t = {}) {
741
+ let s = this.getRule(e, t);
742
+ return s || (s = this.getRule("dev", t)), (s == null ? void 0 : s.resolvedOptions().pluralCategories.length) > 1;
743
+ }
744
+ getPluralFormsOfKey(e, t, s = {}) {
745
+ return this.getSuffixes(e, s).map((n) => `${t}${n}`);
746
+ }
747
+ getSuffixes(e, t = {}) {
748
+ let s = this.getRule(e, t);
749
+ return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((n, a) => $e[n] - $e[a]).map((n) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${n}`) : [];
750
+ }
751
+ getSuffix(e, t, s = {}) {
752
+ const n = this.getRule(e, s);
753
+ return n ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${n.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, s));
754
+ }
755
+ }
756
+ const De = (r, e, t, s = ".", n = !0) => {
757
+ let a = bt(r, e, t);
758
+ return !a && n && x(t) && (a = ye(r, t, s), a === void 0 && (a = ye(e, t, s))), a;
759
+ }, he = (r) => r.replace(/\$/g, "$$$$");
760
+ class Ae {
761
+ constructor(e = {}) {
762
+ var t;
763
+ this.logger = B.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((s) => s), this.init(e);
764
+ }
765
+ init(e = {}) {
766
+ e.interpolation || (e.interpolation = {
767
+ escapeValue: !0
768
+ });
769
+ const {
770
+ escape: t,
771
+ escapeValue: s,
772
+ useRawValueToEscape: n,
773
+ prefix: a,
774
+ prefixEscaped: i,
775
+ suffix: o,
776
+ suffixEscaped: u,
777
+ formatSeparator: c,
778
+ unescapeSuffix: d,
779
+ unescapePrefix: f,
780
+ nestingPrefix: m,
781
+ nestingPrefixEscaped: g,
782
+ nestingSuffix: h,
783
+ nestingSuffixEscaped: p,
784
+ nestingOptionsSeparator: y,
785
+ maxReplaces: L,
786
+ alwaysFormat: b
787
+ } = e.interpolation;
788
+ this.escape = t !== void 0 ? t : Nt, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = n !== void 0 ? n : !1, this.prefix = a ? Z(a) : i || "{{", this.suffix = o ? Z(o) : u || "}}", this.formatSeparator = c || ",", this.unescapePrefix = d ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : d || "", this.nestingPrefix = m ? Z(m) : g || Z("$t("), this.nestingSuffix = h ? Z(h) : p || Z(")"), this.nestingOptionsSeparator = y || ",", this.maxReplaces = L || 1e3, this.alwaysFormat = b !== void 0 ? b : !1, this.resetRegExp();
789
+ }
790
+ reset() {
791
+ this.options && this.init(this.options);
792
+ }
793
+ resetRegExp() {
794
+ const e = (t, s) => (t == null ? void 0 : t.source) === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
795
+ this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
796
+ }
797
+ interpolate(e, t, s, n) {
798
+ var g;
799
+ let a, i, o;
800
+ const u = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (h) => {
801
+ if (h.indexOf(this.formatSeparator) < 0) {
802
+ const b = De(t, u, h, this.options.keySeparator, this.options.ignoreJSONStructure);
803
+ return this.alwaysFormat ? this.format(b, void 0, s, {
804
+ ...n,
805
+ ...t,
806
+ interpolationkey: h
807
+ }) : b;
808
+ }
809
+ const p = h.split(this.formatSeparator), y = p.shift().trim(), L = p.join(this.formatSeparator).trim();
810
+ return this.format(De(t, u, y, this.options.keySeparator, this.options.ignoreJSONStructure), L, s, {
811
+ ...n,
812
+ ...t,
813
+ interpolationkey: y
814
+ });
815
+ };
816
+ this.resetRegExp();
817
+ const d = (n == null ? void 0 : n.missingInterpolationHandler) || this.options.missingInterpolationHandler, f = ((g = n == null ? void 0 : n.interpolation) == null ? void 0 : g.skipOnVariables) !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
818
+ return [{
819
+ regex: this.regexpUnescape,
820
+ safeValue: (h) => he(h)
821
+ }, {
822
+ regex: this.regexp,
823
+ safeValue: (h) => this.escapeValue ? he(this.escape(h)) : he(h)
824
+ }].forEach((h) => {
825
+ for (o = 0; a = h.regex.exec(e); ) {
826
+ const p = a[1].trim();
827
+ if (i = c(p), i === void 0)
828
+ if (typeof d == "function") {
829
+ const L = d(e, a, n);
830
+ i = x(L) ? L : "";
831
+ } else if (n && Object.prototype.hasOwnProperty.call(n, p))
832
+ i = "";
833
+ else if (f) {
834
+ i = a[0];
835
+ continue;
836
+ } else
837
+ this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), i = "";
838
+ else
839
+ !x(i) && !this.useRawValueToEscape && (i = ke(i));
840
+ const y = h.safeValue(i);
841
+ if (e = e.replace(a[0], y), f ? (h.regex.lastIndex += i.length, h.regex.lastIndex -= a[0].length) : h.regex.lastIndex = 0, o++, o >= this.maxReplaces)
842
+ break;
843
+ }
844
+ }), e;
845
+ }
846
+ nest(e, t, s = {}) {
847
+ let n, a, i;
848
+ const o = (u, c) => {
849
+ const d = this.nestingOptionsSeparator;
850
+ if (u.indexOf(d) < 0)
851
+ return u;
852
+ const f = u.split(new RegExp(`${d}[ ]*{`));
853
+ let m = `{${f[1]}`;
854
+ u = f[0], m = this.interpolate(m, i);
855
+ const g = m.match(/'/g), h = m.match(/"/g);
856
+ (((g == null ? void 0 : g.length) ?? 0) % 2 === 0 && !h || h.length % 2 !== 0) && (m = m.replace(/'/g, '"'));
857
+ try {
858
+ i = JSON.parse(m), c && (i = {
859
+ ...c,
860
+ ...i
861
+ });
862
+ } catch (p) {
863
+ return this.logger.warn(`failed parsing options string in nesting for key ${u}`, p), `${u}${d}${m}`;
864
+ }
865
+ return i.defaultValue && i.defaultValue.indexOf(this.prefix) > -1 && delete i.defaultValue, u;
866
+ };
867
+ for (; n = this.nestingRegexp.exec(e); ) {
868
+ let u = [];
869
+ i = {
870
+ ...s
871
+ }, i = i.replace && !x(i.replace) ? i.replace : i, i.applyPostProcessor = !1, delete i.defaultValue;
872
+ const c = /{.*}/.test(n[1]) ? n[1].lastIndexOf("}") + 1 : n[1].indexOf(this.formatSeparator);
873
+ if (c !== -1 && (u = n[1].slice(c).split(this.formatSeparator).map((d) => d.trim()).filter(Boolean), n[1] = n[1].slice(0, c)), a = t(o.call(this, n[1].trim(), i), i), a && n[0] === e && !x(a))
874
+ return a;
875
+ x(a) || (a = ke(a)), a || (this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`), a = ""), u.length && (a = u.reduce((d, f) => this.format(d, f, s.lng, {
876
+ ...s,
877
+ interpolationkey: n[1].trim()
878
+ }), a.trim())), e = e.replace(n[0], a), this.regexp.lastIndex = 0;
879
+ }
880
+ return e;
881
+ }
882
+ }
883
+ const Ot = (r) => {
884
+ let e = r.toLowerCase().trim();
885
+ const t = {};
886
+ if (r.indexOf("(") > -1) {
887
+ const s = r.split("(");
888
+ e = s[0].toLowerCase().trim();
889
+ const n = s[1].substring(0, s[1].length - 1);
890
+ e === "currency" && n.indexOf(":") < 0 ? t.currency || (t.currency = n.trim()) : e === "relativetime" && n.indexOf(":") < 0 ? t.range || (t.range = n.trim()) : n.split(";").forEach((i) => {
891
+ if (i) {
892
+ const [o, ...u] = i.split(":"), c = u.join(":").trim().replace(/^'+|'+$/g, ""), d = o.trim();
893
+ t[d] || (t[d] = c), c === "false" && (t[d] = !1), c === "true" && (t[d] = !0), isNaN(c) || (t[d] = parseInt(c, 10));
894
+ }
895
+ });
896
+ }
897
+ return {
898
+ formatName: e,
899
+ formatOptions: t
900
+ };
901
+ }, Ue = (r) => {
902
+ const e = {};
903
+ return (t, s, n) => {
904
+ let a = n;
905
+ n && n.interpolationkey && n.formatParams && n.formatParams[n.interpolationkey] && n[n.interpolationkey] && (a = {
906
+ ...a,
907
+ [n.interpolationkey]: void 0
908
+ });
909
+ const i = s + JSON.stringify(a);
910
+ let o = e[i];
911
+ return o || (o = r(ne(s), n), e[i] = o), o(t);
912
+ };
913
+ }, jt = (r) => (e, t, s) => r(ne(t), s)(e);
914
+ class Pt {
915
+ constructor(e = {}) {
916
+ this.logger = B.create("formatter"), this.options = e, this.init(e);
917
+ }
918
+ init(e, t = {
919
+ interpolation: {}
920
+ }) {
921
+ this.formatSeparator = t.interpolation.formatSeparator || ",";
922
+ const s = t.cacheInBuiltFormats ? Ue : jt;
923
+ this.formats = {
924
+ number: s((n, a) => {
925
+ const i = new Intl.NumberFormat(n, {
926
+ ...a
927
+ });
928
+ return (o) => i.format(o);
929
+ }),
930
+ currency: s((n, a) => {
931
+ const i = new Intl.NumberFormat(n, {
932
+ ...a,
933
+ style: "currency"
934
+ });
935
+ return (o) => i.format(o);
936
+ }),
937
+ datetime: s((n, a) => {
938
+ const i = new Intl.DateTimeFormat(n, {
939
+ ...a
940
+ });
941
+ return (o) => i.format(o);
942
+ }),
943
+ relativetime: s((n, a) => {
944
+ const i = new Intl.RelativeTimeFormat(n, {
945
+ ...a
946
+ });
947
+ return (o) => i.format(o, a.range || "day");
948
+ }),
949
+ list: s((n, a) => {
950
+ const i = new Intl.ListFormat(n, {
951
+ ...a
952
+ });
953
+ return (o) => i.format(o);
954
+ })
955
+ };
956
+ }
957
+ add(e, t) {
958
+ this.formats[e.toLowerCase().trim()] = t;
959
+ }
960
+ addCached(e, t) {
961
+ this.formats[e.toLowerCase().trim()] = Ue(t);
962
+ }
963
+ format(e, t, s, n = {}) {
964
+ const a = t.split(this.formatSeparator);
965
+ if (a.length > 1 && a[0].indexOf("(") > 1 && a[0].indexOf(")") < 0 && a.find((o) => o.indexOf(")") > -1)) {
966
+ const o = a.findIndex((u) => u.indexOf(")") > -1);
967
+ a[0] = [a[0], ...a.splice(1, o)].join(this.formatSeparator);
968
+ }
969
+ return a.reduce((o, u) => {
970
+ var f;
971
+ const {
972
+ formatName: c,
973
+ formatOptions: d
974
+ } = Ot(u);
975
+ if (this.formats[c]) {
976
+ let m = o;
977
+ try {
978
+ const g = ((f = n == null ? void 0 : n.formatParams) == null ? void 0 : f[n.interpolationkey]) || {}, h = g.locale || g.lng || n.locale || n.lng || s;
979
+ m = this.formats[c](o, h, {
980
+ ...d,
981
+ ...n,
982
+ ...g
983
+ });
984
+ } catch (g) {
985
+ this.logger.warn(g);
986
+ }
987
+ return m;
988
+ } else
989
+ this.logger.warn(`there was no format function for ${c}`);
990
+ return o;
991
+ }, e);
992
+ }
993
+ }
994
+ const Mt = (r, e) => {
995
+ r.pending[e] !== void 0 && (delete r.pending[e], r.pendingCount--);
996
+ };
997
+ class Tt extends ue {
998
+ constructor(e, t, s, n = {}) {
999
+ var a, i;
1000
+ super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = B.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = n.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = n.maxRetries >= 0 ? n.maxRetries : 5, this.retryTimeout = n.retryTimeout >= 1 ? n.retryTimeout : 350, this.state = {}, this.queue = [], (i = (a = this.backend) == null ? void 0 : a.init) == null || i.call(a, s, n.backend, n);
1001
+ }
1002
+ queueLoad(e, t, s, n) {
1003
+ const a = {}, i = {}, o = {}, u = {};
1004
+ return e.forEach((c) => {
1005
+ let d = !0;
1006
+ t.forEach((f) => {
1007
+ const m = `${c}|${f}`;
1008
+ !s.reload && this.store.hasResourceBundle(c, f) ? this.state[m] = 2 : this.state[m] < 0 || (this.state[m] === 1 ? i[m] === void 0 && (i[m] = !0) : (this.state[m] = 1, d = !1, i[m] === void 0 && (i[m] = !0), a[m] === void 0 && (a[m] = !0), u[f] === void 0 && (u[f] = !0)));
1009
+ }), d || (o[c] = !0);
1010
+ }), (Object.keys(a).length || Object.keys(i).length) && this.queue.push({
1011
+ pending: i,
1012
+ pendingCount: Object.keys(i).length,
1013
+ loaded: {},
1014
+ errors: [],
1015
+ callback: n
1016
+ }), {
1017
+ toLoad: Object.keys(a),
1018
+ pending: Object.keys(i),
1019
+ toLoadLanguages: Object.keys(o),
1020
+ toLoadNamespaces: Object.keys(u)
1021
+ };
1022
+ }
1023
+ loaded(e, t, s) {
1024
+ const n = e.split("|"), a = n[0], i = n[1];
1025
+ t && this.emit("failedLoading", a, i, t), !t && s && this.store.addResourceBundle(a, i, s, void 0, void 0, {
1026
+ skipCopy: !0
1027
+ }), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0);
1028
+ const o = {};
1029
+ this.queue.forEach((u) => {
1030
+ yt(u.loaded, [a], i), Mt(u, e), t && u.errors.push(t), u.pendingCount === 0 && !u.done && (Object.keys(u.loaded).forEach((c) => {
1031
+ o[c] || (o[c] = {});
1032
+ const d = u.loaded[c];
1033
+ d.length && d.forEach((f) => {
1034
+ o[c][f] === void 0 && (o[c][f] = !0);
1035
+ });
1036
+ }), u.done = !0, u.errors.length ? u.callback(u.errors) : u.callback());
1037
+ }), this.emit("loaded", o), this.queue = this.queue.filter((u) => !u.done);
1038
+ }
1039
+ read(e, t, s, n = 0, a = this.retryTimeout, i) {
1040
+ if (!e.length)
1041
+ return i(null, {});
1042
+ if (this.readingCalls >= this.maxParallelReads) {
1043
+ this.waitingReads.push({
1044
+ lng: e,
1045
+ ns: t,
1046
+ fcName: s,
1047
+ tried: n,
1048
+ wait: a,
1049
+ callback: i
1050
+ });
1051
+ return;
1052
+ }
1053
+ this.readingCalls++;
1054
+ const o = (c, d) => {
1055
+ if (this.readingCalls--, this.waitingReads.length > 0) {
1056
+ const f = this.waitingReads.shift();
1057
+ this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
1058
+ }
1059
+ if (c && d && n < this.maxRetries) {
1060
+ setTimeout(() => {
1061
+ this.read.call(this, e, t, s, n + 1, a * 2, i);
1062
+ }, a);
1063
+ return;
1064
+ }
1065
+ i(c, d);
1066
+ }, u = this.backend[s].bind(this.backend);
1067
+ if (u.length === 2) {
1068
+ try {
1069
+ const c = u(e, t);
1070
+ c && typeof c.then == "function" ? c.then((d) => o(null, d)).catch(o) : o(null, c);
1071
+ } catch (c) {
1072
+ o(c);
1073
+ }
1074
+ return;
1075
+ }
1076
+ return u(e, t, o);
1077
+ }
1078
+ prepareLoading(e, t, s = {}, n) {
1079
+ if (!this.backend)
1080
+ return this.logger.warn("No backend was added via i18next.use. Will not load resources."), n && n();
1081
+ x(e) && (e = this.languageUtils.toResolveHierarchy(e)), x(t) && (t = [t]);
1082
+ const a = this.queueLoad(e, t, s, n);
1083
+ if (!a.toLoad.length)
1084
+ return a.pending.length || n(), null;
1085
+ a.toLoad.forEach((i) => {
1086
+ this.loadOne(i);
1087
+ });
1088
+ }
1089
+ load(e, t, s) {
1090
+ this.prepareLoading(e, t, {}, s);
1091
+ }
1092
+ reload(e, t, s) {
1093
+ this.prepareLoading(e, t, {
1094
+ reload: !0
1095
+ }, s);
1096
+ }
1097
+ loadOne(e, t = "") {
1098
+ const s = e.split("|"), n = s[0], a = s[1];
1099
+ this.read(n, a, "read", void 0, void 0, (i, o) => {
1100
+ i && this.logger.warn(`${t}loading namespace ${a} for language ${n} failed`, i), !i && o && this.logger.log(`${t}loaded namespace ${a} for language ${n}`, o), this.loaded(e, i, o);
1101
+ });
1102
+ }
1103
+ saveMissing(e, t, s, n, a, i = {}, o = () => {
1104
+ }) {
1105
+ var u, c, d, f, m;
1106
+ if ((c = (u = this.services) == null ? void 0 : u.utils) != null && c.hasLoadedNamespace && !((f = (d = this.services) == null ? void 0 : d.utils) != null && f.hasLoadedNamespace(t))) {
1107
+ this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
1108
+ return;
1109
+ }
1110
+ if (!(s == null || s === "")) {
1111
+ if ((m = this.backend) != null && m.create) {
1112
+ const g = {
1113
+ ...i,
1114
+ isUpdate: a
1115
+ }, h = this.backend.create.bind(this.backend);
1116
+ if (h.length < 6)
1117
+ try {
1118
+ let p;
1119
+ h.length === 5 ? p = h(e, t, s, n, g) : p = h(e, t, s, n), p && typeof p.then == "function" ? p.then((y) => o(null, y)).catch(o) : o(null, p);
1120
+ } catch (p) {
1121
+ o(p);
1122
+ }
1123
+ else
1124
+ h(e, t, s, n, o, g);
1125
+ }
1126
+ !e || !e[0] || this.store.addResource(e[0], t, s, n);
1127
+ }
1128
+ }
1129
+ }
1130
+ const ge = () => ({
1131
+ debug: !1,
1132
+ initAsync: !0,
1133
+ ns: ["translation"],
1134
+ defaultNS: ["translation"],
1135
+ fallbackLng: ["dev"],
1136
+ fallbackNS: !1,
1137
+ supportedLngs: !1,
1138
+ nonExplicitSupportedLngs: !1,
1139
+ load: "all",
1140
+ preload: !1,
1141
+ simplifyPluralSuffix: !0,
1142
+ keySeparator: ".",
1143
+ nsSeparator: ":",
1144
+ pluralSeparator: "_",
1145
+ contextSeparator: "_",
1146
+ partialBundledLanguages: !1,
1147
+ saveMissing: !1,
1148
+ updateMissing: !1,
1149
+ saveMissingTo: "fallback",
1150
+ saveMissingPlurals: !0,
1151
+ missingKeyHandler: !1,
1152
+ missingInterpolationHandler: !1,
1153
+ postProcess: !1,
1154
+ postProcessPassResolved: !1,
1155
+ returnNull: !1,
1156
+ returnEmptyString: !0,
1157
+ returnObjects: !1,
1158
+ joinArrays: !1,
1159
+ returnedObjectHandler: !1,
1160
+ parseMissingKeyHandler: !1,
1161
+ appendNamespaceToMissingKey: !1,
1162
+ appendNamespaceToCIMode: !1,
1163
+ overloadTranslationOptionHandler: (r) => {
1164
+ let e = {};
1165
+ if (typeof r[1] == "object" && (e = r[1]), x(r[1]) && (e.defaultValue = r[1]), x(r[2]) && (e.tDescription = r[2]), typeof r[2] == "object" || typeof r[3] == "object") {
1166
+ const t = r[3] || r[2];
1167
+ Object.keys(t).forEach((s) => {
1168
+ e[s] = t[s];
1169
+ });
1170
+ }
1171
+ return e;
1172
+ },
1173
+ interpolation: {
1174
+ escapeValue: !0,
1175
+ format: (r) => r,
1176
+ prefix: "{{",
1177
+ suffix: "}}",
1178
+ formatSeparator: ",",
1179
+ unescapePrefix: "-",
1180
+ nestingPrefix: "$t(",
1181
+ nestingSuffix: ")",
1182
+ nestingOptionsSeparator: ",",
1183
+ maxReplaces: 1e3,
1184
+ skipOnVariables: !0
1185
+ },
1186
+ cacheInBuiltFormats: !0
1187
+ }), Fe = (r) => {
1188
+ var e, t;
1189
+ return x(r.ns) && (r.ns = [r.ns]), x(r.fallbackLng) && (r.fallbackLng = [r.fallbackLng]), x(r.fallbackNS) && (r.fallbackNS = [r.fallbackNS]), ((t = (e = r.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (r.supportedLngs = r.supportedLngs.concat(["cimode"])), typeof r.initImmediate == "boolean" && (r.initAsync = r.initImmediate), r;
1190
+ }, re = () => {
1191
+ }, $t = (r) => {
1192
+ Object.getOwnPropertyNames(Object.getPrototypeOf(r)).forEach((t) => {
1193
+ typeof r[t] == "function" && (r[t] = r[t].bind(r));
1194
+ });
1195
+ };
1196
+ class te extends ue {
1197
+ constructor(e = {}, t) {
1198
+ if (super(), this.options = Fe(e), this.services = {}, this.logger = B, this.modules = {
1199
+ external: []
1200
+ }, $t(this), t && !this.isInitialized && !e.isClone) {
1201
+ if (!this.options.initAsync)
1202
+ return this.init(e, t), this;
1203
+ setTimeout(() => {
1204
+ this.init(e, t);
1205
+ }, 0);
1206
+ }
1207
+ }
1208
+ init(e = {}, t) {
1209
+ this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (x(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1210
+ const s = ge();
1211
+ this.options = {
1212
+ ...s,
1213
+ ...this.options,
1214
+ ...Fe(e)
1215
+ }, this.options.interpolation = {
1216
+ ...s.interpolation,
1217
+ ...this.options.interpolation
1218
+ }, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = s.overloadTranslationOptionHandler), this.options.debug === !0 && typeof console < "u" && console.warn("i18next is maintained with support from locize.com — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com");
1219
+ const n = (c) => c ? typeof c == "function" ? new c() : c : null;
1220
+ if (!this.options.isClone) {
1221
+ this.modules.logger ? B.init(n(this.modules.logger), this.options) : B.init(null, this.options);
1222
+ let c;
1223
+ this.modules.formatter ? c = this.modules.formatter : c = Pt;
1224
+ const d = new Te(this.options);
1225
+ this.store = new Pe(this.options.resources, this.options);
1226
+ const f = this.services;
1227
+ f.logger = B, f.resourceStore = this.store, f.languageUtils = d, f.pluralResolver = new It(d, {
1228
+ prepend: this.options.pluralSeparator,
1229
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
1230
+ }), this.options.interpolation.format && this.options.interpolation.format !== s.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), c && (!this.options.interpolation.format || this.options.interpolation.format === s.interpolation.format) && (f.formatter = n(c), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new Ae(this.options), f.utils = {
1231
+ hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1232
+ }, f.backendConnector = new Tt(n(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (g, ...h) => {
1233
+ this.emit(g, ...h);
1234
+ }), this.modules.languageDetector && (f.languageDetector = n(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = n(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new ce(this.services, this.options), this.translator.on("*", (g, ...h) => {
1235
+ this.emit(g, ...h);
1236
+ }), this.modules.external.forEach((g) => {
1237
+ g.init && g.init(this);
1238
+ });
1239
+ }
1240
+ if (this.format = this.options.interpolation.format, t || (t = re), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1241
+ const c = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1242
+ c.length > 0 && c[0] !== "dev" && (this.options.lng = c[0]);
1243
+ }
1244
+ !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((c) => {
1245
+ this[c] = (...d) => this.store[c](...d);
1246
+ }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((c) => {
1247
+ this[c] = (...d) => (this.store[c](...d), this);
1248
+ });
1249
+ const o = X(), u = () => {
1250
+ const c = (d, f) => {
1251
+ this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), o.resolve(f), t(d, f);
1252
+ };
1253
+ if (this.languages && !this.isInitialized)
1254
+ return c(null, this.t.bind(this));
1255
+ this.changeLanguage(this.options.lng, c);
1256
+ };
1257
+ return this.options.resources || !this.options.initAsync ? u() : setTimeout(u, 0), o;
1258
+ }
1259
+ loadResources(e, t = re) {
1260
+ var a, i;
1261
+ let s = t;
1262
+ const n = x(e) ? e : this.language;
1263
+ if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1264
+ if ((n == null ? void 0 : n.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0))
1265
+ return s();
1266
+ const o = [], u = (c) => {
1267
+ if (!c || c === "cimode")
1268
+ return;
1269
+ this.services.languageUtils.toResolveHierarchy(c).forEach((f) => {
1270
+ f !== "cimode" && o.indexOf(f) < 0 && o.push(f);
1271
+ });
1272
+ };
1273
+ n ? u(n) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((d) => u(d)), (i = (a = this.options.preload) == null ? void 0 : a.forEach) == null || i.call(a, (c) => u(c)), this.services.backendConnector.load(o, this.options.ns, (c) => {
1274
+ !c && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(c);
1275
+ });
1276
+ } else
1277
+ s(null);
1278
+ }
1279
+ reloadResources(e, t, s) {
1280
+ const n = X();
1281
+ return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s = re), this.services.backendConnector.reload(e, t, (a) => {
1282
+ n.resolve(), s(a);
1283
+ }), n;
1284
+ }
1285
+ use(e) {
1286
+ if (!e)
1287
+ throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1288
+ if (!e.type)
1289
+ throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1290
+ return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && _e.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1291
+ }
1292
+ setResolvedLanguage(e) {
1293
+ if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1294
+ for (let t = 0; t < this.languages.length; t++) {
1295
+ const s = this.languages[t];
1296
+ if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
1297
+ this.resolvedLanguage = s;
1298
+ break;
1299
+ }
1300
+ }
1301
+ !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1302
+ }
1303
+ }
1304
+ changeLanguage(e, t) {
1305
+ this.isLanguageChangingTo = e;
1306
+ const s = X();
1307
+ this.emit("languageChanging", e);
1308
+ const n = (o) => {
1309
+ this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
1310
+ }, a = (o, u) => {
1311
+ u ? this.isLanguageChangingTo === e && (n(u), this.translator.changeLanguage(u), this.isLanguageChangingTo = void 0, this.emit("languageChanged", u), this.logger.log("languageChanged", u)) : this.isLanguageChangingTo = void 0, s.resolve((...c) => this.t(...c)), t && t(o, (...c) => this.t(...c));
1312
+ }, i = (o) => {
1313
+ var d, f;
1314
+ !e && !o && this.services.languageDetector && (o = []);
1315
+ const u = x(o) ? o : o && o[0], c = this.store.hasLanguageSomeTranslations(u) ? u : this.services.languageUtils.getBestMatchFromCodes(x(o) ? [o] : o);
1316
+ c && (this.language || n(c), this.translator.language || this.translator.changeLanguage(c), (f = (d = this.services.languageDetector) == null ? void 0 : d.cacheUserLanguage) == null || f.call(d, c)), this.loadResources(c, (m) => {
1317
+ a(m, c);
1318
+ });
1319
+ };
1320
+ return !e && this.services.languageDetector && !this.services.languageDetector.async ? i(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(i) : this.services.languageDetector.detect(i) : i(e), s;
1321
+ }
1322
+ getFixedT(e, t, s) {
1323
+ const n = (a, i, ...o) => {
1324
+ let u;
1325
+ typeof i != "object" ? u = this.options.overloadTranslationOptionHandler([a, i].concat(o)) : u = {
1326
+ ...i
1327
+ }, u.lng = u.lng || n.lng, u.lngs = u.lngs || n.lngs, u.ns = u.ns || n.ns, u.keyPrefix !== "" && (u.keyPrefix = u.keyPrefix || s || n.keyPrefix);
1328
+ const c = this.options.keySeparator || ".";
1329
+ let d;
1330
+ return u.keyPrefix && Array.isArray(a) ? d = a.map((f) => (typeof f == "function" && (f = be(f, {
1331
+ ...this.options,
1332
+ ...i
1333
+ })), `${u.keyPrefix}${c}${f}`)) : (typeof a == "function" && (a = be(a, {
1334
+ ...this.options,
1335
+ ...i
1336
+ })), d = u.keyPrefix ? `${u.keyPrefix}${c}${a}` : a), this.t(d, u);
1337
+ };
1338
+ return x(e) ? n.lng = e : n.lngs = e, n.ns = t, n.keyPrefix = s, n;
1339
+ }
1340
+ t(...e) {
1341
+ var t;
1342
+ return (t = this.translator) == null ? void 0 : t.translate(...e);
1343
+ }
1344
+ exists(...e) {
1345
+ var t;
1346
+ return (t = this.translator) == null ? void 0 : t.exists(...e);
1347
+ }
1348
+ setDefaultNamespace(e) {
1349
+ this.options.defaultNS = e;
1350
+ }
1351
+ hasLoadedNamespace(e, t = {}) {
1352
+ if (!this.isInitialized)
1353
+ return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1354
+ if (!this.languages || !this.languages.length)
1355
+ return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1356
+ const s = t.lng || this.resolvedLanguage || this.languages[0], n = this.options ? this.options.fallbackLng : !1, a = this.languages[this.languages.length - 1];
1357
+ if (s.toLowerCase() === "cimode")
1358
+ return !0;
1359
+ const i = (o, u) => {
1360
+ const c = this.services.backendConnector.state[`${o}|${u}`];
1361
+ return c === -1 || c === 0 || c === 2;
1362
+ };
1363
+ if (t.precheck) {
1364
+ const o = t.precheck(this, i);
1365
+ if (o !== void 0)
1366
+ return o;
1367
+ }
1368
+ return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || i(s, e) && (!n || i(a, e)));
1369
+ }
1370
+ loadNamespaces(e, t) {
1371
+ const s = X();
1372
+ return this.options.ns ? (x(e) && (e = [e]), e.forEach((n) => {
1373
+ this.options.ns.indexOf(n) < 0 && this.options.ns.push(n);
1374
+ }), this.loadResources((n) => {
1375
+ s.resolve(), t && t(n);
1376
+ }), s) : (t && t(), Promise.resolve());
1377
+ }
1378
+ loadLanguages(e, t) {
1379
+ const s = X();
1380
+ x(e) && (e = [e]);
1381
+ const n = this.options.preload || [], a = e.filter((i) => n.indexOf(i) < 0 && this.services.languageUtils.isSupportedCode(i));
1382
+ return a.length ? (this.options.preload = n.concat(a), this.loadResources((i) => {
1383
+ s.resolve(), t && t(i);
1384
+ }), s) : (t && t(), Promise.resolve());
1385
+ }
1386
+ dir(e) {
1387
+ var n, a;
1388
+ if (e || (e = this.resolvedLanguage || (((n = this.languages) == null ? void 0 : n.length) > 0 ? this.languages[0] : this.language)), !e)
1389
+ return "rtl";
1390
+ try {
1391
+ const i = new Intl.Locale(e);
1392
+ if (i && i.getTextInfo) {
1393
+ const o = i.getTextInfo();
1394
+ if (o && o.direction)
1395
+ return o.direction;
1396
+ }
1397
+ } catch {
1398
+ }
1399
+ const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], s = ((a = this.services) == null ? void 0 : a.languageUtils) || new Te(ge());
1400
+ return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1401
+ }
1402
+ static createInstance(e = {}, t) {
1403
+ const s = new te(e, t);
1404
+ return s.createInstance = te.createInstance, s;
1405
+ }
1406
+ cloneInstance(e = {}, t = re) {
1407
+ const s = e.forkResourceStore;
1408
+ s && delete e.forkResourceStore;
1409
+ const n = {
1410
+ ...this.options,
1411
+ ...e,
1412
+ isClone: !0
1413
+ }, a = new te(n);
1414
+ if ((e.debug !== void 0 || e.prefix !== void 0) && (a.logger = a.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
1415
+ a[o] = this[o];
1416
+ }), a.services = {
1417
+ ...this.services
1418
+ }, a.services.utils = {
1419
+ hasLoadedNamespace: a.hasLoadedNamespace.bind(a)
1420
+ }, s) {
1421
+ const o = Object.keys(this.store.data).reduce((u, c) => (u[c] = {
1422
+ ...this.store.data[c]
1423
+ }, u[c] = Object.keys(u[c]).reduce((d, f) => (d[f] = {
1424
+ ...u[c][f]
1425
+ }, d), u[c]), u), {});
1426
+ a.store = new Pe(o, n), a.services.resourceStore = a.store;
1427
+ }
1428
+ if (e.interpolation) {
1429
+ const u = {
1430
+ ...ge().interpolation,
1431
+ ...this.options.interpolation,
1432
+ ...e.interpolation
1433
+ }, c = {
1434
+ ...n,
1435
+ interpolation: u
1436
+ };
1437
+ a.services.interpolator = new Ae(c);
1438
+ }
1439
+ return a.translator = new ce(a.services, n), a.translator.on("*", (o, ...u) => {
1440
+ a.emit(o, ...u);
1441
+ }), a.init(n, t), a.translator.options = n, a.translator.backendConnector.services.utils = {
1442
+ hasLoadedNamespace: a.hasLoadedNamespace.bind(a)
1443
+ }, a;
1444
+ }
1445
+ toJSON() {
1446
+ return {
1447
+ options: this.options,
1448
+ store: this.store,
1449
+ language: this.language,
1450
+ languages: this.languages,
1451
+ resolvedLanguage: this.resolvedLanguage
1452
+ };
1453
+ }
1454
+ }
1455
+ const z = te.createInstance();
1456
+ z.createInstance;
1457
+ z.dir;
1458
+ z.init;
1459
+ z.loadResources;
1460
+ z.reloadResources;
1461
+ z.use;
1462
+ z.changeLanguage;
1463
+ z.getFixedT;
1464
+ z.t;
1465
+ z.exists;
1466
+ z.setDefaultNamespace;
1467
+ z.hasLoadedNamespace;
1468
+ z.loadNamespaces;
1469
+ z.loadLanguages;
1470
+ const Rt = (r, e, t, s) => {
1471
+ var a, i, o, u;
1472
+ const n = [t, {
1473
+ code: e,
1474
+ ...s || {}
1475
+ }];
1476
+ if ((i = (a = r == null ? void 0 : r.services) == null ? void 0 : a.logger) != null && i.forward)
1477
+ return r.services.logger.forward(n, "warn", "react-i18next::", !0);
1478
+ W(n[0]) && (n[0] = `react-i18next:: ${n[0]}`), (u = (o = r == null ? void 0 : r.services) == null ? void 0 : o.logger) != null && u.warn ? r.services.logger.warn(...n) : console != null && console.warn && console.warn(...n);
1479
+ }, ze = {}, we = (r, e, t, s) => {
1480
+ W(t) && ze[t] || (W(t) && (ze[t] = /* @__PURE__ */ new Date()), Rt(r, e, t, s));
1481
+ }, qe = (r, e) => () => {
1482
+ if (r.isInitialized)
1483
+ e();
1484
+ else {
1485
+ const t = () => {
1486
+ setTimeout(() => {
1487
+ r.off("initialized", t);
1488
+ }, 0), e();
1489
+ };
1490
+ r.on("initialized", t);
1491
+ }
1492
+ }, Ne = (r, e, t) => {
1493
+ r.loadNamespaces(e, qe(r, t));
1494
+ }, Ve = (r, e, t, s) => {
1495
+ if (W(t) && (t = [t]), r.options.preload && r.options.preload.indexOf(e) > -1)
1496
+ return Ne(r, t, s);
1497
+ t.forEach((n) => {
1498
+ r.options.ns.indexOf(n) < 0 && r.options.ns.push(n);
1499
+ }), r.loadLanguages(e, qe(r, s));
1500
+ }, Dt = (r, e, t = {}) => !e.languages || !e.languages.length ? (we(e, "NO_LANGUAGES", "i18n.languages were undefined or empty", {
1501
+ languages: e.languages
1502
+ }), !0) : e.hasLoadedNamespace(r, {
1503
+ lng: t.lng,
1504
+ precheck: (s, n) => {
1505
+ if (t.bindI18n && t.bindI18n.indexOf("languageChanging") > -1 && s.services.backendConnector.backend && s.isLanguageChangingTo && !n(s.isLanguageChangingTo, r))
1506
+ return !1;
1507
+ }
1508
+ }), W = (r) => typeof r == "string", At = (r) => typeof r == "object" && r !== null, Ut = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, Ft = {
1509
+ "&amp;": "&",
1510
+ "&#38;": "&",
1511
+ "&lt;": "<",
1512
+ "&#60;": "<",
1513
+ "&gt;": ">",
1514
+ "&#62;": ">",
1515
+ "&apos;": "'",
1516
+ "&#39;": "'",
1517
+ "&quot;": '"',
1518
+ "&#34;": '"',
1519
+ "&nbsp;": " ",
1520
+ "&#160;": " ",
1521
+ "&copy;": "©",
1522
+ "&#169;": "©",
1523
+ "&reg;": "®",
1524
+ "&#174;": "®",
1525
+ "&hellip;": "…",
1526
+ "&#8230;": "…",
1527
+ "&#x2F;": "/",
1528
+ "&#47;": "/"
1529
+ }, zt = (r) => Ft[r], Vt = (r) => r.replace(Ut, zt);
1530
+ let Bt = {
1531
+ bindI18n: "languageChanged",
1532
+ bindI18nStore: "",
1533
+ transEmptyNodeValue: "",
1534
+ transSupportBasicHtmlNodes: !0,
1535
+ transWrapTextNodes: "",
1536
+ transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
1537
+ useSuspense: !0,
1538
+ unescape: Vt
1539
+ };
1540
+ const Ht = () => Bt;
1541
+ let Kt;
1542
+ const Wt = () => Kt, Gt = He();
1543
+ class Zt {
1544
+ constructor() {
1545
+ this.usedNamespaces = {};
1546
+ }
1547
+ addUsedNamespaces(e) {
1548
+ e.forEach((t) => {
1549
+ this.usedNamespaces[t] || (this.usedNamespaces[t] = !0);
1550
+ });
1551
+ }
1552
+ getUsedNamespaces() {
1553
+ return Object.keys(this.usedNamespaces);
1554
+ }
1555
+ }
1556
+ const Yt = (r, e) => {
1557
+ const t = We();
1558
+ return K(() => {
1559
+ t.current = e ? t.current : r;
1560
+ }, [r, e]), t.current;
1561
+ }, et = (r, e, t, s) => r.getFixedT(e, t, s), Jt = (r, e, t, s) => ut(et(r, e, t, s), [r, e, t, s]), Qt = (r, e = {}) => {
1562
+ var w, C, A, P;
1563
+ const {
1564
+ i18n: t
1565
+ } = e, {
1566
+ i18n: s,
1567
+ defaultNS: n
1568
+ } = Ke(Gt) || {}, a = t || s || Wt();
1569
+ if (a && !a.reportNamespaces && (a.reportNamespaces = new Zt()), !a) {
1570
+ we(a, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
1571
+ const E = (N, U) => W(U) ? U : At(U) && W(U.defaultValue) ? U.defaultValue : Array.isArray(N) ? N[N.length - 1] : N, v = [E, {}, !1];
1572
+ return v.t = E, v.i18n = {}, v.ready = !1, v;
1573
+ }
1574
+ (w = a.options.react) != null && w.wait && we(a, "DEPRECATED_OPTION", "useTranslation: It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
1575
+ const i = {
1576
+ ...Ht(),
1577
+ ...a.options.react,
1578
+ ...e
1579
+ }, {
1580
+ useSuspense: o,
1581
+ keyPrefix: u
1582
+ } = i;
1583
+ let c = r || n || ((C = a.options) == null ? void 0 : C.defaultNS);
1584
+ c = W(c) ? [c] : c || ["translation"], (P = (A = a.reportNamespaces).addUsedNamespaces) == null || P.call(A, c);
1585
+ const d = (a.isInitialized || a.initializedStoreOnce) && c.every((E) => Dt(E, a, i)), f = Jt(a, e.lng || null, i.nsMode === "fallback" ? c : c[0], u), m = () => f, g = () => et(a, e.lng || null, i.nsMode === "fallback" ? c : c[0], u), [h, p] = j(m);
1586
+ let y = c.join();
1587
+ e.lng && (y = `${e.lng}${y}`);
1588
+ const L = Yt(y), b = We(!0);
1589
+ K(() => {
1590
+ const {
1591
+ bindI18n: E,
1592
+ bindI18nStore: v
1593
+ } = i;
1594
+ b.current = !0, !d && !o && (e.lng ? Ve(a, e.lng, c, () => {
1595
+ b.current && p(g);
1596
+ }) : Ne(a, c, () => {
1597
+ b.current && p(g);
1598
+ })), d && L && L !== y && b.current && p(g);
1599
+ const N = () => {
1600
+ b.current && p(g);
1601
+ };
1602
+ return E && (a == null || a.on(E, N)), v && (a == null || a.store.on(v, N)), () => {
1603
+ b.current = !1, a && E && (E == null || E.split(" ").forEach((U) => a.off(U, N))), v && a && v.split(" ").forEach((U) => a.store.off(U, N));
1604
+ };
1605
+ }, [a, y]), K(() => {
1606
+ b.current && d && p(m);
1607
+ }, [a, u, d]);
1608
+ const S = [h, a, d];
1609
+ if (S.t = h, S.i18n = a, S.ready = d, d || !d && !o)
1610
+ return S;
1611
+ throw new Promise((E) => {
1612
+ e.lng ? Ve(a, e.lng, c, () => E()) : Ne(a, c, () => E());
1613
+ });
1614
+ };
1615
+ let _t = !1;
1616
+ try {
1617
+ document.cookie, _t = !0;
1618
+ } catch {
1619
+ }
1620
+ function J(r) {
1621
+ const { t: e } = Qt(r);
1622
+ return e;
1623
+ }
1624
+ const Xt = ({ onConfirm: r }) => {
1625
+ const e = J("authLib");
1626
+ return K(() => {
1627
+ const { body: t } = document, s = t.style.overflow, n = t.style.pointerEvents;
1628
+ return t.style.overflow = "hidden", t.style.pointerEvents = "none", () => {
1629
+ t.style.overflow = s, t.style.pointerEvents = n;
1630
+ };
1631
+ }, []), ft.createPortal(
1632
+ /* @__PURE__ */ l.createElement("div", { className: "fixed inset-0 z-[9999] flex items-center justify-center bg-black/40 backdrop-blur-sm" }, /* @__PURE__ */ l.createElement("div", { className: "pointer-events-auto w-full max-w-sm rounded-xl bg-white p-6 shadow-xl" }, /* @__PURE__ */ l.createElement("h2", { className: "mb-4 text-xl font-semibold text-gray-800 ltr:text-left rtl:text-center" }, e("sessionExpired.title")), /* @__PURE__ */ l.createElement("p", { className: "mb-8 text-sm text-gray-600 ltr:text-left rtl:text-center" }, e("sessionExpired.message")), /* @__PURE__ */ l.createElement("div", { className: "flex justify-end" }, /* @__PURE__ */ l.createElement(
1633
+ "button",
1634
+ {
1635
+ onClick: r,
1636
+ className: `
1637
+ rounded-lg bg-red-600 px-4 py-2 text-sm font-medium text-white
1638
+ hover:bg-red-700 focus-visible:outline focus-visible:outline-2
1639
+ focus-visible:outline-offset-2 focus-visible:outline-red-600
1640
+ `
1641
+ },
1642
+ e("sessionExpired.button")
1643
+ )))),
1644
+ document.body
1645
+ );
1646
+ }, se = ({
1647
+ label: r,
1648
+ // translation key for the label
1649
+ type: e = "text",
1650
+ placeholder: t,
1651
+ // translation key for the placeholder
1652
+ color: s = "",
1653
+ value: n,
1654
+ onChange: a
1655
+ }) => {
1656
+ const i = J("authLib");
1657
+ return /* @__PURE__ */ Y.createElement("div", { className: "mt-8 flex flex-col" }, r && /* @__PURE__ */ Y.createElement(
1658
+ "label",
1659
+ {
1660
+ htmlFor: `input-${r}`,
1661
+ className: "self-start text-base text-black dark:text-white block ltr:text-left rtl:text-right"
1662
+ },
1663
+ i(r)
1664
+ ), /* @__PURE__ */ Y.createElement(
1665
+ "input",
1666
+ {
1667
+ id: `input-${r}`,
1668
+ type: e,
1669
+ placeholder: t ? i(t) : void 0,
1670
+ value: n,
1671
+ onChange: (o) => a == null ? void 0 : a(o.target.value),
1672
+ className: `
1673
+ px-4 py-4 mt-3.5 text-sm font-light rounded-lg border border-solid w-full
1674
+ ltr:text-left rtl:text-right
1675
+ ${s}
1676
+ `
1677
+ }
1678
+ ));
1679
+ }, tt = ({ icon: r, label: e }) => {
1680
+ const t = J("authLib");
1681
+ return /* @__PURE__ */ Y.createElement("div", { className: "flex gap-5 px-8 py-3 items-center bg-indigo-50 rounded-lg max-md:px-5" }, /* @__PURE__ */ Y.createElement(
1682
+ "img",
1683
+ {
1684
+ loading: "lazy",
1685
+ src: r,
1686
+ alt: e ? t(e) : "",
1687
+ className: "object-contain shrink-0 aspect-square w-[26px]"
1688
+ }
1689
+ ), e && /* @__PURE__ */ Y.createElement("div", { className: "basis-auto text-sm hidden md:block ltr:text-left rtl:text-right" }, t(e)));
1690
+ }, st = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iLTMgMCAyNjIgMjYyIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaWRZTWlkIj48cGF0aCBkPSJNMjU1Ljg3OCAxMzMuNDUxYzAtMTAuNzM0LS44NzEtMTguNTY3LTIuNzU2LTI2LjY5SDEzMC41NXY0OC40NDhoNzEuOTQ3Yy0xLjQ1IDEyLjA0LTkuMjgzIDMwLjE3Mi0yNi42OSA0Mi4zNTZsLS4yNDQgMS42MjIgMzguNzU1IDMwLjAyMyAyLjY4NS4yNjhjMjQuNjU5LTIyLjc3NCAzOC44NzUtNTYuMjgyIDM4Ljg3NS05Ni4wMjciIGZpbGw9IiM0Mjg1RjQiLz48cGF0aCBkPSJNMTMwLjU1IDI2MS4xYzM1LjI0OCAwIDY0LjgzOS0xMS42MDUgODYuNDUzLTMxLjYyMmwtNDEuMTk2LTMxLjkxM2MtMTEuMDI0IDcuNjg4LTI1LjgyIDEzLjA1NS00NS4yNTcgMTMuMDU1LTM0LjUyMyAwLTYzLjgyNC0yMi43NzMtNzQuMjY5LTU0LjI1bC0xLjUzMS4xMy00MC4yOTggMzEuMTg3LS41MjcgMS40NjVDMzUuMzkzIDIzMS43OTggNzkuNDkgMjYxLjEgMTMwLjU1IDI2MS4xIiBmaWxsPSIjMzRBODUzIi8+PHBhdGggZD0iTTU2LjI4MSAxNTYuMzdjLTIuNzU2LTguMTIzLTQuMzUxLTE2LjgyNy00LjM1MS0yNS44MiAwLTguOTk0IDEuNTk1LTE3LjY5NyA0LjIwNi0yNS44MmwtLjA3My0xLjczTDE1LjI2IDcxLjMxMmwtMS4zMzUuNjM1QzUuMDc3IDg5LjY0NCAwIDEwOS41MTcgMCAxMzAuNTVzNS4wNzcgNDAuOTA1IDEzLjkyNSA1OC42MDJsNDIuMzU2LTMyLjc4MiIgZmlsbD0iI0ZCQkMwNSIvPjxwYXRoIGQ9Ik0xMzAuNTUgNTAuNDc5YzI0LjUxNCAwIDQxLjA1IDEwLjU4OSA1MC40NzkgMTkuNDM4bDM2Ljg0NC0zNS45NzRDMTk1LjI0NSAxMi45MSAxNjUuNzk4IDAgMTMwLjU1IDAgNzkuNDkgMCAzNS4zOTMgMjkuMzAxIDEzLjkyNSA3MS45NDdsNDIuMjExIDMyLjc4M2MxMC41OS0zMS40NzcgMzkuODkxLTU0LjI1MSA3NC40MTQtNTQuMjUxIiBmaWxsPSIjRUI0MzM1Ii8+PC9zdmc+", nt = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDE2IDE2IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiPjxwYXRoIGZpbGw9IiNGMzUzMjUiIGQ9Ik0xIDFoNi41djYuNUgxVjF6Ii8+PHBhdGggZmlsbD0iIzgxQkMwNiIgZD0iTTguNSAxSDE1djYuNUg4LjVWMXoiLz48cGF0aCBmaWxsPSIjMDVBNkYwIiBkPSJNMSA4LjVoNi41VjE1SDFWOC41eiIvPjxwYXRoIGZpbGw9IiNGRkJBMDgiIGQ9Ik04LjUgOC41SDE1VjE1SDguNVY4LjV6Ii8+PC9zdmc+";
1691
+ function q(r, e, t) {
1692
+ return r ? r.startsWith(`${e}-`) ? r : r.startsWith("#") ? `${r}` : t : t;
1693
+ }
1694
+ function rt(r, e) {
1695
+ const t = (e == null ? void 0 : e.bg) || "bg-sky-500", s = (e == null ? void 0 : e.text) || "text-gray-800", n = (e == null ? void 0 : e.border) || "border-gray-300", a = (e == null ? void 0 : e.fill) || "fill-current", i = (e == null ? void 0 : e.stroke) || "stroke-current";
1696
+ return {
1697
+ bgClass: q(r.bg ?? "", "bg", t),
1698
+ textClass: q(r.text ?? "", "text", s),
1699
+ borderClass: q(r.border ?? "", "border", n),
1700
+ fillClass: q(r.fill ?? "", "fill", a),
1701
+ strokeClass: q(r.stroke ?? "", "stroke", i)
1702
+ };
1703
+ }
1704
+ /**
1705
+ * @license lucide-react v0.481.0 - ISC
1706
+ *
1707
+ * This source code is licensed under the ISC license.
1708
+ * See the LICENSE file in the root directory of this source tree.
1709
+ */
1710
+ const qt = (r) => r.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), at = (...r) => r.filter((e, t, s) => !!e && e.trim() !== "" && s.indexOf(e) === t).join(" ").trim();
1711
+ /**
1712
+ * @license lucide-react v0.481.0 - ISC
1713
+ *
1714
+ * This source code is licensed under the ISC license.
1715
+ * See the LICENSE file in the root directory of this source tree.
1716
+ */
1717
+ var es = {
1718
+ xmlns: "http://www.w3.org/2000/svg",
1719
+ width: 24,
1720
+ height: 24,
1721
+ viewBox: "0 0 24 24",
1722
+ fill: "none",
1723
+ stroke: "currentColor",
1724
+ strokeWidth: 2,
1725
+ strokeLinecap: "round",
1726
+ strokeLinejoin: "round"
1727
+ };
1728
+ /**
1729
+ * @license lucide-react v0.481.0 - ISC
1730
+ *
1731
+ * This source code is licensed under the ISC license.
1732
+ * See the LICENSE file in the root directory of this source tree.
1733
+ */
1734
+ const ts = Ge(
1735
+ ({
1736
+ color: r = "currentColor",
1737
+ size: e = 24,
1738
+ strokeWidth: t = 2,
1739
+ absoluteStrokeWidth: s,
1740
+ className: n = "",
1741
+ children: a,
1742
+ iconNode: i,
1743
+ ...o
1744
+ }, u) => me(
1745
+ "svg",
1746
+ {
1747
+ ref: u,
1748
+ ...es,
1749
+ width: e,
1750
+ height: e,
1751
+ stroke: r,
1752
+ strokeWidth: s ? Number(t) * 24 / Number(e) : t,
1753
+ className: at("lucide", n),
1754
+ ...o
1755
+ },
1756
+ [
1757
+ ...i.map(([c, d]) => me(c, d)),
1758
+ ...Array.isArray(a) ? a : [a]
1759
+ ]
1760
+ )
1761
+ );
1762
+ /**
1763
+ * @license lucide-react v0.481.0 - ISC
1764
+ *
1765
+ * This source code is licensed under the ISC license.
1766
+ * See the LICENSE file in the root directory of this source tree.
1767
+ */
1768
+ const it = (r, e) => {
1769
+ const t = Ge(
1770
+ ({ className: s, ...n }, a) => me(ts, {
1771
+ ref: a,
1772
+ iconNode: e,
1773
+ className: at(`lucide-${qt(r)}`, s),
1774
+ ...n
1775
+ })
1776
+ );
1777
+ return t.displayName = `${r}`, t;
1778
+ };
1779
+ /**
1780
+ * @license lucide-react v0.481.0 - ISC
1781
+ *
1782
+ * This source code is licensed under the ISC license.
1783
+ * See the LICENSE file in the root directory of this source tree.
1784
+ */
1785
+ const ss = [
1786
+ [
1787
+ "path",
1788
+ {
1789
+ d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
1790
+ key: "wmoenq"
1791
+ }
1792
+ ],
1793
+ ["path", { d: "M12 9v4", key: "juzpu7" }],
1794
+ ["path", { d: "M12 17h.01", key: "p32p05" }]
1795
+ ], ns = it("TriangleAlert", ss);
1796
+ /**
1797
+ * @license lucide-react v0.481.0 - ISC
1798
+ *
1799
+ * This source code is licensed under the ISC license.
1800
+ * See the LICENSE file in the root directory of this source tree.
1801
+ */
1802
+ const rs = [
1803
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1804
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1805
+ ], as = it("X", rs), ot = ({
1806
+ message: r,
1807
+ dismissAfterMs: e = 4e3
1808
+ }) => {
1809
+ const t = J("authLib"), [s, n] = j(!1);
1810
+ return K(() => {
1811
+ if (n(!!r), r && e > 0) {
1812
+ const a = window.setTimeout(() => n(!1), e);
1813
+ return () => window.clearTimeout(a);
1814
+ }
1815
+ }, [r, e]), !s || !r ? null : /* @__PURE__ */ l.createElement(
1816
+ "div",
1817
+ {
1818
+ role: "alert",
1819
+ "aria-live": "assertive",
1820
+ className: `
1821
+ relative isolate flex w-full max-w-md items-start gap-2 overflow-hidden
1822
+ rounded-lg border border-red-300 bg-red-50/80 p-4 pr-6 text-sm text-red-800
1823
+ shadow-lg backdrop-blur
1824
+ transition-all duration-300 ease-out
1825
+ ${s ? "translate-y-0 opacity-100" : "-translate-y-2 opacity-0"}
1826
+ `
1827
+ },
1828
+ /* @__PURE__ */ l.createElement("span", { className: "absolute ltr:left-0 rtl:right-0 top-0 h-full w-1 bg-gradient-to-b from-red-500 to-red-400" }),
1829
+ /* @__PURE__ */ l.createElement(ns, { className: "mt-0.5 h-5 w-5 flex-none" }),
1830
+ /* @__PURE__ */ l.createElement("span", { className: "grow leading-5 ltr:text-left rtl:text-right" }, r),
1831
+ /* @__PURE__ */ l.createElement(
1832
+ "button",
1833
+ {
1834
+ onClick: () => n(!1),
1835
+ "aria-label": t("inlineError.dismiss"),
1836
+ className: `
1837
+ absolute ltr:right-2 rtl:left-2 top-2 rounded p-1 text-red-600/70
1838
+ hover:bg-red-100 hover:text-red-700 focus:outline-none
1839
+ focus-visible:ring focus-visible:ring-red-500/50
1840
+ `
1841
+ },
1842
+ /* @__PURE__ */ l.createElement(as, { className: "h-4 w-4" })
1843
+ )
1844
+ );
1845
+ }, is = () => {
1846
+ const r = J("authLib"), e = Ee(), t = Se(), {
1847
+ brandName: s = r("brandName", { defaultValue: "MyBrand" }),
1848
+ colors: n = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
1849
+ logoUrl: a,
1850
+ oauthProviders: i = [],
1851
+ illustrationUrl: o = r("community.illustrationUrl", {
1852
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
1853
+ }),
1854
+ communityContent: u = {
1855
+ title: r("community.title"),
1856
+ description: r("community.description")
1857
+ },
1858
+ baseUrl: c
1859
+ // IMPORTANT: used for Google OAuth redirect
1860
+ } = Ye(), { login: d } = G(), [f, m] = j(""), [g, h] = j(""), [p, y] = j(!1), [L, b] = j(null), S = {
1861
+ google: { icon: st, label: "social.google" },
1862
+ microsoft: { icon: nt, label: "social.microsoft" }
1863
+ }, w = i.filter((M) => M in S).map((M) => ({
1864
+ id: M,
1865
+ icon: S[M].icon,
1866
+ label: S[M].label
1867
+ })), { bgClass: C, textClass: A, borderClass: P } = rt(n), E = `${C} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
1868
+ async function v(M) {
1869
+ var R;
1870
+ if (M.preventDefault(), !p) {
1871
+ b(null), y(!0);
1872
+ try {
1873
+ await d({ email: f, password: g });
1874
+ } catch (I) {
1875
+ ((R = I == null ? void 0 : I.response) == null ? void 0 : R.status) === 401 ? b(r("errors.invalidCredentials")) : b(r("errors.generic"));
1876
+ } finally {
1877
+ y(!1);
1878
+ }
1879
+ }
1880
+ }
1881
+ function N(M) {
1882
+ var I, k, $;
1883
+ if (!c) {
1884
+ console.error("Auth baseUrl is not configured.");
1885
+ return;
1886
+ }
1887
+ const R = ((k = (I = t.state) == null ? void 0 : I.from) == null ? void 0 : k.pathname) || (($ = t.state) == null ? void 0 : $.from) || "/";
1888
+ if (sessionStorage.setItem("postLoginRedirect", R), M === "google") {
1889
+ const T = "/oauth/google/callback", F = `${window.location.origin}${T}`, O = new URL(`${c}/auth/google`);
1890
+ O.searchParams.set("redirect", F), window.location.href = O.toString();
1891
+ return;
1892
+ }
1893
+ if (M === "microsoft") {
1894
+ const T = "/oauth/microsoft/callback", F = `${window.location.origin}${T}`, O = new URL(`${c}/auth/microsoft`);
1895
+ O.searchParams.set("redirect", F), window.location.href = O.toString();
1896
+ return;
1897
+ }
1898
+ }
1899
+ const U = /* @__PURE__ */ l.createElement(
1900
+ "svg",
1901
+ {
1902
+ className: "h-4 w-4 animate-spin stroke-current",
1903
+ viewBox: "0 0 24 24",
1904
+ fill: "none"
1905
+ },
1906
+ /* @__PURE__ */ l.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
1907
+ /* @__PURE__ */ l.createElement(
1908
+ "path",
1909
+ {
1910
+ className: "opacity-75",
1911
+ d: "M4 12a8 8 0 018-8",
1912
+ strokeWidth: "4",
1913
+ strokeLinecap: "round"
1914
+ }
1915
+ )
1916
+ );
1917
+ return /* @__PURE__ */ l.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${E}` }, /* @__PURE__ */ l.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ l.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${C}` }, /* @__PURE__ */ l.createElement("div", null, a ? /* @__PURE__ */ l.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ l.createElement(
1918
+ "img",
1919
+ {
1920
+ loading: "lazy",
1921
+ src: a,
1922
+ alt: "Brand Logo",
1923
+ className: "bg-white h-8 md:h-22 rounded-lg"
1924
+ }
1925
+ ), /* @__PURE__ */ l.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, s)) : /* @__PURE__ */ l.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, s)), /* @__PURE__ */ l.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ l.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, u.title), /* @__PURE__ */ l.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, u.description), /* @__PURE__ */ l.createElement("div", { className: "relative" }, /* @__PURE__ */ l.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ l.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ l.createElement(
1926
+ "img",
1927
+ {
1928
+ loading: "lazy",
1929
+ src: o,
1930
+ alt: "Sign in illustration",
1931
+ className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
1932
+ }
1933
+ )))), /* @__PURE__ */ l.createElement("div", { className: "w-full md:w-1/2 p-4 md:p-8 m-auto" }, /* @__PURE__ */ l.createElement("div", { className: "flex flex-col md:flex-row justify-between items-center mb-8" }, /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-center md:hidden mb-5" }, a ? /* @__PURE__ */ l.createElement(
1934
+ "img",
1935
+ {
1936
+ loading: "lazy",
1937
+ src: a,
1938
+ alt: "Brand Logo",
1939
+ className: `h-22 rounded-full border ${P}`
1940
+ }
1941
+ ) : /* @__PURE__ */ l.createElement("h2", { className: "text-2xl font-bold" }, s)), /* @__PURE__ */ l.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ l.createElement("p", { className: "text-sm md:text-lg" }, r("SignInPage.welcome"), " ", /* @__PURE__ */ l.createElement("span", { className: `font-semibold ${A} uppercase` }, s)), /* @__PURE__ */ l.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, r("SignInPage.signIn"))), /* @__PURE__ */ l.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, r("SignInPage.noAccount"), /* @__PURE__ */ l.createElement("br", null), /* @__PURE__ */ l.createElement(
1942
+ "button",
1943
+ {
1944
+ type: "button",
1945
+ onClick: () => e("/signup"),
1946
+ className: A
1947
+ },
1948
+ r("SignInPage.signUp")
1949
+ ))), L && /* @__PURE__ */ l.createElement(ot, { message: L }), /* @__PURE__ */ l.createElement("form", { className: "space-y-6", onSubmit: v }, /* @__PURE__ */ l.createElement(
1950
+ se,
1951
+ {
1952
+ label: r("form.emailLabel"),
1953
+ type: "email",
1954
+ placeholder: r("form.emailPlaceholder"),
1955
+ color: P,
1956
+ value: f,
1957
+ onChange: m
1958
+ }
1959
+ ), /* @__PURE__ */ l.createElement(
1960
+ se,
1961
+ {
1962
+ label: r("form.passwordLabel"),
1963
+ type: "password",
1964
+ placeholder: r("form.passwordPlaceholder"),
1965
+ color: P,
1966
+ value: g,
1967
+ onChange: h
1968
+ }
1969
+ ), /* @__PURE__ */ l.createElement("div", { className: "ltr:text-right rtl:text-left" }, /* @__PURE__ */ l.createElement("button", { className: `text-sm ${A}` }, r("SignInPage.forgotPassword"))), /* @__PURE__ */ l.createElement(
1970
+ "button",
1971
+ {
1972
+ type: "submit",
1973
+ disabled: p,
1974
+ className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${p ? "opacity-60 cursor-not-allowed" : ""} ${C} text-white`
1975
+ },
1976
+ p && U,
1977
+ r(p ? "SignInPage.signInSubmitting" : "SignInPage.signIn")
1978
+ ), w.length > 0 && /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ l.createElement("div", { className: `flex-grow h-px ${C}` }), /* @__PURE__ */ l.createElement("span", { className: `${A} mx-3 text-sm` }, r("SignInPage.orLoginWith")), /* @__PURE__ */ l.createElement("div", { className: `flex-grow h-px ${C}` })), /* @__PURE__ */ l.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, w.map((M) => /* @__PURE__ */ l.createElement(
1979
+ "button",
1980
+ {
1981
+ key: M.id,
1982
+ type: "button",
1983
+ onClick: () => N(M.id),
1984
+ className: "flex-1"
1985
+ },
1986
+ /* @__PURE__ */ l.createElement(tt, { icon: M.icon, label: M.label })
1987
+ ))))))));
1988
+ }, os = () => {
1989
+ const r = J("authLib"), e = Ee(), t = Se(), {
1990
+ brandName: s = r("brandName", { defaultValue: "MyBrand" }),
1991
+ colors: n = { bg: "bg-sky-500", text: "text-white", border: "border-sky-500" },
1992
+ logoUrl: a,
1993
+ oauthProviders: i = [],
1994
+ illustrationUrl: o = r("community.illustrationUrl", {
1995
+ defaultValue: "https://cdn.builder.io/api/v1/image/assets/TEMP/35ba84b8335fda2819c3a14ea3d00321a0fd0e79e571caa31108468010868ca5?placeholderIfAbsent=true&apiKey=a460e9a46e514356ac1106eada03046c"
1996
+ }),
1997
+ communityContent: u = {
1998
+ title: r("community.title"),
1999
+ description: r("community.description")
2000
+ },
2001
+ baseUrl: c
2002
+ // IMPORTANT: used for OAuth redirect (same as SignIn)
2003
+ } = Ye(), { login: d, api: f } = G(), [m, g] = j(""), [h, p] = j(""), [y, L] = j(""), [b, S] = j(!1), [w, C] = j(null), A = {
2004
+ google: { icon: st, label: "social.google" },
2005
+ microsoft: { icon: nt, label: "social.microsoft" }
2006
+ }, P = i.filter((k) => k in A).map((k) => ({
2007
+ id: k,
2008
+ icon: A[k].icon,
2009
+ label: A[k].label
2010
+ })), { bgClass: E, textClass: v, borderClass: N } = rt(n), U = `${E} bg-gradient-to-r from-white/10 via-white/0 to-white/0`;
2011
+ async function M(k) {
2012
+ var $, T, F;
2013
+ if (k.preventDefault(), !b) {
2014
+ C(null), S(!0);
2015
+ try {
2016
+ await f.post("/auth/clients/register", {
2017
+ email: h,
2018
+ password: y,
2019
+ name: m || void 0
2020
+ }), await d({ email: h, password: y });
2021
+ } catch (O) {
2022
+ const H = ($ = O == null ? void 0 : O.response) == null ? void 0 : $.status;
2023
+ C(
2024
+ H === 400 ? ((F = (T = O == null ? void 0 : O.response) == null ? void 0 : T.data) == null ? void 0 : F.message) || r("errors.invalidData", {
2025
+ defaultValue: "Please check the fields and try again."
2026
+ }) : H === 409 ? r("errors.emailInUse", {
2027
+ defaultValue: "This email is already in use."
2028
+ }) : r("errors.generic", {
2029
+ defaultValue: "Something went wrong. Please try again."
2030
+ })
2031
+ );
2032
+ } finally {
2033
+ S(!1);
2034
+ }
2035
+ }
2036
+ }
2037
+ function R(k) {
2038
+ var T, F, O;
2039
+ if (!c) {
2040
+ console.error("Auth baseUrl is not configured.");
2041
+ return;
2042
+ }
2043
+ const $ = ((F = (T = t.state) == null ? void 0 : T.from) == null ? void 0 : F.pathname) || ((O = t.state) == null ? void 0 : O.from) || "/";
2044
+ if (sessionStorage.setItem("postLoginRedirect", $), k === "google") {
2045
+ const H = "/oauth/google/callback", D = `${window.location.origin}${H}`, V = new URL(`${c}/auth/google`);
2046
+ V.searchParams.set("redirect", D), window.location.href = V.toString();
2047
+ return;
2048
+ }
2049
+ if (k === "microsoft") {
2050
+ const H = "/oauth/microsoft/callback", D = `${window.location.origin}${H}`, V = new URL(`${c}/auth/microsoft`);
2051
+ V.searchParams.set("redirect", D), window.location.href = V.toString();
2052
+ return;
2053
+ }
2054
+ }
2055
+ const I = /* @__PURE__ */ l.createElement(
2056
+ "svg",
2057
+ {
2058
+ className: "h-4 w-4 animate-spin stroke-current",
2059
+ viewBox: "0 0 24 24",
2060
+ fill: "none"
2061
+ },
2062
+ /* @__PURE__ */ l.createElement("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", strokeWidth: "4" }),
2063
+ /* @__PURE__ */ l.createElement(
2064
+ "path",
2065
+ {
2066
+ className: "opacity-75",
2067
+ d: "M4 12a8 8 0 018-8",
2068
+ strokeWidth: "4",
2069
+ strokeLinecap: "round"
2070
+ }
2071
+ )
2072
+ );
2073
+ return /* @__PURE__ */ l.createElement("div", { className: `flex items-center justify-center min-h-screen p-4 ${U}` }, /* @__PURE__ */ l.createElement("div", { className: "flex w-full max-w-5xl bg-white rounded-2xl shadow-2xl overflow-hidden" }, /* @__PURE__ */ l.createElement("div", { className: `hidden md:flex md:w-1/2 p-12 flex-col justify-between text-white ${E}` }, /* @__PURE__ */ l.createElement("div", null, a ? /* @__PURE__ */ l.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ l.createElement(
2074
+ "img",
2075
+ {
2076
+ loading: "lazy",
2077
+ src: a,
2078
+ alt: "Brand Logo",
2079
+ className: "bg-white h-8 md:h-22 rounded-lg"
2080
+ }
2081
+ ), /* @__PURE__ */ l.createElement("h2", { className: "text-sm md:text-2xl font-bold uppercase" }, s)) : /* @__PURE__ */ l.createElement("h2", { className: "text-sm md:text-2xl font-bold" }, s)), /* @__PURE__ */ l.createElement("div", { className: "flex-1 space-y-4 mt-6 py-4" }, /* @__PURE__ */ l.createElement("h3", { className: "text-2xl font-semibold leading-tight" }, u.title), /* @__PURE__ */ l.createElement("p", { className: "text-base leading-relaxed opacity-90 ltr:text-left rtl:text-right" }, u.description), /* @__PURE__ */ l.createElement("div", { className: "relative" }, /* @__PURE__ */ l.createElement("div", { className: "absolute -left-4 -top-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ l.createElement("div", { className: "absolute -right-4 -bottom-4 w-20 h-20 bg-white/20 rounded-full blur-xl" }), /* @__PURE__ */ l.createElement(
2082
+ "img",
2083
+ {
2084
+ loading: "lazy",
2085
+ src: o,
2086
+ alt: "Sign up illustration",
2087
+ className: "max-w-sm w-full mx-auto rounded-lg shadow-lg transform hover:scale-105 transition-transform duration-300 p-6"
2088
+ }
2089
+ )))), /* @__PURE__ */ l.createElement("div", { className: "w-full md:w-1/2 p-4 md:p-8 m-auto" }, /* @__PURE__ */ l.createElement("div", { className: "flex flex-col md:flex-row justify-between items-center mb-8" }, /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-center md:hidden mb-5" }, a ? /* @__PURE__ */ l.createElement(
2090
+ "img",
2091
+ {
2092
+ loading: "lazy",
2093
+ src: a,
2094
+ alt: "Brand Logo",
2095
+ className: `h-22 rounded-full border ${N}`
2096
+ }
2097
+ ) : /* @__PURE__ */ l.createElement("h2", { className: "text-2xl font-bold" }, s)), /* @__PURE__ */ l.createElement("div", { className: "w-full md:w-auto mb-4 md:mb-0 text-center md:text-left ltr:text-center rtl:text-center md:ltr:text-left md:rtl:text-right" }, /* @__PURE__ */ l.createElement("p", { className: "text-sm md:text-lg" }, r("SignUpPage.welcome", { defaultValue: "Join" }), " ", /* @__PURE__ */ l.createElement("span", { className: `font-semibold ${v} uppercase` }, s)), /* @__PURE__ */ l.createElement("h1", { className: "text-2xl md:text-4xl font-bold text-gray-800" }, r("SignUpPage.signUp", { defaultValue: "Sign up" }))), /* @__PURE__ */ l.createElement("div", { className: "text-sm text-gray-500 text-center md:text-right" }, r("SignUpPage.alreadyHaveAccount", {
2098
+ defaultValue: "Already have an account?"
2099
+ }), /* @__PURE__ */ l.createElement("br", null), /* @__PURE__ */ l.createElement(
2100
+ "button",
2101
+ {
2102
+ type: "button",
2103
+ onClick: () => e("/login"),
2104
+ className: v
2105
+ },
2106
+ r("SignUpPage.signIn", { defaultValue: "Sign in" })
2107
+ ))), w && /* @__PURE__ */ l.createElement(ot, { message: w }), /* @__PURE__ */ l.createElement("form", { className: "space-y-6", onSubmit: M }, /* @__PURE__ */ l.createElement(
2108
+ se,
2109
+ {
2110
+ label: r("form.nameLabel", { defaultValue: "Name" }),
2111
+ type: "text",
2112
+ placeholder: r("form.namePlaceholder", {
2113
+ defaultValue: "Enter your name"
2114
+ }),
2115
+ color: N,
2116
+ value: m,
2117
+ onChange: g
2118
+ }
2119
+ ), /* @__PURE__ */ l.createElement(
2120
+ se,
2121
+ {
2122
+ label: r("form.emailLabel"),
2123
+ type: "email",
2124
+ placeholder: r("form.emailPlaceholder"),
2125
+ color: N,
2126
+ value: h,
2127
+ onChange: p
2128
+ }
2129
+ ), /* @__PURE__ */ l.createElement(
2130
+ se,
2131
+ {
2132
+ label: r("form.passwordLabel"),
2133
+ type: "password",
2134
+ placeholder: r("form.passwordPlaceholder"),
2135
+ color: N,
2136
+ value: y,
2137
+ onChange: L
2138
+ }
2139
+ ), /* @__PURE__ */ l.createElement(
2140
+ "button",
2141
+ {
2142
+ type: "submit",
2143
+ disabled: b,
2144
+ className: `relative flex w-full items-center justify-center gap-2 py-3 rounded-lg font-medium transition-colors ${b ? "opacity-60 cursor-not-allowed" : ""} ${E} text-white`
2145
+ },
2146
+ b && I,
2147
+ b ? r("SignUpPage.signUpSubmitting", {
2148
+ defaultValue: "Creating account..."
2149
+ }) : r("SignUpPage.signUp", { defaultValue: "Sign up" })
2150
+ ), P.length > 0 && /* @__PURE__ */ l.createElement(l.Fragment, null, /* @__PURE__ */ l.createElement("div", { className: "flex items-center pt-2" }, /* @__PURE__ */ l.createElement("div", { className: `flex-grow h-px ${E}` }), /* @__PURE__ */ l.createElement("span", { className: `${v} mx-3 text-sm` }, r("SignUpPage.orContinueWith", {
2151
+ defaultValue: "Or continue with"
2152
+ })), /* @__PURE__ */ l.createElement("div", { className: `flex-grow h-px ${E}` })), /* @__PURE__ */ l.createElement("div", { className: "flex gap-3 mb-6 justify-center md:justify-start" }, P.map((k) => /* @__PURE__ */ l.createElement(
2153
+ "button",
2154
+ {
2155
+ key: k.id,
2156
+ type: "button",
2157
+ onClick: () => R(k.id),
2158
+ className: "flex-1"
2159
+ },
2160
+ /* @__PURE__ */ l.createElement(tt, { icon: k.icon, label: k.label })
2161
+ ))))))));
2162
+ }, Be = () => (K(() => {
2163
+ const r = new URLSearchParams(window.location.search), e = r.get("accessToken"), t = r.get("refreshToken");
2164
+ e && localStorage.setItem("authToken", e), t && localStorage.setItem("refreshToken", t);
2165
+ const s = sessionStorage.getItem("postLoginRedirect") || "/";
2166
+ sessionStorage.removeItem("postLoginRedirect"), window.location.replace(s);
2167
+ }, []), /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-center min-h-screen text-gray-700" }, "Finishing Google sign-in…")), ls = ({ children: r }) => {
2168
+ const { isAuthenticated: e } = G(), t = Se();
2169
+ return e ? r : /* @__PURE__ */ l.createElement(ie, { to: "/login", state: { from: t }, replace: !0 });
2170
+ }, gs = ({ config: r, children: e }) => {
2171
+ const t = Ee(), [s, n] = j(
2172
+ () => localStorage.getItem("authToken")
2173
+ ), [a, i] = j(null), [o, u] = j(!0), [c, d] = j(!1);
2174
+ async function f() {
2175
+ try {
2176
+ await m.post("/auth/logout");
2177
+ } catch (p) {
2178
+ console.warn("Logout endpoint failed, proceeding with local logout:", p);
2179
+ }
2180
+ n(null), i(null), localStorage.removeItem("authToken"), sessionStorage.clear(), d(!1), t("/login", { replace: !0 });
2181
+ }
2182
+ const m = ae(() => {
2183
+ const p = pe.create({
2184
+ baseURL: r.baseUrl,
2185
+ withCredentials: !0
2186
+ });
2187
+ return mt(p, {
2188
+ baseUrl: r.baseUrl,
2189
+ getAccessToken: () => s,
2190
+ setAccessToken: (y) => n(y),
2191
+ logout: () => d(!0)
2192
+ }), p;
2193
+ }, [r.baseUrl, s]);
2194
+ K(() => {
2195
+ (async () => {
2196
+ if (s) {
2197
+ i(de(s)), u(!1);
2198
+ return;
2199
+ }
2200
+ try {
2201
+ const { data: y } = await pe.post(
2202
+ `${r.baseUrl}/auth/refresh-token`,
2203
+ {},
2204
+ { withCredentials: !0 }
2205
+ );
2206
+ n(y.accessToken), i(de(y.accessToken)), localStorage.setItem("authToken", y.accessToken);
2207
+ } catch {
2208
+ } finally {
2209
+ u(!1);
2210
+ }
2211
+ })();
2212
+ }, [s, r.baseUrl]);
2213
+ async function g(p) {
2214
+ const { data: y } = await m.post("/auth/clients/login", p);
2215
+ n(y.accessToken), i(de(y.accessToken)), localStorage.setItem("authToken", y.accessToken), gt(), t("/", { replace: !0 });
2216
+ }
2217
+ const h = ae(
2218
+ () => ({
2219
+ isAuthenticated: !!s,
2220
+ accessToken: s,
2221
+ user: a,
2222
+ login: g,
2223
+ logout: f,
2224
+ api: m,
2225
+ setUser: i
2226
+ }),
2227
+ [s, a, m]
2228
+ );
2229
+ return /* @__PURE__ */ l.createElement(Ze.Provider, { value: r }, /* @__PURE__ */ l.createElement(Je.Provider, { value: h }, /* @__PURE__ */ l.createElement(ht, null, /* @__PURE__ */ l.createElement(
2230
+ _,
2231
+ {
2232
+ path: "login",
2233
+ element: s ? /* @__PURE__ */ l.createElement(ie, { to: "/", replace: !0 }) : /* @__PURE__ */ l.createElement(is, { baseUrl: r.baseUrl, colors: r.colors })
2234
+ }
2235
+ ), /* @__PURE__ */ l.createElement(
2236
+ _,
2237
+ {
2238
+ path: "signup",
2239
+ element: s ? /* @__PURE__ */ l.createElement(ie, { to: "/", replace: !0 }) : /* @__PURE__ */ l.createElement(os, null)
2240
+ }
2241
+ ), /* @__PURE__ */ l.createElement(
2242
+ _,
2243
+ {
2244
+ path: "oauth/google/callback",
2245
+ element: /* @__PURE__ */ l.createElement(Be, null)
2246
+ }
2247
+ ), /* @__PURE__ */ l.createElement(
2248
+ _,
2249
+ {
2250
+ path: "/oauth/microsoft/callback",
2251
+ element: /* @__PURE__ */ l.createElement(Be, null)
2252
+ }
2253
+ ), /* @__PURE__ */ l.createElement(
2254
+ _,
2255
+ {
2256
+ path: "*",
2257
+ element: /* @__PURE__ */ l.createElement(ls, null, e)
2258
+ }
2259
+ )), c && /* @__PURE__ */ l.createElement(Xt, { onConfirm: f })));
2260
+ };
2261
+ function lt(...r) {
2262
+ const { user: e } = G(), t = (e == null ? void 0 : e.roles) ?? [];
2263
+ return r.some((s) => t.includes(s));
2264
+ }
2265
+ function ms(r) {
2266
+ const { user: e } = G();
2267
+ return (e == null ? void 0 : e.modules.includes(r)) ?? !1;
2268
+ }
2269
+ function ve(...r) {
2270
+ const { user: e } = G(), t = (e == null ? void 0 : e.permissions) ?? [];
2271
+ return r.every((s) => t.includes(s));
2272
+ }
2273
+ const ps = ({
2274
+ children: r,
2275
+ fallbackpermessions: e = [],
2276
+ anyPermessions: t = [],
2277
+ fallbackRoles: s = ["super-admin"],
2278
+ redirectTo: n = "/dashboard"
2279
+ }) => {
2280
+ if (s.some((u) => lt(u)))
2281
+ return /* @__PURE__ */ l.createElement(l.Fragment, null, r);
2282
+ const i = e.length === 0 || e.every((u) => ve(u)), o = t.length === 0 || t.some((u) => ve(u));
2283
+ return i && o ? /* @__PURE__ */ l.createElement(l.Fragment, null, r) : /* @__PURE__ */ l.createElement(ie, { to: n, replace: !0 });
2284
+ }, ct = l.createContext({}), xs = ct.Provider;
2285
+ function ys(r, e) {
2286
+ var n, a, i;
2287
+ const s = (n = l.useContext(ct)[r]) == null ? void 0 : n[e];
2288
+ return s ? !!((a = s.perms) != null && a.some((o) => ve(o)) || (i = s.fallbackRoles) != null && i.some((o) => lt(o))) : !1;
2289
+ }
2290
+ const bs = () => {
2291
+ const { user: r, api: e, setUser: t } = G(), [s, n] = j((r == null ? void 0 : r.name) ?? ""), [a, i] = j((r == null ? void 0 : r.email) ?? ""), [o, u] = j(!1), [c, d] = j(!1), [f, m] = j({
2292
+ open: !1,
2293
+ type: "success",
2294
+ title: "",
2295
+ message: ""
2296
+ }), g = "+971 50 827 8229";
2297
+ K(() => {
2298
+ if (!f.open)
2299
+ return;
2300
+ const b = window.setTimeout(() => m((S) => ({ ...S, open: !1 })), 3e3);
2301
+ return () => window.clearTimeout(b);
2302
+ }, [f.open]), K(() => {
2303
+ let b = !1;
2304
+ async function S() {
2305
+ try {
2306
+ const { data: w } = await e.get("/auth/client/me");
2307
+ if (b)
2308
+ return;
2309
+ t(w), n((w == null ? void 0 : w.name) ?? ""), i((w == null ? void 0 : w.email) ?? "");
2310
+ } catch (w) {
2311
+ console.error("Failed to load profile details:", w);
2312
+ }
2313
+ }
2314
+ return S(), () => {
2315
+ b = !0;
2316
+ };
2317
+ }, [e, t]);
2318
+ const h = ae(() => (s || (r == null ? void 0 : r.name) || (r == null ? void 0 : r.email) || "").trim(), [s, r == null ? void 0 : r.name, r == null ? void 0 : r.email]), p = ae(() => h.charAt(0).toUpperCase() || "?", [h]);
2319
+ async function y() {
2320
+ if (r) {
2321
+ d(!0);
2322
+ try {
2323
+ await e.patch("/auth/client/me", { name: s }), t({ ...r, name: s }), u(!1), m({
2324
+ open: !0,
2325
+ type: "success",
2326
+ title: "Changes saved",
2327
+ message: "Your profile was updated successfully."
2328
+ });
2329
+ } catch (b) {
2330
+ console.error("Failed to update profile:", b), m({
2331
+ open: !0,
2332
+ type: "error",
2333
+ title: "Save failed",
2334
+ message: "Failed to save changes. Please try again."
2335
+ });
2336
+ } finally {
2337
+ d(!1);
2338
+ }
2339
+ }
2340
+ }
2341
+ if (!r)
2342
+ return /* @__PURE__ */ l.createElement("p", { className: "text-sm text-gray-500" }, "No user data available.");
2343
+ const L = f.type === "success";
2344
+ return /* @__PURE__ */ l.createElement("div", { className: "max-w-3xl mx-auto" }, f.open && /* @__PURE__ */ l.createElement(
2345
+ "div",
2346
+ {
2347
+ className: "fixed top-6 right-6 z-[999999] flex items-center gap-3 rounded-xl border bg-white px-4 py-3 shadow-lg",
2348
+ role: "status",
2349
+ "aria-live": "polite",
2350
+ style: {
2351
+ borderColor: L ? "#BBF7D0" : "#FECACA"
2352
+ }
2353
+ },
2354
+ /* @__PURE__ */ l.createElement(
2355
+ "div",
2356
+ {
2357
+ className: "flex h-9 w-9 items-center justify-center rounded-full",
2358
+ style: {
2359
+ backgroundColor: L ? "#ECFDF5" : "#FEF2F2"
2360
+ }
2361
+ },
2362
+ L ? /* @__PURE__ */ l.createElement(
2363
+ "svg",
2364
+ {
2365
+ width: "18",
2366
+ height: "18",
2367
+ viewBox: "0 0 24 24",
2368
+ fill: "none",
2369
+ xmlns: "http://www.w3.org/2000/svg",
2370
+ className: "text-green-600"
2371
+ },
2372
+ /* @__PURE__ */ l.createElement(
2373
+ "path",
2374
+ {
2375
+ d: "M20 6L9 17L4 12",
2376
+ stroke: "currentColor",
2377
+ strokeWidth: "2",
2378
+ strokeLinecap: "round",
2379
+ strokeLinejoin: "round"
2380
+ }
2381
+ )
2382
+ ) : /* @__PURE__ */ l.createElement(
2383
+ "svg",
2384
+ {
2385
+ width: "18",
2386
+ height: "18",
2387
+ viewBox: "0 0 24 24",
2388
+ fill: "none",
2389
+ xmlns: "http://www.w3.org/2000/svg",
2390
+ className: "text-red-600"
2391
+ },
2392
+ /* @__PURE__ */ l.createElement(
2393
+ "path",
2394
+ {
2395
+ d: "M12 9V13",
2396
+ stroke: "currentColor",
2397
+ strokeWidth: "2",
2398
+ strokeLinecap: "round"
2399
+ }
2400
+ ),
2401
+ /* @__PURE__ */ l.createElement(
2402
+ "path",
2403
+ {
2404
+ d: "M12 17H12.01",
2405
+ stroke: "currentColor",
2406
+ strokeWidth: "2",
2407
+ strokeLinecap: "round"
2408
+ }
2409
+ ),
2410
+ /* @__PURE__ */ l.createElement(
2411
+ "path",
2412
+ {
2413
+ d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z",
2414
+ stroke: "currentColor",
2415
+ strokeWidth: "2",
2416
+ strokeLinejoin: "round"
2417
+ }
2418
+ )
2419
+ )
2420
+ ),
2421
+ /* @__PURE__ */ l.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ l.createElement(
2422
+ "span",
2423
+ {
2424
+ className: "text-sm font-semibold",
2425
+ style: { color: L ? "#15803D" : "#B91C1C" }
2426
+ },
2427
+ f.title
2428
+ ), f.message && /* @__PURE__ */ l.createElement("span", { className: "text-xs text-gray-500" }, f.message)),
2429
+ /* @__PURE__ */ l.createElement(
2430
+ "button",
2431
+ {
2432
+ type: "button",
2433
+ onClick: () => m((b) => ({ ...b, open: !1 })),
2434
+ className: "ml-2 rounded-md px-2 py-1 text-gray-500 hover:bg-gray-100",
2435
+ "aria-label": "Close",
2436
+ title: "Close"
2437
+ },
2438
+ /* @__PURE__ */ l.createElement(
2439
+ "svg",
2440
+ {
2441
+ width: "16",
2442
+ height: "16",
2443
+ viewBox: "0 0 24 24",
2444
+ fill: "none",
2445
+ xmlns: "http://www.w3.org/2000/svg"
2446
+ },
2447
+ /* @__PURE__ */ l.createElement(
2448
+ "path",
2449
+ {
2450
+ d: "M18 6L6 18",
2451
+ stroke: "currentColor",
2452
+ strokeWidth: "2",
2453
+ strokeLinecap: "round"
2454
+ }
2455
+ ),
2456
+ /* @__PURE__ */ l.createElement(
2457
+ "path",
2458
+ {
2459
+ d: "M6 6L18 18",
2460
+ stroke: "currentColor",
2461
+ strokeWidth: "2",
2462
+ strokeLinecap: "round"
2463
+ }
2464
+ )
2465
+ )
2466
+ )
2467
+ ), /* @__PURE__ */ l.createElement("div", { className: "rounded-2xl border border-gray-200 bg-white shadow-sm" }, /* @__PURE__ */ l.createElement("div", { className: "px-6 pt-6 pb-4" }, /* @__PURE__ */ l.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ l.createElement("div", { className: "flex items-center gap-4" }, /* @__PURE__ */ l.createElement("div", { className: "relative" }, /* @__PURE__ */ l.createElement("div", { className: "h-16 w-16 rounded-full bg-blue-600 flex items-center justify-center text-white text-2xl font-semibold" }, p), /* @__PURE__ */ l.createElement(
2468
+ "button",
2469
+ {
2470
+ type: "button",
2471
+ className: "absolute -bottom-1 -right-1 h-8 w-8 rounded-full border border-gray-200 bg-white shadow-sm flex items-center justify-center hover:bg-gray-50",
2472
+ title: "Change avatar"
2473
+ },
2474
+ /* @__PURE__ */ l.createElement(
2475
+ "svg",
2476
+ {
2477
+ width: "16",
2478
+ height: "16",
2479
+ viewBox: "0 0 24 24",
2480
+ fill: "none",
2481
+ xmlns: "http://www.w3.org/2000/svg"
2482
+ },
2483
+ /* @__PURE__ */ l.createElement(
2484
+ "path",
2485
+ {
2486
+ d: "M12 20H21",
2487
+ stroke: "currentColor",
2488
+ strokeWidth: "2",
2489
+ strokeLinecap: "round"
2490
+ }
2491
+ ),
2492
+ /* @__PURE__ */ l.createElement(
2493
+ "path",
2494
+ {
2495
+ d: "M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z",
2496
+ stroke: "currentColor",
2497
+ strokeWidth: "2",
2498
+ strokeLinejoin: "round"
2499
+ }
2500
+ )
2501
+ )
2502
+ )), /* @__PURE__ */ l.createElement("div", null, /* @__PURE__ */ l.createElement("h1", { className: "text-2xl font-semibold" }, "My Profile"), /* @__PURE__ */ l.createElement("p", { className: "text-sm text-gray-500" }, "Personal details"))), o ? /* @__PURE__ */ l.createElement(
2503
+ "button",
2504
+ {
2505
+ type: "button",
2506
+ onClick: y,
2507
+ disabled: c,
2508
+ className: "rounded-full border border-blue-200 bg-blue-50 px-4 py-2 text-sm font-medium text-blue-700 hover:bg-blue-100 disabled:opacity-60"
2509
+ },
2510
+ c ? "Saving…" : "Save changes"
2511
+ ) : /* @__PURE__ */ l.createElement(
2512
+ "button",
2513
+ {
2514
+ type: "button",
2515
+ onClick: () => u(!0),
2516
+ title: "Edit profile",
2517
+ className: "h-9 w-9 rounded-full border border-gray-200 bg-white shadow-sm flex items-center justify-center hover:bg-gray-50"
2518
+ },
2519
+ /* @__PURE__ */ l.createElement(
2520
+ "svg",
2521
+ {
2522
+ width: "18",
2523
+ height: "18",
2524
+ viewBox: "0 0 24 24",
2525
+ fill: "none",
2526
+ xmlns: "http://www.w3.org/2000/svg"
2527
+ },
2528
+ /* @__PURE__ */ l.createElement(
2529
+ "path",
2530
+ {
2531
+ d: "M12 20H21",
2532
+ stroke: "currentColor",
2533
+ strokeWidth: "2",
2534
+ strokeLinecap: "round"
2535
+ }
2536
+ ),
2537
+ /* @__PURE__ */ l.createElement(
2538
+ "path",
2539
+ {
2540
+ d: "M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4 12.5-12.5Z",
2541
+ stroke: "currentColor",
2542
+ strokeWidth: "2",
2543
+ strokeLinejoin: "round"
2544
+ }
2545
+ )
2546
+ )
2547
+ ))), /* @__PURE__ */ l.createElement("div", { className: "px-6 pb-6 border-t border-gray-100 pt-6" }, /* @__PURE__ */ l.createElement("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-5" }, /* @__PURE__ */ l.createElement("div", null, /* @__PURE__ */ l.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Username"), /* @__PURE__ */ l.createElement(
2548
+ "input",
2549
+ {
2550
+ type: "text",
2551
+ value: s,
2552
+ disabled: !o || c,
2553
+ onChange: (b) => n(b.target.value),
2554
+ className: `w-full rounded-lg border px-3 py-2 text-sm outline-none ${o ? "border-gray-300 bg-white focus:border-blue-500 focus:ring-2 focus:ring-blue-100" : "border-gray-200 bg-gray-50 text-gray-700"}`
2555
+ }
2556
+ )), /* @__PURE__ */ l.createElement("div", null, /* @__PURE__ */ l.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Email ID"), /* @__PURE__ */ l.createElement(
2557
+ "input",
2558
+ {
2559
+ type: "email",
2560
+ value: a,
2561
+ disabled: !0,
2562
+ className: "w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 cursor-not-allowed"
2563
+ }
2564
+ )), /* @__PURE__ */ l.createElement("div", null, /* @__PURE__ */ l.createElement("label", { className: "block text-xs font-medium text-gray-500 mb-2" }, "Mobile number"), /* @__PURE__ */ l.createElement(
2565
+ "input",
2566
+ {
2567
+ type: "text",
2568
+ value: g,
2569
+ disabled: !0,
2570
+ className: "w-full rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 cursor-not-allowed"
2571
+ }
2572
+ ))), o && /* @__PURE__ */ l.createElement(
2573
+ "button",
2574
+ {
2575
+ type: "button",
2576
+ disabled: c,
2577
+ onClick: () => {
2578
+ u(!1), n((r == null ? void 0 : r.name) ?? "");
2579
+ },
2580
+ className: "mt-6 text-sm font-medium text-gray-600 hover:text-gray-900"
2581
+ },
2582
+ "Cancel"
2583
+ ))));
2584
+ };
2585
+ export {
2586
+ gs as AuthProvider,
2587
+ bs as ProfilePage,
2588
+ ct as RbacContext,
2589
+ xs as RbacProvider,
2590
+ ps as RequirePermissions,
2591
+ G as useAuthState,
2592
+ ve as useCan,
2593
+ ys as useGrant,
2594
+ ms as useHasModule,
2595
+ lt as useHasRole
2596
+ };