import { _ as _sfc_main$1 } from './Editor-B1H0gxJz.mjs';
import { defineComponent, withAsyncContext, ref, withCtx, unref, isRef, createVNode, createTextVNode, toDisplayString, openBlock, createBlock, createCommentVNode, useSSRContext } from 'vue';
import { ssrRenderComponent, ssrInterpolate } from 'vue/server-renderer';
import { be as useNuxtApp, b9 as useI18n, b4 as useFetch, br as useState, b8 as useHead, j as VContainer, V as VBtn } from './server.mjs';
import { u as useAuth } from './useAuth-CRQCJpA8.mjs';
import { S as Statuses } from '../nitro/nitro.mjs';
import { V as VCardText } from './VCardText-KkYigSmQ.mjs';
import { V as VCardActions } from './VCardActions-B8o0qNQf.mjs';
import { V as VSpacer } from './VSpacer-D6kTsy1m.mjs';
import '@tiptap/vue-3';
import '@tiptap/starter-kit';
import 'perfect-debounce';
import 'v-calendar';
import 'linkifyjs';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';
import 'luxon';
import '@sequelize/core';
import 'html-to-text';
import 'zod';
import 'crypto';
import 'node:fs';
import 'sharp';
import 'path';
import 'node:stream';
import 'jsdom';
import 'dompurify';
import 'mime-types';
import 'fs';
import 'fs/promises';
import 'linkify-html';
import '@peertube/http-signature';
import 'jsonld';
import 'lodash.intersection';
import 'email-templates';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'node:events';
import 'node:buffer';
import 'node:path';
import 'vue-router';
import 'dotenv';
import 'url';
import 'bcryptjs';
import 'slugify';
import 'umzug';
import 'consola';
import '@sequelize/core/decorators-legacy';
import 'util';
import 'mitt';
import 'ical.js';
import 'node:url';
import 'fast-xml-parser';
import './createSimpleFunctional-D4PbVxKo.mjs';

const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "about",
  __ssrInlineRender: true,
  async setup(__props) {
    let __temp, __restore;
    const { $notify } = useNuxtApp();
    const { isAdmin } = useAuth();
    const { t } = useI18n();
    const { data } = ([__temp, __restore] = withAsyncContext(() => useFetch(
      "/api/settings/about",
      "$PiGXBS_oCy"
      /* nuxt-injected */
    )), __temp = await __temp, __restore(), __temp);
    const about = ref(data || t("about"));
    const settings = useState("settings");
    useHead({
      title: settings.value?.title + " - " + t("common.about"),
      meta: [
        { name: "description", content: about.value }
      ]
    });
    function save() {
      $notify("common.ok", Statuses.SUCCESS);
      $fetch("/api/settings", { method: "PUT", body: { key: "about", value: about.value } });
    }
    return (_ctx, _push, _parent, _attrs) => {
      const _component_CoreEditor = _sfc_main$1;
      _push(ssrRenderComponent(VContainer, _attrs, {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            if (unref(isAdmin)) {
              _push2(ssrRenderComponent(VCardText, null, {
                default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                  if (_push3) {
                    _push3(ssrRenderComponent(_component_CoreEditor, {
                      modelValue: unref(about),
                      "onUpdate:modelValue": ($event) => isRef(about) ? about.value = $event : null,
                      class: "px-3 ma-0",
                      label: unref(t)("common.about"),
                      height: "500px"
                    }, null, _parent3, _scopeId2));
                  } else {
                    return [
                      createVNode(_component_CoreEditor, {
                        modelValue: unref(about),
                        "onUpdate:modelValue": ($event) => isRef(about) ? about.value = $event : null,
                        class: "px-3 ma-0",
                        label: unref(t)("common.about"),
                        height: "500px"
                      }, null, 8, ["modelValue", "onUpdate:modelValue", "label"])
                    ];
                  }
                }),
                _: 1
              }, _parent2, _scopeId));
            } else {
              _push2(`<span${_scopeId}>${unref(about) ?? ""}</span>`);
            }
            if (unref(isAdmin)) {
              _push2(ssrRenderComponent(VCardActions, null, {
                default: withCtx((_2, _push3, _parent3, _scopeId2) => {
                  if (_push3) {
                    _push3(ssrRenderComponent(VSpacer, null, null, _parent3, _scopeId2));
                    _push3(ssrRenderComponent(VBtn, {
                      color: "primary",
                      variant: "outlined",
                      onClick: save
                    }, {
                      default: withCtx((_3, _push4, _parent4, _scopeId3) => {
                        if (_push4) {
                          _push4(`${ssrInterpolate(unref(t)("common.save"))}`);
                        } else {
                          return [
                            createTextVNode(toDisplayString(unref(t)("common.save")), 1)
                          ];
                        }
                      }),
                      _: 1
                    }, _parent3, _scopeId2));
                  } else {
                    return [
                      createVNode(VSpacer),
                      createVNode(VBtn, {
                        color: "primary",
                        variant: "outlined",
                        onClick: save
                      }, {
                        default: withCtx(() => [
                          createTextVNode(toDisplayString(unref(t)("common.save")), 1)
                        ]),
                        _: 1
                      })
                    ];
                  }
                }),
                _: 1
              }, _parent2, _scopeId));
            } else {
              _push2(`<!---->`);
            }
          } else {
            return [
              unref(isAdmin) ? (openBlock(), createBlock(VCardText, { key: 0 }, {
                default: withCtx(() => [
                  createVNode(_component_CoreEditor, {
                    modelValue: unref(about),
                    "onUpdate:modelValue": ($event) => isRef(about) ? about.value = $event : null,
                    class: "px-3 ma-0",
                    label: unref(t)("common.about"),
                    height: "500px"
                  }, null, 8, ["modelValue", "onUpdate:modelValue", "label"])
                ]),
                _: 1
              })) : (openBlock(), createBlock("span", {
                key: 1,
                innerHTML: unref(about)
              }, null, 8, ["innerHTML"])),
              unref(isAdmin) ? (openBlock(), createBlock(VCardActions, { key: 2 }, {
                default: withCtx(() => [
                  createVNode(VSpacer),
                  createVNode(VBtn, {
                    color: "primary",
                    variant: "outlined",
                    onClick: save
                  }, {
                    default: withCtx(() => [
                      createTextVNode(toDisplayString(unref(t)("common.save")), 1)
                    ]),
                    _: 1
                  })
                ]),
                _: 1
              })) : createCommentVNode("", true)
            ];
          }
        }),
        _: 1
      }, _parent));
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/about.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};

export { _sfc_main as default };
