server.mjs 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438
  1. import { hasInjectionContext, inject, version, unref, defineComponent, h, computed, ref, provide, shallowReactive, watch, Suspense, nextTick, Fragment, Transition, getCurrentInstance, mergeProps, useSSRContext, createApp, effectScope, reactive, getCurrentScope, onErrorCaptured, onServerPrefetch, createVNode, resolveDynamicComponent, toRef, defineAsyncComponent, shallowRef, isReadonly, withCtx, isRef, isShallow, isReactive, toRaw } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/vue/index.mjs';
  2. import { $fetch } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/ofetch/dist/node.mjs';
  3. import { b as baseURL } from '../_/renderer.mjs';
  4. import { createHooks } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/hookable/dist/index.mjs';
  5. import { getContext } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/unctx/dist/index.mjs';
  6. import { sanitizeStatusCode, createError as createError$1, appendHeader } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/h3/dist/index.mjs';
  7. import { getActiveHead, CapoPlugin } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/unhead/dist/index.mjs';
  8. import { defineHeadPlugin } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/@unhead/shared/dist/index.mjs';
  9. import { useRoute as useRoute$1, RouterView, createMemoryHistory, createRouter, START_LOCATION } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/vue-router/dist/vue-router.node.mjs';
  10. import { toRouteMatcher, createRouter as createRouter$1 } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/radix3/dist/index.mjs';
  11. import { defu } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/defu/dist/defu.mjs';
  12. import { hasProtocol, isScriptProtocol, joinURL, withQuery } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/ufo/dist/index.mjs';
  13. import { createPinia } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/pinia/dist/pinia.prod.cjs';
  14. import { ssrRenderSuspense, ssrRenderComponent, ssrRenderVNode, ssrRenderAttrs } from 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/vue/server-renderer/index.mjs';
  15. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/vue-bundle-renderer/dist/runtime.mjs';
  16. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/devalue/index.js';
  17. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/@unhead/ssr/dist/index.mjs';
  18. import '../_/nitro.mjs';
  19. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/destr/dist/index.mjs';
  20. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/unenv/runtime/fetch/index.mjs';
  21. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/klona/dist/index.mjs';
  22. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/scule/dist/index.mjs';
  23. import 'node:fs';
  24. import 'node:url';
  25. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/pathe/dist/index.mjs';
  26. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/ohash/dist/index.mjs';
  27. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/unstorage/dist/index.mjs';
  28. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/unstorage/drivers/fs.mjs';
  29. import 'file:///D:/admin/nuxt/sannongzixunwang_web/node_modules/nuxt/dist/core/runtime/nitro/cache-driver.js';
  30. import 'file://D:/admin/nuxt/sannongzixunwang_web/node_modules/unstorage/drivers/fs-lite.mjs';
  31. if (!globalThis.$fetch) {
  32. globalThis.$fetch = $fetch.create({
  33. baseURL: baseURL()
  34. });
  35. }
  36. const appLayoutTransition = false;
  37. const appPageTransition = false;
  38. const appKeepalive = false;
  39. const nuxtLinkDefaults = { "componentName": "NuxtLink", "prefetch": true, "prefetchOn": { "visibility": true } };
  40. const appId = "nuxt-app";
  41. function getNuxtAppCtx(id = appId) {
  42. return getContext(id, {
  43. asyncContext: false
  44. });
  45. }
  46. const NuxtPluginIndicator = "__nuxt_plugin";
  47. function createNuxtApp(options) {
  48. var _a;
  49. let hydratingCount = 0;
  50. const nuxtApp = {
  51. _id: options.id || appId || "nuxt-app",
  52. _scope: effectScope(),
  53. provide: undefined,
  54. globalName: "nuxt",
  55. versions: {
  56. get nuxt() {
  57. return "3.15.1";
  58. },
  59. get vue() {
  60. return nuxtApp.vueApp.version;
  61. }
  62. },
  63. payload: shallowReactive({
  64. ...((_a = options.ssrContext) == null ? undefined : _a.payload) || {},
  65. data: shallowReactive({}),
  66. state: reactive({}),
  67. once: /* @__PURE__ */ new Set(),
  68. _errors: shallowReactive({})
  69. }),
  70. static: {
  71. data: {}
  72. },
  73. runWithContext(fn) {
  74. if (nuxtApp._scope.active && !getCurrentScope()) {
  75. return nuxtApp._scope.run(() => callWithNuxt(nuxtApp, fn));
  76. }
  77. return callWithNuxt(nuxtApp, fn);
  78. },
  79. isHydrating: false,
  80. deferHydration() {
  81. if (!nuxtApp.isHydrating) {
  82. return () => {
  83. };
  84. }
  85. hydratingCount++;
  86. let called = false;
  87. return () => {
  88. if (called) {
  89. return;
  90. }
  91. called = true;
  92. hydratingCount--;
  93. if (hydratingCount === 0) {
  94. nuxtApp.isHydrating = false;
  95. return nuxtApp.callHook("app:suspense:resolve");
  96. }
  97. };
  98. },
  99. _asyncDataPromises: {},
  100. _asyncData: shallowReactive({}),
  101. _payloadRevivers: {},
  102. ...options
  103. };
  104. {
  105. nuxtApp.payload.serverRendered = true;
  106. }
  107. if (nuxtApp.ssrContext) {
  108. nuxtApp.payload.path = nuxtApp.ssrContext.url;
  109. nuxtApp.ssrContext.nuxt = nuxtApp;
  110. nuxtApp.ssrContext.payload = nuxtApp.payload;
  111. nuxtApp.ssrContext.config = {
  112. public: nuxtApp.ssrContext.runtimeConfig.public,
  113. app: nuxtApp.ssrContext.runtimeConfig.app
  114. };
  115. }
  116. nuxtApp.hooks = createHooks();
  117. nuxtApp.hook = nuxtApp.hooks.hook;
  118. {
  119. const contextCaller = async function(hooks, args) {
  120. for (const hook of hooks) {
  121. await nuxtApp.runWithContext(() => hook(...args));
  122. }
  123. };
  124. nuxtApp.hooks.callHook = (name, ...args) => nuxtApp.hooks.callHookWith(contextCaller, name, ...args);
  125. }
  126. nuxtApp.callHook = nuxtApp.hooks.callHook;
  127. nuxtApp.provide = (name, value) => {
  128. const $name = "$" + name;
  129. defineGetter(nuxtApp, $name, value);
  130. defineGetter(nuxtApp.vueApp.config.globalProperties, $name, value);
  131. };
  132. defineGetter(nuxtApp.vueApp, "$nuxt", nuxtApp);
  133. defineGetter(nuxtApp.vueApp.config.globalProperties, "$nuxt", nuxtApp);
  134. const runtimeConfig = options.ssrContext.runtimeConfig;
  135. nuxtApp.provide("config", runtimeConfig);
  136. return nuxtApp;
  137. }
  138. function registerPluginHooks(nuxtApp, plugin2) {
  139. if (plugin2.hooks) {
  140. nuxtApp.hooks.addHooks(plugin2.hooks);
  141. }
  142. }
  143. async function applyPlugin(nuxtApp, plugin2) {
  144. if (typeof plugin2 === "function") {
  145. const { provide: provide2 } = await nuxtApp.runWithContext(() => plugin2(nuxtApp)) || {};
  146. if (provide2 && typeof provide2 === "object") {
  147. for (const key in provide2) {
  148. nuxtApp.provide(key, provide2[key]);
  149. }
  150. }
  151. }
  152. }
  153. async function applyPlugins(nuxtApp, plugins2) {
  154. var _a, _b, _c, _d;
  155. const resolvedPlugins = [];
  156. const unresolvedPlugins = [];
  157. const parallels = [];
  158. const errors = [];
  159. let promiseDepth = 0;
  160. async function executePlugin(plugin2) {
  161. var _a2;
  162. const unresolvedPluginsForThisPlugin = ((_a2 = plugin2.dependsOn) == null ? undefined : _a2.filter((name) => plugins2.some((p) => p._name === name) && !resolvedPlugins.includes(name))) ?? [];
  163. if (unresolvedPluginsForThisPlugin.length > 0) {
  164. unresolvedPlugins.push([new Set(unresolvedPluginsForThisPlugin), plugin2]);
  165. } else {
  166. const promise = applyPlugin(nuxtApp, plugin2).then(async () => {
  167. if (plugin2._name) {
  168. resolvedPlugins.push(plugin2._name);
  169. await Promise.all(unresolvedPlugins.map(async ([dependsOn, unexecutedPlugin]) => {
  170. if (dependsOn.has(plugin2._name)) {
  171. dependsOn.delete(plugin2._name);
  172. if (dependsOn.size === 0) {
  173. promiseDepth++;
  174. await executePlugin(unexecutedPlugin);
  175. }
  176. }
  177. }));
  178. }
  179. });
  180. if (plugin2.parallel) {
  181. parallels.push(promise.catch((e) => errors.push(e)));
  182. } else {
  183. await promise;
  184. }
  185. }
  186. }
  187. for (const plugin2 of plugins2) {
  188. if (((_a = nuxtApp.ssrContext) == null ? undefined : _a.islandContext) && ((_b = plugin2.env) == null ? undefined : _b.islands) === false) {
  189. continue;
  190. }
  191. registerPluginHooks(nuxtApp, plugin2);
  192. }
  193. for (const plugin2 of plugins2) {
  194. if (((_c = nuxtApp.ssrContext) == null ? undefined : _c.islandContext) && ((_d = plugin2.env) == null ? undefined : _d.islands) === false) {
  195. continue;
  196. }
  197. await executePlugin(plugin2);
  198. }
  199. await Promise.all(parallels);
  200. if (promiseDepth) {
  201. for (let i = 0; i < promiseDepth; i++) {
  202. await Promise.all(parallels);
  203. }
  204. }
  205. if (errors.length) {
  206. throw errors[0];
  207. }
  208. }
  209. // @__NO_SIDE_EFFECTS__
  210. function defineNuxtPlugin(plugin2) {
  211. if (typeof plugin2 === "function") {
  212. return plugin2;
  213. }
  214. const _name = plugin2._name || plugin2.name;
  215. delete plugin2.name;
  216. return Object.assign(plugin2.setup || (() => {
  217. }), plugin2, { [NuxtPluginIndicator]: true, _name });
  218. }
  219. function callWithNuxt(nuxt, setup, args) {
  220. const fn = () => setup();
  221. const nuxtAppCtx = getNuxtAppCtx(nuxt._id);
  222. {
  223. return nuxt.vueApp.runWithContext(() => nuxtAppCtx.callAsync(nuxt, fn));
  224. }
  225. }
  226. function tryUseNuxtApp(id) {
  227. var _a;
  228. let nuxtAppInstance;
  229. if (hasInjectionContext()) {
  230. nuxtAppInstance = (_a = getCurrentInstance()) == null ? undefined : _a.appContext.app.$nuxt;
  231. }
  232. nuxtAppInstance = nuxtAppInstance || getNuxtAppCtx(id).tryUse();
  233. return nuxtAppInstance || null;
  234. }
  235. function useNuxtApp(id) {
  236. const nuxtAppInstance = tryUseNuxtApp(id);
  237. if (!nuxtAppInstance) {
  238. {
  239. throw new Error("[nuxt] instance unavailable");
  240. }
  241. }
  242. return nuxtAppInstance;
  243. }
  244. // @__NO_SIDE_EFFECTS__
  245. function useRuntimeConfig(_event) {
  246. return useNuxtApp().$config;
  247. }
  248. function defineGetter(obj, key, val) {
  249. Object.defineProperty(obj, key, { get: () => val });
  250. }
  251. const LayoutMetaSymbol = Symbol("layout-meta");
  252. const PageRouteSymbol = Symbol("route");
  253. const useRouter = () => {
  254. var _a;
  255. return (_a = useNuxtApp()) == null ? undefined : _a.$router;
  256. };
  257. const useRoute = () => {
  258. if (hasInjectionContext()) {
  259. return inject(PageRouteSymbol, useNuxtApp()._route);
  260. }
  261. return useNuxtApp()._route;
  262. };
  263. // @__NO_SIDE_EFFECTS__
  264. function defineNuxtRouteMiddleware(middleware) {
  265. return middleware;
  266. }
  267. const isProcessingMiddleware = () => {
  268. try {
  269. if (useNuxtApp()._processingMiddleware) {
  270. return true;
  271. }
  272. } catch {
  273. return false;
  274. }
  275. return false;
  276. };
  277. const URL_QUOTE_RE = /"/g;
  278. const navigateTo = (to, options) => {
  279. if (!to) {
  280. to = "/";
  281. }
  282. const toPath = typeof to === "string" ? to : "path" in to ? resolveRouteObject(to) : useRouter().resolve(to).href;
  283. const isExternalHost = hasProtocol(toPath, { acceptRelative: true });
  284. const isExternal = (options == null ? undefined : options.external) || isExternalHost;
  285. if (isExternal) {
  286. if (!(options == null ? undefined : options.external)) {
  287. throw new Error("Navigating to an external URL is not allowed by default. Use `navigateTo(url, { external: true })`.");
  288. }
  289. const { protocol } = new URL(toPath, "http://localhost");
  290. if (protocol && isScriptProtocol(protocol)) {
  291. throw new Error(`Cannot navigate to a URL with '${protocol}' protocol.`);
  292. }
  293. }
  294. const inMiddleware = isProcessingMiddleware();
  295. const router = useRouter();
  296. const nuxtApp = useNuxtApp();
  297. {
  298. if (nuxtApp.ssrContext) {
  299. const fullPath = typeof to === "string" || isExternal ? toPath : router.resolve(to).fullPath || "/";
  300. const location2 = isExternal ? toPath : joinURL((/* @__PURE__ */ useRuntimeConfig()).app.baseURL, fullPath);
  301. const redirect = async function(response) {
  302. await nuxtApp.callHook("app:redirected");
  303. const encodedLoc = location2.replace(URL_QUOTE_RE, "%22");
  304. const encodedHeader = encodeURL(location2, isExternalHost);
  305. nuxtApp.ssrContext._renderResponse = {
  306. statusCode: sanitizeStatusCode((options == null ? undefined : options.redirectCode) || 302, 302),
  307. body: `<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=${encodedLoc}"></head></html>`,
  308. headers: { location: encodedHeader }
  309. };
  310. return response;
  311. };
  312. if (!isExternal && inMiddleware) {
  313. router.afterEach((final) => final.fullPath === fullPath ? redirect(false) : undefined);
  314. return to;
  315. }
  316. return redirect(!inMiddleware ? undefined : (
  317. /* abort route navigation */
  318. false
  319. ));
  320. }
  321. }
  322. if (isExternal) {
  323. nuxtApp._scope.stop();
  324. if (options == null ? undefined : options.replace) {
  325. (undefined).replace(toPath);
  326. } else {
  327. (undefined).href = toPath;
  328. }
  329. if (inMiddleware) {
  330. if (!nuxtApp.isHydrating) {
  331. return false;
  332. }
  333. return new Promise(() => {
  334. });
  335. }
  336. return Promise.resolve();
  337. }
  338. return (options == null ? undefined : options.replace) ? router.replace(to) : router.push(to);
  339. };
  340. function resolveRouteObject(to) {
  341. return withQuery(to.path || "", to.query || {}) + (to.hash || "");
  342. }
  343. function encodeURL(location2, isExternalHost = false) {
  344. const url = new URL(location2, "http://localhost");
  345. if (!isExternalHost) {
  346. return url.pathname + url.search + url.hash;
  347. }
  348. if (location2.startsWith("//")) {
  349. return url.toString().replace(url.protocol, "");
  350. }
  351. return url.toString();
  352. }
  353. const NUXT_ERROR_SIGNATURE = "__nuxt_error";
  354. const useError = () => toRef(useNuxtApp().payload, "error");
  355. const showError = (error) => {
  356. const nuxtError = createError(error);
  357. try {
  358. const nuxtApp = useNuxtApp();
  359. const error2 = useError();
  360. if (false) ;
  361. error2.value = error2.value || nuxtError;
  362. } catch {
  363. throw nuxtError;
  364. }
  365. return nuxtError;
  366. };
  367. const isNuxtError = (error) => !!error && typeof error === "object" && NUXT_ERROR_SIGNATURE in error;
  368. const createError = (error) => {
  369. const nuxtError = createError$1(error);
  370. Object.defineProperty(nuxtError, NUXT_ERROR_SIGNATURE, {
  371. value: true,
  372. configurable: false,
  373. writable: false
  374. });
  375. return nuxtError;
  376. };
  377. version[0] === "3";
  378. function resolveUnref(r) {
  379. return typeof r === "function" ? r() : unref(r);
  380. }
  381. function resolveUnrefHeadInput(ref2) {
  382. if (ref2 instanceof Promise || ref2 instanceof Date || ref2 instanceof RegExp)
  383. return ref2;
  384. const root = resolveUnref(ref2);
  385. if (!ref2 || !root)
  386. return root;
  387. if (Array.isArray(root))
  388. return root.map((r) => resolveUnrefHeadInput(r));
  389. if (typeof root === "object") {
  390. const resolved = {};
  391. for (const k in root) {
  392. if (!Object.prototype.hasOwnProperty.call(root, k)) {
  393. continue;
  394. }
  395. if (k === "titleTemplate" || k[0] === "o" && k[1] === "n") {
  396. resolved[k] = unref(root[k]);
  397. continue;
  398. }
  399. resolved[k] = resolveUnrefHeadInput(root[k]);
  400. }
  401. return resolved;
  402. }
  403. return root;
  404. }
  405. defineHeadPlugin({
  406. hooks: {
  407. "entries:resolve": (ctx) => {
  408. for (const entry2 of ctx.entries)
  409. entry2.resolvedInput = resolveUnrefHeadInput(entry2.input);
  410. }
  411. }
  412. });
  413. const headSymbol = "usehead";
  414. const _global = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  415. const globalKey$1 = "__unhead_injection_handler__";
  416. function setHeadInjectionHandler(handler) {
  417. _global[globalKey$1] = handler;
  418. }
  419. function injectHead() {
  420. if (globalKey$1 in _global) {
  421. return _global[globalKey$1]();
  422. }
  423. const head = inject(headSymbol);
  424. if (!head && "prerender" !== "production")
  425. console.warn("Unhead is missing Vue context, falling back to shared context. This may have unexpected results.");
  426. return head || getActiveHead();
  427. }
  428. [CapoPlugin({ track: true })];
  429. const unhead_KgADcZ0jPj = /* @__PURE__ */ defineNuxtPlugin({
  430. name: "nuxt:head",
  431. enforce: "pre",
  432. setup(nuxtApp) {
  433. const head = nuxtApp.ssrContext.head;
  434. setHeadInjectionHandler(
  435. // need a fresh instance of the nuxt app to avoid parallel requests interfering with each other
  436. () => useNuxtApp().vueApp._context.provides.usehead
  437. );
  438. nuxtApp.vueApp.use(head);
  439. }
  440. });
  441. function createContext(opts = {}) {
  442. let currentInstance;
  443. let isSingleton = false;
  444. const checkConflict = (instance) => {
  445. if (currentInstance && currentInstance !== instance) {
  446. throw new Error("Context conflict");
  447. }
  448. };
  449. let als;
  450. if (opts.asyncContext) {
  451. const _AsyncLocalStorage = opts.AsyncLocalStorage || globalThis.AsyncLocalStorage;
  452. if (_AsyncLocalStorage) {
  453. als = new _AsyncLocalStorage();
  454. } else {
  455. console.warn("[unctx] `AsyncLocalStorage` is not provided.");
  456. }
  457. }
  458. const _getCurrentInstance = () => {
  459. if (als) {
  460. const instance = als.getStore();
  461. if (instance !== undefined) {
  462. return instance;
  463. }
  464. }
  465. return currentInstance;
  466. };
  467. return {
  468. use: () => {
  469. const _instance = _getCurrentInstance();
  470. if (_instance === undefined) {
  471. throw new Error("Context is not available");
  472. }
  473. return _instance;
  474. },
  475. tryUse: () => {
  476. return _getCurrentInstance();
  477. },
  478. set: (instance, replace) => {
  479. if (!replace) {
  480. checkConflict(instance);
  481. }
  482. currentInstance = instance;
  483. isSingleton = true;
  484. },
  485. unset: () => {
  486. currentInstance = undefined;
  487. isSingleton = false;
  488. },
  489. call: (instance, callback) => {
  490. checkConflict(instance);
  491. currentInstance = instance;
  492. try {
  493. return als ? als.run(instance, callback) : callback();
  494. } finally {
  495. if (!isSingleton) {
  496. currentInstance = undefined;
  497. }
  498. }
  499. },
  500. async callAsync(instance, callback) {
  501. currentInstance = instance;
  502. const onRestore = () => {
  503. currentInstance = instance;
  504. };
  505. const onLeave = () => currentInstance === instance ? onRestore : undefined;
  506. asyncHandlers.add(onLeave);
  507. try {
  508. const r = als ? als.run(instance, callback) : callback();
  509. if (!isSingleton) {
  510. currentInstance = void 0;
  511. }
  512. return await r;
  513. } finally {
  514. asyncHandlers.delete(onLeave);
  515. }
  516. }
  517. };
  518. }
  519. function createNamespace(defaultOpts = {}) {
  520. const contexts = {};
  521. return {
  522. get(key, opts = {}) {
  523. if (!contexts[key]) {
  524. contexts[key] = createContext({ ...defaultOpts, ...opts });
  525. }
  526. return contexts[key];
  527. }
  528. };
  529. }
  530. const _globalThis = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof global !== "undefined" ? global : {};
  531. const globalKey = "__unctx__";
  532. _globalThis[globalKey] || (_globalThis[globalKey] = createNamespace());
  533. const asyncHandlersKey = "__unctx_async_handlers__";
  534. const asyncHandlers = _globalThis[asyncHandlersKey] || (_globalThis[asyncHandlersKey] = /* @__PURE__ */ new Set());
  535. function executeAsync(function_) {
  536. const restores = [];
  537. for (const leaveHandler of asyncHandlers) {
  538. const restore2 = leaveHandler();
  539. if (restore2) {
  540. restores.push(restore2);
  541. }
  542. }
  543. const restore = () => {
  544. for (const restore2 of restores) {
  545. restore2();
  546. }
  547. };
  548. let awaitable = function_();
  549. if (awaitable && typeof awaitable === "object" && "catch" in awaitable) {
  550. awaitable = awaitable.catch((error) => {
  551. restore();
  552. throw error;
  553. });
  554. }
  555. return [awaitable, restore];
  556. }
  557. const ROUTE_KEY_PARENTHESES_RE$1 = /(:\w+)\([^)]+\)/g;
  558. const ROUTE_KEY_SYMBOLS_RE$1 = /(:\w+)[?+*]/g;
  559. const ROUTE_KEY_NORMAL_RE$1 = /:\w+/g;
  560. const interpolatePath = (route, match) => {
  561. return match.path.replace(ROUTE_KEY_PARENTHESES_RE$1, "$1").replace(ROUTE_KEY_SYMBOLS_RE$1, "$1").replace(ROUTE_KEY_NORMAL_RE$1, (r) => {
  562. var _a;
  563. return ((_a = route.params[r.slice(1)]) == null ? undefined : _a.toString()) || "";
  564. });
  565. };
  566. const generateRouteKey$1 = (routeProps, override) => {
  567. const matchedRoute = routeProps.route.matched.find((m) => {
  568. var _a;
  569. return ((_a = m.components) == null ? undefined : _a.default) === routeProps.Component.type;
  570. });
  571. const source = override ?? (matchedRoute == null ? undefined : matchedRoute.meta.key) ?? (matchedRoute && interpolatePath(routeProps.route, matchedRoute));
  572. return typeof source === "function" ? source(routeProps.route) : source;
  573. };
  574. const wrapInKeepAlive = (props, children) => {
  575. return { default: () => children };
  576. };
  577. function toArray$1(value) {
  578. return Array.isArray(value) ? value : [value];
  579. }
  580. async function getRouteRules(arg) {
  581. const path = typeof arg === "string" ? arg : arg.path;
  582. {
  583. useNuxtApp().ssrContext._preloadManifest = true;
  584. const _routeRulesMatcher = toRouteMatcher(
  585. createRouter$1({ routes: (/* @__PURE__ */ useRuntimeConfig()).nitro.routeRules })
  586. );
  587. return defu({}, ..._routeRulesMatcher.matchAll(path).reverse());
  588. }
  589. }
  590. const __nuxt_page_meta = {
  591. middleware: "auth"
  592. };
  593. function handleHotUpdate(_router, _generateRoutes) {
  594. }
  595. const _routes = [
  596. {
  597. name: "advertising-adDetail",
  598. path: "/advertising/adDetail",
  599. component: () => import('./adDetail-0ZM2Ilkx.mjs')
  600. },
  601. {
  602. name: "advertising",
  603. path: "/advertising",
  604. component: () => import('./index-CdSLpijn.mjs')
  605. },
  606. {
  607. name: "index",
  608. path: "/",
  609. component: () => import('./index-BsR5P_FK.mjs')
  610. },
  611. {
  612. name: "login",
  613. path: "/login",
  614. component: () => import('./login-mprElTZX.mjs')
  615. },
  616. {
  617. name: "primaryNavigation-id",
  618. path: "/primaryNavigation/:id()",
  619. component: () => import('./_id_-C52_c1sz.mjs')
  620. },
  621. {
  622. name: "primaryNavigation-newsDetail-newsDetail",
  623. path: "/primaryNavigation/newsDetail/newsDetail",
  624. component: () => import('./newsDetail-3A-Af3Wl.mjs')
  625. },
  626. {
  627. name: "primaryNavigation-newsList",
  628. path: "/primaryNavigation/newsList",
  629. meta: __nuxt_page_meta,
  630. component: () => import('./newsList-BwptwNCi.mjs')
  631. },
  632. {
  633. name: "register",
  634. path: "/register",
  635. component: () => import('./register-BaQ9c9VV.mjs')
  636. },
  637. {
  638. name: "topic-id",
  639. path: "/topic/:id()",
  640. component: () => import('./_id_-DK7UnuU6.mjs')
  641. },
  642. {
  643. name: "topic",
  644. path: "/topic",
  645. component: () => import('./index-DaBWgrPY.mjs')
  646. },
  647. {
  648. name: "user-about",
  649. path: "/user/about",
  650. component: () => import('./about-BQoZ6Vl3.mjs')
  651. }
  652. ];
  653. const _wrapIf = (component, props, slots) => {
  654. props = props === true ? {} : props;
  655. return { default: () => {
  656. var _a;
  657. return props ? h(component, props, slots) : (_a = slots.default) == null ? undefined : _a.call(slots);
  658. } };
  659. };
  660. const ROUTE_KEY_PARENTHESES_RE = /(:\w+)\([^)]+\)/g;
  661. const ROUTE_KEY_SYMBOLS_RE = /(:\w+)[?+*]/g;
  662. const ROUTE_KEY_NORMAL_RE = /:\w+/g;
  663. function generateRouteKey(route) {
  664. const source = (route == null ? undefined : route.meta.key) ?? route.path.replace(ROUTE_KEY_PARENTHESES_RE, "$1").replace(ROUTE_KEY_SYMBOLS_RE, "$1").replace(ROUTE_KEY_NORMAL_RE, (r) => {
  665. var _a;
  666. return ((_a = route.params[r.slice(1)]) == null ? undefined : _a.toString()) || "";
  667. });
  668. return typeof source === "function" ? source(route) : source;
  669. }
  670. function isChangingPage(to, from) {
  671. if (to === from || from === START_LOCATION) {
  672. return false;
  673. }
  674. if (generateRouteKey(to) !== generateRouteKey(from)) {
  675. return true;
  676. }
  677. const areComponentsSame = to.matched.every(
  678. (comp, index) => {
  679. var _a, _b;
  680. return comp.components && comp.components.default === ((_b = (_a = from.matched[index]) == null ? undefined : _a.components) == null ? undefined : _b.default);
  681. }
  682. );
  683. if (areComponentsSame) {
  684. return false;
  685. }
  686. return true;
  687. }
  688. const routerOptions0 = {
  689. scrollBehavior(to, from, savedPosition) {
  690. var _a;
  691. const nuxtApp = useNuxtApp();
  692. const behavior = ((_a = useRouter().options) == null ? undefined : _a.scrollBehaviorType) ?? "auto";
  693. let position = savedPosition || undefined;
  694. const routeAllowsScrollToTop = typeof to.meta.scrollToTop === "function" ? to.meta.scrollToTop(to, from) : to.meta.scrollToTop;
  695. if (!position && from && to && routeAllowsScrollToTop !== false && isChangingPage(to, from)) {
  696. position = { left: 0, top: 0 };
  697. }
  698. if (to.path === from.path) {
  699. if (from.hash && !to.hash) {
  700. return { left: 0, top: 0 };
  701. }
  702. if (to.hash) {
  703. return { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior };
  704. }
  705. return false;
  706. }
  707. const hasTransition = (route) => !!(route.meta.pageTransition ?? appPageTransition);
  708. const hookToWait = hasTransition(from) && hasTransition(to) ? "page:transition:finish" : "page:finish";
  709. return new Promise((resolve) => {
  710. nuxtApp.hooks.hookOnce(hookToWait, async () => {
  711. await new Promise((resolve2) => setTimeout(resolve2, 0));
  712. if (to.hash) {
  713. position = { el: to.hash, top: _getHashElementScrollMarginTop(to.hash), behavior };
  714. }
  715. resolve(position);
  716. });
  717. });
  718. }
  719. };
  720. function _getHashElementScrollMarginTop(selector) {
  721. try {
  722. const elem = (void 0).querySelector(selector);
  723. if (elem) {
  724. return (Number.parseFloat(getComputedStyle(elem).scrollMarginTop) || 0) + (Number.parseFloat(getComputedStyle((void 0).documentElement).scrollPaddingTop) || 0);
  725. }
  726. } catch {
  727. }
  728. return 0;
  729. }
  730. const configRouterOptions = {
  731. hashMode: false,
  732. scrollBehaviorType: "auto"
  733. };
  734. const routerOptions = {
  735. ...configRouterOptions,
  736. ...routerOptions0
  737. };
  738. const validate = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => {
  739. var _a;
  740. let __temp, __restore;
  741. if (!((_a = to.meta) == null ? undefined : _a.validate)) {
  742. return;
  743. }
  744. const nuxtApp = useNuxtApp();
  745. const router = useRouter();
  746. const result = ([__temp, __restore] = executeAsync(() => Promise.resolve(to.meta.validate(to))), __temp = await __temp, __restore(), __temp);
  747. if (result === true) {
  748. return;
  749. }
  750. const error = createError({
  751. statusCode: result && result.statusCode || 404,
  752. statusMessage: result && result.statusMessage || `Page Not Found: ${to.fullPath}`,
  753. data: {
  754. path: to.fullPath
  755. }
  756. });
  757. const unsub = router.beforeResolve((final) => {
  758. unsub();
  759. if (final === to) {
  760. const unsub2 = router.afterEach(async () => {
  761. unsub2();
  762. await nuxtApp.runWithContext(() => showError(error));
  763. });
  764. return false;
  765. }
  766. });
  767. });
  768. const manifest_45route_45rule = /* @__PURE__ */ defineNuxtRouteMiddleware(async (to) => {
  769. {
  770. return;
  771. }
  772. });
  773. const globalMiddleware = [
  774. validate,
  775. manifest_45route_45rule
  776. ];
  777. const namedMiddleware = {
  778. auth: () => import('./auth-DRRsgHvx.mjs')
  779. };
  780. const plugin = /* @__PURE__ */ defineNuxtPlugin({
  781. name: "nuxt:router",
  782. enforce: "pre",
  783. async setup(nuxtApp) {
  784. var _a, _b, _c;
  785. let __temp, __restore;
  786. let routerBase = (/* @__PURE__ */ useRuntimeConfig()).app.baseURL;
  787. const history = ((_a = routerOptions.history) == null ? undefined : _a.call(routerOptions, routerBase)) ?? createMemoryHistory(routerBase);
  788. const routes2 = routerOptions.routes ? ([__temp, __restore] = executeAsync(() => routerOptions.routes(_routes)), __temp = await __temp, __restore(), __temp) ?? _routes : _routes;
  789. let startPosition;
  790. const router = createRouter({
  791. ...routerOptions,
  792. scrollBehavior: (to, from, savedPosition) => {
  793. if (from === START_LOCATION) {
  794. startPosition = savedPosition;
  795. return;
  796. }
  797. if (routerOptions.scrollBehavior) {
  798. router.options.scrollBehavior = routerOptions.scrollBehavior;
  799. if ("scrollRestoration" in (undefined).history) {
  800. const unsub = router.beforeEach(() => {
  801. unsub();
  802. (undefined).history.scrollRestoration = "manual";
  803. });
  804. }
  805. return routerOptions.scrollBehavior(to, START_LOCATION, startPosition || savedPosition);
  806. }
  807. },
  808. history,
  809. routes: routes2
  810. });
  811. handleHotUpdate(router, routerOptions.routes ? routerOptions.routes : (routes22) => routes22);
  812. nuxtApp.vueApp.use(router);
  813. const previousRoute = shallowRef(router.currentRoute.value);
  814. router.afterEach((_to, from) => {
  815. previousRoute.value = from;
  816. });
  817. Object.defineProperty(nuxtApp.vueApp.config.globalProperties, "previousRoute", {
  818. get: () => previousRoute.value
  819. });
  820. const initialURL = nuxtApp.ssrContext.url;
  821. const _route = shallowRef(router.currentRoute.value);
  822. const syncCurrentRoute = () => {
  823. _route.value = router.currentRoute.value;
  824. };
  825. nuxtApp.hook("page:finish", syncCurrentRoute);
  826. router.afterEach((to, from) => {
  827. var _a2, _b2, _c2, _d;
  828. if (((_b2 = (_a2 = to.matched[0]) == null ? undefined : _a2.components) == null ? undefined : _b2.default) === ((_d = (_c2 = from.matched[0]) == null ? undefined : _c2.components) == null ? undefined : _d.default)) {
  829. syncCurrentRoute();
  830. }
  831. });
  832. const route = {};
  833. for (const key in _route.value) {
  834. Object.defineProperty(route, key, {
  835. get: () => _route.value[key],
  836. enumerable: true
  837. });
  838. }
  839. nuxtApp._route = shallowReactive(route);
  840. nuxtApp._middleware = nuxtApp._middleware || {
  841. global: [],
  842. named: {}
  843. };
  844. useError();
  845. if (!((_b = nuxtApp.ssrContext) == null ? undefined : _b.islandContext)) {
  846. router.afterEach(async (to, _from, failure) => {
  847. delete nuxtApp._processingMiddleware;
  848. if (failure) {
  849. await nuxtApp.callHook("page:loading:end");
  850. }
  851. if ((failure == null ? undefined : failure.type) === 4) {
  852. return;
  853. }
  854. if (to.redirectedFrom && to.fullPath !== initialURL) {
  855. await nuxtApp.runWithContext(() => navigateTo(to.fullPath || "/"));
  856. }
  857. });
  858. }
  859. try {
  860. if (true) {
  861. ;
  862. [__temp, __restore] = executeAsync(() => router.push(initialURL)), await __temp, __restore();
  863. ;
  864. }
  865. ;
  866. [__temp, __restore] = executeAsync(() => router.isReady()), await __temp, __restore();
  867. ;
  868. } catch (error2) {
  869. [__temp, __restore] = executeAsync(() => nuxtApp.runWithContext(() => showError(error2))), await __temp, __restore();
  870. }
  871. const resolvedInitialRoute = router.currentRoute.value;
  872. syncCurrentRoute();
  873. if ((_c = nuxtApp.ssrContext) == null ? undefined : _c.islandContext) {
  874. return { provide: { router } };
  875. }
  876. const initialLayout = nuxtApp.payload.state._layout;
  877. router.beforeEach(async (to, from) => {
  878. var _a2, _b2;
  879. await nuxtApp.callHook("page:loading:start");
  880. to.meta = reactive(to.meta);
  881. if (nuxtApp.isHydrating && initialLayout && !isReadonly(to.meta.layout)) {
  882. to.meta.layout = initialLayout;
  883. }
  884. nuxtApp._processingMiddleware = true;
  885. if (!((_a2 = nuxtApp.ssrContext) == null ? undefined : _a2.islandContext)) {
  886. const middlewareEntries = /* @__PURE__ */ new Set([...globalMiddleware, ...nuxtApp._middleware.global]);
  887. for (const component of to.matched) {
  888. const componentMiddleware = component.meta.middleware;
  889. if (!componentMiddleware) {
  890. continue;
  891. }
  892. for (const entry2 of toArray$1(componentMiddleware)) {
  893. middlewareEntries.add(entry2);
  894. }
  895. }
  896. {
  897. const routeRules = await nuxtApp.runWithContext(() => getRouteRules({ path: to.path }));
  898. if (routeRules.appMiddleware) {
  899. for (const key in routeRules.appMiddleware) {
  900. if (routeRules.appMiddleware[key]) {
  901. middlewareEntries.add(key);
  902. } else {
  903. middlewareEntries.delete(key);
  904. }
  905. }
  906. }
  907. }
  908. for (const entry2 of middlewareEntries) {
  909. const middleware = typeof entry2 === "string" ? nuxtApp._middleware.named[entry2] || await ((_b2 = namedMiddleware[entry2]) == null ? undefined : _b2.call(namedMiddleware).then((r) => r.default || r)) : entry2;
  910. if (!middleware) {
  911. throw new Error(`Unknown route middleware: '${entry2}'.`);
  912. }
  913. const result = await nuxtApp.runWithContext(() => middleware(to, from));
  914. {
  915. if (result === false || result instanceof Error) {
  916. const error2 = result || createError$1({
  917. statusCode: 404,
  918. statusMessage: `Page Not Found: ${initialURL}`
  919. });
  920. await nuxtApp.runWithContext(() => showError(error2));
  921. return false;
  922. }
  923. }
  924. if (result === true) {
  925. continue;
  926. }
  927. if (result || result === false) {
  928. return result;
  929. }
  930. }
  931. }
  932. });
  933. router.onError(async () => {
  934. delete nuxtApp._processingMiddleware;
  935. await nuxtApp.callHook("page:loading:end");
  936. });
  937. router.afterEach(async (to, _from) => {
  938. if (to.matched.length === 0) {
  939. await nuxtApp.runWithContext(() => showError(createError$1({
  940. statusCode: 404,
  941. fatal: false,
  942. statusMessage: `Page not found: ${to.fullPath}`,
  943. data: {
  944. path: to.fullPath
  945. }
  946. })));
  947. }
  948. });
  949. nuxtApp.hooks.hookOnce("app:created", async () => {
  950. try {
  951. if ("name" in resolvedInitialRoute) {
  952. resolvedInitialRoute.name = void 0;
  953. }
  954. await router.replace({
  955. ...resolvedInitialRoute,
  956. force: true
  957. });
  958. router.options.scrollBehavior = routerOptions.scrollBehavior;
  959. } catch (error2) {
  960. await nuxtApp.runWithContext(() => showError(error2));
  961. }
  962. });
  963. return { provide: { router } };
  964. }
  965. });
  966. function definePayloadReducer(name, reduce) {
  967. {
  968. useNuxtApp().ssrContext._payloadReducers[name] = reduce;
  969. }
  970. }
  971. const reducers = [
  972. ["NuxtError", (data) => isNuxtError(data) && data.toJSON()],
  973. ["EmptyShallowRef", (data) => isRef(data) && isShallow(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_")],
  974. ["EmptyRef", (data) => isRef(data) && !data.value && (typeof data.value === "bigint" ? "0n" : JSON.stringify(data.value) || "_")],
  975. ["ShallowRef", (data) => isRef(data) && isShallow(data) && data.value],
  976. ["ShallowReactive", (data) => isReactive(data) && isShallow(data) && toRaw(data)],
  977. ["Ref", (data) => isRef(data) && data.value],
  978. ["Reactive", (data) => isReactive(data) && toRaw(data)]
  979. ];
  980. const revive_payload_server_eJ33V7gbc6 = /* @__PURE__ */ defineNuxtPlugin({
  981. name: "nuxt:revive-payload:server",
  982. setup() {
  983. for (const [reducer, fn] of reducers) {
  984. definePayloadReducer(reducer, fn);
  985. }
  986. }
  987. });
  988. const components_plugin_KR1HBZs4kY = /* @__PURE__ */ defineNuxtPlugin({
  989. name: "nuxt:global-components"
  990. });
  991. const element_plus_elM4AXquKi = /* @__PURE__ */ defineNuxtPlugin(() => {
  992. });
  993. const pinia_Uphuq97G1L = /* @__PURE__ */ defineNuxtPlugin((nuxtApp) => {
  994. const pinia = createPinia();
  995. nuxtApp.vueApp.use(pinia);
  996. return {
  997. provide: {
  998. pinia
  999. }
  1000. };
  1001. });
  1002. function toArray(value) {
  1003. return Array.isArray(value) ? value : [value];
  1004. }
  1005. function useRequestEvent(nuxtApp = useNuxtApp()) {
  1006. var _a;
  1007. return (_a = nuxtApp.ssrContext) == null ? undefined : _a.event;
  1008. }
  1009. function prerenderRoutes(path) {
  1010. const paths = toArray(path);
  1011. appendHeader(useRequestEvent(), "x-nitro-prerender", paths.map((p) => encodeURIComponent(p)).join(", "));
  1012. }
  1013. let routes;
  1014. const prerender_server_LXx1wM9sKF = /* @__PURE__ */ defineNuxtPlugin(async () => {
  1015. let __temp, __restore;
  1016. if (routes && !routes.length) {
  1017. return;
  1018. }
  1019. (/* @__PURE__ */ useRuntimeConfig()).nitro.routeRules;
  1020. routes || (routes = Array.from(processRoutes(([__temp, __restore] = executeAsync(() => {
  1021. var _a;
  1022. return (_a = routerOptions.routes) == null ? undefined : _a.call(routerOptions, _routes);
  1023. }), __temp = await __temp, __restore(), __temp) ?? _routes)));
  1024. const batch = routes.splice(0, 10);
  1025. prerenderRoutes(batch);
  1026. });
  1027. const OPTIONAL_PARAM_RE = /^\/?:.*(?:\?|\(\.\*\)\*)$/;
  1028. function shouldPrerender(path) {
  1029. return true;
  1030. }
  1031. function processRoutes(routes2, currentPath = "/", routesToPrerender = /* @__PURE__ */ new Set()) {
  1032. var _a;
  1033. for (const route of routes2) {
  1034. if (OPTIONAL_PARAM_RE.test(route.path) && !((_a = route.children) == null ? undefined : _a.length) && shouldPrerender()) {
  1035. routesToPrerender.add(currentPath);
  1036. }
  1037. if (route.path.includes(":")) {
  1038. continue;
  1039. }
  1040. const fullPath = joinURL(currentPath, route.path);
  1041. {
  1042. routesToPrerender.add(fullPath);
  1043. }
  1044. if (route.children) {
  1045. processRoutes(route.children, fullPath, routesToPrerender);
  1046. }
  1047. }
  1048. return routesToPrerender;
  1049. }
  1050. const plugins = [
  1051. unhead_KgADcZ0jPj,
  1052. plugin,
  1053. revive_payload_server_eJ33V7gbc6,
  1054. components_plugin_KR1HBZs4kY,
  1055. element_plus_elM4AXquKi,
  1056. pinia_Uphuq97G1L,
  1057. prerender_server_LXx1wM9sKF
  1058. ];
  1059. const layouts = {};
  1060. const LayoutLoader = defineComponent({
  1061. name: "LayoutLoader",
  1062. inheritAttrs: false,
  1063. props: {
  1064. name: String,
  1065. layoutProps: Object
  1066. },
  1067. setup(props, context) {
  1068. return () => h(layouts[props.name], props.layoutProps, context.slots);
  1069. }
  1070. });
  1071. const __nuxt_component_0 = defineComponent({
  1072. name: "NuxtLayout",
  1073. inheritAttrs: false,
  1074. props: {
  1075. name: {
  1076. type: [String, Boolean, Object],
  1077. default: null
  1078. },
  1079. fallback: {
  1080. type: [String, Object],
  1081. default: null
  1082. }
  1083. },
  1084. setup(props, context) {
  1085. const nuxtApp = useNuxtApp();
  1086. const injectedRoute = inject(PageRouteSymbol);
  1087. const route = injectedRoute === useRoute() ? useRoute$1() : injectedRoute;
  1088. const layout = computed(() => {
  1089. let layout2 = unref(props.name) ?? route.meta.layout ?? "default";
  1090. if (layout2 && !(layout2 in layouts)) {
  1091. if (props.fallback) {
  1092. layout2 = unref(props.fallback);
  1093. }
  1094. }
  1095. return layout2;
  1096. });
  1097. const layoutRef = ref();
  1098. context.expose({ layoutRef });
  1099. const done = nuxtApp.deferHydration();
  1100. return () => {
  1101. const hasLayout = layout.value && layout.value in layouts;
  1102. const transitionProps = route.meta.layoutTransition ?? appLayoutTransition;
  1103. return _wrapIf(Transition, hasLayout && transitionProps, {
  1104. default: () => h(Suspense, { suspensible: true, onResolve: () => {
  1105. nextTick(done);
  1106. } }, {
  1107. default: () => h(
  1108. LayoutProvider,
  1109. {
  1110. layoutProps: mergeProps(context.attrs, { ref: layoutRef }),
  1111. key: layout.value || undefined,
  1112. name: layout.value,
  1113. shouldProvide: !props.name,
  1114. hasTransition: !!transitionProps
  1115. },
  1116. context.slots
  1117. )
  1118. })
  1119. }).default();
  1120. };
  1121. }
  1122. });
  1123. const LayoutProvider = defineComponent({
  1124. name: "NuxtLayoutProvider",
  1125. inheritAttrs: false,
  1126. props: {
  1127. name: {
  1128. type: [String, Boolean]
  1129. },
  1130. layoutProps: {
  1131. type: Object
  1132. },
  1133. hasTransition: {
  1134. type: Boolean
  1135. },
  1136. shouldProvide: {
  1137. type: Boolean
  1138. }
  1139. },
  1140. setup(props, context) {
  1141. const name = props.name;
  1142. if (props.shouldProvide) {
  1143. provide(LayoutMetaSymbol, {
  1144. isCurrent: (route) => name === (route.meta.layout ?? "default")
  1145. });
  1146. }
  1147. return () => {
  1148. var _a, _b;
  1149. if (!name || typeof name === "string" && !(name in layouts)) {
  1150. return (_b = (_a = context.slots).default) == null ? undefined : _b.call(_a);
  1151. }
  1152. return h(
  1153. LayoutLoader,
  1154. { key: name, layoutProps: props.layoutProps, name },
  1155. context.slots
  1156. );
  1157. };
  1158. }
  1159. });
  1160. const RouteProvider = defineComponent({
  1161. props: {
  1162. vnode: {
  1163. type: Object,
  1164. required: true
  1165. },
  1166. route: {
  1167. type: Object,
  1168. required: true
  1169. },
  1170. vnodeRef: Object,
  1171. renderKey: String,
  1172. trackRootNodes: Boolean
  1173. },
  1174. setup(props) {
  1175. const previousKey = props.renderKey;
  1176. const previousRoute = props.route;
  1177. const route = {};
  1178. for (const key in props.route) {
  1179. Object.defineProperty(route, key, {
  1180. get: () => previousKey === props.renderKey ? props.route[key] : previousRoute[key],
  1181. enumerable: true
  1182. });
  1183. }
  1184. provide(PageRouteSymbol, shallowReactive(route));
  1185. return () => {
  1186. return h(props.vnode, { ref: props.vnodeRef });
  1187. };
  1188. }
  1189. });
  1190. const __nuxt_component_1 = defineComponent({
  1191. name: "NuxtPage",
  1192. inheritAttrs: false,
  1193. props: {
  1194. name: {
  1195. type: String
  1196. },
  1197. transition: {
  1198. type: [Boolean, Object],
  1199. default: undefined
  1200. },
  1201. keepalive: {
  1202. type: [Boolean, Object],
  1203. default: undefined
  1204. },
  1205. route: {
  1206. type: Object
  1207. },
  1208. pageKey: {
  1209. type: [Function, String],
  1210. default: null
  1211. }
  1212. },
  1213. setup(props, { attrs, slots, expose }) {
  1214. const nuxtApp = useNuxtApp();
  1215. const pageRef = ref();
  1216. const forkRoute = inject(PageRouteSymbol, null);
  1217. let previousPageKey;
  1218. expose({ pageRef });
  1219. inject(LayoutMetaSymbol, null);
  1220. let vnode;
  1221. const done = nuxtApp.deferHydration();
  1222. if (props.pageKey) {
  1223. watch(() => props.pageKey, (next, prev) => {
  1224. if (next !== prev) {
  1225. nuxtApp.callHook("page:loading:start");
  1226. }
  1227. });
  1228. }
  1229. return () => {
  1230. return h(RouterView, { name: props.name, route: props.route, ...attrs }, {
  1231. default: (routeProps) => {
  1232. if (!routeProps.Component) {
  1233. done();
  1234. return;
  1235. }
  1236. const key = generateRouteKey$1(routeProps, props.pageKey);
  1237. if (!nuxtApp.isHydrating && !hasChildrenRoutes(forkRoute, routeProps.route, routeProps.Component) && previousPageKey === key) {
  1238. nuxtApp.callHook("page:loading:end");
  1239. }
  1240. previousPageKey = key;
  1241. const hasTransition = !!(props.transition ?? routeProps.route.meta.pageTransition ?? appPageTransition);
  1242. const transitionProps = hasTransition && _mergeTransitionProps([
  1243. props.transition,
  1244. routeProps.route.meta.pageTransition,
  1245. appPageTransition,
  1246. { onAfterLeave: () => {
  1247. nuxtApp.callHook("page:transition:finish", routeProps.Component);
  1248. } }
  1249. ].filter(Boolean));
  1250. const keepaliveConfig = props.keepalive ?? routeProps.route.meta.keepalive ?? appKeepalive;
  1251. vnode = _wrapIf(
  1252. Transition,
  1253. hasTransition && transitionProps,
  1254. wrapInKeepAlive(
  1255. keepaliveConfig,
  1256. h(Suspense, {
  1257. suspensible: true,
  1258. onPending: () => nuxtApp.callHook("page:start", routeProps.Component),
  1259. onResolve: () => {
  1260. nextTick(() => nuxtApp.callHook("page:finish", routeProps.Component).then(() => nuxtApp.callHook("page:loading:end")).finally(done));
  1261. }
  1262. }, {
  1263. default: () => {
  1264. const providerVNode = h(RouteProvider, {
  1265. key: key || undefined,
  1266. vnode: slots.default ? h(Fragment, undefined, slots.default(routeProps)) : routeProps.Component,
  1267. route: routeProps.route,
  1268. renderKey: key || undefined,
  1269. trackRootNodes: hasTransition,
  1270. vnodeRef: pageRef
  1271. });
  1272. return providerVNode;
  1273. }
  1274. })
  1275. )
  1276. ).default();
  1277. return vnode;
  1278. }
  1279. });
  1280. };
  1281. }
  1282. });
  1283. function _mergeTransitionProps(routeProps) {
  1284. const _props = routeProps.map((prop) => ({
  1285. ...prop,
  1286. onAfterLeave: prop.onAfterLeave ? toArray$1(prop.onAfterLeave) : undefined
  1287. }));
  1288. return defu(..._props);
  1289. }
  1290. function hasChildrenRoutes(fork, newRoute, Component) {
  1291. if (!fork) {
  1292. return false;
  1293. }
  1294. const index = newRoute.matched.findIndex((m) => {
  1295. var _a;
  1296. return ((_a = m.components) == null ? undefined : _a.default) === (Component == null ? undefined : Component.type);
  1297. });
  1298. return index < newRoute.matched.length - 1;
  1299. }
  1300. const _export_sfc = (sfc, props) => {
  1301. const target = sfc.__vccOpts || sfc;
  1302. for (const [key, val] of props) {
  1303. target[key] = val;
  1304. }
  1305. return target;
  1306. };
  1307. const _sfc_main$2 = {};
  1308. function _sfc_ssrRender(_ctx, _push, _parent, _attrs) {
  1309. const _component_NuxtLayout = __nuxt_component_0;
  1310. const _component_NuxtPage = __nuxt_component_1;
  1311. _push(`<div${ssrRenderAttrs(mergeProps({ class: "sannong" }, _attrs))} data-v-8c698bba>`);
  1312. _push(ssrRenderComponent(_component_NuxtLayout, null, {
  1313. default: withCtx((_, _push2, _parent2, _scopeId) => {
  1314. if (_push2) {
  1315. _push2(ssrRenderComponent(_component_NuxtPage, null, null, _parent2, _scopeId));
  1316. } else {
  1317. return [
  1318. createVNode(_component_NuxtPage)
  1319. ];
  1320. }
  1321. }),
  1322. _: 1
  1323. }, _parent));
  1324. _push(`</div>`);
  1325. }
  1326. const _sfc_setup$2 = _sfc_main$2.setup;
  1327. _sfc_main$2.setup = (props, ctx) => {
  1328. const ssrContext = useSSRContext();
  1329. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("app.vue");
  1330. return _sfc_setup$2 ? _sfc_setup$2(props, ctx) : undefined;
  1331. };
  1332. const AppComponent = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["ssrRender", _sfc_ssrRender], ["__scopeId", "data-v-8c698bba"]]);
  1333. const _sfc_main$1 = {
  1334. __name: "nuxt-error-page",
  1335. __ssrInlineRender: true,
  1336. props: {
  1337. error: Object
  1338. },
  1339. setup(__props) {
  1340. const props = __props;
  1341. const _error = props.error;
  1342. _error.stack ? _error.stack.split("\n").splice(1).map((line) => {
  1343. const text = line.replace("webpack:/", "").replace(".vue", ".js").trim();
  1344. return {
  1345. text,
  1346. internal: line.includes("node_modules") && !line.includes(".cache") || line.includes("internal") || line.includes("new Promise")
  1347. };
  1348. }).map((i) => `<span class="stack${i.internal ? " internal" : ""}">${i.text}</span>`).join("\n") : "";
  1349. const statusCode = Number(_error.statusCode || 500);
  1350. const is404 = statusCode === 404;
  1351. const statusMessage = _error.statusMessage ?? (is404 ? "Page Not Found" : "Internal Server Error");
  1352. const description = _error.message || _error.toString();
  1353. const stack = undefined;
  1354. const _Error404 = defineAsyncComponent(() => import('./error-404-BGB5EDvk.mjs'));
  1355. const _Error = defineAsyncComponent(() => import('./error-500-DD6Lyp77.mjs'));
  1356. const ErrorTemplate = is404 ? _Error404 : _Error;
  1357. return (_ctx, _push, _parent, _attrs) => {
  1358. _push(ssrRenderComponent(unref(ErrorTemplate), mergeProps({ statusCode: unref(statusCode), statusMessage: unref(statusMessage), description: unref(description), stack: unref(stack) }, _attrs), null, _parent));
  1359. };
  1360. }
  1361. };
  1362. const _sfc_setup$1 = _sfc_main$1.setup;
  1363. _sfc_main$1.setup = (props, ctx) => {
  1364. const ssrContext = useSSRContext();
  1365. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-error-page.vue");
  1366. return _sfc_setup$1 ? _sfc_setup$1(props, ctx) : undefined;
  1367. };
  1368. const _sfc_main = {
  1369. __name: "nuxt-root",
  1370. __ssrInlineRender: true,
  1371. setup(__props) {
  1372. const IslandRenderer = () => null;
  1373. const nuxtApp = useNuxtApp();
  1374. nuxtApp.deferHydration();
  1375. nuxtApp.ssrContext.url;
  1376. const SingleRenderer = false;
  1377. provide(PageRouteSymbol, useRoute());
  1378. nuxtApp.hooks.callHookWith((hooks) => hooks.map((hook) => hook()), "vue:setup");
  1379. const error = useError();
  1380. const abortRender = error.value && !nuxtApp.ssrContext.error;
  1381. onErrorCaptured((err, target, info) => {
  1382. nuxtApp.hooks.callHook("vue:error", err, target, info).catch((hookError) => console.error("[nuxt] Error in `vue:error` hook", hookError));
  1383. {
  1384. const p = nuxtApp.runWithContext(() => showError(err));
  1385. onServerPrefetch(() => p);
  1386. return false;
  1387. }
  1388. });
  1389. const islandContext = nuxtApp.ssrContext.islandContext;
  1390. return (_ctx, _push, _parent, _attrs) => {
  1391. ssrRenderSuspense(_push, {
  1392. default: () => {
  1393. if (unref(abortRender)) {
  1394. _push(`<div></div>`);
  1395. } else if (unref(error)) {
  1396. _push(ssrRenderComponent(unref(_sfc_main$1), { error: unref(error) }, null, _parent));
  1397. } else if (unref(islandContext)) {
  1398. _push(ssrRenderComponent(unref(IslandRenderer), { context: unref(islandContext) }, null, _parent));
  1399. } else if (unref(SingleRenderer)) {
  1400. ssrRenderVNode(_push, createVNode(resolveDynamicComponent(unref(SingleRenderer)), null, null), _parent);
  1401. } else {
  1402. _push(ssrRenderComponent(unref(AppComponent), null, null, _parent));
  1403. }
  1404. },
  1405. _: 1
  1406. });
  1407. };
  1408. }
  1409. };
  1410. const _sfc_setup = _sfc_main.setup;
  1411. _sfc_main.setup = (props, ctx) => {
  1412. const ssrContext = useSSRContext();
  1413. (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("node_modules/nuxt/dist/app/components/nuxt-root.vue");
  1414. return _sfc_setup ? _sfc_setup(props, ctx) : undefined;
  1415. };
  1416. let entry;
  1417. {
  1418. entry = async function createNuxtAppServer(ssrContext) {
  1419. const vueApp = createApp(_sfc_main);
  1420. const nuxt = createNuxtApp({ vueApp, ssrContext });
  1421. try {
  1422. await applyPlugins(nuxt, plugins);
  1423. await nuxt.hooks.callHook("app:created", vueApp);
  1424. } catch (error) {
  1425. await nuxt.hooks.callHook("app:error", error);
  1426. nuxt.payload.error = nuxt.payload.error || createError(error);
  1427. }
  1428. if (ssrContext == null ? undefined : ssrContext._renderResponse) {
  1429. throw new Error("skipping render");
  1430. }
  1431. return vueApp;
  1432. };
  1433. }
  1434. const entry$1 = (ssrContext) => entry(ssrContext);
  1435. export { _export_sfc as _, navigateTo as a, useNuxtApp as b, useRuntimeConfig as c, resolveUnrefHeadInput as d, entry$1 as default, useRoute as e, injectHead as i, nuxtLinkDefaults as n, resolveRouteObject as r, useRouter as u };
  1436. //# sourceMappingURL=server.mjs.map