PC-mj/.output/server/chunks/app/server.mjs

1139 lines
38 KiB
JavaScript
Raw Permalink Normal View History

2024-01-09 07:55:02 +00:00
import { version, unref, inject, hasInjectionContext, getCurrentInstance, ref, computed, createApp, effectScope, reactive, useSSRContext, defineAsyncComponent, provide, onErrorCaptured, onServerPrefetch, createVNode, resolveDynamicComponent, toRef, shallowRef, shallowReactive, isReadonly, isRef, isShallow, isReactive, toRaw, resolveComponent, mergeProps, nextTick } from 'vue';
import { d as useRuntimeConfig$1, $ as $fetch, w as withQuery, l as hasProtocol, p as parseURL, m as isScriptProtocol, j as joinURL, h as createError$1, n as sanitizeStatusCode, o as createHooks } from '../nitro/node-server.mjs';
import { getActiveHead } from 'unhead';
import { defineHeadPlugin } from '@unhead/shared';
import { createMemoryHistory, createRouter, START_LOCATION } from 'vue-router';
import { ssrRenderSuspense, ssrRenderComponent, ssrRenderVNode } from 'vue/server-renderer';
import 'node:http';
import 'node:https';
import 'fs';
import 'path';
import 'node:fs';
import 'node:url';
function createContext$1(opts = {}) {
let currentInstance;
let isSingleton = false;
const checkConflict = (instance) => {
if (currentInstance && currentInstance !== instance) {
throw new Error("Context conflict");
}
};
let als;
if (opts.asyncContext) {
const _AsyncLocalStorage = opts.AsyncLocalStorage || globalThis.AsyncLocalStorage;
if (_AsyncLocalStorage) {
als = new _AsyncLocalStorage();
} else {
console.warn("[unctx] `AsyncLocalStorage` is not provided.");
}
}
const _getCurrentInstance = () => {
if (als && currentInstance === void 0) {
const instance = als.getStore();
if (instance !== void 0) {
return instance;
}
}
return currentInstance;
};
return {
use: () => {
const _instance = _getCurrentInstance();
if (_instance === void 0) {
throw new Error("Context is not available");
}
return _instance;
},
tryUse: () => {
return _getCurrentInstance();
},
set: (instance, replace) => {
if (!replace) {
checkConflict(instance);
}
currentInstance = instance;
isSingleton = true;
},
unset: () => {
currentInstance = void 0;
isSingleton = false;
},
call: (instance, callback) => {
checkConflict(instance);
currentInstance = instance;
try {
return als ? als.run(instance, callback) : callback();
} finally {
if (!isSingleton) {
currentInstance = void 0;
}
}
},
async callAsync(instance, callback) {
currentInstance = instance;
const onRestore = () => {
currentInstance = instance;
};
const onLeave = () => currentInstance === instance ? onRestore : void 0;
asyncHandlers$1.add(onLeave);
try {
const r = als ? als.run(instance, callback) : callback();
if (!isSingleton) {
currentInstance = void 0;
}
return await r;
} finally {
asyncHandlers$1.delete(onLeave);
}
}
};
}
function createNamespace$1(defaultOpts = {}) {
const contexts = {};
return {
get(key, opts = {}) {
if (!contexts[key]) {
contexts[key] = createContext$1({ ...defaultOpts, ...opts });
}
contexts[key];
return contexts[key];
}
};
}
const _globalThis$1 = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : {};
const globalKey$2 = "__unctx__";
const defaultNamespace$1 = _globalThis$1[globalKey$2] || (_globalThis$1[globalKey$2] = createNamespace$1());
const getContext = (key, opts = {}) => defaultNamespace$1.get(key, opts);
const asyncHandlersKey$1 = "__unctx_async_handlers__";
const asyncHandlers$1 = _globalThis$1[asyncHandlersKey$1] || (_globalThis$1[asyncHandlersKey$1] = /* @__PURE__ */ new Set());
const appConfig = useRuntimeConfig$1().app;
const baseURL = () => appConfig.baseURL;
if (!globalThis.$fetch) {
globalThis.$fetch = $fetch.create({
baseURL: baseURL()
});
}
const nuxtAppCtx = /* @__PURE__ */ getContext("nuxt-app", {
asyncContext: false
});
const NuxtPluginIndicator = "__nuxt_plugin";
function createNuxtApp(options) {
let hydratingCount = 0;
const nuxtApp = {
_scope: effectScope(),
provide: void 0,
globalName: "nuxt",
versions: {
get nuxt() {
return "3.8.2";
},
get vue() {
return nuxtApp.vueApp.version;
}
},
payload: reactive({
data: {},
state: {},
_errors: {},
...{ serverRendered: true }
}),
static: {
data: {}
},
runWithContext: (fn) => nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn)),
isHydrating: false,
deferHydration() {
if (!nuxtApp.isHydrating) {
return () => {
};
}
hydratingCount++;
let called = false;
return () => {
if (called) {
return;
}
called = true;
hydratingCount--;
if (hydratingCount === 0) {
nuxtApp.isHydrating = false;
return nuxtApp.callHook("app:suspense:resolve");
}
};
},
_asyncDataPromises: {},
_asyncData: {},
_payloadRevivers: {},
...options
};
nuxtApp.hooks = createHooks();
nuxtApp.hook = nuxtApp.hooks.hook;
{
const contextCaller = async function(hooks, args) {
for (const hook of hooks) {
await nuxtApp.runWithContext(() => hook(...args));
}
};
nuxtApp.hooks.callHook = (name, ...args) => nuxtApp.hooks.callHookWith(contextCaller, name, ...args);
}
nuxtApp.callHook = nuxtApp.hooks.callHook;
nuxtApp.provide = (name, value) => {
const $name = "$" + name;
defineGetter(nuxtApp, $name, value);
defineGetter(nuxtApp.vueApp.config.globalProperties, $name, value);
};
defineGetter(nuxtApp.vueApp, "$nuxt", nuxtApp);
defineGetter(nuxtApp.vueApp.config.globalProperties, "$nuxt", nuxtApp);
{
if (nuxtApp.ssrContext) {
nuxtApp.ssrContext.nuxt = nuxtApp;
nuxtApp.ssrContext._payloadReducers = {};
nuxtApp.payload.path = nuxtApp.ssrContext.url;
}
nuxtApp.ssrContext = nuxtApp.ssrContext || {};
if (nuxtApp.ssrContext.payload) {
Object.assign(nuxtApp.payload, nuxtApp.ssrContext.payload);
}
nuxtApp.ssrContext.payload = nuxtApp.payload;
nuxtApp.ssrContext.config = {
public: options.ssrContext.runtimeConfig.public,
app: options.ssrContext.runtimeConfig.app
};
}
const runtimeConfig = options.ssrContext.runtimeConfig;
nuxtApp.provide("config", runtimeConfig);
return nuxtApp;
}
async function applyPlugin(nuxtApp, plugin2) {
if (plugin2.hooks) {
nuxtApp.hooks.addHooks(plugin2.hooks);
}
if (typeof plugin2 === "function") {
const { provide: provide2 } = await nuxtApp.runWithContext(() => plugin2(nuxtApp)) || {};
if (provide2 && typeof provide2 === "object") {
for (const key in provide2) {
nuxtApp.provide(key, provide2[key]);
}
}
}
}
async function applyPlugins(nuxtApp, plugins2) {
var _a, _b;
const parallels = [];
const errors = [];
for (const plugin2 of plugins2) {
if (((_a = nuxtApp.ssrContext) == null ? void 0 : _a.islandContext) && ((_b = plugin2.env) == null ? void 0 : _b.islands) === false) {
continue;
}
const promise = applyPlugin(nuxtApp, plugin2);
if (plugin2.parallel) {
parallels.push(promise.catch((e) => errors.push(e)));
} else {
await promise;
}
}
await Promise.all(parallels);
if (errors.length) {
throw errors[0];
}
}
/*! @__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function defineNuxtPlugin(plugin2) {
if (typeof plugin2 === "function") {
return plugin2;
}
delete plugin2.name;
return Object.assign(plugin2.setup || (() => {
}), plugin2, { [NuxtPluginIndicator]: true });
}
function callWithNuxt(nuxt, setup, args) {
const fn = () => args ? setup(...args) : setup();
{
return nuxt.vueApp.runWithContext(() => nuxtAppCtx.callAsync(nuxt, fn));
}
}
/*! @__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function useNuxtApp() {
var _a;
let nuxtAppInstance;
if (hasInjectionContext()) {
nuxtAppInstance = (_a = getCurrentInstance()) == null ? void 0 : _a.appContext.app.$nuxt;
}
nuxtAppInstance = nuxtAppInstance || nuxtAppCtx.tryUse();
if (!nuxtAppInstance) {
{
throw new Error("[nuxt] instance unavailable");
}
}
return nuxtAppInstance;
}
/*! @__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function useRuntimeConfig() {
return (/* @__PURE__ */ useNuxtApp()).$config;
}
function defineGetter(obj, key, val) {
Object.defineProperty(obj, key, { get: () => val });
}
version.startsWith("3");
function resolveUnref(r) {
return typeof r === "function" ? r() : unref(r);
}
function resolveUnrefHeadInput(ref2, lastKey = "") {
if (ref2 instanceof Promise)
return ref2;
const root = resolveUnref(ref2);
if (!ref2 || !root)
return root;
if (Array.isArray(root))
return root.map((r) => resolveUnrefHeadInput(r, lastKey));
if (typeof root === "object") {
return Object.fromEntries(
Object.entries(root).map(([k, v]) => {
if (k === "titleTemplate" || k.startsWith("on"))
return [k, unref(v)];
return [k, resolveUnrefHeadInput(v, k)];
})
);
}
return root;
}
defineHeadPlugin({
hooks: {
"entries:resolve": function(ctx) {
for (const entry2 of ctx.entries)
entry2.resolvedInput = resolveUnrefHeadInput(entry2.input);
}
}
});
const headSymbol = "usehead";
const _global = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
const globalKey$1 = "__unhead_injection_handler__";
function setHeadInjectionHandler(handler) {
_global[globalKey$1] = handler;
}
function injectHead() {
if (globalKey$1 in _global) {
return _global[globalKey$1]();
}
const head = inject(headSymbol);
if (!head && "production" !== "production")
console.warn("Unhead is missing Vue context, falling back to shared context. This may have unexpected results.");
return head || getActiveHead();
}
const unhead_KgADcZ0jPj = /* @__PURE__ */ defineNuxtPlugin({
name: "nuxt:head",
enforce: "pre",
setup(nuxtApp) {
const head = nuxtApp.ssrContext.head;
setHeadInjectionHandler(
// need a fresh instance of the nuxt app to avoid parallel requests interfering with each other
() => (/* @__PURE__ */ useNuxtApp()).vueApp._context.provides.usehead
);
nuxtApp.vueApp.use(head);
}
});
function createContext(opts = {}) {
let currentInstance;
let isSingleton = false;
const checkConflict = (instance) => {
if (currentInstance && currentInstance !== instance) {
throw new Error("Context conflict");
}
};
let als;
if (opts.asyncContext) {
const _AsyncLocalStorage = opts.AsyncLocalStorage || globalThis.AsyncLocalStorage;
if (_AsyncLocalStorage) {
als = new _AsyncLocalStorage();
} else {
console.warn("[unctx] `AsyncLocalStorage` is not provided.");
}
}
const _getCurrentInstance = () => {
if (als && currentInstance === void 0) {
const instance = als.getStore();
if (instance !== void 0) {
return instance;
}
}
return currentInstance;
};
return {
use: () => {
const _instance = _getCurrentInstance();
if (_instance === void 0) {
throw new Error("Context is not available");
}
return _instance;
},
tryUse: () => {
return _getCurrentInstance();
},
set: (instance, replace) => {
if (!replace) {
checkConflict(instance);
}
currentInstance = instance;
isSingleton = true;
},
unset: () => {
currentInstance = void 0;
isSingleton = false;
},
call: (instance, callback) => {
checkConflict(instance);
currentInstance = instance;
try {
return als ? als.run(instance, callback) : callback();
} finally {
if (!isSingleton) {
currentInstance = void 0;
}
}
},
async callAsync(instance, callback) {
currentInstance = instance;
const onRestore = () => {
currentInstance = instance;
};
const onLeave = () => currentInstance === instance ? onRestore : void 0;
asyncHandlers.add(onLeave);
try {
const r = als ? als.run(instance, callback) : callback();
if (!isSingleton) {
currentInstance = void 0;
}
return await r;
} finally {
asyncHandlers.delete(onLeave);
}
}
};
}
function createNamespace(defaultOpts = {}) {
const contexts = {};
return {
get(key, opts = {}) {
if (!contexts[key]) {
contexts[key] = createContext({ ...defaultOpts, ...opts });
}
contexts[key];
return contexts[key];
}
};
}
const _globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : {};
const globalKey = "__unctx__";
_globalThis[globalKey] || (_globalThis[globalKey] = createNamespace());
const asyncHandlersKey = "__unctx_async_handlers__";
const asyncHandlers = _globalThis[asyncHandlersKey] || (_globalThis[asyncHandlersKey] = /* @__PURE__ */ new Set());
function executeAsync(function_) {
const restores = [];
for (const leaveHandler of asyncHandlers) {
const restore2 = leaveHandler();
if (restore2) {
restores.push(restore2);
}
}
const restore = () => {
for (const restore2 of restores) {
restore2();
}
};
let awaitable = function_();
if (awaitable && typeof awaitable === "object" && "catch" in awaitable) {
awaitable = awaitable.catch((error) => {
restore();
throw error;
});
}
return [awaitable, restore];
}
const PageRouteSymbol = Symbol("route");
const useRouter = () => {
var _a;
return (_a = /* @__PURE__ */ useNuxtApp()) == null ? void 0 : _a.$router;
};
const useRoute = () => {
if (hasInjectionContext()) {
return inject(PageRouteSymbol, (/* @__PURE__ */ useNuxtApp())._route);
}
return (/* @__PURE__ */ useNuxtApp())._route;
};
/*! @__NO_SIDE_EFFECTS__ */
// @__NO_SIDE_EFFECTS__
function defineNuxtRouteMiddleware(middleware) {
return middleware;
}
const isProcessingMiddleware = () => {
try {
if ((/* @__PURE__ */ useNuxtApp())._processingMiddleware) {
return true;
}
} catch {
return true;
}
return false;
};
const navigateTo = (to, options) => {
if (!to) {
to = "/";
}
const toPath = typeof to === "string" ? to : withQuery(to.path || "/", to.query || {}) + (to.hash || "");
if (options == null ? void 0 : options.open) {
return Promise.resolve();
}
const isExternal = (options == null ? void 0 : options.external) || hasProtocol(toPath, { acceptRelative: true });
if (isExternal) {
if (!(options == null ? void 0 : options.external)) {
throw new Error("Navigating to an external URL is not allowed by default. Use `navigateTo(url, { external: true })`.");
}
const protocol = parseURL(toPath).protocol;
if (protocol && isScriptProtocol(protocol)) {
throw new Error(`Cannot navigate to a URL with '${protocol}' protocol.`);
}
}
const inMiddleware = isProcessingMiddleware();
const router = useRouter();
const nuxtApp = /* @__PURE__ */ useNuxtApp();
{
if (nuxtApp.ssrContext) {
const fullPath = typeof to === "string" || isExternal ? toPath : router.resolve(to).fullPath || "/";
const location2 = isExternal ? toPath : joinURL((/* @__PURE__ */ useRuntimeConfig()).app.baseURL, fullPath);
const redirect = async function(response) {
await nuxtApp.callHook("app:redirected");
const encodedLoc = location2.replace(/"/g, "%22");
nuxtApp.ssrContext._renderResponse = {
statusCode: sanitizeStatusCode((options == null ? void 0 : options.redirectCode) || 302, 302),
body: `<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head></html>`,
headers: { location: location2 }
};
return response;
};
if (!isExternal && inMiddleware) {
router.afterEach((final) => final.fullPath === fullPath ? redirect(false) : void 0);
return to;
}
return redirect(!inMiddleware ? void 0 : (
/* abort route navigation */
false
));
}
}
if (isExternal) {
nuxtApp._scope.stop();
if (options == null ? void 0 : options.replace) {
location.replace(toPath);
} else {
location.href = toPath;
}
if (inMiddleware) {
if (!nuxtApp.isHydrating) {
return false;
}
return new Promise(() => {
});
}
return Promise.resolve();
}
return (options == null ? void 0 : options.replace) ? router.replace(to) : router.push(to);
};
const useError = () => toRef((/* @__PURE__ */ useNuxtApp()).payload, "error");
const showError = (_err) => {
const err = createError(_err);
try {
const nuxtApp = /* @__PURE__ */ useNuxtApp();
const error = useError();
if (false)
;
error.value = error.value || err;
} catch {
throw err;
}
return err;
};
const isNuxtError = (err) => !!(err && typeof err === "object" && "__nuxt_error" in err);
const createError = (err) => {
const _err = createError$1(err);
_err.__nuxt_error = true;
return _err;
};
const _routes = [
{
name: "details-id",
path: "/details/:id()",
meta: {},
alias: [],
redirect: void 0,
2024-09-25 10:12:53 +00:00
component: () => import('./_nuxt/_id_-b5049671.mjs').then((m) => m.default || m)
2024-01-09 07:55:02 +00:00
},
{
name: "index.html",
path: "/index.html",
meta: {},
alias: [],
redirect: void 0,
component: () => import('./_nuxt/index-bbc3c9b2.mjs').then((m) => m.default || m)
2024-01-09 07:55:02 +00:00
},
{
name: "index",
path: "/",
meta: {},
alias: [],
redirect: void 0,
2024-07-24 08:17:06 +00:00
component: () => import('./_nuxt/index-ffb382ac.mjs').then((m) => m.default || m)
2024-01-09 07:55:02 +00:00
},
{
name: "publish",
path: "/publish",
meta: {},
alias: [],
redirect: void 0,
component: () => import('./_nuxt/index-5bb6c415.mjs').then((m) => m.default || m)
2024-01-09 07:55:02 +00:00
}
];
function generateRouteKey(route) {
const source = (route == null ? void 0 : route.meta.key) ?? route.path.replace(/(:\w+)\([^)]+\)/g, "$1").replace(/(:\w+)[?+*]/g, "$1").replace(/:\w+/g, (r) => {
var _a;
return ((_a = route.params[r.slice(1)]) == null ? void 0 : _a.toString()) || "";
});
return typeof source === "function" ? source(route) : source;
}
function isChangingPage(to, from) {
if (to === from) {
return false;
}
if (generateRouteKey(to) !== generateRouteKey(from)) {
return true;
}
const areComponentsSame = to.matched.every(
(comp, index) => {
var _a, _b;
return comp.components && comp.components.default === ((_b = (_a = from.matched[index]) == null ? void 0 : _a.components) == null ? void 0 : _b.default);
}
);
if (areComponentsSame) {
return false;
}
return true;
}
const appPageTransition = false;
const nuxtLinkDefaults = { "componentName": "NuxtLink" };
const routerOptions0 = {
scrollBehavior(to, from, savedPosition) {
var _a;
const nuxtApp = /* @__PURE__ */ useNuxtApp();
const behavior = ((_a = useRouter().options) == null ? void 0 : _a.scrollBehaviorType) ?? "auto";
let position = savedPosition || void 0;
const routeAllowsScrollToTop = typeof to.meta.scrollToTop === "function" ? to.meta.scrollToTop(to, from) : to.meta.scrollToTop;
if (!position && from && to && routeAllowsScrollToTop !== false && isChangingPage(to, from)) {
position = { left: 0, top: 0 };
}
if (to.path === from.path) {
if (from.hash && !to.hash) {
return { left: 0, top: 0 };
}
if (to.hash) {
return { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior };
}
}
const hasTransition = (route) => !!(route.meta.pageTransition ?? appPageTransition);
const hookToWait = hasTransition(from) && hasTransition(to) ? "page:transition:finish" : "page:finish";
return new Promise((resolve) => {
nuxtApp.hooks.hookOnce(hookToWait, async () => {
await nextTick();
if (to.hash) {
position = { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior };
}
resolve(position);
});
});
}
};
function _getHashElementScrollMarginTop(selector) {
try {
const elem = document.querySelector(selector);
if (elem) {
return parseFloat(getComputedStyle(elem).scrollMarginTop);
}
} catch {
}
return 0;
}
const configRouterOptions = {
hashMode: false,
scrollBehaviorType: "auto"
};
const routerOptions = {
...configRouterOptions,
...routerOptions0
};
const validate = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => {
var _a;
let __temp, __restore;
if (!((_a = to.meta) == null ? void 0 : _a.validate)) {
return;
}
useRouter();
const result = ([__temp, __restore] = executeAsync(() => Promise.resolve(to.meta.validate(to))), __temp = await __temp, __restore(), __temp);
if (result === true) {
return;
}
{
return result;
}
});
const manifest_45route_45rule = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => {
{
return;
}
});
const globalMiddleware = [
validate,
manifest_45route_45rule
];
const namedMiddleware = {
"error-handler": () => import('./_nuxt/errorHandler-a798e3fb.mjs')
};
2024-01-09 07:55:02 +00:00
const plugin = /* @__PURE__ */ defineNuxtPlugin({
name: "nuxt:router",
enforce: "pre",
async setup(nuxtApp) {
var _a, _b;
let __temp, __restore;
let routerBase = (/* @__PURE__ */ useRuntimeConfig()).app.baseURL;
if (routerOptions.hashMode && !routerBase.includes("#")) {
routerBase += "#";
}
const history = ((_a = routerOptions.history) == null ? void 0 : _a.call(routerOptions, routerBase)) ?? createMemoryHistory(routerBase);
const routes = ((_b = routerOptions.routes) == null ? void 0 : _b.call(routerOptions, _routes)) ?? _routes;
let startPosition;
const initialURL = nuxtApp.ssrContext.url;
const router = createRouter({
...routerOptions,
scrollBehavior: (to, from, savedPosition) => {
var _a2;
if (from === START_LOCATION) {
startPosition = savedPosition;
return;
}
router.options.scrollBehavior = routerOptions.scrollBehavior;
return (_a2 = routerOptions.scrollBehavior) == null ? void 0 : _a2.call(routerOptions, to, START_LOCATION, startPosition || savedPosition);
},
history,
routes
});
nuxtApp.vueApp.use(router);
const previousRoute = shallowRef(router.currentRoute.value);
router.afterEach((_to, from) => {
previousRoute.value = from;
});
Object.defineProperty(nuxtApp.vueApp.config.globalProperties, "previousRoute", {
get: () => previousRoute.value
});
const _route = shallowRef(router.resolve(initialURL));
const syncCurrentRoute = () => {
_route.value = router.currentRoute.value;
};
nuxtApp.hook("page:finish", syncCurrentRoute);
router.afterEach((to, from) => {
var _a2, _b2, _c, _d;
if (((_b2 = (_a2 = to.matched[0]) == null ? void 0 : _a2.components) == null ? void 0 : _b2.default) === ((_d = (_c = from.matched[0]) == null ? void 0 : _c.components) == null ? void 0 : _d.default)) {
syncCurrentRoute();
}
});
const route = {};
for (const key in _route.value) {
Object.defineProperty(route, key, {
get: () => _route.value[key]
});
}
nuxtApp._route = shallowReactive(route);
nuxtApp._middleware = nuxtApp._middleware || {
global: [],
named: {}
};
useError();
try {
if (true) {
;
[__temp, __restore] = executeAsync(() => router.push(initialURL)), await __temp, __restore();
;
}
;
[__temp, __restore] = executeAsync(() => router.isReady()), await __temp, __restore();
;
} catch (error2) {
[__temp, __restore] = executeAsync(() => nuxtApp.runWithContext(() => showError(error2))), await __temp, __restore();
}
const initialLayout = nuxtApp.payload.state._layout;
router.beforeEach(async (to, from) => {
var _a2, _b2;
to.meta = reactive(to.meta);
if (nuxtApp.isHydrating && initialLayout && !isReadonly(to.meta.layout)) {
to.meta.layout = initialLayout;
}
nuxtApp._processingMiddleware = true;
if (!((_a2 = nuxtApp.ssrContext) == null ? void 0 : _a2.islandContext)) {
const middlewareEntries = /* @__PURE__ */ new Set([...globalMiddleware, ...nuxtApp._middleware.global]);
for (const component of to.matched) {
const componentMiddleware = component.meta.middleware;
if (!componentMiddleware) {
continue;
}
if (Array.isArray(componentMiddleware)) {
for (const entry2 of componentMiddleware) {
middlewareEntries.add(entry2);
}
} else {
middlewareEntries.add(componentMiddleware);
}
}
for (const entry2 of middlewareEntries) {
const middleware = typeof entry2 === "string" ? nuxtApp._middleware.named[entry2] || await ((_b2 = namedMiddleware[entry2]) == null ? void 0 : _b2.call(namedMiddleware).then((r) => r.default || r)) : entry2;
if (!middleware) {
throw new Error(`Unknown route middleware: '${entry2}'.`);
}
const result = await nuxtApp.runWithContext(() => middleware(to, from));
{
if (result === false || result instanceof Error) {
const error2 = result || createError$1({
statusCode: 404,
statusMessage: `Page Not Found: ${initialURL}`
});
await nuxtApp.runWithContext(() => showError(error2));
return false;
}
}
if (result === true) {
continue;
}
if (result || result === false) {
return result;
}
}
}
});
router.onError(() => {
delete nuxtApp._processingMiddleware;
});
router.afterEach(async (to, _from, failure) => {
var _a2;
delete nuxtApp._processingMiddleware;
if ((failure == null ? void 0 : failure.type) === 4) {
return;
}
if (to.matched.length === 0 && !((_a2 = nuxtApp.ssrContext) == null ? void 0 : _a2.islandContext)) {
await nuxtApp.runWithContext(() => showError(createError$1({
statusCode: 404,
fatal: false,
statusMessage: `Page not found: ${to.fullPath}`
})));
} else if (to.redirectedFrom && to.fullPath !== initialURL) {
await nuxtApp.runWithContext(() => navigateTo(to.fullPath || "/"));
}
});
nuxtApp.hooks.hookOnce("app:created", async () => {
try {
await router.replace({
...router.resolve(initialURL),
name: void 0,
// #4920, #4982
force: true
});
router.options.scrollBehavior = routerOptions.scrollBehavior;
} catch (error2) {
await nuxtApp.runWithContext(() => showError(error2));
}
});
return { provide: { router } };
}
});
function definePayloadReducer(name, reduce) {
{
(/* @__PURE__ */ useNuxtApp()).ssrContext._payloadReducers[name] = reduce;
}
}
const reducers = {
NuxtError: (data) => isNuxtError(data) && data.toJSON(),
EmptyShallowRef: (data) => isRef(data) && isShallow(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_"),
EmptyRef: (data) => isRef(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_"),
ShallowRef: (data) => isRef(data) && isShallow(data) && data.value,
ShallowReactive: (data) => isReactive(data) && isShallow(data) && toRaw(data),
Ref: (data) => isRef(data) && data.value,
Reactive: (data) => isReactive(data) && toRaw(data)
};
const revive_payload_server_eJ33V7gbc6 = /* @__PURE__ */ defineNuxtPlugin({
name: "nuxt:revive-payload:server",
setup() {
for (const reducer in reducers) {
definePayloadReducer(reducer, reducers[reducer]);
}
}
});
const components_plugin_KR1HBZs4kY = /* @__PURE__ */ defineNuxtPlugin({
name: "nuxt:global-components"
});
const element_plus_teleports_plugin_h4Dmekbj62 = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook("app:rendered", (ctx) => {
var _a;
if ((_a = ctx.ssrContext) == null ? void 0 : _a.teleports) {
ctx.ssrContext.teleports = renderTeleports(ctx.ssrContext.teleports);
}
});
});
function renderTeleports(teleports) {
const body = Object.entries(teleports).reduce((all, [key, value]) => {
if (key.startsWith("#el-popper-container-") || [].includes(key)) {
return `${all}<div id="${key.slice(1)}">${value}</div>`;
}
return all;
}, teleports.body || "");
return { ...teleports, body };
}
class ElementPlusError extends Error {
constructor(m) {
super(m);
this.name = "ElementPlusError";
}
}
function throwError(scope, m) {
throw new ElementPlusError(`[${scope}] ${m}`);
}
function debugWarn(scope, message) {
}
const defaultNamespace = "el";
const statePrefix = "is-";
const _bem = (namespace, block, blockSuffix, element, modifier) => {
let cls = `${namespace}-${block}`;
if (blockSuffix) {
cls += `-${blockSuffix}`;
}
if (element) {
cls += `__${element}`;
}
if (modifier) {
cls += `--${modifier}`;
}
return cls;
};
const namespaceContextKey = Symbol("namespaceContextKey");
const useGetDerivedNamespace = (namespaceOverrides) => {
const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref(defaultNamespace)) : ref(defaultNamespace));
const namespace = computed(() => {
return unref(derivedNamespace) || defaultNamespace;
});
return namespace;
};
const useNamespace = (block, namespaceOverrides) => {
const namespace = useGetDerivedNamespace(namespaceOverrides);
const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
const is = (name, ...args) => {
const state = args.length >= 1 ? args[0] : true;
return name && state ? `${statePrefix}${name}` : "";
};
const cssVar = (object) => {
const styles = {};
for (const key in object) {
if (object[key]) {
styles[`--${namespace.value}-${key}`] = object[key];
}
}
return styles;
};
const cssVarBlock = (object) => {
const styles = {};
for (const key in object) {
if (object[key]) {
styles[`--${namespace.value}-${block}-${key}`] = object[key];
}
}
return styles;
};
const cssVarName = (name) => `--${namespace.value}-${name}`;
const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
return {
namespace,
b,
e,
m,
be,
em,
bm,
bem,
is,
cssVar,
cssVarName,
cssVarBlock,
cssVarBlockName
};
};
const defaultIdInjection = {
prefix: Math.floor(Math.random() * 1e4),
current: 0
};
const ID_INJECTION_KEY = Symbol("elIdInjection");
const useIdInjection = () => {
return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
};
const useId = (deterministicId) => {
const idInjection = useIdInjection();
const namespace = useGetDerivedNamespace();
const idRef = computed(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
return idRef;
};
const element_plus_injection_plugin_1RNPi6ogby = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.provide(ID_INJECTION_KEY, { "prefix": 1024, "current": 0 });
});
const plugins = [
unhead_KgADcZ0jPj,
plugin,
revive_payload_server_eJ33V7gbc6,
components_plugin_KR1HBZs4kY,
element_plus_teleports_plugin_h4Dmekbj62,
element_plus_injection_plugin_1RNPi6ogby
];
const _sfc_main$2 = {
__name: "app",
__ssrInlineRender: true,
setup(__props) {
useRoute();
let isNeedLogin = ref(true);
2024-05-15 03:52:55 +00:00
let isGetLoginState = ref(true);
2024-01-09 07:55:02 +00:00
const goLogin = () => {
return;
};
provide("isNeedLogin", isNeedLogin);
provide("goLogin", goLogin);
2024-05-15 03:52:55 +00:00
provide("isGetLoginState", isGetLoginState);
2024-01-09 07:55:02 +00:00
return (_ctx, _push, _parent, _attrs) => {
const _component_RouterView = resolveComponent("RouterView");
_push(`<!--[--><div id="append_parent"></div><div id="ajaxwaitid"></div>`);
_push(ssrRenderComponent(_component_RouterView, null, null, _parent));
_push(`<!--]-->`);
};
}
};
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("app.vue");
return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : void 0;
};
const AppComponent = _sfc_main$2;
const _sfc_main$1 = {
__name: "nuxt-error-page",
__ssrInlineRender: true,
props: {
error: Object
},
setup(__props) {
const props = __props;
const _error = props.error;
(_error.stack || "").split("\n").splice(1).map((line) => {
const text = line.replace("webpack:/", "").replace(".vue", ".js").trim();
return {
text,
internal: line.includes("node_modules") && !line.includes(".cache") || line.includes("internal") || line.includes("new Promise")
};
}).map((i) => `<span class="stack${i.internal ? " internal" : ""}">${i.text}</span>`).join("\n");
const statusCode = Number(_error.statusCode || 500);
const is404 = statusCode === 404;
const statusMessage = _error.statusMessage ?? (is404 ? "Page Not Found" : "Internal Server Error");
const description = _error.message || _error.toString();
const stack = void 0;
2024-07-03 04:26:06 +00:00
const _Error404 = defineAsyncComponent(() => import('./_nuxt/error-404-6c4afc63.mjs').then((r) => r.default || r));
const _Error = defineAsyncComponent(() => import('./_nuxt/error-500-1e0a9b90.mjs').then((r) => r.default || r));
2024-01-09 07:55:02 +00:00
const ErrorTemplate = is404 ? _Error404 : _Error;
return (_ctx, _push, _parent, _attrs) => {
_push(ssrRenderComponent(unref(ErrorTemplate), mergeProps({ statusCode: unref(statusCode), statusMessage: unref(statusMessage), description: unref(description), stack: unref(stack) }, _attrs), null, _parent));
};
}
};
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("node_modules/nuxt/dist/app/components/nuxt-error-page.vue");
return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : void 0;
};
const ErrorComponent = _sfc_main$1;
const _sfc_main = {
__name: "nuxt-root",
__ssrInlineRender: true,
setup(__props) {
const IslandRenderer = defineAsyncComponent(() => import('./_nuxt/island-renderer-1d37df94.mjs').then((r) => r.default || r));
const nuxtApp = /* @__PURE__ */ useNuxtApp();
nuxtApp.deferHydration();
nuxtApp.ssrContext.url;
const SingleRenderer = false;
provide(PageRouteSymbol, useRoute());
nuxtApp.hooks.callHookWith((hooks) => hooks.map((hook) => hook()), "vue:setup");
const error = useError();
onErrorCaptured((err, target, info) => {
nuxtApp.hooks.callHook("vue:error", err, target, info).catch((hookError) => console.error("[nuxt] Error in `vue:error` hook", hookError));
{
const p = nuxtApp.runWithContext(() => showError(err));
onServerPrefetch(() => p);
return false;
}
});
const islandContext = nuxtApp.ssrContext.islandContext;
return (_ctx, _push, _parent, _attrs) => {
ssrRenderSuspense(_push, {
default: () => {
if (unref(error)) {
_push(ssrRenderComponent(unref(ErrorComponent), { error: unref(error) }, null, _parent));
} else if (unref(islandContext)) {
_push(ssrRenderComponent(unref(IslandRenderer), { context: unref(islandContext) }, null, _parent));
} else if (unref(SingleRenderer)) {
ssrRenderVNode(_push, createVNode(resolveDynamicComponent(unref(SingleRenderer)), null, null), _parent);
} else {
_push(ssrRenderComponent(unref(AppComponent), null, null, _parent));
}
},
_: 1
});
};
}
};
const _sfc_setup = _sfc_main.setup;
_sfc_main.setup = (props, ctx) => {
const ssrContext = useSSRContext();
(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-root.vue");
return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
const RootComponent = _sfc_main;
let entry;
{
entry = async function createNuxtAppServer(ssrContext) {
const vueApp = createApp(RootComponent);
const nuxt = createNuxtApp({ vueApp, ssrContext });
try {
await applyPlugins(nuxt, plugins);
await nuxt.hooks.callHook("app:created", vueApp);
} catch (err) {
await nuxt.hooks.callHook("app:error", err);
nuxt.payload.error = nuxt.payload.error || err;
}
if (ssrContext == null ? void 0 : ssrContext._renderResponse) {
throw new Error("skipping render");
}
return vueApp;
};
}
const entry$1 = (ctx) => entry(ctx);
export { useRuntimeConfig as a, navigateTo as b, createError as c, useNamespace as d, entry$1 as default, useRoute as e, useId as f, defaultNamespace as g, debugWarn as h, useGetDerivedNamespace as i, useIdInjection as j, namespaceContextKey as k, injectHead as l, nuxtLinkDefaults as n, resolveUnrefHeadInput as r, throwError as t, useRouter as u };
//# sourceMappingURL=server.mjs.map