import{_ as P}from"./DRkNpQ1P.js";import{e as N,f as O,g as U,ad as G,o as i,c as r,a as e,t as a,k as h,F as _,r as H,j as L,l as x,m as M,h as K,p as J,K as Q,q as X,s as Y,b as S,w as $,y as W,ae as E,L as T,i as Z,d as F,ac as ee}from"./CQHa_U7G.js";import{u as te}from"./BJMSi7ez.js";const oe={class:"text-base leading-none"},ne={class:"hidden sm:inline"},se={key:0,class:"absolute right-0 mt-2 w-44 bg-slate-800 border border-slate-700 rounded-xl shadow-xl py-1 z-50"},ae=["onClick"],ie={class:"text-lg leading-none"},re={key:0,class:"ml-auto text-indigo-400"},le=N({__name:"LanguageSwitcher",setup(I){const{locale:C,locales:n}=O(),v=x(!1),p=x(null),y=M(()=>n.value),s=M(()=>C.value),d={hu:"🇭🇺",en:"🇬🇧"},g={hu:"Magyar",en:"English"};function b(l){return d[l]||"🌐"}function k(l){return g[l]||l.toUpperCase()}function j(){const u=K("access_token").value;return u?{Authorization:`Bearer ${u}`}:{}}async function V(l){if(l===s.value){v.value=!1;return}C.value=l;try{localStorage.setItem("preferred_language",l)}catch{}try{await $fetch("/api/v1/auth/me/language",{method:"PATCH",headers:{...j(),"Content-Type":"application/json"},body:{preferred_language:l}})}catch(u){console.error("[LanguageSwitcher] Failed to persist language preference:",u)}v.value=!1}function B(l){p.value&&!p.value.contains(l.target)&&(v.value=!1)}return U(()=>{document.addEventListener("click",B)}),G(()=>{document.removeEventListener("click",B)}),(l,u)=>(i(),r("div",{class:"relative",ref_key:"dropdownRef",ref:p},[e("button",{class:"flex items-center gap-2 px-3 py-1.5 text-xs font-medium rounded-lg transition bg-slate-700/50 hover:bg-slate-700 text-slate-300 hover:text-white border border-slate-600/50",onClick:u[0]||(u[0]=m=>v.value=!v.value)},[e("span",oe,a(b(s.value)),1),e("span",ne,a(k(s.value)),1),(i(),r("svg",{class:h(["w-3.5 h-3.5 text-slate-400 transition-transform duration-200",{"rotate-180":v.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...u[1]||(u[1]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"},null,-1)])],2))]),v.value?(i(),r("div",se,[(i(!0),r(_,null,H(y.value,m=>(i(),r("button",{key:m.code,class:h(["flex items-center gap-3 w-full px-4 py-2.5 text-sm transition",m.code===s.value?"bg-indigo-600/20 text-indigo-300":"text-slate-300 hover:bg-slate-700 hover:text-white"]),onClick:A=>V(m.code)},[e("span",ie,a(b(m.code)),1),e("span",null,a(m.name),1),m.code===s.value?(i(),r("span",re,[...u[2]||(u[2]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1)])])):L("",!0)],10,ae))),128))])):L("",!0)],512))}}),ue=J("/logo.svg"),de={class:"min-h-screen bg-slate-900 text-white flex"},ce={class:"flex items-center gap-3 min-w-0"},he={class:"text-sm font-bold text-white leading-tight"},pe={class:"text-[10px] font-semibold uppercase tracking-wider text-indigo-400 leading-tight"},ve={class:"flex-1 px-2 py-4 space-y-2 overflow-y-auto overflow-x-hidden"},me={key:0},ge=["onClick"],fe=["innerHTML"],ke={class:"ml-2 mt-1 space-y-1 overflow-hidden transition-all duration-200"},we=["innerHTML"],xe={class:"whitespace-nowrap overflow-hidden"},be=["innerHTML"],_e={class:"p-4 border-t border-slate-700 overflow-hidden"},Me={class:"flex-1 flex flex-col min-w-0 transition-all duration-300 ease-in-out"},Ce={class:"sticky top-0 z-10 bg-slate-800/95 backdrop-blur-sm border-b border-slate-700"},ye={class:"flex items-center justify-between h-16 px-4 lg:px-6"},je={class:"flex items-center gap-3"},Be={class:"text-lg font-semibold text-white truncate"},ze={class:"flex items-center gap-3"},$e={class:"w-8 h-8 rounded-full bg-indigo-600 flex items-center justify-center text-sm font-bold text-white"},He={class:"hidden sm:block text-sm text-slate-300"},Le={key:0,class:"absolute right-0 mt-2 w-56 bg-slate-800 border border-slate-700 rounded-xl shadow-xl py-1 z-50"},Ve={class:"px-4 py-3 border-b border-slate-700"},Se={class:"text-sm font-medium text-white"},Ae={class:"text-xs text-slate-400 mt-0.5"},Re={class:"flex-1 p-4 lg:p-6 overflow-auto"},Ne=N({__name:"default",setup(I){const{t:C}=O(),n=Q(),v=X(),p=Y(),y=te(),s=x(!1),d=x(!1),g=x(!1),b=x(null),k=x(new Set(["menu.center"])),j=M(()=>p.userEmail||C("common.unknown_user")),V=M(()=>{const o=p.userEmail;return o?o.split("@")[0].split(".").map(t=>t[0]).join("").toUpperCase().slice(0,2):"??"}),B=[{title:"menu.center",items:[{path:"/",label:"menu.dashboard",icon:''}]},{title:"menu.providers_title",items:[{label:"menu.providers",icon:'',children:[{path:"/providers",label:"menu.all_providers",icon:''},{path:"/providers/pending",label:"menu.pending_providers",icon:''}]}]},{title:"menu.users_and_partners",items:[{label:"menu.garages",icon:'',children:[{path:"/garages",label:"menu.garage_list",icon:''}]},{label:"menu.users",icon:'',children:[{path:"/users",label:"menu.user_list",icon:''},{path:"/persons",label:"menu.persons",icon:''}]}]},{title:"menu.finance",items:[{path:"/packages",label:"menu.packages",icon:''}]},{title:"menu.gamification",items:[{label:"menu.game_settings",icon:'',children:[{path:"/gamification/point-rules",label:"menu.point_rules",icon:''},{path:"/gamification/levels",label:"menu.levels",icon:''},{path:"/gamification/badges",label:"menu.badges",icon:''},{path:"/gamification/validation-rules",label:"menu.validation_rules",icon:''}]},{label:"menu.events_and_seasons",icon:'',children:[{path:"/gamification/seasons",label:"menu.seasons",icon:''},{path:"/gamification/competitions",label:"menu.competitions",icon:''}]},{label:"menu.user_data",icon:'',children:[{path:"/gamification/users",label:"menu.statistics",icon:''},{path:"/gamification/leaderboard",label:"menu.leaderboard",icon:''},{path:"/gamification/ledger",label:"menu.ledger",icon:''}]},{path:"/gamification",label:"menu.gamification_hq",icon:''},{path:"/gamification/config",label:"menu.system_config",icon:''},{path:"/gamification/parameters",label:"menu.system_parameters",icon:''}]},{title:"menu.system",items:[{path:"/permissions",label:"menu.permissions",icon:''},{label:"menu.system_logs",icon:'',children:[{path:"/",label:"menu.system_logs",icon:''}]}]}],l=M(()=>n.path==="/"?"menu.dashboard":n.path.startsWith("/permissions")?"permissions.title":n.path.startsWith("/garages")?"menu.garages":n.path.startsWith("/persons")?"menu.persons":n.path.startsWith("/users")?"menu.users":n.path.startsWith("/logs")?"menu.system_logs":n.path.startsWith("/packages")?"menu.packages":n.path.startsWith("/providers")?n.path==="/providers/pending"?"providers.pending_title":n.path.startsWith("/providers/")?"providers.provider_detail":"providers.title":n.path.startsWith("/gamification")?n.path==="/gamification"?"menu.gamification_hq":n.path==="/gamification/point-rules"?"menu.point_rules":n.path==="/gamification/levels"?"menu.levels":n.path==="/gamification/badges"?"menu.badges":n.path==="/gamification/seasons"?"menu.seasons":n.path==="/gamification/competitions"?"menu.competitions":n.path==="/gamification/users"?"gamification.users.title":n.path.startsWith("/gamification/users/")?"gamification.users.user_detail_title":n.path==="/gamification/leaderboard"?"menu.leaderboard":n.path==="/gamification/config"?"menu.system_config":n.path==="/gamification/parameters"?"menu.system_parameters":n.path==="/gamification/ledger"?"menu.points_ledger":n.path==="/gamification/validation-rules"?"menu.validation_rules":"menu.gamification":"common.admin_panel");function u(o){return o==="/"?n.path==="/":n.path.startsWith(o)}function m(o){return o.children?o.children.some(t=>u(t.path)):!1}function A(o){k.value.has(o.label)?k.value.delete(o.label):k.value.add(o.label)}function q(){p.logout(),g.value=!1,v.push("/login")}function R(o){b.value&&!b.value.contains(o.target)&&(g.value=!1)}return U(()=>{document.addEventListener("click",R),y.fetchRegions().then(()=>{p.user?.region_code&&y.setActiveRegion(p.user.region_code)})}),G(()=>{document.removeEventListener("click",R)}),(o,t)=>{const z=P,D=le;return i(),r("div",de,[s.value?(i(),r("div",{key:0,class:"fixed inset-0 bg-black/50 z-20 lg:hidden",onClick:t[0]||(t[0]=f=>s.value=!1)})):L("",!0),e("aside",{class:h(["fixed lg:static inset-y-0 left-0 z-30 flex flex-col bg-slate-800 border-r border-slate-700 transition-all duration-300 ease-in-out overflow-hidden",s.value||!d.value?"w-52":"w-20"])},[S(z,{to:"/",class:"flex items-center h-16 px-4 border-b border-slate-700 overflow-hidden hover:bg-slate-700/50 transition"},{default:$(()=>[e("div",ce,[t[7]||(t[7]=e("img",{src:ue,class:"h-8 w-auto flex-shrink-0",alt:"SF Logo"},null,-1)),e("div",{class:h(["transition-all duration-300 ease-in-out overflow-hidden whitespace-nowrap",s.value||!d.value?"opacity-100 max-w-[200px]":"opacity-0 max-w-0"])},[e("div",he,a(o.$t("common.service_finder")),1),e("div",pe,a(o.$t("common.admin")),1)],2)])]),_:1}),e("button",{class:"hidden lg:flex items-center justify-center h-10 mx-2 mt-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition flex-shrink-0",onClick:t[1]||(t[1]=f=>d.value=!d.value)},[(i(),r("svg",{class:h(["w-5 h-5 transition-transform duration-300",{"rotate-180":d.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...t[8]||(t[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M11 19l-7-7 7-7m8 14l-7-7 7-7"},null,-1)])],2))]),e("nav",ve,[(i(),r(_,null,H(B,f=>(i(),r(_,{key:f.title},[W(e("div",{class:"px-3 py-1 text-xs font-semibold uppercase tracking-wider text-slate-500 whitespace-nowrap overflow-hidden"},a(o.$t(f.title)),513),[[E,s.value||!d.value]]),(i(!0),r(_,null,H(f.items,c=>(i(),r(_,{key:c.label},[c.children?(i(),r("div",me,[e("button",{class:h(["flex items-center w-full gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition",m(c)?"bg-indigo-600/20 text-indigo-300":"text-slate-300 hover:bg-slate-700 hover:text-white"]),onClick:w=>A(c)},[e("span",{class:"flex-shrink-0 w-5 h-5",innerHTML:c.icon},null,8,fe),e("span",{class:h(["flex-1 text-left whitespace-nowrap overflow-hidden transition-all duration-300 ease-in-out",s.value||!d.value?"opacity-100 max-w-[200px]":"opacity-0 max-w-0"])},a(o.$t(c.label)),3),(i(),r("svg",{class:h(["w-4 h-4 transition-all duration-300 ease-in-out flex-shrink-0",{"rotate-90":k.value.has(c.label),"opacity-100":s.value||!d.value,"opacity-0":d.value&&!s.value}]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[...t[9]||(t[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)])],2))],10,ge),W(e("div",ke,[(i(!0),r(_,null,H(c.children,w=>(i(),T(z,{key:w.path,to:w.path,class:h(["flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition",u(w.path)?"bg-indigo-600 text-white":"text-slate-400 hover:bg-slate-700 hover:text-white"]),onClick:t[2]||(t[2]=We=>s.value=!1)},{default:$(()=>[e("span",{class:"flex-shrink-0 w-4 h-4",innerHTML:w.icon},null,8,we),e("span",xe,a(o.$t(w.label)),1)]),_:2},1032,["to","class"]))),128))],512),[[E,k.value.has(c.label)&&(s.value||!d.value)]])])):(i(),T(z,{key:1,to:c.path,class:h(["flex items-center gap-3 px-3 py-2.5 rounded-lg text-sm font-medium transition",u(c.path)?"bg-indigo-600 text-white":"text-slate-300 hover:bg-slate-700 hover:text-white"]),onClick:t[3]||(t[3]=w=>s.value=!1)},{default:$(()=>[e("span",{class:"flex-shrink-0 w-5 h-5",innerHTML:c.icon},null,8,be),e("span",{class:h(["whitespace-nowrap overflow-hidden transition-all duration-300 ease-in-out",s.value||!d.value?"opacity-100 max-w-[200px]":"opacity-0 max-w-0"])},a(o.$t(c.label)),3)]),_:2},1032,["to","class"]))],64))),128))],64))),64))]),e("div",_e,[e("div",{class:h(["text-xs text-slate-500 whitespace-nowrap transition-all duration-300 ease-in-out",s.value||!d.value?"opacity-100 max-w-[200px]":"opacity-0 max-w-0"])},a(o.$t("common.service_finder"))+" "+a(o.$t("common.version")),3)])],2),e("div",Me,[e("header",Ce,[e("div",ye,[e("div",je,[e("button",{class:"lg:hidden p-2 rounded-lg text-slate-400 hover:text-white hover:bg-slate-700 transition",onClick:t[4]||(t[4]=f=>s.value=!0)},[...t[10]||(t[10]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 12h16M4 18h16"})],-1)])]),e("h1",Be,a(o.$t(l.value)),1)]),e("div",ze,[S(D),e("div",{class:"relative",ref_key:"dropdownRef",ref:b},[e("button",{class:"flex items-center gap-2 p-1.5 rounded-lg hover:bg-slate-700 transition",onClick:t[5]||(t[5]=f=>g.value=!g.value)},[e("div",$e,a(V.value),1),e("span",He,a(j.value),1),t[11]||(t[11]=e("svg",{class:"w-4 h-4 text-slate-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 9l-7 7-7-7"})],-1))]),g.value?(i(),r("div",Le,[e("div",Ve,[e("p",Se,a(j.value),1),e("p",Ae,a(Z(p).userRole==="SUPERADMIN"?o.$t("common.super_administrator"):o.$t("common.administrator")),1)]),S(z,{to:"/profile",class:"flex items-center gap-3 px-4 py-2.5 text-sm text-slate-300 hover:bg-slate-700 hover:text-white transition",onClick:t[6]||(t[6]=f=>g.value=!1)},{default:$(()=>[t[12]||(t[12]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"})],-1)),F(" "+a(o.$t("common.profile_settings")),1)]),_:1}),e("button",{class:"flex items-center gap-3 w-full px-4 py-2.5 text-sm text-red-400 hover:bg-slate-700 hover:text-red-300 transition",onClick:q},[t[13]||(t[13]=e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})],-1)),F(" "+a(o.$t("common.sign_out")),1)])])):L("",!0)],512)])])]),e("main",Re,[ee(o.$slots,"default")])])])}}});export{Ne as default};