955 lines
32 KiB
JavaScript
955 lines
32 KiB
JavaScript
import { hasInjectionContext, getCurrentInstance, shallowReactive, reactive, effectScope, getCurrentScope, inject, toRef, shallowRef, isReadonly, isRef, isShallow, isReactive, toRaw, defineComponent, provide, h, ref, Suspense, Fragment, useSSRContext, defineAsyncComponent, unref, mergeProps, onErrorCaptured, onServerPrefetch, createVNode, resolveDynamicComponent, createApp } from "vue";
|
|
import { $fetch } from "/home/bennet/source/vat-api/node_modules/ofetch/dist/node.mjs";
|
|
import { baseURL } from "#internal/nuxt/paths";
|
|
import { createHooks } from "/home/bennet/source/vat-api/node_modules/hookable/dist/index.mjs";
|
|
import { getContext, executeAsync } from "/home/bennet/source/vat-api/node_modules/unctx/dist/index.mjs";
|
|
import { sanitizeStatusCode, createError as createError$1 } from "/home/bennet/source/vat-api/node_modules/h3/dist/index.mjs";
|
|
import { START_LOCATION, createMemoryHistory, createRouter, RouterView } from "vue-router";
|
|
import { defu } from "/home/bennet/source/vat-api/node_modules/defu/dist/defu.mjs";
|
|
import { hasProtocol, joinURL, withQuery, parseURL, encodePath, decodePath, isScriptProtocol } from "/home/bennet/source/vat-api/node_modules/ufo/dist/index.mjs";
|
|
import { ssrRenderComponent, ssrRenderSuspense, ssrRenderVNode } from "vue/server-renderer";
|
|
if (!globalThis.$fetch) {
|
|
globalThis.$fetch = $fetch.create({
|
|
baseURL: baseURL()
|
|
});
|
|
}
|
|
if (!("global" in globalThis)) {
|
|
globalThis.global = globalThis;
|
|
}
|
|
const nuxtLinkDefaults = { "componentName": "NuxtLink" };
|
|
const appId = "nuxt-app";
|
|
function getNuxtAppCtx(id = appId) {
|
|
return getContext(id, {
|
|
asyncContext: false
|
|
});
|
|
}
|
|
const NuxtPluginIndicator = "__nuxt_plugin";
|
|
function createNuxtApp(options) {
|
|
let hydratingCount = 0;
|
|
const nuxtApp = {
|
|
_id: options.id || appId || "nuxt-app",
|
|
_scope: effectScope(),
|
|
provide: void 0,
|
|
versions: {
|
|
get nuxt() {
|
|
return "4.3.1";
|
|
},
|
|
get vue() {
|
|
return nuxtApp.vueApp.version;
|
|
}
|
|
},
|
|
payload: shallowReactive({
|
|
...options.ssrContext?.payload || {},
|
|
data: shallowReactive({}),
|
|
state: reactive({}),
|
|
once: /* @__PURE__ */ new Set(),
|
|
_errors: shallowReactive({})
|
|
}),
|
|
static: {
|
|
data: {}
|
|
},
|
|
runWithContext(fn) {
|
|
if (nuxtApp._scope.active && !getCurrentScope()) {
|
|
return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn));
|
|
}
|
|
return 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: shallowReactive({}),
|
|
_payloadRevivers: {},
|
|
...options
|
|
};
|
|
{
|
|
nuxtApp.payload.serverRendered = true;
|
|
}
|
|
if (nuxtApp.ssrContext) {
|
|
nuxtApp.payload.path = nuxtApp.ssrContext.url;
|
|
nuxtApp.ssrContext.nuxt = nuxtApp;
|
|
nuxtApp.ssrContext.payload = nuxtApp.payload;
|
|
nuxtApp.ssrContext.config = {
|
|
public: nuxtApp.ssrContext.runtimeConfig.public,
|
|
app: nuxtApp.ssrContext.runtimeConfig.app
|
|
};
|
|
}
|
|
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);
|
|
const runtimeConfig = options.ssrContext.runtimeConfig;
|
|
nuxtApp.provide("config", runtimeConfig);
|
|
return nuxtApp;
|
|
}
|
|
function registerPluginHooks(nuxtApp, plugin2) {
|
|
if (plugin2.hooks) {
|
|
nuxtApp.hooks.addHooks(plugin2.hooks);
|
|
}
|
|
}
|
|
async function applyPlugin(nuxtApp, plugin2) {
|
|
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) {
|
|
const resolvedPlugins = /* @__PURE__ */ new Set();
|
|
const unresolvedPlugins = [];
|
|
const parallels = [];
|
|
let error = void 0;
|
|
let promiseDepth = 0;
|
|
async function executePlugin(plugin2) {
|
|
const unresolvedPluginsForThisPlugin = plugin2.dependsOn?.filter((name) => plugins2.some((p) => p._name === name) && !resolvedPlugins.has(name)) ?? [];
|
|
if (unresolvedPluginsForThisPlugin.length > 0) {
|
|
unresolvedPlugins.push([new Set(unresolvedPluginsForThisPlugin), plugin2]);
|
|
} else {
|
|
const promise = applyPlugin(nuxtApp, plugin2).then(async () => {
|
|
if (plugin2._name) {
|
|
resolvedPlugins.add(plugin2._name);
|
|
await Promise.all(unresolvedPlugins.map(async ([dependsOn, unexecutedPlugin]) => {
|
|
if (dependsOn.has(plugin2._name)) {
|
|
dependsOn.delete(plugin2._name);
|
|
if (dependsOn.size === 0) {
|
|
promiseDepth++;
|
|
await executePlugin(unexecutedPlugin);
|
|
}
|
|
}
|
|
}));
|
|
}
|
|
}).catch((e) => {
|
|
if (!plugin2.parallel && !nuxtApp.payload.error) {
|
|
throw e;
|
|
}
|
|
error ||= e;
|
|
});
|
|
if (plugin2.parallel) {
|
|
parallels.push(promise);
|
|
} else {
|
|
await promise;
|
|
}
|
|
}
|
|
}
|
|
for (const plugin2 of plugins2) {
|
|
if (nuxtApp.ssrContext?.islandContext && plugin2.env?.islands === false) {
|
|
continue;
|
|
}
|
|
registerPluginHooks(nuxtApp, plugin2);
|
|
}
|
|
for (const plugin2 of plugins2) {
|
|
if (nuxtApp.ssrContext?.islandContext && plugin2.env?.islands === false) {
|
|
continue;
|
|
}
|
|
await executePlugin(plugin2);
|
|
}
|
|
await Promise.all(parallels);
|
|
if (promiseDepth) {
|
|
for (let i = 0; i < promiseDepth; i++) {
|
|
await Promise.all(parallels);
|
|
}
|
|
}
|
|
if (error) {
|
|
throw nuxtApp.payload.error || error;
|
|
}
|
|
}
|
|
// @__NO_SIDE_EFFECTS__
|
|
function defineNuxtPlugin(plugin2) {
|
|
if (typeof plugin2 === "function") {
|
|
return plugin2;
|
|
}
|
|
const _name = plugin2._name || plugin2.name;
|
|
delete plugin2.name;
|
|
return Object.assign(plugin2.setup || (() => {
|
|
}), plugin2, { [NuxtPluginIndicator]: true, _name });
|
|
}
|
|
function callWithNuxt(nuxt, setup, args) {
|
|
const fn = () => setup();
|
|
const nuxtAppCtx = getNuxtAppCtx(nuxt._id);
|
|
{
|
|
return nuxt.vueApp.runWithContext(() => nuxtAppCtx.callAsync(nuxt, fn));
|
|
}
|
|
}
|
|
function tryUseNuxtApp(id) {
|
|
let nuxtAppInstance;
|
|
if (hasInjectionContext()) {
|
|
nuxtAppInstance = getCurrentInstance()?.appContext.app.$nuxt;
|
|
}
|
|
nuxtAppInstance ||= getNuxtAppCtx(id).tryUse();
|
|
return nuxtAppInstance || null;
|
|
}
|
|
function useNuxtApp(id) {
|
|
const nuxtAppInstance = tryUseNuxtApp(id);
|
|
if (!nuxtAppInstance) {
|
|
{
|
|
throw new Error("[nuxt] instance unavailable");
|
|
}
|
|
}
|
|
return nuxtAppInstance;
|
|
}
|
|
// @__NO_SIDE_EFFECTS__
|
|
function useRuntimeConfig(_event) {
|
|
return useNuxtApp().$config;
|
|
}
|
|
function defineGetter(obj, key, val) {
|
|
Object.defineProperty(obj, key, { get: () => val });
|
|
}
|
|
const LayoutMetaSymbol = /* @__PURE__ */ Symbol("layout-meta");
|
|
const PageRouteSymbol = /* @__PURE__ */ Symbol("route");
|
|
import.meta.url.replace(/\/app\/.*$/, "/");
|
|
const useRouter = () => {
|
|
return useNuxtApp()?.$router;
|
|
};
|
|
const useRoute = () => {
|
|
if (hasInjectionContext()) {
|
|
return inject(PageRouteSymbol, useNuxtApp()._route);
|
|
}
|
|
return useNuxtApp()._route;
|
|
};
|
|
// @__NO_SIDE_EFFECTS__
|
|
function defineNuxtRouteMiddleware(middleware) {
|
|
return middleware;
|
|
}
|
|
const isProcessingMiddleware = () => {
|
|
try {
|
|
if (useNuxtApp()._processingMiddleware) {
|
|
return true;
|
|
}
|
|
} catch {
|
|
return false;
|
|
}
|
|
return false;
|
|
};
|
|
const URL_QUOTE_RE = /"/g;
|
|
const navigateTo = (to, options) => {
|
|
to ||= "/";
|
|
const toPath = typeof to === "string" ? to : "path" in to ? resolveRouteObject(to) : useRouter().resolve(to).href;
|
|
const isExternalHost = hasProtocol(toPath, { acceptRelative: true });
|
|
const isExternal = options?.external || isExternalHost;
|
|
if (isExternal) {
|
|
if (!options?.external) {
|
|
throw new Error("Navigating to an external URL is not allowed by default. Use `navigateTo(url, { external: true })`.");
|
|
}
|
|
const { protocol } = new URL(toPath, "http://localhost");
|
|
if (protocol && isScriptProtocol(protocol)) {
|
|
throw new Error(`Cannot navigate to a URL with '${protocol}' protocol.`);
|
|
}
|
|
}
|
|
const inMiddleware = isProcessingMiddleware();
|
|
const router = useRouter();
|
|
const nuxtApp = 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(URL_QUOTE_RE, "%22");
|
|
const encodedHeader = encodeURL(location2, isExternalHost);
|
|
nuxtApp.ssrContext["~renderResponse"] = {
|
|
statusCode: sanitizeStatusCode(options?.redirectCode || 302, 302),
|
|
body: `<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head></html>`,
|
|
headers: { location: encodedHeader }
|
|
};
|
|
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?.replace) {
|
|
(void 0).replace(toPath);
|
|
} else {
|
|
(void 0).href = toPath;
|
|
}
|
|
if (inMiddleware) {
|
|
if (!nuxtApp.isHydrating) {
|
|
return false;
|
|
}
|
|
return new Promise(() => {
|
|
});
|
|
}
|
|
return Promise.resolve();
|
|
}
|
|
const encodedTo = typeof to === "string" ? encodeRoutePath(to) : to;
|
|
return options?.replace ? router.replace(encodedTo) : router.push(encodedTo);
|
|
};
|
|
function resolveRouteObject(to) {
|
|
return withQuery(to.path || "", to.query || {}) + (to.hash || "");
|
|
}
|
|
function encodeURL(location2, isExternalHost = false) {
|
|
const url = new URL(location2, "http://localhost");
|
|
if (!isExternalHost) {
|
|
return url.pathname + url.search + url.hash;
|
|
}
|
|
if (location2.startsWith("//")) {
|
|
return url.toString().replace(url.protocol, "");
|
|
}
|
|
return url.toString();
|
|
}
|
|
function encodeRoutePath(url) {
|
|
const parsed = parseURL(url);
|
|
return encodePath(decodePath(parsed.pathname)) + parsed.search + parsed.hash;
|
|
}
|
|
const NUXT_ERROR_SIGNATURE = "__nuxt_error";
|
|
const useError = /* @__NO_SIDE_EFFECTS__ */ () => toRef(useNuxtApp().payload, "error");
|
|
const showError = (error) => {
|
|
const nuxtError = createError(error);
|
|
try {
|
|
const error2 = /* @__PURE__ */ useError();
|
|
if (false) ;
|
|
error2.value ||= nuxtError;
|
|
} catch {
|
|
throw nuxtError;
|
|
}
|
|
return nuxtError;
|
|
};
|
|
const isNuxtError = (error) => !!error && typeof error === "object" && NUXT_ERROR_SIGNATURE in error;
|
|
const createError = (error) => {
|
|
if (typeof error !== "string" && error.statusText) {
|
|
error.message ??= error.statusText;
|
|
}
|
|
const nuxtError = createError$1(error);
|
|
Object.defineProperty(nuxtError, NUXT_ERROR_SIGNATURE, {
|
|
value: true,
|
|
configurable: false,
|
|
writable: false
|
|
});
|
|
Object.defineProperty(nuxtError, "status", {
|
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
get: () => nuxtError.statusCode,
|
|
configurable: true
|
|
});
|
|
Object.defineProperty(nuxtError, "statusText", {
|
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
get: () => nuxtError.statusMessage,
|
|
configurable: true
|
|
});
|
|
return nuxtError;
|
|
};
|
|
const unhead_k2P3m_ZDyjlr2mMYnoDPwavjsDN8hBlk9cFai0bbopU = /* @__PURE__ */ defineNuxtPlugin({
|
|
name: "nuxt:head",
|
|
enforce: "pre",
|
|
setup(nuxtApp) {
|
|
const head = nuxtApp.ssrContext.head;
|
|
nuxtApp.vueApp.use(head);
|
|
}
|
|
});
|
|
function toArray(value) {
|
|
return Array.isArray(value) ? value : [value];
|
|
}
|
|
const matcher = (m, p) => {
|
|
return [];
|
|
};
|
|
const _routeRulesMatcher = (path) => defu({}, ...matcher().map((r) => r.data).reverse());
|
|
const routeRulesMatcher = _routeRulesMatcher;
|
|
function getRouteRules(arg) {
|
|
const path = typeof arg === "string" ? arg : arg.path;
|
|
try {
|
|
return routeRulesMatcher(path);
|
|
} catch (e) {
|
|
console.error("[nuxt] Error matching route rules.", e);
|
|
return {};
|
|
}
|
|
}
|
|
const _routes = [
|
|
{
|
|
name: "index",
|
|
path: "/",
|
|
component: () => import("./_nuxt/index-BDcJu3_l.js")
|
|
}
|
|
];
|
|
const ROUTE_KEY_PARENTHESES_RE = /(:\w+)\([^)]+\)/g;
|
|
const ROUTE_KEY_SYMBOLS_RE = /(:\w+)[?+*]/g;
|
|
const ROUTE_KEY_NORMAL_RE = /:\w+/g;
|
|
function generateRouteKey(route) {
|
|
const source = route?.meta.key ?? route.path.replace(ROUTE_KEY_PARENTHESES_RE, "$1").replace(ROUTE_KEY_SYMBOLS_RE, "$1").replace(ROUTE_KEY_NORMAL_RE, (r) => route.params[r.slice(1)]?.toString() || "");
|
|
return typeof source === "function" ? source(route) : source;
|
|
}
|
|
function isChangingPage(to, from) {
|
|
if (to === from || from === START_LOCATION) {
|
|
return false;
|
|
}
|
|
if (generateRouteKey(to) !== generateRouteKey(from)) {
|
|
return true;
|
|
}
|
|
const areComponentsSame = to.matched.every(
|
|
(comp, index) => comp.components && comp.components.default === from.matched[index]?.components?.default
|
|
);
|
|
if (areComponentsSame) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
const routerOptions0 = {
|
|
scrollBehavior(to, from, savedPosition) {
|
|
const nuxtApp = useNuxtApp();
|
|
const hashScrollBehaviour = useRouter().options?.scrollBehaviorType ?? "auto";
|
|
if (to.path.replace(/\/$/, "") === from.path.replace(/\/$/, "")) {
|
|
if (from.hash && !to.hash) {
|
|
return { left: 0, top: 0 };
|
|
}
|
|
if (to.hash) {
|
|
return { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior: hashScrollBehaviour };
|
|
}
|
|
return false;
|
|
}
|
|
const routeAllowsScrollToTop = typeof to.meta.scrollToTop === "function" ? to.meta.scrollToTop(to, from) : to.meta.scrollToTop;
|
|
if (routeAllowsScrollToTop === false) {
|
|
return false;
|
|
}
|
|
const hookToWait = nuxtApp._runningTransition ? "page:transition:finish" : "page:loading:end";
|
|
return new Promise((resolve) => {
|
|
if (from === START_LOCATION) {
|
|
resolve(_calculatePosition(to, from, savedPosition, hashScrollBehaviour));
|
|
return;
|
|
}
|
|
nuxtApp.hooks.hookOnce(hookToWait, () => {
|
|
requestAnimationFrame(() => resolve(_calculatePosition(to, from, savedPosition, hashScrollBehaviour)));
|
|
});
|
|
});
|
|
}
|
|
};
|
|
function _getHashElementScrollMarginTop(selector) {
|
|
try {
|
|
const elem = (void 0).querySelector(selector);
|
|
if (elem) {
|
|
return (Number.parseFloat(getComputedStyle(elem).scrollMarginTop) || 0) + (Number.parseFloat(getComputedStyle((void 0).documentElement).scrollPaddingTop) || 0);
|
|
}
|
|
} catch {
|
|
}
|
|
return 0;
|
|
}
|
|
function _calculatePosition(to, from, savedPosition, defaultHashScrollBehaviour) {
|
|
if (savedPosition) {
|
|
return savedPosition;
|
|
}
|
|
const isPageNavigation = isChangingPage(to, from);
|
|
if (to.hash) {
|
|
return {
|
|
el: to.hash,
|
|
top: _getHashElementScrollMarginTop(to.hash),
|
|
behavior: isPageNavigation ? defaultHashScrollBehaviour : "instant"
|
|
};
|
|
}
|
|
return {
|
|
left: 0,
|
|
top: 0
|
|
};
|
|
}
|
|
const configRouterOptions = {
|
|
hashMode: false,
|
|
scrollBehaviorType: "auto"
|
|
};
|
|
const routerOptions = {
|
|
...configRouterOptions,
|
|
...routerOptions0
|
|
};
|
|
const validate = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to, from) => {
|
|
let __temp, __restore;
|
|
if (!to.meta?.validate) {
|
|
return;
|
|
}
|
|
const result = ([__temp, __restore] = executeAsync(() => Promise.resolve(to.meta.validate(to))), __temp = await __temp, __restore(), __temp);
|
|
if (result === true) {
|
|
return;
|
|
}
|
|
const error = createError({
|
|
fatal: false,
|
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
status: result && (result.status || result.statusCode) || 404,
|
|
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
statusText: result && (result.statusText || result.statusMessage) || `Page Not Found: ${to.fullPath}`,
|
|
data: {
|
|
path: to.fullPath
|
|
}
|
|
});
|
|
return error;
|
|
});
|
|
const manifest_45route_45rule = /* @__PURE__ */ defineNuxtRouteMiddleware((to) => {
|
|
{
|
|
return;
|
|
}
|
|
});
|
|
const globalMiddleware = [
|
|
validate,
|
|
manifest_45route_45rule
|
|
];
|
|
const namedMiddleware = {};
|
|
const plugin = /* @__PURE__ */ defineNuxtPlugin({
|
|
name: "nuxt:router",
|
|
enforce: "pre",
|
|
async setup(nuxtApp) {
|
|
let __temp, __restore;
|
|
let routerBase = (/* @__PURE__ */ useRuntimeConfig()).app.baseURL;
|
|
const history = routerOptions.history?.(routerBase) ?? createMemoryHistory(routerBase);
|
|
const routes = routerOptions.routes ? ([__temp, __restore] = executeAsync(() => routerOptions.routes(_routes)), __temp = await __temp, __restore(), __temp) ?? _routes : _routes;
|
|
let startPosition;
|
|
const router = createRouter({
|
|
...routerOptions,
|
|
scrollBehavior: (to, from, savedPosition) => {
|
|
if (from === START_LOCATION) {
|
|
startPosition = savedPosition;
|
|
return;
|
|
}
|
|
if (routerOptions.scrollBehavior) {
|
|
router.options.scrollBehavior = routerOptions.scrollBehavior;
|
|
if ("scrollRestoration" in (void 0).history) {
|
|
const unsub = router.beforeEach(() => {
|
|
unsub();
|
|
(void 0).history.scrollRestoration = "manual";
|
|
});
|
|
}
|
|
return routerOptions.scrollBehavior(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 initialURL = nuxtApp.ssrContext.url;
|
|
const _route = shallowRef(router.currentRoute.value);
|
|
const syncCurrentRoute = () => {
|
|
_route.value = router.currentRoute.value;
|
|
};
|
|
router.afterEach((to, from) => {
|
|
if (to.matched.at(-1)?.components?.default === from.matched.at(-1)?.components?.default) {
|
|
syncCurrentRoute();
|
|
}
|
|
});
|
|
const route = { sync: syncCurrentRoute };
|
|
for (const key in _route.value) {
|
|
Object.defineProperty(route, key, {
|
|
get: () => _route.value[key],
|
|
enumerable: true
|
|
});
|
|
}
|
|
nuxtApp._route = shallowReactive(route);
|
|
nuxtApp._middleware ||= {
|
|
global: [],
|
|
named: {}
|
|
};
|
|
const error = /* @__PURE__ */ useError();
|
|
if (!nuxtApp.ssrContext?.islandContext) {
|
|
router.afterEach(async (to, _from, failure) => {
|
|
delete nuxtApp._processingMiddleware;
|
|
if (failure) {
|
|
await nuxtApp.callHook("page:loading:end");
|
|
}
|
|
if (failure?.type === 4) {
|
|
return;
|
|
}
|
|
if (to.redirectedFrom && to.fullPath !== initialURL) {
|
|
await nuxtApp.runWithContext(() => navigateTo(to.fullPath || "/"));
|
|
}
|
|
});
|
|
}
|
|
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 resolvedInitialRoute = router.currentRoute.value;
|
|
syncCurrentRoute();
|
|
if (nuxtApp.ssrContext?.islandContext) {
|
|
return { provide: { router } };
|
|
}
|
|
const initialLayout = nuxtApp.payload.state._layout;
|
|
router.beforeEach(async (to, from) => {
|
|
await nuxtApp.callHook("page:loading:start");
|
|
to.meta = reactive(to.meta);
|
|
if (nuxtApp.isHydrating && initialLayout && !isReadonly(to.meta.layout)) {
|
|
to.meta.layout = initialLayout;
|
|
}
|
|
nuxtApp._processingMiddleware = true;
|
|
if (!nuxtApp.ssrContext?.islandContext) {
|
|
const middlewareEntries = /* @__PURE__ */ new Set([...globalMiddleware, ...nuxtApp._middleware.global]);
|
|
for (const component of to.matched) {
|
|
const componentMiddleware = component.meta.middleware;
|
|
if (!componentMiddleware) {
|
|
continue;
|
|
}
|
|
for (const entry2 of toArray(componentMiddleware)) {
|
|
middlewareEntries.add(entry2);
|
|
}
|
|
}
|
|
const routeRules = getRouteRules({ path: to.path });
|
|
if (routeRules.appMiddleware) {
|
|
for (const key in routeRules.appMiddleware) {
|
|
if (routeRules.appMiddleware[key]) {
|
|
middlewareEntries.add(key);
|
|
} else {
|
|
middlewareEntries.delete(key);
|
|
}
|
|
}
|
|
}
|
|
for (const entry2 of middlewareEntries) {
|
|
const middleware = typeof entry2 === "string" ? nuxtApp._middleware.named[entry2] || await namedMiddleware[entry2]?.().then((r) => r.default || r) : entry2;
|
|
if (!middleware) {
|
|
throw new Error(`Unknown route middleware: '${entry2}'.`);
|
|
}
|
|
try {
|
|
if (false) ;
|
|
const result = await nuxtApp.runWithContext(() => middleware(to, from));
|
|
if (true) {
|
|
if (result === false || result instanceof Error) {
|
|
const error2 = result || createError({
|
|
status: 404,
|
|
statusText: `Page Not Found: ${initialURL}`
|
|
});
|
|
await nuxtApp.runWithContext(() => showError(error2));
|
|
return false;
|
|
}
|
|
}
|
|
if (result === true) {
|
|
continue;
|
|
}
|
|
if (result === false) {
|
|
return result;
|
|
}
|
|
if (result) {
|
|
if (isNuxtError(result) && result.fatal) {
|
|
await nuxtApp.runWithContext(() => showError(result));
|
|
}
|
|
return result;
|
|
}
|
|
} catch (err) {
|
|
const error2 = createError(err);
|
|
if (error2.fatal) {
|
|
await nuxtApp.runWithContext(() => showError(error2));
|
|
}
|
|
return error2;
|
|
}
|
|
}
|
|
}
|
|
});
|
|
router.onError(async () => {
|
|
delete nuxtApp._processingMiddleware;
|
|
await nuxtApp.callHook("page:loading:end");
|
|
});
|
|
router.afterEach((to) => {
|
|
if (to.matched.length === 0 && !error.value) {
|
|
return nuxtApp.runWithContext(() => showError(createError({
|
|
status: 404,
|
|
fatal: false,
|
|
statusText: `Page not found: ${to.fullPath}`,
|
|
data: {
|
|
path: to.fullPath
|
|
}
|
|
})));
|
|
}
|
|
});
|
|
nuxtApp.hooks.hookOnce("app:created", async () => {
|
|
try {
|
|
if ("name" in resolvedInitialRoute) {
|
|
resolvedInitialRoute.name = void 0;
|
|
}
|
|
await router.replace({
|
|
...resolvedInitialRoute,
|
|
force: true
|
|
});
|
|
router.options.scrollBehavior = routerOptions.scrollBehavior;
|
|
} catch (error2) {
|
|
await nuxtApp.runWithContext(() => showError(error2));
|
|
}
|
|
});
|
|
return { provide: { router } };
|
|
}
|
|
});
|
|
function definePayloadReducer(name, reduce) {
|
|
{
|
|
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_MVtmlZaQpj6ApFmshWfUWl5PehCebzaBf2NuRMiIbms = /* @__PURE__ */ defineNuxtPlugin({
|
|
name: "nuxt:revive-payload:server",
|
|
setup() {
|
|
for (const [reducer, fn] of reducers) {
|
|
definePayloadReducer(reducer, fn);
|
|
}
|
|
}
|
|
});
|
|
const components_plugin_4kY4pyzJIYX99vmMAAIorFf3CnAaptHitJgf7JxiED8 = /* @__PURE__ */ defineNuxtPlugin({
|
|
name: "nuxt:global-components"
|
|
});
|
|
const plugins = [
|
|
unhead_k2P3m_ZDyjlr2mMYnoDPwavjsDN8hBlk9cFai0bbopU,
|
|
plugin,
|
|
revive_payload_server_MVtmlZaQpj6ApFmshWfUWl5PehCebzaBf2NuRMiIbms,
|
|
components_plugin_4kY4pyzJIYX99vmMAAIorFf3CnAaptHitJgf7JxiED8
|
|
];
|
|
const defineRouteProvider = (name = "RouteProvider") => defineComponent({
|
|
name,
|
|
props: {
|
|
route: {
|
|
type: Object,
|
|
required: true
|
|
},
|
|
vnode: Object,
|
|
vnodeRef: Object,
|
|
renderKey: String,
|
|
trackRootNodes: Boolean
|
|
},
|
|
setup(props) {
|
|
const previousKey = props.renderKey;
|
|
const previousRoute = props.route;
|
|
const route = {};
|
|
for (const key in props.route) {
|
|
Object.defineProperty(route, key, {
|
|
get: () => previousKey === props.renderKey ? props.route[key] : previousRoute[key],
|
|
enumerable: true
|
|
});
|
|
}
|
|
provide(PageRouteSymbol, shallowReactive(route));
|
|
return () => {
|
|
if (!props.vnode) {
|
|
return props.vnode;
|
|
}
|
|
return h(props.vnode, { ref: props.vnodeRef });
|
|
};
|
|
}
|
|
});
|
|
const RouteProvider = defineRouteProvider();
|
|
const __nuxt_component_0 = defineComponent({
|
|
name: "NuxtPage",
|
|
inheritAttrs: false,
|
|
props: {
|
|
name: {
|
|
type: String
|
|
},
|
|
transition: {
|
|
type: [Boolean, Object],
|
|
default: void 0
|
|
},
|
|
keepalive: {
|
|
type: [Boolean, Object],
|
|
default: void 0
|
|
},
|
|
route: {
|
|
type: Object
|
|
},
|
|
pageKey: {
|
|
type: [Function, String],
|
|
default: null
|
|
}
|
|
},
|
|
setup(props, { attrs, slots, expose }) {
|
|
const nuxtApp = useNuxtApp();
|
|
const pageRef = ref();
|
|
inject(PageRouteSymbol, null);
|
|
expose({ pageRef });
|
|
inject(LayoutMetaSymbol, null);
|
|
nuxtApp.deferHydration();
|
|
return () => {
|
|
return h(RouterView, { name: props.name, route: props.route, ...attrs }, {
|
|
default: (routeProps) => {
|
|
return h(Suspense, { suspensible: true }, {
|
|
default() {
|
|
return h(RouteProvider, {
|
|
vnode: slots.default ? normalizeSlot(slots.default, routeProps) : routeProps.Component,
|
|
route: routeProps.route,
|
|
vnodeRef: pageRef
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
};
|
|
}
|
|
});
|
|
function normalizeSlot(slot, data) {
|
|
const slotContent = slot(data);
|
|
return slotContent.length === 1 ? h(slotContent[0]) : h(Fragment, void 0, slotContent);
|
|
}
|
|
const _export_sfc = (sfc, props) => {
|
|
const target = sfc.__vccOpts || sfc;
|
|
for (const [key, val] of props) {
|
|
target[key] = val;
|
|
}
|
|
return target;
|
|
};
|
|
const _sfc_main$2 = {};
|
|
function _sfc_ssrRender(_ctx, _push, _parent, _attrs) {
|
|
const _component_NuxtPage = __nuxt_component_0;
|
|
_push(ssrRenderComponent(_component_NuxtPage, _attrs, null, _parent));
|
|
}
|
|
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 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender]]);
|
|
const _sfc_main$1 = {
|
|
__name: "nuxt-error-page",
|
|
__ssrInlineRender: true,
|
|
props: {
|
|
error: Object
|
|
},
|
|
setup(__props) {
|
|
const props = __props;
|
|
const _error = props.error;
|
|
const status = Number(_error.statusCode || 500);
|
|
const is404 = status === 404;
|
|
const statusText = _error.statusMessage ?? (is404 ? "Page Not Found" : "Internal Server Error");
|
|
const description = _error.message || _error.toString();
|
|
const stack = void 0;
|
|
const _Error404 = defineAsyncComponent(() => import("./_nuxt/error-404-BY_x-_oz.js"));
|
|
const _Error = defineAsyncComponent(() => import("./_nuxt/error-500-B0qDQUop.js"));
|
|
const ErrorTemplate = is404 ? _Error404 : _Error;
|
|
return (_ctx, _push, _parent, _attrs) => {
|
|
_push(ssrRenderComponent(unref(ErrorTemplate), mergeProps({ status: unref(status), statusText: unref(statusText), statusCode: unref(status), statusMessage: unref(statusText), 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 _sfc_main = {
|
|
__name: "nuxt-root",
|
|
__ssrInlineRender: true,
|
|
setup(__props) {
|
|
const IslandRenderer = () => null;
|
|
const nuxtApp = useNuxtApp();
|
|
nuxtApp.deferHydration();
|
|
nuxtApp.ssrContext.url;
|
|
const SingleRenderer = false;
|
|
provide(PageRouteSymbol, useRoute());
|
|
nuxtApp.hooks.callHookWith((hooks) => hooks.map((hook) => hook()), "vue:setup");
|
|
const error = /* @__PURE__ */ useError();
|
|
const abortRender = error.value && !nuxtApp.ssrContext.error;
|
|
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(abortRender)) {
|
|
_push(`<div></div>`);
|
|
} else if (unref(error)) {
|
|
_push(ssrRenderComponent(unref(_sfc_main$1), { 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;
|
|
};
|
|
let entry;
|
|
{
|
|
entry = async function createNuxtAppServer(ssrContext) {
|
|
const vueApp = createApp(_sfc_main);
|
|
const nuxt = createNuxtApp({ vueApp, ssrContext });
|
|
try {
|
|
await applyPlugins(nuxt, plugins);
|
|
await nuxt.hooks.callHook("app:created", vueApp);
|
|
} catch (error) {
|
|
await nuxt.hooks.callHook("app:error", error);
|
|
nuxt.payload.error ||= createError(error);
|
|
}
|
|
if (ssrContext && (ssrContext["~renderResponse"] || ssrContext._renderResponse)) {
|
|
throw new Error("skipping render");
|
|
}
|
|
return vueApp;
|
|
};
|
|
}
|
|
const entry_default = ((ssrContext) => entry(ssrContext));
|
|
export {
|
|
_export_sfc as _,
|
|
useNuxtApp as a,
|
|
useRuntimeConfig as b,
|
|
nuxtLinkDefaults as c,
|
|
entry_default as default,
|
|
encodeRoutePath as e,
|
|
navigateTo as n,
|
|
resolveRouteObject as r,
|
|
useRouter as u
|
|
};
|
|
//# sourceMappingURL=server.mjs.map
|