@tracktor/shared-module 2.19.0 → 2.19.3

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