@tracktor/shared-module 2.14.3 → 2.14.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Changelog
2
2
 
3
- ## [2.14.3] - 2025-07-02
3
+ ## [2.14.4] - 2025-07-02
4
4
 
5
5
  ### 🔧 Fixed
6
- - **package.json exports**: Fixed peer dependency react
6
+ - **package.json exports**: Fixed dependency react
@@ -11,10 +11,10 @@ export interface useAdapterParams {
11
11
  */
12
12
  export declare const useAdapter: (params?: useAdapterParams) => {
13
13
  dateAdapter: (date: string | number | Date | null | undefined, format?: string) => string;
14
- distanceAdapter: (distance?: string | number | null | undefined, options?: {
15
- fractionDigits?: number | undefined;
16
- metric?: string | undefined;
17
- } | undefined) => string;
14
+ distanceAdapter: (distance?: string | number | null, options?: {
15
+ fractionDigits?: number;
16
+ metric?: string;
17
+ }) => string;
18
18
  filePathAdapter: (path?: string | null, size?: number | "full") => string;
19
19
  worksiteNameAdapter: (name: unknown) => string;
20
20
  };
@@ -24,11 +24,11 @@ declare const useFilters: (options?: useFiltersOptions) => {
24
24
  readonly handleFilter: () => () => void;
25
25
  readonly setFilter: () => void;
26
26
  } | {
27
- getFilter: <T = string, DefaultValue = undefined>(name: string, defaultValue?: T | undefined) => DefaultValue extends undefined ? T | undefined : T;
27
+ getFilter: <T = string, DefaultValue = undefined>(name: string, defaultValue?: T) => DefaultValue extends undefined ? T | undefined : T;
28
28
  getFilters: () => {
29
29
  [x: string]: any;
30
30
  };
31
- handleFilter: <T_1>(name: string, key?: string) => (_: SyntheticEvent, value?: T_1 | undefined) => void;
31
+ handleFilter: <T>(name: string, key?: string) => (_: SyntheticEvent, value?: T) => void;
32
32
  setFilter: (name: string, value: unknown, persist?: boolean) => void;
33
33
  };
34
34
  export default useFilters;
@@ -27,7 +27,7 @@ export interface useResponseErrorParams {
27
27
  * @param params
28
28
  */
29
29
  export declare const useResponseError: <T = ResponseError>(params?: useResponseErrorParams) => {
30
- getErrorCode: (error?: any) => string;
31
- printError: (error?: unknown) => any;
30
+ getErrorCode: (error?: T | any) => string;
31
+ printError: (error?: T | unknown) => any;
32
32
  };
33
33
  export default useResponseError;
package/dist/main.cjs CHANGED
@@ -1,25 +1,22 @@
1
- "use strict";var yr=Object.create;var Oe=Object.defineProperty;var hr=Object.getOwnPropertyDescriptor;var mr=Object.getOwnPropertyNames;var Er=Object.getPrototypeOf,br=Object.prototype.hasOwnProperty;var Rr=(r,n,o,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let a of mr(n))!br.call(r,a)&&a!==o&&Oe(r,a,{get:()=>n[a],enumerable:!(i=hr(n,a))||i.enumerable});return r};var Ie=(r,n,o)=>(o=r!=null?yr(Er(r)):{},Rr(n||!r||!r.__esModule?Oe(o,"default",{value:r,enumerable:!0}):o,r));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react");var q={exports:{}},z={};/**
1
+ "use strict";var de=Object.create;var B=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var pe=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,me=Object.prototype.hasOwnProperty;var ye=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of pe(r))!me.call(e,n)&&n!==o&&B(e,n,{get:()=>r[n],enumerable:!(a=fe(r,n))||a.enumerable});return e};var X=(e,r,o)=>(o=e!=null?de(ge(e)):{},ye(r||!e||!e.__esModule?B(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("react");var N={exports:{}},k={};/**
2
2
  * @license React
3
- * react-jsx-runtime.production.min.js
3
+ * react-jsx-runtime.production.js
4
4
  *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ke;function wr(){if(ke)return z;ke=1;var r=m,n=Symbol.for("react.element"),o=Symbol.for("react.fragment"),i=Object.prototype.hasOwnProperty,a=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function f(p,c,g){var u,w={},h=null,_=null;g!==void 0&&(h=""+g),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(_=c.ref);for(u in c)i.call(c,u)&&!l.hasOwnProperty(u)&&(w[u]=c[u]);if(p&&p.defaultProps)for(u in c=p.defaultProps,c)w[u]===void 0&&(w[u]=c[u]);return{$$typeof:n,type:p,key:h,ref:_,props:w,_owner:a.current}}return z.Fragment=o,z.jsx=f,z.jsxs=f,z}var U={};/**
9
+ */var H;function he(){if(H)return k;H=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 k.Fragment=r,k.jsx=o,k.jsxs=o,k}var I={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var De;function _r(){return De||(De=1,process.env.NODE_ENV!=="production"&&function(){var r=m,n=Symbol.for("react.element"),o=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),a=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),p=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),g=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),w=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),x=Symbol.iterator,b="@@iterator";function O(e){if(e===null||typeof e!="object")return null;var t=x&&e[x]||e[b];return typeof t=="function"?t:null}var P=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(e){{for(var t=arguments.length,s=new Array(t>1?t-1:0),d=1;d<t;d++)s[d-1]=arguments[d];T("error",e,s)}}function T(e,t,s){{var d=P.ReactDebugCurrentFrame,E=d.getStackAddendum();E!==""&&(t+="%s",s=s.concat([E]));var R=s.map(function(y){return String(y)});R.unshift("Warning: "+t),Function.prototype.apply.call(console[e],console,R)}}var oe=!1,ae=!1,We=!1,ze=!1,Ue=!1,ie;ie=Symbol.for("react.module.reference");function Ve(e){return!!(typeof e=="string"||typeof e=="function"||e===i||e===l||Ue||e===a||e===g||e===u||ze||e===_||oe||ae||We||typeof e=="object"&&e!==null&&(e.$$typeof===h||e.$$typeof===w||e.$$typeof===f||e.$$typeof===p||e.$$typeof===c||e.$$typeof===ie||e.getModuleId!==void 0))}function Me(e,t,s){var d=e.displayName;if(d)return d;var E=t.displayName||t.name||"";return E!==""?s+"("+E+")":s}function se(e){return e.displayName||"Context"}function L(e){if(e==null)return null;if(typeof e.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case i:return"Fragment";case o:return"Portal";case l:return"Profiler";case a:return"StrictMode";case g:return"Suspense";case u:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case p:var t=e;return se(t)+".Consumer";case f:var s=e;return se(s._context)+".Provider";case c:return Me(e,e.render,"ForwardRef");case w:var d=e.displayName||null;return d!==null?d:L(e.type)||"Memo";case h:{var E=e,R=E._payload,y=E._init;try{return L(y(R))}catch{return null}}}return null}var $=Object.assign,W=0,ue,ce,le,fe,de,pe,ge;function ve(){}ve.__reactDisabledLog=!0;function Qe(){{if(W===0){ue=console.log,ce=console.info,le=console.warn,fe=console.error,de=console.group,pe=console.groupCollapsed,ge=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ve,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}W++}}function Ke(){{if(W--,W===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:$({},e,{value:ue}),info:$({},e,{value:ce}),warn:$({},e,{value:le}),error:$({},e,{value:fe}),group:$({},e,{value:de}),groupCollapsed:$({},e,{value:pe}),groupEnd:$({},e,{value:ge})})}W<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var H=P.ReactCurrentDispatcher,X;function M(e,t,s){{if(X===void 0)try{throw Error()}catch(E){var d=E.stack.trim().match(/\n( *(at )?)/);X=d&&d[1]||""}return`
18
- `+X+e}}var Z=!1,Q;{var Ge=typeof WeakMap=="function"?WeakMap:Map;Q=new Ge}function ye(e,t){if(!e||Z)return"";{var s=Q.get(e);if(s!==void 0)return s}var d;Z=!0;var E=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var R;R=H.current,H.current=null,Qe();try{if(t){var y=function(){throw Error()};if(Object.defineProperty(y.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(y,[])}catch(D){d=D}Reflect.construct(e,[],y)}else{try{y.call()}catch(D){d=D}e.call(y.prototype)}}else{try{throw Error()}catch(D){d=D}e()}}catch(D){if(D&&d&&typeof D.stack=="string"){for(var v=D.stack.split(`
19
- `),A=d.stack.split(`
20
- `),C=v.length-1,S=A.length-1;C>=1&&S>=0&&v[C]!==A[S];)S--;for(;C>=1&&S>=0;C--,S--)if(v[C]!==A[S]){if(C!==1||S!==1)do if(C--,S--,S<0||v[C]!==A[S]){var k=`
21
- `+v[C].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),typeof e=="function"&&Q.set(e,k),k}while(C>=1&&S>=0);break}}}finally{Z=!1,H.current=R,Ke(),Error.prepareStackTrace=E}var Y=e?e.displayName||e.name:"",Ae=Y?M(Y):"";return typeof e=="function"&&Q.set(e,Ae),Ae}function Je(e,t,s){return ye(e,!1)}function qe(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function K(e,t,s){if(e==null)return"";if(typeof e=="function")return ye(e,qe(e));if(typeof e=="string")return M(e);switch(e){case g:return M("Suspense");case u:return M("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return Je(e.render);case w:return K(e.type,t,s);case h:{var d=e,E=d._payload,R=d._init;try{return K(R(E),t,s)}catch{}}}return""}var G=Object.prototype.hasOwnProperty,he={},me=P.ReactDebugCurrentFrame;function J(e){if(e){var t=e._owner,s=K(e.type,e._source,t?t.type:null);me.setExtraStackFrame(s)}else me.setExtraStackFrame(null)}function Be(e,t,s,d,E){{var R=Function.call.bind(G);for(var y in e)if(R(e,y)){var v=void 0;try{if(typeof e[y]!="function"){var A=Error((d||"React class")+": "+s+" type `"+y+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[y]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw A.name="Invariant Violation",A}v=e[y](t,y,d,s,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(C){v=C}v&&!(v instanceof Error)&&(J(E),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",d||"React class",s,y,typeof v),J(null)),v instanceof Error&&!(v.message in he)&&(he[v.message]=!0,J(E),j("Failed %s type: %s",s,v.message),J(null))}}}var He=Array.isArray;function ee(e){return He(e)}function Xe(e){{var t=typeof Symbol=="function"&&Symbol.toStringTag,s=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return s}}function Ze(e){try{return Ee(e),!1}catch{return!0}}function Ee(e){return""+e}function be(e){if(Ze(e))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Xe(e)),Ee(e)}var Re=P.ReactCurrentOwner,er={key:!0,ref:!0,__self:!0,__source:!0},we,_e;function rr(e){if(G.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return e.ref!==void 0}function tr(e){if(G.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function nr(e,t){typeof e.ref=="string"&&Re.current}function or(e,t){{var s=function(){we||(we=!0,j("%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://reactjs.org/link/special-props)",t))};s.isReactWarning=!0,Object.defineProperty(e,"key",{get:s,configurable:!0})}}function ar(e,t){{var s=function(){_e||(_e=!0,j("%s: `ref` 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://reactjs.org/link/special-props)",t))};s.isReactWarning=!0,Object.defineProperty(e,"ref",{get:s,configurable:!0})}}var ir=function(e,t,s,d,E,R,y){var v={$$typeof:n,type:e,key:t,ref:s,props:y,_owner:R};return v._store={},Object.defineProperty(v._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(v,"_self",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.defineProperty(v,"_source",{configurable:!1,enumerable:!1,writable:!1,value:E}),Object.freeze&&(Object.freeze(v.props),Object.freeze(v)),v};function sr(e,t,s,d,E){{var R,y={},v=null,A=null;s!==void 0&&(be(s),v=""+s),tr(t)&&(be(t.key),v=""+t.key),rr(t)&&(A=t.ref,nr(t,E));for(R in t)G.call(t,R)&&!er.hasOwnProperty(R)&&(y[R]=t[R]);if(e&&e.defaultProps){var C=e.defaultProps;for(R in C)y[R]===void 0&&(y[R]=C[R])}if(v||A){var S=typeof e=="function"?e.displayName||e.name||"Unknown":e;v&&or(y,S),A&&ar(y,S)}return ir(e,v,A,E,d,Re.current,y)}}var re=P.ReactCurrentOwner,Ce=P.ReactDebugCurrentFrame;function N(e){if(e){var t=e._owner,s=K(e.type,e._source,t?t.type:null);Ce.setExtraStackFrame(s)}else Ce.setExtraStackFrame(null)}var te;te=!1;function ne(e){return typeof e=="object"&&e!==null&&e.$$typeof===n}function Se(){{if(re.current){var e=L(re.current.type);if(e)return`
22
-
23
- Check the render method of \``+e+"`."}return""}}function ur(e){return""}var Pe={};function cr(e){{var t=Se();if(!t){var s=typeof e=="string"?e:e.displayName||e.name;s&&(t=`
24
-
25
- Check the top-level render call using <`+s+">.")}return t}}function je(e,t){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var s=cr(t);if(Pe[s])return;Pe[s]=!0;var d="";e&&e._owner&&e._owner!==re.current&&(d=" It was passed a child from "+L(e._owner.type)+"."),N(e),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',s,d),N(null)}}function Te(e,t){{if(typeof e!="object")return;if(ee(e))for(var s=0;s<e.length;s++){var d=e[s];ne(d)&&je(d,t)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var E=O(e);if(typeof E=="function"&&E!==e.entries)for(var R=E.call(e),y;!(y=R.next()).done;)ne(y.value)&&je(y.value,t)}}}function lr(e){{var t=e.type;if(t==null||typeof t=="string")return;var s;if(typeof t=="function")s=t.propTypes;else if(typeof t=="object"&&(t.$$typeof===c||t.$$typeof===w))s=t.propTypes;else return;if(s){var d=L(t);Be(s,e.props,"prop",d,e)}else if(t.PropTypes!==void 0&&!te){te=!0;var E=L(t);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",E||"Unknown")}typeof t.getDefaultProps=="function"&&!t.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function fr(e){{for(var t=Object.keys(e.props),s=0;s<t.length;s++){var d=t[s];if(d!=="children"&&d!=="key"){N(e),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",d),N(null);break}}e.ref!==null&&(N(e),j("Invalid attribute `ref` supplied to `React.Fragment`."),N(null))}}function xe(e,t,s,d,E,R){{var y=Ve(e);if(!y){var v="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(v+=" 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 A=ur();A?v+=A:v+=Se();var C;e===null?C="null":ee(e)?C="array":e!==void 0&&e.$$typeof===n?(C="<"+(L(e.type)||"Unknown")+" />",v=" Did you accidentally export a JSX literal instead of a component?"):C=typeof e,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",C,v)}var S=sr(e,t,s,E,R);if(S==null)return S;if(y){var k=t.children;if(k!==void 0)if(d)if(ee(k)){for(var Y=0;Y<k.length;Y++)Te(k[Y],e);Object.freeze&&Object.freeze(k)}else j("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 Te(k,e)}return e===i?fr(S):lr(S),S}}function dr(e,t,s){return xe(e,t,s,!0)}function pr(e,t,s){return xe(e,t,s,!1)}var gr=pr,vr=dr;U.Fragment=i,U.jsx=gr,U.jsxs=vr}()),U}var Fe;function Cr(){return Fe||(Fe=1,process.env.NODE_ENV==="production"?q.exports=wr():q.exports=_r()),q.exports}var F=Cr();const I=m.createContext({}),Sr=({children:r,apiURL:n,libraries:o,localStorageKeys:i})=>{const a=m.useMemo(()=>({apiURL:n,libraries:o,localStorageKeys:i}),[n,o,i]);return F.jsx(I.Provider,{value:a,children:r})},Pr="user",jr=({Fallback:r,isLogged:n,loginPath:o="/login",redirect401Path:i="/login",...a})=>{const{libraries:l,localStorageKeys:f}=m.useContext(I),p=a?.reactRouter||l?.reactRouter,c=a?.axios||l?.axios,g=a?.localStorageKey||f?.user||Pr;if(!p)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[u,w]=m.useState(null),{useLocation:h,Navigate:_,Outlet:x}=p,b=h(),O=m.useRef(!1),P=typeof n=="function"?n():!!n,j=typeof P=="boolean"?P:P?.isLogged;return m.useEffect(()=>{O.current||(O.current=!0,c.interceptors.response.use(T=>T,async T=>(typeof T=="object"&&T&&"response"in T&&T.response&&typeof T.response=="object"&&"status"in T.response&&T.response&&typeof T.response=="object"&&"status"in T.response&&T?.response?.status===401&&(c.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(g),w(i)),Promise.reject(T))))},[c.defaults.headers.common,c.interceptors.response,g,i]),j&&!u?F.jsx(m.Suspense,{fallback:r,children:b.state?.from?.state&&b.state?.from?.pathname===o?F.jsx(_,{to:b.state.from.state.from.pathname+b.state.from.state.from.search,replace:!0}):F.jsx(x,{})}):F.jsx(_,{to:o+b.search,state:{from:b},replace:!0})},Tr=({data:r,...n})=>{const{libraries:o}=m.useContext(I),i=n?.reactRouter||o?.reactRouter,a=n?.gtm||o?.gtm;if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");if(!a)throw new Error("GTM is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const{useGoogleTagManager:l}=a,{useLocation:f,Outlet:p}=i,{pathname:c}=f(),{sendEvent:g}=l();return m.useEffect(()=>{g({event:"pageView",pathname:c,...r})},[r,c,g]),F.jsx(p,{})},V=(()=>{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}})(),xr="user",Ar=({tokenTypeKey:r="tokenType",tokenKey:n="accessToken",postContentType:o="application/json",...i})=>{const{apiURL:a=i.apiURL,libraries:l,localStorageKeys:f}=m.useContext(I),p=i?.userLocalStorageKey||f?.user||xr,c=i?.axios||l?.axios;if(!c)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!c?.defaults||V)return null;if(typeof window<"u"&&window.localStorage){const g=localStorage.getItem(p),u=g?JSON.parse(g):null,w=u?.[r]?u[r]:null,h=u?.[n]?u[n]:null,_=g?`${w} ${h}`:null;_&&(c.defaults.headers.common.Authorization=_)}return c.defaults.baseURL=a,c.defaults.headers.post["Content-Type"]=o,null},Or=({debug:r,resources:n,...o})=>{const{libraries:i}=m.useContext(I),a=o?.i18||i?.i18,{i18next:l,initReactI18next:f,languageDetector:p}=a||{};if(V)return null;if(!a)throw new Error("i18 is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return l?.isInitialized||(l.use(p).use(f).init({debug:r,fallbackLng:"en",interpolation:{escapeValue:!1},load:"languageOnly",react:{bindI18n:"languageChanged loaded",useSuspense:!0},resources:n,returnNull:!1}).then(()=>{document.documentElement.lang!==l.resolvedLanguage&&l.resolvedLanguage&&document.documentElement.setAttribute("lang",l.resolvedLanguage)}),l.on("languageChanged",c=>{document.documentElement.setAttribute("lang",c)})),null},Ir=({dsn:r,integrations:n,tracesSampleRate:o,replaysSessionSampleRate:i,replaysOnErrorSampleRate:a,tracePropagationTargets:l,ignoreErrors:f,debug:p,environment:c,release:g,...u})=>{const{libraries:w}=m.useContext(I),h=u?.sentry||w?.sentry,_=u?.reactRouter||w?.reactRouter;if(!h)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!_)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(h.isInitialized())return null;const{createRoutesFromChildren:x,matchRoutes:b,useLocation:O,useNavigationType:P}=_;return(p||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&h.init({debug:p,dsn:r,environment:c||"production",ignoreErrors:[...f||[],/dynamically imported module/,/Cannot read properties of undefined \(reading 'default'\)/,/Loading chunk \d+ failed/,/ChunkLoadError/,/Failed to fetch dynamically imported module/,/vite:preloadError/],integrations:[h.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:x,matchRoutes:b,useEffect:m.useEffect,useLocation:O,useNavigationType:P}),...n||[]],release:g,replaysOnErrorSampleRate:a||1,replaysSessionSampleRate:i||.1,tracePropagationTargets:l,tracesSampleRate:o||1}),null},kr=({IMaskMixin:r,...n})=>{const o=m.useMemo(()=>r(({TextField:i,...a})=>F.jsx(i,{...a})),[r]);return F.jsx(o,{...n})},Dr=({language:r,...n})=>{const{libraries:o}=m.useContext(I),i=n?.dayjs||o?.dayjs,a=n?.plugin||o?.dayjsPlugin;if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props of InitializeDaysJSConfig.");return m.useEffect(()=>{(async()=>{const f=r||navigator.language?.slice(0,2)||"en";a&&a.forEach(p=>{p&&i.extend(p)}),await import("dayjs/locale/en"),await import("dayjs/locale/fr"),i.locale(f)})().then()},[i,a,r]),null},Fr=()=>(m.useEffect(()=>{if(V)return;const r=n=>{try{n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),window.location.reload()}catch{}};return window.addEventListener("vite:preloadError",r),()=>{window.removeEventListener("vite:preloadError",r)}},[]),null),Lr=r=>r&&typeof r=="function",$r=r=>r&&typeof r=="function",Nr=({children:r,defaultQueriesOptions:n,defaultMutationsOptions:o,...i})=>{const{libraries:a}=m.useContext(I),l=i?.QueryClient||a?.reactQuery?.QueryClient,f=i?.QueryClientProvider||a?.reactQuery?.QueryClientProvider;if(!l)throw new Error("QueryClient is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!f)throw new Error("QueryClientProvider is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!Lr(f))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!$r(l))throw new Error("Provided QueryClient dependencies are not valid.");const p=new l({defaultOptions:{mutations:{...o},queries:{getNextPageParam:(c,g,u)=>c.length+(u||0),refetchOnWindowFocus:!1,retry:3,...n}}});return F.jsx(f,{client:p,children:r})},Yr=r=>{const{libraries:n}=m.useContext(I),o=r?.i18||n?.i18,i=r?.i18?.translateFunction||n?.i18?.translateFunction,a=o?.i18next?.t||i||(g=>g),{unknownErrorTranslationKey:l="error.unknownError"}=r||{},f=a(l),p=m.useCallback(g=>{if(g&&typeof g=="object"&&"response"in g){const{response:u}=g||{};if(u&&typeof u=="object"&&"reason"in u)return String(u.reason);if(u&&typeof u=="object"&&"data"in u&&u.data&&typeof u.data=="object"&&"reason"in u.data)return String(u.data.reason);if(u&&typeof u=="object"&&"data"in u&&u.data&&typeof u.data=="object"&&"message"in u.data)return String(u.data.message);if(u&&typeof u=="object"&&"data"in u&&u.data&&typeof u.data=="object"&&"detail"in u.data){const{detail:w}=u.data;if(Array.isArray(w)&&w.length>0&&typeof w[0]=="object"&&w[0]!==null&&"msg"in w[0]){const{msg:h}=w[0];if(typeof h=="string")return String(h)}}}return g instanceof Error?g.message:f},[f]);return{getErrorCode:m.useCallback(g=>{const{response:u}=g||{};return u?.error_code?String(u?.error_code):u?.data?.error_code?String(u?.data?.error_code):u?.error_code?String(u?.error_code):u?.data?.error_code?String(u.data.error_code):"unknown_error_code"},[]),printError:p}},Wr=({data:r,fetchNextPage:n,isFetchingNextPage:o,isInitialLoading:i,isLoading:a,enabled:l=!0})=>{const f=m.useCallback(async c=>{o||!l||await n({pageParam:c?.pageParam||c.visibleRowsCount})},[l,n,o]),p=m.useMemo(()=>{if(r)return r.pages.reduce((c,g)=>[...c,...g],[])},[r]);return{fetchNextPageOnRowsScrollEnd:f,isLoading:o||a,loadingVariant:i?"skeleton":"linear",rows:p}},zr=r=>{const{libraries:n}=m.useContext(I),o=r?.axios||n?.axios,i=r?.localStorageKey||"user";if(!o)throw new Error("Axios is not provided. You can provide it with InjectDependenciesProvider or directly in params of useAuth.");const a=m.useCallback(({tokenType:f,accessToken:p})=>{o.defaults.headers.common.Authorization=`${f} ${p}`},[o.defaults.headers.common]),l=()=>{o.defaults.headers.common.Authorization=null};return m.useEffect(()=>{if(V)return;const f=({newValue:p,key:c})=>{if(c===i&&p)try{const{accessToken:g,tokenType:u}=JSON.parse(p);a({accessToken:g,tokenType:u})}catch(g){console.error("Failed to parse newValue from localStorage:",g)}};return window.addEventListener("storage",f),()=>{window.removeEventListener("storage",f)}},[i,a]),{clearAuthenticationToken:l,setAuthenticationToken:a}},$e=({library:r,date:n,format:o="ll"})=>r(n).format(o),Ne=(r,n)=>{const{fractionDigits:o=0,metric:i="km"}=n||{},a=Number(r);return Number.isNaN(a)?`0${i}`:`${a.toFixed(o)}${i}`},Ye=r=>!r||typeof r!="string"?"":r.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),Ur=r=>r?.startsWith("/")?r?.startsWith("/files")?r:`/files${r}`:r?.startsWith("files")?`/${r}`:`/files/${r}`,Vr=({path:r,size:n,apiURL:o})=>{if(!r)return"";const i=Ur(r),a=`${o}${i}`,l=a.match(/\.(jpeg|jpg|png|gif|bmp|webp|svg|avif)$/)!==null;return typeof n=="number"&&l?`${a.replace("/files",`/thumbs/${n}`)}`:a},Mr=r=>{const{apiURL:n,libraries:o}=m.useContext(I),i=r?.dayjs||o?.dayjs;return{dateAdapter:(f,p)=>{if(!i)throw new Error("Dayjs is not provided. You can provide it with InjectDependenciesProvider or directly in props.");return $e({date:f,format:p,library:i})},distanceAdapter:Ne,filePathAdapter:(f,p)=>{if(!n)throw new Error("API URL is not provided. You can provide it with InjectDependenciesProvider or directly in props to filePathAdapter.");return Vr({apiURL:n,path:f,size:p})},worksiteNameAdapter:Ye}},B=(r,n)=>n==="short"?r.split("-")[0]:r,Qr=(r,n="full")=>{const[o,i]=m.useState(()=>{const a=r?.language||navigator.language;return r&&"isInitialized"in r&&r.isInitialized,B(a,n)});return m.useEffect(()=>{r&&"isInitialized"in r&&r.isInitialized&&r.language&&i(B(r.language,n));const a=l=>{i(B(l,n))};return r?.on?.("languageChanged",a),()=>{r?.off?.("languageChanged",a)}},[r,n]),o},Kr="tracktor.filter",Gr={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},Le=(r,n,o)=>`${o}_${r}=>${n}`,Jr=r=>{const{libraries:n,localStorageKeys:o}=m.useContext(I),i=r?.reactRouter||n?.reactRouter,{pathname:a}=i?.useLocation?.()??{pathname:"/"},[l,f]=i?.useSearchParams?.()??[new URLSearchParams,()=>{}],p=o?.filter||Kr;if(V)return Gr;if(!i)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const c=(h,_,x=!0)=>{const b=Le(h,r?.pathname||a,p);if(!_||Array.isArray(_)&&!_.length){l.delete(h),f(l),localStorage.removeItem(b);return}x&&_&&localStorage.setItem(b,JSON.stringify({...l,[h]:_})),_&&(l.set(h,JSON.stringify(_)),f(l))};return{getFilter:(h,_)=>{const x=l.get(h);if(x)try{return JSON.parse(x)}catch{return x}const b=Le(h,r?.pathname||a,p),O=localStorage.getItem(b);if(O)try{return JSON.parse(O)[h]}catch{}return _},getFilters:()=>{const h=Object.fromEntries(l.entries()),x=Object.keys(localStorage).filter(b=>b.startsWith(p)&&b.endsWith(r?.pathname||a)).reduce((b,O)=>{const P=localStorage.getItem(O);if(P){const j=JSON.parse(P),T=Object.keys(j)?.[0];b[T]=Object.values(j)?.[0]}return b},{});return{...h,...x}},handleFilter:(h,_)=>(x,b)=>{if(b||Array.isArray(b)&&b.length===0){const O=_||"value",P=typeof b=="object"&&O in b?b[O]:b;c(h,P);return}c(h,void 0)},setFilter:c}},qr=r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase(),Br=r=>{const i=r.split("/").filter(a=>a.length>0).map(a=>a.replace(/\${([^}]*)}/g,"$1").split(/[_-]/).map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join("")).join("");return i.charAt(0).toLowerCase()+i.slice(1)},Hr=r=>(r.split("/").pop()||r).replace(/\.json$/,"").replace(/^openapi\./,""),Xr=(r,n,o,i)=>{const a=Br(n),l=qr(o),f=`${a}${l}`;return r&&typeof r=="object"&&"operationId"in r&&i?.includes(String(r.operationId))?`${f}AsQuery`:f},Zr=(r,n)=>{const o={};return r?.forEach(i=>{o[i]={query:{useInfinite:!0,useInfiniteQueryParam:"offset",useQuery:!0}}}),n?.filter(i=>!o[i]).forEach(i=>{o[i]={query:{useQuery:!0}}}),Object.keys(o).length?o:void 0},et=r=>(Array.isArray(r)?r:[r]).reduce((o,i)=>{const{output:a,useInfiniteIds:l,useQueryIds:f,input:p="./openapi.json"}=i||{},c=Hr(p);return{...o,[c]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:p,output:{baseUrl:a?.baseUrl,client:"react-query",mode:"tags-split",override:{...(l?.length||f?.length)&&{operations:Zr(l,f)},header:g=>["Generated by orval 🍺",...g.title?[g.title]:[],...g.description?[g.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(g,u,w)=>Xr(g,u,w,f),query:{useQuery:!0}},schemas:a?.schemas||`src/api/${c}/model`,target:a?.target||`src/api/${c}/services/api.ts`,...a}}}},{});exports.GTMSendPageView=Tr;exports.InitializeAxiosConfig=Ar;exports.InitializeDaysJSConfig=Dr;exports.InitializeI18nConfig=Or;exports.InitializeSentryConfig=Ir;exports.InjectDependenciesContext=I;exports.InjectDependenciesProvider=Sr;exports.MaskTextField=kr;exports.PreloadErrorHandler=Fr;exports.QueryClientProviderWithConfig=Nr;exports.RequireAuth=jr;exports.dateAdapter=$e;exports.distanceAdapter=Ne;exports.getOrvalConfig=et;exports.useAdapter=Mr;exports.useAuth=zr;exports.useCurrentLanguage=Qr;exports.useFilters=Jr;exports.useInfiniteDataGrid=Wr;exports.useResponseError=Yr;exports.worksiteNameAdapter=Ye;
17
+ */var Z;function ve(){return Z||(Z=1,process.env.NODE_ENV!=="production"&&function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ce?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case p:return"Fragment";case A:return"Profiler";case S:return"StrictMode";case M:return"Suspense";case ae:return"SuspenseList";case se: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 R:return"Portal";case E:return(t.displayName||"Context")+".Provider";case T:return(t._context.displayName||"Context")+".Consumer";case U:var f=t.render;return t=t.displayName,t||(t=f.displayName||f.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case ie:return f=t.displayName||null,f!==null?f:e(t.type)||"Memo";case W:f=t._payload,t=t._init;try{return e(t(f))}catch{}}return null}function r(t){return""+t}function o(t){try{r(t);var f=!1}catch{f=!0}if(f){f=console;var h=f.error,w=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return h.call(f,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",w),r(t)}}function a(t){if(t===p)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===W)return"<...>";try{var f=e(t);return f?"<"+f+">":"<...>"}catch{return"<...>"}}function n(){var t=F.A;return t===null?null:t.getOwner()}function i(){return Error("react-stack-top-frame")}function c(t){if(Q.call(t,"key")){var f=Object.getOwnPropertyDescriptor(t,"key").get;if(f&&f.isReactWarning)return!1}return t.key!==void 0}function u(t,f){function h(){V||(V=!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)",f))}h.isReactWarning=!0,Object.defineProperty(t,"key",{get:h,configurable:!0})}function l(){var t=e(this.type);return G[t]||(G[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,f,h,w,P,C,$,Y){return h=C.ref,t={$$typeof:y,type:t,key:f,props:C,_owner:P},(h!==void 0?h: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:$}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function s(t,f,h,w,P,C,$,Y){var b=f.children;if(b!==void 0)if(w)if(ue(b)){for(w=0;w<b.length;w++)v(b[w]);Object.freeze&&Object.freeze(b)}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(b);if(Q.call(f,"key")){b=e(t);var x=Object.keys(f).filter(function(le){return le!=="key"});w=0<x.length?"{key: someKey, "+x.join(": ..., ")+": ...}":"{key: someKey}",K[b+w]||(x=0<x.length?"{"+x.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,w,b,x,b),K[b+w]=!0)}if(b=null,h!==void 0&&(o(h),b=""+h),c(f)&&(o(f.key),b=""+f.key),"key"in f){h={};for(var z in f)z!=="key"&&(h[z]=f[z])}else h=f;return b&&u(h,typeof t=="function"?t.displayName||t.name||"Unknown":t),d(t,b,C,P,n(),h,$,Y)}function v(t){typeof t=="object"&&t!==null&&t.$$typeof===y&&t._store&&(t._store.validated=1)}var m=g,y=Symbol.for("react.transitional.element"),R=Symbol.for("react.portal"),p=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),E=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),F=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=Object.prototype.hasOwnProperty,ue=Array.isArray,D=console.createTask?console.createTask:function(){return null};m={"react-stack-bottom-frame":function(t){return t()}};var V,G={},J=m["react-stack-bottom-frame"].bind(m,i)(),q=D(a(i)),K={};I.Fragment=p,I.jsx=function(t,f,h,w,P){var C=1e4>F.recentlyCreatedOwnerStacks++;return s(t,f,h,!1,w,P,C?Error("react-stack-top-frame"):J,C?D(a(t)):q)},I.jsxs=function(t,f,h,w,P){var C=1e4>F.recentlyCreatedOwnerStacks++;return s(t,f,h,!0,w,P,C?Error("react-stack-top-frame"):J,C?D(a(t)):q)}}()),I}var ee;function Ee(){return ee||(ee=1,process.env.NODE_ENV==="production"?N.exports=he():N.exports=ve()),N.exports}var _=Ee();const j=g.createContext({}),we=({children:e,apiURL:r,libraries:o,localStorageKeys:a})=>{const n=g.useMemo(()=>({apiURL:r,libraries:o,localStorageKeys:a}),[r,o,a]);return _.jsx(j.Provider,{value:n,children:e})},be="user",Re=({Fallback:e,isLogged:r,loginPath:o="/login",redirect401Path:a="/login",...n})=>{const{libraries:i,localStorageKeys:c}=g.useContext(j),u=n?.reactRouter||i?.reactRouter,l=n?.axios||i?.axios,d=n?.localStorageKey||c?.user||be;if(!u)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");const[s,v]=g.useState(null),{useLocation:m,Navigate:y,Outlet:R}=u,p=m(),S=g.useRef(!1),A=typeof r=="function"?r():!!r,T=typeof A=="boolean"?A:A?.isLogged;return g.useEffect(()=>{S.current||(S.current=!0,l.interceptors.response.use(E=>E,async E=>(typeof E=="object"&&E&&"response"in E&&E.response&&typeof E.response=="object"&&"status"in E.response&&E.response&&typeof E.response=="object"&&"status"in E.response&&E?.response?.status===401&&(l.defaults.headers.common.Authorization=null,typeof window<"u"&&window.localStorage&&localStorage.removeItem(d),v(a)),Promise.reject(E))))},[l.defaults.headers.common,l.interceptors.response,d,a]),T&&!s?_.jsx(g.Suspense,{fallback:e,children:p.state?.from?.state&&p.state?.from?.pathname===o?_.jsx(y,{to:p.state.from.state.from.pathname+p.state.from.state.from.search,replace:!0}):_.jsx(R,{})}):_.jsx(y,{to:o+p.search,state:{from:p},replace:!0})},Se=({data:e,...r})=>{const{libraries:o}=g.useContext(j),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 g.useEffect(()=>{d({event:"pageView",pathname:l,...e})},[e,l,d]),_.jsx(u,{})},O=(()=>{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}})(),Ae="user",je=({tokenTypeKey:e="tokenType",tokenKey:r="accessToken",postContentType:o="application/json",...a})=>{const{apiURL:n=a.apiURL,libraries:i,localStorageKeys:c}=g.useContext(j),u=a?.userLocalStorageKey||c?.user||Ae,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||O)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,m=s?.[r]?s[r]:null,y=d?`${v} ${m}`:null;y&&(l.defaults.headers.common.Authorization=y)}return l.defaults.baseURL=n,l.defaults.headers.post["Content-Type"]=o,null},Ce=({debug:e,resources:r,...o})=>{const{libraries:a}=g.useContext(j),n=o?.i18||a?.i18,{i18next:i,initReactI18next:c,languageDetector:u}=n||{};if(O)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},_e=({dsn:e,integrations:r,tracesSampleRate:o,replaysSessionSampleRate:a,replaysOnErrorSampleRate:n,tracePropagationTargets:i,ignoreErrors:c,debug:u,environment:l,release:d,...s})=>{const{libraries:v}=g.useContext(j),m=s?.sentry||v?.sentry,y=s?.reactRouter||v?.reactRouter;if(!m)throw new Error("Sentry is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(!y)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props.");if(m.isInitialized())return null;const{createRoutesFromChildren:R,matchRoutes:p,useLocation:S,useNavigationType:A}=y;return(u||process.env.NODE_ENV==="prod"||process.env.NODE_ENV==="production")&&m.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:[m.reactRouterV6BrowserTracingIntegration({createRoutesFromChildren:R,matchRoutes:p,useEffect:g.useEffect,useLocation:S,useNavigationType:A}),...r||[]],release:d,replaysOnErrorSampleRate:n||1,replaysSessionSampleRate:a||.1,tracePropagationTargets:i,tracesSampleRate:o||1}),null},Pe=({IMaskMixin:e,...r})=>{const o=g.useMemo(()=>e(({TextField:a,...n})=>_.jsx(a,{...n})),[e]);return _.jsx(o,{...r})},Te=({language:e,...r})=>{const{libraries:o}=g.useContext(j),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 g.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},xe=()=>(g.useEffect(()=>{if(O)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),ke=e=>e&&typeof e=="function",Ie=e=>e&&typeof e=="function",Oe=({children:e,defaultQueriesOptions:r,defaultMutationsOptions:o,...a})=>{const{libraries:n}=g.useContext(j),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(!ke(c))throw new Error("Provided QueryClientProvider dependencies are not valid.");if(!Ie(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 _.jsx(c,{client:u,children:e})},Ne=e=>{const{libraries:r}=g.useContext(j),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=g.useCallback(d=>{if(d&&typeof d=="object"&&"response"in d){const{response:s}=d||{};if(s&&typeof s=="object"&&"reason"in s)return String(s.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"reason"in s.data)return String(s.data.reason);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"message"in s.data)return String(s.data.message);if(s&&typeof s=="object"&&"data"in s&&s.data&&typeof s.data=="object"&&"detail"in s.data){const{detail:v}=s.data;if(Array.isArray(v)&&v.length>0&&typeof v[0]=="object"&&v[0]!==null&&"msg"in v[0]){const{msg:m}=v[0];if(typeof m=="string")return String(m)}}}return d instanceof Error?d.message:c},[c]);return{getErrorCode:g.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}},Le=({data:e,fetchNextPage:r,isFetchingNextPage:o,isInitialLoading:a,isLoading:n,enabled:i=!0})=>{const c=g.useCallback(async l=>{o||!i||await r({pageParam:l?.pageParam||l.visibleRowsCount})},[i,r,o]),u=g.useMemo(()=>{if(e)return e.pages.reduce((l,d)=>[...l,...d],[])},[e]);return{fetchNextPageOnRowsScrollEnd:c,isLoading:o||n,loadingVariant:a?"skeleton":"linear",rows:u}},Fe=e=>{const{libraries:r}=g.useContext(j),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=g.useCallback(({tokenType:c,accessToken:u})=>{o.defaults.headers.common.Authorization=`${c} ${u}`},[o.defaults.headers.common]),i=()=>{o.defaults.headers.common.Authorization=null};return g.useEffect(()=>{if(O)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}},re=({library:e,date:r,format:o="ll"})=>e(r).format(o),ne=(e,r)=>{const{fractionDigits:o=0,metric:a="km"}=r||{},n=Number(e);return Number.isNaN(n)?`0${a}`:`${n.toFixed(o)}${a}`},oe=e=>!e||typeof e!="string"?"":e.replace(/_/g," ").toLowerCase().split(" ").map(o=>o.length>0?o.charAt(0).toUpperCase()+o.slice(1):o).join(" "),De=e=>e?.startsWith("/")?e?.startsWith("/files")?e:`/files${e}`:e?.startsWith("files")?`/${e}`:`/files/${e}`,$e=({path:e,size:r,apiURL:o})=>{if(!e)return"";const a=De(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},Ye=e=>{const{apiURL:r,libraries:o}=g.useContext(j),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 re({date:c,format:u,library:a})},distanceAdapter:ne,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 $e({apiURL:r,path:c,size:u})},worksiteNameAdapter:oe}},L=(e,r)=>r==="short"?e.split("-")[0]:e,ze=(e,r="full")=>{const[o,a]=g.useState(()=>{const n=e?.language||navigator.language;return e&&"isInitialized"in e&&e.isInitialized,L(n,r)});return g.useEffect(()=>{e&&"isInitialized"in e&&e.isInitialized&&e.language&&a(L(e.language,r));const n=i=>{a(L(i,r))};return e?.on?.("languageChanged",n),()=>{e?.off?.("languageChanged",n)}},[e,r]),o},Ue="tracktor.filter",Me={getFilter:()=>{},getFilters:()=>({}),handleFilter:()=>()=>{},setFilter:()=>{}},te=(e,r,o)=>`${o}_${e}=>${r}`,We=e=>{const{libraries:r,localStorageKeys:o}=g.useContext(j),a=e?.reactRouter||r?.reactRouter,{pathname:n}=a?.useLocation?.()??{pathname:"/"},[i,c]=a?.useSearchParams?.()??[new URLSearchParams,()=>{}],u=o?.filter||Ue;if(O)return Me;if(!a)throw new Error("React Router is not provided. You can provide it with InjectDependenciesProvider or directly in props of GTMSendPageView.");const l=(m,y,R=!0)=>{const p=te(m,e?.pathname||n,u);if(!y||Array.isArray(y)&&!y.length){i.delete(m),c(i),localStorage.removeItem(p);return}R&&y&&localStorage.setItem(p,JSON.stringify({...i,[m]:y})),y&&(i.set(m,JSON.stringify(y)),c(i))};return{getFilter:(m,y)=>{const R=i.get(m);if(R)try{return JSON.parse(R)}catch{return R}const p=te(m,e?.pathname||n,u),S=localStorage.getItem(p);if(S)try{return JSON.parse(S)[m]}catch{}return y},getFilters:()=>{const m=Object.fromEntries(i.entries()),R=Object.keys(localStorage).filter(p=>p.startsWith(u)&&p.endsWith(e?.pathname||n)).reduce((p,S)=>{const A=localStorage.getItem(S);if(A){const T=JSON.parse(A),E=Object.keys(T)?.[0];p[E]=Object.values(T)?.[0]}return p},{});return{...m,...R}},handleFilter:(m,y)=>(R,p)=>{if(p||Array.isArray(p)&&p.length===0){const S=y||"value",A=typeof p=="object"&&S in p?p[S]:p;l(m,A);return}l(m,void 0)},setFilter:l}},Qe=e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase(),Ve=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)},Ge=e=>(e.split("/").pop()||e).replace(/\.json$/,"").replace(/^openapi\./,""),Je=(e,r,o,a)=>{const n=Ve(r),i=Qe(o),c=`${n}${i}`;return e&&typeof e=="object"&&"operationId"in e&&a?.includes(String(e.operationId))?`${c}AsQuery`:c},qe=(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},Ke=e=>(Array.isArray(e)?e:[e]).reduce((o,a)=>{const{output:n,useInfiniteIds:i,useQueryIds:c,input:u="./openapi.json"}=a||{},l=Ge(u);return{...o,[l]:{hooks:{afterAllFilesWrite:"prettier src/api/ --write"},input:u,output:{baseUrl:n?.baseUrl,client:"react-query",mode:"tags-split",override:{...(i?.length||c?.length)&&{operations:qe(i,c)},header:d=>["Generated by orval 🍺",...d.title?[d.title]:[],...d.description?[d.description]:[]],mutator:{name:"axiosCustomInstance",path:"./node_modules/@tracktor/shared-module/dist/axiosCustomInstance.ts"},operationName:(d,s,v)=>Je(d,s,v,c),query:{useQuery:!0}},schemas:n?.schemas||`src/api/${l}/model`,target:n?.target||`src/api/${l}/services/api.ts`,...n}}}},{});exports.GTMSendPageView=Se;exports.InitializeAxiosConfig=je;exports.InitializeDaysJSConfig=Te;exports.InitializeI18nConfig=Ce;exports.InitializeSentryConfig=_e;exports.InjectDependenciesContext=j;exports.InjectDependenciesProvider=we;exports.MaskTextField=Pe;exports.PreloadErrorHandler=xe;exports.QueryClientProviderWithConfig=Oe;exports.RequireAuth=Re;exports.dateAdapter=re;exports.distanceAdapter=ne;exports.getOrvalConfig=Ke;exports.useAdapter=Ye;exports.useAuth=Fe;exports.useCurrentLanguage=ze;exports.useFilters=We;exports.useInfiniteDataGrid=Le;exports.useResponseError=Ne;exports.worksiteNameAdapter=oe;