@lokalise/harmony 1.5.5 → 1.6.0-exp-jwtutils.1

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 (29) hide show
  1. package/dist/harmony.cjs +1 -1
  2. package/dist/harmony.mjs +514 -372
  3. package/dist/types/src/features/auth/core/jwtAuthAddon.d.ts +6 -0
  4. package/dist/types/src/features/auth/core/jwtTokenPayload.d.ts +48 -0
  5. package/dist/types/src/features/auth/core/jwtTokenPayload.test.d.ts +1 -0
  6. package/dist/types/src/features/auth/core/middleware/jwtAuthMiddleware.d.ts +7 -0
  7. package/dist/types/src/features/auth/core/middleware/jwtAuthMiddleware.test.d.ts +1 -0
  8. package/dist/types/src/features/auth/core/service/authService.d.ts +40 -0
  9. package/dist/types/src/features/auth/core/service/contributors.d.ts +205 -0
  10. package/dist/types/src/features/auth/core/service/teamUsersService.d.ts +128 -0
  11. package/dist/types/src/features/auth/core/types/teamRole.d.ts +3 -0
  12. package/dist/types/src/features/auth/core/utils/makeAuthHeader.d.ts +3 -0
  13. package/dist/types/src/features/auth/core/utils/makeAuthHeader.test.d.ts +1 -0
  14. package/dist/types/src/features/auth/frontend/addon/browserJwtAuthAddon.d.ts +15 -0
  15. package/dist/types/src/features/auth/frontend/events/NewJwtIssuedEvent.d.ts +17 -0
  16. package/dist/types/src/features/auth/frontend/hooks/services/useGetUserTokenQuery.d.ts +10 -0
  17. package/dist/types/src/features/auth/frontend/hooks/services/useRetrieveContributorQuery.d.ts +25 -0
  18. package/dist/types/src/features/auth/frontend/hooks/services/userGetTeamUsersQuery.d.ts +17 -0
  19. package/dist/types/src/features/auth/frontend/hooks/utility/useAuthenticatedProjectContributor.d.ts +23 -0
  20. package/dist/types/src/features/auth/frontend/hooks/utility/useAuthenticatedUser.d.ts +15 -0
  21. package/dist/types/src/features/auth/frontend/hooks/utility/useGetPromotedClassicSessionJwtQuery.d.ts +8 -0
  22. package/dist/types/src/features/auth/frontend/hooks/utility/useJwtTokenPayload.d.ts +16 -0
  23. package/dist/types/src/features/auth/frontend/middleware/promoteClassicSessionToJwtMiddleware.d.ts +6 -0
  24. package/dist/types/src/features/auth/frontend/middleware/promoteClassicSessionToJwtMiddleware.test.d.ts +1 -0
  25. package/dist/types/src/features/auth/frontend/utils/cookieToken.d.ts +2 -0
  26. package/dist/types/src/features/auth/frontend/utils/tokenStorage.d.ts +7 -0
  27. package/dist/types/src/node.d.ts +9 -0
  28. package/dist/types/src/utils/types/apiQueryOverrides.d.ts +2 -0
  29. package/package.json +13 -2
package/dist/harmony.mjs CHANGED
@@ -1,265 +1,272 @@
1
- import { jsx as i, jsxs as b, Fragment as Be } from "react/jsx-runtime";
2
- import * as k from "react";
3
- import { useRef as rn, useState as Me, useCallback as me, useEffect as ie, useContext as an, createContext as on, cloneElement as sn, Fragment as $e, forwardRef as cn } from "react";
4
- import { Tooltip as ae, Link as Ue, Menu as oe, MenuList as se, CaretUpIcon as ln, UserIcon as De, MenuItem as $, MenuDivider as ze, Tag as un } from "@lokalise/louis";
5
- import { format as We } from "date-fns";
6
- import { toZonedTime as dn } from "date-fns-tz";
1
+ var gn = Object.defineProperty;
2
+ var bn = (e, n, t) => n in e ? gn(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t;
3
+ var ve = (e, n, t) => bn(e, typeof n != "symbol" ? n + "" : n, t);
4
+ import { jsx as i, jsxs as _, Fragment as Je } from "react/jsx-runtime";
5
+ import * as x from "react";
6
+ import { useRef as Ge, useState as Ke, useCallback as Te, useEffect as W, useContext as pn, createContext as _n, cloneElement as vn, Fragment as Ve, forwardRef as Tn } from "react";
7
+ import { Tooltip as le, Link as Ye, Menu as ue, MenuList as de, CaretUpIcon as wn, UserIcon as Qe, MenuItem as F, MenuDivider as Ze, Tag as yn } from "@lokalise/louis";
8
+ import { z as f } from "zod";
9
+ import { sendByPayloadRoute as fe } from "@lokalise/frontend-http-client";
10
+ import { useQuery as In } from "@tanstack/react-query";
11
+ import { buildPayloadRoute as Nn } from "@lokalise/universal-ts-utils/api-contracts/apiContracts";
12
+ import { format as Xe } from "date-fns";
13
+ import { toZonedTime as Sn } from "date-fns-tz";
7
14
  var B = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
8
- function Fe(e) {
15
+ function en(e) {
9
16
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
10
17
  }
11
- var D, ge;
12
- function ce() {
13
- if (ge) return D;
14
- ge = 1;
18
+ var J, we;
19
+ function me() {
20
+ if (we) return J;
21
+ we = 1;
15
22
  function e(n) {
16
23
  var t = typeof n;
17
24
  return n != null && (t == "object" || t == "function");
18
25
  }
19
- return D = e, D;
26
+ return J = e, J;
20
27
  }
21
- var z, he;
22
- function fn() {
23
- if (he) return z;
24
- he = 1;
28
+ var G, ye;
29
+ function kn() {
30
+ if (ye) return G;
31
+ ye = 1;
25
32
  var e = typeof B == "object" && B && B.Object === Object && B;
26
- return z = e, z;
33
+ return G = e, G;
27
34
  }
28
- var W, pe;
29
- function He() {
30
- if (pe) return W;
31
- pe = 1;
32
- var e = fn(), n = typeof self == "object" && self && self.Object === Object && self, t = e || n || Function("return this")();
33
- return W = t, W;
35
+ var K, Ie;
36
+ function nn() {
37
+ if (Ie) return K;
38
+ Ie = 1;
39
+ var e = kn(), n = typeof self == "object" && self && self.Object === Object && self, t = e || n || Function("return this")();
40
+ return K = t, K;
34
41
  }
35
- var F, be;
36
- function mn() {
37
- if (be) return F;
38
- be = 1;
39
- var e = He(), n = function() {
42
+ var V, Ne;
43
+ function Pn() {
44
+ if (Ne) return V;
45
+ Ne = 1;
46
+ var e = nn(), n = function() {
40
47
  return e.Date.now();
41
48
  };
42
- return F = n, F;
49
+ return V = n, V;
43
50
  }
44
- var H, _e;
45
- function gn() {
46
- if (_e) return H;
47
- _e = 1;
51
+ var Y, Se;
52
+ function En() {
53
+ if (Se) return Y;
54
+ Se = 1;
48
55
  var e = /\s/;
49
56
  function n(t) {
50
57
  for (var r = t.length; r-- && e.test(t.charAt(r)); )
51
58
  ;
52
59
  return r;
53
60
  }
54
- return H = n, H;
61
+ return Y = n, Y;
55
62
  }
56
- var G, ve;
57
- function hn() {
58
- if (ve) return G;
59
- ve = 1;
60
- var e = gn(), n = /^\s+/;
63
+ var Q, ke;
64
+ function jn() {
65
+ if (ke) return Q;
66
+ ke = 1;
67
+ var e = En(), n = /^\s+/;
61
68
  function t(r) {
62
69
  return r && r.slice(0, e(r) + 1).replace(n, "");
63
70
  }
64
- return G = t, G;
71
+ return Q = t, Q;
65
72
  }
66
- var V, Te;
67
- function Ge() {
68
- if (Te) return V;
69
- Te = 1;
70
- var e = He(), n = e.Symbol;
71
- return V = n, V;
73
+ var Z, Pe;
74
+ function tn() {
75
+ if (Pe) return Z;
76
+ Pe = 1;
77
+ var e = nn(), n = e.Symbol;
78
+ return Z = n, Z;
72
79
  }
73
- var Y, we;
74
- function pn() {
75
- if (we) return Y;
76
- we = 1;
77
- var e = Ge(), n = Object.prototype, t = n.hasOwnProperty, r = n.toString, a = e ? e.toStringTag : void 0;
78
- function o(c) {
79
- var l = t.call(c, a), u = c[a];
80
+ var X, Ee;
81
+ function Cn() {
82
+ if (Ee) return X;
83
+ Ee = 1;
84
+ var e = tn(), n = Object.prototype, t = n.hasOwnProperty, r = n.toString, a = e ? e.toStringTag : void 0;
85
+ function o(s) {
86
+ var l = t.call(s, a), u = s[a];
80
87
  try {
81
- c[a] = void 0;
82
- var s = !0;
88
+ s[a] = void 0;
89
+ var c = !0;
83
90
  } catch {
84
91
  }
85
- var d = r.call(c);
86
- return s && (l ? c[a] = u : delete c[a]), d;
92
+ var d = r.call(s);
93
+ return c && (l ? s[a] = u : delete s[a]), d;
87
94
  }
88
- return Y = o, Y;
95
+ return X = o, X;
89
96
  }
90
- var Z, Ie;
91
- function bn() {
92
- if (Ie) return Z;
93
- Ie = 1;
97
+ var ee, je;
98
+ function An() {
99
+ if (je) return ee;
100
+ je = 1;
94
101
  var e = Object.prototype, n = e.toString;
95
102
  function t(r) {
96
103
  return n.call(r);
97
104
  }
98
- return Z = t, Z;
105
+ return ee = t, ee;
99
106
  }
100
- var X, ye;
101
- function _n() {
102
- if (ye) return X;
103
- ye = 1;
104
- var e = Ge(), n = pn(), t = bn(), r = "[object Null]", a = "[object Undefined]", o = e ? e.toStringTag : void 0;
105
- function c(l) {
107
+ var ne, Ce;
108
+ function Rn() {
109
+ if (Ce) return ne;
110
+ Ce = 1;
111
+ var e = tn(), n = Cn(), t = An(), r = "[object Null]", a = "[object Undefined]", o = e ? e.toStringTag : void 0;
112
+ function s(l) {
106
113
  return l == null ? l === void 0 ? a : r : o && o in Object(l) ? n(l) : t(l);
107
114
  }
108
- return X = c, X;
115
+ return ne = s, ne;
109
116
  }
110
- var J, Ne;
111
- function vn() {
112
- if (Ne) return J;
113
- Ne = 1;
117
+ var te, Ae;
118
+ function Ln() {
119
+ if (Ae) return te;
120
+ Ae = 1;
114
121
  function e(n) {
115
122
  return n != null && typeof n == "object";
116
123
  }
117
- return J = e, J;
124
+ return te = e, te;
118
125
  }
119
- var K, Se;
120
- function Tn() {
121
- if (Se) return K;
122
- Se = 1;
123
- var e = _n(), n = vn(), t = "[object Symbol]";
126
+ var re, Re;
127
+ function xn() {
128
+ if (Re) return re;
129
+ Re = 1;
130
+ var e = Rn(), n = Ln(), t = "[object Symbol]";
124
131
  function r(a) {
125
132
  return typeof a == "symbol" || n(a) && e(a) == t;
126
133
  }
127
- return K = r, K;
134
+ return re = r, re;
128
135
  }
129
- var Q, Ee;
130
- function wn() {
131
- if (Ee) return Q;
132
- Ee = 1;
133
- var e = hn(), n = ce(), t = Tn(), r = NaN, a = /^[-+]0x[0-9a-f]+$/i, o = /^0b[01]+$/i, c = /^0o[0-7]+$/i, l = parseInt;
134
- function u(s) {
135
- if (typeof s == "number")
136
- return s;
137
- if (t(s))
136
+ var ae, Le;
137
+ function On() {
138
+ if (Le) return ae;
139
+ Le = 1;
140
+ var e = jn(), n = me(), t = xn(), r = NaN, a = /^[-+]0x[0-9a-f]+$/i, o = /^0b[01]+$/i, s = /^0o[0-7]+$/i, l = parseInt;
141
+ function u(c) {
142
+ if (typeof c == "number")
143
+ return c;
144
+ if (t(c))
138
145
  return r;
139
- if (n(s)) {
140
- var d = typeof s.valueOf == "function" ? s.valueOf() : s;
141
- s = n(d) ? d + "" : d;
146
+ if (n(c)) {
147
+ var d = typeof c.valueOf == "function" ? c.valueOf() : c;
148
+ c = n(d) ? d + "" : d;
142
149
  }
143
- if (typeof s != "string")
144
- return s === 0 ? s : +s;
145
- s = e(s);
146
- var h = o.test(s);
147
- return h || c.test(s) ? l(s.slice(2), h ? 2 : 8) : a.test(s) ? r : +s;
150
+ if (typeof c != "string")
151
+ return c === 0 ? c : +c;
152
+ c = e(c);
153
+ var b = o.test(c);
154
+ return b || s.test(c) ? l(c.slice(2), b ? 2 : 8) : a.test(c) ? r : +c;
148
155
  }
149
- return Q = u, Q;
156
+ return ae = u, ae;
150
157
  }
151
- var ee, Pe;
152
- function Ve() {
153
- if (Pe) return ee;
154
- Pe = 1;
155
- var e = ce(), n = mn(), t = wn(), r = "Expected a function", a = Math.max, o = Math.min;
156
- function c(l, u, s) {
157
- var d, h, v, T, g, w, y = 0, S = !1, m = !1, N = !0;
158
+ var ie, xe;
159
+ function rn() {
160
+ if (xe) return ie;
161
+ xe = 1;
162
+ var e = me(), n = Pn(), t = On(), r = "Expected a function", a = Math.max, o = Math.min;
163
+ function s(l, u, c) {
164
+ var d, b, T, w, g, y, N = 0, k = !1, h = !1, S = !0;
158
165
  if (typeof l != "function")
159
166
  throw new TypeError(r);
160
- u = t(u) || 0, e(s) && (S = !!s.leading, m = "maxWait" in s, v = m ? a(t(s.maxWait) || 0, u) : v, N = "trailing" in s ? !!s.trailing : N);
161
- function _(f) {
162
- var E = d, R = h;
163
- return d = h = void 0, y = f, T = l.apply(R, E), T;
167
+ u = t(u) || 0, e(c) && (k = !!c.leading, h = "maxWait" in c, T = h ? a(t(c.maxWait) || 0, u) : T, S = "trailing" in c ? !!c.trailing : S);
168
+ function v(m) {
169
+ var P = d, L = b;
170
+ return d = b = void 0, N = m, w = l.apply(L, P), w;
164
171
  }
165
- function p(f) {
166
- return y = f, g = setTimeout(q, u), S ? _(f) : T;
172
+ function p(m) {
173
+ return N = m, g = setTimeout(M, u), k ? v(m) : w;
167
174
  }
168
- function A(f) {
169
- var E = f - w, R = f - y, fe = u - E;
170
- return m ? o(fe, v - R) : fe;
175
+ function q(m) {
176
+ var P = m - y, L = m - N, _e = u - P;
177
+ return h ? o(_e, T - L) : _e;
171
178
  }
172
- function ue(f) {
173
- var E = f - w, R = f - y;
174
- return w === void 0 || E >= u || E < 0 || m && R >= v;
179
+ function be(m) {
180
+ var P = m - y, L = m - N;
181
+ return y === void 0 || P >= u || P < 0 || h && L >= T;
175
182
  }
176
- function q() {
177
- var f = n();
178
- if (ue(f))
179
- return de(f);
180
- g = setTimeout(q, A(f));
183
+ function M() {
184
+ var m = n();
185
+ if (be(m))
186
+ return pe(m);
187
+ g = setTimeout(M, q(m));
181
188
  }
182
- function de(f) {
183
- return g = void 0, N && d ? _(f) : (d = h = void 0, T);
189
+ function pe(m) {
190
+ return g = void 0, S && d ? v(m) : (d = b = void 0, w);
184
191
  }
185
- function nn() {
186
- g !== void 0 && clearTimeout(g), y = 0, d = w = h = g = void 0;
192
+ function mn() {
193
+ g !== void 0 && clearTimeout(g), N = 0, d = y = b = g = void 0;
187
194
  }
188
- function tn() {
189
- return g === void 0 ? T : de(n());
195
+ function hn() {
196
+ return g === void 0 ? w : pe(n());
190
197
  }
191
- function U() {
192
- var f = n(), E = ue(f);
193
- if (d = arguments, h = this, w = f, E) {
198
+ function H() {
199
+ var m = n(), P = be(m);
200
+ if (d = arguments, b = this, y = m, P) {
194
201
  if (g === void 0)
195
- return p(w);
196
- if (m)
197
- return clearTimeout(g), g = setTimeout(q, u), _(w);
202
+ return p(y);
203
+ if (h)
204
+ return clearTimeout(g), g = setTimeout(M, u), v(y);
198
205
  }
199
- return g === void 0 && (g = setTimeout(q, u)), T;
206
+ return g === void 0 && (g = setTimeout(M, u)), w;
200
207
  }
201
- return U.cancel = nn, U.flush = tn, U;
208
+ return H.cancel = mn, H.flush = hn, H;
202
209
  }
203
- return ee = c, ee;
210
+ return ie = s, ie;
204
211
  }
205
- var In = Ve();
206
- const yn = /* @__PURE__ */ Fe(In);
207
- var ne, je;
208
- function Nn() {
209
- if (je) return ne;
210
- je = 1;
211
- var e = Ve(), n = ce(), t = "Expected a function";
212
- function r(a, o, c) {
212
+ var qn = rn();
213
+ const Mn = /* @__PURE__ */ en(qn);
214
+ var oe, Oe;
215
+ function Bn() {
216
+ if (Oe) return oe;
217
+ Oe = 1;
218
+ var e = rn(), n = me(), t = "Expected a function";
219
+ function r(a, o, s) {
213
220
  var l = !0, u = !0;
214
221
  if (typeof a != "function")
215
222
  throw new TypeError(t);
216
- return n(c) && (l = "leading" in c ? !!c.leading : l, u = "trailing" in c ? !!c.trailing : u), e(a, o, {
223
+ return n(s) && (l = "leading" in s ? !!s.leading : l, u = "trailing" in s ? !!s.trailing : u), e(a, o, {
217
224
  leading: l,
218
225
  maxWait: o,
219
226
  trailing: u
220
227
  });
221
228
  }
222
- return ne = r, ne;
229
+ return oe = r, oe;
223
230
  }
224
- var Sn = Nn();
225
- const En = /* @__PURE__ */ Fe(Sn), Pn = (e, n, t, r) => {
231
+ var $n = Bn();
232
+ const Un = /* @__PURE__ */ en($n), zn = (e, n, t, r) => {
226
233
  switch (n) {
227
234
  case "debounce":
228
- return yn(e, t, r);
235
+ return Mn(e, t, r);
229
236
  case "throttle":
230
- return En(e, t, r);
237
+ return Un(e, t, r);
231
238
  default:
232
239
  return e;
233
240
  }
234
- }, jn = (
241
+ }, Dn = (
235
242
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
236
243
  (e) => {
237
- const n = k.useRef(e);
238
- return k.useEffect(() => {
244
+ const n = x.useRef(e);
245
+ return x.useEffect(() => {
239
246
  n.current = e;
240
- }), k.useMemo(() => (...t) => {
247
+ }), x.useMemo(() => (...t) => {
241
248
  var r;
242
249
  return (r = n.current) === null || r === void 0 ? void 0 : r.call(n, ...t);
243
250
  }, []);
244
251
  }
245
- ), Ln = (
252
+ ), Wn = (
246
253
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
247
254
  (e) => {
248
- const [n, t] = k.useState((e == null ? void 0 : e.current) || null);
255
+ const [n, t] = x.useState((e == null ? void 0 : e.current) || null);
249
256
  return e && setTimeout(() => {
250
257
  e.current !== n && t(e.current);
251
- }, 0), { refProxy: k.useMemo(() => new Proxy((a) => {
258
+ }, 0), { refProxy: x.useMemo(() => new Proxy((a) => {
252
259
  a !== n && t(a);
253
260
  }, {
254
261
  get(a, o) {
255
262
  return o === "current" ? n : a[o];
256
263
  },
257
- set(a, o, c) {
258
- return o === "current" ? t(c) : a[o] = c, !0;
264
+ set(a, o, s) {
265
+ return o === "current" ? t(s) : a[o] = s, !0;
259
266
  }
260
267
  }), [n]), refElement: n, setRefElement: t };
261
268
  }
262
- ), xn = (e, n) => n === "border-box" ? {
269
+ ), Fn = (e, n) => n === "border-box" ? {
263
270
  width: e.borderBoxSize[0].inlineSize,
264
271
  height: e.borderBoxSize[0].blockSize
265
272
  } : n === "content-box" ? {
@@ -269,198 +276,198 @@ const En = /* @__PURE__ */ Fe(Sn), Pn = (e, n, t, r) => {
269
276
  width: e.contentRect.width,
270
277
  height: e.contentRect.height
271
278
  };
272
- function Cn({ skipOnMount: e = !1, refreshMode: n, refreshRate: t = 1e3, refreshOptions: r, handleWidth: a = !0, handleHeight: o = !0, targetRef: c, observerOptions: l, onResize: u } = {}) {
273
- const s = rn(e), d = jn(u), [h, v] = Me({
279
+ function Hn({ skipOnMount: e = !1, refreshMode: n, refreshRate: t = 1e3, refreshOptions: r, handleWidth: a = !0, handleHeight: o = !0, targetRef: s, observerOptions: l, onResize: u } = {}) {
280
+ const c = Ge(e), d = Dn(u), [b, T] = Ke({
274
281
  width: void 0,
275
282
  height: void 0
276
- }), { refProxy: T, refElement: g } = Ln(c), { box: w } = l || {}, y = me((m) => {
283
+ }), { refProxy: w, refElement: g } = Wn(s), { box: y } = l || {}, N = Te((h) => {
277
284
  if (!a && !o)
278
285
  return;
279
- if (s.current) {
280
- s.current = !1;
286
+ if (c.current) {
287
+ c.current = !1;
281
288
  return;
282
289
  }
283
- const N = (_, p) => a && _.width !== p.width || o && _.height !== p.height;
284
- m.forEach((_) => {
285
- const p = xn(_, w);
286
- v((A) => N(A, p) ? (d == null || d({
290
+ const S = (v, p) => a && v.width !== p.width || o && v.height !== p.height;
291
+ h.forEach((v) => {
292
+ const p = Fn(v, y);
293
+ T((q) => S(q, p) ? (d == null || d({
287
294
  width: p.width,
288
295
  height: p.height,
289
- entry: _
290
- }), p) : A);
296
+ entry: v
297
+ }), p) : q);
291
298
  });
292
- }, [a, o, s, w]), S = me(Pn(y, n, t, r), [
293
- y,
299
+ }, [a, o, c, y]), k = Te(zn(N, n, t, r), [
300
+ N,
294
301
  n,
295
302
  t,
296
303
  r
297
304
  ]);
298
- return ie(() => {
299
- let m;
300
- return g ? (m = new window.ResizeObserver(S), m.observe(g, l)) : (h.width || h.height) && (d == null || d({
305
+ return W(() => {
306
+ let h;
307
+ return g ? (h = new window.ResizeObserver(k), h.observe(g, l)) : (b.width || b.height) && (d == null || d({
301
308
  width: null,
302
309
  height: null,
303
310
  entry: null
304
- }), v({ width: void 0, height: void 0 })), () => {
305
- var N, _, p;
306
- (N = m == null ? void 0 : m.disconnect) === null || N === void 0 || N.call(m), (p = (_ = S).cancel) === null || p === void 0 || p.call(_);
311
+ }), T({ width: void 0, height: void 0 })), () => {
312
+ var S, v, p;
313
+ (S = h == null ? void 0 : h.disconnect) === null || S === void 0 || S.call(h), (p = (v = k).cancel) === null || p === void 0 || p.call(v);
307
314
  };
308
- }, [S, g]), Object.assign({ ref: T }, h);
315
+ }, [k, g]), Object.assign({ ref: w }, b);
309
316
  }
310
- function Ye(e) {
317
+ function an(e) {
311
318
  var n, t, r = "";
312
319
  if (typeof e == "string" || typeof e == "number") r += e;
313
320
  else if (typeof e == "object") if (Array.isArray(e)) {
314
321
  var a = e.length;
315
- for (n = 0; n < a; n++) e[n] && (t = Ye(e[n])) && (r && (r += " "), r += t);
322
+ for (n = 0; n < a; n++) e[n] && (t = an(e[n])) && (r && (r += " "), r += t);
316
323
  } else for (t in e) e[t] && (r && (r += " "), r += t);
317
324
  return r;
318
325
  }
319
- function L() {
320
- for (var e, n, t = 0, r = "", a = arguments.length; t < a; t++) (e = arguments[t]) && (n = Ye(e)) && (r && (r += " "), r += n);
326
+ function C() {
327
+ for (var e, n, t = 0, r = "", a = arguments.length; t < a; t++) (e = arguments[t]) && (n = an(e)) && (r && (r += " "), r += n);
321
328
  return r;
322
329
  }
323
- const Rn = "_headerContainer_1cubo_1", kn = "_navigationTabList_1cubo_8", On = "_navigationTab_1cubo_8", An = "_headerContent_1cubo_34", qn = "_staticEnabled_1cubo_50", C = {
324
- headerContainer: Rn,
325
- navigationTabList: kn,
326
- navigationTab: On,
327
- headerContent: An,
328
- staticEnabled: qn
329
- }, Bn = 77, M = ({ sticky: e, children: n }) => {
330
- const { ref: t, height: r } = Cn({
330
+ const Jn = "_headerContainer_1cubo_1", Gn = "_navigationTabList_1cubo_8", Kn = "_navigationTab_1cubo_8", Vn = "_headerContent_1cubo_34", Yn = "_staticEnabled_1cubo_50", R = {
331
+ headerContainer: Jn,
332
+ navigationTabList: Gn,
333
+ navigationTab: Kn,
334
+ headerContent: Vn,
335
+ staticEnabled: Yn
336
+ }, Qn = 77, U = ({ sticky: e, children: n }) => {
337
+ const { ref: t, height: r } = Hn({
331
338
  refreshMode: "debounce",
332
339
  refreshRate: 0
333
- }), [a, o] = Me(!1), c = () => a ? !e : !0;
334
- ie(() => {
340
+ }), [a, o] = Ke(!1), s = () => a ? !e : !0;
341
+ W(() => {
335
342
  const u = () => {
336
343
  o(window.scrollY > 0);
337
344
  };
338
345
  return window.addEventListener("scroll", u), () => window.removeEventListener("scroll", u);
339
346
  }, []);
340
- const l = `${r || Bn}px`;
341
- return /* @__PURE__ */ i("div", { style: { minHeight: l }, children: /* @__PURE__ */ i("div", { children: /* @__PURE__ */ b(
347
+ const l = `${r || Qn}px`;
348
+ return /* @__PURE__ */ i("div", { style: { minHeight: l }, children: /* @__PURE__ */ i("div", { children: /* @__PURE__ */ _(
342
349
  "div",
343
350
  {
344
351
  ref: t,
345
- className: L(C.headerContent, {
346
- [C.staticEnabled]: c()
352
+ className: C(R.headerContent, {
353
+ [R.staticEnabled]: s()
347
354
  }),
348
355
  children: [
349
- /* @__PURE__ */ i(M.Header, {}),
350
- /* @__PURE__ */ i(M.Tabs, {}),
356
+ /* @__PURE__ */ i(U.Header, {}),
357
+ /* @__PURE__ */ i(U.Tabs, {}),
351
358
  n
352
359
  ]
353
360
  }
354
361
  ) }) });
355
362
  };
356
- M.Header = ({ children: e }) => /* @__PURE__ */ i("div", { className: C.headerContainer, children: e });
357
- M.Tabs = ({ children: e }) => /* @__PURE__ */ i("div", { className: "flex justify-between gap-2 nowrap", children: e });
358
- const Mn = "_sidebarContainer_bmdti_1", $n = {
359
- sidebarContainer: Mn
360
- }, Un = "_logoLink_1baxb_1", Dn = {
361
- logoLink: Un
362
- }, zn = ({ src: e, href: n = "/", ariaLabel: t = "Home", alt: r = "Lokalise" }) => /* @__PURE__ */ i("a", { className: Dn.logoLink, href: n, "aria-label": t, children: /* @__PURE__ */ i("img", { src: e, alt: r }) }), Wn = "_link_1weq1_1", Fn = "_active_1weq1_18", Le = {
363
- link: Wn,
364
- active: Fn
365
- }, Hn = ({ label: e, to: n, icon: t }) => /* @__PURE__ */ i(ae, { placement: "right", tooltip: e, children: /* @__PURE__ */ i(
366
- Ue,
363
+ U.Header = ({ children: e }) => /* @__PURE__ */ i("div", { className: R.headerContainer, children: e });
364
+ U.Tabs = ({ children: e }) => /* @__PURE__ */ i("div", { className: "flex justify-between gap-2 nowrap", children: e });
365
+ const Zn = "_sidebarContainer_bmdti_1", Xn = {
366
+ sidebarContainer: Zn
367
+ }, et = "_logoLink_1baxb_1", nt = {
368
+ logoLink: et
369
+ }, tt = ({ src: e, href: n = "/", ariaLabel: t = "Home", alt: r = "Lokalise" }) => /* @__PURE__ */ i("a", { className: nt.logoLink, href: n, "aria-label": t, children: /* @__PURE__ */ i("img", { src: e, alt: r }) }), rt = "_link_1weq1_1", at = "_active_1weq1_18", qe = {
370
+ link: rt,
371
+ active: at
372
+ }, it = ({ label: e, to: n, icon: t }) => /* @__PURE__ */ i(le, { placement: "right", tooltip: e, children: /* @__PURE__ */ i(
373
+ Ye,
367
374
  {
368
- className: L(Le.link, {
369
- [Le.active]: window.location.pathname.startsWith(n)
375
+ className: C(qe.link, {
376
+ [qe.active]: window.location.pathname.startsWith(n)
370
377
  }),
371
378
  href: n,
372
379
  children: /* @__PURE__ */ i(t, { size: "25px" })
373
380
  }
374
- ) }), Gn = "_dropdownButton_hwh0c_1", Vn = "_dropdownButtonActive_hwh0c_18", xe = {
375
- dropdownButton: Gn,
376
- dropdownButtonActive: Vn
377
- }, Yn = ({ children: e, icon: n }) => /* @__PURE__ */ i(
378
- oe,
381
+ ) }), ot = "_dropdownButton_hwh0c_1", st = "_dropdownButtonActive_hwh0c_18", Me = {
382
+ dropdownButton: ot,
383
+ dropdownButtonActive: st
384
+ }, ct = ({ children: e, icon: n }) => /* @__PURE__ */ i(
385
+ ue,
379
386
  {
380
- menuButton: ({ opened: t }) => /* @__PURE__ */ i(ae, { placement: "right", tooltip: "Help", children: /* @__PURE__ */ i(
387
+ menuButton: ({ opened: t }) => /* @__PURE__ */ i(le, { placement: "right", tooltip: "Help", children: /* @__PURE__ */ i(
381
388
  "button",
382
389
  {
383
390
  type: "button",
384
- className: L(xe.dropdownButton, {
385
- [xe.dropdownButtonActive]: t
391
+ className: C(Me.dropdownButton, {
392
+ [Me.dropdownButtonActive]: t
386
393
  }),
387
394
  children: /* @__PURE__ */ i(n, { size: "25px" })
388
395
  }
389
396
  ) }),
390
- children: /* @__PURE__ */ i(se, { placement: "right-start", children: e })
397
+ children: /* @__PURE__ */ i(de, { placement: "right-start", children: e })
391
398
  }
392
- ), Zn = "_iconContainer_nz34m_1", Xn = {
393
- iconContainer: Zn
394
- }, Ze = ({ className: e = "" }) => /* @__PURE__ */ i(
399
+ ), lt = "_iconContainer_nz34m_1", ut = {
400
+ iconContainer: lt
401
+ }, on = ({ className: e = "" }) => /* @__PURE__ */ i(
395
402
  "div",
396
403
  {
397
404
  "aria-label": "Upgrade Icon",
398
- className: L(
399
- Xn.iconContainer,
405
+ className: C(
406
+ ut.iconContainer,
400
407
  "flex-row",
401
408
  "items-center",
402
409
  "justify-center",
403
410
  e
404
411
  ),
405
- children: /* @__PURE__ */ i(ln, {})
412
+ children: /* @__PURE__ */ i(wn, {})
406
413
  }
407
- ), Jn = "_menuContainer_wbu3u_5", Kn = "_profileButton_wbu3u_16", Qn = "_profileImage_wbu3u_29", et = "_profileImageHighlight_wbu3u_37", nt = "_profileImageUpgradeIcon_wbu3u_41", tt = "_userIconWrapper_wbu3u_47", P = {
408
- menuContainer: Jn,
409
- profileButton: Kn,
410
- profileImage: Qn,
411
- profileImageHighlight: et,
412
- profileImageUpgradeIcon: nt,
413
- userIconWrapper: tt
414
- }, Xe = on({}), O = () => an(Xe), rt = ({ children: e }) => {
414
+ ), dt = "_menuContainer_wbu3u_5", ft = "_profileButton_wbu3u_16", mt = "_profileImage_wbu3u_29", ht = "_profileImageHighlight_wbu3u_37", gt = "_profileImageUpgradeIcon_wbu3u_41", bt = "_userIconWrapper_wbu3u_47", E = {
415
+ menuContainer: dt,
416
+ profileButton: ft,
417
+ profileImage: mt,
418
+ profileImageHighlight: ht,
419
+ profileImageUpgradeIcon: gt,
420
+ userIconWrapper: bt
421
+ }, sn = _n({}), O = () => pn(sn), pt = ({ children: e }) => {
415
422
  const {
416
423
  currentTeam: n,
417
424
  otherTeams: t,
418
425
  showUpgradeCta: r,
419
426
  showBillingButton: a,
420
427
  allowTeamCreation: o,
421
- isLimitedView: c,
428
+ isLimitedView: s,
422
429
  isProviderAlpha: l,
423
430
  canAccessTeamSettings: u,
424
- isEndOfTrialActive: s,
431
+ isEndOfTrialActive: c,
425
432
  isTeamSuspended: d
426
433
  } = O();
427
434
  return /* @__PURE__ */ i(
428
- oe,
435
+ ue,
429
436
  {
430
- menuButton: () => /* @__PURE__ */ b("button", { className: P.profileButton, "aria-label": "Profile menu", type: "button", children: [
437
+ menuButton: () => /* @__PURE__ */ _("button", { className: E.profileButton, "aria-label": "Profile menu", type: "button", children: [
431
438
  n != null && n.logoUrl ? /* @__PURE__ */ i(
432
439
  "img",
433
440
  {
434
441
  src: n.logoUrl,
435
- className: L(P.profileImage, {
436
- [P.profileImageHighlight]: r
442
+ className: C(E.profileImage, {
443
+ [E.profileImageHighlight]: r
437
444
  }),
438
445
  alt: "Team Logo"
439
446
  }
440
447
  ) : /* @__PURE__ */ i(
441
448
  "div",
442
449
  {
443
- className: L(P.userIconWrapper, "flex-row", "align-center", "items-center", {
444
- [P.profileImageHighlight]: r
450
+ className: C(E.userIconWrapper, "flex-row", "align-center", "items-center", {
451
+ [E.profileImageHighlight]: r
445
452
  }),
446
- children: /* @__PURE__ */ i(De, { size: "25px" })
453
+ children: /* @__PURE__ */ i(Qe, { size: "25px" })
447
454
  }
448
455
  ),
449
- r && /* @__PURE__ */ i(Ze, { className: P.profileImageUpgradeIcon })
456
+ r && /* @__PURE__ */ i(on, { className: E.profileImageUpgradeIcon })
450
457
  ] }),
451
- children: /* @__PURE__ */ i(se, { placement: "right-end", className: P.menuContainer, children: e({
458
+ children: /* @__PURE__ */ i(de, { placement: "right-end", className: E.menuContainer, children: e({
452
459
  allowTeamCreation: o,
453
460
  otherTeams: t,
454
- isLimitedView: c,
461
+ isLimitedView: s,
455
462
  canAccessTeamSettings: u,
456
- isEndOfTrialActive: s,
463
+ isEndOfTrialActive: c,
457
464
  isTeamSuspended: d,
458
465
  showBillingButton: a,
459
466
  isProviderAlpha: l
460
467
  }) })
461
468
  }
462
469
  );
463
- }, Je = 0, it = 9999, at = [150, 151, 250, 251], ot = [152, 153, 252, 253], st = [154, 155, 157, 158, 254, 255, 258, 354, 355, 358], ct = [156, 159, 160, 256, 259, 260], Ke = 9998, le = (e) => e === Je, Qe = (e) => e === it, Vt = (e) => at.includes(e), Yt = (e) => ot.includes(e), Zt = (e) => st.includes(e), Xt = (e) => ct.includes(e), Jt = (e) => e > Je && e < Ke, Kt = (e) => e === Ke, lt = /\n/, Ce = (e, n, t) => e.split(n).flatMap((r, a) => a !== 0 ? [sn(t, { key: Math.random().toString(32).slice(0, 10) }), r] : r), ut = (e, n, t) => typeof e == "string" ? Ce(e, n, t) : e.flatMap((r) => typeof r == "string" ? Ce(r, n, t) : r), Qt = (e) => ut(e, lt, /* @__PURE__ */ i("br", {})), dt = /(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi, ft = (e) => e.match(dt) ?? [], Re = (e, n, t) => {
470
+ }, cn = 0, _t = 9999, vt = [150, 151, 250, 251], Tt = [152, 153, 252, 253], wt = [154, 155, 157, 158, 254, 255, 258, 354, 355, 358], yt = [156, 159, 160, 256, 259, 260], ln = 9998, he = (e) => e === cn, un = (e) => e === _t, Tr = (e) => vt.includes(e), wr = (e) => Tt.includes(e), yr = (e) => wt.includes(e), Ir = (e) => yt.includes(e), Nr = (e) => e > cn && e < ln, Sr = (e) => e === ln, It = /\n/, Be = (e, n, t) => e.split(n).flatMap((r, a) => a !== 0 ? [vn(t, { key: Math.random().toString(32).slice(0, 10) }), r] : r), Nt = (e, n, t) => typeof e == "string" ? Be(e, n, t) : e.flatMap((r) => typeof r == "string" ? Be(r, n, t) : r), kr = (e) => Nt(e, It, /* @__PURE__ */ i("br", {})), St = /(\b(https?|):\/\/[-a-zA-Zа-яА-Я0-9+&@#/%?=~_|!:,.;]*[-a-zA-Zа-яА-Я0-9+&@#/%=~_|])/gi, kt = (e) => e.match(St) ?? [], $e = (e, n, t) => {
464
471
  const r = e.split(n);
465
472
  if (r.length === 1)
466
473
  return e;
@@ -468,142 +475,142 @@ const Mn = "_sidebarContainer_bmdti_1", $n = {
468
475
  return r[0] !== "" && a.push(r[0]), r.shift(), r[r.length - 1] === "" && r.pop(), a.push(
469
476
  /* @__PURE__ */ i("a", { href: n, target: "_blank", rel: "noreferrer noopener", children: n }, n + t)
470
477
  ), a.push(r.join(n)), a.filter((o) => o !== "");
471
- }, ke = (e) => {
472
- const n = ft(e);
473
- return n != null && n.length ? n.reduce((t, r, a) => typeof t == "string" ? Re(t, r, a) : t.flatMap((o) => typeof o == "string" ? Re(o, r, a) : o), e) : e;
474
- }, er = (e) => typeof e == "string" ? ke(e) : e.flatMap((n) => typeof n == "string" ? ke(n) : n, e), nr = (e, n = "PP") => We(e, n), tr = (e, n, t = "PP") => We(dn(e, n), t), rr = (e) => {
475
- ie(e, []);
476
- }, mt = ({ children: e, config: n }) => {
478
+ }, Ue = (e) => {
479
+ const n = kt(e);
480
+ return n != null && n.length ? n.reduce((t, r, a) => typeof t == "string" ? $e(t, r, a) : t.flatMap((o) => typeof o == "string" ? $e(o, r, a) : o), e) : e;
481
+ }, Pr = (e) => typeof e == "string" ? Ue(e) : e.flatMap((n) => typeof n == "string" ? Ue(n) : n, e), Er = (e, n = "PP") => Xe(e, n), jr = (e, n, t = "PP") => Xe(Sn(e, n), t), Cr = (e) => {
482
+ W(e, []);
483
+ }, Pt = ({ children: e, config: n }) => {
477
484
  const {
478
485
  teams: t,
479
486
  currentTeamId: r,
480
487
  planId: a,
481
488
  isLimitedView: o,
482
- isTeamSuspended: c,
489
+ isTeamSuspended: s,
483
490
  canAccessTeamSettings: l,
484
491
  isEndOfTrialActive: u
485
- } = n, s = t.find((m) => m.id === r), d = t.filter((m) => m.id !== r), h = (s == null ? void 0 : s.role) ?? "", v = ["biller", "owner"].includes(h), T = le(a) || Qe(a), S = {
492
+ } = n, c = t.find((h) => h.id === r), d = t.filter((h) => h.id !== r), b = (c == null ? void 0 : c.role) ?? "", T = ["biller", "owner"].includes(b), w = he(a) || un(a), k = {
486
493
  ...n,
487
- currentTeam: s,
494
+ currentTeam: c,
488
495
  otherTeams: d,
489
- canChangeBilling: v,
490
- isOnFreeOrTrialPlan: T,
491
- showUpgradeCta: !o && T && v && !c,
492
- showBillingButton: !o && l && v,
496
+ canChangeBilling: T,
497
+ isOnFreeOrTrialPlan: w,
498
+ showUpgradeCta: !o && w && T && !s,
499
+ showBillingButton: !o && l && T,
493
500
  allowTeamCreation: !o && !u
494
501
  };
495
- return /* @__PURE__ */ i(Xe.Provider, { value: S, children: e });
496
- }, gt = ({ config: e, children: n }) => /* @__PURE__ */ i(mt, { config: e, children: /* @__PURE__ */ i(rt, { children: n }) }), ht = "_container_q5pot_1", pt = "_profileEmail_q5pot_5", Oe = {
497
- container: ht,
498
- profileEmail: pt
499
- }, bt = ({
502
+ return /* @__PURE__ */ i(sn.Provider, { value: k, children: e });
503
+ }, Et = ({ config: e, children: n }) => /* @__PURE__ */ i(Pt, { config: e, children: /* @__PURE__ */ i(pt, { children: n }) }), jt = "_container_q5pot_1", Ct = "_profileEmail_q5pot_5", ze = {
504
+ container: jt,
505
+ profileEmail: Ct
506
+ }, At = ({
500
507
  href: e,
501
508
  onClick: n,
502
509
  userEmail: t,
503
510
  hideBottomDivider: r
504
511
  }) => {
505
512
  const { isEndOfTrialActive: a, isTeamSuspended: o } = O();
506
- return a || o ? null : /* @__PURE__ */ b(Be, { children: [
513
+ return a || o ? null : /* @__PURE__ */ _(Je, { children: [
507
514
  /* @__PURE__ */ i(
508
- $,
515
+ F,
509
516
  {
510
517
  href: e,
511
518
  onClick: () => {
512
519
  n == null || n();
513
520
  },
514
- children: /* @__PURE__ */ b("div", { className: `flex-col ${Oe.container}`, children: [
521
+ children: /* @__PURE__ */ _("div", { className: `flex-col ${ze.container}`, children: [
515
522
  /* @__PURE__ */ i("span", { children: "Profile Settings" }),
516
- /* @__PURE__ */ i("span", { className: Oe.profileEmail, children: t })
523
+ /* @__PURE__ */ i("span", { className: ze.profileEmail, children: t })
517
524
  ] })
518
525
  }
519
526
  ),
520
- !r && /* @__PURE__ */ i(ze, {})
527
+ !r && /* @__PURE__ */ i(Ze, {})
521
528
  ] });
522
- }, _t = "_wrapper_15d85_1", vt = "_profileImage_15d85_14", Tt = "_teamName_15d85_22", wt = "_planLabel_15d85_29", It = "_membership_15d85_38", yt = "_defaultProfileImage_15d85_44", x = {
523
- wrapper: _t,
524
- profileImage: vt,
525
- teamName: Tt,
526
- planLabel: wt,
527
- membership: It,
528
- defaultProfileImage: yt
529
- }, en = ({ team: e, onClick: n, hidePlanLabel: t }) => {
529
+ }, Rt = "_wrapper_15d85_1", Lt = "_profileImage_15d85_14", xt = "_teamName_15d85_22", Ot = "_planLabel_15d85_29", qt = "_membership_15d85_38", Mt = "_defaultProfileImage_15d85_44", A = {
530
+ wrapper: Rt,
531
+ profileImage: Lt,
532
+ teamName: xt,
533
+ planLabel: Ot,
534
+ membership: qt,
535
+ defaultProfileImage: Mt
536
+ }, dn = ({ team: e, onClick: n, hidePlanLabel: t }) => {
530
537
  const { currentTeam: r, planId: a } = O(), o = e || r;
531
538
  if (!o)
532
539
  return null;
533
- const c = le(a) ? "Free" : Qe(a) ? "Trial" : void 0;
534
- return /* @__PURE__ */ b(
535
- n ? $ : "div",
540
+ const s = he(a) ? "Free" : un(a) ? "Trial" : void 0;
541
+ return /* @__PURE__ */ _(
542
+ n ? F : "div",
536
543
  {
537
- className: `flex-row gap-2 flex-nowrap items-center ${x.wrapper}`,
544
+ className: `flex-row gap-2 flex-nowrap items-center ${A.wrapper}`,
538
545
  ...n && { onClick: () => n(o) },
539
546
  children: [
540
- o.logoUrl ? /* @__PURE__ */ i("img", { className: x.profileImage, src: o.logoUrl, alt: "Team Logo" }) : /* @__PURE__ */ i("span", { className: `flex-row justify-center items-center ${x.defaultProfileImage}`, children: /* @__PURE__ */ i(De, { size: "25px" }) }),
541
- /* @__PURE__ */ b("div", { className: "flex-col items-start", children: [
542
- /* @__PURE__ */ b("div", { className: "flex-row items-center flex-nowrap gap-2", children: [
543
- /* @__PURE__ */ i("span", { title: o.name, className: x.teamName, children: o.name }),
544
- c && !t && /* @__PURE__ */ i("span", { className: `flex-row justify-center items-center ${x.planLabel}`, children: c })
547
+ o.logoUrl ? /* @__PURE__ */ i("img", { className: A.profileImage, src: o.logoUrl, alt: "Team Logo" }) : /* @__PURE__ */ i("span", { className: `flex-row justify-center items-center ${A.defaultProfileImage}`, children: /* @__PURE__ */ i(Qe, { size: "25px" }) }),
548
+ /* @__PURE__ */ _("div", { className: "flex-col items-start", children: [
549
+ /* @__PURE__ */ _("div", { className: "flex-row items-center flex-nowrap gap-2", children: [
550
+ /* @__PURE__ */ i("span", { title: o.name, className: A.teamName, children: o.name }),
551
+ s && !t && /* @__PURE__ */ i("span", { className: `flex-row justify-center items-center ${A.planLabel}`, children: s })
545
552
  ] }),
546
- /* @__PURE__ */ i("span", { className: x.membership, children: o.role })
553
+ /* @__PURE__ */ i("span", { className: A.membership, children: o.role })
547
554
  ] })
548
555
  ]
549
556
  }
550
557
  );
551
- }, Nt = "_teamsContainer_1t68g_1", St = {
552
- teamsContainer: Nt
553
- }, Et = ({ onSwitchTeam: e }) => {
558
+ }, Bt = "_teamsContainer_1t68g_1", $t = {
559
+ teamsContainer: Bt
560
+ }, Ut = ({ onSwitchTeam: e }) => {
554
561
  const { otherTeams: n } = O();
555
- return n.length === 0 ? null : /* @__PURE__ */ i("div", { className: `flex-col items-stretch ${St.teamsContainer}`, children: n.map((t) => /* @__PURE__ */ i(en, { team: t, onClick: e, hidePlanLabel: !0 }, t.id)) });
556
- }, Pt = "_container_1u995_1", jt = "_planCta_1u995_15", Lt = "_upgradeIconWrapper_1u995_19", te = {
557
- container: Pt,
558
- planCta: jt,
559
- upgradeIconWrapper: Lt
560
- }, xt = ({ upgradeOptionHref: e }) => {
562
+ return n.length === 0 ? null : /* @__PURE__ */ i("div", { className: `flex-col items-stretch ${$t.teamsContainer}`, children: n.map((t) => /* @__PURE__ */ i(dn, { team: t, onClick: e, hidePlanLabel: !0 }, t.id)) });
563
+ }, zt = "_container_1u995_1", Dt = "_planCta_1u995_15", Wt = "_upgradeIconWrapper_1u995_19", se = {
564
+ container: zt,
565
+ planCta: Dt,
566
+ upgradeIconWrapper: Wt
567
+ }, Ft = ({ upgradeOptionHref: e }) => {
561
568
  const { planId: n, trialDaysLeft: t, showUpgradeCta: r } = O();
562
569
  if (!r)
563
570
  return null;
564
- const c = le(n) ? "Your team is currently on the Free plan" : `Free trial ends in ${t} ${t === 1 ? "day" : "days"}`;
565
- return /* @__PURE__ */ b($, { href: e, className: `flex-col gap-1 items-start ${te.container}`, children: [
566
- /* @__PURE__ */ i("span", { className: te.planCta, children: c }),
567
- /* @__PURE__ */ b("div", { className: `flex-row items-center gap-1 ${te.upgradeIconWrapper}`, children: [
568
- /* @__PURE__ */ i(Ze, {}),
571
+ const s = he(n) ? "Your team is currently on the Free plan" : `Free trial ends in ${t} ${t === 1 ? "day" : "days"}`;
572
+ return /* @__PURE__ */ _(F, { href: e, className: `flex-col gap-1 items-start ${se.container}`, children: [
573
+ /* @__PURE__ */ i("span", { className: se.planCta, children: s }),
574
+ /* @__PURE__ */ _("div", { className: `flex-row items-center gap-1 ${se.upgradeIconWrapper}`, children: [
575
+ /* @__PURE__ */ i(on, {}),
569
576
  /* @__PURE__ */ i("span", { children: "See upgrade options" })
570
577
  ] })
571
578
  ] });
572
- }, I = ({ children: e, ...n }) => /* @__PURE__ */ i("nav", { ...n, className: $n.sidebarContainer, children: e });
579
+ }, I = ({ children: e, ...n }) => /* @__PURE__ */ i("nav", { ...n, className: Xn.sidebarContainer, children: e });
573
580
  I.Top = ({ children: e }) => /* @__PURE__ */ i("div", { children: e });
574
581
  I.Bottom = ({ children: e }) => /* @__PURE__ */ i("div", { children: e });
575
- I.Avatar = zn;
576
- I.IconLink = Hn;
577
- I.Menu = Yn;
578
- I.ProfileMenu = gt;
579
- I.TeamSwitch = Et;
580
- I.TeamMenuItem = en;
581
- I.UpgradeMenuItem = xt;
582
- I.ProfileSettingsMenuItem = bt;
583
- const Ct = "_breadcrumbsItem_1hm6a_1", Rt = "_breadcrumbs_1hm6a_1", Ae = {
584
- breadcrumbsItem: Ct,
585
- breadcrumbs: Rt
586
- }, ir = ({ items: e }) => /* @__PURE__ */ i("nav", { "aria-label": "breadcrumb", className: Ae.breadcrumbs, children: e.map((n, t) => /* @__PURE__ */ b($e, { children: [
587
- /* @__PURE__ */ i(Ue, { className: Ae.breadcrumbsItem, href: n.link, rel: "noreferrer", children: n.name }),
582
+ I.Avatar = tt;
583
+ I.IconLink = it;
584
+ I.Menu = ct;
585
+ I.ProfileMenu = Et;
586
+ I.TeamSwitch = Ut;
587
+ I.TeamMenuItem = dn;
588
+ I.UpgradeMenuItem = Ft;
589
+ I.ProfileSettingsMenuItem = At;
590
+ const Ht = "_breadcrumbsItem_1hm6a_1", Jt = "_breadcrumbs_1hm6a_1", De = {
591
+ breadcrumbsItem: Ht,
592
+ breadcrumbs: Jt
593
+ }, Ar = ({ items: e }) => /* @__PURE__ */ i("nav", { "aria-label": "breadcrumb", className: De.breadcrumbs, children: e.map((n, t) => /* @__PURE__ */ _(Ve, { children: [
594
+ /* @__PURE__ */ i(Ye, { className: De.breadcrumbsItem, href: n.link, rel: "noreferrer", children: n.name }),
588
595
  t < e.length - 1 && /* @__PURE__ */ i("span", { children: " — " })
589
- ] }, `${n.link}-${n.name}`)) }), kt = ({ items: e }) => /* @__PURE__ */ i(Be, { children: e.map((n, t) => /* @__PURE__ */ b($e, { children: [
590
- !!t && n.some((r) => r.visible) && /* @__PURE__ */ i(ze, {}),
591
- n.filter(({ visible: r }) => r).map(({ link: r, label: a, onClick: o }) => /* @__PURE__ */ i($, { href: r || "#", "aria-label": a, onClick: o, children: a }, a))
592
- ] }, n[0].label)) }), Ot = "_badge_1pc1v_1", At = "_tag_1pc1v_15", qt = "_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21", Bt = "_disabled_1pc1v_57", Mt = "_projectNavigationItem_1pc1v_61", $t = "_projectNavigationItemDisabled_1pc1v_67", j = {
593
- badge: Ot,
594
- tag: At,
595
- withNavLinkStyle: qt,
596
- disabled: Bt,
597
- projectNavigationItem: Mt,
598
- projectNavigationItemDisabled: $t
599
- }, qe = ({ label: e, badge: n, novel: t }) => /* @__PURE__ */ b("div", { className: "flex gap-1", children: [
600
- /* @__PURE__ */ b("div", { children: [
596
+ ] }, `${n.link}-${n.name}`)) }), Gt = ({ items: e }) => /* @__PURE__ */ i(Je, { children: e.map((n, t) => /* @__PURE__ */ _(Ve, { children: [
597
+ !!t && n.some((r) => r.visible) && /* @__PURE__ */ i(Ze, {}),
598
+ n.filter(({ visible: r }) => r).map(({ link: r, label: a, onClick: o }) => /* @__PURE__ */ i(F, { href: r || "#", "aria-label": a, onClick: o, children: a }, a))
599
+ ] }, n[0].label)) }), Kt = "_badge_1pc1v_1", Vt = "_tag_1pc1v_15", Yt = "_withNavLinkStyle_1pc1v_42 _withLinkStyle_1pc1v_21", Qt = "_disabled_1pc1v_57", Zt = "_projectNavigationItem_1pc1v_61", Xt = "_projectNavigationItemDisabled_1pc1v_67", j = {
600
+ badge: Kt,
601
+ tag: Vt,
602
+ withNavLinkStyle: Yt,
603
+ disabled: Qt,
604
+ projectNavigationItem: Zt,
605
+ projectNavigationItemDisabled: Xt
606
+ }, We = ({ label: e, badge: n, novel: t }) => /* @__PURE__ */ _("div", { className: "flex gap-1", children: [
607
+ /* @__PURE__ */ _("div", { children: [
601
608
  /* @__PURE__ */ i("span", { children: e }),
602
609
  !!n && /* @__PURE__ */ i("div", { className: j.badge, "aria-label": `${n} items requiring attention`, children: n > 9 ? "9+" : n })
603
610
  ] }),
604
- !!t && /* @__PURE__ */ i(un, { className: j.tag, children: t })
605
- ] }), re = cn(
606
- ({ label: e, href: n = "", disabled: t = !1, badge: r, onClick: a, novel: o }, c) => /* @__PURE__ */ i(ae, { tooltip: "You do not have access to this function", show: t, children: /* @__PURE__ */ i(
611
+ !!t && /* @__PURE__ */ i(yn, { className: j.tag, children: t })
612
+ ] }), ce = Tn(
613
+ ({ label: e, href: n = "", disabled: t = !1, badge: r, onClick: a, novel: o }, s) => /* @__PURE__ */ i(le, { tooltip: "You do not have access to this function", show: t, children: /* @__PURE__ */ i(
607
614
  "div",
608
615
  {
609
616
  className: t ? j.projectNavigationItemDisabled : j.projectNavigationItem,
@@ -611,32 +618,32 @@ const Ct = "_breadcrumbsItem_1hm6a_1", Rt = "_breadcrumbs_1hm6a_1", Ae = {
611
618
  "button",
612
619
  {
613
620
  type: "button",
614
- ref: c,
615
- className: L(j.withNavLinkStyle, {
621
+ ref: s,
622
+ className: C(j.withNavLinkStyle, {
616
623
  [j.disabled]: t
617
624
  }),
618
625
  disabled: t,
619
626
  onClick: a,
620
- children: /* @__PURE__ */ i(qe, { label: e, badge: r, novel: o })
627
+ children: /* @__PURE__ */ i(We, { label: e, badge: r, novel: o })
621
628
  }
622
- ) : /* @__PURE__ */ i("a", { href: n, className: j.withNavLinkStyle, children: /* @__PURE__ */ i(qe, { label: e, badge: r, novel: o }) })
629
+ ) : /* @__PURE__ */ i("a", { href: n, className: j.withNavLinkStyle, children: /* @__PURE__ */ i(We, { label: e, badge: r, novel: o }) })
623
630
  }
624
631
  ) })
625
632
  );
626
- re.displayName = "NavigationTabsItem";
627
- const Ut = (e) => (e == null ? void 0 : e.some((n) => n.some((t) => t.visible))) ?? !1, Dt = (e) => e.visible && (!e.dropdown || Ut(e.dropdown)), ar = ({ navigation: e, activeItem: n }) => /* @__PURE__ */ i("nav", { "aria-label": "Project", children: /* @__PURE__ */ i("ul", { className: C.navigationTabList, "aria-orientation": "horizontal", children: e.filter(Dt).map((t) => {
633
+ ce.displayName = "NavigationTabsItem";
634
+ const er = (e) => (e == null ? void 0 : e.some((n) => n.some((t) => t.visible))) ?? !1, nr = (e) => e.visible && (!e.dropdown || er(e.dropdown)), Rr = ({ navigation: e, activeItem: n }) => /* @__PURE__ */ i("nav", { "aria-label": "Project", children: /* @__PURE__ */ i("ul", { className: R.navigationTabList, "aria-orientation": "horizontal", children: e.filter(nr).map((t) => {
628
635
  var r, a, o;
629
636
  return t.dropdown ? /* @__PURE__ */ i(
630
637
  "li",
631
638
  {
632
- className: C.navigationTab,
639
+ className: R.navigationTab,
633
640
  "data-testid": t.key,
634
641
  "aria-selected": (r = t.isActive) == null ? void 0 : r.call(t, n),
635
642
  children: /* @__PURE__ */ i(
636
- oe,
643
+ ue,
637
644
  {
638
- menuButton: ({ opened: c }) => /* @__PURE__ */ i(re, { label: t.label, disabled: t.disabled, active: c }),
639
- children: /* @__PURE__ */ i(se, { children: /* @__PURE__ */ i(kt, { items: t.dropdown }) })
645
+ menuButton: ({ opened: s }) => /* @__PURE__ */ i(ce, { label: t.label, disabled: t.disabled, active: s }),
646
+ children: /* @__PURE__ */ i(de, { children: /* @__PURE__ */ i(Gt, { items: t.dropdown }) })
640
647
  }
641
648
  )
642
649
  },
@@ -644,11 +651,11 @@ const Ut = (e) => (e == null ? void 0 : e.some((n) => n.some((t) => t.visible)))
644
651
  ) : /* @__PURE__ */ i(
645
652
  "li",
646
653
  {
647
- className: C.navigationTab,
654
+ className: R.navigationTab,
648
655
  "data-testid": t.key,
649
656
  "aria-selected": (a = t.isActive) == null ? void 0 : a.call(t, n),
650
657
  children: /* @__PURE__ */ i(
651
- re,
658
+ ce,
652
659
  {
653
660
  label: t.label,
654
661
  href: t.link,
@@ -662,30 +669,165 @@ const Ut = (e) => (e == null ? void 0 : e.some((n) => n.some((t) => t.visible)))
662
669
  },
663
670
  t.key
664
671
  );
665
- }) }) });
672
+ }) }) }), tr = f.union([
673
+ f.literal("owner"),
674
+ f.literal("admin"),
675
+ f.literal("biller"),
676
+ f.literal("member")
677
+ ]), rr = f.object({
678
+ userId: f.number(),
679
+ teamId: f.number(),
680
+ userTeamRole: tr,
681
+ userEmail: f.string().email(),
682
+ userCurrentTeamId: f.number(),
683
+ planId: f.number(),
684
+ planName: f.string(),
685
+ isProviderAlpha: f.boolean(),
686
+ isFullyAuthenticated: f.boolean(),
687
+ exp: f.number()
688
+ });
689
+ function fn(e) {
690
+ try {
691
+ const n = e.split(".")[1], t = atob(n);
692
+ return rr.parse(JSON.parse(t));
693
+ } catch {
694
+ return;
695
+ }
696
+ }
697
+ const D = class D extends CustomEvent {
698
+ constructor(n) {
699
+ super(D.eventName, { detail: { token: n, payload: fn(n.accessToken) } });
700
+ }
701
+ };
702
+ ve(D, "eventName", "new-jwt-issued");
703
+ let z = D;
704
+ const ar = f.object({
705
+ accessToken: f.string(),
706
+ refreshToken: f.string()
707
+ }), ge = Nn({
708
+ description: "Takes a teamId and returns a JWT token access and refresh token for the user",
709
+ method: "post",
710
+ requestPathParamsSchema: f.object({ teamId: f.number() }),
711
+ pathResolver: (e) => `/team/${e.teamId}/actions/get-user-token`,
712
+ requestHeaderSchema: f.object({ Authorization: f.string().optional() }),
713
+ requestBodySchema: f.undefined(),
714
+ successResponseBodySchema: ar
715
+ }), ir = {
716
+ teamKey: (e) => ["getUserToken", e]
717
+ }, or = (e, n, t) => In({
718
+ ...t,
719
+ queryFn: ({ queryKey: [r, a] }) => fe(e, ge, {
720
+ pathParams: { teamId: a },
721
+ headers: {}
722
+ }),
723
+ queryKey: ir.teamKey(n)
724
+ });
725
+ function Lr(e, n) {
726
+ const t = or(e, n), r = Ge();
727
+ return W(() => {
728
+ t.data && t.data.accessToken !== r.current && (window.dispatchEvent(new z(t.data)), r.current = t.data.accessToken);
729
+ }, [t.data]), t;
730
+ }
731
+ function $(e) {
732
+ return { Authorization: `Bearer ${e}` };
733
+ }
734
+ function sr(e, n) {
735
+ return (t) => async (r, a) => {
736
+ var l;
737
+ const o = await n.getCachedJwtToken();
738
+ if (o === void 0)
739
+ return t(r, a);
740
+ const s = await t(r, {
741
+ ...a,
742
+ headers: { ...a.headers, ...$(o.accessToken) }
743
+ });
744
+ if (o && (s.status === 401 || s.status === 403)) {
745
+ const u = fn(o.accessToken);
746
+ if (!u)
747
+ return s;
748
+ const c = await fe(e, ge, {
749
+ pathParams: { teamId: u.teamId },
750
+ headers: $(o.refreshToken)
751
+ });
752
+ return await ((l = n.onNewJwtTokenIssued) == null ? void 0 : l.call(n, c)), t(r, {
753
+ ...a,
754
+ headers: { ...a.headers, ...$(c.accessToken) }
755
+ });
756
+ }
757
+ return s;
758
+ };
759
+ }
760
+ const Fe = {
761
+ wretch: {
762
+ jwtAuth(e) {
763
+ return this.middlewares([sr(this, e)]);
764
+ }
765
+ }
766
+ };
767
+ function cr(e, n) {
768
+ return (t) => async (r, a) => {
769
+ var l;
770
+ if (await n.getCachedJwtToken() !== void 0)
771
+ return t(r, a);
772
+ const s = await fe(e, ge, {
773
+ pathParams: { teamId: await n.getTeamId() },
774
+ headers: {}
775
+ });
776
+ return await ((l = n.onNewJwtTokenIssued) == null ? void 0 : l.call(n, s)), t(r, {
777
+ ...a,
778
+ headers: { ...a.headers, ...$(s.accessToken) }
779
+ });
780
+ };
781
+ }
782
+ async function lr() {
783
+ }
784
+ const xr = {
785
+ wretch: {
786
+ jwtAuth(e) {
787
+ return this.addon(Fe).jwtAuth(He(e));
788
+ },
789
+ jwtAuthWithClassicSessionPromotion(e) {
790
+ const n = He(e);
791
+ return this.addon(Fe).jwtAuth(n).middlewares([cr(this, n)]);
792
+ }
793
+ }
794
+ };
795
+ function He(e) {
796
+ return {
797
+ ...e,
798
+ getCachedJwtToken: e.getCachedJwtToken ?? lr,
799
+ onNewJwtTokenIssued: async (n) => {
800
+ var t;
801
+ return window.dispatchEvent(new z(n)), (t = e.onNewJwtTokenIssued) == null ? void 0 : t.call(e, n);
802
+ }
803
+ };
804
+ }
666
805
  export {
667
- ir as Breadcrumbs,
668
- Ke as ENTERPRISE_OPENSOURCE_PLAN_ID,
669
- ct as ENTERPRISE_PLAN_IDS,
670
- ot as ESSENTIAL_PLAN_IDS,
671
- Je as FREE_PLAN_ID,
672
- M as NavigationPanel,
673
- ar as NavigationTabs,
674
- st as PRO_PLAN_IDS,
675
- at as START_PLAN_IDS,
806
+ Ar as Breadcrumbs,
807
+ xr as BrowserJwtAuthAddon,
808
+ ln as ENTERPRISE_OPENSOURCE_PLAN_ID,
809
+ yt as ENTERPRISE_PLAN_IDS,
810
+ Tt as ESSENTIAL_PLAN_IDS,
811
+ cn as FREE_PLAN_ID,
812
+ Fe as JwtAuthAddon,
813
+ U as NavigationPanel,
814
+ Rr as NavigationTabs,
815
+ wt as PRO_PLAN_IDS,
816
+ vt as START_PLAN_IDS,
676
817
  I as Sidebar,
677
- it as TRIAL_PLAN_ID,
678
- Qt as convertNewLineToBreakTag,
679
- nr as formatDate,
680
- tr as formatDateTz,
681
- Kt as isEnterpriseOpenSourcePlan,
682
- Xt as isEnterprisePlan,
683
- Yt as isEssentialPlan,
684
- le as isFreePlan,
685
- Jt as isPaidPlan,
686
- Zt as isProPlan,
687
- Vt as isStartPlan,
688
- Qe as isTrialPlan,
689
- er as makeUrlClickable,
690
- rr as useEffectOnce
818
+ _t as TRIAL_PLAN_ID,
819
+ kr as convertNewLineToBreakTag,
820
+ Er as formatDate,
821
+ jr as formatDateTz,
822
+ Sr as isEnterpriseOpenSourcePlan,
823
+ Ir as isEnterprisePlan,
824
+ wr as isEssentialPlan,
825
+ he as isFreePlan,
826
+ Nr as isPaidPlan,
827
+ yr as isProPlan,
828
+ Tr as isStartPlan,
829
+ un as isTrialPlan,
830
+ Pr as makeUrlClickable,
831
+ Cr as useEffectOnce,
832
+ Lr as useGetPromotedClassicSessionJwtQuery
691
833
  };