const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/router-BscLjLv3.js","assets/router-CZRcee6x.js","assets/vue.runtime.esm-bundler-56z_v_HH.js","assets/chunk-BEqpzyXh.js","assets/global.store-BNqBuUdA.js","assets/local-storage-DuQCXLd0.js","assets/pinia-C4FTeoHo.js","assets/endpoints-Bdye5CiX.js","assets/setting.service-DtcFOiQX.js","assets/user.store-DPFu8pQI.js","assets/notification.store-EczSZ_VB.js","assets/error-handling-S7N4FACK.js","assets/company.store-BQg_W5d2.js","assets/company.service-BUBqxT6X.js","assets/vue-router-_izWfDzq.js","assets/MainLogo-Cm91SJr7.js","assets/NotificationRoot-BRoqgK4C.js","assets/NotificationItem-WqI-MG9H.js","assets/abilities-CSdbnHpk.js","assets/store-DIrP_oUf.js","assets/routes-B4sdSdat.js"])))=>i.map(i=>d[i]);
import{a as e,r as t}from"./local-storage-DuQCXLd0.js";import{t as n}from"./endpoints-Bdye5CiX.js";var r=`modulepreload`,i=function(e){return`/build/`+e},a={},o=function(e,t,n){let o=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}o=l(t.map(t=>{if(t=i(t,n),t in a)return;a[t]=!0;let o=t.endsWith(`.css`),s=o?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.href===t&&(!o||r.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${s}`))return;let l=document.createElement(`link`);if(l.rel=o?`stylesheet`:r,o||(l.as=`script`),l.crossOrigin=``,l.href=t,c&&l.setAttribute(`nonce`,c),document.head.appendChild(l),o)return new Promise((e,n)=>{l.addEventListener(`load`,e),l.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},s=e.create({withCredentials:!0,headers:{common:{"X-Requested-With":`XMLHttpRequest`}}});s.interceptors.request.use(e=>{let t=localStorage.getItem(`selectedCompany`),n=localStorage.getItem(`auth.token`),r=localStorage.getItem(`isAdminMode`)===`true`;return n&&(e.headers.Authorization=n),t&&!r&&(e.headers.company=t),e});var c=!1,l=[n.LOGIN,n.LOGOUT,n.CSRF_COOKIE];function u(e){return e?l.some(t=>e.endsWith(t)):!1}s.interceptors.response.use(e=>e,async e=>{if(e.response?.status!==401||u(e.config?.url)||c)return Promise.reject(e);let{default:n}=await o(async()=>{let{default:e}=await import(`./router-BscLjLv3.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])),r=n.currentRoute.value;if(r.name===`login`||typeof r.path==`string`&&r.path.startsWith(`/installation`)||r.meta?.isCustomerPortal===!0)return Promise.reject(e);c=!0,t(`auth.token`),t(`selectedCompany`),t(`isAdminMode`);let i=window.location.pathname+window.location.search;try{await n.push({name:`login`,query:{next:i}})}finally{setTimeout(()=>{c=!1},0)}return Promise.reject(e)});export{o as n,s as t};