import { _ as __nuxt_component_0 } from './nuxt-link-8cb59051.mjs';
import { useSSRContext, ref, resolveComponent, withCtx, createVNode, computed, createTextVNode, toDisplayString, defineComponent } from 'vue';
import { NavigationComponents } from '@vue-layout/navigation';
import { _ as _export_sfc, d as defineNuxtComponent, g as useAuthStore, s as storeToRefs } from '../server.mjs';
import { ssrRenderAttrs, ssrRenderClass, ssrRenderComponent, ssrInterpolate, ssrRenderAttr } from 'vue/server-renderer';
import { u as useAPI } from './api-29ff697c.mjs';
import { Countdown } from '@vue-layout/countdown';
import { BContainer } from 'bootstrap-vue-next';

const _sfc_main$2 = /* @__PURE__ */ defineNuxtComponent({
  components: {
    NavigationComponents
  },
  setup() {
    const store = useAuthStore();
    const { loggedIn, user } = storeToRefs(store);
    const displayNav = ref(false);
    const toggleNav = () => {
      displayNav.value = !displayNav.value;
    };
    return {
      loggedIn,
      user,
      toggleNav,
      displayNav
    };
  }
}, "$hcjc7driI8");
function _sfc_ssrRender$2(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_navigation_components = resolveComponent("navigation-components");
  const _component_nuxt_link = __nuxt_component_0;
  _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="${ssrRenderClass([{ "show": _ctx.displayNav }, "navbar-content navbar-collapse 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.display_name ? _ctx.user.display_name : _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$2 = _sfc_main$2.setup;
_sfc_main$2.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/header.vue");
  return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const pageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender$2]]);
const _sfc_main$1 = /* @__PURE__ */ defineNuxtComponent({
  components: { Countdown, NavigationComponents },
  setup() {
    const store = useAuthStore();
    const { loggedIn, accessTokenExpireDate: tokenExpireDate, realmManagement } = storeToRefs(store);
    const tokenExpiresIn = computed(() => {
      if (!tokenExpireDate.value) {
        return 0;
      }
      return tokenExpireDate.value.getTime() - Date.now();
    });
    const docsUrl = computed(() => {
      const api = useAPI();
      return new URL("docs/", api.getBaseURL()).href;
    });
    return {
      loggedIn,
      tokenExpiresIn,
      docsUrl,
      realmManagement
    };
  }
}, "$uKgLM6mddT");
function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_navigation_components = resolveComponent("navigation-components");
  const _component_Countdown = resolveComponent("Countdown");
  _push(`<div${ssrRenderAttrs(_attrs)}><div class="page-sidebar">`);
  if (_ctx.realmManagement) {
    _push(`<div class="sidebar-header"><div class="text-center">${ssrInterpolate(_ctx.realmManagement.name)}</div></div>`);
  } else {
    _push(`<!---->`);
  }
  _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>`);
    _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></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/sidebar.vue");
  return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const PageSidebar = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender$1]]);
const _sfc_main = /* @__PURE__ */ defineComponent({
  components: {
    BContainer
  },
  computed: {
    year() {
      return (/* @__PURE__ */ new Date()).getFullYear();
    }
  }
});
function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
  const _component_BContainer = resolveComponent("BContainer");
  _push(`<div${ssrRenderAttrs(_attrs)}><div class="page-footer"><div class="copyright"> \xA9 Authup ${ssrInterpolate(_ctx.year)}</div></div>`);
  _push(ssrRenderComponent(_component_BContainer, {
    toast: { root: true },
    fluid: "sm",
    position: "position-fixed",
    style: { "z-index": "9999" }
  }, null, _parent));
  _push(`</div>`);
}
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/footer.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const pageFooter = /* @__PURE__ */ _export_sfc(_sfc_main, [["ssrRender", _sfc_ssrRender]]);

export { PageSidebar as P, pageFooter as a, pageHeader as p };
//# sourceMappingURL=footer-eec52a6b.mjs.map
