import{a3 as p,N as f,m as w}from"./BpDVC-Oo.js";const y=()=>{const a=()=>{const t=window.location.hostname;return p[t].apiUrl},n=()=>{const t={},r=l();return r&&(t.Authorization=`${r}`),t},h=async(t,r={})=>{try{const o=a(),e=await $fetch(t,{...r,baseURL:o,method:"GET",headers:n()});return e.data||e}catch(o){throw s(o),o}},u=async(t,r={},o={})=>{try{const e=a(),c=n(),g={...o,baseURL:e,method:"POST",headers:c,body:r},i=await $fetch(t,g);return i.data||i}catch(e){throw s(e),e}},d=async(t,r={},o={})=>{try{const e=a(),c=await $fetch(t,{...o,baseURL:e,method:"PUT",headers:n(),body:r});return c.data||c}catch(e){throw s(e),e}},m=async(t,r={})=>{try{const o=a(),e=await $fetch(t,{...r,baseURL:o,method:"DELETE",headers:n()});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=w().token)==null?void 0:t.value)||null}catch{return localStorage.getItem("auth_token")||sessionStorage.getItem("auth_token")||null}};return{get:h,post:u,put:d,delete:m}},T=()=>{const{get:a}=y();function n(u){return a(`/empresas/${u}`)}function h(){return a("/downloads/logomarcas")}return{getInfoEmpresa:n,getLogomarcas:h}};export{T as e,y as u};
