import{X as m,N as f,s as v}from"./CQHo_aHN.js";const w=()=>{const r=m(),a=()=>{const t={},n=l();return n&&(t.Authorization=`${n}`),t},u=async(t,n={})=>{try{const o=r.public.productionEndpoint||"/api/v1",e=await $fetch(t,{...n,baseURL:o,method:"GET",headers:a()});return e.data||e}catch(o){throw s(o),o}},i=async(t,n={},o={})=>{try{const e=r.public.productionEndpoint||"/api/v1",c=a(),g={...o,baseURL:e,method:"POST",headers:c,body:n},h=await $fetch(t,g);return h.data||h}catch(e){throw s(e),e}},d=async(t,n={},o={})=>{try{const e=r.public.productionEndpoint||"/api/v1",c=await $fetch(t,{...o,baseURL:e,method:"PUT",headers:a(),body:n});return c.data||c}catch(e){throw s(e),e}},p=async(t,n={})=>{try{const o=r.public.productionEndpoint||"/api/v1",e=await $fetch(t,{...n,baseURL:o,method:"DELETE",headers:a()});return e.data||e}catch(o){throw s(o),o}},s=t=>{t.status===401&&(console.warn("Token de autenticação inválido ou expirado"),localStorage.removeItem("auth_token"),sessionStorage.removeItem("auth_token"),f("/login"))},l=()=>{var t;try{return((t=v().token)==null?void 0:t.value)||null}catch{return localStorage.getItem("auth_token")||sessionStorage.getItem("auth_token")||null}};return{get:u,post:i,put:d,delete:p}},y=()=>{const{get:r}=w();function a(i){return r(`/empresas/${i}`)}function u(){return r("/downloads/logomarcas")}return{getInfoEmpresa:a,getLogomarcas:u}};export{y as e,w as u};
