import { _ as __nuxt_component_0 } from './nuxt-link-sYJKuURe.mjs';
import { ref, defineComponent, computed, watch, mergeProps, unref, withCtx, createVNode, toDisplayString, openBlock, createBlock, createCommentVNode, createTextVNode, useSSRContext } from 'vue';
import { ssrRenderAttrs, ssrRenderSlot, ssrRenderComponent, ssrRenderList, ssrInterpolate, ssrRenderAttr } from 'vue/server-renderer';
import { u as useRoute, n as navigateTo, _ as _export_sfc } from './server.mjs';
import { u as useTheme } from './useTheme-BJEBqOKH.mjs';
import '../_/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'node:crypto';
import 'node:url';
import '../routes/renderer.mjs';
import 'vue-bundle-renderer/runtime';
import 'unhead/server';
import 'devalue';
import 'unhead/utils';
import 'unhead/plugins';
import 'vue-router';

const authState = ref(false);
const useAuth = () => {
  const isAuthenticated = authState;
  const setAuth = (value) => {
    isAuthenticated.value = value;
    if (typeof localStorage !== "undefined") {
      localStorage.setItem("workpulse-auth", value ? "1" : "0");
    }
  };
  const initAuth = () => {
    return;
  };
  const signIn = () => setAuth(true);
  const signOut = () => setAuth(false);
  return { isAuthenticated, initAuth, signIn, signOut };
};

const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  __name: "AppSidebar",
  __ssrInlineRender: true,
  setup(__props) {
    const route = useRoute();
    const items = [
      { to: "/", label: "Dashboard" },
      { to: "/report", label: "Daily Report" },
      { to: "/calendar", label: "Calendar" },
      { to: "/team", label: "Team Monitoring" },
      { to: "/analytics", label: "Analytics" },
      { to: "/notifications", label: "Notifications", badge: "4" },
      { to: "/profile", label: "Profile" },
      { to: "/settings", label: "Settings" }
    ];
    return (_ctx, _push, _parent, _attrs) => {
      const _component_NuxtLink = __nuxt_component_0;
      _push(`<aside${ssrRenderAttrs(mergeProps({ class: "sidebar-shell sticky top-0 hidden h-screen p-4 backdrop-blur lg:flex lg:flex-col" }, _attrs))}><div class="sidebar-brand mb-8 flex items-center gap-3 p-3"><div class="relative flex h-10 w-10 items-center justify-center rounded-xl bg-gradient-to-br from-brand-500 to-brand-300 text-[11px] font-bold text-white shadow-soft"> WP <span class="absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-white/90"></span></div><div><p class="text-sm font-semibold">WorkPulse</p><p class="text-xs text-text-secondary">Internal Reporting Hub</p></div></div><nav class="space-y-1.5"><!--[-->`);
      ssrRenderList(items, (item) => {
        _push(ssrRenderComponent(_component_NuxtLink, {
          key: item.to,
          to: item.to,
          class: ["sidebar-link group relative flex items-center justify-between px-3 py-2.5 text-sm", unref(route).path === item.to ? "sidebar-link-active" : "sidebar-link-idle"]
        }, {
          default: withCtx((_, _push2, _parent2, _scopeId) => {
            if (_push2) {
              _push2(`<span class="relative z-10"${_scopeId}>${ssrInterpolate(item.label)}</span>`);
              if (item.badge) {
                _push2(`<span class="chip"${_scopeId}>${ssrInterpolate(item.badge)}</span>`);
              } else {
                _push2(`<!---->`);
              }
            } else {
              return [
                createVNode("span", { class: "relative z-10" }, toDisplayString(item.label), 1),
                item.badge ? (openBlock(), createBlock("span", {
                  key: 0,
                  class: "chip"
                }, toDisplayString(item.badge), 1)) : createCommentVNode("", true)
              ];
            }
          }),
          _: 2
        }, _parent));
      });
      _push(`<!--]--></nav><button class="btn-ghost mt-auto w-full justify-start text-red-600 hover:bg-red-50 dark:hover:bg-red-500/10"> Logout </button></aside>`);
    };
  }
});
const _sfc_setup$3 = _sfc_main$3.setup;
_sfc_main$3.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("components/layout/AppSidebar.vue");
  return _sfc_setup$3 ? _sfc_setup$3(props, ctx) : void 0;
};
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  __name: "AppTopbar",
  __ssrInlineRender: true,
  setup(__props) {
    const { isDark } = useTheme();
    const openProfileMenu = ref(false);
    ref(null);
    const currentDate = new Intl.DateTimeFormat("en-US", {
      month: "long",
      day: "numeric",
      year: "numeric"
    }).format(/* @__PURE__ */ new Date());
    return (_ctx, _push, _parent, _attrs) => {
      const _component_NuxtLink = __nuxt_component_0;
      _push(`<header${ssrRenderAttrs(mergeProps({ class: "sticky top-0 z-20 border-b border-surface-border bg-white/75 backdrop-blur" }, _attrs))} data-v-7f14ad0d><div class="flex h-16 items-center gap-3 px-4 sm:px-6 lg:px-8" data-v-7f14ad0d><input class="input max-w-xl" placeholder="Search employee, report, division..." data-v-7f14ad0d><div class="ml-auto hidden items-center gap-3 md:flex" data-v-7f14ad0d><p class="inline-flex items-center gap-2 text-sm text-text-secondary" data-v-7f14ad0d><svg viewBox="0 0 24 24" class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.8" data-v-7f14ad0d><rect x="3" y="5" width="18" height="16" rx="2" data-v-7f14ad0d></rect><path d="M16 3v4M8 3v4M3 10h18" data-v-7f14ad0d></path></svg> ${ssrInterpolate(unref(currentDate))}</p><button class="inline-flex h-10 w-10 items-center justify-center rounded-xl border border-surface-border bg-white text-text-secondary transition hover:-translate-y-0.5 hover:border-brand-300 hover:text-text-primary"${ssrRenderAttr("aria-label", unref(isDark) ? "Switch to light mode" : "Switch to dark mode")} data-v-7f14ad0d>`);
      if (unref(isDark)) {
        _push(`<svg viewBox="0 0 24 24" class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.9" data-v-7f14ad0d><path d="M12 3v2M12 19v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M3 12h2M19 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41" data-v-7f14ad0d></path><circle cx="12" cy="12" r="4" data-v-7f14ad0d></circle></svg>`);
      } else {
        _push(`<svg viewBox="0 0 24 24" class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.9" data-v-7f14ad0d><path d="M12 3a7.5 7.5 0 1 0 9 9A9 9 0 1 1 12 3z" data-v-7f14ad0d></path></svg>`);
      }
      _push(`</button>`);
      _push(ssrRenderComponent(_component_NuxtLink, {
        to: "/notifications",
        class: "relative inline-flex h-10 w-10 items-center justify-center rounded-xl border border-surface-border bg-white text-text-secondary transition hover:-translate-y-0.5 hover:border-brand-300 hover:text-text-primary",
        "aria-label": "Open notifications"
      }, {
        default: withCtx((_, _push2, _parent2, _scopeId) => {
          if (_push2) {
            _push2(`<svg viewBox="0 0 24 24" class="h-4 w-4" fill="none" stroke="currentColor" stroke-width="1.8" data-v-7f14ad0d${_scopeId}><path d="M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 1 0-12 0v3.2a2 2 0 0 1-.6 1.4L4 17h5" data-v-7f14ad0d${_scopeId}></path><path d="M9 17a3 3 0 0 0 6 0" data-v-7f14ad0d${_scopeId}></path></svg><span class="absolute -right-1 -top-1 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-brand-500 px-1 text-[10px] font-semibold text-white" data-v-7f14ad0d${_scopeId}>4</span>`);
          } else {
            return [
              (openBlock(), createBlock("svg", {
                viewBox: "0 0 24 24",
                class: "h-4 w-4",
                fill: "none",
                stroke: "currentColor",
                "stroke-width": "1.8"
              }, [
                createVNode("path", { d: "M15 17h5l-1.4-1.4A2 2 0 0 1 18 14.2V11a6 6 0 1 0-12 0v3.2a2 2 0 0 1-.6 1.4L4 17h5" }),
                createVNode("path", { d: "M9 17a3 3 0 0 0 6 0" })
              ])),
              createVNode("span", { class: "absolute -right-1 -top-1 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-brand-500 px-1 text-[10px] font-semibold text-white" }, "4")
            ];
          }
        }),
        _: 1
      }, _parent));
      _push(`<div class="relative" data-v-7f14ad0d><button class="inline-flex h-10 items-center gap-2 rounded-xl border border-surface-border bg-white px-3 text-sm font-semibold text-text-primary transition hover:border-brand-300" data-v-7f14ad0d><span class="inline-flex h-7 w-7 items-center justify-center rounded-lg bg-brand-50 text-xs text-brand-700" data-v-7f14ad0d>FA</span><span data-v-7f14ad0d>Fikri A.</span></button>`);
      if (unref(openProfileMenu)) {
        _push(`<div class="absolute right-0 z-40 mt-2 w-44 rounded-xl border border-surface-border bg-white p-1 shadow-soft dark:bg-slate-900" data-v-7f14ad0d>`);
        _push(ssrRenderComponent(_component_NuxtLink, {
          to: "/profile",
          class: "block rounded-lg px-3 py-2 text-sm text-text-primary hover:bg-brand-50 dark:hover:bg-slate-800",
          onClick: ($event) => openProfileMenu.value = false
        }, {
          default: withCtx((_, _push2, _parent2, _scopeId) => {
            if (_push2) {
              _push2(` My Profile `);
            } else {
              return [
                createTextVNode(" My Profile ")
              ];
            }
          }),
          _: 1
        }, _parent));
        _push(`<button class="block w-full rounded-lg px-3 py-2 text-left text-sm text-red-600 hover:bg-red-50 dark:hover:bg-red-500/10" data-v-7f14ad0d> Logout </button></div>`);
      } else {
        _push(`<!---->`);
      }
      _push(`</div></div></div></header>`);
    };
  }
});
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/layout/AppTopbar.vue");
  return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const __nuxt_component_1 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-7f14ad0d"]]);
const _sfc_main$1 = {};
function _sfc_ssrRender(_ctx, _push, _parent, _attrs) {
  const _component_NuxtLink = __nuxt_component_0;
  _push(`<nav${ssrRenderAttrs(mergeProps({ class: "fixed bottom-0 left-0 right-0 z-30 border-t border-surface-border bg-white/95 p-2 backdrop-blur lg:hidden" }, _attrs))}><div class="grid grid-cols-5 gap-1 text-center text-xs text-text-secondary">`);
  _push(ssrRenderComponent(_component_NuxtLink, {
    to: "/",
    class: "rounded-lg p-2 hover:bg-brand-50"
  }, {
    default: withCtx((_, _push2, _parent2, _scopeId) => {
      if (_push2) {
        _push2(`Home`);
      } else {
        return [
          createTextVNode("Home")
        ];
      }
    }),
    _: 1
  }, _parent));
  _push(ssrRenderComponent(_component_NuxtLink, {
    to: "/calendar",
    class: "rounded-lg p-2 hover:bg-brand-50"
  }, {
    default: withCtx((_, _push2, _parent2, _scopeId) => {
      if (_push2) {
        _push2(`Calendar`);
      } else {
        return [
          createTextVNode("Calendar")
        ];
      }
    }),
    _: 1
  }, _parent));
  _push(ssrRenderComponent(_component_NuxtLink, {
    to: "/report",
    class: "rounded-lg bg-brand-500 p-2 font-medium text-white"
  }, {
    default: withCtx((_, _push2, _parent2, _scopeId) => {
      if (_push2) {
        _push2(`Report`);
      } else {
        return [
          createTextVNode("Report")
        ];
      }
    }),
    _: 1
  }, _parent));
  _push(ssrRenderComponent(_component_NuxtLink, {
    to: "/team",
    class: "rounded-lg p-2 hover:bg-brand-50"
  }, {
    default: withCtx((_, _push2, _parent2, _scopeId) => {
      if (_push2) {
        _push2(`Team`);
      } else {
        return [
          createTextVNode("Team")
        ];
      }
    }),
    _: 1
  }, _parent));
  _push(ssrRenderComponent(_component_NuxtLink, {
    to: "/settings",
    class: "rounded-lg p-2 hover:bg-brand-50"
  }, {
    default: withCtx((_, _push2, _parent2, _scopeId) => {
      if (_push2) {
        _push2(`Settings`);
      } else {
        return [
          createTextVNode("Settings")
        ];
      }
    }),
    _: 1
  }, _parent));
  _push(`</div></nav>`);
}
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/layout/MobileNav.vue");
  return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const __nuxt_component_2 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["ssrRender", _sfc_ssrRender]]);
const _sfc_main = /* @__PURE__ */ defineComponent({
  __name: "default",
  __ssrInlineRender: true,
  setup(__props) {
    const route = useRoute();
    useTheme();
    const { isAuthenticated } = useAuth();
    const isLoginRoute = computed(() => route.path === "/login");
    const showAppShell = computed(() => isAuthenticated.value && !isLoginRoute.value);
    watch([() => route.path, isAuthenticated], () => {
      if (!isAuthenticated.value && route.path !== "/login") {
        navigateTo("/login");
        return;
      }
      if (isAuthenticated.value && route.path === "/login") {
        navigateTo("/");
      }
    }, { immediate: true });
    return (_ctx, _push, _parent, _attrs) => {
      const _component_LayoutAppSidebar = _sfc_main$3;
      const _component_LayoutAppTopbar = __nuxt_component_1;
      const _component_LayoutMobileNav = __nuxt_component_2;
      _push(`<div${ssrRenderAttrs(mergeProps({ class: "min-h-screen bg-surface-base" }, _attrs))}>`);
      if (unref(isLoginRoute)) {
        _push(`<div>`);
        ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
        _push(`</div>`);
      } else if (unref(showAppShell)) {
        _push(`<div class="grid min-h-screen lg:grid-cols-[270px_1fr]">`);
        _push(ssrRenderComponent(_component_LayoutAppSidebar, null, null, _parent));
        _push(`<div class="min-w-0">`);
        _push(ssrRenderComponent(_component_LayoutAppTopbar, null, null, _parent));
        _push(`<main class="px-4 pb-24 pt-6 sm:px-6 lg:px-8">`);
        ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
        _push(`</main></div>`);
        _push(ssrRenderComponent(_component_LayoutMobileNav, null, null, _parent));
        _push(`</div>`);
      } else {
        _push(`<div class="flex min-h-screen items-center justify-center"><p class="text-sm text-text-secondary">Redirecting to login...</p></div>`);
      }
      _push(`</div>`);
    };
  }
});
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
  const ssrContext = useSSRContext();
  (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("layouts/default.vue");
  return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};

export { _sfc_main as default };
//# sourceMappingURL=default-Bks4VdXn.mjs.map
