@tracktor/shared-module 2.19.6 → 2.20.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/hooks/useFilters.d.ts +5 -0
- package/dist/main.js +161 -160
- package/dist/main.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import fe, { useMemo as
|
|
1
|
+
import Z from "axios";
|
|
2
|
+
import fe, { useMemo as G, createContext as pe, useContext as P, useEffect as j, useState as W, useRef as ae, Suspense as ge, useCallback as O } from "react";
|
|
3
3
|
const Ye = (e, r) => {
|
|
4
|
-
const o =
|
|
4
|
+
const o = Z.CancelToken.source(), a = Z({
|
|
5
5
|
...e,
|
|
6
6
|
...r,
|
|
7
7
|
cancelToken: o.token
|
|
@@ -10,11 +10,11 @@ const Ye = (e, r) => {
|
|
|
10
10
|
o.cancel("Query was cancelled");
|
|
11
11
|
}, a;
|
|
12
12
|
};
|
|
13
|
-
var
|
|
14
|
-
var
|
|
13
|
+
var D = { exports: {} }, L = {};
|
|
14
|
+
var ee;
|
|
15
15
|
function me() {
|
|
16
|
-
if (
|
|
17
|
-
|
|
16
|
+
if (ee) return L;
|
|
17
|
+
ee = 1;
|
|
18
18
|
var e = /* @__PURE__ */ Symbol.for("react.transitional.element"), r = /* @__PURE__ */ Symbol.for("react.fragment");
|
|
19
19
|
function o(a, n, i) {
|
|
20
20
|
var c = null;
|
|
@@ -31,25 +31,25 @@ function me() {
|
|
|
31
31
|
props: i
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return L.Fragment = r, L.jsx = o, L.jsxs = o, L;
|
|
35
35
|
}
|
|
36
36
|
var N = {};
|
|
37
|
-
var
|
|
37
|
+
var te;
|
|
38
38
|
function ye() {
|
|
39
|
-
return
|
|
39
|
+
return te || (te = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
40
40
|
function e(t) {
|
|
41
41
|
if (t == null) return null;
|
|
42
42
|
if (typeof t == "function")
|
|
43
43
|
return t.$$typeof === le ? null : t.displayName || t.name || null;
|
|
44
44
|
if (typeof t == "string") return t;
|
|
45
45
|
switch (t) {
|
|
46
|
-
case
|
|
46
|
+
case k:
|
|
47
47
|
return "Fragment";
|
|
48
|
-
case
|
|
48
|
+
case E:
|
|
49
49
|
return "Profiler";
|
|
50
|
-
case
|
|
50
|
+
case g:
|
|
51
51
|
return "StrictMode";
|
|
52
|
-
case
|
|
52
|
+
case I:
|
|
53
53
|
return "Suspense";
|
|
54
54
|
case se:
|
|
55
55
|
return "SuspenseList";
|
|
@@ -60,18 +60,18 @@ function ye() {
|
|
|
60
60
|
switch (typeof t.tag == "number" && console.error(
|
|
61
61
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
62
62
|
), t.$$typeof) {
|
|
63
|
-
case
|
|
63
|
+
case A:
|
|
64
64
|
return "Portal";
|
|
65
|
-
case
|
|
65
|
+
case _:
|
|
66
66
|
return t.displayName || "Context";
|
|
67
|
-
case
|
|
67
|
+
case m:
|
|
68
68
|
return (t._context.displayName || "Context") + ".Consumer";
|
|
69
|
-
case
|
|
69
|
+
case b:
|
|
70
70
|
var f = t.render;
|
|
71
71
|
return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
|
|
72
72
|
case ie:
|
|
73
73
|
return f = t.displayName || null, f !== null ? f : e(t.type) || "Memo";
|
|
74
|
-
case
|
|
74
|
+
case z:
|
|
75
75
|
f = t._payload, t = t._init;
|
|
76
76
|
try {
|
|
77
77
|
return e(t(f));
|
|
@@ -92,8 +92,8 @@ function ye() {
|
|
|
92
92
|
}
|
|
93
93
|
if (f) {
|
|
94
94
|
f = console;
|
|
95
|
-
var
|
|
96
|
-
return
|
|
95
|
+
var h = f.error, w = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
96
|
+
return h.call(
|
|
97
97
|
f,
|
|
98
98
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
99
99
|
w
|
|
@@ -101,8 +101,8 @@ function ye() {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
function a(t) {
|
|
104
|
-
if (t ===
|
|
105
|
-
if (typeof t == "object" && t !== null && t.$$typeof ===
|
|
104
|
+
if (t === k) return "<>";
|
|
105
|
+
if (typeof t == "object" && t !== null && t.$$typeof === z)
|
|
106
106
|
return "<...>";
|
|
107
107
|
try {
|
|
108
108
|
var f = e(t);
|
|
@@ -112,44 +112,44 @@ function ye() {
|
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
function n() {
|
|
115
|
-
var t =
|
|
115
|
+
var t = U.A;
|
|
116
116
|
return t === null ? null : t.getOwner();
|
|
117
117
|
}
|
|
118
118
|
function i() {
|
|
119
119
|
return Error("react-stack-top-frame");
|
|
120
120
|
}
|
|
121
121
|
function c(t) {
|
|
122
|
-
if (
|
|
122
|
+
if (J.call(t, "key")) {
|
|
123
123
|
var f = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
124
124
|
if (f && f.isReactWarning) return !1;
|
|
125
125
|
}
|
|
126
126
|
return t.key !== void 0;
|
|
127
127
|
}
|
|
128
128
|
function u(t, f) {
|
|
129
|
-
function
|
|
130
|
-
|
|
129
|
+
function h() {
|
|
130
|
+
K || (K = !0, console.error(
|
|
131
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)",
|
|
132
132
|
f
|
|
133
133
|
));
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
get:
|
|
135
|
+
h.isReactWarning = !0, Object.defineProperty(t, "key", {
|
|
136
|
+
get: h,
|
|
137
137
|
configurable: !0
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
function l() {
|
|
141
141
|
var t = e(this.type);
|
|
142
|
-
return
|
|
142
|
+
return q[t] || (q[t] = !0, console.error(
|
|
143
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."
|
|
144
144
|
)), t = this.props.ref, t !== void 0 ? t : null;
|
|
145
145
|
}
|
|
146
|
-
function d(t, f,
|
|
147
|
-
var R =
|
|
146
|
+
function d(t, f, h, w, $, V) {
|
|
147
|
+
var R = h.ref;
|
|
148
148
|
return t = {
|
|
149
|
-
$$typeof:
|
|
149
|
+
$$typeof: T,
|
|
150
150
|
type: t,
|
|
151
151
|
key: f,
|
|
152
|
-
props:
|
|
152
|
+
props: h,
|
|
153
153
|
_owner: w
|
|
154
154
|
}, (R !== void 0 ? R : null) !== null ? Object.defineProperty(t, "ref", {
|
|
155
155
|
enumerable: !1,
|
|
@@ -168,15 +168,15 @@ function ye() {
|
|
|
168
168
|
configurable: !1,
|
|
169
169
|
enumerable: !1,
|
|
170
170
|
writable: !0,
|
|
171
|
-
value:
|
|
171
|
+
value: $
|
|
172
172
|
}), Object.defineProperty(t, "_debugTask", {
|
|
173
173
|
configurable: !1,
|
|
174
174
|
enumerable: !1,
|
|
175
175
|
writable: !0,
|
|
176
|
-
value:
|
|
176
|
+
value: V
|
|
177
177
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
178
178
|
}
|
|
179
|
-
function s(t, f,
|
|
179
|
+
function s(t, f, h, w, $, V) {
|
|
180
180
|
var R = f.children;
|
|
181
181
|
if (R !== void 0)
|
|
182
182
|
if (w)
|
|
@@ -189,12 +189,12 @@ function ye() {
|
|
|
189
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."
|
|
190
190
|
);
|
|
191
191
|
else y(R);
|
|
192
|
-
if (
|
|
192
|
+
if (J.call(f, "key")) {
|
|
193
193
|
R = e(t);
|
|
194
|
-
var
|
|
194
|
+
var x = Object.keys(f).filter(function(de) {
|
|
195
195
|
return de !== "key";
|
|
196
196
|
});
|
|
197
|
-
w = 0 <
|
|
197
|
+
w = 0 < x.length ? "{key: someKey, " + x.join(": ..., ") + ": ...}" : "{key: someKey}", X[R + w] || (x = 0 < x.length ? "{" + x.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
198
198
|
`A props object containing a "key" prop is being spread into JSX:
|
|
199
199
|
let props = %s;
|
|
200
200
|
<%s {...props} />
|
|
@@ -203,82 +203,82 @@ React keys must be passed directly to JSX without using spread:
|
|
|
203
203
|
<%s key={someKey} {...props} />`,
|
|
204
204
|
w,
|
|
205
205
|
R,
|
|
206
|
-
|
|
206
|
+
x,
|
|
207
207
|
R
|
|
208
|
-
),
|
|
208
|
+
), X[R + w] = !0);
|
|
209
209
|
}
|
|
210
|
-
if (R = null,
|
|
211
|
-
|
|
212
|
-
for (var
|
|
213
|
-
|
|
214
|
-
} else
|
|
210
|
+
if (R = null, h !== void 0 && (o(h), R = "" + h), c(f) && (o(f.key), R = "" + f.key), "key" in f) {
|
|
211
|
+
h = {};
|
|
212
|
+
for (var M in f)
|
|
213
|
+
M !== "key" && (h[M] = f[M]);
|
|
214
|
+
} else h = f;
|
|
215
215
|
return R && u(
|
|
216
|
-
|
|
216
|
+
h,
|
|
217
217
|
typeof t == "function" ? t.displayName || t.name || "Unknown" : t
|
|
218
218
|
), d(
|
|
219
219
|
t,
|
|
220
220
|
R,
|
|
221
|
-
|
|
221
|
+
h,
|
|
222
222
|
n(),
|
|
223
|
-
|
|
224
|
-
|
|
223
|
+
$,
|
|
224
|
+
V
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
227
|
function y(t) {
|
|
228
|
-
p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof ===
|
|
228
|
+
p(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === z && (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
229
|
}
|
|
230
230
|
function p(t) {
|
|
231
|
-
return typeof t == "object" && t !== null && t.$$typeof ===
|
|
231
|
+
return typeof t == "object" && t !== null && t.$$typeof === T;
|
|
232
232
|
}
|
|
233
|
-
var
|
|
233
|
+
var v = fe, T = /* @__PURE__ */ Symbol.for("react.transitional.element"), A = /* @__PURE__ */ Symbol.for("react.portal"), k = /* @__PURE__ */ Symbol.for("react.fragment"), g = /* @__PURE__ */ Symbol.for("react.strict_mode"), E = /* @__PURE__ */ Symbol.for("react.profiler"), m = /* @__PURE__ */ Symbol.for("react.consumer"), _ = /* @__PURE__ */ Symbol.for("react.context"), b = /* @__PURE__ */ Symbol.for("react.forward_ref"), I = /* @__PURE__ */ Symbol.for("react.suspense"), se = /* @__PURE__ */ Symbol.for("react.suspense_list"), ie = /* @__PURE__ */ Symbol.for("react.memo"), z = /* @__PURE__ */ Symbol.for("react.lazy"), ce = /* @__PURE__ */ Symbol.for("react.activity"), le = /* @__PURE__ */ Symbol.for("react.client.reference"), U = v.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, J = Object.prototype.hasOwnProperty, ue = Array.isArray, Q = console.createTask ? console.createTask : function() {
|
|
234
234
|
return null;
|
|
235
235
|
};
|
|
236
|
-
|
|
236
|
+
v = {
|
|
237
237
|
react_stack_bottom_frame: function(t) {
|
|
238
238
|
return t();
|
|
239
239
|
}
|
|
240
240
|
};
|
|
241
|
-
var
|
|
242
|
-
|
|
241
|
+
var K, q = {}, B = v.react_stack_bottom_frame.bind(
|
|
242
|
+
v,
|
|
243
243
|
i
|
|
244
|
-
)(),
|
|
245
|
-
N.Fragment =
|
|
246
|
-
var w = 1e4 >
|
|
244
|
+
)(), H = Q(a(i)), X = {};
|
|
245
|
+
N.Fragment = k, N.jsx = function(t, f, h) {
|
|
246
|
+
var w = 1e4 > U.recentlyCreatedOwnerStacks++;
|
|
247
247
|
return s(
|
|
248
248
|
t,
|
|
249
249
|
f,
|
|
250
|
-
|
|
250
|
+
h,
|
|
251
251
|
!1,
|
|
252
|
-
w ? Error("react-stack-top-frame") :
|
|
253
|
-
w ?
|
|
252
|
+
w ? Error("react-stack-top-frame") : B,
|
|
253
|
+
w ? Q(a(t)) : H
|
|
254
254
|
);
|
|
255
|
-
}, N.jsxs = function(t, f,
|
|
256
|
-
var w = 1e4 >
|
|
255
|
+
}, N.jsxs = function(t, f, h) {
|
|
256
|
+
var w = 1e4 > U.recentlyCreatedOwnerStacks++;
|
|
257
257
|
return s(
|
|
258
258
|
t,
|
|
259
259
|
f,
|
|
260
|
-
|
|
260
|
+
h,
|
|
261
261
|
!0,
|
|
262
|
-
w ? Error("react-stack-top-frame") :
|
|
263
|
-
w ?
|
|
262
|
+
w ? Error("react-stack-top-frame") : B,
|
|
263
|
+
w ? Q(a(t)) : H
|
|
264
264
|
);
|
|
265
265
|
};
|
|
266
266
|
})()), N;
|
|
267
267
|
}
|
|
268
|
-
var
|
|
268
|
+
var re;
|
|
269
269
|
function he() {
|
|
270
|
-
return
|
|
270
|
+
return re || (re = 1, process.env.NODE_ENV === "production" ? D.exports = me() : D.exports = ye()), D.exports;
|
|
271
271
|
}
|
|
272
272
|
var C = he();
|
|
273
273
|
const We = ({ IMaskMixin: e, ...r }) => {
|
|
274
|
-
const o =
|
|
274
|
+
const o = G(
|
|
275
275
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
276
276
|
() => e(({ TextField: a, ...n }) => /* @__PURE__ */ C.jsx(a, { ...n })),
|
|
277
277
|
[e]
|
|
278
278
|
);
|
|
279
279
|
return /* @__PURE__ */ C.jsx(o, { ...r });
|
|
280
|
-
},
|
|
281
|
-
const n =
|
|
280
|
+
}, S = pe({}), ze = ({ children: e, apiURL: r, libraries: o, localStorageKeys: a }) => {
|
|
281
|
+
const n = G(
|
|
282
282
|
() => ({
|
|
283
283
|
apiURL: r,
|
|
284
284
|
libraries: o,
|
|
@@ -286,9 +286,9 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
286
286
|
}),
|
|
287
287
|
[r, o, a]
|
|
288
288
|
);
|
|
289
|
-
return /* @__PURE__ */ C.jsx(
|
|
289
|
+
return /* @__PURE__ */ C.jsx(S.Provider, { value: n, children: e });
|
|
290
290
|
}, Ue = ({ data: e, ...r }) => {
|
|
291
|
-
const { libraries: o } = P(
|
|
291
|
+
const { libraries: o } = P(S), a = r?.reactRouter || o?.reactRouter, n = r?.gtm || o?.gtm;
|
|
292
292
|
if (!a)
|
|
293
293
|
throw new Error(
|
|
294
294
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
@@ -303,7 +303,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
303
303
|
...e
|
|
304
304
|
});
|
|
305
305
|
}, [e, l, d]), /* @__PURE__ */ C.jsx(u, {});
|
|
306
|
-
},
|
|
306
|
+
}, F = (() => {
|
|
307
307
|
try {
|
|
308
308
|
return typeof global == "object" && global !== null && ("HermesInternal" in global || // Hermes JS engine
|
|
309
309
|
"__fbBatchedBridge" in global || // RN Bridge
|
|
@@ -317,18 +317,18 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
317
317
|
postContentType: o = "application/json",
|
|
318
318
|
...a
|
|
319
319
|
}) => {
|
|
320
|
-
const { apiURL: n = a.apiURL, libraries: i, localStorageKeys: c } = P(
|
|
320
|
+
const { apiURL: n = a.apiURL, libraries: i, localStorageKeys: c } = P(S), u = a?.userLocalStorageKey || c?.user || ve, l = a?.axios || i?.axios;
|
|
321
321
|
if (!l)
|
|
322
322
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
323
|
-
if (!l?.defaults ||
|
|
323
|
+
if (!l?.defaults || F)
|
|
324
324
|
return null;
|
|
325
325
|
if (typeof window < "u" && window.localStorage) {
|
|
326
|
-
const d = localStorage.getItem(u), s = d ? JSON.parse(d) : null, y = s?.[e] ? s[e] : null, p = s?.[r] ? s[r] : null,
|
|
327
|
-
|
|
326
|
+
const d = localStorage.getItem(u), s = d ? JSON.parse(d) : null, y = s?.[e] ? s[e] : null, p = s?.[r] ? s[r] : null, v = d ? `${y} ${p}` : null;
|
|
327
|
+
v && (l.defaults.headers.common.Authorization = v);
|
|
328
328
|
}
|
|
329
329
|
return l.defaults.baseURL = n, l.defaults.headers.post["Content-Type"] = o, null;
|
|
330
330
|
}, Ve = ({ language: e, ...r }) => {
|
|
331
|
-
const { libraries: o } = P(
|
|
331
|
+
const { libraries: o } = P(S), a = r?.dayjs || o?.dayjs, n = r?.plugin || o?.dayjsPlugin;
|
|
332
332
|
if (!a)
|
|
333
333
|
throw new Error(
|
|
334
334
|
"Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
|
|
@@ -342,8 +342,8 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
342
342
|
})().then();
|
|
343
343
|
}, [a, n, e]), null;
|
|
344
344
|
}, Me = ({ debug: e, resources: r, ...o }) => {
|
|
345
|
-
const { libraries: a } = P(
|
|
346
|
-
if (
|
|
345
|
+
const { libraries: a } = P(S), n = o?.i18 || a?.i18, { i18next: i, initReactI18next: c, languageDetector: u } = n || {};
|
|
346
|
+
if (F)
|
|
347
347
|
return null;
|
|
348
348
|
if (!n)
|
|
349
349
|
throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
@@ -378,14 +378,14 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
378
378
|
release: d,
|
|
379
379
|
...s
|
|
380
380
|
}) => {
|
|
381
|
-
const { libraries: y } = P(
|
|
381
|
+
const { libraries: y } = P(S), p = s?.sentry || y?.sentry, v = s?.reactRouter || y?.reactRouter;
|
|
382
382
|
if (!p)
|
|
383
383
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
384
|
-
if (!
|
|
384
|
+
if (!v)
|
|
385
385
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
386
386
|
if (p.isInitialized())
|
|
387
387
|
return null;
|
|
388
|
-
const { createRoutesFromChildren:
|
|
388
|
+
const { createRoutesFromChildren: T, matchRoutes: A, useLocation: k, useNavigationType: g } = v;
|
|
389
389
|
return (u || process.env.NODE_ENV === "prod" || process.env.NODE_ENV === "production") && p.init({
|
|
390
390
|
debug: u,
|
|
391
391
|
dsn: e,
|
|
@@ -401,11 +401,11 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
401
401
|
],
|
|
402
402
|
integrations: [
|
|
403
403
|
p.reactRouterV6BrowserTracingIntegration({
|
|
404
|
-
createRoutesFromChildren:
|
|
405
|
-
matchRoutes:
|
|
404
|
+
createRoutesFromChildren: T,
|
|
405
|
+
matchRoutes: A,
|
|
406
406
|
useEffect: j,
|
|
407
|
-
useLocation:
|
|
408
|
-
useNavigationType:
|
|
407
|
+
useLocation: k,
|
|
408
|
+
useNavigationType: g
|
|
409
409
|
}),
|
|
410
410
|
...r || []
|
|
411
411
|
],
|
|
@@ -416,7 +416,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
416
416
|
tracesSampleRate: o || 1
|
|
417
417
|
}), null;
|
|
418
418
|
}, Je = () => (j(() => {
|
|
419
|
-
if (
|
|
419
|
+
if (F)
|
|
420
420
|
return;
|
|
421
421
|
const e = (r) => {
|
|
422
422
|
try {
|
|
@@ -428,16 +428,16 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
428
428
|
window.removeEventListener("vite:preloadError", e);
|
|
429
429
|
};
|
|
430
430
|
}, []), null), Ee = "user", Ke = ({ Fallback: e, isLogged: r, loginPath: o = "/login", redirect401Path: a = "/login", ...n }) => {
|
|
431
|
-
const { libraries: i, localStorageKeys: c } = P(
|
|
431
|
+
const { libraries: i, localStorageKeys: c } = P(S), u = n?.reactRouter || i?.reactRouter, l = n?.axios || i?.axios, d = n?.localStorageKey || c?.user || Ee;
|
|
432
432
|
if (!u)
|
|
433
433
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
434
|
-
const [s, y] =
|
|
434
|
+
const [s, y] = W(null), { useLocation: p, Navigate: v, Outlet: T } = u, A = p(), k = ae(!1), g = typeof r == "function" ? r() : !!r, E = typeof g == "boolean" ? g : g?.isLogged;
|
|
435
435
|
return j(() => {
|
|
436
|
-
|
|
437
|
-
(
|
|
438
|
-
async (
|
|
436
|
+
k.current || (k.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))
|
|
439
439
|
));
|
|
440
|
-
}, [l.defaults.headers.common, l.interceptors.response, d, a]),
|
|
440
|
+
}, [l.defaults.headers.common, l.interceptors.response, d, a]), E && !s ? /* @__PURE__ */ C.jsx(ge, { fallback: e, children: A.state?.from?.state && A.state?.from?.pathname === o ? /* @__PURE__ */ C.jsx(v, { to: A.state.from.state.from.pathname + A.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ C.jsx(T, {}) }) : /* @__PURE__ */ C.jsx(v, { to: o + A.search, state: { from: A }, replace: !0 });
|
|
441
441
|
}, we = async () => {
|
|
442
442
|
if ("caches" in window)
|
|
443
443
|
try {
|
|
@@ -447,13 +447,13 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
447
447
|
console.error("Failed to clear caches:", e);
|
|
448
448
|
}
|
|
449
449
|
}, qe = ({ autoUpdate: e, renderDialog: r, clearCachesOnReload: o }) => {
|
|
450
|
-
const a =
|
|
450
|
+
const a = ae(null), [n, i] = W(!1), c = O(() => {
|
|
451
451
|
a.current && a.current.postMessage({ type: "SKIP_WAITING" }), o && localStorage.setItem("tracktor_clear_caches", "1"), window.location.reload();
|
|
452
452
|
}, [o]);
|
|
453
453
|
j(() => {
|
|
454
454
|
localStorage.getItem("tracktor_clear_caches") === "1" && (localStorage.removeItem("tracktor_clear_caches"), we().catch(console.error));
|
|
455
455
|
}, []);
|
|
456
|
-
const u =
|
|
456
|
+
const u = O(() => {
|
|
457
457
|
window.confirm("A new version is available. The app will reload now.") && c();
|
|
458
458
|
}, [c]);
|
|
459
459
|
return j(() => {
|
|
@@ -527,7 +527,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
527
527
|
name: _e(y),
|
|
528
528
|
path: y
|
|
529
529
|
},
|
|
530
|
-
operationName: (p,
|
|
530
|
+
operationName: (p, v, T) => Ae(p, v, T, c),
|
|
531
531
|
query: {
|
|
532
532
|
useQuery: !0
|
|
533
533
|
}
|
|
@@ -544,7 +544,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
544
544
|
defaultMutationsOptions: o,
|
|
545
545
|
...a
|
|
546
546
|
}) => {
|
|
547
|
-
const { libraries: n } = P(
|
|
547
|
+
const { libraries: n } = P(S), i = a?.QueryClient || n?.reactQuery?.QueryClient, c = a?.QueryClientProvider || n?.reactQuery?.QueryClientProvider;
|
|
548
548
|
if (!i)
|
|
549
549
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
550
550
|
if (!c)
|
|
@@ -576,7 +576,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
576
576
|
const a = xe(e), n = `${o}${a}`, i = n.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
577
577
|
return typeof r == "number" && i ? `${n.replace("/files", `/thumbs/${r}`)}` : n;
|
|
578
578
|
}, Xe = (e) => {
|
|
579
|
-
const { apiURL: r, libraries: o } = P(
|
|
579
|
+
const { apiURL: r, libraries: o } = P(S), a = e?.dayjs || o?.dayjs;
|
|
580
580
|
return {
|
|
581
581
|
dateAdapter: (c, u) => {
|
|
582
582
|
if (!a)
|
|
@@ -602,10 +602,10 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
602
602
|
worksiteNameAdapter: Ie
|
|
603
603
|
};
|
|
604
604
|
}, Ze = (e) => {
|
|
605
|
-
const { libraries: r } = P(
|
|
605
|
+
const { libraries: r } = P(S), o = e?.axios || r?.axios, a = e?.localStorageKey || "user";
|
|
606
606
|
if (!o)
|
|
607
607
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
608
|
-
const n =
|
|
608
|
+
const n = O(
|
|
609
609
|
({ tokenType: c, accessToken: u }) => {
|
|
610
610
|
o.defaults.headers.common.Authorization = `${c} ${u}`;
|
|
611
611
|
},
|
|
@@ -614,7 +614,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
614
614
|
o.defaults.headers.common.Authorization = null;
|
|
615
615
|
};
|
|
616
616
|
return j(() => {
|
|
617
|
-
if (
|
|
617
|
+
if (F)
|
|
618
618
|
return;
|
|
619
619
|
const c = ({ newValue: u, key: l }) => {
|
|
620
620
|
if (l === a && u)
|
|
@@ -632,21 +632,21 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
632
632
|
clearAuthenticationToken: i,
|
|
633
633
|
setAuthenticationToken: n
|
|
634
634
|
};
|
|
635
|
-
},
|
|
636
|
-
const [o, a] =
|
|
635
|
+
}, Y = (e, r) => r === "short" ? e.split("-")[0] : e, et = (e, r = "full") => {
|
|
636
|
+
const [o, a] = W(() => {
|
|
637
637
|
const n = e?.language || navigator.language;
|
|
638
|
-
return e && "isInitialized" in e && e.isInitialized,
|
|
638
|
+
return e && "isInitialized" in e && e.isInitialized, Y(n, r);
|
|
639
639
|
});
|
|
640
640
|
return j(() => {
|
|
641
|
-
e && "isInitialized" in e && e.isInitialized && e.language && a(
|
|
641
|
+
e && "isInitialized" in e && e.isInitialized && e.language && a(Y(e.language, r));
|
|
642
642
|
const n = (i) => {
|
|
643
|
-
a(
|
|
643
|
+
a(Y(i, r));
|
|
644
644
|
};
|
|
645
645
|
return e?.on?.("languageChanged", n), () => {
|
|
646
646
|
e?.off?.("languageChanged", n);
|
|
647
647
|
};
|
|
648
648
|
}, [e, r]), o;
|
|
649
|
-
},
|
|
649
|
+
}, Le = "tracktor.filter", Ne = {
|
|
650
650
|
getFilter: () => {
|
|
651
651
|
},
|
|
652
652
|
getFilters: () => ({}),
|
|
@@ -654,13 +654,13 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
654
654
|
},
|
|
655
655
|
setFilter: () => {
|
|
656
656
|
}
|
|
657
|
-
},
|
|
657
|
+
}, ne = (e) => {
|
|
658
658
|
try {
|
|
659
659
|
return JSON.parse(e);
|
|
660
660
|
} catch {
|
|
661
661
|
return e;
|
|
662
662
|
}
|
|
663
|
-
},
|
|
663
|
+
}, oe = (e, r, o) => `${o}_${e}=>${r}`, Fe = (e) => e.reduce((r, o) => {
|
|
664
664
|
const a = localStorage.getItem(o);
|
|
665
665
|
if (a)
|
|
666
666
|
try {
|
|
@@ -670,71 +670,72 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
670
670
|
}
|
|
671
671
|
return r;
|
|
672
672
|
}, {}), tt = (e) => {
|
|
673
|
-
const { libraries: r, localStorageKeys: o } = P(
|
|
674
|
-
}], [u, l] =
|
|
675
|
-
if (
|
|
676
|
-
return
|
|
673
|
+
const { libraries: r, localStorageKeys: o } = P(S), a = e?.reactRouter || r?.reactRouter, { pathname: n } = a?.useLocation?.() ?? { pathname: "/" }, [i, c] = a?.useSearchParams?.() ?? [new URLSearchParams(), () => {
|
|
674
|
+
}], [u, l] = W({}), d = o?.filter || Le, s = e?.syncWithUrl === void 0 ? !0 : e?.syncWithUrl, y = e?.persistToLocalStorage === void 0 ? !0 : e?.persistToLocalStorage;
|
|
675
|
+
if (F)
|
|
676
|
+
return Ne;
|
|
677
677
|
if (!a)
|
|
678
678
|
throw new Error(
|
|
679
679
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of reactRouter."
|
|
680
680
|
);
|
|
681
|
-
const
|
|
682
|
-
(
|
|
683
|
-
),
|
|
684
|
-
const
|
|
685
|
-
if (!
|
|
686
|
-
s ? (i.delete(
|
|
687
|
-
const
|
|
688
|
-
return delete
|
|
689
|
-
}), localStorage.removeItem(
|
|
681
|
+
const p = () => Object.keys(localStorage).filter(
|
|
682
|
+
(g) => g.startsWith(d) && g.endsWith(e?.pathname || n)
|
|
683
|
+
), v = (g, E, m = !0) => {
|
|
684
|
+
const _ = oe(g, e?.pathname || n, d);
|
|
685
|
+
if (!E || Array.isArray(E) && !E.length) {
|
|
686
|
+
s ? (i.delete(g), c(i)) : l((b) => {
|
|
687
|
+
const I = { ...b };
|
|
688
|
+
return delete I[g], I;
|
|
689
|
+
}), y && localStorage.removeItem(_);
|
|
690
690
|
return;
|
|
691
691
|
}
|
|
692
|
-
|
|
692
|
+
y && m && E && localStorage.setItem(_, JSON.stringify({ ...i, [g]: E })), s && E ? (i.set(g, JSON.stringify(E)), c(i)) : !s && E && l((b) => ({ ...b, [g]: E }));
|
|
693
693
|
};
|
|
694
694
|
return {
|
|
695
|
-
getFilter: (
|
|
696
|
-
if (!s) {
|
|
697
|
-
const v = u[m];
|
|
698
|
-
if (v !== void 0)
|
|
699
|
-
return v;
|
|
700
|
-
}
|
|
695
|
+
getFilter: (g, E) => {
|
|
701
696
|
if (s) {
|
|
702
|
-
const
|
|
703
|
-
if (
|
|
704
|
-
return
|
|
697
|
+
const m = i.get(g);
|
|
698
|
+
if (m)
|
|
699
|
+
return ne(m);
|
|
700
|
+
} else {
|
|
701
|
+
const m = u[g];
|
|
702
|
+
if (m !== void 0)
|
|
703
|
+
return m;
|
|
705
704
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
705
|
+
if (y) {
|
|
706
|
+
const m = oe(g, e?.pathname || n, d), _ = localStorage.getItem(m);
|
|
707
|
+
if (_)
|
|
708
|
+
try {
|
|
709
|
+
const b = JSON.parse(_)[g];
|
|
710
|
+
return !s && b !== void 0 && l((I) => ({ ...I, [g]: b })), b;
|
|
711
|
+
} catch {
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
return E;
|
|
714
715
|
},
|
|
715
716
|
getFilters: () => {
|
|
716
|
-
const
|
|
717
|
+
const g = y ? Fe(p()) : {};
|
|
717
718
|
if (s) {
|
|
718
|
-
const
|
|
719
|
+
const E = Array.from(i.entries()).reduce((m, [_, b]) => (m[_] = ne(b), m), {});
|
|
719
720
|
return {
|
|
720
|
-
...
|
|
721
|
-
...
|
|
721
|
+
...g,
|
|
722
|
+
...E
|
|
722
723
|
};
|
|
723
724
|
}
|
|
724
725
|
return {
|
|
725
|
-
...
|
|
726
|
+
...g,
|
|
726
727
|
...u
|
|
727
728
|
};
|
|
728
729
|
},
|
|
729
|
-
handleFilter: (
|
|
730
|
-
if (
|
|
731
|
-
const
|
|
732
|
-
|
|
730
|
+
handleFilter: (g, E) => (m, _) => {
|
|
731
|
+
if (_ || Array.isArray(_) && _.length === 0) {
|
|
732
|
+
const b = E || "value", I = typeof _ == "object" && b in _ ? _[b] : _;
|
|
733
|
+
v(g, I);
|
|
733
734
|
return;
|
|
734
735
|
}
|
|
735
|
-
|
|
736
|
+
v(g, void 0);
|
|
736
737
|
},
|
|
737
|
-
setFilter:
|
|
738
|
+
setFilter: v
|
|
738
739
|
};
|
|
739
740
|
}, rt = ({
|
|
740
741
|
data: e,
|
|
@@ -744,12 +745,12 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
744
745
|
isLoading: n,
|
|
745
746
|
enabled: i = !0
|
|
746
747
|
}) => {
|
|
747
|
-
const c =
|
|
748
|
+
const c = O(
|
|
748
749
|
async (l) => {
|
|
749
750
|
o || !i || await r({ pageParam: l?.pageParam || l.visibleRowsCount });
|
|
750
751
|
},
|
|
751
752
|
[i, r, o]
|
|
752
|
-
), u =
|
|
753
|
+
), u = G(() => {
|
|
753
754
|
if (e)
|
|
754
755
|
return e.pages.reduce((l, d) => [...l, ...d], []);
|
|
755
756
|
}, [e]);
|
|
@@ -760,7 +761,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
760
761
|
rows: u
|
|
761
762
|
};
|
|
762
763
|
}, nt = (e) => {
|
|
763
|
-
const { libraries: r } = P(
|
|
764
|
+
const { libraries: r } = P(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 = O(
|
|
764
765
|
(d) => {
|
|
765
766
|
if (d && typeof d == "object" && "response" in d) {
|
|
766
767
|
const { response: s } = d || {};
|
|
@@ -783,7 +784,7 @@ const We = ({ IMaskMixin: e, ...r }) => {
|
|
|
783
784
|
},
|
|
784
785
|
[c]
|
|
785
786
|
);
|
|
786
|
-
return { getErrorCode:
|
|
787
|
+
return { getErrorCode: O((d) => {
|
|
787
788
|
const { response: s } = d || {};
|
|
788
789
|
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";
|
|
789
790
|
}, []), printError: u };
|
|
@@ -794,7 +795,7 @@ export {
|
|
|
794
795
|
Ve as InitializeDaysJSConfig,
|
|
795
796
|
Me as InitializeI18nConfig,
|
|
796
797
|
Ge as InitializeSentryConfig,
|
|
797
|
-
|
|
798
|
+
S as InjectDependenciesContext,
|
|
798
799
|
ze as InjectDependenciesProvider,
|
|
799
800
|
We as MaskTextField,
|
|
800
801
|
Je as PreloadErrorHandler,
|
package/dist/main.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(m,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("axios"),require("react")):typeof define=="function"&&define.amd?define(["exports","axios","react"],O):(m=typeof globalThis<"u"?globalThis:m||self,O(m["@tracktor/shared-module"]={},m.axios,m.React))})(this,(function(m,O,f){"use strict";const ae=(e,r)=>{const o=O.CancelToken.source(),a=O({...e,...r,cancelToken:o.token}).then(({data:n})=>n);return a.cancel=()=>{o.cancel("Query was cancelled")},a};var D={exports:{}},N={};var G;function se(){if(G)return N;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 N.Fragment=r,N.jsx=o,N.jsxs=o,N}var L={};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 k:return"Fragment";case R:return"Profiler";case y:return"StrictMode";case I: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 j:return"Portal";case S:return t.displayName||"Context";case h:return(t._context.displayName||"Context")+".Consumer";case A: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 z: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 E=p.error,b=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return E.call(p,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",b),r(t)}}function a(t){if(t===k)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===z)return"<...>";try{var p=e(t);return p?"<"+p+">":"<...>"}catch{return"<...>"}}function n(){var t=U.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 E(){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))}E.isReactWarning=!0,Object.defineProperty(t,"key",{get:E,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,E,b,W,Q){var _=E.ref;return t={$$typeof:T,type:t,key:p,props:E,_owner:b},(_!==void 0?_: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:W}),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,E,b,W,Q){var _=p.children;if(_!==void 0)if(b)if(Ke(_)){for(b=0;b<_.length;b++)v(_[b]);Object.freeze&&Object.freeze(_)}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(_);if($.call(p,"key")){_=e(t);var x=Object.keys(p).filter(function(Be){return Be!=="key"});b=0<x.length?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}",oe[_+b]||(x=0<x.length?"{"+x.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
2
2
|
let props = %s;
|
|
3
3
|
<%s {...props} />
|
|
4
4
|
React keys must be passed directly to JSX without using spread:
|
|
5
5
|
let props = %s;
|
|
6
|
-
<%s key={someKey} {...props} />`,b,_,O,_),ne[_+b]=!0)}if(_=null,R!==void 0&&(o(R),_=""+R),c(p)&&(o(p.key),_=""+p.key),"key"in p){R={};for(var Q in p)Q!=="key"&&(R[Q]=p[Q])}else R=p;return _&&u(R,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,_,R,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 S=f,k=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),h=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),w=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),Me=Symbol.for("react.suspense"),Qe=Symbol.for("react.suspense_list"),Ve=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),Ge=Symbol.for("react.activity"),Je=Symbol.for("react.client.reference"),z=S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=Object.prototype.hasOwnProperty,Ke=Array.isArray,U=console.createTask?console.createTask:function(){return null};S={react_stack_bottom_frame:function(t){return t()}};var $,ee={},te=S.react_stack_bottom_frame.bind(S,i)(),re=U(a(i)),ne={};N.Fragment=h,N.jsx=function(t,p,R){var b=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,R,!1,b?Error("react-stack-top-frame"):te,b?U(a(t)):re)},N.jsxs=function(t,p,R){var b=1e4>z.recentlyCreatedOwnerStacks++;return s(t,p,R,!0,b?Error("react-stack-top-frame"):te,b?U(a(t)):re)}})()),N}var J;function ie(){return J||(J=1,process.env.NODE_ENV==="production"?F.exports=ae():F.exports=se()),F.exports}var T=ie();const ce=({IMaskMixin:e,...r})=>{const o=f.useMemo(()=>e(({TextField:a,...n})=>T.jsx(a,{...n})),[e]);return T.jsx(o,{...r})},A=f.createContext({}),le=({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})},ue=({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}})(),de="user",fe=({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||de,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,S=d?`${v} ${g}`:null;S&&(l.defaults.headers.common.Authorization=S)}return l.defaults.baseURL=n,l.defaults.headers.post["Content-Type"]=o,null},pe=({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},ge=({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},me=({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=s?.reactRouter||v?.reactRouter;if(!g)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!S)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:h,useNavigationType:E}=S;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:h,useNavigationType:E}),...r||[]],release:d,replaysOnErrorSampleRate:n||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:i,tracesSampleRate:o||1}),null},ye=()=>(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),he="user",ve=({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||he;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:S,Outlet:k}=u,C=g(),h=f.useRef(!1),E=typeof r=="function"?r():!!r,P=typeof E=="boolean"?E:E?.isLogged;return f.useEffect(()=>{h.current||(h.current=!0,l.interceptors.response.use(m=>m,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),v(a)),Promise.reject(m))))},[l.defaults.headers.common,l.interceptors.response,d,a]),P&&!s?T.jsx(f.Suspense,{fallback:e,children:C.state?.from?.state&&C.state?.from?.pathname===o?T.jsx(S,{to:C.state.from.state.from.pathname+C.state.from.state.from.search,replace:!0}):T.jsx(k,{})}):T.jsx(S,{to:o+C.search,state:{from:C},replace:!0})},Ee=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)}},we=({autoUpdate:e,renderDialog:r,clearCachesOnReload:o})=>{const a=f.useRef(null),[n,i]=f.useState(!1),c=f.useCallback(()=>{a.current&&a.current.postMessage({type:"SKIP_WAITING"}),o&&localStorage.setItem("tracktor_clear_caches","1"),window.location.reload()},[o]);f.useEffect(()=>{localStorage.getItem("tracktor_clear_caches")==="1"&&(localStorage.removeItem("tracktor_clear_caches"),Ee().catch(console.error))},[]);const u=f.useCallback(()=>{window.confirm("A new version is available. The app will reload now.")&&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()},[e,n,c]),f.useEffect(()=>{n&&!e&&!r&&u()},[r,u,n,e]),n&&!e&&r?r(c):null},Re=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),be=e=>{const r=e.split(/[/\\]/).pop()||"";return r.substring(0,r.lastIndexOf("."))},_e=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\./,""),Ae=(e,r,o,a)=>{const n=_e(r),i=Re(o),c=`${n}${i}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},Ce=(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},je=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:Ce(i,c)},header:g=>["Generated by orval 🍺",...g.title?[g.title]:[],...g.description?[g.description]:[]],mutator:{name:be(v),path:v},operationName:(g,S,k)=>Ae(g,S,k,c),query:{useQuery:!0}},schemas:n?.schemas||`src/api/${s}/model`,target:n?.target||`src/api/${s}/services/api.ts`,...n}}}},{}),Pe=e=>e&&typeof e=="function",Te=e=>e&&typeof e=="function",ke=({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(!Pe(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Te(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(" "),Ie=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,Oe=({path:e,size:r,apiURL:o})=>{if(!e)return"";const a=Ie(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},xe=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:Oe({apiURL:r,path:c,size:u})},worksiteNameAdapter:H}},Ne=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,Le=(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},Fe="tracktor.filter",De={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},X=e=>{try{return JSON.parse(e)}catch{return e}},Z=(e,r,o)=>`${o}_${e}=>${r}`,Ye=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},{}),We=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||Fe,s=e?.syncWithUrl===void 0?!0:e?.syncWithUrl;if(L)return De;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(h=>h.startsWith(d)&&h.endsWith(e?.pathname||n)),g=(h,E,P=!0)=>{const m=Z(h,e?.pathname||n,d);if(!E||Array.isArray(E)&&!E.length){s?(i.delete(h),c(i)):l(w=>{const j={...w};return delete j[h],j}),localStorage.removeItem(m);return}P&&E&&localStorage.setItem(m,JSON.stringify({...i,[h]:E})),s&&E?(i.set(h,JSON.stringify(E)),c(i)):!s&&E&&l(w=>({...w,[h]:E}))};return{getFilter:(h,E)=>{if(!s){const w=u[h];if(w!==void 0)return w}if(s){const w=i.get(h);if(w)return X(w)}const P=Z(h,e?.pathname||n,d),m=localStorage.getItem(P);if(m)try{const w=JSON.parse(m)[h];return!s&&w!==void 0&&l(j=>({...j,[h]:w})),w}catch{}return E},getFilters:()=>{const h=v(),E=Ye(h);if(s){const P=Array.from(i.entries()).reduce((m,[w,j])=>(m[w]=X(j),m),{});return{...E,...P}}return{...E,...u}},handleFilter:(h,E)=>(P,m)=>{if(m||Array.isArray(m)&&m.length===0){const w=E||"value",j=typeof m=="object"&&w in m?m[w]:m;g(h,j);return}g(h,void 0)},setFilter:g}},ze=({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}},Ue=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}};y.GTMSendPageView=ue,y.InitializeAxiosConfig=fe,y.InitializeDaysJSConfig=pe,y.InitializeI18nConfig=ge,y.InitializeSentryConfig=me,y.InjectDependenciesContext=A,y.InjectDependenciesProvider=le,y.MaskTextField=ce,y.PreloadErrorHandler=ye,y.QueryClientProviderWithConfig=ke,y.RequireAuth=ve,y.UpdateNotifier=we,y.axiosCustomInstance=oe,y.dateAdapter=K,y.distanceAdapter=B,y.getOrvalConfig=je,y.useAdapter=xe,y.useAuth=Ne,y.useCurrentLanguage=Le,y.useFilters=We,y.useInfiniteDataGrid=ze,y.useResponseError=Ue,y.worksiteNameAdapter=H,Object.defineProperty(y,Symbol.toStringTag,{value:"Module"})}));
|
|
6
|
+
<%s key={someKey} {...props} />`,b,_,x,_),oe[_+b]=!0)}if(_=null,E!==void 0&&(o(E),_=""+E),c(p)&&(o(p.key),_=""+p.key),"key"in p){E={};for(var V in p)V!=="key"&&(E[V]=p[V])}else E=p;return _&&u(E,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,_,E,n(),W,Q)}function v(t){g(t)?t._store&&(t._store.validated=1):typeof t=="object"&&t!==null&&t.$$typeof===z&&(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===T}var w=f,T=Symbol.for("react.transitional.element"),j=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),h=Symbol.for("react.consumer"),S=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),Qe=Symbol.for("react.suspense_list"),Ve=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),Ge=Symbol.for("react.activity"),Je=Symbol.for("react.client.reference"),U=w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,Ke=Array.isArray,M=console.createTask?console.createTask:function(){return null};w={react_stack_bottom_frame:function(t){return t()}};var ee,te={},re=w.react_stack_bottom_frame.bind(w,i)(),ne=M(a(i)),oe={};L.Fragment=k,L.jsx=function(t,p,E){var b=1e4>U.recentlyCreatedOwnerStacks++;return s(t,p,E,!1,b?Error("react-stack-top-frame"):re,b?M(a(t)):ne)},L.jsxs=function(t,p,E){var b=1e4>U.recentlyCreatedOwnerStacks++;return s(t,p,E,!0,b?Error("react-stack-top-frame"):re,b?M(a(t)):ne)}})()),L}var K;function ce(){return K||(K=1,process.env.NODE_ENV==="production"?D.exports=se():D.exports=ie()),D.exports}var P=ce();const le=({IMaskMixin:e,...r})=>{const o=f.useMemo(()=>e(({TextField:a,...n})=>P.jsx(a,{...n})),[e]);return P.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 P.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]),P.jsx(u,{})},F=(()=>{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||F)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,w=d?`${v} ${g}`:null;w&&(l.defaults.headers.common.Authorization=w)}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(F)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},ye=({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,w=s?.reactRouter||v?.reactRouter;if(!g)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!w)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:T,matchRoutes:j,useLocation:k,useNavigationType:y}=w;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:T,matchRoutes:j,useEffect:f.useEffect,useLocation:k,useNavigationType:y}),...r||[]],release:d,replaysOnErrorSampleRate:n||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:i,tracesSampleRate:o||1}),null},he=()=>(f.useEffect(()=>{if(F)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:w,Outlet:T}=u,j=g(),k=f.useRef(!1),y=typeof r=="function"?r():!!r,R=typeof y=="boolean"?y:y?.isLogged;return f.useEffect(()=>{k.current||(k.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]),R&&!s?P.jsx(f.Suspense,{fallback:e,children:j.state?.from?.state&&j.state?.from?.pathname===o?P.jsx(w,{to:j.state.from.state.from.pathname+j.state.from.state.from.search,replace:!0}):P.jsx(T,{})}):P.jsx(w,{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)}},Re=({autoUpdate:e,renderDialog:r,clearCachesOnReload:o})=>{const a=f.useRef(null),[n,i]=f.useState(!1),c=f.useCallback(()=>{a.current&&a.current.postMessage({type:"SKIP_WAITING"}),o&&localStorage.setItem("tracktor_clear_caches","1"),window.location.reload()},[o]);f.useEffect(()=>{localStorage.getItem("tracktor_clear_caches")==="1"&&(localStorage.removeItem("tracktor_clear_caches"),we().catch(console.error))},[]);const u=f.useCallback(()=>{window.confirm("A new version is available. The app will reload now.")&&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()},[e,n,c]),f.useEffect(()=>{n&&!e&&!r&&u()},[r,u,n,e]),n&&!e&&r?r(c):null},be=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),_e=e=>{const r=e.split(/[/\\]/).pop()||"";return r.substring(0,r.lastIndexOf("."))},Se=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)},Ae=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Ce=(e,r,o,a)=>{const n=Se(r),i=be(o),c=`${n}${i}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},je=(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},Pe=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||Ae(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:je(i,c)},header:g=>["Generated by orval 🍺",...g.title?[g.title]:[],...g.description?[g.description]:[]],mutator:{name:_e(v),path:v},operationName:(g,w,T)=>Ce(g,w,T,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 P.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(F)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}},Y=(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,Y(n,r)});return f.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(Y(e.language,r));const n=i=>{a(Y(i,r))};return e?.on?.("languageChanged",n),()=>{e?.off?.("languageChanged",n)}},[e,r]),o},De="tracktor.filter",Ye={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},Z=e=>{try{return JSON.parse(e)}catch{return e}},q=(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,v=e?.persistToLocalStorage===void 0?!0:e?.persistToLocalStorage;if(F)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 g=()=>Object.keys(localStorage).filter(y=>y.startsWith(d)&&y.endsWith(e?.pathname||n)),w=(y,R,h=!0)=>{const S=q(y,e?.pathname||n,d);if(!R||Array.isArray(R)&&!R.length){s?(i.delete(y),c(i)):l(A=>{const I={...A};return delete I[y],I}),v&&localStorage.removeItem(S);return}v&&h&&R&&localStorage.setItem(S,JSON.stringify({...i,[y]:R})),s&&R?(i.set(y,JSON.stringify(R)),c(i)):!s&&R&&l(A=>({...A,[y]:R}))};return{getFilter:(y,R)=>{if(s){const h=i.get(y);if(h)return Z(h)}else{const h=u[y];if(h!==void 0)return h}if(v){const h=q(y,e?.pathname||n,d),S=localStorage.getItem(h);if(S)try{const A=JSON.parse(S)[y];return!s&&A!==void 0&&l(I=>({...I,[y]:A})),A}catch{}}return R},getFilters:()=>{const y=v?We(g()):{};if(s){const R=Array.from(i.entries()).reduce((h,[S,A])=>(h[S]=Z(A),h),{});return{...y,...R}}return{...y,...u}},handleFilter:(y,R)=>(h,S)=>{if(S||Array.isArray(S)&&S.length===0){const A=R||"value",I=typeof S=="object"&&A in S?S[A]:S;w(y,I);return}w(y,void 0)},setFilter:w}},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&&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=de,m.InitializeAxiosConfig=pe,m.InitializeDaysJSConfig=ge,m.InitializeI18nConfig=me,m.InitializeSentryConfig=ye,m.InjectDependenciesContext=C,m.InjectDependenciesProvider=ue,m.MaskTextField=le,m.PreloadErrorHandler=he,m.QueryClientProviderWithConfig=Ie,m.RequireAuth=Ee,m.UpdateNotifier=Re,m.axiosCustomInstance=ae,m.dateAdapter=B,m.distanceAdapter=H,m.getOrvalConfig=Pe,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"})}));
|