import { defineComponent, computed, ref, unref, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrInterpolate, ssrRenderClass, ssrRenderAttr, ssrIncludeBooleanAttr, ssrRenderList } from 'vue/server-renderer'; import { u as useFormatter } from './useFormatter-hycy3urM.mjs'; import { a as useI18n, b as useRouter, i as useRoute } from './server.mjs'; import './region-0mvXqaMM.mjs'; import 'pinia'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'vue-router'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'unhead/plugins'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "[id]", __ssrInlineRender: true, setup(__props) { const { t } = useI18n(); const { formatNumber, formatDate, formatDateTime } = useFormatter(); useRouter(); const route = useRoute(); computed(() => Number(route.params.id)); const loading = ref(true); const error = ref(false); const stats = ref(null); const ledger = ref([]); const ledgerLoading = ref(false); const penaltyForm = ref({ amount: 0, reason: "" }); const penaltySubmitting = ref(false); const penaltyError = ref(""); const penaltySuccess = ref(""); const rewardForm = ref({ xp_amount: 0, social_amount: 0, reason: "" }); const rewardSubmitting = ref(false); const rewardError = ref(""); const rewardSuccess = ref(""); function restrictionLabel(level) { switch (level) { case 1: return t("gamification.user_detail.restriction_mild"); case 2: return t("gamification.user_detail.restriction_moderate"); case 3: return t("gamification.user_detail.restriction_severe"); default: return `${level}. ${t("gamification.user_detail.restriction_level")}`; } } return (_ctx, _push, _parent, _attrs) => { _push(`

${ssrInterpolate(unref(t)("gamification.user_detail.title"))}

${ssrInterpolate(unref(t)("gamification.user_detail.user_id"))} #${ssrInterpolate(_ctx.$route.params.id)}

`); if (unref(loading)) { _push(`
${ssrInterpolate(unref(t)("gamification.user_detail.loading"))}
`); } else if (unref(error)) { _push(`

${ssrInterpolate(unref(t)("gamification.user_detail.load_error"))}

`); } else if (!unref(stats)) { _push(`

${ssrInterpolate(unref(t)("gamification.user_detail.not_found"))}

`); } else { _push(`

${ssrInterpolate(unref(t)("gamification.user_detail.stat_total_xp"))}

${ssrInterpolate(unref(formatNumber)(unref(stats).total_xp))}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_level"))}

${ssrInterpolate(unref(stats).current_level)}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_total_points"))}

${ssrInterpolate(unref(formatNumber)(unref(stats).total_points))}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_social_points"))}

${ssrInterpolate(unref(formatNumber)(unref(stats).social_points))}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_penalty_points"))}

${ssrInterpolate(unref(stats).penalty_points > 0 ? `-${unref(stats).penalty_points}` : "0")}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_restriction"))}

${ssrInterpolate(unref(stats).restriction_level > 0 ? restrictionLabel(unref(stats).restriction_level) : unref(t)("gamification.user_detail.none"))}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_penalty_quota"))}

${ssrInterpolate(unref(stats).penalty_quota_remaining)}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_banned"))}

${ssrInterpolate(unref(stats).banned_until ? unref(formatDate)(unref(stats).banned_until) : unref(t)("gamification.user_detail.no"))}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_services"))}

${ssrInterpolate(unref(stats).services_submitted)}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_discovered"))}

${ssrInterpolate(unref(stats).places_discovered)}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_validated"))}

${ssrInterpolate(unref(stats).places_validated)}

${ssrInterpolate(unref(t)("gamification.user_detail.stat_providers"))}

${ssrInterpolate(unref(stats).providers_added_count)}

${ssrInterpolate(unref(t)("gamification.user_detail.penalty_title"))}

`); if (unref(penaltySubmitting)) { _push(``); } else { _push(``); } _push(` ${ssrInterpolate(unref(penaltySubmitting) ? unref(t)("gamification.user_detail.penalty_submitting") : unref(t)("gamification.user_detail.penalty_submit"))}`); if (unref(penaltyError)) { _push(`

${ssrInterpolate(unref(penaltyError))}

`); } else { _push(``); } if (unref(penaltySuccess)) { _push(`

${ssrInterpolate(unref(penaltySuccess))}

`); } else { _push(``); } _push(`

${ssrInterpolate(unref(t)("gamification.user_detail.reward_title"))}

`); if (unref(rewardSubmitting)) { _push(``); } else { _push(``); } _push(` ${ssrInterpolate(unref(rewardSubmitting) ? unref(t)("gamification.user_detail.reward_submitting") : unref(t)("gamification.user_detail.reward_submit"))}`); if (unref(rewardError)) { _push(`

${ssrInterpolate(unref(rewardError))}

`); } else { _push(``); } if (unref(rewardSuccess)) { _push(`

${ssrInterpolate(unref(rewardSuccess))}

`); } else { _push(``); } _push(`

${ssrInterpolate(unref(t)("gamification.user_detail.ledger_title"))}

${ssrInterpolate(unref(t)("gamification.user_detail.ledger_count", { count: unref(ledger).length }))}
`); if (unref(ledgerLoading)) { _push(`
${ssrInterpolate(unref(t)("gamification.user_detail.ledger_loading"))}
`); } else if (unref(ledger).length === 0) { _push(`
${ssrInterpolate(unref(t)("gamification.user_detail.ledger_empty"))}
`); } else { _push(`
`); ssrRenderList(unref(ledger), (entry) => { var _a; _push(``); }); _push(`
${ssrInterpolate(unref(t)("gamification.user_detail.ledger_col_date"))}${ssrInterpolate(unref(t)("gamification.user_detail.ledger_col_points"))}${ssrInterpolate(unref(t)("gamification.user_detail.ledger_col_penalty"))}${ssrInterpolate(unref(t)("gamification.user_detail.ledger_col_xp"))}${ssrInterpolate(unref(t)("gamification.user_detail.ledger_col_reason"))}${ssrInterpolate(unref(t)("gamification.user_detail.ledger_col_source"))}
${ssrInterpolate(unref(formatDateTime)(entry.created_at))}${ssrInterpolate(entry.points >= 0 ? "+" : "")}${ssrInterpolate(entry.points)}${ssrInterpolate(entry.penalty_change ? `-${entry.penalty_change}` : "\u2014")}${ssrInterpolate((_a = entry.xp) != null ? _a : "\u2014")}${ssrInterpolate(entry.reason)}`); if (entry.source_type) { _push(`${ssrInterpolate(entry.source_type)}${ssrInterpolate(entry.source_id ? ` #${entry.source_id}` : "")}`); } else { _push(`\u2014`); } _push(`
`); } _push(`
`); } _push(``); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/gamification/users/[id].vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; export { _sfc_main as default }; //# sourceMappingURL=_id_-DvpH9xyV.mjs.map