@tracktor/shared-module 2.18.2 → 2.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import ee from "axios";
2
- import fe, { createContext as pe, useMemo as G, useContext as j, useState as W, useRef as ae, useEffect as k, Suspense as ge, useCallback as L } from "react";
3
- const De = (e, n) => {
2
+ import fe, { useMemo as G, createContext as pe, useContext as j, useEffect as k, useState as W, useRef as ae, Suspense as ge, useCallback as N } from "react";
3
+ const Ye = (e, r) => {
4
4
  const o = ee.CancelToken.source(), a = ee({
5
5
  ...e,
6
- ...n,
6
+ ...r,
7
7
  cancelToken: o.token
8
- }).then(({ data: r }) => r);
8
+ }).then(({ data: n }) => n);
9
9
  return a.cancel = () => {
10
10
  o.cancel("Query was cancelled");
11
11
  }, a;
12
12
  };
13
- var D = { exports: {} }, N = {};
13
+ var D = { exports: {} }, L = {};
14
14
  /**
15
15
  * @license React
16
16
  * react-jsx-runtime.production.js
@@ -22,25 +22,25 @@ var D = { exports: {} }, N = {};
22
22
  */
23
23
  var te;
24
24
  function me() {
25
- if (te) return N;
25
+ if (te) return L;
26
26
  te = 1;
27
- var e = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
28
- function o(a, r, i) {
27
+ var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
28
+ function o(a, n, i) {
29
29
  var c = null;
30
- if (i !== void 0 && (c = "" + i), r.key !== void 0 && (c = "" + r.key), "key" in r) {
30
+ if (i !== void 0 && (c = "" + i), n.key !== void 0 && (c = "" + n.key), "key" in n) {
31
31
  i = {};
32
- for (var d in r)
33
- d !== "key" && (i[d] = r[d]);
34
- } else i = r;
35
- return r = i.ref, {
32
+ for (var u in n)
33
+ u !== "key" && (i[u] = n[u]);
34
+ } else i = n;
35
+ return n = i.ref, {
36
36
  $$typeof: e,
37
37
  type: a,
38
38
  key: c,
39
- ref: r !== void 0 ? r : null,
39
+ ref: n !== void 0 ? n : null,
40
40
  props: i
41
41
  };
42
42
  }
43
- return N.Fragment = n, N.jsx = o, N.jsxs = o, N;
43
+ return L.Fragment = r, L.jsx = o, L.jsxs = o, L;
44
44
  }
45
45
  var F = {};
46
46
  /**
@@ -53,7 +53,7 @@ var F = {};
53
53
  * LICENSE file in the root directory of this source tree.
54
54
  */
55
55
  var re;
56
- function ye() {
56
+ function he() {
57
57
  return re || (re = 1, process.env.NODE_ENV !== "production" && function() {
58
58
  function e(t) {
59
59
  if (t == null) return null;
@@ -61,7 +61,7 @@ function ye() {
61
61
  return t.$$typeof === le ? null : t.displayName || t.name || null;
62
62
  if (typeof t == "string") return t;
63
63
  switch (t) {
64
- case b:
64
+ case A:
65
65
  return "Fragment";
66
66
  case y:
67
67
  return "Profiler";
@@ -69,7 +69,7 @@ function ye() {
69
69
  return "StrictMode";
70
70
  case P:
71
71
  return "Suspense";
72
- case ie:
72
+ case se:
73
73
  return "SuspenseList";
74
74
  case ce:
75
75
  return "Activity";
@@ -78,16 +78,16 @@ function ye() {
78
78
  switch (typeof t.tag == "number" && console.error(
79
79
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
80
80
  ), t.$$typeof) {
81
- case I:
81
+ case x:
82
82
  return "Portal";
83
- case p:
83
+ case g:
84
84
  return (t.displayName || "Context") + ".Provider";
85
85
  case _:
86
86
  return (t._context.displayName || "Context") + ".Consumer";
87
87
  case w:
88
88
  var f = t.render;
89
89
  return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
90
- case se:
90
+ case ie:
91
91
  return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
92
92
  case J:
93
93
  f = t._payload, t = t._init;
@@ -98,12 +98,12 @@ function ye() {
98
98
  }
99
99
  return null;
100
100
  }
101
- function n(t) {
101
+ function r(t) {
102
102
  return "" + t;
103
103
  }
104
104
  function o(t) {
105
105
  try {
106
- n(t);
106
+ r(t);
107
107
  var f = !1;
108
108
  } catch {
109
109
  f = !0;
@@ -115,11 +115,11 @@ function ye() {
115
115
  f,
116
116
  "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
117
117
  E
118
- ), n(t);
118
+ ), r(t);
119
119
  }
120
120
  }
121
121
  function a(t) {
122
- if (t === b) return "<>";
122
+ if (t === A) return "<>";
123
123
  if (typeof t == "object" && t !== null && t.$$typeof === J)
124
124
  return "<...>";
125
125
  try {
@@ -129,7 +129,7 @@ function ye() {
129
129
  return "<...>";
130
130
  }
131
131
  }
132
- function r() {
132
+ function n() {
133
133
  var t = z.A;
134
134
  return t === null ? null : t.getOwner();
135
135
  }
@@ -143,7 +143,7 @@ function ye() {
143
143
  }
144
144
  return t.key !== void 0;
145
145
  }
146
- function d(t, f) {
146
+ function u(t, f) {
147
147
  function v() {
148
148
  q || (q = !0, console.error(
149
149
  "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
@@ -161,13 +161,13 @@ function ye() {
161
161
  "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
162
162
  )), t = this.props.ref, t !== void 0 ? t : null;
163
163
  }
164
- function u(t, f, v, E, x, T, Q, M) {
164
+ function d(t, f, v, E, I, T, Q, V) {
165
165
  return v = T.ref, t = {
166
- $$typeof: A,
166
+ $$typeof: b,
167
167
  type: t,
168
168
  key: f,
169
169
  props: T,
170
- _owner: x
170
+ _owner: I
171
171
  }, (v !== void 0 ? v : null) !== null ? Object.defineProperty(t, "ref", {
172
172
  enumerable: !1,
173
173
  get: l
@@ -190,10 +190,10 @@ function ye() {
190
190
  configurable: !1,
191
191
  enumerable: !1,
192
192
  writable: !0,
193
- value: M
193
+ value: V
194
194
  }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
195
195
  }
196
- function s(t, f, v, E, x, T, Q, M) {
196
+ function s(t, f, v, E, I, T, Q, V) {
197
197
  var R = f.children;
198
198
  if (R !== void 0)
199
199
  if (E)
@@ -226,39 +226,39 @@ React keys must be passed directly to JSX without using spread:
226
226
  }
227
227
  if (R = null, v !== void 0 && (o(v), R = "" + v), c(f) && (o(f.key), R = "" + f.key), "key" in f) {
228
228
  v = {};
229
- for (var V in f)
230
- V !== "key" && (v[V] = f[V]);
229
+ for (var M in f)
230
+ M !== "key" && (v[M] = f[M]);
231
231
  } else v = f;
232
- return R && d(
232
+ return R && u(
233
233
  v,
234
234
  typeof t == "function" ? t.displayName || t.name || "Unknown" : t
235
- ), u(
235
+ ), d(
236
236
  t,
237
237
  R,
238
238
  T,
239
- x,
240
- r(),
239
+ I,
240
+ n(),
241
241
  v,
242
242
  Q,
243
- M
243
+ V
244
244
  );
245
245
  }
246
246
  function h(t) {
247
- typeof t == "object" && t !== null && t.$$typeof === A && t._store && (t._store.validated = 1);
247
+ typeof t == "object" && t !== null && t.$$typeof === b && t._store && (t._store.validated = 1);
248
248
  }
249
- var g = fe, A = Symbol.for("react.transitional.element"), I = Symbol.for("react.portal"), b = Symbol.for("react.fragment"), m = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), p = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), ie = Symbol.for("react.suspense_list"), se = Symbol.for("react.memo"), J = Symbol.for("react.lazy"), ce = Symbol.for("react.activity"), le = Symbol.for("react.client.reference"), z = g.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, ue = Array.isArray, U = console.createTask ? console.createTask : function() {
249
+ var p = fe, b = Symbol.for("react.transitional.element"), x = Symbol.for("react.portal"), A = Symbol.for("react.fragment"), m = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), _ = Symbol.for("react.consumer"), g = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), se = Symbol.for("react.suspense_list"), ie = Symbol.for("react.memo"), J = Symbol.for("react.lazy"), ce = Symbol.for("react.activity"), le = Symbol.for("react.client.reference"), z = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, K = Object.prototype.hasOwnProperty, ue = Array.isArray, U = console.createTask ? console.createTask : function() {
250
250
  return null;
251
251
  };
252
- g = {
252
+ p = {
253
253
  "react-stack-bottom-frame": function(t) {
254
254
  return t();
255
255
  }
256
256
  };
257
- var q, B = {}, H = g["react-stack-bottom-frame"].bind(
258
- g,
257
+ var q, B = {}, H = p["react-stack-bottom-frame"].bind(
258
+ p,
259
259
  i
260
260
  )(), X = U(a(i)), Z = {};
261
- F.Fragment = b, F.jsx = function(t, f, v, E, x) {
261
+ F.Fragment = A, F.jsx = function(t, f, v, E, I) {
262
262
  var T = 1e4 > z.recentlyCreatedOwnerStacks++;
263
263
  return s(
264
264
  t,
@@ -266,11 +266,11 @@ React keys must be passed directly to JSX without using spread:
266
266
  v,
267
267
  !1,
268
268
  E,
269
- x,
269
+ I,
270
270
  T ? Error("react-stack-top-frame") : H,
271
271
  T ? U(a(t)) : X
272
272
  );
273
- }, F.jsxs = function(t, f, v, E, x) {
273
+ }, F.jsxs = function(t, f, v, E, I) {
274
274
  var T = 1e4 > z.recentlyCreatedOwnerStacks++;
275
275
  return s(
276
276
  t,
@@ -278,7 +278,7 @@ React keys must be passed directly to JSX without using spread:
278
278
  v,
279
279
  !0,
280
280
  E,
281
- x,
281
+ I,
282
282
  T ? Error("react-stack-top-frame") : H,
283
283
  T ? U(a(t)) : X
284
284
  );
@@ -286,47 +286,43 @@ React keys must be passed directly to JSX without using spread:
286
286
  }()), F;
287
287
  }
288
288
  var ne;
289
- function he() {
290
- return ne || (ne = 1, process.env.NODE_ENV === "production" ? D.exports = me() : D.exports = ye()), D.exports;
289
+ function ye() {
290
+ return ne || (ne = 1, process.env.NODE_ENV === "production" ? D.exports = me() : D.exports = he()), D.exports;
291
291
  }
292
- var C = he();
293
- const S = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys: a }) => {
294
- const r = G(
292
+ var C = ye();
293
+ const We = ({ IMaskMixin: e, ...r }) => {
294
+ const o = G(
295
+ // eslint-disable-next-line react/jsx-props-no-spreading
296
+ () => e(({ TextField: a, ...n }) => /* @__PURE__ */ C.jsx(a, { ...n })),
297
+ [e]
298
+ );
299
+ return /* @__PURE__ */ C.jsx(o, { ...r });
300
+ }, S = pe({}), ze = ({ children: e, apiURL: r, libraries: o, localStorageKeys: a }) => {
301
+ const n = G(
295
302
  () => ({
296
- apiURL: n,
303
+ apiURL: r,
297
304
  libraries: o,
298
305
  localStorageKeys: a
299
306
  }),
300
- [n, o, a]
307
+ [r, o, a]
301
308
  );
302
- return /* @__PURE__ */ C.jsx(S.Provider, { value: r, children: e });
303
- }, ve = "user", We = ({ Fallback: e, isLogged: n, loginPath: o = "/login", redirect401Path: a = "/login", ...r }) => {
304
- const { libraries: i, localStorageKeys: c } = j(S), d = r?.reactRouter || i?.reactRouter, l = r?.axios || i?.axios, u = r?.localStorageKey || c?.user || ve;
305
- if (!d)
306
- throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
307
- const [s, h] = W(null), { useLocation: g, Navigate: A, Outlet: I } = d, b = g(), m = ae(!1), y = typeof n == "function" ? n() : !!n, _ = typeof y == "boolean" ? y : y?.isLogged;
308
- return k(() => {
309
- m.current || (m.current = !0, l.interceptors.response.use(
310
- (p) => p,
311
- async (p) => (typeof p == "object" && p && "response" in p && p.response && typeof p.response == "object" && "status" in p.response && p.response && typeof p.response == "object" && "status" in p.response && p?.response?.status === 401 && (l.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(u), h(a)), Promise.reject(p))
312
- ));
313
- }, [l.defaults.headers.common, l.interceptors.response, u, a]), _ && !s ? /* @__PURE__ */ C.jsx(ge, { fallback: e, children: b.state?.from?.state && b.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(A, { to: b.state.from.state.from.pathname + b.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(I, {}) }) : /* @__PURE__ */ C.jsx(A, { to: o + b.search, state: { from: b }, replace: !0 });
314
- }, ze = ({ data: e, ...n }) => {
315
- const { libraries: o } = j(S), a = n?.reactRouter || o?.reactRouter, r = n?.gtm || o?.gtm;
309
+ return /* @__PURE__ */ C.jsx(S.Provider, { value: n, children: e });
310
+ }, Ue = ({ data: e, ...r }) => {
311
+ const { libraries: o } = j(S), a = r?.reactRouter || o?.reactRouter, n = r?.gtm || o?.gtm;
316
312
  if (!a)
317
313
  throw new Error(
318
314
  "React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
319
315
  );
320
- if (!r)
316
+ if (!n)
321
317
  throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");
322
- const { useGoogleTagManager: i } = r, { useLocation: c, Outlet: d } = a, { pathname: l } = c(), { sendEvent: u } = i();
318
+ const { useGoogleTagManager: i } = n, { useLocation: c, Outlet: u } = a, { pathname: l } = c(), { sendEvent: d } = i();
323
319
  return k(() => {
324
- u({
320
+ d({
325
321
  event: "pageView",
326
322
  pathname: l,
327
323
  ...e
328
324
  });
329
- }, [e, l, u]), /* @__PURE__ */ C.jsx(d, {});
325
+ }, [e, l, d]), /* @__PURE__ */ C.jsx(u, {});
330
326
  }, $ = (() => {
331
327
  try {
332
328
  return typeof global == "object" && global !== null && ("HermesInternal" in global || // Hermes JS engine
@@ -335,29 +331,43 @@ const S = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
335
331
  } catch {
336
332
  return !1;
337
333
  }
338
- })(), we = "user", Ue = ({
334
+ })(), ve = "user", Qe = ({
339
335
  tokenTypeKey: e = "tokenType",
340
- tokenKey: n = "accessToken",
336
+ tokenKey: r = "accessToken",
341
337
  postContentType: o = "application/json",
342
338
  ...a
343
339
  }) => {
344
- const { apiURL: r = a.apiURL, libraries: i, localStorageKeys: c } = j(S), d = a?.userLocalStorageKey || c?.user || we, l = a?.axios || i?.axios;
340
+ const { apiURL: n = a.apiURL, libraries: i, localStorageKeys: c } = j(S), u = a?.userLocalStorageKey || c?.user || ve, l = a?.axios || i?.axios;
345
341
  if (!l)
346
342
  throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
347
343
  if (!l?.defaults || $)
348
344
  return null;
349
345
  if (typeof window < "u" && window.localStorage) {
350
- const u = localStorage.getItem(d), s = u ? JSON.parse(u) : null, h = s?.[e] ? s[e] : null, g = s?.[n] ? s[n] : null, A = u ? `${h} ${g}` : null;
351
- A && (l.defaults.headers.common.Authorization = A);
346
+ const d = localStorage.getItem(u), s = d ? JSON.parse(d) : null, h = s?.[e] ? s[e] : null, p = s?.[r] ? s[r] : null, b = d ? `${h} ${p}` : null;
347
+ b && (l.defaults.headers.common.Authorization = b);
352
348
  }
353
- return l.defaults.baseURL = r, l.defaults.headers.post["Content-Type"] = o, null;
354
- }, Qe = ({ debug: e, resources: n, ...o }) => {
355
- const { libraries: a } = j(S), r = o?.i18 || a?.i18, { i18next: i, initReactI18next: c, languageDetector: d } = r || {};
349
+ return l.defaults.baseURL = n, l.defaults.headers.post["Content-Type"] = o, null;
350
+ }, Ve = ({ language: e, ...r }) => {
351
+ const { libraries: o } = j(S), a = r?.dayjs || o?.dayjs, n = r?.plugin || o?.dayjsPlugin;
352
+ if (!a)
353
+ throw new Error(
354
+ "Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
355
+ );
356
+ return k(() => {
357
+ (async () => {
358
+ const c = e || navigator.language?.slice(0, 2) || "en";
359
+ n && n.forEach((u) => {
360
+ u && a.extend(u);
361
+ }), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), a.locale(c);
362
+ })().then();
363
+ }, [a, n, e]), null;
364
+ }, Me = ({ debug: e, resources: r, ...o }) => {
365
+ const { libraries: a } = j(S), n = o?.i18 || a?.i18, { i18next: i, initReactI18next: c, languageDetector: u } = n || {};
356
366
  if ($)
357
367
  return null;
358
- if (!r)
368
+ if (!n)
359
369
  throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
360
- return i?.isInitialized || (i.use(d).use(c).init({
370
+ return i?.isInitialized || (i.use(u).use(c).init({
361
371
  debug: e,
362
372
  fallbackLng: "en",
363
373
  interpolation: {
@@ -368,36 +378,36 @@ const S = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
368
378
  bindI18n: "languageChanged loaded",
369
379
  useSuspense: !0
370
380
  },
371
- resources: n,
381
+ resources: r,
372
382
  returnNull: !1
373
383
  }).then(() => {
374
384
  document.documentElement.lang !== i.resolvedLanguage && i.resolvedLanguage && document.documentElement.setAttribute("lang", i.resolvedLanguage);
375
385
  }), i.on("languageChanged", (l) => {
376
386
  document.documentElement.setAttribute("lang", l);
377
387
  })), null;
378
- }, Me = ({
388
+ }, Ge = ({
379
389
  dsn: e,
380
- integrations: n,
390
+ integrations: r,
381
391
  tracesSampleRate: o,
382
392
  replaysSessionSampleRate: a,
383
- replaysOnErrorSampleRate: r,
393
+ replaysOnErrorSampleRate: n,
384
394
  tracePropagationTargets: i,
385
395
  ignoreErrors: c,
386
- debug: d,
396
+ debug: u,
387
397
  environment: l,
388
- release: u,
398
+ release: d,
389
399
  ...s
390
400
  }) => {
391
- const { libraries: h } = j(S), g = s?.sentry || h?.sentry, A = s?.reactRouter || h?.reactRouter;
392
- if (!g)
401
+ const { libraries: h } = j(S), p = s?.sentry || h?.sentry, b = s?.reactRouter || h?.reactRouter;
402
+ if (!p)
393
403
  throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
394
- if (!A)
404
+ if (!b)
395
405
  throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
396
- if (g.isInitialized())
406
+ if (p.isInitialized())
397
407
  return null;
398
- const { createRoutesFromChildren: I, matchRoutes: b, useLocation: m, useNavigationType: y } = A;
399
- return (d || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && g.init({
400
- debug: d,
408
+ const { createRoutesFromChildren: x, matchRoutes: A, useLocation: m, useNavigationType: y } = b;
409
+ return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && p.init({
410
+ debug: u,
401
411
  dsn: e,
402
412
  environment: l || "production",
403
413
  ignoreErrors: [
@@ -410,176 +420,209 @@ const S = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
410
420
  /vite:preloadError/
411
421
  ],
412
422
  integrations: [
413
- g.reactRouterV6BrowserTracingIntegration({
414
- createRoutesFromChildren: I,
415
- matchRoutes: b,
423
+ p.reactRouterV6BrowserTracingIntegration({
424
+ createRoutesFromChildren: x,
425
+ matchRoutes: A,
416
426
  useEffect: k,
417
427
  useLocation: m,
418
428
  useNavigationType: y
419
429
  }),
420
- ...n || []
430
+ ...r || []
421
431
  ],
422
- release: u,
423
- replaysOnErrorSampleRate: r || 1,
432
+ release: d,
433
+ replaysOnErrorSampleRate: n || 1,
424
434
  replaysSessionSampleRate: a || 0.1,
425
435
  tracePropagationTargets: i,
426
436
  tracesSampleRate: o || 1
427
437
  }), null;
428
- }, Ve = ({ IMaskMixin: e, ...n }) => {
429
- const o = G(
430
- // eslint-disable-next-line react/jsx-props-no-spreading
431
- () => e(({ TextField: a, ...r }) => /* @__PURE__ */ C.jsx(a, { ...r })),
432
- [e]
433
- );
434
- return /* @__PURE__ */ C.jsx(o, { ...n });
435
- }, Ge = ({ language: e, ...n }) => {
436
- const { libraries: o } = j(S), a = n?.dayjs || o?.dayjs, r = n?.plugin || o?.dayjsPlugin;
437
- if (!a)
438
- throw new Error(
439
- "Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
440
- );
441
- return k(() => {
442
- (async () => {
443
- const c = e || navigator.language?.slice(0, 2) || "en";
444
- r && r.forEach((d) => {
445
- d && a.extend(d);
446
- }), await import("dayjs/locale/en"), await import("dayjs/locale/fr"), a.locale(c);
447
- })().then();
448
- }, [a, r, e]), null;
449
438
  }, Je = () => (k(() => {
450
439
  if ($)
451
440
  return;
452
- const e = (n) => {
441
+ const e = (r) => {
453
442
  try {
454
- n.preventDefault(), n.stopPropagation(), n.stopImmediatePropagation(), window.location.reload();
443
+ r.preventDefault(), r.stopPropagation(), r.stopImmediatePropagation(), window.location.reload();
455
444
  } catch {
456
445
  }
457
446
  };
458
447
  return window.addEventListener("vite:preloadError", e), () => {
459
448
  window.removeEventListener("vite:preloadError", e);
460
449
  };
461
- }, []), null), Ee = async () => {
450
+ }, []), null), we = "user", Ke = ({ Fallback: e, isLogged: r, loginPath: o = "/login", redirect401Path: a = "/login", ...n }) => {
451
+ const { libraries: i, localStorageKeys: c } = j(S), u = n?.reactRouter || i?.reactRouter, l = n?.axios || i?.axios, d = n?.localStorageKey || c?.user || we;
452
+ if (!u)
453
+ throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
454
+ const [s, h] = W(null), { useLocation: p, Navigate: b, Outlet: x } = u, A = p(), m = ae(!1), y = typeof r == "function" ? r() : !!r, _ = typeof y == "boolean" ? y : y?.isLogged;
455
+ return k(() => {
456
+ m.current || (m.current = !0, l.interceptors.response.use(
457
+ (g) => g,
458
+ async (g) => (typeof g == "object" && g && "response" in g && g.response && typeof g.response == "object" && "status" in g.response && g.response && typeof g.response == "object" && "status" in g.response && g?.response?.status === 401 && (l.defaults.headers.common.Authorization = null, typeof window < "u" && window.localStorage && localStorage.removeItem(d), h(a)), Promise.reject(g))
459
+ ));
460
+ }, [l.defaults.headers.common, l.interceptors.response, d, a]), _ && !s ? /* @__PURE__ */ C.jsx(ge, { fallback: e, children: A.state?.from?.state && A.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(b, { to: A.state.from.state.from.pathname + A.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(x, {}) }) : /* @__PURE__ */ C.jsx(b, { to: o + A.search, state: { from: A }, replace: !0 });
461
+ }, Ee = async () => {
462
462
  if ("caches" in window)
463
463
  try {
464
464
  const e = await caches.keys();
465
- await Promise.all(e.map((n) => caches.delete(n)));
465
+ await Promise.all(e.map((r) => caches.delete(r)));
466
466
  } catch (e) {
467
467
  console.error("Failed to clear caches:", e);
468
468
  }
469
- }, Ke = ({ autoUpdate: e, renderDialog: n, clearCachesOnReload: o }) => {
470
- const a = ae(null), [r, i] = W(!1), c = L(async () => {
469
+ }, qe = ({ autoUpdate: e, renderDialog: r, clearCachesOnReload: o }) => {
470
+ const a = ae(null), [n, i] = W(!1), c = N(async () => {
471
471
  a.current && a.current.postMessage({ type: "SKIP_WAITING" }), o && await Ee(), window.location.reload();
472
- }, [o]), d = L(async () => {
472
+ }, [o]), u = N(async () => {
473
473
  window.confirm("A new version is available. The app will reload now.") && await c();
474
474
  }, [c]);
475
475
  return k(() => {
476
476
  if (!("serviceWorker" in navigator)) return;
477
- let l, u;
478
- const s = (g) => {
479
- g && navigator.serviceWorker.controller && (a.current = g, i(!0));
477
+ let l, d;
478
+ const s = (p) => {
479
+ p && navigator.serviceWorker.controller && (a.current = p, i(!0));
480
480
  }, h = () => {
481
- const g = l?.installing;
482
- g && (u = () => {
483
- g.state === "installed" && s(g);
484
- }, g.addEventListener("statechange", u));
481
+ const p = l?.installing;
482
+ p && (d = () => {
483
+ p.state === "installed" && s(p);
484
+ }, p.addEventListener("statechange", d));
485
485
  };
486
486
  return (async () => {
487
487
  l = await navigator.serviceWorker.getRegistration(), l && (s(l.waiting), l.addEventListener("updatefound", h));
488
488
  })().catch(console.error), () => {
489
- l?.removeEventListener("updatefound", h), u && l?.installing && l.installing.removeEventListener("statechange", u);
489
+ l?.removeEventListener("updatefound", h), d && l?.installing && l.installing.removeEventListener("statechange", d);
490
490
  };
491
491
  }, []), k(() => {
492
- r && e && c().catch(console.error);
493
- }, [e, r, c]), k(() => {
494
- r && !e && !n && d().catch(console.error);
495
- }, [n, d, r, e]), r && !e && n ? n(c) : null;
496
- }, Re = (e) => e && typeof e == "function", be = (e) => e && typeof e == "function", qe = ({
492
+ n && e && c().catch(console.error);
493
+ }, [e, n, c]), k(() => {
494
+ n && !e && !r && u().catch(console.error);
495
+ }, [r, u, n, e]), n && !e && r ? r(c) : null;
496
+ }, Re = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), be = (e) => {
497
+ const r = e.split(/[/\\]/).pop() || "";
498
+ return r.substring(0, r.lastIndexOf("."));
499
+ }, Ae = (e) => {
500
+ const a = e.split("/").filter((n) => n.length > 0).map((n) => n.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join("")).join("");
501
+ return a.charAt(0).toLowerCase() + a.slice(1);
502
+ }, Se = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), je = (e, r, o, a) => {
503
+ const n = Ae(r), i = Re(o), c = `${n}${i}`;
504
+ return e && typeof e == "object" && "operationId" in e && a?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
505
+ }, _e = (e, r) => {
506
+ const o = {};
507
+ return e?.forEach((a) => {
508
+ o[a] = {
509
+ query: {
510
+ useInfinite: !0,
511
+ useInfiniteQueryParam: "offset",
512
+ useQuery: !0
513
+ }
514
+ };
515
+ }), r?.filter((a) => !o[a]).forEach((a) => {
516
+ o[a] = {
517
+ query: {
518
+ useQuery: !0
519
+ }
520
+ };
521
+ }), Object.keys(o).length ? o : void 0;
522
+ }, Be = (e) => (Array.isArray(e) ? e : [e]).reduce((o, a) => {
523
+ const { output: n, useInfiniteIds: i, useQueryIds: c, input: u = "./openapi.json", customAxiosInstancePath: l, overrideApiName: d } = a || {}, s = d || Se(u), h = l || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts";
524
+ return {
525
+ ...o,
526
+ [s]: {
527
+ input: u,
528
+ output: {
529
+ baseUrl: n?.baseUrl,
530
+ client: "react-query",
531
+ mode: "tags-split",
532
+ override: {
533
+ ...(i?.length || c?.length) && {
534
+ operations: _e(i, c)
535
+ },
536
+ header: (p) => [
537
+ "Generated by orval 🍺",
538
+ ...p.title ? [p.title] : [],
539
+ ...p.description ? [p.description] : []
540
+ ],
541
+ mutator: {
542
+ name: be(h),
543
+ path: h
544
+ },
545
+ operationName: (p, b, x) => je(p, b, x, c),
546
+ query: {
547
+ useQuery: !0
548
+ }
549
+ },
550
+ schemas: n?.schemas || `src/api/${s}/model`,
551
+ target: n?.target || `src/api/${s}/services/api.ts`,
552
+ ...n
553
+ }
554
+ }
555
+ };
556
+ }, {}), Pe = (e) => e && typeof e == "function", Te = (e) => e && typeof e == "function", He = ({
497
557
  children: e,
498
- defaultQueriesOptions: n,
558
+ defaultQueriesOptions: r,
499
559
  defaultMutationsOptions: o,
500
560
  ...a
501
561
  }) => {
502
- const { libraries: r } = j(S), i = a?.QueryClient || r?.reactQuery?.QueryClient, c = a?.QueryClientProvider || r?.reactQuery?.QueryClientProvider;
562
+ const { libraries: n } = j(S), i = a?.QueryClient || n?.reactQuery?.QueryClient, c = a?.QueryClientProvider || n?.reactQuery?.QueryClientProvider;
503
563
  if (!i)
504
564
  throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
505
565
  if (!c)
506
566
  throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
507
- if (!Re(c))
567
+ if (!Pe(c))
508
568
  throw new Error("Provided QueryClientProvider dependencies are not valid.");
509
- if (!be(i))
569
+ if (!Te(i))
510
570
  throw new Error("Provided QueryClient dependencies are not valid.");
511
- const d = new i({
571
+ const u = new i({
512
572
  defaultOptions: {
513
573
  mutations: {
514
574
  ...o
515
575
  },
516
576
  queries: {
517
- getNextPageParam: (l, u, s) => l.length + (s || 0),
577
+ getNextPageParam: (l, d, s) => l.length + (s || 0),
518
578
  refetchOnWindowFocus: !1,
519
579
  retry: 3,
520
- ...n
580
+ ...r
521
581
  }
522
582
  }
523
583
  });
524
- return /* @__PURE__ */ C.jsx(c, { client: d, children: e });
525
- }, Be = (e) => {
526
- const { libraries: n } = j(S), o = e?.i18 || n?.i18, a = e?.i18?.translateFunction || n?.i18?.translateFunction, r = o?.i18next?.t || a || ((u) => u), { unknownErrorTranslationKey: i = "error.unknownError" } = e || {}, c = r(i), d = L(
527
- (u) => {
528
- if (u && typeof u == "object" && "response" in u) {
529
- const { response: s } = u || {};
530
- if (s && typeof s == "object" && "reason" in s)
531
- return String(s.reason);
532
- if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "reason" in s.data)
533
- return String(s.data.reason);
534
- if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "message" in s.data)
535
- return String(s.data.message);
536
- if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "detail" in s.data) {
537
- const { detail: h } = s.data;
538
- if (Array.isArray(h) && h.length > 0 && typeof h[0] == "object" && h[0] !== null && "msg" in h[0]) {
539
- const { msg: g } = h[0];
540
- if (typeof g == "string")
541
- return String(g);
542
- }
543
- }
544
- }
545
- return u instanceof Error ? u.message : c;
584
+ return /* @__PURE__ */ C.jsx(c, { client: u, children: e });
585
+ }, ke = ({ library: e, date: r, format: o = "ll" }) => e(r).format(o), Ce = (e, r) => {
586
+ const { fractionDigits: o = 0, metric: a = "km", spacingBetween: n = !0 } = r || {}, i = Number(e), c = n ? " " : "";
587
+ return Number.isNaN(i) ? `0${c}${a}` : `${i.toFixed(o)}${c}${a}`;
588
+ }, xe = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((o) => o.length > 0 ? o.charAt(0).toUpperCase() + o.slice(1) : o).join(" "), Ie = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, Oe = ({ path: e, size: r, apiURL: o }) => {
589
+ if (!e)
590
+ return "";
591
+ const a = Ie(e), n = `${o}${a}`, i = n.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
592
+ return typeof r == "number" && i ? `${n.replace("/files", `/thumbs/${r}`)}` : n;
593
+ }, Xe = (e) => {
594
+ const { apiURL: r, libraries: o } = j(S), a = e?.dayjs || o?.dayjs;
595
+ return {
596
+ dateAdapter: (c, u) => {
597
+ if (!a)
598
+ throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
599
+ return ke({
600
+ date: c,
601
+ format: u,
602
+ library: a
603
+ });
546
604
  },
547
- [c]
548
- );
549
- return { getErrorCode: L((u) => {
550
- const { response: s } = u || {};
551
- return s?.error_code ? String(s?.error_code) : s?.data?.error_code ? String(s?.data?.error_code) : s?.error_code ? String(s?.error_code) : s?.data?.error_code ? String(s.data.error_code) : "unknown_error_code";
552
- }, []), printError: d };
553
- }, He = ({
554
- data: e,
555
- fetchNextPage: n,
556
- isFetchingNextPage: o,
557
- isInitialLoading: a,
558
- isLoading: r,
559
- enabled: i = !0
560
- }) => {
561
- const c = L(
562
- async (l) => {
563
- o || !i || await n({ pageParam: l?.pageParam || l.visibleRowsCount });
605
+ distanceAdapter: Ce,
606
+ filePathAdapter: (c, u) => {
607
+ if (!r)
608
+ throw new Error(
609
+ "API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
610
+ );
611
+ return typeof c == "string" && /^https?:\/\//.test(c) ? c : Oe({
612
+ apiURL: r,
613
+ path: c,
614
+ size: u
615
+ });
564
616
  },
565
- [i, n, o]
566
- ), d = G(() => {
567
- if (e)
568
- return e.pages.reduce((l, u) => [...l, ...u], []);
569
- }, [e]);
570
- return {
571
- fetchNextPageOnRowsScrollEnd: c,
572
- isLoading: o || r,
573
- loadingVariant: a ? "skeleton" : "linear-progress",
574
- rows: d
617
+ worksiteNameAdapter: xe
575
618
  };
576
- }, Xe = (e) => {
577
- const { libraries: n } = j(S), o = e?.axios || n?.axios, a = e?.localStorageKey || "user";
619
+ }, Ze = (e) => {
620
+ const { libraries: r } = j(S), o = e?.axios || r?.axios, a = e?.localStorageKey || "user";
578
621
  if (!o)
579
622
  throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
580
- const r = L(
581
- ({ tokenType: c, accessToken: d }) => {
582
- o.defaults.headers.common.Authorization = `${c} ${d}`;
623
+ const n = N(
624
+ ({ tokenType: c, accessToken: u }) => {
625
+ o.defaults.headers.common.Authorization = `${c} ${u}`;
583
626
  },
584
627
  [o.defaults.headers.common]
585
628
  ), i = () => {
@@ -588,71 +631,37 @@ const S = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
588
631
  return k(() => {
589
632
  if ($)
590
633
  return;
591
- const c = ({ newValue: d, key: l }) => {
592
- if (l === a && d)
634
+ const c = ({ newValue: u, key: l }) => {
635
+ if (l === a && u)
593
636
  try {
594
- const { accessToken: u, tokenType: s } = JSON.parse(d);
595
- r({ accessToken: u, tokenType: s });
596
- } catch (u) {
597
- console.error("Failed to parse newValue from localStorage:", u);
637
+ const { accessToken: d, tokenType: s } = JSON.parse(u);
638
+ n({ accessToken: d, tokenType: s });
639
+ } catch (d) {
640
+ console.error("Failed to parse newValue from localStorage:", d);
598
641
  }
599
642
  };
600
643
  return window.addEventListener("storage", c), () => {
601
644
  window.removeEventListener("storage", c);
602
645
  };
603
- }, [a, r]), {
646
+ }, [a, n]), {
604
647
  clearAuthenticationToken: i,
605
- setAuthenticationToken: r
606
- };
607
- }, Ae = ({ library: e, date: n, format: o = "ll" }) => e(n).format(o), Se = (e, n) => {
608
- const { fractionDigits: o = 0, metric: a = "km", spacingBetween: r = !0 } = n || {}, i = Number(e), c = r ? " " : "";
609
- return Number.isNaN(i) ? `0${c}${a}` : `${i.toFixed(o)}${c}${a}`;
610
- }, je = (e) => !e || typeof e != "string" ? "" : e.replace(/_/g, " ").toLowerCase().split(" ").map((o) => o.length > 0 ? o.charAt(0).toUpperCase() + o.slice(1) : o).join(" "), _e = (e) => e?.startsWith("/") ? e?.startsWith("/files") ? e : `/files${e}` : e?.startsWith("files") ? `/${e}` : `/files/${e}`, Pe = ({ path: e, size: n, apiURL: o }) => {
611
- if (!e)
612
- return "";
613
- const a = _e(e), r = `${o}${a}`, i = r.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
614
- return typeof n == "number" && i ? `${r.replace("/files", `/thumbs/${n}`)}` : r;
615
- }, Ze = (e) => {
616
- const { apiURL: n, libraries: o } = j(S), a = e?.dayjs || o?.dayjs;
617
- return {
618
- dateAdapter: (c, d) => {
619
- if (!a)
620
- throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
621
- return Ae({
622
- date: c,
623
- format: d,
624
- library: a
625
- });
626
- },
627
- distanceAdapter: Se,
628
- filePathAdapter: (c, d) => {
629
- if (!n)
630
- throw new Error(
631
- "API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter."
632
- );
633
- return typeof c == "string" && /^https?:\/\//.test(c) ? c : Pe({
634
- apiURL: n,
635
- path: c,
636
- size: d
637
- });
638
- },
639
- worksiteNameAdapter: je
648
+ setAuthenticationToken: n
640
649
  };
641
- }, Y = (e, n) => n === "short" ? e.split("-")[0] : e, et = (e, n = "full") => {
650
+ }, Y = (e, r) => r === "short" ? e.split("-")[0] : e, et = (e, r = "full") => {
642
651
  const [o, a] = W(() => {
643
- const r = e?.language || navigator.language;
644
- return e && "isInitialized" in e && e.isInitialized, Y(r, n);
652
+ const n = e?.language || navigator.language;
653
+ return e && "isInitialized" in e && e.isInitialized, Y(n, r);
645
654
  });
646
655
  return k(() => {
647
- e && "isInitialized" in e && e.isInitialized && e.language && a(Y(e.language, n));
648
- const r = (i) => {
649
- a(Y(i, n));
656
+ e && "isInitialized" in e && e.isInitialized && e.language && a(Y(e.language, r));
657
+ const n = (i) => {
658
+ a(Y(i, r));
650
659
  };
651
- return e?.on?.("languageChanged", r), () => {
652
- e?.off?.("languageChanged", r);
660
+ return e?.on?.("languageChanged", n), () => {
661
+ e?.off?.("languageChanged", n);
653
662
  };
654
- }, [e, n]), o;
655
- }, Te = "tracktor.filter", ke = {
663
+ }, [e, r]), o;
664
+ }, Ne = "tracktor.filter", Le = {
656
665
  getFilter: () => {
657
666
  },
658
667
  getFilters: () => ({}),
@@ -660,41 +669,41 @@ const S = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
660
669
  },
661
670
  setFilter: () => {
662
671
  }
663
- }, oe = (e, n, o) => `${o}_${e}=>${n}`, Ce = (e) => e.reduce((n, o) => {
672
+ }, oe = (e, r, o) => `${o}_${e}=>${r}`, Fe = (e) => e.reduce((r, o) => {
664
673
  const a = localStorage.getItem(o);
665
674
  if (a)
666
675
  try {
667
- const r = JSON.parse(a), i = Object.keys(r)?.[0];
668
- i && (n[i] = Object.values(r)?.[0]);
676
+ const n = JSON.parse(a), i = Object.keys(n)?.[0];
677
+ i && (r[i] = Object.values(n)?.[0]);
669
678
  } catch {
670
679
  }
671
- return n;
680
+ return r;
672
681
  }, {}), tt = (e) => {
673
- const { libraries: n, localStorageKeys: o } = j(S), a = e?.reactRouter || n?.reactRouter, { pathname: r } = a?.useLocation?.() ?? { pathname: "/" }, [i, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
674
- }], [d, l] = W({}), u = o?.filter || Te, s = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl;
682
+ const { libraries: r, localStorageKeys: o } = j(S), a = e?.reactRouter || r?.reactRouter, { pathname: n } = a?.useLocation?.() ?? { pathname: "/" }, [i, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
683
+ }], [u, l] = W({}), d = o?.filter || Ne, s = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl;
675
684
  if ($)
676
- return ke;
685
+ return Le;
677
686
  if (!a)
678
687
  throw new Error(
679
688
  "React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
680
689
  );
681
690
  const h = () => Object.keys(localStorage).filter(
682
- (m) => m.startsWith(u) && m.endsWith(e?.pathname || r)
683
- ), g = (m, y, _ = !0) => {
684
- const p = oe(m, e?.pathname || r, u);
691
+ (m) => m.startsWith(d) && m.endsWith(e?.pathname || n)
692
+ ), p = (m, y, _ = !0) => {
693
+ const g = oe(m, e?.pathname || n, d);
685
694
  if (!y || Array.isArray(y) && !y.length) {
686
695
  s ? (i.delete(m), c(i)) : l((w) => {
687
696
  const P = { ...w };
688
697
  return delete P[m], P;
689
- }), localStorage.removeItem(p);
698
+ }), localStorage.removeItem(g);
690
699
  return;
691
700
  }
692
- _ && y && localStorage.setItem(p, JSON.stringify({ ...i, [m]: y })), s && y ? (i.set(m, JSON.stringify(y)), c(i)) : !s && y && l((w) => ({ ...w, [m]: y }));
701
+ _ && y && localStorage.setItem(g, JSON.stringify({ ...i, [m]: y })), s && y ? (i.set(m, JSON.stringify(y)), c(i)) : !s && y && l((w) => ({ ...w, [m]: y }));
693
702
  };
694
703
  return {
695
704
  getFilter: (m, y) => {
696
705
  if (!s) {
697
- const w = d[m];
706
+ const w = u[m];
698
707
  if (w !== void 0)
699
708
  return w;
700
709
  }
@@ -707,17 +716,17 @@ const S = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
707
716
  return w;
708
717
  }
709
718
  }
710
- const _ = oe(m, e?.pathname || r, u), p = localStorage.getItem(_);
711
- if (p)
719
+ const _ = oe(m, e?.pathname || n, d), g = localStorage.getItem(_);
720
+ if (g)
712
721
  try {
713
- const w = JSON.parse(p)[m];
722
+ const w = JSON.parse(g)[m];
714
723
  return !s && w !== void 0 && l((P) => ({ ...P, [m]: w })), w;
715
724
  } catch {
716
725
  }
717
726
  return y;
718
727
  },
719
728
  getFilters: () => {
720
- const m = h(), y = Ce(m);
729
+ const m = h(), y = Fe(m);
721
730
  if (s) {
722
731
  const _ = Object.fromEntries(i.entries());
723
732
  return {
@@ -727,102 +736,93 @@ const S = pe({}), Ye = ({ children: e, apiURL: n, libraries: o, localStorageKeys
727
736
  }
728
737
  return {
729
738
  ...y,
730
- ...d
739
+ ...u
731
740
  };
732
741
  },
733
- handleFilter: (m, y) => (_, p) => {
734
- if (p || Array.isArray(p) && p.length === 0) {
735
- const w = y || "value", P = typeof p == "object" && w in p ? p[w] : p;
736
- g(m, P);
742
+ handleFilter: (m, y) => (_, g) => {
743
+ if (g || Array.isArray(g) && g.length === 0) {
744
+ const w = y || "value", P = typeof g == "object" && w in g ? g[w] : g;
745
+ p(m, P);
737
746
  return;
738
747
  }
739
- g(m, void 0);
748
+ p(m, void 0);
740
749
  },
741
- setFilter: g
750
+ setFilter: p
742
751
  };
743
- }, xe = (e) => e.charAt(0).toUpperCase() + e.slice(1).toLowerCase(), Ie = (e) => {
744
- const a = e.split("/").filter((r) => r.length > 0).map((r) => r.replace(/\${([^}]*)}/g, "$1").split(/[_-]/).map((l) => l.charAt(0).toUpperCase() + l.slice(1)).join("")).join("");
745
- return a.charAt(0).toLowerCase() + a.slice(1);
746
- }, Oe = (e) => (e.split("/").pop() || e).replace(/\.json$/, "").replace(/^openapi\./, ""), Le = (e, n, o, a) => {
747
- const r = Ie(n), i = xe(o), c = `${r}${i}`;
748
- return e && typeof e == "object" && "operationId" in e && a?.includes(String(e.operationId)) ? `${c}AsQuery` : c;
749
- }, Ne = (e, n) => {
750
- const o = {};
751
- return e?.forEach((a) => {
752
- o[a] = {
753
- query: {
754
- useInfinite: !0,
755
- useInfiniteQueryParam: "offset",
756
- useQuery: !0
757
- }
758
- };
759
- }), n?.filter((a) => !o[a]).forEach((a) => {
760
- o[a] = {
761
- query: {
762
- useQuery: !0
763
- }
764
- };
765
- }), Object.keys(o).length ? o : void 0;
766
- }, rt = (e) => (Array.isArray(e) ? e : [e]).reduce((o, a) => {
767
- const { output: r, useInfiniteIds: i, useQueryIds: c, input: d = "./openapi.json" } = a || {}, l = Oe(d);
752
+ }, rt = ({
753
+ data: e,
754
+ fetchNextPage: r,
755
+ isFetchingNextPage: o,
756
+ isInitialLoading: a,
757
+ isLoading: n,
758
+ enabled: i = !0
759
+ }) => {
760
+ const c = N(
761
+ async (l) => {
762
+ o || !i || await r({ pageParam: l?.pageParam || l.visibleRowsCount });
763
+ },
764
+ [i, r, o]
765
+ ), u = G(() => {
766
+ if (e)
767
+ return e.pages.reduce((l, d) => [...l, ...d], []);
768
+ }, [e]);
768
769
  return {
769
- ...o,
770
- [l]: {
771
- hooks: {
772
- afterAllFilesWrite: "prettier src/api/ --write"
773
- },
774
- input: d,
775
- output: {
776
- baseUrl: r?.baseUrl,
777
- client: "react-query",
778
- mode: "tags-split",
779
- override: {
780
- ...(i?.length || c?.length) && {
781
- operations: Ne(i, c)
782
- },
783
- header: (u) => [
784
- "Generated by orval 🍺",
785
- ...u.title ? [u.title] : [],
786
- ...u.description ? [u.description] : []
787
- ],
788
- mutator: {
789
- name: "axiosCustomInstance",
790
- path: a?.customAxiosInstancePath || "./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"
791
- },
792
- operationName: (u, s, h) => Le(u, s, h, c),
793
- query: {
794
- useQuery: !0
770
+ fetchNextPageOnRowsScrollEnd: c,
771
+ isLoading: o || n,
772
+ loadingVariant: a ? "skeleton" : "linear-progress",
773
+ rows: u
774
+ };
775
+ }, nt = (e) => {
776
+ const { libraries: r } = j(S), o = e?.i18 || r?.i18, a = e?.i18?.translateFunction || r?.i18?.translateFunction, n = o?.i18next?.t || a || ((d) => d), { unknownErrorTranslationKey: i = "error.unknownError" } = e || {}, c = n(i), u = N(
777
+ (d) => {
778
+ if (d && typeof d == "object" && "response" in d) {
779
+ const { response: s } = d || {};
780
+ if (s && typeof s == "object" && "reason" in s)
781
+ return String(s.reason);
782
+ if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "reason" in s.data)
783
+ return String(s.data.reason);
784
+ if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "message" in s.data)
785
+ return String(s.data.message);
786
+ if (s && typeof s == "object" && "data" in s && s.data && typeof s.data == "object" && "detail" in s.data) {
787
+ const { detail: h } = s.data;
788
+ if (Array.isArray(h) && h.length > 0 && typeof h[0] == "object" && h[0] !== null && "msg" in h[0]) {
789
+ const { msg: p } = h[0];
790
+ if (typeof p == "string")
791
+ return String(p);
795
792
  }
796
- },
797
- schemas: r?.schemas || `src/api/${l}/model`,
798
- target: r?.target || `src/api/${l}/services/api.ts`,
799
- ...r
793
+ }
800
794
  }
801
- }
802
- };
803
- }, {});
795
+ return d instanceof Error ? d.message : c;
796
+ },
797
+ [c]
798
+ );
799
+ return { getErrorCode: N((d) => {
800
+ const { response: s } = d || {};
801
+ return s?.error_code ? String(s?.error_code) : s?.data?.error_code ? String(s?.data?.error_code) : s?.error_code ? String(s?.error_code) : s?.data?.error_code ? String(s.data.error_code) : "unknown_error_code";
802
+ }, []), printError: u };
803
+ };
804
804
  export {
805
- ze as GTMSendPageView,
806
- Ue as InitializeAxiosConfig,
807
- Ge as InitializeDaysJSConfig,
808
- Qe as InitializeI18nConfig,
809
- Me as InitializeSentryConfig,
805
+ Ue as GTMSendPageView,
806
+ Qe as InitializeAxiosConfig,
807
+ Ve as InitializeDaysJSConfig,
808
+ Me as InitializeI18nConfig,
809
+ Ge as InitializeSentryConfig,
810
810
  S as InjectDependenciesContext,
811
- Ye as InjectDependenciesProvider,
812
- Ve as MaskTextField,
811
+ ze as InjectDependenciesProvider,
812
+ We as MaskTextField,
813
813
  Je as PreloadErrorHandler,
814
- qe as QueryClientProviderWithConfig,
815
- We as RequireAuth,
816
- Ke as UpdateNotifier,
817
- De as axiosCustomInstance,
818
- Ae as dateAdapter,
819
- Se as distanceAdapter,
820
- rt as getOrvalConfig,
821
- Ze as useAdapter,
822
- Xe as useAuth,
814
+ He as QueryClientProviderWithConfig,
815
+ Ke as RequireAuth,
816
+ qe as UpdateNotifier,
817
+ Ye as axiosCustomInstance,
818
+ ke as dateAdapter,
819
+ Ce as distanceAdapter,
820
+ Be as getOrvalConfig,
821
+ Xe as useAdapter,
822
+ Ze as useAuth,
823
823
  et as useCurrentLanguage,
824
824
  tt as useFilters,
825
- He as useInfiniteDataGrid,
826
- Be as useResponseError,
827
- je as worksiteNameAdapter
825
+ rt as useInfiniteDataGrid,
826
+ nt as useResponseError,
827
+ xe as worksiteNameAdapter
828
828
  };