import { defineComponent, ref, computed, unref, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrInterpolate, ssrIncludeBooleanAttr, ssrRenderList, ssrRenderClass, ssrRenderAttr, ssrRenderStyle } from 'vue/server-renderer'; import { a as useI18n } from './server.mjs'; import { _ as _export_sfc } from './_plugin-vue_export-helper-1tPrXgE0.mjs'; 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 'pinia'; 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: "validation-rules", __ssrInlineRender: true, setup(__props) { const { t } = useI18n(); const loading = ref(true); const error = ref(false); const saving = ref(false); const formError = ref(""); const toast = ref(""); const lastSaved = ref(""); const rules = ref([]); const originalValues = ref({}); const editedValues = ref({}); const hasChanges = computed(() => { return Object.keys(editedValues.value).length > 0; }); function hasRuleChanged(ruleKey) { return ruleKey in editedValues.value; } function getOriginalValue(ruleKey) { var _a; return (_a = originalValues.value[ruleKey]) != null ? _a : 0; } function getProgressWidth(ruleKey) { var _a, _b; const val = (_b = (_a = editedValues.value[ruleKey]) != null ? _a : originalValues.value[ruleKey]) != null ? _b : 0; return val + "%"; } function getValueBadgeClass(val) { if (val >= 80) return "bg-emerald-500/20 text-emerald-400"; if (val >= 50) return "bg-amber-500/20 text-amber-400"; return "bg-slate-500/20 text-slate-400"; } function getProgressBarClass(val) { if (val >= 80) return "bg-emerald-500"; if (val >= 50) return "bg-amber-500"; return "bg-slate-500"; } return (_ctx, _push, _parent, _attrs) => { _push(`

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

${ssrInterpolate(unref(t)("gamification.validation_rules.subtitle"))}

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

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

`); } else { _push(`
${ssrInterpolate(unref(t)("gamification.validation_rules.last_saved"))} ${ssrInterpolate(unref(lastSaved) ? unref(lastSaved) : "\u2014")}
`); if (unref(saving)) { _push(``); } else { _push(``); } _push(` ${ssrInterpolate(unref(saving) ? unref(t)("gamification.validation_rules.saving") : unref(t)("gamification.validation_rules.save_rules"))}
`); ssrRenderList(unref(rules), (rule) => { var _a; _push(`

${ssrInterpolate(rule.rule_key)}

${ssrInterpolate(rule.description)}

${ssrInterpolate(rule.rule_value)}
`); if (hasRuleChanged(rule.rule_key)) { _push(`
${ssrInterpolate(unref(t)("gamification.validation_rules.changed_from"))} ${ssrInterpolate(getOriginalValue(rule.rule_key))}${ssrInterpolate(unref(editedValues)[rule.rule_key])}
`); } else { _push(``); } _push(`
`); }); _push(`

${ssrInterpolate(unref(t)("gamification.validation_rules.info_title"))}

${ssrInterpolate(unref(t)("gamification.validation_rules.info_text"))}

`); } if (unref(formError)) { _push(`
${ssrInterpolate(unref(formError))}
`); } else { _push(``); } if (unref(toast)) { _push(`
${ssrInterpolate(unref(toast))}
`); } else { _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/validation-rules.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const validationRules = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-7a2ac5d4"]]); export { validationRules as default }; //# sourceMappingURL=validation-rules-CgWl8yP4.mjs.map