@tracktor/shared-module 2.5.0 → 2.5.2
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/CHANGELOG.md +2 -3
- package/dist/components/Utils/PreloadErrorHandler.d.ts +4 -4
- package/dist/main.js +37 -34
- package/dist/main.umd.cjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
# [Versions](https://github.com/Tracktor/shared-module/releases)
|
|
2
2
|
|
|
3
|
-
## v2.5.
|
|
4
|
-
- **[fix]** -
|
|
5
|
-
- **[feat]** - add `PreloadErrorHandler` component
|
|
3
|
+
## v2.5.2
|
|
4
|
+
- **[fix]** - add `PreloadErrorHandler` handling event error disable sentry reporting
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This component is used to handle preload error
|
|
3
|
-
* When a preload error occurs, the page will be reloaded
|
|
4
|
-
* Error is caused when a new deployment occurs
|
|
2
|
+
* This component is used to handle preload error.
|
|
3
|
+
* When a preload error occurs, the page will be reloaded.
|
|
4
|
+
* Error is caused when a new deployment occurs and the hosting service
|
|
5
|
+
* deletes the assets from previous deployments.
|
|
5
6
|
* Vite emits vite:preloadError event when it fails to load dynamic imports.
|
|
6
|
-
* @constructor
|
|
7
7
|
*/
|
|
8
8
|
declare const PreloadErrorHandler: () => null;
|
|
9
9
|
export default PreloadErrorHandler;
|
package/dist/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Ne, { createContext as gr, useMemo as fe, useContext as
|
|
1
|
+
import Ne, { createContext as gr, useMemo as fe, useContext as I, useState as We, useRef as hr, useEffect as z, Suspense as yr, useCallback as re } from "react";
|
|
2
2
|
var le = { exports: {} }, G = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
@@ -43,7 +43,7 @@ function Er() {
|
|
|
43
43
|
var t = j && e[j] || e[T];
|
|
44
44
|
return typeof t == "function" ? t : null;
|
|
45
45
|
}
|
|
46
|
-
var
|
|
46
|
+
var D = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
47
47
|
function _(e) {
|
|
48
48
|
{
|
|
49
49
|
for (var t = arguments.length, a = new Array(t > 1 ? t - 1 : 0), v = 1; v < t; v++)
|
|
@@ -53,7 +53,7 @@ function Er() {
|
|
|
53
53
|
}
|
|
54
54
|
function L(e, t, a) {
|
|
55
55
|
{
|
|
56
|
-
var v =
|
|
56
|
+
var v = D.ReactDebugCurrentFrame, E = v.getStackAddendum();
|
|
57
57
|
E !== "" && (t += "%s", a = a.concat([E]));
|
|
58
58
|
var w = a.map(function(y) {
|
|
59
59
|
return String(y);
|
|
@@ -187,7 +187,7 @@ function Er() {
|
|
|
187
187
|
q < 0 && _("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
var te =
|
|
190
|
+
var te = D.ReactCurrentDispatcher, ne;
|
|
191
191
|
function J(e, t, a) {
|
|
192
192
|
{
|
|
193
193
|
if (ne === void 0)
|
|
@@ -313,7 +313,7 @@ function Er() {
|
|
|
313
313
|
}
|
|
314
314
|
return "";
|
|
315
315
|
}
|
|
316
|
-
var X = Object.prototype.hasOwnProperty, be = {}, Pe =
|
|
316
|
+
var X = Object.prototype.hasOwnProperty, be = {}, Pe = D.ReactDebugCurrentFrame;
|
|
317
317
|
function Z(e) {
|
|
318
318
|
if (e) {
|
|
319
319
|
var t = e._owner, a = H(e.type, e._source, t ? t.type : null);
|
|
@@ -364,7 +364,7 @@ function Er() {
|
|
|
364
364
|
if (He(e))
|
|
365
365
|
return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ke(e)), je(e);
|
|
366
366
|
}
|
|
367
|
-
var B =
|
|
367
|
+
var B = D.ReactCurrentOwner, Xe = {
|
|
368
368
|
key: !0,
|
|
369
369
|
ref: !0,
|
|
370
370
|
__self: !0,
|
|
@@ -462,7 +462,7 @@ function Er() {
|
|
|
462
462
|
return or(e, h, x, E, v, B.current, y);
|
|
463
463
|
}
|
|
464
464
|
}
|
|
465
|
-
var ue =
|
|
465
|
+
var ue = D.ReactCurrentOwner, Oe = D.ReactDebugCurrentFrame;
|
|
466
466
|
function V(e) {
|
|
467
467
|
if (e) {
|
|
468
468
|
var t = e._owner, a = H(e.type, e._source, t ? t.type : null);
|
|
@@ -490,7 +490,7 @@ Check the render method of \`` + e + "`.";
|
|
|
490
490
|
function ir(e) {
|
|
491
491
|
return "";
|
|
492
492
|
}
|
|
493
|
-
var
|
|
493
|
+
var De = {};
|
|
494
494
|
function ur(e) {
|
|
495
495
|
{
|
|
496
496
|
var t = Ae();
|
|
@@ -503,15 +503,15 @@ Check the top-level render call using <` + a + ">.");
|
|
|
503
503
|
return t;
|
|
504
504
|
}
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function Ie(e, t) {
|
|
507
507
|
{
|
|
508
508
|
if (!e._store || e._store.validated || e.key != null)
|
|
509
509
|
return;
|
|
510
510
|
e._store.validated = !0;
|
|
511
511
|
var a = ur(t);
|
|
512
|
-
if (
|
|
512
|
+
if (De[a])
|
|
513
513
|
return;
|
|
514
|
-
|
|
514
|
+
De[a] = !0;
|
|
515
515
|
var v = "";
|
|
516
516
|
e && e._owner && e._owner !== ue.current && (v = " It was passed a child from " + k(e._owner.type) + "."), V(e), _('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, v), V(null);
|
|
517
517
|
}
|
|
@@ -523,7 +523,7 @@ Check the top-level render call using <` + a + ">.");
|
|
|
523
523
|
if (ae(e))
|
|
524
524
|
for (var a = 0; a < e.length; a++) {
|
|
525
525
|
var v = e[a];
|
|
526
|
-
ce(v) &&
|
|
526
|
+
ce(v) && Ie(v, t);
|
|
527
527
|
}
|
|
528
528
|
else if (ce(e))
|
|
529
529
|
e._store && (e._store.validated = !0);
|
|
@@ -531,7 +531,7 @@ Check the top-level render call using <` + a + ">.");
|
|
|
531
531
|
var E = S(e);
|
|
532
532
|
if (typeof E == "function" && E !== e.entries)
|
|
533
533
|
for (var w = E.call(e), y; !(y = w.next()).done; )
|
|
534
|
-
ce(y.value) &&
|
|
534
|
+
ce(y.value) && Ie(y.value, t);
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
537
|
}
|
|
@@ -623,7 +623,7 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
623
623
|
[n, o]
|
|
624
624
|
);
|
|
625
625
|
return /* @__PURE__ */ F.jsx(A.Provider, { value: u, children: r });
|
|
626
|
-
},
|
|
626
|
+
}, Dr = ({
|
|
627
627
|
Fallback: r,
|
|
628
628
|
isLogged: n,
|
|
629
629
|
loginPath: o = "/login",
|
|
@@ -632,10 +632,10 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
632
632
|
...f
|
|
633
633
|
}) => {
|
|
634
634
|
var _, L, Y, N;
|
|
635
|
-
const { libraries: l } =
|
|
635
|
+
const { libraries: l } = I(A), d = (f == null ? void 0 : f.reactRouter) || (l == null ? void 0 : l.reactRouter), c = (f == null ? void 0 : f.axios) || (l == null ? void 0 : l.axios);
|
|
636
636
|
if (!d)
|
|
637
637
|
throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
638
|
-
const [g, m] = We(null), { useLocation: p, Navigate: R, Outlet: s } = d, j = p(), T = hr(!1), S = typeof n == "function" ? n() : !!n,
|
|
638
|
+
const [g, m] = We(null), { useLocation: p, Navigate: R, Outlet: s } = d, j = p(), T = hr(!1), S = typeof n == "function" ? n() : !!n, D = typeof S == "boolean" ? S : S == null ? void 0 : S.isLogged;
|
|
639
639
|
return z(() => {
|
|
640
640
|
T.current || (T.current = !0, c.interceptors.response.use(
|
|
641
641
|
(b) => b,
|
|
@@ -644,9 +644,9 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
644
644
|
return typeof b == "object" && b && "response" in b && b.response && typeof b.response == "object" && "status" in b.response && b.response && typeof b.response == "object" && "status" in b.response && ((U = b == null ? void 0 : b.response) == null ? void 0 : U.status) === 401 && (c.defaults.headers.common.Authorization = null, localStorage.removeItem(u), m(i)), Promise.reject(b);
|
|
645
645
|
}
|
|
646
646
|
));
|
|
647
|
-
}, [c.defaults.headers.common, c.interceptors.response, u, i]),
|
|
648
|
-
},
|
|
649
|
-
const { libraries: o } =
|
|
647
|
+
}, [c.defaults.headers.common, c.interceptors.response, u, i]), D && !g ? /* @__PURE__ */ F.jsx(yr, { fallback: r, children: (L = (_ = j.state) == null ? void 0 : _.from) != null && L.state && ((N = (Y = j.state) == null ? void 0 : Y.from) == null ? void 0 : N.pathname) === o ? /* @__PURE__ */ F.jsx(R, { to: j.state.from.state.from.pathname + j.state.from.state.from.search, replace: !0 }) : /* @__PURE__ */ F.jsx(s, {}) }) : /* @__PURE__ */ F.jsx(R, { to: o + j.search, state: { from: j }, replace: !0 });
|
|
648
|
+
}, Ir = ({ data: r, ...n }) => {
|
|
649
|
+
const { libraries: o } = I(A), u = (n == null ? void 0 : n.reactRouter) || (o == null ? void 0 : o.reactRouter), i = (n == null ? void 0 : n.gtm) || (o == null ? void 0 : o.gtm);
|
|
650
650
|
if (!u)
|
|
651
651
|
throw new Error(
|
|
652
652
|
"React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView."
|
|
@@ -668,7 +668,7 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
668
668
|
postContentType: u = "application/json",
|
|
669
669
|
...i
|
|
670
670
|
}) => {
|
|
671
|
-
const { apiURL: f = i.apiURL, libraries: l } =
|
|
671
|
+
const { apiURL: f = i.apiURL, libraries: l } = I(A), d = (i == null ? void 0 : i.axios) || (l == null ? void 0 : l.axios);
|
|
672
672
|
if (!d)
|
|
673
673
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
674
674
|
if (!(d != null && d.defaults))
|
|
@@ -676,7 +676,7 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
676
676
|
const c = localStorage.getItem(n), g = c ? JSON.parse(c) : null, m = g != null && g[r] ? g[r] : null, p = g != null && g[o] ? g[o] : null, R = c ? `${m} ${p}` : null;
|
|
677
677
|
return d.defaults.baseURL = f, d.defaults.headers.post["Content-Type"] = u, R && (d.defaults.headers.common.Authorization = R), null;
|
|
678
678
|
}, $r = ({ debug: r, resources: n, ...o }) => {
|
|
679
|
-
const { libraries: u } =
|
|
679
|
+
const { libraries: u } = I(A), i = (o == null ? void 0 : o.i18) || (u == null ? void 0 : u.i18), { i18next: f, initReactI18next: l, languageDetector: d } = i || {};
|
|
680
680
|
if (!i)
|
|
681
681
|
throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
682
682
|
return f != null && f.isInitialized || (f.use(d).use(l).init({
|
|
@@ -709,7 +709,7 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
709
709
|
environment: c,
|
|
710
710
|
...g
|
|
711
711
|
}) => {
|
|
712
|
-
const { libraries: m } =
|
|
712
|
+
const { libraries: m } = I(A), p = (g == null ? void 0 : g.sentry) || (m == null ? void 0 : m.sentry), R = (g == null ? void 0 : g.reactRouter) || (m == null ? void 0 : m.reactRouter);
|
|
713
713
|
if (!p)
|
|
714
714
|
throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
715
715
|
if (!R)
|
|
@@ -745,12 +745,12 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
745
745
|
);
|
|
746
746
|
return /* @__PURE__ */ F.jsx(o, { ...n });
|
|
747
747
|
}, Yr = ({ accessToken: r, ...n }) => {
|
|
748
|
-
const { libraries: o } =
|
|
748
|
+
const { libraries: o } = I(A), u = (n == null ? void 0 : n.mapbox) || (o == null ? void 0 : o.mapbox);
|
|
749
749
|
if (!u)
|
|
750
750
|
throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
751
751
|
return r && (u.accessToken = r), null;
|
|
752
752
|
}, Nr = ({ language: r, ...n }) => {
|
|
753
|
-
const { libraries: o } =
|
|
753
|
+
const { libraries: o } = I(A), u = (n == null ? void 0 : n.dayjs) || (o == null ? void 0 : o.dayjs), i = (n == null ? void 0 : n.plugin) || (o == null ? void 0 : o.dayjsPlugin);
|
|
754
754
|
if (!u)
|
|
755
755
|
throw new Error(
|
|
756
756
|
"Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig."
|
|
@@ -765,8 +765,11 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
765
765
|
})().then();
|
|
766
766
|
}, [u, i, r]), null;
|
|
767
767
|
}, Wr = () => (z(() => {
|
|
768
|
-
const r = () => {
|
|
769
|
-
|
|
768
|
+
const r = (n) => {
|
|
769
|
+
try {
|
|
770
|
+
n.preventDefault(), n.stopPropagation(), window.location.reload();
|
|
771
|
+
} catch {
|
|
772
|
+
}
|
|
770
773
|
};
|
|
771
774
|
return window.addEventListener("vite:preloadError", r), () => {
|
|
772
775
|
window.removeEventListener("vite:preloadError", r);
|
|
@@ -778,7 +781,7 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
778
781
|
...u
|
|
779
782
|
}) => {
|
|
780
783
|
var c, g;
|
|
781
|
-
const { libraries: i } =
|
|
784
|
+
const { libraries: i } = I(A), f = (u == null ? void 0 : u.QueryClient) || ((c = i == null ? void 0 : i.reactQuery) == null ? void 0 : c.QueryClient), l = (u == null ? void 0 : u.QueryClientProvider) || ((g = i == null ? void 0 : i.reactQuery) == null ? void 0 : g.QueryClientProvider);
|
|
782
785
|
if (!f)
|
|
783
786
|
throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");
|
|
784
787
|
if (!l)
|
|
@@ -803,11 +806,11 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
803
806
|
return /* @__PURE__ */ F.jsx(l, { client: d, children: r });
|
|
804
807
|
}, Vr = (r) => {
|
|
805
808
|
var g, m, p;
|
|
806
|
-
const { libraries: n } =
|
|
809
|
+
const { libraries: n } = I(A), o = (r == null ? void 0 : r.i18) || (n == null ? void 0 : n.i18), u = ((g = r == null ? void 0 : r.i18) == null ? void 0 : g.translateFunction) || ((m = n == null ? void 0 : n.i18) == null ? void 0 : m.translateFunction), i = ((p = o == null ? void 0 : o.i18next) == null ? void 0 : p.t) || u || ((R) => R), { unknownErrorTranslationKey: f = "error.unknownError" } = r || {}, l = i(f), d = re(
|
|
807
810
|
(R) => {
|
|
808
|
-
var j, T, S,
|
|
811
|
+
var j, T, S, D, _, L, Y, N, b;
|
|
809
812
|
const { response: s } = R || {};
|
|
810
|
-
return s != null && s.reason ? String(s.reason) : (j = s == null ? void 0 : s.data) != null && j.reason ? String(s.data.reason) : (T = s == null ? void 0 : s.data) != null && T.message ? String(s.data.message) : (
|
|
813
|
+
return s != null && s.reason ? String(s.reason) : (j = s == null ? void 0 : s.data) != null && j.reason ? String(s.data.reason) : (T = s == null ? void 0 : s.data) != null && T.message ? String(s.data.message) : (D = (S = s == null ? void 0 : s.data) == null ? void 0 : S.detail) != null && D.length && Array.isArray((_ = s == null ? void 0 : s.data) == null ? void 0 : _.detail) && ((Y = (L = s == null ? void 0 : s.data) == null ? void 0 : L.detail[0]) != null && Y.msg) && typeof ((b = (N = s == null ? void 0 : s.data) == null ? void 0 : N.detail[0]) == null ? void 0 : b.msg) == "string" ? String(s.data.detail[0].msg) : l;
|
|
811
814
|
},
|
|
812
815
|
[l]
|
|
813
816
|
);
|
|
@@ -840,7 +843,7 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
840
843
|
rows: d
|
|
841
844
|
};
|
|
842
845
|
}, Ur = (r) => {
|
|
843
|
-
const { libraries: n } =
|
|
846
|
+
const { libraries: n } = I(A), o = (r == null ? void 0 : r.axios) || (n == null ? void 0 : n.axios), u = (r == null ? void 0 : r.localStorageKey) || "user";
|
|
844
847
|
if (!o)
|
|
845
848
|
throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");
|
|
846
849
|
const i = re(
|
|
@@ -877,7 +880,7 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
877
880
|
const u = Cr(r), i = `${o}${u}`, f = i.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/) !== null;
|
|
878
881
|
return typeof n == "number" && f ? `${i.replace("/files", `/thumbs/${n}`)}` : i;
|
|
879
882
|
}, qr = (r) => {
|
|
880
|
-
const { apiURL: n, libraries: o } =
|
|
883
|
+
const { apiURL: n, libraries: o } = I(A), u = (r == null ? void 0 : r.dayjs) || (o == null ? void 0 : o.dayjs);
|
|
881
884
|
return {
|
|
882
885
|
dateAdapter: (l, d) => {
|
|
883
886
|
if (!u)
|
|
@@ -969,7 +972,7 @@ const A = gr({}), Ar = ({ children: r, apiURL: n, libraries: o }) => {
|
|
|
969
972
|
};
|
|
970
973
|
}, {});
|
|
971
974
|
export {
|
|
972
|
-
|
|
975
|
+
Ir as GTMSendPageView,
|
|
973
976
|
kr as InitializeAxiosConfig,
|
|
974
977
|
Nr as InitializeDaysJSConfig,
|
|
975
978
|
$r as InitializeI18nConfig,
|
|
@@ -980,7 +983,7 @@ export {
|
|
|
980
983
|
Lr as MaskTextField,
|
|
981
984
|
Wr as PreloadErrorHandler,
|
|
982
985
|
zr as QueryClientProviderWithConfig,
|
|
983
|
-
|
|
986
|
+
Dr as RequireAuth,
|
|
984
987
|
pr as dateAdapter,
|
|
985
988
|
_r as distanceAdapter,
|
|
986
989
|
Gr as getOrvalConfig,
|
package/dist/main.umd.cjs
CHANGED
|
@@ -22,4 +22,4 @@
|
|
|
22
22
|
|
|
23
23
|
Check the render method of \``+e+"`."}return""}}function It(e){return""}var ke={};function Dt(e){{var r=De();if(!r){var a=typeof e=="string"?e:e.displayName||e.name;a&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+a+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=Dt(r);if(ke[a])return;ke[a]=!0;var v="";e&&e._owner&&e._owner!==se.current&&(v=" It was passed a child from "+L(e._owner.type)+"."),V(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,v),V(null)}}function Le(e,r){{if(typeof e!="object")return;if(ae(e))for(var a=0;a<e.length;a++){var v=e[a];ce(v)&&Fe(v,r)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var R=x(e);if(typeof R=="function"&&R!==e.entries)for(var w=R.call(e),m;!(m=w.next()).done;)ce(m.value)&&Fe(m.value,r)}}}function kt(e){{var r=e.type;if(r==null||typeof r=="string")return;var a;if(typeof r=="function")a=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===c||r.$$typeof===_))a=r.propTypes;else return;if(a){var v=L(r);wt(a,e.props,"prop",v,e)}else if(r.PropTypes!==void 0&&!ue){ue=!0;var R=L(r);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ft(e){{for(var r=Object.keys(e.props),a=0;a<r.length;a++){var v=r[a];if(v!=="children"&&v!=="key"){V(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),V(null);break}}e.ref!==null&&(V(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}function Ye(e,r,a,v,R,w){{var m=vt(e);if(!m){var y="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(y+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=It();O?y+=O:y+=De();var P;e===null?P="null":ae(e)?P="array":e!==void 0&&e.$$typeof===n?(P="<"+(L(e.type)||"Unknown")+" />",y=" Did you accidentally export a JSX literal instead of a component?"):P=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,y)}var S=At(e,r,a,R,w);if(S==null)return S;if(m){var D=r.children;if(D!==void 0)if(v)if(ae(D)){for(var U=0;U<D.length;U++)Le(D[U],e);Object.freeze&&Object.freeze(D)}else b("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 Le(D,e)}return e===s?Ft(S):kt(S),S}}function Lt(e,r,a){return Ye(e,r,a,!0)}function Yt(e,r,a){return Ye(e,r,a,!1)}var Nt=Yt,Wt=Lt;G.Fragment=s,G.jsx=Nt,G.jsxs=Wt}()),G}process.env.NODE_ENV==="production"?te.exports=We():te.exports=ze();var F=te.exports;const A=h.createContext({}),Me=({children:t,apiURL:n,libraries:o})=>{const s=h.useMemo(()=>({apiURL:n,libraries:o}),[n,o]);return F.jsx(A.Provider,{value:s,children:t})},Ve=({Fallback:t,isLogged:n,loginPath:o="/login",localStorageKey:s="user",redirect401Path:i="/login",...f})=>{var b,N,W,z;const{libraries:l}=h.useContext(A),d=(f==null?void 0:f.reactRouter)||(l==null?void 0:l.reactRouter),c=(f==null?void 0:f.axios)||(l==null?void 0:l.axios);if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[g,E]=h.useState(null),{useLocation:_,Navigate:p,Outlet:u}=d,T=_(),I=h.useRef(!1),x=typeof n=="function"?n():!!n,k=typeof x=="boolean"?x:x==null?void 0:x.isLogged;return h.useEffect(()=>{I.current||(I.current=!0,c.interceptors.response.use(j=>j,async j=>{var Q;return typeof j=="object"&&j&&"response"in j&&j.response&&typeof j.response=="object"&&"status"in j.response&&j.response&&typeof j.response=="object"&&"status"in j.response&&((Q=j==null?void 0:j.response)==null?void 0:Q.status)===401&&(c.defaults.headers.common.Authorization=null,localStorage.removeItem(s),E(i)),Promise.reject(j)}))},[c.defaults.headers.common,c.interceptors.response,s,i]),k&&!g?F.jsx(h.Suspense,{fallback:t,children:(N=(b=T.state)==null?void 0:b.from)!=null&&N.state&&((z=(W=T.state)==null?void 0:W.from)==null?void 0:z.pathname)===o?F.jsx(p,{to:T.state.from.state.from.pathname+T.state.from.state.from.search,replace:!0}):F.jsx(u,{})}):F.jsx(p,{to:o+T.search,state:{from:T},replace:!0})},Ue=({data:t,...n})=>{const{libraries:o}=h.useContext(A),s=(n==null?void 0:n.reactRouter)||(o==null?void 0:o.reactRouter),i=(n==null?void 0:n.gtm)||(o==null?void 0:o.gtm);if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!i)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:f}=i,{useLocation:l,Outlet:d}=s,{pathname:c}=l(),{sendEvent:g}=f();return h.useEffect(()=>{g({event:"pageView",pathname:c,...t})},[t,c,g]),F.jsx(d,{})},Be=({tokenTypeKey:t="tokenType",userLocalStorageKey:n="user",tokenKey:o="accessToken",postContentType:s="application/json",...i})=>{const{apiURL:f=i.apiURL,libraries:l}=h.useContext(A),d=(i==null?void 0:i.axios)||(l==null?void 0:l.axios);if(!d)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(d!=null&&d.defaults))return null;const c=localStorage.getItem(n),g=c?JSON.parse(c):null,E=g!=null&&g[t]?g[t]:null,_=g!=null&&g[o]?g[o]:null,p=c?`${E} ${_}`:null;return d.defaults.baseURL=f,d.defaults.headers.post["Content-Type"]=s,p&&(d.defaults.headers.common.Authorization=p),null},Ge=({debug:t,resources:n,...o})=>{const{libraries:s}=h.useContext(A),i=(o==null?void 0:o.i18)||(s==null?void 0:s.i18),{i18next:f,initReactI18next:l,languageDetector:d}=i||{};if(!i)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return f!=null&&f.isInitialized||(f.use(d).use(l).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==f.resolvedLanguage&&f.resolvedLanguage&&document.documentElement.setAttribute("lang",f.resolvedLanguage)}),f.on("languageChanged",c=>{document.documentElement.setAttribute("lang",c)})),null},Qe=({dsn:t,integrations:n,tracesSampleRate:o,replaysSessionSampleRate:s,replaysOnErrorSampleRate:i,tracePropagationTargets:f,ignoreErrors:l,debug:d,environment:c,...g})=>{const{libraries:E}=h.useContext(A),_=(g==null?void 0:g.sentry)||(E==null?void 0:E.sentry),p=(g==null?void 0:g.reactRouter)||(E==null?void 0:E.reactRouter);if(!_)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!p)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(_.isInitialized())return null;const{createRoutesFromChildren:u,matchRoutes:T,useLocation:I,useNavigationType:x}=p;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&_.init({debug:d,dsn:t,environment:c||"production",ignoreErrors:l,integrations:[_.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:u,matchRoutes:T,useEffect:h.useEffect,useLocation:I,useNavigationType:x}),...n||[]],replaysOnErrorSampleRate:i||1,replaysSessionSampleRate:s||.1,tracePropagationTargets:f,tracesSampleRate:o||1}),null},Je=({IMaskMixin:t,...n})=>{const o=h.useMemo(()=>t(({TextField:s,...i})=>F.jsx(s,{...i})),[t]);return F.jsx(o,{...n})},He=({accessToken:t,...n})=>{const{libraries:o}=h.useContext(A),s=(n==null?void 0:n.mapbox)||(o==null?void 0:o.mapbox);if(!s)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return t&&(s.accessToken=t),null},Ke=({language:t,...n})=>{const{libraries:o}=h.useContext(A),s=(n==null?void 0:n.dayjs)||(o==null?void 0:o.dayjs),i=(n==null?void 0:n.plugin)||(o==null?void 0:o.dayjsPlugin);if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return h.useEffect(()=>{(async()=>{var d;const l=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";i&&i.forEach(c=>{c&&s.extend(c)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),s.locale(l)})().then()},[s,i,t]),null},Xe=()=>(h.useEffect(()=>{const t=()=>{window.location.reload()};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),null),Ze=t=>t&&typeof t=="function",$e=t=>t&&typeof t=="function",qe=({children:t,defaultQueriesOptions:n,defaultMutationsOptions:o,...s})=>{var c,g;const{libraries:i}=h.useContext(A),f=(s==null?void 0:s.QueryClient)||((c=i==null?void 0:i.reactQuery)==null?void 0:c.QueryClient),l=(s==null?void 0:s.QueryClientProvider)||((g=i==null?void 0:i.reactQuery)==null?void 0:g.QueryClientProvider);if(!f)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Ze(l))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!$e(f))throw new Error("Provided QueryClient dependencies are not valid.");const d=new f({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(E,_,p)=>E.length+(p||0),refetchOnWindowFocus:!1,retry:3,...n}}});return F.jsx(l,{client:d,children:t})},et=t=>{var g,E,_;const{libraries:n}=h.useContext(A),o=(t==null?void 0:t.i18)||(n==null?void 0:n.i18),s=((g=t==null?void 0:t.i18)==null?void 0:g.translateFunction)||((E=n==null?void 0:n.i18)==null?void 0:E.translateFunction),i=((_=o==null?void 0:o.i18next)==null?void 0:_.t)||s||(p=>p),{unknownErrorTranslationKey:f="error.unknownError"}=t||{},l=i(f),d=h.useCallback(p=>{var T,I,x,k,b,N,W,z,j;const{response:u}=p||{};return u!=null&&u.reason?String(u.reason):(T=u==null?void 0:u.data)!=null&&T.reason?String(u.data.reason):(I=u==null?void 0:u.data)!=null&&I.message?String(u.data.message):(k=(x=u==null?void 0:u.data)==null?void 0:x.detail)!=null&&k.length&&Array.isArray((b=u==null?void 0:u.data)==null?void 0:b.detail)&&((W=(N=u==null?void 0:u.data)==null?void 0:N.detail[0])!=null&&W.msg)&&typeof((j=(z=u==null?void 0:u.data)==null?void 0:z.detail[0])==null?void 0:j.msg)=="string"?String(u.data.detail[0].msg):l},[l]);return{getErrorCode:h.useCallback(p=>{var T,I,x;const{response:u}=p||{};return u!=null&&u.error_code?String(u==null?void 0:u.error_code):(T=u==null?void 0:u.data)!=null&&T.error_code?String((I=u==null?void 0:u.data)==null?void 0:I.error_code):u!=null&&u.error_code?String(u==null?void 0:u.error_code):(x=u==null?void 0:u.data)!=null&&x.error_code?String(u.data.error_code):"unknown_error_code"},[]),printError:d}},tt=({data:t,fetchNextPage:n,isFetchingNextPage:o,isInitialLoading:s,isLoading:i,enabled:f=!0})=>{const l=h.useCallback(async c=>{o||!f||await n({pageParam:(c==null?void 0:c.pageParam)||c.visibleRowsCount})},[f,n,o]),d=h.useMemo(()=>{if(t)return t.pages.reduce((c,g)=>[...c,...g],[])},[t]);return{fetchNextPageOnRowsScrollEnd:l,isLoading:o||i,loadingVariant:s?"skeleton":"linear",rows:d}},rt=t=>{const{libraries:n}=h.useContext(A),o=(t==null?void 0:t.axios)||(n==null?void 0:n.axios),s=(t==null?void 0:t.localStorageKey)||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const i=h.useCallback(({tokenType:l,accessToken:d})=>{o.defaults.headers.common.Authorization=`${l} ${d}`},[o.defaults.headers.common]),f=()=>{o.defaults.headers.common.Authorization=null};return h.useEffect(()=>{const l=({newValue:d,key:c})=>{if(c===s&&d)try{const{accessToken:g,tokenType:E}=JSON.parse(d);i({accessToken:g,tokenType:E})}catch(g){console.error("Failed to parse newValue from localStorage:",g)}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[s,i]),{clearAuthenticationToken:f,setAuthenticationToken:i}},de=({library:t,date:n,format:o="ll"})=>t(n).format(o),ve=(t,n="km")=>{const o=Number(t);return Number.isNaN(o)?`0 ${n}`:`${o.toFixed(2)} ${n}`},nt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,ot=({path:t,size:n,apiURL:o})=>{if(!t)return"";const s=nt(t),i=`${o}${s}`,f=i.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&f?`${i.replace("/files",`/thumbs/${n}`)}`:i},at=t=>{const{apiURL:n,libraries:o}=h.useContext(A),s=(t==null?void 0:t.dayjs)||(o==null?void 0:o.dayjs);return{dateAdapter:(l,d)=>{if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return de({date:l,format:d,library:s})},distanceAdapter:ve,filePathAdapter:(l,d)=>{if(!n)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return ot({apiURL:n,path:l,size:d})}}},K=(t,n)=>n==="short"?t.split("-")[0]:t,it=(t,n="full")=>{const[o,s]=h.useState(()=>{const i=(t==null?void 0:t.language)||navigator.language;return t&&"isInitialized"in t&&t.isInitialized,K(i,n)});return h.useEffect(()=>{var f;t&&"isInitialized"in t&&t.isInitialized&&t.language&&s(K(t.language,n));const i=l=>{s(K(l,n))};return(f=t==null?void 0:t.on)==null||f.call(t,"languageChanged",i),()=>{var l;(l=t==null?void 0:t.off)==null||l.call(t,"languageChanged",i)}},[t,n]),o},st=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),ut=t=>{const s=t.split("/").filter(i=>i.length>0).map(i=>i.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join("")).join("");return s.charAt(0).toLowerCase()+s.slice(1)},ct=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),lt=(t,n,o)=>{const s=ut(n),i=st(o);return`${s}${i}`},ft=t=>{if(t)return(t==null?void 0:t.reduce((n,o)=>(n[o]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},n),{}))||{}},dt=t=>(Array.isArray(t)?t:[t]).reduce((o,s)=>{const{output:i,operationsToGenerateInfiniteQueryHook:f,input:l="./openapi.json"}=s||{},d=ct(l);return{...o,[d]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:l,output:{baseUrl:i==null?void 0:i.baseUrl,client:"react-query",mode:"tags-split",override:{...(f==null?void 0:f.length)&&{operations:ft(f)},header:c=>["Generated by orval 🍺",...c.title?[c.title]:[],...c.description?[c.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/axiosCustomInstance.ts`},operationName:lt,query:{useQuery:!0}},schemas:(i==null?void 0:i.schemas)||`src/api/${d}/model`,target:(i==null?void 0:i.target)||`src/api/${d}/services/api.ts`,...i}}}},{});C.GTMSendPageView=Ue,C.InitializeAxiosConfig=Be,C.InitializeDaysJSConfig=Ke,C.InitializeI18nConfig=Ge,C.InitializeMapBoxConfig=He,C.InitializeSentryConfig=Qe,C.InjectDependenciesContext=A,C.InjectDependenciesProvider=Me,C.MaskTextField=Je,C.PreloadErrorHandler=Xe,C.QueryClientProviderWithConfig=qe,C.RequireAuth=Ve,C.dateAdapter=de,C.distanceAdapter=ve,C.getOrvalConfig=dt,C.useAdapter=at,C.useAuth=rt,C.useCurrentLanguage=it,C.useInfiniteDataGrid=tt,C.useResponseError=et,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|
|
25
|
+
Check the top-level render call using <`+a+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var a=Dt(r);if(ke[a])return;ke[a]=!0;var v="";e&&e._owner&&e._owner!==se.current&&(v=" It was passed a child from "+L(e._owner.type)+"."),V(e),b('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',a,v),V(null)}}function Le(e,r){{if(typeof e!="object")return;if(ae(e))for(var a=0;a<e.length;a++){var v=e[a];ce(v)&&Fe(v,r)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var R=x(e);if(typeof R=="function"&&R!==e.entries)for(var w=R.call(e),m;!(m=w.next()).done;)ce(m.value)&&Fe(m.value,r)}}}function kt(e){{var r=e.type;if(r==null||typeof r=="string")return;var a;if(typeof r=="function")a=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===c||r.$$typeof===_))a=r.propTypes;else return;if(a){var v=L(r);wt(a,e.props,"prop",v,e)}else if(r.PropTypes!==void 0&&!ue){ue=!0;var R=L(r);b("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",R||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&b("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ft(e){{for(var r=Object.keys(e.props),a=0;a<r.length;a++){var v=r[a];if(v!=="children"&&v!=="key"){V(e),b("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",v),V(null);break}}e.ref!==null&&(V(e),b("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}function Ye(e,r,a,v,R,w){{var m=vt(e);if(!m){var y="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(y+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var O=It();O?y+=O:y+=De();var P;e===null?P="null":ae(e)?P="array":e!==void 0&&e.$$typeof===n?(P="<"+(L(e.type)||"Unknown")+" />",y=" Did you accidentally export a JSX literal instead of a component?"):P=typeof e,b("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",P,y)}var S=At(e,r,a,R,w);if(S==null)return S;if(m){var D=r.children;if(D!==void 0)if(v)if(ae(D)){for(var U=0;U<D.length;U++)Le(D[U],e);Object.freeze&&Object.freeze(D)}else b("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 Le(D,e)}return e===s?Ft(S):kt(S),S}}function Lt(e,r,a){return Ye(e,r,a,!0)}function Yt(e,r,a){return Ye(e,r,a,!1)}var Nt=Yt,Wt=Lt;G.Fragment=s,G.jsx=Nt,G.jsxs=Wt}()),G}process.env.NODE_ENV==="production"?te.exports=We():te.exports=ze();var F=te.exports;const A=h.createContext({}),Me=({children:t,apiURL:n,libraries:o})=>{const s=h.useMemo(()=>({apiURL:n,libraries:o}),[n,o]);return F.jsx(A.Provider,{value:s,children:t})},Ve=({Fallback:t,isLogged:n,loginPath:o="/login",localStorageKey:s="user",redirect401Path:i="/login",...f})=>{var b,N,W,z;const{libraries:l}=h.useContext(A),d=(f==null?void 0:f.reactRouter)||(l==null?void 0:l.reactRouter),c=(f==null?void 0:f.axios)||(l==null?void 0:l.axios);if(!d)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[g,E]=h.useState(null),{useLocation:_,Navigate:p,Outlet:u}=d,T=_(),I=h.useRef(!1),x=typeof n=="function"?n():!!n,k=typeof x=="boolean"?x:x==null?void 0:x.isLogged;return h.useEffect(()=>{I.current||(I.current=!0,c.interceptors.response.use(j=>j,async j=>{var Q;return typeof j=="object"&&j&&"response"in j&&j.response&&typeof j.response=="object"&&"status"in j.response&&j.response&&typeof j.response=="object"&&"status"in j.response&&((Q=j==null?void 0:j.response)==null?void 0:Q.status)===401&&(c.defaults.headers.common.Authorization=null,localStorage.removeItem(s),E(i)),Promise.reject(j)}))},[c.defaults.headers.common,c.interceptors.response,s,i]),k&&!g?F.jsx(h.Suspense,{fallback:t,children:(N=(b=T.state)==null?void 0:b.from)!=null&&N.state&&((z=(W=T.state)==null?void 0:W.from)==null?void 0:z.pathname)===o?F.jsx(p,{to:T.state.from.state.from.pathname+T.state.from.state.from.search,replace:!0}):F.jsx(u,{})}):F.jsx(p,{to:o+T.search,state:{from:T},replace:!0})},Ue=({data:t,...n})=>{const{libraries:o}=h.useContext(A),s=(n==null?void 0:n.reactRouter)||(o==null?void 0:o.reactRouter),i=(n==null?void 0:n.gtm)||(o==null?void 0:o.gtm);if(!s)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!i)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:f}=i,{useLocation:l,Outlet:d}=s,{pathname:c}=l(),{sendEvent:g}=f();return h.useEffect(()=>{g({event:"pageView",pathname:c,...t})},[t,c,g]),F.jsx(d,{})},Be=({tokenTypeKey:t="tokenType",userLocalStorageKey:n="user",tokenKey:o="accessToken",postContentType:s="application/json",...i})=>{const{apiURL:f=i.apiURL,libraries:l}=h.useContext(A),d=(i==null?void 0:i.axios)||(l==null?void 0:l.axios);if(!d)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!(d!=null&&d.defaults))return null;const c=localStorage.getItem(n),g=c?JSON.parse(c):null,E=g!=null&&g[t]?g[t]:null,_=g!=null&&g[o]?g[o]:null,p=c?`${E} ${_}`:null;return d.defaults.baseURL=f,d.defaults.headers.post["Content-Type"]=s,p&&(d.defaults.headers.common.Authorization=p),null},Ge=({debug:t,resources:n,...o})=>{const{libraries:s}=h.useContext(A),i=(o==null?void 0:o.i18)||(s==null?void 0:s.i18),{i18next:f,initReactI18next:l,languageDetector:d}=i||{};if(!i)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return f!=null&&f.isInitialized||(f.use(d).use(l).init({debug:t,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==f.resolvedLanguage&&f.resolvedLanguage&&document.documentElement.setAttribute("lang",f.resolvedLanguage)}),f.on("languageChanged",c=>{document.documentElement.setAttribute("lang",c)})),null},Qe=({dsn:t,integrations:n,tracesSampleRate:o,replaysSessionSampleRate:s,replaysOnErrorSampleRate:i,tracePropagationTargets:f,ignoreErrors:l,debug:d,environment:c,...g})=>{const{libraries:E}=h.useContext(A),_=(g==null?void 0:g.sentry)||(E==null?void 0:E.sentry),p=(g==null?void 0:g.reactRouter)||(E==null?void 0:E.reactRouter);if(!_)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!p)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(_.isInitialized())return null;const{createRoutesFromChildren:u,matchRoutes:T,useLocation:I,useNavigationType:x}=p;return(d||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&_.init({debug:d,dsn:t,environment:c||"production",ignoreErrors:l,integrations:[_.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:u,matchRoutes:T,useEffect:h.useEffect,useLocation:I,useNavigationType:x}),...n||[]],replaysOnErrorSampleRate:i||1,replaysSessionSampleRate:s||.1,tracePropagationTargets:f,tracesSampleRate:o||1}),null},Je=({IMaskMixin:t,...n})=>{const o=h.useMemo(()=>t(({TextField:s,...i})=>F.jsx(s,{...i})),[t]);return F.jsx(o,{...n})},He=({accessToken:t,...n})=>{const{libraries:o}=h.useContext(A),s=(n==null?void 0:n.mapbox)||(o==null?void 0:o.mapbox);if(!s)throw new Error("Mapbox is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return t&&(s.accessToken=t),null},Ke=({language:t,...n})=>{const{libraries:o}=h.useContext(A),s=(n==null?void 0:n.dayjs)||(o==null?void 0:o.dayjs),i=(n==null?void 0:n.plugin)||(o==null?void 0:o.dayjsPlugin);if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return h.useEffect(()=>{(async()=>{var d;const l=t||((d=navigator.language)==null?void 0:d.slice(0,2))||"en";i&&i.forEach(c=>{c&&s.extend(c)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),s.locale(l)})().then()},[s,i,t]),null},Xe=()=>(h.useEffect(()=>{const t=n=>{try{n.preventDefault(),n.stopPropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",t),()=>{window.removeEventListener("vite:preloadError",t)}},[]),null),Ze=t=>t&&typeof t=="function",$e=t=>t&&typeof t=="function",qe=({children:t,defaultQueriesOptions:n,defaultMutationsOptions:o,...s})=>{var c,g;const{libraries:i}=h.useContext(A),f=(s==null?void 0:s.QueryClient)||((c=i==null?void 0:i.reactQuery)==null?void 0:c.QueryClient),l=(s==null?void 0:s.QueryClientProvider)||((g=i==null?void 0:i.reactQuery)==null?void 0:g.QueryClientProvider);if(!f)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!l)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Ze(l))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!$e(f))throw new Error("Provided QueryClient dependencies are not valid.");const d=new f({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(E,_,p)=>E.length+(p||0),refetchOnWindowFocus:!1,retry:3,...n}}});return F.jsx(l,{client:d,children:t})},et=t=>{var g,E,_;const{libraries:n}=h.useContext(A),o=(t==null?void 0:t.i18)||(n==null?void 0:n.i18),s=((g=t==null?void 0:t.i18)==null?void 0:g.translateFunction)||((E=n==null?void 0:n.i18)==null?void 0:E.translateFunction),i=((_=o==null?void 0:o.i18next)==null?void 0:_.t)||s||(p=>p),{unknownErrorTranslationKey:f="error.unknownError"}=t||{},l=i(f),d=h.useCallback(p=>{var T,I,x,k,b,N,W,z,j;const{response:u}=p||{};return u!=null&&u.reason?String(u.reason):(T=u==null?void 0:u.data)!=null&&T.reason?String(u.data.reason):(I=u==null?void 0:u.data)!=null&&I.message?String(u.data.message):(k=(x=u==null?void 0:u.data)==null?void 0:x.detail)!=null&&k.length&&Array.isArray((b=u==null?void 0:u.data)==null?void 0:b.detail)&&((W=(N=u==null?void 0:u.data)==null?void 0:N.detail[0])!=null&&W.msg)&&typeof((j=(z=u==null?void 0:u.data)==null?void 0:z.detail[0])==null?void 0:j.msg)=="string"?String(u.data.detail[0].msg):l},[l]);return{getErrorCode:h.useCallback(p=>{var T,I,x;const{response:u}=p||{};return u!=null&&u.error_code?String(u==null?void 0:u.error_code):(T=u==null?void 0:u.data)!=null&&T.error_code?String((I=u==null?void 0:u.data)==null?void 0:I.error_code):u!=null&&u.error_code?String(u==null?void 0:u.error_code):(x=u==null?void 0:u.data)!=null&&x.error_code?String(u.data.error_code):"unknown_error_code"},[]),printError:d}},tt=({data:t,fetchNextPage:n,isFetchingNextPage:o,isInitialLoading:s,isLoading:i,enabled:f=!0})=>{const l=h.useCallback(async c=>{o||!f||await n({pageParam:(c==null?void 0:c.pageParam)||c.visibleRowsCount})},[f,n,o]),d=h.useMemo(()=>{if(t)return t.pages.reduce((c,g)=>[...c,...g],[])},[t]);return{fetchNextPageOnRowsScrollEnd:l,isLoading:o||i,loadingVariant:s?"skeleton":"linear",rows:d}},rt=t=>{const{libraries:n}=h.useContext(A),o=(t==null?void 0:t.axios)||(n==null?void 0:n.axios),s=(t==null?void 0:t.localStorageKey)||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const i=h.useCallback(({tokenType:l,accessToken:d})=>{o.defaults.headers.common.Authorization=`${l} ${d}`},[o.defaults.headers.common]),f=()=>{o.defaults.headers.common.Authorization=null};return h.useEffect(()=>{const l=({newValue:d,key:c})=>{if(c===s&&d)try{const{accessToken:g,tokenType:E}=JSON.parse(d);i({accessToken:g,tokenType:E})}catch(g){console.error("Failed to parse newValue from localStorage:",g)}};return window.addEventListener("storage",l),()=>{window.removeEventListener("storage",l)}},[s,i]),{clearAuthenticationToken:f,setAuthenticationToken:i}},de=({library:t,date:n,format:o="ll"})=>t(n).format(o),ve=(t,n="km")=>{const o=Number(t);return Number.isNaN(o)?`0 ${n}`:`${o.toFixed(2)} ${n}`},nt=t=>t!=null&&t.startsWith("/")?t!=null&&t.startsWith("/files")?t:`/files${t}`:t!=null&&t.startsWith("files")?`/${t}`:t!=null&&t.startsWith("files")?`/${t}`:`/files/${t}`,ot=({path:t,size:n,apiURL:o})=>{if(!t)return"";const s=nt(t),i=`${o}${s}`,f=i.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&f?`${i.replace("/files",`/thumbs/${n}`)}`:i},at=t=>{const{apiURL:n,libraries:o}=h.useContext(A),s=(t==null?void 0:t.dayjs)||(o==null?void 0:o.dayjs);return{dateAdapter:(l,d)=>{if(!s)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return de({date:l,format:d,library:s})},distanceAdapter:ve,filePathAdapter:(l,d)=>{if(!n)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return ot({apiURL:n,path:l,size:d})}}},K=(t,n)=>n==="short"?t.split("-")[0]:t,it=(t,n="full")=>{const[o,s]=h.useState(()=>{const i=(t==null?void 0:t.language)||navigator.language;return t&&"isInitialized"in t&&t.isInitialized,K(i,n)});return h.useEffect(()=>{var f;t&&"isInitialized"in t&&t.isInitialized&&t.language&&s(K(t.language,n));const i=l=>{s(K(l,n))};return(f=t==null?void 0:t.on)==null||f.call(t,"languageChanged",i),()=>{var l;(l=t==null?void 0:t.off)==null||l.call(t,"languageChanged",i)}},[t,n]),o},st=t=>t.charAt(0).toUpperCase()+t.slice(1).toLowerCase(),ut=t=>{const s=t.split("/").filter(i=>i.length>0).map(i=>i.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join("")).join("");return s.charAt(0).toLowerCase()+s.slice(1)},ct=t=>(t.split("/").pop()||t).replace(/\.json$/,"").replace(/^openapi\./,""),lt=(t,n,o)=>{const s=ut(n),i=st(o);return`${s}${i}`},ft=t=>{if(t)return(t==null?void 0:t.reduce((n,o)=>(n[o]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}},n),{}))||{}},dt=t=>(Array.isArray(t)?t:[t]).reduce((o,s)=>{const{output:i,operationsToGenerateInfiniteQueryHook:f,input:l="./openapi.json"}=s||{},d=ct(l);return{...o,[d]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:l,output:{baseUrl:i==null?void 0:i.baseUrl,client:"react-query",mode:"tags-split",override:{...(f==null?void 0:f.length)&&{operations:ft(f)},header:c=>["Generated by orval 🍺",...c.title?[c.title]:[],...c.description?[c.description]:[]],mutator:{name:"axiosCustomInstance",path:`${__dirname}/axiosCustomInstance.ts`},operationName:lt,query:{useQuery:!0}},schemas:(i==null?void 0:i.schemas)||`src/api/${d}/model`,target:(i==null?void 0:i.target)||`src/api/${d}/services/api.ts`,...i}}}},{});C.GTMSendPageView=Ue,C.InitializeAxiosConfig=Be,C.InitializeDaysJSConfig=Ke,C.InitializeI18nConfig=Ge,C.InitializeMapBoxConfig=He,C.InitializeSentryConfig=Qe,C.InjectDependenciesContext=A,C.InjectDependenciesProvider=Me,C.MaskTextField=Je,C.PreloadErrorHandler=Xe,C.QueryClientProviderWithConfig=qe,C.RequireAuth=Ve,C.dateAdapter=de,C.distanceAdapter=ve,C.getOrvalConfig=dt,C.useAdapter=at,C.useAuth=rt,C.useCurrentLanguage=it,C.useInfiniteDataGrid=tt,C.useResponseError=et,Object.defineProperty(C,Symbol.toStringTag,{value:"Module"})});
|