import { useSSRContext, computed, mergeProps, resolveComponent, withCtx, createVNode, createTextVNode, toDisplayString } from 'vue';
import { ssrRenderAttrs, ssrInterpolate, ssrRenderComponent, ssrRenderAttr } from 'vue/server-renderer';
import { u as useNuxtApp, _ as _export_sfc, d as useAuthStore, e as __nuxt_component_0$1 } from './server.mjs';
import { NavigationComponents, Countdown } from '@vue-layout/basic';
import { d as defineNuxtComponent } from './component.ed786e27.mjs';
import 'ofetch';
import 'hookable';
import 'unctx';
import 'destr';
import 'ufo';
import 'h3';
import '@unhead/vue';
import '@unhead/dom';
import 'vue-router';
import '@ebec/http';
import 'hapic';
import 'rapiq';
import 'change-case';
import '@ucast/mongo2js';
import '@hapic/oauth2';
import '@vuelidate/validators';
import 'ilingo';
import 'nanoid';
import '@vue-layout/hyperscript';
import 'smob';
import 'browser-storage-adapter';
import 'cookie-es';
import 'ohash';
import 'defu';
import './node-server.mjs';
import 'node-fetch-native/polyfill';
import 'http';
import 'https';
import 'unenv/runtime/fetch/index';
import 'scule';
import 'unstorage';
import 'radix3';
import 'node:fs';
import 'node:url';
import 'pathe';
import './composables.c25fc8b8.mjs';

const useAPI = () => {
  const nuxtApp = useNuxtApp();
  return nuxtApp.$api;
};
const _sfc_main$2 = {
  computed: {
    year() {
      return new Date().getFullYear();
    }
  }
};
function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "page-footer" }, _attrs))}><div class="copyright"> \xA9 Authup ${ssrInterpolate($options.year)}</div></div>`);
}
const _sfc_setup$2 = _sfc_main$2.setup;
_sfc_main$2.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/footer.vue");
  return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const pageFooter = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
const footer = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: pageFooter
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main$1 = defineNuxtComponent({
  components: {
    NavigationComponents
  },
  setup() {
    const { loggedIn, user } = useAuthStore();
    return {
      loggedIn,
      user
    };
  }
});
function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_navigation_components = resolveComponent("navigation-components");
  const _component_nuxt_link = __nuxt_component_0$1;
  _push(`<div${ssrRenderAttrs(_attrs)}><header class="page-header fixed-top"><div class="header-title"><div class="toggle-box"><button type="button" class="toggle-trigger"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button></div><div class="logo"> Authup </div></div><nav class="page-navbar navbar-expand-md"><div id="page-navbar" class="navbar-content navbar-collapse">`);
  _push(ssrRenderComponent(_component_navigation_components, {
    class: "navbar-nav",
    tier: 0
  }, null, _parent));
  if (_ctx.loggedIn && _ctx.user) {
    _push(`<ul class="navbar-nav nav-items navbar-gadgets"><li class="nav-item"><a href="javascript:void(0)" class="nav-link"><span>${ssrInterpolate(_ctx.user.displayName ? _ctx.user.displayName : _ctx.user.name)}</span></a></li><li class="nav-item">`);
    _push(ssrRenderComponent(_component_nuxt_link, {
      to: "/settings",
      class: "nav-link"
    }, {
      default: withCtx((_, _push2, _parent2, _scopeId) => {
        if (_push2) {
          _push2(`<i class="fa fa-cog"${_scopeId}></i>`);
        } else {
          return [
            createVNode("i", { class: "fa fa-cog" })
          ];
        }
      }),
      _: 1
    }, _parent));
    _push(`</li><li class="nav-item">`);
    _push(ssrRenderComponent(_component_nuxt_link, {
      to: "/logout",
      class: "nav-link"
    }, {
      default: withCtx((_, _push2, _parent2, _scopeId) => {
        if (_push2) {
          _push2(`<i class="fa fa-power-off"${_scopeId}></i>`);
        } else {
          return [
            createVNode("i", { class: "fa fa-power-off" })
          ];
        }
      }),
      _: 1
    }, _parent));
    _push(`</li></ul>`);
  } else {
    _push(`<!---->`);
  }
  _push(`</div></nav></header></div>`);
}
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/header.vue");
  return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const pageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);
const header = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: pageHeader
}, Symbol.toStringTag, { value: "Module" }));
const _sfc_main = defineNuxtComponent({
  components: { Countdown, NavigationComponents },
  setup() {
    const { loggedIn, accessTokenExpireDate: tokenExpireDate } = useAuthStore();
    const tokenExpiresIn = computed(() => {
      if (!tokenExpireDate) {
        return 0;
      }
      return tokenExpireDate.getTime() - Date.now();
    });
    const docsUrl = computed(() => {
      const api = useAPI();
      return new URL("docs/", api.config.baseURL).href;
    });
    return {
      loggedIn,
      tokenExpiresIn,
      docsUrl
    };
  }
});
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_navigation_components = resolveComponent("navigation-components");
  const _component_countdown = resolveComponent("countdown");
  _push(`<div${ssrRenderAttrs(mergeProps({ class: "page-sidebar" }, _attrs))}>`);
  _push(ssrRenderComponent(_component_navigation_components, {
    class: "sidebar-menu navbar-nav",
    tier: 1
  }, null, _parent));
  _push(`<div class="mt-auto">`);
  if (_ctx.loggedIn) {
    _push(`<div class="font-weight-light d-flex flex-column ms-3 me-3 mb-1 mt-auto"><small class="text-muted">`);
    _push(ssrRenderComponent(_component_countdown, { time: _ctx.tokenExpiresIn }, {
      default: withCtx((props, _push2, _parent2, _scopeId) => {
        if (_push2) {
          _push2(`<i class="fa fa-clock pr-1"${_scopeId}></i> The session expires in <span class="text-success"${_scopeId}>${ssrInterpolate(props.minutes)} minute(s), ${ssrInterpolate(props.seconds)} second(s)</span>. `);
        } else {
          return [
            createVNode("i", { class: "fa fa-clock pr-1" }),
            createTextVNode(" The session expires in "),
            createVNode("span", { class: "text-success" }, toDisplayString(props.minutes) + " minute(s), " + toDisplayString(props.seconds) + " second(s)", 1),
            createTextVNode(". ")
          ];
        }
      }),
      _: 1
    }, _parent));
    _push(`</small></div>`);
  } else {
    _push(`<!---->`);
  }
  _push(`<ul class="sidebar-menu nav-items navbar-nav"><li class="nav-item"><a class="nav-link"${ssrRenderAttr("href", _ctx.docsUrl)} target="_blank"><i class="fa fa-file"></i> <span class="nav-link-text">API Docs</span></a></li></ul></div></div>`);
}
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/sidebar.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const pageSidebar = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);
const sidebar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: pageSidebar
}, Symbol.toStringTag, { value: "Module" }));

export { pageFooter as a, pageSidebar as b, footer as f, header as h, pageHeader as p, sidebar as s, useAPI as u };
//# sourceMappingURL=sidebar.74ee9bac.mjs.map
