import { _ as __nuxt_component_0 } from './nuxt-link-1NBbHb-h.mjs';
import { defineComponent, ref, computed, mergeProps, withCtx, createVNode, toDisplayString, unref, openBlock, createBlock, createTextVNode, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrRenderAttr, ssrInterpolate, ssrRenderList, ssrRenderStyle, ssrRenderSlot } from 'vue/server-renderer';
import { a as useI18n, b as useRouter, c as useAuthStore } from './server.mjs';
import { p as publicAssetsURL } from '../nitro/nitro.mjs';
import { useRoute } from 'vue-router';
import { u as useRegionStore } from './region-0mvXqaMM.mjs';
import 'pinia';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';
import 'unhead/plugins';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
__name: "LanguageSwitcher",
__ssrInlineRender: true,
setup(__props) {
const { locale, locales } = useI18n();
const dropdownOpen = ref(false);
const dropdownRef = ref(null);
const availableLocales = computed(() => locales.value);
const currentLocale = computed(() => locale.value);
const flagMap = {
hu: "\u{1F1ED}\u{1F1FA}",
en: "\u{1F1EC}\u{1F1E7}"
};
const labelMap = {
hu: "Magyar",
en: "English"
};
function flagFor(code) {
return flagMap[code] || "\u{1F310}";
}
function labelFor(code) {
return labelMap[code] || code.toUpperCase();
}
return (_ctx, _push, _parent, _attrs) => {
_push(`
`);
if (dropdownOpen.value) {
_push(`
`);
ssrRenderList(availableLocales.value, (loc) => {
_push(`
`);
});
_push(`
`);
} else {
_push(``);
}
_push(`
`);
};
}
});
const _sfc_setup$1 = _sfc_main$1.setup;
_sfc_main$1.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/LanguageSwitcher.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const _imports_0 = publicAssetsURL("/logo.svg");
const _sfc_main = /* @__PURE__ */ defineComponent({
__name: "default",
__ssrInlineRender: true,
setup(__props) {
const { t } = useI18n();
const route = useRoute();
useRouter();
const authStore = useAuthStore();
useRegionStore();
const sidebarOpen = ref(false);
const sidebarCollapsed = ref(false);
const dropdownOpen = ref(false);
ref(null);
const expandedGroups = ref(/* @__PURE__ */ new Set(["menu.center"]));
const userEmail = computed(() => authStore.userEmail || t("common.unknown_user"));
const userInitials = computed(() => {
const email = authStore.userEmail;
if (!email) return "??";
return email.split("@")[0].split(".").map((s) => s[0]).join("").toUpperCase().slice(0, 2);
});
const menuGroups = [
{
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: "/",
/* P0 HOTFIX: placeholder until /logs page is built */
label: "menu.system_logs",
icon: ''
}
]
}
]
}
];
const pageTitle = computed(() => {
if (route.path === "/") return "menu.dashboard";
if (route.path.startsWith("/permissions")) return "permissions.title";
if (route.path.startsWith("/garages")) return "menu.garages";
if (route.path.startsWith("/persons")) return "menu.persons";
if (route.path.startsWith("/users")) return "menu.users";
if (route.path.startsWith("/logs")) return "menu.system_logs";
if (route.path.startsWith("/packages")) return "menu.packages";
if (route.path.startsWith("/providers")) {
if (route.path === "/providers/pending") return "providers.pending_title";
if (route.path.startsWith("/providers/")) return "providers.provider_detail";
return "providers.title";
}
if (route.path.startsWith("/gamification")) {
if (route.path === "/gamification") return "menu.gamification_hq";
if (route.path === "/gamification/point-rules") return "menu.point_rules";
if (route.path === "/gamification/levels") return "menu.levels";
if (route.path === "/gamification/badges") return "menu.badges";
if (route.path === "/gamification/seasons") return "menu.seasons";
if (route.path === "/gamification/competitions") return "menu.competitions";
if (route.path === "/gamification/users") return "gamification.users.title";
if (route.path.startsWith("/gamification/users/")) return "gamification.users.user_detail_title";
if (route.path === "/gamification/leaderboard") return "menu.leaderboard";
if (route.path === "/gamification/config") return "menu.system_config";
if (route.path === "/gamification/parameters") return "menu.system_parameters";
if (route.path === "/gamification/ledger") return "menu.points_ledger";
if (route.path === "/gamification/validation-rules") return "menu.validation_rules";
return "menu.gamification";
}
return "common.admin_panel";
});
function isActive(path) {
if (path === "/") return route.path === "/";
return route.path.startsWith(path);
}
function isGroupActive(item) {
if (!item.children) return false;
return item.children.some((child) => isActive(child.path));
}
return (_ctx, _push, _parent, _attrs) => {
const _component_NuxtLink = __nuxt_component_0;
const _component_LanguageSwitcher = _sfc_main$1;
_push(``);
if (sidebarOpen.value) {
_push(`
`);
} else {
_push(``);
}
_push(`
${ssrInterpolate(_ctx.$t(pageTitle.value))}
`);
_push(ssrRenderComponent(_component_LanguageSwitcher, null, null, _parent));
_push(`
`);
if (dropdownOpen.value) {
_push(`
${ssrInterpolate(userEmail.value)}
${ssrInterpolate(unref(authStore).userRole === "SUPERADMIN" ? _ctx.$t("common.super_administrator") : _ctx.$t("common.administrator"))}
`);
_push(ssrRenderComponent(_component_NuxtLink, {
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: ($event) => dropdownOpen.value = false
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(`
${ssrInterpolate(_ctx.$t("common.profile_settings"))}`);
} else {
return [
(openBlock(), createBlock("svg", {
class: "w-4 h-4",
fill: "none",
stroke: "currentColor",
viewBox: "0 0 24 24"
}, [
createVNode("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"
})
])),
createTextVNode(" " + toDisplayString(_ctx.$t("common.profile_settings")), 1)
];
}
}),
_: 1
}, _parent));
_push(`
`);
} else {
_push(``);
}
_push(`
`);
ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
_push(` `);
};
}
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("layouts/default.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
export { _sfc_main as default };
//# sourceMappingURL=default-Fh6lSdpd.mjs.map