import{_ as q}from"./Dv0GRYVD.js";import{_ as y}from"./DlAUqK2U.js";import{c as u,o as i,a as e,s as N,J as p,x as B,r as M,b as m,w as _,m as l,D as L,d as x,t as S,l as A,a4 as I,O as f}from"./B9WsArp0.js";import{u as P}from"./DYBvU1z2.js";const V={name:"MaterialSymbolsPersonRounded"},D={xmlns:"http://www.w3.org/2000/svg",width:"25px",height:"25px",viewBox:"0 0 24 24"};function O(w,r,d,c,n,g){return i(),u("svg",D,r[0]||(r[0]=[e("path",{fill:"currentColor",d:"M12 12q-1.65 0-2.825-1.175T8 8t1.175-2.825T12 4t2.825 1.175T16 8t-1.175 2.825T12 12m-8 6v-.8q0-.85.438-1.562T5.6 14.55q1.55-.775 3.15-1.162T12 13t3.25.388t3.15 1.162q.725.375 1.163 1.088T20 17.2v.8q0 .825-.587 1.413T18 20H6q-.825 0-1.412-.587T4 18"},null,-1)]))}const R=y(V,[["render",O]]),U={class:"h-20 w-full px-5 shadow-lg md:px-11",style:{background:"linear-gradient(to right, var(--primary), var(--primary-shade))"}},E={class:"flex h-full items-center justify-between 2xl:px-28"},j={class:"flex items-center"},z=["src"],H={class:"flex items-center gap-20 text-xs font-medium text-white md:pr-6 md:text-lg"},J={key:1,class:"relative"},F={style:{color:"var(--primary)"}},G={key:0,class:"absolute right-0 z-50 mt-2 w-40 rounded-lg bg-white py-2 shadow-lg"},K={__name:"NavBar",async setup(w){let r,d;const{data:c,...n}=N(),g=p(()=>n&&n.status&&n.status.value==="authenticated"),b=p(()=>{var o;return((o=c.value)==null?void 0:o.refId)||""}),{logoSrc:h}=([r,d]=B(()=>P()),r=await r,d(),r),k=p(()=>{var o,t;return((t=(o=c.value)==null?void 0:o.nomeUsuario)==null?void 0:t.split(" ")[0])||""}),a=M(!1),C=async()=>{a.value=!1;try{await n.signOut({redirect:!1}),await f("/")}catch(o){o.message.includes("external URL")&&await f(logoutUrl,{external:!0})}},T=()=>{a.value=!1,f(`/user-profile/${b.value}`)};return window.addEventListener("click",o=>{const t=document.querySelector(".relative");t&&!t.contains(o.target)&&(a.value=!1)}),(o,t)=>{const v=q,$=R;return i(),u("div",U,[e("div",E,[e("div",j,[m(v,{to:"/",class:"block"},{default:_(()=>[e("img",{src:l(h),class:"max-h-16 w-auto cursor-pointer pt-2"},null,8,z)]),_:1})]),e("div",H,[l(g)?(i(),u("div",J,[e("button",{onClick:t[0]||(t[0]=s=>a.value=!l(a)),class:"group flex flex-row rounded-lg bg-white px-3 py-2 font-bold ease-in-out hover:underline hover:underline-offset-8"},[e("p",F,[t[6]||(t[6]=x(" Olá, ")),e("b",null,S(l(k)),1),t[7]||(t[7]=x("! "))]),m($,{class:"ml-2",style:{color:"var(--primary)"}})]),m(I,{name:"fade"},{default:_(()=>[l(a)?(i(),u("div",G,[e("button",{onClick:C,class:"bold block w-full py-2 pr-6 text-right",onMouseover:t[1]||(t[1]=s=>s.target.style.backgroundColor="rgba(var(--primary-rgb), 0.1)"),onMouseleave:t[2]||(t[2]=s=>s.target.style.backgroundColor=""),style:{color:"var(--primary)"}}," Sair ",32),e("button",{onClick:T,class:"bold block w-full py-2 pr-6 text-right",onMouseover:t[3]||(t[3]=s=>s.target.style.backgroundColor="rgba(var(--primary-rgb), 0.1)"),onMouseleave:t[4]||(t[4]=s=>s.target.style.backgroundColor=""),style:{color:"var(--primary)"}}," Perfil ",32)])):A("",!0)]),_:1})])):(i(),L(v,{key:0,to:"/login"},{default:_(()=>t[5]||(t[5]=[e("p",{class:"group relative rounded-lg bg-white px-3 py-2 font-bold hover:underline hover:underline-offset-8",style:{color:"var(--primary)"}}," Acesse ou Cadastre-se ➜ ",-1)])),_:1,__:[5]}))])])])}}},Z=y(K,[["__scopeId","data-v-578ee55b"]]);export{Z as _};
